@tight-embedded/react 6.8.1 → 6.9.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.js CHANGED
@@ -1,3 +1,2 @@
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,useContext as i,createContext as l,useEffect as s,Component as c,useState as d,useCallback as u,createElement as h,forwardRef as p,useLayoutEffect as g,useImperativeHandle as m,useReducer as v,Fragment as f}from"react";import"zustand/react/shallow";import{cloneDeep as b,entries as y,mapValues as C,isEqual as x,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 S}from"zod";import{jsx as I,Fragment as N,jsxs as P}from"react/jsx-runtime";import{QueryClient as R,useIsRestoring as D,useQuery as M,keepPreviousData as L,useMutationState as F,useMutation as O,useQueries as V,useInfiniteQuery as U}from"@tanstack/react-query";import B from"yocto-queue";import H from"big.js";import{ResponsiveContainer as W,BarChart as _,Legend as q,CartesianGrid as z,XAxis as j,YAxis as K,Tooltip as Y,Bar as Z,ReferenceLine as G,Line as Q}from"recharts";import{flexRender as X,createColumnHelper as J,useReactTable as $,getCoreRowModel as ee,getExpandedRowModel as te}from"@tanstack/react-table";import{useFloatingNodeId as ne,useFloating as re,offset as ae,flip as oe,shift as ie,size as le,autoUpdate as se,useClick as ce,useDismiss as de,useRole as ue,useInteractions as he,useFloatingParentNodeId as pe,FloatingTree as ge,FloatingNode as me,useMergeRefs as ve,FloatingPortal as fe,FloatingOverlay as be,FloatingFocusManager as ye}from"@floating-ui/react";import{ContextAwareConfirmation as Ce,confirmable as xe}from"react-confirm";import{createFormHookContexts as Te,useStore as we,createFormHook as ke}from"@tanstack/react-form";import{NumericFormat as Ee}from"react-number-format";import Ae from"fuse.js";import Se from"react-inlinesvg";import{AnimatePresence as Ie,motion as Ne}from"motion/react";import{useDropzone as Pe}from"react-dropzone";import{useNavigate as Re,useMatches as De,Outlet as Me,createMemoryRouter as Le,RouterProvider as Fe,useLocation as Oe,MemoryRouter as Ve,Routes as Ue,Route as Be}from"tight-react-router";import{openDB as He}from"idb";import{PersistQueryClientProvider as We}from"@tanstack/react-query-persist-client";import{fetchEventSource as _e}from"@microsoft/fetch-event-source";import{Toast as qe,createToaster as ze,Toaster as je}from"@ark-ui/react/toast";import{Portal as Ke}from"@ark-ui/react/portal";function Ye(e,t){return`${e.trim()}:${t.trim()}`}const Ze=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,FEATUREFLAG_GENERAL_LEDGER:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,Ye("featureFlags","updateFlags"))});function Ge(){return gn(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function Qe(){return gn(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}let Xe=null,Je=!1;function $e(){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 et(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function tt(){const e=$e();if(!e)return;const{meta:t,params:n}=e;if(Je)return t.remove(),Je=!1,void(Xe=null);Xe?n["interactive-widget"]=Xe:delete n["interactive-widget"],Xe=null,et(t,n)}const nt="drawerNavigation",rt=(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=$e();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),Je=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;Xe=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",et(t,n)}(),{drawerHistory:[o]};{const t=b(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,Ye(nt,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,Ye(nt,"closeDrawer")),0===t().drawerHistory.length&&tt()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,Ye(nt,"closeAllDrawers")),tt()},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,Ye(nt,"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,Ye(nt,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,Ye(nt,"confirmCloseDrawer")),0===t().drawerHistory.length&&tt()}}),at=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,Ye("externalOptions","setOptions"))});function ot(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function it(e){return Array.isArray(e)&&e.length>0}function lt(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 st="search",ct=lt({key:st,name:"Search"});function dt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function ut(e,t,n){return new Date(e,t,n)}function ht(e){const[t,n,r]=e.split("-");return ut(Number(t),Number(n),Number(r))}function pt(){return dt(ut(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function gt(e,t){return dt(ut(t,e,1))}function mt(){const e=/* @__PURE__ */new Date;return dt(ut(e.getFullYear(),e.getMonth()+1,0))}function vt(e){const t=/* @__PURE__ */new Date;return dt(ut(t.getFullYear(),t.getMonth()-e,1))}function ft(e){const t=e.getMonth(),n=t-t%3;return dt(ut(e.getFullYear(),n,1))}function bt(e){const t=e.getMonth(),n=t-t%3+3;return dt(ut(e.getFullYear(),n,0))}const yt={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"},Ct={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"},xt=e=>Object.values(yt).includes(e),Tt={[yt.ALL_TIME]:()=>"",[yt.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return gt(e.getMonth(),e.getFullYear())}(),[yt.LAST_YEAR]:()=>dt(ut(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[yt.LAST_MONTH]:()=>vt(1),[yt.LAST_6_MONTHS]:()=>vt(5),[yt.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return dt(ut(e.getFullYear(),e.getMonth()-11,1))}(),[yt.THIS_YEAR]:()=>dt(ut(/* @__PURE__ */(new Date).getFullYear(),0,1)),[yt.LAST_3_MONTHS]:()=>vt(2),[yt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ft(ut(e.getFullYear(),e.getMonth()-3,1))}(),[yt.THIS_QUARTER]:()=>ft(/* @__PURE__ */new Date)};function wt(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 kt=e=>Tt[e](),Et={[yt.ALL_TIME]:()=>"",[yt.THIS_MONTH]:()=>mt(),[yt.LAST_YEAR]:()=>dt(ut(/* @__PURE__ */(new Date).getFullYear(),0,0)),[yt.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return dt(ut(e.getFullYear(),e.getMonth(),0))}(),[yt.LAST_6_MONTHS]:()=>mt(),[yt.LAST_12_MONTHS]:()=>mt(),[yt.THIS_YEAR]:()=>pt(),[yt.LAST_3_MONTHS]:()=>mt(),[yt.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return bt(ut(e.getFullYear(),e.getMonth()-3,1))}(),[yt.THIS_QUARTER]:()=>bt(/* @__PURE__ */new Date)},At=e=>Et[e](),St=e=>{return xt(e)?{beginDate:kt(e),endDate:At(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:dt((t=e).beginDate),endDate:dt(t.endDate)};var t},It=["SUN","MON","TUE","WED","THU","FRI","SAT"],Nt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Pt({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 Rt(e,t){return e.toDateString()===t.toDateString()}function Dt(e){return Rt(e,/* @__PURE__ */new Date)}function Mt(e,t){const n=ut(e.getFullYear(),e.getMonth(),e.getDate()),r=ut(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function Lt(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 Ft(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=ut(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function Ot(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 Ft(o,i,l)?ut(l,o-1,i):null}function Vt(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 Ft(i,l,o)?ut(o,i-1,l):null}function Ut(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 Bt(e,t){return Mt(e,t)?t:e}function Ht(e,t){return Mt(t,e)?t:e}const Wt=(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},_t=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return Dt(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Wt(t,{abbreviateMonth:!0,abbreviateYear:!1})},qt=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function zt(e,t){return ut(e.getFullYear(),e.getMonth(),e.getDate()+t)}function jt(e){const{month:t,year:n}=e;return{beginDate:ut(n,t-1,1),endDate:ut(n,t+1,0)}}const Kt="date",Yt=Object.values(yt).map(e=>{return{name:Ct[t=e],value:{date:{name:Ct[t],value:t}}};var t}),Zt=lt({key:Kt,name:"Date",possibleValues:()=>({values:Yt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function Gt(e){return"OWNER"===e||"READ_ONLY"===e}function Qt(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===st);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==st)}const Xt=Zt.createFilter({name:Ct[yt.LAST_12_MONTHS],value:{date:{name:Ct[yt.LAST_12_MONTHS],value:yt.LAST_12_MONTHS}}});function Jt(e,t){return Qt([...t.some(e=>e.modelKey===Kt)?function(e){const t=e.findIndex(e=>e.modelKey===Kt);return-1!==t?ot(e,t):e}(e.filters):e.filters,...t])}function $t(e,t){const n=e.filters[t];return n&&n.modelKey===Kt?function(e,t){const n=[...e];return n[t]=Xt,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function en(e){return Qt(e.some(e=>e.modelKey===Kt)?e:[...e,Xt])}function tn(e,t){if(e.hasInitialized)return e;const n=[];return Gt(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(Xt),{filters:n,hasInitialized:!0}}const nn="transactionsDashboardFilters",rn=e=>({transactionsDashboardFilters:[Xt],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Jt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ye(nn,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:$t({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ye(nn,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:en(t)}),void 0,Ye(nn,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=tn({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,Ye(nn,"initialize"))}),an="expenseDashboardFilters",on=e=>({expenseDashboardFilters:[Xt],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Jt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ye(an,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:$t({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ye(an,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:en(t)}),void 0,Ye(an,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=tn({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,Ye(an,"initialize"))}),ln="incomeDashboardFilters",sn=e=>({incomeDashboardFilters:[Xt],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Jt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ye(ln,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:$t({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ye(ln,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:en(t)}),void 0,Ye(ln,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=tn({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,Ye(ln,"initialize"))}),cn={label:"Connected Accounts",value:"connected"},dn="banksAndIntegrationsState",un=e=>({banksAndIntegrationsSelectedTab:cn,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,Ye(dn,"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,Ye(dn,"toggleExpandedIntegration"))}),hn={plaidLink:null,plaidLinkEvent:null,plaidLinkError:null,gusto:null,payroll:null,bITile:null,conversations:null,bill:null,transactionForm:null,bankTransactionForm:null,processorTransactionForm:null,customer:null},pn=e=>({events:hn,setEvents:t=>e(e=>({events:{...e.events,...t}}),void 0,Ye("events","setEvents"))}),gn=e()(t(n((...e)=>({...Ze(...e),...rt(...e),...at(...e),...rn(...e),...on(...e),...sn(...e),...un(...e),...pn(...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})),mn={SELECT:"select",EXPAND:"expand"},vn={...mn,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},fn=[vn.COMMENTS,vn.DATE,vn.DESCRIPTION,vn.AMOUNT,vn.CATEGORY,vn.DIMENSION_VALUE,vn.REVIEW_STATUS],bn=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(fn)))}),yn=e=>{const t=bn.safeParse(e);return t.success?t.data:void 0},Cn=A.optional(A.string().trim()),xn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Tn=A.optional(A.array(A.string().trim())),wn=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())}),kn={transactionsDashboard:yn,incomeDashboard:yn,expenseDashboard:yn,accessToken:e=>{const t=Cn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=Tn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>xn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=wn.safeParse(e);return t.success?t.data:void 0}},En=(e,t)=>{if(void 0!==kn[e])return(0,kn[e])(t)};function An(e){const t=a(!1),n=gn(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=En(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=gn(e=>e.externalOptions);return{options:o(()=>b(r),[r]),setOptions:n}}const Sn=l(null);function In(){return i(Sn)}function Nn(e){const t=a(!1),n=gn(e=>e.setEvents);return s(()=>{e&&!t.current&&(n(e),t.current=!0)},[e,n]),[gn(e=>e.events),n]}function Pn(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Rn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function Dn(e){return String.fromCharCode(e+(e>25?39:97))}function Mn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Dn(t%52)+n;return Dn(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var Ln=/\s*!(important)?/i;function Fn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var On=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}},Vn=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Un(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(Vn.has(n))return;const r=e[n],a=t[n];Pn(r)&&Pn(a)?e[n]=Un(r,a):e[n]=a}),e):e,{})}var Bn=e=>null!=e;function Hn(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);Bn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Wn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return Hn(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 _n={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},qn=/([A-Z])/g,zn=/^ms-/,jn=On(e=>e.startsWith("--")?e:e.replace(qn,"-$1").replace(zn,"-ms-").toLowerCase()),Kn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),Yn=`(?:${"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("|")})`,Zn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${Yn}$`),Gn={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):Pn(e)?Hn(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&Kn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&Zn.test(e)},Qn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Rn(t))};const Xn=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,_themeBizhub,base".split(",")),Jn=/^@|&|&$/;function $n(e){return Xn.has(e)||Jn.test(e)}const er=/^_/,tr=/&|@/,nr=/* @__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(":");nr.set(t,n)});const rr={conditions:{shift:function(e){return e.sort((e,t)=>{const n=$n(e),r=$n(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Xn.has(e)?e.replace(er,""):tr.test(e)?`[${Fn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${nr.get(e)||jn(e)}_${Fn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},ar=function(e){const{utility:t,hash:n,conditions:r=_n}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return On(({base:o,...i}={})=>{const l=Wn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return Hn(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&Ln.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(Ln,"").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,Mn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}(rr),or=(...e)=>ar(ir(...e));or.raw=(...e)=>ir(...e);const{mergeCss:ir}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>Pn(e)&&Object.keys(Rn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Wn(t,e))}return{mergeCss:On(function(...e){return Un(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}(rr);function lr(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const sr=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function cr(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=sr(e),o=e=>({...r,...Rn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=ir(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=ir(n,e.css))}),n}(a,r);return ir(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(On(function(e){return or(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=sr(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 cr({base:ir(t,o.base),variants:Object.fromEntries(i.map(e=>[e,ir(n[e],o.variants[e])])),defaultVariants:Un(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 dr,ur=((dr=ur||{}).component="component",dr["dashboard-placeholder-table"]="dashboard-placeholder-table",dr["dashboard-header"]="dashboard-header",dr["dashboard-table"]="dashboard-table",dr["dashboard-table-body"]="dashboard-table-body",dr["dashboard-table-cell"]="dashboard-table-cell",dr["dashboard-table-column-header"]="dashboard-table-column-header",dr["dashboard-table-header"]="dashboard-table-header",dr.label="label",dr.popup="popup",dr["popup-sort-row"]="popup-sort-row",dr["progress-bar"]="progress-bar",dr["progress-bar-fill"]="progress-bar-fill",dr.drawer="drawer",dr.summation="summation",dr["table-parent-row"]="table-parent-row",dr["table-row"]="table-row",dr["table-sub-row"]="table-sub-row",dr.tile="tile",dr["tile-bar-label"]="tile-bar-label",dr["tile-bar-label-outer"]="tile-bar-label-outer",dr["tile-body"]="tile-body",dr["tile-filter-button"]="tile-filter-button",dr["tile-filter-list"]="tile-filter-list",dr["tile-filter-row"]="tile-filter-row",dr["tile-header"]="tile-header",dr["business-owner-dashboard"]="business-owner-dashboard",dr["business-owner-dashboard-header"]="business-owner-dashboard-header",dr["transaction-type-label"]="transaction-type-label",dr["transaction-date-cell-container"]="transaction-date-cell-container",dr["selector-row"]="selector-row",dr["popup-list"]="popup-list",dr.badge="badge",dr["badge-chip"]="badge-chip",dr["date-cell"]="date-cell",dr["vertical-divider"]="vertical-divider",dr["horizontal-divider"]="horizontal-divider",dr["checkbox-input"]="checkbox-input",dr["bulk-select"]="bulk-select",dr["button-base"]="button-base",dr["button-discreet-small"]="button-discreet-small",dr["button-primary"]="button-primary",dr["button-secondary"]="button-secondary",dr["button-success"]="button-success",dr["button-danger"]="button-danger",dr["button-warning"]="button-warning",dr["button-action"]="button-action",dr["button-table-header"]="button-table-header",dr["button-inline"]="button-inline",dr["small-square-button"]="small-square-button",dr.card="card",dr["card-button"]="card-button",dr["card-button-icon-container"]="card-button-icon-container",dr["pagination-button"]="pagination-button",dr.text="text",dr["cell-button"]="cell-button",dr["selector-button"]="selector-button",dr["review-status-selector-button"]="review-status-selector-button",dr["review-status-dropdown-arrow"]="review-status-dropdown-arrow",dr["financial-summary-layout"]="financial-summary-layout",dr["financial-summary-chatbox"]="financial-summary-chatbox",dr["financial-summary-chatbox-header"]="financial-summary-chatbox-header",dr["month-picker"]="month-picker",dr["month-picker-left-button"]="month-picker-left-button",dr["month-picker-right-button"]="month-picker-right-button",dr["month-picker-label"]="month-picker-label",dr["filter-bar"]="filter-bar",dr["filter-search-bar"]="filter-search-bar",dr.pill="pill",dr["filter-pill"]="filter-pill",dr["email-pill"]="email-pill",dr["discreet-form-input"]="discreet-form-input",dr["editable-form-input"]="editable-form-input",dr["amount-input"]="amount-input",dr["modal-popup"]="modal-popup",dr["drawer-header"]="drawer-header",dr["form-body"]="form-body",dr.body="body",dr.heading="heading",dr["sub-label"]="sub-label",dr["strong-label"]="strong-label",dr["strong-sub-label"]="strong-sub-label",dr["weak-label"]="weak-label",dr["metric-xl"]="metric-xl",dr["metric-md"]="metric-md",dr["large-icon"]="large-icon",dr["medium-icon"]="medium-icon",dr["small-icon"]="small-icon",dr["tiny-icon"]="tiny-icon",dr["x-large-icon"]="x-large-icon",dr["xx-large-icon"]="xx-large-icon",dr["category-icon"]="category-icon",dr["card-header"]="card-header",dr.icon="icon",dr["neutral-badge"]="neutral-badge",dr["highlight-badge"]="highlight-badge",dr["success-badge"]="success-badge",dr["warning-badge"]="warning-badge",dr["danger-badge"]="danger-badge",dr["critical-badge"]="critical-badge",dr["button-group"]="button-group",dr["alert-dialog"]="alert-dialog",dr["alert-header"]="alert-header",dr["emphasis-label"]="emphasis-label",dr["profit-loss-graph"]="profit-loss-graph",dr.banner="banner",dr["banner-high"]="banner-high",dr["banner-medium"]="banner-medium",dr["banner-low"]="banner-low",dr["banner-urgent"]="banner-urgent",dr["banner-default"]="banner-default",dr["banner-button"]="banner-button",dr["banner-button-text"]="banner-button-text",dr["banner-button-icon"]="banner-button-icon",dr["banner-icon"]="banner-icon",dr["banner-title"]="banner-title",dr["empty-dashboard-layout"]="empty-dashboard-layout",dr["emphasis-sub-label"]="emphasis-sub-label",dr["bar-transactions-positive"]="bar-transactions-positive",dr["bar-transactions-negative"]="bar-transactions-negative",dr["message-sent"]="message-sent",dr["message-received"]="message-received",dr["date-amount-header"]="date-amount-header",dr["close-button"]="close-button",dr["start-date-form-section"]="start-date-form-section",dr["beginning-balance-form-section"]="beginning-balance-form-section",dr["date-picker-nav-button"]="date-picker-nav-button",dr["date-picker-day-button"]="date-picker-day-button",dr["dropdown-selector-button"]="dropdown-selector-button",dr.chip="chip",dr["attachment-dropzone"]="attachment-dropzone",dr["list-body"]="list-body",dr["loading-skeleton"]="loading-skeleton",dr["line-item-card"]="line-item-card",dr["linked-entity-row"]="linked-entity-row",dr["drawer-search-bar"]="drawer-search-bar",dr["value-comparison-summary"]="value-comparison-summary",dr["category-selector-table-cell"]="category-selector-table-cell",dr["zero-state-button"]="zero-state-button",dr.toast="toast",dr["toast-dismiss"]="toast-dismiss",dr);const hr=e=>null==e,pr=e=>!hr(e),gr="Tight-",mr=e=>`${gr}${e}`;function vr(e){return e in ur}function fr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===gr&&r in ur}function br(e){return!vr(e)&&!fr(e)}const yr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(mr(e)),t.forEach(e=>{hr(e)||(br(e)?r.push(e):vr(e)?n.push(mr(e)):fr(e)&&n.push(e))}),{className:lr(...n,...r)}},Cr=or.raw({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}),xr=yr(ur["business-owner-dashboard-header"],or(Cr));function Tr({children:e}){return I("div",{...xr,children:e})}function wr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(fr(t)&&e.push(t),e),[])],[])}function kr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(br(t)&&e.push(t),e),[])],[])}function Er(e){const t=Array.isArray(e)?e:[e];return{className:lr(...wr(t),...kr(t))}}const Ar=cr({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:"template"}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:"template"},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:"template"},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"template",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"template"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:"template"},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:"template"},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:"template"}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"template"}},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"}}}}),Sr=yr(ur.heading,Ar({heading:"default"}));function Ir({children:e,stylists:t=[]}){const n=Er([Sr,...t]);return I("div",{...n,children:e})}function Nr(e,t,n){return[...e,{accessToken:t,environment:n}]}function Pr(e,t){return[...e,t]}function Rr(e){return""===e.trim()}function Dr(e){return hr(e)||Rr(e)}function Mr(e){return!Dr(e)}const Lr=l({activeToken:void 0,accountantToken:void 0});function Fr(){const{activeToken:e}=i(Lr);return e}const Or=()=>{throw new Error("No access token provided")},Vr=72e5,Ur=new R({defaultOptions:{queries:{gcTime:Vr,staleTime:3e4,refetchInterval:6e4}}}),Br=l("SANDBOX");function Hr(){return i(Br)}function Wr({queryKey:e,queryFn:t,...n}){const r=Fr(),a=Hr(),o=Mr(r),i=Nr(e,r??"",a),l=D(),s=M({...n,queryKey:i,queryFn:o?t:Or,...o?{}:{retry:!1,staleTime:1/0}},Ur);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class _r{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 qr=Symbol("Circular"),zr=Symbol("AccessError");function jr(e,t,n){return Kr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function Kr({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=qr),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=Yr(()=>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=Yr(()=>s[i]);e.push(Kr({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=Yr(()=>s[c]);e[c]=Kr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function Yr(e){try{return e()}catch{return zr}}const Zr=Object.prototype.toString,Gr=Object.getPrototypeOf;function Qr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Xr=/^\s*at .*(\S+:\d+|\(native\))/m,Jr=/^(eval@)?(\[native code])?$/;function $r(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 ea(e,t){const n=ta(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Qr(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[na(n)];return a.push(...oa(n).map(e=>na(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function ta(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===Zr.call(t))return!0;t=Gr(t)}return!1}(e))return e;let n=function(e){if(!Qr(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 na(e,t={backtrace:!1}){return{errorClass:e.name,message:e.message,stacktrace:ra(e,t),type:"object"==typeof self&&self.navigator?"browserjs":"nodejs"}}function ra(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(Xr)?e.split("\n").filter(e=>!!e.match(Xr)).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=$r(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(Jr)).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=$r(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<aa;){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 aa=20;function oa(e){const t=e;if(t.cause){const e=ta(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(oa(e))}return[]}function ia(...e){console.error}const la={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 sa=Date.now();const ca=()=>{sa=Date.now()},da={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-sa,!0}),{reset:ca})},ua=[["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\)$/]],ha=[["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/]],pa=(ga=function(e){const t=""!==(n=e)&&ua.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 ha)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,...ga(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 ga;class ma{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 va extends c{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}=ea(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 I(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return I(N,{children:this.props.children})}}const fa={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(va,{client:e,onError:t,FallbackComponent:n,children:r})})},ba=new class{breadcrumbs=[];config;delivery=new _r(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return ia(),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}=ea(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=jr(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){ia()}}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 ya="",Ca="";const xa="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",Ta=ba.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.8.1",appType:"browser",releaseStage:xa,enabledReleaseStages:["prod"],plugins:[da,pa,la,(()=>{const e=new ma(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),fa]}),wa=(e,t)=>{try{ba.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?ka({error:n,severity:"error"}):ka({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},ka=async e=>{try{await ba.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:ya,environment:Ca}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await ka({error:t,severity:"error"}):await ka({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},Ea=Ta.getPlugin("react"),Aa=Ea?.BugsnagErrorBoundary,Sa=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,Ia=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},Na=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},Pa={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function Ra(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...C(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?Pa:{}}});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 Da({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=Ia({extraHeaders:t,authorization:e});wa("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return wa("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),Na(e)}catch(l){return Promise.reject(l)}}async function Ma(e){const{url:t,headers:n}=Ra(e);return Da({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function La(e){return Ma(e)}async function Fa(e){return Ma(e)}const Oa=(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}),Va={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"},Ua={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"},Ba={...Ua,LOCAL:"http://localhost:8082"};function Ha(e){return Oa(`${t=e,Va[t]}/v5`,"v5");var t}const Wa=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],_a=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...St(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Ha(a)};return await Fa(o)};function qa({filter:e,grouping:t,select:n,accountingMethod:r}){return Wr({queryKey:Wa({filter:e,grouping:t,accountingMethod:r}),queryFn:_a,select:n})}const za="noDataHeight";function ja(e){const t=Vt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function Ka(e){const t=ja(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?H(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?H(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 Ya(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(hr(n))return t;for(const i of n){const{month:e,netIncome:n}=Ka(i);t.total=H(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 Za="MONTHLY",Ga=yr(ur["tile-header"],or({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Qa({title:e}){return I("div",{...Ga,children:I(Ir,{children:e})})}const Xa=yr(ur["tile-body"],or({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 Ja({children:e}){return I("div",{...Xa,children:e})}const $a=cr({base:{display:"flex",flexDirection:"column",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 eo({children:e,type:t,isSample:n=!1}){const r=yr(ur.tile,$a({type:t,isSample:n}));return I("div",{...r,children:e})}const to=or({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),no=or.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),ro=or.raw({whiteSpace:"normal",overflowWrap:"break-word"}),ao=or.raw({overflow:"visible",whiteSpace:"nowrap"}),oo=or({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),io=or.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),lo=or.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"template"});or.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"});const so=yr(ur.text,or({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to);function co({children:e}){return I("div",{...so,children:e})}const uo=yr(ur["metric-xl"],Ar({metric:"xl"}));function ho(e){return I("div",{...uo,children:e.children})}const po=yr(ur.summation,or({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function go({title:e,label:t}){return P("div",{...po,children:[I(ho,{children:e}),I(co,{children:t})]})}const mo=yr(null,or({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function vo({children:e}){return I("div",{...mo,children:e})}const fo=(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},bo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),yo=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<yo&&l>=1e3&&(l/=1e3),o>=yo?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${bo(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:fo(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:fo(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:fo(e,t)}}{const t=2,n=fo(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=bo(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 xo(e){return Co(e,{condense:!0,dollarSign:!0})}function To(e){return Co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function wo(e){return Co(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function ko(e,t){return Co(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const Eo=cr({variants:{wrap:{ellipsis:no,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function Ao({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Dr(n))return null;const a=Er([yr(ur["strong-label"],ur.text,Ar({label:"strongLabel"}),Eo({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const So=cr({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",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:no,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:no,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function Io({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=yr(ur["sub-label"],ur.text,So({intent:e,wrap:t,accent:r}),to);return Dr(n)?null:I("div",{...a,children:n})}const No=yr(null,or({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 Po({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===za)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),P("div",{...No,children:[I(Ao,{children:t[0].name??""}),I(Io,{children:xo(Number(n))})]})}const Ro={"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)"},"colors.template.appBackground":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-template-appBackground)"},"colors.template.appBackground.weak":{value:"hsl(from var(--Tight-colors-template-appBackground) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-appBackground-weak)"},"colors.template.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-template-foreground)"},"colors.template.foreground.weak":{value:"hsl(from var(--Tight-colors-template-foreground) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-foreground-weak)"},"colors.template.typography":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-template-typography)"},"colors.template.typography.weak":{value:"hsl(from var(--Tight-colors-template-typography) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-typography-weak)"},"colors.template.brand":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-template-brand)"},"colors.template.brand.weak":{value:"hsl(from var(--Tight-colors-template-brand) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weak)"},"colors.template.brand.strong":{value:"hsl(from var(--Tight-colors-template-brand) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strong)"},"colors.template.brand.weaker":{value:"hsl(from var(--Tight-colors-template-brand-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weaker)"},"colors.template.brand.stronger":{value:"hsl(from var(--Tight-colors-template-brand-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-stronger)"},"colors.template.brand.weakest":{value:"hsl(from var(--Tight-colors-template-brand-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weakest)"},"colors.template.brand.strongest":{value:"hsl(from var(--Tight-colors-template-brand-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strongest)"},"colors.template.neutral":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-template-neutral)"},"colors.template.neutral.weak":{value:"hsl(from var(--Tight-colors-template-neutral) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weak)"},"colors.template.neutral.strong":{value:"hsl(from var(--Tight-colors-template-neutral) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strong)"},"colors.template.neutral.weaker":{value:"hsl(from var(--Tight-colors-template-neutral-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weaker)"},"colors.template.neutral.stronger":{value:"hsl(from var(--Tight-colors-template-neutral-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-stronger)"},"colors.template.neutral.weakest":{value:"hsl(from var(--Tight-colors-template-neutral-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weakest)"},"colors.template.neutral.strongest":{value:"hsl(from var(--Tight-colors-template-neutral-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strongest)"},"colors.template.accent":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-template-accent)"},"colors.template.accent.weak":{value:"hsl(from var(--Tight-colors-template-accent) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weak)"},"colors.template.accent.strong":{value:"hsl(from var(--Tight-colors-template-accent) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strong)"},"colors.template.accent.weaker":{value:"hsl(from var(--Tight-colors-template-accent-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weaker)"},"colors.template.accent.stronger":{value:"hsl(from var(--Tight-colors-template-accent-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-stronger)"},"colors.template.accent.weakest":{value:"hsl(from var(--Tight-colors-template-accent-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weakest)"},"colors.template.accent.strongest":{value:"hsl(from var(--Tight-colors-template-accent-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strongest)"},"colors.template.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-template-success)"},"colors.template.success.weak":{value:"hsl(from var(--Tight-colors-template-success) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weak)"},"colors.template.success.strong":{value:"hsl(from var(--Tight-colors-template-success) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strong)"},"colors.template.success.weaker":{value:"hsl(from var(--Tight-colors-template-success-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weaker)"},"colors.template.success.stronger":{value:"hsl(from var(--Tight-colors-template-success-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-stronger)"},"colors.template.success.weakest":{value:"hsl(from var(--Tight-colors-template-success-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weakest)"},"colors.template.success.strongest":{value:"hsl(from var(--Tight-colors-template-success-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strongest)"},"colors.template.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-template-warning)"},"colors.template.warning.weak":{value:"hsl(from var(--Tight-colors-template-warning) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weak)"},"colors.template.warning.strong":{value:"hsl(from var(--Tight-colors-template-warning) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strong)"},"colors.template.warning.weaker":{value:"hsl(from var(--Tight-colors-template-warning-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weaker)"},"colors.template.warning.stronger":{value:"hsl(from var(--Tight-colors-template-warning-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-stronger)"},"colors.template.warning.weakest":{value:"hsl(from var(--Tight-colors-template-warning-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weakest)"},"colors.template.warning.strongest":{value:"hsl(from var(--Tight-colors-template-warning-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strongest)"},"colors.template.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-template-danger)"},"colors.template.danger.weak":{value:"hsl(from var(--Tight-colors-template-danger) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weak)"},"colors.template.danger.strong":{value:"hsl(from var(--Tight-colors-template-danger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strong)"},"colors.template.danger.weaker":{value:"hsl(from var(--Tight-colors-template-danger-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weaker)"},"colors.template.danger.stronger":{value:"hsl(from var(--Tight-colors-template-danger-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-stronger)"},"colors.template.danger.weakest":{value:"hsl(from var(--Tight-colors-template-danger-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weakest)"},"colors.template.danger.strongest":{value:"hsl(from var(--Tight-colors-template-danger-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strongest)"},"lineHeights.template":{value:"normal",variable:"var(--Tight-lineHeights-template)"},"letterSpacings.template":{value:"normal",variable:"var(--Tight-letterSpacings-template)"},"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)"},"durations.toast.enter":{value:"250ms",variable:"var(--Tight-durations-toast-enter)"},"durations.toast.exit":{value:"200ms",variable:"var(--Tight-durations-toast-exit)"},"easings.toast.enter":{value:"ease-out",variable:"var(--Tight-easings-toast-enter)"},"easings.toast.exit":{value:"ease-in",variable:"var(--Tight-easings-toast-exit)"},"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-brand-primary-weaker)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-brand-primary-weak)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-brand-primary)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-brand-secondary-weaker)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-brand-secondary)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-brand-action-stronger)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-brand-success-stronger)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-brand-success-strongest)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-brand-warning-stronger)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-brand-warning-strongest)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-brand-danger-stronger)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-surface-background-hover)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-surface-foreground-hover)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-surface-elevated)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-surface-elevated-hover)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-surface-intent-primary)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-surface-intent-primary-hover)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-surface-intent-primary-active)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-intent-primary-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-surface-intent-secondary)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-surface-intent-secondary-hover)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-surface-intent-secondary-active)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-intent-secondary-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-surface-intent-action)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-surface-intent-action-hover)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-surface-intent-action-active)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-intent-action-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"var(--Tight-colors-surface-intent-action-discreet)",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-surface-intent-action-discreet-hover)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-surface-intent-action-discreet-active)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-surface-intent-action-highlight)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-surface-intent-success)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-surface-intent-success-hover)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-surface-intent-success-active)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-intent-success-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-surface-intent-success-highlight)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-surface-intent-warning)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-surface-intent-warning-hover)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-surface-intent-warning-active)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-intent-warning-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-surface-intent-warning-highlight)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-surface-intent-danger)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-surface-intent-danger-hover)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-surface-intent-danger-active)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-intent-danger-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-surface-intent-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-surface-intent-danger-highlight)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.intent.notification":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-intent-notification)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-surface-reports-alternateRows)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.intent.notification":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-notification)"},"colors.typography.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-typography-accent-action)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-body)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-label)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-label-sub)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-label-strong)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-label-strongSub)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-label-emphasisSub)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-heading)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-metric-sm)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-metric-md)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-metric-lg)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-metric-xl)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-icon-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-icon-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-icon-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-icon-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-icon-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-icon-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-icon-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-icon-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-icon-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-icon-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-icon-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-icon-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-icon-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-icon-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-icon-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-icon-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-icon-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-icon-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-icon-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-icon-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-icon-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-icon-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-icon-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-icon-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-icon-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-border-layout-weak)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-border-layout-strong)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-border-intent-primary-hover)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-border-intent-primary)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-border-intent-primary-active)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-intent-primary-disabled)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-border-intent-secondary-hover)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-border-intent-secondary)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-border-intent-secondary-active)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-intent-secondary-disabled)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-border-intent-danger-hover)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-border-intent-danger)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-border-intent-danger-active)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-intent-danger-disabled)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-border-intent-warning-hover)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-border-intent-warning)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-border-intent-warning-active)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-intent-warning-disabled)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-border-intent-success-hover)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-border-intent-success)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-border-intent-success-active)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-intent-success-disabled)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-border-intent-action-hover)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-border-intent-action)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-border-intent-action-active)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-intent-action-disabled)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-money)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-money-positive)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-money-positive-weak)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-money-positive-strong)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-money-negative)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-money-negative-weak)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-money-negative-strong)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"var(--Tight-colors-overlay)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"var(--Tight-colors-transparent)",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"var(--Tight-colors-none)",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"var(--Tight-colors-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.appBackground":{value:"var(--Tight-colors-colorPalette-appBackground)",variable:"var(--Tight-colors-colorPalette-appBackground)"},"colors.colorPalette.appBackground.weak":{value:"var(--Tight-colors-colorPalette-appBackground-weak)",variable:"var(--Tight-colors-colorPalette-appBackground-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-weak)"},"colors.colorPalette.foreground":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"colors.colorPalette.foreground.weak":{value:"var(--Tight-colors-colorPalette-foreground-weak)",variable:"var(--Tight-colors-colorPalette-foreground-weak)"},"colors.colorPalette.typography":{value:"var(--Tight-colors-colorPalette-typography)",variable:"var(--Tight-colors-colorPalette-typography)"},"colors.colorPalette.typography.weak":{value:"var(--Tight-colors-colorPalette-typography-weak)",variable:"var(--Tight-colors-colorPalette-typography-weak)"},"colors.colorPalette.brand":{value:"var(--Tight-colors-colorPalette-brand)",variable:"var(--Tight-colors-colorPalette-brand)"},"colors.colorPalette.brand.weak":{value:"var(--Tight-colors-colorPalette-brand-weak)",variable:"var(--Tight-colors-colorPalette-brand-weak)"},"colors.colorPalette.brand.strong":{value:"var(--Tight-colors-colorPalette-brand-strong)",variable:"var(--Tight-colors-colorPalette-brand-strong)"},"colors.colorPalette.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.brand.weaker":{value:"var(--Tight-colors-colorPalette-brand-weaker)",variable:"var(--Tight-colors-colorPalette-brand-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.brand.stronger":{value:"var(--Tight-colors-colorPalette-brand-stronger)",variable:"var(--Tight-colors-colorPalette-brand-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-stronger)"},"colors.colorPalette.brand.weakest":{value:"var(--Tight-colors-colorPalette-brand-weakest)",variable:"var(--Tight-colors-colorPalette-brand-weakest)"},"colors.colorPalette.weakest":{value:"var(--Tight-colors-colorPalette-weakest)",variable:"var(--Tight-colors-colorPalette-weakest)"},"colors.colorPalette.brand.strongest":{value:"var(--Tight-colors-colorPalette-brand-strongest)",variable:"var(--Tight-colors-colorPalette-brand-strongest)"},"colors.colorPalette.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.neutral":{value:"var(--Tight-colors-colorPalette-neutral)",variable:"var(--Tight-colors-colorPalette-neutral)"},"colors.colorPalette.neutral.weak":{value:"var(--Tight-colors-colorPalette-neutral-weak)",variable:"var(--Tight-colors-colorPalette-neutral-weak)"},"colors.colorPalette.neutral.strong":{value:"var(--Tight-colors-colorPalette-neutral-strong)",variable:"var(--Tight-colors-colorPalette-neutral-strong)"},"colors.colorPalette.neutral.weaker":{value:"var(--Tight-colors-colorPalette-neutral-weaker)",variable:"var(--Tight-colors-colorPalette-neutral-weaker)"},"colors.colorPalette.neutral.stronger":{value:"var(--Tight-colors-colorPalette-neutral-stronger)",variable:"var(--Tight-colors-colorPalette-neutral-stronger)"},"colors.colorPalette.neutral.weakest":{value:"var(--Tight-colors-colorPalette-neutral-weakest)",variable:"var(--Tight-colors-colorPalette-neutral-weakest)"},"colors.colorPalette.neutral.strongest":{value:"var(--Tight-colors-colorPalette-neutral-strongest)",variable:"var(--Tight-colors-colorPalette-neutral-strongest)"},"colors.colorPalette.accent":{value:"var(--Tight-colors-colorPalette-accent)",variable:"var(--Tight-colors-colorPalette-accent)"},"colors.colorPalette.accent.weak":{value:"var(--Tight-colors-colorPalette-accent-weak)",variable:"var(--Tight-colors-colorPalette-accent-weak)"},"colors.colorPalette.accent.strong":{value:"var(--Tight-colors-colorPalette-accent-strong)",variable:"var(--Tight-colors-colorPalette-accent-strong)"},"colors.colorPalette.accent.weaker":{value:"var(--Tight-colors-colorPalette-accent-weaker)",variable:"var(--Tight-colors-colorPalette-accent-weaker)"},"colors.colorPalette.accent.stronger":{value:"var(--Tight-colors-colorPalette-accent-stronger)",variable:"var(--Tight-colors-colorPalette-accent-stronger)"},"colors.colorPalette.accent.weakest":{value:"var(--Tight-colors-colorPalette-accent-weakest)",variable:"var(--Tight-colors-colorPalette-accent-weakest)"},"colors.colorPalette.accent.strongest":{value:"var(--Tight-colors-colorPalette-accent-strongest)",variable:"var(--Tight-colors-colorPalette-accent-strongest)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.weakest":{value:"var(--Tight-colors-colorPalette-success-weakest)",variable:"var(--Tight-colors-colorPalette-success-weakest)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.weakest":{value:"var(--Tight-colors-colorPalette-warning-weakest)",variable:"var(--Tight-colors-colorPalette-warning-weakest)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.danger.weakest":{value:"var(--Tight-colors-colorPalette-danger-weakest)",variable:"var(--Tight-colors-colorPalette-danger-weakest)"},"colors.colorPalette.danger.strongest":{value:"var(--Tight-colors-colorPalette-danger-strongest)",variable:"var(--Tight-colors-colorPalette-danger-strongest)"},"colors.colorPalette.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-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.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-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.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"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.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.intent.notification":{value:"var(--Tight-colors-colorPalette-intent-notification)",variable:"var(--Tight-colors-colorPalette-intent-notification)"},"colors.colorPalette.notification":{value:"var(--Tight-colors-colorPalette-notification)",variable:"var(--Tight-colors-colorPalette-notification)"},"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 Do(e,t){return Ro[e]?.value||t}Do.var=function(e,t){return Ro[e]?.variable||t};const Mo=yr(null,or({borderRadius:"50%",flexShrink:0})),Lo=yr(null,or({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Fo=Do.var("colors.surface.foreground.disabled");function Oo({color:e=Fo,diameter:t=17,label:n}){return P("div",{...Lo,"data-testid":"bullet-row",children:[I("div",{...Mo,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(Io,{children:n})]})}const Vo=yr(null,or({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function Uo({payload:e}){return void 0===e?null:I("div",{...Vo,children:e.map((e,t)=>"none"!==e.type&&I(Oo,{color:e.color,label:e.value,diameter:17},t))})}const Bo={right:20,left:20},Ho=["income","profit","expenses","loss"],Wo=e=>Ho.findIndex(t=>t===e.dataKey),_o={paddingBottom:"20px",marginLeft:"-20px"},qo={stackId:"stack",isAnimationActive:!1},zo=yr(ur["profit-loss-graph"],or({"& .recharts-surface":{outline:"none"}})),jo=Do.var("colors.money"),Ko=Do.var("colors.border.layout"),Yo=Do.var("colors.border.layout.strong"),Zo={fill:Do.var("colors.typography.base"),fontSize:Do.var("fontSizes.metric.sm")},Go={profit:Do.var("colors.money.positive.strong"),income:Do.var("colors.money.positive.weak"),loss:Do.var("colors.money.negative.strong"),expenses:Do.var("colors.money.negative.weak")},Qo=[0,100],Xo=["auto","auto"];function Jo({data:e}){const[t,n]=d(!0);if(void 0===e)return null;const r=e.hasAnyData?Xo:Qo;return I(W,{width:"100%",height:"100%",...zo,children:P(_,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:Bo,children:[I(q,{verticalAlign:"top",itemSorter:Wo,wrapperStyle:_o,content:({payload:e})=>I(Uo,{payload:e})}),I(z,{strokeDasharray:"0",vertical:!1,stroke:Ko}),I(j,{dataKey:"month",interval:0,tickLine:!1,stroke:Ko,tick:Zo}),I(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:Ko,tick:Zo,tickFormatter:e=>xo(e)}),I(Y,{content:({active:e,payload:t})=>I(Po,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(Z,{name:"Profit",dataKey:"profit",fill:Go.profit,...qo}),I(Z,{name:"Income",dataKey:"income",fill:Go.income,...qo}),I(Z,{name:"Loss",dataKey:"loss",fill:Go.loss,...qo}),I(Z,{name:"Expenses",dataKey:"expenses",fill:Go.expenses,...qo}),I(Z,{dataKey:za,fill:Ko,legendType:"none",...qo}),I(G,{y:0,stroke:Yo}),I(Q,{dataKey:"netIncome",fill:jo,stroke:jo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const $o=or({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 ei({styles:e}){const t=lr(mr(ur["loading-skeleton"]),$o,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const ti=or({width:"40%",minHeight:65});function ni({children:e}){return P(N,{children:[I(ei,{styles:ti}),I(vo,{children:e})]})}const ri=yr(null,or({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),ai=or({width:"80px",height:"17px",marginBottom:"10px"}),oi=or({width:"100%",height:"100%"});function ii(){return P(N,{children:[P("div",{...ri,children:[I(ei,{styles:ai}),I(ei,{styles:ai}),I(ei,{styles:ai}),I(ei,{styles:ai})]}),I(ei,{styles:oi})]})}const li=cr({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 si({size:e}){const t=li({size:e});return I("div",{className:t,children:"Sample"})}const ci=20200,di=5043,ui=Object.freeze({income:ci,expenses:di,netIncome:15157,absoluteSum:Math.abs(ci)+Math.abs(di)}),hi=Object.freeze({total:di,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),pi=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),gi=[{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 mi({filter:e=yt.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return qa({filter:e,grouping:t,select:Ya})}({filter:e,grouping:Za}),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=Wt(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=gi[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 P(eo,{type:"chart",children:[I(Qa,{title:"Profit + Loss"}),I(Ja,{children:r?I(ni,{children:I(ii,{})}):P(N,{children:[I(go,{title:xo(a?.total??0),label:"Profit"}),I(vo,{children:I(Jo,{data:a})})]})}),t&&I(si,{size:"xl"})]})}const vi={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},fi=l({}),bi=cr({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 yi(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:l}=i(fi),s=n?.styleIconKey?l?.[n.styleIconKey]:void 0,c=Er([yr(null,bi()),...o]);return s?I("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:or({objectFit:"contain"})}):I(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const Ci=yi(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"}),xi=yi(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"),Ti=yi(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"),wi=yi(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"}),ki=yi(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 Ei(e){return Oa(`${t=e,Ua[t]}`,"v6");var t}async function Ai({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=Ia({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=>Sa(e,t)).join("&"):Sa(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});wa("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return wa("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),Na(e)}catch(s){return Promise.reject(s)}}async function Si(e){const{url:t,headers:n}=Ra(e);return Ai({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function Ii(e){return Si({...e,endpointManager:Ei(e.environment)})}async function Ni(e){return Si({...e,endpointManager:Ha(e.environment)})}const Pi=l(void 0);function Ri(){return i(Pi)}const Di=e=>["introspect",e];function Mi(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 Ni(r)}(n[2].accessToken,n[2].environment,e)}}function Li(){const e=Ri();return Wr({queryKey:Di(e),queryFn:Mi(e)})}const Fi={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"},Oi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Vi={DISCREPANCY:{text:"Discrepancy",Icon:xi,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:Ti,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:Ci,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:Ti,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:Ti,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:Ci,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:ki,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:wi,variant:"success"}},Ui={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"]},Bi={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"]},Hi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Wi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],_i=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],qi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],zi=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],ji=[{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 Ki(){return Gi()?ji:zi}function Yi(e,t){return{...Vi[e],key:e,value:(t?Ui:Bi)[e]}}function Zi(e){const t=Gi()?Ui:Bi,n=Oi.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Vi[n]}function Gi(){const{query:{data:e}}=Li();return"ACCOUNTANT"===e?.userRole}function Qi(){return Yi("NEEDS_REVIEW",Gi())}function Xi(e){return e in Fi}const{CONVERSATIONS:Ji,TRANSACTIONS:$i}=vi.FinancialOverview,el={MESSAGE_REVIEW:Ji,TRANSACTION_REVIEW:$i,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},tl={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},nl={resolutionStatus:{in:["OPEN"]}},rl=[],al=[],ol=yi(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"),il=yi(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"),ll=or.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"}}),sl=or(ll),cl=or.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),dl=or(cl);or({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}),or({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),or({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const ul=l({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function hl({Component:e,stylists:t}){return I(e,{stylists:[yr(ur["small-icon"],ur.icon),...t??[]],size:12})}const pl=yr(ur["pagination-button"],or({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})),gl=yr(null,or({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"}}),dl),ml=yr(null,or({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),vl=yr(null,or({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function fl(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=i(ul);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return P("div",{...pl,children:[I("div",{...ml,children:I("button",{...gl,onClick:r,disabled:!t,children:I(hl,{Component:ol,stylists:[vl]})})}),I("div",{...ml,children:I("button",{...gl,onClick:n,disabled:!e,children:I(hl,{Component:il,stylists:[vl]})})})]})}const bl=or({width:"100%",height:"50px"});function yl(){return I(ei,{styles:bl})}const Cl=yr(ur["dashboard-placeholder-table"],or({display:"flex",flexDirection:"column",gap:"4px"})),xl=yr(null,or({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),Tl=or({width:"100px",height:"20px"});function wl({numColumns:e=6}){return P("div",{...Cl,children:[I("div",{...xl,children:Array.from({length:e},(e,t)=>I(ei,{styles:Tl},t))}),I(yl,{}),I(yl,{}),I(yl,{}),I(yl,{}),I(yl,{}),I(yl,{})]})}function kl(e,t){const n=Fr(),r=Hr();return u(a=>{const o=Mr(n),i=o?{}:{retry:!1,staleTime:1/0};return Ur.prefetchQuery({queryKey:Nr(e(a),n??"",r),queryFn:o?t:Or,...i})},[e,t,n,r])}const El=Object.freeze({}),Al=Object.freeze({cursor:"FINAL_PAGE"});function Sl({queryKey:e,queryFn:t,...n}){const[r,i]=d(El),l=a(e);x(l.current,e)||(l.current=e,i(El));const c=n.select,h=pr(c)?e=>({...c(e),cursor:e.cursor}):void 0,p=Pr(e,r),g=Wr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),m=o(()=>{return e=g.query.data?.cursor,t=i,{getFirstPage:()=>t(El),getLastPage:()=>t(Al),hasNextPage:pr(e?.after),hasPreviousPage:pr(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[g.query.data?.cursor]),v=kl(u(t=>Pr(e,t),[e]),t),f=kl(u(t=>Pr(e,t),[e]),t);return s(()=>{const e=g.query.data?.cursor;!g.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{ka({error:e,severity:"error"})}),e.before&&f({cursor:e.before}).catch(e=>{ka({error:e,severity:"error"})}))},[g.query.data?.cursor,g.query.isFetching,v,f]),{...g,paginationControls:m}}function Il({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 s(()=>()=>{n.cancelCallback()},[n]),{startCallback:u(e=>{n.startCallback(e)},[n]),cancelCallback:u(()=>{n.cancelCallback()},[n])}}function Nl({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=Il({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Pl={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"},Rl={ASC:"ASC",DESC:"DESC"},Dl=e=>["conversations",e??{}],Ml=e=>["conversations","conversation",e],Ll=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Fl(e){return Sl({queryKey:e?Dl(e):["conversations",{}],queryFn:Ll})}const Ol=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 Ii(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Vl(e){const t=pr(e);return Wr({queryKey:Ml({id:e??""}),queryFn:Ol,enabled:t})}const Ul=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:Ei(n)};return await La(r)};function Bl(){return Nl({prefetchFn:kl(Ml,Ol)})}function Hl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Wl({header:e}){const t=Hl(e.column);return I("div",{...yr(ur["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:X(e.column.columnDef.header,e.getContext())})}const _l=yr(ur["dashboard-table-header"],or({display:"flex",flexDirection:"row",alignItems:"center"}));function ql({headerGroups:e}){return I("div",{children:e.map(e=>h("div",{..._l,key:e.id},e.headers.map(e=>I(Wl,{header:e},e.id))))})}const zl=yr(ur["dashboard-table-body"],or({display:"flex",flexDirection:"column"}));function jl({children:e}){return I("div",{...zl,children:e})}function Kl(e){if("object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id)return e.id}const Yl=/* @__PURE__ */new Set;const Zl=l(void 0);function Gl({editMutationKey:e,children:t}){const n=function(e){const t=F({filters:{mutationKey:e,status:"pending"},select:e=>e.state.variables},Ur);return o(()=>0===t.length?Yl:function(e){const t=/* @__PURE__ */new Set;for(const n of e){const e=Array.isArray(n)?n:[n];for(const n of e){const e=Kl(n);void 0!==e&&t.add(e)}}return t}(t),[t])}(e);return I(Zl.Provider,{value:n,children:t})}const Ql=yr(ur["dashboard-table-cell"],or({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),Xl=or({display:"flex",flexDirection:"row",height:"100%"});function Jl({cell:e,onCellClick:t,isMutating:n}){const r=Hl(e.column);return I("div",{className:Xl,style:r,onClick:()=>{!n&&t&&t(e)},children:I("div",{style:r,...Ql,children:X(e.column.columnDef.cell,{...e.getContext(),isMutating:n})})})}const $l=yr(ur["table-sub-row"],or({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function es({rowData:e,onCellClick:t,isMutating:n}){const r=e.getVisibleCells();return I("div",{...$l,children:r.map(e=>I(Jl,{cell:e,onCellClick:t,isMutating:n,isChild:!0},e.id))})}const ts=or({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden",position:"relative",isolation:"isolate"}),ns=or({position:"absolute",inset:"0",backgroundColor:"surface.foreground",opacity:"80%",pointerEvents:"all",cursor:"default"}),rs=or({background:"surface.background"}),as=yr(ur["table-row"],or({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.weaker"}}));function os({rowData:e,onMouseEnter:t,onMouseLeave:n,onCellClick:r,shouldDisplayDivider:a}){const o=function(e){const t=i(Zl);return t?.has(e)??!1}(e.id),l=e.getIsExpanded(),s=yr(ur["table-parent-row"],ts,e.index%2==0?rs:void 0),c=e.getVisibleCells();return P("div",{...s,onMouseEnter:t,onMouseLeave:n,children:[I("div",{...as,children:c.map(e=>I(Jl,{cell:e,onCellClick:r,isMutating:o},e.id))}),o&&I("div",{className:ns}),l&&I("div",{children:e.subRows.map(e=>I(es,{rowData:e,onCellClick:r,shouldDisplayDivider:a,isMutating:o},e.id))})]})}const is=(e,t={})=>{gn.getState().openDrawer(e,t)},ls=()=>{gn.getState().requestCloseDrawer()},ss=()=>gn(e=>e.drawerHistory),cs=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]);function ds(e,t,n){pr(e)&&(e.listener(t),e.preventDefault)||n?.()}function us(e,t){const{events:n}=gn.getState();ds(n.transactionForm,{type:"OPEN_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>{is("BankTransactionForm",{routeProps:{transactionId:e?.id??t?.transactionId,initialTab:t?.initialTab,initialType:t?.initialType}}),null!==e&&(cs.has(e.apiName)?ds(n.bankTransactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null}):ds(n.processorTransactionForm,{type:"OPEN_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null}))})}function hs({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Nr(e,n,r);return Ur.fetchQuery({queryKey:a,queryFn:t})}function ps({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Nr(e,n,r);return Ur.prefetchQuery({queryKey:a,queryFn:t})}const gs=[{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"}],ms={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},vs={ASC:"ASC",DESC:"DESC"},fs=e=>["banks/transactions",e??{}],bs=e=>["banks/transactions",e.id],ys=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Cs(e,t){return Sl({queryKey:fs(e),queryFn:ys,...t})}const xs=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 Ii(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Ts({id:e,enabled:t=!0}){return Wr({queryKey:bs({id:e??""}),queryFn:xs,enabled:t})}function ws(){return Nl({prefetchFn:kl(bs,xs)})}function ks(){const{query:{data:e}}=Cs({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!hr(t)&&t.length>0}const Es={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 As(e,t){return!Dr(e)&&e.startsWith(t)}function Ss({id:e,prefix:t}){return void 0!==e?`${Es[t]}_${e}`:""}function Is(e){let t=e;return"string"==typeof e&&e.includes("_")&&(t=e.split("_")[1]),Number(t)}const Ns=e=>["conversations/messages",e];function Ps(e){if(hr(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 Rs=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 Ii(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},Ds=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:Ei(n),accessToken:t};return await La(r)};function Ms(){return Nl({prefetchFn:kl(Ns,Rs)})}const Ls=e=>["summaries",e??{}],Fs=e=>["summaries",e.id],Os=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:Ei(t[2].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const Vs=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 Ii(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Us(){return gn(e=>e.events.conversations)}function Bs({rowData:e,isMobile:t}){const n=Us(),{startPrefetch:r,cancelPrefetch:a}=Bl(),{startPrefetch:o,cancelPrefetch:i}=Ms(),{startPrefetch:l,cancelPrefetch:s}=ws(),{startPrefetch:c,cancelPrefetch:d}=Nl({prefetchFn:kl(Fs,Vs)}),h=u(()=>{pr(e.original.attachedEntityId)&&As(e.original.attachedEntityId,Es.BANK_TRANSACTION)?l({id:e.original.attachedEntityId}):pr(e.original.attachedEntityId)&&As(e.original.attachedEntityId,Es.FINANCIAL_SUMMARY)&&c({id:e.original.attachedEntityId}),o({id:e.original.id}),r({id:e.original.id})},[e.original.attachedEntityId,e.original.id,o,r,l,c]),p=u(()=>{pr(e.original.attachedEntityId)&&As(e.original.attachedEntityId,Es.BANK_TRANSACTION)?s():pr(e.original.attachedEntityId)&&As(e.original.attachedEntityId,Es.FINANCIAL_SUMMARY)&&d(),i(),a()},[s,d,a,i,e.original.attachedEntityId]);return I(os,{rowData:e,onMouseEnter:h,onMouseLeave:p,shouldDisplayDivider:e=>0!==e,onCellClick:()=>{ds(n,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:e.original,error:null},()=>((e,t,n)=>{n?is("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):pr(t)?As(t,Es.BANK_TRANSACTION)?us(null,{transactionId:t,initialTab:"conversation"}):As(t,Es.FINANCIAL_SUMMARY)&&(r=e,a=t,is("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){is("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t))}})}const Hs=yi(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"),Ws=or.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}}),_s=or(Ws),qs=or.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"}});or(qs);const zs=or.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),js=or(zs),Ks=or.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});or(Ks);const Ys=or.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"}}),Zs=or.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"}}),Gs=or.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"}}}),Qs=or.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"}}),Xs=or.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"}}}),Js=or.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"}}),$s=cr({base:or.raw(Ws,zs,ll),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:zs,small:Ks},intent:{default:{},danger:Zs,primary:qs,secondary:Xs,success:Gs,warning:Qs,action:Js}}}),ec=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,eventSource:g},m){const v=function(e){switch(e){case"danger":return ur["button-danger"];case"primary":return ur["button-primary"];case"secondary":return ur["button-secondary"];case"success":return ur["button-success"];case"warning":return ur["button-warning"];case"action":return ur["button-action"];case"default":return null}}(c),f=Er([yr(ur["button-base"],v,r,or($s.raw({width:s,size:l,intent:c}),n)),...t]);return I("button",{ref:m,...f,type:a,onClick:o,disabled:i,"data-active":d,"data-event-name":g,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function tc({children:e,stylists:t=[],...n}){return I(ec,{intent:"secondary",stylists:t,...n,children:e})}const nc=yr(ur["small-square-button"],void 0),rc=or({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function ac(){const e=Us();return I("div",{className:rc,children:I(tc,{stylists:[nc],onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation",{routeProps:{conversationId:null}}))},width:"fill-parent",children:I(hl,{Component:Hs})})})}const oc=cr({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 ic({children:e,dashboard:t}){const n=yr(ur["dashboard-table"],oc({dashboard:t}));return I("div",{...n,children:e})}const lc=l(null),sc="mobile",cc=cr({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 dc({children:e,alignVariant:t="flexStart"}){const n=yr(null,cc({alignVariant:t}));return I("div",{...n,children:e})}const uc=cr({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"template",maxWidth:"100%",xl:{lineHeight:"template",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"},notification:{color:"typography.intent.notification"}},wrap:{ellipsis:no,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:ao},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function hc({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=yr(ur.label,ur.text,or(uc.raw({intent:t,wrap:n,alignment:r}),a));return Dr(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const pc={"sm-sm":yr(ur.text,or({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to),"sm-med":yr(ur.text,or({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to),"sm-lg":yr(ur.text,or({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to),"med-sm":yr(ur.text,or({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to),"med-med":yr(ur.text,or({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to),"med-lg":yr(ur.text,or({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to)};function gc({children:e,size:t,weight:n,stylists:r=[]}){const a=Er([pc[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const mc=yr(ur["emphasis-label"],or({lineHeight:"template"}));function vc({children:e}){return I(gc,{size:"med",weight:"lg",stylists:[mc],children:e})}function fc({text:e,isRead:t}){return I(t?hc:vc,{children:e})}function bc({date:e,isRead:t=!1}){const n=_t(e);return I(fc,{text:n,isRead:t})}const yc=yr(ur["strong-sub-label"],Ar({label:"strongSubLabel"}));function Cc({children:e,stylists:t=[]}){return Dr(e)?null:I(gc,{size:"sm",weight:"med",stylists:[yc,...t],children:e})}const xc=l(null),Tc=or({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),wc=or.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"}}),kc=yr(ur["selector-row"],or(wc));function Ec(e,t,n){const[r,a]=d(e);return[t??r,n??a]}function Ac({children:e}){return null===pe()?I(ge,{children:e}):e}function Sc({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const c=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=d(),[c,h]=d(),[p,g]=Ec(e,r,a),m=ne(),v=re({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:se,middleware:[ae(n),oe({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),ie({padding:8}),le({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})]}),f=v.context,b=ce(f,{enabled:i}),y=de(f,{bubbles:{escapeKey:!0}}),C=ue(f),x=he([b,y,C]),T=u(()=>g(!1),[g]);return o(()=>({open:p,setOpen:g,close:T,...x,...v,modal:!0,labelId:l,descriptionId:c,setLabelId:s,setDescriptionId:h,nodeId:m}),[p,g,T,x,v,l,c,m])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=pe(),p=l&&null===h,g=c.nodeId;return I(Ac,{children:I(me,{id:g,children:I(xc.Provider,{value:{...c,popupParentNodeId:h,blockInteraction:p},children:e})})})}function Ic(){const e=i(xc);if(hr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function Nc({children:e}){const t=Ic(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const Pc=yi(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 Rc({Component:e,stylists:t}){return I(e,{stylists:[yr(ur["tiny-icon"],ur.icon),...t??[]],size:9})}const Dc=yi(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"),Mc=yr(ur["button-discreet-small"],or(Ys,{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"}}),sl),Lc=yr(null,or({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),Fc=yr(null,or({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"}})),Oc=yr(null,or({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function Vc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return P("div",{...Mc,"data-active":a,children:[P("button",{...Lc,...r,children:[I(Cc,{children:t}),!a&&I("div",{...Oc,children:I(Rc,{Component:Dc})})]}),a&&I("button",{...Fc,onClick:e,children:I(Rc,{Component:Pc})})]})}const Uc=cr({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 Bc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=Ic(),d=ve([c.refs.setFloating,n]),u=yr(ur.popup,Uc({type:r}));return a||l.open?P(fe,{children:[s&&I(be,{lockScroll:!0}),I(ye,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:I("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Hc=yr(ur["popup-sort-row"],or({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 Wc({onClick:e,children:t,active:n}){return I("button",{onClick:e,...Hc,children:I(Io,{accent:n?"active":"action",children:t})})}const _c=yr(null,or({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),qc=yr(null,or({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function zc({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=Ic(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return P("div",{..._c,children:[I(Cc,{stylists:[qc],children:"Sort by:"}),I(Wc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Wc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const jc=or.raw(Ys,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Kc({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=d(!1),u=yr(ur["button-discreet-small"],or(jc,e),sl),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return I("button",{type:"button",...u,onClick:e=>{void 0===h&&c(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const Yc={minWidth:"140px"};function Zc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=i(lc);if(!a)return null;const{sortInstance:o,setSortInstance:l}=a,s=o?.orderBy===t,c=()=>{l(void 0)};return t&&n&&r?P(Sc,{placement:"bottom-start",children:[I(Nc,{children:t=>I(Vc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),I(Bc,{style:Yc,children:I(zc,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{l(e)},sortInstance:o})})]}):I(Kc,{disabled:!0,children:I(Cc,{children:e})})}const Gc=cr({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 Qc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I("div",{className:Gc({align:a,padding:o}),children:I(Zc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Xc="Oldest to Newest",Jc="Newest to Oldest";const $c=l({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 ed({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=i($c);let a="";return e===r?a="Me":Gt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),I(fc,{text:a,isRead:t})}const td=yi(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"),nd=yr(ur.text,or({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"template",maxWidth:"100%",fontFamily:"label"}),to);function rd({children:e,stylists:t=[]}){const n=Er([nd,...t]);return I("div",{...n,children:e})}const ad=cr({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"}}}}),od=lr(or({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),to),id=or({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),ld=or({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),sd=or({display:"flex",alignItems:"center",gap:8}),cd=or({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),dd=or({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),ud=or({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),hd=or({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function pd({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:ad({isRead:a}),onTouchEnd:o,children:P("div",{className:od,children:[P("div",{className:dd,children:[!a&&I("div",{className:hd}),I(fc,{text:t,isRead:a})]}),P("div",{className:id,children:[I("div",{className:ud,children:I(ed,{authorUserId:e,isRead:a})}),P("div",{className:sd,children:[I("div",{className:ld,children:I(bc,{date:n,isRead:a})}),a?I(hl,{Component:il}):I(rd,{children:I(hl,{Component:il})})]})]}),I("div",{className:cd,children:Dr(r)?P(N,{children:[I(hl,{Component:td}),I(hc,{children:"Shared a file"})]}):I(hc,{children:r})})]})})}const gd=or({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),md=or({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function vd({text:e,isRead:t}){return t?I(hc,{children:e}):P("div",{className:gd,children:[I("div",{className:md}),I(vc,{children:e})]})}const fd=J(),bd=yr(null,or({paddingLeft:"25px"})),yd=[fd.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(dc,{children:I(ed,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(Cc,{stylists:[bd],children:"From"}),size:160,maxSize:160}),fd.accessor("subject",{id:"subject",cell:({row:e})=>P(dc,{children:[I(vd,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(hc,{children:e.original.latestMessage.text})]}),header:()=>I(Cc,{stylists:[bd],children:"Subject"}),size:200}),fd.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(dc,{children:I(bc,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(Qc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Jc,sortAscDisplay:Xc}),size:150,maxSize:150}),fd.display({id:sc,cell:({row:e})=>I(pd,{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 Cd(e){return e?yd.filter(e=>e.id===sc):yd.filter(e=>e.id!==sc)}const xd=[],Td=or({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"}),wd=yr(ur["empty-dashboard-layout"],Td);function kd({children:e}){return I("div",{...wd,"data-testid":"empty-dashboard-layout",children:e})}const Ed=or({width:"25px",height:"25px",borderRadius:"sm"});function Ad({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return pr(e)?P(N,{children:[!r&&I(ei,{styles:Ed}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[yr(ur["large-icon"],ur.icon),...n??[]],size:25})}const Sd=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I(ec,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),Id=yi(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"}),Nd=or({width:"15px",height:"15px",borderRadius:"sm"});function Pd({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return pr(e)?P(N,{children:[!r&&I(ei,{styles:Nd}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[yr(ur["medium-icon"],ur.icon),...n??[]],size:15})}function Rd(){const e=Us();return P(N,{children:[I(Ad,{Component:Id}),I(Ao,{wrap:"wrap",children:"Need help with your financials?"}),P(Sd,{...yr(ur["zero-state-button"]),onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation",{routeProps:{conversationId:null}}))},children:[I(Ao,{children:"Message Bookkeeper"}),I(Pd,{Component:il})]})]})}const Dd=yi(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 P(N,{children:[I(Ad,{Component:Dd}),I(Ao,{wrap:"wrap",children:"All caught up"}),I(Io,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const Ld=l({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function Fd(e){const{registerAnchor:t}=i(Ld);g(()=>{t(e)},[e,t])}const Od=yr(null,or({display:"flex",flexDirection:"row",gap:"5px"}));function Vd({children:e}){return I("div",{...Od,children:e})}const Ud=cr({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Bd(e){return I(e?Md:Rd,{})}function Hd({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){Fd(Ji);const i=function({conversations:e,isMobile:t}){return $({data:e??xd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??xd.length,columns:Cd(t),getCoreRowModel:ee(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Fl({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!hr(l?.data?.[0])&&!s;return P("div",{className:Ud({isMobile:o}),children:[I("div",{id:Ji}),P(ul.Provider,{value:r,children:[P(Tr,{children:[I(Ir,{children:"Conversations"}),P(Vd,{children:[I(fl,{}),I(ac,{})]})]}),I(ic,{dashboard:"financialOverviewDashboard",children:a?I(wl,{numColumns:4}):P(N,{children:[!o&&I(lc.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(ql,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(Gl,{editMutationKey:i.options.meta?.editMutationKey,children:I(jl,{children:i.getRowModel().rows.map(e=>I(Bs,{rowData:e,isMobile:o},e.id))})}):I(kd,{children:Bd(c)})]})})]})]})}const Wd=yr(ur.body,Ar({body:"default"}));function _d({children:e,stylists:t=[]}){if(Dr(e))return null;const n=Er([Wd,...t]);return I("div",{...n,children:e})}const qd=yr(null,or({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),zd=cr({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),jd=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function Kd(){return I("div",{...qd,children:jd.map((e,t)=>I(ei,{styles:zd({width:e?.width})},t))})}const Yd=or({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}"}),Zd=or({position:"relative",width:"25px",height:"25px"});function Gd({hasUnread:e}){return P("div",{className:Zd,children:[I(Ad,{Component:Id}),e&&I("div",{"data-testid":"unread-comment-badge",className:Yd,"aria-hidden":"true"})]})}const Qd=yr(ur["financial-summary-chatbox-header"],or({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Xd({hasUnreadMessages:e=!1,showMessageIndicator:t}){return P("div",{...Qd,children:[I(Ao,{children:"Message Bookkeeper"}),t&&I(Gd,{hasUnread:e})]})}const Jd=or({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function $d(){const e=Us();return P("div",{className:Jd,children:[I(Ad,{Component:Dd}),I(Ao,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(Io,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),P(Sd,{...yr(ur["zero-state-button"]),onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation"))},children:[I(Ao,{children:"Send a Message"}),I(Pd,{Component:il})]})]})}const eu=or({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function tu({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Bl(),{startPrefetch:a,cancelPrefetch:o}=Ms(),i=u(()=>{a({id:t}),n({id:t})},[t,a,n]),l=u(()=>{o(),r()},[o,r]);return P("div",{className:eu,children:[I(Ad,{Component:Dd}),I(Ao,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(Io,{wrap:"wrap",children:"Pick up where you left off."}),I(tc,{onClick:()=>is("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(Ao,{children:"Continue conversation"})})]})}const nu=or({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function ru({summaryId:e}){return P("div",{className:nu,children:[I(Ad,{Component:Dd}),I(Ao,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(Io,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(tc,{...yr(ur["zero-state-button"]),onClick:()=>is("FinancialSummary",{routeProps:{summaryId:e}}),children:I(Ao,{children:"Talk to a bookkeeper"})})]})}function au({summaryId:e,conversationId:t}){const n=pr(t);return hr(e)?I($d,{}):n?I(tu,{conversationId:t,summaryId:e}):I(ru,{summaryId:e})}const ou=or({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"}),iu=yr(ur["financial-summary-chatbox"],or({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 lu({summaryData:e}){const t=pr(e?.summary),n=pr(e?.conversation);return P("div",{className:ou,children:[I(Xd,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...iu,children:I(au,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const su=yi(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"),cu=or({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function du(){return P("div",{className:cu,children:[I(Ad,{Component:su}),I(Ao,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const uu=or({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),hu=cr({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:{}}}}),pu=yr(null,or({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),gu=or({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function mu({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Wr({queryKey:(t={limit:1,filter:{date:{equal:gt(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Ls(t):["summaries",{}],queryFn:Os,...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 $${ci.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${di.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=yr(ur["financial-summary-layout"],hu({isSample:e,isZeroState:o}));return P("div",{className:gu,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(Kd,{}):o?I(du,{}):P("div",{className:uu,children:[I(_d,{stylists:[pu],children:a}),e&&I(si,{size:"lg"})]})}),I(lu,{summaryData:n})]})}const vu=yr(ur["month-picker"],or({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),fu=yr(ur["month-picker-left-button"],or({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),bu=yr(ur["month-picker-right-button"],or({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),yu=yr(ur["month-picker-label"],or({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function Cu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=ut(e.year,e.month,1),o=Wt(a,{abbreviateMonth:!0});return P("div",{...vu,children:[I(tc,{stylists:[fu],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:I(hl,{Component:ol})}),I("div",{...yu,children:I(Ao,{children:o})}),I(tc,{stylists:[bu],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:I(hl,{Component:il})})]})}const xu=or({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function Tu({children:e}){return I("div",{className:xu,children:e})}function wu(){return gn(e=>e.events.bITile)}const ku=cr({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),Eu=yr(ur["progress-bar"],or({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),Au=yr(ur["progress-bar-fill"],or({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),Su=yr(ur["tile-bar-label"],or({paddingLeft:"10px"})),Iu=yr(ur["tile-bar-label-outer"],or({paddingLeft:"10px"}));function Nu({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?ur["bar-transactions-positive"]:ur["bar-transactions-negative"],l=yr(i,ku({color:n})),s=Er([Au,l]);return P("div",{...Eu,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...Su,children:I(hc,{children:e})})}),!o&&I("div",{...Iu,children:I(hc,{children:e})})]})}const Pu=yr(ur["metric-md"],or(Ar.raw({metric:"md"}),ao));function Ru(e){return I("div",{...Pu,children:e.children})}const Du=or({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),Mu=or({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function Lu({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 P("div",{className:Du,children:[I(Nu,{label:e,percentage:a,color:r}),I("div",{className:Mu,children:I(Ru,{children:xo(t)})})]})}const Fu=yi(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"),Ou={},Vu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return Ou[e]={loading:!1,error:null,scriptEl:t}},Uu="undefined"!=typeof window&&void 0!==window.document;function Bu({src:e,checkForExisting:t=!1,...n}){let r=Ou[e];!r&&t&&e&&Uu&&(r=Vu(e));const[a,o]=d(r?r.loading:Boolean(e)),[i,l]=d(r?r.error:null),[c,u]=d(!1);return s(()=>{if(!Uu||!e||c||i)return;let a;r=Ou[e],!r&&t&&(r=Vu(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=Ou[e]={loading:!0,error:null,scriptEl:a});const s=()=>{r&&(r.loading=!1),o(!1),u(!0)},d=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",s),a.addEventListener("error",d),document.body.appendChild(a),()=>{a.removeEventListener("load",s),a.removeEventListener("error",d),r&&r.loading&&(a.remove(),delete Ou[e])}},[e]),[a,i]}const Hu=e=>["integrations",e??{}],Wu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function _u(e,t){return Sl({...t,queryKey:Hu(e),queryFn:Wu})}function qu(e){return _u({filter:{apiName:{equal:"PLAID"}}},e)}function zu(e){return Oa(`${t=e,Va[t]}/v1`,"v1");var t}async function ju({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:zu(n)},{url:a,headers:o}=Ra(r);return await Ai({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const Ku="cancel",Yu="danger",Zu="success",Gu=or({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Qu=or({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Xu=cr({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"}}),Ju={transform:"none",willChange:"auto"};function $u({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=re({open:e,strategy:"fixed"}),s=de(l,{outsidePress:o,escapeKey:i}),c=ue(l,{role:t}),{getFloatingProps:d}=he([s,c]),u="alertdialog"===t?ur["alert-dialog"]:null,{className:h}=yr(u,Xu({size:r,padding:a}));return e?I(fe,{children:I(be,{lockScroll:!0,className:Gu,children:I(ye,{context:l,modal:!0,returnFocus:!0,children:I("div",{...d(),className:h,style:Ju,children:n})})})}):null}const eh=yr(ur["close-button"],or({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"}}),dl),th=()=>ls();function nh({Icon:e=Pc,handleClose:t=th}={}){return I("button",{...eh,onClick:t,type:"button",children:I(Pd,{Component:e,...eh})})}const rh=yr(ur["alert-header"],or({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"template"},ro));function ah({children:e}){return I("div",{...rh,children:e})}const oh=or({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),ih=or.raw({width:"100%"}),lh=e=>{switch(e){case sh.DANGER:return"danger";case sh.SUCCESS:return"success";case sh.ACTION:return"primary";default:return"secondary"}},sh={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ch=Ce.createConfirmation(xe(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return P($u,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[P("div",{className:Qu,children:[I(ah,{children:r}),o&&I(nh,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(hc,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:oh,children:i.map(e=>I(ec,{intent:lh(e.type),styles:ih,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(Ao,{children:e.label})},e.key))})]})}));function dh(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function uh(e){return new H(e).div(100).toNumber()}function hh(e){return new H(e).times(100).toNumber()}function ph(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function gh(e,t){return t?e?`${e} ${ph(t)}`:ph(t):e??""}const mh=e=>{ds(gn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:{defaultValues:e},error:null},()=>is("Conversation",{routeProps:{conversationId:null,defaultValues:e}}))},vh=or({display:"flex",flexDirection:"column",gap:"12px"});async function fh(e){await ch({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:Ku,label:"Cancel"},{key:Zu,label:"Chat",type:sh.SUCCESS}]})===Zu&&mh({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const bh=e=>["banks/accounts",e??{}],yh={integration:{expand:!0},status:{notIn:["REMOVED"]}},Ch=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:Ei(o)},l=await La(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function xh(e){return Sl({queryKey:bh({...e?.params,filter:{...yh,...e?.params?.filter}}),queryFn:Ch,enabled:e?.enabled,select:e?.select})}function Th(e,t){return hs({queryKey:Pr(bh({filter:yh}),{}),queryFn:Ch,accessToken:e,environment:t})}const wh={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},kh={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."}},Eh={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:kh.short.credentialsChanged,longMessage:kh.long.relinkCredentials,buttonType:wh.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:kh.short.credentialsChanged,longMessage:kh.long.relinkCredentials,buttonType:wh.RELINK},INVALID_MFA:{shortMessage:kh.short.credentialsChanged,longMessage:kh.long.relinkCredentials,buttonType:wh.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:kh.short.credentialsChanged,longMessage:kh.long.invalidUpdatedUsername,buttonType:wh.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:kh.short.accountLocked,longMessage:kh.long.accountLocked,buttonType:wh.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:kh.short.credentialsChanged,longMessage:kh.long.relinkCredentials,buttonType:wh.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:kh.short.supportChanged,longMessage:kh.long.supportChanged,buttonType:wh.CHAT},USER_SETUP_REQUIRED:{shortMessage:kh.short.updateNeeded,longMessage:kh.long.updateNeeded,buttonType:wh.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:kh.short.supportChanged,longMessage:kh.long.mfaUpdateNeeded,buttonType:wh.OPEN_BANK},NO_ACCOUNTS:{shortMessage:kh.short.noAccountsAvailable,longMessage:kh.long.noAccountsUnlink,buttonType:wh.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:kh.short.noAccountsAvailable,longMessage:kh.long.noAccountsUnlink,buttonType:wh.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:kh.short.connectionError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},ITEM_NOT_FOUND:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},PRODUCT_NOT_READY:{shortMessage:kh.short.serverError,longMessage:kh.long.productNotReady,buttonType:wh.CHAT},USER_PERMISSION_REVOKED:{shortMessage:kh.short.connectionError,longMessage:kh.long.permissionRevoked,buttonType:wh.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:kh.short.temporarilyDown,longMessage:kh.long.bankMaintenance,buttonType:wh.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:kh.short.serverDown,longMessage:kh.long.serverDown,buttonType:wh.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:kh.short.temporarilyDown,longMessage:kh.long.bankMaintenance,buttonType:wh.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:kh.short.supportChanged,longMessage:kh.long.supportChanged,buttonType:wh.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:kh.short.connectionError,longMessage:kh.long.connectionError,buttonType:wh.CHAT},PLANNED_MAINTENANCE:{shortMessage:kh.short.temporarilyDown,longMessage:kh.long.bankConnectionMaintenance,buttonType:wh.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:kh.short.requestError,longMessage:kh.long.connectionError,buttonType:wh.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:kh.short.inputError,longMessage:kh.long.connectionError,buttonType:wh.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:kh.short.volumeDown,longMessage:kh.long.bankMaintenance,buttonType:wh.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:kh.short.serverError,longMessage:kh.long.connectionError,buttonType:wh.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:kh.short.updateNeeded,longMessage:kh.long.partnerCredsChange,buttonType:wh.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:kh.short.credentialsExpiring,longMessage:kh.long.credentialsExpiring,buttonType:wh.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:kh.short.relinkNeeded,longMessage:kh.long.relinkForStatements,buttonType:wh.RELINK}},DEFAULT:{DEFAULT:{shortMessage:kh.short.connectionError,longMessage:kh.long.connectionError,buttonType:wh.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:kh.short.generic,longMessage:kh.long.generic,buttonType:wh.CHAT}}};function Ah({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=Eh[e];if(!n)return ka({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),Eh.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(ka({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),Eh.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}},Ih=l({createToast:()=>null,dismiss:()=>{}});function Nh({mutationFn:e,onMutateFn:t,onSuccess:n,onError:r,meta:a,...l}){const s=Fr(),c=Hr(),d=!Dr(s),u=function(){const{createToast:e,dismiss:t}=i(Ih);return o(()=>({success:(t,n)=>e("success",t,n),error:(t,n)=>e("error",t,n),dismiss:t}),[e,t])}(),h=n||a?.toastOptions?(e,t,r)=>{const o=n?.(e,t,r);if(a?.toastOptions){const n=a.toastOptions,r=n.defaultPartialMessage;if(pr(r)&&n.responseErrorParser.isPartialFailure(e)){const a=n.responseErrorParser.getErrorMessages(e),o="function"==typeof r?r(t):r;(a.length>0?a:[o]).forEach(e=>u.error(e))}else if(pr(n.defaultSuccessMessage)){const r=(i=n.defaultSuccessMessage,l=e,s=t,"function"==typeof i?i(l,s):i);pr(r)&&u.success(r)}}var i,l,s;return o}:void 0,p=r||a?.toastOptions?.defaultErrorMessage?(e,t,n)=>{const o=r?.(e,t,n);if(a?.toastOptions){(function(e,t,n){const r=t.defaultErrorMessage,a="function"==typeof r?r(n):r;if(hr(a))return[];const o=t.responseErrorParser.getErrorMessages(e);return o.length>0?o:[a]})(e,a.toastOptions,t).forEach(e=>u.error(e))}return o}:void 0;return O({...l,mutationFn:d?async t=>{const n=await e({data:t,accessToken:s,environment:c});return a?.toastOptions?.responseErrorParser.isFailureResult(n)?Promise.reject(n):n}:Or,onMutate:d&&pr(t)?e=>t({data:e,accessToken:s,environment:c}):void 0,onSuccess:h,onError:p},Ur)}function Ph(e){return"object"==typeof e&&null!==e}const Rh={isFailureResult:function(e){return Ph(e)&&"FAILURE"===e.result},isPartialFailure:function(){return!1},getErrorMessages:function(e){if(!Ph(e)||!pr(e.errors))return[];const t=[],{fieldErrors:n,globalErrors:r}=e.errors;if(pr(n))for(const a of Object.values(n))pr(a)&&Mr(a.errorMessage)&&t.push(a.errorMessage);if(Array.isArray(r))for(const a of r)pr(a)&&Mr(a.errorMessage)&&t.push(a.errorMessage);return t}},Dh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Ha(n)};return await Fa(r)},Mh=async({data:e,accessToken:t,environment:n})=>Dh({data:e,accessToken:t,environment:n}),Lh=async({data:e,accessToken:t,environment:n})=>Dh({data:e,accessToken:t,environment:n}),Fh=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:Ha(n)};return await Fa(r)})({data:{accounts:e},accessToken:t,environment:n});function Oh(e){return Nh({onSuccess:async()=>{wa("mutation successful, invalidating bank account queries");try{return Ur.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ka({error:e,severity:"error"})}},...e})}function Vh(){return Oh({mutationFn:Lh,meta:{toastOptions:{responseErrorParser:Rh,defaultErrorMessage:"Couldn't update account"}}})}function Uh(){return Nh({onSuccess:async()=>{wa("mutation successful, invalidating bank account queries");try{return Ur.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ka({error:e,severity:"error"})}},mutationFn:Fh,meta:{toastOptions:{responseErrorParser:Rh,defaultErrorMessage:"Couldn't update accounts"}}})}const Bh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,Hh=e=>"PLAID"===e,Wh=e=>({id:Is(e.id),apiAccountName:e.name,apiAccountNo:e.mask??void 0,apiAccountType:["DEPOSITORY","CREDIT"].includes(e.type??"")?e.type:void 0,tranStartDate:void 0,duplicateBankAccountIds:[]}),_h=or({display:"flex",flexDirection:"column",gap:"16px"}),qh=async()=>ch({title:"Merge Accounts",body:P("div",{className:_h,children:[I(hc,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(hc,{wrap:"wrap",children:"This action can't be undone."}),I(hc,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:Ku,label:"Cancel"},{key:Yu,label:"Continue",type:sh.DANGER}]}),zh=()=>ch({title:"Merge Failed",body:I(hc,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:Ku,label:"OK"}]}),{formContext:jh,fieldContext:Kh,useFieldContext:Yh,useFormContext:Zh}=Te(),Gh=yi(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 Qh({children:e,stylists:t=[],...n}){return I(ec,{intent:"success",stylists:t,...n,children:e})}function Xh({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return P(Qh,{type:"submit",disabled:n,children:[e&&I(hl,{Component:Gh}),I(Ao,{children:t})]})}const Jh=or({animation:"linear 1s spin infinite"}),$h=or({background:"conic-gradient(from 90deg, transparent 0deg, {colors.icon.base.weak} 360deg)",height:"100%",width:"100%",opacity:1}),ep=or({position:"relative"});function tp({size:e}){const t=e??15;return I("div",{className:ep,children:P("svg",{className:Jh,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[I("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:I("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:I("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:I("div",{className:$h})})})}),I("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}'}),I("defs",{children:I("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:I("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"})})})]})})}const np=yr(null,or({display:"flex",width:"100%"}));function rp({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r,isSubmitting:a}){let o;return o=a&&e?P(N,{children:[I(tp,{size:12}),I(Ao,{children:t})]}):a&&!e?I(tp,{size:12}):!a&&e?P(N,{children:[I(hl,{Component:Gh}),I(Ao,{children:t})]}):I(Ao,{children:t}),I(Sd,{type:"submit",disabled:n||a,stylists:[np],onClick:r,children:o})}const ap=cr({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 op({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=yr("vertical"===e?ur["vertical-divider"]:ur["horizontal-divider"],n,ap({alignment:e,color:t}));return I("div",{...r})}const ip=or({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),lp=[yr(null,or({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],sp=yr(null,or({display:"flex",alignItems:"center",gap:"4px"}));function cp({errorMessage:e}){return P("div",{...sp,children:[I(Pd,{Component:xi,stylists:lp}),I(Io,{intent:"danger",wrap:"wrap",children:e})]})}const dp=or({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function up({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o,isSubmitting:i}){return P(N,{children:[I(op,{alignment:"horizontal",color:"normal"}),P("div",{className:ip,children:[e,o&&I("div",{className:dp,children:I(cp,{errorMessage:o})}),I(rp,{showIcon:t,disabled:r,onClick:a,textContent:n,isSubmitting:i})]})]})}const hp=or.raw({_notDisabled:{"&[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"}},_disabled:{backgroundColor:"surface.foreground.disabled",color:"typography.base.weak",pointerEvents:"none",borderColor:"border.layout"}}),pp=or.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function gp({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1,disabled:l=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i,"data-disabled":l||void 0}}}const mp=or({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},hp),vp=or(pp),fp=or({display:"flex",flexDirection:"column",gap:"8px"}),bp=or({display:"flex",justifyContent:"space-between",alignItems:"center"});function yp({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:c,errorMessage:u,disableHover:h=!1,type:p,remainingChars:g,hasErrorStyles:m,disabled:v=!1}){const f=yr(i||null,mp,l,vp,dl),b=Yh(),y=we(b.form.store,e=>e.isSubmitting)||v,[C,x]=d(!0),{dataAttributes:T}=gp({isActive:C,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:m,disableHover:h,disabled:y});return P("div",{className:fp,children:[P("div",{className:bp,children:[void 0!==r&&I(hc,{children:r}),pr(g)&&I(hc,{children:`${g}`})]}),I("div",{...f,onClick:s,...n,onMouseDown:e=>{x(!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:()=>{x(!1),c?.()},...T,children:e}),o&&"open"!==n?.["data-state"]&&u&&I(cp,{errorMessage:u})]})}const Cp=or({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled",_notDisabled:{"&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}}});function xp({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a,disabled:o}){const i=Yh(),l=we(i.store,e=>e.meta.errors[0]?.message),s=we(i.store,e=>e.meta.isDefaultValue),c=we(i.store,e=>e.meta.isTouched);return I(yp,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:s,isTouched:c,className:ur["discreet-form-input"],additionalStyles:Cp,errorMessage:l,onClick:a,onBlur:i.handleBlur,disabled:o,children:e})}function Tp(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 wp(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function kp(e){"Enter"===e.key&&e.currentTarget.blur()}const Ep=yr(ur["amount-input"],Ar({metric:"md"}),or({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),Ap=yr(null,or({display:"flex",alignItems:"center",gap:"2px"}));function Sp({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=d(!1);return P("div",{...Ap,children:[hr(e)&&I(Ru,{children:"$"}),I(Ee,{...Ep,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:hr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:kp,autoFocus:o})]})}const Ip=cr({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",_disabled:{backgroundColor:"surface.foreground.disabled"}},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function Np({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=Yh(),h=we(u.store,e=>e.meta.errors[0]?.message),p=we(u.store,e=>e.meta.isTouched),g="string"==typeof u.state.value?u.state.value.length:0,m=pr(c)?c-g:void 0;return I(yp,{label:t,inputRef:r,popupTriggerProps:o,className:ur["editable-form-input"],additionalStyles:Ip({kind:e}),errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:m,hasErrorStyles:d,disabled:a,children:n})}const Pp=yr(null,or({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function Rp({options:e,onSelect:t,selectedLabel:n}){const r=Ic();return I("div",{...Pp,children:e.map(e=>I(Wc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const Dp=yi(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"),Mp=yr(ur["dropdown-selector-button"],or({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"}}),sl);function Lp({selectedLabel:e,options:t,onSelect:n}){return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:t=>P("button",{...Mp,...t,children:[I(Ao,{children:e}),I(Rc,{Component:Dp})]})}),I(Bc,{children:I(Rp,{options:t,onSelect:n,selectedLabel:e})})]})}const Fp=yr(null,or({display:"flex",alignItems:"center",gap:"15px"})),Op=Nt.map((e,t)=>({value:t,label:e})),Vp=Pt({}).map(e=>({value:e,label:String(e)}));function Up({currentMonthYear:e,onMonthYearChange:t}){const n=e.getFullYear(),r=e.getMonth(),a=(e,n)=>{const r=new Date(e,n,1);t(r)};return P("div",{...Fp,children:[I(Lp,{selectedLabel:Nt[r],options:Op,onSelect:e=>a(n,e)}),I(Lp,{selectedLabel:String(n),options:Vp,onSelect:e=>a(e,r)})]})}const Bp=yr(null,or({background:"surface.foreground",padding:"25px",gap:"15px"})),Hp=yr(null,or({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),Wp=yr(ur["date-picker-nav-button"],or({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"}}),sl),_p=yr(null,or({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),qp=yr(null,or({padding:"8px",textAlign:"center"})),zp=yr(ur["date-picker-day-button"],or({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"}}),sl),jp=yr(null,or({color:"typography.base"}));function Kp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&Rt(e,t),l=Dt(e),s=e.getMonth()!==n,c=!!a&&Mt(e,a),d=!!o&&Mt(o,e);return I("button",{...zp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(Ao,{stylists:s||c||d?[jp]:[],children:e.getDate().toString()})})}function Yp({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=Ic(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=ut(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&&Mt(a,u),g=hr(o)||d.length>0&&Mt(d[0],o),m=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return P("div",{...Bp,children:[P("div",{...Hp,children:[I("button",{...Wp,onClick:()=>v(-1),disabled:!g,"aria-label":"Previous month",children:I(hl,{Component:ol})}),I(Up,{currentMonthYear:l,onMonthYearChange:r}),I("button",{...Wp,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:I(hl,{Component:il})})]}),P("div",{..._p,children:[It.map(e=>I("div",{...qp,children:I(Io,{children:e})},e)),d.map(t=>I(Kp,{date:t,selectedDate:e,currentMonth:c,onClick:m,maxDate:a,minDate:o},t.toISOString()))]})]})}const Zp=yr(null,Ar({label:"default"}),or({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),Gp=yr(null,Ar({label:"default"}),or({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 Qp(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant",block:"end"}),e.current.setAttribute("data-hasscrolled","true"))}async function Xp(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 Jp=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),$p=[...Jp].map(e=>`.${e}`).join(","),eg=/* @__PURE__ */new Set(["xls","xlsx","csv"]),tg={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...Jp].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."},ng={"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 rg(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 ag(e,t,n){return rg(e,null,e.name,t,!1,!0,n)}async function og(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||!Jp.has(r))return tg.unsupportedFileType;if(e.size>52428800)return eg.has(r)?tg.fileTooLargeSpreadsheet:tg.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await Xp(e);for(const e of a)if(await Xp(e.file)===t)return tg.duplicate}return null}(e,t);return n?ag(e,n):rg(e,null,e.name,tg.pendingUpload,!0,!1)}const ig=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Ha(n).getUrl(`/files/upload/${a}`),s=Dr(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 lg(){return Nh({mutationFn:ig,onSuccess:async()=>Ur.invalidateQueries({queryKey:["files/attachments"]})})}const sg=async({data:e,accessToken:t,environment:n})=>{const r=Ha(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 cg=or({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),dg=or({display:"none"}),ug=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=lg();return{mutateAsync:u(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 rg(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return ag(e.file,tg.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=u(()=>{r.current?.click()},[]),l=u(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>og(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 P("div",{children:[I("input",{className:dg,type:"file",multiple:!0,accept:$p,ref:r,onChange:l}),I(tc,{type:"button",onClick:i,children:I("span",{className:cg,children:I(Pd,{Component:td})})})]})},hg=S.custom(),pg=S.object({message:S.object({text:S.string(),attachments:S.array(hg)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),gg=or.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),mg=or.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"}),vg=or(mg,gg),fg=or.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),bg=or(fg,gg,Ar.raw({body:"default"})),yg=or({display:"block",width:"100%"}),Cg=or({position:"relative"}),xg=or({display:"flex",justifyContent:"flex-end",gap:"15px"}),Tg=or({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),wg=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Yh(),c=a(null),{startCallback:d}=Il({delay:50,callback:e=>n(e)});m(l,()=>c.current);const u=!e&&pg.safeParse(s.form.state.values).success;return I(Np,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(Qp(t),void d(!0)),children:P("div",{className:yg,children:[P("div",{className:Cg,children:[P("pre",{className:vg,children:[s.state.value.text,I("br",{})]}),I("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:bg,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),P("div",{className:xg,children:[!i&&I(ug,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),I(tc,{disabled:!u,type:"submit",children:I("span",{className:Tg,children:I(Pd,{Component:Dd})})})]})]})})}),kg=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,Eg=l(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function Ag(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 Sg(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 Ig(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 Ng(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 Pg(e){const[t,n]=d(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:l,isMousing:c,isScrolling:h}=function(e,t){const n=a(null),[r,o]=d(!0),[l,c]=d(!1),u=i(Eg),[h,p]=v(Ag,{focusedIndex:null,maxIndex:e});s(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&hr(h.focusedIndex)&&void 0!==u?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,u?.popupNodeId,t.forceRootCascade]);const g=a(null);return s(()=>{p({type:"max",max:e})},[e]),s(()=>{const e=n.current;if(null!==e){const n=e=>{c(!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),c(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>c(!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:l}}(t.size-1,e),p=Ic(),g=u((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),m=u(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:f,sortedMap:b}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(Sg)),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){s(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=Ng(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&&Ig(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,f,b,l.focusedIndex,p,e);const{startCallback:y,cancelCallback:C}=Il({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&Ig(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return x=l.focusedIndex,s(()=>{const e=E.current;if(null===x||T)return;const{node:t,metadata:n}=Ng(x,w,k);return A.lastOpenedIndex!==x&&n?.hasCascading&&(A.closeCurrentCascade(),S({focusedIndex:x,node:t,listElement:e})),()=>I()},[x,T=c,E=r,A=e,I=C,w=f,k=b,S=y]),function(e,t,n,r){s(()=>{const{metadata:a}=Ng(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(l.focusedIndex,f,b,e),o(()=>({register:g,unregister:m,map:b,focusedIndex:l.focusedIndex,listRef:r,isMousing:c,isScrolling:h,popupNodeId:p?.nodeId}),[g,m,b,l.focusedIndex,r,c,h,p?.nodeId]);var x,T,w,k,E,A,S,I}const Rg=l(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function Dg({style:e,children:t,forceNewCascade:n}){const r=yr(ur["popup-list"],Tc,e),a=function(e){const[t,n]=d(null),[r,a]=d(!1),[o,i]=d(null),l=u((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=u(()=>{n(null),i(null),a(!1)},[n,i,a]),c=u(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:c,forceRootCascade:e}}(n),o=Pg(a);return I("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:I(Eg.Provider,{value:o,children:I(Rg.Provider,{value:a,children:t})})})}function Mg({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=Mr(e),h=e=>{n?.(e)};return P(N,{children:[d&&I(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?I(o,{...l??{},onClick:h,searchTerm:e}):I(i,{...l??{},onClick:h})]})}const Lg=lr(Ar({body:"default"}),or({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function Fg({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return s(()=>{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)}},[]),I("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Lg})}function Og({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=Ic(),[c,u]=d(""),h=Mr(c),p=l?.(h);return I(Bc,{children:I(Dg,{style:p,children:I(Mg,{searchTerm:c,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:Fg,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function Vg({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:l,focusedIndex:s,isMousing:c,listRef:d}=i(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!==l&&null!==t.current?l.get(t.current)?.index??-1:-1,[l]),p=h===s;g(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const m=u(()=>{d?.current?.focus()},[d]),v=o(()=>({onFocus:m,"data-focused":p}),[m,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const Ug=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...kc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),Bg=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=Vg(),l=ve([i,r]);return I(Ug,{...kc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),Hg=or({display:"flex",gap:"8px",alignItems:"center"});function Wg({promptText:e}){return P("div",{className:Hg,children:[I(hl,{Component:Hs}),I(hc,{children:e})]})}function _g({text:e}){return I("div",{...kc,children:e?I(Ao,{children:e}):I(ei,{styles:or({width:"100%",height:"16px"})})})}const qg=yr(ur["popup-list"],Tc),zg=()=>P("div",{...qg,children:[I(_g,{}),I(_g,{}),I(_g,{}),I(_g,{}),I(_g,{})]});function jg({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(zg,{}):P(N,{children:[r&&I(Bg,{onClick:()=>is("BankAccountForm"),children:I(Wg,{promptText:"Add bank account"})}),e?.map(e=>I(Bg,{onClick:()=>t(e),children:I(Ao,{wrap:"wrap",children:gh(e?.name,e?.mask)})},e?.id))]})}const Kg={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Yg={...Kg,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function Zg({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ae(e??[],Yg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(zg,{}):P(N,{children:[a&&I(Bg,{onClick:()=>is("BanksAndIntegrations"),children:I(Wg,{promptText:"Add bank account"})}),0===l.length?I(_g,{text:"No results found"}):l.map(e=>I(Bg,{onClick:()=>n(e),children:I(Ao,{wrap:"wrap",children:gh(e?.name,e?.mask)})},e?.id))]})}function Gg({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(Og,{onClick:e,placeholder:"Search bank accounts...",SearchList:Zg,DefaultList:jg,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Qg=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function Xg({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=gh(n?.name??"",n?.mask??"");return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:r=>I(Np,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:Qg,type:"button",disabled:t,children:pr(n)?I(hc,{children:i}):I(hc,{intent:"weak",children:"Select bank account"})})})}),I(Gg,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const Jg=e=>{if(hr(e))return!1;const t=e.filter(e=>Hh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||pr(e.lastSyncedDate))},$g=()=>{const e=xh({select:e=>({...e,hasPlaidLinkedBankAccount:(e?.data?.filter(e=>"PLAID"===e.apiName)??[]).length>0})});return{...e,hasPlaidLinkedBankAccount:!!e.query.data&&e.query.data.hasPlaidLinkedBankAccount}};function em(){return xh({select:e=>{return{...e,plaidItemAccountsReadyToSync:Jg(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>Hh(e.apiName)))};var t}})}function tm(e){return e?.filter(e=>Bh(e.apiName)&&"ACTIVE"===e.status)}function nm(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function rm(e){return xh({select:t=>({...t,data:nm(t?.data,e)})})}const am=e=>{const{query:t}=xh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data};function om({options:e,onClick:t}){const n=Ic();return I(Bc,{children:I(Dg,{children:e.map((e,r)=>I(Bg,{onClick:()=>(t(e),void n.close()),children:I(hc,{children:e.label})},`${e.label}_${r}`))})})}const im=yr(null,or({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),lm=or.raw({color:"typography.base.weak"}),sm=(e,t)=>e===t;function cm({options:e,label:t,isEqual:n=sm,isEmpty:r,disabled:a}){const o=Yh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!hr(o.state.value)&&!r?.(o.state.value);return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:n=>I(Np,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...im,type:"button",children:I(hc,l?{children:i(e,o.state.value)}:{extraClassNames:[lm],children:`Select ${t.toLowerCase()}...`})})})}),I(om,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const dm=or({border:"none",outline:"none",backgroundColor:"transparent"},Ar.raw({label:"default"})),um=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"})),hm=yi(um,"Bank",{styleIconKey:"bank"}),pm=cr({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 gm({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?gh(e,t):e;return P("div",{className:pm({active:r}),children:[n&&I(Io,{intent:r?"normal":"weak",children:n}),I(hc,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const mm=e=>["plaidInstitutionLogo",e??{}],vm=yr(ur["category-icon"],or({objectFit:"contain"})),fm=yr(ur["category-icon"],or({objectFit:"contain",color:"icon.base"}));function bm(e,t,n){const r=({size:n=24})=>{const{icons:r}=i(fi),a=e;return Mr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?I(Se,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...fm}):I("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...vm});var o};return r.displayName=t,r}const ym=or({display:"flex",gap:"10px",maxWidth:"100%"});function Cm({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=Fr(),n=Hr();return M({queryKey:mm({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await ju({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?bm(i,"Logo"):void 0;return P("div",{className:ym,children:[I(Ad,{Component:l&&o?l:hm}),I(gm,{accountName:e,accountNo:t,active:a,syncText:r})]})}const xm=yr(ur.text,Ar({label:"strongLabel"}),or({maxWidth:"100%"}),to);function Tm({children:e,stylists:t=[]}){const n=Er([xm,...t]);return I("div",{...n,children:e})}const wm=or({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function km({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(tc,{...r,disabled:n,width:"fill-parent",children:I(Tm,{children:e?gh(e.name,e.mask):P("div",{className:wm,children:[I(hc,{children:t}),I(hl,{Component:Hs})]})})})}const Em="TRIGGER_ACCOUNT",Am="FORM_SELECTABLE_ACCOUNT",Sm=or({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Im({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return P("div",{className:Sm,children:[P(Sc,{placement:"bottom-start",children:[I(Nc,{children:t=>I(km,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Em?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(Gg,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I(cp,{errorMessage:o})]})}const Nm=(e,t,n)=>{if(!n)return;const r=e===Am?t:n,a=e===Am?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,Hh(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},Pm=or({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Rm=or({display:{base:"block",sm:"none"}}),Dm=or({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Mm=or({display:"flex",justifyContent:"center",alignItems:"center"}),Lm=or({display:{base:"none",sm:"block"}}),Fm=or({display:{base:"block",sm:"none"}});function Om({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return P("div",{className:Pm,children:[P("div",{className:Dm,children:[o?I(Im,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Em,bankAccounts:n,isFilling:r,warningMessage:Nm(Em,e,t??null)}):I(km,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),P("div",{className:Mm,children:[I("div",{className:Lm,children:I(Pd,{Component:il})}),I("div",{className:Fm,children:I(Pd,{Component:Dp})})]}),I(Cm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:Rm,children:I(op,{alignment:"horizontal"})})]})}function Vm({queryKey:e,queryFn:t,...n}){const r=Fr(),a=Hr(),o=Mr(r),i=Nr(e,r??"",a),l=D(),s=U({...n,queryKey:i,queryFn:o?t:Or,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Ur);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const Um=e=>["vendors",e??{}],Bm=e=>["vendors","infinite",e??{}],Hm=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:Ei(r)},o=await La(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},Wm=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return Hm({queryParams:n,cursor:r,accessToken:a,environment:o})};function _m(e={},t){return Sl({queryKey:Um(e),queryFn:Wm,...t})}const qm=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return Hm({queryParams:n,cursor:o,accessToken:r,environment:a})};async function zm(e){const{url:t,headers:n}=Ra(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=Ia({extraHeaders:n,authorization:t});wa("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return wa("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),Na(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function jm(e){return zm(e)}const Km="FAILURE";function Ym(e){return"object"==typeof e&&null!==e}function Zm(e){return!!Ym(e)&&(e.result===Km||Array.isArray(e.data)&&e.data.some(Zm))}const Gm={isFailureResult:function(e){return Ym(e)&&e.result===Km},isPartialFailure:function(e){return!(!Ym(e)||e.result===Km)&&Array.isArray(e.data)&&e.data.some(Zm)},getErrorMessages:function e(t){if(!Ym(t))return[];const n=[];if(Array.isArray(t.error))for(const r of t.error)pr(r)&&Mr(r.message)&&n.push(r.message);if(Array.isArray(t.data))for(const r of t.data)n.push(...e(r));return n}},Qm=async({data:e,accessToken:t,environment:n})=>La({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:Ei(n)}),Xm=async({data:e,accessToken:t,environment:n})=>jm({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:Ei(n)}),Jm=async({data:e,accessToken:t,environment:n})=>La({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:Ei(n)}),$m=async()=>await Ur.invalidateQueries({queryKey:["vendors"]});function ev(){return Nh({mutationFn:Qm,onSuccess:$m,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Vendor saved",defaultErrorMessage:"Couldn't save vendor"}}})}const tv=lr(Ar({body:"default"}),or({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),nv=or({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),rv=yr(ur["button-inline"],or({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function av({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return P("div",{className:nv,children:[I("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:tv}),I("button",{type:"button",onClick:r,...rv,children:I(Io,{children:"Add"})})]})}function ov({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=d(!1),[i,l]=d(""),c=a(null);return s(()=>{r&&c.current&&c.current.focus({preventScroll:!0})},[r]),I(Bg,{onClick:r?void 0:()=>{o(!0)},children:r?I(av,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:c}):I(Wg,{promptText:e})})}function iv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ae(e??[],Kg),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(zg,{}):P(N,{children:[I(ov,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?I(_g,{text:"No results found"}):l.map(e=>I(Bg,{onClick:()=>n(e),children:I(hc,{children:e.name})},e.id))]})}function lv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(zg,{}):P(N,{children:[I(ov,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(Bg,{onClick:()=>t(e),children:I(hc,{children:e.name})},e.id))]})}function sv({onClick:e}){const{query:{data:t,isLoading:n}}=_m({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=ev(),a=t?.data??[];return I(Og,{onClick:e,placeholder:"Search vendors...",SearchList:iv,DefaultList:lv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}function cv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const dv=e=>["customers",e??{}],uv=e=>["customers","infinite",e??{}],hv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:Ei(r)},o=await La(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},pv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return hv({queryParams:n,cursor:r,accessToken:a,environment:o})};function gv(e={},t){return Sl({queryKey:dv(e),queryFn:pv,...t})}const mv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return hv({queryParams:n,cursor:o,accessToken:r,environment:a})},vv=async({data:e,accessToken:t,environment:n})=>La({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:Ei(n)}),fv=async({data:e,accessToken:t,environment:n})=>jm({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:Ei(n)}),bv=async()=>await Ur.invalidateQueries({queryKey:["customers"]});function yv(){return Nh({mutationFn:vv,onSuccess:bv,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Customer saved",defaultErrorMessage:"Couldn't save customer"}}})}const Cv={left:"-100%",right:"100%"},xv={type:"tween",duration:.3},Tv={x:0},wv=e=>({x:Cv[e]}),kv=e=>({x:Cv[e]});function Ev({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(Bc,{style:r,modal:!0,forceMount:t,children:e})}const Av=or({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Sv=yr(null,Av);function Iv({children:e,clickHandler:t}){const n=Ic();return t||(t=()=>{n.close()}),I(be,{lockScroll:!0,...Sv,onClick:t,children:e})}const Nv=or({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 Pv({children:e,overlay:t=!1}){const n=Ic(),r=u(e=>{e.stopPropagation()},[]);return I(Ie,{children:n.context.open&&P(Ev,{fadeIn:!1,forceMount:!0,children:[t&&I(Iv,{}),I(Ne.div,{transition:xv,initial:wv("right"),animate:Tv,exit:kv("right"),className:Nv,onAnimationEnd:r,children:e})]})})}const Rv=or.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Dv=or.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"}),Mv=yr(ur["drawer-header"],or(Rv));function Lv({hideDivider:e=!1,children:t}){return P(N,{children:[I("header",{...Mv,children:t}),!e&&I(op,{alignment:"horizontal",color:"normal"})]})}const Fv=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function Ov({children:e}){return I("div",{className:Fv,children:e})}const Vv=or({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),Uv=cr({base:Dv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function Bv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=Ic();return P(N,{children:[I(Lv,{children:P(Ov,{children:[I(nh,{Icon:ol,handleClose:()=>{r?.(),i.close()}}),I(Ao,{children:o}),!hr(t)&&I("div",{className:Vv,children:t})]})}),I("div",{className:Uv({padChildren:a}),children:n}),e]})}function Hv({overlay:e=!1,...t}){return I(Pv,{overlay:e,children:I(Bv,{...t})})}const Wv=yi(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"}),_v=or({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),qv=yr(ur["drawer-search-bar"],or({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"})),zv=lr(or({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"}}),Ar({label:"strongLabel"})),jv=yr(null,or({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Kv({searchTerm:e,setSearchTerm:t,placeholder:n}){return P("div",{className:_v,children:[I(Ao,{children:"Search"}),P("div",{...qv,children:[I(Pd,{Component:Wv}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:zv}),Mr(e)&&I(tc,{stylists:[jv],onClick:()=>t(""),children:I(Pd,{Component:Pc})})]})]})}function Yv({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=d("");return I(Mg,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Kv,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function Zv({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:d}){const[h,p]=Ec({},a?.selected,i),[g,m]=Ec({},a?.expanded,l),v=u((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),f=u((e,t)=>{const n=t??!g[e],r={[e]:n};m({...g,...r})},[g,m]),b=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:()=>d?.(e)??!0,getIsExpanded:()=>g[r]??!1,toggleExpanded:()=>f(r,!g[r])}})})),[e,r,t,n,h,v,g,f,c,d]);return o(()=>{const e={selected:h,expanded:g};return{groups:b,toggleSelected:v,toggleExpanded:f,getState:()=>e}},[b,v,f,g,h])}const Gv=yi(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"),Qv=or({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function Xv({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return P("div",{className:Qv,children:[I(Pd,{Component:Gv}),I(Ao,{wrap:"wrap",children:`No ${t} found`}),n&&I(Io,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const Jv=or({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function $v({children:e}){return I("div",{className:Jv,children:e})}const ef=yr(ur["list-body"],null);function tf({title:e,children:t}){return P($v,{children:[e,I("div",{...ef,children:t})]})}const nf=yi(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"),rf=yr(null,or({fill:"surface.intent.action.active"}));function af({selected:e,showEmptyIndicator:t}){return e?I(Pd,{Component:wi,stylists:[rf]}):t?I(Pd,{Component:nf}):null}const of=cr({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 lf({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=yr(ur["selector-row"],of({selected:r}),dl);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function sf({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return P(lf,{handleClick:t,selected:n,children:[e,I(af,{selected:n,showEmptyIndicator:r})]})}const cf=or.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function df(){return I(ei,{styles:or(wc,cf)})}const uf=or({width:"70px",height:"24px"}),hf=or({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function pf(){return P("div",{className:hf,children:[I(ei,{styles:uf}),P($v,{children:[I(df,{}),I(df,{}),I(df,{})]}),I(ei,{styles:uf}),P($v,{children:[I(df,{}),I(df,{}),I(df,{})]})]})}function gf({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ae(e,Kg),[e]),s=Zv({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?I(pf,{}):0===s.groups.length?I(Xv,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):I(tf,{title:I(hc,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return I(sf,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:I(hc,{children:t.value.name})},t.key)})})}const mf=or({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),vf=or({width:"100%"});function ff({promptText:e,placeholderText:t,onSubmit:n,onPromptClick:r,keepInlineCreateOnPromptClick:o=!1}){const[i,l]=d(!1),[c,u]=d(""),h=a(null);s(()=>{i&&h.current&&h.current.focus({preventScroll:!0})},[i]);const p=()=>{u(""),l(!1)};return P("div",{className:vf,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||p()},children:[I(op,{alignment:"horizontal"}),I(lf,{handleClick:i?void 0:()=>{r&&(r(),!o)||l(!0)},children:i?I(av,{placeholder:t,value:c,onChange:u,onSubmit:()=>{c.trim()&&(n(c.trim()),u(""),l(!1))},onCancel:p,inputRef:h}):I(Wg,{promptText:e})})]})}function bf(){return gn(e=>e.events.customer)}function yf({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=bf(),l=Zv({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(pf,{}):P($v,{children:[I(ff,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n,onPromptClick:i?()=>i.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}):void 0,keepInlineCreateOnPromptClick:pr(i)&&!i.preventDefault}),P("div",{className:mf,children:[I(hc,{children:"Customers"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I(sf,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(hc,{children:t.value.name})},t.key)})})]})]})}function Cf({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=gv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(cv)})}),{mutateAsync:a}=yv(),o=Ic(),i=n?.data??[],[l,s]=d(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(Hv,{title:"Back",Footer:I(up,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!c}),onClose:()=>s(t?{[t.id]:!0}:{}),children:I(Yv,{placeholder:"Search customers...",onClick:e=>{hr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:gf,DefaultList:yf,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 xf({frequencies:e,onClick:t}){const n=Ic();return I(Bc,{children:I(Dg,{children:e.map(e=>I(Bg,{onClick:()=>(t(e),void n.close()),children:I(Ao,{children:e.name})},e.value))})})}const Tf=cr({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 wf({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=yr(ur["button-group"],lr(Tf({width:a,backgroundColor:o,active:t,corners:i}),js,_s,or(Xs),sl));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(Ao,{wrap:"wrap",textAlign:"center",children:e.label}):I(hc,{wrap:"wrap",alignment:"center",children:e.label})})}const kf=cr({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"}}}});function Ef({width:e,children:t}){return I("div",{className:kf({width:e}),children:t})}function Af({options:e,handleClick:t,selectedIndex:n}){const[r,a]=d(null);return I(Ef,{width:"full",children:e.map((e,o)=>P(f,{children:[0!==o&&I(op,{color:o!==n&&o!==n+1||r===n?"normal":"active"}),I(wf,{option:e,isActive:o===n,handleClick:()=>t(o),onHoverChange:e=>a(e?o:null),width:"full",backgroundColor:"foreground",corners:"rounded"})]},e.value))})}const Sf=yi(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"),If=or({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}"},hp,pp,cl),Nf=yr(null,or({color:"icon.base"})),Pf=yr(ur["attachment-dropzone"],If);function Rf({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return P("div",{...a,...e({className:Pf.className,onMouseDown:r,onBlur:n}),children:[I("input",{...t()}),I(Pd,{stylists:[Nf],Component:Sf}),I(hc,{children:"Add Files"})]})}const Df=or({display:"flex",flexDirection:"column",gap:"8px"}),Mf=or({display:"flex",justifyContent:"space-between",alignItems:"center"});function Lf({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return P("div",{className:Df,children:[o&&I("div",{className:Mf,children:I(hc,{children:o})}),I(Rf,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&I(cp,{errorMessage:i})]})}const Ff=or({display:"flex",justifyContent:"start",width:"100%"}),Of=or({display:"flex",alignItems:"center",gap:"9px"}),Vf=or({width:"100%"}),Uf=cr({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function Bf(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Hf({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||!Bf(n)}),[e,t]),s=o(()=>new Ae(l,Kg),[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 I(Xv,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return P(N,{children:[I("div",{className:Ff,children:I(hc,{children:"Search Results"})}),I("div",{className:Uf({nested:u}),children:d.map(e=>I("div",{className:Vf,children:e.map(e=>I(lf,{handleClick:()=>i(e),selected:r[e.id],children:P("div",{className:Of,children:[I(af,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(hc,{children:e.name})]})},e.id))},e[0].id))})]})}const Wf=yi(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"),_f=cr({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"}}}}),qf=or({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"}}),zf=or({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 jf({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=yr(ur["selector-row"],_f({active:r,expanded:a}),dl);return P("div",{...i,children:[o?P("button",{type:"button",className:qf,onClick:t,children:[I(af,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:qf,children:e}),!hr(n)&&I("button",{type:"button",className:zf,onClick:n,children:I(Pd,{Component:a?Wf:Dp})})]})}function Kf({dimensionValueRows:e,onClick:t}){return e.map(e=>I(lf,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:P("div",{className:Of,children:[I(af,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(hc,{children:e.value.name})]})},e.key))}function Yf({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=Zv({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||!Bf(t)}}),c=s.groups.some(e=>e.getRows().length>1);return P(N,{children:[I("div",{className:Ff,children:I(hc,{children:e})}),I("div",{className:Uf({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return P("div",{className:Vf,children:[(c||0===t)&&I(op,{alignment:"horizontal"}),I(jf,{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:I(hc,{children:n.value.name})}),n.expanded&&P(N,{children:[I(op,{alignment:"horizontal"}),I(Kf,{dimensionValueRows:r,onClick:i})]})]},e.key)}return I(Kf,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function Zf({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=u(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 I(Yv,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Hf,DefaultList:Yf,listLength:t.flatDimensionValues.length,extraProps:t})}function Gf({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||!Bf(n)}),[n,r]),[l,s]=d(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),c=o(()=>i.flat(),[i]),u=Ic(),h=Object.values(l).some(Boolean);return I(Bv,{title:"Back",Footer:I(up,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=c.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:I(Zf,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:c,selectedRow:l,setSelectedRow:s})})}function Qf(e){const t=Ic();return I(Pv,{children:t.open&&I(Gf,{...e})})}const Xf=or({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),Jf=or.raw({color:"typography.base.weak"});function $f(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 eb=/\D/g,tb=or({border:"none",outline:"none",backgroundColor:"transparent"},Ar.raw({label:"default"})),nb=or({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),rb=cr({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:"template",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),ab=or({border:"none",background:"none",padding:0,cursor:"pointer"}),ob=or({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function ib({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return P("div",{...yr(ur.pill,n,rb({disabled:r})),children:[I("div",{className:ob,children:e}),I("button",{className:ab,onClick:t,disabled:r,children:I(Rc,{Component:Pc,stylists:[yr(null,nb)]})})]})}const lb=S.email(),sb=or({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),cb=or({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},Ar.raw({label:"default"})),{useAppForm:db,withForm:ub,withFieldGroup:hb}=ke({formContext:jh,fieldContext:Kh,formComponents:{SaveButton:Xh,FormSaveButton:rp,FormFooter:up},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Yh();return I(xp,{inputRef:t,label:e,children:I(Sp,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Yh();return I(Np,{inputRef:r,label:e,hasErrorStyles:t,children:I(Sp,{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=Yh(),s=we(l.store,e=>e.meta.isDefaultValue),c=a(null),[u,h]=d(()=>l.state.value?Vt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Vt(l.state.value):null,[g,m]=d(""),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=Ot(r);if(a){let e=a;t&&n?e=Ht(Bt(a,t),n):t?e=Bt(a,t):n&&(e=Ht(a,n)),l.handleChange(Ut(e)),h(e)}else l.handleChange("")},f=g||(p?Lt(p):""),[b,y]=d(!1),C=e=>{b&&(()=>{if(p&&!s){const e=Ot(g);(t&&e&&Mt(e,t)||n&&e&&Mt(n,e))&&m(Lt(p))}})(),y(e)},x=e=>{"Enter"===e.key&&(e.preventDefault(),C(!b))},T=o?Np:xp;return P(Sc,{placement:"bottom-start",onOpenChange:C,open:b,children:[I(Nc,{children:t=>I(T,{label:e,inputRef:c,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:I("input",{...Zp,ref:c,type:"text",id:l.name,value:f,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:x,autoComplete:"off"})})}),I(Bc,{initialFocus:!1,children:I(Yp,{selectedDate:p,onDateSelect:e=>{l.handleChange(Ut(e)),m(Lt(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=Yh(),i=a(null);return I(Np,{label:e,inputRef:i,children:I("textarea",{...Gp,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:wg,ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Yh(),a=am(t?.id??""),{query:{data:o},isFilling:i}=xh({select:e=>({...e,data:tm(e?.data)})}),l=o?.data,s=pr(e)&&!kg(e);return I(Xg,{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=Yh(),r=t.findIndex(e=>e.value===n.state.value);return I(Np,{label:e,disableHover:!0,children:I(Af,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:cm,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Yh(),l=a(null);return I(Np,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:I("input",{className:dm,value:i.state.value,onChange:e=>i.handleChange(e.target.value),type:t,maxLength:n,ref:l,placeholder:o})})},BulkMergeAccountRowField:Om,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const o=a(null),i=r?Np:xp,{handleBlur:l}=Yh();return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(hc,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})}),I(sv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?Np:xp;return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(hc,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})}),I(Cf,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??gs[0].name}`;return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:t=>I(Np,{inputRef:r,label:e,popupTriggerProps:t,children:I(Ao,{children:o})})}),I(xf,{frequencies:gs,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=ng,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Yh(),c=we(s.form.store,e=>e.isSubmitting),{mutateAsync:u}=lg(),[h,p]=d(!0),{dataAttributes:g}=gp({isActive:h,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l,disabled:n||c}),{getRootProps:m,getInputProps:v}=Pe({maxFiles:e,accept:t,disabled:n||c,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=>og(e,n))),...i.map(e=>ag(e,tg.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const d=c.map(async e=>{try{const t=await u({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(d);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 I(Lf,{getRootProps:m,getInputProps:v,dataAttrs:g,onMouseDown:()=>p(!0),onBlur:()=>p(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return P(Sc,{children:[I(Nc,{children:n=>I(Np,{label:e,popupTriggerProps:n,children:I("button",{className:Xf,type:"button",children:I(hc,t?{children:t.name}:{extraClassNames:[Jf],children:`Select ${e.toLowerCase()}...`})})})}),I(Qf,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Yh(),o=a(null),i=a(null);return g(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),I(Np,{label:e,disabled:t,inputRef:o,kind:"text",children:I("input",{className:tb,value:$f(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace(eb,"").length,o=t.value.replace(eb,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=$f(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=Yh(),[o,i]=d(""),l=a(null),s=r.state.value,c=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=lb.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 I(Np,{label:e,disabled:t,inputRef:l,kind:"container",children:P("div",{className:sb,children:[s.map(e=>I(ib,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:ur["email-pill"],disabled:t},e)),I("input",{ref:l,className:cb,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:c,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),c()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const pb=[yr(null,or({"& path":{stroke:"icon.base"}}))];function gb({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return P(tc,{type:"button",onClick:n,children:[e&&I(hl,{Component:Pc,stylists:pb}),I(Ao,{children:t})]})}const mb=or({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),vb=or({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),fb=or({maxWidth:"600px"}),bb=or({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),yb=or({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Cb=or({display:"flex",justifyContent:"flex-start",alignItems:"center"}),xb=or({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Tb=or({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),wb=or({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),kb=e=>{Tp(e),wp(e)};function Eb({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=xh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=Uh(),a=Fr(),o=Hr(),i=pr(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,ps({queryKey:Pr(fs({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:ys,accessToken:n,environment:r}))}),db({defaultValues:l,onSubmit:async e=>{if(await qh()===Yu){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await zh());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=Pr(fs({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await hs({queryKey:r,queryFn:ys,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Vt(e.tranStartDate||""),l=Vt(n||""),s=Vt(e.tranMinStartDate||""),hr(l)?i:pr(s)?Ht(l,s):(pr(i)&&Ht(l,i),i));var i,l,s;return hr(r)?null:Ut(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...Wh(t),duplicateBankAccountIds:[Is(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await zh()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return P("form",{className:mb,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:kb,children:[P("div",{className:vb,children:[I(Ao,{children:"Merge Accounts"}),I("div",{className:fb,children:I(hc,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),P("div",{className:bb,children:[P("div",{className:yb,children:[I("div",{className:Cb,children:I(Ao,{children:"Duplicate Account"})}),I("div",{className:xb,children:I(Ao,{children:"Into"})}),I("div",{className:Tb,children:I(Ao,{children:"Destination Account"})})]}),I(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>I(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 I(Om,{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))})]}),I("div",{className:wb,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return P(N,{children:[I(gb,{showIcon:!1,onClick:()=>n()}),I(Sd,{onClick:()=>i.reset(o),disabled:!t,children:I(Ao,{children:"Clear Selections"})}),I(Xh,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Ab=or({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"}),Sb=Ce.createConfirmation(xe(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I($u,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:Ab,children:I(Eb,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Ib({plaidItemAccounts:e,matchingAccountPairs:t}){await Sb({matchingAccountPairs:t,plaidItemAccounts:e})}const Nb=or({display:"flex",flexDirection:"column",gap:"12px"}),Pb=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:zu(n)},{url:a,headers:o}=Ra(r);return Ai({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(wa("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(ka({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),fh("NO_LINK_TOKEN"))}catch(r){return ka({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),fh("LINK_TOKEN_FAILED")}};async function Rb(e,t,n){const r=await async function(e,t){const n=Pr(Hu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await hs({queryKey:n,queryFn:Wu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Db(e,t,n,r){wa("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||wa("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,ps({queryKey:Pr(bh({filter:yh}),{}),queryFn:Ch,accessToken:r,environment:a});const o=await Rb(e,t,n);if(o){const e=await Th(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:zu(r)},{url:o,headers:i}=Ra(a);return await Da({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(wa("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Ur.invalidateQueries({queryKey:["integrations"]}),Ur.invalidateQueries({queryKey:["banks/accounts",{}]}),Ur.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===Ah({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return ka({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 Th(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?(ka({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ch({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:Ku,label:"Cancel"},{key:Zu,label:"Chat",type:sh.SUCCESS}]})===Zu&&mh({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void ka({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 ka({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ch({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:Ku,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return ka({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 ch({title:"All set! Ready to track your transactions?",body:P("div",{className:vh,children:[I(hc,{wrap:"wrap",children:`Your ${n} ${t} ${dh("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(hc,{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.`}),I("ul",{children:e.map(e=>I("li",{children:I(hc,{wrap:"wrap",children:gh(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:Zu,label:"Get Started",type:sh.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 ch({title:"Your transactions are being categorized",body:P("div",{className:Nb,children:[I(hc,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(hc,{wrap:"wrap",children:"Hurdlr has detected that the following accounts may be duplicates of the newly linked accounts."}),P("ul",{children:[r.map(({duplicateAccount:e})=>I("li",{children:I(hc,{wrap:"wrap",children:gh(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(hc,{wrap:"wrap",children:"and more..."})})]}),I(hc,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:Ku,label:"No thanks"},{key:Zu,label:"Review",type:sh.SUCCESS}]})===Zu&&await Ib({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(ka({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ch({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${dh("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:Zu,label:"Get started",type:sh.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return ka({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ch({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:Ku,label:"Cancel"},{key:Zu,label:"Chat",type:sh.SUCCESS}]})===Zu&&mh({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 Mb(e,t,n){return hr(e)?(wa("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(wa("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(ka({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&&(ka({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 ch({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:Ku,label:"Cancel"},{key:"chat",label:"Chat"},{key:Zu,label:"Banks & Integrations",type:sh.SUCCESS}]});"chat"===t?mh({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==Zu||(e=>{const t=gn.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||is("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Lb=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${_t(t.lastSyncedDate)}`},Fb=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},Ob="PLAID_LINK_NEW",Vb="PLAID_LINK_UNLINK_RELINK",Ub="PLAID_LINK_UPDATE",Bb="PLAID_LINK_UNLINK";function Hb({plaidEvent:e,apiAccessToken:t,apiErrorCode:n}){const r=t?{plaidAccessToken:t}:null,a=null!=n;switch(e){case Ob:return{type:"PLAID_LINK_NEW",result:"SUCCESS",data:null,error:null};case Ub:return a?{type:"PLAID_LINK_RESET",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RESET",result:"SUCCESS",data:r,error:null};case Vb:return a?{type:"PLAID_LINK_RELINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RELINK",result:"SUCCESS",data:r,error:null};case Bb:return a?{type:"PLAID_LINK_UNLINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_UNLINK",result:"SUCCESS",data:r,error:null};default:return null}}function Wb({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}}}function _b(){return gn(e=>e.events.plaidLink)}function qb(){return gn(e=>e.events.plaidLinkEvent)}function zb(){return gn(e=>e.events.plaidLinkError)}const jb=l({});function Kb({onPlaidLink:e,children:t}){return I(jb.Provider,{value:{onPlaidLink:e},children:t})}function Yb(){return i(jb)}const Zb=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Ha(n)};return await Fa(r)};function Gb(){return Nh({mutationFn:Zb,onSuccess:()=>{const e=["integrations"];return Ur.invalidateQueries({queryKey:e})}})}const Qb=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Ha(t)};return await Fa(n)};function Xb(){return Nh({mutationFn:Qb,onSuccess:()=>{const e=["integrations"];return Ur.invalidateQueries({queryKey:e})}})}const Jb=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(Is(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Ha(n)};return await async function(e){return zm(e)}(r)};function $b(){const{mutate:e}=Xb();return Nh({mutationFn:Jb,onSuccess:()=>{const e=["integrations"];return Ur.invalidateQueries({queryKey:e})},onError:async t=>{ka({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ch({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:Ku,label:"Cancel"},{key:Zu,label:"Try Again",type:sh.SUCCESS}]})===Zu&&e()}})}function ey(e,t){return new Promise(n=>{window.Plaid.create({token:e,onSuccess:(e,t)=>n({status:"success",public_token:e,metadata:t}),onExit:(e,t)=>n({status:"exit",metadata:t,error:e}),onEvent:(e,n)=>{wa(`Plaid event: ${e}`,{metadata:n,eventName:e}),t?.listener({type:"PLAID_LINK_EVENT",result:"SUCCESS",data:{eventName:e,metadata:n},error:null})}}).open()})}async function ty(e,t,n,r,a,o){const i=await Pb(e,t,n);if(!i)return;const l=await ey(i,a);if("success"===l?.status){const{public_token:e,metadata:i}=l;wa("Plaid link successful",{public_token:e,metadata:i});const s=await Db(e,i,t,n);if(s.relinkPlaidItemId)return ty(s.relinkPlaidItemId,t,n,r,a,o)}else if("exit"===l?.status){const{metadata:e,error:t}=l;wa("Plaid link exited",{metadata:e,error:t}),t&&o?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await Mb(t,e,i)&&r()}else ka({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:l,token:i}})}function ny(){const[e,t]=Bu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Fr(),r=Hr(),{mutate:a}=Xb(),{onPlaidLink:o}=Yb(),i=_b(),l=qb(),s=zb();return{linkPlaid:e=>{if(pr(i)){const t=Hb(e);if(pr(t)&&i.listener(t),i.preventDefault)return}if(pr(o)){const t=Wb(e);o(t)}else ty(e.plaidItemId?Is(e.plaidItemId):void 0,n,r,a,l,s)},loading:e||pr(t),hasOnPlaidLinkOverride:pr(i)||pr(o)}}function ry(){const[e,t]=Bu({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Fr(),r=Hr(),{mutate:a}=Xb(),{apiPartnerName:o}=i($c),{onPlaidLink:l}=Yb(),s=_b(),c=qb(),d=zb();return{linkPlaid:e=>{if(pr(s)){const t=Hb(e);if(pr(t)&&s.listener(t),s.preventDefault)return}if(pr(l)){const t=Wb(e);l(t)}else!async function(e,t,n,r,a,o,i){const l=await Pb(e,t,n);if(!l)return;const s=await ey(l,o);if("success"===s?.status){const{public_token:e,metadata:l}=s;wa("Plaid link from search successful",{public_token:e,metadata:l});const c=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Rb(t.institution.institution_id,n,r);if(i)return ka({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ch({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:Ku,label:"Cancel"},{key:Zu,label:"Relink",type:sh.SUCCESS}]}))===Zu?{relinkPlaidItemId:Is(i.id)}:{}}var o;return wa("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Db(e,t,n,r)}(e,l,t,n,r);c.relinkPlaidItemId&&ty(c.relinkPlaidItemId,t,n,a,o,i)}else if("exit"===s?.status){const{metadata:e,error:t}=s;wa("Plaid link from search exited",{metadata:e,error:t}),t&&i?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await Mb(t,e,l)&&a()}}(e.plaidItemId?Is(e.plaidItemId):void 0,n,r,o,a,c,d)},loading:e||pr(t),hasOnPlaidLinkOverride:pr(s)||pr(l)}}const ay=yr(null,_s,or({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"}}}}),sl);function oy({onPress:e,preventDefault:t,eventSource:n}){const{linkPlaid:r,loading:a}=ny();return P("button",{onClick:()=>{e?.(),t||r({plaidEvent:Ob,message:"Tile Plaid Link button pressed"})},...ay,disabled:a,"data-event-name":n,children:[I(Pd,{Component:Fu}),I(hc,{intent:"primary",children:"Link Account"})]})}const iy=or({width:266,minHeight:32});function ly(){return I(ei,{styles:iy})}const sy=yr(ur.text,or({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to);function cy({children:e}){return I("div",{...sy,children:e})}const dy={SUCCESS:or({backgroundColor:"surface.intent.success.highlight"}),DANGER:or({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:or({backgroundColor:"surface.intent.secondary"})},uy=yr(ur.chip,or({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function hy({variant:e,children:t}){return I("div",{className:lr(uy.className,dy[e]),children:I(cy,{children:t})})}const py=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function gy({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 I(hy,{variant:py(r,n,t),children:a})}const my=or({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function vy({title:e,label:t,comparison:n,invertDirection:r}){return P("div",{className:my,children:[I(go,{title:e,label:t}),pr(n)&&I(gy,{difference:n,invertDirection:r})]})}const fy={netIncome:0,income:0,expenses:0,absoluteSum:0},by=e=>{if(hr(e))return fy;const t=e.income?.total??0,n=e.expenses?.total??0,r=H(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},yy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(by):[]},Cy=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function xy({defaultRange:e=yt.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=wu(),i=u(()=>{a?.listener?.({type:"PROFIT_AND_LOSS_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?jt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return qa({filter:e,grouping:t,select:yy})}({filter:l,grouping:t?Za:void 0}),{profitLossData:d,profitDifference:h}=o(()=>{if(n)return{profitLossData:ui,profitDifference:null};if(!s||0===s.length)return{profitLossData:Cy,profitDifference:null};if(2===s.length){const[e,t]=s;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:s[0],profitDifference:null}},[s,n]);return P(eo,{isSample:n,children:[I(Qa,{title:"Profit + Loss"}),I(Ja,{children:c?P(ni,{children:[I(ly,{}),I(ly,{})]}):P(N,{children:[I(vy,{title:xo(d.netIncome),label:"Profit",comparison:h}),P(vo,{children:[I(Lu,{amount:d.income,total:d.absoluteSum,color:"positive",label:"Income"}),I(Lu,{amount:d.expenses,total:d.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(si,{size:"sm"}),r&&I(oy,{onPress:i,preventDefault:a?.preventDefault})]})}const Ty=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],wy=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...St(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Ha(a)};return await Fa(o)},ky={moneyIn:0,moneyOut:0,netMoneyIn:0},Ey=e=>{if(hr(e)||hr(e.operatingActivities)||!e.operatingActivities.children)return ky;let t=new H(0),n=new H(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(H(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Ay=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Ey):[]};const Sy=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function Iy({defaultRange:e=yt.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=wu(),i=u(()=>{a?.listener?.({type:"CASH_FLOW_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?jt(t):e,{query:{data:s,isFetched:c},isFilling:d}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Wr({queryKey:Ty({filter:e,grouping:t}),queryFn:wy,select:n})}({filter:e,grouping:t,select:Ay})}({filter:l,grouping:t?Za:void 0}),{cashFlowData:h,difference:p}=o(()=>{if(n)return{cashFlowData:pi,difference:null};if(!s||0===s.length)return{cashFlowData:Sy,difference:null};if(2===s.length){const[e,t]=s;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:s[0],difference:null}},[s,n]),g=n||c?Math.abs(h.moneyIn)+Math.abs(h.moneyOut):0;return P(eo,{isSample:n,children:[I(Qa,{title:"Cash Flow"}),I(Ja,{children:d?P(ni,{children:[I(ly,{}),I(ly,{})]}):P(N,{children:[I(vy,{title:xo(h.netMoneyIn),label:"Change in Cash",comparison:p}),P(vo,{children:[I(Lu,{amount:h.moneyIn,total:g,color:"positive",label:"Money In"}),I(Lu,{amount:h.moneyOut,total:g,color:"negative",label:"Money Out"})]})]})}),n&&I(si,{size:"sm"}),r&&I(oy,{onPress:i,preventDefault:a?.preventDefault})]})}const Ny=or({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Py=or({display:"flex",justifyContent:"end"});function Ry({color:e,bulletLabel:t,moneySummary:n}){return P("div",{className:Ny,children:[I(Oo,{color:e,label:t}),I("div",{className:Py,children:I(hc,{children:n})})]})}const Dy=yr(null,or({display:"flex",gap:"10px",alignItems:"center"})),My=or({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Ly=yr(null,My);function Fy({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>P("div",{...Dy,children:[I(Oo,{color:Do.var("colors.brand.secondary")}),t?I(ei,{styles:My}):I("div",{...Ly})]},n))})}const Oy={total:0,children:[]},Vy=e=>{return hr(e)||hr(e.expenses)||!e.expenses.children?Oy:{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},Uy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Vy):[]},By=[Do.var("colors.brand.primary"),Do.var("colors.brand.success"),Do.var("colors.brand.action")],Hy=Object.freeze({total:0,children:[]});function Wy({defaultRange:e=yt.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=gn(e=>e.externalOptions),l=wu(),s=u(()=>{l?.listener?.({type:"EXPENSE_TILE",result:"SUCCESS",data:null,error:null})},[l]),c=i.dataVisualizationColors??By,d=t?jt(t):e,{query:{data:h},isFilling:p}=function({filter:e,grouping:t}){return qa({filter:e,grouping:t,select:Uy})}({filter:d,grouping:t?Za:void 0}),{expenseData:g,expensesDifference:m}=o(()=>{if(r)return{expenseData:hi,expensesDifference:null};if(!h||0===h.length)return{expenseData:Hy,expensesDifference:null};if(2===h.length){const[e,t]=h;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:h[0],expensesDifference:null}},[h,r]),v=void 0===n?"Total Expenses":`${Nt[n]} Total`,f=g.children.length>0;return P(eo,{isSample:r,children:[I(Qa,{title:"Expenses"}),I(Ja,{children:p?I(ni,{children:I(Fy,{shimmer:!0})}):P(N,{children:[I(vy,{title:xo(g.total),label:v,comparison:m,invertDirection:!0}),I(vo,{children:f?g.children.map((e,t)=>I(Ry,{color:c[t],bulletLabel:e.name,moneySummary:xo(e.total)},t)):I(Fy,{})})]})}),r&&I(si,{size:"sm"}),a&&I(oy,{onPress:s,preventDefault:l?.preventDefault})]})}const _y=yr(null,or({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function qy({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:ut(l=e.year,i,1),endDate:ut(l,i+1,0)});var i,l,s,c,d,u,h,p;return P("div",{..._y,children:[P(Tr,{children:[I(Ir,{children:"Monthly Review"}),I(Cu,{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})]}),P(Tu,{children:[I(xy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(Iy,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(Wy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const zy="Oldest to Newest",jy="Newest to Oldest",Ky="A-Z",Yy="Z-A",Zy="Lowest to Highest",Gy="Highest to Lowest",Qy="A-Z",Xy="Z-A";function Jy(){const[e,t]=d(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 ms)??!1,n=(e.direction&&e.direction in vs)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const $y=or({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"}}}),eC=or({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),tC=or({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function nC({checked:e,onClick:t,Icon:n=Gh}){const[r,a]=d(e??!1),o=void 0===e?r:e;return I("button",{...yr(ur["checkbox-input"],$y,o?tC:eC,dl),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&I(Rc,{Component:n})})}const rC=yr(null,or({paddingLeft:"20px",paddingRight:"5px"}));function aC({checked:e,onClick:t,Icon:n=Gh}){return I("div",{...rC,children:I(nC,{checked:e,onClick:t,Icon:n})})}const oC=yr(ur["date-cell"],or({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function iC({date:e,annotation:t}){const n=Lt(Vt(e));return P("div",{...oC,children:[t&&I(cy,{children:t}),I(hc,{children:n})]})}const lC="Income",sC={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},cC={Expense:[{name:"Expense",value:sC.EXPENSE}],Income:[{name:lC,value:sC.REVENUE}],Transfer:[{name:"Bank Transfer In",value:sC.TRANSFER_IN},{name:"Bank Transfer Out",value:sC.TRANSFER_OUT}]},dC={EXPENSE:"Expense",REVENUE:lC,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},uC=Object.fromEntries(Object.entries(dC).map(([e,t])=>[e,`Add ${t}`])),hC=Object.fromEntries(Object.entries(dC).map(([e,t])=>[e,`Edit ${t}`])),pC=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},gC=e=>e===sC.TRANSFER_IN||e===sC.TRANSFER_OUT,mC=or({color:"money.negative"}),vC=or({color:"money.positive"}),fC=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>Rr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),bC=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!hr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:mC};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?vC:mC}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":lC,css:t?mC:vC}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?mC:vC};break;default:t=(e=>({type:e.type,displayName:fC(e.type),css:e.amount<0?mC:vC}))(e)}var n;return t},yC=yi(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"),CC=yr(ur["transaction-date-cell-container"],or({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function xC({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=bC(e),a=yr(ur["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?P("div",{...CC,children:[I(Pd,{Component:yC}),I(iC,{date:e.date,annotation:o})]}):I(iC,{date:e.date,annotation:o})}const TC=or({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),wC=or({display:"flex",flexDirection:"column",width:"100%"}),kC=or({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function EC({label:e,subLabel:t,iconUrl:n}){return P("div",{className:TC,children:[n?I("img",{src:n,className:kC,alt:void 0,width:24,height:24}):I("span",{className:kC}),P("div",{className:wC,children:[I(hc,{children:e}),I(Io,{children:t})]})]})}function AC({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:or({paddingLeft:"25px"}),children:I(EC,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I(EC,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}function SC(e){return To(uh(e.amount))}const IC=yi(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"),NC=yi(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"),PC=or({display:"flex",alignItems:"center",gap:"8px"}),RC=or({padding:"6px"});function DC({row:e}){const t=e.original,n=I(Ru,{children:SC(t)});if(e?.getCanExpand()){const t=e.getIsExpanded();return I(Kc,{ariaLabel:t?"Collapse children":"Expand children",ariaExpanded:t,children:P("div",{className:PC,children:[I(Pd,{Component:t?NC:IC}),n]})})}return I("div",{className:RC,children:n})}const MC=yi(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"),LC=yi(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"),FC=or({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),OC=or({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function VC({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return MC;case"Deposited to":return LC;default:return null}})(e);return P("div",{className:FC,children:[n&&I(Pd,{Component:n}),P("div",{className:OC,children:[e&&I(Io,{children:e}),t&&I(hc,{children:t})]})]})}const UC=or({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"}}),BC=lr(UC,or({padding:"2.5px"})),HC=lr(UC,or({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),WC=or({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"}}),_C=lr(WC,or({_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"}}})),qC=or({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"}}}),zC=lr(qC,or({_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"}}})),jC=or({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"}}),KC=lr(jC,or({_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"}}})),YC=or({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"}}),ZC=lr(YC,or({_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"}}})),GC=or({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"}}),QC=lr(GC,or({_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"}}})),XC=or({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"}}),JC={default:_C,neutral:_C,warning:ZC,success:KC,danger:QC,highlight:zC},$C=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=Er([yr(ur["selector-button"],lr(XC,JC[e]),dl),...n]);return I("button",{ref:a,...o,...r,children:t})}),ex=()=>["accounting/glAccounts"],tx=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await Ni(n);return ax(r)};function nx(e){return Wr({...e,queryKey:["accounting/glAccounts"],queryFn:tx})}function rx(){return nx({select:hx})}const ax=e=>e.map(e=>({...e,id:Ss({id:e.id,prefix:"GL_ACCOUNT"})}));function ox(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 ix(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>ix(e,t))}const lx=e=>!e.parentAccountNo;function sx(e){const t=ox(e);return e.filter(lx).map(e=>({...e,children:ix(e,t)}))}function cx(e,t){return(t.get(e)??[]).map(e=>{const n=cx(e.accountNo,t);return{...e,children:n}})}function dx(e){const t=ox(e);return e.filter(lx).map(e=>({...e,children:cx(e.accountNo,t)}))}function ux(){return nx({select:dx})}function hx(e){return sx(e).flatMap(e=>[e,...e.children])}const px=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function gx(e,t){return o(()=>e?.filter(e=>t.includes(e.type))??[],[e,t])}const mx={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function vx(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function fx(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=>{vx(e,n,t)})}(r,n):a?vx(a,r,n):i&&vx(r,r,n)}),n}const bx=[yr(null,or({marginLeft:"6px",marginRight:"6px"}))],yx=yr(null,or({whiteSpace:"normal"}));function Cx({types:e,onClick:t,searchTerm:n}){const{query:{data:r},isFilling:a}=rx(),i=gx(r,e),l=o(()=>new Ae(i,mx),[i]),s=o(()=>fx(l.search(n),i),[i,n,l]);return a?I(zg,{}):s.map(({parent:e,child:n})=>I(Bg,{onClick:()=>t(n),children:P(Tm,{stylists:[yx],children:[e.name,I(hl,{Component:il,stylists:bx}),n.name]})},`${n.accountNo}`))}const xx=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=ve([a,t?.ref]);return I(Ug,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function Tx({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=i(Rg),{itemRef:o,index:l,itemProps:s}=Vg({hasCascading:!0}),{isScrolling:c}=i(Eg);return P(Sc,{open:n===l,onOpenChange:e=>{c||r(e,l)},placement:"right-start",children:[I(Nc,{children:t=>I(xx,{itemProps:s,index:l,ref:o,popupTriggerProps:t,children:e})}),I(Bc,{initialFocus:a,children:t})]})}const wx=or({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),kx=or({display:"flex",gap:"8px",color:"icon.base"});function Ex({Icon:e,iconUrl:t,displayLabel:n}){const r=t?bm(t,"Icon"):void 0;return P("div",{className:wx,children:[P("div",{className:kx,children:[!hr(e)&&e,hr(e)&&r&&I(Pd,{Component:r}),I(Ao,{wrap:"wrap",children:n})]}),I(hl,{Component:il})]})}function Ax({types:e,onClick:t}){const{query:{data:n,isFetching:r},isFilling:a}=nx({select:sx}),o=gx(n,e);return a?I(zg,{}):a||r||void 0!==n?o.map(e=>I(Tx,{triggerChildren:I(Ex,{displayLabel:e.name}),popupChildren:I(Sx,{glAccount:e,onClick:t})},e.accountNo)):I(_g,{text:"No data"})}function Sx({glAccount:e,onClick:t}){return I(Dg,{children:e.children.map(e=>I(Bg,{onClick:()=>t(e),children:I(Ao,{children:e.name})},e.accountNo))})}const Ix=or({maxWidth:"420px",width:"fit-content"});function Nx({onClick:e,types:t}){const{query:{data:n}}=ux(),r=gx(n,t);return I(Og,{onClick:e,placeholder:"Search revenue accounts...",getSearchActiveStyles:e=>e?Ix:void 0,SearchList:Cx,DefaultList:Ax,extraProps:{types:t},listLength:r.length,forceSearchVisible:!0})}const Px={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 Rx(e,t=!0){const n=Ah({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 Dx(){return _u({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 Mx={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"},Lx=e=>["tasks",e??{}],Fx={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},Ox={filter:{status:{in:["ACTIVE"]}}},Vx=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:Ei(t[2].environment)},a=await La(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function Ux(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=hr(r=e)||hr(r.data)?[]:[...r.data].sort((e,t)=>Fx[e.priority]-Fx[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=Ox,Wr({...r,queryKey:a?Lx(a):["tasks",{}],queryFn:Vx}));var r,a;const{query:{data:i},isFilling:l}=em(),{query:{data:s},isFilling:c}=qu({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=>Rx(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[Px]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const Bx=e=>{const t=el[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},Hx=e=>["banks/transactions/summary",e],Wx=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:Ei(t[2].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},_x=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>jx({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),qx=async({data:e,accessToken:t,environment:n})=>jx({data:{data:e},accessToken:t,environment:n}),zx=async({data:e,accessToken:t,environment:n})=>qx({data:[e],accessToken:t,environment:n}),jx=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:Ei(n)};return await La(r)};function Kx(){return wa("mutation successful, invalidating BT queries"),Promise.all([Ur.invalidateQueries({queryKey:["banks/transactions"]}),Ur.invalidateQueries({queryKey:["banks/transactions/summary"]}),Ur.invalidateQueries({queryKey:["tasks"]}),Ur.invalidateQueries({queryKey:["reports"]})]).catch(e=>ka({error:e,severity:"error"}))}function Yx(){return Gx({mutationFn:zx,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}})}function Zx({mutationKey:e=["banks/transactions"],...t}){return Nh({onSuccess:()=>Kx(),mutationKey:e,...t})}function Gx({mutationKey:e=["banks/transactions"],...t}){return Nh({onSuccess:()=>Kx(),mutationKey:e,...t})}function Qx(){return Zx({mutationFn:qx,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Couldn't update categories"}}})}const Xx=yr(ur["category-selector-table-cell"]);function Jx({transaction:e,parentTransaction:t,accountName:n}){const{startPrefetch:r,cancelPrefetch:a}=Nl({prefetchFn:kl(ex,tx)}),{mutate:o}=Yx(),i=void 0!==t,l=hr(e.glAccount?.iconUrl)?void 0:bm(e.glAccount.iconUrl,"Revenue Icon");return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>P($C,{...e,stylists:[Xx],onMouseEnter:r,onMouseLeave:a,children:[l&&I(Pd,{Component:l}),I(hc,{children:n})]})}),I(Nx,{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:px})]})}const $x=e=>e>0?"Deposited to":"Withdrawn from",eT=yi(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"),tT=e=>({id:e.id,name:e.name});function nT(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:dh("Category","Categories",n.size,!0),list:[...n].join(", ")}}const rT=yr(null,or({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),aT=yr(null,or({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function oT({transaction:e}){const{label:t,list:n}=nT(e.children);return I(dc,{children:P("div",{...aT,children:[I(Pd,{Component:eT}),P("div",{...rT,children:[I(Ao,{children:t}),I(Io,{children:n})]})]})})}const iT=()=>["expenses/categories"],lT=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await Ni(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 sT(e){return Wr({...e,queryKey:["expenses/categories"],queryFn:lT})}function cT(){return sT({select:e=>({...e,data:e.data?mT(e.data):void 0})})}function dT(e,t){return(t.get(e)??[]).map(e=>{const n=dT(e.id,t);return{...e,children:n.length>0?n:void 0}})}function uT(e){if(0===e.length)return[];const t=pT(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=dT(e.id,t);return{...e,children:n.length>0?n:void 0}})}function hT(){return sT({select:e=>({...e,data:e.data?uT(e.data):void 0})})}function pT(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 gT(e){if(0===e.length)return[];const t=pT(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function mT(e){if(0===e.length)return[];const t=pT(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function vT(){return Nl({prefetchFn:kl(iT,lT)})}const fT={keys:[{name:"name"}],threshold:.1};function bT(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function yT(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?bT(a,r,n):o?bT(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{bT(e,n,t)})}(r,n)}),n}const CT=yr(null,or({whiteSpace:"normal"})),xT=[yr(null,or({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function TT({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=sT({select:e=>({...e,data:e.data?gT(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ae(i??[],fT),[i]),c=o(()=>i?yT(s.search(e),i):[],[i,e,s]);return a?I(zg,{}):l?I(_g,{text:"No data"}):0===c.length?I(_g,{text:"No results found"}):I(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=bm(n.iconUrl,"Expense Icon");return P(Bg,{onClick:()=>t(tT(n)),children:[I(Pd,{Component:a}),I(Tm,{stylists:[CT],children:r?n.name:P(N,{children:[e.name,I(hl,{Component:il,stylists:xT}),n.name]})})]},`${e.id}_${n.id}`)})})}function wT({category:e,handleCategoryChange:t}){return I(Dg,{children:e.children?.map(e=>{const n=bm(e.iconUrl,"Expense Icon");return P(Bg,{onClick:()=>t(tT(e)),children:[I(Pd,{Component:n}),I(Ao,{wrap:"wrap",children:e.name})]},e.id)})})}function kT({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=cT(),a=t?.data,o=!r&&n&&void 0===a;return r?I(zg,{}):o?I(_g,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(Tx,{triggerChildren:I(Ex,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(wT,{category:t,handleCategoryChange:e})},t.id);const n=bm(t.iconUrl,"Expense Category Icon");return P(Bg,{onClick:()=>e(tT(t)),children:[I(Pd,{Component:n}),I(Ao,{wrap:"wrap",children:t.name})]},t.id)})})}const ET=({onClick:e})=>{const{query:{data:t}}=cT();return I(Og,{onClick:e,placeholder:"Search expense categories...",SearchList:TT,DefaultList:kT,listLength:(t?.data??[]).length})},AT=yr(ur["category-selector-table-cell"]);function ST({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=vT(),a=e.category?.name??"",{mutate:o}=Yx(),i=void 0!==t,l=hr(e.category?.iconUrl)?void 0:bm(e.category.iconUrl,"Expense Icon");return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>P($C,{...e,stylists:[AT],onMouseEnter:n,onMouseLeave:r,children:[l&&I(Pd,{Component:l}),I(hc,{children:a})]})}),I(ET,{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 IT({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(oT,{transaction:e});switch(pC(e.type)){case"EXPENSE_CATEGORY":return I(ST,{transaction:e,parentTransaction:t});case"TRANSFER":return I(VC,{annotation:$x(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return ka({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(Jx,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function NT({name:e}){return I(N,{children:e&&I(hc,{children:e})})}function PT({onClick:e}){const t=Ic(),n=Ki();return I(Bc,{children:I(Dg,{children:n.map(({status:n,displayName:r})=>I(Bg,{onClick:()=>(e(n),void t.close()),children:I(Ao,{children:r})},n))})})}const RT=yr(ur["review-status-selector-button"],or({width:"151px",justifyContent:"center"})),DT=yr(ur["review-status-dropdown-arrow"],or({display:"none"}));function MT({status:e,transactionId:t}){const[n,r]=d(!1),{mutate:a}=Yx(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:c}=Zi(e);return t&&((u=t).startsWith(Es.TRANSACTION_LINE_ITEM)||u.startsWith(Es.PROCESSOR_TRANSACTION))?null:P(Sc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(Nc,{children:e=>P($C,{variant:s,...e,stylists:[RT],onClick:i,children:[I(Pd,{Component:c}),I(hc,{children:l}),I("div",{...DT,children:I(hl,{Component:Dp})})]})}),I(PT,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function LT({status:e,transactionId:t}){return I(MT,{status:e,transactionId:t},t)}function FT({isMutating:e}){return e?I(tp,{}):I(Pd,{Component:il})}function OT({isMutating:e}){return I(FT,{isMutating:e})}const VT=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})),UT=yi(VT,"Dash"),BT=yr(null,or({stroke:"icon.base.weak"}));function HT({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(Gd,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(Rc,{Component:UT,stylists:[BT]})})})}function WT({conversationId:e}){const{query:{data:t}}=Vl(e??null),{startPrefetch:n,cancelPrefetch:r}=Bl(),{startPrefetch:a,cancelPrefetch:o}=Ms(),i=pr(t),l=i&&"READ"===t?.readStatus,s=u(()=>{pr(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=u(()=>{pr(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I(HT,{hasConversation:i,hasUnread:!l})})}const _T=yr(ur["badge-chip"],BC),qT=yr(null,oo),zT=yr(null,dl),jT=yr(ur["neutral-badge"],WC),KT=yr(ur["highlight-badge"],qC),YT=yr(ur["success-badge"],jC),ZT=yr(ur["warning-badge"],YC),GT=yr(ur["danger-badge"],ur["critical-badge"],GC);function QT({type:e,children:t}){let n;switch(e){case"danger":n=GT;break;case"warning":n=ZT;break;case"neutral":n=jT;break;case"success":n=YT;break;case"highlight":n=KT}const r=Er([_T,qT,n,zT]);return I("div",{...r,children:t})}function XT({reviewStatus:e}){const{variant:t,Icon:n}=Zi(e);return I(QT,{type:t,children:I(Pd,{Component:n})})}const JT=or({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),$T=or({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),ew=or({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),tw=or({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),nw=or({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),rw=or({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function aw({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=nT(e.children);return`${t}: ${n}`}switch(pC(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${$x(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void ka({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 P("div",{className:JT,children:[r&&I(Pd,{Component:yC}),P("div",{className:nw,children:[P("div",{className:ew,children:[t.iconUrl?I("img",{src:t.iconUrl,className:rw,alt:void 0,width:24,height:24}):I("span",{className:rw}),I(Ao,{children:t.description})]}),P("div",{className:tw,children:[I(XT,{reviewStatus:t.reviewStatus}),I(Io,{wrap:"wrapTwice",children:n})]})]}),P("div",{className:$T,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(DC,{row:e}),I(hl,{Component:il})]})]})}const ow=yi(VT,"Minus");function iw({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(aC,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?ow:Gh})}const lw=J(),sw=[lw.display({id:vn.SELECT,header:({table:e})=>I(iw,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(aC,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),lw.accessor("date",{id:vn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(dc,{children:I(xC,{transaction:e.row.original,isChild:t})})},header:()=>I(Qc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:zy,sortDescDisplay:jy}),size:130,maxSize:144}),lw.accessor("description",{id:vn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(dc,{children:I(AC,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(Qc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:Ky,sortDescDisplay:Yy}),size:180}),lw.accessor("amount",{id:vn.AMOUNT,cell:e=>I(dc,{alignVariant:"flexEnd",children:I(DC,{row:e.row})}),header:()=>I(Qc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:Zy,sortDescDisplay:Gy,align:"right"}),size:130,maxSize:130}),lw.accessor("category.id",{id:vn.CATEGORY,cell:({row:e})=>I(IT,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(Qc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),lw.accessor(e=>e.dimensionValues[0]?.id,{id:vn.DIMENSION_VALUE,cell:e=>I(dc,{children:I(NT,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>I(Qc,{columnName:"Business"}),size:130}),lw.accessor("reviewStatus",{id:vn.REVIEW_STATUS,cell:e=>I(dc,{children:I(LT,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(Qc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:Qy,sortDescDisplay:Xy,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),lw.display({id:vn.COMMENTS,cell:e=>{const t=e.row.original;return I(dc,{alignVariant:"center",children:I(WT,{conversationId:t.conversation?.id})})},header:()=>I(Qc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),lw.display({id:vn.EXPAND,cell:e=>I("div",{className:or({paddingRight:"20px"}),children:I(OT,{isMutating:e.isMutating})}),size:40,maxSize:60})],cw=lw.display({id:"MOBILE",cell:e=>I(aw,{row:e.row})}),dw=l(!0);function uw(){return i(dw)}const hw=[];function pw({transactions:e,columns:t}){const n=uw(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(vn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[cw]:(i=t)?sw.filter(e=>i.includes(e.id)):sw;var i;return $({data:e??hw,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??hw.length,columns:o,getCoreRowModel:ee(),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:te(),paginateExpandedRows:!1,getRowId:e=>e.id,meta:{editMutationKey:["banks/transactions"]},state:{columnOrder:r,columnVisibility:a}})}const gw=[vn.COMMENTS,vn.DATE,vn.DESCRIPTION,vn.AMOUNT,vn.CATEGORY,vn.REVIEW_STATUS];function mw({Component:e,stylists:t}){return I(e,{stylists:[yr(ur["xx-large-icon"],ur.icon),...t??[]],size:50})}function vw(){return P(N,{children:[I(mw,{Component:wi}),I(Ao,{wrap:"wrap",children:"All caught up"}),I(Io,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function fw({children:e,stylists:t=[],...n}){return I(ec,{intent:"warning",stylists:t,...n,children:e})}function bw({eventSource:e}){const{linkPlaid:t,loading:n}=ny();return I(fw,{...yr(ur["zero-state-button"]),onClick:()=>t({plaidEvent:Ob,message:"Plaid Link button pressed"}),disabled:n,eventSource:e,children:I(Ao,{children:"Link your bank"})})}function yw({eventSource:e}){return P(N,{children:[I(mw,{Component:hm}),I(Ir,{children:"Link Bank Account"}),I(Io,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(bw,{eventSource:e})]})}const Cw=or({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function xw(){return P(N,{children:[I("div",{className:Cw,children:I(mw,{Component:Ti})}),I(Ir,{children:"Transactions are being processed"}),I(Io,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}function Tw(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,s(()=>()=>{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 s(()=>{r.current=w(e,t,n)},[e,t,n]),i}function ww({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=d(e),[a,o]=d(!1);s(()=>{r(e)},[e]);const i=Tw(u(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const kw=yr(ur["filter-bar"],or({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"}})),Ew=yr(ur["filter-search-bar"],or({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),Aw=yr(null,or({color:"icon.base",flexShrink:0,marginRight:"15px"})),Sw=yr(null,or({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"template",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:"template"}})),Iw=or({width:25});function Nw({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=ww({debouncedValue:t,onChangeDebouncedValue:e});return I("div",{...kw,children:P("div",{...Ew,children:[I("div",{className:Iw,children:n||i?I(tp,{}):I(Pd,{stylists:[Aw],Component:Wv})}),I("input",{...Sw,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:wp})]})})}const Pw=yr(ur["date-amount-header"],or({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function Rw({formattedDate:e,formattedSum:t}){return P("div",{...Pw,children:[I(Ao,{wrap:"wrap",children:e}),I(Ru,{children:t})]})}function Dw(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=gC(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();us(e?.original??t.original,{initialTab:"conversation"})}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();us(e?.original??t.original)}}function Mw({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=ws(),a=u(()=>n({id:e.original.id}),[n,e.original]);return I(os,{rowData:e,onMouseEnter:a,onMouseLeave:r,onCellClick:Dw,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 Lw({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=To(uh(r.netSumCents)),r.rows.push(n))}else{const r=Vt(e);t.set(e,{date:e,formattedDate:r?Lt(r):e,netSumCents:n.original.amount,formattedSumDollars:To(uh(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>P(f,{children:[I(Rw,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(Mw,{rowData:e},e.id))]},e.date))})}function Fw({table:e,hasSelect:t}){const n=uw();return I(Gl,{editMutationKey:e.options.meta?.editMutationKey,children:I(jl,{children:n?I(Lw,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(Mw,{rowData:e,hasSelect:t},e.id))})})}function Ow(e){return e?"Search":"Search transactions..."}function Vw(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 Uw(e,t){return e.get(t)??[]}function Bw(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function Hw(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function Ww(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function _w({buttonText:e,onButtonClick:t}){return P(N,{children:[I(Ad,{Component:Gv}),I(Ao,{children:"No results"}),I(Io,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(Kc,{onClick:t,children:e})]})}const qw=or({xl:{minWidth:"900px"}}),zw=or({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function jw({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){Fd($i);const c=function({transactions:e}){return function({transactions:e,columns:t}){return pw({transactions:e,columns:t?[...t,vn.EXPAND]:void 0})}({transactions:e,columns:gw})}({transactions:i}),{query:{data:d},isFilling:u}=Cs({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=uw(),p=!hr(d?.data?.[0])&&!u,g=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(_w,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(vw,{})):a=I(xw,{}):a=I(yw,{eventSource:"FinancialOverviewTransactionsTableZeroState"}),a}(e??!1,i.length>0,p,l.length>0);return P("div",{className:qw,children:[I("div",{id:$i}),P(ul.Provider,{value:o,children:[P(Tr,{children:[I(Ir,{children:"Transactions for review"}),I(Vd,{children:I(fl,{})})]}),I(ic,{dashboard:"financialOverviewDashboard",children:r?I(wl,{}):P(N,{children:[!h&&I("div",{className:zw,children:I(Nw,{placeholder:Ow(h),searchTerm:l,onChange:s,isFetching:a})}),I(lc.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(ql,{headerGroups:c.getHeaderGroups()})}),hr(g)?I(Fw,{table:c,hasSelect:!1}):I(kd,{children:g})]})})]})]})}function Kw(){const[e,t]=d(""),{sortInstance:n,setSortInstance:r,apiSort:a}=Jy(),o={...(()=>{const e=Qi();return{...tl,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=Cs({filter:o,sort:a,limit:10}),u=i?.data??rl,{hasPlaidLinkedBankAccount:h,isFilling:p}=$g();return I(jw,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:c,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const Yw=yr(null,or({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function Zw({children:e}){return I("div",{...Yw,children:e})}const Gw=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:Id,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:Ci,buttonText:"Review"};case"LINK_BANK":return{Icon:hm,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:hm,buttonText:"Fix"};case"RELINK":return{Icon:hm,buttonText:"Relink"};case"CHAT":return{Icon:xi,buttonText:"Learn more"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:wi,buttonText:""};default:return{Icon:xi,buttonText:""}}},Qw=yr(ur["banner-title"],or({display:"flex",alignItems:"center",gap:"8px"})),Xw=yr(ur["banner-icon"],or({width:"20px",height:"20px"}));function Jw({title:e,type:t}){const{Icon:n}=Gw(t);return P("div",{...Qw,children:[I(Pd,{Component:n,stylists:[Xw]}),I(Ao,{wrap:"wrap",children:e})]})}const $w=yr(null,or({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 ek({title:e,description:t,type:n}){return P("div",{...$w,children:[I(Jw,{title:e,type:n}),I(Io,{wrap:"wrap",children:t})]})}const tk=ur["banner-button"],nk=or.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),rk=yr(ur["banner-button-text"]),ak=yr(ur["banner-button-icon"]);function ok({priority:e,type:t,handleClick:n,eventSource:r}){const{buttonText:a}=Gw(t),o=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return P(ec,{onClick:n,intent:o,styles:nk,className:tk,eventSource:r,children:[I(Ao,{stylists:[rk],children:a}),I(hl,{stylists:[ak],Component:il})]})}const ik=cr({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"}}}}),lk={HIGH:ur["banner-high"],MEDIUM:ur["banner-medium"],LOW:ur["banner-low"],URGENT:ur["banner-urgent"]};function sk({task:e,handleClick:t,eventSource:n}){const{name:r,description:a,shortDescription:o,type:i,priority:l}=e,s=uw()?o:a,c=yr(ur.banner,lk[l],ik({priority:l}));return P("div",{...c,children:[I(ek,{title:r,description:s,type:i}),I(ok,{priority:l,type:i,handleClick:t,eventSource:n})]})}function ck(e,t){ds(gn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>is("Conversation",{routeProps:{conversationId:null,defaultValues:{message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}}}}))}function dk(e,t,n,r,a){return()=>ch({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function uk(e){const{mutateAsync:t}=$b(),n=Fr(),r=Hr(),{apiPartnerName:a}=i($c),o=uw(),{linkPlaid:l,loading:s,hasOnPlaidLinkOverride:c}=ny(),{linkPlaid:d,loading:u}=ny(),h=_b(),p=Ah({apiErrorType:e?.apiErrorType,apiErrorCode:e?.apiErrorCode});if(hr(p)||hr(e))return null;const g="ITEM_LOCKED"===e.apiErrorCode;switch(p.buttonType){case wh.DELETE_OR_RELINK:case wh.RELINK:return s?null:(v=l,f=a,b=o,{alert:dk(p,(m=e).apiInstitutionName,f,b,[{key:Ku,label:"Cancel"},{key:Zu,label:"Relink",type:sh.SUCCESS}]),actions:{success:()=>{v({plaidEvent:Ub,plaidItemId:m.id,apiAccessToken:m.apiAccessToken,apiErrorCode:m.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case wh.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:dk(e,t.apiInstitutionName,a,o,[{key:Ku,label:"Cancel"},{key:wh.CHAT,label:"Chat"},{key:Zu,label:"Unlink and Relink",type:sh.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:Vb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[wh.CHAT]:()=>ck(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,t,d,a,o,c);case wh.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l,s){return{alert:dk(e,t.apiInstitutionName,i,l,[{key:Ku,label:"Cancel"},{key:wh.CHAT,label:"Chat"},{key:wh.RELINK,label:"Relink"},{key:Zu,label:"Go To Bank",type:sh.SUCCESS}]),actions:{success:async()=>{const e=await ju({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;pr(o)?ds(s,{type:"PLAID_LINK_ROUTE_TO_BANK",result:"SUCCESS",data:{bankUrl:o},error:null},()=>window.open(o,"_blank")):window.open(o,"_blank")},[wh.RELINK]:()=>{o({plaidEvent:Ub,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[wh.CHAT]:()=>ck(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,g,n,r,l,a,o,h);case wh.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:dk(e,t.apiInstitutionName,a,o,[{key:Ku,label:"Cancel"},{key:Zu,label:"Unlink",type:sh.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:Bb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(p,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:dk(e,t,a,o,[{key:Ku,label:"Cancel"},{key:wh.CHAT,label:"Chat",type:sh.SUCCESS}]),actions:{[wh.CHAT]:()=>ck(t,r)}}}(p,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var m,v,f,b}const hk=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){ka({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function pk({task:e}){const{linkPlaid:t,loading:n}=ny(),{linkPlaid:r,loading:a}=ry(),o=uk(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&hr(o);if(i||l||s)return null;const c="LINK_BANK"===e.type?"FinancialOverviewLinkAccountBanner":"RELINK"===e.type?"FinancialOverviewRelinkAccountBanner":void 0;return I(sk,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:Ub,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?(wa("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:Ob,message:"Plaid Banner Link Bank pressed"})):pr(o)&&(wa("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),hk(o))},eventSource:c})}const gk=yr(ur.banner,ur["banner-default"],ik({priority:"DEFAULT"}));function mk(){const e=uw()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...gk,children:I(ek,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const vk=yr(ur.banner,ur["banner-default"],ik({priority:"DEFAULT"}));function fk(){const e=uw()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...vk,children:I(ek,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const bk=or({width:"100%",height:72,minWidth:"300px"});function yk(){return P(N,{children:[I(ei,{styles:bk}),I(ei,{styles:bk}),I(ei,{styles:bk})]})}function Ck({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(yk,{}):a?e.map(e=>void 0===Mx[e.type]?null:"LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(wh).includes(e.type)?I(pk,{task:e},e.id):I(sk,{task:e,handleClick:()=>t(e.type)},e.id)):I(n?fk:mk,{})}const xk=yr(ur["button-table-header"]),Tk=or({height:{xl:"auto",base:"44px"}});function wk(){const e=xh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:Tk,children:P(tc,{onClick:()=>{is(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[xk],eventSource:"FinancialOverviewActionItemHeader",children:[I(hl,{Component:Fu}),I(Cc,{children:"Banks & Integrations"})]})})}const kk=yi(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:"M1 3.5H14"}),r.createElement("path",{d:"M1 7.5H14"}),r.createElement("path",{d:"M1 11.5H14"})),"HamburgerNavMenu"),Ek=or.raw({width:"44px",height:"44px"});function Ak(){return I(tc,{onClick:()=>is("NavMenu"),styles:Ek,children:I(Pd,{Component:kk})})}const Sk=yr(ur["business-owner-dashboard-header"],or(Cr,{flexDirection:{base:"column",xl:"row"},alignItems:{base:"stretch",xl:"center"},justifyContent:{base:"center",xl:"space-between"},height:{base:"auto",xl:"80px"},minHeight:"80px",gap:{base:"16px",xl:0}})),Ik=or({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"});function Nk(){return P("div",{...Sk,children:[P("div",{className:Ik,children:[I(Ak,{}),I(wk,{})]}),I(Ir,{children:"Action Items"})]})}const Pk=()=>{const e=uw(),{isApp:t}=i(Ld);return e&&t};function Rk({shouldFilterTasks:e=!1}){const t=Pk(),{taskBanners:n,isFilling:r}=Ux(e),a=ks(),{query:{data:o}}=em();return P(N,{children:[t?I(Nk,{}):P(Tr,{children:[I(Ir,{children:"Action Items"}),I(wk,{})]}),I(Zw,{children:I(Ck,{taskBanners:n,handleScrollAction:Bx,isWaitingForPlaidItemAccountsSync:!a&&!0===o?.plaidItemAccountsReadyToSync,isFilling:r})})]})}const Dk=yr(ur["business-owner-dashboard"],or({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),Mk=or({display:"flex",width:"100%",justifyContent:"center"}),Lk={status:{in:["ACTIVE","INACTIVE"]}};function Fk({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=d(void 0);return{sortInstance:e,setSortInstance:u(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Pl)??!1,n=(e.direction&&e.direction in Rl)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:l,paginationControls:s}=Fl({limit:10,sort:a,filter:nl}),c=o?.data??al,h=uw(),{hasBookkeeper:p}=i($c),{initialPageProps:g}=i(Ld),{query:{data:m}}=em(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=Cs({filter:Lk,limit:1});return(e?.data?.length??0)>0}(),m),f=/* @__PURE__ */new Date,b={month:f.getMonth(),year:f.getFullYear()};const[y,C]=Ec(g?.period??b,e,t),x=(T=y.month,{beginDate:ut((w=y.year)-1,T+1,1),endDate:ut(w,T+1,0)});var T,w;return I("div",{className:Mk,children:P("div",{...Dk,children:[I(Rk,{shouldFilterTasks:h}),!h&&P(N,{children:[I(qy,{period:y,handleDateChange:e=>{var t,n;(t=b).year===(n=e).year&&n.month>t.month||n.year>t.year||C(e)},todayPeriod:b,showSamples:v,showLinkAccountButton:v&&!m?.plaidItemAccountsReadyToSync}),p&&P(N,{children:[I(Tr,{children:I(Ir,{children:"Financial Summary"})}),I(mu,{isSample:v,period:y})]})]}),!h&&I(N,{children:I(mi,{filter:x,isSample:v})}),p&&I(Hd,{sortInstance:n,setSortInstance:r,conversations:c,paginationControls:s,isFilling:l,isMobile:h}),I(Kw,{})]})})}function Ok(e){return I(Aa||N,{children:e.children})}function Vk({children:e}){return I(Ok,{children:I("div",{className:mr(ur.component),children:e})})}function Uk({source:e,children:t}){return I(Sn.Provider,{value:e,children:t})}function Bk(e){return I(Vk,{children:I(Uk,{source:"FinancialOverview",children:I(Fk,{...e})})})}const Hk=or({display:"flex",flexDirection:"column"});function Wk({task:e}){return I("div",{className:Hk,children:I(pk,{task:e})})}const _k=or({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),qk=or({width:"80px",height:"12px"}),zk=or({width:"150px",height:"16px"}),jk=or({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),Kk=or({userSelect:"none",cursor:"pointer"});function Yk(){return P("div",{className:jk,children:[P("div",{className:Kk,children:[P("div",{className:_k,children:[I(ei,{styles:zk}),I(ei,{styles:qk})]}),P("div",{className:_k,children:[I(ei,{styles:zk}),I(ei,{styles:qk})]})]}),I("div",{className:Kk,children:P("div",{className:_k,children:[I(ei,{styles:zk}),I(ei,{styles:qk})]})})]})}const Zk=or.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function Gk({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=uw(),a=n||r?Kc:tc;return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(a,{extraClassNames:[Zk],popupTriggerProps:e,children:I(hl,{Component:Gv,stylists:t})})}),I(Bc,{children:e})]})}const Qk=yi(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"),Xk=cr({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 Jk({width:e="lg",children:t}){const n=yr(ur["modal-popup"],Xk({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const $k=or({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),eE=or({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),tE=or({display:"flex",flexDirection:"column",gap:"12px"}),nE=or({display:"flex",flexDirection:"row",gap:"10px"}),rE=or({display:"flex",flexDirection:"column",gap:"10px"}),aE=({acknowledged:e,setAcknowledged:t})=>P("div",{className:tE,children:[I(hc,{wrap:"wrap",children:"The selected start date is after the existing start date. Transactions before the new start date will be hidden."}),P("div",{className:nE,children:[I(nC,{checked:e,onClick:()=>t(!e)}),I(hc,{wrap:"wrap",children:"I understand."})]})]});function oE({bankAccounts:e}){const{apiPartnerName:t}=i($c),n=e.reduce((e,t)=>{const n=Vt(t.tranStartDate||""),r=Vt(e.tranStartDate||"");return n&&r&&Mt(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutateAsync:n}=Uh(),r=Ic();return db({defaultValues:{tranStartDate:t},onSubmit:async t=>{var a,o;await n((a=e,o=t.value.tranStartDate,a.map(e=>({id:Is(e.id),tranStartDate:o,duplicateBankAccountIds:[]})))),r.close(),ch({title:"Start Date Updated",body:P("div",{className:rE,children:[I(hc,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(hc,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:Zu,type:sh.SUCCESS}]})}})})(e,n),a=Ic(),o=()=>{a.close()},[l,s]=d(!1),{query:{data:c}}=qu(),u=c?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Vt(e.reduce((e,t)=>{const n=Vt(t.tranMinStartDate||""),r=Vt(e.tranMinStartDate||"");return n&&r&&Mt(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${gh(e[0]?.name,e[0]?.mask)} account dating back to ${qt(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${qt(h)}.`;return P("form",{className:$k,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit()},children:[I(Ao,{children:"Set Bank Transaction Start Date"}),I(hc,{wrap:"wrap",children:p}),I(hc,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),I(r.AppField,{name:"tranStartDate",children:e=>I(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),I(r.Subscribe,{selector:e=>e,children:e=>{const t=Vt(e.values.tranStartDate||""),r=Vt(n),a=t&&r&&Mt(t,r);return P(N,{children:[e.isDirty&&a&&I(aE,{acknowledged:l,setAcknowledged:s}),P("div",{className:eE,children:[I(gb,{showIcon:!1,onClick:o}),I(Xh,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!l})]})]})}})]})}function iE({bankAccounts:e}){return P(Sc,{placement:"right-start",children:[I(Nc,{children:e=>P(Bg,{...e,children:[I(Pd,{Component:Qk}),I(Ao,{children:"Edit Start Date"})]})}),I(Ev,{children:I(Iv,{children:I(Jk,{width:"sm",children:I(oE,{bankAccounts:e})})})})]})}const lE=yi(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"),sE=yi(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"),cE={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 dE(e){const{apiPartnerName:t,unitIntegrationBankName:n}=i($c);return"UNIT"===e?n??t??"Unit":cE[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const uE=or({display:"flex",flexDirection:"column",gap:"16px"}),hE=yr(null,or({color:"brand.danger"}));function pE({integration:e,accounts:t}){const{mutate:n}=$b(),r=Ic(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=ny(),{query:{data:l}}=(s=e.id,_u({},{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}}=rm(e.id),u=d?.data,h=dE(e.apiName),p="PLAID"===e.apiName;return P(Dg,{children:[p&&!o&&P(Bg,{onClick:()=>(a({plaidEvent:Ub,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(Pd,{Component:Hs}),I(Ao,{children:"Add Account"})]}),p&&u&&I(iE,{bankAccounts:u}),it(t)&&P(Bg,{onClick:()=>Ib({plaidItemAccounts:t}),children:[I(Pd,{Component:sE}),I(Ao,{children:"Merge Accounts"})]}),p&&P(Bg,{onClick:()=>(async()=>{let o;var l;o=it(t)?await(async e=>ch({title:"Remove Institution",body:I("div",{className:uE,children:I(hc,{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:Ku,label:"Cancel"},{key:Yu,label:"Remove",type:sh.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ch({title:"Remove Institution",body:I("div",{className:uE,children:I(hc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:Ku,label:"Cancel"},{key:Yu,label:"Remove",type:sh.DANGER}]}))(h),r.close(),o===Yu&&(p&&i?a({plaidEvent:Bb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[I(Pd,{stylists:[hE],Component:lE}),I(Ao,{stylists:[hE],children:"Delete Connection"})]})]})}const gE=or({userSelect:"none"});function mE({children:e}){return I("div",{className:gE,children:e})}const vE=or({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 fE({children:e}){return I("div",{className:vE,children:e})}const bE=yr(ur.badge,HC),yE=yr(null,oo),CE=yr(null,dl),xE=yr(ur["neutral-badge"],_C),TE=yr(ur["highlight-badge"],zC),wE=yr(ur["success-badge"],KC),kE=yr(ur["warning-badge"],ZC),EE=yr(ur["danger-badge"],ur["critical-badge"],QC);function AE({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=EE;break;case"warning":o=kE;break;case"neutral":o=xE;break;case"success":o=wE;break;case"highlight":o=TE}const i=Er([bE,yE,o,CE]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function SE({plaidItem:e}){const t=uk(e);return P(AE,{type:"danger",onClick:n=>{n.stopPropagation(),t&&(wa(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),hk(t))},disabled:hr(t),children:[I(Pd,{Component:xi}),I(Io,{children:"Fix Bank Error"}),I(hl,{Component:il})]})}const IE=cr({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"}}}}}),NE=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function PE({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=lr(IE({active:a}),dl);return P("button",{className:l,onClick:t=>{t.stopPropagation(),is("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[P("div",{className:NE,children:[I(Pd,{Component:i?yC:hm}),I(gm,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(Pd,{Component:il})]})}const RE=or({display:"flex",flexDirection:"column",gap:"4px"}),DE=or({display:"flex",alignItems:"center",gap:"8px"}),ME=yr(null,or({color:"brand.primary.weak"})),LE=or({overflow:"hidden"});function FE({integration:e,isCompact:t=!1}){const{query:{data:n}}=rm(e.id),r=n?.data,a="PLAID"===e.apiName,o=dE(e.apiName);if(!it(r))return null;const i=e.iconUrl?bm(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return P(mE,{children:[P(fE,{children:[P(Ov,{children:[I(Ad,{Component:i??hm}),P("div",{className:RE,children:[I(hc,{children:e.apiInstitutionName??o}),I(Io,{children:Lb(r)})]})]}),P("div",{className:DE,children:[a&&pr(e.apiErrorCode)&&I(SE,{plaidItem:e}),I(Gk,{stylists:[ME],shouldUseButtonDiscreteStyles:t,children:I(pE,{integration:e,accounts:r})})]})]}),I("div",{className:LE,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(PE,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Fb(t),active:n,integration:e},t.id)})})]})}const OE=bm("data:image/png;base64,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","Stripe"),VE=bm("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"),UE=bm("data:image/png;base64,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","Shopify"),BE=bm("data:image/png;base64,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","Gusto"),HE=bm("data:image/png;base64,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","Freshbooks"),WE=bm("data:image/png;base64,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","Uber"),_E=bm("data:image/png;base64,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","Bank"),qE={GUSTO:BE,FRESHBOOKS:HE,FRESHBOOKS2:HE,SHOPIFY:UE,STRIPE:OE,SQUARE:VE,UBER:WE};function zE(e){return qE[e]??_E}const jE=or({display:"flex",flexDirection:"column",gap:"4px"});function KE({integration:e,isCompact:t}){const n=dE(e.apiName),r=function(e){if(e)return`Last synced ${_t(e)}`}(e.lastSyncedDate),a=zE(e.apiName);return I(mE,{children:P(fE,{children:[P(Ov,{children:[I(Ad,{Component:a}),P("div",{className:jE,children:[I(hc,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(Io,{intent:"normal",children:r})]})]}),I(Gk,{shouldUseButtonDiscreteStyles:t,children:I(pE,{integration:e})})]})})}const YE=or({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),ZE=or.raw({color:"typography.base.weak"}),GE=or({overflow:"hidden"});function QE({manualBankAccounts:e,isCompact:t=!1}){const n=uw(),r=t||n?Kc:tc;return P(mE,{children:[P("div",{className:YE,children:[I(hc,{extraClassNames:[ZE],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>is("BankAccountForm"),active:!1,children:I(hl,{Component:Hs})})]}),I("div",{className:GE,children:e.map(e=>I(PE,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const XE=yr(ur["selector-row"],lr(or(Ys,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),sl)),JE=or({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),$E=or({display:"flex",alignItems:"center",gap:"8px"}),eA=or({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),tA=yr(null,or({width:"20px",height:"20px"}));function nA(){const{linkPlaid:e,loading:t}=ry();return I("button",{...XE,disabled:t,onClick:()=>{wa("Add New Connection button pressed"),e({plaidEvent:Ob,message:"Add New Connection button pressed"})},children:P("div",{className:JE,children:[P("div",{className:$E,children:[I(Ad,{stylists:[tA],Component:hm}),P("div",{className:eA,children:[I(hc,{children:"Connect your bank"}),I(Io,{children:"Find your banking institution with Plaid"})]})]}),I(Pd,{Component:il})]})})}const rA=or({paddingInline:"16px",paddingBottom:"8px"}),aA=or.raw({color:"typography.base.weak",fontWeight:"label"});function oA({title:e,children:t}){return P("div",{children:[I("div",{className:rA,children:I(hc,{extraClassNames:[aA],children:e})}),t]})}const iA=or({minWidth:"100%",height:"45px"});function lA(){return P(N,{children:[I(ei,{styles:iA}),I(ei,{styles:iA}),I(ei,{styles:iA})]})}const sA=yr(ur["selector-row"],lr(or(Ys,{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"}),sl)),cA=or({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),dA=or({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),uA=or({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function hA({integration:e}){const{linkPlaid:t,loading:n}=ny(),r="PLAID"===e.apiName,a=dE(e.apiName),o=e.iconUrl?bm(e.iconUrl,"Institution Icon"):hm;return I("button",{...sA,disabled:n||!r,onClick:()=>{wa(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:Ub,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:P("span",{className:cA,children:[P("div",{className:dA,children:[I(Ad,{Component:o}),I(hc,{children:e.apiInstitutionName??a??void 0})]}),r&&P("div",{className:uA,children:[I(hl,{Component:Fu}),I(hc,{children:"Relink"})]})]})})}const pA=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"}))),gA=yr(ur["selector-row"],lr(or(Ys,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),sl)),mA=or({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),vA=or({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),fA=or({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),bA=or({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:"template",padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),yA=or({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function CA(){const e=Ic(),{mutateAsync:t}=Gb(),[n,r]=d("");return P("div",{className:vA,children:[I(Ao,{children:"Enter your shop name"}),I("div",{className:yA,children:I(pA,{})}),I(hc,{children:"Please enter the name of your shop below."}),I("input",{className:bA,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),P("div",{className:fA,children:[I(gb,{showIcon:!1,onClick:()=>{e.close()}}),I(Qh,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(Ao,{children:"Connect"})})]})]})}function xA(){const e=zE("SHOPIFY")??Fu;return P(Sc,{placement:"bottom",children:[I(Nc,{children:t=>P("button",{...gA,...t,children:[P("div",{className:mA,children:[I(Ad,{Component:e}),I(hc,{children:"Shopify"})]}),I(Pd,{Component:il})]})}),I(Ev,{children:I(Iv,{children:I(Jk,{width:"sm",children:I(CA,{})})})})]})}const TA=yr(ur["selector-row"],lr(or(Ys,{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"}),sl)),wA=or({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function kA({apiName:e}){const{mutateAsync:t}=Gb(),n=dE(e),r=gn(e=>e.events.gusto);if("SHOPIFY"===e)return I(xA,{});const a=zE(e)??Fu;return P("button",{...TA,onClick:async()=>{if("GUSTO"===e){let e=!1;if(pr(r)&&(r.listener({type:"GUSTO_NEW",result:"SUCCESS",data:null,error:null}),e=r.preventDefault??!1),e)return}const n=await t({apiName:e});window.open(n.url)},children:[P("div",{className:wA,children:[I(Ad,{Component:a}),I(hc,{children:n})]}),I(Pd,{Component:il})]})}const EA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function AA(e){return EA.includes(e)}const SA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],IA=or({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),NA=or({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function PA(){const{query:{data:e},isFilling:t}=Dx(),n=e?.multiAccountIntegrations,r=e?.integrations,a=pr(n)&&n.length>0||pr(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=i($c),n=gn(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(AA),a=e?.map(e=>e.apiName)||[];let o=r??SA;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return P("div",{className:IA,children:[(t||a)&&I(oA,{title:"Already Connected",children:t?I(lA,{}):P(N,{children:[n?.map(e=>I(hA,{integration:e},e.id)),r?.map(e=>I(hA,{integration:e},e.id))]})}),I(oA,{title:"Available Banks",children:I(nA,{})}),o&&o.length>0&&I(oA,{title:"Integrations",children:I("div",{className:NA,children:o.map(e=>I(kA,{apiName:e},e))})})]})}const RA=or({marginTop:"16px"}),DA=or({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),MA=or.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function LA({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(PA,{}):t?P(N,{children:[P("div",{className:RA,children:[I(hc,{extraClassNames:[MA],children:"Connected Accounts"}),r?.map(t=>I(FE,{integration:t,isCompact:e},t.id)),a?.map(t=>I(KE,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(QE,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(QE,{manualBankAccounts:o}):P("div",{className:DA,children:[I(Ad,{Component:hm}),I(Ao,{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 FA=yr(null,or({color:"typography.base.weak"})),OA=yr(ur["drawer-header"],or({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Rv)),VA=or({display:"flex",gap:"8px"}),UA=or({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),BA=cr({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),HA=or({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),WA=or({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),_A=yr(null,or({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),qA=cr({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function zA({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=uw()||e,{query:{data:a},isFilling:o}=Dx(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=xh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>Hh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:tm(e?.data)};var t}}),{mutate:c,isPending:d}=Xb(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),g=p&&Rx(p,!1),m="connected"===gn(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&m,f=m?"Add New Connection":"Add New Account",b=()=>{is(m?"NewConnection":"BankAccountForm")},y=r?Kc:tc;return P(Kb,{onPlaidLink:n,children:[P("div",{...OA,children:[P(Ov,{children:[t&&I(nh,{}),r?I(Ao,{children:"Banks & Integrations"}):I(Ir,{stylists:[FA],children:"Banks & Integrations"})]}),P("div",{className:VA,children:[0!==h&&P(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(Pd,{Component:Fu,stylists:[yr(null,qA({refreshLoading:d}))]}),!r&&I(hc,{children:"Sync Accounts"})]}),P(y,{onClick:()=>b(),active:!1,children:[I(Pd,{Component:Hs}),!r&&I(hc,{children:"Add New Connection"})]})]})]}),g&&I("div",{className:WA,children:I(Wk,{task:g})}),o?I(Yk,{}):P(N,{children:[I("div",{className:BA({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:UA,children:I(LA,{isCompact:r,showPlaidItems:m,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(m&&v)&&I("div",{className:HA,children:P(tc,{stylists:[_A],onClick:()=>b(),children:[I(Pd,{Component:Hs}),I(Ao,{children:f})]})})]})]})}const jA=or({display:"flex",justifyContent:"center"}),KA=or({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 YA({onPlaidLink:e}){return I(Vk,{children:I(Uk,{source:"BanksAndIntegrations",children:I("div",{className:jA,children:I("div",{className:KA,children:I(zA,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})})}function ZA(e){return lt({key:"customer",name:"Customer",possibleValues:e})}function GA(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 QA=or({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function XA({children:e}){return I("div",{className:QA,children:e})}function JA({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return P(Sc,{children:[I(Nc,{children:e=>P(lf,{popupTriggerChildrenProps:e,children:[P(XA,{children:[t&&I(Pd,{Component:bm(t,"")}),I(hc,{wrap:"wrap",children:i})]}),I(Pd,{Component:il})]})}),I(Hv,{title:r,Footer:o??null,children:a})]})}function $A(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ae(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 eS({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return I(N,{children:e.map((e,o)=>I(r,{groupIndex:o,children:e.map((e,n)=>I(a,{item:e},t(e,n)))},n(e,o)))})}const tS=or({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),nS=yr(ur["list-body"],or({display:"block"}));function rS({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return P("div",{className:tS,children:[e&&I(hc,{intent:"weak",children:e}),n?I(Xv,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):I("div",{...nS,children:t})]})}const aS=or({display:"flex",flexDirection:"column",gap:"16px"});function oS({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I(sf,{handleClick:t,selected:n,isMultiSelect:r,children:P(XA,{children:[e.iconUrl&&I(Pd,{Component:bm(e.iconUrl,"")}),I(hc,{wrap:"wrap",children:e.name??""})]})},e.id)}function iS({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 I($v,{children:I("div",{className:aS,children:I(eS,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>I(oS,{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 I(rS,{label:r,children:e})}})})})}function lS({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=$A(e,{items:n,fuseOptions:fT,processResults:yT});return r?I(pf,{}):0===Object.keys(i).length?I(Xv,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(iS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function sS(e,t){return fx(e,t).map(e=>({parent:e.parent,child:e.child}))}function cS({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=$A(e,{items:n,fuseOptions:mx,processResults:sS});return r?I(pf,{}):0===Object.keys(i).length?I(Xv,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(iS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function dS(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...dS(n));return t}function uS(e,t){return e.value?.[t]?.value?.id?.in??[]}function hS(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&uS(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{uS(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function pS(e,t){const n=[];return e.forEach(e=>uS(e,t).forEach(e=>n.push(e))),new Set(n)}function gS(e,t,n,r){return u(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!uS(t,e).some(e=>n.includes(e)));return Bw(t,e,r)})},[t,r,e])}const mS=or.raw({width:"100%",justifyContent:"center"}),vS=or({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 fS({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return P("div",{className:vS,children:[P(Sd,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[I(hc,{children:"Apply"}),I(hl,{Component:Gh})]}),I(tc,{onClick:e,styles:mS,children:I(hc,{children:"Clear All"})})]})}function bS({onApply:e,onClearAll:t}){const n=Ic();return I(fS,{onApply:()=>{e(),n.close()},onClearAll:t})}function yS({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>dS(e),[e]),g=u(()=>{i(p)},[p,i]),m=u(()=>{if(p&&l&&s){const e=Uw(s,"category"),t=hS(l,e,p,"category");d(t)}},[p,l,s,d]),v=I(bS,{onApply:m,onClearAll:g});return I(JA,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:I(Yv,{placeholder:"Search expense categories...",onClick:a,SearchList:lS,DefaultList:CS,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:d,isMultiSelect:h}})})}function CS({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(pf,{}):I(tf,{title:I(Ao,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=dS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(yS,{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 I(sf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:P(XA,{children:[e.iconUrl&&I(Pd,{Component:bm(e.iconUrl,e.name??"")}),I(hc,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const xS=[];function TS({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=hT(),s=i?.data??xS,c=pS(Uw(t,"category"),"category"),d=u(e=>{const t=wS(e);n(t)},[n]),h=gS("category",r,0,a);return a&&o?I(Yv,{placeholder:"Search expense categories...",onClick:d,SearchList:lS,DefaultList:CS,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function wS(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 kS(){const{query:{data:e},isFilling:t}=sT(),n=e?.data,r=o(()=>n?.map(wS),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function ES(e){return lt({key:"category",name:"Category",NestedListComponent:TS,possibleValues:e})}const AS=[{value:"in",label:"In"}];function SS(e){return lt({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:AS})}function IS(){const e=function(){const e=Gi();return(e?Hi:Wi).map(t=>Yi(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 u(()=>({values:t,isFilling:!1}),[t])}function NS(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const PS=S.object({minAmount:S.number().nullable(),maxAmount:S.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 RS(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:pr((a=t).greaterThanEqual)?uh(a.greaterThanEqual):null,maxAmount:pr(a.lessThanEqual)?uh(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const DS=or({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function MS({children:e,title:t}){return I(Hv,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:DS,children:e})})}const LS=or({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),FS=or({display:"flex",flexDirection:"column",flex:1}),OS=or({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function VS({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(MS,{title:"Amount",children:I(US,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function US({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Ic();return db({defaultValues:RS(0,r),validators:{onChange:PS},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=we(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=hh(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=hh(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 P(N,{children:[I("div",{className:OS,children:P($v,{children:[P("div",{className:LS,children:[I("div",{className:FS,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(Ao,{children:"To"}),I("div",{className:FS,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I(cp,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(fS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const BS=[{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 HS(){return lt({key:"amount",name:"Amount",operators:BS,ModalComponent:VS})}function WS(){const{query:{data:e},isFilling:t}=xh(),n=e?.data,r=function({institutionIds:e}){const t=Fr(),n=Hr(),r=[...new Set(e)],a=V({queries:r.map(e=>({queryKey:mm({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await ju({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=>pr(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=gh(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return u(()=>({values:a??[],isFilling:t}),[a,t])}function _S(e){return lt({key:"bankAccount",name:"Bank Account",possibleValues:e})}const qS=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:[],zS=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:Ei(t[1].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function jS(e){return Wr({queryKey:["dimensionValues"],queryFn:zS,...e})}function KS(){const{query:{data:e},isFilling:t}=gv({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 u(()=>({values:r??[],isFilling:t}),[r,t])}function YS(e){return lt({key:"vendor",name:"Vendor",possibleValues:e})}function ZS(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 lt({key:"type",name:"Type",possibleValues:()=>({values:t})})}const GS=yi(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"),QS=yr(null,or({fill:"surface.intent.action.active"}));function XS({isSelected:e}){return I(Pd,e?{Component:GS,stylists:[QS]}:{Component:nf})}function JS({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 I(tf,{title:I(Io,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?nI(l.value.status?.value):a.some(e=>x(e.value,l.value)));var l;return P(lf,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[I(XA,{children:I(hc,{wrap:"wrap",children:r.name})}),I(XS,{isSelected:i})]},`${r.name}_${o}`)})})}const $S="status",eI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function tI(){const e="in";return{values:eI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function nI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function rI(e){return nI(e.value.status?.value)}function aI(){return lt({key:$S,name:"Status",possibleValues:tI,singleSelect:!0,SimpleListComponent:JS})}const oI=(iI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(iI));var iI;function lI({onApply:e,onClearAll:t}){const n=Ic();return I(fS,{onApply:()=>{e(),n.close()},onClearAll:t})}function sI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>dS(e),[e]),g=u(()=>{i(p)},[p,i]),m=u(()=>{if(p&&l&&s){const e=Uw(s,"glAccount"),t=hS(l,e,p,"glAccount");d(t)}},[p,l,s,d]),v=I(lI,{onApply:m,onClearAll:g});return I(JA,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:I(Yv,{placeholder:"Search GL accounts...",onClick:a,SearchList:cS,DefaultList:cI,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:d,isMultiSelect:h}})})}function cI({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(pf,{}):I(tf,{title:I(Ao,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=dS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(sI,{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 I(sf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(XA,{children:I(hc,{wrap:"wrap",children:e.name})})},e.id)})})}const dI=[];function uI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=ux(),s=i??dI,c=pS(Uw(t,"glAccount"),"glAccount"),d=u(e=>{const t=hI(e);n(t)},[n]),h=gS("glAccount",r,0,a);return a&&o?I(Yv,{placeholder:"Search GL accounts...",onClick:d,SearchList:cS,DefaultList:cI,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function hI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function pI(e){return lt({key:"glAccount",name:"GL Account",NestedListComponent:uI,possibleValues:e})}function gI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(xt(e)){const t=St(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(wt(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,GA(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 GA(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return GA(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return GA(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 GA(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return GA(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function mI(e,t){const n=e.reduce(gI,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return oI.forEach(e=>{const n=t[e];t[e]=k(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const vI=e=>{const t=gn(e=>e.transactionsDashboardFilters),n=gn(e=>e.expenseDashboardFilters),r=gn(e=>e.incomeDashboardFilters),a=gn(e=>e.setTransactionsDashboardFilters),o=gn(e=>e.addTransactionsDashboardFilters),i=gn(e=>e.removeTransactionsDashboardFilter),l=gn(e=>e.hasInitializedTransactionsDashboardFilters),s=gn(e=>e.setExpenseDashboardFilters),c=gn(e=>e.addExpenseDashboardFilters),d=gn(e=>e.removeExpenseDashboardFilter),u=gn(e=>e.hasInitializedExpenseDashboardFilters),h=gn(e=>e.setIncomeDashboardFilters),p=gn(e=>e.addIncomeDashboardFilters),g=gn(e=>e.removeIncomeDashboardFilter),m=gn(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:kS(),getBankAccounts:WS(),getCustomers:KS(),getVendors:function(){const{query:{data:e},isFilling:t}=_m(),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 u(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=jS(),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 u(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=rx(),n=o(()=>e?.map(e=>hI(e)),[e]);return u(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:IS()}}function bI(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 yI=or({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function CI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(MS,{title:"Back",children:I(xI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function xI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=Ic();return db({defaultValues:{[e.key]:bI(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 P(N,{children:[I("div",{className:yI,children:I($v,{children:I(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=>I(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),I(fS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const TI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function wI(){return lt({key:"description",name:"Description",operators:TI,ModalComponent:CI})}const kI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function EI(){return lt({key:"notes",name:"Notes",operators:kI,ModalComponent:CI})}const AI=[{name:"Expense",types:cC.Expense},{name:"Income",types:cC.Income},{name:"Transfer",types:cC.Transfer}];function SI(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=vI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=fI(),p=o(()=>({reviewStatus:SS(h),amount:HS(),bankAccount:_S(l),category:ES(i),customer:ZA(c),date:Zt,description:wI(),glAccount:pI(d),notes:EI(),status:aI(),vendor:YS(s),type:ZS(AI),search:ct}),[l,i,s,c,d,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]),f=u(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}function II(e,t,n,r,a){const o=gn(e=>e.initializeTransactionsDashboardFilters),i=gn(e=>e.initializeExpenseDashboardFilters),l=gn(e=>e.initializeIncomeDashboardFilters),c=gn(e=>e.hasInitializedTransactionsDashboardFilters),d=gn(e=>e.hasInitializedExpenseDashboardFilters),u=gn(e=>e.hasInitializedIncomeDashboardFilters),h=Qi(),p="transactionsDashboard"===e?c:"expenseDashboard"===e?d:u;s(()=>{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 NI=l(void 0);function PI(){const e=i(NI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function RI({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!==st&&l.modelKey!==Kt&&(l.modelKey!==$S||!rI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(hr(n)&&pr(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(hr(r)&&pr(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(uh(n),{dollarSign:!0,signage:"default"}),i=Co(uh(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=>I(ib,{text:e.text,additionalValidClassName:ur["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const DI=yi(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"),MI=or({width:"17px",height:"17px",borderRadius:"sm"});function LI({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return pr(e)?P(N,{children:[!r&&I(ei,{styles:MI}),I("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[yr(ur["medium-icon"],ur.icon),...n??[]],size:17})}const FI=or({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),OI={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function VI(){const e=uw(),{dashboardKey:t}=PI();return I(tc,{onClick:()=>{is(OI[t],{routeProps:{}})},stylists:[yr(null,FI)],children:e?I(LI,{Component:DI}):P(N,{children:[I(hl,{Component:DI}),I(hc,{children:"Filters"})]})})}const UI=S.object({beginDate:S.string().nullable(),endDate:S.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Vt(e.beginDate),n=Vt(e.endDate);if(t&&n)return!Mt(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),BI=or({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),HI=or({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),WI=yr(null,or({marginTop:"22px"}));function _I({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,db({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:UI},onSubmit:e=>{const t={beginDate:e.value.beginDate||void 0,endDate:e.value.endDate||void 0};i(t)}})),a=we(r.store,e=>e.errorMap),o=a&&Object.values(a).some(e=>void 0!==e);var i;return P("div",{className:BI,children:[P("div",{className:HI,children:[I(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),I(Ad,{Component:ow,stylists:[WI]}),I(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&I(cp,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const qI={width:"fit-content"};function zI({onDateRangeChange:e}){const{filters:t}=PI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Kt);if(void 0!==t){const e=t.value.date?.value;if(wt(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(Tx,{triggerChildren:I(Ex,{displayLabel:"Custom"}),popupChildren:I(Bc,{style:qI,children:I(_I,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const jI=or({width:200,minWidth:200});function KI({dateFilter:e,addFilter:t}){return I(Bg,{onClick:()=>t(e),children:I(Ao,{children:Ct[e]})})}function YI({getModel:e,addFilters:t}){const{setOpen:n}=Ic(),r=r=>{const a=e(Kt);if(void 0===a)return;const o=a.createFilter({name:Ct[r],value:{[a.key]:{name:Ct[r],value:r}}});t([o]),n(!1)};return I(Bc,{children:P(Dg,{style:jI,children:[I(KI,{dateFilter:yt.ALL_TIME,addFilter:r}),I(op,{alignment:"horizontal"}),I(KI,{dateFilter:yt.THIS_MONTH,addFilter:r}),I(KI,{dateFilter:yt.LAST_MONTH,addFilter:r}),I(KI,{dateFilter:yt.LAST_3_MONTHS,addFilter:r}),I(KI,{dateFilter:yt.LAST_12_MONTHS,addFilter:r}),I(op,{alignment:"horizontal"}),I(KI,{dateFilter:yt.THIS_QUARTER,addFilter:r}),I(KI,{dateFilter:yt.LAST_QUARTER,addFilter:r}),I(op,{alignment:"horizontal"}),I(KI,{dateFilter:yt.THIS_YEAR,addFilter:r}),I(KI,{dateFilter:yt.LAST_YEAR,addFilter:r}),I(op,{alignment:"horizontal"}),I(zI,{onDateRangeChange:n=>{const r=e(Kt);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const ZI=[yr(null,FI)];function GI({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Kt);let n=Ct[yt.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=xt(e)?Ct[e]:wt(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Vt(e.beginDate):null,n=e.endDate?Vt(e.endDate):null;return t&&!n?`After ${qt(t)}`:!t&&n?`Before ${qt(n)}`:t&&n?`${Lt(t)} - ${Lt(n)}`:"Custom"}(e):t.name}return n})(e);return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(tc,{stylists:ZI,popupTriggerProps:e,children:I(hc,{children:r})})}),I(YI,{getModel:t,addFilters:n})]})}const QI=or({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),XI=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function JI({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=Ic();return I(Bg,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:P("div",{className:QI,children:[P("span",{className:XI,children:[n&&I(Pd,{Component:n}),I(Ao,{children:e})]}),o&&I(Pd,{Component:il})]})})}const $I=[{label:dC[sC.EXPENSE],type:sC.EXPENSE},{label:dC[sC.REVENUE],type:sC.REVENUE},{label:dC.BANK_TRANSFER,type:"TRANSFER_IN"},{label:dC.BANK_TRANSFER,type:"TRANSFER_OUT"}],eN=yr(null,FI);function tN({manualTransactionOptions:e}){const t=$I.filter(t=>e.includes(t.type)),n=uw();return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(tc,{stylists:[eN],popupTriggerProps:e,children:n?I(LI,{Component:Hs}):P(N,{children:[I(hl,{Component:Hs}),I(hc,{children:"Add Transaction"})]})})}),I(Bc,{children:I(Dg,{children:t.map(({label:e,type:t})=>I(JI,{closeOnClick:!0,onClick:()=>us(null,{initialType:t}),children:e},t))})})]})}const nN=yi(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"),rN=or.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function aN(){return I(tc,{styles:rN,onClick:()=>is("TransactionSettingsDrawer"),children:I(Pd,{Component:nN})})}const oN=or.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function iN({children:e,styles:t}){return I("div",{className:or(oN,t),children:e})}const lN=yr(ur["dashboard-header"],or({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),sN=yr(null,or({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),cN=or.raw({paddingLeft:"15px",paddingRight:"15px"}),dN=or({display:"none",xl:{display:"flex"}});function uN({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=PI(),l=uw(),s=o(()=>hr(n)?"":n.find(e=>e.modelKey===st)?.value.search?.value??"",[n]);return P("div",{...lN,children:[P("div",{...sN,children:[I(Nw,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(st);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:Ow(l)}),I(VI,{}),I(tN,{manualTransactionOptions:t}),!l&&I(GI,{filters:n,getModel:a,addFilters:i}),I(aN,{}),I("div",{className:dN,children:I(fl,{})})]}),n.length>0&&I(iN,{styles:cN,children:I(RI,{filters:n,removeFilter:r})})]})}const hN=fn.filter(e=>e!==vn.COMMENTS&&e!==vn.DIMENSION_VALUE),pN=yr(null,or({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function gN(){return I("div",{...pN,children:I(fl,{})})}const mN=or.raw({gap:"6px"});function vN({Icon:e,label:t,children:n,onClick:r}){return n?P(Sc,{placement:"bottom-start",children:[I(Nc,{children:n=>P(Kc,{popupTriggerProps:n,extraClassNames:[mN],children:[e&&I(hl,{Component:e}),I(hc,{children:t})]})}),n]}):P(Kc,{onClick:r,extraClassNames:[mN],children:[e&&I(hl,{Component:e}),I(hc,{children:t})]})}const fN=yi(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"),bN=yr(null,or({whiteSpace:"normal"}));function yN({transactions:e,id:t,label:n,resetSelected:r}){const{mutateAsync:a}=Zx({mutationFn:qx,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Couldn't update review statuses"}}}),o=Ic();return Xi(t)?I(Bg,{onClick:()=>(async t=>{if(o.close(),e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));await a(r)}var n;r&&r()})(t),children:I(Tm,{stylists:[bN],children:n})}):null}const CN={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},xN=e=>e.map(e=>({id:e.id,status:CN.INACTIVE})),TN=yi(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"),wN=[{id:"delete",label:"Delete",Icon:fN,component:function({transactions:e,resetSelected:t,...n}){const{mutateAsync:r}=Zx({mutationFn:qx,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:(e,t)=>1===t.length?"Transaction deleted":`${t.length} transactions deleted`,defaultErrorMessage:e=>1===e.length?"Couldn't delete transaction":"Couldn't delete transactions",defaultPartialMessage:"Some transactions couldn't be deleted"}}}),a=async()=>{const n=xN(e);await r(n),t&&t()};return I(vN,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ch({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:Ku,label:"Cancel"},{key:Yu,label:"Delete",type:sh.DANGER}]}).then(e=>{e===Yu&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:TN,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=Qx(),o=e.length;return o>0&&I(vN,{label:`${t} ${dh("Expense","Expenses",o,!0)}`,...r,children:I(ET,{onClick:async function(t){var r,o;t?.id&&(await a((r=e,o=t.id.toString(),r.map(e=>({id:e.id,categoryId:o})))),n&&n())}})})}},{id:"recategorize-revenues",label:"Recategorize",Icon:TN,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=Qx(),o=e.length;return I(vN,{label:`${t} ${dh("Revenue","Revenues",o,!0)}`,...r,children:I(Nx,{onClick:async function(t){var r,o;await a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:px})})}}];function kN({subActionList:e}){return I(Dg,{children:e})}function EN({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?I(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return I(vN,{label:n,Icon:r,children:I(Bc,{children:i.length>0?I(kN,{subActionList:i}):I(Bg,{children:I(hc,{children:"No Actions Available for Selection"})},"no-actions")})})}const AN=yr(ur["bulk-select"],or({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function SN({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=Ki();return o(()=>[...wN,{id:"review",label:"Change Review Status",Icon:wi,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:yN}))}],[e])})(),s=()=>e.resetRowSelection(!0);return P("div",{...AN,children:[I(iw,{table:e}),I(Ao,{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?I(EN,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&I(t,{transactions:d,resetSelected:s,...c},i)})]})}function IN({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r,zeroStateEventName:o}){const i=uw(),l=function({transactions:e,columns:t}){const n=uw(),r=pw({transactions:e,columns:t?[vn.SELECT,...t,vn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!hr(t.getColumn(mn.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:s}=PI(),c=l.getIsAllRowsSelected(),d=l.getIsSomeRowsSelected(),u=c||d;let h;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?h=I(_w,{buttonText:"Clear Filters",onButtonClick:()=>s([])}):r&&0===e?.length&&(h=I(xw,{})):h=I(yw,{eventSource:o});const p=u&&hr(h)&&!i;return P(ic,{dashboard:"transactionDashboard",children:[p?I(SN,{table:l}):I(ql,{headerGroups:l.getHeaderGroups()}),hr(h)?I(Fw,{table:l}):I(kd,{children:h})]})}const NN={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"}},PN=(e={})=>{const t=Qn(NN,e);return NN.transform(t,Gn)},RN=e=>or(PN(e));RN.raw=PN;const DN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},MN=(e={})=>{const t=Qn(DN,e);return DN.transform(t,Gn)},LN=e=>or(MN(e));LN.raw=MN;const FN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},ON=(e={})=>{const t=Qn(FN,e);return FN.transform(t,Gn)},VN=e=>or(ON(e));VN.raw=ON;const UN={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},BN=(e={})=>{const t=Qn(UN,e);return UN.transform(t,Gn)},HN=e=>or(BN(e));HN.raw=BN;const WN=or({display:"flex",padding:"16px 12px",borderWidth:"md",borderStyle:"solid",borderRadius:"lg",borderColor:"border.layout",backgroundColor:"surface.foreground"}),_N=yr(ur.card,WN,or({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function qN({children:e}){return I("div",{..._N,children:e})}const zN=yr(ur["card-header"],or({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function jN({children:e}){return I("div",{...zN,children:e})}const KN=or({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function YN({children:e}){return I("div",{className:KN,children:e})}const ZN=cr({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 GN({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}=PI();if(!d(t))return null;const h="active"===r,p=yr(ur["card-button"],ZN({filterStatus:r}),a);return I("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 QN=cr({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"}}),XN=or({minWidth:"200px"}),JN=or({marginLeft:"auto"});function $N({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=PI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Wr({queryKey:Hx({groupBy:e,filter:t}),queryFn:Wx})}({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)||!Xi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,yr(ur["card-button-icon-container"],QN({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Xi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return P(GN,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:XN,isZeroState:t,filterEffectiveValueExtractor:NS,children:[I("div",{...l,children:I(Pd,{Component:e.Icon})}),!t&&i&&P(N,{children:[I(Ao,{children:e.text}),I("div",{className:JN,children:I(Ru,{children:s})})]}),!t&&!i&&P(N,{children:[I(hc,{children:e.text}),I("div",{className:or({marginLeft:"auto"}),children:I(Ru,{children:s})})]}),t&&P(N,{children:[I(hc,{intent:"weak",children:e.text}),I("div",{className:or({marginLeft:"auto"}),children:I(Ru,{children:s})})]})]},e.text)}function eP({isZeroState:e}){const t=function(){const e=Gi();return(e?_i:qi).map(t=>Yi(t,e))}();return P(qN,{children:[I(jN,{children:I(hc,{intent:"weak",children:"Review Status"})}),I(YN,{children:t.map(t=>I($N,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const tP=or({width:"20px",height:"20px",borderRadius:"sm"});function nP({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return pr(e)?P(N,{children:[!r&&I(ei,{styles:tP}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[yr(ur["medium-icon"],ur.icon),...n??[]],size:20})}const rP=or({minWidth:"269px"}),aP=or({marginLeft:"auto"});function oP({account:e,isZeroState:t}){const{apiFilters:n}=PI(),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=Dr(e.mask)?void 0:ph(e.mask),c=Co(null!=(d=e.accountBalance)?uh(d):0,{dollarSign:!0});var d;return P(GN,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:rP,isZeroState:t,filterEffectiveValueExtractor:qS,children:[e.iconUrl&&I(nP,{imageUrl:e.iconUrl,Component:hm}),!t&&a&&P(N,{children:[I(Ao,{children:o}),s&&I(hc,{wrap:"wrap",children:s}),I("div",{className:aP,children:I(Ru,{children:c})})]}),!t&&!a&&P(N,{children:[I(hc,{children:o}),s&&I(hc,{wrap:"wrap",children:s}),I("div",{className:aP,children:I(Ru,{children:c})})]}),t&&P(N,{children:[I(hc,{intent:"weak",children:o}),s&&I(hc,{intent:"weak",wrap:"wrap",children:s}),I("div",{className:aP,children:I(Ru,{children:c})})]})]},e.id)}const iP=[{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 lP({isZeroState:e}){const{query:{data:t}}=xh({params:{filter:{apiName:{in:[...cs]}}}}),n=(r=t?.data??[],e?iP: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 P(qN,{children:[I(jN,{children:I(hc,{intent:"weak",children:"Account Balances"})}),I(YN,{children:n.map((t,n)=>I(oP,{account:t,isZeroState:e},n))})]})}const sP=or({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),cP=or({display:{"@page/xl":"flex",base:"none"}}),dP=or({display:{"@page/xl":"none",base:"flex"}}),uP=or({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 hP({showZeroStates:e,Chart:t}){return P("div",{className:uP,children:[I("div",{className:cP,children:I(eP,{isZeroState:e})}),I("div",{className:cP,children:I(lP,{isZeroState:e})}),I("div",{className:sP,children:I(t,{})}),I("div",{className:dP,children:I(eP,{isZeroState:e})}),I("div",{className:dP,children:I(lP,{isZeroState:e})})]})}const pP=or({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),gP=HN({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),mP=or({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),vP=or({paddingTop:"8px"}),fP=or({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),bP=or({display:"flex",flexDirection:"column",gap:"10px"});function yP({columns:e=hN,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1,zeroStateEventName:d}){const{filters:u}=PI(),{hasPlaidLinkedBankAccount:h}=$g(),p=h??!1,g=uw();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(wl,{});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===u.length&&pr(u[0].value?.date)?0:u.length,t.length);return I("div",{className:gP,children:P("div",{className:pP,children:[g&&c&&I("div",{className:bP,children:I(Rk,{})}),I(hP,{Chart:l,showZeroStates:!i}),P("div",{className:mP,children:[I("div",{className:vP,children:I(uN,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:fP,children:I(IN,{hasLinkedBankAccount:p,filterState:r,transactions:t,columns:e,zeroStateEventName:d})})]}),I(gN,{})]})})}return"zero state"}const CP=or({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),xP=yr(ur.card,WN,CP);function TP({children:e}){return I("div",{...xP,children:e})}const wP=or({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function kP({children:e}){return I("div",{className:wP,children:e})}const EP=yr(ur["card-header"],or({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function AP({children:e}){return I("div",{...EP,children:e})}const SP=or({minWidth:"300px"});function IP({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:SP,children:I(Af,{options:e,handleClick:t,selectedIndex:n})})}function NP(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=bt(e);return{beginDate:ft(ut(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:dt(ut(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:pt()}:"LAST_12_MONTHS"}const PP=Do.var("colors.border.layout"),RP=yr(ur["profit-loss-graph"],or({"& .recharts-surface":{outline:"none"}})),DP=Do.var("colors.money.positive.weak"),MP=Do.var("colors.money.positive"),LP=Do.var("colors.money.negative.weak"),FP=Do.var("colors.money.negative"),OP=Do.var("colors.surface.intent.action"),VP=Do.var("colors.surface.intent.action.active"),UP=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],BP=()=>{const[e,t]=d(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=qa({accountingMethod:"CASH",filter:NP(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=Vt(e??"");return{longLabel:t?Wt(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:ja(e)}}(e):"QUARTERLY"===t?function(e){const t=ht(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=ht(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??[]}(UP[e].value)}};function HP({selectedIndex:e,onSelect:t}){return I(IP,{options:UP,handleClick:t,selectedIndex:e})}const WP={top:20,right:20,left:20,bottom:5},_P={fill:Do.var("colors.typography.base"),fontSize:Do.var("fontSizes.metric.sm")};function qP({data:e,children:t,tooltip:n}){return I(W,{width:"100%",height:"100%",...RP,style:{flexGrow:1},children:P(_,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:WP,children:[I(j,{dataKey:"label",interval:0,tickLine:!1,stroke:PP,tick:_P}),I(Y,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const zP=or({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function jP(){return P("div",{className:zP,children:[I(Oo,{color:DP,label:"Income",diameter:10}),I(Oo,{color:LP,label:"Expense",diameter:10})]})}const KP=yr(null,or({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),YP=yr(null,or({width:"100%",height:"1px",backgroundColor:"border.layout"})),ZP=yr(null,or({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),GP=Do.var("colors.money.positive"),QP=Do.var("colors.money.negative");function XP({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 P("div",{...KP,children:[I(Ao,{children:a}),I("div",{...YP}),P("div",{...ZP,children:[I(Oo,{color:GP,label:"Income",diameter:12}),I(Ru,{children:xo(Number(o))})]}),P("div",{...ZP,children:[I(Oo,{color:QP,label:"Expense",diameter:12}),I(Ru,{children:xo(Number(i))})]})]})}function JP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=BP(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return P(TP,{children:[P(kP,{children:[P(AP,{children:[I(hc,{intent:"weak",children:"All Transactions"}),I(go,{title:xo(r),label:void 0})]}),P(AP,{children:[I(HP,{selectedIndex:e,onSelect:t}),I(jP,{})]})]}),P(qP,{data:n,tooltip:({active:e,payload:t})=>I(XP,{active:e,payload:t}),children:[I(Z,{name:"Income",dataKey:"income",minPointSize:2,fill:DP,isAnimationActive:!1,activeBar:{fill:MP}}),I(Z,{name:"Expense",dataKey:"expense",minPointSize:2,fill:LP,isAnimationActive:!1,activeBar:{fill:FP}})]})]})}const $P=or({display:"flex",flexDirection:"column",gap:{base:0,sm:"16px"}});function eR({columns:e,limit:t=100}){const n=SI(),{userRole:r}=i($c),{sortInstance:a,setSortInstance:o,apiSort:l}=Jy(),s=Pk(),{isFilling:c,paginationControls:d,query:{data:u,isError:h,error:p,isFetching:g}}=Cs({limit:t,sort:l,filter:{...n.apiFilters}}),m=u?.data,v=ks();return II("transactionsDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,c,v),P("div",{className:$P,children:[s&&I(Ak,{}),I(NI.Provider,{value:n,children:I(ul.Provider,{value:d,children:I(lc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(yP,{columns:e,transactions:m,isFetching:g,isFilling:c,isError:h,error:p??null,hasTransactions:v,Chart:JP,manualTransactionOptions:[sC.EXPENSE,sC.REVENUE,"TRANSFER_IN"],zeroStateEventName:"TransactionsDashboardZeroState"})})})})]})}const tR=e=>I(Vk,{children:I(Uk,{source:"TransactionsDashboard",children:I(eR,{...e})})}),nR={in:["EXPENSE","TRANSFER_OUT"]},rR=[{name:"Expense",types:cC.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:sC.TRANSFER_OUT}]}];function aR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=vI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=fI(),p=o(()=>({reviewStatus:SS(h),amount:HS(),bankAccount:_S(l),category:ES(i),customer:ZA(c),date:Zt,description:wI(),glAccount:pI(d),notes:EI(),status:aI(),vendor:YS(s),type:ZS(rR),search:ct}),[l,i,s,c,d,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,nR),[e,m]),f=u(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:g,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}const oR=yr(ur.text,or({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),to);function iR({children:e}){return I("div",{...oR,children:e})}const lR=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function sR({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 P("div",{className:lR,children:[I(cy,{children:n}),I(iR,{children:wo(r)})]})}const cR=or({width:"160px",height:"32px"}),dR=or({width:"54px",height:"32px"}),uR=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:cR,children:I(hc,{children:String(t.value)})}),hR=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:dR,children:I(hc,{alignment:"right",children:(r=n.value,Co(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},pR=({active:e,payload:t})=>I(sR,{active:e,payload:t});function gR({data:e}){return I(W,{width:"100%",height:44*(e?.length??0)+12,...RP,children:P(_,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[I(j,{type:"number",hide:!0,domain:[0,"dataMax"]}),I(K,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:uR,width:172}),I(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:hR,width:66}),I(Y,{content:pR,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(Z,{dataKey:"total",minPointSize:2,fill:OP,isAnimationActive:!1,activeBar:{fill:VP},barSize:32})]})})}const mR=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):[]},vR=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function fR(){const[e,t]=d(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Ut(n),endDate:Ut(t)}})(vR[e].value),{query:{data:r}}=qa({filter:n,select:mR}),a=n?`${Lt(Vt(n.beginDate))} - ${Lt(Vt(n.endDate))}`:"";return P(TP,{children:[P(kP,{children:[P(AP,{children:[I(hc,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(hc,{intent:"weak",wrap:"ellipsis",children:a})]}),I(IP,{options:vR,handleClick:e=>t(e),selectedIndex:e})]}),I(gR,{data:r})]})}function bR({columns:e,limit:t=100}){const n=aR(),{userRole:r}=i($c),{sortInstance:a,setSortInstance:o,apiSort:l}=Jy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=Cs({limit:t,sort:l,filter:{...n.apiFilters}}),g=d?.data,m=ks();return II("expenseDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),I(NI.Provider,{value:n,children:I(ul.Provider,{value:c,children:I(lc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(yP,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:fR,manualTransactionOptions:[sC.EXPENSE,"TRANSFER_OUT"],showTasks:!0,zeroStateEventName:"ExpenseDashboardZeroState"})})})})}const yR=e=>I(Vk,{children:I(Uk,{source:"ExpenseDashboard",children:I(bR,{...e})})}),CR={in:["REVENUE","TRANSFER_IN"]},xR=[{name:lC,types:cC.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:sC.TRANSFER_IN}]}];function TR(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=vI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=fI(),h=o(()=>({reviewStatus:SS(d),amount:HS(),bankAccount:_S(l),category:ES(i),customer:ZA(s),date:Zt,description:wI(),glAccount:pI(c),notes:EI(),status:aI(),type:ZS(xR),search:ct}),[l,i,s,c,d]),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,CR),[e,g]),v=u(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}=BP(),r=n.reduce((e,t)=>e+t.income,0);return P(TP,{children:[P(kP,{children:[P(AP,{children:[I(hc,{intent:"weak",children:"Total Income"}),I(go,{title:xo(r),label:void 0})]}),I(AP,{children:I(HP,{selectedIndex:e,onSelect:t})})]}),I(qP,{data:n,tooltip:({active:e,payload:t})=>I(sR,{active:e,payload:t}),children:I(Z,{name:"Revenue",dataKey:"income",minPointSize:2,fill:OP,isAnimationActive:!1,activeBar:{fill:VP}})})]})}function kR({columns:e,limit:t=100}){const n=TR(),{userRole:r}=i($c),{sortInstance:a,setSortInstance:o,apiSort:l}=Jy(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=Cs({limit:t,sort:l,filter:{...n.apiFilters}}),g=d?.data,m=ks();return II("incomeDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,m),I(NI.Provider,{value:n,children:I(ul.Provider,{value:c,children:I(lc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(yP,{columns:e,transactions:g,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:m,Chart:wR,manualTransactionOptions:[sC.REVENUE,"TRANSFER_IN"],showTasks:!0,zeroStateEventName:"IncomeDashboardZeroState"})})})})}const ER=e=>I(Vk,{children:I(Uk,{source:"IncomeDashboard",children:I(kR,{...e})})});function AR(){return I(op,{color:"weak",alignment:"horizontal"})}function SR(e){return t=>{"Enter"!==t.key&&"Space"!==t.code||(t.preventDefault(),e?.(t))}}const IR=cr({base:{display:"flex",padding:"16px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...cl,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),NR=cr({base:{...io},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function PR({name:e,disabled:t,onClick:n}){const r=t?void 0:n,a=t?void 0:SR(n);return P("div",{className:IR({disabled:t}),role:"button",tabIndex:t?-1:0,onKeyDown:a,onClick:r,children:[I("div",{className:NR({disabled:t??!1}),children:e}),!t&&I(Pd,{Component:il})]})}const RR=or({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),DR=or({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 12px",width:"100%",cursor:"pointer"}),MR=or(io,{color:"typography.base.weak"});function LR({label:e,defaultExpanded:t=!1,children:n}){const[r,a]=d(t),o=()=>a(e=>!e),i=SR(o);return P("div",{className:RR,children:[P("div",{className:DR,role:"button",tabIndex:0,"aria-expanded":r,onClick:o,onKeyDown:i,children:[I("div",{className:MR,children:e}),I(Pd,{Component:r?Dp:il})]}),r&&n]})}const FR={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}}};function OR(){const e=function(){const e=Re();return u(t=>{e(FR[t].route)},[e])}();return P(LR,{label:"Accounting",defaultExpanded:!0,children:[I(AR,{}),I(PR,{name:"Profit & Loss",onClick:()=>e("profit-and-loss")}),I(AR,{}),I(PR,{disabled:!0,name:"Balance Sheet"}),I(AR,{}),I(PR,{disabled:!0,name:"Cash Flow Statement"}),I(AR,{}),I(PR,{disabled:!0,name:"Trial Balance"})]})}function VR(){return P(LR,{label:"Income and Invoices",children:[I(AR,{}),I(PR,{disabled:!0,name:"Income Analysis"}),I(AR,{}),I(PR,{disabled:!0,name:"Accounts Receivable Aging"})]})}function UR(){return P(LR,{label:"Expenses and Bills",children:[I(AR,{}),I(PR,{disabled:!0,name:"Expense Analysis"}),I(AR,{}),I(PR,{disabled:!0,name:"Accounts Payable Aging"}),I(AR,{}),I(PR,{disabled:!0,name:"Time & Task Analysis"}),I(AR,{}),I(PR,{disabled:!0,name:"Mileage Analysis"})]})}function BR(){return P(LR,{label:"Taxes",children:[I(AR,{}),I(PR,{disabled:!0,name:"Schedule C"}),I(AR,{}),I(PR,{disabled:!0,name:"Form 1065"}),I(AR,{}),I(PR,{disabled:!0,name:"Form 1120-S"}),I(AR,{}),I(PR,{disabled:!0,name:"Form 1120"}),I(AR,{}),I(PR,{disabled:!0,name:"T2125"}),I(AR,{}),I(PR,{disabled:!0,name:"Tax Details for Filing"})]})}const HR=RN({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),WR=LN({gap:"16px",width:"100%"}),_R=VN({gap:"8px",alignItems:"center"}),qR=or(io,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),zR=or(io,{color:"typography.base"});function jR(){const e=De(),t=Re(),n=e.flatMap(e=>function(e){try{return hM.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:I("nav",{className:_R,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return P(f,{children:[r>0&&I(hl,{Component:il}),a?I("span",{className:zR,"aria-current":"page",children:e.label}):I("button",{type:"button",className:qR,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const KR=LN({gap:"16px",alignItems:"flex-start",width:"100%"}),YR=e=>["reports","profitAndLoss",e],ZR=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await La(n);return"SUCCESS"===r.result?r.data:void 0};function GR(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function QR(e){if(!hr(e))return Co(uh(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function XR(e){if(!hr(e))return Co(e,{cents:"always",decorator:"%",signage:"parens"})}function JR(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=GR(e,e=>{const t=n(e)?.total;return QR(t)}),i=[...(r?.children??[]).map((r,a)=>{const o=GR(e,e=>{const t=n(e)?.children?.[a].total;return function(e){if(void 0!==e)return Co(uh(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:GR(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=>QR(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>XR(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>QR(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>XR(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>QR(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}const $R=yi(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 eD({expanded:e,canExpand:t=!0}){return I(Rc,{Component:t?e?Dp:il:$R})}const tD=cr({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:io,bold:lo},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 nD({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return I("td",{rowSpan:e,onClick:n,className:tD({clickable:r??void 0!==n,...a}),children:t})}function rD({children:e,colspan:t,...n}){return I("th",{colSpan:t,className:tD({...n}),children:e})}const aD=J();function oD(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const iD=or({alignItems:"center",display:"flex",gap:8}),lD=aD.accessor("label",{id:"label",header:e=>{const t=e.table.getIsAllRowsExpanded();return I(nD,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:P("div",{className:iD,children:[I(eD,{expanded:t}),t?"Collapse All":"Expand All"]})})},cell:e=>I(nD,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:P("div",{className:iD,children:[I(eD,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})});const sD={[yt.LAST_6_MONTHS]:"Last 6 Months",[yt.LAST_12_MONTHS]:"Last 12 Months (TTM)",[yt.LAST_QUARTER]:"Last Quarter",[yt.LAST_YEAR]:"Last Year",[yt.THIS_QUARTER]:"This Quarter",[yt.THIS_YEAR]:"This Year"},cD=[yt.LAST_6_MONTHS,yt.LAST_12_MONTHS,yt.LAST_QUARTER,yt.LAST_YEAR,yt.THIS_QUARTER,yt.THIS_YEAR];const dD=or({width:"200px",minWidth:"200px"}),uD={width:"fit-content"};function hD({onPresetSelect:e,onCustomSelect:t}){const{close:n}=Ic();return I(Bc,{children:P(Dg,{style:dD,children:[cD.map((t,r)=>P(f,{children:[I(Bg,{onClick:()=>(e(t),void n()),children:I(Ao,{children:sD[t]})}),(1===r||3===r)&&I(op,{alignment:"horizontal"})]},t)),I(op,{alignment:"horizontal"}),I(Tx,{triggerChildren:I(Ex,{displayLabel:"Custom"}),popupChildren:I(Bc,{style:uD,children:I(_I,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function pD({value:e,onChange:t}){const n=function(e){const t=Vt(e.endDate),n=Vt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:Lt(n)} - ${null===t?e.endDate:Lt(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${Lt(n)} - ${Lt(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?Wt(n,{abbreviateMonth:!0}):`${Wt(n,{abbreviateMonth:!0})} - ${Wt(t,{abbreviateMonth:!0})}`}(e);return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>P(tc,{popupTriggerProps:e,children:[I(Pd,{Component:Qk}),I(hc,{wrap:"nowrap",children:n})]})}),I(hD,{onPresetSelect:e=>{t(St(e))},onCustomSelect:e=>{t(e)}})]})}const gD={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},mD={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},vD=["NONE","MONTHLY","QUARTERLY","YEARLY"],fD=or({width:"200px",minWidth:"200px"});function bD({onSelect:e}){const{close:t}=Ic();return I(Bc,{children:I(Dg,{style:fD,children:vD.map(n=>I(Bg,{onClick:()=>(e(n),void t()),children:I(Ao,{children:gD[n]})},n))})})}function yD({value:e,onChange:t}){const n=mD[e];return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>P(tc,{popupTriggerProps:e,children:[I(Pd,{Component:su}),I(hc,{wrap:"nowrap",children:n})]})}),I(bD,{onSelect:t})]})}const CD=[{label:"Accrual",value:"ACCRUAL"},{label:"Cash",value:"CASH"}],xD=Object.fromEntries(CD.map((e,t)=>[e.value,t])),TD=or({width:"200px"});function wD({accountingMethod:e,onChange:t}){const n=xD[e],r=u(e=>{t(CD[e].value)},[t]);return I("div",{className:TD,children:I(Af,{options:CD,selectedIndex:n,handleClick:r})})}const kD=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:"none"})))),ED=yi(kD,"DimensionValue"),AD=or({width:"200px",minWidth:"200px"});function SD({labels:e,onSelect:t}){const{close:n}=Ic(),r=e=>{t(e),n()};return I(Bc,{children:P(Dg,{style:AD,children:[I(Bg,{onClick:()=>r(void 0),children:I(Ao,{children:"None"})}),e.map(e=>I(Bg,{onClick:()=>r(e.id),children:I(Ao,{children:e.name})},e.id))]})})}function ID(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(hr(e)||n.has(e))continue;const i=r.children.find(e=>!hr(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 ND(){return jS({select:ID})}function PD({value:e,onChange:t}){const{query:{data:n=[]}}=ND();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>P(tc,{popupTriggerProps:e,children:[I(Pd,{Component:ED}),I(hc,{wrap:"nowrap",children:a})]})}),I(SD,{labels:n,onSelect:t})]})}function RD({popupTriggerProps:e,text:t}){return P(lf,{popupTriggerChildrenProps:e,children:[I(XA,{children:I(hc,{wrap:"wrap",children:t})}),I(Pd,{Component:il})]})}function DD({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=Uw(n,e.key),i=Ww(e.name,o,1);return P(Sc,{children:[I(Nc,{children:e=>I(RD,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>Bw(n,e.key,t))},filters:a})]})}const MD=yi(um,"Bank");function LD({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(XS,{isSelected:n}):I(af,{selected:n,showEmptyIndicator:!0});return P(lf,{handleClick:t,selected:n,children:[P(XA,{children:[o&&I(Ad,{imageUrl:e.iconUrl,Component:MD}),I(hc,{wrap:"wrap",children:e.name})]}),i]})}function FD({values:e,model:t,pendingFilters:n,onClick:r}){return I(tf,{title:I(Io,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=Uw(n,t.key),i=(l=e,o.some(e=>x(e.value,l.value)));var l;return I(LD,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(Xv,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function OD({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ae(e,Kg),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return I(FD,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function VD({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I(Yv,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:OD,DefaultList:FD,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function UD({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=Ic();return I(Hv,{title:"Back",Footer:I(fS,{onClearAll:()=>{a(e=>Bw(e,t.key,[]))},onApply:()=>{const e=Uw(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?I(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):I(VD,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function BD({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=Ic();return I(fS,{onApply:()=>{n(Hw(e)),a()},onClearAll:()=>{t(e=>Bw(e,r,[]))}})}function HD({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=Uw(n,e.key),a=e.singleSelect?(o=r,i=t,l=e.createFilter,o.some(e=>x(e.value,i.value))?o:[l(i)]):function(e,t,n){const r=e.findIndex(e=>x(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 Bw(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=I(Hv,{title:"Back",Footer:I(BD,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:I(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(hr(l)||!it(l))return null;if(s)return I(df,{});i=I(UD,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=Uw(n,e.key),s=Ww(e.name,l);return P(Sc,{children:[I(Nc,{children:e=>I(RD,{popupTriggerProps:e,text:s})}),i]})}const WD=or({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function _D({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=uw();return I("div",{className:WD,children:I(tf,{title:I(Io,{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 hr(o)&&void 0===t.SimpleListComponent?I(DD,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):I(HD,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function qD(e){return!hr(e)&&e.startsWith("dimension_")}const zD=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:Ei(t[1].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function jD(){return Wr({queryKey:["dimensions"],queryFn:zD})}function KD({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=jD(),{query:{data:i}}=jS(),l=qD(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||!Bf(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 I(Zf,{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=>Bw(e,l,n))},allowMultiselect:!0})}function YD(e,t){return lt({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>I(KD,{...e,dimension:t})})}function ZD({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=KS(),t=function(){const{query:{data:e}}=ND();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,YD(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:ZA(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=Ic(),[a,i]=d(()=>Vw(e,n));return I(Bv,{title:"Filter By",padChildren:!1,Footer:I(fS,{onApply:()=>{t(Hw(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:I(_D,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function GD({filters:e,setFilters:t}){const{open:n}=Ic();return I(Pv,{overlay:!0,children:n&&I(ZD,{filters:e,setFilters:t})})}function QD({filters:e,setFilters:t}){return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>P(tc,{popupTriggerProps:e,children:[I(Pd,{Component:DI}),I(hc,{wrap:"nowrap",children:"Filters"})]})}),I(GD,{filters:e,setFilters:t})]})}function XD({filters:e,setFilters:t}){return e.map((n,r)=>I(ib,{text:n.name,onClickRemove:()=>t(ot(e,r)),additionalValidClassName:ur["filter-pill"]},n.id))}const JD=yi(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 $D(){return P(tc,{disabled:!0,children:[I(hl,{Component:JD}),I(hc,{children:"Export Report"})]})}function eM(){return P(tc,{disabled:!0,children:[I(hl,{Component:Dd}),I(hc,{children:"Send Report"})]})}const tM=[],nM=cr({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:io,bold:lo},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"}}),rM=or({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),aM=VN({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),oM=VN({gap:"8px",flexWrap:"wrap"}),iM=HN({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"}),lM=or({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),sM=or({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),cM=or({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function dM(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function uM(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!qD(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 hM=S.object({label:S.string()}),pM=Le([{path:FR["/"].path,errorElement:I(N,{}),element:I(Me,{}),handle:FR["/"].handle,children:[{index:!0,Component:function(){const e=Pk();return P("div",{className:HR,children:[e&&I(Ak,{}),P("div",{className:WR,children:[I(OR,{}),I(VR,{}),I(UR,{}),I(BR,{})]})]})}},{Component:function(){return P("div",{className:KR,children:[I(jR,{}),I(Me,{})]})},children:[{path:FR["profit-and-loss"].path,Component:function(){const[e,t]=d(()=>St(yt.LAST_6_MONTHS)),[n,r]=d("MONTHLY"),[i,l]=d("ACCRUAL"),[s,c]=d(void 0),h=a(null),[p,g]=d([]),m=gn(e=>e.FEATUREFLAG_REPORT_FILTERS),v=u(()=>{const e=b.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[b=h]);var b;const{query:{data:y},isFilling:C}=(x={filter:{...e,dimensionValues:uM(p),customerIds:dM(p)},grouping:{period:n,dimensionId:s},accountingMethod:i},T={placeholderData:L},Wr({queryKey:YR(x??{}),queryFn:ZR,...T}));var x,T;const w=o(()=>JR(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)=>aD.accessor(`values.${c}[${t}]`,{header:t=>I(rD,{border:oD(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 I(nD,{border:oD(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?aD.group({id:`valueRecord.${a}`,header:t=>I(rD,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[lD,...a]}(y),[y]),E=$({data:w??tM,columns:k,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:!0,columnPinning:{left:["label"]}}}),A=E.getExpandedRowModel().rows;return P("div",{className:rM,children:[P("div",{className:aM,children:[P("div",{className:oM,children:[I(pD,{value:e,onChange:t}),I(yD,{value:n,onChange:r}),m&&I(QD,{filters:p,setFilters:g}),I(PD,{value:s,onChange:c})]}),P("div",{className:oM,children:[I(wD,{accountingMethod:i,onChange:l}),I($D,{}),I(eM,{})]})]}),I(iN,{children:I(XD,{filters:p,setFilters:g})}),!C&&I("div",{className:iM,ref:h,onScroll:v,children:P("table",{className:lM,children:[I("thead",{className:sM,children:E.getHeaderGroups().map(e=>I("tr",{className:cM,children:e.headers.map((e,t)=>e.isPlaceholder?I(rD,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):X(e.column.columnDef.header,e.getContext()))},e.id))}),I("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 I("tr",{className:nM({rowType:l,expandable:n,weight:o}),onClick:r,children:e.getVisibleCells().map(e=>I(f,{children:X(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})]})},handle:FR["profit-and-loss"].handle}]}]}]);function gM(){return s(()=>()=>{pM.navigate(FR["/"].route)},[]),I(Fe,{router:pM})}function mM(){return I(Vk,{children:I(gM,{})})}const vM=He("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),fM={queryClient:Ur,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await vM).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await vM).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await vM).delete("queryClient",e)}(e)}}}(),maxAge:Vr,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function bM({children:e}){return I(We,{client:Ur,persistOptions:fM,children:e})}const yM=or({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"}}),CM=or({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:"overlay",overscrollBehavior:{base:"contain",xl:"none"}}),xM=yr(null,ur.component,yM);function TM({children:e}){const t=a(null),n=a(null),r=uw();return g(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),I(fe,{children:I(be,{lockScroll:!0,className:CM,children:I("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,gn.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...xM,children:e})})})}const wM=l({closingQueue:[],drawerHistory:[]});function kM({children:e}){const t=gn(e=>e.drawerHistory),n=gn(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(wM.Provider,{value:r,children:a&&I(TM,{children:e})})}const EM=l({isActive:!0,isClosing:!1});function AM({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=i(wM),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),l=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==l,d=(o&&o[t])??(l&&l[t]);return I(EM.Provider,{value:{isActive:s,isClosing:c},children:d&&I(e,{...d.routeProps})})}const SM=cr({base:{position:"absolute",display:"flex",top:0,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"}},variants:{side:{right:{right:0,left:{base:0,sm:"auto"}},left:{left:0,right:{base:0,sm:"auto"}}},mobileCoverage:{full:{},partial:{width:{base:"80%"},minWidth:{base:"auto"}}}},defaultVariants:{side:"right",mobileCoverage:"full"}}),IM=or({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function NM({children:e,side:t="right",mobileCoverage:n="full"}){const r=a(null),{isActive:o,isClosing:l}=i(EM),{onExitAnimationEnd:c,onInitialAnimationComplete:h}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=d(!0),o=u(()=>{gn.getState().confirmCloseDrawer()},[]),i=u(()=>{a(!1)},[a]);return s(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:o,isClosing:l,focusRef:r}),{context:p,refs:g}=re({open:o&&!l}),m=ve([r,g.setFloating]);return I(Ie,{onExitComplete:c,children:!l&&I(ye,{context:p,modal:!0,initialFocus:-1,children:P(Ne.div,{tabIndex:-1,ref:m,onAnimationComplete:()=>h(),transition:xv,initial:wv(t),animate:Tv,exit:kv(t),...yr(ur.drawer,SM({side:t,mobileCoverage:n})),children:[e,!o&&I("div",{className:IM})]})})})}const PM=cr({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 RM({background:e,children:t}){return I("div",{className:PM({background:e}),children:t})}const DM=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function MM(e){return void 0!==DM[e]}function LM(e){return DM[e]}const FM=yi(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"),OM=or({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function VM({cldrShortName:e}){return I("div",{className:OM,children:LM(e)})}const UM=cr({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),BM=or({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 HM({reactions:e,type:t,handleClick:n}){return I("div",{className:BM,children:e.map((e,r)=>I("button",{className:UM({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(VM,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const WM=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:Ei(n)};return await La(o)},_M=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:Ei(n)};return await jm(o)};function qM(e,t,n){return Nr(Ns({id:e}),t,n)}async function zM(e){const t=Ns({id:e});return wa("mutation successful, invalidating messages queries"),Ur.invalidateQueries({queryKey:t}).catch(e=>ka({error:e,severity:"error"}))}function jM(e,t,n){const r=[...e];return r[n]=t,r}const KM=or({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),YM=Object.keys(DM).filter(MM).map(e=>({emojiCode:e,authorInfo:[]}));function ZM({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:l}=i($c),{mutate:s}=function(e){const{userId:t,userEmail:n}=i($c);return Nh({mutationFn:WM,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Failed to react to message"}},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=qM(n,t,r);await Ur.cancelQueries({queryKey:i});const l=Ur.getQueryData(i);return Ur.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:jM(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:()=>zM(e)})}(e);return P(Sc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(Nc,{children:e=>I("button",{className:KM,...e,children:I(Pd,{Component:FM})})}),I(Bc,{type:"reaction",children:I(HM,{reactions:YM,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===l);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const GM=cr({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function QM({reactions:e,type:t,handleClick:n}){const r=GM({type:t});return I("div",{className:r,children:I(HM,{reactions:e,handleClick:n,type:t})})}const XM=cr({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),JM=cr({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"}}}}),$M=or({position:"relative",display:"flex",flexDirection:"column"});function eL({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const l=a(null),{isHover:c,setIsHover:u,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=d(!1),[r,a]=d(!1);return s(()=>{if(null===o.current||!i||c)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,c=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,c}(l),{mutate:g}=function(e){const{userId:t}=i($c);return Nh({mutationFn:_M,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Failed to delete reaction"}},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=qM(n,t,r);await Ur.cancelQueries({queryKey:o});const i=Ur.getQueryData(o);return Ur.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return hr(r)||0===r.reactions.length?t:jM(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:()=>zM(e)})}(e),m=n?"sent":"received",v=o.filter(e=>MM(e.emojiCode)),f=v.length>0,b="sent"===m?ur["message-sent"]:ur["message-received"],y=yr(ur[b],JM({type:m}));return P("div",{className:XM({type:m,hasReactionsOnMessage:f}),ref:l,onMouseEnter:()=>"received"===m&&u(!0),children:[P("div",{className:$M,children:[I("div",{...y,children:r}),f&&I(QM,{reactions:v,type:m,handleClick:e=>g({id:t,emojiCode:e})})]}),c&&I(ZM,{conversationId:e,messageId:t,type:m,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const tL=cr({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),nL=or({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}),rL=or({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),aL=or({textDecoration:"none",color:"inherit",cursor:"pointer"});function oL({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=uw();return I("div",{className:tL({type:e?"sent":"received"}),children:I("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 ka({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:aL,children:P("div",{className:nL,children:[P("div",{className:rL,children:[I(hc,{children:n}),I(Io,{children:`${r}`})]}),I(Pd,{Component:JD})]})})})}const iL=yr(null,or({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function lL({children:e}){return I("div",{...iL,children:e})}const sL=yr(null,or({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"})),cL=or({minHeight:1,width:"100%"}),dL=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=u(()=>{t&&pr(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){s(()=>{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),P("div",{tabIndex:-1,...sL,ref:i,children:[I("div",{className:cL,ref:o}),e]})}),uL=Object.freeze({message:{text:"",attachments:[]}}),hL=or({width:"24px",height:"24px",objectFit:"contain"});function pL({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:hL})}const gL=or({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"}),mL=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),vL=or({display:"grid",flexDirection:"column",minWidth:0}),fL="LOADING",bL="LOADED",yL="ERROR";function CL({attachment:e,onRemove:t}){const n=e.hasError?yL:e.isPending?fL:bL;return P("div",{className:gL,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[P("div",{className:mL,children:[e.iconUrl&&I(pL,{iconUrl:e.iconUrl,fileName:e.displayFileName}),P("div",{className:vL,children:[I(hc,{children:e.displayFileName}),n===fL&&e.displayText&&I(Io,{accent:"strongest",children:e.displayText}),n===bL&&e.fileSize&&I(Io,{children:e.fileSize}),n===yL&&I(Io,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(Kc,{onClick:async n=>{n.stopPropagation(),await ch({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:Ku,label:"Cancel"},{key:Yu,label:"Remove",type:sh.DANGER}]})===Yu&&t(e)},children:I(hl,{Component:Pc})})]})}const xL=or({width:"100%"});function TL({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:db({defaultValues:t??uL,onSubmit:t=>{pg.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),d=a(null),h=u(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:g}=Nh({mutationFn:sg,meta:{toastOptions:{responseErrorParser:Rh,defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Ur.invalidateQueries({queryKey:["files/attachments"]}),await Ur.invalidateQueries({queryKey:["conversations"]})}}),m=u(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 I("form",{className:xL,ref:d,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,d.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:I(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>P(N,{children:[e.map(e=>I(CL,{attachment:e,onRemove:m},e.localId)),I(c.AppField,{name:"message",children:t=>I(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function wL(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 kL(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return wa("mutation successful, invalidating messages queries"),Promise.all([Ur.invalidateQueries({queryKey:e}),Ur.invalidateQueries({queryKey:t}),Ur.invalidateQueries({queryKey:n})]).catch(e=>ka({error:e,severity:"error"}))}const EL=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Ul({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),AL=async({data:e,accessToken:t,environment:n})=>Ul({data:{data:[e]},accessToken:t,environment:n}),SL=or({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),IL=or({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),NL=or({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),PL="Marked As Resolved";function RL({resolver:e}){const t=e?`${e} ${PL}`:PL;return P("div",{className:IL,children:[I("div",{className:SL}),I("div",{className:NL,children:t}),I("div",{className:SL})]})}const DL=cr({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 ML({width:e="md",height:t="md"}){return I(ei,{styles:DL({width:e,height:t})})}const LL=or({display:"flex",flexDirection:"row-reverse"});function FL(){return P(N,{children:[I(ML,{width:"lg",height:"lg"}),I("div",{className:LL,children:I(ML,{width:"md",height:"lg"})}),I("div",{className:LL,children:I(ML,{width:"lg",height:"xl"})}),I(ML,{width:"md",height:"lg"})]})}const OL=or({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function VL({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(lL,{children:I(eL,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(lL,{children:I(FL,{})}):P("div",{className:OL,children:[I(Ao,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(hc,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const UL=yr(null,or({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 BL({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:l,defaultValues:c,defaultSubject:u}){const{userId:h}=i($c),{mutate:p}=function(){const{userId:e}=i($c);return Nh({mutationFn:Ds,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Failed to send message"}},onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=Nr(Ns({id:e.conversationId}),t,n);await Ur.cancelQueries({queryKey:a});const o=Ur.getQueryData(a);return Ur.setQueryData(a,t=>[wL(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:kL})}(),{query:{data:g},isFilling:m}=function(e){const t=pr(e);return Wr({queryKey:Ns({id:e??""}),queryFn:Rs,select:Ps,enabled:t})}(e),{mutate:v,isPending:f,variables:b}=(k=t,E=l,Nh({mutationFn:AL,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Failed to create conversation"}},onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(hr(e)||hr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(pr(E)){const e={id:E};As(E,Es.BANK_TRANSACTION)?o=async()=>{const t=bs(e);return await Ur.invalidateQueries({queryKey:t})}:As(E,Es.FINANCIAL_SUMMARY)&&(i=async()=>await Ur.invalidateQueries({queryKey:a}))}return wa("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Ur.invalidateQueries({queryKey:n}),Ur.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>ka({error:e,severity:"error"}))}})),{mutate:y}=Nh({mutationFn:EL,meta:{toastOptions:{responseErrorParser:Gm,defaultErrorMessage:"Failed to mark conversation as read"}},onSuccess:async()=>{const e=["conversations"],t=["tasks"];return wa("mutation successful, invalidating conversations queries"),Promise.all([Ur.invalidateQueries({queryKey:e}),Ur.invalidateQueries({queryKey:t})]).catch(e=>ka({error:e,severity:"error"}))}}),[C,x]=d(!1),T=a(null),w=a(null);var k,E;s(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),s(()=>{Qp(w)},[g,w]);const A=hr(e)||hr(g)||m;return P(N,{children:[A?I(dL,{ref:w,inputRef:T,activeKeyboard:C,setActiveKeyboard:x,children:I(VL,{isConversationLoading:f,isFilling:m,message:b?.message?.text})}):P(dL,{ref:w,activeKeyboard:C,setActiveKeyboard:x,inputRef:T,children:[n&&I(RL,{resolver:"Conversation"}),g.map((t,n)=>{const r=t[0].author.userId===h;return I(lL,{children:t.map(t=>P(N,{children:[t.attachments.filter(e=>!hr(e)).map(e=>I(oL,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(eL,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...UL,children:I(TL,{scrollRef:w,inputRef:T,conversationId:e,blockSubmit:f,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),i=o.map(e=>`att_${e.id}`),s=a.length>0,c=i.length>0;if(s||c)if(hr(e)){const e=function(e,t,n){let r="";return pr(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(u,a,o[0]?.displayFileName),t=(d=a,h=i,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...pr(g=l)&&{attachedEntityId:g},message:{text:d,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:i}});var d,h,g},setActiveKeyboard:x,defaultValues:c})})]})}function HL({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=d(e),{query:{data:o}}=Vl(r),i="CLOSED"===o?.resolutionStatus;return P(RM,{children:[I(Lv,{}),I(BL,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const WL=yr(ur["form-body"],or({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 _L({children:e}){return I("div",{...WL,children:e})}const qL=yr(null,or({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),zL=yr(null,or({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),jL=or({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),KL=e=>{Tp(e),wp(e)},YL=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:o,conversationId:i,transactionId:l,transaction:c})=>{const d=a(c);return s(()=>{d.current=c},[c]),s(()=>()=>{const{events:e}=gn.getState(),t=d.current;ds(e.transactionForm,{type:"CLOSE_TRANSACTION_FORM",result:"SUCCESS",data:t??null,error:null}),pr(t)&&(cs.has(t.apiName)?ds(e.bankTransactionForm,{type:"CLOSE_BANK_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}):ds(e.processorTransactionForm,{type:"CLOSE_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}))},[]),I(NM,{children:P("div",{...qL,children:[I(RM,{children:P("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:KL,...zL,children:[n,I(_L,{children:e}),r]})}),null!==o&&I("div",{className:jL}),"conversation"===o&&l&&I(HL,{conversationId:i,attachedEntityId:l,defaultSubject:c?.description})]})})},ZL=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],GL=["FEDERAL","STATE","SALES"],QL=["Q1","Q2","Q3","Q4"],XL=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function JL(e){if(!hr(e))return XL.find(t=>t.value===e)?.name}const $L=S.object({id:S.string(),type:S.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:S.enum(Object.values(Fi)),amount:S.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:S.string("Required").refine(e=>(function(e,t){const n=ut(e.getFullYear(),e.getMonth(),e.getDate()),r=ut(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||Rt(new Date(e),/* @__PURE__ */new Date))&&Mt(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),frequency:S.union([S.object({name:S.string(),value:S.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),S.undefined()]),category:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),dimensionValues:S.array(S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).optional()),bankAccount:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:S.string().nullable(),itemizedByOptions:S.object({category:S.boolean(),customer:S.boolean()}).optional(),attachments:S.array(hg)}),eF=S.object({id:S.string(),name:S.string().optional(),requiredness:S.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),tF=S.object({id:S.string(),name:S.string().optional(),dimension:eF.optional()}),nF=tF.extend({child:tF.optional()}),rF=S.object({id:S.string().optional(),lineItemType:S.literal("itemized"),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).optional(),dimensionValues:S.array(nF),customer:S.object({id:S.string(),name:S.string().optional()}).nullable(),amount:S.number()}),aF=S.object({lineItemType:S.literal("invoice"),amount:S.number().nullable(),invoice:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),oF=S.object({lineItemType:S.literal("bill"),amount:S.number().nullable(),bill:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),iF=S.object({lineItemType:S.literal("fee"),amount:S.number()}),lF=S.object({lineItemType:S.literal("payment"),amount:S.number(),payment:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string(),bankAccount:S.object({id:S.string(),displayName:S.string()})})}),sF=S.discriminatedUnion("lineItemType",[rF,aF,iF,oF,lF]),cF=$L.extend({children:S.array(sF),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).nullable()});cF.extend({tax:S.object({paymentInfo:S.object({region:S.enum(GL).optional(),year:S.number().optional(),quarter:S.enum(QL).optional()}).nullable().optional()}).optional()});const dF=$L.extend({id:S.string(),type:S.literal(Object.values(sC)),description:S.string(),displayName:S.string(),iconUrl:S.string(),status:S.literal(Object.values(CN)),reviewStatus:S.literal(Object.values(Fi)),apiName:S.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:S.string().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()},{message:"Required"}),customer:S.object({id:S.string(),name:S.string().optional(),email:S.string().optional()}).nullable(),vendor:S.object({id:S.string(),name:S.string().optional()}).nullable(),invoice:S.object({id:S.string(),name:S.string(),date:S.string(),lineItems:S.array(S.object({id:S.string(),amount:S.number()}))}).nullable(),bill:S.object({id:S.string(),name:S.string().optional()}).nullable(),payroll:S.object({id:S.string(),date:S.string().optional(),checkDate:S.string().optional(),description:S.string().optional()}).nullable(),apiItemId:S.string().nullable()}),uF=S.looseObject({amount:S.number().nullable(),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),hF=S.object({children:S.array(uF),itemizeByOptions:S.record(S.string(),S.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"]})})}),pF=cF.extend({type:S.literal("EXPENSE"),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:S.object({id:S.string(),name:S.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&&Dr(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),gF=cF.extend({type:S.literal("BANK_TRANSFER"),reconciliationMatch:S.object({id:S.string(),description:S.string().optional(),amount:S.number().optional(),date:S.string().optional(),apiInstitutionId:S.string().nullable().optional(),apiName:S.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!!hr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>gF.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),mF=dF.extend({}),vF=S.looseObject({amount:S.number().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),fF=S.object({children:S.array(vF),itemizeByOptions:S.record(S.string(),S.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"]})})}),bF=cF.extend({type:S.literal("REVENUE"),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.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 yF(e){return e.reduce((e,t)=>new H(e).plus(t??0).toNumber(),0)}function CF(e,t){const n=new H(e).times(100).round(0),r=new H(t).times(100).round(0);return!n.eq(r)}function xF(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(Dr(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function TF(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function wF(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function kF(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function EF(e){return"EXPENSE"!==e.type||hr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function AF(e,t,n){if(e(t))return n}const SF={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function IF(e){return Dr(e)?void 0:e}function NF(e,t,n){const r=(e,t)=>AF(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:IF((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:IF(e.id),amount:e.amount?hh(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:IF(e.id),amount:hh(e.amount)}}(e);case"bill":return function(e){return{id:IF(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:IF(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?hh(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=>!hr(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 hr(t)?e:{...e,glAccountId:Ss({id:t,prefix:"GL_ACCOUNT"})}});return hr(r)?hr(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 PF(e=null){const{mutateAsync:t}=Yx(),{mutateAsync:n}=Gx({mutationFn:_x,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}}),{query:{data:r}}=sT();return async(a,o,i)=>{const l=r?.data??[];var s,c;e?(await t(function(e,t,n,r){return{...NF(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()):await n((s=a,c=l,{...NF(s,c,()=>!0),amount:s.amount?hh(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||SF[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}))}}const RF=cF.extend({type:S.literal("TAX_PAYMENT"),tax:S.object({paymentInfo:S.object({region:S.enum(GL,{message:`Tax region must be one of: ${GL.join(", ")}`}),quarter:S.enum(QL,{message:"Required"}),year:S.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: ${GL.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))});function DF(){const e=a(!0);return s(()=>(e.current=!0,()=>{e.current=!1}),[]),u(()=>{e.current&&ls()},[])}const MF={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Ut(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:gs[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function LF(e){const t=/* @__PURE__ */new Map;for(const n of e){if(hr(n.bill)||!hr(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 FF(e){const t=/* @__PURE__ */new Map;for(const n of e){if(hr(n.invoice)||!hr(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 OF(e){const t=/* @__PURE__ */new Map;for(const n of e){if(hr(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 VF(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function UF(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(hr(e.paymentId)&&hr(e.bill)&&hr(e.invoice)||VF(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...LF(r),...FF(r),...OF(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=>!(hr(e.invoice)&&hr(e.payroll)&&hr(e.bill)&&hr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return hr(e.paymentId)||VF(e,n)?t&&VF(e,n)?(r=e,{...r,lineItemType:"fee",amount:uh(r.amount)}):hr(e.invoice)?hr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:uh(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return hr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:uh(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:uh(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:uh(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:uh(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=uh(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 BF({value:e}){return{fields:HF(function(e){switch(e){case"EXPENSE":return pF;case"TAX_PAYMENT":return RF;case"BANK_TRANSFER":return gF;case"REVENUE":return bF}}(e.type).safeParse(e))}}function HF(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 WF(e,t,n){const r=PF(e),{query:{data:a}}=nx({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=DF(),i=e?(s=t,c=a,{id:(l=e).id,type:EF(l),reviewStatus:l.reviewStatus,amount:uh(l.amount),category:l.category,date:l.date,vendor:l.vendor,customer:l.customer,frequency:l.frequency,bankAccount:l.bankAccount,glAccount:l.glAccount,notes:l.notes,dimensionValues:xF(l.dimensionValues,s),children:UF(l,c),reconciliationMatch:l.reconciliationMatch?{...l.reconciliationMatch,amount:uh(l.reconciliationMatch.amount??0)}:void 0,tax:l.tax,attachments:l.attachments?l.attachments.map(e=>({localId:e.id,file:new File([],e.fileName??""),displayFileName:e.fileName??"Unknown",displayText:"",fileSize:e.fileSize??null,id:Is(e.id),isPending:!1,hasError:!1,iconUrl:e.iconUrl??null,publicFileUrl:e.url??null})):[]}):function(e="EXPENSE",t){return{...MF,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var l,s,c;return db({defaultValues:i,canSubmitWhenInvalid:!0,validators:{onBlur:BF,onSubmit:BF},onSubmit:async e=>(await r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),o()),onSubmitInvalid:()=>{}})}function _F({onClick:e}){return I(JI,{Icon:fN,onClick:e,closeOnClick:!0,children:"Archive"})}function qF({onClick:e}){return I(JI,{onClick:e,closeOnClick:!0,children:"Restore"})}function zF(e){return u(async t=>{e.baseStore.setState(e=>({...e,isSubmitting:!0}));try{await t()}finally{e.baseStore.setState(e=>({...e,isSubmitting:!1}))}},[e])}const jF=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"})),KF=yi(jF,"Bill");function YF({onClick:e,error:t,validate:n}){return I(up,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const ZF=or({display:"flex",flexDirection:"column",width:"100%"}),GF=yr(ur["value-comparison-summary"],or({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),QF=or({display:"flex",flexDirection:"column",gap:"8px"});function XF({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return I("div",{className:ZF,children:P("div",{...GF,children:[P("div",{className:QF,children:[I(hc,{intent:"weak",children:"Selected Total"}),I(Ao,{children:ko(uh(e),r)})]}),P("div",{className:QF,children:[I(hc,{intent:"weak",children:`${n} Total`}),I(Ao,{children:wo(t)})]})]})})}const JF=or.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),$F=yr(null,or({color:"icon.base"}));function eO({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=ww({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return I("div",{className:_v,children:P("div",{...qv,children:[l?I(tp,{}):I(Pd,{stylists:[$F],Component:Wv}),I("input",{className:zv,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:wp}),Mr(e)&&I(tc,{styles:JF,onClick:()=>o(""),children:I(Pd,{Component:Pc})})]})})}const tO=or({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function nO({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return P("div",{className:tO,children:[I(hc,{intent:"weak",children:"Search"}),I(eO,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function rO(e,t,n){return`${e} | ${Lt(Vt(t))} | ${wo(uh(n))}`}const aO=yr(ur["linked-entity-row"],or({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"}})),oO=or({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),iO=yr(null,or({color:"icon.base"}));function lO({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return P("button",{type:"button",...aO,onClick:o,children:[P("div",{className:oO,children:[I(Pd,{stylists:[iO],Component:r}),I(hc,{wrap:"wrap",children:rO(t,n,e)})]}),I(af,{selected:a,showEmptyIndicator:!0})]})}const sO={root:null,threshold:1};function cO({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=u(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return s(()=>{const e=new IntersectionObserver(o,sO);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return I("div",{ref:n})}function dO({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return I(N,{children:t.groups.map(t=>P(rS,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>I(lO,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),I(cO,{onIntersect:a,enable:!r&&o})]},t.key))})}function uO(e){return Co(e,{cents:"always",dollarSign:!0})}function hO(e){return uO(Math.abs(e))}function pO({title:e,body:t}){return ch({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 gO(e,t,n){const r=hO(e);return`The selected bills total of ${hO(t)} is less than the expense total of ${r}. Was there a fee of ${hO(n)}?`}const mO=or(Dv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function vO({children:e}){return I("div",{className:mO,children:e})}function fO({transactionTotal:e,bills:t,previouslySelected:n,onSubmit:r,fetchNextPage:a,hasNextPage:i,isFetching:l,isFetchingNextPage:s,searchTerm:c,onSearchChange:u}){const[h,p]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[g,m]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),v=o(()=>new Set(n.map(e=>e.id)),[n]),f=o(()=>Rr(c)?[...n,...t.filter(e=>!v.has(e.id))]:t,[c,n,t,v]),b=Zv({data:[f],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:e=>{p(e),m(t=>{const n={...t},r=f.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:h}}),y=Object.entries(h).filter(([,e])=>e).map(([e])=>g[e]),C=y.reduce((e,t)=>e+t.amount,0),x=l&&!s;return I(Bv,{title:"Link Bill",Footer:I(YF,{onClick:()=>{const t=new H(C).div(100).times(-1).toNumber(),n=new H(e).sub(t).toNumber();t>e&&y.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return pO({title:"Bill Payment",body:gO(n,e,t)})}({selectedTotal:t,transactionTotal:e,suggestedFee:n}).then(e=>{let t=0;"FEE"===e&&(t=n),r(y,t)}).catch(()=>{}):r(y,0)}}),padChildren:!1,children:P(vO,{children:[I(XF,{selectedAmount:C,transactionTotal:e,transactionTypeLabel:"Expense"}),I(nO,{searchTerm:c,onChange:u,isFetching:x,searchPlaceholder:"Search bills..."}),I(dO,{listLabel:"Bills",glSourceList:b,icon:KF,fetchNextPage:a,hasNextPage:i,isFetching:l,pluralNoun:"bills",singularNoun:"bill"})]})})}const bO=e=>["bills/bills","infinite",e??{}],yO=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:Ei(n)},o=await La(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})},CO=[];function xO(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 TO(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return hr(e)||(t.search=e),t}function wO(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(c=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:c}),limit:10,filter:TO(t)},Vm({queryFn:yO,queryKey:bO(s)}));var s,c;const u=(r?.pages??CO).flatMap(e=>(e.data??[]).map(xO));return I(fO,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function kO(e){const t=Ic();return I(Pv,{children:t.open&&I(wO,{...e})})}function EO(e){return{lineItemType:"fee",amount:e}}function AO(e){return{lineItemType:"bill",amount:uh(-e.amount),bill:{id:e.id,amount:uh(e.amount),date:e.date,name:e.name}}}function SO(e){return e.map(AO)}function IO(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function NO(e){return`Remove ${e}?`}function PO(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function RO({action:e,titleName:t,entityName:n}){return ch({title:NO(t),body:PO(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 DO={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},MO={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function LO(e,t){const n=MO[t];return RO({titleName:n,entityName:n.toLowerCase(),action:DO[e]})}function FO(e){return e.filter(e=>"bill"===e.lineItemType).map(e=>({id:e.bill.id,name:e.bill.name,date:e.bill.date,amount:hh(e.bill.amount)}))}const OO="bill",VO=ub({defaultValues:MF,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType),a=FO(e.state.values.children);return P(Sc,{open:t,onOpenChange:n,children:[I(JI,{onClick:async()=>{const t=IO(OO,e.state.values.children);OO!==t?"YES"===await LO(OO,t)&&n(!0):n(!0)},Icon:KF,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),I(kO,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=SO(t);0!==r&&a.push(EO(r)),e.setFieldValue("children",a),n(!1)},previouslySelected:a})]})}}),UO=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})),BO=yi(UO,"Payroll");function HO(e,t,n){const r=hO(e);return`The selected invoice total of ${hO(t)} is greater than the transaction total of ${r}. Was there a fee of ${hO(n)}?`}const WO=e=>["payments/payments","infinite",e??{}],_O=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:Ei(n)},o=await La(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})},qO=or({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),zO=or({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),jO=or({marginLeft:"auto"});function KO({description:e,amount:t,bankAccountDisplayName:n,date:r}){return P("div",{className:qO,children:[P("div",{className:zO,children:[I(hc,{children:e}),t&&I(hc,{wrap:"nowrap",children:To(t)})]}),P("div",{className:zO,children:[n&&I(Io,{children:n}),I("span",{className:jO,children:r&&I(Io,{wrap:"nowrap",children:Lt(Vt(r))})})]})]})}function YO({payment:e,selected:t,onClick:n}){return I(sf,{handleClick:n,selected:t,isMultiSelect:!0,children:I(KO,{description:e.description,amount:uh(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}function ZO(e){return e}function GO(e){return e.pages.flatMap(e=>(e.data??[]).map(ZO))}function QO(e){return Object.values(e).some(e=>e)}function XO(e,t){return e===hh(t)}function JO(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:Rr(t)?void 0:t}}function $O({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const[a,i]=d(""),{query:{data:l,fetchNextPage:s,isFetching:c,hasNextPage:h,isFetchingNextPage:p}}=(g={filter:JO(n,a)},m={select:GO},Vm({queryFn:_O,queryKey:WO(g),...m}));var g,m;const[v,f]=d(r),[b,y]=d([]),C=o(()=>Object.fromEntries([...v,...b].map(e=>[e.id,!0])),[v,b]),x=o(()=>new Set(r.map(e=>e.id)),[r]),T=o(()=>Rr(a)?[...r,...(l??[]).filter(e=>!x.has(e.id))]:l??[],[a,r,l,x]),w=[...v,...b].reduce((e,t)=>e+t.amount,0),[k,E]=d(void 0),A=u(e=>{const n=r.filter(t=>e[t.id]),a=b.filter(t=>e[t.id]),o=new Set(a.map(e=>e.id)),i=(l??[]).filter(t=>e[t.id]&&!x.has(t.id)&&!o.has(t.id)),s=[...a,...i],c=[...n,...s].reduce((e,t)=>e+t.amount,0),d=QO(e);void 0===k||!XO(c,t)&&d||E(void 0),f(n),y(s)},[r,b,l,x,t,k]),S=Zv({data:[T],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:C},onSelectedChange:A}),N=c&&!p;return I(Bv,{title:"Link Transactions",Footer:I(YF,{validate:()=>{const e=XO(w,t),n=QO(C),r=e||!n;return r||E("The selected total must equal the income amount."),r},error:k,onClick:()=>{e(v.map(e=>e.id),b)}}),padChildren:!1,children:P(vO,{children:[I(XF,{selectedAmount:w,transactionTotal:t,transactionTypeLabel:lC,selectedAmountSignage:"default"}),I(nO,{searchTerm:a,onChange:i,isFetching:N,searchPlaceholder:"Search transactions..."}),S.groups.map(e=>{const t=e.getRows();return I(rS,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return I(YO,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),I(cO,{onIntersect:s,enable:!c&&h})]})})}function eV({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const a=Ic();return I(Pv,{children:a.open&&I($O,{transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r,onSubmit:e})})}function tV({transactionTotal:e,invoices:t,previouslySelected:n,onInvoiceSubmit:r,onPaymentSubmit:a,hasExistingInvoices:i,parentBankAccountId:l,fetchNextPage:s,hasNextPage:c,isFetching:u,isFetchingNextPage:h,searchTerm:p,onSearchChange:g}){const[m,v]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[f,b]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),[y,C]=d(!1),x=o(()=>new Set(n.map(e=>e.id)),[n]),T=o(()=>Rr(p)?[...n,...t.filter(e=>!x.has(e.id))]:t,[p,n,t,x]),w=Zv({data:[T],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:e=>{v(e),b(t=>{const n={...t},r=T.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:m}}),k=Object.entries(m).filter(([,e])=>e).map(([e])=>f[e]),E=k.reduce((e,t)=>e+t.amount,0),A=u&&!h;return I(Bv,{title:"Link Invoice",HeaderRightAction:I(Gk,{shouldUseButtonDiscreteStyles:!0,children:I(Dg,{forceNewCascade:!0,children:P(Sc,{open:y,onOpenChange:C,children:[I(JI,{onClick:async()=>{const e=k.length>0;if(i){if("YES"!==await LO("payment","invoice"))return}else if(e&&"YES"!==await async function(){return RO({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;C(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),I(eV,{transactionTotalDollars:e,parentBankAccountId:l,previouslySelected:[],onSubmit:a})]})})}),Footer:I(YF,{onClick:async()=>{const t=uh(E);if(t>e&&k.length>0){const n=new H(t).sub(e),a=n.toNumber(),o=n.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return pO({title:"Invoice Payment",body:HO(n,e,t)})})({selectedTotal:t,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=o),r(k,t)}).catch(()=>{})}else r(k,0)}}),padChildren:!1,children:P(vO,{children:[I(XF,{selectedAmount:E,transactionTotal:e,transactionTypeLabel:lC}),I(nO,{searchTerm:p,onChange:g,isFetching:A,searchPlaceholder:"Search invoices..."}),I(dO,{listLabel:"Invoices",glSourceList:w,icon:BO,fetchNextPage:s,hasNextPage:c,isFetching:u,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const nV=e=>["invoicing/invoices","infinite",e??{}],rV=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:Ei(r)},o=await La(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})},aV=[];function oV(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return Rr(e)||(t.search=e),t}function iV(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return Vm({queryFn:rV,queryKey:nV(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:oV(t)}});var s;const c=(r?.pages??aV).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return I(tV,{...e,invoices:c,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function lV(e){const t=Ic();return I(Pv,{children:t.open&&I(iV,{...e})})}function sV(e){const t=uh(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const cV=(e,t)=>{const n=e.map(sV);return 0!==t&&n.push(EO(t)),n};function dV(e){const t=uh(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 uV(e){return e.map(dV)}function hV(e){return e.filter(e=>"invoice"===e.lineItemType).map(e=>({id:e.invoice.id,name:e.invoice.name,date:e.invoice.date,amount:hh(e.invoice.amount)}))}const pV="invoice",gV=ub({defaultValues:MF,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType),a=hV(e.state.values.children);return P(Sc,{open:t,onOpenChange:n,children:[I(JI,{onClick:async()=>{const t=IO(pV,e.state.values.children);pV!==t?"YES"===await LO(pV,t)&&n(!0):n(!0)},Icon:BO,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),I(lV,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=cV(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:(t,r)=>{const a=uV(r);e.setFieldValue("children",a),n(!1)},hasExistingInvoices:r,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),mV=gs.filter(e=>"ONE_TIME"!=e.value);function vV({onClick:e}){const t=Ic();return I(Tx,{triggerChildren:I(Ex,{displayLabel:"Make recurring"}),popupChildren:I(xf,{frequencies:mV,onClick:n=>{e(n),t.close()}})})}function fV({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(Kc,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(Ad,{Component:t})})}function bV({activeTab:e,onClick:t,popupTriggerProps:n}){return I(fV,{active:"conversation"===e,onClick:()=>t("conversation"),icon:Id,ariaLabel:"conversation-tab",popupTriggerProps:n})}const yV=or({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function CV({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=Ic(),[a,o]=d(e),{query:{data:i}}=Vl(a),l="CLOSED"===i?.resolutionStatus;return I(Ev,{children:P("div",{className:yV,children:[I(Lv,{children:P(Ov,{children:[I(nh,{Icon:ol,handleClose:()=>r.setOpen(!1)}),I(Ao,{children:"Back"})]})}),I(BL,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const xV={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:lC},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},TV=Object.values(xV);function wV({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=Qe();return a?I(pf,{}):I(tf,{title:P(N,{children:[s&&t&&I(Ao,{children:"Suggested"}),I(Ao,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(JA,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(AV,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I(sf,{handleClick:()=>e(t),selected:n,children:P(XA,{children:[t.iconUrl&&I(Pd,{Component:bm(t.iconUrl,t.name??"")}),I(hc,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const kV="Search expense categories...",EV=[];function AV({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=hT(),s=r??i?.data??EV,c=Ic(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I(Yv,{placeholder:kV,onClick:d,SearchList:lS,DefaultList:wV,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function SV({onClick:e,showSuggestedCategories:t,glAccounts:n,listLabel:r,isFilling:a,glAccount:o,handleConversion:i,parentOnClick:l,selectedIds:s}){const c=Qe();return a?I(pf,{}):P(N,{children:[c&&t&&I(tf,{title:I(Ao,{children:"Suggested"})}),I(tf,{title:I(Ao,{children:r}),children:n?.map(t=>{const n=s.has(t.id);return t.hasChilds?I(JA,{text:t.name,iconUrl:t.iconUrl,title:"All Categories",children:I(PV,{headerLabel:"All Categories",listLabel:t.name,nestedGlAccounts:t.children,handleConversion:i,glAccount:o,parentOnClick:l})},t.id):I(sf,{handleClick:()=>e(t),selected:n,children:I(XA,{children:I(hc,{wrap:"wrap",children:t.name})})},t.id)})})]})}const IV="Search income categories...",NV=[];function PV({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}=ux(),d=r??l??NV,u=gx([...d],px),h=Ic(),p=o?.id?/* @__PURE__ */new Set([o.id]):/* @__PURE__ */new Set,g=e=>{i?i(e):t({type:"REVENUE",value:e}),h.close()};return I(Yv,{placeholder:IV,onClick:g,SearchList:cS,DefaultList:SV,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 RV({list:e,onClick:t,NestedChildList:n}){return I($v,{children:e.groups.map(e=>I(rS,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(JA,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:I(n,{row:e})},e.key);const r=e.getIsSelected();return I(sf,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:P(XA,{children:[e.value.iconUrl&&I(Pd,{Component:bm(e.value.iconUrl,e.value.name)}),I(hc,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const DV="All Tax Categories";function MV({handleConversion:e,region:t}){const n=Ic(),r=Zv({data:[XL],groups:[{label:DV,key:DV}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(RV,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function LV({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=Qe(),d=!l&&i&&0===r.length;return l?I(pf,{}):P($v,{children:[a&&I("div",{children:I(lf,{handleClick:t,children:I(hc,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(Ao,{children:"Suggested"}),!d&&P(N,{children:[I(Ao,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I(sf,{handleClick:()=>e(t),selected:n,children:I(KO,{description:t.description,amount:uh(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const FV={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function OV({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ae(n??[],FV),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?I(pf,{}):0===l.length?I(Xv,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I($v,{children:I("div",{children:l.map(e=>{const n=a?.id===e.id;return I(sf,{handleClick:()=>t(e),selected:n,children:I(KO,{description:e.description,amount:uh(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const VV=[];function UV({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Vt(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:Ut(zt(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Ut(zt(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:g}=Cs(s,{enabled:null!==l}),m=h?.data??VV,{query:{data:v}}=nx({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),f=Ic();return I(Yv,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),f.close()},SearchList:OV,DefaultList:LV,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}}),f.close()},reconciliationMatch:i}})}function BV({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=d(function(e){switch(e){case"EXPENSE":return TV.indexOf(xV.EXPENSE);case"REVENUE":return TV.indexOf(xV.REVENUE);case"TAX_PAYMENT":return TV.indexOf(xV.TAX_EXPENSE);default:return TV.indexOf(xV.TRANSFER)}}(e)),{category:c,glAccount:u,tax:h,date:p,bankAccount:g,reconciliationMatch:m,amount:v}=o,f=h?.paymentInfo?.region,b=g?.id;return P(Hv,{title:t,children:[!i&&I(Af,{options:TV,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(TV[l].value){case"EXPENSE":return I(AV,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(PV,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return I(MV,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:f});case"BANK_TRANSFER":return I(UV,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:v??0,transactionDate:p,reconciliationMatch:m})}},{})]})}const HV=or({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function WV({children:e}){const{startPrefetch:t,cancelPrefetch:n}=vT();return I("button",{className:HV,type:"button",onMouseEnter:t,onMouseLeave:n,children:e})}const _V=or({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function qV({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!hr(o)&&""!==o.id,l=hr(o?.iconUrl)?void 0:bm(o.iconUrl,"Expense Icon");return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(Np,{label:"Category",popupTriggerProps:e,children:P(WV,{children:[i?P("div",{className:_V,children:[l&&I(Pd,{Component:l}),I(hc,{wrap:"wrap",children:o.name})]}):I(hc,{intent:"weak",children:"Select category"}),I(Pd,{Component:il})]})})}),I(BV,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function zV(){const{query:{data:e}}=jS(),{query:{data:t=[]}}=ND(),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 jV=or({display:"flex",gap:"8px",alignItems:"center"});function KV({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!hr(o)&&""!==o.id,l=hr(o?.iconUrl)?void 0:bm(o.iconUrl,"Revenue Icon");return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(Np,{label:"Category",popupTriggerProps:e,children:P(WV,{children:[i?P("div",{className:jV,children:[l&&I(Pd,{Component:l}),I(hc,{children:o.name})]}):I(hc,{intent:"weak",children:"Select category"}),I(Pd,{Component:il})]})})}),I(BV,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function YV(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 ZV=(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=>!hr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},GV={id:"customer",name:"Customer"};function QV(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function XV(e){return YV({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function JV(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 $V=yr(ur["line-item-card"],or({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),eU=or({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),tU=or({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),nU=ub({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}=zV(),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 P("div",{...$V,children:[P("div",{className:eU,children:[I(hc,{children:`Line Item #${t+1}`}),P(Kc,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(hc,{children:"Remove"}),I(Pd,{Component:fN})]})]}),P("div",{className:tU,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(qV,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(KV,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),I(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=>!hr(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:TF(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,GV.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>I(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(wF(t))})},r[0][0].id))}),I(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&I(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),rU=or({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function aU({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=Ic();return I(Bc,{children:P(Dg,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return I(Bg,{onClick:()=>{n(e.id,!r)},children:P("div",{className:rU,children:[I(hc,{children:a(e)}),I(Pd,{Component:r?wi:nf})]})},e.id)}),!hr(r)&&I(Bg,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(hc,{children:"Confirm Selection"})})]})})}const oU=e=>Object.keys(e).filter(t=>e[t]);function iU({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return P(Sc,{placement:"bottom-end",children:[I(Nc,{children:e=>P(Kc,{popupTriggerProps:e,children:[I(hc,{children:"Itemize By"}),I(Pd,{Component:Dp})]})}),I(aU,{items:[...e,GV],selectedIds:oU(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const lU=or({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),sU=or({display:"flex",justifyContent:"space-between",alignItems:"center"}),cU=or.raw({color:"surface.intent.danger.active"}),dU=or({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function uU({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=yF(n),i=CF(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 P("div",{className:lU,children:[P("div",{className:sU,children:[I(hc,{children:`${dC[e]} amount`}),I(hc,{children:uO(t)})]}),P("div",{className:sU,children:[I(hc,{children:"Line items total"}),I(hc,{children:uO(o)})]}),P("div",{className:sU,children:[I(hc,{extraClassNames:l?[cU]:void 0,children:"Difference"}),I(hc,{extraClassNames:l?[cU]:void 0,children:(d=t,u=o,ko(new H(d).minus(u).toNumber(),"default"))})]}),l&&P("div",{className:dU,children:[I(hl,{Component:xi}),I(hc,{extraClassNames:[cU],children:c})]}),s&&P("div",{className:dU,children:[I(hl,{Component:xi}),I(hc,{extraClassNames:[cU],children:"At least 2 line items are required"})]})]});var d,u}function hU({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(up,{onSave:e,children:I(uU,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const pU=or({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function gU(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}=zV(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new H(r).div(2).round(2,H.roundDown),n=new H(r).sub(t);return[YV({amount:t.toNumber(),...structuredClone(c)}),YV({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=Ic(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return hF;case"BANK_TRANSFER":return mF;case"REVENUE":return fF}}(r);return db({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=HF(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=yF(e.children.map(e=>e.amount));return CF(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:ZV(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,YV({...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===GV.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(hr(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=I(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>I(iU,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=I(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>I(hU,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return P(Bv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[I(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>I(nU,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),I(t.Subscribe,{selector:e=>e.values.children,children:e=>I("div",{className:pU,children:e.length<10&&P(Kc,{onClick:r,active:!1,children:[I(hc,{children:"Add Line Item"}),I(hl,{Component:Hs})]})})})]})}function mU(e){const t=Ic();return I(Pv,{children:t.open&&I(gU,{...e})})}function vU({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=Ic();return P(Sc,{children:[I(Nc,{children:e=>I(JI,{Icon:eT,popupTriggerProps:e,children:"Itemize"})}),I(mU,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(QV)),r.close()}})]})}const fU=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?P(Sc,{children:[I(Nc,{children:e=>I(bV,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(CV,{conversationId:r,attachedEntityId:a})]}):I(bV,{onClick:n,activeTab:t}),bU=ub({defaultValues:MF,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=Ge(),s=uw(),c=!hr(n)&&kg(n)&&"EXPENSE"===n.type,{mutateAsync:d}=Zx({mutationFn:qx,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Transactions saved",defaultErrorMessage:"Couldn't save transactions"}}}),h=zF(e),p=u(t=>{JV(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(Lv,{children:P(Ov,{children:[I(nh,{}),I(Ao,{children:t}),i&&I(fU,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(Gk,{shouldUseButtonDiscreteStyles:!0,children:P(Dg,{children:[I(e.Subscribe,{selector:e=>({children:e.values.children,type:e.values.type}),children:({children:t,type:r})=>P(N,{children:[("EXPENSE"===n?.type||"TRANSFER_OUT"===n?.type)&&I(VO,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&I(gV,{form:e}),0===t.length&&I(vU,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:p}),kF(t)&&I(JI,{Icon:eT,onClick:()=>p([t[0]]),children:"Unitemize"})]})}),c&&I(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&I(vV,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===CN.ACTIVE&&I(_F,{onClick:async()=>{hr(n)||await async function(){return ch({title:"Archive transaction",body:"Are you sure you want to archive this transaction?",buttons:[{key:Ku,label:"Cancel"},{key:Yu,label:"Archive",type:sh.DANGER}]}).then(e=>e===Yu)}()&&await h(async()=>{await d(xN([n])),ls()})}}),n?.status===CN.INACTIVE&&I(qF,{onClick:async()=>{hr(n)||await h(async()=>{var e;await d((e=[n],e.map(e=>({id:e.id,status:CN.ACTIVE})))),ls()})}})]})})]})})}});function yU(e){return 0===e.length||kF(e)&&e.every(e=>null===e.customer)}const CU=ub({defaultValues:MF,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=Ge();return P(N,{children:[I(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&&I(e.AppField,{name:"vendor",children:e=>I(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),I(e.Subscribe,{selector:e=>yU(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),I(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)&&I(e.AppField,{name:"frequency",children:e=>I(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"category",children:t=>I(qV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),xU=ub({defaultValues:MF,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return P(N,{children:[I(e.Subscribe,{selector:e=>yU(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"glAccount",children:t=>I(KV,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}});function TU({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===$x(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(Np,{label:a,popupTriggerProps:e,children:P(WV,{children:[r?I(KO,{description:r.description||"",amount:r.amount||0,date:r.date||Lt(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(hc,{intent:"weak",children:"Needs Match"}),I(Pd,{Component:il})]})})}),I(BV,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const wU=ub({defaultValues:MF,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return P(N,{children:[I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"reconciliationMatch",children:()=>I(TU,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function kU({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return P(Sc,{placement:"bottom-start",children:[I(Nc,{children:e=>I(Np,{label:"Category",popupTriggerProps:e,children:P(WV,{children:[I(hc,{children:JL(r?.paymentInfo?.region)??"Select region..."}),I(Pd,{Component:il})]})})}),I(BV,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const EU=ub({defaultValues:MF,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return P(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(kU,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),I(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>I(e.ButtonGroupField,{label:"Quarter",options:ZL})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:Pt({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),AU=ub({defaultValues:MF,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 pr(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:uh(t.value.transfer.amount)}),pr(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 I(N,{children:I(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return I(CU,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return I(xU,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return I(wU,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return I(EU,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),SU=yr(null,or({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function IU({transaction:e,bankAccount:t}){const n=e?e.description:"",r=hr(t)||hr(e)?"":((e,t)=>{const n=gC(t.type),r=$x(t.amount);return`${n?`${r} `:""}${gh(e.name,e.mask)}`})(t,e);return P("div",{...SU,children:[I(Ao,{wrap:"wrap",children:n}),t&&I(Io,{children:r})]})}const NU=or({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),PU=or({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function RU({attachments:e,onRemove:t}){return I("div",{className:NU,children:I("div",{className:PU,children:e.map(e=>I(CL,{attachment:e,onRemove:t},e.localId))})})}const DU=ub({defaultValues:MF,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=Nh({mutationFn:sg,meta:{toastOptions:{responseErrorParser:Rh,defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Ur.invalidateQueries({queryKey:["files/attachments"]}),await Ur.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>P(N,{children:[I(e.AttachmentDropzoneField,{entityId:Is(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(RU,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),MU=or({display:"flex",flexDirection:"column",gap:"8px"});function LU({children:e}){return I("div",{className:MU,children:e})}const FU=cr({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 OU({children:e,surface:t,style:n}){const r=or(FU.raw({surface:t}),n);return I("div",{className:r,children:e})}function VU(){return I(op,{alignment:"horizontal"})}const UU=or({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function BU(e){return I("div",{className:UU,children:e.children})}function HU({property:e}){return"string"==typeof e?I(hc,{children:e}):e}function WU({label:e,value:t}){return P(BU,{children:[I(HU,{property:e}),I(HU,{property:t})]})}function _U(e){return Lt(Vt(e))}function qU({amount:e,date:t,description:n}){return P(OU,{surface:"foreground",children:[I(WU,{label:"Description",value:n}),I(VU,{}),I(WU,{label:"Date",value:_U(t)}),I(VU,{}),I(WU,{label:"Amount",value:uO(e)})]})}const zU=or.raw({padding:12});function jU({amount:e}){return I(OU,{surface:"background",style:zU,children:I(WU,{label:"Fee",value:uO(e)})})}const KU=or({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),YU=or({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function ZU({label:e,warning:t}){return P("div",{className:KU,children:[I(hc,{children:e}),t&&P("div",{className:YU,children:[I(Pd,{Component:xi}),t]})]})}function GU(e){return uO(Math.abs(e))}function QU(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new H(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?`${GU(c)} Overpaid`:"underpaid"===o?function(e){return`${GU(e)} Underpaid`}(c):null}const XU=ub({defaultValues:MF,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=hV(e.state.values.children);return P(LU,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=QU(t,e.amount,e.type);return I(ZU,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?I(qU,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?I(jU,{amount:Math.abs(e.amount)},`fee_${t}`):null),P(Sc,{open:n,onOpenChange:r,children:[I(Nc,{children:e=>P(Kc,{popupTriggerProps:e,children:[I(hc,{children:"Edit Linked Invoices"}),I(hl,{Component:il})]})}),I(lV,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=cV(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:(t,n)=>{const a=uV(n);e.setFieldValue("children",a),r(!1)},hasExistingInvoices:!0,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function JU({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:uO(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 I(OU,{children:l.map((e,t)=>P(f,{children:[t>0&&I(VU,{}),I(WU,{label:e.label,value:e.value.toString()})]},e.label))})}const $U=ub({defaultValues:MF,render:function({form:e}){const{query:{data:t}}=jD(),n=e.state.values.children;if(kF(n))return P(LU,{children:[I(hc,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(JU,{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}`)),P(Sc,{children:[I(Nc,{children:e=>P(Kc,{popupTriggerProps:e,children:[I(hc,{children:"Edit Line Items"}),I(hl,{Component:il})]})}),I(mU,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(XV),onSubmit:t=>{JV(t.map(QV),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),eB=ub({defaultValues:MF,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=FO(e.state.values.children);return P(LU,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=QU(t,e.amount,e.type);return I(ZU,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?I(qU,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?I(jU,{amount:Math.abs(e.amount)},`fee_${t}`):null),P(Sc,{open:n,onOpenChange:r,children:[I(Nc,{children:e=>P(Kc,{popupTriggerProps:e,children:[I(hc,{children:"Edit Linked Bills"}),I(hl,{Component:il})]})}),I(kO,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=SO(t);0!==n&&a.push(EO(n)),e.setFieldValue("children",a),r(!1)},previouslySelected:a})]})]})}});function tB({amount:e,bankAccountName:t,date:n,description:r}){return P(OU,{surface:"foreground",children:[I(WU,{label:"Description",value:r}),I(VU,{}),t&&P(N,{children:[I(WU,{label:"Account",value:t}),I(VU,{})]}),I(WU,{label:"Date",value:_U(n)}),I(VU,{}),I(WU,{label:"Amount",value:uO(e)})]})}const nB=ub({defaultValues:MF,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.filter(e=>"payment"===e.lineItemType).map(e=>({id:e.payment.id,amount:hh(e.payment.amount),date:e.payment.date,description:e.payment.name,bankAccount:{displayName:e.payment.bankAccount.displayName}}));return P(LU,{children:[I(ZU,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?I(tB,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),P(Sc,{open:t,onOpenChange:n,children:[I(Nc,{children:e=>P(Kc,{popupTriggerProps:e,children:[I(hc,{children:"Edit Linked Transactions"}),I(hl,{Component:il})]})}),I(eV,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,previouslySelected:r,onSubmit:(t,r)=>{const a=e.state.values.children.filter(e=>"payment"===e.lineItemType&&t.includes(e.payment.id)),o=uV(r);e.setFieldValue("children",[...a,...o]),n(!1)}})]})]})}}),rB=ub({defaultValues:MF,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?I(XU,{form:e}):t.some(e=>"bill"===e.lineItemType)?I(eB,{form:e}):t.some(e=>"payment"===e.lineItemType)?I(nB,{form:e}):kF(t)?I($U,{form:e}):null}});function aB({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:c}=zV(),u=void 0===i?uC[s]:hC[s],[h,p]=d(l??null),g=I(bU,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),m=I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(up,{disabled:e,isSubmitting:t})});return P(YL,{onSubmit:n.handleSubmit,Header:g,Footer:m,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(IU,{transaction:e,bankAccount:r}),I(n.AppField,{name:"amount",children:e=>I(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),I(n.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),I(AU,{form:n,transaction:e,isManual:a}),I(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=TF(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,c).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>I(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>I(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(wF(e))})},r[0][0].id))}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>it(e)&&I(rB,{form:n})}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(DU,{form:n,transactionId:i})]})}function oB({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}=zV(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=Ts({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:WF(a,r,t),bankAccount:am(a?.bankAccount?.id??""),isManual:hr(a)||kg(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return I(o.Subscribe,{selector:e=>e.values.type,children:n=>I(aB,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function iB({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=Ts({id:e});return s(()=>{!r&&hr(n)&&ls()},[n,r]),hr(n)?null:I(oB,{transactionId:e,initialTab:t})}function lB({transactionId:e,initialTab:t,initialType:n}){return e?I(iB,{transactionId:e,initialTab:t}):!e&&n?I(oB,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function sB({subject:e,children:t}){return P(Lv,{children:[P(Ov,{children:[I(nh,{}),I(Ao,{children:e})]}),I("div",{className:VN({alignItems:"center",gap:15}),children:t})]})}function cB({conversationId:e,defaultValues:t}){const[n,r]=d(e),{query:{data:a}}=Vl(n),o="CLOSED"===a?.resolutionStatus;return I(NM,{children:P(RM,{children:[I(sB,{subject:a?.subject??"Conversation"}),I(BL,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const dB=yi(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 uB({onClick:e,active:t}){return I(tc,{type:"button",onClick:e,active:t,children:I(Pd,{Component:dB})})}const hB=or({display:"flex",flexDirection:"column"});function pB({label:e,data:t,isFilling:n,shimmerWidth:r}){return P("div",{className:hB,children:[I(Io,{children:e}),n?I(ML,{width:r}):I(Ao,{wrap:"wrap",children:t??""})]})}function gB({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=Ts({id:e}),a=am(n?.bankAccount.id??"");if(hr(n))return null;const o=LN({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 P("div",{"data-open":t,className:o,children:[P("div",{className:VN({justifyContent:"space-between"}),children:[I(pB,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(pB,{label:"Amount",data:To(uh(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(pB,{label:"Bank Account",data:gh(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(pB,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function mB({conversationId:e,transactionId:t}){const[n,r]=d(e),[a,o]=d(!0),{query:{data:i}}=Vl(n),l="CLOSED"===i?.resolutionStatus;return I(NM,{children:P(RM,{children:[I(sB,{subject:i?.subject??"Conversation",children:pr(t)&&I(uB,{onClick:()=>o(!a),active:a},"infoButton")}),pr(t)&&I(gB,{transactionId:t,isOpen:a}),I(BL,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function vB(){const e=ss().length>1;return I(NM,{children:P(RM,{background:"foreground",children:[I(Lv,{children:P(Ov,{children:[I(nh,e?{Icon:ol}:{}),I(Ao,{children:"Add New Connection"})]})}),I(PA,{})]})})}function fB(){return I(Lv,{children:P(Ov,{children:[I(nh,{}),I(Ao,{children:"Financial Summary"})]})})}const bB=or({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),yB=Ar.raw({body:"default"}),CB=or({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},yB);function xB({summaryText:e}){return I("div",{className:bB,children:I("div",{className:CB,children:e})})}const TB=or({display:"flex",flexDirection:"column",overflow:"auto"});function wB({summary:e}){return P("div",{className:TB,children:[I(fB,{}),I(xB,{summaryText:e})]})}const kB=or({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function EB({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Wr({queryKey:Fs({id:e}),queryFn:Vs})}({id:e});return I(NM,{children:P("div",{className:kB,children:[I(RM,{children:I(wB,{summary:n?.summary})}),I(op,{}),I(HL,{conversationId:t??null,attachedEntityId:e})]})})}function AB(){return I(NM,{children:I(RM,{children:I(zA,{showCloseButton:!0,inOverlay:!0})})})}const SB=S.object({id:S.string(),name:S.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:S.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:S.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Dr(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),IB={mergeDestination:Am,selectedAccount:null};const NB=or({display:"flex",flexDirection:"column",gap:"20px"}),PB=or({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),RB=or.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),DB=or(RB,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),MB=or(RB,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),LB=or(RB,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),FB=or({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),OB=or({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),VB=or({width:"100%",display:"flex",justifyContent:"flex-start"}),UB=or({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),BB=or({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),HB=e=>{Tp(e),wp(e)};function WB({account:e}){const t=Ic(),n=function(e,t){const{mutateAsync:n}=Vh(),r=DF();return db({defaultValues:IB,onSubmit:async a=>{if(await qh()===Yu&&pr(e)&&pr(a.value.selectedAccount)){const s=(o=e,i=a.value.mergeDestination,l=a.value.selectedAccount,i===Am?{...Wh(l),duplicateBankAccountIds:[Is(o.id)]}:{...Wh(o),duplicateBankAccountIds:[Is(l.id)]});try{await n(s),t.close(),a.value.mergeDestination===Am&&r()}catch{await zh()}}var o,i,l},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=xh();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 P("form",{className:NB,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:HB,children:[I(Ao,{children:"Merge Accounts"}),I("div",{className:PB,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>P(N,{children:[P("div",{className:DB,children:[I("div",{className:VB,children:I(Ao,{children:"Duplicate Account"})}),t===Am?I(Cm,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Im,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Nm(t,e,n.state.value)})})]}),P("div",{className:MB,children:[I("div",{className:UB,children:I(Ao,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:OB,children:I(tc,{onClick:()=>e.handleChange(e.state.value===Am?Em:Am),children:I(Pd,{Component:il})})})})]}),P("div",{className:LB,children:[I("div",{className:BB,children:I(Ao,{children:"Destination Account"})}),t===Am?I(n.AppField,{name:"selectedAccount",children:n=>I(Im,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Nm(t,e,n.state.value)})}):I(Cm,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),P("div",{className:FB,children:[I(gb,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(Xh,{disabled:hr(e),showIcon:!1,textContent:"Merge"})})]})]})}function _B({bankAccount:e}){return I(Dg,{children:P(Sc,{placement:"right-start",children:[I(Nc,{children:e=>P(Bg,{...e,children:[I(Pd,{Component:sE}),I(Ao,{children:"Merge Account"})]})}),I(Ev,{children:I(Iv,{children:I(Jk,{children:I(WB,{account:e})})})})]})})}const qB=or({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"}}}),zB=({tranStartDate:e})=>P(N,{children:[I(Io,{children:"Start Date"}),Mr(e)?I(Ao,{children:`${qt(Vt(e))}`}):I(Ao,{children:"Set Start Date"})]});function jB({bankAccount:e}){return P(Sc,{placement:"right-start",children:[I(Nc,{children:t=>I("button",{className:lr(mr(ur["start-date-form-section"]),qB,dl),...t,type:"button",children:I(zB,{tranStartDate:e.tranStartDate})})}),I(Ev,{children:I(Iv,{children:I(Jk,{width:"sm",children:I(oE,{bankAccounts:[e]})})})})]})}const KB=e=>["accounting/manualJournalEntry",e.id],YB=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 Ni(a)};function ZB({id:e}){return Wr({queryKey:KB({id:String(Is(e))}),queryFn:YB,enabled:pr(e)})}const GB=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:Ha(n)};return await Fa(r)})({data:e,accessToken:t,environment:n});const QB=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Ha(n)};return await Fa(r)},XB=S.object({amount:S.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:S.string("Required")}),JB=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===Is(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},$B=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=ZB({id:t??null}),r=function(){const{query:{data:e}}=rx();return gx(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutateAsync:a}=Nh({mutationFn:QB,meta:{toastOptions:{responseErrorParser:Rh,defaultErrorMessage:"Couldn't save beginning balance"}},onSuccess:async()=>{wa("beginning balance mutation successful, invalidating bank account queries");try{return Ur.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&ka({error:e,severity:"error"})}}});const{mutateAsync:o}=Nh({onSuccess:async()=>{wa("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Ur.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Ur.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&ka({error:e,severity:"error"})}},mutationFn:GB,meta:{toastOptions:{responseErrorParser:Rh,defaultErrorMessage:"Couldn't update journal entry"}}}),i=Ic(),l=((e,t)=>{const n=JB(e,t);return{amount:pr(e.beginningBalanceData.journalEntry?.id)?n:"",date:pr(t?.date)?t.date:""}})(e,n);return db({defaultValues:l,validators:{onBlur:XB},onSubmit:async l=>{if(hr(t)||hr(n))await a({bankAccountId:Is(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(hr(e.id))return null;const o={...e,id:e.id},i=a.map(e=>Is(e.id));let l=0;return o.transactions?.forEach(e=>{r.glAccountId&&e.glAccountId===Is(r.glAccountId)&&(e.drAmount?(l=Number(e.drAmount)-n,e.drAmount=n):e.crAmount&&(l=Number(e.crAmount)-n,e.crAmount=n))}),hr(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=Ut(t)??o.date,o)})(n,Vt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);pr(t)&&await o(t)}return i.close()}})},eH=or({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),tH=or({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function nH({bankAccount:e}){const t=$B(e),n=Ic(),r=()=>{n.close()};return P("form",{className:eH,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(Ao,{children:"Set Beginning Balance"}),I(t.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),I(t.AppField,{name:"amount",children:e=>I(e.EditableAmountField,{label:"Beginning Balance Amount"})}),I(t.Subscribe,{selector:e=>e,children:e=>P("div",{className:tH,children:[I(gb,{showIcon:!1,onClick:r}),I(Xh,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const rH=cr({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"}}}}),aH=or({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function oH({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=yr(ur["beginning-balance-form-section"],rH({layout:a}),dl),i=yr(ur["beginning-balance-form-section"],rH({layout:"right"}),dl),l=r&&qt(r);return P(Sc,{placement:"right-start",children:[I(Nc,{children:e=>P("div",{className:aH,children:[P("button",{...o,...e,type:"button",children:[I(Io,{children:"Beginning Balance"}),I(Ao,{children:pr(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&P("button",{...i,...e,type:"button",children:[I(Io,{children:"Migration Date"}),I(Ao,{children:l})]})]})}),I(Ev,{children:I(Iv,{children:I(Jk,{width:"sm",children:I(nH,{bankAccount:e})})})})]})}const iH=cr({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function lH({bankAccount:e,showStartDate:t}){const{query:{data:n}}=ZB({id:e?.beginningBalanceData.journalEntry?.id??null}),r=JB(e,n),a=pr(n?.date)?Vt(n?.date):null,o=pr(e.tranStartDate)?Vt(e.tranStartDate):null,i=pr(a)&&pr(o)&&!Rt(a,o),l=i?"left":t?"right":"left";return P("div",{className:iH({layout:i?"stacked":"inline"}),children:[t&&I(jB,{bankAccount:e}),I(oH,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const sH=or({marginTop:"15px",marginBottom:"15px"}),cH={id:"",name:"",mask:"",type:void 0};const dH=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],uH=e=>{Tp(e),wp(e)};function hH({bankAccountId:e}){const t=am(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:cH,[r,a]=d(n),o=function(e,t){const{mutateAsync:n}=Vh(),{mutateAsync:r}=Oh({mutationFn:Mh,meta:{toastOptions:{responseErrorParser:Rh,defaultSuccessMessage:"Account created",defaultErrorMessage:"Couldn't create account"}}}),a=Mr(String(e.id)),o=DF();return db({defaultValues:e,validators:{onBlur:SB},onSubmit:async e=>{if(a)await n(Wh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((i=e.value,{apiAccountName:i.name,apiAccountNo:i.mask??void 0,apiAccountType:i.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 i;return o()},onSubmitInvalid:()=>{}})}(r,a),i=!t||Bh(t.apiName),l=!!t&&Hh(t.apiName),s=gh(r?.name??"",r?.mask??""),c=Mr(s)?s:"New Bank Account",u=l&&pr(t?.tranStartDate);return I(NM,{children:I(RM,{children:P("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:uH,children:[P(Lv,{children:[P(Ov,{children:[I(nh,{Icon:ol}),I(Ao,{children:c}),pr(t)&&I(Gk,{shouldUseButtonDiscreteStyles:!0,children:I(_B,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),P(_L,{children:[I(o.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),I(o.AppField,{name:"mask",children:e=>I(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),I(o.AppField,{name:"type",children:e=>I(e.GenericSelectorField,{label:"Account Type",options:dH,disabled:!i})}),pr(t)&&P(N,{children:[I("div",{className:sH,children:I(op,{alignment:"horizontal"})}),I(lH,{bankAccount:t,showStartDate:u})]})]})]})})})}function pH({filters:e,filterModels:t,setFilters:n}){const r=ss().length>1,[a,o]=d(()=>Vw(e,t));return I(NM,{children:P(RM,{children:[I(Lv,{children:P(Ov,{children:[I(nh,r?{Icon:ol}:{}),I(hc,{children:"Back"})]})}),I(_D,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),I(fS,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=Hw(a);n(e),ls()}})]})})}function gH({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=vI(e);return I(pH,{filters:n,filterModels:t,setFilters:r})}function mH(){const e=aR();return I(gH,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function vH(){const e=TR();return I(gH,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function fH(){const e=SI();return I(gH,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function bH({Icon:e,label:t,popupTriggerChildrenProps:n}){return P(lf,{popupTriggerChildrenProps:n,children:[P(XA,{children:[I(Pd,{Component:e}),I(hc,{children:t})]}),I(Pd,{Component:il})]})}const yH=yi(jF,"Expenses");function CH(){return I(bH,{Icon:yH,label:"Categories"})}const xH=yi(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"),TH=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function wH(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 kH(e,t){return{search:Mr(e)?e:void 0,status:{in:t}}}function EH(e){return e.pages.flatMap(e=>(e.data??[]).map(wH))}const AH=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function SH(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function IH(e,t){const n=(e,n)=>AF(e=>!t(e),e,n);return{state:n("state",Dr(e.state)?void 0:e.state),city:n("city",Dr(e.city)?void 0:e.city),zip:n("zip",Dr(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Dr(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Dr(e.address1)?void 0:e.address1),address2:n("address2",Dr(e.address2)?void 0:e.address2)}}const NH=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:AH});function PH(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:SH(e.address)}}const RH=S.object({state:S.string(),city:S.string(),zip:S.string(),phoneWork:S.string(),address1:S.string(),address2:S.string()}),DH=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:S.string().optional(),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),email:S.email().or(S.literal("")),ccEmails:S.array(S.email()),bccEmails:S.array(S.email()),invoicePrefix:S.string().optional(),address:RH.optional()});function MH({customer:e}){const{mutateAsync:t}=yv(),n=Ic();return db({defaultValues:e??NH,validators:{onSubmit:DH},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>AF(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(AH).filter(e=>e in AH).some(e=>!n(e))?IH(e.address??AH,n):void 0,i=a("invoicePrefix",Mr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Mr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Mr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:hr(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 LH=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})),FH=or({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),OH=or({width:"100%"}),VH=hb({defaultValues:AH,props:{disabled:!1},render:function({group:e,disabled:t}){return P(N,{children:[I(e.AppField,{name:"address1",children:e=>I(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),I(e.AppField,{name:"address2",children:e=>I(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),I(e.AppField,{name:"city",children:e=>I(e.TextField,{label:"City",placeholder:"City",disabled:t})}),P("div",{className:FH,children:[I("div",{className:OH,children:I(e.AppField,{name:"state",children:()=>I(cm,{label:"State",options:[{label:"Select State",value:""},...LH],isEmpty:Dr,disabled:t})})}),I("div",{className:OH,children:I(e.AppField,{name:"zip",children:e=>I(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),I(e.AppField,{name:"phoneWork",children:e=>I(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),UH=or.raw({width:"100%"});function BH({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o,isSubmitting:i}){const l=uw();return P(N,{children:[I(op,{alignment:"horizontal",color:"normal"}),P("div",{className:ip,children:[!o&&I(rp,{disabled:a,onClick:t,isSubmitting:i}),o&&l&&I(tc,{onClick:n,styles:UH,children:I(hc,{children:r})}),e]})]})}const HH=or({display:"flex",gap:"8px"});function WH({title:e,customer:t}){const n=MH({customer:t}),[r,a]=d(n.state.values.ccEmails.length>0),[o,i]=d(n.state.values.bccEmails.length>0),l=Ic(),s=uw(),c="ACTIVE"===t?.status,u="INACTIVE"===t?.status,h=u&&!s,{mutateAsync:p}=Nh({mutationFn:fv,onSuccess:bv,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Customer deleted",defaultErrorMessage:"Couldn't delete customer"}}}),{mutateAsync:g}=yv(),m=zF(n),v=async()=>{if(hr(t))return;"RESTORE"===await async function(e){return ch({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)&&await m(async()=>{await g({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),l.close()})},f=c||h?I(Gk,{shouldUseButtonDiscreteStyles:!0,children:P(Dg,{children:[c&&I(_F,{onClick:async()=>{if(hr(t))return;const{id:e}=t;if(hr(e))return;"ARCHIVE"===await async function(e){return ch({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)&&await m(async()=>{await p({id:e}),l.close()})}}),u&&I(qF,{onClick:v})]})}):null,b=h?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(BH,{onSave:n.handleSubmit,disabled:e,restoreLabel:"Restore Customer",onRestore:v,isArchived:u,isSubmitting:t})});return I(Bv,{title:e,HeaderRightAction:f,Footer:b,padChildren:!1,children:P(_L,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:u})}),I(n.AppField,{name:"billingContactName",children:e=>I(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:u})}),I(n.AppField,{name:"email",children:e=>I(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:u})}),I(n.AppField,{name:"ccEmails",children:e=>r&&I(e.MultiEmailField,{label:"CC Billing Emails",disabled:u})}),I(n.AppField,{name:"bccEmails",children:e=>o&&I(e.MultiEmailField,{label:"BCC Billing Emails",disabled:u})}),(!r||!o)&&P("div",{className:HH,children:[!r&&I(Kc,{onClick:()=>a(!0),children:"CC"}),!o&&I(Kc,{onClick:()=>i(!0),children:"BCC"})]}),I(n.AppField,{name:"invoicePrefix",children:e=>I(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:u})}),I(VH,{form:n,fields:"address",disabled:u})]})})}function _H({title:e,customer:t}){const n=Ic();return I(Pv,{children:n.open&&I(WH,{title:e,customer:t})})}const qH=or({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function zH({customer:e}){const t=bf(),[n,r]=d(!1),a=P(N,{children:[P(XA,{children:[I(Ad,{Component:xH}),P("div",{className:qH,children:[I(hc,{children:e.name}),e.email&&I(Io,{children:e.email})]})]}),I(Pd,{Component:il})]});if(t?.preventDefault)return I(lf,{handleClick:()=>{t.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null})},children:a});const o=()=>{t?.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null}),r(!0)};return P(Sc,t?{enableClickMiddleware:!1,open:n,onOpenChange:r,children:[I(Nc,{children:e=>I(lf,{handleClick:o,popupTriggerChildrenProps:e,children:a})}),I(_H,{title:"Edit Customer",customer:PH(e)})]}:{children:[I(Nc,{children:e=>I(lf,{popupTriggerChildrenProps:e,children:a})}),I(_H,{title:"Edit Customer",customer:PH(e)})]})}const jH=or.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function KH({selectedValue:e,Icon:t=Dp,options:n,onClick:r,additionalStyles:a=[]}){return P(Sc,{children:[I(Nc,{children:n=>P(tc,{popupTriggerProps:n,styles:[jH,...a],children:[I(hc,{children:e.label}),I(Pd,{Component:t})]})}),I(om,{options:n,onClick:r})]})}const YH=or({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),ZH=or({display:"flex",gap:"8px"}),GH=or.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function QH({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return P("div",{className:YH,children:[I(hc,{intent:"weak",children:"Search"}),P("div",{className:ZH,children:[I(eO,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),I(KH,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[GH]})]})]})}const XH=P(N,{children:[I(Pd,{Component:Hs}),I(hc,{children:"Add Customer"})]});function JH(){const e=bf(),[t,n]=d(!1);if(e?.preventDefault)return I(tc,{onClick:()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null})},children:XH});if(pr(e)){const r=()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}),n(!0)};return P(Sc,{enableClickMiddleware:!1,open:t,onOpenChange:n,children:[I(Nc,{children:e=>I(tc,{onClick:r,popupTriggerProps:e,children:XH})}),I(_H,{title:"Add Customer",customer:void 0})]})}return P(Sc,{children:[I(Nc,{children:e=>I(tc,{popupTriggerProps:e,children:XH})}),I(_H,{title:"Add Customer",customer:void 0})]})}function $H(){const[e,t]=d(""),[n,r]=d(TH[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 Vm({queryFn:mv,queryKey:uv(e),...t})}({filter:kH(e,t)},{select:EH});return{list:Zv({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 P(Bv,{title:"Back",HeaderRightAction:I(JH,{}),padChildren:!0,children:[I(QH,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:TH,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>I(rS,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>I(zH,{customer:e.value},e.value.id))},e.key)),I(cO,{onIntersect:o,enable:i})]})}function eW(){const e=Ic();return I(Pv,{children:e.open&&I($H,{})})}function tW(){return P(Sc,{children:[I(Nc,{children:e=>I(bH,{Icon:xH,label:"Customers",popupTriggerChildrenProps:e})}),I(eW,{})]})}const nW=yi(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"),rW=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:AH,transactionCount:0,iconUrl:void 0});function aW(e){return{id:e.id,name:e.name,status:e.status,address:SH(e.address),transactionCount:e.transactionCount,iconUrl:e.iconUrl||void 0}}const oW=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),address:RH.optional(),transactionCount:S.number(),iconUrl:S.string().optional()});const iW=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function lW(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address,transactionCount:e.transactionCount}}function sW(e,t,n){return{search:Mr(e)?e:void 0,name:hr(n)?void 0:{notEqual:n},status:{in:t}}}function cW(e){return e.pages.flatMap(e=>(e.data??[]).map(lW))}function dW({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:sW(e,t,n)},u={select:cW},Vm({queryFn:qm,queryKey:Bm(d),...u}));var d,u;return{list:Zv({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 uW=yi(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"),hW=or({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),pW=or({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),gW=cr({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"}}}}),mW=or({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),vW=or({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function fW({targetVendor:e,duplicateVendor:t}){return P("div",{className:hW,children:[I(hc,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),P("div",{className:pW,children:[P("div",{className:gW({archivedVendor:!0}),children:[I(Pd,{imageUrl:t.iconUrl,Component:nW}),I(hc,{intent:"weak",children:t.name})]}),P("div",{className:mW,children:[I(Pd,{Component:uW,stylists:[yr(null,vW)]}),I(Io,{intent:"weak",children:"Merging Into"})]}),P("div",{className:gW({archivedVendor:!1}),children:[I(Pd,{imageUrl:e.iconUrl,Component:nW}),I(hc,{children:e.name})]})]}),I(hc,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function bW({vendor:e,onClose:t}){const{mutate:n}=Nh({mutationFn:Jm,onSuccess:$m}),[r,a]=d({}),[o,i]=d(""),{list:l,data:s,fetchNextPage:c,isFetching:u,hasNextPage:h,isLoading:p}=dW({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),g=Ic(),m=I(up,{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 ch({title:"Confirm Merge",body:I(fW,{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 P(Bv,{title:"Back",Footer:m,padChildren:!0,children:[I(eO,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>I(rS,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>I(sf,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:P(XA,{children:[I(Ad,{imageUrl:e.value.iconUrl??void 0,Component:nW}),I(hc,{children:e.value.name})]})},e.value.id))},e.key)),I(cO,{onIntersect:c,enable:!u&&h})]})}function yW({vendor:e,onClose:t}){const n=Ic();return I(Pv,{children:n.open&&I(bW,{vendor:e,onClose:()=>{t(),n.close()}})})}function CW({vendor:e,onClose:t}){return P(Sc,{children:[I(Nc,{children:e=>I(JI,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),I(yW,{vendor:e,onClose:t})]})}const xW=or.raw({width:"100%"});function TW({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o,isSubmitting:i}){const l=uw();return I(BH,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,isSubmitting:i,children:l&&!hr(e)&&P(Sc,{children:[I(Nc,{children:e=>I(tc,{popupTriggerProps:e,styles:xW,children:I(hc,{children:"Merge"})})}),I(yW,{vendor:e,onClose:r})]})})}function wW({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=ev(),n=Ic();return db({defaultValues:e??rW,validators:{onSubmit:oW},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(AH).filter(e=>e in AH).some(e=>!t(e))?IH(e.address??AH,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}),r=Ic(),a=uw(),o="ACTIVE"===t?.status,i="INACTIVE"===t?.status,l=!hr(t?.transactionCount)&&t.transactionCount>0,{mutateAsync:s}=Nh({mutationFn:Xm,onSuccess:$m,meta:{toastOptions:{responseErrorParser:Gm,defaultSuccessMessage:"Vendor deleted",defaultErrorMessage:"Couldn't delete vendor"}}}),{mutateAsync:c}=ev(),d=zF(n),u=async()=>{if(hr(t))return;"RESTORE"===await async function(e){return ch({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)&&await d(async()=>{await c({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),r.close()})},h=o&&(!a||o&&!l),p=i&&!a,g=hr(t)||!h&&!p?null:I(Gk,{shouldUseButtonDiscreteStyles:!0,children:P(Dg,{children:[i&&I(qF,{onClick:u}),!a&&I(CW,{vendor:t,onClose:()=>r.close()}),o&&!l&&I(_F,{onClick:async()=>{if(hr(t)||hr(t.id))return;const{id:e}=t;if(hr(e))return;"ARCHIVE"===await async function(e){return ch({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)&&await d(async()=>{await s({id:e}),r.close()})}})]})}),m=i&&!a?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:a})=>I(TW,{vendor:t,onSave:n.handleSubmit,onRestore:u,onClose:()=>r.close(),disabled:e,isSubmitting:a,isArchived:i})});return I(Bv,{title:e,HeaderRightAction:g,Footer:m,padChildren:!1,children:P(_L,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:i,maxLength:255})}),I(VH,{form:n,fields:"address",disabled:i})]})})}function kW({title:e,vendor:t}){const n=Ic();return I(Pv,{children:n.open&&I(wW,{title:e,vendor:t})})}const EW=or({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function AW({vendor:e}){return P(Sc,{children:[I(Nc,{children:t=>P(lf,{popupTriggerChildrenProps:t,children:[P(XA,{children:[I(Ad,{imageUrl:e.iconUrl??void 0,Component:nW}),I("div",{className:EW,children:I(hc,{children:e.name})})]}),I(Pd,{Component:il})]})}),I(kW,{title:"Edit Vendor",vendor:aW(e)})]})}function SW(){const[e,t]=d(""),[n,r]=d(iW[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=dW({searchTerm:e,statuses:n.value}),c=uw();return P(Bv,{title:"Back",HeaderRightAction:P(Sc,{children:[I(Nc,{children:e=>P(tc,{popupTriggerProps:e,children:[I(Pd,{Component:Hs}),!c&&I(hc,{children:"Add Vendor"})]})}),I(kW,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[I(QH,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:iW,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>I(rS,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>I(AW,{vendor:e.value},e.value.id))},e.key)),I(cO,{onIntersect:o,enable:!i&&l})]})}function IW(){const e=Ic();return I(Pv,{children:e.open&&I(SW,{})})}function NW(){return P(Sc,{children:[I(Nc,{children:e=>I(bH,{Icon:nW,label:"Vendors",popupTriggerChildrenProps:e})}),I(IW,{})]})}const PW=or({padding:"16px"});function RW(){const e=gn(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return I(NM,{children:P(RM,{children:[I(Lv,{children:P(Ov,{children:[I(nh,{Icon:ol}),I(Ao,{children:"Back"})]})}),I("div",{className:PW,children:P(rS,{label:"Transaction Settings",children:[e&&I(CH,{}),I(NW,{}),I(tW,{})]})})]})})}const DW=cr({base:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"8px",cursor:"pointer",padding:"12px 16px",minHeight:"42px",width:"100%",borderRadius:"zero",borderWidth:"md",borderStyle:"solid",borderColor:"transparent",borderLeftWidth:"xl",color:"typography.intent.secondary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",borderColor:"border.intent.action.hover"}},"&:focus-visible":{outlineWidth:"xl",outlineStyle:"solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.foreground",borderLeftColor:"border.intent.action.active"},false:{backgroundColor:"surface.background",borderLeftColor:"transparent"}}}});function MW({children:e,handleClick:t,selected:n=!1}){return I("button",{...yr(ur["selector-row"],DW({selected:n}),sl),"aria-current":n,onClick:t,type:"button",children:e})}const LW=or({display:"flex",alignItems:"center",gap:"8px",flex:"1 0 0"});function FW({children:e}){return I("div",{className:LW,children:e})}const OW={FinancialOverview:"/",TransactionsDashboard:"/transactions",BanksAndIntegrations:"/banks",ExpenseDashboard:"/expense",IncomeDashboard:"/income",ReportDashboard:"/reports",Invoices_NOT_IMPL:"/invoices",TimeAndTasks_NOT_IMPL:"/time-and-tasks",Mileage_NOT_IMPL:"/mileage",Payroll_NOT_IMPL:"/payroll",ChartOfAccounts_NOT_IMPL:"/chart-of-accounts",GeneralLedger:"/general-ledger",Journal_NOT_IMPL:"/journal",Taxes_NOT_IMPL:"/taxes"};function VW(e,t){return OW[e.page]===t}const UW=or({display:"flex",flexDirection:"column",gap:"8px"}),BW=or({marginTop:"8px",marginBottom:"16px"});function HW({section:e,index:t,onClick:n}){const r=function(){const{isApp:e,navigate:t,location:n}=i(Ld);if(e)return{navigate:t,location:n}}();if(hr(r))return null;const{navigate:a,location:o}=r;return P("div",{className:UW,children:[t>0&&I("div",{className:BW,children:I(op,{alignment:"horizontal"})}),void 0!==e.label&&I(Io,{intent:"weak",children:e.label}),e.items.map(e=>I(MW,{selected:VW(e,o.pathname),handleClick:()=>{a&&(n?.(),a({page:e.page}))},children:P(FW,{children:[I(Pd,{Component:e.Icon}),I(hc,{children:e.label})]})},e.label))]})}const WW=l(null),_W=l(void 0),qW=or({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"flex-start",alignItems:"center",width:"fit-content",color:"typography.intent.secondary",fontWeight:"label.strong"}),zW=or({height:"32px",width:"auto",maxWidth:"100%",objectFit:"contain",objectPosition:"left"}),jW=or({flex:1,overflowY:"auto",display:"flex",flexDirection:"column",padding:"16px",height:"100%"}),KW=or({paddingTop:"16px",paddingBottom:"16px"});function YW({onClick:e}){const t=i(WW),n=i(_W);if(hr(t))return null;const{sections:r}=t;return P("div",{className:jW,children:[void 0!==n&&P(N,{children:[I("div",{className:qW,children:I("img",{src:n.partnerLogoUrl,alt:n.partnerName,className:zW})}),I("div",{className:KW,children:I(MW,{handleClick:n.onRtlExit,children:P(FW,{children:[I(Pd,{Component:ol}),I(hc,{children:"Exit Bookkeeping"})]})})})]}),r.map((t,n)=>I(HW,{section:t,index:n,onClick:e},t.label??n))]})}function ZW(){return I(NM,{side:"left",mobileCoverage:"partial",children:I(YW,{onClick:()=>ls()})})}function GW(){return P(kM,{children:[I(AM,{name:"BankTransactionForm",Component:lB}),I(AM,{name:"Conversation",Component:cB}),I(AM,{name:"MobileConversation",Component:mB}),I(AM,{name:"FinancialSummary",Component:EB}),I(AM,{name:"BanksAndIntegrations",Component:AB}),I(AM,{name:"BankAccountForm",Component:hH}),I(AM,{name:"NewConnection",Component:vB}),I(AM,{name:"TransactionsFilterList",Component:fH}),I(AM,{name:"ExpensesFilterList",Component:mH}),I(AM,{name:"RevenueFilterList",Component:vH}),I(AM,{name:"TransactionSettingsDrawer",Component:RW}),I(AM,{name:"NavMenu",Component:ZW})]})}const QW=({environment:e,children:t})=>I(Br.Provider,{value:e,children:t});function XW({children:e}){const{query:{data:t}}=Li(),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 I($c.Provider,{value:n,children:e})}const JW=e=>["whiteLabels",e??{}],$W=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:Ei(t[3].environment)},r=await La(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function e_({children:e}){const t=Ri(),{query:{data:n}}=Sl({queryKey:JW({filter:{name:{equal:t}}}),queryFn:$W}),r={icons:n?.data?.[0]?.icons};return I(fi.Provider,{value:r,children:e})}const t_=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const n_="SSE connection failed with status";function r_({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Hr();s(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Ba[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 _e(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${n_} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case t_.CONNECTED:return void wa("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case t_.ERROR:throw ka({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case t_.CACHE_BUST:return wa("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(()=>{Ur.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>ka({error:e,severity:"error"}))},500*Math.random()),wa(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void ka({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 ka({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(n_))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>ka({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const a_=[t_.CACHE_BUST];function o_({children:e}){const{companyId:t,customerPartnerId:n}=i($c);return r_({companyId:t,customerPartnerId:n,sseTypes:a_}),e}const i_=l({dimensions:{width:null,height:null}}),l_="undefined"!=typeof window?g:s,s_="undefined"==typeof window;const c_=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;s_&&(t=!1);const[n,r]=d(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=Tw(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);l_(()=>{o.current=t},[t]),s(()=>{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),l_(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I(i_.Provider,{value:r,children:e})},d_=({children:e})=>{const{dimensions:t}=i(i_),n=pr(t.width)&&t.width<parseInt(Do("sizes.breakpoint-xl"));return I(dw.Provider,{value:n,children:e})},u_=yi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",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",fill:"none",stroke:"inherit",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",fill:"none",stroke:"inherit",strokeMiterlimit:10})),"ToastError"),h_=yi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",strokeMiterlimit:10,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"}),r.createElement("path",{stroke:"inherit",fill:"none",d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"ToastSuccess"),p_=yr(ur.toast,or({boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",width:{base:"92%",xl:"328px"},paddingInline:"16px",paddingBlock:"12px",borderRadius:"sm",backgroundColor:"surface.intent.notification",color:"typography.intent.notification",boxShadow:"box-shadow",willChange:"translate, opacity",transitionProperty:"opacity, translate",transitionDuration:"toast.enter",transitionTimingFunction:"toast.enter","&[data-state='closed']":{transitionDuration:"toast.exit",transitionTimingFunction:"toast.exit"}})),g_={translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)"},m_=or({flex:"1 0 0",minWidth:0}),v_=or.raw({lineClamp:2}),f_=yr(ur["toast-dismiss"],or({display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",cursor:"pointer",padding:0,color:"typography.intent.notification",flexShrink:0,borderRadius:"sm",outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}})),b_=cr({base:{},variants:{type:{error:{fill:"typography.intent.notification",stroke:"surface.intent.notification"},success:{fill:"typography.intent.notification",stroke:"surface.intent.notification"}}}});function y_({title:e,type:t}){const n=yr(null,b_({type:t}));return P(qe.Root,{...p_,style:g_,children:[I(Pd,{Component:"success"===t?h_:u_,stylists:[n]}),I(qe.Title,{className:m_,children:"string"==typeof e?I(hc,{intent:"notification",wrap:"wrap",extraClassNames:[v_],children:e}):e}),I(qe.CloseTrigger,{...f_,children:I(hl,{Component:Pc})})]})}const C_=ze({placement:"bottom",offsets:{top:"0px",right:"0px",bottom:"60px",left:"0px"},gap:8,removeDelay:250,duration:3e3,max:24,pauseOnPageIdle:!0,overlap:!1}),x_={success:3e3,error:6e3};function T_(e,t,n){const r=n?.dedupeKey??`${e}:${t}`,a=Date.now();return function(e,t){const n=w_.get(e);return void 0!==n&&t-n<2e3}(r,a)?null:(function(e,t){for(const[n,r]of w_)t-r>=2e3&&w_.delete(n);w_.set(e,t)}(r,a),function(){const e=C_.getVisibleToasts();!function(e){for(const t of k_)e.has(t)||k_.delete(t)}(new Set(e.map(e=>e.id)));const t=e.filter(e=>void 0!==e.id&&!k_.has(e.id));if(t.length<3)return;const n=[...t].reverse().find(e=>"error"!==e.type)??t[t.length-1];void 0!==n?.id&&(k_.add(n.id),C_.update(n.id,{removeDelay:0}),C_.dismiss(n.id))}(),C_.create({type:e,title:t,duration:n?.duration??x_[e]}))}const w_=/* @__PURE__ */new Map,k_=/* @__PURE__ */new Set;function E_({children:e}){const t=o(()=>({createToast:T_,dismiss:C_.dismiss}),[]);return P(Ih.Provider,{value:t,children:[e,I(Ke,{children:I(je,{toaster:C_,children:e=>{return I(y_,{title:e.title,type:(t=e.type,"success"===t?"success":"error")},e.id);var t}})})]})}function A_({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return s(()=>{var e,r;e=n,r=t,ba.setProperties(xa),Ca=r,ya=e},[n,t]),I(QW,{environment:t,children:I(bM,{children:I(Lr.Provider,{value:r,children:I(XW,{children:I(e_,{children:I(o_,{children:I(c_,{children:I(d_,{children:P(E_,{children:[I(Ce.ConfirmationRoot,{}),e,I(GW,{})]})})})})})})})})})}function S_({children:e,initialNav:t}){const n=Re(),r=Oe(),i=a(void 0),l=u(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),c=u(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),d=u(e=>{const t=OW[e.page];t!==r.pathname&&(gn.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&is(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);s(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&is(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:d,registerAnchor:c,location:r,initialPageProps:t.pageProps}),[d,c,r,t.pageProps]);return I(Ld.Provider,{value:p,children:e})}const I_=e=>r.createElement("svg",{width:90,height:24,viewBox:"0 0 90 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M15.6182 11.5362V8.24941C15.6182 3.87291 12.0796 0.325012 7.71366 0.325012H1.375V12.1459H15.0099C15.1782 12.1459 15.3141 12.2822 15.3141 12.4508V15.7376C15.3141 20.1141 18.8534 23.662 23.2194 23.662H29.558V11.8411H15.9231C15.7549 11.8411 15.619 11.7049 15.619 11.5362H15.6182Z",fill:"white"}),r.createElement("path",{d:"M52.4967 23.6612V20.9282H59.1775C60.8137 20.9282 61.7406 20.1628 61.7406 18.3313V16.336C60.7045 17.5392 59.1225 18.2218 57.3504 18.2218C53.3969 18.2218 50.5337 15.2147 50.5337 11.3336C50.5337 7.45246 53.6153 4.4729 57.3779 4.4729C59.15 4.4729 60.7595 5.12881 61.7956 6.41387V4.74613H64.6863V18.1951C64.6863 21.9943 62.2865 23.662 59.0958 23.662H52.4967V23.6612ZM61.6589 11.3336C61.6589 8.98237 59.941 7.26112 57.5954 7.26112C55.2499 7.26112 53.5595 8.98318 53.5595 11.3336C53.5595 13.684 55.2499 15.4069 57.5954 15.4069C59.941 15.4069 61.6589 13.6848 61.6589 11.3336Z",fill:"white"}),r.createElement("path",{d:"M43.3378 18.3037C40.2563 18.3037 38.7842 16.9643 38.7842 14.1485V7.53353H36.5479V4.74531H38.1024C38.5116 4.74531 38.7842 4.47209 38.7842 3.97995V1.35632H41.8108V4.74612H45.41V7.53434H41.8108V13.8486C41.8108 14.9147 42.3292 15.4612 43.5562 15.4612H45.4108V18.3045H43.3386L43.3378 18.3037Z",fill:"white"}),r.createElement("path",{d:"M66.536 18.3037V0.325012H69.5633V6.11224C70.4086 5.07365 71.7172 4.47207 73.3809 4.47207C76.7351 4.47207 79.1073 6.85004 79.1073 10.595V18.3037H76.0799V10.8682C76.0799 8.65399 74.8805 7.34217 72.9167 7.34217C70.9529 7.34217 69.5625 8.70912 69.5625 10.8682V18.3037H66.5352H66.536Z",fill:"white"}),r.createElement("path",{d:"M86.0307 18.3037C82.9491 18.3037 81.4771 16.9643 81.4771 14.1485V7.53353H79.2407V4.74531H80.7953C81.2045 4.74531 81.4771 4.47209 81.4771 3.97995V1.35632H84.5037V4.74612H88.1029V7.53434H84.5037V13.8486C84.5037 14.9147 85.0221 15.4612 86.2491 15.4612H88.1037V18.3045H86.0315L86.0307 18.3037Z",fill:"white"}),r.createElement("path",{d:"M49.3991 4.74609H46.3726V18.3045H49.3991V4.74609Z",fill:"white"}),r.createElement("path",{d:"M48.1859 0.325012H46.3726V3.22998H49.3991V1.54116C49.3991 0.869845 48.8564 0.325012 48.1859 0.325012Z",fill:"white"})),N_=or({display:"flex",flexDirection:"column",gap:"24px",alignItems:"center",paddingTop:"15%",width:"100%",height:"100vh"}),P_=or({display:"flex",flexDirection:"column",gap:"24px",alignItems:"flex-start"}),R_=or({display:"flex",flexDirection:"column",gap:"24px",width:{xl:"368px",sm:"316px",base:"auto"},minHeight:{md:"110px",base:"140px"},padding:"36px 24px",alignItems:"flex-start",borderRadius:"4px",backgroundLinear:"to-t",gradientFrom:"#009C75",gradientTo:"#2AD17B",gradientFromPosition:"23.41%",gradientToPosition:"106.24%"}),D_=or({display:"flex",flexDirection:"column",gap:"12px"}),M_=or({fontFamily:"Duplet Semibold, sans-serif",fontWeight:"md",fontSize:"md",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),L_=or({fontFamily:"Duplet Regular, sans-serif",fontWeight:"sm",fontSize:"md",lineHeight:"template",letterSpacing:"0.84px",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),F_=or({display:"inline"});function O_(){const e=Pk();return I("div",{className:N_,children:P("div",{className:P_,children:[e&&I(Ak,{}),P("div",{className:R_,children:[I(I_,{width:89,height:24,overflow:"visible"}),P("div",{className:D_,children:[P("span",{className:F_,children:[I("span",{className:M_,children:"This component is currently only available in the "}),I("a",{className:M_,href:"https://docs.tight.com/v5.0/embeddable-ui/white-labeled-experience/how-to-embed",target:"_blank",rel:"noreferrer",children:"v5 Javascript SDK"})]}),P("span",{className:F_,children:[I("span",{className:L_,children:"It will be available in "}),I("a",{className:L_,href:"https://docs.tight.com/embeddable-ui/tight-embeddable-ui",target:"_blank",rel:"noreferrer",children:"v6 React Components"}),I("span",{className:L_,children:" soon"})]})]})]})]})})}function V_({selectedAccountId:e}){const{query:{data:t}}=nx(),n=t?.find(t=>t.id===e);return I(hc,{children:n?.name??"Select an account"})}const U_=LN({gap:"16px",alignItems:"flex-start",width:"100%"});function B_(){const[e]=d(void 0);return P("div",{className:U_,children:[I(Ir,{children:"General Ledger"}),I(V_,{selectedAccountId:e})]})}const H_={FinancialOverview:{path:OW.FinancialOverview,element:I(Bk,{})},FinancialOverviewDashboard:{path:OW.FinancialOverview,element:I(Bk,{})},TransactionsDashboard:{path:OW.TransactionsDashboard,element:I(tR,{})},BanksAndIntegrations:{path:OW.BanksAndIntegrations,element:I(YA,{})},ExpenseDashboard:{path:OW.ExpenseDashboard,element:I(yR,{})},IncomeDashboard:{path:OW.IncomeDashboard,element:I(ER,{})},Invoices_NOT_IMPL:{path:OW.Invoices_NOT_IMPL,element:I(O_,{})},TimeAndTasks_NOT_IMPL:{path:OW.TimeAndTasks_NOT_IMPL,element:I(O_,{})},Mileage_NOT_IMPL:{path:OW.Mileage_NOT_IMPL,element:I(O_,{})},Payroll_NOT_IMPL:{path:OW.Payroll_NOT_IMPL,element:I(O_,{})},ReportDashboard:{path:OW.ReportDashboard,element:I(mM,{})},ChartOfAccounts_NOT_IMPL:{path:OW.ChartOfAccounts_NOT_IMPL,element:I(O_,{})},GeneralLedger:{path:OW.GeneralLedger,element:I(function(){return gn(e=>e.FEATUREFLAG_GENERAL_LEDGER)?I(Vk,{children:I(B_,{})}):I(O_,{})},{})},Journal_NOT_IMPL:{path:OW.Journal_NOT_IMPL,element:I(O_,{})},Taxes_NOT_IMPL:{path:OW.Taxes_NOT_IMPL,element:I(O_,{})}},W_=yi(e=>r.createElement("svg",{width:12,height:13,viewBox:"0 0 12 13",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.03662 4.44452H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 6.4079H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 8.37134H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.9267 11.3112H2.07323C1.88019 11.3112 1.68904 11.2732 1.5107 11.1993C1.33236 11.1254 1.17031 11.0172 1.03381 10.8807C0.758141 10.605 0.603271 10.2311 0.603271 9.84124V1.01123L1.8882 1.99291L3.21938 1.01123L4.52487 1.99291L5.83549 1.01123L7.14098 1.99291L8.4516 1.01123V9.84124C8.45296 10.2316 8.60897 10.6054 8.88546 10.881C9.16195 11.1565 9.53637 11.3112 9.9267 11.3112Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.07324 4.44452H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 6.4079H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 8.37134H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M9.43334 4.93286H11.3967V9.84128C11.3745 10.2168 11.2097 10.5696 10.936 10.8276C10.6623 11.0856 10.3003 11.2293 9.92419 11.2293C9.54803 11.2293 9.18609 11.0856 8.91237 10.8276C8.63866 10.5696 8.47385 10.2168 8.45166 9.84128V4.93286H9.43334Z",strokeMiterlimit:10})),"Transactions"),__=yi(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.8474 4.45435H2.84612C2.17063 4.45435 1.62305 5.00193 1.62305 5.67742V13.0094C1.62305 13.6849 2.17063 14.2325 2.84612 14.2325H13.8474C14.5228 14.2325 15.0704 13.6849 15.0704 13.0094V5.67742C15.0704 5.00193 14.5228 4.45435 13.8474 4.45435Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.7927 4.45439H5.90039L6.51513 2.01465H10.1779L10.7927 4.45439Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.12376 11.1779H8.6542C8.89706 11.1779 9.12997 11.0815 9.3017 10.9097C9.47342 10.738 9.5699 10.5051 9.5699 10.2622C9.5699 10.0194 9.47342 9.78647 9.3017 9.61474C9.12997 9.44302 8.89706 9.34654 8.6542 9.34654H8.01385C7.77099 9.34654 7.53808 9.25007 7.36635 9.07834C7.19462 8.90661 7.09814 8.6737 7.09814 8.43084C7.09814 8.18798 7.19462 7.95507 7.36635 7.78334C7.53808 7.61161 7.77099 7.51514 8.01385 7.51514H9.54429",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 6.90039V7.51513",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 11.178V11.7927",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06922 13.6005C4.07207 13.816 4.03519 14.0302 3.96036 14.2326H2.84621C2.68367 14.2318 2.52291 14.1991 2.37322 14.1366C2.22354 14.0741 2.08791 13.9828 1.97417 13.8682C1.86044 13.7536 1.77085 13.6179 1.71061 13.4688C1.65037 13.3198 1.62066 13.1605 1.6232 13.0001V11.9003C1.82715 11.8223 2.04493 11.7858 2.26352 11.7928C2.74476 11.7995 3.20401 11.9929 3.54192 12.3312C3.87984 12.6694 4.06926 13.1254 4.06922 13.6005Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0703 11.9012V13.0126C15.0686 13.3356 14.9392 13.6449 14.7102 13.8733C14.4812 14.1017 14.1711 14.2308 13.8472 14.2325H12.733C12.6582 14.0279 12.6213 13.8115 12.6242 13.5938C12.6242 13.3533 12.6718 13.1153 12.7642 12.8932C12.8566 12.6712 12.9921 12.4696 13.1628 12.2999C13.3336 12.1301 13.5362 11.9957 13.7592 11.9043C13.9821 11.8129 14.2209 11.7663 14.462 11.7671C14.6715 11.7723 14.8781 11.8178 15.0703 11.9012Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06919 5.06911C4.06919 5.31015 4.02223 5.54882 3.93098 5.77144C3.83974 5.99405 3.70602 6.19623 3.53748 6.36637C3.36895 6.53652 3.16892 6.67129 2.94886 6.76295C2.72881 6.8546 2.49305 6.90135 2.25513 6.90051C2.03959 6.90424 1.82525 6.86733 1.62305 6.79165V5.67744C1.62385 5.51434 1.65668 5.35304 1.71961 5.20292C1.78255 5.05281 1.87434 4.91688 1.98964 4.80305C2.10494 4.68922 2.24144 4.59977 2.3912 4.53991C2.54095 4.48005 2.70097 4.45097 2.86192 4.45437H3.96174C4.03315 4.65123 4.06953 4.85937 4.06919 5.06911Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0702 5.68985V6.79252C14.8755 6.86364 14.6695 6.90011 14.4619 6.90025C14.2209 6.90109 13.9821 6.85482 13.7592 6.76411C13.5362 6.6734 13.3336 6.54003 13.1629 6.37165C12.9921 6.20327 12.8567 6.00318 12.7643 5.78287C12.6718 5.56257 12.6242 5.32637 12.6242 5.08782C12.6208 4.87175 12.6577 4.65691 12.7331 4.4541H13.8472C14.0098 4.45492 14.1705 4.48763 14.3202 4.55033C14.4699 4.61304 14.6055 4.7045 14.7193 4.81942C14.833 4.93434 14.9226 5.07044 14.9828 5.21985C15.0431 5.36926 15.0728 5.52901 15.0702 5.68985Z",strokeMiterlimit:10,strokeLinecap:"square"})),"Income"),q_=yi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M3.0668 7.46405H1.11133V11.375H3.0668V7.46405Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.8887 4.53595H8.93323V11.375H10.8887V4.53595Z",strokeMiterlimit:10}),r.createElement("path",{d:"M6.97782 0.625H5.02234V11.375H6.97782V0.625Z",strokeMiterlimit:10}),r.createElement("path",{d:"M0.138672 11.375H11.8613",strokeMiterlimit:10})),"Reports"),z_={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:W_}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:__},{page:"ExpenseDashboard",label:"Expenses",Icon:yH},{page:"IncomeDashboard",label:"Income",Icon:__}]},{items:[{page:"ReportDashboard",label:"Reports",Icon:q_}]}]},j_=yi(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"),K_=yi(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:"M7.5 14.25C11.2279 14.25 14.25 11.2279 14.25 7.5C14.25 3.77208 11.2279 0.75 7.5 0.75C3.77208 0.75 0.75 3.77208 0.75 7.5C0.75 11.2279 3.77208 14.25 7.5 14.25Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 2.58856V7.49999L10.5664 10.5664",strokeMiterlimit:10})),"TimeAndTasks"),Y_=yi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.58591 0.969731H4.86823C4.67602 0.970222 4.4865 1.01495 4.31436 1.10046C4.14222 1.18597 3.99207 1.30996 3.87555 1.46283L2.38978 3.44818L0.53418 4.06455V8.3986H2.38978C2.38978 8.06994 2.52034 7.75473 2.75274 7.52233C2.98514 7.28993 3.30034 7.15937 3.629 7.15937C3.95766 7.15937 4.27287 7.28993 4.50527 7.52233C4.73767 7.75473 4.86823 8.06994 4.86823 8.3986H9.20228C9.20228 8.06994 9.33284 7.75473 9.56524 7.52233C9.79764 7.28993 10.1128 7.15937 10.4415 7.15937C10.7702 7.15937 11.0854 7.28993 11.3178 7.52233C11.5502 7.75473 11.6807 8.06994 11.6807 8.3986H14.1592V5.52437C14.1588 5.27713 14.0844 5.03565 13.9457 4.831C13.8069 4.62636 13.6101 4.46789 13.3806 4.37598L11.0644 3.44818L9.57858 1.46283C9.46275 1.30922 9.31275 1.18469 9.14045 1.09911C8.96815 1.01352 8.77829 0.969227 8.58591 0.969731Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4414 9.63788C11.1258 9.63788 11.6806 9.08306 11.6806 8.39865C11.6806 7.71424 11.1258 7.15942 10.4414 7.15942C9.75697 7.15942 9.20215 7.71424 9.20215 8.39865C9.20215 9.08306 9.75697 9.63788 10.4414 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.62887 9.63788C4.31328 9.63788 4.8681 9.08306 4.8681 8.39865C4.8681 7.71424 4.31328 7.15942 3.62887 7.15942C2.94447 7.15942 2.38965 7.71424 2.38965 8.39865C2.38965 9.08306 2.94447 9.63788 3.62887 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.6021 4.06445H4.25195",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9199 6.54297H14.1591",strokeMiterlimit:10}),r.createElement("path",{d:"M7.34668 2.20898V4.06458",strokeMiterlimit:10})),"Mileage"),Z_=yi(UO,"Payroll"),G_=yi(kD,"ChartOfAccounts"),Q_=yi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.930835 6.6925H4.15797V7.04359C4.15797 7.44029 4.00038 7.82073 3.71987 8.10124C3.43937 8.38174 3.05892 8.53933 2.66223 8.53933H2.42176C2.02507 8.53933 1.64462 8.38174 1.36412 8.10124C1.08361 7.82073 0.926025 7.44029 0.926025 7.04359V6.6925H0.930835Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M0.469116 3.00363H3.07583C3.28237 3.00199 3.48644 2.95853 3.67573 2.87588C3.86502 2.79322 4.0356 2.67307 4.17719 2.52269C4.31979 2.37361 4.49058 2.25433 4.67964 2.17177C4.8687 2.08921 5.07227 2.04502 5.27855 2.04175H6.72138C6.92915 2.04454 7.13431 2.08849 7.325 2.17104C7.51569 2.25359 7.68813 2.37311 7.83236 2.52269C7.97715 2.67285 8.15037 2.7927 8.34193 2.87527C8.53349 2.95784 8.73956 3.00147 8.94815 3.00363H11.5308",strokeMiterlimit:10}),r.createElement("path",{d:"M6 0.699951V11.2999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.76535 11.2999H3.2345",strokeMiterlimit:10}),r.createElement("path",{d:"M2.7728 3.00366H2.31109L0.930786 6.23079V6.6925H4.15792V6.23079L2.7728 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.84197 6.6925H11.0691V7.04359C11.0691 7.44029 10.9115 7.82073 10.631 8.10124C10.3505 8.38174 9.97006 8.53933 9.57336 8.53933H9.33289C8.9362 8.53933 8.55575 8.38174 8.27525 8.10124C7.99474 7.82073 7.83716 7.44029 7.83716 7.04359V6.6925H7.84197Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.68886 3.00366H9.22716L7.84204 6.23079V6.6925H11.0692V6.23079L9.68886 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"})),"GeneralLedger"),X_=yi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.650024 1.86523V8.67246H4.54278C4.73458 8.67246 4.92449 8.71032 5.10162 8.78387C5.27875 8.85742 5.43962 8.96522 5.57501 9.10108C5.71039 9.23693 5.81762 9.39818 5.89056 9.57557C5.96349 9.75295 6.00069 9.943 6.00002 10.1348V3.32247C6.00002 3.1311 5.96232 2.94161 5.88909 2.76481C5.81586 2.58801 5.70852 2.42737 5.5732 2.29205C5.43788 2.15673 5.27724 2.04939 5.10044 1.97616C4.92364 1.90293 4.73415 1.86523 4.54278 1.86523H0.650024Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 1.86523V8.67246H7.45724C7.26545 8.67246 7.07554 8.71032 6.89841 8.78387C6.72127 8.85742 6.5604 8.96522 6.42502 9.10108C6.28963 9.23693 6.1824 9.39818 6.10947 9.57557C6.03654 9.75295 5.99934 9.943 6.00001 10.1348V3.32247C6.00001 2.93599 6.15354 2.56533 6.42682 2.29205C6.70011 2.01876 7.07076 1.86523 7.45724 1.86523H11.35Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 8.67249V10.1348H7.45725H4.54278H0.650024V8.67249",strokeMiterlimit:10})),"Journal"),J_=yi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.32498 11.2259H0.775757V0.774048H8.37577V3.64998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.47954 2.37524H2.677V4.84696H6.47954V2.37524Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.57825 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M4.57825 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M8.1449 7.27441C8.14484 7.32563 8.10334 7.36713 8.05212 7.36719C8.01365 7.36719 7.98028 7.34389 7.96619 7.31055L7.95935 7.27441C7.95935 7.22312 8.00083 7.18164 8.05212 7.18164L8.08826 7.18848C8.1216 7.20257 8.1449 7.23594 8.1449 7.27441Z"}),r.createElement("path",{d:"M9.77344 8.90295C9.77338 8.95417 9.73188 8.99567 9.68066 8.99573C9.64219 8.99573 9.60882 8.97243 9.59473 8.93909L9.58789 8.90295C9.58789 8.85166 9.62937 8.81018 9.68066 8.81018L9.7168 8.81702C9.75014 8.83111 9.77344 8.86448 9.77344 8.90295Z"}),r.createElement("path",{d:"M9.80828 6.96296L7.92403 9.21425",strokeMiterlimit:10}),r.createElement("path",{d:"M8.86626 10.6502C10.281 10.6502 11.428 9.50333 11.428 8.08855C11.428 6.67377 10.281 5.52686 8.86626 5.52686C7.45148 5.52686 6.30457 6.67377 6.30457 8.08855C6.30457 9.50333 7.45148 10.6502 8.86626 10.6502Z",strokeMiterlimit:10})),"Taxes"),$_={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:W_}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:__},{page:"ExpenseDashboard",label:"Expenses",Icon:yH},{page:"IncomeDashboard",label:"Income",Icon:__}]},{items:[{page:"Invoices_NOT_IMPL",label:"Invoices",Icon:j_},{page:"TimeAndTasks_NOT_IMPL",label:"Time & Tasks",Icon:K_},{page:"Mileage_NOT_IMPL",label:"Mileage",Icon:Y_},{page:"Payroll_NOT_IMPL",label:"Payroll",Icon:Z_},{page:"ReportDashboard",label:"Reports",Icon:q_}]},{label:"Accounting",items:[{page:"ChartOfAccounts_NOT_IMPL",label:"Chart of Accounts",Icon:G_},{page:"GeneralLedger",label:"General Ledger",Icon:Q_},{page:"Journal_NOT_IMPL",label:"Journal",Icon:X_}]},{items:[{page:"Taxes_NOT_IMPL",label:"Taxes",Icon:J_}]}]},eq=or({position:"sticky",top:0,alignSelf:"flex-start",width:"256px",maxWidth:"256px",height:"100dvh",display:"flex",flexDirection:"column",backgroundColor:"surface.background",borderRight:"1px solid {colors.border.layout}",flexShrink:0});function tq(){return I("div",{className:eq,children:I(YW,{})})}const nq=or({width:"100%",display:"flex",flexDirection:"row"}),rq=or({flex:1,display:"flex",flexDirection:"column",padding:{xl:"50px",base:"16px"}});function aq(){const e=uw();return P("div",{className:nq,children:[!e&&I(tq,{}),I("div",{className:rq,children:I(Ue,{children:Object.entries(H_).map(([e,t])=>I(Be,{path:t.path,element:t.element},e))})})]})}function oq(e){const{accessToken:t,environment:n="PRODUCTION",initialNav:r={page:"FinancialOverview"},buildTarget:a,rtlConfig:o}=e,i=/* @__PURE__ */function(e){return e?$_:z_}("PLAYGROUND"===a||"LAB"===a);return I(Ve,{initialEntries:[H_[r.page].path],children:I(_W.Provider,{value:o,children:I(S_,{initialNav:r,children:I(WW.Provider,{value:i,children:I(A_,{environment:n,accessToken:t,children:I(aq,{})})})})})})}const iq=["BanksAndIntegrations"],lq={BanksAndIntegrations:!0,FinancialOverview:!0,TransactionsDashboard:!0,ExpenseDashboard:!0,IncomeDashboard:!0,ReportDashboard:!0,GeneralLedger:!0},sq=new Set(Object.values(vi).flatMap(e=>Object.values(e)));function cq(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!lq[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&iq.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)&&sq.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{YA as BanksAndIntegrations,yR as ExpenseDashboard,Bk as FinancialOverview,ER as IncomeDashboard,mM as ReportDashboard,A_ as Tight,oq as TightApp,tR as TransactionsDashboard,cq as parseNavUrl,Nn as useEmbeddedEventListeners,In as useEventSource,An 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,useContext as i,createContext as l,useEffect as s,Component as c,useState as d,useCallback as u,createElement as h,forwardRef as p,useLayoutEffect as m,useImperativeHandle as g,useReducer as v,Fragment as f}from"react";import"zustand/react/shallow";import{cloneDeep as b,entries as y,mapValues as w,isEqual as C,differenceBy as x,debounce as T,isEmpty as k}from"lodash-es";import{v4 as E}from"uuid";import*as A from"zod";import{z as S}from"zod";import{jsx as I,Fragment as N,jsxs as R}from"react/jsx-runtime";import{QueryClient as P,useIsRestoring as D,useQuery as M,keepPreviousData as L,useMutationState as F,useMutation as O,useQueries as V,useInfiniteQuery as U}from"@tanstack/react-query";import B from"yocto-queue";import H from"big.js";import{ResponsiveContainer as W,BarChart as z,Legend as _,CartesianGrid as j,XAxis as q,YAxis as K,Tooltip as Y,Bar as Z,ReferenceLine as G,Line as Q}from"recharts";import{flexRender as X,createColumnHelper as J,useReactTable as $,getCoreRowModel as ee,getExpandedRowModel as te}from"@tanstack/react-table";import{useFloatingNodeId as ne,useFloating as re,offset as ae,flip as oe,shift as ie,size as le,autoUpdate as se,useClick as ce,useDismiss as de,useRole as ue,useInteractions as he,useFloatingParentNodeId as pe,FloatingTree as me,FloatingNode as ge,useMergeRefs as ve,FloatingPortal as fe,FloatingOverlay as be,FloatingFocusManager as ye}from"@floating-ui/react";import{ContextAwareConfirmation as we,confirmable as Ce}from"react-confirm";import{createFormHookContexts as xe,useStore as Te,createFormHook as ke}from"@tanstack/react-form";import{NumericFormat as Ee}from"react-number-format";import Ae from"fuse.js";import Se from"react-inlinesvg";import{AnimatePresence as Ie,motion as Ne}from"motion/react";import{useDropzone as Re}from"react-dropzone";import{openDB as Pe}from"idb";import{PersistQueryClientProvider as De}from"@tanstack/react-query-persist-client";import{fetchEventSource as Me}from"@microsoft/fetch-event-source";import{Toast as Le,createToaster as Fe,Toaster as Oe}from"@ark-ui/react/toast";import{Portal as Ve}from"@ark-ui/react/portal";function Ue(e,t){return`${e.trim()}:${t.trim()}`}const Be=e=>({FEATUREFLAG_BULK_SELECT:!1,FEATUREFLAG_ATTACH_TO_PAYROLL:!1,FEATUREFLAG_FREQUENCY_SELECTOR:!1,FEATUREFLAG_SUGGESTED_CATEGORIES:!1,FEATUREFLAG_CATEGORY_SETTINGS:!1,FEATUREFLAG_GENERAL_LEDGER:!1,updateFlags:t=>e(e=>({...e,...t}),void 0,Ue("featureFlags","updateFlags"))});function He(){return dn(e=>e.FEATUREFLAG_FREQUENCY_SELECTOR)}function We(){return dn(e=>e.FEATUREFLAG_SUGGESTED_CATEGORIES)}function ze(){return dn(e=>e.FEATUREFLAG_GENERAL_LEDGER)}let _e=null,je=!1;function qe(){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 Ke(e,t){e.setAttribute("content",Object.entries(t).map(([e,t])=>t?`${e}=${t}`:e).join(", "))}function Ye(){const e=qe();if(!e)return;const{meta:t,params:n}=e;if(je)return t.remove(),je=!1,void(_e=null);_e?n["interactive-widget"]=_e:delete n["interactive-widget"],_e=null,Ke(t,n)}const Ze="drawerNavigation",Ge=(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=qe();if(!e){const t=document.createElement("meta");t.name="viewport",document.head.appendChild(t),je=!0,e={meta:t,params:{}}}const{meta:t,params:n}=e;_e=n["interactive-widget"]??null,n["interactive-widget"]="resizes-content",Ke(t,n)}(),{drawerHistory:[o]};{const t=b(e.drawerHistory);return t.push(o),{drawerHistory:t}}},void 0,Ue(Ze,"openDrawer")),closeDrawer:()=>{e(e=>{const t=e.drawerHistory;return{drawerHistory:t.slice(0,t.length-1)}},void 0,Ue(Ze,"closeDrawer")),0===t().drawerHistory.length&&Ye()},closeAllDrawers:()=>{e(()=>({drawerHistory:[]}),void 0,Ue(Ze,"closeAllDrawers")),Ye()},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,Ue(Ze,"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,Ue(Ze,"requestCloseAllDrawers")),confirmCloseDrawer:()=>{e(e=>({closingQueue:e.closingQueue.slice(1)}),void 0,Ue(Ze,"confirmCloseDrawer")),0===t().drawerHistory.length&&Ye()}}),Qe=e=>({externalOptions:{},setOptions:(t,n=!1)=>e(e=>n?{externalOptions:{...t}}:{externalOptions:{...e.externalOptions,...t}},void 0,Ue("externalOptions","setOptions"))});function Xe(e,t){return t>-1&&t<=e.length-1?[...e.slice(0,t),...e.slice(t+1)]:[...e]}function Je(e){return Array.isArray(e)&&e.length>0}function $e(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 et="search",tt=$e({key:et,name:"Search"});function nt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function rt(e,t,n){return new Date(e,t,n)}function at(e){const[t,n,r]=e.split("-");return rt(Number(t),Number(n),Number(r))}function ot(){return nt(rt(/* @__PURE__ */(new Date).getFullYear()+1,0,0))}function it(e,t){return nt(rt(t,e,1))}function lt(){const e=/* @__PURE__ */new Date;return nt(rt(e.getFullYear(),e.getMonth()+1,0))}function st(e){const t=/* @__PURE__ */new Date;return nt(rt(t.getFullYear(),t.getMonth()-e,1))}function ct(e){const t=e.getMonth(),n=t-t%3;return nt(rt(e.getFullYear(),n,1))}function dt(e){const t=e.getMonth(),n=t-t%3+3;return nt(rt(e.getFullYear(),n,0))}const ut={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"},ht={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"},pt=e=>Object.values(ut).includes(e),mt={[ut.ALL_TIME]:()=>"",[ut.THIS_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return it(e.getMonth(),e.getFullYear())}(),[ut.LAST_YEAR]:()=>nt(rt(/* @__PURE__ */(new Date).getFullYear()-1,0,1)),[ut.LAST_MONTH]:()=>st(1),[ut.LAST_6_MONTHS]:()=>st(5),[ut.LAST_12_MONTHS]:()=>function(){const e=/* @__PURE__ */new Date;return nt(rt(e.getFullYear(),e.getMonth()-11,1))}(),[ut.THIS_YEAR]:()=>nt(rt(/* @__PURE__ */(new Date).getFullYear(),0,1)),[ut.LAST_3_MONTHS]:()=>st(2),[ut.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return ct(rt(e.getFullYear(),e.getMonth()-3,1))}(),[ut.THIS_QUARTER]:()=>ct(/* @__PURE__ */new Date)};function gt(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 vt=e=>mt[e](),ft={[ut.ALL_TIME]:()=>"",[ut.THIS_MONTH]:()=>lt(),[ut.LAST_YEAR]:()=>nt(rt(/* @__PURE__ */(new Date).getFullYear(),0,0)),[ut.LAST_MONTH]:()=>function(){const e=/* @__PURE__ */new Date;return nt(rt(e.getFullYear(),e.getMonth(),0))}(),[ut.LAST_6_MONTHS]:()=>lt(),[ut.LAST_12_MONTHS]:()=>lt(),[ut.THIS_YEAR]:()=>ot(),[ut.LAST_3_MONTHS]:()=>lt(),[ut.LAST_QUARTER]:()=>function(){const e=/* @__PURE__ */new Date;return dt(rt(e.getFullYear(),e.getMonth()-3,1))}(),[ut.THIS_QUARTER]:()=>dt(/* @__PURE__ */new Date)},bt=e=>ft[e](),yt=e=>{return pt(e)?{beginDate:vt(e),endDate:bt(e)}:function(e){if("object"!=typeof e)return!1;const t=e;return"string"==typeof t.beginDate&&"string"==typeof t.endDate}(e)?e:{beginDate:nt((t=e).beginDate),endDate:nt(t.endDate)};var t},wt=["SUN","MON","TUE","WED","THU","FRI","SAT"],Ct=["January","February","March","April","May","June","July","August","September","October","November","December"];function xt({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 Tt(e,t){return e.toDateString()===t.toDateString()}function kt(e){return Tt(e,/* @__PURE__ */new Date)}function Et(e,t){const n=rt(e.getFullYear(),e.getMonth(),e.getDate()),r=rt(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()>r.getTime()}function At(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 St(e,t,n){if(e<1||e>12||t<1||t>31)return!1;const r=rt(n,e-1,t);return!(r.getFullYear()!==n||r.getMonth()!==e-1||r.getDate()!==t)}function It(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 St(o,i,l)?rt(l,o-1,i):null}function Nt(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 St(i,l,o)?rt(o,i-1,l):null}function Rt(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 Pt(e,t){return Et(e,t)?t:e}function Dt(e,t){return Et(t,e)?t:e}const Mt=(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},Lt=e=>{const t=new Date(e||""),n=/* @__PURE__ */new Date;return kt(t)?t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):t.getFullYear()===n.getFullYear()?(e=>e.toLocaleString("default",{month:"short"})+" "+e.getDate())(t):Mt(t,{abbreviateMonth:!0,abbreviateYear:!1})},Ft=e=>e?e.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}):null;function Ot(e,t){return rt(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Vt(e){const{month:t,year:n}=e;return{beginDate:rt(n,t-1,1),endDate:rt(n,t+1,0)}}const Ut="date",Bt=Object.values(ut).map(e=>{return{name:ht[t=e],value:{date:{name:ht[t],value:t}}};var t}),Ht=$e({key:Ut,name:"Date",possibleValues:()=>({values:Bt}),singleSelect:!0,hideInFilterListOnDesktop:!0});function Wt(e){return"OWNER"===e||"READ_ONLY"===e}function zt(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===et);return-1===t?e:e.filter((e,n)=>n===t||e.modelKey!==et)}const _t=Ht.createFilter({name:ht[ut.LAST_12_MONTHS],value:{date:{name:ht[ut.LAST_12_MONTHS],value:ut.LAST_12_MONTHS}}});function jt(e,t){return zt([...t.some(e=>e.modelKey===Ut)?function(e){const t=e.findIndex(e=>e.modelKey===Ut);return-1!==t?Xe(e,t):e}(e.filters):e.filters,...t])}function qt(e,t){const n=e.filters[t];return n&&n.modelKey===Ut?function(e,t){const n=[...e];return n[t]=_t,n}(e.filters,t):e.filters.filter((e,n)=>n!==t)}function Kt(e){return zt(e.some(e=>e.modelKey===Ut)?e:[...e,_t])}function Yt(e,t){if(e.hasInitialized)return e;const n=[];return Wt(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 Zt="transactionsDashboardFilters",Gt=e=>({transactionsDashboardFilters:[_t],hasInitializedTransactionsDashboardFilters:!1,addTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:jt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ue(Zt,"add")),removeTransactionsDashboardFilter:t=>e(e=>({...e,transactionsDashboardFilters:qt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t)}),void 0,Ue(Zt,"remove")),setTransactionsDashboardFilters:t=>e(e=>({...e,transactionsDashboardFilters:Kt(t)}),void 0,Ue(Zt,"set")),initializeTransactionsDashboardFilters:t=>e(e=>{const n=Yt({filters:e.transactionsDashboardFilters,hasInitialized:e.hasInitializedTransactionsDashboardFilters},t);return{...e,transactionsDashboardFilters:n.filters,hasInitializedTransactionsDashboardFilters:n.hasInitialized}},void 0,Ue(Zt,"initialize"))}),Qt="expenseDashboardFilters",Xt=e=>({expenseDashboardFilters:[_t],hasInitializedExpenseDashboardFilters:!1,addExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:jt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ue(Qt,"add")),removeExpenseDashboardFilter:t=>e(e=>({...e,expenseDashboardFilters:qt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t)}),void 0,Ue(Qt,"remove")),setExpenseDashboardFilters:t=>e(e=>({...e,expenseDashboardFilters:Kt(t)}),void 0,Ue(Qt,"set")),initializeExpenseDashboardFilters:t=>e(e=>{const n=Yt({filters:e.expenseDashboardFilters,hasInitialized:e.hasInitializedExpenseDashboardFilters},t);return{...e,expenseDashboardFilters:n.filters,hasInitializedExpenseDashboardFilters:n.hasInitialized}},void 0,Ue(Qt,"initialize"))}),Jt="incomeDashboardFilters",$t=e=>({incomeDashboardFilters:[_t],hasInitializedIncomeDashboardFilters:!1,addIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:jt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ue(Jt,"add")),removeIncomeDashboardFilter:t=>e(e=>({...e,incomeDashboardFilters:qt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t)}),void 0,Ue(Jt,"remove")),setIncomeDashboardFilters:t=>e(e=>({...e,incomeDashboardFilters:Kt(t)}),void 0,Ue(Jt,"set")),initializeIncomeDashboardFilters:t=>e(e=>{const n=Yt({filters:e.incomeDashboardFilters,hasInitialized:e.hasInitializedIncomeDashboardFilters},t);return{...e,incomeDashboardFilters:n.filters,hasInitializedIncomeDashboardFilters:n.hasInitialized}},void 0,Ue(Jt,"initialize"))}),en="generalLedgerFilters",tn="ACCRUAL",nn={generalLedgerGlAccountId:void 0,generalLedgerDateRange:void 0,generalLedgerAccountingMethod:tn},rn=e=>({...nn,setGeneralLedgerGlAccountId:t=>e(e=>({...e,generalLedgerGlAccountId:t}),void 0,Ue(en,"setGlAccountId")),setGeneralLedgerDateRange:t=>e(e=>({...e,generalLedgerDateRange:t}),void 0,Ue(en,"setDateRange")),setGeneralLedgerAccountingMethod:t=>e(e=>({...e,generalLedgerAccountingMethod:t}),void 0,Ue(en,"setAccountingMethod")),setGeneralLedgerFilters:t=>e(e=>({...e,generalLedgerGlAccountId:t.glAccountId,generalLedgerDateRange:t.dateRange,generalLedgerAccountingMethod:t.accountingMethod}),void 0,Ue(en,"setFilters")),resetGeneralLedgerFilters:()=>e(e=>({...e,...nn}),void 0,Ue(en,"reset"))}),an={label:"Connected Accounts",value:"connected"},on="banksAndIntegrationsState",ln=e=>({banksAndIntegrationsSelectedTab:an,expandedPlaidItems:[],hasExpandedUpdated:!1,setBanksAndIntegrationsSelectedTab:t=>e({banksAndIntegrationsSelectedTab:t},void 0,Ue(on,"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,Ue(on,"toggleExpandedIntegration"))}),sn={plaidLink:null,plaidLinkEvent:null,plaidLinkError:null,gusto:null,payroll:null,bITile:null,conversations:null,bill:null,transactionForm:null,customer:null},cn=e=>({events:sn,setEvents:t=>e(e=>({events:{...e.events,...t}}),void 0,Ue("events","setEvents"))}),dn=e()(t(n((...e)=>({...Be(...e),...Ge(...e),...Qe(...e),...Gt(...e),...Xt(...e),...$t(...e),...rn(...e),...ln(...e),...cn(...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})),un={SELECT:"select",EXPAND:"expand"},hn={...un,DATE:"date",DESCRIPTION:"description",AMOUNT:"amount",CATEGORY:"category",DIMENSION_VALUE:"dimensionValue",REVIEW_STATUS:"reviewStatus",COMMENTS:"comments"},pn=[hn.COMMENTS,hn.DATE,hn.DESCRIPTION,hn.AMOUNT,hn.CATEGORY,hn.DIMENSION_VALUE,hn.REVIEW_STATUS],mn=A.object({pageSize:A.optional(A.int32().positive()),columns:A.optional(A.array(A.enum(pn)))}),gn=e=>{const t=mn.safeParse(e);return t.success?t.data:void 0},vn=A.optional(A.string().trim()),fn=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,bn=A.optional(A.array(A.string().trim())),yn=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())}),wn={transactionsDashboard:gn,incomeDashboard:gn,expenseDashboard:gn,accessToken:e=>{const t=vn.safeParse(e);return t.success?t.data:void 0},dataVisualizationColors:e=>{const t=bn.safeParse(e);if(!t.success||void 0===t.data)return;const n=t.data.filter(e=>fn.test(e));return n.length>0?n:void 0},banksAndIntegrations:e=>{const t=yn.safeParse(e);return t.success?t.data:void 0}},Cn=(e,t)=>{if(void 0!==wn[e])return(0,wn[e])(t)};function xn(e){const t=a(!1),n=dn(e=>e.setOptions);if(e&&!t.current){n(function(e){let t={};for(const[n,r]of y(e)){const e=Cn(n,r);void 0!==e&&(t={...t,[n]:e})}return t}(e)),t.current=!0}const r=dn(e=>e.externalOptions);return{options:o(()=>b(r),[r]),setOptions:n}}const Tn=l(null);function kn(){return i(Tn)}function En(e){const t=a(!1),n=dn(e=>e.setEvents);return s(()=>{e&&!t.current&&(n(e),t.current=!0)},[e,n]),[dn(e=>e.events),n]}function An(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function Sn(e){return Object.fromEntries(Object.entries(e??{}).filter(([e,t])=>void 0!==t))}function In(e){return String.fromCharCode(e+(e>25?39:97))}function Nn(e){return function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=In(t%52)+n;return In(t%52)+n}(function(e,t){let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e}(5381,e)>>>0)}var Rn=/\s*!(important)?/i;function Pn(e){return"string"==typeof e?e.replaceAll(" ","_"):e}var Dn=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}},Mn=/* @__PURE__ */new Set(["__proto__","constructor","prototype"]);function Ln(...e){return e.reduce((e,t)=>t?(Object.keys(t).forEach(n=>{if(Mn.has(n))return;const r=e[n],a=t[n];An(r)&&An(a)?e[n]=Ln(r,a):e[n]=a}),e):e,{})}var Fn=e=>null!=e;function On(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);Fn(u)&&(i[c]=u)}return i}var i;return t(n,o)}(e)}function Vn(e,t,n=!0){const{utility:r,conditions:a}=t,{hasShorthand:o,resolveShorthand:i}=r;return On(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 Un={shift:e=>e,finalize:e=>e,breakpoints:{keys:[]}},Bn=/([A-Z])/g,Hn=/^ms-/,Wn=Dn(e=>e.startsWith("--")?e:e.replace(Bn,"-$1").replace(Hn,"-ms-").toLowerCase()),zn=new RegExp(`^(${["min","max","clamp","calc"].join("|")})\\(.*\\)`),_n=`(?:${"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("|")})`,jn=new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${_n}$`),qn={map:function(e,t){return Array.isArray(e)?e.map(e=>t(e)):An(e)?On(e,e=>t(e)):t(e)},isCssFunction:e=>"string"==typeof e&&zn.test(e),isCssVar:e=>"string"==typeof e&&/^var\(--.+\)$/.test(e),isCssUnit:e=>"string"==typeof e&&jn.test(e)},Kn=(e,t)=>{if(!e?.defaultValues)return t;const n="function"==typeof e.defaultValues?e.defaultValues(t):e.defaultValues;return Object.assign({},n,Sn(t))};const Yn=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,_themeBizhub,base".split(",")),Zn=/^@|&|&$/;function Gn(e){return Yn.has(e)||Zn.test(e)}const Qn=/^_/,Xn=/&|@/,Jn=/* @__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(":");Jn.set(t,n)});const $n={conditions:{shift:function(e){return e.sort((e,t)=>{const n=Gn(e),r=Gn(t);return n&&!r?1:!n&&r?-1:0})},finalize:function(e){return e.map(e=>Yn.has(e)?e.replace(Qn,""):Xn.test(e)?`[${Pn(e.trim())}]`:e)},breakpoints:{keys:["base","sm","md","lg","xl","1_5xl","2xl"]}},utility:{prefix:"tsystem",transform:(e,t)=>({className:`${Jn.get(e)||Wn(e)}_${Pn(t)}`}),toHash:(e,t)=>t(e.join(":")),resolveShorthand:e=>e}},er=function(e){const{utility:t,hash:n,conditions:r=Un}=e,a=e=>[t.prefix,e].filter(Boolean).join("-");return Dn(({base:o,...i}={})=>{const l=Vn(Object.assign(i,o),e),s=/* @__PURE__ */new Set;return On(l,(e,o)=>{if(null==e)return;const i="string"==typeof(u=e)&&Rn.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(Rn,"").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,Nn))}else i=[...r.finalize(e),a(o)].join(":");return i})(d,h.className);i&&(p=`${p}!`),s.add(p)}),Array.from(s).join(" ")})}($n),tr=(...e)=>er(nr(...e));tr.raw=(...e)=>nr(...e);const{mergeCss:nr}=function(e){function t(t){const n=function(...e){return e.flat().filter(e=>An(e)&&Object.keys(Sn(e)).length>0)}(...t);return 1===n.length?n:n.map(t=>Vn(t,e))}return{mergeCss:Dn(function(...e){return Ln(...t(e))}),assignCss:function(...e){return Object.assign({},...t(e))}}}($n);function rr(){let e,t="",n=0;for(;n<arguments.length;)(e=arguments[n++])&&"string"==typeof e&&(t&&(t+=" "),t+=e);return t}const ar=e=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...e});function or(e){const{base:t,variants:n,defaultVariants:r,compoundVariants:a}=ar(e),o=e=>({...r,...Sn(e)});function i(e={}){const r=o(e);let i={...t};for(const[t,a]of Object.entries(r))n[t]?.[a]&&(i=nr(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=nr(n,e.css))}),n}(a,r);return nr(i,l)}const l=Object.keys(n),s=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Object.keys(t)]));return Object.assign(Dn(function(e){return tr(i(e))}),{__cva__:!0,variantMap:s,variantKeys:l,raw:i,config:e,merge:function(e){const o=ar(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 or({base:nr(t,o.base),variants:Object.fromEntries(i.map(e=>[e,nr(n[e],o.variants[e])])),defaultVariants:Ln(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 ir,lr=((ir=lr||{}).component="component",ir["dashboard-placeholder-table"]="dashboard-placeholder-table",ir["dashboard-header"]="dashboard-header",ir["dashboard-table"]="dashboard-table",ir["dashboard-table-body"]="dashboard-table-body",ir["dashboard-table-cell"]="dashboard-table-cell",ir["dashboard-table-column-header"]="dashboard-table-column-header",ir["dashboard-table-header"]="dashboard-table-header",ir.label="label",ir.popup="popup",ir["popup-sort-row"]="popup-sort-row",ir["progress-bar"]="progress-bar",ir["progress-bar-fill"]="progress-bar-fill",ir.drawer="drawer",ir.summation="summation",ir["table-parent-row"]="table-parent-row",ir["table-row"]="table-row",ir["table-sub-row"]="table-sub-row",ir.tile="tile",ir["tile-bar-label"]="tile-bar-label",ir["tile-bar-label-outer"]="tile-bar-label-outer",ir["tile-body"]="tile-body",ir["tile-filter-button"]="tile-filter-button",ir["tile-filter-list"]="tile-filter-list",ir["tile-filter-row"]="tile-filter-row",ir["tile-header"]="tile-header",ir["business-owner-dashboard"]="business-owner-dashboard",ir["business-owner-dashboard-header"]="business-owner-dashboard-header",ir["transaction-type-label"]="transaction-type-label",ir["transaction-date-cell-container"]="transaction-date-cell-container",ir["selector-row"]="selector-row",ir["popup-list"]="popup-list",ir.badge="badge",ir["badge-chip"]="badge-chip",ir["date-cell"]="date-cell",ir["vertical-divider"]="vertical-divider",ir["horizontal-divider"]="horizontal-divider",ir["checkbox-input"]="checkbox-input",ir["bulk-select"]="bulk-select",ir["button-base"]="button-base",ir["button-discreet-small"]="button-discreet-small",ir["button-primary"]="button-primary",ir["button-secondary"]="button-secondary",ir["button-success"]="button-success",ir["button-danger"]="button-danger",ir["button-warning"]="button-warning",ir["button-action"]="button-action",ir["button-table-header"]="button-table-header",ir["button-inline"]="button-inline",ir["small-square-button"]="small-square-button",ir.card="card",ir["card-button"]="card-button",ir["card-button-icon-container"]="card-button-icon-container",ir["pagination-button"]="pagination-button",ir.text="text",ir["cell-button"]="cell-button",ir["selector-button"]="selector-button",ir["review-status-selector-button"]="review-status-selector-button",ir["review-status-dropdown-arrow"]="review-status-dropdown-arrow",ir["financial-summary-layout"]="financial-summary-layout",ir["financial-summary-chatbox"]="financial-summary-chatbox",ir["financial-summary-chatbox-header"]="financial-summary-chatbox-header",ir["month-picker"]="month-picker",ir["month-picker-left-button"]="month-picker-left-button",ir["month-picker-right-button"]="month-picker-right-button",ir["month-picker-label"]="month-picker-label",ir["filter-bar"]="filter-bar",ir["filter-search-bar"]="filter-search-bar",ir.pill="pill",ir["filter-pill"]="filter-pill",ir["email-pill"]="email-pill",ir["discreet-form-input"]="discreet-form-input",ir["editable-form-input"]="editable-form-input",ir["amount-input"]="amount-input",ir["modal-popup"]="modal-popup",ir["drawer-header"]="drawer-header",ir["form-body"]="form-body",ir.body="body",ir.heading="heading",ir["sub-label"]="sub-label",ir["strong-label"]="strong-label",ir["strong-sub-label"]="strong-sub-label",ir["weak-label"]="weak-label",ir["metric-xl"]="metric-xl",ir["metric-md"]="metric-md",ir["large-icon"]="large-icon",ir["medium-icon"]="medium-icon",ir["small-icon"]="small-icon",ir["tiny-icon"]="tiny-icon",ir["x-large-icon"]="x-large-icon",ir["xx-large-icon"]="xx-large-icon",ir["category-icon"]="category-icon",ir["card-header"]="card-header",ir.icon="icon",ir["neutral-badge"]="neutral-badge",ir["highlight-badge"]="highlight-badge",ir["success-badge"]="success-badge",ir["warning-badge"]="warning-badge",ir["danger-badge"]="danger-badge",ir["critical-badge"]="critical-badge",ir["button-group"]="button-group",ir["alert-dialog"]="alert-dialog",ir["alert-header"]="alert-header",ir["emphasis-label"]="emphasis-label",ir["profit-loss-graph"]="profit-loss-graph",ir.banner="banner",ir["banner-high"]="banner-high",ir["banner-medium"]="banner-medium",ir["banner-low"]="banner-low",ir["banner-urgent"]="banner-urgent",ir["banner-default"]="banner-default",ir["banner-button"]="banner-button",ir["banner-button-text"]="banner-button-text",ir["banner-button-icon"]="banner-button-icon",ir["banner-icon"]="banner-icon",ir["banner-title"]="banner-title",ir["empty-dashboard-layout"]="empty-dashboard-layout",ir["emphasis-sub-label"]="emphasis-sub-label",ir["bar-transactions-positive"]="bar-transactions-positive",ir["bar-transactions-negative"]="bar-transactions-negative",ir["message-sent"]="message-sent",ir["message-received"]="message-received",ir["date-amount-header"]="date-amount-header",ir["close-button"]="close-button",ir["start-date-form-section"]="start-date-form-section",ir["beginning-balance-form-section"]="beginning-balance-form-section",ir["date-picker-nav-button"]="date-picker-nav-button",ir["date-picker-day-button"]="date-picker-day-button",ir["dropdown-selector-button"]="dropdown-selector-button",ir.chip="chip",ir["attachment-dropzone"]="attachment-dropzone",ir["list-body"]="list-body",ir["loading-skeleton"]="loading-skeleton",ir["line-item-card"]="line-item-card",ir["linked-entity-row"]="linked-entity-row",ir["drawer-search-bar"]="drawer-search-bar",ir["value-comparison-summary"]="value-comparison-summary",ir["category-selector-table-cell"]="category-selector-table-cell",ir["zero-state-button"]="zero-state-button",ir.toast="toast",ir["toast-dismiss"]="toast-dismiss",ir);const sr=e=>null==e,cr=e=>!sr(e),dr="Tight-",ur=e=>`${dr}${e}`;function hr(e){return e in lr}function pr(e){const t=e.indexOf("-"),n=e.slice(0,t+1),r=e.slice(t+1);return n===dr&&r in lr}function mr(e){return!hr(e)&&!pr(e)}const gr=(e,...t)=>{const n=[],r=[];return null!==e&&n.push(ur(e)),t.forEach(e=>{sr(e)||(mr(e)?r.push(e):hr(e)?n.push(ur(e)):pr(e)&&n.push(e))}),{className:rr(...n,...r)}},vr=tr.raw({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"80px",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}),fr=gr(lr["business-owner-dashboard-header"],tr(vr));function br({children:e}){return I("div",{...fr,children:e})}function yr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(pr(t)&&e.push(t),e),[])],[])}function wr(e){return e.reduce((e,t)=>[...e,...t.className.split(" ").reduce((e,t)=>(mr(t)&&e.push(t),e),[])],[])}function Cr(e){const t=Array.isArray(e)?e:[e];return{className:rr(...yr(t),...wr(t))}}const xr=or({base:{},variants:{body:{default:{fontWeight:"body",fontSize:{xl:"body",base:"lg"},fontFamily:"body",color:"typography.base",lineHeight:"template"}},label:{default:{fontWeight:"label",fontSize:{xl:"label",base:"lg"},fontFamily:"label",color:"typography.label",lineHeight:"template"},subLabel:{fontWeight:"label.sub",fontSize:{xl:"label.sub",base:"md"},fontFamily:"label",color:"typography.label.sub",lineHeight:"template"},strongLabel:{fontSize:"lg",fontWeight:"sm",lineHeight:"template",xl:{fontWeight:"label.strong",fontSize:"label.strong",lineHeight:"template"},fontFamily:"label",color:"typography.label.strong"},weakLabel:{fontWeight:"sm",fontSize:{sm:"label",base:"lg"},fontFamily:"label",color:"brand.primary.weak",lineHeight:"template"},strongSubLabel:{fontWeight:"label.strongSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.strongSub",lineHeight:"template"},emphasisSubLabel:{fontWeight:"label.emphasisSub",fontSize:{xl:"label.strongSub",base:"md"},fontFamily:"label",color:"typography.label.emphasisSub",lineHeight:"template"}},heading:{default:{fontWeight:"heading",fontSize:{xl:"heading",base:"lg"},fontFamily:"heading",color:"typography.heading",lineHeight:"template"}},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"}}}}),Tr=gr(lr.heading,xr({heading:"default"}));function kr({children:e,stylists:t=[]}){const n=Cr([Tr,...t]);return I("div",{...n,children:e})}function Er(e,t,n){return[...e,{accessToken:t,environment:n}]}function Ar(e,t){return[...e,t]}function Sr(e){return""===e.trim()}function Ir(e){return sr(e)||Sr(e)}function Nr(e){return!Ir(e)}const Rr=l({activeToken:void 0,accountantToken:void 0});function Pr(){const{activeToken:e}=i(Rr);return e}const Dr=()=>{throw new Error("No access token provided")},Mr=72e5,Lr=new P({defaultOptions:{queries:{gcTime:Mr,staleTime:3e4,refetchInterval:6e4}}}),Fr=l("SANDBOX");function Or(){return i(Fr)}function Vr({queryKey:e,queryFn:t,...n}){const r=Pr(),a=Or(),o=Nr(r),i=Er(e,r??"",a),l=D(),s=M({...n,queryKey:i,queryFn:o?t:Dr,...o?{}:{retry:!1,staleTime:1/0}},Lr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}class Ur{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 Br=Symbol("Circular"),Hr=Symbol("AccessError");function Wr(e,t,n){return zr({key:"",value:e,replacer:t,seen:[],depth:0,depthLimit:n?.depthLimit,edgeIndex:0,edgesLimit:n?.edgesLimit})}function zr({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=Br),n&&(s=n(e,s)),"object"==typeof(c=s)&&null!==c&&"toJSON"in c&&"function"==typeof c.toJSON&&(s=_r(()=>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=_r(()=>s[i]);e.push(zr({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=_r(()=>s[c]);e[c]=zr({key:c,value:d,replacer:n,seen:r,depth:o,depthLimit:a,edgeIndex:i,edgesLimit:l})}s=e}return r.pop(),s}function _r(e){try{return e()}catch{return Hr}}const jr=Object.prototype.toString,qr=Object.getPrototypeOf;function Kr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Yr=/^\s*at .*(\S+:\d+|\(native\))/m,Zr=/^(eval@)?(\[native code])?$/;function Gr(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=Xr(e,t);let r;"InvalidError"===n.name&&(r={[t]:{"non-error parameter":e}}),void 0!==n.metadata&&Kr(n.metadata)&&(r={...r,[n.name]:n.metadata});const a=[Jr(n)];return a.push(...ta(n).map(e=>Jr(e,{backtrace:!1}))),{exceptions:a,metadata:r}}function Xr(e,t){if(function(e){if(e instanceof Error)return!0;let t=e;for(;t;){if("[object Error]"===jr.call(t))return!0;t=qr(t)}return!1}(e))return e;let n=function(e){if(!Kr(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 Jr(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(Yr)?e.split("\n").filter(e=>!!e.match(Yr)).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=Gr(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(Zr)).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=Gr(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<ea;){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 ea=20;function ta(e){const t=e;if(t.cause){const e=Xr(t.cause,"cause");return"InvalidError"===e.name?[]:[e].concat(ta(e))}return[]}function na(...e){console.error}const ra={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 aa=Date.now();const oa=()=>{aa=Date.now()},ia={name:"appDuration",load:e=>(e.addOnError(e=>{const t=Date.now();return e.app=e.app||{},e.app.duration=t-aa,!0}),{reset:oa})},la=[["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\)$/]],sa=[["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/]],ca=(da=function(e){const t=""!==(n=e)&&la.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 sa)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,...da(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 da;class ua{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 ha extends c{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 I(e,{error:this.state.error,errorInfo:this.state.errorInfo,clearError:()=>this.handleClearError()})}return I(N,{children:this.props.children})}}const pa={name:"react",load:e=>({BugsnagErrorBoundary:({onError:t,fallbackComponent:n,children:r})=>I(ha,{client:e,onError:t,FallbackComponent:n,children:r})})},ma=new class{breadcrumbs=[];config;delivery=new Ur(this);errorCallbacks=/* @__PURE__ */new Set;postErrorCallbacks=/* @__PURE__ */new Set;plugins=[];start(e){if(this.config)return na(),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 g of c){const e=await g(s);if("boolean"==typeof e&&!e)return}const u=Wr(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 g of this.postErrorCallbacks)g(s);try{await this.delivery.sendEvent(p)}catch(m){na()}}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 ga="",va="";const fa="true"==={}.VITEST||"undefined"!=typeof window&&"Cypress"in window?"test":"prod",ba=ma.start({apiKey:"899aec02393ac236377b73b483800d2c",appVersion:"6.9.1",appType:"browser",releaseStage:fa,enabledReleaseStages:["prod"],plugins:[ia,ca,ra,(()=>{const e=new ua(15,1e3);return"undefined"!=typeof window&&window.addEventListener("popstate",e.reset),{name:"limitEvents",load:t=>(t.addOnError(function(){return e.increment()}),{reset:e.reset})}})(),pa]}),ya=(e,t)=>{try{ma.leaveBreadcrumb(e,t)}catch(n){n instanceof Error?wa({error:n,severity:"error"}):wa({error:new Error("Unknown error in logging.breadcrumb"),severity:"error",extraData:{originalError:n}})}},wa=async e=>{try{await ma.notify(e.error,t=>(t.severity=e.severity,e.groupingHash&&(t.groupingHash=e.groupingHash),t.metaData={...t.metaData,custom:{...e.extraData,accessToken:ga,environment:va}},!0)),e.error,e.error.message,e.extraData,console.warn}catch(t){t instanceof Error?await wa({error:t,severity:"error"}):await wa({error:new Error("Unknown error in logging.notify"),severity:"error",extraData:{originalError:t}})}},Ca=ba.getPlugin("react"),xa=Ca?.BugsnagErrorBoundary,Ta=(e,t)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`,ka=({extraHeaders:e,authorization:t})=>{const n={...e};return void 0!==t&&(n.Authorization=t),n},Ea=async e=>{const t=await e.json();return e.ok?t:Promise.reject(t)},Aa={"hurdlr-cache-session":!0,"hurdlr-auto-refresh-token":!0};function Sa(e){const t=(({accessToken:e,extraHeaders:t})=>{const n={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${e}`};return void 0!==t?{...w(t,e=>`${e}`),...n}:n})({accessToken:e.accessToken,extraHeaders:{...e.extraHeaders,...e.pagination,..."v5"===e.endpointManager.apiVersion?Aa:{}}});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 Ia({authorization:e,extraHeaders:t,includeCredentials:n,method:r="POST",params:a,url:o}){const i=ka({extraHeaders:t,authorization:e});ya("HTTP POST Request",{url:o,accessToken:e});try{const e=await fetch(o,{method:r,headers:i,credentials:"include",body:JSON.stringify(a)});return ya("HTTP POST Response",{url:o,status:e.status,statusText:e.statusText}),Ea(e)}catch(l){return Promise.reject(l)}}async function Na(e){const{url:t,headers:n}=Sa(e);return Ia({url:t,params:e.bodyParams,includeCredentials:!0,extraHeaders:n})}async function Ra(e){return Na(e)}async function Pa(e){return Na(e)}const Da=(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}),Ma={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"},La={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"},Fa={...La,LOCAL:"http://localhost:8082"};function Oa(e){return Da(`${t=e,Ma[t]}/v5`,"v5");var t}const Va=({filter:e,grouping:t,accountingMethod:n})=>["reports","profitAndLoss",{filter:e,...t&&{grouping:t},accountingMethod:n}],Ua=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/profitAndLoss",bodyParams:{exportType:"JSON",...yt(n.filter),...n.grouping&&{grouping:n.grouping},accountingMethod:n.accountingMethod},accessToken:r,endpointManager:Oa(a)};return await Pa(o)};function Ba({filter:e,grouping:t,select:n,accountingMethod:r}){return Vr({queryKey:Va({filter:e,grouping:t,accountingMethod:r}),queryFn:Ua,select:n})}const Ha="noDataHeight";function Wa(e){const t=Nt(e??"");return null!==t?t.toLocaleString("default",{month:"short"}):""}function za(e){const t=Wa(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?H(t).minus(r).toNumber():0,loss:a,remainingExpenses:void 0!==n?H(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 _a(e){const t={total:0,domain:[],months:[],hasAnyData:!1};if("FAILURE_NO_DATA"===e.result)return t;const n=e.json?.data;if(sr(n))return t;for(const i of n){const{month:e,netIncome:n}=za(i);t.total=H(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 ja="MONTHLY",qa=gr(lr["tile-header"],tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderTopRadius:"lg",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"15px"}));function Ka({title:e}){return I("div",{...qa,children:I(kr,{children:e})})}const Ya=gr(lr["tile-body"],tr({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 Za({children:e}){return I("div",{...Ya,children:e})}const Ga=or({base:{display:"flex",flexDirection:"column",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=gr(lr.tile,Ga({type:t,isSample:n}));return I("div",{...r,children:e})}const Xa=tr({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Ja=tr.raw({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"}),$a=tr.raw({whiteSpace:"normal",overflowWrap:"break-word"}),eo=tr.raw({overflow:"visible",whiteSpace:"nowrap"}),to=tr({fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),no=tr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"}),ro=tr.raw({fontFamily:"body",fontSize:"md",fontStyle:"normal",fontWeight:"md",lineHeight:"template"});tr.raw({fontFamily:"body",fontSize:"sm",fontStyle:"normal",fontWeight:"sm",lineHeight:"template"});const ao=gr(lr.text,tr({fontSize:"md",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa);function oo({children:e}){return I("div",{...ao,children:e})}const io=gr(lr["metric-xl"],xr({metric:"xl"}));function lo(e){return I("div",{...io,children:e.children})}const so=gr(lr.summation,tr({display:"flex",flexDirection:"column",flexShrink:1,alignItems:"flex-start",justifyContent:"space-between"}));function co({title:e,label:t}){return R("div",{...so,children:[I(lo,{children:e}),I(oo,{children:t})]})}const uo=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"start",height:"100%",width:"100%"}));function ho({children:e}){return I("div",{...uo,children:e})}const po=(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},mo=(e,t=0,n=2)=>e.toLocaleString(void 0,{useGrouping:!0,minimumFractionDigits:t,maximumFractionDigits:n}),go=1e9;function vo(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<go&&l>=1e3&&(l/=1e3),o>=go?i="B":o>=1e6?i="M":(l=Math.round(l),i="K"),`${mo(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:po(e,t)}}if("always"===t){const t=2;return{precision:t,minPrecision:2,roundedValue:po(e,t)}}if("default"===t&&Math.abs(e)>=1e3){const t=0;return{precision:t,minPrecision:0,roundedValue:po(e,t)}}{const t=2,n=po(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=mo(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 fo(e){return vo(e,{condense:!0,dollarSign:!0})}function bo(e){return vo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"always"})}function yo(e){return vo(e,{cents:"always",condense:!1,dollarSign:!0,signage:"off"})}function wo(e){return vo(e,{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function Co(e,t){return vo(e,{cents:"always",condense:!1,dollarSign:!0,signage:t})}const xo=or({variants:{wrap:{ellipsis:Ja,wrap:{whiteSpace:"normal",overflowWrap:"break-word"}},textAlign:{start:{textAlign:"start"},center:{textAlign:"center"}}}});function To({wrap:e="ellipsis",textAlign:t="start",children:n,stylists:r=[]}){if(Ir(n))return null;const a=Cr([gr(lr["strong-label"],lr.text,xr({label:"strongLabel"}),xo({wrap:e,textAlign:t})),...r]);return I("div",{title:"ellipsis"===e?n:void 0,...a,children:n})}const ko=or({base:{fontWeight:"label.sub",fontSize:"md",fontFamily:"label",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",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:Ja,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:{whiteSpace:"nowrap",overflow:"visible"},wrapTwice:{ellipsisTextRaw:Ja,whiteSpace:"normal",display:"-webkit-box","-webkit-line-clamp":2,"-webkit-box-orient":"vertical"}}}});function Eo({intent:e="normal",wrap:t="ellipsis",children:n,accent:r}){const a=gr(lr["sub-label"],lr.text,ko({intent:e,wrap:t,accent:r}),Xa);return Ir(n)?null:I("div",{...a,children:n})}const Ao=gr(null,tr({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 So({active:e,payload:t}){if(t.length<=0||!e||t[0].dataKey===Ha)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",{...Ao,children:[I(To,{children:t[0].name??""}),I(Eo,{children:fo(Number(n))})]})}const Io={"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)"},"colors.template.background":{value:"var(--Tight-colors-white200)",variable:"var(--Tight-colors-template-background)"},"colors.template.background.weak":{value:"hsl(from var(--Tight-colors-surface-background) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-background-weak)"},"colors.template.appBackground":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-template-appBackground)"},"colors.template.foreground":{value:"var(--Tight-colors-white100)",variable:"var(--Tight-colors-template-foreground)"},"colors.template.foreground.weak":{value:"hsl(from var(--Tight-colors-template-foreground) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-foreground-weak)"},"colors.template.typography":{value:"var(--Tight-colors-black700)",variable:"var(--Tight-colors-template-typography)"},"colors.template.typography.weak":{value:"hsl(from var(--Tight-colors-template-typography) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-typography-weak)"},"colors.template.brand":{value:"var(--Tight-colors-black600)",variable:"var(--Tight-colors-template-brand)"},"colors.template.brand.weak":{value:"hsl(from var(--Tight-colors-template-brand) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weak)"},"colors.template.brand.strong":{value:"hsl(from var(--Tight-colors-template-brand) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strong)"},"colors.template.brand.weaker":{value:"hsl(from var(--Tight-colors-template-brand-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weaker)"},"colors.template.brand.stronger":{value:"hsl(from var(--Tight-colors-template-brand-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-stronger)"},"colors.template.brand.weakest":{value:"hsl(from var(--Tight-colors-template-brand-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-brand-weakest)"},"colors.template.brand.strongest":{value:"hsl(from var(--Tight-colors-template-brand-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-brand-strongest)"},"colors.template.neutral":{value:"var(--Tight-colors-white600)",variable:"var(--Tight-colors-template-neutral)"},"colors.template.neutral.weak":{value:"hsl(from var(--Tight-colors-template-neutral) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weak)"},"colors.template.neutral.strong":{value:"hsl(from var(--Tight-colors-template-neutral) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strong)"},"colors.template.neutral.weaker":{value:"hsl(from var(--Tight-colors-template-neutral-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weaker)"},"colors.template.neutral.stronger":{value:"hsl(from var(--Tight-colors-template-neutral-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-stronger)"},"colors.template.neutral.weakest":{value:"hsl(from var(--Tight-colors-template-neutral-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-neutral-weakest)"},"colors.template.neutral.strongest":{value:"hsl(from var(--Tight-colors-template-neutral-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-neutral-strongest)"},"colors.template.accent":{value:"var(--Tight-colors-blue400)",variable:"var(--Tight-colors-template-accent)"},"colors.template.accent.weak":{value:"hsl(from var(--Tight-colors-template-accent) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weak)"},"colors.template.accent.strong":{value:"hsl(from var(--Tight-colors-template-accent) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strong)"},"colors.template.accent.weaker":{value:"hsl(from var(--Tight-colors-template-accent-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weaker)"},"colors.template.accent.stronger":{value:"hsl(from var(--Tight-colors-template-accent-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-stronger)"},"colors.template.accent.weakest":{value:"hsl(from var(--Tight-colors-template-accent-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-accent-weakest)"},"colors.template.accent.strongest":{value:"hsl(from var(--Tight-colors-template-accent-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-accent-strongest)"},"colors.template.success":{value:"var(--Tight-colors-green400)",variable:"var(--Tight-colors-template-success)"},"colors.template.success.weak":{value:"hsl(from var(--Tight-colors-template-success) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weak)"},"colors.template.success.strong":{value:"hsl(from var(--Tight-colors-template-success) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strong)"},"colors.template.success.weaker":{value:"hsl(from var(--Tight-colors-template-success-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weaker)"},"colors.template.success.stronger":{value:"hsl(from var(--Tight-colors-template-success-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-stronger)"},"colors.template.success.weakest":{value:"hsl(from var(--Tight-colors-template-success-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-success-weakest)"},"colors.template.success.strongest":{value:"hsl(from var(--Tight-colors-template-success-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-success-strongest)"},"colors.template.warning":{value:"var(--Tight-colors-yellow400)",variable:"var(--Tight-colors-template-warning)"},"colors.template.warning.weak":{value:"hsl(from var(--Tight-colors-template-warning) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weak)"},"colors.template.warning.strong":{value:"hsl(from var(--Tight-colors-template-warning) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strong)"},"colors.template.warning.weaker":{value:"hsl(from var(--Tight-colors-template-warning-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weaker)"},"colors.template.warning.stronger":{value:"hsl(from var(--Tight-colors-template-warning-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-stronger)"},"colors.template.warning.weakest":{value:"hsl(from var(--Tight-colors-template-warning-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-warning-weakest)"},"colors.template.warning.strongest":{value:"hsl(from var(--Tight-colors-template-warning-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-warning-strongest)"},"colors.template.danger":{value:"var(--Tight-colors-red400)",variable:"var(--Tight-colors-template-danger)"},"colors.template.danger.weak":{value:"hsl(from var(--Tight-colors-template-danger) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weak)"},"colors.template.danger.strong":{value:"hsl(from var(--Tight-colors-template-danger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strong)"},"colors.template.danger.weaker":{value:"hsl(from var(--Tight-colors-template-danger-weak) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weaker)"},"colors.template.danger.stronger":{value:"hsl(from var(--Tight-colors-template-danger-strong) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-stronger)"},"colors.template.danger.weakest":{value:"hsl(from var(--Tight-colors-template-danger-weaker) h max(calc(s - 5), 0) min(calc(l + 12), 93))",variable:"var(--Tight-colors-template-danger-weakest)"},"colors.template.danger.strongest":{value:"hsl(from var(--Tight-colors-template-danger-stronger) h min(calc(s + 5), 100) max(calc(l - 18), 5))",variable:"var(--Tight-colors-template-danger-strongest)"},"lineHeights.template":{value:"normal",variable:"var(--Tight-lineHeights-template)"},"letterSpacings.template":{value:"normal",variable:"var(--Tight-letterSpacings-template)"},"fonts.template":{value:"Duplet Regular, sans-serif",variable:"var(--Tight-fonts-template)"},"fonts.base":{value:"var(--Tight-fonts-template)",variable:"var(--Tight-fonts-base)"},"fontSizes.template":{value:"16px",variable:"var(--Tight-fontSizes-template)"},"fontSizes.template.xs":{value:"calc(calc(var(--Tight-fontSizes-template) - 2px) - 2px)",variable:"var(--Tight-fontSizes-template-xs)"},"fontSizes.template.sm":{value:"calc(var(--Tight-fontSizes-template) - 2px)",variable:"var(--Tight-fontSizes-template-sm)"},"fontSizes.template.lg":{value:"calc(var(--Tight-fontSizes-template) + 4px)",variable:"var(--Tight-fontSizes-template-lg)"},"fontSizes.template.xl":{value:"calc(var(--Tight-fontSizes-template-lg) + 4px)",variable:"var(--Tight-fontSizes-template-xl)"},"fontSizes.sm":{value:"var(--Tight-fontSizes-template-xs)",variable:"var(--Tight-fontSizes-sm)"},"fontSizes.md":{value:"var(--Tight-fontSizes-template-sm)",variable:"var(--Tight-fontSizes-md)"},"fontSizes.lg":{value:"var(--Tight-fontSizes-template)",variable:"var(--Tight-fontSizes-lg)"},"fontSizes.xl":{value:"var(--Tight-fontSizes-template-lg)",variable:"var(--Tight-fontSizes-xl)"},"fontSizes.2xl":{value:"var(--Tight-fontSizes-template-xl)",variable:"var(--Tight-fontSizes-2xl)"},"fontWeights.template.sm":{value:"400",variable:"var(--Tight-fontWeights-template-sm)"},"fontWeights.template.md":{value:"600",variable:"var(--Tight-fontWeights-template-md)"},"fontWeights.template.lg":{value:"900",variable:"var(--Tight-fontWeights-template-lg)"},"fontWeights.sm":{value:"var(--Tight-fontWeights-template-sm)",variable:"var(--Tight-fontWeights-sm)"},"fontWeights.md":{value:"var(--Tight-fontWeights-template-md)",variable:"var(--Tight-fontWeights-md)"},"fontWeights.lg":{value:"var(--Tight-fontWeights-template-lg)",variable:"var(--Tight-fontWeights-lg)"},"radii.zero":{value:"0",variable:"var(--Tight-radii-zero)"},"radii.full":{value:"9999px",variable:"var(--Tight-radii-full)"},"radii.template":{value:"4px",variable:"var(--Tight-radii-template)"},"radii.template.sm":{value:"var(--Tight-radii-template-sm)",variable:"var(--Tight-radii-template-sm)"},"radii.template.md":{value:"var(--Tight-radii-template-md)",variable:"var(--Tight-radii-template-md)"},"radii.template.lg":{value:"var(--Tight-radii-template-lg)",variable:"var(--Tight-radii-template-lg)"},"radii.sm":{value:"var(--Tight-radii-template-sm)",variable:"var(--Tight-radii-sm)"},"radii.md":{value:"var(--Tight-radii-template-md)",variable:"var(--Tight-radii-md)"},"radii.lg":{value:"var(--Tight-radii-template-lg)",variable:"var(--Tight-radii-lg)"},"borderWidths.template":{value:"1px",variable:"var(--Tight-borderWidths-template)"},"borderWidths.template.sm":{value:"var(--Tight-borderWidths-template-sm)",variable:"var(--Tight-borderWidths-template-sm)"},"borderWidths.template.md":{value:"var(--Tight-borderWidths-template-md)",variable:"var(--Tight-borderWidths-template-md)"},"borderWidths.template.lg":{value:"var(--Tight-borderWidths-template-lg)",variable:"var(--Tight-borderWidths-template-lg)"},"borderWidths.template.xl":{value:"var(--Tight-borderWidths-template-xl)",variable:"var(--Tight-borderWidths-template-xl)"},"borderWidths.sm":{value:"var(--Tight-borderWidths-template-sm)",variable:"var(--Tight-borderWidths-sm)"},"borderWidths.md":{value:"var(--Tight-borderWidths-template-md)",variable:"var(--Tight-borderWidths-md)"},"borderWidths.lg":{value:"var(--Tight-borderWidths-template-lg)",variable:"var(--Tight-borderWidths-lg)"},"borderWidths.xl":{value:"var(--Tight-borderWidths-template-xl)",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)"},"durations.toast.enter":{value:"250ms",variable:"var(--Tight-durations-toast-enter)"},"durations.toast.exit":{value:"200ms",variable:"var(--Tight-durations-toast-exit)"},"easings.toast.enter":{value:"ease-out",variable:"var(--Tight-easings-toast-enter)"},"easings.toast.exit":{value:"ease-in",variable:"var(--Tight-easings-toast-exit)"},"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-brand-primary-weaker)",variable:"var(--Tight-colors-brand-primary-weaker)"},"colors.brand.primary.weak":{value:"var(--Tight-colors-brand-primary-weak)",variable:"var(--Tight-colors-brand-primary-weak)"},"colors.brand.primary":{value:"var(--Tight-colors-brand-primary)",variable:"var(--Tight-colors-brand-primary)"},"colors.brand.primary.strong":{value:"var(--Tight-colors-brand-primary-strong)",variable:"var(--Tight-colors-brand-primary-strong)"},"colors.brand.primary.stronger":{value:"var(--Tight-colors-brand-primary-stronger)",variable:"var(--Tight-colors-brand-primary-stronger)"},"colors.brand.secondary.weaker":{value:"var(--Tight-colors-brand-secondary-weaker)",variable:"var(--Tight-colors-brand-secondary-weaker)"},"colors.brand.secondary.weak":{value:"var(--Tight-colors-brand-secondary-weak)",variable:"var(--Tight-colors-brand-secondary-weak)"},"colors.brand.secondary":{value:"var(--Tight-colors-brand-secondary)",variable:"var(--Tight-colors-brand-secondary)"},"colors.brand.secondary.strong":{value:"var(--Tight-colors-brand-secondary-strong)",variable:"var(--Tight-colors-brand-secondary-strong)"},"colors.brand.action.opaque":{value:"var(--Tight-colors-brand-action-opaque)",variable:"var(--Tight-colors-brand-action-opaque)"},"colors.brand.action.weaker":{value:"var(--Tight-colors-brand-action-weaker)",variable:"var(--Tight-colors-brand-action-weaker)"},"colors.brand.action.weak":{value:"var(--Tight-colors-brand-action-weak)",variable:"var(--Tight-colors-brand-action-weak)"},"colors.brand.action":{value:"var(--Tight-colors-brand-action)",variable:"var(--Tight-colors-brand-action)"},"colors.brand.action.strong":{value:"var(--Tight-colors-brand-action-strong)",variable:"var(--Tight-colors-brand-action-strong)"},"colors.brand.action.stronger":{value:"var(--Tight-colors-brand-action-stronger)",variable:"var(--Tight-colors-brand-action-stronger)"},"colors.brand.action.strongest":{value:"var(--Tight-colors-brand-action-strongest)",variable:"var(--Tight-colors-brand-action-strongest)"},"colors.brand.success.opaque":{value:"var(--Tight-colors-brand-success-opaque)",variable:"var(--Tight-colors-brand-success-opaque)"},"colors.brand.success.weaker":{value:"var(--Tight-colors-brand-success-weaker)",variable:"var(--Tight-colors-brand-success-weaker)"},"colors.brand.success.weak":{value:"var(--Tight-colors-brand-success-weak)",variable:"var(--Tight-colors-brand-success-weak)"},"colors.brand.success":{value:"var(--Tight-colors-brand-success)",variable:"var(--Tight-colors-brand-success)"},"colors.brand.success.strong":{value:"var(--Tight-colors-brand-success-strong)",variable:"var(--Tight-colors-brand-success-strong)"},"colors.brand.success.stronger":{value:"var(--Tight-colors-brand-success-stronger)",variable:"var(--Tight-colors-brand-success-stronger)"},"colors.brand.success.strongest":{value:"var(--Tight-colors-brand-success-strongest)",variable:"var(--Tight-colors-brand-success-strongest)"},"colors.brand.warning.opaque":{value:"var(--Tight-colors-brand-warning-opaque)",variable:"var(--Tight-colors-brand-warning-opaque)"},"colors.brand.warning.weaker":{value:"var(--Tight-colors-brand-warning-weaker)",variable:"var(--Tight-colors-brand-warning-weaker)"},"colors.brand.warning.weak":{value:"var(--Tight-colors-brand-warning-weak)",variable:"var(--Tight-colors-brand-warning-weak)"},"colors.brand.warning":{value:"var(--Tight-colors-brand-warning)",variable:"var(--Tight-colors-brand-warning)"},"colors.brand.warning.strong":{value:"var(--Tight-colors-brand-warning-strong)",variable:"var(--Tight-colors-brand-warning-strong)"},"colors.brand.warning.stronger":{value:"var(--Tight-colors-brand-warning-stronger)",variable:"var(--Tight-colors-brand-warning-stronger)"},"colors.brand.warning.strongest":{value:"var(--Tight-colors-brand-warning-strongest)",variable:"var(--Tight-colors-brand-warning-strongest)"},"colors.brand.danger.opaque":{value:"var(--Tight-colors-brand-danger-opaque)",variable:"var(--Tight-colors-brand-danger-opaque)"},"colors.brand.danger.weaker":{value:"var(--Tight-colors-brand-danger-weaker)",variable:"var(--Tight-colors-brand-danger-weaker)"},"colors.brand.danger.weak":{value:"var(--Tight-colors-brand-danger-weak)",variable:"var(--Tight-colors-brand-danger-weak)"},"colors.brand.danger":{value:"var(--Tight-colors-brand-danger)",variable:"var(--Tight-colors-brand-danger)"},"colors.brand.danger.strong":{value:"var(--Tight-colors-brand-danger-strong)",variable:"var(--Tight-colors-brand-danger-strong)"},"colors.brand.danger.stronger":{value:"var(--Tight-colors-brand-danger-stronger)",variable:"var(--Tight-colors-brand-danger-stronger)"},"colors.surface.background":{value:"var(--Tight-colors-surface-background)",variable:"var(--Tight-colors-surface-background)"},"colors.surface.background.hover":{value:"var(--Tight-colors-surface-background-hover)",variable:"var(--Tight-colors-surface-background-hover)"},"colors.surface.foreground":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-foreground)"},"colors.surface.foreground.hover":{value:"var(--Tight-colors-surface-foreground-hover)",variable:"var(--Tight-colors-surface-foreground-hover)"},"colors.surface.foreground.disabled":{value:"var(--Tight-colors-surface-foreground-disabled)",variable:"var(--Tight-colors-surface-foreground-disabled)"},"colors.surface.elevated":{value:"var(--Tight-colors-surface-elevated)",variable:"var(--Tight-colors-surface-elevated)"},"colors.surface.elevated.hover":{value:"var(--Tight-colors-surface-elevated-hover)",variable:"var(--Tight-colors-surface-elevated-hover)"},"colors.surface.intent.primary":{value:"var(--Tight-colors-surface-intent-primary)",variable:"var(--Tight-colors-surface-intent-primary)"},"colors.surface.intent.primary.hover":{value:"var(--Tight-colors-surface-intent-primary-hover)",variable:"var(--Tight-colors-surface-intent-primary-hover)"},"colors.surface.intent.primary.active":{value:"var(--Tight-colors-surface-intent-primary-active)",variable:"var(--Tight-colors-surface-intent-primary-active)"},"colors.surface.intent.primary.disabled":{value:"var(--Tight-colors-surface-intent-primary-disabled)",variable:"var(--Tight-colors-surface-intent-primary-disabled)"},"colors.surface.intent.secondary":{value:"var(--Tight-colors-surface-intent-secondary)",variable:"var(--Tight-colors-surface-intent-secondary)"},"colors.surface.intent.secondary.hover":{value:"var(--Tight-colors-surface-intent-secondary-hover)",variable:"var(--Tight-colors-surface-intent-secondary-hover)"},"colors.surface.intent.secondary.active":{value:"var(--Tight-colors-surface-intent-secondary-active)",variable:"var(--Tight-colors-surface-intent-secondary-active)"},"colors.surface.intent.secondary.disabled":{value:"var(--Tight-colors-surface-intent-secondary-disabled)",variable:"var(--Tight-colors-surface-intent-secondary-disabled)"},"colors.surface.intent.action":{value:"var(--Tight-colors-surface-intent-action)",variable:"var(--Tight-colors-surface-intent-action)"},"colors.surface.intent.action.hover":{value:"var(--Tight-colors-surface-intent-action-hover)",variable:"var(--Tight-colors-surface-intent-action-hover)"},"colors.surface.intent.action.active":{value:"var(--Tight-colors-surface-intent-action-active)",variable:"var(--Tight-colors-surface-intent-action-active)"},"colors.surface.intent.action.disabled":{value:"var(--Tight-colors-surface-intent-action-disabled)",variable:"var(--Tight-colors-surface-intent-action-disabled)"},"colors.surface.intent.action.discreet":{value:"var(--Tight-colors-surface-intent-action-discreet)",variable:"var(--Tight-colors-surface-intent-action-discreet)"},"colors.surface.intent.action.discreet.hover":{value:"var(--Tight-colors-surface-intent-action-discreet-hover)",variable:"var(--Tight-colors-surface-intent-action-discreet-hover)"},"colors.surface.intent.action.discreet.active":{value:"var(--Tight-colors-surface-intent-action-discreet-active)",variable:"var(--Tight-colors-surface-intent-action-discreet-active)"},"colors.surface.intent.action.highlight":{value:"var(--Tight-colors-surface-intent-action-highlight)",variable:"var(--Tight-colors-surface-intent-action-highlight)"},"colors.surface.intent.success":{value:"var(--Tight-colors-surface-intent-success)",variable:"var(--Tight-colors-surface-intent-success)"},"colors.surface.intent.success.hover":{value:"var(--Tight-colors-surface-intent-success-hover)",variable:"var(--Tight-colors-surface-intent-success-hover)"},"colors.surface.intent.success.active":{value:"var(--Tight-colors-surface-intent-success-active)",variable:"var(--Tight-colors-surface-intent-success-active)"},"colors.surface.intent.success.disabled":{value:"var(--Tight-colors-surface-intent-success-disabled)",variable:"var(--Tight-colors-surface-intent-success-disabled)"},"colors.surface.intent.success.highlight":{value:"var(--Tight-colors-surface-intent-success-highlight)",variable:"var(--Tight-colors-surface-intent-success-highlight)"},"colors.surface.intent.warning":{value:"var(--Tight-colors-surface-intent-warning)",variable:"var(--Tight-colors-surface-intent-warning)"},"colors.surface.intent.warning.hover":{value:"var(--Tight-colors-surface-intent-warning-hover)",variable:"var(--Tight-colors-surface-intent-warning-hover)"},"colors.surface.intent.warning.active":{value:"var(--Tight-colors-surface-intent-warning-active)",variable:"var(--Tight-colors-surface-intent-warning-active)"},"colors.surface.intent.warning.disabled":{value:"var(--Tight-colors-surface-intent-warning-disabled)",variable:"var(--Tight-colors-surface-intent-warning-disabled)"},"colors.surface.intent.warning.highlight":{value:"var(--Tight-colors-surface-intent-warning-highlight)",variable:"var(--Tight-colors-surface-intent-warning-highlight)"},"colors.surface.intent.danger":{value:"var(--Tight-colors-surface-intent-danger)",variable:"var(--Tight-colors-surface-intent-danger)"},"colors.surface.intent.danger.hover":{value:"var(--Tight-colors-surface-intent-danger-hover)",variable:"var(--Tight-colors-surface-intent-danger-hover)"},"colors.surface.intent.danger.active":{value:"var(--Tight-colors-surface-intent-danger-active)",variable:"var(--Tight-colors-surface-intent-danger-active)"},"colors.surface.intent.danger.disabled":{value:"var(--Tight-colors-surface-intent-danger-disabled)",variable:"var(--Tight-colors-surface-intent-danger-disabled)"},"colors.surface.intent.danger.weak":{value:"var(--Tight-colors-surface-intent-danger-weak)",variable:"var(--Tight-colors-surface-intent-danger-weak)"},"colors.surface.intent.danger.highlight":{value:"var(--Tight-colors-surface-intent-danger-highlight)",variable:"var(--Tight-colors-surface-intent-danger-highlight)"},"colors.surface.intent.notification":{value:"var(--Tight-colors-surface-foreground)",variable:"var(--Tight-colors-surface-intent-notification)"},"colors.surface.reports.alternateRows":{value:"var(--Tight-colors-surface-reports-alternateRows)",variable:"var(--Tight-colors-surface-reports-alternateRows)"},"colors.typography.base":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-base)"},"colors.typography.base.weak":{value:"var(--Tight-colors-typography-base-weak)",variable:"var(--Tight-colors-typography-base-weak)"},"colors.typography.contrast":{value:"var(--Tight-colors-typography-contrast)",variable:"var(--Tight-colors-typography-contrast)"},"colors.typography.contrast.weak":{value:"var(--Tight-colors-typography-contrast-weak)",variable:"var(--Tight-colors-typography-contrast-weak)"},"colors.typography.intent.primary":{value:"var(--Tight-colors-typography-intent-primary)",variable:"var(--Tight-colors-typography-intent-primary)"},"colors.typography.intent.primary.hover":{value:"var(--Tight-colors-typography-intent-primary-hover)",variable:"var(--Tight-colors-typography-intent-primary-hover)"},"colors.typography.intent.primary.active":{value:"var(--Tight-colors-typography-intent-primary-active)",variable:"var(--Tight-colors-typography-intent-primary-active)"},"colors.typography.intent.secondary":{value:"var(--Tight-colors-typography-intent-secondary)",variable:"var(--Tight-colors-typography-intent-secondary)"},"colors.typography.intent.secondary.hover":{value:"var(--Tight-colors-typography-intent-secondary-hover)",variable:"var(--Tight-colors-typography-intent-secondary-hover)"},"colors.typography.intent.secondary.active":{value:"var(--Tight-colors-typography-intent-secondary-active)",variable:"var(--Tight-colors-typography-intent-secondary-active)"},"colors.typography.intent.action":{value:"var(--Tight-colors-typography-intent-action)",variable:"var(--Tight-colors-typography-intent-action)"},"colors.typography.intent.action.hover":{value:"var(--Tight-colors-typography-intent-action-hover)",variable:"var(--Tight-colors-typography-intent-action-hover)"},"colors.typography.intent.action.active":{value:"var(--Tight-colors-typography-intent-action-active)",variable:"var(--Tight-colors-typography-intent-action-active)"},"colors.typography.intent.success":{value:"var(--Tight-colors-typography-intent-success)",variable:"var(--Tight-colors-typography-intent-success)"},"colors.typography.intent.success.hover":{value:"var(--Tight-colors-typography-intent-success-hover)",variable:"var(--Tight-colors-typography-intent-success-hover)"},"colors.typography.intent.success.active":{value:"var(--Tight-colors-typography-intent-success-active)",variable:"var(--Tight-colors-typography-intent-success-active)"},"colors.typography.intent.warning":{value:"var(--Tight-colors-typography-intent-warning)",variable:"var(--Tight-colors-typography-intent-warning)"},"colors.typography.intent.warning.hover":{value:"var(--Tight-colors-typography-intent-warning-hover)",variable:"var(--Tight-colors-typography-intent-warning-hover)"},"colors.typography.intent.warning.active":{value:"var(--Tight-colors-typography-intent-warning-active)",variable:"var(--Tight-colors-typography-intent-warning-active)"},"colors.typography.intent.danger":{value:"var(--Tight-colors-typography-intent-danger)",variable:"var(--Tight-colors-typography-intent-danger)"},"colors.typography.intent.danger.hover":{value:"var(--Tight-colors-typography-intent-danger-hover)",variable:"var(--Tight-colors-typography-intent-danger-hover)"},"colors.typography.intent.danger.active":{value:"var(--Tight-colors-typography-intent-danger-active)",variable:"var(--Tight-colors-typography-intent-danger-active)"},"colors.typography.intent.notification":{value:"var(--Tight-colors-typography-base)",variable:"var(--Tight-colors-typography-intent-notification)"},"colors.typography.accent.success":{value:"var(--Tight-colors-typography-accent-success)",variable:"var(--Tight-colors-typography-accent-success)"},"colors.typography.accent.warning":{value:"var(--Tight-colors-typography-accent-warning)",variable:"var(--Tight-colors-typography-accent-warning)"},"colors.typography.accent.danger":{value:"var(--Tight-colors-typography-accent-danger)",variable:"var(--Tight-colors-typography-accent-danger)"},"colors.typography.accent.action":{value:"var(--Tight-colors-typography-accent-action)",variable:"var(--Tight-colors-typography-accent-action)"},"colors.typography.body":{value:"var(--Tight-colors-typography-body)",variable:"var(--Tight-colors-typography-body)"},"colors.typography.label":{value:"var(--Tight-colors-typography-label)",variable:"var(--Tight-colors-typography-label)"},"colors.typography.label.sub":{value:"var(--Tight-colors-typography-label-sub)",variable:"var(--Tight-colors-typography-label-sub)"},"colors.typography.label.strong":{value:"var(--Tight-colors-typography-label-strong)",variable:"var(--Tight-colors-typography-label-strong)"},"colors.typography.label.strongSub":{value:"var(--Tight-colors-typography-label-strongSub)",variable:"var(--Tight-colors-typography-label-strongSub)"},"colors.typography.label.emphasisSub":{value:"var(--Tight-colors-typography-label-emphasisSub)",variable:"var(--Tight-colors-typography-label-emphasisSub)"},"colors.typography.heading":{value:"var(--Tight-colors-typography-heading)",variable:"var(--Tight-colors-typography-heading)"},"colors.typography.metric.sm":{value:"var(--Tight-colors-typography-metric-sm)",variable:"var(--Tight-colors-typography-metric-sm)"},"colors.typography.metric.md":{value:"var(--Tight-colors-typography-metric-md)",variable:"var(--Tight-colors-typography-metric-md)"},"colors.typography.metric.lg":{value:"var(--Tight-colors-typography-metric-lg)",variable:"var(--Tight-colors-typography-metric-lg)"},"colors.typography.metric.xl":{value:"var(--Tight-colors-typography-metric-xl)",variable:"var(--Tight-colors-typography-metric-xl)"},"colors.icon.base":{value:"var(--Tight-colors-icon-base)",variable:"var(--Tight-colors-icon-base)"},"colors.icon.base.weak":{value:"var(--Tight-colors-icon-base-weak)",variable:"var(--Tight-colors-icon-base-weak)"},"colors.icon.contrast":{value:"var(--Tight-colors-icon-contrast)",variable:"var(--Tight-colors-icon-contrast)"},"colors.icon.contrast.weak":{value:"var(--Tight-colors-icon-contrast-weak)",variable:"var(--Tight-colors-icon-contrast-weak)"},"colors.icon.intent.primary":{value:"var(--Tight-colors-icon-intent-primary)",variable:"var(--Tight-colors-icon-intent-primary)"},"colors.icon.intent.primary.hover":{value:"var(--Tight-colors-icon-intent-primary-hover)",variable:"var(--Tight-colors-icon-intent-primary-hover)"},"colors.icon.intent.primary.active":{value:"var(--Tight-colors-icon-intent-primary-active)",variable:"var(--Tight-colors-icon-intent-primary-active)"},"colors.icon.intent.secondary":{value:"var(--Tight-colors-icon-intent-secondary)",variable:"var(--Tight-colors-icon-intent-secondary)"},"colors.icon.intent.secondary.hover":{value:"var(--Tight-colors-icon-intent-secondary-hover)",variable:"var(--Tight-colors-icon-intent-secondary-hover)"},"colors.icon.intent.secondary.active":{value:"var(--Tight-colors-icon-intent-secondary-active)",variable:"var(--Tight-colors-icon-intent-secondary-active)"},"colors.icon.intent.action":{value:"var(--Tight-colors-icon-intent-action)",variable:"var(--Tight-colors-icon-intent-action)"},"colors.icon.intent.action.hover":{value:"var(--Tight-colors-icon-intent-action-hover)",variable:"var(--Tight-colors-icon-intent-action-hover)"},"colors.icon.intent.action.active":{value:"var(--Tight-colors-icon-intent-action-active)",variable:"var(--Tight-colors-icon-intent-action-active)"},"colors.icon.intent.success":{value:"var(--Tight-colors-icon-intent-success)",variable:"var(--Tight-colors-icon-intent-success)"},"colors.icon.intent.success.hover":{value:"var(--Tight-colors-icon-intent-success-hover)",variable:"var(--Tight-colors-icon-intent-success-hover)"},"colors.icon.intent.success.active":{value:"var(--Tight-colors-icon-intent-success-active)",variable:"var(--Tight-colors-icon-intent-success-active)"},"colors.icon.intent.warning":{value:"var(--Tight-colors-icon-intent-warning)",variable:"var(--Tight-colors-icon-intent-warning)"},"colors.icon.intent.warning.hover":{value:"var(--Tight-colors-icon-intent-warning-hover)",variable:"var(--Tight-colors-icon-intent-warning-hover)"},"colors.icon.intent.warning.active":{value:"var(--Tight-colors-icon-intent-warning-active)",variable:"var(--Tight-colors-icon-intent-warning-active)"},"colors.icon.intent.danger":{value:"var(--Tight-colors-icon-intent-danger)",variable:"var(--Tight-colors-icon-intent-danger)"},"colors.icon.intent.danger.hover":{value:"var(--Tight-colors-icon-intent-danger-hover)",variable:"var(--Tight-colors-icon-intent-danger-hover)"},"colors.icon.intent.danger.active":{value:"var(--Tight-colors-icon-intent-danger-active)",variable:"var(--Tight-colors-icon-intent-danger-active)"},"colors.icon.accent.success":{value:"var(--Tight-colors-icon-accent-success)",variable:"var(--Tight-colors-icon-accent-success)"},"colors.icon.accent.warning":{value:"var(--Tight-colors-icon-accent-warning)",variable:"var(--Tight-colors-icon-accent-warning)"},"colors.icon.accent.danger":{value:"var(--Tight-colors-icon-accent-danger)",variable:"var(--Tight-colors-icon-accent-danger)"},"colors.border.layout.weak":{value:"var(--Tight-colors-border-layout-weak)",variable:"var(--Tight-colors-border-layout-weak)"},"colors.border.layout":{value:"var(--Tight-colors-border-layout)",variable:"var(--Tight-colors-border-layout)"},"colors.border.layout.strong":{value:"var(--Tight-colors-border-layout-strong)",variable:"var(--Tight-colors-border-layout-strong)"},"colors.border.intent.primary.hover":{value:"var(--Tight-colors-border-intent-primary-hover)",variable:"var(--Tight-colors-border-intent-primary-hover)"},"colors.border.intent.primary":{value:"var(--Tight-colors-border-intent-primary)",variable:"var(--Tight-colors-border-intent-primary)"},"colors.border.intent.primary.active":{value:"var(--Tight-colors-border-intent-primary-active)",variable:"var(--Tight-colors-border-intent-primary-active)"},"colors.border.intent.primary.disabled":{value:"var(--Tight-colors-border-intent-primary-disabled)",variable:"var(--Tight-colors-border-intent-primary-disabled)"},"colors.border.intent.secondary.hover":{value:"var(--Tight-colors-border-intent-secondary-hover)",variable:"var(--Tight-colors-border-intent-secondary-hover)"},"colors.border.intent.secondary":{value:"var(--Tight-colors-border-intent-secondary)",variable:"var(--Tight-colors-border-intent-secondary)"},"colors.border.intent.secondary.active":{value:"var(--Tight-colors-border-intent-secondary-active)",variable:"var(--Tight-colors-border-intent-secondary-active)"},"colors.border.intent.secondary.disabled":{value:"var(--Tight-colors-border-intent-secondary-disabled)",variable:"var(--Tight-colors-border-intent-secondary-disabled)"},"colors.border.intent.danger.hover":{value:"var(--Tight-colors-border-intent-danger-hover)",variable:"var(--Tight-colors-border-intent-danger-hover)"},"colors.border.intent.danger":{value:"var(--Tight-colors-border-intent-danger)",variable:"var(--Tight-colors-border-intent-danger)"},"colors.border.intent.danger.active":{value:"var(--Tight-colors-border-intent-danger-active)",variable:"var(--Tight-colors-border-intent-danger-active)"},"colors.border.intent.danger.disabled":{value:"var(--Tight-colors-border-intent-danger-disabled)",variable:"var(--Tight-colors-border-intent-danger-disabled)"},"colors.border.intent.warning.hover":{value:"var(--Tight-colors-border-intent-warning-hover)",variable:"var(--Tight-colors-border-intent-warning-hover)"},"colors.border.intent.warning":{value:"var(--Tight-colors-border-intent-warning)",variable:"var(--Tight-colors-border-intent-warning)"},"colors.border.intent.warning.active":{value:"var(--Tight-colors-border-intent-warning-active)",variable:"var(--Tight-colors-border-intent-warning-active)"},"colors.border.intent.warning.disabled":{value:"var(--Tight-colors-border-intent-warning-disabled)",variable:"var(--Tight-colors-border-intent-warning-disabled)"},"colors.border.intent.success.hover":{value:"var(--Tight-colors-border-intent-success-hover)",variable:"var(--Tight-colors-border-intent-success-hover)"},"colors.border.intent.success":{value:"var(--Tight-colors-border-intent-success)",variable:"var(--Tight-colors-border-intent-success)"},"colors.border.intent.success.active":{value:"var(--Tight-colors-border-intent-success-active)",variable:"var(--Tight-colors-border-intent-success-active)"},"colors.border.intent.success.disabled":{value:"var(--Tight-colors-border-intent-success-disabled)",variable:"var(--Tight-colors-border-intent-success-disabled)"},"colors.border.intent.action.hover":{value:"var(--Tight-colors-border-intent-action-hover)",variable:"var(--Tight-colors-border-intent-action-hover)"},"colors.border.intent.action":{value:"var(--Tight-colors-border-intent-action)",variable:"var(--Tight-colors-border-intent-action)"},"colors.border.intent.action.active":{value:"var(--Tight-colors-border-intent-action-active)",variable:"var(--Tight-colors-border-intent-action-active)"},"colors.border.intent.action.disabled":{value:"var(--Tight-colors-border-intent-action-disabled)",variable:"var(--Tight-colors-border-intent-action-disabled)"},"colors.money":{value:"var(--Tight-colors-money)",variable:"var(--Tight-colors-money)"},"colors.money.positive":{value:"var(--Tight-colors-money-positive)",variable:"var(--Tight-colors-money-positive)"},"colors.money.positive.weak":{value:"var(--Tight-colors-money-positive-weak)",variable:"var(--Tight-colors-money-positive-weak)"},"colors.money.positive.strong":{value:"var(--Tight-colors-money-positive-strong)",variable:"var(--Tight-colors-money-positive-strong)"},"colors.money.negative":{value:"var(--Tight-colors-money-negative)",variable:"var(--Tight-colors-money-negative)"},"colors.money.negative.weak":{value:"var(--Tight-colors-money-negative-weak)",variable:"var(--Tight-colors-money-negative-weak)"},"colors.money.negative.strong":{value:"var(--Tight-colors-money-negative-strong)",variable:"var(--Tight-colors-money-negative-strong)"},"colors.overlay":{value:"var(--Tight-colors-overlay)",variable:"var(--Tight-colors-overlay)"},"colors.transparent":{value:"var(--Tight-colors-transparent)",variable:"var(--Tight-colors-transparent)"},"colors.none":{value:"var(--Tight-colors-none)",variable:"var(--Tight-colors-none)"},"colors.currentColor":{value:"var(--Tight-colors-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.background":{value:"var(--Tight-colors-colorPalette-background)",variable:"var(--Tight-colors-colorPalette-background)"},"colors.colorPalette.background.weak":{value:"var(--Tight-colors-colorPalette-background-weak)",variable:"var(--Tight-colors-colorPalette-background-weak)"},"colors.colorPalette.weak":{value:"var(--Tight-colors-colorPalette-weak)",variable:"var(--Tight-colors-colorPalette-weak)"},"colors.colorPalette.appBackground":{value:"var(--Tight-colors-colorPalette-appBackground)",variable:"var(--Tight-colors-colorPalette-appBackground)"},"colors.colorPalette.foreground":{value:"var(--Tight-colors-colorPalette-foreground)",variable:"var(--Tight-colors-colorPalette-foreground)"},"colors.colorPalette.foreground.weak":{value:"var(--Tight-colors-colorPalette-foreground-weak)",variable:"var(--Tight-colors-colorPalette-foreground-weak)"},"colors.colorPalette.typography":{value:"var(--Tight-colors-colorPalette-typography)",variable:"var(--Tight-colors-colorPalette-typography)"},"colors.colorPalette.typography.weak":{value:"var(--Tight-colors-colorPalette-typography-weak)",variable:"var(--Tight-colors-colorPalette-typography-weak)"},"colors.colorPalette.brand":{value:"var(--Tight-colors-colorPalette-brand)",variable:"var(--Tight-colors-colorPalette-brand)"},"colors.colorPalette.brand.weak":{value:"var(--Tight-colors-colorPalette-brand-weak)",variable:"var(--Tight-colors-colorPalette-brand-weak)"},"colors.colorPalette.brand.strong":{value:"var(--Tight-colors-colorPalette-brand-strong)",variable:"var(--Tight-colors-colorPalette-brand-strong)"},"colors.colorPalette.strong":{value:"var(--Tight-colors-colorPalette-strong)",variable:"var(--Tight-colors-colorPalette-strong)"},"colors.colorPalette.brand.weaker":{value:"var(--Tight-colors-colorPalette-brand-weaker)",variable:"var(--Tight-colors-colorPalette-brand-weaker)"},"colors.colorPalette.weaker":{value:"var(--Tight-colors-colorPalette-weaker)",variable:"var(--Tight-colors-colorPalette-weaker)"},"colors.colorPalette.brand.stronger":{value:"var(--Tight-colors-colorPalette-brand-stronger)",variable:"var(--Tight-colors-colorPalette-brand-stronger)"},"colors.colorPalette.stronger":{value:"var(--Tight-colors-colorPalette-stronger)",variable:"var(--Tight-colors-colorPalette-stronger)"},"colors.colorPalette.brand.weakest":{value:"var(--Tight-colors-colorPalette-brand-weakest)",variable:"var(--Tight-colors-colorPalette-brand-weakest)"},"colors.colorPalette.weakest":{value:"var(--Tight-colors-colorPalette-weakest)",variable:"var(--Tight-colors-colorPalette-weakest)"},"colors.colorPalette.brand.strongest":{value:"var(--Tight-colors-colorPalette-brand-strongest)",variable:"var(--Tight-colors-colorPalette-brand-strongest)"},"colors.colorPalette.strongest":{value:"var(--Tight-colors-colorPalette-strongest)",variable:"var(--Tight-colors-colorPalette-strongest)"},"colors.colorPalette.neutral":{value:"var(--Tight-colors-colorPalette-neutral)",variable:"var(--Tight-colors-colorPalette-neutral)"},"colors.colorPalette.neutral.weak":{value:"var(--Tight-colors-colorPalette-neutral-weak)",variable:"var(--Tight-colors-colorPalette-neutral-weak)"},"colors.colorPalette.neutral.strong":{value:"var(--Tight-colors-colorPalette-neutral-strong)",variable:"var(--Tight-colors-colorPalette-neutral-strong)"},"colors.colorPalette.neutral.weaker":{value:"var(--Tight-colors-colorPalette-neutral-weaker)",variable:"var(--Tight-colors-colorPalette-neutral-weaker)"},"colors.colorPalette.neutral.stronger":{value:"var(--Tight-colors-colorPalette-neutral-stronger)",variable:"var(--Tight-colors-colorPalette-neutral-stronger)"},"colors.colorPalette.neutral.weakest":{value:"var(--Tight-colors-colorPalette-neutral-weakest)",variable:"var(--Tight-colors-colorPalette-neutral-weakest)"},"colors.colorPalette.neutral.strongest":{value:"var(--Tight-colors-colorPalette-neutral-strongest)",variable:"var(--Tight-colors-colorPalette-neutral-strongest)"},"colors.colorPalette.accent":{value:"var(--Tight-colors-colorPalette-accent)",variable:"var(--Tight-colors-colorPalette-accent)"},"colors.colorPalette.accent.weak":{value:"var(--Tight-colors-colorPalette-accent-weak)",variable:"var(--Tight-colors-colorPalette-accent-weak)"},"colors.colorPalette.accent.strong":{value:"var(--Tight-colors-colorPalette-accent-strong)",variable:"var(--Tight-colors-colorPalette-accent-strong)"},"colors.colorPalette.accent.weaker":{value:"var(--Tight-colors-colorPalette-accent-weaker)",variable:"var(--Tight-colors-colorPalette-accent-weaker)"},"colors.colorPalette.accent.stronger":{value:"var(--Tight-colors-colorPalette-accent-stronger)",variable:"var(--Tight-colors-colorPalette-accent-stronger)"},"colors.colorPalette.accent.weakest":{value:"var(--Tight-colors-colorPalette-accent-weakest)",variable:"var(--Tight-colors-colorPalette-accent-weakest)"},"colors.colorPalette.accent.strongest":{value:"var(--Tight-colors-colorPalette-accent-strongest)",variable:"var(--Tight-colors-colorPalette-accent-strongest)"},"colors.colorPalette.success":{value:"var(--Tight-colors-colorPalette-success)",variable:"var(--Tight-colors-colorPalette-success)"},"colors.colorPalette.success.weak":{value:"var(--Tight-colors-colorPalette-success-weak)",variable:"var(--Tight-colors-colorPalette-success-weak)"},"colors.colorPalette.success.strong":{value:"var(--Tight-colors-colorPalette-success-strong)",variable:"var(--Tight-colors-colorPalette-success-strong)"},"colors.colorPalette.success.weaker":{value:"var(--Tight-colors-colorPalette-success-weaker)",variable:"var(--Tight-colors-colorPalette-success-weaker)"},"colors.colorPalette.success.stronger":{value:"var(--Tight-colors-colorPalette-success-stronger)",variable:"var(--Tight-colors-colorPalette-success-stronger)"},"colors.colorPalette.success.weakest":{value:"var(--Tight-colors-colorPalette-success-weakest)",variable:"var(--Tight-colors-colorPalette-success-weakest)"},"colors.colorPalette.success.strongest":{value:"var(--Tight-colors-colorPalette-success-strongest)",variable:"var(--Tight-colors-colorPalette-success-strongest)"},"colors.colorPalette.warning":{value:"var(--Tight-colors-colorPalette-warning)",variable:"var(--Tight-colors-colorPalette-warning)"},"colors.colorPalette.warning.weak":{value:"var(--Tight-colors-colorPalette-warning-weak)",variable:"var(--Tight-colors-colorPalette-warning-weak)"},"colors.colorPalette.warning.strong":{value:"var(--Tight-colors-colorPalette-warning-strong)",variable:"var(--Tight-colors-colorPalette-warning-strong)"},"colors.colorPalette.warning.weaker":{value:"var(--Tight-colors-colorPalette-warning-weaker)",variable:"var(--Tight-colors-colorPalette-warning-weaker)"},"colors.colorPalette.warning.stronger":{value:"var(--Tight-colors-colorPalette-warning-stronger)",variable:"var(--Tight-colors-colorPalette-warning-stronger)"},"colors.colorPalette.warning.weakest":{value:"var(--Tight-colors-colorPalette-warning-weakest)",variable:"var(--Tight-colors-colorPalette-warning-weakest)"},"colors.colorPalette.warning.strongest":{value:"var(--Tight-colors-colorPalette-warning-strongest)",variable:"var(--Tight-colors-colorPalette-warning-strongest)"},"colors.colorPalette.danger":{value:"var(--Tight-colors-colorPalette-danger)",variable:"var(--Tight-colors-colorPalette-danger)"},"colors.colorPalette.danger.weak":{value:"var(--Tight-colors-colorPalette-danger-weak)",variable:"var(--Tight-colors-colorPalette-danger-weak)"},"colors.colorPalette.danger.strong":{value:"var(--Tight-colors-colorPalette-danger-strong)",variable:"var(--Tight-colors-colorPalette-danger-strong)"},"colors.colorPalette.danger.weaker":{value:"var(--Tight-colors-colorPalette-danger-weaker)",variable:"var(--Tight-colors-colorPalette-danger-weaker)"},"colors.colorPalette.danger.stronger":{value:"var(--Tight-colors-colorPalette-danger-stronger)",variable:"var(--Tight-colors-colorPalette-danger-stronger)"},"colors.colorPalette.danger.weakest":{value:"var(--Tight-colors-colorPalette-danger-weakest)",variable:"var(--Tight-colors-colorPalette-danger-weakest)"},"colors.colorPalette.danger.strongest":{value:"var(--Tight-colors-colorPalette-danger-strongest)",variable:"var(--Tight-colors-colorPalette-danger-strongest)"},"colors.colorPalette.primary.weaker":{value:"var(--Tight-colors-colorPalette-primary-weaker)",variable:"var(--Tight-colors-colorPalette-primary-weaker)"},"colors.colorPalette.primary.weak":{value:"var(--Tight-colors-colorPalette-primary-weak)",variable:"var(--Tight-colors-colorPalette-primary-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.primary.stronger":{value:"var(--Tight-colors-colorPalette-primary-stronger)",variable:"var(--Tight-colors-colorPalette-primary-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.success.opaque":{value:"var(--Tight-colors-colorPalette-success-opaque)",variable:"var(--Tight-colors-colorPalette-success-opaque)"},"colors.colorPalette.warning.opaque":{value:"var(--Tight-colors-colorPalette-warning-opaque)",variable:"var(--Tight-colors-colorPalette-warning-opaque)"},"colors.colorPalette.danger.opaque":{value:"var(--Tight-colors-colorPalette-danger-opaque)",variable:"var(--Tight-colors-colorPalette-danger-opaque)"},"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.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.intent.notification":{value:"var(--Tight-colors-colorPalette-intent-notification)",variable:"var(--Tight-colors-colorPalette-intent-notification)"},"colors.colorPalette.notification":{value:"var(--Tight-colors-colorPalette-notification)",variable:"var(--Tight-colors-colorPalette-notification)"},"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 No(e,t){return Io[e]?.value||t}No.var=function(e,t){return Io[e]?.variable||t};const Ro=gr(null,tr({borderRadius:"50%",flexShrink:0})),Po=gr(null,tr({display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",minWidth:0})),Do=No.var("colors.surface.foreground.disabled");function Mo({color:e=Do,diameter:t=17,label:n}){return R("div",{...Po,"data-testid":"bullet-row",children:[I("div",{...Ro,style:{backgroundColor:e,width:`${t}px`,height:`${t}px`},"data-testid":"bullet"}),n&&I(Eo,{children:n})]})}const Lo=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"30px"}));function Fo({payload:e}){return void 0===e?null:I("div",{...Lo,children:e.map((e,t)=>"none"!==e.type&&I(Mo,{color:e.color,label:e.value,diameter:17},t))})}const Oo={right:20,left:20},Vo=["income","profit","expenses","loss"],Uo=e=>Vo.findIndex(t=>t===e.dataKey),Bo={paddingBottom:"20px",marginLeft:"-20px"},Ho={stackId:"stack",isAnimationActive:!1},Wo=gr(lr["profit-loss-graph"],tr({"& .recharts-surface":{outline:"none"}})),zo=No.var("colors.money"),_o=No.var("colors.border.layout"),jo=No.var("colors.border.layout.strong"),qo={fill:No.var("colors.typography.base"),fontSize:No.var("fontSizes.metric.sm")},Ko={profit:No.var("colors.money.positive.strong"),income:No.var("colors.money.positive.weak"),loss:No.var("colors.money.negative.strong"),expenses:No.var("colors.money.negative.weak")},Yo=[0,100],Zo=["auto","auto"];function Go({data:e}){const[t,n]=d(!0);if(void 0===e)return null;const r=e.hasAnyData?Zo:Yo;return I(W,{width:"100%",height:"100%",...Wo,children:R(z,{data:e.months,stackOffset:"sign",accessibilityLayer:!0,barSize:35,margin:Oo,children:[I(_,{verticalAlign:"top",itemSorter:Uo,wrapperStyle:Bo,content:({payload:e})=>I(Fo,{payload:e})}),I(j,{strokeDasharray:"0",vertical:!1,stroke:_o}),I(q,{dataKey:"month",interval:0,tickLine:!1,stroke:_o,tick:qo}),I(K,{type:"number",tickCount:7,domain:r,axisLine:!1,tickLine:!1,stroke:_o,tick:qo,tickFormatter:e=>fo(e)}),I(Y,{content:({active:e,payload:t})=>I(So,{active:e,payload:t}),isAnimationActive:!1,shared:!1}),I(Z,{name:"Profit",dataKey:"profit",fill:Ko.profit,...Ho}),I(Z,{name:"Income",dataKey:"income",fill:Ko.income,...Ho}),I(Z,{name:"Loss",dataKey:"loss",fill:Ko.loss,...Ho}),I(Z,{name:"Expenses",dataKey:"expenses",fill:Ko.expenses,...Ho}),I(Z,{dataKey:Ha,fill:_o,legendType:"none",...Ho}),I(G,{y:0,stroke:jo}),I(Q,{dataKey:"netIncome",fill:zo,stroke:zo,strokeWidth:1,legendType:"none",activeDot:!1,isAnimationActive:t,onAnimationStart:()=>n(!0),onAnimationEnd:()=>n(!1)})]})})}const Qo=tr({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 Xo({styles:e}){const t=rr(ur(lr["loading-skeleton"]),Qo,e);return I("div",{className:t,"data-testid":"shimmer-block"})}const Jo=tr({width:"40%",minHeight:65});function $o({children:e}){return R(N,{children:[I(Xo,{styles:Jo}),I(ho,{children:e})]})}const ei=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",gap:16})),ti=tr({width:"80px",height:"17px",marginBottom:"10px"}),ni=tr({width:"100%",height:"100%"});function ri(){return R(N,{children:[R("div",{...ei,children:[I(Xo,{styles:ti}),I(Xo,{styles:ti}),I(Xo,{styles:ti}),I(Xo,{styles:ti})]}),I(Xo,{styles:ni})]})}const ai=or({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 oi({size:e}){const t=ai({size:e});return I("div",{className:t,children:"Sample"})}const ii=20200,li=5043,si=Object.freeze({income:ii,expenses:li,netIncome:15157,absoluteSum:Math.abs(ii)+Math.abs(li)}),ci=Object.freeze({total:li,children:[{name:"Plane/Train/Bus",total:2500},{name:"Business Meals",total:1800},{name:"Employee Entertainment",total:743}]}),di=Object.freeze({moneyIn:25300,moneyOut:8150,netMoneyIn:17150}),ui=[{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 hi({filter:e=ut.LAST_12_MONTHS,isSample:t=!1}){const{query:{data:n},isFilling:r}=function({filter:e,grouping:t}){return Ba({filter:e,grouping:t,select:_a})}({filter:e,grouping:ja}),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=Mt(i,{abbreviateMonth:!0,abbreviateYear:!0}),s=ui[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:[I(Ka,{title:"Profit + Loss"}),I(Za,{children:r?I($o,{children:I(ri,{})}):R(N,{children:[I(co,{title:fo(a?.total??0),label:"Profit"}),I(ho,{children:I(Go,{data:a})})]})}),t&&I(oi,{size:"xl"})]})}const pi={FinancialOverview:{CONVERSATIONS:"conversations-section",TRANSACTIONS:"transactions-section"}},mi=l({}),gi=or({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 vi(e,t,n){const r=({size:r=24,fill:a="transparent",stylists:o})=>{const{icons:l}=i(mi),s=n?.styleIconKey?l?.[n.styleIconKey]:void 0,c=Cr([gr(null,gi()),...o]);return s?I("img",{src:s,alt:t,width:r,height:r,style:{minHeight:r,minWidth:r},className:tr({objectFit:"contain"})}):I(e,{...c,style:{minHeight:r,minWidth:r},width:r,height:r,fill:a})};return r.displayName=t,r}const fi=vi(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"}),bi=vi(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"),yi=vi(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"),wi=vi(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"}),Ci=vi(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 xi(e){return Da(`${t=e,La[t]}`,"v6");var t}async function Ti({authorization:e,extraHeaders:t,includeCredentials:n,params:r,url:a,cache:o}){const i=ka({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=>Ta(e,t)).join("&"):Ta(e,t),n}).join("&");var a;return""!==r&&(n+=`?${r}`),n})({url:a,params:r});ya("HTTP GET Request",{url:a,accessToken:e});try{const e=await fetch(l,{method:"GET",headers:i,credentials:"include",cache:o});return ya("HTTP GET Response",{url:a,status:e.status,statusText:e.statusText}),Ea(e)}catch(s){return Promise.reject(s)}}async function ki(e){const{url:t,headers:n}=Sa(e);return Ti({url:t,params:e.params,includeCredentials:!0,extraHeaders:n})}async function Ei(e){return ki({...e,endpointManager:xi(e.environment)})}async function Ai(e){return ki({...e,endpointManager:Oa(e.environment)})}const Si=l(void 0);function Ii(){return i(Si)}const Ni=e=>["introspect",e];function Ri(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 Ai(r)}(n[2].accessToken,n[2].environment,e)}}function Pi(){const e=Ii();return Vr({queryKey:Ni(e),queryFn:Ri(e)})}const Di={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"},Mi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_REVIEW","AWAITING_MATCH","IN_REVIEW","ADDITIONAL_REVIEW","NEEDS_APPROVAL","RECONCILED"],Li={DISCREPANCY:{text:"Discrepancy",Icon:bi,variant:"danger"},CLIENT_REVIEW:{text:"Client Review",Icon:yi,variant:"neutral"},NEEDS_REVIEW:{text:"Needs Review",Icon:fi,variant:"warning"},AWAITING_MATCH:{text:"Awaiting Match",Icon:yi,variant:"neutral"},IN_REVIEW:{text:"In Review",Icon:yi,variant:"neutral"},ADDITIONAL_REVIEW:{text:"Additional Review",Icon:fi,variant:"warning"},NEEDS_APPROVAL:{text:"Needs Approval",Icon:Ci,variant:"warning"},RECONCILED:{text:"Reconciled",Icon:wi,variant:"success"}},Fi={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"]},Oi={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"]},Vi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW","ADDITIONAL_REVIEW","AWAITING_MATCH","RECONCILED"],Ui=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","AWAITING_MATCH","RECONCILED"],Bi=["DISCREPANCY","CLIENT_REVIEW","NEEDS_APPROVAL","NEEDS_REVIEW"],Hi=["NEEDS_REVIEW","NEEDS_APPROVAL","IN_REVIEW","RECONCILED"],Wi=[{status:"USER_REVIEW_REQUIRED",displayName:"Needs Review"},{status:"ACCOUNTANT_REVIEW_REQUIRED",displayName:"Flag to Accountant"},{status:"RECONCILED",displayName:"Reconciled"}],zi=[{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 _i(){return Ki()?zi:Wi}function ji(e,t){return{...Li[e],key:e,value:(t?Fi:Oi)[e]}}function qi(e){const t=Ki()?Fi:Oi,n=Mi.find(n=>t[n].includes(e))??"NEEDS_REVIEW";return Li[n]}function Ki(){const{query:{data:e}}=Pi();return"ACCOUNTANT"===e?.userRole}function Yi(){return ji("NEEDS_REVIEW",Ki())}function Zi(e){return e in Di}const{CONVERSATIONS:Gi,TRANSACTIONS:Qi}=pi.FinancialOverview,Xi={MESSAGE_REVIEW:Gi,TRANSACTION_REVIEW:Qi,RULE_REVIEW:"",CSV_IMPORT_REVIEW:""},Ji={status:{in:["ACTIVE"]},category:{expand:!0},glAccount:{expand:!0},bankAccount:{expand:!0}},$i={resolutionStatus:{in:["OPEN"]}},el=[],tl=[],nl=vi(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"),rl=vi(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"),al=tr.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"}}),ol=tr(al),il=tr.raw({transition:"background 300ms ease-out, box-shadow 0ms",_supportHover:{transition:"background 100ms ease-out, box-shadow 0ms"}}),ll=tr(il);tr({transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}),tr({"& > .Tight-text":{transition:"color 300ms ease-out",_supportHover:{transition:"color 100ms ease-out"}}}),tr({"& path":{transition:"stroke 300ms ease-out",_supportHover:{transition:"stroke 100ms ease-out"}}});const sl=l({hasNextPage:!1,hasPreviousPage:!1,getFirstPage:()=>{},getLastPage:()=>{},pageBackwards:()=>{},pageForwards:()=>{}});function cl({Component:e,stylists:t}){return I(e,{stylists:[gr(lr["small-icon"],lr.icon),...t??[]],size:12})}const dl=gr(lr["pagination-button"],tr({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})),ul=gr(null,tr({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"}}),ll),hl=gr(null,tr({display:"flex",gap:"9px",padding:"10px",justifyContent:"center",alignItems:"center",width:{xl:"100%",base:"44px"}})),pl=gr(null,tr({height:{xl:"12px",base:"20px"},width:{xl:"12px",base:"20px"}}));function ml(){const{hasNextPage:e,hasPreviousPage:t,pageForwards:n,pageBackwards:r}=function(){const e=i(sl);if(void 0===e)throw new Error("usePaginationContext must be used within a PaginationProvider");return e}();return R("div",{...dl,children:[I("div",{...hl,children:I("button",{...ul,onClick:r,disabled:!t,children:I(cl,{Component:nl,stylists:[pl]})})}),I("div",{...hl,children:I("button",{...ul,onClick:n,disabled:!e,children:I(cl,{Component:rl,stylists:[pl]})})})]})}const gl=tr({width:"100%",height:"50px"});function vl(){return I(Xo,{styles:gl})}const fl=gr(lr["dashboard-placeholder-table"],tr({display:"flex",flexDirection:"column",gap:"4px"})),bl=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",height:"52px",paddingLeft:"64px",paddingRight:"64px"})),yl=tr({width:"100px",height:"20px"});function wl({numColumns:e=6}){return R("div",{...fl,children:[I("div",{...bl,children:Array.from({length:e},(e,t)=>I(Xo,{styles:yl},t))}),I(vl,{}),I(vl,{}),I(vl,{}),I(vl,{}),I(vl,{}),I(vl,{})]})}function Cl(e,t){const n=Pr(),r=Or();return u(a=>{const o=Nr(n),i=o?{}:{retry:!1,staleTime:1/0};return Lr.prefetchQuery({queryKey:Er(e(a),n??"",r),queryFn:o?t:Dr,...i})},[e,t,n,r])}const xl=Object.freeze({}),Tl=Object.freeze({cursor:"FINAL_PAGE"});function kl({queryKey:e,queryFn:t,...n}){const[r,i]=d(xl),l=a(e);C(l.current,e)||(l.current=e,i(xl));const c=n.select,h=cr(c)?e=>({...c(e),cursor:e.cursor}):void 0,p=Ar(e,r),m=Vr({...n,queryKey:p,queryFn:t,placeholderData:L,select:h}),g=o(()=>{return e=m.query.data?.cursor,t=i,{getFirstPage:()=>t(xl),getLastPage:()=>t(Tl),hasNextPage:cr(e?.after),hasPreviousPage:cr(e?.before),pageForwards:()=>{e?.after&&t({cursor:e.after})},pageBackwards:()=>{e?.before&&t({cursor:e.before})}};var e,t},[m.query.data?.cursor]),v=Cl(u(t=>Ar(e,t),[e]),t),f=Cl(u(t=>Ar(e,t),[e]),t);return s(()=>{const e=m.query.data?.cursor;!m.query.isFetching&&e&&(e.after&&v({cursor:e.after}).catch(e=>{wa({error:e,severity:"error"})}),e.before&&f({cursor:e.before}).catch(e=>{wa({error:e,severity:"error"})}))},[m.query.data?.cursor,m.query.isFetching,v,f]),{...m,paginationControls:g}}function El({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 s(()=>()=>{n.cancelCallback()},[n]),{startCallback:u(e=>{n.startCallback(e)},[n]),cancelCallback:u(()=>{n.cancelCallback()},[n])}}function Al({prefetchFn:e}){const{startCallback:t,cancelCallback:n}=El({delay:250,callback:e});return{startPrefetch:t,cancelPrefetch:n}}const Sl={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"},Il={ASC:"ASC",DESC:"DESC"},Nl=e=>["conversations",e??{}],Rl=e=>["conversations","conversation",e],Pl=async e=>{const t=e.queryKey,n={path:"/v6/conversations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Dl(e){return kl({queryKey:e?Nl(e):["conversations",{}],queryFn:Pl})}const Ml=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 Ei(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null};function Ll(e){const t=cr(e);return Vr({queryKey:Rl({id:e??""}),queryFn:Ml,enabled:t})}const Fl=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/conversations",bodyParams:e,accessToken:t,endpointManager:xi(n)};return await Ra(r)};function Ol(){return Al({prefetchFn:Cl(Rl,Ml)})}function Vl(e){const t=e.getSize(),n=e.columnDef.maxSize;return{flex:`${t} 0 auto`,width:t,maxWidth:void 0!==n?`${n}px`:"auto"}}function Ul({header:e}){const t=Vl(e.column);return I("div",{...gr(lr["dashboard-table-column-header"]),style:t,children:e.isPlaceholder?null:X(e.column.columnDef.header,e.getContext())})}const Bl=gr(lr["dashboard-table-header"],tr({display:"flex",flexDirection:"row",alignItems:"center",minHeight:"32px"}));function Hl({headerGroups:e}){return I("div",{children:e.map(e=>h("div",{...Bl,key:e.id},e.headers.map(e=>I(Ul,{header:e},e.id))))})}const Wl=gr(lr["dashboard-table-body"],tr({display:"flex",flexDirection:"column"}));function zl({children:e}){return I("div",{...Wl,children:e})}function _l(e){if("object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id)return e.id}const jl=/* @__PURE__ */new Set;const ql=l(void 0);function Kl({editMutationKey:e,children:t}){const n=function(e){const t=F({filters:{mutationKey:e,status:"pending"},select:e=>e.state.variables},Lr);return o(()=>0===t.length?jl:function(e){const t=/* @__PURE__ */new Set;for(const n of e){const e=Array.isArray(n)?n:[n];for(const n of e){const e=_l(n);void 0!==e&&t.add(e)}}return t}(t),[t])}(e);return I(ql.Provider,{value:n,children:t})}const Yl=gr(lr["dashboard-table-cell"],tr({height:"100%",display:"flex",justifyContent:"center",flexDirection:"column",color:"icon.base"})),Zl=tr({display:"flex",flexDirection:"row",height:"100%"});function Gl({cell:e,onCellClick:t,isMutating:n}){const r=Vl(e.column);return I("div",{className:Zl,style:r,onClick:()=>{!n&&t&&t(e)},children:I("div",{style:r,...Yl,children:X(e.column.columnDef.cell,{...e.getContext(),isMutating:n})})})}const Ql=gr(lr["table-sub-row"],tr({display:"flex",alignItems:"center",justifyContent:"flex-start",height:"60px",overflow:"hidden",minWidth:"fit-content",borderRadius:"zero",cursor:"pointer",_hover:{backgroundColor:"brand.action.weaker"}}));function Xl({rowData:e,onCellClick:t,isMutating:n}){const r=e.getVisibleCells();return I("div",{...Ql,children:r.map(e=>I(Gl,{cell:e,onCellClick:t,isMutating:n,isChild:!0},e.id))})}const Jl=tr({display:"flex",flexDirection:"column",borderRadius:"zero",cursor:"pointer",minWidth:"fit-content",overflow:"hidden",position:"relative",isolation:"isolate"}),$l=tr({position:"absolute",inset:"0",backgroundColor:"surface.foreground",opacity:"80%",pointerEvents:"all",cursor:"default"}),es=tr({background:"surface.background"}),ts=gr(lr["table-row"],tr({display:"flex",alignItems:"center",justifyContent:"flex-start",height:{base:"85px",xl:"60px"},minWidth:"fit-content",_hover:{backgroundColor:"brand.action.weaker"},"&:focus-visible":{outlineColor:"brand.action.strong",outlineStyle:"solid",outlineWidth:"borderWidths.md",outlineOffset:"calc(-1 * {borderWidths.md})",zIndex:1,backgroundColor:"brand.action.weaker"}}));function ns({rowData:e,onMouseEnter:t,onMouseLeave:n,onRowClick:r,onCellClick:o,shouldDisplayDivider:l}){const c=function(e){const t=i(ql);return t?.has(e)??!1}(e.id),d=e.getIsExpanded(),u=gr(lr["table-parent-row"],Jl,e.index%2==0?es:void 0),h=e.getVisibleCells(),p=function(e){const t=a(null);return s(()=>{const n=t.current;n&&(n.inert=e)},[e]),t}(c),{onKeyDownCapture:m,ref:g,role:v,tabIndex:f}=function(e){const t=a(null);return{role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDownCapture:n=>{"Enter"!==n.key&&"Space"!==n.code||n.target!==t.current||(n.preventDefault(),n.stopPropagation(),e?.())},ref:t}}(r);return R("div",{...u,onMouseEnter:t,onMouseLeave:n,ref:p,children:[I("div",{...ts,onKeyDownCapture:m,ref:g,role:v,tabIndex:f,children:h.map(e=>I(Gl,{cell:e,onCellClick:o,isMutating:c},e.id))}),c&&I("div",{className:$l}),d&&I("div",{children:e.subRows.map(e=>I(Xl,{rowData:e,onCellClick:o,shouldDisplayDivider:l,isMutating:c},e.id))})]})}const rs=(e,t={})=>{dn.getState().openDrawer(e,t)},as=()=>{dn.getState().requestCloseDrawer()},os=()=>dn(e=>e.drawerHistory),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!Ir(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)}function ds(e,t,n){cr(e)&&(e.listener(t),e.preventDefault)||n?.()}function us(e,t){const{events:n}=dn.getState();null!==e?ls(e.id,is.BANK_TRANSACTION)?ds(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>rs("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ds(n.transactionForm,{type:"OPEN_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:e,error:null},()=>rs("BankTransactionForm",{routeProps:{transactionId:e.id,initialTab:t?.initialTab}})):ds(n.transactionForm,{type:"OPEN_BANK_TRANSACTION_FORM",result:"SUCCESS",data:null,error:null},()=>rs("BankTransactionForm",{routeProps:{transactionId:t?.transactionId,initialTab:t?.initialTab,initialType:t?.initialType}}))}function hs({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Er(e,n,r);return Lr.fetchQuery({queryKey:a,queryFn:t})}function ps({queryKey:e,queryFn:t,accessToken:n,environment:r}){if(!n)return Promise.reject(new Error("Access token is required to fetch entity"));const a=Er(e,n,r);return Lr.prefetchQuery({queryKey:a,queryFn:t})}const ms=[{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"}],gs={DATE:"DATE",DESCRIPTION:"DESCRIPTION",AMOUNT:"AMOUNT",STATUS:"STATUS",REVIEW_STATUS:"REVIEW_STATUS"},vs={ASC:"ASC",DESC:"DESC"},fs=e=>["banks/transactions",e??{}],bs=e=>["banks/transactions",e.id],ys=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function ws(e,t){return kl({queryKey:fs(e),queryFn:ys,...t})}const Cs=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 Ei(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function xs({id:e,enabled:t=!0}){return Vr({queryKey:bs({id:e??""}),queryFn:Cs,enabled:t})}function Ts(){return Al({prefetchFn:Cl(bs,Cs)})}function ks(){const{query:{data:e}}=ws({limit:1,filter:{status:{in:["ACTIVE","INACTIVE"]}}}),t=e?.data;return!sr(t)&&t.length>0}const Es=e=>["conversations/messages",e];function As(e){if(sr(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 Ss=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 Ei(r);return"SUCCESS"===a.result&&void 0!==a.data?a.data:null},Is=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/messages",bodyParams:{data:[e]},endpointManager:xi(n),accessToken:t};return await Ra(r)};function Ns(){return Al({prefetchFn:Cl(Es,Ss)})}const Rs=e=>["summaries",e??{}],Ps=e=>["summaries",e.id],Ds=async e=>{const t=e.queryKey,n={path:"/v6/summaries/query",bodyParams:{...t[1]},accessToken:t[2].accessToken,endpointManager:xi(t[2].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data}:{data:void 0}};const Ms=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 Ei(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null};function Ls(){return dn(e=>e.events.conversations)}function Fs({rowData:e,isMobile:t}){const n=Ls(),{startPrefetch:r,cancelPrefetch:a}=Ol(),{startPrefetch:o,cancelPrefetch:i}=Ns(),{startPrefetch:l,cancelPrefetch:s}=Ts(),{startPrefetch:c,cancelPrefetch:d}=Al({prefetchFn:Cl(Ps,Ms)}),h=u(()=>{cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?l({id:e.original.attachedEntityId}):cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&c({id:e.original.attachedEntityId}),o({id:e.original.id}),r({id:e.original.id})},[e.original.attachedEntityId,e.original.id,o,r,l,c]),p=u(()=>{cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.BANK_TRANSACTION)?s():cr(e.original.attachedEntityId)&&ls(e.original.attachedEntityId,is.FINANCIAL_SUMMARY)&&d(),i(),a()},[s,d,a,i,e.original.attachedEntityId]);return I(ns,{rowData:e,onMouseEnter:h,onMouseLeave:p,shouldDisplayDivider:e=>0!==e,onCellClick:()=>{ds(n,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:e.original,error:null},()=>((e,t,n)=>{n?rs("MobileConversation",{routeProps:{conversationId:e,transactionId:t}}):cr(t)?ls(t,is.BANK_TRANSACTION)?us(null,{transactionId:t,initialTab:"conversation"}):ls(t,is.FINANCIAL_SUMMARY)&&(r=e,a=t,rs("FinancialSummary",{routeProps:{conversationId:r,summaryId:a}})):function(e){rs("Conversation",{routeProps:{conversationId:e}})}(e);var r,a})(e.original.id,e.original.attachedEntityId,t))}})}const Os=vi(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"),Vs=tr.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}}),Us=tr(Vs),Bs=tr.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"}});tr(Bs);const Hs=tr.raw({padding:"10px",fontSize:"md",fontWeight:"md",gap:"9px"}),Ws=tr(Hs),zs=tr.raw({padding:"6px",fontSize:"sm",fontWeight:"sm",gap:"5px"});tr(zs);const _s=tr.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"}}),js=tr.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"}}),qs=tr.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"}}}),Ks=tr.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"}}),Ys=tr.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"}}}),Zs=tr.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"}}),Gs=or({base:tr.raw(Vs,Hs,al),variants:{width:{default:{width:"fit-content"},"fill-parent":{width:"100%",height:"100%"}},size:{default:Hs,small:zs},intent:{default:{},danger:js,primary:Bs,secondary:Ys,success:qs,warning:Ks,action:Zs}}}),Qs=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,eventSource:m},g){const v=function(e){switch(e){case"danger":return lr["button-danger"];case"primary":return lr["button-primary"];case"secondary":return lr["button-secondary"];case"success":return lr["button-success"];case"warning":return lr["button-warning"];case"action":return lr["button-action"];case"default":return null}}(c),f=Cr([gr(lr["button-base"],v,r,tr(Gs.raw({width:s,size:l,intent:c}),n)),...t]);return I("button",{ref:g,...f,type:a,onClick:o,disabled:i,"data-active":d,"data-event-name":m,onMouseEnter:u,onMouseLeave:h,...p,children:e})});function Xs({children:e,stylists:t=[],...n}){return I(Qs,{intent:"secondary",stylists:t,...n,children:e})}const Js=gr(lr["small-square-button"],void 0),$s=tr({width:{xl:"auto",base:"44px"},maxHeight:{xl:"35px",base:"44px"}});function ec(){const e=Ls();return I("div",{className:$s,children:I(Xs,{stylists:[Js],onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation",{routeProps:{conversationId:null}}))},width:"fill-parent",children:I(cl,{Component:Os})})})}const tc=or({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"},generalLedger:{borderWidth:"lg",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"md",background:"surface.foreground"}}}});function nc({children:e,dashboard:t}){const n=gr(lr["dashboard-table"],tc({dashboard:t}));return I("div",{...n,children:e})}const rc=l(null),ac="mobile",oc=or({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 ic({children:e,alignVariant:t="flexStart"}){const n=gr(null,oc({alignVariant:t}));return I("div",{...n,children:e})}const lc=or({base:{fontWeight:"label",fontSize:"lg",fontFamily:"label",lineHeight:"template",maxWidth:"100%",xl:{lineHeight:"template",fontSize:"label"}},variants:{intent:{weak:{color:"typography.base.weak"},default:{color:"typography.label"},primary:{color:"typography.intent.primary"},contrast:{color:"typography.contrast"},notification:{color:"typography.intent.notification"}},wrap:{ellipsis:Ja,wrap:{whiteSpace:"normal",overflowWrap:"break-word"},nowrap:eo},alignment:{left:{textAlign:"left"},center:{textAlign:"center"},right:{textAlign:"right"}}}});function sc({children:e,intent:t="default",wrap:n="ellipsis",alignment:r="left",extraClassNames:a=[]}){const o=gr(lr.label,lr.text,tr(lc.raw({intent:t,wrap:n,alignment:r}),a));return Ir(e)?null:I("div",{title:"ellipsis"===n?e:void 0,...o,children:e})}const cc={"sm-sm":gr(lr.text,tr({fontSize:{xl:"sm",base:"md"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"sm-med":gr(lr.text,tr({fontSize:{xl:"sm",base:"md"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"sm-lg":gr(lr.text,tr({fontSize:"sm",fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"med-sm":gr(lr.text,tr({fontSize:{xl:"md",base:"lg"},fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"med-med":gr(lr.text,tr({fontSize:{xl:"md",base:"lg"},fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa),"med-lg":gr(lr.text,tr({fontSize:{xl:"md",base:"lg"},fontWeight:"lg",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa)};function dc({children:e,size:t,weight:n,stylists:r=[]}){const a=Cr([cc[`${t}-${n}`],...r]);return I("div",{title:e,...a,children:e})}const uc=gr(lr["emphasis-label"],tr({lineHeight:"template"}));function hc({children:e}){return I(dc,{size:"med",weight:"lg",stylists:[uc],children:e})}function pc({text:e,isRead:t}){return I(t?sc:hc,{children:e})}function mc({date:e,isRead:t=!1}){const n=Lt(e);return I(pc,{text:n,isRead:t})}const gc=gr(lr["strong-sub-label"],xr({label:"strongSubLabel"}));function vc({children:e,stylists:t=[]}){return Ir(e)?null:I(dc,{size:"sm",weight:"med",stylists:[gc,...t],children:e})}const fc=l(null),bc=tr({overflow:"auto",display:"flex",flexDirection:"column",width:"fit-content",minWidth:"150px",maxWidth:"325px",maxHeight:"314px","&:focus, &:focus-within":{outline:"none"},scrollbar:"hidden"}),yc=tr.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"}}),wc=gr(lr["selector-row"],tr(yc));function Cc(e,t,n){const[r,a]=d(e);return[t??r,n??a]}function xc({children:e}){return null===pe()?I(me,{children:e}):e}function Tc({children:e,initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,blockInteraction:l=!0,enableClickMiddleware:s=!0}){const c=function({initialOpen:e=!1,placement:t="bottom",offsetPx:n=0,open:r,onOpenChange:a,enableClickMiddleware:i=!0}={}){const[l,s]=d(),[c,h]=d(),[p,m]=Cc(e,r,a),g=ne(),v=re({placement:t,open:p,nodeId:g,onOpenChange:(e,t)=>{!e&&t instanceof MouseEvent&&(t.clientX<0||t.clientY<0||t.clientX>window.innerWidth||t.clientY>window.innerHeight)||m(e)},whileElementsMounted:se,middleware:[ae(n),oe({crossAxis:t.includes("-"),fallbackStrategy:"bestFit",fallbackAxisSideDirection:"none",padding:8}),ie({padding:8}),le({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})]}),f=v.context,b=ce(f,{enabled:i}),y=de(f,{bubbles:{escapeKey:!0}}),w=ue(f),C=he([b,y,w]),x=u(()=>m(!1),[m]);return o(()=>({open:p,setOpen:m,close:x,...C,...v,modal:!0,labelId:l,descriptionId:c,setLabelId:s,setDescriptionId:h,nodeId:g}),[p,m,x,C,v,l,c,g])}({initialOpen:t,placement:n,offsetPx:r,open:a,onOpenChange:i,enableClickMiddleware:s}),h=pe(),p=l&&null===h,m=c.nodeId;return I(xc,{children:I(ge,{id:m,children:I(fc.Provider,{value:{...c,popupParentNodeId:h,blockInteraction:p},children:e})})})}function kc(){const e=i(fc);if(sr(e))throw new Error("Popup components must be wrapped in <PopupManager />");return e}function Ec({children:e}){const t=kc(),n=t.refs.setReference,r=t.open?"open":"closed",a={...t.getReferenceProps(),ref:n,"data-state":r};return I(N,{children:e(a)})}const Ac=vi(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 Sc({Component:e,stylists:t}){return I(e,{stylists:[gr(lr["tiny-icon"],lr.icon),...t??[]],size:9})}const Ic=vi(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"),Nc=gr(lr["button-discreet-small"],tr(_s,{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"}}),ol),Rc=gr(null,tr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",backgroundColor:"transparent",padding:"6px 0 6px 6px",border:"none",outline:"none",cursor:"pointer"})),Pc=gr(null,tr({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"}})),Dc=gr(null,tr({padding:"0 6px 0 0",display:"flex",alignItems:"center",color:"icon.base"}));function Mc({onClearClick:e,columnName:t,active:n,popupTriggerProps:r}){const a=n||"open"===r?.["data-state"];return R("div",{...Nc,"data-active":a,children:[R("button",{...Rc,...r,children:[I(vc,{children:t}),!a&&I("div",{...Dc,children:I(Sc,{Component:Ic})})]}),a&&I("button",{...Pc,onClick:e,children:I(Sc,{Component:Ac})})]})}const Lc=or({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 Fc({initialFocus:e=!0,style:t,ref:n,type:r,forceMount:a,modal:o,...i}){const{context:l,blockInteraction:s,...c}=kc(),d=ve([c.refs.setFloating,n]),u=gr(lr.popup,Lc({type:r}));return a||l.open?R(fe,{children:[s&&I(be,{lockScroll:!0}),I(ye,{context:l,modal:o??!0,initialFocus:e?void 0:-1,children:I("div",{ref:d,...u,style:{...c.floatingStyles,...t},...c.getFloatingProps(i),"aria-labelledby":c.labelId,"aria-describedby":c.descriptionId,children:i.children})})]}):null}const Oc=gr(lr["popup-sort-row"],tr({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 Vc({onClick:e,children:t,active:n}){return I("button",{onClick:e,...Oc,children:I(Eo,{accent:n?"active":"action",children:t})})}const Uc=gr(null,tr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"})),Bc=gr(null,tr({paddingTop:"10px",paddingLeft:"10px",paddingRight:"10px",paddingBottom:"8px",color:"typography.base.weak"}));function Hc({sortDef:e,sortAscDisplay:t,sortDescDisplay:n,handleSortClick:r,sortInstance:a}){const o=kc(),i=e=>{r(e),o.close()},l=a?.orderBy===e&&"ASC"===a?.direction,s=a?.orderBy===e&&"DESC"===a?.direction;return R("div",{...Uc,children:[I(vc,{stylists:[Bc],children:"Sort by:"}),I(Vc,{onClick:()=>i({orderBy:e,direction:"ASC"}),active:l,children:t}),I(Vc,{onClick:()=>i({orderBy:e,direction:"DESC"}),active:s,children:n})]})}const Wc=tr.raw(_s,{width:"fit-content",padding:"6px","&::before":{content:"''",position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function zc({extraClassNames:e,children:t,active:n,disabled:r,onClick:a,popupTriggerProps:o,ariaLabel:i,ariaExpanded:l}){const[s,c]=d(!1),u=gr(lr["button-discreet-small"],tr(Wc,e),ol),h=n??function(e){switch(e){case"open":return!0;case"closed":return!1;case void 0:return}}(o?.["data-state"]);return I("button",{type:"button",...u,onClick:e=>{void 0===h&&c(!s),a&&a(e)},"data-active":h??s,disabled:r,...o,"aria-label":i,"aria-expanded":l,children:t})}const _c={minWidth:"140px"};function jc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r}){const a=i(rc);if(!a)return null;const{sortInstance:o,setSortInstance:l}=a,s=o?.orderBy===t,c=()=>{l(void 0)};return t&&n&&r?R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(Mc,{active:s,onClearClick:c,columnName:e,popupTriggerProps:t})}),I(Fc,{style:_c,children:I(Hc,{sortDef:t,sortAscDisplay:n,sortDescDisplay:r,handleSortClick:e=>{l(e)},sortInstance:o})})]}):I(zc,{disabled:!0,children:I(vc,{children:e})})}const qc=or({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 Kc({children:e,align:t="left",padding:n="default"}){return I("div",{className:qc({align:t,padding:n}),children:e})}function Yc({columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r,align:a="left",padding:o="default"}){return I(Kc,{align:a,padding:o,children:I(jc,{columnName:e,sortDef:t,sortAscDisplay:n,sortDescDisplay:r})})}const Zc="Oldest to Newest",Gc="Newest to Oldest";const Qc=l({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 Xc({authorUserId:e,isRead:t}){const{userRole:n,userId:r}=i(Qc);let a="";return e===r?a="Me":Wt(n)?a="Bookkeeper":/* @__PURE__ */function(e){return"ACCOUNTANT"===e}(n)&&(a="User"),I(pc,{text:a,isRead:t})}const Jc=vi(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"),$c=gr(lr.text,tr({fontSize:"md",fontWeight:"lg",color:"typography.base",fontStyle:"normal",lineHeight:"template",maxWidth:"100%",fontFamily:"label"}),Xa);function ed({children:e,stylists:t=[]}){const n=Cr([$c,...t]);return I("div",{...n,children:e})}const td=or({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"}}}}),nd=rr(tr({display:"flex",flex:1,flexDirection:"column",alignItems:"start",justifyContent:"center",gap:"4px",maxWidth:"100%",paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"}),Xa),rd=tr({display:"flex",flexDirection:"row",alignItems:"flex-end",justifyContent:"space-between",width:"100%"}),ad=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"end"}),od=tr({display:"flex",alignItems:"center",gap:8}),id=tr({display:"flex",alignItems:"center",gap:"4px",maxWidth:"100%"}),ld=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:4,maxWidth:"100%"}),sd=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4}),cd=tr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function dd({sender:e,subject:t,date:n,message:r,isRead:a,handleFormOpen:o}){return I("button",{className:td({isRead:a}),onTouchEnd:o,children:R("div",{className:nd,children:[R("div",{className:ld,children:[!a&&I("div",{className:cd}),I(pc,{text:t,isRead:a})]}),R("div",{className:rd,children:[I("div",{className:sd,children:I(Xc,{authorUserId:e,isRead:a})}),R("div",{className:od,children:[I("div",{className:ad,children:I(mc,{date:n,isRead:a})}),a?I(cl,{Component:rl}):I(ed,{children:I(cl,{Component:rl})})]})]}),I("div",{className:id,children:Ir(r)?R(N,{children:[I(cl,{Component:Jc}),I(sc,{children:"Shared a file"})]}):I(sc,{children:r})})]})})}const ud=tr({display:"flex",alignItems:"center",flexDirection:"row",gap:"4px"}),hd=tr({backgroundColor:"typography.base",borderRadius:9999,maxHeight:8,minHeight:8,maxWidth:8,minWidth:8});function pd({text:e,isRead:t}){return t?I(sc,{children:e}):R("div",{className:ud,children:[I("div",{className:hd}),I(hc,{children:e})]})}const md=J(),gd=gr(null,tr({paddingLeft:"25px"})),vd=[md.accessor("latestMessage.author.userId",{id:"from",cell:({row:e})=>I(ic,{children:I(Xc,{authorUserId:e.original.latestMessage.author.userId,isRead:"READ"===e.original.readStatus})}),header:()=>I(vc,{stylists:[gd],children:"From"}),size:160,maxSize:160}),md.accessor("subject",{id:"subject",cell:({row:e})=>R(ic,{children:[I(pd,{text:e.original.subject,isRead:"READ"===e.original.readStatus}),I(sc,{children:e.original.latestMessage.text})]}),header:()=>I(vc,{stylists:[gd],children:"Subject"}),size:200}),md.accessor("lastUpdatedDateTime",{id:"date",cell:({row:e})=>I(ic,{children:I(mc,{date:e.original.lastUpdatedDateTime,isRead:"READ"===e.original.readStatus})}),header:()=>I(Yc,{columnName:"Date",sortDef:"LAST_MESSAGE_CREATED_DATE_TIME",sortDescDisplay:Gc,sortAscDisplay:Zc}),size:150,maxSize:150}),md.display({id:ac,cell:({row:e})=>I(dd,{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 fd(e){return e?vd.filter(e=>e.id===ac):vd.filter(e=>e.id!==ac)}const bd=[],yd=tr({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"}),wd=gr(lr["empty-dashboard-layout"],yd);function Cd({children:e}){return I("div",{...wd,"data-testid":"empty-dashboard-layout",children:e})}const xd=tr({width:"25px",height:"25px",borderRadius:"sm"});function Td({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:xd}),I("img",{src:e,alt:t.displayName,width:25,height:25,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["large-icon"],lr.icon),...n??[]],size:25})}const kd=p(function({children:e,active:t,stylists:n=[],width:r,...a},o){return I(Qs,{ref:o,intent:"primary",stylists:n,active:t,width:r,...a,children:e})}),Ed=vi(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"}),Ad=tr({width:"15px",height:"15px",borderRadius:"sm"});function Sd({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:Ad}),I("img",{src:e,alt:t.displayName,width:15,height:15,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["medium-icon"],lr.icon),...n??[]],size:15})}function Id(){const e=Ls();return R(N,{children:[I(Td,{Component:Ed}),I(To,{wrap:"wrap",children:"Need help with your financials?"}),R(kd,{...gr(lr["zero-state-button"]),onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation",{routeProps:{conversationId:null}}))},children:[I(To,{children:"Message Bookkeeper"}),I(Sd,{Component:rl})]})]})}const Nd=vi(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 Rd(){return R(N,{children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",children:"All caught up"}),I(Eo,{wrap:"wrap",children:"We'll let you know if something comes up."})]})}const Pd=l({isApp:!1,navigate:()=>{},location:{hash:"",key:"",pathname:"",search:"",state:void 0,mask:void 0},registerAnchor:()=>{},initialPageProps:void 0});function Dd(e){const{registerAnchor:t}=i(Pd);m(()=>{t(e)},[e,t])}const Md=gr(null,tr({display:"flex",flexDirection:"row",gap:"5px"}));function Ld({children:e}){return I("div",{...Md,children:e})}const Fd=or({variants:{isMobile:{true:{},false:{minWidth:"900px"}}}});function Od(e){return I(e?Rd:Id,{})}function Vd({sortInstance:e,setSortInstance:t,conversations:n,paginationControls:r,isFilling:a,isMobile:o}){Dd(Gi);const i=function({conversations:e,isMobile:t}){return $({data:e??bd,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??bd.length,columns:fd(t),getCoreRowModel:ee(),getRowId:e=>e.id})}({conversations:n,isMobile:o}),{query:{data:l},isFilling:s}=Dl({limit:1,filter:{resolutionStatus:{in:["OPEN","CLOSED"]}}}),c=!sr(l?.data?.[0])&&!s;return R("div",{className:Fd({isMobile:o}),children:[I("div",{id:Gi}),R(sl.Provider,{value:r,children:[R(br,{children:[I(kr,{children:"Conversations"}),R(Ld,{children:[I(ml,{}),I(ec,{})]})]}),I(nc,{dashboard:"financialOverviewDashboard",children:a?I(wl,{numColumns:4}):R(N,{children:[!o&&I(rc.Provider,{value:{sortInstance:e,setSortInstance:t},children:I(Hl,{headerGroups:i.getHeaderGroups()})}),n.length>0?I(Kl,{editMutationKey:i.options.meta?.editMutationKey,children:I(zl,{children:i.getRowModel().rows.map(e=>I(Fs,{rowData:e,isMobile:o},e.id))})}):I(Cd,{children:Od(c)})]})})]})]})}const Ud=gr(lr.body,xr({body:"default"}));function Bd({children:e,stylists:t=[]}){if(Ir(e))return null;const n=Cr([Ud,...t]);return I("div",{...n,children:e})}const Hd=gr(null,tr({display:"flex",flexDirection:"column",gap:"6px",width:"100%",padding:"10px"})),Wd=or({base:{height:16},variants:{width:{w92:{width:"92%"},w90:{width:"90%"},w88:{width:"88%"},w87:{width:"87%"},w85:{width:"85%"},w70:{width:"70%"}}}}),zd=[{width:"w85"},{width:"w90"},{width:"w88"},{width:"w85"},{width:"w92"},{width:"w87"},{width:"w90"},{width:"w85"},{width:"w88"}];function _d(){return I("div",{...Hd,children:zd.map((e,t)=>I(Xo,{styles:Wd({width:e?.width})},t))})}const jd=tr({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}"}),qd=tr({position:"relative",width:"25px",height:"25px"});function Kd({hasUnread:e}){return R("div",{className:qd,children:[I(Td,{Component:Ed}),e&&I("div",{"data-testid":"unread-comment-badge",className:jd,"aria-hidden":"true"})]})}const Yd=gr(lr["financial-summary-chatbox-header"],tr({display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"5px",padding:"10px",width:"100%",borderBottom:"{borderWidths.lg} solid {colors.border.layout}",boxSizing:"border-box"}));function Zd({hasUnreadMessages:e=!1,showMessageIndicator:t}){return R("div",{...Yd,children:[I(To,{children:"Message Bookkeeper"}),t&&I(Kd,{hasUnread:e})]})}const Gd=tr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",textAlign:"center",color:"icon.base"});function Qd(){const e=Ls();return R("div",{className:Gd,children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",textAlign:"center",children:"Your financial summary will be ready soon"}),I(Eo,{wrap:"wrap",children:"In the meantime, ask about your financial trends"}),R(kd,{...gr(lr["zero-state-button"]),onClick:()=>{ds(e,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation"))},children:[I(To,{children:"Send a Message"}),I(Sd,{Component:rl})]})]})}const Xd=tr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function Jd({summaryId:e,conversationId:t}){const{startPrefetch:n,cancelPrefetch:r}=Ol(),{startPrefetch:a,cancelPrefetch:o}=Ns(),i=u(()=>{a({id:t}),n({id:t})},[t,a,n]),l=u(()=>{o(),r()},[o,r]);return R("div",{className:Xd,children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",textAlign:"center",children:"Continue conversation with your bookkeeper"}),I(Eo,{wrap:"wrap",children:"Pick up where you left off."}),I(Xs,{onClick:()=>rs("FinancialSummary",{routeProps:{summaryId:e,conversationId:t}}),onMouseEnter:i,onMouseLeave:l,children:I(To,{children:"Continue conversation"})})]})}const $d=tr({display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",color:"icon.base"});function eu({summaryId:e}){return R("div",{className:$d,children:[I(Td,{Component:Nd}),I(To,{wrap:"wrap",textAlign:"center",children:"Ask questions about your financial summary"}),I(Eo,{wrap:"wrap",children:"Your bookkeeper will respond here."}),I(Xs,{...gr(lr["zero-state-button"]),onClick:()=>rs("FinancialSummary",{routeProps:{summaryId:e}}),children:I(To,{children:"Talk to a bookkeeper"})})]})}function tu({summaryId:e,conversationId:t}){const n=cr(t);return sr(e)?I(Qd,{}):n?I(Jd,{conversationId:t,summaryId:e}):I(eu,{summaryId:e})}const nu=tr({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"}),ru=gr(lr["financial-summary-chatbox"],tr({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 au({summaryData:e}){const t=cr(e?.summary),n=cr(e?.conversation);return R("div",{className:nu,children:[I(Zd,{showMessageIndicator:t&&n,hasUnreadMessages:"UNREAD"===e?.conversation?.readStatus}),I("div",{...ru,children:I(tu,{summaryId:e?.id,conversationId:e?.conversation?.id})})]})}const ou=vi(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"),iu=tr({display:"flex",flexDirection:"column",gap:"12px",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center",color:"icon.base"});function lu(){return R("div",{className:iu,children:[I(Td,{Component:ou}),I(To,{wrap:"wrap",textAlign:"center",children:"A summary of this month's financials will appear here once more data is available."})]})}const su=tr({borderRadius:"lg",overflow:"auto",height:"100%",width:"100%",padding:"10px"}),cu=or({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:{}}}}),du=gr(null,tr({whiteSpace:"pre-wrap",display:"flex",alignItems:"start",gap:"10px",height:"fit-content"})),uu=tr({display:"flex",flexDirection:{base:"column",xl:"row"},flexWrap:{xl:"wrap"},gap:"10px",maxWidth:"1440px",alignItems:"flex-start"});function hu({isSample:e,period:t}){const{query:{data:n},isFilling:r}=function(e){return n={select:e=>e?.data?.[0]},Vr({queryKey:(t={limit:1,filter:{date:{equal:it(e.month,e.year)},status:{in:["ACTIVE"]}},sort:{direction:"DESC",orderBy:"DATE"}})?Rs(t):["summaries",{}],queryFn:Ds,...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 $${ii.toLocaleString()}, up from $${17924..toLocaleString()} the previous month, reflecting strong revenue growth. However, expenses also rose slightly to $${li.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=gr(lr["financial-summary-layout"],cu({isSample:e,isZeroState:o}));return R("div",{className:uu,children:[I("div",{"data-testid":"financial-summary-layout",...i,children:!e&&r?I(_d,{}):o?I(lu,{}):R("div",{className:su,children:[I(Bd,{stylists:[du],children:a}),e&&I(oi,{size:"lg"})]})}),I(au,{summaryData:n})]})}const pu=gr(lr["month-picker"],tr({display:"flex",alignItems:"center",gap:"15px",borderRadius:"md",border:"1px solid {colors.border.layout}",background:"surface.foreground",width:"fit-content"})),mu=gr(lr["month-picker-left-button"],tr({border:"none",borderRight:"1px solid {colors.border.layout}",borderRightRadius:0,_disabled:{cursor:"default"}})),gu=gr(lr["month-picker-right-button"],tr({border:"none",borderLeft:"1px solid {colors.border.layout}",borderLeftRadius:0,_disabled:{cursor:"default"}})),vu=gr(lr["month-picker-label"],tr({cursor:"default",display:"flex",justifyContent:"center",width:"75px"}));function fu({period:e,setPeriod:t,disableNext:n=!1,disablePrev:r=!1}){const a=rt(e.year,e.month,1),o=Mt(a,{abbreviateMonth:!0});return R("div",{...pu,children:[I(Xs,{stylists:[mu],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:I(cl,{Component:nl})}),I("div",{...vu,children:I(To,{children:o})}),I(Xs,{stylists:[gu],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:I(cl,{Component:rl})})]})}const bu=tr({display:"flex",justifyContent:"space-between",gap:"10px",maxWidth:"1440px",width:"100%"});function yu({children:e}){return I("div",{className:bu,children:e})}function wu(){return dn(e=>e.events.bITile)}const Cu=or({variants:{color:{positive:{backgroundColor:"money.positive.weak"},negative:{backgroundColor:"money.negative.weak"}}}}),xu=gr(lr["progress-bar"],tr({height:"32px",backgroundColor:"surface.intent.secondary",display:"flex",flexDirection:"row",alignItems:"center",border:"{borderWidths.lg} solid {colors.border.layout.weak}",borderRadius:"sm",overflow:"hidden"})),Tu=gr(lr["progress-bar-fill"],tr({borderRadius:"sm",height:"100%",display:"flex",alignItems:"center"})),ku=gr(lr["tile-bar-label"],tr({paddingLeft:"10px"})),Eu=gr(lr["tile-bar-label-outer"],tr({paddingLeft:"10px"}));function Au({label:e="",percentage:t,color:n,width:r}){const a=void 0===r?"100%":`${r}px`,o=t>=50,i="positive"===n?lr["bar-transactions-positive"]:lr["bar-transactions-negative"],l=gr(i,Cu({color:n})),s=Cr([Tu,l]);return R("div",{...xu,style:{width:a},children:[I("div",{...s,style:{width:`${t}%`},children:o&&I("div",{...ku,children:I(sc,{children:e})})}),!o&&I("div",{...Eu,children:I(sc,{children:e})})]})}const Su=gr(lr["metric-md"],tr(xr.raw({metric:"md"}),eo));function Iu(e){return I("div",{...Su,children:e.children})}const Nu=tr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"24px",width:"100%"}),Ru=tr({overflow:"visible",width:"80px",display:"flex",justifyContent:"end"});function Pu({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:Nu,children:[I(Au,{label:e,percentage:a,color:r}),I("div",{className:Ru,children:I(Iu,{children:fo(t)})})]})}const Du=vi(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"),Mu={},Lu=e=>{const t=document.querySelector(`script[src="${e}"]`);if(t)return Mu[e]={loading:!1,error:null,scriptEl:t}},Fu="undefined"!=typeof window&&void 0!==window.document;function Ou({src:e,checkForExisting:t=!1,...n}){let r=Mu[e];!r&&t&&e&&Fu&&(r=Lu(e));const[a,o]=d(r?r.loading:Boolean(e)),[i,l]=d(r?r.error:null),[c,u]=d(!1);return s(()=>{if(!Fu||!e||c||i)return;let a;r=Mu[e],!r&&t&&(r=Lu(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=Mu[e]={loading:!0,error:null,scriptEl:a});const s=()=>{r&&(r.loading=!1),o(!1),u(!0)},d=e=>{r&&(r.error=e),l(e)};return a.addEventListener("load",s),a.addEventListener("error",d),document.body.appendChild(a),()=>{a.removeEventListener("load",s),a.removeEventListener("error",d),r&&r.loading&&(a.remove(),delete Mu[e])}},[e]),[a,i]}const Vu=e=>["integrations",e??{}],Uu=async e=>{const t=e.queryKey,n={path:"/v6/integrations/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function Bu(e,t){return kl({...t,queryKey:Vu(e),queryFn:Uu})}function Hu(e){return Bu({filter:{apiName:{equal:"PLAID"}}},e)}function Wu(e){return Da(`${t=e,Ma[t]}/v1`,"v1");var t}async function zu({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:Wu(n)},{url:a,headers:o}=Sa(r);return await Ti({url:a,includeCredentials:!0,extraHeaders:o,params:e?{institutionId:e}:void 0})}const _u="cancel",ju="danger",qu="success",Ku=tr({position:"fixed",inset:0,minHeight:"100dvh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"overlay"}),Yu=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"}),Zu=or({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"}}),Gu={transform:"none",willChange:"auto"};function Qu({show:e,role:t="dialog",children:n,size:r="sm",padding:a="md",outsidePress:o=!1,escapeKey:i=!0}){const{context:l}=re({open:e,strategy:"fixed"}),s=de(l,{outsidePress:o,escapeKey:i}),c=ue(l,{role:t}),{getFloatingProps:d}=he([s,c]),u="alertdialog"===t?lr["alert-dialog"]:null,{className:h}=gr(u,Zu({size:r,padding:a}));return e?I(fe,{children:I(be,{lockScroll:!0,className:Ku,children:I(ye,{context:l,modal:!0,returnFocus:!0,children:I("div",{...d(),className:h,style:Gu,children:n})})})}):null}const Xu=gr(lr["close-button"],tr({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"}}),ll),Ju=()=>as();function $u({Icon:e=Ac,handleClose:t=Ju}={}){return I("button",{...Xu,onClick:t,type:"button",children:I(Sd,{Component:e,...Xu})})}const eh=gr(lr["alert-header"],tr({fontFamily:"heading",fontSize:"xl",fontStyle:"normal",fontWeight:"md",lineHeight:"template"},$a));function th({children:e}){return I("div",{...eh,children:e})}const nh=tr({display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"center",xl:{flexDirection:"row",justifyContent:"flex-end",gap:"10px"}}),rh=tr.raw({width:"100%"}),ah=e=>{switch(e){case oh.DANGER:return"danger";case oh.SUCCESS:return"success";case oh.ACTION:return"primary";default:return"secondary"}},oh={SUCCESS:"success",DANGER:"danger",ACTION:"action"},ih=we.createConfirmation(Ce(function({show:e,proceed:t,cancel:n,title:r,body:a,cancellable:o,buttons:i=[{key:"ok",type:"default",label:"OK"}]}){return R(Qu,{show:e,role:"alertdialog",size:"sm",padding:"md",outsidePress:!1,escapeKey:!0,children:[R("div",{className:Yu,children:[I(th,{children:r}),o&&I($u,{handleClose:()=>n()})]}),a&&"string"==typeof a?I(sc,{wrap:"wrap",children:a}):I(N,{children:a}),I("div",{className:nh,children:i.map(e=>I(Qs,{intent:ah(e.type),styles:rh,onClick:()=>e.onClick?t(e.onClick()):t(e.key),children:I(To,{children:e.label})},e.key))})]})}));function lh(e,t,n,r){const a=1===n?e:t;return r?`${n} ${a}`:a}function sh(e){return new H(e).div(100).toNumber()}function ch(e){return new H(e).times(100).toNumber()}function dh(e){const t=Math.max(4-e.length,0);return`*${e+"*".repeat(t)}`}function uh(e,t){return t?e?`${e} ${dh(t)}`:dh(t):e??""}const hh=e=>{ds(dn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:{defaultValues:e},error:null},()=>rs("Conversation",{routeProps:{conversationId:null,defaultValues:e}}))},ph=tr({display:"flex",flexDirection:"column",gap:"12px"});async function mh(e){await ih({title:"Uh Oh!",body:"Something went wrong trying to link your bank, please try again.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Chat",type:oh.SUCCESS}]})===qu&&hh({message:{text:`Please help me with my bank issue (code: ${e}). Thanks!`,attachments:[]}})}const gh=e=>["banks/accounts",e??{}],vh={integration:{expand:!0},status:{notIn:["REMOVED"]}},fh=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:xi(o)},l=await Ra(i);return"SUCCESS"===l.result&&void 0!==l.data?{data:l.data,cursor:l.cursor}:{data:void 0,cursor:void 0}};function bh(e){return kl({queryKey:gh({...e?.params,filter:{...vh,...e?.params?.filter}}),queryFn:fh,enabled:e?.enabled,select:e?.select})}function yh(e,t){return hs({queryKey:Ar(gh({filter:vh}),{}),queryFn:fh,accessToken:e,environment:t})}const wh={RELINK:"RELINK",UNLINK_RELINK:"UNLINK_RELINK",OPEN_BANK:"OPEN_BANK",DELETE_OR_RELINK:"DELETE_OR_RELINK",UNLINK_ONLY:"UNLINK_ONLY",CHAT:"CHAT"},Ch={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."}},xh={ITEM_ERROR:{INVALID_CREDENTIALS:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.RELINK},INSUFFICIENT_CREDENTIALS:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.RELINK},INVALID_MFA:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.RELINK},INVALID_UPDATED_USERNAME:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.invalidUpdatedUsername,buttonType:wh.UNLINK_RELINK},ITEM_LOCKED:{shortMessage:Ch.short.accountLocked,longMessage:Ch.long.accountLocked,buttonType:wh.OPEN_BANK},ITEM_LOGIN_REQUIRED:{shortMessage:Ch.short.credentialsChanged,longMessage:Ch.long.relinkCredentials,buttonType:wh.DELETE_OR_RELINK},ITEM_NOT_SUPPORTED:{shortMessage:Ch.short.supportChanged,longMessage:Ch.long.supportChanged,buttonType:wh.CHAT},USER_SETUP_REQUIRED:{shortMessage:Ch.short.updateNeeded,longMessage:Ch.long.updateNeeded,buttonType:wh.OPEN_BANK},MFA_NOT_SUPPORTED:{shortMessage:Ch.short.supportChanged,longMessage:Ch.long.mfaUpdateNeeded,buttonType:wh.OPEN_BANK},NO_ACCOUNTS:{shortMessage:Ch.short.noAccountsAvailable,longMessage:Ch.long.noAccountsUnlink,buttonType:wh.UNLINK_ONLY},NO_AUTH_ACCOUNTS:{shortMessage:Ch.short.noAccountsAvailable,longMessage:Ch.long.noAccountsUnlink,buttonType:wh.UNLINK_ONLY},INVALID_SEND_METHOD:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},NO_INVESTMENT_ACCOUNTS:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},NO_INVESTMENT_AUTH_ACCOUNTS:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},NO_LIABILITY_ACCOUNTS:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},PRODUCTS_NOT_SUPPORTED:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},ITEM_NOT_FOUND:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},PRODUCT_NOT_READY:{shortMessage:Ch.short.serverError,longMessage:Ch.long.productNotReady,buttonType:wh.CHAT},USER_PERMISSION_REVOKED:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.permissionRevoked,buttonType:wh.UNLINK_RELINK}},INSTITUTION_ERROR:{INSTITUTION_DOWN:{shortMessage:Ch.short.temporarilyDown,longMessage:Ch.long.bankMaintenance,buttonType:wh.CHAT},INSTITUTION_NOT_RESPONDING:{shortMessage:Ch.short.serverDown,longMessage:Ch.long.serverDown,buttonType:wh.CHAT},INSTITUTION_NOT_AVAILABLE:{shortMessage:Ch.short.temporarilyDown,longMessage:Ch.long.bankMaintenance,buttonType:wh.CHAT},INSTITUTION_NO_LONGER_SUPPORTED:{shortMessage:Ch.short.supportChanged,longMessage:Ch.long.supportChanged,buttonType:wh.CHAT}},API_ERROR:{INTERNAL_SERVER_ERROR:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT},PLANNED_MAINTENANCE:{shortMessage:Ch.short.temporarilyDown,longMessage:Ch.long.bankConnectionMaintenance,buttonType:wh.CHAT}},INVALID_REQUEST:{DEFAULT:{shortMessage:Ch.short.requestError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},INVALID_INPUT:{DEFAULT:{shortMessage:Ch.short.inputError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},INVALID_RESULT:{DEFAULT:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},RATE_LIMIT_EXCEEDED:{DEFAULT:{shortMessage:Ch.short.volumeDown,longMessage:Ch.long.bankMaintenance,buttonType:wh.CHAT}},OAUTH_ERROR:{DEFAULT:{shortMessage:Ch.short.serverError,longMessage:Ch.long.connectionError,buttonType:wh.RELINK}},CHANGE_TO_PARTNER_CREDS:{DEFAULT:{shortMessage:Ch.short.updateNeeded,longMessage:Ch.long.partnerCredsChange,buttonType:wh.UNLINK_RELINK}},PENDING_DISCONNECT:{DEFAULT:{shortMessage:Ch.short.credentialsExpiring,longMessage:Ch.long.credentialsExpiring,buttonType:wh.RELINK}},ADDITIONAL_CONSENT_REQUIRED:{DEFAULT:{shortMessage:Ch.short.relinkNeeded,longMessage:Ch.long.relinkForStatements,buttonType:wh.RELINK}},DEFAULT:{DEFAULT:{shortMessage:Ch.short.connectionError,longMessage:Ch.long.connectionError,buttonType:wh.CHAT}},UNKNOWN:{UNKNOWN:{shortMessage:Ch.short.generic,longMessage:Ch.long.generic,buttonType:wh.CHAT}}};function Th({apiErrorType:e,apiErrorCode:t}){if(!e||!t)return null;const n=xh[e];if(!n)return wa({error:new Error(`Unknown bank error type: ${e}`),severity:"error"}),xh.DEFAULT.DEFAULT;return(n[t]??n.DEFAULT)||(wa({error:new Error(`Unknown bank error code: ${t} for type: ${e}`),severity:"error"}),xh.DEFAULT.DEFAULT)}function kh(e){return!0===e?.additionalConsentRequired}const Eh=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 Ah({mutationFn:e,onMutateFn:t,onSuccess:n,onError:r,...a}){const o=Pr(),i=Or(),l=!Ir(o);return O({...a,mutationFn:l?t=>e({data:t,accessToken:o,environment:i}):Dr,onMutate:l&&cr(t)?e=>t({data:e,accessToken:o,environment:i}):void 0,onSuccess:n,onError:r},Lr)}const Sh=l({createToast:()=>null,dismiss:()=>{}});function Ih(){const{createToast:e,dismiss:t}=i(Sh);return o(()=>({success:(t,n)=>e("success",t,n),error:(t,n)=>e("error",t,n),dismiss:t}),[e,t])}function Nh({toast:e,responseErrorParser:t,toastOptions:n,onSuccess:r,onError:a}){return{onSuccess:r||n?(a,o,i)=>(n&&function(e,t,n,r,a){const o=n.defaultPartialMessage;if(cr(o)&&t.isPartialFailure(r)){const n=t.getErrorMessages(r),i="function"==typeof o?o(a):o;(n.length>0?n:[i]).forEach(t=>e.error(t))}else{const t=(i=n.defaultSuccessMessage,l=r,s=a,"function"==typeof i?i(l,s):i);cr(t)&&e.success(t)}var i,l,s}(e,t,n,a,o),r?.(a,o,i)):void 0,onError:a||n?.defaultErrorMessage?(r,o,i)=>(n&&function(e,t,n,r,a){(function(e,t,n,r){const a=t.defaultErrorMessage,o="function"==typeof a?a(r):a;if(sr(o))return[];const i=n.getErrorMessages(e);return i.length>0?i:[o]})(r,n,t,a).forEach(t=>e.error(t))}(e,t,n,r,o),a?.(r,o,i)):void 0}}function Rh(e){return"object"==typeof e&&null!==e}const Ph={isFailureResult:function(e){return Rh(e)&&"FAILURE"===e.result},isPartialFailure:function(){return!1},getErrorMessages:function(e){if(!Rh(e)||!cr(e.errors))return[];const t=[],{fieldErrors:n,globalErrors:r}=e.errors;if(cr(n))for(const a of Object.values(n))cr(a)&&Nr(a.errorMessage)&&t.push(a.errorMessage);if(Array.isArray(r))for(const a of r)cr(a)&&Nr(a.errorMessage)&&t.push(a.errorMessage);return t}};function Dh({mutationFn:e,onSuccess:t,onError:n,meta:r,...a}){const o=Ih(),{onSuccess:i,onError:l}=Nh({toast:o,responseErrorParser:Ph,toastOptions:r?.toastOptions,onSuccess:t,onError:n});return Ah({...a,mutationFn:async({data:t,accessToken:n,environment:r})=>{const a=await e({data:t,accessToken:n,environment:r});return Ph.isFailureResult(a)?Promise.reject(a):a},onSuccess:i,onError:l})}const Mh=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/account",bodyParams:{account:e},accessToken:t,endpointManager:Oa(n)};return await Pa(r)},Lh=async({data:e,accessToken:t,environment:n})=>Mh({data:e,accessToken:t,environment:n}),Fh=async({data:e,accessToken:t,environment:n})=>Mh({data:e,accessToken:t,environment:n}),Oh=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:Oa(n)};return await Pa(r)})({data:{accounts:e},accessToken:t,environment:n});function Vh(e){return Dh({onSuccess:async()=>{ya("mutation successful, invalidating bank account queries");try{return Lr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}},...e})}function Uh(){return Vh({mutationFn:Fh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update account"}}})}function Bh(){return Dh({onSuccess:async()=>{ya("mutation successful, invalidating bank account queries");try{return Lr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}},mutationFn:Oh,meta:{toastOptions:{defaultErrorMessage:"Couldn't update accounts"}}})}const Hh=e=>"CSV_IMPORT"===e||"MANUAL_ENTRY"===e,Wh=e=>"PLAID"===e,zh=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:[]}),_h=tr({display:"flex",flexDirection:"column",gap:"16px"}),jh=async()=>ih({title:"Merge Accounts",body:R("div",{className:_h,children:[I(sc,{wrap:"wrap",children:"The selected accounts and their transactions will be merged into your linked accounts."}),I(sc,{wrap:"wrap",children:"This action can't be undone."}),I(sc,{wrap:"wrap",children:"It may take a few minutes for this process to complete."})]}),buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Continue",type:oh.DANGER}]}),qh=()=>ih({title:"Merge Failed",body:I(sc,{wrap:"wrap",children:"There was an error merging your bank accounts. Please try again later."}),buttons:[{key:_u,label:"OK"}]}),{formContext:Kh,fieldContext:Yh,useFieldContext:Zh,useFormContext:Gh}=xe(),Qh=vi(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 Xh({children:e,stylists:t=[],...n}){return I(Qs,{intent:"success",stylists:t,...n,children:e})}function Jh({showIcon:e=!0,textContent:t="Save",disabled:n=!1}){return R(Xh,{type:"submit",disabled:n,children:[e&&I(cl,{Component:Qh}),I(To,{children:t})]})}const $h=tr({animation:"linear 1s spin infinite"}),ep=tr({background:"conic-gradient(from 90deg, transparent 0deg, {colors.icon.base.weak} 360deg)",height:"100%",width:"100%",opacity:1}),tp=tr({position:"relative"});function np({size:e}){const t=e??15;return I("div",{className:tp,children:R("svg",{className:$h,width:t,height:t,viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[I("g",{clipPath:"url(#paint0_angular_27751_8190_clip_path)","data-figma-skip-parse":"true",children:I("g",{transform:"matrix(0 0.0075 -0.0075 0 8.5 8.5)",children:I("foreignObject",{x:"-1266.67",y:"-1266.67",width:"2533.33",height:"2533.33",children:I("div",{className:ep})})})}),I("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}'}),I("defs",{children:I("clipPath",{id:"paint0_angular_27751_8190_clip_path",children:I("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"})})})]})})}const rp=gr(null,tr({display:"flex",width:"100%"}));function ap({showIcon:e=!0,textContent:t="Save Changes",disabled:n=!1,onClick:r,isSubmitting:a}){let o;return o=a&&e?R(N,{children:[I(np,{size:12}),I(To,{children:t})]}):a&&!e?I(np,{size:12}):!a&&e?R(N,{children:[I(cl,{Component:Qh}),I(To,{children:t})]}):I(To,{children:t}),I(kd,{type:"submit",disabled:n||a,stylists:[rp],onClick:r,children:o})}const op=or({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 ip({alignment:e="vertical",color:t="normal",additionalClassName:n}){const r=gr("vertical"===e?lr["vertical-divider"]:lr["horizontal-divider"],n,op({alignment:e,color:t}));return I("div",{...r})}const lp=tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"16px",backgroundColor:"surface.foreground",minHeight:"48px",gap:"12px",xl:{alignItems:"flex-end"}}),sp=[gr(null,tr({color:"icon.accent.danger","& path":{stroke:"icon.accent.danger"}}))],cp=gr(null,tr({display:"flex",alignItems:"center",gap:"4px"}));function dp({errorMessage:e}){return R("div",{...cp,children:[I(Sd,{Component:bi,stylists:sp}),I(Eo,{intent:"danger",wrap:"wrap",children:e})]})}const up=tr({display:"flex",width:"100%",maxWidth:"100%",justifyContent:"flex-start"});function hp({children:e,showIcon:t=!1,textContent:n,disabled:r=!1,onSave:a,error:o,isSubmitting:i}){return R(N,{children:[I(ip,{alignment:"horizontal",color:"normal"}),R("div",{className:lp,children:[e,o&&I("div",{className:up,children:I(dp,{errorMessage:o})}),I(ap,{showIcon:t,disabled:r,onClick:a,textContent:n,isSubmitting:i})]})]})}const pp=tr.raw({_notDisabled:{"&[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"}},_disabled:{backgroundColor:"surface.foreground.disabled",color:"typography.base.weak",pointerEvents:"none",borderColor:"border.layout"}}),mp=tr.raw({"&[data-haserror='true']":{border:"{borderWidths.lg} solid",borderColor:"border.intent.danger"}});function gp({isActive:e,isDefaultValue:t,isTouched:n,popupTriggerProps:r,errorMessage:a,hasErrorStyles:o,disableHover:i=!1,disabled:l=!1}){return{dataAttributes:{"data-active":e,"data-isdefaultvalue":t,"data-haserror":n&&"open"!==r?.["data-state"]&&void 0!==a||o||!1,"data-disablehover":i,"data-disabled":l||void 0}}}const vp=tr({display:"flex",flexDirection:"column",padding:"16px 16px",cursor:"pointer",outline:"none",gap:"8px",borderRadius:"md",border:"1px solid {colors.border.layout}"},pp),fp=tr(mp),bp=tr({display:"flex",flexDirection:"column",gap:"8px"}),yp=tr({display:"flex",justifyContent:"space-between",alignItems:"center"});function wp({children:e,inputRef:t,popupTriggerProps:n,label:r,isDefaultValue:a,isTouched:o,className:i,additionalStyles:l,onClick:s,onBlur:c,errorMessage:u,disableHover:h=!1,type:p,remainingChars:m,hasErrorStyles:g,disabled:v=!1}){const f=gr(i||null,vp,l,fp,ll),[b,y]=d(!0),{dataAttributes:w}=gp({isActive:b,isDefaultValue:a,isTouched:o,popupTriggerProps:n,errorMessage:u,hasErrorStyles:g,disableHover:h,disabled:v});return R("div",{className:bp,children:[R("div",{className:yp,children:[void 0!==r&&I(sc,{children:r}),cr(m)&&I(sc,{children:`${m}`})]}),I("div",{...f,onClick:s,...n,onMouseDown:e=>{y(!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:()=>{y(!1),c?.()},...w,children:e}),o&&"open"!==n?.["data-state"]&&u&&I(dp,{errorMessage:u})]})}function Cp({disabled:e=!1,...t}){const n=Zh(),r=Te(n.form.store,e=>e.isSubmitting);return I(wp,{...t,disabled:r||e})}const xp=tr({border:"{borderWidths.lg} solid transparent",backgroundColor:"surface.foreground.disabled",_notDisabled:{"&:focus-within, &[data-isdefaultvalue='false']":{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout"},"&:focus-within":{cursor:"text"}}});function Tp({children:e,inputRef:t,popupTriggerProps:n,label:r,onClick:a,disabled:o}){const i=Zh(),l=Te(i.store,e=>e.meta.errors[0]?.message),s=Te(i.store,e=>e.meta.isDefaultValue),c=Te(i.store,e=>e.meta.isTouched);return I(Cp,{label:r,inputRef:t,popupTriggerProps:n,isDefaultValue:s,isTouched:c,className:lr["discreet-form-input"],additionalStyles:xp,errorMessage:l,onClick:a,onBlur:i.handleBlur,disabled:o,children:e})}function kp(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 Ep(e){"Escape"===e.key&&e.target instanceof HTMLElement&&e.target.blur()}function Ap(e){"Enter"===e.key&&e.currentTarget.blur()}const Sp=gr(lr["amount-input"],xr({metric:"md"}),tr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer",width:"100%",_focus:{cursor:"text"}})),Ip=gr(null,tr({display:"flex",alignItems:"center",gap:"2px"}));function Np({value:e,onChange:t,inputRef:n,onClick:r,onBlur:a,autofocus:o=!1}){const[i,l]=d(!1);return R("div",{...Ip,children:[sr(e)&&I(Iu,{children:"$"}),I(Ee,{...Sp,getInputRef:n,thousandSeparator:!0,decimalScale:2,prefix:"$",value:sr(e)?"":e,onValueChange:e=>{t(void 0===e.floatValue?null:e.floatValue)},fixedDecimalScale:!i,onClick:r,onFocus:()=>l(!0),onBlur:()=>{l(!1),a?.()},onKeyDown:Ap,autoFocus:o})]})}const Rp=or({base:{backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",_disabled:{backgroundColor:"surface.foreground.disabled"}},variants:{kind:{text:{cursor:"text"},button:{cursor:"pointer"},container:{cursor:"default"}}}});function Pp({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=Zh(),h=Te(u.store,e=>e.meta.errors[0]?.message),p=Te(u.store,e=>e.meta.isTouched),m="string"==typeof u.state.value?u.state.value.length:0,g=cr(c)?c-m:void 0;return I(Cp,{label:t,inputRef:r,popupTriggerProps:o,className:lr["editable-form-input"],additionalStyles:Rp({kind:e}),errorMessage:h,onBlur:u.handleBlur,disableHover:l,onClick:i,type:s,isTouched:p,remainingChars:g,hasErrorStyles:d,disabled:a,children:n})}const Dp=gr(null,tr({display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",minWidth:"120px"}));function Mp({options:e,onSelect:t,selectedLabel:n}){const r=kc();return I("div",{...Dp,children:e.map(e=>I(Vc,{onClick:()=>{return n=Number(e.value),r.close(),void t(n);var n},active:n===e.label,children:e.label},e.value))})}const Lp=vi(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"),Fp=gr(lr["dropdown-selector-button"],tr({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"}}),ol);function Op({selectedLabel:e,options:t,onSelect:n}){return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>R("button",{...Fp,...t,children:[I(To,{children:e}),I(Sc,{Component:Lp})]})}),I(Fc,{children:I(Mp,{options:t,onSelect:n,selectedLabel:e})})]})}const Vp=gr(null,tr({display:"flex",alignItems:"center",gap:"15px"})),Up=Ct.map((e,t)=>({value:t,label:e})),Bp=xt({}).map(e=>({value:e,label:String(e)}));function Hp({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",{...Vp,children:[I(Op,{selectedLabel:Ct[r],options:Up,onSelect:e=>a(n,e)}),I(Op,{selectedLabel:String(n),options:Bp,onSelect:e=>a(e,r)})]})}const Wp=gr(null,tr({background:"surface.foreground",padding:"25px",gap:"15px"})),zp=gr(null,tr({display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px",alignSelf:"stretch",marginBottom:"30px"})),_p=gr(lr["date-picker-nav-button"],tr({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"}}),ol),jp=gr(null,tr({display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px 2px"})),qp=gr(null,tr({padding:"8px",textAlign:"center"})),Kp=gr(lr["date-picker-day-button"],tr({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"}}),ol),Yp=gr(null,tr({color:"typography.base"}));function Zp({date:e,selectedDate:t,currentMonth:n,onClick:r,maxDate:a,minDate:o}){const i=t&&Tt(e,t),l=kt(e),s=e.getMonth()!==n,c=!!a&&Et(e,a),d=!!o&&Et(o,e);return I("button",{...Kp,onClick:()=>r(e),"data-selected":i,"data-today":l,disabled:c||d,children:I(To,{stylists:s||c||d?[Yp]:[],children:e.getDate().toString()})})}function Gp({selectedDate:e,onDateSelect:t,viewDate:n,onViewDateChange:r,maxDate:a,minDate:o}){const i=kc(),l=n||/* @__PURE__ */new Date,s=l.getFullYear(),c=l.getMonth(),d=function(e,t){const n=rt(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&&Et(a,u),m=sr(o)||d.length>0&&Et(d[0],o),g=e=>{t(e),i.close()},v=e=>{const t=new Date(l);t.setMonth(l.getMonth()+e),r(t)};return R("div",{...Wp,children:[R("div",{...zp,children:[I("button",{..._p,onClick:()=>v(-1),disabled:!m,"aria-label":"Previous month",children:I(cl,{Component:nl})}),I(Hp,{currentMonthYear:l,onMonthYearChange:r}),I("button",{..._p,onClick:()=>v(1),disabled:!p,"aria-label":"Next month",children:I(cl,{Component:rl})})]}),R("div",{...jp,children:[wt.map(e=>I("div",{...qp,children:I(Eo,{children:e})},e)),d.map(t=>I(Zp,{date:t,selectedDate:e,currentMonth:c,onClick:g,maxDate:a,minDate:o},t.toISOString()))]})]})}const Qp=gr(null,xr({label:"default"}),tr({outline:"none",border:"none",padding:0,backgroundColor:"transparent",flex:1,cursor:"pointer","&:focus":{cursor:"text"}})),Xp=gr(null,xr({label:"default"}),tr({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 Jp(e){null!==e.current&&(e.current.scrollIntoView({behavior:"instant",block:"end"}),e.current.setAttribute("data-hasscrolled","true"))}async function $p(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 em=/* @__PURE__ */new Set(["pdf","xls","xlsx","csv","txt","jpg","jpeg","png","gif","heic","jfif","tif","tiff","svg","webp"]),tm=[...em].map(e=>`.${e}`).join(","),nm=/* @__PURE__ */new Set(["xls","xlsx","csv"]),rm={pendingUpload:"Uploading...",uploadError:"Failed to upload. Try uploading again.",unsupportedFileType:`Unsupported file type. Please upload a ${[...em].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."},am={"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 om(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 im(e,t,n){return om(e,null,e.name,t,!1,!0,n)}async function lm(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||!em.has(r))return rm.unsupportedFileType;if(e.size>52428800)return nm.has(r)?rm.fileTooLargeSpreadsheet:rm.fileTooLarge;const a=t.filter(t=>t.file.size===e.size);if(a.length>0){const t=await $p(e);for(const e of a)if(await $p(e.file)===t)return rm.duplicate}return null}(e,t);return n?im(e,n):om(e,null,e.name,rm.pendingUpload,!0,!1)}const sm=async({data:e,accessToken:t,environment:n})=>{const{file:r,entity:a,caption:o,entityId:i}=e,l=Oa(n).getUrl(`/files/upload/${a}`),s=Ir(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 cm(){return Ah({mutationFn:sm,onSuccess:async()=>Lr.invalidateQueries({queryKey:["files/attachments"]})})}const dm=async({data:e,accessToken:t,environment:n})=>{const r=Oa(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 um=tr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),hm=tr({display:"none"}),pm=({onFileSelect:e,onUploadComplete:t,existingAttachments:n})=>{const r=a(null),{mutateAsync:o}=function(){const{mutateAsync:e}=cm();return{mutateAsync:u(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 om(e.file,n,r,"",!1,!1,e.localId,a,o,i)}return im(e.file,rm.uploadError,e.localId)}(e,r[t]))},[e])}}(),i=u(()=>{r.current?.click()},[]),l=u(async a=>{const i=Array.from(a.target.files??[]);if(0===i.length)return;const l=await Promise.all(i.map(e=>lm(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:[I("input",{className:hm,type:"file",multiple:!0,accept:tm,ref:r,onChange:l}),I(Xs,{type:"button",onClick:i,children:I("span",{className:um,children:I(Sd,{Component:Jc})})})]})},mm=S.custom(),gm=S.object({message:S.object({text:S.string(),attachments:S.array(mm)}).refine(e=>e.text.trim().length>0||e.attachments.some(e=>null!==e.id),{message:"Either message text or attachments are required"})}),vm=tr.raw({maxHeight:150,maxWidth:"100%",whiteSpace:"pre-wrap",overflowWrap:"break-word",width:"100%",boxSizing:"border-box",margin:0,padding:0,fontFamily:"body"}),fm=tr.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"}),bm=tr(fm,vm),ym=tr.raw({resize:"none",inset:0,outline:"none",overflow:"auto",position:"absolute",appearance:"none",border:"none",backgroundColor:"transparent",fontSize:"16px"}),wm=tr(ym,vm,xr.raw({body:"default"})),Cm=tr({display:"block",width:"100%"}),xm=tr({position:"relative"}),Tm=tr({display:"flex",justifyContent:"flex-end",gap:"15px"}),km=tr({paddingInline:"8px",display:"flex",alignItems:"start",justifyContent:"center"}),Em=p(function({blockSubmit:e=!1,scrollRef:t,setActiveKeyboard:n,onFileSelect:r,onUploadComplete:o,hideFileUpload:i},l){const s=Zh(),c=a(null),{startCallback:d}=El({delay:50,callback:e=>n(e)});g(l,()=>c.current);const u=!e&&gm.safeParse(s.form.state.values).success;return I(Pp,{kind:"text",inputRef:c,disableHover:!0,onClick:()=>(Jp(t),void d(!0)),children:R("div",{className:Cm,children:[R("div",{className:xm,children:[R("pre",{className:bm,children:[s.state.value.text,I("br",{})]}),I("textarea",{ref:c,placeholder:"Message...",value:s.state.value.text,className:wm,onChange:e=>s.handleChange({...s.state.value,text:e.target.value})})]}),R("div",{className:Tm,children:[!i&&I(pm,{onFileSelect:r,onUploadComplete:o,existingAttachments:s.state.value.attachments}),I(Xs,{disabled:!u,type:"submit",children:I("span",{className:km,children:I(Sd,{Component:Nd})})})]})]})})}),Am=e=>"MANUAL_ENTRY"===e.apiName||"CSV_IMPORT"===e.apiName,Sm=l(Object.freeze({map:/* @__PURE__ */new Map,register:()=>{},unregister:()=>{},focusedIndex:null,isMousing:!0,isScrolling:!1,listRef:void 0,popupNodeId:void 0,newCascade:void 0}));function Im(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 Nm(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 Rm(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 Pm(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 Dm(e){const[t,n]=d(()=>/* @__PURE__ */new Map),{listRef:r,focusedState:l,isMousing:c,isScrolling:h}=function(e,t){const n=a(null),[r,o]=d(!0),[l,c]=d(!1),u=i(Sm),[h,p]=v(Im,{focusedIndex:null,maxIndex:e});s(()=>{const e=n.current,r=()=>{!t.forceRootCascade&&sr(h.focusedIndex)&&void 0!==u?.popupNodeId&&p({type:"set",focusedIndex:0})};return e?.addEventListener("focus",r),()=>{e?.removeEventListener("focus",r)}},[n,h.focusedIndex,p,u?.popupNodeId,t.forceRootCascade]);const m=a(null);return s(()=>{p({type:"max",max:e})},[e]),s(()=>{const e=n.current;if(null!==e){const n=e=>{c(!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&&m.current===e.target||(0!==e.movementX||0!==e.movementY)&&n&&(o(!0),m.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),c(!1),t?(e.preventDefault(),p({type:"increment",repeat:e.repeat})):n&&(e.preventDefault(),p({type:"decrement",repeat:e.repeat}))},a=()=>c(!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:l}}(t.size-1,e),p=kc(),m=u((e,t)=>{n(n=>new Map(n).set(e,t??null))},[]),g=u(e=>{n(t=>{const n=new Map(t);return n.delete(e),n})},[]),{sortedNodes:f,sortedMap:b}=function(e,t){const n=o(()=>{let n=[];return null!==t.current&&(n=Array.from(e.keys()).sort(Nm)),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){s(()=>{const i=e.current;if(!i)return;const l=e=>{const{node:l,metadata:s}=Pm(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,m,g,v;c||"Enter"===e.key||u?(p=r,m=l,g=i,v=o,!(!(h=s)||!h.hasCascading||null===p||m&&g&&Rm(m,g)&&(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,f,b,l.focusedIndex,p,e);const{startCallback:y,cancelCallback:w}=El({delay:200,callback:({focusedIndex:t,node:n,listElement:r})=>{n&&r&&Rm(n,r)?e.setCascadeState(!0,t):e.closeCurrentCascade()}});return C=l.focusedIndex,s(()=>{const e=E.current;if(null===C||x)return;const{node:t,metadata:n}=Pm(C,T,k);return A.lastOpenedIndex!==C&&n?.hasCascading&&(A.closeCurrentCascade(),S({focusedIndex:C,node:t,listElement:e})),()=>I()},[C,x=c,E=r,A=e,I=w,T=f,k=b,S=y]),function(e,t,n,r){s(()=>{const{metadata:a}=Pm(e,t,n);null===e||a?.hasCascading||r.closeCurrentCascade()},[r,e,n,t])}(l.focusedIndex,f,b,e),o(()=>({register:m,unregister:g,map:b,focusedIndex:l.focusedIndex,listRef:r,isMousing:c,isScrolling:h,popupNodeId:p?.nodeId}),[m,g,b,l.focusedIndex,r,c,h,p?.nodeId]);var C,x,T,k,E,A,S,I}const Mm=l(Object.freeze({cascadeIndex:null,setCascadeState:()=>{},onScroll:()=>{},focus:!1,setFocus:()=>{},lastOpenedIndex:null,closeCurrentCascade:()=>{},forceRootCascade:void 0}));function Lm({style:e,children:t,forceNewCascade:n}){const r=gr(lr["popup-list"],bc,e),a=function(e){const[t,n]=d(null),[r,a]=d(!1),[o,i]=d(null),l=u((e,r)=>{e&&t!==r?(i(r),n(r)):e||t!==r||(a(!1),n(null))},[t,a]),s=u(()=>{n(null),i(null),a(!1)},[n,i,a]),c=u(()=>{n(null),i(null),a(!1)},[]);return{cascadeIndex:t,setCascadeState:l,onScroll:s,focus:r,setFocus:a,lastOpenedIndex:o,closeCurrentCascade:c,forceRootCascade:e}}(n),o=Dm(a);return I("div",{...r,onScroll:a.onScroll,ref:o.listRef,tabIndex:0,children:I(Sm.Provider,{value:o,children:I(Mm.Provider,{value:a,children:t})})})}function Fm({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=Nr(e),h=e=>{n?.(e)};return R(N,{children:[d&&I(a,{searchTerm:e,setSearchTerm:t,placeholder:r}),d&&u?I(o,{...l??{},onClick:h,searchTerm:e}):I(i,{...l??{},onClick:h})]})}const Om=rr(xr({body:"default"}),tr({display:"flex",alignItems:"center",padding:"10px",flex:1,border:"none",outline:"none",background:"transparent",width:325,minWidth:325,"&::placeholder":{color:"typography.base.weak"}}));function Vm({searchTerm:e,setSearchTerm:t,placeholder:n}){const r=a(null);return s(()=>{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)}},[]),I("input",{ref:r,type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Om})}function Um({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i,getSearchActiveStyles:l}){const s=kc(),[c,u]=d(""),h=Nr(c),p=l?.(h);return I(Fc,{children:I(Lm,{style:p,children:I(Fm,{searchTerm:c,setSearchTerm:u,onClick:t=>{e?.(t),s.close()},placeholder:t,SearchInput:Vm,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})})})}function Bm({hasCascading:e=!1}={}){const t=a(null),{register:n,unregister:r,map:l,focusedIndex:s,isMousing:c,listRef:d}=i(Sm);m(()=>{const a=t.current;if(a)return n(a,{index:0,hasCascading:e}),()=>{r(a)}},[n,r,e]);const h=o(()=>void 0!==l&&null!==t.current?l.get(t.current)?.index??-1:-1,[l]),p=h===s;m(()=>{p&&(c||t.current?.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"}))},[p,c]);const g=u(()=>{d?.current?.focus()},[d]),v=o(()=>({onFocus:g,"data-focused":p}),[g,p]);return{itemRef:t,isActive:p,index:h,itemProps:v}}const Hm=p(function({onClick:e,index:t,children:n,itemProps:r,popupTriggerProps:a},o){return I("button",{...wc,onClick:e,"data-listitem":!0,"data-index":t,...a,...r,ref:o,children:n})}),Wm=p(function({onClick:e,children:t,popupTriggerProps:n},r){const{index:a,itemProps:o,itemRef:i}=Bm(),l=ve([i,r]);return I(Hm,{...wc,onClick:e,index:a,...n,itemProps:o,ref:l,children:t})}),zm=tr({display:"flex",gap:"8px",alignItems:"center"});function _m({promptText:e}){return R("div",{className:zm,children:[I(cl,{Component:Os}),I(sc,{children:e})]})}function jm({text:e}){return I("div",{...wc,children:e?I(To,{children:e}):I(Xo,{styles:tr({width:"100%",height:"16px"})})})}const qm=gr(lr["popup-list"],bc),Km=()=>R("div",{...qm,children:[I(jm,{}),I(jm,{}),I(jm,{}),I(jm,{}),I(jm,{})]});function Ym({bankAccounts:e,onClick:t,isFilling:n,showAddButton:r=!1}){return n?I(Km,{}):R(N,{children:[r&&I(Wm,{onClick:()=>rs("BankAccountForm"),children:I(_m,{promptText:"Add bank account"})}),e?.map(e=>I(Wm,{onClick:()=>t(e),children:I(To,{wrap:"wrap",children:uh(e?.name,e?.mask)})},e?.id))]})}const Zm={keys:[{name:"name"}],threshold:.3,includeScore:!0,minMatchCharLength:1},Gm={...Zm,keys:[{name:"apiAccountName",weight:2},{name:"apiAccountNo",weight:1}]};function Qm({bankAccounts:e,searchTerm:t,onClick:n,isFilling:r,showAddButton:a=!1}){const i=o(()=>new Ae(e??[],Gm),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(Km,{}):R(N,{children:[a&&I(Wm,{onClick:()=>rs("BanksAndIntegrations"),children:I(_m,{promptText:"Add bank account"})}),0===l.length?I(jm,{text:"No results found"}):l.map(e=>I(Wm,{onClick:()=>n(e),children:I(To,{wrap:"wrap",children:uh(e?.name,e?.mask)})},e?.id))]})}function Xm({onClick:e,bankAccounts:t,isFilling:n,showAddButton:r=!1}){return I(Um,{onClick:e,placeholder:"Search bank accounts...",SearchList:Qm,DefaultList:Ym,extraProps:{bankAccounts:t,isFilling:n,showAddButton:r},listLength:t?.length??0})}const Jm=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function $m({label:e,disabled:t,bankAccount:n,bankAccountOptions:r,isFilling:a,onClick:o}){const i=uh(n?.name??"",n?.mask??"");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:r=>I(Pp,{label:e,popupTriggerProps:r,disabled:t,children:I("button",{className:Jm,type:"button",disabled:t,children:cr(n)?I(sc,{children:i}):I(sc,{intent:"weak",children:"Select bank account"})})})}),I(Xm,{bankAccounts:r,isFilling:a,onClick:o,showAddButton:!0})]})}const eg=/* @__PURE__ */new Set(["QBO","XERO","BENCH","PARTNER_IMPLEMENTATION","UNIT","MANUAL_ENTRY","CSV_IMPORT","TAXBOT","CAPITAL_ONE","PLAID","DEDUCTR","WAVE"]),tg=e=>{if(sr(e))return!1;const t=e.filter(e=>Wh(e.apiName)&&"ACTIVE"===e.status&&!0===e.isSupported);return void 0!==t&&t.length>0&&!t.some(e=>!e.syncTransactions||cr(e.lastSyncedDate))},ng=()=>{const e=bh({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 bh({select:e=>{return{...e,plaidItemAccountsReadyToSync:tg(e.data),hasPlaidLinkedBankAccount:(t=e.data,void 0!==t?.find(e=>Wh(e.apiName)))};var t}})}function ag(e){return e?.filter(e=>Hh(e.apiName)&&"ACTIVE"===e.status)}function og(e,t){return e?.filter(e=>e.integration?.id===t)||[]}function ig(e){return bh({select:t=>({...t,data:og(t?.data,e)})})}const lg=e=>{const{query:t}=bh({select:t=>{return{...t,data:(n=t?.data,r=e,n?.find(e=>e.id===r))};var n,r}});return t.data?.data};function sg({options:e,onClick:t}){const n=kc();return I(Fc,{children:I(Lm,{children:e.map((e,r)=>I(Wm,{onClick:()=>(t(e),void n.close()),children:I(sc,{children:e.label})},`${e.label}_${r}`))})})}const cg=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"})),dg=tr.raw({color:"typography.base.weak"}),ug=(e,t)=>e===t;function hg({options:e,label:t,isEqual:n=ug,isEmpty:r,disabled:a}){const o=Zh(),i=(e,t)=>{const r=e.find(e=>n(e.value,t));return r?.label},l=!sr(o.state.value)&&!r?.(o.state.value);return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:n=>I(Pp,{label:t,popupTriggerProps:n,disabled:a,children:I("button",{...cg,type:"button",children:I(sc,l?{children:i(e,o.state.value)}:{extraClassNames:[dg],children:`Select ${t.toLowerCase()}...`})})})}),I(sg,{options:e,onClick:e=>{o.handleChange(e.value),o.handleBlur()}})]})}const pg=tr({border:"none",outline:"none",backgroundColor:"transparent"},xr.raw({label:"default"})),mg=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"})),gg=vi(mg,"Bank",{styleIconKey:"bank"}),vg=or({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 fg({accountName:e,accountNo:t,syncText:n,active:r=!0}){const a=t?uh(e,t):e;return R("div",{className:vg({active:r}),children:[n&&I(Eo,{intent:r?"normal":"weak",children:n}),I(sc,{wrap:"ellipsis",intent:r?"default":"weak",children:a})]})}const bg=e=>["plaidInstitutionLogo",e??{}],yg=gr(lr["category-icon"],tr({objectFit:"contain"})),wg=gr(lr["category-icon"],tr({objectFit:"contain",color:"icon.base"}));function Cg(e,t,n){const r=({size:n=24})=>{const{icons:r}=i(mi),a=e;return Nr(o=a)&&o.split("?")[0].toLowerCase().endsWith(".svg")?I(Se,{src:a,title:t,width:n,height:n,style:{minHeight:n,minWidth:n},...wg}):I("img",{src:a,alt:t,width:n,height:n,style:{minHeight:n,minWidth:n},...yg});var o};return r.displayName=t,r}const xg=tr({display:"flex",gap:"10px",maxWidth:"100%"});function Tg({accountName:e,accountNo:t,institutionId:n,syncText:r,active:a=!0,showIcon:o=!0}){const i=function(e){const t=Pr(),n=Or();return M({queryKey:bg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>await zu({institutionId:e,accessToken:t,environment:n}),staleTime:864e5}).data?.map?.logo}(n),l=i?Cg(i,"Logo"):void 0;return R("div",{className:xg,children:[I(Td,{Component:l&&o?l:gg}),I(fg,{accountName:e,accountNo:t,active:a,syncText:r})]})}const kg=gr(lr.text,xr({label:"strongLabel"}),tr({maxWidth:"100%"}),Xa);function Eg({children:e,stylists:t=[]}){const n=Cr([kg,...t]);return I("div",{...n,children:e})}const Ag=tr({maxWidth:"100%",display:"flex",gap:"10px",alignItems:"center"});function Sg({selectedAccount:e,placeholderText:t,disabled:n=!1,popupTriggerProps:r}){return I(Xs,{popupTriggerProps:r,disabled:n,width:"fill-parent",children:I(Eg,{children:e?uh(e.name,e.mask):R("div",{className:Ag,children:[I(sc,{children:t}),I(cl,{Component:Os})]})})})}const Ig="TRIGGER_ACCOUNT",Ng="FORM_SELECTABLE_ACCOUNT",Rg=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function Pg({selectedAccount:e,setSelectedAccount:t,mergeDestination:n,bankAccounts:r,isFilling:a,warningMessage:o}){return R("div",{className:Rg,children:[R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(Sg,{popupTriggerProps:t,selectedAccount:e,placeholderText:n===Ig?"Select Duplicate Bank Account":"Select Destination Bank Account"})}),I(Xm,{bankAccounts:r,isFilling:a,onClick:t})]}),o&&I(dp,{errorMessage:o})]})}const Dg=(e,t,n)=>{if(!n)return;const r=e===Ng?t:n,a=e===Ng?n:t,o=(i=r.mask,l=a.mask,!i||!l||i!==l);var i,l;const s=(c=r?.apiName,d=a?.apiName,Wh(c)&&Hh(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},Mg=tr({display:"flex",flexDirection:"column",gap:{base:"15px",sm:"0"}}),Lg=tr({display:{base:"block",sm:"none"}}),Fg=tr({display:"grid",gridTemplateColumns:{sm:"300px auto 175px",base:"1fr"},gap:"10px",alignItems:"center"}),Og=tr({display:"flex",justifyContent:"center",alignItems:"center"}),Vg=tr({display:{base:"none",sm:"block"}}),Ug=tr({display:{base:"block",sm:"none"}});function Bg({destinationAccount:e,selectedDuplicate:t,availableAccounts:n,isFilling:r,onSelectionChange:a}){const o=n&&n.length>0;return R("div",{className:Mg,children:[R("div",{className:Fg,children:[o?I(Pg,{selectedAccount:t,setSelectedAccount:a,mergeDestination:Ig,bankAccounts:n,isFilling:r,warningMessage:Dg(Ig,e,t??null)}):I(Sg,{disabled:!0,selectedAccount:t,placeholderText:"No Duplicate Accounts Available"}),R("div",{className:Og,children:[I("div",{className:Vg,children:I(Sd,{Component:rl})}),I("div",{className:Ug,children:I(Sd,{Component:Lp})})]}),I(Tg,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""})]}),I("div",{className:Lg,children:I(ip,{alignment:"horizontal"})})]})}function Hg({queryKey:e,queryFn:t,...n}){const r=Pr(),a=Or(),o=Nr(r),i=Er(e,r??"",a),l=D(),s=U({...n,queryKey:i,queryFn:o?t:Dr,initialPageParam:null,getNextPageParam:e=>e?.cursor?.after,...o?{}:{retry:!1,staleTime:1/0}},Lr);return{isRehydrating:l,isFilling:l||s.isLoading,query:s}}const Wg=e=>["vendors",e??{}],zg=e=>["vendors","infinite",e??{}],_g=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/vendors/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:xi(r)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},jg=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return _g({queryParams:n,cursor:r,accessToken:a,environment:o})};function qg(e={},t){return kl({queryKey:Wg(e),queryFn:jg,...t})}const Kg=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return _g({queryParams:n,cursor:o,accessToken:r,environment:a})},Yg="FAILURE";function Zg(e){return"object"==typeof e&&null!==e}function Gg(e){return!!Zg(e)&&(e.result===Yg||Array.isArray(e.data)&&e.data.some(Gg))}const Qg={isFailureResult:function(e){return Zg(e)&&e.result===Yg},isPartialFailure:function(e){return!(!Zg(e)||e.result===Yg)&&Array.isArray(e.data)&&e.data.some(Gg)},getErrorMessages:function e(t){if(!Zg(t))return[];const n=[];if(Array.isArray(t.error))for(const r of t.error)cr(r)&&Nr(r.message)&&n.push(r.message);if(Array.isArray(t.data))for(const r of t.data)n.push(...e(r));return n}};function Xg({onSuccess:e,onError:t,meta:n,...r}){const a=Ih(),{onSuccess:o,onError:i}=Nh({toast:a,responseErrorParser:Qg,toastOptions:n?.toastOptions,onSuccess:e,onError:t});return Ah({...r,onSuccess:o,onError:i})}async function Jg(e){const{url:t,headers:n}=Sa(e);return async function(e){const{authorization:t,extraHeaders:n,params:r,url:a}=e,o=ka({extraHeaders:n,authorization:t});ya("HTTP DELETE Request",{url:a,accessToken:t});try{const e=await fetch(a,{method:"DELETE",headers:o,credentials:"include",body:JSON.stringify(r)});return ya("HTTP DELETE Response",{url:a,status:e.status,statusText:e.statusText}),Ea(e)}catch(i){return Promise.reject(i)}}({url:t,params:e.bodyParams,extraHeaders:n})}async function $g(e){return Jg(e)}const ev=async({data:e,accessToken:t,environment:n})=>Ra({path:"/v6/vendors",bodyParams:e,accessToken:t,endpointManager:xi(n)}),tv=async({data:e,accessToken:t,environment:n})=>$g({path:"/v6/vendors/{id}",pathParams:e,accessToken:t,endpointManager:xi(n)}),nv=async({data:e,accessToken:t,environment:n})=>Ra({path:"/v6/vendors",bodyParams:{data:[{id:e.targetId,duplicateVendorIds:[e.duplicateId]}]},accessToken:t,endpointManager:xi(n)}),rv=async()=>await Lr.invalidateQueries({queryKey:["vendors"]});function av(){return Xg({mutationFn:ev,onSuccess:rv,meta:{toastOptions:{defaultSuccessMessage:"Vendor saved",defaultErrorMessage:"Couldn't save vendor"}}})}const ov=rr(xr({body:"default"}),tr({display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flex:1,border:"none",outline:"none",background:"transparent","&::placeholder":{color:"typography.base.weak"}})),iv=tr({display:"flex",alignItems:"center",width:"100%",gap:"8px"}),lv=gr(lr["button-inline"],tr({display:"flex",alignItems:"center",justifyContent:"center",background:"brand.success",color:"typography.contrast",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:"sm",outline:"none"}));function sv({placeholder:e,value:t,onChange:n,onSubmit:r,onCancel:a,inputRef:o}){return R("div",{className:iv,children:[I("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:ov}),I("button",{type:"button",onClick:r,...lv,children:I(Eo,{children:"Add"})})]})}function cv({promptText:e,placeholderText:t,onSubmit:n}){const[r,o]=d(!1),[i,l]=d(""),c=a(null);return s(()=>{r&&c.current&&c.current.focus({preventScroll:!0})},[r]),I(Wm,{onClick:r?void 0:()=>{o(!0)},children:r?I(sv,{placeholder:t,value:i,onChange:l,onSubmit:()=>{i.trim()&&(n(i.trim()),l(""),o(!1))},onCancel:()=>{l(""),o(!1)},inputRef:c}):I(_m,{promptText:e})})}function dv({vendors:e,searchTerm:t,onClick:n,isLoading:r,onCreateVendor:a}){const i=o(()=>new Ae(e??[],Zm),[e]),l=o(()=>e?i.search(t).map(e=>e.item):[],[e,t,i]);return r?I(Km,{}):R(N,{children:[I(cv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:a}),0===l.length?I(jm,{text:"No results found"}):l.map(e=>I(Wm,{onClick:()=>n(e),children:I(sc,{children:e.name})},e.id))]})}function uv({vendors:e,onClick:t,isLoading:n,onCreateVendor:r}){return n?I(Km,{}):R(N,{children:[I(cv,{promptText:"Add a vendor",placeholderText:"Enter vendor name...",onSubmit:r}),e.map(e=>I(Wm,{onClick:()=>t(e),children:I(sc,{children:e.name})},e.id))]})}function hv({onClick:e}){const{query:{data:t,isLoading:n}}=qg({filter:{status:{in:["ACTIVE"]}}}),{mutate:r}=av(),a=t?.data??[];return I(Um,{onClick:e,placeholder:"Search vendors...",SearchList:dv,DefaultList:uv,extraProps:{vendors:a,isLoading:n,onCreateVendor:e=>{r({data:[{name:e}]})}},listLength:a.length})}const pv=tr({all:"unset"});function mv({children:e}){return I("div",{tabIndex:0,role:"button",className:pv,children:e})}function gv(e){return{id:e.id,name:e.name,email:e.email||void 0}}const vv=e=>["customers",e??{}],fv=e=>["customers","infinite",e??{}],bv=async({queryParams:e,accessToken:t,cursor:n,environment:r})=>{const a={path:"/v6/customers/query",bodyParams:{...e,cursor:n},accessToken:t,endpointManager:xi(r)},o=await Ra(a);return"SUCCESS"===o.result&&void 0!==o.data?{data:o.data,cursor:o.cursor}:{data:void 0,cursor:void 0}},yv=async e=>{const t=e.queryKey,n=t[1],r=t[2].cursor,a=t[3].accessToken,o=t[3].environment;return bv({queryParams:n,cursor:r,accessToken:a,environment:o})};function wv(e={},t){return kl({queryKey:vv(e),queryFn:yv,...t})}const Cv=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o=e.pageParam;return bv({queryParams:n,cursor:o,accessToken:r,environment:a})},xv=async({data:e,accessToken:t,environment:n})=>Ra({path:"/v6/customers",bodyParams:e,accessToken:t,endpointManager:xi(n)}),Tv=async({data:e,accessToken:t,environment:n})=>$g({path:"/v6/customers/{id}",pathParams:e,accessToken:t,endpointManager:xi(n)}),kv=async()=>await Lr.invalidateQueries({queryKey:["customers"]});function Ev(){return Xg({mutationFn:xv,onSuccess:kv,meta:{toastOptions:{defaultSuccessMessage:"Customer saved",defaultErrorMessage:"Couldn't save customer"}}})}const Av={left:"-100%",right:"100%"},Sv={type:"tween",duration:.3},Iv={x:0},Nv=e=>({x:Av[e]}),Rv=e=>({x:Av[e]});function Pv({children:e,forceMount:t,fadeIn:n=!0}){const r={transform:"none",willChange:"auto",...n?{}:{animation:"none"}};return I(Fc,{style:r,modal:!0,forceMount:t,children:e})}const Dv=tr({backgroundColor:"overlay",display:"flex",justifyContent:"center",alignItems:"center"}),Mv=gr(null,Dv);function Lv({children:e,clickHandler:t}){const n=kc();return t||(t=()=>{n.close()}),I(be,{lockScroll:!0,...Mv,onClick:t,children:e})}const Fv=tr({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 Ov({children:e,overlay:t=!1}){const n=kc(),r=u(e=>{e.stopPropagation()},[]);return I(Ie,{children:n.context.open&&R(Pv,{fadeIn:!1,forceMount:!0,children:[t&&I(Lv,{}),I(Ne.div,{transition:Sv,initial:Nv("right"),animate:Iv,exit:Rv("right"),className:Fv,onAnimationEnd:r,children:e})]})})}const Vv=tr.raw({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.foreground",padding:"8px 16px",maxWidth:"100%",overflow:"hidden",width:"100%"}),Uv=tr.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"}),Bv=gr(lr["drawer-header"],tr(Vv));function Hv({hideDivider:e=!1,children:t}){return R(N,{children:[I("header",{...Bv,children:t}),!e&&I(ip,{alignment:"horizontal",color:"normal"})]})}const Wv=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",textOverflow:"ellipsis",maxWidth:"100%",whiteSpace:"nowrap"});function zv({children:e}){return I("div",{className:Wv,children:e})}const _v=tr({position:"absolute",right:"16px",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px"}),jv=or({base:Uv,variants:{padChildren:{true:{padding:"16px"},false:{padding:0}}},defaultVariants:{padChildren:!0}});function qv({Footer:e,HeaderRightAction:t,children:n,onClose:r,padChildren:a,title:o}){const i=kc();return R(N,{children:[I(Hv,{children:R(zv,{children:[I($u,{Icon:nl,handleClose:()=>{r?.(),i.close()}}),I(To,{children:o}),!sr(t)&&I("div",{className:_v,children:t})]})}),I("div",{className:jv({padChildren:a}),children:n}),e]})}function Kv({overlay:e=!1,...t}){return I(Ov,{overlay:e,children:I(qv,{...t})})}const Yv=vi(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"}),Zv=tr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px",width:"100%"}),Gv=gr(lr["drawer-search-bar"],tr({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"})),Qv=rr(tr({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"}}),xr({label:"strongLabel"})),Xv=gr(null,tr({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}));function Jv({searchTerm:e,setSearchTerm:t,placeholder:n}){return R("div",{className:Zv,children:[I(To,{children:"Search"}),R("div",{...Gv,children:[I(Sd,{Component:Yv}),I("input",{type:"text",placeholder:n,value:e,onChange:e=>t(e.target.value),className:Qv}),Nr(e)&&I(Xs,{stylists:[Xv],onClick:()=>t(""),children:I(Sd,{Component:Ac})})]})]})}function $v({onClick:e,placeholder:t,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i}){const[l,s]=d("");return I(Fm,{searchTerm:l,setSearchTerm:s,onClick:t=>{e?.(t)},placeholder:t,SearchInput:Jv,SearchList:n,DefaultList:r,extraProps:a,listLength:o,forceSearchVisible:i})}function ef({data:e,groups:t,getRowKey:n,getGroupKey:r,state:a,onSelectedChange:i,onExpandedChange:l,hasMultiSelect:s=!1,getCanSelect:c,getCanExpand:d}){const[h,p]=Cc({},a?.selected,i),[m,g]=Cc({},a?.expanded,l),v=u((e,t)=>{const n=t??!h[e],r={[e]:n};p(s?{...h,...r}:r)},[h,p,s]),f=u((e,t)=>{const n=t??!m[e],r={[e]:n};g({...m,...r})},[m,g]),b=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:m[r]??!1,getCanSelect:()=>c?.(e)??!0,getIsSelected:()=>h[r]??!1,toggleSelected:e=>v(r,e),getCanExpand:()=>d?.(e)??!0,getIsExpanded:()=>m[r]??!1,toggleExpanded:()=>f(r,!m[r])}})})),[e,r,t,n,h,v,m,f,c,d]);return o(()=>{const e={selected:h,expanded:m};return{groups:b,toggleSelected:v,toggleExpanded:f,getState:()=>e}},[b,v,f,m,h])}const tf=vi(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"),nf=tr({paddingTop:"50px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px"});function rf({singularSearchCTANoun:e,pluralNounNotFound:t,showSearchCTA:n}){return R("div",{className:nf,children:[I(Sd,{Component:tf}),I(To,{wrap:"wrap",children:`No ${t} found`}),n&&I(Eo,{wrap:"wrap",children:`Try searching for a different ${e}`})]})}const af=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function of({children:e}){return I("div",{className:af,children:e})}const lf=gr(lr["list-body"],null);function sf({title:e,children:t}){return R(of,{children:[e,I("div",{...lf,children:t})]})}const cf=vi(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"),df=gr(null,tr({fill:"surface.intent.action.active"}));function uf({selected:e,showEmptyIndicator:t}){return e?I(Sd,{Component:wi,stylists:[df]}):t?I(Sd,{Component:cf}):null}const hf=or({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 pf({children:e,handleClick:t,popupTriggerChildrenProps:n,selected:r=!1}){const a=gr(lr["selector-row"],hf({selected:r}),ll);return I("button",{onClick:t,...a,...n,type:"button",children:e})}function mf({children:e,handleClick:t,selected:n=!1,isMultiSelect:r=!1}){return R(pf,{handleClick:t,selected:n,children:[e,I(uf,{selected:n,showEmptyIndicator:r})]})}const gf=tr.raw({padding:"0",height:{sm:"35px",base:"51px"},cursor:"default",border:0});function vf(){return I(Xo,{styles:tr(yc,gf)})}const ff=tr({width:"70px",height:"24px"}),bf=tr({display:"flex",flexDirection:"column",justifyContent:"flex-start",width:"100%",gap:"16px"});function yf(){return R("div",{className:bf,children:[I(Xo,{styles:ff}),R(of,{children:[I(vf,{}),I(vf,{}),I(vf,{})]}),I(Xo,{styles:ff}),R(of,{children:[I(vf,{}),I(vf,{}),I(vf,{})]})]})}function wf({customers:e,searchTerm:t,isLoading:n,selectedRow:r,onSelectedChange:a,onClick:i}){const l=o(()=>new Ae(e,Zm),[e]),s=ef({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?I(yf,{}):0===s.groups.length?I(rf,{singularSearchCTANoun:"customer",pluralNounNotFound:"customers",showSearchCTA:!0}):I(sf,{title:I(sc,{children:"Search Results"}),children:s.groups.map(e=>{const[t]=e.getRows();return I(mf,{handleClick:()=>i(t.value),selected:t.getIsSelected(),children:I(sc,{children:t.value.name})},t.key)})})}const Cf=tr({display:"flex",flexDirection:"column",justifyContent:"start",gap:"8px"}),xf=tr({width:"100%"});function Tf({promptText:e,placeholderText:t,onSubmit:n,onPromptClick:r,keepInlineCreateOnPromptClick:o=!1}){const[i,l]=d(!1),[c,u]=d(""),h=a(null);s(()=>{i&&h.current&&h.current.focus({preventScroll:!0})},[i]);const p=()=>{u(""),l(!1)};return R("div",{className:xf,onKeyDown:e=>{"Escape"===e.key&&e.stopPropagation()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||p()},children:[I(ip,{alignment:"horizontal"}),I(pf,{handleClick:i?void 0:()=>{r&&(r(),!o)||l(!0)},children:i?I(sv,{placeholder:t,value:c,onChange:u,onSubmit:()=>{c.trim()&&(n(c.trim()),u(""),l(!1))},onCancel:p,inputRef:h}):I(_m,{promptText:e})})]})}function kf(){return dn(e=>e.events.customer)}function Ef({customers:e,isLoading:t,onCreateCustomer:n,selectedRow:r,onSelectedChange:a,onClick:o}){const i=kf(),l=ef({data:e.map(e=>[e]),getRowKey:e=>e.id,getGroupKey:({groupIndex:e})=>e.toString(),state:{selected:r},onSelectedChange:a});return t?I(yf,{}):R(of,{children:[I(Tf,{promptText:"Add a customer",placeholderText:"Enter customer name...",onSubmit:n,onPromptClick:i?()=>i.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}):void 0,keepInlineCreateOnPromptClick:cr(i)&&!i.preventDefault}),R("div",{className:Cf,children:[I(sc,{children:"Customers"}),I("div",{children:l.groups.map(e=>{const[t]=e.getRows();return I(mf,{handleClick:()=>o(t.value),selected:t.getIsSelected(),children:I(sc,{children:t.value.name})},t.key)})})]})]})}function Af({onClick:e,currentCustomer:t}){const{query:{data:n,isLoading:r}}=wv({filter:{status:{in:["ACTIVE"]}}},{select:e=>({...e,data:e.data?.map(gv)})}),{mutateAsync:a}=Ev(),o=kc(),i=n?.data??[],[l,s]=d(t?{[t.id]:!0}:{}),c=!l[t?.id??""];return I(Kv,{title:"Back",Footer:I(hp,{onSave:()=>{const t=Object.keys(l).find(e=>l[e]),n=i.find(e=>e.id===t);n&&e(n),o.close()},disabled:!c}),onClose:()=>s(t?{[t.id]:!0}:{}),children:I($v,{placeholder:"Search customers...",onClick:e=>{sr(e)||s(t=>t[e.id]?{}:{[e.id]:!0})},SearchList:wf,DefaultList:Ef,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 Sf({frequencies:e,onClick:t}){const n=kc();return I(Fc,{children:I(Lm,{children:e.map(e=>I(Wm,{onClick:()=>(t(e),void n.close()),children:I(To,{children:e.name})},e.value))})})}const If=or({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%"},fit:{width:"fit-content%",minWidth:"100px"}},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 Nf({option:e,isActive:t,handleClick:n,onHoverChange:r,width:a,backgroundColor:o,corners:i}){if(void 0===e)return null;const l=gr(lr["button-group"],rr(If({width:a,backgroundColor:o,active:t,corners:i}),Ws,Us,tr(Ys),ol));return I("button",{type:"button",...l,onClick:n,onMouseEnter:()=>r?.(!0),onMouseLeave:()=>r?.(!1),"data-active":t,children:t?I(To,{wrap:"wrap",textAlign:"center",children:e.label}):I(sc,{wrap:"wrap",alignment:"center",children:e.label})})}const Rf=or({base:{display:"flex",flexDirection:"row",isolation:"isolate"},variants:{width:{full:{width:"100%"},fit:{width:"fit-content"}}}});function Pf({width:e,children:t}){return I("div",{className:Rf({width:e}),children:t})}function Df({width:e="full",options:t,handleClick:n,selectedIndex:r}){const[a,o]=d(null);return I(Pf,{width:e,children:t.map((t,i)=>R(f,{children:[0!==i&&I(ip,{color:i!==r&&i!==r+1||a===r?"normal":"active"}),I(Nf,{option:t,isActive:i===r,handleClick:()=>n(i),onHoverChange:e=>o(e?i:null),width:e,backgroundColor:"foreground",corners:"rounded"})]},t.value))})}const Mf=vi(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"),Lf=tr({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}"},pp,mp,il),Ff=gr(null,tr({color:"icon.base"})),Of=gr(lr["attachment-dropzone"],Lf);function Vf({getRootProps:e,getInputProps:t,onBlur:n,onMouseDown:r,dataAttrs:a}){return R("div",{...a,...e({className:Of.className,onMouseDown:r,onBlur:n}),children:[I("input",{...t()}),I(Sd,{stylists:[Ff],Component:Mf}),I(sc,{children:"Add Files"})]})}const Uf=tr({display:"flex",flexDirection:"column",gap:"8px"}),Bf=tr({display:"flex",justifyContent:"space-between",alignItems:"center"});function Hf({getRootProps:e,getInputProps:t,dataAttrs:n,onMouseDown:r,onBlur:a,label:o,errorMessage:i,isTouched:l}){return R("div",{className:Uf,children:[o&&I("div",{className:Bf,children:I(sc,{children:o})}),I(Vf,{getRootProps:e,getInputProps:t,onMouseDown:r,onBlur:a,dataAttrs:n}),l&&i&&I(dp,{errorMessage:i})]})}const Wf=tr({display:"flex",justifyContent:"start",width:"100%"}),zf=tr({display:"flex",alignItems:"center",gap:"9px"}),_f=tr({width:"100%"}),jf=or({base:{display:"flex",flexDirection:"column",width:"100%"},variants:{nested:{true:{gap:"8px"}}}});function qf(e){return"REQUIRED"===e.requiredness&&"REQUIRED"===e.child?.requiredness}function Kf({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||!qf(n)}),[e,t]),s=o(()=>new Ae(l,Zm),[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 I(rf,{singularSearchCTANoun:"dimension value",pluralNounNotFound:"dimension values",showSearchCTA:!0});const u=d.some(e=>e.length>1);return R(N,{children:[I("div",{className:Wf,children:I(sc,{children:"Search Results"})}),I("div",{className:jf({nested:u}),children:d.map(e=>I("div",{className:_f,children:e.map(e=>I(pf,{handleClick:()=>i(e),selected:r[e.id],children:R("div",{className:zf,children:[I(uf,{selected:r[e.id],showEmptyIndicator:!r[e.id]}),I(sc,{children:e.name})]})},e.id))},e[0].id))})]})}const Yf=vi(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"),Zf=or({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"}}}}),Gf=tr({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"}}),Qf=tr({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 Xf({children:e,onClick:t,onExpandToggle:n,active:r,expanded:a,canSelect:o=!0}){const i=gr(lr["selector-row"],Zf({active:r,expanded:a}),ll);return R("div",{...i,children:[o?R("button",{type:"button",className:Gf,onClick:t,children:[I(uf,{selected:r,showEmptyIndicator:!r}),e]}):I("div",{className:Gf,children:e}),!sr(n)&&I("button",{type:"button",className:Qf,onClick:n,children:I(Sd,{Component:a?Yf:Lp})})]})}function Jf({dimensionValueRows:e,onClick:t}){return e.map(e=>I(pf,{handleClick:()=>t(e.value),selected:e.getIsSelected(),children:R("div",{className:zf,children:[I(uf,{selected:e.getIsSelected(),showEmptyIndicator:!e.getIsSelected()}),I(sc,{children:e.value.name})]})},e.key))}function $f({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=ef({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||!qf(t)}}),c=s.groups.some(e=>e.getRows().length>1);return R(N,{children:[I("div",{className:Wf,children:I(sc,{children:e})}),I("div",{className:jf({nested:c}),children:s.groups.map((e,t)=>{if(c){const[n,...r]=e.getRows();return R("div",{className:_f,children:[(c||0===t)&&I(ip,{alignment:"horizontal"}),I(Xf,{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:I(sc,{children:n.value.name})}),n.expanded&&R(N,{children:[I(ip,{alignment:"horizontal"}),I(Jf,{dimensionValueRows:r,onClick:i})]})]},e.key)}return I(Jf,{dimensionValueRows:e.getRows(),onClick:i},e.key)})})]})}function eb({onClick:e,...t}){const{allowMultiselect:n,dimensionValueOptions:r,selectedRow:a,setSelectedRow:o}=t,i=u(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 I($v,{placeholder:`Search ${t.fieldDimension.toLowerCase()}...`,onClick:i,SearchList:Kf,DefaultList:$f,listLength:t.flatDimensionValues.length,extraProps:t})}function tb({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||!qf(n)}),[n,r]),[l,s]=d(()=>t?.id&&i.flat().some(e=>e.id===t.id)?{[t.id]:!0}:{}),c=o(()=>i.flat(),[i]),u=kc(),h=Object.values(l).some(Boolean);return I(qv,{title:"Back",Footer:I(hp,{onSave:()=>{const e=Object.keys(l).find(e=>l[e]),t=c.find(t=>t.id===e);t&&(a(t),u.close())},disabled:!h}),children:I(eb,{onClick:e=>{s(t=>({[e.id]:!t[e.id]}))},fieldDimension:e,dimensionValueOptions:i,dimensions:r,flatDimensionValues:c,selectedRow:l,setSelectedRow:s})})}function nb(e){const t=kc();return I(Ov,{children:t.open&&I(tb,{...e})})}const rb=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"}),ab=tr.raw({color:"typography.base.weak"});function ob(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 ib=/\D/g,lb=tr({border:"none",outline:"none",backgroundColor:"transparent"},xr.raw({label:"default"})),sb=tr({display:"flex",width:"14px",height:"14px",padding:"2px",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px",borderRadius:"sm"}),cb=or({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:"template",color:"typography.intent.secondary"},variants:{disabled:{true:{userSelect:"none",cursor:"not-allowed",opacity:.5}}}}),db=tr({border:"none",background:"none",padding:0,cursor:"pointer"}),ub=tr({maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default"});function hb({text:e,onClickRemove:t,additionalValidClassName:n,disabled:r=!1}){return R("div",{...gr(lr.pill,n,cb({disabled:r})),children:[I("div",{className:ub,children:e}),I("button",{className:db,onClick:t,disabled:r,children:I(Sc,{Component:Ac,stylists:[gr(null,sb)]})})]})}const pb=S.email(),mb=tr({display:"flex",flexWrap:"wrap",gap:"4px",alignItems:"center",width:"100%"}),gb=tr({outline:"none",border:"none",flexGrow:1,backgroundColor:"transparent"},xr.raw({label:"default"})),{useAppForm:vb,withForm:fb,withFieldGroup:bb}=ke({formContext:Kh,fieldContext:Yh,formComponents:{SaveButton:Jh,FormSaveButton:ap,FormFooter:hp},fieldComponents:{DiscreetAmountField:function({label:e}){const t=a(null),n=Zh();return I(Tp,{inputRef:t,label:e,children:I(Np,{value:n.state.value,onChange:n.handleChange,inputRef:t})})},EditableAmountField:function({label:e,hasErrorStyles:t,autofocus:n=!1}){const r=a(null),o=Zh();return I(Pp,{inputRef:r,label:e,hasErrorStyles:t,children:I(Np,{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=Zh(),s=Te(l.store,e=>e.meta.isDefaultValue),c=a(null),[u,h]=d(()=>l.state.value?Nt(l.state.value):/* @__PURE__ */new Date),p=l.state.value?Nt(l.state.value):null,[m,g]=d(""),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);g(r);const a=It(r);if(a){let e=a;t&&n?e=Dt(Pt(a,t),n):t?e=Pt(a,t):n&&(e=Dt(a,n)),l.handleChange(Rt(e)),h(e)}else l.handleChange("")},f=m||(p?At(p):""),[b,y]=d(!1),w=e=>{b&&(()=>{if(p&&!s){const e=It(m);(t&&e&&Et(e,t)||n&&e&&Et(n,e))&&g(At(p))}})(),y(e)},C=e=>{"Enter"===e.key&&(e.preventDefault(),w(!b))},x=o?Pp:Tp;return R(Tc,{placement:"bottom-start",onOpenChange:w,open:b,children:[I(Ec,{children:t=>I(x,{label:e,inputRef:c,popupTriggerProps:t,onClick:()=>y(!0),hasErrorStyles:i,children:I("input",{...Qp,ref:c,type:"text",id:l.name,value:f,onChange:v,placeholder:"MM/DD/YYYY",maxLength:10,autoFocus:r,onKeyDown:C,autoComplete:"off"})})}),I(Fc,{initialFocus:!1,children:I(Gp,{selectedDate:p,onDateSelect:e=>{l.handleChange(Rt(e)),g(At(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=Zh(),i=a(null);return I(Pp,{label:e,inputRef:i,children:I("textarea",{...Xp,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:Em,ManualBankAccountField:function({transaction:e}){const{state:{value:t},handleChange:n,handleBlur:r}=Zh(),a=lg(t?.id??""),{query:{data:o},isFilling:i}=bh({select:e=>({...e,data:ag(e?.data)})}),l=o?.data,s=cr(e)&&!Am(e);return I($m,{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=Zh(),r=t.findIndex(e=>e.value===n.state.value);return I(Pp,{label:e,disableHover:!0,children:I(Df,{options:t,selectedIndex:r,handleClick:e=>{n.handleChange(t[e].value.toString())}})})},GenericSelectorField:hg,TextField:function({label:e,type:t="text",maxLength:n,disabled:r,placeholder:o="Enter value..."}){const i=Zh(),l=a(null);return I(Pp,{label:e,disabled:r,inputRef:l,kind:"text",type:t,maxLength:n,children:I("input",{className:pg,value:i.state.value,onChange:e=>i.handleChange(e.target.value),type:t,maxLength:n,ref:l,placeholder:o})})},BulkMergeAccountRowField:Bg,VendorFieldInput:function({label:e,onClick:t,vendor:n,editable:r=!1}){const o=a(null),i=r?Pp:Tp,{handleBlur:l}=Zh();return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(mv,{children:I(sc,{intent:n?.name?"default":"weak",children:n?.name||"Select vendor"})})})}),I(hv,{onClick:e=>{t(e),l()}})]})},CustomerFieldInput:function({label:e,onClick:t,customer:n,editable:r=!1}){const o=a(null),i=r?Pp:Tp;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(i,{inputRef:o,label:e,popupTriggerProps:t,children:I(mv,{children:I(sc,{intent:n?.name?"default":"weak",children:n?.name||"Select customer"})})})}),I(Af,{onClick:t,currentCustomer:n})]})},FrequencyFieldInput:function({label:e,onClick:t,frequency:n}){const r=a(null),o=`${n?.name??ms[0].name}`;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>I(Pp,{inputRef:r,label:e,popupTriggerProps:t,children:I(To,{children:o})})}),I(Sf,{frequencies:ms,onClick:t})]})},AttachmentDropzoneField:function({maxFiles:e=3,accept:t=am,disabled:n=!1,label:r,errorMessage:a,isTouched:o=!1,hasErrorStyles:i=!1,disableHover:l=!1}){const s=Zh(),c=Te(s.form.store,e=>e.isSubmitting),{mutateAsync:u}=cm(),[h,p]=d(!0),{dataAttributes:m}=gp({isActive:h,isDefaultValue:!1,isTouched:o,popupTriggerProps:void 0,errorMessage:a,hasErrorStyles:i,disableHover:l,disabled:n||c}),{getRootProps:g,getInputProps:v}=Re({maxFiles:e,accept:t,disabled:n||c,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=>lm(e,n))),...i.map(e=>im(e,rm.maxAttachmentsReached))];s.setValue(e=>[...(e??[]).filter(e=>!e.hasError),...l]);const c=l.filter(e=>!e.hasError);if(0===c.length)return;const d=c.map(async e=>{try{const t=await u({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(d);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 I(Hf,{getRootProps:g,getInputProps:v,dataAttrs:m,onMouseDown:()=>p(!0),onBlur:()=>p(!1),label:r,errorMessage:a,isTouched:o})},DimensionValueField:function({fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a}){return R(Tc,{children:[I(Ec,{children:n=>I(Pp,{label:e,popupTriggerProps:n,children:I("button",{className:rb,type:"button",children:I(sc,t?{children:t.name}:{extraClassNames:[ab],children:`Select ${e.toLowerCase()}...`})})})}),I(nb,{fieldDimension:e,selectedDimensionValue:t,dimensionValueOptions:n,dimensions:r,onSave:a})]})},PhoneNumberField:function({label:e,disabled:t,placeholder:n="(555) 555-5555"}){const r=Zh(),o=a(null),i=a(null);return m(()=>{null!==i.current&&o.current&&(o.current.setSelectionRange(i.current,i.current),i.current=null)}),I(Pp,{label:e,disabled:t,inputRef:o,kind:"text",children:I("input",{className:lb,value:ob(r.state.value),onChange:function(e){const t=e.target,n=t.selectionEnd??t.value.length,a=t.value.slice(0,n).replace(ib,"").length,o=t.value.replace(ib,"").slice(0,10);r.handleChange(o),r.setErrorMap({onBlur:void 0});const l=ob(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=Zh(),[o,i]=d(""),l=a(null),s=r.state.value,c=()=>{const e=o.trim().toLowerCase();e&&(e=>{if(!e)return!1;const t=pb.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 I(Pp,{label:e,disabled:t,inputRef:l,kind:"container",children:R("div",{className:mb,children:[s.map(e=>I(hb,{text:e,onClickRemove:()=>{r.handleChange(s.filter(t=>t!==e)),r.setErrorMap({onChange:void 0})},additionalValidClassName:lr["email-pill"],disabled:t},e)),I("input",{ref:l,className:gb,value:o,onChange:e=>{i(e.target.value),r.setErrorMap({onChange:void 0})},onBlur:c,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),c()):"Backspace"===e.key&&""===o&&s.length>0&&r.handleChange(s.slice(0,-1))},placeholder:n,disabled:t,type:"text",autoComplete:"off"})]})})}}});const yb=[gr(null,tr({"& path":{stroke:"icon.base"}}))];function wb({showIcon:e=!0,textContent:t="Cancel",onClick:n}){return R(Xs,{type:"button",onClick:n,children:[e&&I(cl,{Component:Ac,stylists:yb}),I(To,{children:t})]})}const Cb=tr({display:"flex",flexDirection:"column",gap:"20px",padding:"20px",width:"100%",maxWidth:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",minWidth:{md:"800px",base:"100%"}}),xb=tr({display:"flex",flexDirection:"column",gap:"10px",flexShrink:0}),Tb=tr({maxWidth:"600px"}),kb=tr({display:"flex",flexDirection:"column",gap:"15px",flexGrow:1,flexShrink:1,minHeight:0,overflowY:"auto"}),Eb=tr({display:{base:"none",md:"grid"},gridTemplateColumns:"300px auto 175px",gap:"10px",alignItems:"center"}),Ab=tr({display:"flex",justifyContent:"flex-start",alignItems:"center"}),Sb=tr({display:"flex",justifyContent:{md:"center",base:"flex-start"},alignItems:"center"}),Ib=tr({display:"flex",justifyContent:{md:"flex-end",base:"flex-start"},alignItems:"center"}),Nb=tr({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"15px",justifyContent:"flex-end",paddingTop:"10px",borderTop:"1px solid",borderColor:"border.layout",flexShrink:0}),Rb=e=>{kp(e),Ep(e)};function Pb({destinationAccounts:e,matchingAccountPairs:t,handleClose:n}){const{query:{data:r},isFilling:a}=bh(),o={selectedAccounts:e.filter(e=>e.glAccountId&&e.isSupported).map(e=>({duplicateAccount:void 0,destinationAccount:e}))},i=function(e,t,n){const{mutateAsync:r}=Bh(),a=Pr(),o=Or(),i=cr(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,ps({queryKey:Ar(fs({filter:{bankAccount:{id:{in:[t]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),queryFn:ys,accessToken:n,environment:r}))}),vb({defaultValues:l,onSubmit:async e=>{if(await jh()===ju){const n=e.value.selectedAccounts.filter(e=>void 0!==e.duplicateAccount);if(!a)return void(await qh());const l=i?await Promise.all(n.map(async({destinationAccount:e,duplicateAccount:t})=>{const n=await async function(e,t,n){const r=Ar(fs({filter:{bankAccount:{id:{in:[e]}},status:{in:["ACTIVE"]}},sort:{orderBy:"DATE",direction:"DESC"},limit:1}),{cursor:void 0}),a=await hs({queryKey:r,queryFn:ys,accessToken:t,environment:n});return a?.data?.[0]?.date}(t.id,a,o),r=(i=Nt(e.tranStartDate||""),l=Nt(n||""),s=Nt(e.tranMinStartDate||""),sr(l)?i:cr(s)?Dt(l,s):(cr(i)&&Dt(l,i),i));var i,l,s;return sr(r)?null:Rt(r)})):[],s=n.map(({duplicateAccount:e,destinationAccount:t},n)=>{const r=l[n];return{...zh(t),duplicateBankAccountIds:[cs(e.id)],...r&&{tranStartDate:r}}});try{await r(s),t()}catch{await qh()}}},onSubmitInvalid:()=>{}})}(o,n,t),l=i.state.values.selectedAccounts.map(e=>e.destinationAccount);return R("form",{className:Cb,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i.handleSubmit()},onKeyDown:Rb,children:[R("div",{className:xb,children:[I(To,{children:"Merge Accounts"}),I("div",{className:Tb,children:I(sc,{wrap:"wrap",children:"If you have historical transactions from imported accounts, you can merge them into your linked accounts."})})]}),R("div",{className:kb,children:[R("div",{className:Eb,children:[I("div",{className:Ab,children:I(To,{children:"Duplicate Account"})}),I("div",{className:Sb,children:I(To,{children:"Into"})}),I("div",{className:Ib,children:I(To,{children:"Destination Account"})})]}),I(i.AppField,{mode:"array",name:"selectedAccounts",children:e=>e.state.value.map((t,n)=>I(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)&&Hh(e.apiName)&&"REMOVED"!==e.status)}(l,e.state.value,n,r?.data);return I(Bg,{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))})]}),I("div",{className:Nb,children:I(i.Subscribe,{selector:e=>e.values.selectedAccounts,children:e=>{const t=e.some(e=>void 0!==e.duplicateAccount);return R(N,{children:[I(wb,{showIcon:!1,onClick:()=>n()}),I(kd,{onClick:()=>i.reset(o),disabled:!t,children:I(To,{children:"Clear Selections"})}),I(Jh,{showIcon:!1,disabled:!t,textContent:"Merge"})]})}})})]})}const Db=tr({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"}),Mb=we.createConfirmation(Ce(function({show:e,dismiss:t,matchingAccountPairs:n,plaidItemAccounts:r}){const a=n?n.map(e=>e.destinationAccount):r;return I(Qu,{show:e,role:"dialog",size:"lg",padding:"none",outsidePress:!1,escapeKey:!0,children:I("div",{className:Db,children:I(Pb,{destinationAccounts:a,matchingAccountPairs:n,handleClose:()=>t()})})})}));async function Lb({plaidItemAccounts:e,matchingAccountPairs:t}){await Mb({matchingAccountPairs:t,plaidItemAccounts:e})}const Fb=tr({display:"flex",flexDirection:"column",gap:"12px"}),Ob=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:Wu(n)},{url:a,headers:o}=Sa(r);return Ti({url:a,includeCredentials:!0,extraHeaders:o,params:t?{plaidItemId:t}:void 0})}({plaidItemId:e,accessToken:t,environment:n});return r.link_token?(ya("Plaid Link Token created successfully",{accessToken:t,plaidItemId:e,link_token:r.link_token}),r.link_token):(wa({error:new Error("Plaid Link Token missing in response"),severity:"error",extraData:{accessToken:t,plaidItemId:e,res:r}}),mh("NO_LINK_TOKEN"))}catch(r){return wa({error:new Error("Plaid Link Token creation failed"),severity:"error",extraData:{accessToken:t,plaidItemId:e,error:r}}),mh("LINK_TOKEN_FAILED")}};async function Vb(e,t,n){const r=await async function(e,t){const n=Ar(Vu({filter:{apiName:{equal:"PLAID"}}}),{cursor:void 0}),r=await hs({queryKey:n,queryFn:Uu,accessToken:e,environment:t});return r?.data??[]}(t,n);return r?.find(t=>t.apiInstitutionId===e&&"ACTIVE"===t.status)}async function Ub(e,t,n,r){ya("savePlaidItemPublicToken",{publicToken:e,metadata:t,accessToken:n,environment:r});try{t.institution&&t.institution.institution_id&&t.institution.name||ya("Plaid metadata missing institution info",{metadata:t,publicToken:e});const o=await async function(e,t,n){if(e){r=t,a=n,ps({queryKey:Ar(gh({filter:vh}),{}),queryFn:fh,accessToken:r,environment:a});const o=await Vb(e,t,n);if(o){const e=await yh(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:Wu(r)},{url:o,headers:i}=Sa(a);return await Ia({url:o,params:{publicToken:e,plaidMetadata:t},includeCredentials:!0,extraHeaders:i})}({publicToken:e,metadata:t,accessToken:n,environment:r});if(ya("Plaid Public Token exchanged successfully",{metadata:t,publicToken:e}),await async function(){await Promise.all([Lr.invalidateQueries({queryKey:["integrations"]}),Lr.invalidateQueries({queryKey:["banks/accounts",{}]}),Lr.invalidateQueries({queryKey:["banks/transactions",{}]})])}(),a=i,"RELINK"===Th({apiErrorType:a.apiErrorType,apiErrorCode:a.apiErrorCode})?.buttonType)return wa({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 yh(n,r),s=l?.data?.filter(e=>Hh(e.apiName)&&"ACTIVE"===e.status)||[];return await async function(e,t,n,r,a){const o=n.institution?.name,i=x(e.plaidItemAccounts,t,"id");if(0===i.length)return 0===(e.plaidItemAccounts??[]).length?(wa({error:new Error("No accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),async function(e){await ih({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:_u,label:"Cancel"},{key:qu,label:"Chat",type:oh.SUCCESS}]})===qu&&hh({message:{text:`I tried to link with ${e} and no accounts were returned (CODE: BANK_NO_ACCOUNTS).`,attachments:[]}})}(o||"my bank")):void wa({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 wa({error:new Error("No new valid accounts were linked from Plaid"),severity:"error",extraData:{metadata:n,publicToken:r,plaidItem:e}}),ih({title:"Uh Oh!",body:`There are no new/valid income or expense accounts in your ${o} account.`,buttons:[{key:_u,label:"OK"}]});const l=i.filter(e=>!e.isSupported);if(e.plaidItemAccounts&&l&&l.length>0)return wa({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 ih({title:"All set! Ready to track your transactions?",body:R("div",{className:ph,children:[I(sc,{wrap:"wrap",children:`Your ${n} ${t} ${lh("account","accounts",n)} are now linked. All transactions will be organized into easy-to-understand categories.`}),I(sc,{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.`}),I("ul",{children:e.map(e=>I("li",{children:I(sc,{wrap:"wrap",children:uh(e.apiAccountName??"",e.apiMask??"")})},e.apiMask))})]}),buttons:[{key:qu,label:"Get Started",type:oh.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:Eh(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 ih({title:"Your transactions are being categorized",body:R("div",{className:Fb,children:[I(sc,{wrap:"wrap",children:`Your ${e} account(s) are now linked.`}),I(sc,{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})=>I("li",{children:I(sc,{wrap:"wrap",children:uh(e?.name??"",e?.mask??"")})},e?.id)),a&&I("li",{children:I(sc,{wrap:"wrap",children:"and more..."})})]}),I(sc,{wrap:"wrap",children:"We suggest you merge these accounts into your newly linked accounts. Would you like to review suggestions?"})]}),buttons:[{key:_u,label:"No thanks"},{key:qu,label:"Review",type:oh.SUCCESS}]})===qu&&await Lb({matchingAccountPairs:t,plaidItemAccounts:n})}({institutionName:o??"your bank",matchingAccountPairs:s,plaidItemAccounts:s.map(e=>e.destinationAccount)}):e.plaidItemAccounts?(wa({error:new Error("Accounts saved successfully"),severity:"info",extraData:{metadata:n,publicToken:r,plaidItem:e}}),((e,t)=>ih({title:"All set! Ready to track your transactions?",body:`Your ${t} ${e} ${lh("account","accounts",t)} are now linked. All transactions will be organized into easy-to-understand categories.`,buttons:[{key:qu,label:"Get started",type:oh.SUCCESS}]}))(o,e.plaidItemAccounts.length)):void 0}(i,o,t,e,s),{}}catch(o){return wa({error:new Error("Plaid Public Token exchange failed"),severity:"error",extraData:{metadata:t,publicToken:e,error:o}}),await async function(e){await ih({title:"Uh Oh!",body:"It appears something went wrong with your connection while linking your bank. Please try again.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Chat",type:oh.SUCCESS}]})===qu&&hh({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 Bb(e,t,n){return sr(e)?(ya("Plaid Link exited by user with error",{metadata:t,error:e,linkToken:n}),!1):(ya("Plaid Link exited by user without error",{metadata:t,linkToken:n}),"ITEM_NO_ERROR"===e.error_code||"item-no-error"===e.error_code?(wa({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&&(wa({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 ih({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:_u,label:"Cancel"},{key:"chat",label:"Chat"},{key:qu,label:"Banks & Integrations",type:oh.SUCCESS}]});"chat"===t?hh({message:{text:"Please help me with my bank issue (code: INVALID_UPDATED_USERNAME). Thanks!",attachments:[]}}):t!==qu||(e=>{const t=dn.getState().drawerHistory;return Object.keys(t).includes(e)})("BanksAndIntegrations")||rs("BanksAndIntegrations")}(t.institution?.name||"Invalid Updated Username")),!1))}const Hb=e=>{const t=e.find(e=>e.isSupported&&e.lastSyncedDate);if(t&&t.lastSyncedDate)return`Last synced ${Lt(t.lastSyncedDate)}`},Wb=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},zb="PLAID_LINK_NEW",_b="PLAID_LINK_UNLINK_RELINK",jb="PLAID_LINK_UPDATE",qb="PLAID_LINK_UNLINK";function Kb({plaidEvent:e,apiAccessToken:t,apiErrorCode:n}){const r=t?{plaidAccessToken:t}:null,a=null!=n;switch(e){case zb:return{type:"PLAID_LINK_NEW",result:"SUCCESS",data:null,error:null};case jb:return a?{type:"PLAID_LINK_RESET",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RESET",result:"SUCCESS",data:r,error:null};case _b:return a?{type:"PLAID_LINK_RELINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_RELINK",result:"SUCCESS",data:r,error:null};case qb:return a?{type:"PLAID_LINK_UNLINK",result:"FAILURE",data:null,error:{errorCode:n}}:{type:"PLAID_LINK_UNLINK",result:"SUCCESS",data:r,error:null};default:return null}}function Yb({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}}}function Zb(){return dn(e=>e.events.plaidLink)}function Gb(){return dn(e=>e.events.plaidLinkEvent)}function Qb(){return dn(e=>e.events.plaidLinkError)}const Xb=l({});function Jb({onPlaidLink:e,children:t}){return I(Xb.Provider,{value:{onPlaidLink:e},children:t})}function $b(){return i(Xb)}const ey=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:e,accessToken:t,endpointManager:Oa(n)};return await Pa(r)};function ty(){return Ah({mutationFn:ey,onSuccess:()=>{const e=["integrations"];return Lr.invalidateQueries({queryKey:e})}})}const ny=async({accessToken:e,environment:t})=>{const n={path:"/banks/refresh",accessToken:e,endpointManager:Oa(t)};return await Pa(n)};function ry(){return Ah({mutationFn:ny,onSuccess:()=>{const e=["integrations"];return Lr.invalidateQueries({queryKey:e})}})}const ay=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/integration",bodyParams:{id:String(cs(e.id)),removeFromApi:e.removeFromApi},accessToken:t,endpointManager:Oa(n)};return await async function(e){return Jg(e)}(r)};function oy(){const{mutate:e}=ry();return Ah({mutationFn:ay,onSuccess:()=>{const e=["integrations"];return Lr.invalidateQueries({queryKey:e})},onError:async t=>{wa({error:new Error("error while deleting Plaid Item"),severity:"error",extraData:{error:t}}),await ih({title:"Uh Oh!",body:"It appears something went wrong with your connection while unlinking your bank. Please try again.",buttons:[{key:_u,label:"Cancel"},{key:qu,label:"Try Again",type:oh.SUCCESS}]})===qu&&e()}})}function iy(e,t){return new Promise(n=>{window.Plaid.create({token:e,onSuccess:(e,t)=>n({status:"success",public_token:e,metadata:t}),onExit:(e,t)=>n({status:"exit",metadata:t,error:e}),onEvent:(e,n)=>{ya(`Plaid event: ${e}`,{metadata:n,eventName:e}),t?.listener({type:"PLAID_LINK_EVENT",result:"SUCCESS",data:{eventName:e,metadata:n},error:null})}}).open()})}async function ly(e,t,n,r,a,o){const i=await Ob(e,t,n);if(!i)return;const l=await iy(i,a);if("success"===l?.status){const{public_token:e,metadata:i}=l;ya("Plaid link successful",{public_token:e,metadata:i});const s=await Ub(e,i,t,n);if(s.relinkPlaidItemId)return ly(s.relinkPlaidItemId,t,n,r,a,o)}else if("exit"===l?.status){const{metadata:e,error:t}=l;ya("Plaid link exited",{metadata:e,error:t}),t&&o?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await Bb(t,e,i)&&r()}else wa({error:new Error("Plaid Link did not return a status and failed to open"),severity:"error",extraData:{plaidItemId:e,plaidLinkStatus:l,token:i}})}function sy(){const[e,t]=Ou({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Pr(),r=Or(),{mutate:a}=ry(),{onPlaidLink:o}=$b(),i=Zb(),l=Gb(),s=Qb();return{linkPlaid:e=>{if(cr(i)){const t=Kb(e);if(cr(t)&&i.listener(t),i.preventDefault)return}if(cr(o)){const t=Yb(e);o(t)}else ly(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,a,l,s)},loading:e||cr(t),hasOnPlaidLinkOverride:cr(i)||cr(o)}}function cy(){const[e,t]=Ou({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),n=Pr(),r=Or(),{mutate:a}=ry(),{apiPartnerName:o}=i(Qc),{onPlaidLink:l}=$b(),s=Zb(),c=Gb(),d=Qb();return{linkPlaid:e=>{if(cr(s)){const t=Kb(e);if(cr(t)&&s.listener(t),s.preventDefault)return}if(cr(l)){const t=Yb(e);l(t)}else!async function(e,t,n,r,a,o,i){const l=await Ob(e,t,n);if(!l)return;const s=await iy(l,o);if("success"===s?.status){const{public_token:e,metadata:l}=s;ya("Plaid link from search successful",{public_token:e,metadata:l});const c=await async function(e,t,n,r,a){if(t?.institution?.institution_id){const i=await Vb(t.institution.institution_id,n,r);if(i)return wa({error:new Error("Plaid Item already linked for institution"),severity:"error",extraData:{metadata:t,publicToken:e,plaidItem:i}}),await(o=a,ih({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:_u,label:"Cancel"},{key:qu,label:"Relink",type:oh.SUCCESS}]}))===qu?{relinkPlaidItemId:cs(i.id)}:{}}var o;return ya("Saving Plaid Public Token from search",{metadata:t,publicToken:e}),Ub(e,t,n,r)}(e,l,t,n,r);c.relinkPlaidItemId&&ly(c.relinkPlaidItemId,t,n,a,o,i)}else if("exit"===s?.status){const{metadata:e,error:t}=s;ya("Plaid link from search exited",{metadata:e,error:t}),t&&i?.listener({type:"PLAID_LINK_FAILURE",result:"FAILURE",data:null,error:{displayMessage:t.display_message,errorCode:t.error_code,errorMessage:t.error_message}}),await Bb(t,e,l)&&a()}}(e.plaidItemId?cs(e.plaidItemId):void 0,n,r,o,a,c,d)},loading:e||cr(t),hasOnPlaidLinkOverride:cr(s)||cr(l)}}const dy=gr(null,Us,tr({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"}}}}),ol);function uy({onPress:e,preventDefault:t,eventSource:n}){const{linkPlaid:r,loading:a}=sy();return R("button",{onClick:()=>{e?.(),t||r({plaidEvent:zb,message:"Tile Plaid Link button pressed"})},...dy,disabled:a,"data-event-name":n,children:[I(Sd,{Component:Du}),I(sc,{intent:"primary",children:"Link Account"})]})}const hy=tr({width:266,minHeight:32});function py(){return I(Xo,{styles:hy})}const my=gr(lr.text,tr({fontSize:"sm",fontWeight:"sm",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa);function gy({children:e}){return I("div",{...my,children:e})}const vy={SUCCESS:tr({backgroundColor:"surface.intent.success.highlight"}),DANGER:tr({backgroundColor:"surface.intent.danger.highlight"}),NEUTRAL:tr({backgroundColor:"surface.intent.secondary"})},fy=gr(lr.chip,tr({display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:"8px",paddingRight:"8px",paddingTop:"4px",paddingBottom:"4px",gap:"10px"}));function by({variant:e,children:t}){return I("div",{className:rr(fy.className,vy[e]),children:I(gy,{children:t})})}const yy=(e,t,n)=>e?"NEUTRAL":n?t?"DANGER":"SUCCESS":t?"SUCCESS":"DANGER";function wy({difference:e,invertDirection:t=!1}){const n=e>0,r=0===e,a=`${vo(e,{condense:!0,dollarSign:!0,signage:r?"off":"always"})} vs. last month`;return I(by,{variant:yy(r,n,t),children:a})}const Cy=tr({display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"});function xy({title:e,label:t,comparison:n,invertDirection:r}){return R("div",{className:Cy,children:[I(co,{title:e,label:t}),cr(n)&&I(wy,{difference:n,invertDirection:r})]})}const Ty={netIncome:0,income:0,expenses:0,absoluteSum:0},ky=e=>{if(sr(e))return Ty;const t=e.income?.total??0,n=e.expenses?.total??0,r=H(t).plus(n).toNumber();return{netIncome:e.netIncome??0,income:t,expenses:n,absoluteSum:r}},Ey=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(ky):[]},Ay=Object.freeze({income:0,expenses:0,netIncome:0,absoluteSum:0});function Sy({defaultRange:e=ut.THIS_YEAR,period:t,isSample:n=!1,showLinkAccountButton:r}){const a=wu(),i=u(()=>{a?.listener?.({type:"PROFIT_AND_LOSS_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Vt(t):e,{query:{data:s},isFilling:c}=function({filter:e,grouping:t}){return Ba({filter:e,grouping:t,select:Ey})}({filter:l,grouping:t?ja:void 0}),{profitLossData:d,profitDifference:h}=o(()=>{if(n)return{profitLossData:si,profitDifference:null};if(!s||0===s.length)return{profitLossData:Ay,profitDifference:null};if(2===s.length){const[e,t]=s;return{profitLossData:t,profitDifference:t.netIncome-e.netIncome}}return{profitLossData:s[0],profitDifference:null}},[s,n]);return R(Qa,{isSample:n,children:[I(Ka,{title:"Profit + Loss"}),I(Za,{children:c?R($o,{children:[I(py,{}),I(py,{})]}):R(N,{children:[I(xy,{title:fo(d.netIncome),label:"Profit",comparison:h}),R(ho,{children:[I(Pu,{amount:d.income,total:d.absoluteSum,color:"positive",label:"Income"}),I(Pu,{amount:d.expenses,total:d.absoluteSum,color:"negative",label:"Expenses"})]})]})}),n&&I(oi,{size:"sm"}),r&&I(uy,{onPress:i,preventDefault:a?.preventDefault})]})}const Iy=({filter:e,grouping:t})=>["reports/cashFlowStatementDirect","reports",{filter:e,...t&&{grouping:t}}],Ny=async e=>{const t=e.queryKey,n=t[2],r=t[3].accessToken,a=t[3].environment,o={path:"/reports/cashFlowStatementDirect",bodyParams:{exportType:"JSON",...yt(n.filter),...n.grouping&&{grouping:n.grouping}},accessToken:r,endpointManager:Oa(a)};return await Pa(o)},Ry={moneyIn:0,moneyOut:0,netMoneyIn:0},Py=e=>{if(sr(e)||sr(e.operatingActivities)||!e.operatingActivities.children)return Ry;let t=new H(0),n=new H(0);for(const r of e.operatingActivities.children)r.total<0?n=n.plus(H(r.total).abs()):t=t.plus(r.total);return{moneyIn:t.toNumber(),moneyOut:n.toNumber(),netMoneyIn:e.operatingActivities.total}},Dy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(Py):[]};const My=Object.freeze({moneyIn:0,moneyOut:0,netMoneyIn:0});function Ly({defaultRange:e=ut.THIS_YEAR,comparisonPeriod:t,isSample:n=!1,showLinkAccountButton:r}){const a=wu(),i=u(()=>{a?.listener?.({type:"CASH_FLOW_TILE",result:"SUCCESS",data:null,error:null})},[a]),l=t?Vt(t):e,{query:{data:s,isFetched:c},isFilling:d}=function({filter:e,grouping:t}){return function({filter:e,grouping:t,select:n}){return Vr({queryKey:Iy({filter:e,grouping:t}),queryFn:Ny,select:n})}({filter:e,grouping:t,select:Dy})}({filter:l,grouping:t?ja:void 0}),{cashFlowData:h,difference:p}=o(()=>{if(n)return{cashFlowData:di,difference:null};if(!s||0===s.length)return{cashFlowData:My,difference:null};if(2===s.length){const[e,t]=s;return{cashFlowData:t,difference:t.netMoneyIn-e.netMoneyIn}}return{cashFlowData:s[0],difference:null}},[s,n]),m=n||c?Math.abs(h.moneyIn)+Math.abs(h.moneyOut):0;return R(Qa,{isSample:n,children:[I(Ka,{title:"Cash Flow"}),I(Za,{children:d?R($o,{children:[I(py,{}),I(py,{})]}):R(N,{children:[I(xy,{title:fo(h.netMoneyIn),label:"Change in Cash",comparison:p}),R(ho,{children:[I(Pu,{amount:h.moneyIn,total:m,color:"positive",label:"Money In"}),I(Pu,{amount:h.moneyOut,total:m,color:"negative",label:"Money Out"})]})]})}),n&&I(oi,{size:"sm"}),r&&I(uy,{onPress:i,preventDefault:a?.preventDefault})]})}const Fy=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"45px",width:"100%"}),Oy=tr({display:"flex",justifyContent:"end"});function Vy({color:e,bulletLabel:t,moneySummary:n}){return R("div",{className:Fy,children:[I(Mo,{color:e,label:t}),I("div",{className:Oy,children:I(sc,{children:n})})]})}const Uy=gr(null,tr({display:"flex",gap:"10px",alignItems:"center"})),By=tr({width:"200px",height:"16px",backgroundColor:"brand.secondary"}),Hy=gr(null,By);function Wy({bulletAmount:e=3,shimmer:t=!1}){return I(N,{children:Array.from({length:e},(e,n)=>R("div",{...Uy,children:[I(Mo,{color:No.var("colors.brand.secondary")}),t?I(Xo,{styles:By}):I("div",{...Hy})]},n))})}const zy={total:0,children:[]},_y=e=>{return sr(e)||sr(e.expenses)||!e.expenses.children?zy:{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},jy=e=>{if(void 0===e.result||"FAILURE_NO_DATA"===e.result)return[];const t=e.json?.data;return t?t.map(_y):[]},qy=[No.var("colors.brand.primary"),No.var("colors.brand.success"),No.var("colors.brand.action")],Ky=Object.freeze({total:0,children:[]});function Yy({defaultRange:e=ut.THIS_YEAR,comparisonPeriod:t,monthIndex:n,isSample:r=!1,showLinkAccountButton:a}){const i=dn(e=>e.externalOptions),l=wu(),s=u(()=>{l?.listener?.({type:"EXPENSE_TILE",result:"SUCCESS",data:null,error:null})},[l]),c=i.dataVisualizationColors??qy,d=t?Vt(t):e,{query:{data:h},isFilling:p}=function({filter:e,grouping:t}){return Ba({filter:e,grouping:t,select:jy})}({filter:d,grouping:t?ja:void 0}),{expenseData:m,expensesDifference:g}=o(()=>{if(r)return{expenseData:ci,expensesDifference:null};if(!h||0===h.length)return{expenseData:Ky,expensesDifference:null};if(2===h.length){const[e,t]=h;return{expenseData:t,expensesDifference:t.total-e.total}}return{expenseData:h[0],expensesDifference:null}},[h,r]),v=void 0===n?"Total Expenses":`${Ct[n]} Total`,f=m.children.length>0;return R(Qa,{isSample:r,children:[I(Ka,{title:"Expenses"}),I(Za,{children:p?I($o,{children:I(Wy,{shimmer:!0})}):R(N,{children:[I(xy,{title:fo(m.total),label:v,comparison:g,invertDirection:!0}),I(ho,{children:f?m.children.map((e,t)=>I(Vy,{color:c[t],bulletLabel:e.name,moneySummary:fo(e.total)},t)):I(Wy,{})})]})}),r&&I(oi,{size:"sm"}),a&&I(uy,{onPress:s,preventDefault:l?.preventDefault})]})}const Zy=gr(null,tr({display:"flex",flexDirection:"column",gap:"10px",maxWidth:"1440px"}));function Gy({period:e,handleDateChange:t,todayPeriod:n,showSamples:r,showLinkAccountButton:a}){const o=(i=e.month,{beginDate:rt(l=e.year,i,1),endDate:rt(l,i+1,0)});var i,l,s,c,d,u,h,p;return R("div",{...Zy,children:[R(br,{children:[I(kr,{children:"Monthly Review"}),I(fu,{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(yu,{children:[I(Sy,{defaultRange:o,period:e,isSample:r,showLinkAccountButton:a}),I(Ly,{defaultRange:o,comparisonPeriod:e,isSample:r,showLinkAccountButton:a}),I(Yy,{defaultRange:o,comparisonPeriod:e,monthIndex:e.month,isSample:r,showLinkAccountButton:a})]})]})}const Qy="Oldest to Newest",Xy="Newest to Oldest",Jy="A-Z",$y="Z-A",ew="Lowest to Highest",tw="Highest to Lowest",nw="A-Z",rw="Z-A";function aw(){const[e,t]=d(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 gs)??!1,n=(e.direction&&e.direction in vs)??!1;return t&&n})(e)&&t(e)},apiSort:n}}const ow=tr({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"}}}),iw=tr({border:"{borderWidths.lg} solid",borderColor:"border.layout.strong",background:"surface.foreground"}),lw=tr({background:"brand.primary.strong",border:"none",color:"icon.contrast"});function sw({checked:e,onClick:t,Icon:n=Qh}){const[r,a]=d(e??!1),o=void 0===e?r:e;return I("button",{...gr(lr["checkbox-input"],ow,o?lw:iw,ll),type:"button",onClick:n=>{void 0===e&&a(!r),t&&t(n)},"data-is-checked":o,children:o&&I(Sc,{Component:n})})}const cw=gr(null,tr({paddingLeft:"20px",paddingRight:"5px"}));function dw({checked:e,onClick:t,Icon:n=Qh}){return I("div",{...cw,children:I(sw,{checked:e,onClick:t,Icon:n})})}const uw=gr(lr["date-cell"],tr({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center"}));function hw({date:e,annotation:t}){const n=At(Nt(e));return R("div",{...uw,children:[t&&I(gy,{children:t}),I(sc,{children:n})]})}const pw="Income",mw={EXPENSE:"EXPENSE",REVENUE:"REVENUE",TRANSFER_IN:"TRANSFER_IN",TRANSFER_OUT:"TRANSFER_OUT"},gw={EXPENSE:"Expense",REVENUE:pw,TRANSFER_IN:"Bank Transfer In",TRANSFER_OUT:"Bank Transfer Out"},vw={Expense:[{name:gw.EXPENSE,value:mw.EXPENSE}],Income:[{name:gw.REVENUE,value:mw.REVENUE}],Transfer:[{name:gw.TRANSFER_IN,value:mw.TRANSFER_IN},{name:gw.TRANSFER_OUT,value:mw.TRANSFER_OUT}]},fw={EXPENSE:"Expense",REVENUE:pw,BANK_TRANSFER:"Transfer",TAX_PAYMENT:"Tax Payment"},bw=Object.fromEntries(Object.entries(fw).map(([e,t])=>[e,`Add ${t}`])),yw=Object.fromEntries(Object.entries(fw).map(([e,t])=>[e,`Edit ${t}`])),ww=e=>{switch(e){case"EXPENSE":return"EXPENSE_CATEGORY";case"TRANSFER_IN":case"TRANSFER_OUT":return"TRANSFER";default:return"GL_ACCOUNT"}},Cw=e=>e===mw.TRANSFER_IN||e===mw.TRANSFER_OUT,xw=tr({color:"money.negative"}),Tw=tr({color:"money.positive"}),kw=e=>e.replaceAll("_"," ").toLowerCase().split(" ").map(e=>Sr(e)?e:e[0].toUpperCase()+e.slice(1)).join(" "),Ew=e=>{let t;switch(e.type){case"EXPENSE":t=(e=>{if(!sr(e.tax?.paymentInfo))return{type:"EXPENSE",displayName:"Tax Payment",css:xw};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?Tw:xw}})(e);break;case"REVENUE":t=(e=>{const t=e.amount<0;return{type:"REVENUE",displayName:t?"Income Refund":pw,css:t?xw:Tw}})(e);break;case"TRANSFER_IN":case"TRANSFER_OUT":t={type:(n=e).type,displayName:"Bank Transfer",css:n.amount<0?xw:Tw};break;default:t=(e=>({type:e.type,displayName:kw(e.type),css:e.amount<0?xw:Tw}))(e)}var n;return t},Aw=vi(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"),Sw=gr(lr["transaction-date-cell-container"],tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}));function Iw({transaction:e,showTypeLabel:t=!1,isChild:n=!1}){const r=Ew(e),a=gr(lr["transaction-type-label"],r.css),o=t?I("span",{...a,children:r.displayName}):void 0;return n?R("div",{...Sw,children:[I(Sd,{Component:Aw}),I(hw,{date:e.date,annotation:o})]}):I(hw,{date:e.date,annotation:o})}const Nw=tr({display:"flex",gap:"8px",flexDirection:"row",alignItems:"center",width:"100%"}),Rw=tr({display:"flex",flexDirection:"column",width:"100%"}),Pw=tr({width:20,minWidth:20,height:20,minHeight:20,borderRadius:"9999px"});function Dw({iconUrl:e,iconSpacing:t}){return void 0!==e?I("img",{src:e,className:Pw,alt:void 0,width:24,height:24}):t?I("span",{className:Pw}):null}function Mw({label:e,subLabel:t,iconUrl:n,iconSpacing:r=!0}){return R("div",{className:Nw,children:[I(Dw,{iconUrl:n,iconSpacing:r}),R("div",{className:Rw,children:[I(sc,{children:e}),I(Eo,{children:t})]})]})}function Lw({bankTransaction:e,isChild:t=!1}){return t?I("div",{className:tr({paddingLeft:"25px"}),children:I(Mw,{label:e.displayName,subLabel:e.description,iconUrl:e.iconUrl})}):I(Mw,{label:e.displayName,subLabel:e.bankAccount?.displayName,iconUrl:e.iconUrl})}const Fw=vi(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"),Ow=vi(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"),Vw=tr({display:"flex",alignItems:"center",gap:"8px"}),Uw=tr({padding:"6px"});function Bw({amount:e,canExpand:t=!1,isExpanded:n=!1}){return t?I(zc,{ariaLabel:n?"Collapse children":"Expand children",ariaExpanded:n,children:R("div",{className:Vw,children:[I(Sd,{Component:n?Ow:Fw}),I(Iu,{children:e})]})}):I("div",{className:Uw,children:I(Iu,{children:e})})}const Hw=vi(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"),Ww=vi(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"),zw=tr({padding:"10px",height:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:"8px",color:"icon.base"}),_w=tr({width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"});function jw({annotation:e,accountName:t}){const n=(e=>{switch(e){case"Withdrawn from":return Hw;case"Deposited to":return Ww;default:return null}})(e);return R("div",{className:zw,children:[n&&I(Sd,{Component:n}),R("div",{className:_w,children:[e&&I(Eo,{children:e}),t&&I(sc,{children:t})]})]})}const qw={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 Kw(e,t=!0){const n=Th({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 Yw(){return Bu({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 Zw={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"},Gw=e=>["tasks",e??{}],Qw={URGENT:0,HIGH:1,MEDIUM:2,LOW:3},Xw={filter:{status:{in:["ACTIVE"]}}},Jw=async e=>{const t=e.queryKey,n=t[1],r={path:"/v6/tasks/query",accessToken:t[2].accessToken,bodyParams:{...n},endpointManager:xi(t[2].environment)},a=await Ra(r);return"SUCCESS"===a.result&&void 0!==a.data?{data:a.data}:{data:void 0}};function $w(e){const{query:{data:t},isFilling:n}=(r={select:t=>((e,t)=>{const n=sr(r=e)||sr(r.data)?[]:[...r.data].sort((e,t)=>Qw[e.priority]-Qw[t.priority]);var r;return t?n.filter(e=>"MESSAGE_REVIEW"===e.type||"BANK_ERROR"===e.type):n})(t,e)},a=Xw,Vr({...r,queryKey:a?Gw(a):["tasks",{}],queryFn:Jw}));var r,a;const{query:{data:i},isFilling:l}=rg(),{query:{data:s},isFilling:c}=Hu({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=>Kw(e)));let r=[];!1===i?.hasPlaidLinkedBankAccount&&(r=[qw]);const a=t??[];return[...e,...r,...a]},[t,i,s]),isFilling:n||l||c}}const eC=e=>{const t=Xi[e];if(t){const e=document.getElementById(t);e&&e.scrollIntoView({behavior:"smooth"})}},tC=e=>["banks/transactions/summary",e],nC=async e=>{const t=e.queryKey,n={path:"/v6/banks/transactions/query/summary",bodyParams:t[1],accessToken:t[2].accessToken,endpointManager:xi(t[2].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?r.data:null},rC=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>iC({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),aC=async({data:e,accessToken:t,environment:n})=>iC({data:{data:e},accessToken:t,environment:n}),oC=async({data:e,accessToken:t,environment:n})=>aC({data:[e],accessToken:t,environment:n}),iC=async({data:e,accessToken:t,environment:n})=>{const r={path:"/v6/banks/transactions",bodyParams:e,accessToken:t,endpointManager:xi(n)};return await Ra(r)};function lC(){return ya("mutation successful, invalidating BT queries"),Promise.all([Lr.invalidateQueries({queryKey:["banks/transactions"]}),Lr.invalidateQueries({queryKey:["banks/transactions/summary"]}),Lr.invalidateQueries({queryKey:["tasks"]}),Lr.invalidateQueries({queryKey:["reports"]})]).catch(e=>wa({error:e,severity:"error"}))}function sC(){return dC({mutationFn:oC,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}})}function cC({mutationKey:e=["banks/transactions"],...t}){return Xg({onSuccess:()=>lC(),mutationKey:e,...t})}function dC({mutationKey:e=["banks/transactions"],...t}){return Xg({onSuccess:()=>lC(),mutationKey:e,...t})}function uC(){return cC({mutationFn:aC,meta:{toastOptions:{defaultErrorMessage:"Couldn't update categories"}}})}const hC=()=>["accounting/glAccounts"],pC=async e=>{const t=e.queryKey,n={path:"/accounting/glAccounts",params:{leavesOnly:"false"},accessToken:t[1].accessToken,environment:t[1].environment},r=await Ai(n);return fC(r)};function mC(e){return Vr({...e,queryKey:["accounting/glAccounts"],queryFn:pC})}function gC(e){return e.filter(e=>"ACTIVE"===e.status)}function vC(e){return mC({select:t=>CC(e?gC(t):t).flatMap(e=>[e,...e.children])})}const fC=e=>e.map(e=>({...e,id:ss({id:e.id,prefix:"GL_ACCOUNT"})}));function bC(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 yC(e,t){const n=t.get(e.accountNo)??[];return 0===n.length?[{...e,children:[]}]:n.flatMap(e=>yC(e,t))}const wC=e=>!e.parentAccountNo;function CC(e){const t=bC(e);return e.filter(wC).map(e=>({...e,children:yC(e,t)}))}function xC(e,t){return(t.get(e)??[]).map(e=>{const n=xC(e.accountNo,t);return{...e,children:n}})}function TC(e){const t=bC(e);return e.filter(wC).map(e=>({...e,children:xC(e.accountNo,t)}))}function kC(){return mC({select:TC})}const EC=["LIABILITY","EQUITY","INCOME","OTHER_INCOME"];function AC(e,t){return o(()=>void 0===t?e??[]:e?.filter(e=>t.includes(e.type))??[],[e,t])}const SC=tr({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"}}),IC=rr(SC,tr({padding:"2.5px"})),NC=rr(SC,tr({padding:"4px 5px",cursor:"pointer","&:focus":{outline:"none"},"&[data-state='closed']":{}})),RC=tr({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"}}),PC=rr(RC,tr({_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"}}})),DC=tr({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"}}}),MC=rr(DC,tr({_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"}}})),LC=tr({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"}}),FC=rr(LC,tr({_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"}}})),OC=tr({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"}}),VC=rr(OC,tr({_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"}}})),UC=tr({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"}}),BC=rr(UC,tr({_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"}}})),HC=tr({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"}}),WC={default:PC,neutral:PC,warning:VC,success:FC,danger:BC,highlight:MC},zC=p(function({variant:e="default",children:t,stylists:n=[],...r},a){const o=Cr([gr(lr["selector-button"],rr(HC,WC[e]),ll),...n]);return I("button",{ref:a,...o,...r,children:t})}),_C={keys:[{name:"name"},{name:"accountNo"}],threshold:.1};function jC(e,t,n){var r;r=t,n.some(({child:e})=>e.accountNo===r.accountNo)||n.push({parent:e,child:t})}function qC(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=>{jC(e,n,t)})}(r,n):a?jC(a,r,n):i&&jC(r,r,n)}),n}const KC=[gr(null,tr({marginLeft:"6px",marginRight:"6px"}))],YC=gr(null,tr({whiteSpace:"normal"}));function ZC({types:e,activeOnly:t,onClick:n,searchTerm:r}){const{query:{data:a},isFilling:i}=vC(t),l=AC(a,e),s=o(()=>new Ae(l,_C),[l]),c=o(()=>qC(s.search(r),l),[l,r,s]);return i?I(Km,{}):c.map(({parent:e,child:t})=>I(Wm,{onClick:()=>n(t),children:R(Eg,{stylists:[YC],children:[e.name,I(cl,{Component:rl,stylists:KC}),t.name]})},`${t.accountNo}`))}const GC=p(function({index:e,popupTriggerProps:t,children:n,itemProps:r},a){const o=ve([a,t?.ref]);return I(Hm,{index:e,ref:o,itemProps:r,popupTriggerProps:t,children:n})});function QC({triggerChildren:e,popupChildren:t}){const{cascadeIndex:n,setCascadeState:r,focus:a}=i(Mm),{itemRef:o,index:l,itemProps:s}=Bm({hasCascading:!0}),{isScrolling:c}=i(Sm);return R(Tc,{open:n===l,onOpenChange:e=>{c||r(e,l)},placement:"right-start",children:[I(Ec,{children:t=>I(GC,{itemProps:s,index:l,ref:o,popupTriggerProps:t,children:e})}),I(Fc,{initialFocus:a,children:t})]})}const XC=tr({display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",color:"icon.base"}),JC=tr({display:"flex",gap:"8px",color:"icon.base"});function $C({Icon:e,iconUrl:t,displayLabel:n}){const r=t?Cg(t,"Icon"):void 0;return R("div",{className:XC,children:[R("div",{className:JC,children:[!sr(e)&&e,sr(e)&&r&&I(Sd,{Component:r}),I(To,{wrap:"wrap",children:n})]}),I(cl,{Component:rl})]})}function ex({types:e,activeOnly:t,onClick:n}){const{query:{data:r,isFetching:a},isFilling:o}=(l=t,mC({select:e=>CC(l?gC(e):e)})),i=AC(r,e);var l;return o?I(Km,{}):o||a||void 0!==r?i.map(e=>I(QC,{triggerChildren:I($C,{displayLabel:e.name}),popupChildren:I(tx,{glAccount:e,onClick:n})},e.accountNo)):I(jm,{text:"No data"})}function tx({glAccount:e,onClick:t}){return I(Lm,{children:e.children.map(e=>I(Wm,{onClick:()=>t(e),children:I(To,{children:e.name})},e.accountNo))})}const nx=tr({maxWidth:"420px",width:"fit-content"});function rx({onClick:e,types:t,activeOnly:n,placeholder:r="Search accounts..."}){return I(Um,{onClick:e,placeholder:r,getSearchActiveStyles:e=>e?nx:void 0,SearchList:ZC,DefaultList:ex,extraProps:{types:t,activeOnly:n},listLength:0,forceSearchVisible:!0})}const ax=gr(lr["category-selector-table-cell"]);function ox({accountName:e,iconUrl:t,onChange:n,types:r,activeOnly:a,placeholder:o}){const{startPrefetch:i,cancelPrefetch:l}=Al({prefetchFn:Cl(hC,pC)}),s=sr(t)?void 0:Cg(t,"");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:t=>R(zC,{...t,stylists:[ax],onMouseEnter:i,onMouseLeave:l,children:[s&&I(Sd,{Component:s}),I(sc,{children:e})]})}),I(rx,{onClick:n,types:r,activeOnly:a,placeholder:o})]})}function ix({transaction:e,parentTransaction:t,accountName:n}){const{mutate:r}=sC(),a=void 0!==t;return I(ox,{accountName:n,iconUrl:e.glAccount?.iconUrl,onChange:a?n=>{if(n?.id&&a){const{id:a,children:o}=t,{id:i}=e,l=o.map(e=>e.id===i?{...e,glAccountId:n.id.toString()}:e);r({id:a,children:l})}}:t=>{r({id:e.id,glAccountId:t.id})},types:EC,placeholder:"Search revenue accounts..."})}const lx=e=>e>0?"Deposited to":"Withdrawn from",sx=vi(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"),cx=e=>({id:e.id,name:e.name});function dx(e){const t=e.map(e=>e?.category?.name??e?.glAccount?.name).filter(e=>void 0!==e),n=new Set(t);return{label:lh("Category","Categories",n.size,!0),list:[...n].join(", ")}}const ux=gr(null,tr({flexDirection:"column",textAlign:"start",width:"100%",overflow:"hidden"})),hx=gr(null,tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",width:"100%",gap:"10px"}));function px({transaction:e}){const{label:t,list:n}=dx(e.children);return I(ic,{children:R("div",{...hx,children:[I(Sd,{Component:sx}),R("div",{...ux,children:[I(To,{children:t}),I(Eo,{children:n})]})]})})}const mx=()=>["expenses/categories"],gx=async e=>{const t=e.queryKey,n={path:"/expenses/categories",accessToken:t[1].accessToken,environment:t[1].environment},r=await Ai(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 vx(e){return Vr({...e,queryKey:["expenses/categories"],queryFn:gx})}function fx(){return vx({select:e=>({...e,data:e.data?Tx(e.data):void 0})})}function bx(e,t){return(t.get(e)??[]).map(e=>{const n=bx(e.id,t);return{...e,children:n.length>0?n:void 0}})}function yx(e){if(0===e.length)return[];const t=Cx(e);return e.filter(e=>!e.parentCategoryId).map(e=>{const n=bx(e.id,t);return{...e,children:n.length>0?n:void 0}})}function wx(){return vx({select:e=>({...e,data:e.data?yx(e.data):void 0})})}function Cx(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 xx(e){if(0===e.length)return[];const t=Cx(e);return e.map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function Tx(e){if(0===e.length)return[];const t=Cx(e);return e.filter(e=>!e.parentCategoryId).map(e=>({...e,children:e.id?t.get(e.id):void 0}))}function kx(){return Al({prefetchFn:Cl(mx,gx)})}const Ex={keys:[{name:"name"}],threshold:.1};function Ax(e,t,n){var r;r=t,n.some(e=>e.child.id===r.id)||n.push({parent:e,child:t})}function Sx(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?Ax(a,r,n):o?Ax(r,r,n):i&&function(e,t){e.children&&e.children.forEach(n=>{Ax(e,n,t)})}(r,n)}),n}const Ix=gr(null,tr({whiteSpace:"normal"})),Nx=[gr(null,tr({marginLeft:"6px",marginRight:"6px",color:"icon.base"}))];function Rx({searchTerm:e,onClick:t}){const{query:{data:n,isFetched:r},isFilling:a}=vx({select:e=>({...e,data:e.data?xx(e.data):void 0})}),i=n?.data,l=!a&&r&&(void 0===i||0===i.length),s=o(()=>new Ae(i??[],Ex),[i]),c=o(()=>i?Sx(s.search(e),i):[],[i,e,s]);return a?I(Km,{}):l?I(jm,{text:"No data"}):0===c.length?I(jm,{text:"No results found"}):I(N,{children:c.map(({parent:e,child:n})=>{const r=e.id===n.id,a=Cg(n.iconUrl,"Expense Icon");return R(Wm,{onClick:()=>t(cx(n)),children:[I(Sd,{Component:a}),I(Eg,{stylists:[Ix],children:r?n.name:R(N,{children:[e.name,I(cl,{Component:rl,stylists:Nx}),n.name]})})]},`${e.id}_${n.id}`)})})}function Px({category:e,handleCategoryChange:t}){return I(Lm,{children:e.children?.map(e=>{const n=Cg(e.iconUrl,"Expense Icon");return R(Wm,{onClick:()=>t(cx(e)),children:[I(Sd,{Component:n}),I(To,{wrap:"wrap",children:e.name})]},e.id)})})}function Dx({onClick:e}){const{query:{data:t,isFetched:n},isFilling:r}=fx(),a=t?.data,o=!r&&n&&void 0===a;return r?I(Km,{}):o?I(jm,{text:"No data"}):I(N,{children:a?.map(t=>{if(t.hasChilds)return I(QC,{triggerChildren:I($C,{displayLabel:t.name,iconUrl:t.iconUrl}),popupChildren:I(Px,{category:t,handleCategoryChange:e})},t.id);const n=Cg(t.iconUrl,"Expense Category Icon");return R(Wm,{onClick:()=>e(cx(t)),children:[I(Sd,{Component:n}),I(To,{wrap:"wrap",children:t.name})]},t.id)})})}const Mx=({onClick:e})=>{const{query:{data:t}}=fx();return I(Um,{onClick:e,placeholder:"Search expense categories...",SearchList:Rx,DefaultList:Dx,listLength:(t?.data??[]).length})},Lx=gr(lr["category-selector-table-cell"]);function Fx({transaction:e,parentTransaction:t}){const{startPrefetch:n,cancelPrefetch:r}=kx(),a=e.category?.name??"",{mutate:o}=sC(),i=void 0!==t,l=sr(e.category?.iconUrl)?void 0:Cg(e.category.iconUrl,"Expense Icon");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(zC,{...e,stylists:[Lx],onMouseEnter:n,onMouseLeave:r,children:[l&&I(Sd,{Component:l}),I(sc,{children:a})]})}),I(Mx,{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 Ox({transaction:e,parentTransaction:t}){if(e.children.length>0)return I(px,{transaction:e});switch(ww(e.type)){case"EXPENSE_CATEGORY":return I(Fx,{transaction:e,parentTransaction:t});case"TRANSFER":return I(jw,{annotation:lx(e.amount),accountName:e.bankAccount?.name});case"PAYMENT":return wa({error:new Error("Should not get here. Payout without line items."),severity:"error"}),null;default:return I(ix,{transaction:e,parentTransaction:t,accountName:e.glAccount?.name})}}function Vx({name:e}){return I(N,{children:e&&I(sc,{children:e})})}function Ux({onClick:e}){const t=kc(),n=_i();return I(Fc,{children:I(Lm,{children:n.map(({status:n,displayName:r})=>I(Wm,{onClick:()=>(e(n),void t.close()),children:I(To,{children:r})},n))})})}const Bx=gr(lr["review-status-selector-button"],tr({width:"151px",justifyContent:"center"})),Hx=gr(lr["review-status-dropdown-arrow"],tr({display:"none"}));function Wx({status:e,transactionId:t}){const[n,r]=d(!1),{mutate:a}=sC(),o=()=>{r(!1)},i=()=>{r(!n)},{text:l,variant:s,Icon:c}=qi(e);return t&&((u=t).startsWith(is.TRANSACTION_LINE_ITEM)||u.startsWith(is.PROCESSOR_TRANSACTION))?null:R(Tc,{open:n,blockInteraction:!1,onOpenChange:o,enableClickMiddleware:!1,placement:"bottom-start",children:[I(Ec,{children:e=>R(zC,{variant:s,...e,stylists:[Bx],onClick:i,children:[I(Sd,{Component:c}),I(sc,{children:l}),I("div",{...Hx,children:I(cl,{Component:Lp})})]})}),I(Ux,{onClick:e=>{a({id:t,reviewStatus:e}),o()}})]});var u}function zx({status:e,transactionId:t}){return I(Wx,{status:e,transactionId:t},t)}function _x({isMutating:e}){return e?I(np,{}):I(Sd,{Component:rl})}function jx({isMutating:e}){return I(_x,{isMutating:e})}const qx=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})),Kx=vi(qx,"Dash"),Yx=gr(null,tr({stroke:"icon.base.weak"}));function Zx({hasConversation:e,hasUnread:t=!1}){return I(N,{children:e?I(Kd,{hasUnread:t}):I("div",{"data-testid":"no-conversations-dash",children:I(Sc,{Component:Kx,stylists:[Yx]})})})}function Gx({conversationId:e}){const{query:{data:t}}=Ll(e??null),{startPrefetch:n,cancelPrefetch:r}=Ol(),{startPrefetch:a,cancelPrefetch:o}=Ns(),i=cr(t),l=i&&"READ"===t?.readStatus,s=u(()=>{cr(e)&&(n({id:e}),a({id:e}))},[e,n,a]),c=u(()=>{cr(e)&&(r(),o())},[e,r,o]);return I("div",{onMouseEnter:s,onMouseLeave:c,children:I(Zx,{hasConversation:i,hasUnread:!l})})}function Qx(e){return bo(sh(e.amount))}const Xx=gr(lr["badge-chip"],IC),Jx=gr(null,to),$x=gr(null,ll),eT=gr(lr["neutral-badge"],RC),tT=gr(lr["highlight-badge"],DC),nT=gr(lr["success-badge"],LC),rT=gr(lr["warning-badge"],OC),aT=gr(lr["danger-badge"],lr["critical-badge"],UC);function oT({type:e,children:t}){let n;switch(e){case"danger":n=aT;break;case"warning":n=rT;break;case"neutral":n=eT;break;case"success":n=nT;break;case"highlight":n=tT}const r=Cr([Xx,Jx,n,$x]);return I("div",{...r,children:t})}function iT({reviewStatus:e}){const{variant:t,Icon:n}=qi(e);return I(oT,{type:t,children:I(Sd,{Component:n})})}const lT=tr({padding:"12px 16px",display:"flex",gap:"6px",flexDirection:"row",alignItems:"center",maxWidth:"100%"}),sT=tr({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,gap:"8px"}),cT=tr({display:"flex",gap:"8px",justifyContent:"flex-start",alignItems:"center",minWidth:0}),dT=tr({display:"flex",alignItems:"center",gap:"12px",minWidth:0}),uT=tr({display:"flex",gap:"8px",flexDirection:"column",minWidth:0}),hT=tr({width:24,minWidth:24,height:24,minHeight:24,borderRadius:"9999px"});function pT({row:e}){const t=e.original,n=function(e){if(e.children.length>0){const{label:t,list:n}=dx(e.children);return`${t}: ${n}`}switch(ww(e.type)){case"EXPENSE_CATEGORY":return e.category?.name;case"TRANSFER":return`${lx(e.amount)}: ${e.bankAccount?.name}`;case"PAYMENT":return void wa({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:lT,children:[r&&I(Sd,{Component:Aw}),R("div",{className:uT,children:[R("div",{className:cT,children:[t.iconUrl?I("img",{src:t.iconUrl,className:hT,alt:void 0,width:24,height:24}):I("span",{className:hT}),I(To,{children:t.description})]}),R("div",{className:dT,children:[I(iT,{reviewStatus:t.reviewStatus}),I(Eo,{wrap:"wrapTwice",children:n})]})]}),R("div",{className:sT,onClick:t=>{e.getCanExpand()&&(t.stopPropagation(),e.toggleExpanded())},children:[I(Bw,{amount:Qx(e.original),canExpand:e.getCanExpand(),isExpanded:e.getIsExpanded()}),I(cl,{Component:rl})]})]})}const mT=vi(qx,"Minus");function gT({table:e}){const t=e.getIsAllRowsSelected(),n=e.getIsSomeRowsSelected();return I(dw,{checked:t||n,onClick:e.getToggleAllRowsSelectedHandler(),Icon:n?mT:Qh})}const vT=J(),fT=[vT.display({id:hn.SELECT,header:({table:e})=>I(gT,{table:e}),cell:({row:e})=>void 0===e.getParentRow()?I(dw,{checked:e.getIsSelected(),onClick:e.getToggleSelectedHandler()},e.original.id):null,maxSize:35,meta:{clickable:!0}}),vT.accessor("date",{id:hn.DATE,cell:e=>{const t=void 0!==e.row.getParentRow();return I(ic,{children:I(Iw,{transaction:e.row.original,isChild:t})})},header:()=>I(Yc,{columnName:"Date",sortDef:"DATE",sortAscDisplay:Qy,sortDescDisplay:Xy}),size:130,maxSize:144}),vT.accessor("description",{id:hn.DESCRIPTION,cell:e=>{const t=void 0!==e.row.getParentRow();return I(ic,{children:I(Lw,{bankTransaction:e.row.original,isChild:t})})},header:()=>I(Yc,{columnName:"Source",sortDef:"DESCRIPTION",sortAscDisplay:Jy,sortDescDisplay:$y}),size:180}),vT.accessor("amount",{id:hn.AMOUNT,cell:e=>I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:Qx(e.row.original),canExpand:e.row.getCanExpand(),isExpanded:e.row.getIsExpanded()})}),header:()=>I(Yc,{columnName:"Amount",sortDef:"AMOUNT",sortAscDisplay:ew,sortDescDisplay:tw,align:"right"}),size:130,maxSize:130}),vT.accessor("category.id",{id:hn.CATEGORY,cell:({row:e})=>I(Ox,{transaction:e.original,parentTransaction:e.getParentRow()?.original}),header:()=>I(Yc,{columnName:"Category",padding:"none"}),size:130,meta:{clickable:!0}}),vT.accessor(e=>e.dimensionValues[0]?.id,{id:hn.DIMENSION_VALUE,cell:e=>I(ic,{children:I(Vx,{name:e.row.original.dimensionValues[0]?.name})}),header:()=>I(Yc,{columnName:"Business"}),size:130}),vT.accessor("reviewStatus",{id:hn.REVIEW_STATUS,cell:e=>I(ic,{children:I(zx,{status:e.getValue(),transactionId:e.row.original.id})}),header:()=>I(Yc,{columnName:"Status",sortDef:"REVIEW_STATUS",sortAscDisplay:nw,sortDescDisplay:rw,padding:"large"}),size:200,maxSize:230,meta:{clickable:!0}}),vT.display({id:hn.COMMENTS,cell:e=>{const t=e.row.original;return I(ic,{alignVariant:"center",children:I(Gx,{conversationId:t.conversation?.id})})},header:()=>I(Yc,{columnName:"Comments"}),size:80,maxSize:110,meta:{clickable:!0}}),vT.display({id:hn.EXPAND,cell:e=>I("div",{className:tr({paddingRight:"20px"}),children:I(jx,{isMutating:e.isMutating})}),size:40,maxSize:60})],bT=vT.display({id:"MOBILE",cell:e=>I(pT,{row:e.row})}),yT=l(!0);function wT(){return i(yT)}const CT=[];function xT({transactions:e,columns:t}){const n=wT(),r=n?["MOBILE"]:t,a=n?{MOBILE:!0}:function(e){if(e)return Object.values(hn).reduce((t,n)=>(t[n]=e.includes(n),t),{})}(t),o=n?[bT]:(i=t)?fT.filter(e=>i.includes(e.id)):fT;var i;return $({data:e??CT,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,rowCount:e?.length??CT.length,columns:o,getCoreRowModel:ee(),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:te(),paginateExpandedRows:!1,getRowId:e=>e.id,meta:{editMutationKey:["banks/transactions"]},state:{columnOrder:r,columnVisibility:a}})}const TT=[hn.COMMENTS,hn.DATE,hn.DESCRIPTION,hn.AMOUNT,hn.CATEGORY,hn.REVIEW_STATUS];function kT({Component:e,stylists:t}){return I(e,{stylists:[gr(lr["xx-large-icon"],lr.icon),...t??[]],size:50})}function ET(){return R(N,{children:[I(kT,{Component:wi}),I(To,{wrap:"wrap",children:"All caught up"}),I(Eo,{wrap:"wrap",children:"If any transactions need your review, they’ll be flagged here"})]})}function AT({children:e,stylists:t=[],...n}){return I(Qs,{intent:"warning",stylists:t,...n,children:e})}function ST({eventSource:e}){const{linkPlaid:t,loading:n}=sy();return I(AT,{...gr(lr["zero-state-button"]),onClick:()=>t({plaidEvent:zb,message:"Plaid Link button pressed"}),disabled:n,eventSource:e,children:I(To,{children:"Link your bank"})})}function IT({eventSource:e}){return R(N,{children:[I(kT,{Component:gg}),I(kr,{children:"Link Bank Account"}),I(Eo,{wrap:"wrap",children:"Effortlessly track every dollar by linking your bank account"}),I(ST,{eventSource:e})]})}const NT=tr({animation:"spin",display:"flex",alignItems:"center",justifyContent:"center",width:"15px",height:"15px",marginBottom:"16px"});function RT(){return R(N,{children:[I("div",{className:NT,children:I(kT,{Component:yi})}),I(kr,{children:"Transactions are being processed"}),I(Eo,{wrap:"wrap",children:"Any transactions that require review will show up here."})]})}function PT(e,t=500,n){const r=a();!function(e){const t=a(e);t.current=e,s(()=>()=>{t.current()},[])}(()=>{r.current&&r.current.cancel()});const i=o(()=>{const a=T(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 s(()=>{r.current=T(e,t,n)},[e,t,n]),i}function DT({debouncedValue:e,onChangeDebouncedValue:t}){const[n,r]=d(e),[a,o]=d(!1);s(()=>{r(e)},[e]);const i=PT(u(e=>{t(e),o(!1)},[t]),280);return{inputValue:n,onChangeInputValue:e=>{r(e),a||o(!0),i(e)},isDebounced:a}}const MT=gr(lr["filter-bar"],tr({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"}})),LT=gr(lr["filter-search-bar"],tr({display:"flex",flexDirection:"row",alignItems:"center",width:"100%",height:"100%",paddingLeft:"5px"})),FT=gr(null,tr({color:"icon.base",flexShrink:0,marginRight:"15px"})),OT=gr(null,tr({border:"none",outline:"none",background:"transparent",fontSize:"lg",color:"typography.base",fontStyle:"normal",fontWeight:"sm",lineHeight:"template",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:"template"}})),VT=tr({width:25});function UT({onChange:e,searchTerm:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=DT({debouncedValue:t,onChangeDebouncedValue:e});return I("div",{...MT,children:R("div",{...LT,children:[I("div",{className:VT,children:n||i?I(np,{}):I(Sd,{stylists:[FT],Component:Yv})}),I("input",{...OT,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Ep})]})})}const BT=gr(lr["date-amount-header"],tr({padding:"8px 16px",display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"surface.elevated",border:"none",gap:"8px"}));function HT({formattedDate:e,formattedSum:t}){return R("div",{...BT,children:[I(To,{wrap:"wrap",children:e}),I(Iu,{children:t})]})}function WT(e){const t=e.row,n=e.column.columnDef.meta?.clickable,r=t.getCanExpand(),a=Cw(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();us(e?.original??t.original,{initialTab:"conversation"})}else if(l&&r)t.toggleExpanded();else if(!n||o){const e=t.getParentRow();us(e?.original??t.original)}}function zT({rowData:e,hasSelect:t=!0}){const{startPrefetch:n,cancelPrefetch:r}=Ts(),a=u(()=>n({id:e.original.id}),[n,e.original]),o=u(()=>{us(e.original)},[e.original]);return I(ns,{rowData:e,onMouseEnter:a,onMouseLeave:r,onRowClick:o,onCellClick:WT,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 _T({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=bo(sh(r.netSumCents)),r.rows.push(n))}else{const r=Nt(e);t.set(e,{date:e,formattedDate:r?At(r):e,netSumCents:n.original.amount,formattedSumDollars:bo(sh(n.original.amount)),rows:[n]})}}return t}(e).values())}(e),[e]);return I(N,{children:t.map(e=>R(f,{children:[I(HT,{formattedDate:e.formattedDate,formattedSum:e.formattedSumDollars}),e.rows.map(e=>I(zT,{rowData:e},e.id))]},e.date))})}function jT({table:e,hasSelect:t}){const n=wT();return I(Kl,{editMutationKey:e.options.meta?.editMutationKey,children:I(zl,{children:n?I(_T,{rows:e.getRowModel().rows}):e.getRowModel().rows.map(e=>I(zT,{rowData:e,hasSelect:t},e.id))})})}function qT(e){return e?"Search":"Search transactions..."}function KT(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 YT(e,t){return e.get(t)??[]}function ZT(e,t,n){const r=new Map(e);return n.length>0?r.set(t,n):r.set(t,[]),r}function GT(e){const t=[];return e.forEach(e=>{t.push(...e)}),t}function QT(e,t,n){let r=t.length;return void 0!==n&&r>n&&(r=n),r>0?`${e} (${r})`:e}function XT({buttonText:e,onButtonClick:t}){return R(N,{children:[I(Td,{Component:tf}),I(To,{children:"No results"}),I(Eo,{wrap:"wrap",children:"Try another search, or adjust the filters"}),e&&t&&I(zc,{onClick:t,children:e})]})}const JT=tr({xl:{minWidth:"900px"}}),$T=tr({xl:{display:"flex",padding:"16px",maxWidth:"500px"}});function ek({hasLinkedAccount:e,sortInstance:t,setSortInstance:n,isFilling:r,isFetching:a,paginationControls:o,transactions:i,searchTerm:l,onSearchChange:s}){Dd(Qi);const c=function({transactions:e}){return function({transactions:e,columns:t}){return xT({transactions:e,columns:t?[...t,hn.EXPAND]:void 0})}({transactions:e,columns:TT})}({transactions:i}),{query:{data:d},isFilling:u}=ws({limit:1,filter:{status:{in:["ACTIVE","INACTIVE","REMOVED"]}}}),h=wT(),p=!sr(d?.data?.[0])&&!u,m=function(e,t,n,r){let a;return e||t?r&&!t&&n?a=I(XT,{buttonText:"Clear Search",onButtonClick:()=>{s("")}}):!e||n||t?e&&n&&!t&&(a=I(ET,{})):a=I(RT,{}):a=I(IT,{eventSource:"FinancialOverviewTransactionsTableZeroState"}),a}(e??!1,i.length>0,p,l.length>0);return R("div",{className:JT,children:[I("div",{id:Qi}),R(sl.Provider,{value:o,children:[R(br,{children:[I(kr,{children:"Transactions for review"}),I(Ld,{children:I(ml,{})})]}),I(nc,{dashboard:"financialOverviewDashboard",children:r?I(wl,{}):R(N,{children:[!h&&I("div",{className:$T,children:I(UT,{placeholder:qT(h),searchTerm:l,onChange:s,isFetching:a})}),I(rc.Provider,{value:{sortInstance:t,setSortInstance:n},children:I(Hl,{headerGroups:c.getHeaderGroups()})}),sr(m)?I(jT,{table:c,hasSelect:!1}):I(Cd,{children:m})]})})]})]})}function tk(){const[e,t]=d(""),{sortInstance:n,setSortInstance:r,apiSort:a}=aw(),o={...(()=>{const e=Yi();return{...Ji,reviewStatus:{in:e?.value}}})(),search:e.length>0?e:void 0},{query:{data:i,isFetching:l},isFilling:s,paginationControls:c}=ws({filter:o,sort:a,limit:10}),u=i?.data??el,{hasPlaidLinkedBankAccount:h,isFilling:p}=ng();return I(ek,{sortInstance:n,setSortInstance:r,isFilling:s||p,isFetching:l,paginationControls:c,transactions:u,hasLinkedAccount:h??!1,searchTerm:e,onSearchChange:t})}const nk=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:"10px",alignSelf:"stretch",paddingLeft:{base:"16px",xl:0},paddingRight:{base:"16px",xl:0}}));function rk({children:e}){return I("div",{...nk,children:e})}const ak=e=>{switch(e){case"MESSAGE_REVIEW":return{Icon:Ed,buttonText:"Respond"};case"TRANSACTION_REVIEW":return{Icon:fi,buttonText:"Review"};case"LINK_BANK":return{Icon:gg,buttonText:"Link"};case"DELETE_OR_RELINK":case"UNLINK_RELINK":case"OPEN_BANK":return{Icon:gg,buttonText:"Fix"};case"RELINK":return{Icon:gg,buttonText:"Relink"};case"CHAT":return{Icon:bi,buttonText:"Learn more"};case"ALL_CAUGHT_UP":case"NO_ACTION_ITEMS":return{Icon:wi,buttonText:""};default:return{Icon:bi,buttonText:""}}},ok=gr(lr["banner-title"],tr({display:"flex",alignItems:"center",gap:"8px"})),ik=gr(lr["banner-icon"],tr({width:"20px",height:"20px"}));function lk({title:e,type:t}){const{Icon:n}=ak(t);return R("div",{...ok,children:[I(Sd,{Component:n,stylists:[ik]}),I(To,{wrap:"wrap",children:e})]})}const sk=gr(null,tr({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 ck({title:e,description:t,type:n}){return R("div",{...sk,children:[I(lk,{title:e,type:n}),I(Eo,{wrap:"wrap",children:t})]})}const dk=lr["banner-button"],uk=tr.raw({display:"flex",justifyContent:"center",alignItems:"center",width:{base:"100%",xl:"128px"},gap:{xl:"15px"},flexShrink:{xl:"0"}}),hk=gr(lr["banner-button-text"]),pk=gr(lr["banner-button-icon"]);function mk({priority:e,type:t,handleClick:n,eventSource:r}){const{buttonText:a}=ak(t),o=(e=>{switch(e){case"URGENT":return"danger";case"HIGH":return"warning";case"MEDIUM":return"action";default:return"default"}})(e);return R(Qs,{onClick:n,intent:o,styles:uk,className:dk,eventSource:r,children:[I(To,{stylists:[hk],children:a}),I(cl,{stylists:[pk],Component:rl})]})}const gk=or({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"}}}}),vk={HIGH:lr["banner-high"],MEDIUM:lr["banner-medium"],LOW:lr["banner-low"],URGENT:lr["banner-urgent"]};function fk({task:e,handleClick:t,eventSource:n}){const{name:r,description:a,shortDescription:o,type:i,priority:l}=e,s=wT()?o:a,c=gr(lr.banner,vk[l],gk({priority:l}));return R("div",{...c,children:[I(ck,{title:r,description:s,type:i}),I(mk,{priority:l,type:i,handleClick:t,eventSource:n})]})}function bk(e,t){ds(dn.getState().events.conversations,{type:"OPEN_CONVERSATION",result:"SUCCESS",data:null,error:null},()=>rs("Conversation",{routeProps:{conversationId:null,defaultValues:{message:{text:`Please help me with my ${e} bank issue: (code: ${t}). Thanks!`,attachments:[]}}}}))}function yk(e,t,n,r,a){return()=>ih({title:e?.shortMessage(t??"your bank")||"Bank Error",body:e?.longMessage({apiInstitutionName:t??"your bank",apiPartnerName:n,isMobile:r}),buttons:a})}function wk(e){const{mutateAsync:t}=oy(),n=Pr(),r=Or(),{apiPartnerName:a}=i(Qc),o=wT(),{linkPlaid:l,loading:s,hasOnPlaidLinkOverride:c}=sy(),{linkPlaid:d,loading:u}=sy(),h=Zb(),p=cr(e)?function(e){const t=Th({apiErrorType:e.apiErrorType,apiErrorCode:e.apiErrorCode});return cr(t)?t:kh(e)?xh.ADDITIONAL_CONSENT_REQUIRED.DEFAULT:null}(e):null;if(sr(p)||sr(e))return null;const m="ITEM_LOCKED"===e.apiErrorCode;switch(p.buttonType){case wh.DELETE_OR_RELINK:case wh.RELINK:return s?null:(v=l,f=a,b=o,{alert:yk(p,(g=e).apiInstitutionName,f,b,[{key:_u,label:"Cancel"},{key:qu,label:"Relink",type:oh.SUCCESS}]),actions:{success:()=>{v({plaidEvent:jb,plaidItemId:g.id,apiAccessToken:g.apiAccessToken,apiErrorCode:g.apiErrorCode,message:"Relink Bank Error button pressed"})}}});case wh.UNLINK_RELINK:return u?null:function(e,t,n,r,a,o,i){return{alert:yk(e,t.apiInstitutionName,a,o,[{key:_u,label:"Cancel"},{key:wh.CHAT,label:"Chat"},{key:qu,label:"Unlink and Relink",type:oh.SUCCESS}]),actions:{success:async()=>{i||await n({id:String(t.id),removeFromApi:!0}),r({plaidEvent:_b,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink and Relink Bank Error button pressed"})},[wh.CHAT]:()=>bk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,t,d,a,o,c);case wh.OPEN_BANK:return s?null:function(e,t,n,r,a,o,i,l,s){return{alert:yk(e,t.apiInstitutionName,i,l,[{key:_u,label:"Cancel"},{key:wh.CHAT,label:"Chat"},{key:wh.RELINK,label:"Relink"},{key:qu,label:"Go To Bank",type:oh.SUCCESS}]),actions:{success:async()=>{const e=await zu({institutionId:t.apiInstitutionId??void 0,accessToken:r,environment:a}),o=n?e.map.accountLockedUrl:e.map.accountSetupUrl;cr(o)?ds(s,{type:"PLAID_LINK_ROUTE_TO_BANK",result:"SUCCESS",data:{bankUrl:o},error:null},()=>window.open(o,"_blank")):window.open(o,"_blank")},[wh.RELINK]:()=>{o({plaidEvent:jb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Relink button pressed from Bank Error alert"})},[wh.CHAT]:()=>bk(t.apiInstitutionName,t.apiErrorCode)}}}(p,e,m,n,r,l,a,o,h);case wh.UNLINK_ONLY:return function(e,t,n,r,a,o,i){return{alert:yk(e,t.apiInstitutionName,a,o,[{key:_u,label:"Cancel"},{key:qu,label:"Unlink",type:oh.SUCCESS}]),actions:{success:()=>{i?r({plaidEvent:qb,plaidItemId:t.id,apiAccessToken:t.apiAccessToken,apiErrorCode:t.apiErrorCode,message:"Unlink Bank Error button pressed"}):n({id:String(t.id),removeFromApi:!0})}}}}(p,e,t,d,a,o,c);default:return function(e,t,n,r,a,o){return{alert:yk(e,t,a,o,[{key:_u,label:"Cancel"},{key:wh.CHAT,label:"Chat",type:oh.SUCCESS}]),actions:{[wh.CHAT]:()=>bk(t,r)}}}(p,e.apiInstitutionName,e.apiErrorType,e.apiErrorCode,a,o)}var g,v,f,b}const Ck=async({alert:e,actions:t})=>{const n=await e();if("string"==typeof n&&t[n])try{await t[n]()}catch(r){wa({error:new Error("error while handling bank error alert action"),severity:"error",extraData:{error:r}})}};function xk({task:e}){const{linkPlaid:t,loading:n}=sy(),{linkPlaid:r,loading:a}=cy(),o=wk(e?.meta?.plaidItem),i=n&&"RELINK"===e.type,l=a&&"LINK_BANK"===e.type,s="RELINK"!==e.type&&"LINK_BANK"!==e.type&&sr(o);if(i||l||s)return null;const c="LINK_BANK"===e.type?"FinancialOverviewLinkAccountBanner":"RELINK"===e.type?"FinancialOverviewRelinkAccountBanner":void 0;return I(fk,{task:e,handleClick:()=>{"RELINK"===e.type?t({plaidEvent:jb,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?(ya("Plaid Banner Link Bank clicked",{plaidItem:e?.meta?.plaidItem}),r({plaidEvent:zb,message:"Plaid Banner Link Bank pressed"})):cr(o)&&(ya("Plaid Banner Bank Error clicked",{plaidItem:e?.meta?.plaidItem}),Ck(o))},eventSource:c})}const Tk=gr(lr.banner,lr["banner-default"],gk({priority:"DEFAULT"}));function kk(){const e=wT()?"We'll let you know of new items":"We'll let you know if a new action item comes up";return I("div",{...Tk,children:I(ck,{title:"All Caught Up",description:e,type:"ALL_CAUGHT_UP"})})}const Ek=gr(lr.banner,lr["banner-default"],gk({priority:"DEFAULT"}));function Ak(){const e=wT()?"No action items yet":"No action items yet as your bookkeeper is setting up your books";return I("div",{...Ek,children:I(ck,{title:"Onboarding In Progress",description:e,type:"NO_ACTION_ITEMS"})})}const Sk=tr({width:"100%",height:72,minWidth:"300px"});function Ik(){return R(N,{children:[I(Xo,{styles:Sk}),I(Xo,{styles:Sk}),I(Xo,{styles:Sk})]})}function Nk({taskBanners:e,handleScrollAction:t,isWaitingForPlaidItemAccountsSync:n,isFilling:r}){const a=e.length>0;return r?I(Ik,{}):a?e.map(e=>void 0===Zw[e.type]?null:"LINK_BANK"===e.type||"BANK_ERROR"===e.type||Object.values(wh).includes(e.type)?I(xk,{task:e},e.id):I(fk,{task:e,handleClick:()=>t(e.type)},e.id)):I(n?Ak:kk,{})}const Rk=gr(lr["button-table-header"]),Pk=tr({height:{xl:"auto",base:"44px"}});function Dk(){const e=bh({params:{filter:{status:{equal:"ACTIVE"}}},select:e=>({...e,hasActiveBankAccount:e?.data??!1})});return I("div",{className:Pk,children:R(Xs,{onClick:()=>{rs(e?"BanksAndIntegrations":"NewConnection")},width:"fill-parent",stylists:[Rk],eventSource:"FinancialOverviewActionItemHeader",children:[I(cl,{Component:Du}),I(vc,{children:"Banks & Integrations"})]})})}const Mk=vi(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:"M1 3.5H14"}),r.createElement("path",{d:"M1 7.5H14"}),r.createElement("path",{d:"M1 11.5H14"})),"HamburgerNavMenu"),Lk=tr.raw({width:"44px",height:"44px"});function Fk(){return I(Xs,{onClick:()=>rs("NavMenu"),styles:Lk,children:I(Sd,{Component:Mk})})}const Ok=gr(lr["business-owner-dashboard-header"],tr(vr,{flexDirection:{base:"column",xl:"row"},alignItems:{base:"stretch",xl:"center"},justifyContent:{base:"center",xl:"space-between"},height:{base:"auto",xl:"80px"},minHeight:"80px",gap:{base:"16px",xl:0}})),Vk=tr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"});function Uk(){return R("div",{...Ok,children:[R("div",{className:Vk,children:[I(Fk,{}),I(Dk,{})]}),I(kr,{children:"Action Items"})]})}const Bk=()=>{const e=wT(),{isApp:t}=i(Pd);return e&&t};function Hk({shouldFilterTasks:e=!1}){const t=Bk(),{taskBanners:n,isFilling:r}=$w(e),a=ks(),{query:{data:o}}=rg();return R(N,{children:[t?I(Uk,{}):R(br,{children:[I(kr,{children:"Action Items"}),I(Dk,{})]}),I(rk,{children:I(Nk,{taskBanners:n,handleScrollAction:eC,isWaitingForPlaidItemAccountsSync:!a&&!0===o?.plaidItemAccountsReadyToSync,isFilling:r})})]})}const Wk=gr(lr["business-owner-dashboard"],tr({gap:"10px",display:"flex",flexDirection:"column",width:"100%",maxWidth:"1440px"})),zk=tr({display:"flex",width:"100%",justifyContent:"center"}),_k={status:{in:["ACTIVE","INACTIVE"]}};function jk({period:e,onChangePeriod:t}){const{sortInstance:n,setSortInstance:r,apiSort:a}=function(){const[e,t]=d(void 0);return{sortInstance:e,setSortInstance:u(e=>{!function(e){if(void 0===e)return!0;const t=(e.orderBy&&e.orderBy in Sl)??!1,n=(e.direction&&e.direction in Il)??!1;return t&&n}(e)?t(void 0):t(e)},[t]),apiSort:e}}(),{query:{data:o},isFilling:l,paginationControls:s}=Dl({limit:10,sort:a,filter:$i}),c=o?.data??tl,h=wT(),{hasBookkeeper:p}=i(Qc),{initialPageProps:m}=i(Pd),{query:{data:g}}=rg(),v=function(e,t){const n=!(void 0===t||t.hasPlaidLinkedBankAccount&&!t.plaidItemAccountsReadyToSync);return!e&&n}(function(){const{query:{data:e}}=ws({filter:_k,limit:1});return(e?.data?.length??0)>0}(),g),f=/* @__PURE__ */new Date,b={month:f.getMonth(),year:f.getFullYear()};const[y,w]=Cc(m?.period??b,e,t),C=(x=y.month,{beginDate:rt((T=y.year)-1,x+1,1),endDate:rt(T,x+1,0)});var x,T;return I("div",{className:zk,children:R("div",{...Wk,children:[I(Hk,{shouldFilterTasks:h}),!h&&R(N,{children:[I(Gy,{period:y,handleDateChange:e=>{var t,n;(t=b).year===(n=e).year&&n.month>t.month||n.year>t.year||w(e)},todayPeriod:b,showSamples:v,showLinkAccountButton:v&&!g?.plaidItemAccountsReadyToSync}),p&&R(N,{children:[I(br,{children:I(kr,{children:"Financial Summary"})}),I(hu,{isSample:v,period:y})]})]}),!h&&I(N,{children:I(hi,{filter:C,isSample:v})}),p&&I(Vd,{sortInstance:n,setSortInstance:r,conversations:c,paginationControls:s,isFilling:l,isMobile:h}),I(tk,{})]})})}function qk(e){return I(xa||N,{children:e.children})}function Kk({children:e}){return I(qk,{children:I("div",{className:ur(lr.component),children:e})})}function Yk({source:e,children:t}){return I(Tn.Provider,{value:e,children:t})}function Zk(e){return I(Kk,{children:I(Yk,{source:"FinancialOverview",children:I(jk,{...e})})})}const Gk=tr({display:"flex",flexDirection:"column"});function Qk({task:e}){return I("div",{className:Gk,children:I(xk,{task:e})})}const Xk=tr({padding:"15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",backgroundColor:"surface.foreground",display:"flex",flexDirection:"column",gap:"5px"}),Jk=tr({width:"80px",height:"12px"}),$k=tr({width:"150px",height:"16px"}),eE=tr({display:"flex",flexDirection:"column",gap:"15px",marginTop:"15px"}),tE=tr({userSelect:"none",cursor:"pointer"});function nE(){return R("div",{className:eE,children:[R("div",{className:tE,children:[R("div",{className:Xk,children:[I(Xo,{styles:$k}),I(Xo,{styles:Jk})]}),R("div",{className:Xk,children:[I(Xo,{styles:$k}),I(Xo,{styles:Jk})]})]}),I("div",{className:tE,children:R("div",{className:Xk,children:[I(Xo,{styles:$k}),I(Xo,{styles:Jk})]})})]})}const rE=tr.raw({"&::before":{content:{base:"''",sm:"none"},position:"absolute",top:"-11px",left:"-11px",right:"-11px",bottom:"-11px"}});function aE({children:e,stylists:t,shouldUseButtonDiscreteStyles:n=!1}){const r=wT(),a=n||r?zc:Xs;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(a,{extraClassNames:[rE],popupTriggerProps:e,children:I(cl,{Component:tf,stylists:t})})}),I(Fc,{children:e})]})}const oE=vi(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"),iE=or({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 lE({width:e="lg",children:t}){const n=gr(lr["modal-popup"],iE({width:e}));return I("div",{...n,onClick:e=>{e.stopPropagation()},children:t})}const sE=tr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),cE=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),dE=tr({display:"flex",flexDirection:"column",gap:"12px"}),uE=tr({display:"flex",flexDirection:"row",gap:"10px"}),hE=tr({display:"flex",flexDirection:"column",gap:"10px"}),pE=({acknowledged:e,setAcknowledged:t})=>R("div",{className:dE,children:[I(sc,{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:uE,children:[I(sw,{checked:e,onClick:()=>t(!e)}),I(sc,{wrap:"wrap",children:"I understand."})]})]});function mE({bankAccounts:e}){const{apiPartnerName:t}=i(Qc),n=e.reduce((e,t)=>{const n=Nt(t.tranStartDate||""),r=Nt(e.tranStartDate||"");return n&&r&&Et(n,r)?t:e}).tranStartDate||"",r=((e,t)=>{const{mutateAsync:n}=Bh(),r=kc();return vb({defaultValues:{tranStartDate:t},onSubmit:async t=>{var a,o;await n((a=e,o=t.value.tranStartDate,a.map(e=>({id:cs(e.id),tranStartDate:o,duplicateBankAccountIds:[]})))),r.close(),ih({title:"Start Date Updated",body:R("div",{className:hE,children:[I(sc,{wrap:"wrap",children:"Your start dates have been updated and your transactions are being removed in the background."}),I(sc,{wrap:"wrap",children:"This process may take a few minutes to complete, but you may close this alert."})]}),buttons:[{label:"Done",key:qu,type:oh.SUCCESS}]})}})})(e,n),a=kc(),o=()=>{a.close()},[l,s]=d(!1),{query:{data:c}}=Hu(),u=c?.data?.find(t=>t.id===(e[0]?.integration?.id??""))?.apiInstitutionName||"bank",h=Nt(e.reduce((e,t)=>{const n=Nt(t.tranMinStartDate||""),r=Nt(e.tranMinStartDate||"");return n&&r&&Et(n,r)?t:e}).tranMinStartDate||""),p=1===e.length?`${t} can pull your transactions for your ${uh(e[0]?.name,e[0]?.mask)} account dating back to ${Ft(h)}.`:`${t} can pull your transactions for your ${u} account(s) dating back to ${Ft(h)}.`;return R("form",{className:sE,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit()},children:[I(To,{children:"Set Bank Transaction Start Date"}),I(sc,{wrap:"wrap",children:p}),I(sc,{wrap:"wrap",children:"What date would you like to start pulling transactions back to?"}),I(r.AppField,{name:"tranStartDate",children:e=>I(e.DateInput,{label:"Start Date",maxDate:/* @__PURE__ */new Date,minDate:h,editable:!0})}),I(r.Subscribe,{selector:e=>e,children:e=>{const t=Nt(e.values.tranStartDate||""),r=Nt(n),a=t&&r&&Et(t,r);return R(N,{children:[e.isDirty&&a&&I(pE,{acknowledged:l,setAcknowledged:s}),R("div",{className:cE,children:[I(wb,{showIcon:!1,onClick:o}),I(Jh,{showIcon:!1,textContent:"Confirm",disabled:!!a&&!l})]})]})}})]})}function gE({bankAccounts:e}){return R(Tc,{placement:"right-start",children:[I(Ec,{children:e=>R(Wm,{...e,children:[I(Sd,{Component:oE}),I(To,{children:"Edit Start Date"})]})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(mE,{bankAccounts:e})})})})]})}const vE=vi(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"),fE=vi(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"),bE={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 yE(e){const{apiPartnerName:t,unitIntegrationBankName:n}=i(Qc);return"UNIT"===e?n??t??"Unit":bE[e]||e.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const wE=tr({display:"flex",flexDirection:"column",gap:"16px"}),CE=gr(null,tr({color:"brand.danger"}));function xE({integration:e,accounts:t}){const{mutate:n}=oy(),r=kc(),{linkPlaid:a,loading:o,hasOnPlaidLinkOverride:i}=sy(),{query:{data:l}}=(s=e.id,Bu({},{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}}=ig(e.id),u=d?.data,h=yE(e.apiName),p="PLAID"===e.apiName;return R(Lm,{children:[p&&!o&&R(Wm,{onClick:()=>(a({plaidEvent:jb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Add Account button pressed"}),void r.close()),children:[I(Sd,{Component:Os}),I(To,{children:"Add Account"})]}),p&&u&&I(gE,{bankAccounts:u}),Je(t)&&R(Wm,{onClick:()=>Lb({plaidItemAccounts:t}),children:[I(Sd,{Component:fE}),I(To,{children:"Merge Accounts"})]}),p&&R(Wm,{onClick:()=>(async()=>{let o;var l;o=Je(t)?await(async e=>ih({title:"Remove Institution",body:I("div",{className:wE,children:I(sc,{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:_u,label:"Cancel"},{key:ju,label:"Remove",type:oh.DANGER}]}))(e.apiInstitutionName??h):await(async e=>ih({title:"Remove Institution",body:I("div",{className:wE,children:I(sc,{wrap:"wrap",children:`Would you like to unlink ${e} altogether?`})}),buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Remove",type:oh.DANGER}]}))(h),r.close(),o===ju&&(p&&i?a({plaidEvent:qb,plaidItemId:e.id,apiAccessToken:c?.apiAccessToken,apiErrorCode:c?.apiErrorCode,message:"Remove Institution confirmed in alert"}):(l=e.id,n({id:l,removeFromApi:p})))})(),children:[I(Sd,{stylists:[CE],Component:vE}),I(To,{stylists:[CE],children:"Delete Connection"})]})]})}const TE=tr({userSelect:"none"});function kE({children:e}){return I("div",{className:TE,children:e})}const EE=tr({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 AE({children:e}){return I("div",{className:EE,children:e})}const SE=gr(lr.badge,NC),IE=gr(null,to),NE=gr(null,ll),RE=gr(lr["neutral-badge"],PC),PE=gr(lr["highlight-badge"],MC),DE=gr(lr["success-badge"],FC),ME=gr(lr["warning-badge"],VC),LE=gr(lr["danger-badge"],lr["critical-badge"],BC);function FE({type:e,children:t,onClick:n,disabled:r,popupTriggerProps:a}){let o;switch(e){case"danger":o=LE;break;case"warning":o=ME;break;case"neutral":o=RE;break;case"success":o=DE;break;case"highlight":o=PE}const i=Cr([SE,IE,o,NE]);return I("button",{...i,onClick:n,disabled:r,...a,children:t})}function OE({plaidItem:e}){const t=wk(e),n=sr(e.apiErrorCode)&&kh(e);return R(FE,{type:n?"highlight":"danger",onClick:n=>{n.stopPropagation(),t&&(ya(`Plaid Bank Error Badge clicked for item ${e.id}`,{plaidItem:e}),Ck(t))},disabled:sr(t),children:[I(Sd,{Component:n?Du:bi}),I(Eo,{children:n?"Relink for Statements":"Fix Bank Error"}),I(cl,{Component:rl})]})}const VE=or({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"}}}}}),UE=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"14px",overflow:"hidden"});function BE({bankAccountId:e,name:t,mask:n,syncText:r,active:a,integration:o}){const i="PLAID"===o?.apiName,l=rr(VE({active:a}),ll);return R("button",{className:l,onClick:t=>{t.stopPropagation(),rs("BankAccountForm",{routeProps:{bankAccountId:e}})},disabled:!a,children:[R("div",{className:UE,children:[I(Sd,{Component:i?Aw:gg}),I(fg,{accountName:t,accountNo:n,syncText:r,active:a})]}),a&&I(Sd,{Component:rl})]})}const HE=tr({display:"flex",flexDirection:"column",gap:"4px"}),WE=tr({display:"flex",alignItems:"center",gap:"8px"}),zE=gr(null,tr({color:"brand.primary.weak"})),_E=tr({overflow:"hidden"});function jE({integration:e,isCompact:t=!1}){const{query:{data:n}}=ig(e.id),r=n?.data,a="PLAID"===e.apiName,o=yE(e.apiName);if(!Je(r))return null;const i=e.iconUrl?Cg(e.iconUrl,`${e.apiInstitutionName} logo`):void 0;return R(kE,{children:[R(AE,{children:[R(zv,{children:[I(Td,{Component:i??gg}),R("div",{className:HE,children:[I(sc,{children:e.apiInstitutionName??o}),I(Eo,{children:Hb(r)})]})]}),R("div",{className:WE,children:[a&&(l=e,cr(l.apiErrorCode)||kh(l))&&I(OE,{plaidItem:e}),I(aE,{stylists:[zE],shouldUseButtonDiscreteStyles:t,children:I(xE,{integration:e,accounts:r})})]})]}),I("div",{className:_E,children:r.map(t=>{const n=t.isSupported&&"ACTIVE"===t.status;return I(BE,{bankAccountId:t.id,mask:t.mask,name:t.name,syncText:Wb(t),active:n,integration:e},t.id)})})]});var l}const qE=Cg("data:image/png;base64,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","Stripe"),KE=Cg("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"),YE=Cg("data:image/png;base64,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","Shopify"),ZE=Cg("data:image/png;base64,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","Gusto"),GE=Cg("data:image/png;base64,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","Freshbooks"),QE=Cg("data:image/png;base64,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","Uber"),XE=Cg("data:image/png;base64,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","Bank"),JE={GUSTO:ZE,FRESHBOOKS:GE,FRESHBOOKS2:GE,SHOPIFY:YE,STRIPE:qE,SQUARE:KE,UBER:QE};function $E(e){return JE[e]??XE}const eA=tr({display:"flex",flexDirection:"column",gap:"4px"});function tA({integration:e,isCompact:t}){const n=yE(e.apiName),r=function(e){if(e)return`Last synced ${Lt(e)}`}(e.lastSyncedDate),a=$E(e.apiName);return I(kE,{children:R(AE,{children:[R(zv,{children:[I(Td,{Component:a}),R("div",{className:eA,children:[I(sc,{wrap:"wrap",children:e.apiUsername?`${n} (${e.apiUsername})`:n}),r&&I(Eo,{intent:"normal",children:r})]})]}),I(aE,{shouldUseButtonDiscreteStyles:t,children:I(xE,{integration:e})})]})})}const nA=tr({display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"16px 12px",marginBottom:"8px"}),rA=tr.raw({color:"typography.base.weak"}),aA=tr({overflow:"hidden"});function oA({manualBankAccounts:e,isCompact:t=!1}){const n=wT(),r=t||n?zc:Xs;return R(kE,{children:[R("div",{className:nA,children:[I(sc,{extraClassNames:[rA],children:"Manually Tracked Accounts"}),I(r,{onClick:()=>rs("BankAccountForm"),active:!1,children:I(cl,{Component:Os})})]}),I("div",{className:aA,children:e.map(e=>I(BE,{bankAccountId:e.id,name:e.name,mask:e.mask,active:"ACTIVE"===e.status},e.id))})]})}const iA=gr(lr["selector-row"],rr(tr(_s,{backgroundColor:"surface.foreground",minWidth:"100%",justifyContent:"start",marginBottom:"5px",padding:"16px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"}),ol)),lA=tr({display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}),sA=tr({display:"flex",alignItems:"center",gap:"8px"}),cA=tr({display:"flex",flexDirection:"column",alignItems:"start",width:"100%",gap:"4px"}),dA=gr(null,tr({width:"20px",height:"20px"}));function uA(){const{linkPlaid:e,loading:t}=cy();return I("button",{...iA,disabled:t,onClick:()=>{ya("Add New Connection button pressed"),e({plaidEvent:zb,message:"Add New Connection button pressed"})},children:R("div",{className:lA,children:[R("div",{className:sA,children:[I(Td,{stylists:[dA],Component:gg}),R("div",{className:cA,children:[I(sc,{children:"Connect your bank"}),I(Eo,{children:"Find your banking institution with Plaid"})]})]}),I(Sd,{Component:rl})]})})}const hA=tr({paddingInline:"16px",paddingBottom:"8px"}),pA=tr.raw({color:"typography.base.weak",fontWeight:"label"});function mA({title:e,children:t}){return R("div",{children:[I("div",{className:hA,children:I(sc,{extraClassNames:[pA],children:e})}),t]})}const gA=tr({minWidth:"100%",height:"45px"});function vA(){return R(N,{children:[I(Xo,{styles:gA}),I(Xo,{styles:gA}),I(Xo,{styles:gA})]})}const fA=gr(lr["selector-row"],rr(tr(_s,{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"}),ol)),bA=tr({display:"flex",justifyContent:"space-between",alignItems:"center",minWidth:"100%",width:"100%",height:"25px",gap:"15px"}),yA=tr({display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",gap:"12px"}),wA=tr({display:"flex",alignItems:"center",justifyContent:"center",gap:"5px"});function CA({integration:e}){const{linkPlaid:t,loading:n}=sy(),r="PLAID"===e.apiName,a=yE(e.apiName),o=e.iconUrl?Cg(e.iconUrl,"Institution Icon"):gg;return I("button",{...fA,disabled:n||!r,onClick:()=>{ya(`Relink button pressed for plaid item ${e.id}`,{integration:e}),t({plaidEvent:jb,plaidItemId:e.id,apiAccessToken:e.apiAccessToken,apiErrorCode:e.apiErrorCode,message:"Already Connected Plaid Institution button pressed"})},children:R("span",{className:bA,children:[R("div",{className:yA,children:[I(Td,{Component:o}),I(sc,{children:e.apiInstitutionName??a??void 0})]}),r&&R("div",{className:wA,children:[I(cl,{Component:Du}),I(sc,{children:"Relink"})]})]})})}const xA=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"}))),TA=gr(lr["selector-row"],rr(tr(_s,{minWidth:"100%",justifyContent:"space-between",padding:"16px",backgroundColor:"surface.foreground",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}",borderTopColor:"transparent",borderLeft:"none",borderRight:"none"}),ol)),kA=tr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"}),EA=tr({display:"flex",flexDirection:"column",gap:"12px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),AA=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),SA=tr({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:"template",padding:"12px 16px",borderRadius:"md",_focusVisible:{outline:"4px solid",outlineColor:"border.layout"}}),IA=tr({display:"flex",justifyContent:"center",alignItems:"center",width:"100%"});function NA(){const e=kc(),{mutateAsync:t}=ty(),[n,r]=d("");return R("div",{className:EA,children:[I(To,{children:"Enter your shop name"}),I("div",{className:IA,children:I(xA,{})}),I(sc,{children:"Please enter the name of your shop below."}),I("input",{className:SA,value:n,onChange:e=>r(e.target.value),placeholder:"Enter shop name"}),R("div",{className:AA,children:[I(wb,{showIcon:!1,onClick:()=>{e.close()}}),I(Xh,{onClick:async()=>{const r=await t({apiName:"SHOPIFY",apiUserId:n});window.open(r.url),e.close()},children:I(To,{children:"Connect"})})]})]})}function RA(){const e=$E("SHOPIFY")??Du;return R(Tc,{placement:"bottom",children:[I(Ec,{children:t=>R("button",{...TA,...t,children:[R("div",{className:kA,children:[I(Td,{Component:e}),I(sc,{children:"Shopify"})]}),I(Sd,{Component:rl})]})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(NA,{})})})})]})}const PA=gr(lr["selector-row"],rr(tr(_s,{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"}),ol)),DA=tr({height:"25px",display:"flex",alignItems:"center",justifyContent:"start",gap:"12px"});function MA({apiName:e}){const{mutateAsync:t}=ty(),n=yE(e),r=dn(e=>e.events.gusto);if("SHOPIFY"===e)return I(RA,{});const a=$E(e)??Du;return R("button",{...PA,onClick:async()=>{if("GUSTO"===e){let e=!1;if(cr(r)&&(r.listener({type:"GUSTO_NEW",result:"SUCCESS",data:null,error:null}),e=r.preventDefault??!1),e)return}const n=await t({apiName:e});window.open(n.url)},children:[R("div",{className:DA,children:[I(Td,{Component:a}),I(sc,{children:n})]}),I(Sd,{Component:rl})]})}const LA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE","UBER"];function FA(e){return LA.includes(e)}const OA=["FRESHBOOKS","GUSTO","SHOPIFY","SQUARE","STRIPE"],VA=tr({display:"flex",flexDirection:"column",paddingTop:"16px",gap:"16px",overflowY:"auto",height:"100%",backgroundColor:"surface.background"}),UA=tr({display:"flex",flexDirection:"column",borderTop:"{borderWidths.md} solid {colors.border.layout.weak}"});function BA(){const{query:{data:e},isFilling:t}=Yw(),n=e?.multiAccountIntegrations,r=e?.integrations,a=cr(n)&&n.length>0||cr(r)&&r.length>0,o=function({connectedIntegrations:e}){const t=i(Qc),n=dn(e=>e.externalOptions.banksAndIntegrations?.integrations),r=n?.filter(FA),a=e?.map(e=>e.apiName)||[];let o=r??OA;return t&&(o=o.filter(e=>t.supportedIntegrations.includes(e))),o=o.filter(e=>!a.includes(e)),o}({connectedIntegrations:r});return R("div",{className:VA,children:[(t||a)&&I(mA,{title:"Already Connected",children:t?I(vA,{}):R(N,{children:[n?.map(e=>I(CA,{integration:e},e.id)),r?.map(e=>I(CA,{integration:e},e.id))]})}),I(mA,{title:"Available Banks",children:I(uA,{})}),o&&o.length>0&&I(mA,{title:"Integrations",children:I("div",{className:UA,children:o.map(e=>I(MA,{apiName:e},e))})})]})}const HA=tr({marginTop:"16px"}),WA=tr({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"15px",padding:"40px 20px",backgroundColor:"surface.foreground",borderTop:"{borderWidths.md} solid {colors.border.layout.strong}"}),zA=tr.raw({color:"typography.base.weak",fontWeight:"label",paddingInline:"16px",marginBottom:"8px"});function _A({isCompact:e,showPlaidItems:t,showNewConnectionContent:n,multiAccountIntegrations:r,integrations:a,manualBankAccounts:o}){return n?I(BA,{}):t?R(N,{children:[R("div",{className:HA,children:[I(sc,{extraClassNames:[zA],children:"Connected Accounts"}),r?.map(t=>I(jE,{integration:t,isCompact:e},t.id)),a?.map(t=>I(tA,{integration:t,isCompact:e},t.id))]}),o&&o.length>0&&I(oA,{manualBankAccounts:o,isCompact:e})]}):o&&o.length>0?I(oA,{manualBankAccounts:o}):R("div",{className:WA,children:[I(Td,{Component:gg}),I(To,{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 jA=gr(null,tr({color:"typography.base.weak"})),qA=gr(lr["drawer-header"],tr({padding:"10px 12px 10px 15px",borderBottom:"{borderWidths.md} solid {colors.border.layout.weak}"},Vv)),KA=tr({display:"flex",gap:"8px"}),YA=tr({display:"flex",flexDirection:"column",gap:"16px",height:"100%"}),ZA=or({base:{overflowY:"auto",height:{base:"100%",sm:"fit-content"},scrollbar:"hidden"},variants:{height:{fill:{height:"100%"}},background:{foreground:{backgroundColor:"surface.foreground"}}}}),GA=tr({padding:"20px 16px",display:"flex",justifyContent:"center",alignItems:"center",position:"sticky",bottom:0,backgroundColor:"surface.foreground",width:"100%"}),QA=tr({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"16px",margin:"16px"}),XA=gr(null,tr({minWidth:"100%",padding:"16px",border:"1px solid {colors.border.intent.primary}"})),JA=or({base:{},variants:{refreshLoading:{true:{animation:"spin 1s linear infinite"},false:{animation:"none"}}}});function $A({inOverlay:e,showCloseButton:t=!1,onPlaidLink:n}){const r=wT()||e,{query:{data:a},isFilling:o}=Yw(),i=a?.multiAccountIntegrations,l=a?.integrations,{query:{data:s}}=bh({select:e=>{return{...e,plaidItemAccounts:(t=e?.data,t?.filter(e=>Wh(e.apiName)&&("ACTIVE"===e.status||"INACTIVE"===e.status||!1===e.isSupported))),manualAccounts:ag(e?.data)};var t}}),{mutate:c,isPending:d}=ry(),u=s?s.manualAccounts:null,h=i&&l?i.length+l.length:0,p=i?.find(e=>e.apiErrorCode),m=p&&Kw(p,!1),g="connected"===dn(e=>e.banksAndIntegrationsSelectedTab).value,v=0===h&&g,f=g?"Add New Connection":"Add New Account",b=()=>{rs(g?"NewConnection":"BankAccountForm")},y=r?zc:Xs;return R(Jb,{onPlaidLink:n,children:[R("div",{...qA,children:[R(zv,{children:[t&&I($u,{}),r?I(To,{children:"Banks & Integrations"}):I(kr,{stylists:[jA],children:"Banks & Integrations"})]}),R("div",{className:KA,children:[0!==h&&R(y,{onClick:()=>c(),active:!1,disabled:d,children:[I(Sd,{Component:Du,stylists:[gr(null,JA({refreshLoading:d}))]}),!r&&I(sc,{children:"Sync Accounts"})]}),R(y,{onClick:()=>b(),active:!1,children:[I(Sd,{Component:Os}),!r&&I(sc,{children:"Add New Connection"})]})]})]}),m&&I("div",{className:QA,children:I(Qk,{task:m})}),o?I(nE,{}):R(N,{children:[I("div",{className:ZA({height:v?"fill":void 0,background:v?"foreground":void 0}),children:I("div",{className:YA,children:I(_A,{isCompact:r,showPlaidItems:g,showNewConnectionContent:v,multiAccountIntegrations:i,integrations:l,manualBankAccounts:u})})}),r&&!(g&&v)&&I("div",{className:GA,children:R(Xs,{stylists:[XA],onClick:()=>b(),children:[I(Sd,{Component:Os}),I(To,{children:f})]})})]})]})}const eS=tr({display:"flex",justifyContent:"center"}),tS=tr({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 nS({onPlaidLink:e}){return I(Kk,{children:I(Yk,{source:"BanksAndIntegrations",children:I("div",{className:eS,children:I("div",{className:tS,children:I($A,{showCloseButton:!1,onPlaidLink:e,inOverlay:!1})})})})})}function rS(e){return $e({key:"customer",name:"Customer",possibleValues:e})}function aS(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 oS=tr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",width:"100%",minWidth:0});function iS({children:e}){return I("div",{className:oS,children:e})}function lS({text:e,iconUrl:t,badge:n,title:r,children:a,Footer:o}){const i=n?`${e} ${n}`:e;return R(Tc,{children:[I(Ec,{children:e=>R(pf,{popupTriggerChildrenProps:e,children:[R(iS,{children:[t&&I(Sd,{Component:Cg(t,"")}),I(sc,{wrap:"wrap",children:i})]}),I(Sd,{Component:rl})]})}),I(Kv,{title:r,Footer:o??null,children:a})]})}function sS(e,t){const{items:n,fuseOptions:r,processResults:a}=t,i=o(()=>n.flatMap(e=>[e,...e.children??[]]),[n]),l=o(()=>new Ae(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 cS({groupedList:e,computeItemKey:t,computeGroupKey:n,GroupComponent:r,RowComponent:a}){return I(N,{children:e.map((e,o)=>I(r,{groupIndex:o,children:e.map((e,n)=>I(a,{item:e},t(e,n)))},n(e,o)))})}const dS=tr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"}),uS=gr(lr["list-body"],tr({display:"block"}));function hS({label:e,children:t,zeroState:n,pluralLabel:r,singularLabel:a}){return R("div",{className:dS,children:[e&&I(sc,{intent:"weak",children:e}),n?I(rf,{pluralNounNotFound:r??"",singularSearchCTANoun:a??"",showSearchCTA:!1}):I("div",{...uS,children:t})]})}const pS=tr({display:"flex",flexDirection:"column",gap:"16px"});function mS({item:e,onItemClick:t,selected:n,isMultiSelect:r}){return I(mf,{handleClick:t,selected:n,isMultiSelect:r,children:R(iS,{children:[e.iconUrl&&I(Sd,{Component:Cg(e.iconUrl,"")}),I(sc,{wrap:"wrap",children:e.name??""})]})},e.id)}function gS({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 I(of,{children:I("div",{className:pS,children:I(cS,{groupedList:i,computeGroupKey:(e,t)=>`${t}_${e[0]}`,computeItemKey:e=>e.id,RowComponent:({item:e})=>I(mS,{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 I(hS,{label:r,children:e})}})})})}function vS({searchTerm:e,onClick:t,categories:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=sS(e,{items:n,fuseOptions:Ex,processResults:Sx});return r?I(yf,{}):0===Object.keys(i).length?I(rf,{singularSearchCTANoun:"category",pluralNounNotFound:"categories",showSearchCTA:!0}):I(gS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function fS(e,t){return qC(e,t).map(e=>({parent:e.parent,child:e.child}))}function bS({searchTerm:e,onClick:t,glAccounts:n,isFilling:r,selectedIds:a,isMultiSelect:o}){const i=sS(e,{items:n,fuseOptions:_C,processResults:fS});return r?I(yf,{}):0===Object.keys(i).length?I(rf,{singularSearchCTANoun:"GL account",pluralNounNotFound:"GL accounts",showSearchCTA:!0}):I(gS,{groupedResults:i,onItemClick:t,selectedIds:a,isMultiSelect:o})}function yS(e){const t=[];for(const n of e.children??[])t.push(n.id),t.push(...yS(n));return t}function wS(e,t){return e.value?.[t]?.value?.id?.in??[]}function CS(e,t,n,r){const a=[];return e.forEach(e=>{e.modelKey===r&&wS(e,r).some(e=>n.includes(e))||a.push(e)}),t.forEach(e=>{wS(e,r).some(e=>n.includes(e))&&a.push(e)}),a}function xS(e,t){const n=[];return e.forEach(e=>wS(e,t).forEach(e=>n.push(e))),new Set(n)}function TS(e,t,n,r){return u(n=>{t&&r&&r(t=>{const r=(t.get(e)??[]).filter(t=>!wS(t,e).some(e=>n.includes(e)));return ZT(t,e,r)})},[t,r,e])}const kS=tr.raw({width:"100%",justifyContent:"center"}),ES=tr({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 AS({onClearAll:e,onApply:t,isApplyButtonDisabled:n=!1}){return R("div",{className:ES,children:[R(kd,{type:"button",onClick:t,disabled:n,width:"fill-parent",children:[I(sc,{children:"Apply"}),I(cl,{Component:Qh})]}),I(Xs,{onClick:e,styles:kS,children:I(sc,{children:"Clear All"})})]})}function SS({onApply:e,onClearAll:t}){const n=kc();return I(AS,{onApply:()=>{e(),n.close()},onClearAll:t})}function IS({category:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>yS(e),[e]),m=u(()=>{i(p)},[p,i]),g=u(()=>{if(p&&l&&s){const e=YT(s,"category"),t=CS(l,e,p,"category");d(t)}},[p,l,s,d]),v=I(SS,{onApply:g,onClearAll:m});return I(lS,{text:e.name??"",iconUrl:e.iconUrl,badge:t,title:"All Categories",Footer:v,children:I($v,{placeholder:"Search expense categories...",onClick:a,SearchList:vS,DefaultList:NS,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:d,isMultiSelect:h}})})}function NS({categories:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(yf,{}):I(sf,{title:I(To,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=yS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(IS,{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 I(mf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:R(iS,{children:[e.iconUrl&&I(Sd,{Component:Cg(e.iconUrl,e.name??"")}),I(sc,{wrap:"wrap",children:e.name??""})]})},e.id)})})}const RS=[];function PS({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=wx(),s=i?.data??RS,c=xS(YT(t,"category"),"category"),d=u(e=>{const t=DS(e);n(t)},[n]),h=TS("category",r,0,a);return a&&o?I($v,{placeholder:"Search expense categories...",onClick:d,SearchList:vS,DefaultList:NS,listLength:s.length,extraProps:{categories:s,label:"All Expense Categories",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function DS(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 MS(){const{query:{data:e},isFilling:t}=vx(),n=e?.data,r=o(()=>n?.map(DS),[n]);return u(()=>({values:r??[],isFilling:t}),[r,t])}function LS(e){return $e({key:"category",name:"Category",NestedListComponent:PS,possibleValues:e})}const FS=[{value:"in",label:"In"}];function OS(e){return $e({key:"reviewStatus",name:"Review Status",possibleValues:e,operators:FS})}function VS(){const e=function(){const e=Ki();return(e?Vi:Ui).map(t=>ji(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 u(()=>({values:t,isFilling:!1}),[t])}function US(e){return e.value.reviewStatus?.value.in?e.value.reviewStatus.value.in:e.value.reviewStatus?.value.notIn?e.value.reviewStatus.value.notIn:[]}const BS=S.object({minAmount:S.number().nullable(),maxAmount:S.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 HS(e,t){let n=null,r=null;return t&&t.forEach(e=>{const t=e.value.amount?.value;if(t){const e={minAmount:cr((a=t).greaterThanEqual)?sh(a.greaterThanEqual):null,maxAmount:cr(a.lessThanEqual)?sh(a.lessThanEqual):null};n=e.minAmount??n,r=e.maxAmount??r}var a}),{minAmount:n,maxAmount:r}}const WS=tr({display:"flex",minHeight:0,width:"100%",height:"100%",justifyContent:"space-between",flexDirection:"column"});function zS({children:e,title:t}){return I(Kv,{title:t,padChildren:!1,children:I("form",{onSubmit:e=>{e.preventDefault()},className:WS,children:e})})}const _S=tr({display:"flex",flexDirection:"row",width:"100%",alignItems:"center",gap:"16px"}),jS=tr({display:"flex",flexDirection:"column",flex:1}),qS=tr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function KS({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){return I(zS,{title:"Amount",children:I(YS,{model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a})})}function YS({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=kc();return vb({defaultValues:HS(0,r),validators:{onChange:BS},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=vo(e,{dollarSign:!0,signage:"default"}),a=ch(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=vo(t,{dollarSign:!0,signage:"default"}),r=ch(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:[I("div",{className:qS,children:R(of,{children:[R("div",{className:_S,children:[I("div",{className:jS,children:I(o.AppField,{name:"minAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Minimum",autofocus:!0,hasErrorStyles:l})})}),I(To,{children:"To"}),I("div",{className:jS,children:I(o.AppField,{name:"maxAmount",listeners:{onBlur:s},children:e=>I(e.EditableAmountField,{label:"Maximum",hasErrorStyles:l})})})]}),l&&I(dp,{errorMessage:Object.values(i)[0].amounts[0].message})]})}),I(AS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue("minAmount",null),o.setFieldValue("maxAmount",null),r&&r([])},isApplyButtonDisabled:l})]})}const ZS=[{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 GS(){return $e({key:"amount",name:"Amount",operators:ZS,ModalComponent:KS})}function QS(){const{query:{data:e},isFilling:t}=bh(),n=e?.data,r=function({institutionIds:e}){const t=Pr(),n=Or(),r=[...new Set(e)],a=V({queries:r.map(e=>({queryKey:bg({institutionId:e,accessToken:t,environment:n}),queryFn:async()=>({institutionId:e,data:await zu({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=>cr(e))??[],[n])}),a=o(()=>n?.map(e=>{const t=e?.name,n=e?.mask,a=uh(t,n);return{name:a,iconUrl:r[e.integration?.apiInstitutionId??""],value:{bankAccount:{name:a,value:{id:{in:[e.id]}}}}}}),[n,r]);return u(()=>({values:a??[],isFilling:t}),[a,t])}function XS(e){return $e({key:"bankAccount",name:"Bank Account",possibleValues:e})}const JS=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:[],$S=async e=>{const t=e.queryKey,n={path:"/v6/dimensions/values/query",bodyParams:{},accessToken:t[1].accessToken,endpointManager:xi(t[1].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function eI(e){return Vr({queryKey:["dimensionValues"],queryFn:$S,...e})}function tI(){const{query:{data:e},isFilling:t}=wv({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 u(()=>({values:r??[],isFilling:t}),[r,t])}function nI(e){return $e({key:"vendor",name:"Vendor",possibleValues:e})}function rI(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 $e({key:"type",name:"Type",possibleValues:()=>({values:t})})}const aI=vi(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"),oI=gr(null,tr({fill:"surface.intent.action.active"}));function iI({isSelected:e}){return I(Sd,e?{Component:aI,stylists:[oI]}:{Component:cf})}function lI({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 I(sf,{title:I(Eo,{children:"Filter by"}),children:r.values.map((r,o)=>{const i=(l=r,0===a.length?uI(l.value.status?.value):a.some(e=>C(e.value,l.value)));var l;return R(pf,{handleClick:()=>(r=>{const a=[...e.filter(e=>e.modelKey!==t.key),t.createFilter(r)];n(a)})(r),selected:i,children:[I(iS,{children:I(sc,{wrap:"wrap",children:r.name})}),I(iI,{isSelected:i})]},`${r.name}_${o}`)})})}const sI="status",cI=[{name:"Active",apiStatuses:["ACTIVE"]},{name:"Archived",apiStatuses:["INACTIVE"]},{name:"Active and Archived",apiStatuses:["ACTIVE","INACTIVE"]}];function dI(){const e="in";return{values:cI.map(t=>({name:t.name,value:{status:{name:t.name,value:{[e]:[...t.apiStatuses]}}}}))}}function uI(e){if(!e)return!1;const t=e.in;return Array.isArray(t)&&1===t.length&&"ACTIVE"===t[0]}function hI(e){return uI(e.value.status?.value)}function pI(){return $e({key:sI,name:"Status",possibleValues:dI,singleSelect:!0,SimpleListComponent:lI})}const mI=(gI={bankAccount:!0,vendor:!0,dimensionValues:!0,customer:!0,category:!0,glAccount:!0,reconciliationMatch:!0,invoice:!0,bill:!0,payroll:!0,conversation:!0},Object.keys(gI));var gI;function vI({onApply:e,onClearAll:t}){const n=kc();return I(AS,{onApply:()=>{e(),n.close()},onClearAll:t})}function fI({glAccount:e,badge:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:i,filters:l,pendingFilters:s,setPendingFilters:c,setFilters:d,isMultiSelect:h}){const p=o(()=>yS(e),[e]),m=u(()=>{i(p)},[p,i]),g=u(()=>{if(p&&l&&s){const e=YT(s,"glAccount"),t=CS(l,e,p,"glAccount");d(t)}},[p,l,s,d]),v=I(vI,{onApply:g,onClearAll:m});return I(lS,{text:e.name,iconUrl:e.iconUrl,badge:t,title:"All GL Accounts",Footer:v,children:I($v,{placeholder:"Search GL accounts...",onClick:a,SearchList:bS,DefaultList:bI,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:d,isMultiSelect:h}})})}function bI({glAccounts:e,label:t,isFilling:n,selectedIds:r,onToggle:a,onClearAllChildren:o,filters:i,pendingFilters:l,setPendingFilters:s,setFilters:c,isMultiSelect:d}){return n?I(yf,{}):I(sf,{title:I(To,{children:t}),children:e.map(e=>{if(e.hasChilds){const t=yS(e),u=t.length>0?t.filter(e=>r.has(e)).length:0,h=u>0?`(${u})`:void 0;return I(fI,{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 I(mf,{handleClick:()=>a(e),selected:t,isMultiSelect:d,children:I(iS,{children:I(sc,{wrap:"wrap",children:e.name})})},e.id)})})}const yI=[];function wI({filters:e,pendingFilters:t,onToggle:n,model:r,setPendingFilters:a,setFilters:o}){const{query:{data:i},isFilling:l}=kC(),s=i??yI,c=xS(YT(t,"glAccount"),"glAccount"),d=u(e=>{const t=CI(e);n(t)},[n]),h=TS("glAccount",r,0,a);return a&&o?I($v,{placeholder:"Search GL accounts...",onClick:d,SearchList:bS,DefaultList:bI,listLength:s.length,extraProps:{glAccounts:s,label:"All GL Accounts",isFilling:l,selectedIds:c,onToggle:d,onClearAllChildren:h,filters:e,pendingFilters:t,setPendingFilters:a,setFilters:o,isMultiSelect:!0}}):null}function CI(e){const t=e.name;return{name:t,value:{glAccount:{name:t,value:{id:{in:[e.id]}}}}}}function xI(e){return $e({key:"glAccount",name:"GL Account",NestedListComponent:wI,possibleValues:e})}function TI(e,t){const n={},r=t.value;var a,o,i,l;return r.date&&(n.date=function(e){if(pt(e)){const t=yt(e);return{greaterThanEqual:t.beginDate,lessThanEqual:t.endDate}}if(gt(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,aS(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 aS(e,t)}(e.bankAccount,r.bankAccount.value)),r.dimensionValues&&(n.dimensionValues=function(e,t){return aS(e,t)}(e.dimensionValues,r.dimensionValues.value)),r.glAccount&&(n.glAccount=function(e,t){return aS(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 aS(e,t)}(e.vendor,r.vendor.value)),r.customer&&(n.customer=function(e,t){return aS(e,t)}(e.customer,r.customer.value)),r.notes&&(n.notes=r.notes.value),{...e,...n}}function kI(e,t){const n=e.reduce(TI,{});return n.status||(n.status={in:["ACTIVE"]}),!n.type&&t&&(n.type=t),function(e){const t={...e};return mI.forEach(e=>{const n=t[e];t[e]=k(n)?{expand:!0}:{...n,expand:!0}}),t}(n)}const EI=e=>{const t=dn(e=>e.transactionsDashboardFilters),n=dn(e=>e.expenseDashboardFilters),r=dn(e=>e.incomeDashboardFilters),a=dn(e=>e.setTransactionsDashboardFilters),o=dn(e=>e.addTransactionsDashboardFilters),i=dn(e=>e.removeTransactionsDashboardFilter),l=dn(e=>e.hasInitializedTransactionsDashboardFilters),s=dn(e=>e.setExpenseDashboardFilters),c=dn(e=>e.addExpenseDashboardFilters),d=dn(e=>e.removeExpenseDashboardFilter),u=dn(e=>e.hasInitializedExpenseDashboardFilters),h=dn(e=>e.setIncomeDashboardFilters),p=dn(e=>e.addIncomeDashboardFilters),m=dn(e=>e.removeIncomeDashboardFilter),g=dn(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:m,hasUserConfiguredFilters:g}}};function AI(){return{getCategories:MS(),getBankAccounts:QS(),getCustomers:tI(),getVendors:function(){const{query:{data:e},isFilling:t}=qg(),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 u(()=>({values:r??[],isFilling:t}),[t,r])}(),getDimensionValues:function(){const{query:{data:e},isFilling:t}=eI(),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 u(()=>({values:r??[],isFilling:t}),[r,t])}(),getGlAccounts:function(){const{query:{data:e},isFilling:t}=vC(),n=o(()=>e?.map(e=>CI(e)),[e]);return u(()=>({values:n??[],isFilling:t}),[n,t])}(),getReviewStatuses:VS()}}function SI(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 II=tr({display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between",padding:"16px"});function NI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){return I(zS,{title:"Back",children:I(RI,{model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a})})}function RI({model:e,setFilters:t,filters:n,setPendingFilters:r,pendingFilters:a}){const o=function({model:e,setFilters:t,filters:n,pendingFilters:r}){const a=kc();return vb({defaultValues:{[e.key]:SI(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:[I("div",{className:II,children:I(of,{children:I(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=>I(t.TextField,{label:"Contains",placeholder:`Filter ${e.key}...`})})})}),I(AS,{onApply:o.handleSubmit,onClearAll:()=>{o.setFieldValue(String(e.key),""),r&&r([])}})]})}const PI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function DI(){return $e({key:"description",name:"Description",operators:PI,ModalComponent:NI})}const MI=[{value:"equal",label:"Equals"},{value:"notEqual",label:"Does not equal"},{value:"contain",label:"Contains"}];function LI(){return $e({key:"notes",name:"Notes",operators:MI,ModalComponent:NI})}const FI=[{name:"Expense",types:vw.Expense},{name:"Income",types:vw.Income},{name:"Transfer",types:vw.Transfer}];function OI(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=EI("transactionsDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=AI(),p=o(()=>({reviewStatus:OS(h),amount:GS(),bankAccount:XS(l),category:LS(i),customer:rS(c),date:Ht,description:DI(),glAccount:xI(d),notes:LI(),status:pI(),vendor:nI(s),type:rI(FI),search:tt}),[l,i,s,c,d,h]),m=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]),g=/* @__PURE__ */(new Date).getDate(),v=o(()=>kI(e,void 0),[e,g]),f=u(e=>p[e],[p]);return{dashboardKey:"transactionsDashboard",filters:e,filterPopupModels:m,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}function VI(e,t,n,r,a){const o=dn(e=>e.initializeTransactionsDashboardFilters),i=dn(e=>e.initializeExpenseDashboardFilters),l=dn(e=>e.initializeIncomeDashboardFilters),c=dn(e=>e.hasInitializedTransactionsDashboardFilters),d=dn(e=>e.hasInitializedExpenseDashboardFilters),u=dn(e=>e.hasInitializedIncomeDashboardFilters),h=Yi(),p="transactionsDashboard"===e?c:"expenseDashboard"===e?d:u;s(()=>{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 UI=l(void 0);function BI(){const e=i(UI);if(void 0===e)throw new Error("useTransactionsFilterContext must be used within a TransactionsFilterContext.Provider");return e}function HI({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!==et&&l.modelKey!==Ut&&(l.modelKey!==sI||!hI(l))){if("amount"===l.modelKey){null===i&&(i=t.length);const e=l.value.amount?.value;if(sr(n)&&cr(e?.greaterThanEqual)){n=s,a=e.greaterThanEqual;continue}if(sr(r)&&cr(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=vo(sh(n),{dollarSign:!0,signage:"default"}),i=vo(sh(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=>I(hb,{text:e.text,additionalValidClassName:lr["filter-pill"],onClickRemove:()=>{e.indicesToRemove.forEach(e=>t(e))}},e.key))}const WI=vi(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"),zI=tr({width:"17px",height:"17px",borderRadius:"sm"});function _I({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:zI}),I("img",{src:e,alt:t.displayName,width:17,height:17,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["medium-icon"],lr.icon),...n??[]],size:17})}const jI=tr({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"}),qI={expenseDashboard:"ExpensesFilterList",incomeDashboard:"RevenueFilterList",transactionsDashboard:"TransactionsFilterList"};function KI(){const e=wT(),{dashboardKey:t}=BI();return I(Xs,{onClick:()=>{rs(qI[t],{routeProps:{}})},stylists:[gr(null,jI)],children:e?I(_I,{Component:WI}):R(N,{children:[I(cl,{Component:WI}),I(sc,{children:"Filters"})]})})}const YI=S.object({beginDate:S.string().nullable(),endDate:S.string().nullable()}).refine(e=>{if(e.beginDate&&e.endDate){const t=Nt(e.beginDate),n=Nt(e.endDate);if(t&&n)return!Et(t,n)}return!0},{message:"End date must be on or after start date",path:["dateRange"]}),ZI=tr({display:"flex",flexDirection:"column",padding:"16px",gap:"16px"}),GI=tr({display:"flex",flexDirection:"row",gap:"16px",alignItems:"center"}),QI=gr(null,tr({marginTop:"22px"}));function XI({onDateRangeChange:e,initialBeginDate:t,initialEndDate:n}){const r=(i=e,vb({defaultValues:{beginDate:t||null,endDate:n||null},validators:{onChange:YI},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:ZI,children:[R("div",{className:GI,children:[I(r.AppField,{name:"beginDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"Start Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})}),I(Td,{Component:mT,stylists:[QI]}),I(r.AppField,{name:"endDate",listeners:{onChange:()=>r.handleSubmit()},children:e=>I(e.DateInput,{label:"End Date",editable:!0,hasErrorStyles:o,maxDate:/* @__PURE__ */new Date})})]}),o&&I(dp,{errorMessage:Object.values(a)[0].dateRange[0].message})]})}const JI={width:"fit-content"};function $I({onDateRangeChange:e}){const{filters:t}=BI(),{initialBeginDate:n,initialEndDate:r}=(e=>{const t=e.find(e=>e.modelKey===Ut);if(void 0!==t){const e=t.value.date?.value;if(gt(e)&&"Custom"===t.name)return{initialBeginDate:e.beginDate,initialEndDate:e.endDate}}return{initialBeginDate:void 0,initialEndDate:void 0}})(t);return I(QC,{triggerChildren:I($C,{displayLabel:"Custom"}),popupChildren:I(Fc,{style:JI,children:I(XI,{onDateRangeChange:e,initialBeginDate:n,initialEndDate:r})})})}const eN=tr({width:200,minWidth:200});function tN({dateFilter:e,addFilter:t}){return I(Wm,{onClick:()=>t(e),children:I(To,{children:ht[e]})})}function nN({getModel:e,addFilters:t}){const{setOpen:n}=kc(),r=r=>{const a=e(Ut);if(void 0===a)return;const o=a.createFilter({name:ht[r],value:{[a.key]:{name:ht[r],value:r}}});t([o]),n(!1)};return I(Fc,{children:R(Lm,{style:eN,children:[I(tN,{dateFilter:ut.ALL_TIME,addFilter:r}),I(ip,{alignment:"horizontal"}),I(tN,{dateFilter:ut.THIS_MONTH,addFilter:r}),I(tN,{dateFilter:ut.LAST_MONTH,addFilter:r}),I(tN,{dateFilter:ut.LAST_3_MONTHS,addFilter:r}),I(tN,{dateFilter:ut.LAST_12_MONTHS,addFilter:r}),I(ip,{alignment:"horizontal"}),I(tN,{dateFilter:ut.THIS_QUARTER,addFilter:r}),I(tN,{dateFilter:ut.LAST_QUARTER,addFilter:r}),I(ip,{alignment:"horizontal"}),I(tN,{dateFilter:ut.THIS_YEAR,addFilter:r}),I(tN,{dateFilter:ut.LAST_YEAR,addFilter:r}),I(ip,{alignment:"horizontal"}),I($I,{onDateRangeChange:n=>{const r=e(Ut);if(void 0===r)return;const a=r.createFilter({name:"Custom",value:{[r.key]:{name:"Custom",value:n}}});t([a])}})]})})}const rN=[gr(null,jI)];function aN({filters:e,getModel:t,addFilters:n}){const r=(e=>{const t=e.find(e=>e.modelKey===Ut);let n=ht[ut.LAST_12_MONTHS];if(void 0!==t){const e=t.value.date?.value;n=pt(e)?ht[e]:gt(e)&&"Custom"===t.value.date?.name?function(e){const t=e.beginDate?Nt(e.beginDate):null,n=e.endDate?Nt(e.endDate):null;return t&&!n?`After ${Ft(t)}`:!t&&n?`Before ${Ft(n)}`:t&&n?`${At(t)} - ${At(n)}`:"Custom"}(e):t.name}return n})(e);return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Xs,{stylists:rN,popupTriggerProps:e,children:I(sc,{children:r})})}),I(nN,{getModel:t,addFilters:n})]})}const oN=tr({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"inherit"}),iN=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"inherit"});function lN({children:e,onClick:t,Icon:n,closeOnClick:r=!1,popupTriggerProps:a,expandable:o=!1}){const i=kc();return I(Wm,{onClick:()=>{r&&i.close(),t?.()},popupTriggerProps:a,children:R("div",{className:oN,children:[R("span",{className:iN,children:[n&&I(Sd,{Component:n}),I(To,{children:e})]}),o&&I(Sd,{Component:rl})]})})}const sN=[{label:fw[mw.EXPENSE],type:mw.EXPENSE},{label:fw[mw.REVENUE],type:mw.REVENUE},{label:fw.BANK_TRANSFER,type:"TRANSFER_IN"},{label:fw.BANK_TRANSFER,type:"TRANSFER_OUT"}],cN=gr(null,jI);function dN({manualTransactionOptions:e}){const t=sN.filter(t=>e.includes(t.type)),n=wT();return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Xs,{stylists:[cN],popupTriggerProps:e,children:n?I(_I,{Component:Os}):R(N,{children:[I(cl,{Component:Os}),I(sc,{children:"Add Transaction"})]})})}),I(Fc,{children:I(Lm,{children:t.map(({label:e,type:t})=>I(lN,{closeOnClick:!0,onClick:()=>us(null,{initialType:t}),children:e},t))})})]})}const uN=vi(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"),hN=tr.raw({display:"flex",padding:{base:"26px",xl:"16px"},gap:"8px",height:"35px"});function pN(){return I(Xs,{styles:hN,onClick:()=>rs("TransactionSettingsDrawer"),children:I(Sd,{Component:uN})})}const mN=tr.raw({flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",gap:"12px",width:"100%",display:"flex"});function gN({children:e,styles:t}){return I("div",{className:tr(mN,t),children:e})}const vN=gr(lr["dashboard-header"],tr({display:"flex",flexDirection:"column",alignItems:"flex-start",paddingBottom:"20px",paddingTop:"8px",gap:"20px"})),fN=gr(null,tr({display:"flex",alignItems:"center",gap:"8px",padding:"15px 15px 0 15px",width:"100%",xl:{gap:"12px"}})),bN=tr.raw({paddingLeft:"15px",paddingRight:"15px"}),yN=tr({display:"none",xl:{display:"flex"}});function wN({isFetching:e,manualTransactionOptions:t}){const{filters:n,removeFilter:r,getModel:a,addFilters:i}=BI(),l=wT(),s=o(()=>sr(n)?"":n.find(e=>e.modelKey===et)?.value.search?.value??"",[n]);return R("div",{...vN,children:[R("div",{...fN,children:[I(UT,{isFetching:e,searchTerm:s,onChange:e=>{const t=a(et);if(void 0===t)return;const n=t.createFilter({name:"Search",value:{search:{name:e,value:e}}});i([n])},placeholder:qT(l)}),I(KI,{}),I(dN,{manualTransactionOptions:t}),!l&&I(aN,{filters:n,getModel:a,addFilters:i}),I(pN,{}),I("div",{className:yN,children:I(ml,{})})]}),n.length>0&&I(gN,{styles:bN,children:I(HI,{filters:n,removeFilter:r})})]})}const CN=pn.filter(e=>e!==hn.COMMENTS&&e!==hn.DIMENSION_VALUE),xN=gr(null,tr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}));function TN(){return I("div",{...xN,children:I(ml,{})})}const kN=tr.raw({gap:"6px"});function EN({Icon:e,label:t,children:n,onClick:r}){return n?R(Tc,{placement:"bottom-start",children:[I(Ec,{children:n=>R(zc,{popupTriggerProps:n,extraClassNames:[kN],children:[e&&I(cl,{Component:e}),I(sc,{children:t})]})}),n]}):R(zc,{onClick:r,extraClassNames:[kN],children:[e&&I(cl,{Component:e}),I(sc,{children:t})]})}const AN=vi(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"),SN=gr(null,tr({whiteSpace:"normal"}));function IN({transactions:e,id:t,label:n,resetSelected:r}){const{mutateAsync:a}=cC({mutationFn:aC,meta:{toastOptions:{defaultErrorMessage:"Couldn't update review statuses"}}}),o=kc();return Zi(t)?I(Wm,{onClick:()=>(async t=>{if(o.close(),e.length>0){const r=(n=t,e.map(e=>({id:e.id,reviewStatus:n})));await a(r)}var n;r&&r()})(t),children:I(Eg,{stylists:[SN],children:n})}):null}const NN={ACTIVE:"ACTIVE",INACTIVE:"INACTIVE",REMOVED:"REMOVED"},RN=e=>e.map(e=>({id:e.id,status:NN.INACTIVE})),PN=vi(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"),DN=[{id:"delete",label:"Delete",Icon:AN,component:function({transactions:e,resetSelected:t,...n}){const{mutateAsync:r}=cC({mutationFn:aC,meta:{toastOptions:{defaultSuccessMessage:(e,t)=>1===t.length?"Transaction deleted":`${t.length} transactions deleted`,defaultErrorMessage:e=>1===e.length?"Couldn't delete transaction":"Couldn't delete transactions",defaultPartialMessage:"Some transactions couldn't be deleted"}}}),a=async()=>{const n=RN(e);await r(n),t&&t()};return I(EN,{...n,onClick:()=>{return t=e.length,n=a,void(t>0&&ih({title:"Delete transactions",body:`Are you sure you want to delete ${t} transactions?`,buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Delete",type:oh.DANGER}]}).then(e=>{e===ju&&n()}));var t,n}})}},{id:"recategorize-expenses",label:"Recategorize",Icon:PN,filter:e=>"EXPENSE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=uC(),o=e.length;return o>0&&I(EN,{label:`${t} ${lh("Expense","Expenses",o,!0)}`,...r,children:I(Mx,{onClick:async function(t){var r,o;t?.id&&(await a((r=e,o=t.id.toString(),r.map(e=>({id:e.id,categoryId:o})))),n&&n())}})})}},{id:"recategorize-revenues",label:"Recategorize",Icon:PN,filter:e=>"REVENUE"===e.type,component:function({transactions:e,label:t,resetSelected:n,...r}){const{mutateAsync:a}=uC(),o=e.length;return I(EN,{label:`${t} ${lh("Revenue","Revenues",o,!0)}`,...r,children:I(rx,{onClick:async function(t){var r,o;await a((r=e,o=t.id,r.map(e=>({id:e.id,glAccountId:o})))),n&&n()},types:EC,placeholder:"Search revenue accounts..."})})}}];function MN({subActionList:e}){return I(Lm,{children:e})}function LN({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?I(n,{id:r,transactions:l,label:i,resetSelected:a},r):null}).filter(e=>null!==e),[e,t,a]);return I(EN,{label:n,Icon:r,children:I(Fc,{children:i.length>0?I(MN,{subActionList:i}):I(Wm,{children:I(sc,{children:"No Actions Available for Selection"})},"no-actions")})})}const FN=gr(lr["bulk-select"],tr({display:"flex",alignItems:"center",gap:"16px",padding:"4px 0"}));function ON({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=_i();return o(()=>[...DN,{id:"review",label:"Change Review Status",Icon:wi,subActions:e.map(({status:e,displayName:t})=>({id:e,label:t,component:IN}))}],[e])})(),s=()=>e.resetRowSelection(!0);return R("div",{...FN,children:[I(gT,{table:e}),I(To,{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?I(LN,{subActions:o,transactions:a,resetSelected:s,...c},i):t&&I(t,{transactions:d,resetSelected:s,...c},i)})]})}function VN({transactions:e,columns:t,filterState:n,hasLinkedBankAccount:r,zeroStateEventName:o}){const i=wT(),l=function({transactions:e,columns:t}){const n=wT(),r=xT({transactions:e,columns:t?[hn.SELECT,...t,hn.EXPAND]:void 0});return function(e,t,n=!0){const r=n&&!sr(t.getColumn(un.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:s}=BI(),c=l.getIsAllRowsSelected(),d=l.getIsSomeRowsSelected(),u=c||d;let h;r||0!==e?.length?"FILTERS_MATCHED_NONE"===n?h=I(XT,{buttonText:"Clear Filters",onButtonClick:()=>s([])}):r&&0===e?.length&&(h=I(RT,{})):h=I(IT,{eventSource:o});const p=u&&sr(h)&&!i;return R(nc,{dashboard:"transactionDashboard",children:[p?I(ON,{table:l}):I(Hl,{headerGroups:l.getHeaderGroups()}),sr(h)?I(jT,{table:l}):I(Cd,{children:h})]})}const UN={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"}},BN=(e={})=>{const t=Kn(UN,e);return UN.transform(t,qn)},HN=e=>tr(BN(e));HN.raw=BN;const WN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"column",...r}},defaultValues:{gap:"8px"}},zN=(e={})=>{const t=Kn(WN,e);return WN.transform(t,qn)},_N=e=>tr(zN(e));_N.raw=zN;const jN={transform(e){const{justify:t,gap:n,...r}=e;return{display:"flex",alignItems:"center",justifyContent:t,gap:n,flexDirection:"row",...r}},defaultValues:{gap:"8px"}},qN=(e={})=>{const t=Kn(jN,e);return jN.transform(t,qn)},KN=e=>tr(qN(e));KN.raw=qN;const YN={transform(e){const{name:t,type:n,...r}=e;return{containerType:n,containerName:t,...r}},defaultValues:{type:"inline-size"}},ZN=(e={})=>{const t=Kn(YN,e);return YN.transform(t,qn)},GN=e=>tr(ZN(e));GN.raw=ZN;const QN=tr({display:"flex",padding:"16px 12px",borderWidth:"md",borderStyle:"solid",borderRadius:"lg",borderColor:"border.layout",backgroundColor:"surface.foreground"}),XN=gr(lr.card,QN,tr({padding:"16px 12px",flexDirection:"column",alignItems:"flex-start",gap:"16px",flex:"1 0 0"}));function JN({children:e}){return I("div",{...XN,children:e})}const $N=gr(lr["card-header"],tr({display:"flex",alignItems:"center",gap:"10px",alignSelf:"stretch"}));function eR({children:e}){return I("div",{...$N,children:e})}const tR=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"12px",alignSelf:"stretch"});function nR({children:e}){return I("div",{className:tR,children:e})}const rR=or({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 aR({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}=BI();if(!d(t))return null;const h="active"===r,p=gr(lr["card-button"],rR({filterStatus:r}),a);return I("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 oR=or({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"}}),iR=tr({minWidth:"200px"}),lR=tr({marginLeft:"auto"});function sR({labeledReviewStatus:e,isZeroState:t}){const{apiFilters:{reviewStatus:n,...r}}=BI(),{data:a}=function(e){const{query:{data:t},isFilling:n,isRehydrating:r}=function({groupBy:e,filter:t}){return Vr({queryKey:tC({groupBy:e,filter:t}),queryFn:nC})}({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)||!Zi(r))&&(t?.in?.includes(r)??!1);var t,r})?"active":"inactive";t&&(o="zeroState");const i="active"===o,l=(c=e,d=t,gr(lr["card-button-icon-container"],oR({intent:d?"neutral":c.variant}))),s=String(((e,t)=>{let n=0;return e?.forEach(e=>{e.value&&Zi(e.value)&&t.value.includes(e.value)&&(n+=e.count??0)})??n})(a,e));var c,d;return R(aR,{filterApiNames:e.value,filterModelKey:"reviewStatus",extractFilterValue:e=>e.reviewStatus?.value.in,filterStatus:o,buttonClassName:iR,isZeroState:t,filterEffectiveValueExtractor:US,children:[I("div",{...l,children:I(Sd,{Component:e.Icon})}),!t&&i&&R(N,{children:[I(To,{children:e.text}),I("div",{className:lR,children:I(Iu,{children:s})})]}),!t&&!i&&R(N,{children:[I(sc,{children:e.text}),I("div",{className:tr({marginLeft:"auto"}),children:I(Iu,{children:s})})]}),t&&R(N,{children:[I(sc,{intent:"weak",children:e.text}),I("div",{className:tr({marginLeft:"auto"}),children:I(Iu,{children:s})})]})]},e.text)}function cR({isZeroState:e}){const t=function(){const e=Ki();return(e?Bi:Hi).map(t=>ji(t,e))}();return R(JN,{children:[I(eR,{children:I(sc,{intent:"weak",children:"Review Status"})}),I(nR,{children:t.map(t=>I(sR,{labeledReviewStatus:t,isZeroState:e},t.text))})]})}const dR=tr({width:"20px",height:"20px",borderRadius:"sm"});function uR({imageUrl:e,Component:t,stylists:n}){const[r,a]=d(!1);return cr(e)?R(N,{children:[!r&&I(Xo,{styles:dR}),I("img",{src:e,alt:t.displayName,width:20,height:20,onLoad:()=>a(!0),style:r?void 0:{display:"none"}})]}):I(t,{stylists:[gr(lr["medium-icon"],lr.icon),...n??[]],size:20})}const hR=tr({minWidth:"269px"}),pR=tr({marginLeft:"auto"});function mR({account:e,isZeroState:t}){const{apiFilters:n}=BI(),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=Ir(e.mask)?void 0:dh(e.mask),c=vo(null!=(d=e.accountBalance)?sh(d):0,{dollarSign:!0});var d;return R(aR,{filterApiNames:[e.id],filterModelKey:"bankAccount",extractFilterValue:e=>e.bankAccount?.value.id?.in,filterStatus:r,buttonClassName:hR,isZeroState:t,filterEffectiveValueExtractor:JS,children:[e.iconUrl&&I(uR,{imageUrl:e.iconUrl,Component:gg}),!t&&a&&R(N,{children:[I(To,{children:o}),s&&I(sc,{wrap:"wrap",children:s}),I("div",{className:pR,children:I(Iu,{children:c})})]}),!t&&!a&&R(N,{children:[I(sc,{children:o}),s&&I(sc,{wrap:"wrap",children:s}),I("div",{className:pR,children:I(Iu,{children:c})})]}),t&&R(N,{children:[I(sc,{intent:"weak",children:o}),s&&I(sc,{intent:"weak",wrap:"wrap",children:s}),I("div",{className:pR,children:I(Iu,{children:c})})]})]},e.id)}const gR=[{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 vR({isZeroState:e}){const{query:{data:t}}=bh({params:{filter:{apiName:{in:[...eg]}}}}),n=(r=t?.data??[],e?gR: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(JN,{children:[I(eR,{children:I(sc,{intent:"weak",children:"Account Balances"})}),I(nR,{children:n.map((t,n)=>I(mR,{account:t,isZeroState:e},n))})]})}const fR=tr({minHeight:"250px",maxHeight:"320px",gridColumn:{"@page/md":"span 2","@page/xl":"unset"}}),bR=tr({display:{"@page/xl":"flex",base:"none"}}),yR=tr({display:{"@page/xl":"none",base:"flex"}}),wR=tr({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 CR({showZeroStates:e,Chart:t}){return R("div",{className:wR,children:[I("div",{className:bR,children:I(cR,{isZeroState:e})}),I("div",{className:bR,children:I(vR,{isZeroState:e})}),I("div",{className:fR,children:I(t,{})}),I("div",{className:yR,children:I(cR,{isZeroState:e})}),I("div",{className:yR,children:I(vR,{isZeroState:e})})]})}const xR=tr({display:"flex",flexDirection:"column",width:"100%",height:"100%",maxWidth:"1440px",gap:"16px"}),TR=GN({name:"page",containerType:"inline-size",display:"flex",justifyContent:"center"}),kR=tr({border:"{borderWidths.md} solid {colors.border.layout}",borderRadius:"lg",overflow:"hidden",background:"surface.foreground",marginTop:"16px"}),ER=tr({paddingTop:"8px"}),AR=tr({borderTop:{xl:"{borderWidths.md} solid {colors.border.layout}",base:"none"}}),SR=tr({display:"flex",flexDirection:"column",gap:"10px"});function IR({columns:e=CN,transactions:t,isFetching:n,isFilling:r,isError:a,error:o,hasTransactions:i,Chart:l,manualTransactionOptions:s,showTasks:c=!1,zeroStateEventName:d}){const{filters:u}=BI(),{hasPlaidLinkedBankAccount:h}=ng(),p=h??!1,m=wT();if(a)return I("div",{children:`Error: ${o?.message}`});if(r)return I(wl,{});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===u.length&&cr(u[0].value?.date)?0:u.length,t.length);return I("div",{className:TR,children:R("div",{className:xR,children:[m&&c&&I("div",{className:SR,children:I(Hk,{})}),I(CR,{Chart:l,showZeroStates:!i}),R("div",{className:kR,children:[I("div",{className:ER,children:I(wN,{isFetching:n,manualTransactionOptions:s})}),I("div",{className:AR,children:I(VN,{hasLinkedBankAccount:p,filterState:r,transactions:t,columns:e,zeroStateEventName:d})})]}),I(TN,{})]})})}return"zero state"}const NR=tr({flexGrow:1,minWidth:0,minHeight:"100%",flexDirection:"column"}),RR=gr(lr.card,QN,NR);function PR({children:e}){return I("div",{...RR,children:e})}const DR=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"20px"});function MR({children:e}){return I("div",{className:DR,children:e})}const LR=gr(lr["card-header"],tr({display:"flex",flexDirection:"column",gap:"8px",minWidth:0}));function FR({children:e}){return I("div",{...LR,children:e})}const OR=tr({minWidth:"300px"});function VR({options:e,handleClick:t,selectedIndex:n}){return I("div",{className:OR,children:I(Df,{options:e,handleClick:t,selectedIndex:n})})}function UR(e){return"QUARTERLY"===e?function(){const e=/* @__PURE__ */new Date,t=dt(e);return{beginDate:ct(rt(e.getFullYear(),e.getMonth()-9,e.getDate())),endDate:t}}():"YEARLY"===e?{beginDate:nt(rt(/* @__PURE__ */(new Date).getFullYear()-4,0,1)),endDate:ot()}:"LAST_12_MONTHS"}const BR=No.var("colors.border.layout"),HR=gr(lr["profit-loss-graph"],tr({"& .recharts-surface":{outline:"none"}})),WR=No.var("colors.money.positive.weak"),zR=No.var("colors.money.positive"),_R=No.var("colors.money.negative.weak"),jR=No.var("colors.money.negative"),qR=No.var("colors.surface.intent.action"),KR=No.var("colors.surface.intent.action.active"),YR=[{label:"Months",value:"MONTHLY"},{label:"Quarters",value:"QUARTERLY"},{label:"Years",value:"YEARLY"}],ZR=()=>{const[e,t]=d(0);return{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:function(e){const{query:{data:t}}=Ba({accountingMethod:"CASH",filter:UR(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=Nt(e??"");return{longLabel:t?Mt(t,{abbreviateMonth:!1,abbreviateYear:!1}):"",label:Wa(e)}}(e):"QUARTERLY"===t?function(e){const t=at(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=at(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??[]}(YR[e].value)}};function GR({selectedIndex:e,onSelect:t}){return I(VR,{options:YR,handleClick:t,selectedIndex:e})}const QR={top:20,right:20,left:20,bottom:5},XR={fill:No.var("colors.typography.base"),fontSize:No.var("fontSizes.metric.sm")};function JR({data:e,children:t,tooltip:n}){return I(W,{width:"100%",height:"100%",...HR,style:{flexGrow:1},children:R(z,{data:e,accessibilityLayer:!0,barCategoryGap:"20%",margin:QR,children:[I(q,{dataKey:"label",interval:0,tickLine:!1,stroke:BR,tick:XR}),I(Y,{content:({active:e,payload:t})=>n({active:e,payload:t}),isAnimationActive:!1,cursor:{fill:"transparent"}}),t]})})}const $R=tr({display:"flex",flexDirection:"row",gap:"8px",justifyContent:"flex-end"});function eP(){return R("div",{className:$R,children:[I(Mo,{color:WR,label:"Income",diameter:10}),I(Mo,{color:_R,label:"Expense",diameter:10})]})}const tP=gr(null,tr({display:"flex",flexDirection:"column",border:"1px solid {colors.border.layout}",borderRadius:"sm",backgroundColor:"surface.background",boxShadow:"box-shadow",padding:"12px",gap:"8px",minWidth:"180px"})),nP=gr(null,tr({width:"100%",height:"1px",backgroundColor:"border.layout"})),rP=gr(null,tr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"20px"})),aP=No.var("colors.money.positive"),oP=No.var("colors.money.negative");function iP({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",{...tP,children:[I(To,{children:a}),I("div",{...nP}),R("div",{...rP,children:[I(Mo,{color:aP,label:"Income",diameter:12}),I(Iu,{children:fo(Number(o))})]}),R("div",{...rP,children:[I(Mo,{color:oP,label:"Expense",diameter:12}),I(Iu,{children:fo(Number(i))})]})]})}function lP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=ZR(),r=n.reduce((e,t)=>e+t.income-t.expense,0);return R(PR,{children:[R(MR,{children:[R(FR,{children:[I(sc,{intent:"weak",children:"All Transactions"}),I(co,{title:fo(r),label:void 0})]}),R(FR,{children:[I(GR,{selectedIndex:e,onSelect:t}),I(eP,{})]})]}),R(JR,{data:n,tooltip:({active:e,payload:t})=>I(iP,{active:e,payload:t}),children:[I(Z,{name:"Income",dataKey:"income",minPointSize:2,fill:WR,isAnimationActive:!1,activeBar:{fill:zR}}),I(Z,{name:"Expense",dataKey:"expense",minPointSize:2,fill:_R,isAnimationActive:!1,activeBar:{fill:jR}})]})]})}const sP=tr({display:"flex",flexDirection:"column",gap:{base:0,sm:"16px"}});function cP({columns:e,limit:t=100}){const n=OI(),{userRole:r}=i(Qc),{sortInstance:a,setSortInstance:o,apiSort:l}=aw(),s=Bk(),{isFilling:c,paginationControls:d,query:{data:u,isError:h,error:p,isFetching:m}}=ws({limit:t,sort:l,filter:{...n.apiFilters}}),g=u?.data,v=ks();return VI("transactionsDashboard",r,g?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,c,v),R("div",{className:sP,children:[s&&I(Fk,{}),I(UI.Provider,{value:n,children:I(sl.Provider,{value:d,children:I(rc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(IR,{columns:e,transactions:g,isFetching:m,isFilling:c,isError:h,error:p??null,hasTransactions:v,Chart:lP,manualTransactionOptions:[mw.EXPENSE,mw.REVENUE,"TRANSFER_IN"],zeroStateEventName:"TransactionsDashboardZeroState"})})})})]})}const dP=e=>I(Kk,{children:I(Yk,{source:"TransactionsDashboard",children:I(cP,{...e})})}),uP={in:["EXPENSE","TRANSFER_OUT"]},hP=[{name:"Expense",types:vw.Expense},{name:"Transfer",types:[{name:"Bank Transfer Out",value:mw.TRANSFER_OUT}]}];function pP(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=EI("expenseDashboard"),{getCategories:i,getBankAccounts:l,getVendors:s,getCustomers:c,getGlAccounts:d,getReviewStatuses:h}=AI(),p=o(()=>({reviewStatus:OS(h),amount:GS(),bankAccount:XS(l),category:LS(i),customer:rS(c),date:Ht,description:DI(),glAccount:xI(d),notes:LI(),status:pI(),vendor:nI(s),type:rI(hP),search:tt}),[l,i,s,c,d,h]),m=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]),g=/* @__PURE__ */(new Date).getDate(),v=o(()=>kI(e,uP),[e,g]),f=u(e=>p[e],[p]);return{dashboardKey:"expenseDashboard",filters:e,filterPopupModels:m,setFilters:t,addFilters:n,removeFilter:r,apiFilters:v,getModel:f,hasUserConfiguredFilters:a}}const mP=gr(lr.text,tr({fontSize:"sm",fontWeight:"md",color:"typography.base",fontStyle:"normal",maxWidth:"100%"}),Xa);function gP({children:e}){return I("div",{...mP,children:e})}const vP=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"12px",backgroundColor:"surface.foreground",borderRadius:"sm",boxShadow:"box-shadow",padding:"12px",width:"fit-content",whiteSpace:"nowrap"});function fP({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:vP,children:[I(gy,{children:n}),I(gP,{children:yo(r)})]})}const bP=tr({width:"160px",height:"32px"}),yP=tr({width:"54px",height:"32px"}),wP=({y:e,payload:t})=>I("foreignObject",{x:0,y:e-10,className:bP,children:I(sc,{children:String(t.value)})}),CP=({x:e,y:t,payload:n})=>{return I("foreignObject",{x:e,y:t-10,className:yP,children:I(sc,{alignment:"right",children:(r=n.value,vo(r,{cents:"round",condense:!0,dollarSign:!0}))})});var r},xP=({active:e,payload:t})=>I(fP,{active:e,payload:t});function TP({data:e}){return I(W,{width:"100%",height:44*(e?.length??0)+12,...HR,children:R(z,{layout:"vertical",data:e,barCategoryGap:12,margin:{top:12,right:0,left:0,bottom:0},accessibilityLayer:!0,children:[I(q,{type:"number",hide:!0,domain:[0,"dataMax"]}),I(K,{type:"category",dataKey:"name",tickLine:!1,axisLine:!1,tick:wP,width:172}),I(K,{yAxisId:"right",orientation:"right",type:"category",dataKey:"total",tickLine:!1,axisLine:!1,tick:CP,width:66}),I(Y,{content:xP,isAnimationActive:!1,cursor:{fill:"transparent"}}),I(Z,{dataKey:"total",minPointSize:2,fill:qR,isAnimationActive:!1,activeBar:{fill:KR},barSize:32})]})})}const kP=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):[]},EP=[{label:"1M",value:1},{label:"3M",value:3},{label:"12M",value:12}];function AP(){const[e,t]=d(1),n=(e=>{const t=/* @__PURE__ */new Date,n=new Date(t);return n.setMonth(n.getMonth()-e),{beginDate:Rt(n),endDate:Rt(t)}})(EP[e].value),{query:{data:r}}=Ba({filter:n,select:kP}),a=n?`${At(Nt(n.beginDate))} - ${At(Nt(n.endDate))}`:"";return R(PR,{children:[R(MR,{children:[R(FR,{children:[I(sc,{intent:"weak",wrap:"ellipsis",children:"Top Expense Categories"}),a&&I(sc,{intent:"weak",wrap:"ellipsis",children:a})]}),I(VR,{options:EP,handleClick:e=>t(e),selectedIndex:e})]}),I(TP,{data:r})]})}function SP({columns:e,limit:t=100}){const n=pP(),{userRole:r}=i(Qc),{sortInstance:a,setSortInstance:o,apiSort:l}=aw(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ws({limit:t,sort:l,filter:{...n.apiFilters}}),m=d?.data,g=ks();return VI("expenseDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,g),I(UI.Provider,{value:n,children:I(sl.Provider,{value:c,children:I(rc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(IR,{columns:e,transactions:m,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:g,Chart:AP,manualTransactionOptions:[mw.EXPENSE,"TRANSFER_OUT"],showTasks:!0,zeroStateEventName:"ExpenseDashboardZeroState"})})})})}const IP=e=>I(Kk,{children:I(Yk,{source:"ExpenseDashboard",children:I(SP,{...e})})}),NP={in:["REVENUE","TRANSFER_IN"]},RP=[{name:pw,types:vw.Income},{name:"Transfer",types:[{name:"Bank Transfer In",value:mw.TRANSFER_IN}]}];function PP(){const{filters:e,setFilters:t,addFilters:n,removeFilter:r,hasUserConfiguredFilters:a}=EI("incomeDashboard"),{getCategories:i,getBankAccounts:l,getCustomers:s,getGlAccounts:c,getReviewStatuses:d}=AI(),h=o(()=>({reviewStatus:OS(d),amount:GS(),bankAccount:XS(l),category:LS(i),customer:rS(s),date:Ht,description:DI(),glAccount:xI(c),notes:LI(),status:pI(),type:rI(RP),search:tt}),[l,i,s,c,d]),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]),m=/* @__PURE__ */(new Date).getDate(),g=o(()=>kI(e,NP),[e,m]),v=u(e=>h[e],[h]);return{dashboardKey:"incomeDashboard",filters:e,filterPopupModels:p,setFilters:t,addFilters:n,removeFilter:r,apiFilters:g,getModel:v,hasUserConfiguredFilters:a}}function DP(){const{selectedPeriodIndex:e,setSelectedPeriodIndex:t,data:n}=ZR(),r=n.reduce((e,t)=>e+t.income,0);return R(PR,{children:[R(MR,{children:[R(FR,{children:[I(sc,{intent:"weak",children:"Total Income"}),I(co,{title:fo(r),label:void 0})]}),I(FR,{children:I(GR,{selectedIndex:e,onSelect:t})})]}),I(JR,{data:n,tooltip:({active:e,payload:t})=>I(fP,{active:e,payload:t}),children:I(Z,{name:"Revenue",dataKey:"income",minPointSize:2,fill:qR,isAnimationActive:!1,activeBar:{fill:KR}})})]})}function MP({columns:e,limit:t=100}){const n=PP(),{userRole:r}=i(Qc),{sortInstance:a,setSortInstance:o,apiSort:l}=aw(),{isFilling:s,paginationControls:c,query:{data:d,isError:u,error:h,isFetching:p}}=ws({limit:t,sort:l,filter:{...n.apiFilters}}),m=d?.data,g=ks();return VI("incomeDashboard",r,m?.some(e=>"RECONCILED"!==e.reviewStatus)??!1,s,g),I(UI.Provider,{value:n,children:I(sl.Provider,{value:c,children:I(rc.Provider,{value:{sortInstance:a,setSortInstance:o},children:I(IR,{columns:e,transactions:m,isFetching:p,isFilling:s,isError:u,error:h??null,hasTransactions:g,Chart:DP,manualTransactionOptions:[mw.REVENUE,"TRANSFER_IN"],showTasks:!0,zeroStateEventName:"IncomeDashboardZeroState"})})})})}const LP=e=>I(Kk,{children:I(Yk,{source:"IncomeDashboard",children:I(MP,{...e})})});var FP=(e=>(e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e))(FP||{});function OP(e){return"object"==typeof e&&null!=e&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function VP(e={}){const{initialEntries:t=["/"],initialIndex:n,v5Compat:r=!1}=e;let a;a=t.map((e,t)=>d(e,"string"==typeof e?null:e.state,0===t?"default":void 0,"string"==typeof e?void 0:e.mask));let o=s(null==n?a.length-1:n),i="POP",l=null;function s(e){return Math.min(Math.max(e,0),a.length-1)}function c(){return a[o]}function d(e,t=null,n,r){const o=HP(a?c().pathname:"/",e,t,n,r);return BP("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function u(e){return"string"==typeof e?e:WP(e)}return{get index(){return o},get action(){return i},get location(){return c()},createHref:u,createURL:e=>new URL(u(e),"http://localhost"),encodeLocation(e){const t="string"==typeof e?zP(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,t){i="PUSH";const n=OP(e)?e:d(e,t);o+=1,a.splice(o,a.length,n),r&&l&&l({action:i,location:n,delta:1})},replace(e,t){i="REPLACE";const n=OP(e)?e:d(e,t);a[o]=n,r&&l&&l({action:i,location:n,delta:0})},go(e){i="POP";const t=s(o+e),n=a[t];o=t,l&&l({action:i,location:n,delta:e})},listen:e=>(l=e,()=>{l=null})}}function UP(e,t){if(!1===e||null==e)throw new Error(t)}function BP(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function HP(e,t,n=null,r,a){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?zP(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10),mask:a}}function WP({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function zP(e){const t={};if(e){const n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));const r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}var _P=(e=>(e.data="data",e.redirect="redirect",e.error="error",e))(_P||{});class jP{#e=/* @__PURE__ */new Map;constructor(e){if(e)for(const[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(void 0!==e.defaultValue)return e.defaultValue;throw new Error("No value found for context")}set(e,t){this.#e.set(e,t)}}const qP=/* @__PURE__ */new Set(["lazy","caseSensitive","path","id","index","children"]),KP=/* @__PURE__ */new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function YP(e){return KP.has(e)}function ZP(e,t,n=[],r={},a=!1){return e.map((e,o)=>{const i=[...n,String(o)],l="string"==typeof e.id?e.id:i.join("-");if(UP(!0!==e.index||!e.children,"Cannot specify children on an index route"),UP(a||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),!0===e.index){const n={...e,id:l};return r[l]=GP(n,t(n)),n}{const n={...e,id:l,children:void 0};return r[l]=GP(n,t(n)),e.children&&(n.children=ZP(e.children,t,i,r,a)),n}})}function GP(e,t){return Object.assign(e,{...t,..."object"==typeof t.lazy&&null!=t.lazy?{lazy:{...e.lazy,...t.lazy}}:{}})}function QP(e,t,n,r,a){const o=uD(("string"==typeof t?zP(t):t).pathname||"/",n);if(null==o)return null;const i=a??JP(e);let l=null;const s=function(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return BP(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}(o);for(let c=0;null==l&&c<i.length;++c)l=cD(i[c],s,r);return l}function XP(e,t){const{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function JP(e){const t=$P(e);return t.sort((e,t)=>{return e.score!==t.score?t.score-e.score:(n=e.routesMeta.map(e=>e.childrenIndex),r=t.routesMeta.map(e=>e.childrenIndex),n.length===r.length&&n.slice(0,-1).every((e,t)=>e===r[t])?n[n.length-1]-r[r.length-1]:0);var n,r}),t}function $P(e,t=[],n=[],r="",a=!1){const o=(e,o,i=a,l)=>{const s={relativePath:void 0===l?e.path||"":l,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};if(s.relativePath.startsWith("/")){if(!s.relativePath.startsWith(r)&&i)return;UP(s.relativePath.startsWith(r),`Absolute route path "${s.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),s.relativePath=s.relativePath.slice(r.length)}const c=wD([r,s.relativePath]),d=n.concat(s);e.children&&e.children.length>0&&(UP(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),$P(e.children,t,d,c,i)),(null!=e.path||e.index)&&t.push({path:c,score:sD(c,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(const n of eD(e.path))o(e,t,!0,n);else o(e,t)}),t}function eD(e){const t=e.split("/");if(0===t.length)return[];const[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];const i=eD(r.join("/")),l=[];return l.push(...i.map(e=>""===e?o:[o,e].join("/"))),a&&l.push(...i),l.map(t=>e.startsWith("/")&&""===t?"/":t)}const tD=/^:[\w-]+$/,nD=3,rD=2,aD=1,oD=10,iD=-2,lD=e=>"*"===e;function sD(e,t){const n=e.split("/");let r=n.length;return n.some(lD)&&(r+=iD),t&&(r+=rD),n.filter(e=>!lD(e)).reduce((e,t)=>e+(tD.test(t)?nD:""===t?aD:oD),r)}function cD(e,t,n=!1){const{routesMeta:r}=e,a={};let o="/";const i=[];for(let l=0;l<r.length;++l){const e=r[l],s=l===r.length-1,c="/"===o?t:t.slice(o.length)||"/";let d=dD({path:e.relativePath,caseSensitive:e.caseSensitive,end:s},c);const u=e.route;if(!d&&s&&n&&!r[r.length-1].route.index&&(d=dD({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:wD([o,d.pathname]),pathnameBase:xD(wD([o,d.pathnameBase])),route:u}),"/"!==d.pathnameBase&&(o=wD([o,d.pathnameBase]))}return i}function dD(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});const[n,r]=function(e,t=!1,n=!0){BP("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);const r=[];let a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n,a,o)=>{if(r.push({paramName:t,isOptional:null!=n}),n){const t=o.charAt(a+e.length);return t&&"/"!==t?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");return[new RegExp(a,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;const o=a[0];let i=o.replace(/(.)\/+$/,"$1");const l=a.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if("*"===t){const e=l[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const a=l[r];return e[t]=n&&!a?void 0:(a||"").replace(/%2F/g,"/"),e},{}),pathname:o,pathnameBase:i,pattern:e}}function uD(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;const n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}const hD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pD=e=>hD.test(e);function mD(e,t){const n=CD(t).split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function gD(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function vD(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function fD(e){const t=vD(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function bD(e,t,n,r=!1){let a;"string"==typeof e?a=zP(e):(a={...e},UP(!a.pathname||!a.pathname.includes("?"),gD("?","pathname","search",a)),UP(!a.pathname||!a.pathname.includes("#"),gD("#","pathname","hash",a)),UP(!a.search||!a.search.includes("#"),gD("#","search","hash",a)));const o=""===e||""===a.pathname,i=o?"/":a.pathname;let l;if(null==i)l=n;else{let e=t.length-1;if(!r&&i.startsWith("..")){const t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}l=e>=0?t[e]:"/"}const s=function(e,t="/"){let n,{pathname:r,search:a="",hash:o=""}="string"==typeof e?zP(e):e;return r?(r=yD(r),n=r.startsWith("/")?mD(r.substring(1),"/"):mD(r,t)):n=t,{pathname:n,search:TD(a),hash:kD(o)}}(a,l),c=i&&"/"!==i&&i.endsWith("/"),d=(o||"."===i)&&n.endsWith("/");return s.pathname.endsWith("/")||!c&&!d||(s.pathname+="/"),s}const yD=e=>e.replace(/\/\/+/g,"/"),wD=e=>yD(e.join("/")),CD=e=>e.replace(/\/+$/,""),xD=e=>CD(e).replace(/^\/*/,"/"),TD=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",kD=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class ED{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function AD(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}function SD(e){const t=e.map(e=>e.route.path).filter(Boolean);return wD(t)||"/"}const ID="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ND(e,t){let n=e;if("string"!=typeof n||!hD.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};const r=n;let a=!1;if(ID)try{const e=new URL(window.location.href),r=n.startsWith("//")?new URL(e.protocol+n):new URL(n),o=uD(r.pathname,t);r.origin===e.origin&&null!=o?n=o+r.search+r.hash:a=!0}catch(o){BP(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}const RD=Symbol("Uninstrumented");function PD(e,t){const n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){const t=Object.keys(n);for(const r of t)e[r]&&n[r].push(e[r])}}));const r={};if("function"==typeof t.lazy&&n.lazy.length>0){const e=DD(n.lazy,t.lazy,()=>{});e&&(r.lazy=e)}if("object"==typeof t.lazy){const e=t.lazy;["middleware","loader","action"].forEach(t=>{const a=e[t],o=n[`lazy.${t}`];if("function"==typeof a&&o.length>0){const e=DD(o,a,()=>{});e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return["loader","action"].forEach(e=>{const a=t[e];if("function"==typeof a&&n[e].length>0){const t=a[RD]??a,o=DD(n[e],t,(...e)=>LD(e[0]));o&&("loader"===e&&!0===t.hydrate&&(o.hydrate=!0),o[RD]=t,r[e]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{const t=e[RD]??e,r=DD(n.middleware,t,(...e)=>LD(e[0]));return r?(r[RD]=t,r):e})),r}function DD(e,t,n){return 0===e.length?null:async(...r)=>{const a=await MD(e,n(...r),()=>t(...r),e.length-1);if("error"===a.type)throw a.value;return a.value}}async function MD(e,t,n,r){const a=e[r];let o;if(a){let l;const s=async()=>(l?console.error("You cannot call instrumented handlers more than once"):l=MD(e,t,n,r-1),o=await l,UP(o,"Expected a result"),"error"===o.type&&o.value instanceof Error?{status:"error",error:o.value}:{status:"success",error:void 0});try{await a(s,t)}catch(i){console.error("An instrumentation function threw an error:",i)}l||await s(),await l}else try{const e=await n();o={type:"success",value:e}}catch(i){o={type:"error",value:i}}return o||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function LD(e){const{request:t,context:n,params:r,pattern:a}=e;return{request:OD(t),params:{...r},pattern:a,context:VD(n)}}function FD(e,t){return{currentUrl:WP(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function OD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function VD(e){if(function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t||Object.getOwnPropertyNames(t).sort().join("\0")===UD}(e)){const t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}const UD=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),BD=["POST","PUT","PATCH","DELETE"],HD=new Set(BD),WD=["GET",...BD],zD=new Set(WD),_D=/* @__PURE__ */new Set([301,302,303,307,308]),jD=/* @__PURE__ */new Set([307,308]),qD={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},KD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},YD={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ZD=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),GD="remix-router-transitions",QD=Symbol("ResetLoaderData");let XD=class{#t;#n;#r;#a;constructor(e){this.#t=e,this.#n=JP(e)}get stableRoutes(){return this.#t}get activeRoutes(){return this.#r??this.#t}get branches(){return this.#a??this.#n}get hasHMRRoutes(){return null!=this.#r}setRoutes(e){this.#t=e,this.#n=JP(e)}setHmrRoutes(e){this.#r=e,this.#a=JP(e)}commitHmrRoutes(){this.#r&&(this.#t=this.#r,this.#n=this.#a,this.#r=void 0,this.#a=void 0)}};function JD(e,t,n,r,a,o){let i,l;if(a){i=[];for(const e of t)if(i.push(e),e.route.id===a){l=e;break}}else i=t,l=t[t.length-1];const s=bD(r||".",fD(i),uD(e.pathname,n)||e.pathname,"path"===o);if(null==r&&(s.search=e.search,s.hash=e.hash),(null==r||""===r||"."===r)&&l){const e=BM(s.search);if(l.route.index&&!e)s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&e){const e=new URLSearchParams(s.search),t=e.getAll("index");e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));const n=e.toString();s.search=n?`?${n}`:""}}return"/"!==n&&(s.pathname=function({basename:e,pathname:t}){return"/"===t?e:wD([e,t])}({basename:n,pathname:s.pathname})),WP(s)}function $D(e,t,n){if(!n||(null==(r=n)||!("formData"in r&&null!=r.formData||"body"in r&&void 0!==r.body)))return{path:t};var r,a;if(n.formMethod&&(a=n.formMethod,!zD.has(a.toUpperCase())))return{path:t,error:NM(405,{method:n.formMethod})};const o=()=>({path:t,error:NM(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=PM(t);if(void 0!==n.body){if("text/plain"===n.formEncType){if(!UM(i))return o();const e="string"==typeof n.body?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===n.formEncType){if(!UM(i))return o();try{const e="string"==typeof n.body?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch(r){return o()}}}let s,c;if(UP("function"==typeof FormData,"FormData is not available in this environment"),n.formData)s=xM(n.formData),c=n.formData;else if(n.body instanceof FormData)s=xM(n.body),c=n.body;else if(n.body instanceof URLSearchParams)s=n.body,c=TM(s);else if(null==n.body)s=new URLSearchParams,c=new FormData;else try{s=new URLSearchParams(n.body),c=TM(s)}catch(r){return o()}const d={formMethod:i,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(UM(d.formMethod))return{path:t,submission:d};const u=zP(t);return e&&u.search&&BM(u.search)&&s.append("index",""),u.search=`?${s}`,{path:WP(u),submission:d}}function eM(e,t,n,r,a,o,i,l,s,c,d,u,h,p,m,g,v,f,b,y,w,C){const x=w?LM(w[1])?w[1].error:w[1].data:void 0,T=a.createURL(o.location),k=a.createURL(s);let E;if(d&&o.errors){const e=Object.keys(o.errors)[0];E=i.findIndex(t=>t.route.id===e)}else if(w&&LM(w[1])){const e=w[0];E=i.findIndex(t=>t.route.id===e)-1}const A=w?w[1].statusCode:void 0,S=A&&A>=400,I={currentUrl:T,currentParams:o.matches[0]?.params||{},nextUrl:k,nextParams:i[0].params,...l,actionResult:x,actionStatus:A},N=SD(i),R=i.map((a,i)=>{const{route:l}=a;let h=null;if(null!=E&&i>E)h=!1;else if(l.lazy)h=!0;else if(tM(l))if(d){const{shouldLoad:e}=nM(l,o.loaderData,o.errors);h=e}else(function(e,t,n){const r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a})(o.loaderData,o.matches[i],a)&&(h=!0);else h=!1;if(null!==h)return mM(n,r,e,s,N,a,c,t,h);let p=!1;"boolean"==typeof C?p=C:S?p=!1:(u||T.pathname+T.search===k.pathname+k.search||T.search!==k.search||function(e,t){const n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}(o.matches[i],a))&&(p=!0);const m={...I,defaultShouldRevalidate:p},g=rM(a,m);return mM(n,r,e,s,N,a,c,t,g,m,C)}),P=[];return m.forEach((e,l)=>{if(d||!i.some(t=>t.route.id===e.routeId)||p.has(l))return;const s=o.fetchers.get(l),m=s&&"idle"!==s.state&&void 0===s.data,w=QP(v,e.path,f??"/",!1,y);if(!w){if(b&&m)return;return void P.push({key:l,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null})}if(g.has(l))return;const x=HM(w,e.path),T=new AbortController,k=wM(a,e.path,T.signal);let E=null;if(h.has(l))h.delete(l),E=gM(n,r,k,e.path,w,x,c,t);else if(m)u&&(E=gM(n,r,k,e.path,w,x,c,t));else{let a;a="boolean"==typeof C?C:!S&&u;const o={...I,defaultShouldRevalidate:a};rM(x,o)&&(E=gM(n,r,k,e.path,w,x,c,t,o))}E&&P.push({key:l,routeId:e.routeId,path:e.path,matches:E,match:x,request:k,controller:T})}),{dsMatches:R,revalidatingFetchers:P}}function tM(e){return null!=e.loader||null!=e.middleware&&e.middleware.length>0}function nM(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!tM(e))return{shouldLoad:!1,renderFallback:!1};const r=null!=t&&e.id in t,a=null!=n&&void 0!==n[e.id];if(!r&&a)return{shouldLoad:!1,renderFallback:!1};if("function"==typeof e.loader&&!0===e.loader.hydrate)return{shouldLoad:!0,renderFallback:!r};const o=!r&&!a;return{shouldLoad:o,renderFallback:o}}function rM(e,t){if(e.route.shouldRevalidate){const n=e.route.shouldRevalidate(t);if("boolean"==typeof n)return n}return t.defaultShouldRevalidate}function aM(e,t,n,r,a,o){let i;if(e){const t=r[e];UP(t,`No route found to patch children into: routeId = ${e}`),t.children||(t.children=[]),i=t.children}else i=n.activeRoutes;const l=[],s=[];if(t.forEach(e=>{const t=i.find(t=>oM(e,t));t?s.push({existingRoute:t,newRoute:e}):l.push(e)}),l.length>0){const t=ZP(l,a,[e||"_","patch",String(i?.length||"0")],r);i.push(...t)}if(o&&s.length>0)for(let c=0;c<s.length;c++){const{existingRoute:e,newRoute:t}=s[c],n=e,[r]=ZP([t],a,[],{},!0);Object.assign(n,{element:r.element?r.element:n.element,errorElement:r.errorElement?r.errorElement:n.errorElement,hydrateFallbackElement:r.hydrateFallbackElement?r.hydrateFallbackElement:n.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function oM(e,t){return"id"in e&&"id"in t&&e.id===t.id||e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive&&(!(e.children&&0!==e.children.length||t.children&&0!==t.children.length)||(e.children?.every((e,n)=>t.children?.some(t=>oM(e,t)))??!1))}const iM=/* @__PURE__ */new WeakMap,lM=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{const a=n[t.id];if(UP(a,"No route found in manifest"),!a.lazy||"object"!=typeof a.lazy)return;const o=a.lazy[e];if(!o)return;let i=iM.get(a);i||(i={},iM.set(a,i));const l=i[e];if(l)return l;const s=(async()=>{const t=(l=e,qP.has(l)),n=void 0!==a[e]&&"hasErrorBoundary"!==e;var l;if(t)BP(!t,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(n)BP(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{const t=await o();null!=t&&(Object.assign(a,{[e]:t}),Object.assign(a,r(a)))}"object"==typeof a.lazy&&(a.lazy[e]=void 0,Object.values(a.lazy).every(e=>void 0===e)&&(a.lazy=void 0))})();return i[e]=s,s},sM=/* @__PURE__ */new WeakMap;async function cM(e){const t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function dM(e){return e.matches.some(e=>e.route.middleware)?uM(e,()=>cM(e)):cM(e)}function uM(e,t){return async function(t,n,r,a){const{matches:o,...i}=t,l=o.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),s=await hM(i,l,n,e=>{if(VM(t=e)&&(n=t.status,_D.has(n))&&t.headers.has("Location"))throw e;var t,n;return e},a,function(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:"error",result:t}}));{const{matches:r}=e,a=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),o=SM(r,r[a].route.id).route.id;return Promise.resolve({[o]:{type:"error",result:t}})}});return s}(e,t,0,DM)}async function hM(e,t,n,r,a,o,i=0){const{request:l}=e;if(l.signal.aborted)throw l.signal.reason??new Error(`Request aborted: ${l.method} ${l.url}`);const s=t[i];if(!s)return await n();const[c,d]=s;let u;const h=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{const l=await hM(e,t,n,r,a,o,i+1);return u={value:l},u.value}catch(l){return u={value:await o(l,c,u)},u.value}};try{const t=await d(e,h),n=null!=t?r(t):void 0;return a(n)?n:u?n??u.value:(u={value:await h()},u.value)}catch(p){return await o(p,c,u)}}function pM(e,t,n,r,a){const o=lM({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=function(e,t,n,r,a){const o=n[e.id];if(UP(o,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if("function"==typeof e.lazy){const t=sM.get(o);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};const n=(async()=>{UP("function"==typeof e.lazy,"No lazy route function found");const t=await e.lazy(),n={};for(const e in t){const r=t[e];if(void 0===r)continue;const a=YP(e),i=void 0!==o[e]&&"hasErrorBoundary"!==e;a?BP(!a,"Route property "+e+" is not a supported property to be returned from a lazy route function. This property will be ignored."):i?BP(!i,`Route "${o.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(o,n),Object.assign(o,{...r(o),lazy:void 0})})();return sM.set(o,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}const i=Object.keys(e.lazy),l=[];let s;for(const d of i){if(a&&a.includes(d))continue;const o=lM({key:d,route:e,manifest:n,mapRouteProperties:r});o&&(l.push(o),d===t&&(s=o))}const c=l.length>0?Promise.all(l).then(()=>{}):void 0;return c?.catch(()=>{}),s?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:s}}(r.route,UM(n.method)?"action":"loader",t,e,a);return{middleware:o,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function mM(e,t,n,r,a,o,i,l,s,c=null,d){let u=!1;const h=pM(e,t,n,o,i);return{...o,_lazyPromises:h,shouldLoad:s,shouldRevalidateArgs:c,shouldCallHandler:e=>(u=!0,c?rM(o,"boolean"==typeof d?{...c,defaultShouldRevalidate:d}:"boolean"==typeof e?{...c,defaultShouldRevalidate:e}:c):s),resolve(e){const{lazy:t,loader:i,middleware:c}=o.route,d=u||s||e&&!UM(n.method)&&(t||i),p=c&&c.length>0&&!i&&!t;return!d||!UM(n.method)&&p?Promise.resolve({type:_P.data,result:void 0}):async function({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:o,handlerOverride:i,scopedContext:l}){let s,c;const d=UM(e.method),u=d?"action":"loader",h=a=>{let o;const s=new Promise((e,t)=>o=t);c=()=>o(),e.signal.addEventListener("abort",c);const d=o=>"function"!=typeof a?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${u}" [routeId: ${r.route.id}]`)):a({request:e,url:CM(e,t),pattern:n,params:r.params,context:l},...void 0!==o?[o]:[]),h=(async()=>{try{return{type:"data",result:await(i?i(e=>d(e)):d())}}catch(e){return{type:"error",result:e}}})();return Promise.race([h,s])};try{const t=d?r.route.action:r.route.loader;if(a||o)if(t){let e;const[n]=await Promise.all([h(t).catch(t=>{e=t}),a,o]);if(void 0!==e)throw e;s=n}else{await a;const t=d?r.route.action:r.route.loader;if(!t){if("action"===u){const t=new URL(e.url),n=t.pathname+t.search;throw NM(405,{method:e.method,pathname:n,routeId:r.route.id})}return{type:_P.data,result:void 0}}[s]=await Promise.all([h(t),o])}else{if(!t){const t=new URL(e.url);throw NM(404,{pathname:t.pathname+t.search})}s=await h(t)}}catch(p){return{type:_P.error,result:p}}finally{c&&e.signal.removeEventListener("abort",c)}return s}({request:n,path:r,pattern:a,match:o,lazyHandlerPromise:h?.handler,lazyRoutePromise:h?.route,handlerOverride:e,scopedContext:l})}}}function gM(e,t,n,r,a,o,i,l,s=null){return a.map(c=>c.route.id!==o.route.id?{...c,shouldLoad:!1,shouldRevalidateArgs:s,shouldCallHandler:()=>!1,_lazyPromises:pM(e,t,n,c,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:mM(e,t,n,r,SD(a),c,i,l,!0,s))}async function vM(e){const{result:t,type:n}=e;if(VM(t)){let e;try{e=await async function(e){const t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?null==e.body?null:e.json():e.text()}(t)}catch(a){return{type:_P.error,error:a}}return n===_P.error?{type:_P.error,error:new ED(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:_P.data,data:e,statusCode:t.status,headers:t.headers}}return n===_P.error?OM(t)?t.data instanceof Error?{type:_P.error,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:_P.error,error:(r=t,new ED(r.init?.status??500,r.init?.statusText??"Internal Server Error",r.data)),statusCode:AD(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:_P.error,error:t,statusCode:AD(t)?t.status:void 0}:OM(t)?{type:_P.data,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:_P.data,data:t};var r}function fM(e,t,n,r,a){let o=e.headers.get("Location");if(UP(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!pD(o)){const i=r.slice(0,r.findIndex(e=>e.route.id===n)+1);o=JD(new URL(t.url),i,a,o),e.headers.set("Location",o)}return e}const bM=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function yM(e,t,n,r){if(pD(e)){const r=e,a=r.startsWith("//")?new URL(t.protocol+r):new URL(r);if(bM.includes(a.protocol))throw new Error("Invalid redirect location");const o=null!=uD(a.pathname,n);if(a.origin===t.origin&&o)return yD(a.pathname)+a.search+a.hash}try{const t=r.createURL(e);if(bM.includes(t.protocol))throw new Error("Invalid redirect location")}catch(a){}return e}function wM(e,t,n,r){const a=e.createURL(PM(t)).toString(),o={signal:n};if(r&&UM(r.formMethod)){const{formMethod:e,formEncType:t}=r;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(r.json)):"text/plain"===t?o.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?o.body=xM(r.formData):o.body=r.formData}return new Request(a,o)}function CM(e,t){const n=new URL(e.url),r="string"==typeof t?zP(t):t;if(n.pathname=r.pathname||"/",r.search){const e=new URLSearchParams(r.search),t=e.getAll("index");e.delete("index");for(const n of t.filter(Boolean))e.append("index",n);n.search=e.size?`?${e.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function xM(e){const t=new URLSearchParams;for(const[n,r]of e.entries())t.append(n,"string"==typeof r?r:r.name);return t}function TM(e){const t=new FormData;for(const[n,r]of e.entries())t.append(n,r);return t}function kM(e,t,n,r,a,o,i){let{loaderData:l,errors:s}=function(e,t,n,r=!1,a=!1){const o={};let i,l=null,s=!1;const c={};let d=n&&LM(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;const u=n.route.id,h=t[u];if(UP(!FM(h),"Cannot handle redirect results in processLoaderData"),LM(h)){let t=h.error;if(void 0!==d&&(t=d,d=void 0),l=l||{},a)l[u]=t;else{const n=SM(e,u);null==l[n.route.id]&&(l[n.route.id]=t)}r||(o[u]=QD),s||(s=!0,i=AD(h.error)?h.error.status:500),h.headers&&(c[u]=h.headers)}else o[u]=h.data,h.statusCode&&200!==h.statusCode&&!s&&(i=h.statusCode),h.headers&&(c[u]=h.headers)}),void 0!==d&&n&&(l={[n[0]]:d},n[2]&&(o[n[2]]=void 0)),{loaderData:o,errors:l,statusCode:i||200,loaderHeaders:c}}(t,n,r);return a.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{const{key:n,match:r,controller:a}=t;if(a&&a.signal.aborted)return;const l=o[n];if(UP(l,"Did not find corresponding fetcher result"),LM(l)){const t=SM(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:l.error}),i.delete(n)}else if(FM(l))UP(!1,"Unhandled fetcher revalidation redirect");else{const e=jM(l.data);i.set(n,e)}}),{loaderData:l,errors:s}}function EM(e,t,n,r){const a=Object.entries(t).filter(([,e])=>e!==QD).reduce((e,[t,n])=>(e[t]=n,e),{});for(const o of n){const n=o.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&o.route.loader&&(a[n]=e[n]),r&&r.hasOwnProperty(n))break}return a}function AM(e){return e?LM(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function SM(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>!0===e.route.hasErrorBoundary)||e[0]}function IM(e){const t=1===e.length?e[0]:e.find(e=>e.index||!e.path||"/"===e.path)||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function NM(e,{pathname:t,routeId:n,method:r,type:a,message:o}={}){let i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",r&&t&&n?l=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l=`Route "${n}" does not match URL "${t}"`):404===e?(i="Not Found",l=`No route matches URL "${t}"`):405===e&&(i="Method Not Allowed",r&&t&&n?l=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(l=`Invalid request method "${r.toUpperCase()}"`)),new ED(e||500,i,new Error(l),!0)}function RM(e){const t=Object.entries(e);for(let n=t.length-1;n>=0;n--){const[e,r]=t[n];if(FM(r))return{key:e,result:r}}}function PM(e){return WP({..."string"==typeof e?zP(e):e,hash:""})}function DM(e){return null!=e&&"object"==typeof e&&Object.entries(e).every(([e,t])=>{return"string"==typeof e&&(null!=(n=t)&&"object"==typeof n&&"type"in n&&"result"in n&&(n.type===_P.data||n.type===_P.error));var n})}function MM(e){return VM(e.result)&&_D.has(e.result.status)}function LM(e){return e.type===_P.error}function FM(e){return(e&&e.type)===_P.redirect}function OM(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function VM(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function UM(e){return HD.has(e.toUpperCase())}function BM(e){return new URLSearchParams(e).getAll("index").some(e=>""===e)}function HM(e,t){const n="string"==typeof t?zP(t).search:t.search;if(e[e.length-1].route.index&&BM(n||""))return e[e.length-1];const r=vD(e);return r[r.length-1]}function WM(e){const{formMethod:t,formAction:n,formEncType:r,text:a,formData:o,json:i}=e;if(t&&n&&r)return null!=a?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a}:null!=o?{formMethod:t,formAction:n,formEncType:r,formData:o,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}:void 0}function zM(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function _M(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function jM(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function qM(){let e,t;const n=new Promise((r,a)=>{e=async e=>{r(e);try{await n}catch(t){}},t=async e=>{a(e);try{await n}catch(t){}}});return{promise:n,resolve:e,reject:t}}const KM=r.createContext(null);KM.displayName="DataRouter";const YM=r.createContext(null);YM.displayName="DataRouterState";const ZM=r.createContext(!1),GM=r.createContext({isTransitioning:!1});GM.displayName="ViewTransition";const QM=r.createContext(/* @__PURE__ */new Map);QM.displayName="Fetchers",r.createContext(null).displayName="Await";const XM=r.createContext(null);XM.displayName="Navigation";const JM=r.createContext(null);JM.displayName="Location";const $M=r.createContext({outlet:null,matches:[],isDataRoute:!1});$M.displayName="Route";const eL=r.createContext(null);eL.displayName="RouteError";const tL="REACT_ROUTER_ERROR";function nL(){return null!=r.useContext(JM)}function rL(){return UP(nL(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(JM).location}const aL="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function oL(e){r.useContext(XM).static||r.useLayoutEffect(e)}function iL(){const{isDataRoute:e}=r.useContext($M);return e?function(){const{router:e}=function(){const e=r.useContext(KM);return UP(e,gL("useNavigate")),e}(),t=fL("useNavigate"),n=r.useRef(!1);return oL(()=>{n.current=!0}),r.useCallback(async(r,a={})=>{BP(n.current,aL),n.current&&("number"==typeof r?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))},[e,t])}():function(){UP(nL(),"useNavigate() may be used only in the context of a <Router> component.");const e=r.useContext(KM),{basename:t,navigator:n}=r.useContext(XM),{matches:a}=r.useContext($M),{pathname:o}=rL(),i=JSON.stringify(fD(a)),l=r.useRef(!1);return oL(()=>{l.current=!0}),r.useCallback((r,a={})=>{if(BP(l.current,aL),!l.current)return;if("number"==typeof r)return void n.go(r);const s=bD(r,JSON.parse(i),o,"path"===a.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:wD([t,s.pathname])),(a.replace?n.replace:n.push)(s,a.state,a)},[t,n,i,o,e])}()}const lL=r.createContext(null);function sL(e,{relative:t}={}){const{matches:n}=r.useContext($M),{pathname:a}=rL(),o=JSON.stringify(fD(n));return r.useMemo(()=>bD(e,JSON.parse(o),a,"path"===t),[e,o,a,t])}function cL(e,t,n){UP(nL(),"useRoutes() may be used only in the context of a <Router> component.");const{navigator:a}=r.useContext(XM),{matches:o}=r.useContext($M),i=o[o.length-1],l=i?i.params:{};!i||i.pathname;const s=i?i.pathnameBase:"/";i&&i.route;const c=rL();let d;if(t){const e="string"==typeof t?zP(t):t;UP("/"===s||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=c;const u=d.pathname||"/";let h=u;if("/"!==s){const e=s.replace(/^\//,"").split("/");h="/"+u.replace(/^\//,"").split("/").slice(e.length).join("/")}const p=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):function(e,t,n="/"){return QP(e,t,n,!1)}(e,{pathname:h}),m=function(e,t=[],n){const r=n?.state;if(null==e){if(!r)return null;if(r.errors)e=r.matches;else{if(0!==t.length||r.initialized||!(r.matches.length>0))return null;e=r.matches}}let a=e;const o=r?.errors;if(null!=o){const e=a.findIndex(e=>e.route.id&&void 0!==o?.[e.route.id]);UP(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let e=0;e<a.length;e++){const t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){const{loaderData:e,errors:o}=r,s=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!o||void 0===o[t.route.id]);if(t.route.lazy||s){n.isStatic&&(i=!0),a=l>=0?a.slice(0,l+1):[a[0]];break}}}}const s=n?.onError,c=r&&s?(e,t)=>{s(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:SD(r.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,s)=>{let d,u=!1,h=null,p=null;r&&(d=o&&n.route.id?o[n.route.id]:void 0,h=n.route.errorElement||dL,i&&(l<0&&0===s?(bL["route-fallback"]||(bL["route-fallback"]=!0,BP(!1,"No `HydrateFallback` element provided to render during initial hydration")),u=!0,p=null):l===s&&(u=!0,p=n.route.hydrateFallbackElement||null)));const m=t.concat(a.slice(0,s+1)),g=()=>{let t;return t=d?h:u?p:n.route.Component?I(n.route.Component,{}):n.route.element?n.route.element:e,I(mL,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===s)?I(uL,{location:r.location,revalidation:r.revalidation,component:h,error:d,children:g(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:c}):g()},null)}(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:wD([s,a.encodeLocation?a.encodeLocation(e.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:wD([s,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),o,n);return t&&m?I(JM.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:FP.Pop},children:m}):m}const dL=I(function(){const e=function(){const e=r.useContext(eL),t=vL("useRouteError"),n=fL("useRouteError");return void 0!==e?e:t.errors?.[n]}(),t=AD(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return R(N,{children:[I("h2",{children:"Unexpected Application Error!"}),I("h3",{style:{fontStyle:"italic"},children:t}),n?I("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},children:n}):null,null]})},{});class uL extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=ZM;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&"object"==typeof e&&e&&"digest"in e&&"string"==typeof e.digest){const t=function(e){if(e.startsWith(`${tL}:ROUTE_ERROR_RESPONSE:{`))try{const t=JSON.parse(e.slice(40));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText)return new ED(t.status,t.statusText,t.data)}catch{}}(e.digest);t&&(e=t)}const t=void 0!==e?I($M.Provider,{value:this.props.routeContext,children:I(eL.Provider,{value:e,children:this.props.component})}):this.props.children;return this.context?I(pL,{error:e,children:t}):t}}const hL=/* @__PURE__ */new WeakMap;function pL({children:e,error:t}){const{basename:n}=r.useContext(XM);if("object"==typeof t&&t&&"digest"in t&&"string"==typeof t.digest){const e=function(e){if(e.startsWith(`${tL}:REDIRECT:{`))try{const t=JSON.parse(e.slice(28));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText&&"string"==typeof t.location&&"boolean"==typeof t.reloadDocument&&"boolean"==typeof t.replace)return t}catch{}}(t.digest);if(e){const r=hL.get(t);if(r)throw r;const a=ND(e.location,n);if(ID&&!hL.get(t)){if(!a.isExternal&&!e.reloadDocument){const n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw hL.set(t,n),n}window.location.href=a.absoluteURL||a.to}return I("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function mL({routeContext:e,match:t,children:n}){const a=r.useContext(KM);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),I($M.Provider,{value:e,children:n})}function gL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vL(e){const t=r.useContext(YM);return UP(t,gL(e)),t}function fL(e){const t=function(e){const t=r.useContext($M);return UP(t,gL(e)),t}(e),n=t.matches[t.matches.length-1];return UP(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}const bL={},yL={};function wL(e,t){e||yL[t]||(yL[t]=!0,console.warn(t))}const CL=r.useOptimistic,xL=()=>{};class TL{status="pending";promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}})}}function kL({router:e,flushSync:t,onError:n,useTransitions:a}){const o=r.useContext(ZM);a=o||a;const[i,l]=r.useState(e.state),[s,c]=(d=i,CL?CL(d):[d,xL]);var d;const[u,h]=r.useState(),[p,m]=r.useState({isTransitioning:!1}),[g,v]=r.useState(),[f,b]=r.useState(),[y,w]=r.useState(),C=r.useRef(/* @__PURE__ */new Map),x=r.useCallback((o,{deletedFetchers:i,newErrors:s,flushSync:d,viewTransitionOpts:u})=>{s&&n&&Object.values(s).forEach(e=>n(e,{location:o.location,params:o.matches[0]?.params??{},pattern:SD(o.matches)})),o.fetchers.forEach((e,t)=>{void 0!==e.data&&C.current.set(t,e.data)}),i.forEach(e=>C.current.delete(e)),wL(!1===d||null!=t,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `tight-react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "tight-react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');const p=null!=e.window&&null!=e.window.document&&"function"==typeof e.window.document.startViewTransition;if(wL(null==u||p,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),u&&p){if(t&&d){t(()=>{f&&(g?.resolve(),f.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:u.currentLocation,nextLocation:u.nextLocation})});const n=e.window.document.startViewTransition(()=>{t(()=>l(o))});return n.finished.finally(()=>{t(()=>{v(void 0),b(void 0),h(void 0),m({isTransitioning:!1})})}),void t(()=>b(n))}f?(g?.resolve(),f.skipTransition(),w({state:o,currentLocation:u.currentLocation,nextLocation:u.nextLocation})):(h(o),m({isTransitioning:!0,flushSync:!1,currentLocation:u.currentLocation,nextLocation:u.nextLocation}))}else t&&d?t(()=>l(o)):!1===a?l(o):r.startTransition(()=>{!0===a&&c(e=>EL(e,o)),l(o)})},[e.window,t,f,g,a,c,n]);r.useLayoutEffect(()=>e.subscribe(x),[e,x]),r.useEffect(()=>{p.isTransitioning&&!p.flushSync&&v(new TL)},[p]),r.useEffect(()=>{if(g&&u&&e.window){const t=u,n=g.promise,o=e.window.document.startViewTransition(async()=>{!1===a?l(t):r.startTransition(()=>{!0===a&&c(e=>EL(e,t)),l(t)}),await n});o.finished.finally(()=>{v(void 0),b(void 0),h(void 0),m({isTransitioning:!1})}),b(o)}},[u,g,e.window,a,c]),r.useEffect(()=>{g&&u&&s.location.key===u.location.key&&g.resolve()},[g,f,s.location,u]),r.useEffect(()=>{!p.isTransitioning&&y&&(h(y.state),m({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),w(void 0))},[p.isTransitioning,y]);const T=r.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),k=e.basename||"/",E=r.useMemo(()=>({router:e,navigator:T,static:!1,basename:k,onError:n}),[e,T,k,n]);return R(N,{children:[I(KM.Provider,{value:E,children:I(YM.Provider,{value:s,children:I(QM.Provider,{value:C.current,children:I(GM.Provider,{value:p,children:I(RL,{basename:k,location:s.location,navigationType:s.historyAction,navigator:T,useTransitions:a,children:I(AL,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})})})})})}),null]})}function EL(e,t){return{...e,navigation:"idle"!==t.navigation.state?t.navigation:e.navigation,revalidation:"idle"!==t.revalidation?t.revalidation:e.revalidation,actionData:"submitting"!==t.navigation.state?t.actionData:e.actionData,fetchers:t.fetchers}}const AL=r.memo(function({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:o}){return cL(e,void 0,{manifest:t,state:r,isStatic:a,onError:o})});function SL({basename:e,children:t,initialEntries:n,initialIndex:a,useTransitions:o}){const i=r.useRef();null==i.current&&(i.current=VP({initialEntries:n,initialIndex:a,v5Compat:!0}));const l=i.current,[s,c]=r.useState({action:l.action,location:l.location}),d=r.useCallback(e=>{!1===o?c(e):r.startTransition(()=>c(e))},[o]);return r.useLayoutEffect(()=>l.listen(d),[l,d]),I(KM.Provider,{value:null,children:I(YM.Provider,{value:null,children:I(RL,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:l,useTransitions:o})})})}function IL(e){return function(e){const t=r.useContext($M).outlet;return r.useMemo(()=>t&&I(lL.Provider,{value:e,children:t}),[t,e])}(e.context)}function NL(e){UP(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function RL({basename:e="/",children:t=null,location:n,navigationType:a=FP.Pop,navigator:o,static:i=!1,useTransitions:l}){const s=e.replace(/^\/*/,"/"),c=r.useMemo(()=>({basename:s,navigator:o,static:i,useTransitions:l,future:{}}),[s,o,i,l]);"string"==typeof n&&(n=zP(n));const{pathname:d="/",search:u="",hash:h="",state:p=null,key:m="default",mask:g}=n,v=r.useMemo(()=>{const e=uD(d,s);return null==e?null:{location:{pathname:e,search:u,hash:h,state:p,key:m,mask:g},navigationType:a}},[s,d,u,h,p,m,a,g]);return BP(null!=v,`<Router basename="${s}"> is not able to match the URL "${d}${u}${h}" because it does not start with the basename, so the <Router> won't render anything.`),null==v?null:I(XM.Provider,{value:c,children:I($M.Provider,{value:PL,children:I(JM.Provider,{children:t,value:v})})})}const PL={outlet:null,matches:[],isDataRoute:!1};function DL({children:e,location:t}){return cL(ML(e),t)}function ML(e,t=[]){const n=[];return r.Children.forEach(e,(e,a)=>{if(!r.isValidElement(e))return;const o=[...t,a];if(e.type===r.Fragment)return void n.push.apply(n,ML(e.props.children,o));UP(e.type===NL,`[${"string"==typeof e.type?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),UP(!e.props.index||!e.props.children,"An index route cannot have child routes.");const i={id:e.props.id||o.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:!0===e.props.hasErrorBoundary||null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(i.children=ML(e.props.children,o)),n.push(i)}),n}const LL="get",FL="application/x-www-form-urlencoded";function OL(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}let VL=null;const UL=/* @__PURE__ */new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function BL(e){return null==e||UL.has(e)?e:(BP(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${FL}"`),null)}const HL="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{HL&&(window.__reactRouterVersion=REACT_ROUTER_VERSION)}catch(ir){}const WL=r.forwardRef(function({onClick:e,relative:t,reloadDocument:n,replace:a,mask:o,state:i,target:l,to:s,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:u,...h},p){const{basename:m,navigator:g,useTransitions:v}=r.useContext(XM),f=ND(s,m),b=function(e,{relative:t}={}){UP(nL(),"useHref() may be used only in the context of a <Router> component.");const{basename:n,navigator:a}=r.useContext(XM),{hash:o,pathname:i,search:l}=sL(e,{relative:t});let s=i;return"/"!==n&&(s="/"===i?n:wD([n,i])),a.createHref({pathname:s,search:l,hash:o})}(s=f.to,{relative:t}),y=rL();let w=null;if(o){const e=bD(o,[],y.mask?y.mask.pathname:"/",!0);"/"!==m&&(e.pathname="/"===e.pathname?m:wD([m,e.pathname])),w=g.createHref(e)}const C=function(e,{target:t,replace:n,mask:a,state:o,preventScrollReset:i,relative:l,viewTransition:s,defaultShouldRevalidate:c,useTransitions:d}={}){const u=iL(),h=rL(),p=sL(e,{relative:l});return r.useCallback(m=>{if(v=t,!(0!==(g=m).button||v&&"_self"!==v||(f=g,f.metaKey||f.altKey||f.ctrlKey||f.shiftKey))){m.preventDefault();const t=void 0!==n?n:WP(h)===WP(p),g=()=>u(e,{replace:t,mask:a,state:o,preventScrollReset:i,relative:l,viewTransition:s,defaultShouldRevalidate:c});d?r.startTransition(()=>g()):g()}var g,v,f},[h,u,p,n,a,o,t,e,i,l,s,c,d])}(s,{replace:a,mask:o,state:i,target:l,preventScrollReset:c,relative:t,viewTransition:d,defaultShouldRevalidate:u,useTransitions:v}),x=!(f.isExternal||n);return I("a",{...h,href:(x?w:void 0)||f.absoluteURL||b,onClick:x?function(t){e&&e(t),t.defaultPrevented||C(t)}:e,ref:p,target:l})});WL.displayName="Link";const zL=r.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:l,children:s,...c},d){const u=sL(i,{relative:c.relative}),h=rL(),p=r.useContext(YM),{navigator:m,basename:g}=r.useContext(XM),v=null!=p&&function(e,{relative:t}={}){const n=r.useContext(GM);UP(null!=n,"`useViewTransitionState` must be used within `tight-react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `tight-react-router`?");const{basename:a}=_L("useViewTransitionState"),o=sL(e,{relative:t});if(!n.isTransitioning)return!1;const i=uD(n.currentLocation.pathname,a)||n.currentLocation.pathname,l=uD(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=dD(o.pathname,l)||null!=dD(o.pathname,i)}(u)&&!0===l;let f=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,b=h.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(b=b.toLowerCase(),y=y?y.toLowerCase():null,f=f.toLowerCase()),y&&g&&(y=uD(y,g)||y);const w="/"!==f&&f.endsWith("/")?f.length-1:f.length,C=b===f||!a&&b.startsWith(f)&&"/"===b.charAt(w),x=null!=y&&(y===f||!a&&y.startsWith(f)&&"/"===y.charAt(f.length)),T={isActive:C,isPending:x,isTransitioning:v},k=C?e:void 0;let E;E="function"==typeof n?n(T):[n,C?"active":null,x?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");const A="function"==typeof o?o(T):o;return I(WL,{...c,"aria-current":k,className:E,ref:d,style:A,to:i,viewTransition:l,children:"function"==typeof s?s(T):s})});function _L(e){const t=r.useContext(KM);return UP(t,`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`),t}zL.displayName="NavLink",r.forwardRef(({fetcherKey:e,navigate:t,reloadDocument:n,replace:a,state:o,method:i=LL,action:l,onSubmit:s,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:h,...p},m)=>{const{useTransitions:g}=r.useContext(XM),v=function(){const{router:e}=_L("useSubmit"),{basename:t}=r.useContext(XM),n=fL("useRouteId"),a=e.fetch,o=e.navigate;return r.useCallback(async(e,r={})=>{const{action:i,method:l,encType:s,formData:c,body:d}=function(e,t){let n,r,a,o,i;if(OL(s=e)&&"form"===s.tagName.toLowerCase()){const i=e.getAttribute("action");r=i?uD(i,t):null,n=e.getAttribute("method")||LL,a=BL(e.getAttribute("enctype"))||FL,o=new FormData(e)}else if(OL(l=e)&&"button"===l.tagName.toLowerCase()||function(e){return OL(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){const i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');const s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?uD(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||LL,a=BL(e.getAttribute("formenctype"))||BL(i.getAttribute("enctype"))||FL,o=new FormData(i,e),!function(){if(null===VL)try{new FormData(document.createElement("form"),0),VL=!1}catch(l){VL=!0}return VL}()){const{name:t,type:n,value:r}=e;if("image"===n){const e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(OL(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=LL,r=null,a=FL,i=e}var l,s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}(e,t);if(!1===r.navigate){const e=r.fetcherKey||qL();await a(e,n,r.action||i,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||l,formEncType:r.encType||s,flushSync:r.flushSync})}else await o(r.action||i,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||l,formEncType:r.encType||s,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[a,o,t,n])}(),f=function(e,{relative:t}={}){const{basename:n}=r.useContext(XM),a=r.useContext($M);UP(a,"useFormAction must be used inside a RouteContext");const[o]=a.matches.slice(-1),i={...sL(e||".",{relative:t})},l=rL();if(null==e){i.search=l.search;const e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));const n=e.toString();i.search=n?`?${n}`:""}}return e&&"."!==e||!o?.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(i.pathname="/"===i.pathname?n:wD([n,i.pathname])),WP(i)}(l,{relative:c}),b="get"===i.toLowerCase()?"get":"post";return I("form",{ref:m,method:b,action:f,onSubmit:n?s:n=>{if(s&&s(n),n.defaultPrevented)return;n.preventDefault();const l=n.nativeEvent.submitter,p=l?.getAttribute("formmethod")||i,m=()=>v(l||n.currentTarget,{fetcherKey:e,method:p,navigate:t,replace:a,state:o,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:h});g&&!1!==t?r.startTransition(()=>m()):m()},...p})}).displayName="Form";let jL=0;const qL=()=>`__${String(++jL)}__`;function KL(){return I(ip,{color:"weak",alignment:"horizontal"})}function YL(e){return t=>{"Enter"!==t.key&&"Space"!==t.code||(t.preventDefault(),e?.(t))}}const ZL=or({base:{display:"flex",padding:"16px",alignItems:"center",gap:"9px",background:"surface.foreground",maxWidth:"100%",justifyContent:"space-between",cursor:"pointer",...il,_supportHover:{backgroundColor:"surface.intent.action.hover"}},variants:{disabled:{true:{cursor:"default",background:"surface.background",color:"icon.base.weak",_supportHover:{backgroundColor:"surface.background"}}}}}),GL=or({base:{...no},variants:{disabled:{true:{color:"typography.base.weak"},false:{color:"typography.base"}}},defaultVariants:{disabled:!1}});function QL({name:e,disabled:t,onClick:n}){const r=t?void 0:n,a=t?void 0:YL(n);return R("div",{className:ZL({disabled:t}),role:"button",tabIndex:t?-1:0,onKeyDown:a,onClick:r,children:[I("div",{className:GL({disabled:t??!1}),children:e}),!t&&I(Sd,{Component:rl})]})}const XL=tr({background:"surface.foreground",borderWidth:"md",borderStyle:"solid",borderColor:"border.layout.weak",borderRadius:"sm",width:"100%"}),JL=tr({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 12px",width:"100%",cursor:"pointer"}),$L=tr(no,{color:"typography.base.weak"});function eF({label:e,defaultExpanded:t=!1,children:n}){const[r,a]=d(t),o=()=>a(e=>!e),i=YL(o);return R("div",{className:XL,children:[R("div",{className:JL,role:"button",tabIndex:0,"aria-expanded":r,onClick:o,onKeyDown:i,children:[I("div",{className:$L,children:e}),I(Sd,{Component:r?Lp:rl})]}),r&&n]})}const tF={"/":{path:"/",route:"/",handle:{label:"Reports"}},"profit-and-loss":{path:"profit-and-loss",route:"/profit-and-loss",handle:{label:"Profit & Loss"}},"profit-and-loss/general-ledger":{path:"general-ledger",route:"/profit-and-loss/general-ledger",handle:{label:"General Ledger"}},"balance-sheet":{path:"balance-sheet",route:"/balance-sheet",handle:{label:"Balance Sheet"}},"cash-flow-statement":{path:"cash-flow-statement",route:"/cash-flow-statement",handle:{label:"Cash Flow Statement"}}};function nF(){const e=iL();return u((t,n)=>{e(tF[t].route,n)},[e])}function rF(){const e=nF();return R(eF,{label:"Accounting",defaultExpanded:!0,children:[I(KL,{}),I(QL,{name:"Profit & Loss",onClick:()=>e("profit-and-loss")}),I(KL,{}),I(QL,{name:"Balance Sheet",onClick:()=>e("balance-sheet")}),I(KL,{}),I(QL,{name:"Cash Flow Statement",onClick:()=>e("cash-flow-statement")}),I(KL,{}),I(QL,{disabled:!0,name:"Trial Balance"})]})}function aF(){return R(eF,{label:"Income and Invoices",children:[I(KL,{}),I(QL,{disabled:!0,name:"Income Analysis"}),I(KL,{}),I(QL,{disabled:!0,name:"Accounts Receivable Aging"})]})}function oF(){return R(eF,{label:"Expenses and Bills",children:[I(KL,{}),I(QL,{disabled:!0,name:"Expense Analysis"}),I(KL,{}),I(QL,{disabled:!0,name:"Accounts Payable Aging"}),I(KL,{}),I(QL,{disabled:!0,name:"Time & Task Analysis"}),I(KL,{}),I(QL,{disabled:!0,name:"Mileage Analysis"})]})}function iF(){return R(eF,{label:"Taxes",children:[I(KL,{}),I(QL,{disabled:!0,name:"Schedule C"}),I(KL,{}),I(QL,{disabled:!0,name:"Form 1065"}),I(KL,{}),I(QL,{disabled:!0,name:"Form 1120-S"}),I(KL,{}),I(QL,{disabled:!0,name:"Form 1120"}),I(KL,{}),I(QL,{disabled:!0,name:"T2125"}),I(KL,{}),I(QL,{disabled:!0,name:"Tax Details for Filing"})]})}const lF=HN({gap:"16px",alignItems:"flex-start",direction:{base:"column",xl:"row"}}),sF=_N({gap:"16px",width:"100%"}),cF=KN({gap:"8px",alignItems:"center"}),dF=tr(no,{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"typography.base",_supportHover:{textDecoration:"underline"}}),uF=tr(no,{color:"typography.base"});function hF(){const e=function(){const{matches:e,loaderData:t}=vL("useMatches");return r.useMemo(()=>e.map(e=>XP(e,t)),[e,t])}(),t=iL(),n=e.flatMap(e=>function(e){try{return JV.parse(e),!0}catch{return!1}}(e.handle)?[{id:e.id,pathname:e.pathname,label:e.handle.label}]:[]);return 0===n.length?null:I("nav",{className:cF,"aria-label":"Breadcrumb",children:n.map((e,r)=>{const a=r===n.length-1;return R(f,{children:[r>0&&I(cl,{Component:rl}),a?I("span",{className:uF,"aria-current":"page",children:e.label}):I("button",{type:"button",className:dF,onClick:()=>t(e.pathname),children:e.label})]},e.id)})})}const pF=_N({gap:"16px",alignItems:"flex-start",width:"100%"}),mF=tr({display:"flex",flexDirection:"column",gap:"16px",width:"100%",maxWidth:"100%",alignItems:"center"}),gF=l(void 0);function vF({children:e}){const[t,n]=d(()=>yt(ut.LAST_6_MONTHS)),[r,a]=d("MONTHLY"),[o,i]=d("ACCRUAL"),[l,s]=d(void 0),[c,u]=d([]);return I(gF.Provider,{value:{dateRange:t,setDateRange:n,period:r,setPeriod:a,accountingMethod:o,setAccountingMethod:i,dimensionId:l,setDimensionId:s,reportDimensionFilters:c,setReportDimensionFilters:u},children:e})}const fF={[ut.LAST_6_MONTHS]:"Last 6 Months",[ut.LAST_12_MONTHS]:"Last 12 Months (TTM)",[ut.LAST_QUARTER]:"Last Quarter",[ut.LAST_YEAR]:"Last Year",[ut.THIS_QUARTER]:"This Quarter",[ut.THIS_YEAR]:"This Year"},bF=[ut.LAST_6_MONTHS,ut.LAST_12_MONTHS,ut.LAST_QUARTER,ut.LAST_YEAR,ut.THIS_QUARTER,ut.THIS_YEAR];const yF=tr({width:"200px",minWidth:"200px"}),wF={width:"fit-content"};function CF({onPresetSelect:e,onCustomSelect:t}){const{close:n}=kc();return I(Fc,{children:R(Lm,{style:yF,children:[bF.map((t,r)=>R(f,{children:[I(Wm,{onClick:()=>(e(t),void n()),children:I(To,{children:fF[t]})}),(1===r||3===r)&&I(ip,{alignment:"horizontal"})]},t)),I(ip,{alignment:"horizontal"}),I(QC,{triggerChildren:I($C,{displayLabel:"Custom"}),popupChildren:I(Fc,{style:wF,children:I(XI,{onDateRangeChange:e=>{e.beginDate&&e.endDate&&t({beginDate:e.beginDate,endDate:e.endDate})}})})})]})})}function xF({value:e,onChange:t}){const n=function(e){const t=Nt(e.endDate),n=Nt(e.beginDate);if(null===t||null===n)return`${null===n?e.beginDate:At(n)} - ${null===t?e.endDate:At(t)}`;if(1!==n.getDate()||!function(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.getDate()===t}(t))return`${At(n)} - ${At(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?Mt(n,{abbreviateMonth:!0}):`${Mt(n,{abbreviateMonth:!0})} - ${Mt(t,{abbreviateMonth:!0})}`}(e);return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:oE}),I(sc,{wrap:"nowrap",children:n})]})}),I(CF,{onPresetSelect:e=>{t(yt(e))},onCustomSelect:e=>{t(e)}})]})}const TF={NONE:"None",MONTHLY:"Monthly",QUARTERLY:"Quarterly",YEARLY:"Yearly"},kF={NONE:"Period",MONTHLY:"By Month",QUARTERLY:"By Quarter",YEARLY:"By Year"},EF=["NONE","MONTHLY","QUARTERLY","YEARLY"],AF=tr({width:"200px",minWidth:"200px"});function SF({onSelect:e}){const{close:t}=kc();return I(Fc,{children:I(Lm,{style:AF,children:EF.map(n=>I(Wm,{onClick:()=>(e(n),void t()),children:I(To,{children:TF[n]})},n))})})}function IF({value:e,onChange:t}){const n=kF[e];return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:ou}),I(sc,{wrap:"nowrap",children:n})]})}),I(SF,{onSelect:t})]})}function NF({popupTriggerProps:e,text:t}){return R(pf,{popupTriggerChildrenProps:e,children:[I(iS,{children:I(sc,{wrap:"wrap",children:t})}),I(Sd,{Component:rl})]})}function RF({model:e,setFilters:t,pendingFilters:n,setPendingFilters:r,filters:a}){const o=YT(n,e.key),i=QT(e.name,o,1);return R(Tc,{children:[I(Ec,{children:e=>I(NF,{popupTriggerProps:e,text:i})}),e.ModalComponent&&I(e.ModalComponent,{model:e,setFilters:t,pendingFilters:o,setPendingFilters:t=>{r(n=>ZT(n,e.key,t))},filters:a})]})}const PF=vi(mg,"Bank");function DF({value:e,handleClick:t,isActive:n,modelKey:r,singleSelect:a}){const o="bankAccount"===r,i=a?I(iI,{isSelected:n}):I(uf,{selected:n,showEmptyIndicator:!0});return R(pf,{handleClick:t,selected:n,children:[R(iS,{children:[o&&I(Td,{imageUrl:e.iconUrl,Component:PF}),I(sc,{wrap:"wrap",children:e.name})]}),i]})}function MF({values:e,model:t,pendingFilters:n,onClick:r}){return I(sf,{title:I(Eo,{children:"Filter by"}),children:e.length>0?e.map((e,a)=>{const o=YT(n,t.key),i=(l=e,o.some(e=>C(e.value,l.value)));var l;return I(DF,{handleClick:()=>r(e),value:e,isActive:i,modelKey:t.key,singleSelect:t.singleSelect},`${e.name}_${a}`)}):I(rf,{showSearchCTA:!1,pluralNounNotFound:"results",singularSearchCTANoun:""})})}function LF({values:e,model:t,filters:n,pendingFilters:r,onClick:a,searchTerm:i}){const l=o(()=>new Ae(e,Zm),[e]),s=o(()=>l.search(i).map(e=>e.item),[l,i]);return I(MF,{values:s,model:t,filters:n,pendingFilters:r,onClick:a})}function FF({values:e,model:t,filters:n,pendingFilters:r,onClick:a}){return I($v,{placeholder:`Search ${t.name.toLowerCase()}...`,SearchList:LF,DefaultList:MF,listLength:e.length,onClick:a,extraProps:{values:e,model:t,filters:n,pendingFilters:r}})}function OF({values:e,model:t,filters:n,pendingFilters:r,setPendingFilters:a,setFilters:o,handleValueClick:i}){const l=kc();return I(Kv,{title:"Back",Footer:I(AS,{onClearAll:()=>{a(e=>ZT(e,t.key,[]))},onApply:()=>{const e=YT(r,t.key),a=[...n.filter(e=>e.modelKey!==t.key),...e];o(a),l.close()}}),children:t.NestedListComponent?I(t.NestedListComponent,{filters:n,pendingFilters:r,onToggle:i,model:t,setPendingFilters:a,setFilters:o}):I(FF,{values:e,model:t,filters:n,pendingFilters:r,onClick:i})})}function VF({pendingFilters:e,setPendingFilters:t,setFilters:n,modelKey:r}){const{close:a}=kc();return I(AS,{onApply:()=>{n(GT(e)),a()},onClearAll:()=>{t(e=>ZT(e,r,[]))}})}function UF({model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a}){const o=t=>{r(n=>{const r=YT(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 ZT(n,e.key,a)})};let i;if(void 0===e.possibleValues&&void 0===e.SimpleListComponent)return null;if(e.SimpleListComponent)i=I(Kv,{title:"Back",Footer:I(VF,{pendingFilters:n,setPendingFilters:r,setFilters:a,modelKey:e.key}),children:I(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(sr(l)||!Je(l))return null;if(s)return I(vf,{});i=I(OF,{handleValueClick:o,values:l,model:e,filters:t,pendingFilters:n,setPendingFilters:r,setFilters:a})}const l=YT(n,e.key),s=QT(e.name,l);return R(Tc,{children:[I(Ec,{children:e=>I(NF,{popupTriggerProps:e,text:s})}),i]})}const BF=tr({padding:"16px",flex:"1 1 0",overflowY:"auto",width:"100%"});function HF({filters:e,filterModels:t,setFilters:n,pendingFilters:r,setPendingFilters:a}){const o=wT();return I("div",{className:BF,children:I(sf,{title:I(Eo,{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 sr(o)&&void 0===t.SimpleListComponent?I(RF,{model:t,setFilters:n,pendingFilters:r,setPendingFilters:a,filters:e},t.key):I(UF,{model:t,filters:e,pendingFilters:r,setPendingFilters:a,setFilters:n},t.key)})})})}function WF(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(sr(e)||n.has(e))continue;const i=r.children.find(e=>!sr(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 zF(){return eI({select:WF})}function _F(e){return!sr(e)&&e.startsWith("dimension_")}const jF=async e=>{const t=e.queryKey,n={path:"/v6/templates/dimensions/query",accessToken:t[1].accessToken,endpointManager:xi(t[1].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function qF(){return Vr({queryKey:["dimensions"],queryFn:jF})}function KF({dimension:e,model:t,pendingFilters:n,setPendingFilters:r}){const{query:{data:a}}=qF(),{query:{data:i}}=eI(),l=_F(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||!qf(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 I(eb,{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=>ZT(e,l,n))},allowMultiselect:!0})}function YF(e,t){return $e({key:e,name:t.name,singleSelect:!1,SimpleListComponent:e=>I(KF,{...e,dimension:t})})}function ZF({filters:e,setFilters:t}){const{filterModels:n}=function(){const e=tI(),t=function(){const{query:{data:e}}=zF();return o(()=>{const t=(e??[]).map(e=>{const t=`dimension_${e.id}`;return[t,YF(t,e)]});return Object.fromEntries(t)},[e])}(),n=o(()=>Object.assign({customer:rS(e)},t),[e,t]),r=o(()=>[n.customer,...Object.values(t)],[n,t]);return o(()=>({filterModels:r,filterModelsByKey:n}),[r,n])}(),{close:r}=kc(),[a,i]=d(()=>KT(e,n));return I(qv,{title:"Filter By",padChildren:!1,Footer:I(AS,{onApply:()=>{t(GT(a)),r()},onClearAll:()=>{const e=/* @__PURE__ */new Map;n.forEach(t=>{e.set(t.key,[])}),i(e)}}),children:I(HF,{filters:e,filterModels:n,setFilters:t,pendingFilters:a,setPendingFilters:i})})}function GF({filters:e,setFilters:t}){const{open:n}=kc();return I(Ov,{overlay:!0,children:n&&I(ZF,{filters:e,setFilters:t})})}function QF({filters:e,setFilters:t}){return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:WI}),I(sc,{wrap:"nowrap",children:"Filters"})]})}),I(GF,{filters:e,setFilters:t})]})}const XF=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:"none"})))),JF=vi(XF,"DimensionValue"),$F=tr({width:"200px",minWidth:"200px"});function eO({labels:e,onSelect:t}){const{close:n}=kc(),r=e=>{t(e),n()};return I(Fc,{children:R(Lm,{style:$F,children:[I(Wm,{onClick:()=>r(void 0),children:I(To,{children:"None"})}),e.map(e=>I(Wm,{onClick:()=>r(e.id),children:I(To,{children:e.name})},e.id))]})})}function tO({value:e,onChange:t}){const{query:{data:n=[]}}=zF();if(0===n.length)return null;const r=n.find(t=>t.id===e),a=r?`By ${r.name}`:"Group By";return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:JF}),I(sc,{wrap:"nowrap",children:a})]})}),I(eO,{labels:n,onSelect:t})]})}function nO({accountingMethod:e,onChange:t,textOverrides:n}){const r=o(()=>{return e=n?.cash,t=n?.accrual,[{label:t??"Accrual",value:"ACCRUAL"},{label:e??"Cash",value:"CASH"}];var e,t},[n?.cash,n?.accrual]),a=o(()=>Object.fromEntries(r.map((e,t)=>[e.value,t])),[r])[e],i=u(e=>{t(r[e].value)},[t,r]);return I("div",{children:I(Df,{width:"fit",options:r,selectedIndex:a,handleClick:i})})}const rO=vi(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 aO(){return R(Xs,{disabled:!0,children:[I(cl,{Component:rO}),I(sc,{children:"Export Report"})]})}function oO(){return R(Xs,{disabled:!0,children:[I(cl,{Component:Nd}),I(sc,{children:"Send Report"})]})}function iO({filters:e,setFilters:t}){return e.map((n,r)=>I(hb,{text:n.name,onClickRemove:()=>t(Xe(e,r)),additionalValidClassName:lr["filter-pill"]},n.id))}function lO(){const e=i(gF);if(void 0===e)throw new Error("useReportPreviewContext must be used within a ReportPreviewProvider");return e}const sO=KN({justifyContent:"space-between",width:"100%",maxWidth:"100%",flexWrap:"wrap"}),cO=KN({gap:"8px",flexWrap:"wrap"});function dO({hasDimensionFiltering:e=!0,textOverrides:t}){const{dateRange:n,setDateRange:r,period:a,setPeriod:o,accountingMethod:i,setAccountingMethod:l,dimensionId:s,setDimensionId:c,reportDimensionFilters:d,setReportDimensionFilters:u}=lO();return R(N,{children:[R("div",{className:sO,children:[R("div",{className:cO,children:[I(xF,{value:n,onChange:r}),I(IF,{value:a,onChange:o}),e&&I(QF,{filters:d,setFilters:u}),e&&I(tO,{value:s,onChange:c})]}),R("div",{className:cO,children:[I(nO,{textOverrides:t?.accountingMethod,accountingMethod:i,onChange:l}),I(aO,{}),I(oO,{})]})]}),e&&I(gN,{children:I(iO,{filters:d,setFilters:u})})]})}const uO=or({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:no,bold:ro},clickable:{true:{cursor:"pointer",_supportHover:{backgroundColor:"surface.intent.action.discreet.hover"}},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 hO({children:e,colspan:t,...n}){return I("th",{colSpan:t,className:uO({...n}),children:e})}const pO=or({base:{_odd:{backgroundColor:"surface.reports.alternateRows"},_even:{backgroundColor:"surface.foreground"}},variants:{weight:{regular:no,bold:ro},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"}}),mO=GN({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"}),gO=tr({userSelect:"none",boxSizing:"border-box",minWidth:"800px",borderCollapse:"separate",borderSpacing:0}),vO=tr({backgroundColor:"surface.foreground",position:"sticky",zIndex:2,top:0}),fO=tr({borderBottomColor:"border.layout",borderBottomWidth:"md",borderBottomStyle:"solid",backgroundColor:"inherit"});function bO({table:e}){const t=a(null),n=u(()=>{const e=r.current;e&&(e.dataset.scrolledX=String(e.scrollLeft>0))},[r=t]);var r;const o=e.getExpandedRowModel().rows;return I("div",{className:mO,ref:t,onScroll:n,children:R("table",{className:gO,children:[I("thead",{className:vO,children:e.getHeaderGroups().map(e=>I("tr",{className:fO,children:e.headers.map((e,t)=>e.isPlaceholder?I(hO,{stickyLeft:"left"===e.column.getIsPinned(),border:0!==t?"left":void 0},e.id):I(f,{children:X(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),I("tbody",{children:o.map((e,t)=>{const n=e.getCanExpand(),r=n?()=>e.toggleExpanded():void 0,a=e.original.type,i=n||"expandTotal"===a?"bold":"regular";let l=e.original.type;if(t<o.length-1){const e=o[t+1];"sectionEnd"===a&&"reportTotal"===e.original.type&&(l=void 0)}return I("tr",{className:pO({rowType:l,expandable:n,weight:i}),onClick:r,children:e.getVisibleCells().map(e=>I(f,{children:X(e.column.columnDef.cell,e.getContext())},e.id))},e.id)})})]})})}const yO=e=>["reports","profitAndLoss",e],wO=async e=>{const t=e.queryKey,n={path:"/v6/reports/profitAndLoss",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result?r.data:void 0};function CO(e){const t=[];return{caboose:()=>[...t],car(e){return t.push(e),this}}}const xO="Total";function TO(e){return Ir(e)?xO:`${xO} ${e}`}function kO(e){if(void 0!==e)return vo(sh(e),{cents:"always",signage:"parens"})}function EO(e){if(!sr(e))return vo(sh(e),{cents:"always",condense:!1,decorator:"$",signage:"parens"})}function AO(e,t,n,r){return e.map((e,a)=>{const o=`${t}.${a}`,i=e=>n(e)?.[a],l=r(i),s=e.children??[],c=s.length>0?AO(s,o,e=>i(e)?.children,r):void 0;return{key:o,label:e.name,values:l,accountId:e.accountId??void 0,subrows:c}})}function SO(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function IO(e){if(!sr(e))return vo(e,{cents:"always",decorator:"%",signage:"parens"})}function NO({rowSpan:e,children:t,onClick:n,clickable:r,...a}){return I("td",{rowSpan:e,onClick:n,className:uO({clickable:r??void 0!==n,...a}),children:t})}const RO=vi(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 PO({expanded:e,canExpand:t=!0}){return I(Sc,{Component:t?e?Lp:rl:RO})}const DO=tr({alignItems:"center",display:"flex",gap:8});function MO({depth:e=0,children:t}){return I("div",{className:DO,style:{paddingLeft:9*e},children:t})}function LO({context:e}){const t=e.table.getIsAllRowsExpanded();return I(NO,{onClick:()=>e.table.toggleAllRowsExpanded(),stickyLeft:"left"===e.column.getIsPinned(),alignment:"start",weight:"regular",children:R(MO,{children:[I(PO,{expanded:t}),t?"Collapse All":"Expand All"]})})}function FO(e){return"expandTotal"===e.row.original.type?e.row.depth-1:e.row.depth}function OO({context:e}){return I(NO,{alignment:"start",stickyLeft:"left"===e.column.getIsPinned(),children:R(MO,{depth:FO(e),children:[I(PO,{expanded:e.row.getIsExpanded(),canExpand:e.row.getCanExpand()}),e.getValue()]})})}const VO=J();function UO(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const BO=VO.accessor("label",{id:"label",header:e=>I(LO,{context:e}),cell:e=>I(OO,{context:e})});const HO={placeholderData:L},WO=S.object({glAccountId:S.string(),dateRange:S.object({start:S.string().optional(),end:S.string().optional()}).optional(),accountingMethod:S.enum(["CASH","ACCRUAL"])}),zO=[];function _O(e){const t=e.flatMap(e=>e.value.customer?.value.id?.in??[]);return t.length>0?t:void 0}function jO(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!_F(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}))}function qO(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=lO(),i=function(){const e=nF();return u((t,n)=>{e(t,{state:n})},[e])}(),{query:{data:l},isFilling:s}=(c={filter:{...e,dimensionValues:jO(a),customerIds:_O(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},d=HO,Vr({queryKey:yO(c??{}),queryFn:wO,...d}));var c,d;const h=u((e,t)=>{sr(e.accountId)||i("profit-and-loss/general-ledger",{glAccountId:e.accountId,dateRange:{start:t.period?.beginDate,end:t.period?.endDate},accountingMethod:n})},[i,n]),p=o(()=>function(e){const t=e?.json;if(void 0===t)return[];const n=/* @__PURE__ */function(e){return(t,n)=>{const r=n((i=e,i[0]?.data?.[0]??{})),a=r?.name,o=SO(e,e=>EO(n(e)?.total));var i;return{key:t,label:a,values:o,subrows:[...AO(r?.children??[],t,e=>n(e)?.children,t=>SO(e,e=>kO(t(e)?.total))),{key:`${t}.total`,label:TO(a),type:"expandTotal",values:o}]}}}(t),r=/* @__PURE__ */function(e){return(t,n,r,a)=>({key:t,label:n,type:a,values:SO(e,r)})}(t);return CO().car(n("income",e=>e.income)).car(n("cogs",e=>e.cogs)).car(r("grossProfit","Gross Profit",e=>EO(e.grossProfit),"sectionStart")).car(r("profitMargin","Profit Margin",e=>IO(e.profitMargin),"sectionEnd")).car(n("expenses",e=>e.expenses)).car(r("netOperatingIncome","Net Operating Income",e=>EO(e.netOperatingIncome),"sectionStart")).car(r("operatingMargin","Operating Margin",e=>IO(e.operatingMargin),"sectionEnd")).car(n("otherExpenses",e=>e.otherExpenses)).car(n("otherIncome",e=>e.otherIncome)).car(r("netIncome","Net Income",e=>EO(e.netIncome),"reportTotal")).caboose().filter(e=>void 0!==Object.values(e.values)[0])}(l),[l]),m=o(()=>function(e,t){const n=e?.json??[],r=n[0],a=r?.data,o=n.map((e,o)=>{const i=e.data?.length??0,l=o!==n.length-1&&(i>1||a?.[0]?.name!==r?.name),s=(d=o,u=l,h=t,void 0===(c=e).data?[]:c.data.map((e,t)=>VO.accessor(`values.${d}[${t}]`,{header:t=>I(hO,{border:UO(t.column)?"left":void 0,weight:u?"regular":"bold",colspan:t.header.colSpan,alignment:"end",children:e.name}),cell:e=>{const t=e.row.original,n=e.row.getCanExpand()&&e.row.getIsExpanded(),r=void 0!==h&&Nr(t.accountId)?()=>h(t,c):void 0;return I(NO,{border:UO(e.column)?"left":void 0,alignment:"end",onClick:r,children:!n&&e.cell.getValue()})}})));var c,d,u,h;return l?VO.group({id:`valueRecord.${o}`,header:t=>I(hO,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:s}):s[0]});return[BO,...o]}(l,h),[l,h]);return{table:$({data:p??zO,columns:m,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{income:!0,cogs:!0,expenses:!0,otherExpenses:!0,otherIncome:!0},columnPinning:{left:["label"]}}}),isFilling:s}}function KO(){const{table:e,isFilling:t}=qO();return R(N,{children:[I(dO,{hasDimensionFiltering:!0}),!t&&I(bO,{table:e})]})}const YO=e=>["reports","balanceSheet",e],ZO=async e=>{const t=e.queryKey,n={path:"/v6/reports/balanceSheet",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result?r.data:void 0};function GO(e,t){const n=e.map((e,n)=>[`${n}[0]`,t(e)]);return Object.fromEntries(n)}function QO(e,t,n,r){const a=GO(n,e=>EO(r(e)?.total)),o=[...AO(e.children??[],t,e=>r(e)?.children,e=>GO(n,t=>kO(e(t)?.total))),{key:`${t}.total`,label:TO(e.name),type:"expandTotal",values:a}];return{key:t,label:e.name,values:a,subrows:o}}const XO=TO("Liabilities and Equity");const JO=J(),$O=JO.accessor("label",{id:"label",header:e=>I(LO,{context:e}),cell:e=>I(OO,{context:e})});const eV=[];function tV(){const{dateRange:e,period:t,accountingMethod:n}=lO(),{query:{data:r},isFilling:a}=(i=HO,Vr({queryKey:YO({filter:e,grouping:{period:t},accountingMethod:n}),queryFn:ZO,...i}));var i;const l=o(()=>function(e){return function(e){const t=e?.json;if(void 0===t||0===t.length)return[];const n=t[0],r=CO(),a=n.assets;a&&r.car(QO(a,"assets",t,e=>e.assets));const o=n.liabilitiesAndEquity?.liabilities;o&&r.car(QO(o,"liabilities",t,e=>e.liabilitiesAndEquity?.liabilities));const i=n.liabilitiesAndEquity?.equity;i&&r.car(QO(i,"equity",t,e=>e.liabilitiesAndEquity?.equity));const l=n.liabilitiesAndEquity?.name;return r.car({key:"totalLiabilitiesAndEquity",label:void 0!==l?TO(l):XO,type:"reportTotal",values:GO(t,e=>EO(e.liabilitiesAndEquity?.total))}),r.caboose().filter(e=>void 0!==Object.values(e.values)[0])}(e)}(r),[r]),s=o(()=>function(e){const t=(e?.json??[]).map((e,t)=>{return n=e,r=t,JO.accessor(`values.${r}[0]`,{header:()=>I(hO,{border:"left",weight:"bold",alignment:"end",children:n.name}),cell:e=>{const t=e.row.getCanExpand()&&e.row.getIsExpanded();return I(NO,{border:"left",alignment:"end",children:!t&&e.cell.getValue()})}});var n,r});return[$O,...t]}(r),[r]);return{table:$({data:l??eV,columns:s,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{assets:!0,liabilities:!0,equity:!0},columnPinning:{left:["label"]}}}),isFilling:a}}function nV(){const{table:e,isFilling:t}=tV();return R(N,{children:[I(dO,{hasDimensionFiltering:!1}),!t&&I(bO,{table:e})]})}const rV=e=>["reports","cashFlowStatement",e],aV=async e=>{const t=e.queryKey,n={path:"/v6/reports/cashFlowStatement",bodyParams:{...t[2],exportType:"JSON"},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result?r.data:void 0};function oV(e,t){const n=e.flatMap((e,n)=>(e.data??[]).map((e,r)=>[`${n}[${r}]`,t(e)]));return Object.fromEntries(n)}function iV(e,t,n,r){const a=AO(e.children??[],t,e=>r(e)?.children,e=>oV(n,t=>kO(e(t)?.total))),o=oV(n,e=>EO(r(e)?.total)),i=[...a,{key:`${t}.total`,label:TO(e.name),type:"expandTotal",values:o}];return{key:t,label:e.name,values:o,subrows:i}}const lV=J();function sV(e){const t=e.parent;return void 0===t||0===(t.columns.findIndex(t=>t.id===e.id)??-1)}const cV=lV.accessor("label",{id:"label",header:e=>I(LO,{context:e}),cell:e=>I(OO,{context:e})});const dV=[];function uV(e){const t=/* @__PURE__ */new Map;if(e.forEach(e=>{if(!_F(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}))}function hV(){const{dateRange:e,period:t,accountingMethod:n,dimensionId:r,reportDimensionFilters:a}=lO(),{query:{data:i},isFilling:l}=(s={filter:{...e,dimensionValues:uV(a)},grouping:{period:t,dimensionId:r},accountingMethod:n},c=HO,Vr({queryKey:rV(s??{}),queryFn:aV,...c}));var s,c;const d=o(()=>function(e){return function(e){const t=e?.json;if(void 0===t||0===t.length)return[];const n=t[0].data?.[0];if(!n)return[];const r=CO();return n.operatingActivities&&r.car(iV(n.operatingActivities,"operatingActivities",t,e=>e.operatingActivities)),n.investingActivities&&r.car(iV(n.investingActivities,"investingActivities",t,e=>e.investingActivities)),n.financingActivities&&r.car(iV(n.financingActivities,"financingActivities",t,e=>e.financingActivities)),r.car({key:"changeInCash",label:"Change in Cash",type:"sectionStart",values:oV(t,e=>EO(e.netCashChange))}),r.car({key:"beginCash",label:"Beginning Cash",values:oV(t,e=>EO(e.beginCashBalance))}),r.car({key:"endCash",label:"End Cash",type:"reportTotal",values:oV(t,e=>EO(e.endCashBalance))}),r.caboose().filter(e=>void 0!==Object.values(e.values)[0])}(e)}(i),[i]),u=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)=>lV.accessor(`values.${c}[${t}]`,{header:t=>I(hO,{border:sV(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 I(NO,{border:sV(e.column)?"left":void 0,alignment:"end",children:!t&&e.cell.getValue()})}})));var s,c,d;return i?lV.group({id:`valueRecord.${a}`,header:t=>I(hO,{border:"left",weight:"bold",colspan:t.header.colSpan,alignment:"center",children:e.name}),columns:l}):l[0]});return[cV,...a]}(i),[i]);return{table:$({data:d??dV,columns:u,getCoreRowModel:ee(),getExpandedRowModel:te(),getSubRows:e=>e.subrows,getRowId:e=>e.key,initialState:{expanded:{operatingActivities:!0,investingActivities:!0,financingActivities:!0},columnPinning:{left:["label"]}}}),isFilling:l}}const pV={accountingMethod:{cash:"Cash (Direct)",accrual:"Accrual (Indirect)"}};function mV(){const{table:e,isFilling:t}=hV();return R(N,{children:[I(dO,{hasDimensionFiltering:!0,textOverrides:pV}),!t&&I(bO,{table:e})]})}const gV=e=>r.createElement("svg",{width:90,height:24,viewBox:"0 0 90 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M15.6182 11.5362V8.24941C15.6182 3.87291 12.0796 0.325012 7.71366 0.325012H1.375V12.1459H15.0099C15.1782 12.1459 15.3141 12.2822 15.3141 12.4508V15.7376C15.3141 20.1141 18.8534 23.662 23.2194 23.662H29.558V11.8411H15.9231C15.7549 11.8411 15.619 11.7049 15.619 11.5362H15.6182Z",fill:"white"}),r.createElement("path",{d:"M52.4967 23.6612V20.9282H59.1775C60.8137 20.9282 61.7406 20.1628 61.7406 18.3313V16.336C60.7045 17.5392 59.1225 18.2218 57.3504 18.2218C53.3969 18.2218 50.5337 15.2147 50.5337 11.3336C50.5337 7.45246 53.6153 4.4729 57.3779 4.4729C59.15 4.4729 60.7595 5.12881 61.7956 6.41387V4.74613H64.6863V18.1951C64.6863 21.9943 62.2865 23.662 59.0958 23.662H52.4967V23.6612ZM61.6589 11.3336C61.6589 8.98237 59.941 7.26112 57.5954 7.26112C55.2499 7.26112 53.5595 8.98318 53.5595 11.3336C53.5595 13.684 55.2499 15.4069 57.5954 15.4069C59.941 15.4069 61.6589 13.6848 61.6589 11.3336Z",fill:"white"}),r.createElement("path",{d:"M43.3378 18.3037C40.2563 18.3037 38.7842 16.9643 38.7842 14.1485V7.53353H36.5479V4.74531H38.1024C38.5116 4.74531 38.7842 4.47209 38.7842 3.97995V1.35632H41.8108V4.74612H45.41V7.53434H41.8108V13.8486C41.8108 14.9147 42.3292 15.4612 43.5562 15.4612H45.4108V18.3045H43.3386L43.3378 18.3037Z",fill:"white"}),r.createElement("path",{d:"M66.536 18.3037V0.325012H69.5633V6.11224C70.4086 5.07365 71.7172 4.47207 73.3809 4.47207C76.7351 4.47207 79.1073 6.85004 79.1073 10.595V18.3037H76.0799V10.8682C76.0799 8.65399 74.8805 7.34217 72.9167 7.34217C70.9529 7.34217 69.5625 8.70912 69.5625 10.8682V18.3037H66.5352H66.536Z",fill:"white"}),r.createElement("path",{d:"M86.0307 18.3037C82.9491 18.3037 81.4771 16.9643 81.4771 14.1485V7.53353H79.2407V4.74531H80.7953C81.2045 4.74531 81.4771 4.47209 81.4771 3.97995V1.35632H84.5037V4.74612H88.1029V7.53434H84.5037V13.8486C84.5037 14.9147 85.0221 15.4612 86.2491 15.4612H88.1037V18.3045H86.0315L86.0307 18.3037Z",fill:"white"}),r.createElement("path",{d:"M49.3991 4.74609H46.3726V18.3045H49.3991V4.74609Z",fill:"white"}),r.createElement("path",{d:"M48.1859 0.325012H46.3726V3.22998H49.3991V1.54116C49.3991 0.869845 48.8564 0.325012 48.1859 0.325012Z",fill:"white"})),vV=tr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"center",paddingTop:"15%",width:"100%",height:"100vh"}),fV=tr({display:"flex",flexDirection:"column",gap:"24px",alignItems:"flex-start"}),bV=tr({display:"flex",flexDirection:"column",gap:"24px",width:{xl:"368px",sm:"316px",base:"auto"},minHeight:{md:"110px",base:"140px"},padding:"36px 24px",alignItems:"flex-start",borderRadius:"4px",backgroundLinear:"to-t",gradientFrom:"#009C75",gradientTo:"#2AD17B",gradientFromPosition:"23.41%",gradientToPosition:"106.24%"}),yV=tr({display:"flex",flexDirection:"column",gap:"12px"}),wV=tr({fontFamily:"Duplet Semibold, sans-serif",fontWeight:"md",fontSize:"md",lineHeight:"template",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),CV=tr({fontFamily:"Duplet Regular, sans-serif",fontWeight:"sm",fontSize:"md",lineHeight:"template",letterSpacing:"0.84px",fontStyle:"normal",xl:{lineHeight:"template",fontSize:"md"},color:"#FFF",margin:0,textWrap:"wrap"}),xV=tr({display:"inline"});function TV(){const e=Bk();return I("div",{className:vV,children:R("div",{className:fV,children:[e&&I(Fk,{}),R("div",{className:bV,children:[I(gV,{width:89,height:24,overflow:"visible"}),R("div",{className:yV,children:[R("span",{className:xV,children:[I("span",{className:wV,children:"This component is currently only available in the "}),I("a",{className:wV,href:"https://docs.tight.com/v5.0/embeddable-ui/white-labeled-experience/how-to-embed",target:"_blank",rel:"noreferrer",children:"v5 Javascript SDK"})]}),R("span",{className:xV,children:[I("span",{className:CV,children:"It will be available in "}),I("a",{className:CV,href:"https://docs.tight.com/embeddable-ui/tight-embeddable-ui",target:"_blank",rel:"noreferrer",children:"v6 React Components"}),I("span",{className:CV,children:" soon"})]})]})]})]})})}function kV({onClick:e,accounts:t,listLabel:n,nestedTitle:r,isFilling:a,selectedAccountId:o,onSelect:i,Header:l}){return a?I(yf,{}):R(N,{children:[l,I(sf,{title:I(To,{children:n}),children:t.map(t=>t.hasChilds?I(lS,{text:t.name,iconUrl:t.iconUrl,title:r,children:I(EV,{accounts:t.children,selectedAccountId:o,onSelect:i,listLabel:t.name,nestedTitle:r})},t.id):I(mf,{handleClick:()=>e(t),selected:t.id===o,children:I(iS,{children:I(sc,{wrap:"wrap",children:t.name})})},t.id))})]})}function EV({accounts:e,selectedAccountId:t,onSelect:n,isFilling:r=!1,listLabel:a="All Accounts",placeholder:o="Search accounts...",nestedTitle:i="All Accounts",Header:l}){const s=kc(),c=e=>{n(e),s.close()},d=t?/* @__PURE__ */new Set([t]):/* @__PURE__ */new Set;return I($v,{placeholder:o,onClick:c,SearchList:({searchTerm:t,onClick:n})=>I(bS,{searchTerm:t,onClick:n,glAccounts:e,isFilling:r,selectedIds:d}),DefaultList:kV,listLength:e.length,extraProps:{accounts:e,listLabel:a,nestedTitle:i,isFilling:r,selectedAccountId:t,onSelect:c,Header:l},forceSearchVisible:!0})}const AV=tr({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",outline:"none",border:"none",background:"none",padding:0,cursor:"pointer"});function SV({children:e,...t}){return I("button",{className:AV,type:"button",...t,children:e})}const IV=tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid",borderColor:"border.layout",minWidth:"280px"});function NV({isMobile:e}){const t=kc(),n=a(e);return s(()=>{n.current!==e&&(n.current=e,t.close())},[e,t]),null}function RV({selectedAccountId:e,onSelect:t}){const{query:{data:n},isFilling:r}=mC({select:e=>TC(e.filter(e=>"ACTIVE"===e.status))});return I(Kv,{title:"Select Account",overlay:!0,children:I(EV,{accounts:n??[],isFilling:r,onSelect:t,selectedAccountId:e})})}function PV({onSelect:e}){return I(rx,{onClick:e,activeOnly:!0})}function DV({selectedAccountId:e,onSelect:t,initialOpen:n=!1}){const r=wT(),{query:{data:a}}=mC(),o=a?.find(t=>t.id===e);return R(Tc,{placement:"bottom-start",initialOpen:n,children:[I(NV,{isMobile:r}),I(Ec,{children:e=>{return I(wp,{label:"Account",popupTriggerProps:e,additionalStyles:IV,children:R(SV,{children:[I(sc,{intent:o?"default":"weak",children:(t=o,t?(n=t.accountNo,r=t.name,`${n?`#${n}`:""} ${r??""}`.trim()):"Select an account")}),I(Sd,{Component:rl})]})});var t,n,r}}),r?I(RV,{selectedAccountId:e,onSelect:t}):I(PV,{onSelect:t})]})}const MV=(e,t)=>["generalLedger",e,t],LV=async e=>{const t=e.queryKey,n={path:"/v6/accounting/glAccounts/{id}/generalLedger",pathParams:{id:t[1]},bodyParams:{...t[2],cursor:t[3].cursor},accessToken:t[4].accessToken,endpointManager:xi(t[4].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor,beginningBalance:r.beginningBalance}:{data:void 0,cursor:void 0,beginningBalance:void 0}};function FV({name:e,align:t="left"}){return I(Kc,{align:t,padding:"right"===t?"large":"default",children:I(vc,{children:e})})}const OV={...gw,INVOICE:"Invoice",BILL:"Bill",PAYROLL:"Payroll",JOURNAL_ENTRY:"Journal Entry"};function VV(e){return null===e||0===e?"":yo(sh(e))}function UV({entry:e}){return I(ic,{children:I(Mw,{label:e.entity?.displayName??"",subLabel:e.entity?.secondaryDisplayName??void 0,iconSpacing:!1})})}function BV({label:e}){return I(ic,{children:I(sc,{children:e})})}function HV({balance:e}){return I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:(t=e??null,wo(null===t?0:sh(t)))})});var t}const WV=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"100%"});function zV(e){return function(t){return"entry"!==t.row.original.kind?null:I(e,{entry:t.row.original.entry})}}const _V=J(),jV=[_V.display({id:"date",cell:zV(function({entry:e}){return I(ic,{children:I(hw,{date:e.date})})}),header:()=>I(FV,{name:"Date"}),size:100,maxSize:130}),_V.display({id:"type",cell:zV(function({entry:e}){return I(ic,{children:I(sc,{children:(t=e.type,sr(t)?"":OV[t])})});var t}),header:()=>I(FV,{name:"Type"}),size:110}),_V.display({id:"source",cell:e=>{const t=e.row.original;if("entry"===t.kind)return I(UV,{entry:t.entry});const n="beginningBalance"===t.kind?"Beginning Balance":"Ending Balance";return I(BV,{label:n})},header:()=>I(FV,{name:"Source"}),size:180}),_V.display({id:"debit",cell:zV(function({entry:e}){return I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:VV(e.drAmount)})})}),header:()=>I(FV,{name:"Debit",align:"right"}),size:100,maxSize:130}),_V.display({id:"credit",cell:zV(function({entry:e}){return I(ic,{alignVariant:"flexEnd",children:I(Bw,{amount:VV(e.crAmount)})})}),header:()=>I(FV,{name:"Credit",align:"right"}),size:100,maxSize:130}),_V.display({id:"balance",cell:e=>{const t=e.row.original,n="entry"===t.kind?t.entry.runningBalance:t.balance;return I(HV,{balance:n})},header:()=>I(FV,{name:"Balance",align:"right"}),size:110,maxSize:140}),_V.display({id:"account",cell:zV(function({entry:e}){const t=e.glAccount?.iconUrl,n=Nr(t)?Cg(t,""):void 0;return I(ic,{children:R("div",{className:WV,children:[n&&I(Sd,{Component:n}),I(sc,{children:e.glAccount?.displayName??""})]})})}),header:()=>I(FV,{name:"Account"}),size:140}),_V.display({id:"drilldown",cell:zV(function(){return I(ic,{alignVariant:"center",children:I(Sd,{Component:rl})})}),size:40,maxSize:60})];function qV(e){return"beginningBalance"===e.kind?"__beginning_balance__":"endingBalance"===e.kind?"__ending_balance__":e.entry.id??""}const KV=_N({gap:"16px",alignItems:"stretch",width:"100%"}),YV=tr({alignSelf:"flex-start"}),ZV=tr({display:"flex",justifyContent:"center",alignItems:"center",padding:"16px"}),GV=[];function QV({glAccountId:e,onGlAccountChange:t,dateRange:n,accountingMethod:r,limit:a=100}){const i=o(()=>function(e){if(void 0!==e)return{beginDate:e.start,endDate:e.end}}(n),[n]),{query:{data:l},isFilling:s,paginationControls:c}=function(e,t={},n){return kl({queryKey:MV(e??"",t),queryFn:LV,...n,enabled:Nr(e)&&!0})}(e,{filter:i,accountingMethod:r,limit:a}),d=l?.data,u=l?.beginningBalance,h=o(()=>{if(void 0===d||0===d.length)return GV;const e=[];c.hasPreviousPage||e.push({kind:"beginningBalance",balance:u});for(const t of d)e.push({kind:"entry",entry:t});if(!c.hasNextPage){const t=d[d.length-1];e.push({kind:"endingBalance",balance:t.runningBalance})}return e},[d,u,c.hasPreviousPage,c.hasNextPage]),p=function({rows:e}){return $({data:e,manualPagination:!0,manualSorting:!0,manualFiltering:!0,manualGrouping:!0,columns:jV,getCoreRowModel:ee(),getRowId:qV})}({rows:h});return R("div",{className:KV,children:[I("div",{className:YV,children:I(DV,{selectedAccountId:e,onSelect:e=>t(e.id)})}),e&&R(sl.Provider,{value:c,children:[I(nc,{dashboard:"generalLedger",children:s?I(wl,{numColumns:jV.length}):R(N,{children:[I(Hl,{headerGroups:p.getHeaderGroups()}),h.length>0?I(zl,{children:p.getRowModel().rows.map(e=>I(ns,{rowData:e,shouldDisplayDivider:()=>!1},e.id))}):I(Cd,{children:I(sc,{children:"No entries for this account."})})]})}),I("div",{className:ZV,children:I(ml,{})})]})]})}const XV=_N({gap:"16px",alignItems:"flex-start",width:"100%"}),JV=S.object({label:S.string()}),$V=(eU=[{path:tF["/"].path,errorElement:I(N,{}),element:I(IL,{}),handle:tF["/"].handle,children:[{index:!0,Component:function(){const e=Bk();return R("div",{className:lF,children:[e&&I(Fk,{}),R("div",{className:sF,children:[I(rF,{}),I(aF,{}),I(oF,{}),I(iF,{})]})]})}},{Component:function(){return R("div",{className:pF,children:[I(hF,{}),I("div",{className:mF,children:I(IL,{})})]})},children:[{path:tF["profit-and-loss"].path,element:I(IL,{}),handle:tF["profit-and-loss"].handle,children:[{index:!0,Component:function(){return I(vF,{children:I(KO,{})})}},{path:tF["profit-and-loss/general-ledger"].path,Component:function(){const e=ze(),{state:t}=rL(),n=(r=t,WO.safeParse(r).success?t:void 0);var r;const[a,o]=d(n?.glAccountId),[i,l]=d(n?.dateRange),[s,c]=d(n?.accountingMethod??tn);return e?I("div",{className:XV,children:I(QV,{glAccountId:a,onGlAccountChange:o,dateRange:i,onDateRangeChange:l,accountingMethod:s,onAccountingMethodChange:c})}):I(TV,{})},handle:tF["profit-and-loss/general-ledger"].handle}]},{path:tF["balance-sheet"].path,Component:function(){return I(vF,{children:I(nV,{})})},handle:tF["balance-sheet"].handle},{path:tF["cash-flow-statement"].path,Component:function(){return I(vF,{children:I(mV,{})})},handle:tF["cash-flow-statement"].handle}]}]}],function(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,n=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement;UP(e.routes.length>0,"You must provide a non-empty routes array to createRouter");const r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||ZD;let o=a;if(e.instrumentations){const t=e.instrumentations;o=e=>({...a(e),...PD(t.map(e=>e.route).filter(Boolean),e)})}let i={};const l=new XD(ZP(e.routes,o,void 0,i));let s=e.basename||"/";s.startsWith("/")||(s=`/${s}`);const c=e.dataStrategy||dM,d={...e.future};let u=null;const h=/* @__PURE__ */new Set;let p,m,g,v=null,f=null,b=null,y=null,w=null!=e.hydrationData,C=QP(l.activeRoutes,e.history.location,s,!1,l.branches),x=!1,T=null;if(null!=C||e.patchRoutesOnNavigation)if(C&&!e.hydrationData&&pe(C,l.activeRoutes,e.history.location.pathname).active&&(C=null),C)if(C.some(e=>e.route.lazy))p=!1,m=!p;else if(C.some(e=>tM(e.route))){const t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;let r=C;if(n){const e=C.findIndex(e=>void 0!==n[e.route.id]);r=r.slice(0,e+1)}m=!1,p=!0,r.forEach(e=>{const r=nM(e.route,t,n);m=m||r.renderFallback,p=p&&!r.shouldLoad})}else p=!0,m=!p;else{p=!1,m=!p,C=[];const t=pe(null,l.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(x=!0,C=t.matches)}else{const t=NM(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=IM(l.activeRoutes);p=!0,m=!p,C=n,T={[r.id]:t}}let k,E={historyAction:e.history.action,location:e.history.location,matches:C,initialized:p,renderFallback:m,navigation:qD,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||T,fetchers:/* @__PURE__ */new Map,blockers:/* @__PURE__ */new Map},A=FP.Pop,S=null,I=!1,N=!1;const R=/* @__PURE__ */new Map;let P=null,D=!1,M=!1;const L=/* @__PURE__ */new Set,F=/* @__PURE__ */new Map;let O=0,V=-1;const U=/* @__PURE__ */new Map,B=/* @__PURE__ */new Set,H=/* @__PURE__ */new Map,W=/* @__PURE__ */new Map,z=/* @__PURE__ */new Set,_=/* @__PURE__ */new Map;let j,q=null;function K(e,t={}){e.matches&&(e.matches=e.matches.map(e=>{const t=i[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e})),E={...E,...e};const n=[],r=[];E.fetchers.forEach((e,t)=>{"idle"===e.state&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{E.fetchers.has(e)||F.has(e)||n.push(e)}),0===h.size&&(v={newErrors:e.errors??null}),[...h].forEach(r=>r(E,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),n.forEach(e=>ne(E.fetchers,e)),r.forEach(e=>E.fetchers.delete(e))}function Y(t,n,{flushSync:r}={}){const a=null!=E.actionData&&null!=E.navigation.formMethod&&UM(E.navigation.formMethod)&&"loading"===E.navigation.state&&!0!==t.state?._isRedirect;let o;o=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:a?E.actionData:null;const i=n.loaderData?EM(E.loaderData,n.loaderData,n.matches||[],n.errors):E.loaderData;let s=E.blockers;s.size>0&&(s=new Map(s),s.forEach((e,t)=>s.set(t,YD)));const c=!D&&he(t,n.matches||E.matches),d=!0===I||null!=E.navigation.formMethod&&UM(E.navigation.formMethod)&&!0!==t.state?._isRedirect;let u;if(l.commitHmrRoutes(),D||A===FP.Pop||(A===FP.Push?e.history.push(t,t.state):A===FP.Replace&&e.history.replace(t,t.state)),A===FP.Pop){const e=R.get(E.location.pathname);e&&e.has(t.pathname)?u={currentLocation:E.location,nextLocation:t}:R.has(t.pathname)&&(u={currentLocation:t,nextLocation:E.location})}else if(N){let e=R.get(E.location.pathname);e?e.add(t.pathname):(e=/* @__PURE__ */new Set([t.pathname]),R.set(E.location.pathname,e)),u={currentLocation:E.location,nextLocation:t}}K({...n,actionData:o,loaderData:i,historyAction:A,location:t,initialized:!0,renderFallback:!1,navigation:qD,revalidation:"idle",restoreScrollPosition:c,preventScrollReset:d,blockers:s},{viewTransitionOpts:u,flushSync:!0===r}),A=FP.Pop,I=!1,N=!1,D=!1,M=!1,S?.resolve(),S=null,q?.resolve(),q=null}async function Z(t,n,a){k&&k.abort(),k=null,A=t,D=!0===(a&&a.startUninterruptedRevalidation),function(e,t){if(f&&y){const n=ue(e,t);f[n]=y()}}(E.location,E.matches),I=!0===(a&&a.preventScrollReset),N=!0===(a&&a.enableViewTransition);const c=l.activeRoutes;let d=a?.initialHydration&&E.matches&&E.matches.length>0&&!x?E.matches:QP(c,n,s,!1,l.branches),u=!0===(a&&a.flushSync);if(d&&E.initialized&&!M&&(h=E.location,p=n,h.pathname===p.pathname&&h.search===p.search&&(""===h.hash?""!==p.hash:h.hash===p.hash||""!==p.hash))&&!(a&&a.submission&&UM(a.submission.formMethod)))return void Y(n,{matches:d},{flushSync:u});var h,p;const m=pe(d,c,n.pathname);if(m.active&&m.matches&&(d=m.matches),!d){const{error:e,notFoundMatches:t,route:r}=de(n.pathname);return void Y(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}let g=a&&a.overrideNavigation?{...a.overrideNavigation,matches:d,historyAction:t}:void 0;k=new AbortController;let v=wM(e.history,n,k.signal,a&&a.submission);const b=e.getContext?await e.getContext():new jP;let w;if(a&&a.pendingError)w=[SM(d).route.id,{type:_P.error,error:a.pendingError}];else if(a&&a.submission&&UM(a.submission.formMethod)){const c=await async function(t,n,a,c,d,u,h,p,m={}){$();const g=function(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}(n,c,d,a);if(K({navigation:g},{flushSync:!0===m.flushSync}),h){const e=await me(c,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){const{matches:t,route:n}=IM(l.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:_P.error,error:e.error}]}}const t=SM(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:_P.error,error:e.error}]}}if(!e.matches){const{notFoundMatches:e,error:t,route:r}=de(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:_P.error,error:t}]}}c=e.matches}let v;const f=HM(c,n);if(f.route.action||f.route.lazy){const e=gM(o,i,t,n,c,f,p?[]:r,u),a=await X(t,n,e,u,null);if(v=a[f.route.id],!v)for(const t of c)if(a[t.route.id]){v=a[t.route.id];break}if(t.signal.aborted)return{shortCircuited:!0}}else v={type:_P.error,error:NM(405,{method:t.method,pathname:n.pathname,routeId:f.route.id})};if(FM(v)){let n;return n=m&&null!=m.replace?m.replace:yM(v.response.headers.get("Location"),new URL(t.url),s,e.history)===E.location.pathname+E.location.search,await Q(t,v,!0,{submission:a,replace:n}),{shortCircuited:!0}}if(LM(v)){const e=SM(c,f.route.id);return!0!==(m&&m.replace)&&(A=FP.Push),{matches:c,pendingActionResult:[e.route.id,v,f.route.id]}}return{matches:c,pendingActionResult:[f.route.id,v]}}(v,n,a.submission,d,t,b,m.active,a&&!0===a.initialHydration,{replace:a.replace,flushSync:u});if(c.shortCircuited)return;if(c.pendingActionResult){const[e,t]=c.pendingActionResult;if(LM(t)&&AD(t.error)&&404===t.error.status)return k=null,void Y(n,{matches:c.matches,loaderData:{},errors:{[e]:t.error}})}d=c.matches||d,w=c.pendingActionResult,g=zM(n,d,t,a.submission),u=!1,m.active=!1,v=wM(e.history,v.url,v.signal)}const{shortCircuited:C,matches:T,loaderData:S,errors:R,workingFetchers:P}=await async function(t,n,a,c,d,u,h,p,m,g,v,f,b,y){const w=h||zM(n,a,c,p),C=p||m||WM(w),x=!D&&!v;if(u){if(x){const e=G(b);K({navigation:w,...void 0!==e?{actionData:e}:{}},{flushSync:f})}const e=await me(a,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){const{matches:t,route:n}=IM(l.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}const t=SM(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(!e.matches){const{error:e,notFoundMatches:t,route:r}=de(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}a=e.matches}const T=l.activeRoutes,{dsMatches:A,revalidatingFetchers:S}=eM(t,d,o,i,e.history,E,a,C,n,v?[]:r,!0===v,M,L,z,H,B,T,s,null!=e.patchRoutesOnNavigation,l.branches,b,y);if(V=++O,!e.dataStrategy&&!A.some(e=>e.shouldLoad)&&!A.some(e=>e.route.middleware&&e.route.middleware.length>0)&&0===S.length){const e=new Map(E.fetchers),t=oe(e);return Y(n,{matches:a,loaderData:{},errors:b&&LM(b[1])?{[b[0]]:b[1].error}:null,...AM(b),...t?{fetchers:e}:{}},{flushSync:f}),{shortCircuited:!0}}if(x){const e={};if(!u){e.navigation=w;const t=G(b);void 0!==t&&(e.actionData=t)}S.length>0&&(e.fetchers=function(e){const t=new Map(E.fetchers);return e.forEach(e=>{const n=t.get(e.key),r=_M(void 0,n?n.data:void 0);t.set(e.key,r)}),t}(S)),K(e,{flushSync:f})}S.forEach(e=>{re(e.key),e.controller&&F.set(e.key,e.controller)});const I=()=>S.forEach(e=>re(e.key));k&&k.signal.addEventListener("abort",I);const{loaderResults:N,fetcherResults:R}=await J(A,S,t,n,d);if(t.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",I),S.forEach(e=>F.delete(e.key));let P=RM(N);if(P)return await Q(t,P.result,!0,{replace:g}),{shortCircuited:!0};if(P=RM(R),P)return B.add(P.key),await Q(t,P.result,!0,{replace:g}),{shortCircuited:!0};const U=new Map(E.fetchers);let{loaderData:W,errors:_}=kM(E,a,N,b,S,R,U);v&&E.errors&&(_={...E.errors,..._});const j=oe(U),q=ie(V,U);return{matches:a,loaderData:W,errors:_,...j||q||S.length>0?{workingFetchers:U}:{}}}(v,n,d,t,b,m.active,g,a&&a.submission,a&&a.fetcherSubmission,a&&a.replace,a&&!0===a.initialHydration,u,w,a&&a.callSiteDefaultShouldRevalidate);C||(k=null,Y(n,{matches:T||d,...AM(w),loaderData:S,errors:R,...P?{fetchers:P}:{}}))}function G(e){return e&&!LM(e[1])?{[e[0]]:e[1].data}:E.actionData?0===Object.keys(E.actionData).length?null:E.actionData:void 0}async function Q(r,a,o,{submission:i,fetcherSubmission:l,preventScrollReset:c,replace:d}={}){o||(S?.resolve(),S=null),a.response.headers.has("X-Remix-Revalidate")&&(M=!0);let u=a.response.headers.get("Location");UP(u,"Expected a Location header on the redirect Response"),u=yM(u,new URL(r.url),s,e.history);const h=HP(E.location,u,{_isRedirect:!0});if(n){let e=!1;if(a.response.headers.has("X-Remix-Reload-Document"))e=!0;else if(pD(u)){const n=function(e,t,n=!1){let r="http://localhost";e&&(r="null"!==e.location.origin?e.location.origin:e.location.href),UP(r,"No window.location.(origin|href) available to create URL");let a="string"==typeof t?t:WP(t);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}(t,u,!0);e=n.origin!==t.location.origin||null==uD(n.pathname,s)}if(e)return void(d?t.location.replace(u):t.location.assign(u))}k=null;const p=!0===d||a.response.headers.has("X-Remix-Replace")?FP.Replace:FP.Push,{formMethod:m,formAction:g,formEncType:v}=E.navigation;!i&&!l&&m&&g&&v&&(i=WM(E.navigation));const f=i||l;if(jD.has(a.response.status)&&f&&UM(f.formMethod))await Z(p,h,{submission:{...f,formAction:u},preventScrollReset:c||I,enableViewTransition:o?N:void 0});else{const e=zM(h,[],p,i);await Z(p,h,{overrideNavigation:e,fetcherSubmission:l,preventScrollReset:c||I,enableViewTransition:o?N:void 0})}}async function X(e,t,n,r,a){let o;const i={};try{o=await async function(e,t,n,r,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));const i={request:t,url:CM(t,n),pattern:SD(r),params:r[0].params,context:o,matches:r},l=await e({...i,fetcherKey:a,runClientMiddleware:e=>{const t=i;return uM(t,()=>e({...t,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch(s){}return l}(c,e,t,n,a,r)}catch(l){return n.filter(e=>e.shouldLoad).forEach(e=>{i[e.route.id]={type:_P.error,error:l}}),i}if(e.signal.aborted)return i;if(!UM(e.method))for(const s of n){if(o[s.route.id]?.type===_P.error)break;o.hasOwnProperty(s.route.id)||E.loaderData.hasOwnProperty(s.route.id)||E.errors&&E.errors.hasOwnProperty(s.route.id)||!s.shouldCallHandler()||(o[s.route.id]={type:_P.error,result:new Error(`No result returned from dataStrategy for route ${s.route.id}`)})}for(const[c,d]of Object.entries(o))if(MM(d)){const t=d.result;i[c]={type:_P.redirect,response:fM(t,e,c,n,s)}}else i[c]=await vM(d);return i}async function J(e,t,n,r,a){const o=X(n,r,e,a,null),i=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){const t=(await X(e.request,e.path,e.matches,a,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:_P.error,error:NM(404,{pathname:e.path})}})}));return{loaderResults:await o,fetcherResults:(await i).reduce((e,t)=>Object.assign(e,t),{})}}function $(){M=!0,H.forEach((e,t)=>{F.has(t)&&L.add(t),re(t)})}function ee(e,t,n={}){const r=new Map(E.fetchers);r.set(e,t),K({fetchers:r},{flushSync:!0===(n&&n.flushSync)})}function te(e,t,n,r={}){const a=SM(E.matches,t),o=new Map(E.fetchers);ne(o,e),K({errors:{[a.route.id]:n},fetchers:o},{flushSync:!0===(r&&r.flushSync)})}function ne(e,t){const n=E.fetchers.get(t);!F.has(t)||n&&"loading"===n.state&&U.has(t)||re(t),H.delete(t),U.delete(t),B.delete(t),z.delete(t),L.delete(t),e.delete(t)}function re(e,t){const n=F.get(e);n&&(n.abort(t),F.delete(e))}function ae(e,t){for(const n of e){const e=t.get(n);UP(e,`Expected fetcher: ${n}`);const r=jM(e.data);t.set(n,r)}}function oe(e){const t=[];let n=!1;for(const r of B){const a=e.get(r);UP(a,`Expected fetcher: ${r}`),"loading"===a.state&&(B.delete(r),t.push(r),n=!0)}return ae(t,e),n}function ie(e,t){const n=[];for(const[r,a]of U)if(a<e){const e=t.get(r);UP(e,`Expected fetcher: ${r}`),"loading"===e.state&&(re(r),U.delete(r),n.push(r))}return ae(n,t),n.length>0}function le(e){E.blockers.delete(e),_.delete(e)}function se(e,t){const n=E.blockers.get(e)||YD;UP("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,`Invalid blocker state transition: ${n.state} -> ${t.state}`);const r=new Map(E.blockers);r.set(e,t),K({blockers:r})}function ce({currentLocation:e,nextLocation:t,historyAction:n}){if(0===_.size)return;_.size>1&&BP(!1,"A router only supports one blocker at a time");const r=Array.from(_.entries()),[a,o]=r[r.length-1],i=E.blockers.get(a);return i&&"proceeding"===i.state?void 0:o({currentLocation:e,nextLocation:t,historyAction:n})?a:void 0}function de(e){const t=NM(404,{pathname:e}),n=l.activeRoutes,{matches:r,route:a}=IM(n);return{notFoundMatches:r,route:a,error:t}}function ue(e,t){return b&&b(e,t.map(e=>XP(e,E.loaderData)))||e.key}function he(e,t){if(f){const n=ue(e,t),r=f[n];if("number"==typeof r)return r}return null}function pe(t,n,r){if(e.patchRoutesOnNavigation){const e=l.branches;if(!t)return{active:!0,matches:QP(n,r,s,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:QP(n,r,s,!0,e)}}return{active:!1,matches:null}}async function me(t,n,r,a){if(!e.patchRoutesOnNavigation)return{type:"success",matches:t};let c=t;for(;;){const t=i;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:c,fetcherKey:a,patch:(e,n)=>{r.aborted||aM(e,n,l,t,o,!1)}})}catch(d){return{type:"error",error:d,partialMatches:c}}if(r.aborted)return{type:"aborted"};const u=l.branches,h=QP(l.activeRoutes,n,s,!1,u);let p=null;if(h){if(0===Object.keys(h[0].params).length)return{type:"success",matches:h};if(p=QP(l.activeRoutes,n,s,!0,u),!(p&&c.length<p.length&&ge(c,p.slice(0,c.length))))return{type:"success",matches:h}}if(p||(p=QP(l.activeRoutes,n,s,!0,u)),!p||ge(c,p))return{type:"success",matches:null};c=p}}function ge(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}return g={get basename(){return s},get future(){return d},get state(){return E},get routes(){return l.stableRoutes},get branches(){return l.branches},get manifest(){return i},get window(){return t},initialize:function(){if(u=e.history.listen(({action:t,location:n,delta:r})=>{if(j)return j(),void(j=void 0);BP(0===_.size||null!=r,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");const a=ce({currentLocation:E.location,nextLocation:n,historyAction:t});if(a&&null!=r){const t=new Promise(e=>{j=e});return e.history.go(-1*r),se(a,{state:"blocked",location:n,proceed(){se(a,{state:"proceeding",proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){const e=new Map(E.blockers);e.set(a,YD),K({blockers:e})}}),S?.resolve(),void(S=null)}return Z(t,n)}),n){!function(e,t){try{const n=e.sessionStorage.getItem(GD);if(n){const e=JSON.parse(n);for(const[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch(n){}}(t,R);const e=()=>function(e,t){if(t.size>0){const r={};for(const[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(GD,JSON.stringify(r))}catch(n){BP(!1,`Failed to save applied view transitions in sessionStorage (${n}).`)}}}(t,R);t.addEventListener("pagehide",e),P=()=>t.removeEventListener("pagehide",e)}return E.initialized||Z(FP.Pop,E.location,{initialHydration:!0}),g},subscribe:function(e){if(h.add(e),v){const{newErrors:t}=v;v=null,e(E,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>h.delete(e)},enableScrollRestoration:function(e,t,n){if(f=e,y=t,b=n||null,!w&&E.navigation===qD){w=!0;const e=he(E.location,E.matches);null!=e&&K({restoreScrollPosition:e})}return()=>{f=null,y=null,b=null}},navigate:async function t(n,r){if(S?.resolve(),S=null,"number"==typeof n){S||(S=qM());const t=S.promise;return e.history.go(n),t}const a=JD(E.location,E.matches,s,n,r?.fromRouteId,r?.relative),{path:o,submission:i,error:l}=$D(!1,a,r);let c;r?.mask&&(c={pathname:"",search:"",hash:"",..."string"==typeof r.mask?zP(r.mask):{...E.location.mask,...r.mask}});const d=E.location;let u=HP(d,o,r&&r.state,void 0,c);u={...u,...e.history.encodeLocation(u)};const h=r&&null!=r.replace?r.replace:void 0;let p=FP.Push;!0===h?p=FP.Replace:!1===h||null!=i&&UM(i.formMethod)&&i.formAction===E.location.pathname+E.location.search&&(p=FP.Replace);const m=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,g=!0===(r&&r.flushSync),v=ce({currentLocation:d,nextLocation:u,historyAction:p});v?se(v,{state:"blocked",location:u,proceed(){se(v,{state:"proceeding",proceed:void 0,reset:void 0,location:u}),t(n,r)},reset(){const e=new Map(E.blockers);e.set(v,YD),K({blockers:e})}}):await Z(p,u,{submission:i,pendingError:l,preventScrollReset:m,replace:r&&r.replace,enableViewTransition:r&&r.viewTransition,flushSync:g,callSiteDefaultShouldRevalidate:r&&r.defaultShouldRevalidate})},fetch:async function(t,n,a,c){re(t);const d=!0===(c&&c.flushSync),u=l.activeRoutes,h=JD(E.location,E.matches,s,a,n,c?.relative);let p=QP(u,h,s,!1,l.branches);const m=pe(p,u,h);if(m.active&&m.matches&&(p=m.matches),!p)return void te(t,n,NM(404,{pathname:h}),{flushSync:d});const{path:g,submission:v,error:f}=$D(!0,h,c);if(f)return void te(t,n,f,{flushSync:d});const b=e.getContext?await e.getContext():new jP,y=!0===(c&&c.preventScrollReset);v&&UM(v.formMethod)?await async function(t,n,a,c,d,u,h,p,m,g){$(),H.delete(t);const v=E.fetchers.get(t);var f,b;ee(t,(b=v,{state:"submitting",formMethod:(f=m).formMethod,formAction:f.formAction,formEncType:f.formEncType,formData:f.formData,json:f.json,text:f.text,data:b?b.data:void 0}),{flushSync:h});const y=new AbortController,w=wM(e.history,a,y.signal,m);if(u){const e=await me(c,new URL(w.url).pathname,w.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void te(t,n,e.error,{flushSync:h});if(!e.matches)return void te(t,n,NM(404,{pathname:a}),{flushSync:h});c=e.matches}const C=HM(c,a);if(!C.route.action&&!C.route.lazy){const e=NM(405,{method:m.formMethod,pathname:a,routeId:n});return void te(t,n,e,{flushSync:h})}F.set(t,y);const x=O,T=gM(o,i,w,a,c,C,r,d),S=await X(w,a,T,d,t);let I=S[C.route.id];if(!I)for(const e of T)if(S[e.route.id]){I=S[e.route.id];break}if(w.signal.aborted)return void(F.get(t)===y&&F.delete(t));if(z.has(t)){if(FM(I)||LM(I))return void ee(t,jM(void 0))}else{if(FM(I))return F.delete(t),V>x?void ee(t,jM(void 0)):(B.add(t),ee(t,_M(m)),Q(w,I,!1,{fetcherSubmission:m,preventScrollReset:p}));if(LM(I))return void te(t,n,I.error)}const N=E.navigation.location||E.location,R=wM(e.history,N,y.signal),P=l.activeRoutes,D="idle"!==E.navigation.state?QP(P,E.navigation.location,s,!1,l.branches):E.matches;UP(D,"Didn't find any matches after fetcher action");const W=++O;U.set(t,W);const{dsMatches:_,revalidatingFetchers:j}=eM(R,d,o,i,e.history,E,D,m,N,r,!1,M,L,z,H,B,P,s,null!=e.patchRoutesOnNavigation,l.branches,[C.route.id,I],g),q=_M(m,I.data),Z=new Map(E.fetchers);Z.set(t,q),j.filter(e=>e.key!==t).forEach(e=>{const t=e.key,n=Z.get(t),r=_M(void 0,n?n.data:void 0);Z.set(t,r),re(t),e.controller&&F.set(t,e.controller)}),K({fetchers:Z});const G=()=>j.forEach(e=>re(e.key));y.signal.addEventListener("abort",G);const{loaderResults:ne,fetcherResults:ae}=await J(_,j,R,N,d);if(y.signal.aborted)return;y.signal.removeEventListener("abort",G),U.delete(t),F.delete(t),j.forEach(e=>F.delete(e.key));const oe=E.fetchers.has(t),le=e=>{if(!oe)return e;const n=new Map(e.fetchers);return n.set(t,jM(I.data)),{...e,fetchers:n}};let se=RM(ne);if(se)return E=le(E),Q(R,se.result,!1,{preventScrollReset:p});if(se=RM(ae),se)return B.add(se.key),E=le(E),Q(R,se.result,!1,{preventScrollReset:p});const ce=new Map(E.fetchers);oe&&ce.set(t,jM(I.data));const{loaderData:de,errors:ue}=kM(E,D,ne,void 0,j,ae,ce);ie(W,ce),"loading"===E.navigation.state&&W>V?(UP(A,"Expected pending action"),k&&k.abort(),Y(E.navigation.location,{matches:D,loaderData:de,errors:ue,fetchers:ce})):(K({errors:ue,loaderData:EM(E.loaderData,de,D,ue),fetchers:ce}),M=!1)}(t,n,g,p,b,m.active,d,y,v,c&&c.defaultShouldRevalidate):(H.set(t,{routeId:n,path:g}),await async function(t,n,a,l,s,c,d,u,h){const p=E.fetchers.get(t);ee(t,_M(h,p?p.data:void 0),{flushSync:d});const m=new AbortController,g=wM(e.history,a,m.signal);if(c){const e=await me(l,new URL(g.url).pathname,g.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void te(t,n,e.error,{flushSync:d});if(!e.matches)return void te(t,n,NM(404,{pathname:a}),{flushSync:d});l=e.matches}const v=HM(l,a);F.set(t,m);const f=O,b=gM(o,i,g,a,l,v,r,s),y=await X(g,a,b,s,t);let w=y[v.route.id];if(!w)for(const e of l)if(y[e.route.id]){w=y[e.route.id];break}if(F.get(t)===m&&F.delete(t),!g.signal.aborted){if(!z.has(t))return FM(w)?V>f?void ee(t,jM(void 0)):(B.add(t),void(await Q(g,w,!1,{preventScrollReset:u}))):void(LM(w)?te(t,n,w.error):ee(t,jM(w.data)));ee(t,jM(void 0))}}(t,n,g,p,b,m.active,d,y,v))},revalidate:function(){q||(q=qM()),$(),K({revalidation:"loading"});const e=q.promise;return"submitting"===E.navigation.state?e:"idle"===E.navigation.state?(Z(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),e):(Z(A||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:!0===N}),e)},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:function(e){return W.set(e,(W.get(e)||0)+1),z.has(e)&&z.delete(e),E.fetchers.get(e)||KD},resetFetcher:function(e,t){re(e,t?.reason),ee(e,jM(null))},deleteFetcher:function(e){const t=(W.get(e)||0)-1;t<=0?(W.delete(e),z.add(e)):W.set(e,t),K({fetchers:new Map(E.fetchers)})},dispose:function(){u&&u(),P&&P(),h.clear(),k&&k.abort(),E.fetchers.forEach((e,t)=>ne(E.fetchers,t)),E.blockers.forEach((e,t)=>le(t))},getBlocker:function(e,t){const n=E.blockers.get(e)||YD;return _.get(e)!==t&&_.set(e,t),n},deleteBlocker:le,patchRoutes:function(e,t,n=!1){aM(e,t,l,i,o,n),l.hasHMRRoutes||K({})},_internalFetchControllers:F,_internalSetRoutes:function(e){i={},l.setHmrRoutes(ZP(e,o,void 0,i))},_internalSetStateDoNotUseOrYouWillBreakYourApp(e){K(e)}},e.instrumentations&&(g=function(e,t){const n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){const t=Object.keys(e);for(const r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){const t=e.navigate[RD]??e.navigate,r=DD(n.navigate,t,(...t)=>{const[n,r]=t;return{to:"number"==typeof n||"string"==typeof n?n:n?WP(n):".",...FD(e,r??{})}});r&&(r[RD]=t,e.navigate=r)}if(n.fetch.length>0){const t=e.fetch[RD]??e.fetch,r=DD(n.fetch,t,(...t)=>{const[n,,r,a]=t;return{href:r??".",fetcherKey:n,...FD(e,a??{})}});r&&(r[RD]=t,e.fetch=r)}return e}(g,e.instrumentations.map(e=>e.router).filter(Boolean))),g}({basename:undefined,getContext:undefined,future:undefined,history:VP({initialEntries:undefined,initialIndex:undefined}),hydrationData:undefined,routes:eU,hydrationRouteProperties:["HydrateFallback","hydrateFallbackElement"],mapRouteProperties:function(e){const t={hasErrorBoundary:e.hasErrorBoundary||null!=e.ErrorBoundary||null!=e.errorElement};return e.Component&&Object.assign(t,{element:r.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:r.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:r.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t},dataStrategy:undefined,patchRoutesOnNavigation:undefined,instrumentations:undefined}).initialize());var eU;function tU(){return s(()=>()=>{$V.navigate(tF["/"].route)},[]),I(kL,{router:$V})}function nU(){return I(Kk,{children:I(tU,{})})}const rU=Pe("tight-component-store",1,{upgrade(e){e.createObjectStore("queryClient")}}),aU={queryClient:Lr,persister:/* @__PURE__ */function(e="reactQuery"){return{persistClient:async t=>{await async function(e,t){return(await rU).put("queryClient",t,e)}(e,t)},restoreClient:async()=>await async function(e){return(await rU).get("queryClient",e)}(e),removeClient:async()=>{await async function(e){return(await rU).delete("queryClient",e)}(e)}}}(),maxAge:Mr,dehydrateOptions:{shouldDehydrateQuery:e=>!e.isStale()}};function oU({children:e}){return I(De,{client:Lr,persistOptions:aU,children:e})}const iU=tr({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"}}),lU=tr({position:"fixed",inset:0,overflow:"hidden",boxSizing:"border-box",maxWidth:"100dvw",backgroundColor:"overlay",overscrollBehavior:{base:"contain",xl:"none"}}),sU=gr(null,lr.component,iU);function cU({children:e}){const t=a(null),n=a(null),r=wT();return m(()=>{const e=document.documentElement,t=e.style.overflow;return r&&(e.style.overflow="hidden"),()=>{e.style.overflow=t}},[r]),I(fe,{children:I(be,{lockScroll:!0,className:lU,children:I("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,dn.getState().requestCloseAllDrawers())},ref:t,"data-testid":"drawerContainer",...sU,children:e})})})}const dU=l({closingQueue:[],drawerHistory:[]});function uU({children:e}){const t=dn(e=>e.drawerHistory),n=dn(e=>e.closingQueue),r=o(()=>({drawerHistory:t,closingQueue:n}),[t,n]),a=t.length>0||n.length>0;return I(dU.Provider,{value:r,children:a&&I(cU,{children:e})})}const hU=l({isActive:!0,isClosing:!1});function pU({Component:e,name:t}){const{drawerHistory:n,closingQueue:r}=i(dU),a=n.at(-1);if(void 0===a&&0===r.length)return null;const o=n.find(e=>void 0!==e[t]),l=r.find(e=>void 0!==e[t]),s=void 0!==a?.[t],c=void 0!==l,d=(o&&o[t])??(l&&l[t]);return I(hU.Provider,{value:{isActive:s,isClosing:c},children:d&&I(e,{...d.routeProps})})}const mU=or({base:{position:"absolute",display:"flex",top:0,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"}},variants:{side:{right:{right:0,left:{base:0,sm:"auto"}},left:{left:0,right:{base:0,sm:"auto"}}},mobileCoverage:{full:{},partial:{width:{base:"80%"},minWidth:{base:"auto"}}}},defaultVariants:{side:"right",mobileCoverage:"full"}}),gU=tr({position:"absolute",right:0,top:0,width:1,minWidth:"100%",height:1,minHeight:"100%"});function vU({children:e,side:t="right",mobileCoverage:n="full"}){const r=a(null),{isActive:o,isClosing:l}=i(hU),{onExitAnimationEnd:c,onInitialAnimationComplete:h}=function({isActive:e,isClosing:t,focusRef:n}){const[r,a]=d(!0),o=u(()=>{dn.getState().confirmCloseDrawer()},[]),i=u(()=>{a(!1)},[a]);return s(()=>{r||!e||t||n.current?.focus()},[e,t,n,r]),{onExitAnimationEnd:o,onInitialAnimationComplete:i}}({isActive:o,isClosing:l,focusRef:r}),{context:p,refs:m}=re({open:o&&!l}),g=ve([r,m.setFloating]);return I(Ie,{onExitComplete:c,children:!l&&I(ye,{context:p,modal:!0,initialFocus:-1,children:R(Ne.div,{tabIndex:-1,ref:g,onAnimationComplete:()=>h(),transition:Sv,initial:Nv(t),animate:Iv,exit:Rv(t),...gr(lr.drawer,mU({side:t,mobileCoverage:n})),children:[e,!o&&I("div",{className:gU})]})})})}const fU=or({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 bU({background:e,children:t}){return I("div",{className:fU({background:e}),children:t})}const yU=Object.freeze({thumbs_up:"👍",thumbs_down:"👎",red_heart:"❤️",hundred_points:"💯",eyes:"👀"});function wU(e){return void 0!==yU[e]}function CU(e){return yU[e]}const xU=vi(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"),TU=tr({fontSize:"26px",lineHeight:"26px",width:"26px",userSelect:"none"});function kU({cldrShortName:e}){return I("div",{className:TU,children:CU(e)})}const EU=or({base:{padding:0,border:"none",outline:"none"},variants:{type:{sent:{cursor:"default"},received:{cursor:"pointer"}}}}),AU=tr({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 SU({reactions:e,type:t,handleClick:n}){return I("div",{className:AU,children:e.map((e,r)=>I("button",{className:EU({type:t}),onClick:"received"===t?()=>n(e.emojiCode):void 0,children:I(kU,{cldrShortName:e.emojiCode})},`${e.emojiCode}_${r}`))})}const IU=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:xi(n)};return await Ra(o)},NU=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:xi(n)};return await $g(o)};function RU(e,t,n){return Er(Es({id:e}),t,n)}async function PU(e){const t=Es({id:e});return ya("mutation successful, invalidating messages queries"),Lr.invalidateQueries({queryKey:t}).catch(e=>wa({error:e,severity:"error"}))}function DU(e,t,n){const r=[...e];return r[n]=t,r}const MU=tr({backgroundColor:"surface.elevated",borderRadius:"sm",borderWidth:"sm",borderColor:"border.layout",borderStyle:"solid",display:"flex",justifyContent:"center",alignItems:"center",padding:"8px",cursor:"pointer"}),LU=Object.keys(yU).filter(wU).map(e=>({emojiCode:e,authorInfo:[]}));function FU({conversationId:e,messageId:t,type:n,reactions:r,reactionIsOpen:a,setReactionIsOpen:o}){const{userId:l}=i(Qc),{mutate:s}=function(e){const{userId:t,userEmail:n}=i(Qc);return Xg({mutationFn:IU,meta:{toastOptions:{defaultErrorMessage:"Failed to react to message"}},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=RU(n,t,r);await Lr.cancelQueries({queryKey:i});const l=Lr.getQueryData(i);return Lr.setQueryData(i,t=>{const n=t.findIndex(t=>t.id===e.id);return-1===n?t:DU(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:()=>PU(e)})}(e);return R(Tc,{placement:"top-end",open:a,onOpenChange:o,blockInteraction:!0,children:[I(Ec,{children:e=>I("button",{className:MU,...e,children:I(Sd,{Component:xU})})}),I(Fc,{type:"reaction",children:I(SU,{reactions:LU,type:n,handleClick:e=>{r.some(t=>{const n=t.emojiCode===e,r=t.authorInfo.some(e=>e.userId===l);return n&&r})||(s({id:t,emojiCode:e}),o(!1))}})})]})}const OU=or({base:{position:"absolute",bottom:"-25px"},variants:{type:{sent:{right:"2px"},received:{left:"2px"}}}});function VU({reactions:e,type:t,handleClick:n}){const r=OU({type:t});return I("div",{className:r,children:I(SU,{reactions:e,handleClick:n,type:t})})}const UU=or({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}},hasReactionsOnMessage:{true:{marginBottom:"18px"}}}}),BU=or({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"}}}}),HU=tr({position:"relative",display:"flex",flexDirection:"column"});function WU({conversationId:e,messageId:t,sentByCurrentUser:n,children:r,reactions:o=[]}){const l=a(null),{isHover:c,setIsHover:u,reactionIsOpen:h,setReactionIsOpen:p}=function(e){const[t,n]=d(!1),[r,a]=d(!1);return s(()=>{if(null===o.current||!i||c)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,c=r,l=n]),{isHover:t,reactionIsOpen:r,setIsHover:n,setReactionIsOpen:a};var o,i,l,c}(l),{mutate:m}=function(e){const{userId:t}=i(Qc);return Xg({mutationFn:NU,meta:{toastOptions:{defaultErrorMessage:"Failed to delete reaction"}},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=RU(n,t,r);await Lr.cancelQueries({queryKey:o});const i=Lr.getQueryData(o);return Lr.setQueryData(o,t=>{const n=t.findIndex(t=>t.id===e.id),r=t[n];return sr(r)||0===r.reactions.length?t:DU(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:()=>PU(e)})}(e),g=n?"sent":"received",v=o.filter(e=>wU(e.emojiCode)),f=v.length>0,b="sent"===g?lr["message-sent"]:lr["message-received"],y=gr(lr[b],BU({type:g}));return R("div",{className:UU({type:g,hasReactionsOnMessage:f}),ref:l,onMouseEnter:()=>"received"===g&&u(!0),children:[R("div",{className:HU,children:[I("div",{...y,children:r}),f&&I(VU,{reactions:v,type:g,handleClick:e=>m({id:t,emojiCode:e})})]}),c&&I(FU,{conversationId:e,messageId:t,type:g,reactions:v,reactionIsOpen:h,setReactionIsOpen:p})]})}const zU=or({base:{display:"flex",alignItems:"center",gap:"10px"},variants:{type:{sent:{flexDirection:"row-reverse"},received:{flexDirection:"row"}}}}),_U=tr({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}),jU=tr({display:"flex",flexDirection:"column",gap:"4px",flex:1,minWidth:0}),qU=tr({textDecoration:"none",color:"inherit",cursor:"pointer"});function KU({sentByCurrentUser:e,attachment:t}){const{fileName:n,fileSize:r,url:a}=t,o=wT();return I("div",{className:zU({type:e?"sent":"received"}),children:I("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 wa({error:new Error("error while downloading attachment"),severity:"error",extraData:{error:e}}),window.open(a,"_blank","noopener,noreferrer")}},className:qU,children:R("div",{className:_U,children:[R("div",{className:jU,children:[I(sc,{children:n}),I(Eo,{children:`${r}`})]}),I(Sd,{Component:rO})]})})})}const YU=gr(null,tr({display:"flex",flexDirection:"column-reverse",justifyContent:"center",gap:"10px",alignSelf:"stretch"}));function ZU({children:e}){return I("div",{...YU,children:e})}const GU=gr(null,tr({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"})),QU=tr({minHeight:1,width:"100%"}),XU=p(function({children:e,activeKeyboard:t,setActiveKeyboard:n,inputRef:r},o){const i=a(null);t&&r?.current?.focus();const l=u(()=>{t&&cr(r?.current)&&(n(!1),r.current.blur())},[t,r,n]);return function(e,t,n){s(()=>{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,...GU,ref:i,children:[I("div",{className:QU,ref:o}),e]})}),JU=Object.freeze({message:{text:"",attachments:[]}}),$U=tr({width:"24px",height:"24px",objectFit:"contain"});function eB({iconUrl:e,fileName:t}){return I("img",{src:e,alt:`${t} icon`,className:$U})}const tB=tr({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"}),nB=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"}),rB=tr({display:"grid",flexDirection:"column",minWidth:0}),aB="LOADING",oB="LOADED",iB="ERROR";function lB({attachment:e,onRemove:t}){const n=e.hasError?iB:e.isPending?aB:oB;return R("div",{className:tB,onClick:()=>{var t;e.publicFileUrl&&(t=e.publicFileUrl,window.open(t,"_blank","noopener,noreferrer"))},style:{cursor:e.publicFileUrl?"pointer":"default"},children:[R("div",{className:nB,children:[e.iconUrl&&I(eB,{iconUrl:e.iconUrl,fileName:e.displayFileName}),R("div",{className:rB,children:[I(sc,{children:e.displayFileName}),n===aB&&e.displayText&&I(Eo,{accent:"strongest",children:e.displayText}),n===oB&&e.fileSize&&I(Eo,{children:e.fileSize}),n===iB&&I(Eo,{intent:"danger",wrap:"wrap",children:e.displayText})]})]}),!e.isPending&&I(zc,{onClick:async n=>{n.stopPropagation(),await ih({title:"Remove Attachment?",body:"Are you sure you want to remove this attachment?",buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Remove",type:oh.DANGER}]})===ju&&t(e)},children:I(cl,{Component:Ac})})]})}const sB=tr({width:"100%"});function cB({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:vb({defaultValues:t??JU,onSubmit:t=>{gm.safeParse(t.value).success&&(e(t),t.formApi.reset())}})}}({onSubmit:t,defaultValues:s}),d=a(null),h=u(e=>{c.setFieldValue("message",t=>({...t,attachments:[...t.attachments,...e]}))},[c]),p=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.map(t=>e.find(e=>e.localId===t.localId)||t)}))},[c]),{mutate:m}=Dh({mutationFn:dm,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Lr.invalidateQueries({queryKey:["files/attachments"]}),await Lr.invalidateQueries({queryKey:["conversations"]})}}),g=u(e=>{c.setFieldValue("message",t=>({...t,attachments:t.attachments.filter(t=>t.localId!==e.localId)})),null!==e.id&&m({id:e.id})},[c,m]);return I("form",{className:sB,ref:d,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,d.current,n,r),onSubmit:e=>{if(!n)return e.preventDefault(),e.stopPropagation(),c.handleSubmit()},children:I(c.Subscribe,{selector:e=>e.values.message.attachments,children:e=>R(N,{children:[e.map(e=>I(lB,{attachment:e,onRemove:g},e.localId)),I(c.AppField,{name:"message",children:t=>I(t.MessageAreaInput,{blockSubmit:n,scrollRef:o,setActiveKeyboard:i,ref:l,onFileSelect:h,onUploadComplete:p,hideFileUpload:e.length>=5})})]})})})}function dB(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 uB(){const e=["conversations/messages"],t=["tasks"],n=["conversations"];return ya("mutation successful, invalidating messages queries"),Promise.all([Lr.invalidateQueries({queryKey:e}),Lr.invalidateQueries({queryKey:t}),Lr.invalidateQueries({queryKey:n})]).catch(e=>wa({error:e,severity:"error"}))}const hB=async({data:e,accessToken:t,environment:n})=>(async({data:e,accessToken:t,environment:n})=>Fl({data:{data:e},accessToken:t,environment:n}))({data:[e],accessToken:t,environment:n}),pB=async({data:e,accessToken:t,environment:n})=>Fl({data:{data:[e]},accessToken:t,environment:n}),mB=tr({minHeight:"{borderWidths.lg}",maxHeight:"{borderWidths.lg}",width:"100%",backgroundColor:"border.layout",flex:"1 1 0",display:"flex"}),gB=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:5,paddingLeft:15,paddingRight:15}),vB=tr({wordBreak:"break-word",maxWidth:250,textAlign:"center"}),fB="Marked As Resolved";function bB({resolver:e}){const t=e?`${e} ${fB}`:fB;return R("div",{className:gB,children:[I("div",{className:mB}),I("div",{className:vB,children:t}),I("div",{className:mB})]})}const yB=or({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 wB({width:e="md",height:t="md"}){return I(Xo,{styles:yB({width:e,height:t})})}const CB=tr({display:"flex",flexDirection:"row-reverse"});function xB(){return R(N,{children:[I(wB,{width:"lg",height:"lg"}),I("div",{className:CB,children:I(wB,{width:"md",height:"lg"})}),I("div",{className:CB,children:I(wB,{width:"lg",height:"xl"})}),I(wB,{width:"md",height:"lg"})]})}const TB=tr({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px"});function kB({isConversationLoading:e,isFilling:t,message:n}){return e?n?I(ZU,{children:I(WU,{conversationId:"",messageId:"",sentByCurrentUser:!0,children:n})}):null:!e&&t?I(ZU,{children:I(xB,{})}):R("div",{className:TB,children:[I(To,{textAlign:"center",wrap:"wrap",children:"Send your bookkeeper a message"}),I(sc,{wrap:"wrap",alignment:"center",children:"Typical response time is within one business day"})]})}const EB=gr(null,tr({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 AB({conversationId:e,setConversationId:t,isResolved:n,isUnread:r,isMobile:o=!1,attachedEntityId:l,defaultValues:c,defaultSubject:u}){const{userId:h}=i(Qc),{mutate:p}=function(){const{userId:e}=i(Qc);return Xg({mutationFn:Is,meta:{toastOptions:{defaultErrorMessage:"Failed to send message"}},onMutateFn:({data:t,accessToken:n,environment:r})=>async function({data:e,accessToken:t,environment:n,userId:r}){const a=Er(Es({id:e.conversationId}),t,n);await Lr.cancelQueries({queryKey:a});const o=Lr.getQueryData(a);return Lr.setQueryData(a,t=>[dB(e,r),...t]),{oldMessages:o}}({data:t,accessToken:n,environment:r,userId:e}),onSettled:uB})}(),{query:{data:m},isFilling:g}=function(e){const t=cr(e);return Vr({queryKey:Es({id:e??""}),queryFn:Ss,select:As,enabled:t})}(e),{mutate:v,isPending:f,variables:b}=(k=t,E=l,Xg({mutationFn:pB,meta:{toastOptions:{defaultErrorMessage:"Failed to create conversation"}},onSuccess:e=>{const t=e.data?.[0]?.data?.id;if(sr(e)||sr(t))return;k(t);const n=["conversations"],r=["banks/transactions",{}],a=["summaries",{}];let o=async()=>{},i=async()=>{};if(cr(E)){const e={id:E};ls(E,is.BANK_TRANSACTION)?o=async()=>{const t=bs(e);return await Lr.invalidateQueries({queryKey:t})}:ls(E,is.FINANCIAL_SUMMARY)&&(i=async()=>await Lr.invalidateQueries({queryKey:a}))}return ya("mutation successful, invalidating conversation, bank transaction, financial summary, and message queries"),Promise.all([Lr.invalidateQueries({queryKey:n}),Lr.invalidateQueries({queryKey:r}),o(),i()]).catch(e=>wa({error:e,severity:"error"}))}})),{mutate:y}=Xg({mutationFn:hB,meta:{toastOptions:{defaultErrorMessage:"Failed to mark conversation as read"}},onSuccess:async()=>{const e=["conversations"],t=["tasks"];return ya("mutation successful, invalidating conversations queries"),Promise.all([Lr.invalidateQueries({queryKey:e}),Lr.invalidateQueries({queryKey:t})]).catch(e=>wa({error:e,severity:"error"}))}}),[w,C]=d(!1),x=a(null),T=a(null);var k,E;s(()=>{n&&r&&e&&y({id:e,readStatus:"READ"})},[n,r,e,y]),s(()=>{Jp(T)},[m,T]);const A=sr(e)||sr(m)||g;return R(N,{children:[A?I(XU,{ref:T,inputRef:x,activeKeyboard:w,setActiveKeyboard:C,children:I(kB,{isConversationLoading:f,isFilling:g,message:b?.message?.text})}):R(XU,{ref:T,activeKeyboard:w,setActiveKeyboard:C,inputRef:x,children:[n&&I(bB,{resolver:"Conversation"}),m.map((t,n)=>{const r=t[0].author.userId===h;return I(ZU,{children:t.map(t=>R(N,{children:[t.attachments.filter(e=>!sr(e)).map(e=>I(KU,{sentByCurrentUser:r,attachment:e},e?.id)),t.text&&I(WU,{conversationId:e,messageId:t.id,sentByCurrentUser:r,reactions:t.reactions,children:t.text},t.id)]}))},n)})]}),I("div",{...EB,children:I(cB,{scrollRef:T,inputRef:x,conversationId:e,blockSubmit:f,isMobile:o,addMessage:({value:t})=>{const{text:n,attachments:r}=t.message,a=n.trim(),o=r.filter(e=>null!==e.id&&!e.isPending),i=o.map(e=>`att_${e.id}`),s=a.length>0,c=i.length>0;if(s||c)if(sr(e)){const e=function(e,t,n){let r="";return cr(e)?r=e:t.length>0?r=t:void 0!==n&&(r=n),r.slice(0,40)}(u,a,o[0]?.displayFileName),t=(d=a,h=i,{subject:e,status:"ACTIVE",readStatus:"READ",resolutionStatus:"OPEN",...cr(m=l)&&{attachedEntityId:m},message:{text:d,...h.length>0&&{attachmentIds:h}}});v(t)}else p({conversationId:e,text:a,...c&&{attachmentIds:i}});var d,h,m},setActiveKeyboard:C,defaultValues:c})})]})}function SB({conversationId:e,attachedEntityId:t,defaultSubject:n}){const[r,a]=d(e),{query:{data:o}}=Ll(r),i="CLOSED"===o?.resolutionStatus;return R(bU,{children:[I(Hv,{}),I(AB,{conversationId:r,setConversationId:a,isResolved:i,isUnread:"UNREAD"===o?.readStatus,attachedEntityId:t,defaultSubject:n})]})}const IB=gr(lr["form-body"],tr({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 NB({children:e}){return I("div",{...IB,tabIndex:-1,children:e})}const RB=gr(null,tr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1})),PB=gr(null,tr({display:"flex",flexDirection:"column",flex:1,backgroundColor:"surface.background",maxHeight:"100%"})),DB=tr({maxWidth:1,width:1,display:"flex",flexGrow:1,backgroundColor:"border.layout.strong"}),MB=e=>{kp(e),Ep(e)},LB=({children:e,onSubmit:t,Header:n,Footer:r,activeTab:o,conversationId:l,transactionId:c,transaction:d})=>{const{isClosing:u}=i(hU),h=a(d);s(()=>{h.current=d},[d]);const p=a(!1);return s(()=>{if(!u||p.current)return;p.current=!0;const{events:e}=dn.getState(),t=h.current;cr(t)&&(ls(t.id,is.BANK_TRANSACTION)?ds(e.transactionForm,{type:"CLOSE_BANK_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}):ds(e.transactionForm,{type:"CLOSE_PROCESSOR_TRANSACTION_FORM",result:"SUCCESS",data:t,error:null}))},[u]),I(vU,{children:R("div",{...RB,children:[I(bU,{children:R("form",{onSubmit:e=>{e.preventDefault(),t()},onKeyDown:MB,...PB,children:[n,I(NB,{children:e}),r]})}),null!==o&&I("div",{className:DB}),"conversation"===o&&c&&I(SB,{conversationId:l,attachedEntityId:c,defaultSubject:d?.description})]})})},FB=[{value:"Q1",label:"Q1"},{value:"Q2",label:"Q2"},{value:"Q3",label:"Q3"},{value:"Q4",label:"Q4"}],OB=["FEDERAL","STATE","SALES"],VB=["Q1","Q2","Q3","Q4"],UB=[{value:"FEDERAL",name:"Federal/Self-Employed Income Tax"},{value:"STATE",name:"State Income Tax"},{value:"SALES",name:"Sales Tax"}];function BB(e){if(!sr(e))return UB.find(t=>t.value===e)?.name}const HB=S.object({id:S.string(),type:S.enum(Object.values({EXPENSE:"EXPENSE",REVENUE:"REVENUE",BANK_TRANSFER:"BANK_TRANSFER",TAX_PAYMENT:"TAX_PAYMENT"})),reviewStatus:S.enum(Object.values(Di)),amount:S.number({message:"Required"}).refine(e=>0!==e,{message:"Amount must not be 0"}),date:S.string("Required").refine(e=>(function(e,t){const n=rt(e.getFullYear(),e.getMonth(),e.getDate()),r=rt(t.getFullYear(),t.getMonth(),t.getDate());return n.getTime()<r.getTime()}(new Date(e),/* @__PURE__ */new Date)||Tt(new Date(e),/* @__PURE__ */new Date))&&Et(new Date(e),/* @__PURE__ */new Date("2000-01-01")),{message:"Invalid date"}),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),frequency:S.union([S.object({name:S.string(),value:S.enum(["ONE_TIME","WEEKLY","MONTHLY","YEARLY"])}),S.undefined()]),category:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).nullable(),dimensionValues:S.array(S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).optional()),bankAccount:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}),notes:S.string().nullable(),itemizedByOptions:S.object({category:S.boolean(),customer:S.boolean()}).optional(),attachments:S.array(mm)}),WB=S.object({id:S.string(),name:S.string().optional(),requiredness:S.enum(["REQUIRED","NOT_REQUIRED"]).optional()}),zB=S.object({id:S.string(),name:S.string().optional(),dimension:WB.optional()}),_B=zB.extend({child:zB.optional()}),jB=S.object({id:S.string().optional(),lineItemType:S.literal("itemized"),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).optional(),dimensionValues:S.array(_B),customer:S.object({id:S.string(),name:S.string().optional()}).nullable(),amount:S.number()}),qB=S.object({lineItemType:S.literal("invoice"),amount:S.number().nullable(),invoice:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),KB=S.object({lineItemType:S.literal("bill"),amount:S.number().nullable(),bill:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string()})}),YB=S.object({lineItemType:S.literal("fee"),amount:S.number()}),ZB=S.object({lineItemType:S.literal("payment"),amount:S.number(),payment:S.object({id:S.string(),amount:S.number(),date:S.string(),name:S.string(),bankAccount:S.object({id:S.string(),displayName:S.string()})})}),GB=S.discriminatedUnion("lineItemType",[jB,qB,YB,KB,ZB]),QB=HB.extend({children:S.array(GB),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}).nullable()});QB.extend({tax:S.object({paymentInfo:S.object({region:S.enum(OB).optional(),year:S.number().optional(),quarter:S.enum(VB).optional()}).nullable().optional()}).optional()});const XB=HB.extend({id:S.string(),type:S.literal(Object.values(mw)),description:S.string(),displayName:S.string(),iconUrl:S.string(),status:S.literal(Object.values(NN)),reviewStatus:S.literal(Object.values(Di)),apiName:S.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:S.string().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()},{message:"Required"}),customer:S.object({id:S.string(),name:S.string().optional(),email:S.string().optional()}).nullable(),vendor:S.object({id:S.string(),name:S.string().optional()}).nullable(),invoice:S.object({id:S.string(),name:S.string(),date:S.string(),lineItems:S.array(S.object({id:S.string(),amount:S.number()}))}).nullable(),bill:S.object({id:S.string(),name:S.string().optional()}).nullable(),payroll:S.object({id:S.string(),date:S.string().optional(),checkDate:S.string().optional(),description:S.string().optional()}).nullable(),apiItemId:S.string().nullable()}),JB=S.looseObject({amount:S.number().nullable(),category:S.object({id:S.string(),name:S.string().optional()}).nullable(),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),$B=S.object({children:S.array(JB),itemizeByOptions:S.record(S.string(),S.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"]})})}),eH=QB.extend({type:S.literal("EXPENSE"),vendor:S.object({id:S.string(),name:S.string().optional()},{message:"Required"}).refine(e=>""!==e.id,{message:"Required"}).nullable(),category:S.object({id:S.string(),name:S.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&&Ir(t)}(t,e.value.category?.id)&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["category"]})}),tH=QB.extend({type:S.literal("BANK_TRANSFER"),reconciliationMatch:S.object({id:S.string(),description:S.string().optional(),amount:S.number().optional(),date:S.string().optional(),apiInstitutionId:S.string().nullable().optional(),apiName:S.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!!sr(t)||t===-n},{message:"Transfer amount must be the opposite of the matching bank transaction amount",path:["reconciliationMatch"],when:e=>tH.pick({amount:!0,reconciliationMatch:!0}).safeParse(e.value).success}),nH=XB.extend({}),rH=S.looseObject({amount:S.number().nullable(),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.string().optional()}),customer:S.object({id:S.string(),name:S.string().optional()}).nullable()}),aH=S.object({children:S.array(rH),itemizeByOptions:S.record(S.string(),S.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"]})})}),oH=QB.extend({type:S.literal("REVENUE"),glAccount:S.object({id:S.string(),name:S.string().optional(),accountNo:S.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 iH(e){return e.reduce((e,t)=>new H(e).plus(t??0).toNumber(),0)}function lH(e,t){const n=new H(e).times(100).round(0),r=new H(t).times(100).round(0);return!n.eq(r)}function sH(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(Ir(e))continue;const t=n.get(e);void 0!==t&&(o[t]&&!r.has(e)||(o[t]=i))}return o}function cH(e,t){return e.filter(e=>e.dimension?.id===t).map(e=>[e,...e.children])}function dH(e){return{id:e.id,name:e.name,dimension:e.dimension.id?{...e.dimension,id:e.dimension.id}:void 0}}function uH(e){return e.length>0&&e.every(e=>"itemized"===e.lineItemType)}function hH(e){return"EXPENSE"!==e.type||sr(e.tax?.paymentInfo)?"TRANSFER_OUT"===e.type||"TRANSFER_IN"===e.type?"BANK_TRANSFER":e.type:"TAX_PAYMENT"}function pH(e,t,n){if(e(t))return n}const mH={EXPENSE:"Manual Expense",REVENUE:"Manual Income",BANK_TRANSFER:"Manual Bank Transfer",TAX_PAYMENT:"Manual Tax Payment"};function gH(e){return Ir(e)?void 0:e}function vH(e,t,n){const r=(e,t)=>pH(n,e,t),a=r("children",e.children.map(e=>function(e){switch(e.lineItemType){case"invoice":return{id:gH((t=e).id),invoiceId:t.invoice.id};case"itemized":return function(e){return{id:gH(e.id),amount:e.amount?ch(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:gH(e.id),amount:ch(e.amount)}}(e);case"bill":return function(e){return{id:gH(e.id),billId:e.bill.id}}(e);case"payment":return function(e){return{id:gH(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?ch(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=>!sr(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 sr(t)?e:{...e,glAccountId:ss({id:t,prefix:"GL_ACCOUNT"})}});return sr(r)?sr(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 fH(e=null){const{mutateAsync:t}=sC(),{mutateAsync:n}=dC({mutationFn:rC,meta:{toastOptions:{defaultSuccessMessage:"Transaction saved",defaultErrorMessage:"Couldn't save transaction"}}}),{query:{data:r}}=vx();return async(a,o,i)=>{const l=r?.data??[];var s,c;e?(await t(function(e,t,n,r){return{...vH(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()):await n((s=a,c=l,{...vH(s,c,()=>!0),amount:s.amount?ch(s.amount):0,date:s.date,bankAccountId:s.bankAccount.id,description:s.vendor?.name||mH[s.type]||"Manual Entry",apiName:"MANUAL_ENTRY"}))}}const bH=QB.extend({type:S.literal("TAX_PAYMENT"),tax:S.object({paymentInfo:S.object({region:S.enum(OB,{message:`Tax region must be one of: ${OB.join(", ")}`}),quarter:S.enum(VB,{message:"Required"}),year:S.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: ${OB.join(", ")}`}),t.addIssue({path:["tax","paymentInfo","year"],code:"custom",message:"Tax year is required"}))});function yH(){const e=a(!0);return s(()=>(e.current=!0,()=>{e.current=!1}),[]),u(()=>{e.current&&as()},[])}const wH={id:"",type:"EXPENSE",reviewStatus:"USER_REVIEW_REQUIRED",amount:0,category:{id:"",name:""},bankAccount:{id:"",name:""},glAccount:{id:"",name:"",accountNo:""},date:Rt(/* @__PURE__ */new Date),vendor:{id:"",name:""},customer:null,frequency:ms[0],notes:null,dimensionValues:[],children:[],reconciliationMatch:null,tax:{paymentInfo:null},attachments:[]};function CH(e){const t=/* @__PURE__ */new Map;for(const n of e){if(sr(n.bill)||!sr(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 xH(e){const t=/* @__PURE__ */new Map;for(const n of e){if(sr(n.invoice)||!sr(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 TH(e){const t=/* @__PURE__ */new Map;for(const n of e){if(sr(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 kH(e,t){const n=t?.get(e.glAccount?.id||"");return void 0!==n&&"MERCHANT_FEE"===n.expenseType}function EH(e,t){const n=function(e,t){const n=/* @__PURE__ */new Set;e.forEach(e=>{(sr(e.paymentId)&&sr(e.bill)&&sr(e.invoice)||kH(e,t))&&n.add(e.id)});const r=e.filter(e=>!n.has(e.id)),a=e.filter(e=>n.has(e.id));return[...CH(r),...xH(r),...TH(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=>!(sr(e.invoice)&&sr(e.payroll)&&sr(e.bill)&&sr(e.paymentId)));var o,i;return r.map(e=>function(e,t,n){return sr(e.paymentId)||kH(e,n)?t&&kH(e,n)?(r=e,{...r,lineItemType:"fee",amount:sh(r.amount)}):sr(e.invoice)?sr(e.bill)?function(e){return{...e,lineItemType:"itemized",amount:sh(e.amount),dimensionValues:e.dimensionValues.flatMap(e=>e?.id?[{...e,id:e.id,child:e.child??void 0}]:[])}}(e):function(e){return sr(e.bill)?{bill:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"bill"}:{lineItemType:"bill",amount:sh(e.amount),bill:{id:e.bill.id,date:e.date,name:e.bill.name??"",amount:sh(-e.amount)}}}(e):function(e){if(e.invoice){const t=e.invoice;return{lineItemType:"invoice",amount:sh(e.amount),invoice:{id:t.id,name:t.name??"",date:t.date??"",amount:sh(e.amount)}}}return{invoice:{amount:0,date:"",id:"",name:""},amount:0,lineItemType:"invoice"}}(e):function(e,t){const n=sh(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 AH({value:e}){return{fields:SH(function(e){switch(e){case"EXPENSE":return eH;case"TAX_PAYMENT":return bH;case"BANK_TRANSFER":return tH;case"REVENUE":return oH}}(e.type).safeParse(e))}}function SH(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 IH(e,t,n){const r=fH(e),{query:{data:a}}=mC({select:e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{t.set(e.id,e)}),t}}),o=yH(),i=e?(s=t,c=a,{id:(l=e).id,type:hH(l),reviewStatus:l.reviewStatus,amount:sh(l.amount),category:l.category,date:l.date,vendor:l.vendor,customer:l.customer,frequency:l.frequency,bankAccount:l.bankAccount,glAccount:l.glAccount,notes:l.notes,dimensionValues:sH(l.dimensionValues,s),children:EH(l,c),reconciliationMatch:l.reconciliationMatch?{...l.reconciliationMatch,amount:sh(l.reconciliationMatch.amount??0)}:void 0,tax:l.tax,attachments:l.attachments?l.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{...wH,type:e,dimensionValues:new Array(t.dimensionFieldCount).fill(void 0)}}(n,t);var l,s,c;return vb({defaultValues:i,canSubmitWhenInvalid:!0,validators:{onBlur:AH,onSubmit:AH},onSubmit:async e=>(await r(e.value,e.formApi.state.fieldMeta,()=>e.formApi.reset(e.value,{keepDefaultValues:!0})),o()),onSubmitInvalid:()=>{}})}function NH({onClick:e}){return I(lN,{Icon:AN,onClick:e,closeOnClick:!0,children:"Archive"})}function RH({onClick:e}){return I(lN,{onClick:e,closeOnClick:!0,children:"Restore"})}function PH(e){return u(async t=>{e.baseStore.setState(e=>({...e,isSubmitting:!0}));try{await t()}finally{e.baseStore.setState(e=>({...e,isSubmitting:!1}))}},[e])}const DH=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"})),MH=vi(DH,"Bill");function LH({onClick:e,error:t,validate:n}){return I(hp,{onSave:()=>{(void 0===n||n())&&e()},error:t})}const FH=tr({display:"flex",flexDirection:"column",width:"100%"}),OH=gr(lr["value-comparison-summary"],tr({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",padding:"16px",backgroundColor:"surface.foreground",border:"1px solid {colors.border.layout}",borderRadius:"sm"})),VH=tr({display:"flex",flexDirection:"column",gap:"8px"});function UH({selectedAmount:e,transactionTotal:t,transactionTypeLabel:n,selectedAmountSignage:r="off"}){return I("div",{className:FH,children:R("div",{...OH,children:[R("div",{className:VH,children:[I(sc,{intent:"weak",children:"Selected Total"}),I(To,{children:Co(sh(e),r)})]}),R("div",{className:VH,children:[I(sc,{intent:"weak",children:`${n} Total`}),I(To,{children:yo(t)})]})]})})}const BH=tr.raw({padding:0,outline:"none",border:"none",backgroundColor:"transparent"}),HH=gr(null,tr({color:"icon.base"}));function WH({searchTerm:e,onChange:t,isFetching:n,placeholder:r}){const{inputValue:a,onChangeInputValue:o,isDebounced:i}=DT({debouncedValue:e,onChangeDebouncedValue:t}),l=n||i;return I("div",{className:Zv,children:R("div",{...Gv,children:[l?I(np,{}):I(Sd,{stylists:[HH],Component:Yv}),I("input",{className:Qv,value:a,onChange:e=>o(e.target.value),placeholder:r,onKeyDown:Ep}),Nr(e)&&I(Xs,{styles:BH,onClick:()=>o(""),children:I(Sd,{Component:Ac})})]})})}const zH=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"});function _H({searchTerm:e,onChange:t,isFetching:n,searchPlaceholder:r}){return R("div",{className:zH,children:[I(sc,{intent:"weak",children:"Search"}),I(WH,{searchTerm:e,onChange:t,isFetching:n,placeholder:r})]})}function jH(e,t,n){return`${e} | ${At(Nt(t))} | ${yo(sh(n))}`}const qH=gr(lr["linked-entity-row"],tr({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"}})),KH=tr({display:"flex",alignItems:"center",gap:"9px",flex:"1 0 0",minWidth:0}),YH=gr(null,tr({color:"icon.base"}));function ZH({amount:e,name:t,date:n,icon:r,isSelected:a,onToggle:o}){return R("button",{type:"button",...qH,onClick:o,children:[R("div",{className:KH,children:[I(Sd,{stylists:[YH],Component:r}),I(sc,{wrap:"wrap",children:jH(t,n,e)})]}),I(uf,{selected:a,showEmptyIndicator:!0})]})}const GH={root:null,threshold:1};function QH({enable:e,onIntersect:t}){const n=function({onIntersect:e,enable:t}){const n=a(null),r=t??!0,o=u(t=>{t[0].isIntersecting&&r&&e()},[e,r]);return s(()=>{const e=new IntersectionObserver(o,GH);return n?.current&&e.observe(n.current),()=>{e&&e.disconnect()}},[o]),n}({onIntersect:t,enable:e});return I("div",{ref:n})}function XH({listLabel:e,glSourceList:t,icon:n,isFetching:r,fetchNextPage:a,hasNextPage:o,pluralNoun:i,singularNoun:l}){return I(N,{children:t.groups.map(t=>R(hS,{label:e,singularLabel:l,pluralLabel:i,zeroState:0===t.getRows().length,children:[t.getRows().map(e=>I(ZH,{icon:n,isSelected:e.getIsSelected(),onToggle:()=>e.toggleSelected(!e.getIsSelected()),name:e.value.name,amount:e.value.amount,date:e.value.date},e.key)),I(QH,{onIntersect:a,enable:!r&&o})]},t.key))})}function JH(e){return vo(e,{cents:"always",dollarSign:!0})}function $H(e){return JH(Math.abs(e))}function eW({title:e,body:t}){return ih({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 tW(e,t,n){const r=$H(e);return`The selected bills total of ${$H(t)} is less than the expense total of ${r}. Was there a fee of ${$H(n)}?`}const nW=tr(Uv,{padding:16,maxWidth:{base:"100%",sm:"512px"}});function rW({children:e}){return I("div",{className:nW,children:e})}function aW({transactionTotal:e,bills:t,previouslySelected:n,onSubmit:r,fetchNextPage:a,hasNextPage:i,isFetching:l,isFetchingNextPage:s,searchTerm:c,onSearchChange:u}){const[h,p]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[m,g]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),v=o(()=>new Set(n.map(e=>e.id)),[n]),f=o(()=>Sr(c)?[...n,...t.filter(e=>!v.has(e.id))]:t,[c,n,t,v]),b=ef({data:[f],getRowKey:e=>e.id,getGroupKey:()=>"bills",onSelectedChange:e=>{p(e),g(t=>{const n={...t},r=f.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:h}}),y=Object.entries(h).filter(([,e])=>e).map(([e])=>m[e]),w=y.reduce((e,t)=>e+t.amount,0),C=l&&!s;return I(qv,{title:"Link Bill",Footer:I(LH,{onClick:()=>{const t=new H(w).div(100).times(-1).toNumber(),n=new H(e).sub(t).toNumber();t>e&&y.length>0?function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return eW({title:"Bill Payment",body:tW(n,e,t)})}({selectedTotal:t,transactionTotal:e,suggestedFee:n}).then(e=>{let t=0;"FEE"===e&&(t=n),r(y,t)}).catch(()=>{}):r(y,0)}}),padChildren:!1,children:R(rW,{children:[I(UH,{selectedAmount:w,transactionTotal:e,transactionTypeLabel:"Expense"}),I(_H,{searchTerm:c,onChange:u,isFetching:C,searchPlaceholder:"Search bills..."}),I(XH,{listLabel:"Bills",glSourceList:b,icon:MH,fetchNextPage:a,hasNextPage:i,isFetching:l,pluralNoun:"bills",singularNoun:"bill"})]})})}const oW=e=>["bills/bills","infinite",e??{}],iW=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:xi(n)},o=await Ra(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})},lW=[];function sW(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 cW(e){const t={status:{equal:"ACTIVE"},billStatus:{in:["OPEN"]}};return sr(e)||(t.search=e),t}function dW(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=(s={sort:(c=e.transactionDate,{orderBy:"DATE_PROXIMITY",direction:"ASC",value:c}),limit:10,filter:cW(t)},Hg({queryFn:iW,queryKey:oW(s)}));var s,c;const u=(r?.pages??lW).flatMap(e=>(e.data??[]).map(sW));return I(aW,{...e,bills:u,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function uW(e){const t=kc();return I(Ov,{children:t.open&&I(dW,{...e})})}function hW(e){return{lineItemType:"fee",amount:e}}function pW(e){return{lineItemType:"bill",amount:sh(-e.amount),bill:{id:e.id,amount:sh(e.amount),date:e.date,name:e.name}}}function mW(e){return e.map(pW)}function gW(e,t){const n=t.find(t=>e!==t.lineItemType&&"fee"!==t.lineItemType);return"fee"===n?.lineItemType?e:n?.lineItemType??e}function vW(e){return`Remove ${e}?`}function fW(e,t){return`To ${e}, your ${t} will have to be removed. Would you like to continue?`}async function bW({action:e,titleName:t,entityName:n}){return ih({title:vW(t),body:fW(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 yW={bill:"link bills",invoice:"link invoices",itemized:"add line items",payment:"link transactions",payroll:"link payroll runs"},wW={bill:"Linked Bills",invoice:"Linked Invoices",itemized:"Line Items",payment:"Linked Transactions",payroll:"Linked Payroll Runs"};async function CW(e,t){const n=wW[t];return bW({titleName:n,entityName:n.toLowerCase(),action:yW[e]})}function xW(e){return e.filter(e=>"bill"===e.lineItemType).map(e=>({id:e.bill.id,name:e.bill.name,date:e.bill.date,amount:ch(e.bill.amount)}))}const TW="bill",kW=fb({defaultValues:wH,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"bill"===e.lineItemType),a=xW(e.state.values.children);return R(Tc,{open:t,onOpenChange:n,children:[I(lN,{onClick:async()=>{const t=gW(TW,e.state.values.children);TW!==t?"YES"===await CW(TW,t)&&n(!0):n(!0)},Icon:MH,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Bills":"Link Bill"}),I(uW,{transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,transactionDate:e.state.values.date??"",onSubmit:(t,r)=>{const a=mW(t);0!==r&&a.push(hW(r)),e.setFieldValue("children",a),n(!1)},previouslySelected:a})]})}}),EW=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})),AW=vi(EW,"Payroll");function SW(e,t,n){const r=$H(e);return`The selected invoice total of ${$H(t)} is greater than the transaction total of ${r}. Was there a fee of ${$H(n)}?`}const IW=e=>["payments/payments","infinite",e??{}],NW=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:xi(n)},o=await Ra(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})},RW=tr({display:"flex",flexDirection:"column",width:"100%",gap:"4px",overflow:"hidden"}),PW=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"8px"}),DW=tr({marginLeft:"auto"});function MW({description:e,amount:t,bankAccountDisplayName:n,date:r}){return R("div",{className:RW,children:[R("div",{className:PW,children:[I(sc,{children:e}),t&&I(sc,{wrap:"nowrap",children:bo(t)})]}),R("div",{className:PW,children:[n&&I(Eo,{children:n}),I("span",{className:DW,children:r&&I(Eo,{wrap:"nowrap",children:At(Nt(r))})})]})]})}function LW({payment:e,selected:t,onClick:n}){return I(mf,{handleClick:n,selected:t,isMultiSelect:!0,children:I(MW,{description:e.description,amount:sh(e.amount),bankAccountDisplayName:e.bankAccount.displayName,date:e.date})})}function FW(e){return e}function OW(e){return e.pages.flatMap(e=>(e.data??[]).map(FW))}function VW(e){return Object.values(e).some(e=>e)}function UW(e,t){return e===ch(t)}function BW(e,t){return{status:{equal:"ACTIVE"},...e?{bankAccount:{id:{notIn:[e]}}}:void 0,bankTransaction:{id:{equal:null}},search:Sr(t)?void 0:t}}function HW({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const[a,i]=d(""),{query:{data:l,fetchNextPage:s,isFetching:c,hasNextPage:h,isFetchingNextPage:p}}=(m={filter:BW(n,a)},g={select:OW},Hg({queryFn:NW,queryKey:IW(m),...g}));var m,g;const[v,f]=d(r),[b,y]=d([]),w=o(()=>Object.fromEntries([...v,...b].map(e=>[e.id,!0])),[v,b]),C=o(()=>new Set(r.map(e=>e.id)),[r]),x=o(()=>Sr(a)?[...r,...(l??[]).filter(e=>!C.has(e.id))]:l??[],[a,r,l,C]),T=[...v,...b].reduce((e,t)=>e+t.amount,0),[k,E]=d(void 0),A=u(e=>{const n=r.filter(t=>e[t.id]),a=b.filter(t=>e[t.id]),o=new Set(a.map(e=>e.id)),i=(l??[]).filter(t=>e[t.id]&&!C.has(t.id)&&!o.has(t.id)),s=[...a,...i],c=[...n,...s].reduce((e,t)=>e+t.amount,0),d=VW(e);void 0===k||!UW(c,t)&&d||E(void 0),f(n),y(s)},[r,b,l,C,t,k]),S=ef({data:[x],getRowKey:e=>e.id,getGroupKey:()=>"payments",hasMultiSelect:!0,state:{selected:w},onSelectedChange:A}),N=c&&!p;return I(qv,{title:"Link Transactions",Footer:I(LH,{validate:()=>{const e=UW(T,t),n=VW(w),r=e||!n;return r||E("The selected total must equal the income amount."),r},error:k,onClick:()=>{e(v.map(e=>e.id),b)}}),padChildren:!1,children:R(rW,{children:[I(UH,{selectedAmount:T,transactionTotal:t,transactionTypeLabel:pw,selectedAmountSignage:"default"}),I(_H,{searchTerm:a,onChange:i,isFetching:N,searchPlaceholder:"Search transactions..."}),S.groups.map(e=>{const t=e.getRows();return I(hS,{label:"Transactions",singularLabel:"transaction",pluralLabel:"transactions",zeroState:0===t.length,children:e.getRows().map(e=>{const t=e.getIsSelected();return I(LW,{payment:e.value,selected:t,onClick:()=>e.toggleSelected(!t)},e.key)})},e.key)}),I(QH,{onIntersect:s,enable:!c&&h})]})})}function WW({onSubmit:e,transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r}){const a=kc();return I(Ov,{children:a.open&&I(HW,{transactionTotalDollars:t,parentBankAccountId:n,previouslySelected:r,onSubmit:e})})}function zW({transactionTotal:e,invoices:t,previouslySelected:n,onInvoiceSubmit:r,onPaymentSubmit:a,hasExistingInvoices:i,parentBankAccountId:l,fetchNextPage:s,hasNextPage:c,isFetching:u,isFetchingNextPage:h,searchTerm:p,onSearchChange:m}){const[g,v]=d(()=>Object.fromEntries(n.map(e=>[e.id,!0]))),[f,b]=d(()=>Object.fromEntries(n.map(e=>[e.id,e]))),[y,w]=d(!1),C=o(()=>new Set(n.map(e=>e.id)),[n]),x=o(()=>Sr(p)?[...n,...t.filter(e=>!C.has(e.id))]:t,[p,n,t,C]),T=ef({data:[x],getRowKey:e=>e.id,getGroupKey:()=>"invoices",onSelectedChange:e=>{v(e),b(t=>{const n={...t},r=x.find(n=>e[n.id]&&void 0===t[n.id]);return r&&(n[r.id]=r),n})},hasMultiSelect:!0,state:{selected:g}}),k=Object.entries(g).filter(([,e])=>e).map(([e])=>f[e]),E=k.reduce((e,t)=>e+t.amount,0),A=u&&!h;return I(qv,{title:"Link Invoice",HeaderRightAction:I(aE,{shouldUseButtonDiscreteStyles:!0,children:I(Lm,{forceNewCascade:!0,children:R(Tc,{open:y,onOpenChange:w,children:[I(lN,{onClick:async()=>{const e=k.length>0;if(i){if("YES"!==await CW("payment","invoice"))return}else if(e&&"YES"!==await async function(){return bW({action:"link transactions",entityName:"selected invoices",titleName:"Selected Invoices"})}())return;w(!0)},closeOnClick:!1,expandable:!0,children:"Link Transactions"}),I(WW,{transactionTotalDollars:e,parentBankAccountId:l,previouslySelected:[],onSubmit:a})]})})}),Footer:I(LH,{onClick:async()=>{const t=sh(E);if(t>e&&k.length>0){const n=new H(t).sub(e),a=n.toNumber(),o=n.times(-1).toNumber();(function({selectedTotal:e,suggestedFee:t,transactionTotal:n}){return eW({title:"Invoice Payment",body:SW(n,e,t)})})({selectedTotal:t,transactionTotal:e,suggestedFee:a}).then(e=>{let t=0;"FEE"===e&&(t=o),r(k,t)}).catch(()=>{})}else r(k,0)}}),padChildren:!1,children:R(rW,{children:[I(UH,{selectedAmount:E,transactionTotal:e,transactionTypeLabel:pw}),I(_H,{searchTerm:p,onChange:m,isFetching:A,searchPlaceholder:"Search invoices..."}),I(XH,{listLabel:"Invoices",glSourceList:T,icon:AW,fetchNextPage:s,hasNextPage:c,isFetching:u,pluralNoun:"invoices",singularNoun:"invoice"})]})})}const _W=e=>["invoicing/invoices","infinite",e??{}],jW=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:xi(r)},o=await Ra(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})},qW=[];function KW(e){const t={status:{equal:"ACTIVE"},invoiceStatus:{in:["OPEN"]}};return Sr(e)||(t.search=e),t}function YW(e){const[t,n]=d(""),{query:{data:r,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l}}=function({params:e,options:t}){return Hg({queryFn:jW,queryKey:_W(e),...t})}({params:{sort:(s=e.transactionDate,{orderBy:"DATE_PROXIMITY",value:s,direction:"ASC"}),limit:10,filter:KW(t)}});var s;const c=(r?.pages??qW).flatMap(e=>(e.data??[]).map(e=>({id:e.id,name:e.name??"",date:e.date??"",amount:e.totals?.total??0})));return I(zW,{...e,invoices:c,fetchNextPage:a,hasNextPage:o,isFetching:i,isFetchingNextPage:l,searchTerm:t,onSearchChange:n})}function ZW(e){const t=kc();return I(Ov,{children:t.open&&I(YW,{...e})})}function GW(e){const t=sh(e.amount);return{lineItemType:"invoice",amount:t,invoice:{id:e.id,amount:t,date:e.date,name:e.name}}}const QW=(e,t)=>{const n=e.map(GW);return 0!==t&&n.push(hW(t)),n};function XW(e){const t=sh(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 JW(e){return e.map(XW)}function $W(e){return e.filter(e=>"invoice"===e.lineItemType).map(e=>({id:e.invoice.id,name:e.invoice.name,date:e.invoice.date,amount:ch(e.invoice.amount)}))}const ez="invoice",tz=fb({defaultValues:wH,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.some(e=>"invoice"===e.lineItemType),a=$W(e.state.values.children);return R(Tc,{open:t,onOpenChange:n,children:[I(lN,{onClick:async()=>{const t=gW(ez,e.state.values.children);ez!==t?"YES"===await CW(ez,t)&&n(!0):n(!0)},Icon:AW,closeOnClick:!1,expandable:!0,children:r?"Edit Linked Invoices":"Link Invoice"}),I(ZW,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,r)=>{const a=QW(t,r);e.setFieldValue("children",a),n(!1)},onPaymentSubmit:(t,r)=>{const a=JW(r);e.setFieldValue("children",a),n(!1)},hasExistingInvoices:r,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})}}),nz=ms.filter(e=>"ONE_TIME"!=e.value);function rz({onClick:e}){const t=kc();return I(QC,{triggerChildren:I($C,{displayLabel:"Make recurring"}),popupChildren:I(Sf,{frequencies:nz,onClick:n=>{e(n),t.close()}})})}function az({active:e,icon:t,onClick:n,ariaLabel:r,popupTriggerProps:a}){return I(zc,{ariaLabel:r,onClick:n,active:e,popupTriggerProps:a,children:I(Td,{Component:t})})}function oz({activeTab:e,onClick:t,popupTriggerProps:n}){return I(az,{active:"conversation"===e,onClick:()=>t("conversation"),icon:Ed,ariaLabel:"conversation-tab",popupTriggerProps:n})}const iz=tr({display:"flex",flexDirection:"column",position:"fixed",inset:0,backgroundColor:"surface.background"});function lz({conversationId:e,attachedEntityId:t,defaultSubject:n}){const r=kc(),[a,o]=d(e),{query:{data:i}}=Ll(a),l="CLOSED"===i?.resolutionStatus;return I(Pv,{children:R("div",{className:iz,children:[I(Hv,{children:R(zv,{children:[I($u,{Icon:nl,handleClose:()=>r.setOpen(!1)}),I(To,{children:"Back"})]})}),I(AB,{conversationId:a,setConversationId:o,isResolved:l,isUnread:"UNREAD"===i?.readStatus,attachedEntityId:t,defaultSubject:n})]})})}const sz={EXPENSE:{value:"EXPENSE",label:"Expense"},REVENUE:{value:"REVENUE",label:pw},TAX_EXPENSE:{value:"TAX_PAYMENT",label:"Tax Pmt"},TRANSFER:{value:"BANK_TRANSFER",label:"Transfer"}},cz=Object.values(sz);function dz({onClick:e,showSuggestedCategories:t,listLabel:n,categories:r,isFilling:a,category:o,handleConversion:i,parentOnClick:l}){const s=We();return a?I(yf,{}):I(sf,{title:R(N,{children:[s&&t&&I(To,{children:"Suggested"}),I(To,{children:n})]}),children:r.map(t=>{const n=(r=t.id,o?.id===r);var r;return t.hasChilds?I(lS,{text:t.name??"",iconUrl:t.iconUrl,title:"All Categories",children:I(pz,{nestedCategories:t.children??[],listLabel:t.name??"",handleConversion:i,parentOnClick:l,category:o,showSuggestedCategories:!1})},t.id):I(mf,{handleClick:()=>e(t),selected:n,children:R(iS,{children:[t.iconUrl&&I(Sd,{Component:Cg(t.iconUrl,t.name??"")}),I(sc,{wrap:"wrap",children:t.name??""})]})},t.id)})})}const uz="Search expense categories...",hz=[];function pz({listLabel:e="All Expense Categories",handleConversion:t,showSuggestedCategories:n,nestedCategories:r,category:a,parentOnClick:o}){const{query:{data:i},isFilling:l}=wx(),s=r??i?.data??hz,c=kc(),d=e=>{o?o(e):t({type:"EXPENSE",value:e}),c.close()},u=a?/* @__PURE__ */new Set([a.id]):/* @__PURE__ */new Set;return I($v,{placeholder:uz,onClick:d,SearchList:vS,DefaultList:dz,listLength:s.length,extraProps:{categories:s,listLabel:e,isFilling:l,showSuggestedCategories:n,category:a,handleConversion:t,parentOnClick:d,selectedIds:u}})}function mz({listLabel:e="All Income Categories",handleConversion:t,showSuggestedCategories:n,glAccount:r}){const{query:{data:a},isFilling:o}=kC(),i=AC(a,EC),l=We()&&n?I(sf,{title:I(To,{children:"Suggested"})}):void 0;return I(EV,{accounts:i,selectedAccountId:r?.id,onSelect:e=>t({type:"REVENUE",value:e}),isFilling:o,listLabel:e,placeholder:"Search income categories...",nestedTitle:"All Categories",Header:l})}function gz({list:e,onClick:t,NestedChildList:n}){return I(of,{children:e.groups.map(e=>I(hS,{label:e.original?.label,children:e.getRows().map(e=>{if(e.value.children&&e.value.children.length>0&&void 0!==n)return I(lS,{text:e.value.name,iconUrl:e.value.iconUrl,badge:"",title:"All Categories",Footer:void 0,children:I(n,{row:e})},e.key);const r=e.getIsSelected();return I(mf,{handleClick:()=>{t?t(e):e.toggleSelected(!0)},selected:r,children:R(iS,{children:[e.value.iconUrl&&I(Sd,{Component:Cg(e.value.iconUrl,e.value.name)}),I(sc,{wrap:"wrap",children:e.value.name})]})},e.key)})},e.key))})}const vz="All Tax Categories";function fz({handleConversion:e,region:t}){const n=kc(),r=ef({data:[UB],groups:[{label:vz,key:vz}],getRowKey:e=>e.value,getGroupKey:()=>"region",state:{selected:t?{[t]:!0}:{}}});return I(gz,{onClick:t=>{var r;r=t.value,e({type:"TAX_PAYMENT",value:r.value}),n.close()},list:r})}function bz({onClick:e,onNeedsMatchClick:t,showSuggestedCategories:n,bankTransfers:r,holdingAccount:a,listLabel:o,isFetched:i,isFilling:l,reconciliationMatch:s}){const c=We(),d=!l&&i&&0===r.length;return l?I(yf,{}):R(of,{children:[a&&I("div",{children:I(pf,{handleClick:t,children:I(sc,{wrap:"wrap",children:"Needs Match"})})}),c&&n&&I(To,{children:"Suggested"}),!d&&R(N,{children:[I(To,{children:o}),I("div",{children:r?.map(t=>{const n=s?.id===t.id;return I(mf,{handleClick:()=>e(t),selected:n,children:I(MW,{description:t.description,amount:sh(t.amount),date:t.date,bankAccountDisplayName:t.bankAccount.displayName})},t.id)})})]})]})}const yz={keys:[{name:"description"}],threshold:.2,includeScore:!0,minMatchCharLength:1};function wz({searchTerm:e,onClick:t,bankTransfers:n,isFilling:r,reconciliationMatch:a}){const i=o(()=>new Ae(n??[],yz),[n]),l=o(()=>n?i.search(e).map(e=>e.item):[],[n,e,i]);return r?I(yf,{}):0===l.length?I(rf,{singularSearchCTANoun:"matching bank transaction",pluralNounNotFound:"matching bank transactions",showSearchCTA:!0}):I(of,{children:I("div",{children:l.map(e=>{const n=a?.id===e.id;return I(mf,{handleClick:()=>t(e),selected:n,children:I(MW,{description:e.description,amount:sh(e.amount),date:e.date,bankAccountDisplayName:e.bankAccount.displayName})},e.id)})})})}const Cz=[];function xz({listLabel:e="All Matching Bank Transactions",handleConversion:t,showSuggestedCategories:n,transactionBankAccountId:r,transactionAmount:a,transactionDate:o,reconciliationMatch:i}){const l=Nt(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:Rt(Ot(u=l??/* @__PURE__ */new Date,-3)),lessThanEqual:Rt(Ot(u,3))},bankAccount:{expand:!0,id:{notIn:[c]}},reconciliationMatch:{id:{equal:null}}}});var c,d,u;const{query:{data:h,isFetched:p},isFilling:m}=ws(s,{enabled:null!==l}),g=h?.data??Cz,{query:{data:v}}=mC({select:e=>e.find(e=>"CLEARING_ACCOUNT"===e.assetType)}),f=kc();return I($v,{placeholder:"Search matching bank transfers...",onClick:e=>{t({type:"BANK_TRANSFER",value:{transfer:e}}),f.close()},SearchList:wz,DefaultList:bz,listLength:g.length??0,extraProps:{listLabel:e,bankTransfers:g,isFetched:p,isFilling:m,holdingAccount:v,showSuggestedCategories:n,transactionDate:o,onNeedsMatchClick:()=>{v&&t({type:"BANK_TRANSFER",value:{glAccount:v}}),f.close()},reconciliationMatch:i}})}function Tz({initialTransactionType:e,headerLabel:t="Select Categories",listLabel:n,showSuggestedCategories:r,handleConversion:a,categoryValues:o,hideConversion:i=!1}){const[l,s]=d(function(e){switch(e){case"EXPENSE":return cz.indexOf(sz.EXPENSE);case"REVENUE":return cz.indexOf(sz.REVENUE);case"TAX_PAYMENT":return cz.indexOf(sz.TAX_EXPENSE);default:return cz.indexOf(sz.TRANSFER)}}(e)),{category:c,glAccount:u,tax:h,date:p,bankAccount:m,reconciliationMatch:g,amount:v}=o,f=h?.paymentInfo?.region,b=m?.id;return R(Kv,{title:t,children:[!i&&I(Df,{options:cz,handleClick:e=>s(e),selectedIndex:l}),I(()=>{switch(cz[l].value){case"EXPENSE":return I(pz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,category:c});case"REVENUE":return I(mz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,glAccount:u});case"TAX_PAYMENT":return I(fz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,region:f});case"BANK_TRANSFER":return I(xz,{listLabel:n,showSuggestedCategories:r,handleConversion:a,transactionBankAccountId:b,transactionAmount:v??0,transactionDate:p,reconciliationMatch:g})}},{})]})}function kz({children:e}){const{startPrefetch:t,cancelPrefetch:n}=kx();return I(SV,{onMouseEnter:t,onMouseLeave:n,children:e})}const Ez=tr({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"});function Az({categoryValues:e,handleConversion:t,transactionType:n,onCategorySelect:r,hideConversion:a=!1}){const{category:o}=e,i=!sr(o)&&""!==o.id,l=sr(o?.iconUrl)?void 0:Cg(o.iconUrl,"Expense Icon");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:"Category",popupTriggerProps:e,children:R(kz,{children:[i?R("div",{className:Ez,children:[l&&I(Sd,{Component:l}),I(sc,{wrap:"wrap",children:o.name})]}):I(sc,{intent:"weak",children:"Select category"}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function Sz(){const{query:{data:e}}=eI(),{query:{data:t=[]}}=zF(),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 Iz=tr({display:"flex",gap:"8px",alignItems:"center"});function Nz({categoryValues:e,handleConversion:t,transactionType:n,onGlAccountSelect:r,hideConversion:a=!1}){const{glAccount:o}=e,i=!sr(o)&&""!==o.id,l=sr(o?.iconUrl)?void 0:Cg(o.iconUrl,"Revenue Icon");return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:"Category",popupTriggerProps:e,children:R(kz,{children:[i?R("div",{className:Iz,children:[l&&I(Sd,{Component:l}),I(sc,{children:o.name})]}):I(sc,{intent:"weak",children:"Select category"}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:e=>{t(e),r?.()},categoryValues:e,hideConversion:a})]})}function Rz(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 Pz=(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=>!sr(e.customer?.id));return{...Object.fromEntries(t.map(e=>[e.id,r.has(e.id)])),customer:a}},Dz={id:"customer",name:"Customer"};function Mz(e){return{id:e.id,lineItemType:"itemized",category:e.category,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer,amount:e.amount}}function Lz(e){return Rz({id:e.id,amount:e.amount??0,category:e.category??null,glAccount:e.glAccount,dimensionValues:e.dimensionValues,customer:e.customer})}function Fz(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 Oz=gr(lr["line-item-card"],tr({display:"flex",flexDirection:"column",width:"100%",gap:"8px"})),Vz=tr({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.elevated",padding:"12px 16px",height:"44px"}),Uz=tr({display:"flex",flexDirection:"column",paddingInline:"16px",gap:"8px"}),Bz=fb({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}=Sz(),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",{...Oz,children:[R("div",{className:Vz,children:[I(sc,{children:`Line Item #${t+1}`}),R(zc,{onClick:()=>{1===e.state.values.children.length?r():e.removeFieldValue("children",t)},active:!1,children:[I(sc,{children:"Remove"}),I(Sd,{Component:AN})]})]}),R("div",{className:Uz,children:[I(e.AppField,{name:`children[${t}].amount`,children:e=>I(e.EditableAmountField,{label:"Amount"})}),"EXPENSE"===n&&I(Az,{transactionType:"EXPENSE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),"REVENUE"===n&&I(Nz,{transactionType:"REVENUE",handleConversion:l,categoryValues:e.state.values.children[t],hideConversion:!0}),I(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=>!sr(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:cH(n,e),dimensionValueIndex:a}}).filter(e=>null!==e)}(n,r,a,o,Dz.id,i).map(({fieldDimension:n,dimensionValueOptions:r,dimensionValueIndex:a})=>I(e.AppField,{name:`children[${t}].dimensionValues[${a}]`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.DimensionValueField,{fieldDimension:n,dimensionValueOptions:r,dimensions:o,selectedDimensionValue:e.state.value?.id?e.state.value:void 0,onSave:t=>e.handleChange(dH(t))})},r[0][0].id))}),I(e.Subscribe,{selector:e=>e.values.itemizeByOptions.customer,children:n=>n&&I(e.AppField,{name:`children[${t}].customer`,validators:{onSubmit:({value:e})=>e?.id?void 0:{message:"Required"}},children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:!0})})})]})]})}}),Hz=tr({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",width:"100%"});function Wz({items:e,selectedIds:t,onCheckboxChange:n,onConfirm:r,getLabel:a}){const o=kc();return I(Fc,{children:R(Lm,{forceNewCascade:!0,children:[e?.map(e=>{const r=t.includes(e.id);return I(Wm,{onClick:()=>{n(e.id,!r)},children:R("div",{className:Hz,children:[I(sc,{children:a(e)}),I(Sd,{Component:r?wi:cf})]})},e.id)}),!sr(r)&&I(Wm,{onClick:()=>{r?.(),o.setOpen(!1)},children:I(sc,{children:"Confirm Selection"})})]})})}const zz=e=>Object.keys(e).filter(t=>e[t]);function _z({dimensions:e,itemizeByOptions:t,onCheckboxChange:n}){return R(Tc,{placement:"bottom-end",children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Itemize By"}),I(Sd,{Component:Lp})]})}),I(Wz,{items:[...e,Dz],selectedIds:zz(t),onCheckboxChange:n,getLabel:e=>e.name??""})]})}const jz=tr({display:"flex",flexDirection:"column",gap:"4px",width:"100%"}),qz=tr({display:"flex",justifyContent:"space-between",alignItems:"center"}),Kz=tr.raw({color:"surface.intent.danger.active"}),Yz=tr({display:"flex",alignItems:"center",gap:"4px",color:"surface.intent.danger.active"});function Zz({transactionType:e,transactionAmount:t,lineItemAmounts:n,lineItemCount:r,hasSubmitAttempted:a}){const o=iH(n),i=lH(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:jz,children:[R("div",{className:qz,children:[I(sc,{children:`${fw[e]} amount`}),I(sc,{children:JH(t)})]}),R("div",{className:qz,children:[I(sc,{children:"Line items total"}),I(sc,{children:JH(o)})]}),R("div",{className:qz,children:[I(sc,{extraClassNames:l?[Kz]:void 0,children:"Difference"}),I(sc,{extraClassNames:l?[Kz]:void 0,children:(d=t,u=o,Co(new H(d).minus(u).toNumber(),"default"))})]}),l&&R("div",{className:Yz,children:[I(cl,{Component:bi}),I(sc,{extraClassNames:[Kz],children:c})]}),s&&R("div",{className:Yz,children:[I(cl,{Component:bi}),I(sc,{extraClassNames:[Kz],children:"At least 2 line items are required"})]})]});var d,u}function Gz({onSave:e,transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o}){return I(hp,{onSave:e,children:I(Zz,{transactionType:t,transactionAmount:n,lineItemAmounts:r,lineItemCount:a,hasSubmitAttempted:o})})}const Qz=tr({display:"flex",justifyContent:"start",width:"100%",paddingInline:"10px"});function Xz(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}=Sz(),c=o(()=>"EXPENSE"===n?{category:a}:{glAccount:i??void 0},[a,i,n]),d=o(()=>{if(e.length>0)return e;const t=new H(r).div(2).round(2,H.roundDown),n=new H(r).sub(t);return[Rz({amount:t.toNumber(),...structuredClone(c)}),Rz({amount:n.toNumber(),...structuredClone(c)})]},[e,r,c]),u=kc(),h=function({childTransactions:e,itemizeByOptions:t,parentAmount:n,transactionType:r,onSubmit:a}){const o=function(e){switch(e){case"EXPENSE":default:return $B;case"BANK_TRANSFER":return nH;case"REVENUE":return aH}}(r);return vb({defaultValues:{children:e,itemizeByOptions:t},canSubmitWhenInvalid:!0,validators:{onSubmit:({value:e})=>{const t=SH(o.safeParse(e));if(e.children.length<2)return{form:"minimum-children",fields:t};const r=iH(e.children.map(e=>e.amount));return lH(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:Pz(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,Rz({...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===Dz.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(sr(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=I(t.Subscribe,{selector:e=>e.values.itemizeByOptions,children:e=>I(_z,{dimensions:n,itemizeByOptions:e,onCheckboxChange:i})}),s=I(t.Subscribe,{selector:e=>({children:e.values.children,submissionAttempts:e.submissionAttempts}),children:({children:n,submissionAttempts:r})=>I(Gz,{onSave:()=>t.handleSubmit(),transactionType:e.transactionType,transactionAmount:e.amount,lineItemAmounts:n.map(e=>e.amount),lineItemCount:n.length,hasSubmitAttempted:r>0})});return R(qv,{title:"Edit Line Items",HeaderRightAction:l,Footer:s,padChildren:!1,children:[I(t.AppField,{name:"children",mode:"array",children:n=>n.state.value.map((n,r)=>I(Bz,{form:t,index:r,transactionType:e.transactionType,onUnitemize:a},`${n.id}_${r}`))}),I(t.Subscribe,{selector:e=>e.values.children,children:e=>I("div",{className:Qz,children:e.length<10&&R(zc,{onClick:r,active:!1,children:[I(sc,{children:"Add Line Item"}),I(cl,{Component:Os})]})})})]})}function Jz(e){const t=kc();return I(Ov,{children:t.open&&I(Xz,{...e})})}function $z({transactionType:e,itemizeModalFormValues:t,handleItemizeAction:n}){const r=kc();return R(Tc,{children:[I(Ec,{children:e=>I(lN,{Icon:sx,popupTriggerProps:e,children:"Itemize"})}),I(Jz,{transactionType:e,amount:t.amount??0,category:t.category,glAccount:t.glAccount,childTransactions:[],onSubmit:e=>{n(e.map(Mz)),r.close()}})]})}const e_=({isMobile:e,activeTab:t,tabOnClick:n,conversationId:r,transactionId:a})=>e?R(Tc,{children:[I(Ec,{children:e=>I(oz,{onClick:n,activeTab:t,popupTriggerProps:e})}),I(lz,{conversationId:r,attachedEntityId:a})]}):I(oz,{onClick:n,activeTab:t}),t_=fb({defaultValues:wH,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=He(),s=wT(),c=!sr(n)&&Am(n)&&"EXPENSE"===n.type,{mutateAsync:d}=cC({mutationFn:aC,meta:{toastOptions:{defaultSuccessMessage:"Transactions saved",defaultErrorMessage:"Couldn't save transactions"}}}),h=PH(e),p=u(t=>{Fz(t,e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))},[e]);return I(Hv,{children:R(zv,{children:[I($u,{}),I(To,{children:t}),i&&I(e_,{isMobile:s,activeTab:r,tabOnClick:a,conversationId:o,transactionId:i}),I(aE,{shouldUseButtonDiscreteStyles:!0,children:R(Lm,{children:[I(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)&&I(kW,{form:e}),("REVENUE"===n?.type||"TRANSFER_IN"===n?.type)&&I(tz,{form:e}),0===t.length&&I($z,{itemizeModalFormValues:e.state.values,transactionType:r,handleItemizeAction:p}),uH(t)&&I(lN,{Icon:sx,onClick:()=>p([t[0]]),children:"Unitemize"})]})}),c&&I(e.Subscribe,{selector:e=>e.values.frequency,children:t=>{return l&&!(null!=(n=t)&&"ONE_TIME"!=n.value)&&I(rz,{onClick:t=>e.setFieldValue("frequency",t)});var n}}),n?.status===NN.ACTIVE&&I(NH,{onClick:async()=>{sr(n)||await async function(){return ih({title:"Archive transaction",body:"Are you sure you want to archive this transaction?",buttons:[{key:_u,label:"Cancel"},{key:ju,label:"Archive",type:oh.DANGER}]}).then(e=>e===ju)}()&&await h(async()=>{await d(RN([n])),as()})}}),n?.status===NN.INACTIVE&&I(RH,{onClick:async()=>{sr(n)||await h(async()=>{var e;await d((e=[n],e.map(e=>({id:e.id,status:NN.ACTIVE})))),as()})}})]})})]})})}});function n_(e){return 0===e.length||uH(e)&&e.every(e=>null===e.customer)}const r_=fb({defaultValues:wH,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){const a=He();return R(N,{children:[I(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&&I(e.AppField,{name:"vendor",children:e=>I(e.VendorFieldInput,{label:"Vendor",onClick:e.handleChange,vendor:e.state.value,editable:n})})}),I(e.Subscribe,{selector:e=>n_(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value,editable:n})})}),I(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)&&I(e.AppField,{name:"frequency",children:e=>I(e.FrequencyFieldInput,{label:"Frequency",onClick:e.handleChange,frequency:e.state.value})});var o,i}}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"category",children:t=>I(Az,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onCategorySelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),a_=fb({defaultValues:wH,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.Subscribe,{selector:e=>n_(e.values.children),children:t=>t&&I(e.AppField,{name:"customer",children:e=>I(e.CustomerFieldInput,{label:"Customer",onClick:e.handleChange,customer:e.state.value})})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"glAccount",children:t=>I(Nz,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r,onGlAccountSelect:t.handleBlur})})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}});function o_({categoryValues:e,handleConversion:t,transactionType:n}){const{reconciliationMatch:r}=e,a="Withdrawn from"===lx(r?.amount||0)?"Matching Deposit":"Matching Withdrawal";return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:a,popupTriggerProps:e,children:R(kz,{children:[r?I(MW,{description:r.description||"",amount:r.amount||0,date:r.date||At(/* @__PURE__ */new Date),bankAccountDisplayName:r.bankAccount?.displayName}):I(sc,{intent:"weak",children:"Needs Match"}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const i_=fb({defaultValues:wH,props:{transaction:null,handleConversion:()=>{}},render:function({form:e,transaction:t,handleConversion:n}){return R(N,{children:[I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})}),I(e.Subscribe,{selector:e=>e.values.children,children:t=>0===t.length&&I(e.AppField,{name:"reconciliationMatch",children:()=>I(o_,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:n})})})]})}});function l_({categoryValues:e,handleConversion:t,transactionType:n}){const{tax:r}=e;return R(Tc,{placement:"bottom-start",children:[I(Ec,{children:e=>I(Pp,{label:"Category",popupTriggerProps:e,children:R(kz,{children:[I(sc,{children:BB(r?.paymentInfo?.region)??"Select region..."}),I(Sd,{Component:rl})]})})}),I(Tz,{initialTransactionType:n,handleConversion:t,categoryValues:e})]})}const s_=fb({defaultValues:wH,props:{transaction:null,isManual:!1,handleConversion:()=>{}},render:function({form:e,transaction:t,isManual:n,handleConversion:r}){return R(N,{children:[I(e.AppField,{name:"tax.paymentInfo.region",children:()=>I(l_,{transactionType:e.state.values.type,categoryValues:e.state.values,handleConversion:r})}),I(e.AppField,{name:"tax.paymentInfo.quarter",children:e=>I(e.ButtonGroupField,{label:"Quarter",options:FB})}),I(e.AppField,{name:"tax.paymentInfo.year",children:e=>I(e.GenericSelectorField,{label:"Year",options:xt({startYear:/* @__PURE__ */(new Date).getFullYear()+1}).map(e=>({value:e,label:String(e)}))})}),n&&I(e.AppField,{name:"bankAccount",children:e=>I(e.ManualBankAccountField,{transaction:t})})]})}}),c_=fb({defaultValues:wH,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 cr(t.value.transfer)&&e.setFieldValue("reconciliationMatch",{...t.value.transfer,amount:sh(t.value.transfer.amount)}),cr(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 I(N,{children:I(e.Subscribe,{selector:e=>e.values.type,children:a=>{switch(a){case"EXPENSE":return I(r_,{form:e,transaction:t,isManual:n,handleConversion:r});case"REVENUE":return I(a_,{form:e,transaction:t,isManual:n,handleConversion:r});case"BANK_TRANSFER":return I(i_,{form:e,transaction:t,handleConversion:r});case"TAX_PAYMENT":return I(s_,{form:e,transaction:t,isManual:n,handleConversion:r});default:return null}}})})}}),d_=gr(null,tr({display:"flex",flexDirection:"column",justifyContent:"center",gap:"4px"}));function u_({transaction:e,bankAccount:t}){const n=e?e.description:"",r=sr(t)||sr(e)?"":((e,t)=>{const n=Cw(t.type),r=lx(t.amount);return`${n?`${r} `:""}${uh(e.name,e.mask)}`})(t,e);return R("div",{...d_,children:[I(To,{wrap:"wrap",children:n}),t&&I(Eo,{children:r})]})}const h_=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px"}),p_=tr({display:"flex",flexDirection:"column",alignItems:"stretch",gap:"5px",alignSelf:"stretch"});function m_({attachments:e,onRemove:t}){return I("div",{className:h_,children:I("div",{className:p_,children:e.map(e=>I(lB,{attachment:e,onRemove:t},e.localId))})})}const g_=fb({defaultValues:wH,props:{transactionId:""},render:function({form:e,transactionId:t}){const{mutate:n}=Dh({mutationFn:dm,meta:{toastOptions:{defaultSuccessMessage:"Attachment deleted",defaultErrorMessage:"Couldn't delete attachment"}},onSuccess:async()=>{await Lr.invalidateQueries({queryKey:["files/attachments"]}),await Lr.invalidateQueries({queryKey:["banks/transactions"]})}});return I(e.AppField,{name:"attachments",children:e=>R(N,{children:[I(e.AttachmentDropzoneField,{entityId:cs(t),label:"Attachments"}),(e.state.value?.length??0)>0&&I(m_,{attachments:e.state.value??[],onRemove:t=>{e.setValue(e=>(e??[]).filter(e=>e.localId!==t.localId)),null!==t.id&&n({id:t.id})}})]})})}}),v_=tr({display:"flex",flexDirection:"column",gap:"8px"});function f_({children:e}){return I("div",{className:v_,children:e})}const b_=or({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 y_({children:e,surface:t,style:n}){const r=tr(b_.raw({surface:t}),n);return I("div",{className:r,children:e})}function w_(){return I(ip,{alignment:"horizontal"})}const C_=tr({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"});function x_(e){return I("div",{className:C_,children:e.children})}function T_({property:e}){return"string"==typeof e?I(sc,{children:e}):e}function k_({label:e,value:t}){return R(x_,{children:[I(T_,{property:e}),I(T_,{property:t})]})}function E_(e){return At(Nt(e))}function A_({amount:e,date:t,description:n}){return R(y_,{surface:"foreground",children:[I(k_,{label:"Description",value:n}),I(w_,{}),I(k_,{label:"Date",value:E_(t)}),I(w_,{}),I(k_,{label:"Amount",value:JH(e)})]})}const S_=tr.raw({padding:12});function I_({amount:e}){return I(y_,{surface:"background",style:S_,children:I(k_,{label:"Fee",value:JH(e)})})}const N_=tr({display:"flex",flexDirection:"row",justifyContent:"space-between",maxWidth:"100%",alignItems:"center"}),R_=tr({display:"flex",alignItems:"center",gap:"8px",color:"typography.base"});function P_({label:e,warning:t}){return R("div",{className:N_,children:[I(sc,{children:e}),t&&R("div",{className:R_,children:[I(Sd,{Component:bi}),t]})]})}function D_(e){return JH(Math.abs(e))}function M_(e,t,n){const r=t??0,a=e.reduce((e,t)=>e.add(t.amount??0),new H(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?`${D_(c)} Overpaid`:"underpaid"===o?function(e){return`${D_(e)} Underpaid`}(c):null}const L_=fb({defaultValues:wH,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=$W(e.state.values.children);return R(f_,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=M_(t,e.amount,e.type);return I(P_,{label:"Invoices & Fees",warning:n})}}),t.map((e,t)=>"invoice"===e.lineItemType?I(A_,{description:e.invoice.name,amount:e.invoice.amount,date:e.invoice.date},e.invoice.id):"fee"===e.lineItemType?I(I_,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(Tc,{open:n,onOpenChange:r,children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Linked Invoices"}),I(cl,{Component:rl})]})}),I(ZW,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onInvoiceSubmit:(t,n)=>{const a=QW(t,n);e.setFieldValue("children",a),r(!1)},onPaymentSubmit:(t,n)=>{const a=JW(n);e.setFieldValue("children",a),r(!1)},hasExistingInvoices:!0,previouslySelected:a,parentBankAccountId:e.state.values.bankAccount?.id})]})]})}});function F_({transactionType:e,amount:t,category:n,glAccount:r,dimensionValues:a,dimensions:o,customer:i}){const l=[{label:"Amount",value:JH(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 I(y_,{children:l.map((e,t)=>R(f,{children:[t>0&&I(w_,{}),I(k_,{label:e.label,value:e.value.toString()})]},e.label))})}const O_=fb({defaultValues:wH,render:function({form:e}){const{query:{data:t}}=qF(),n=e.state.values.children;if(uH(n))return R(f_,{children:[I(sc,{children:`Line Items (${n.length})`}),n.map((n,r)=>I(F_,{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(Tc,{children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Line Items"}),I(cl,{Component:rl})]})}),I(Jz,{transactionType:e.state.values.type,amount:e.state.values.amount??0,category:e.state.values.category,glAccount:e.state.values.glAccount,childTransactions:n.map(Lz),onSubmit:t=>{Fz(t.map(Mz),e.state.values.type,t=>e.setFieldValue("category",t),t=>e.setFieldValue("glAccount",t),t=>e.setFieldValue("children",t))}})]})]})}}),V_=fb({defaultValues:wH,render:function({form:e}){const t=e.state.values.children.sort(e=>"fee"===e.lineItemType?1:-1),[n,r]=d(!1),a=xW(e.state.values.children);return R(f_,{children:[I(e.Subscribe,{selector:e=>({amount:e.values.amount,type:e.values.type}),children:e=>{const n=M_(t,e.amount,e.type);return I(P_,{label:"Bills & Fees",warning:n})}}),t.map((e,t)=>"bill"===e.lineItemType?I(A_,{description:e.bill.name,amount:e.bill.amount,date:e.bill.date},e.bill.id):"fee"===e.lineItemType?I(I_,{amount:Math.abs(e.amount)},`fee_${t}`):null),R(Tc,{open:n,onOpenChange:r,children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Linked Bills"}),I(cl,{Component:rl})]})}),I(uW,{transactionDate:e.state.values.date,transactionType:e.state.values.type,transactionTotal:e.state.values.amount??0,onSubmit:(t,n)=>{const a=mW(t);0!==n&&a.push(hW(n)),e.setFieldValue("children",a),r(!1)},previouslySelected:a})]})]})}});function U_({amount:e,bankAccountName:t,date:n,description:r}){return R(y_,{surface:"foreground",children:[I(k_,{label:"Description",value:r}),I(w_,{}),t&&R(N,{children:[I(k_,{label:"Account",value:t}),I(w_,{})]}),I(k_,{label:"Date",value:E_(n)}),I(w_,{}),I(k_,{label:"Amount",value:JH(e)})]})}const B_=fb({defaultValues:wH,render:function({form:e}){const[t,n]=d(!1),r=e.state.values.children.filter(e=>"payment"===e.lineItemType).map(e=>({id:e.payment.id,amount:ch(e.payment.amount),date:e.payment.date,description:e.payment.name,bankAccount:{displayName:e.payment.bankAccount.displayName}}));return R(f_,{children:[I(P_,{label:"Transactions"}),e.state.values.children.map(e=>"payment"===e.lineItemType?I(U_,{description:e.payment.name,amount:e.payment.amount,date:e.payment.date,bankAccountName:e.payment.bankAccount.displayName},e.payment.id):null),R(Tc,{open:t,onOpenChange:n,children:[I(Ec,{children:e=>R(zc,{popupTriggerProps:e,children:[I(sc,{children:"Edit Linked Transactions"}),I(cl,{Component:rl})]})}),I(WW,{transactionTotalDollars:e.state.values.amount??0,parentBankAccountId:e.state.values.bankAccount.id,previouslySelected:r,onSubmit:(t,r)=>{const a=e.state.values.children.filter(e=>"payment"===e.lineItemType&&t.includes(e.payment.id)),o=JW(r);e.setFieldValue("children",[...a,...o]),n(!1)}})]})]})}}),H_=fb({defaultValues:wH,render:function({form:e}){const t=e.state.values.children;return 0===t.length?null:t.some(e=>"invoice"===e.lineItemType)?I(L_,{form:e}):t.some(e=>"bill"===e.lineItemType)?I(V_,{form:e}):t.some(e=>"payment"===e.lineItemType)?I(B_,{form:e}):uH(t)?I(O_,{form:e}):null}});function W_({transaction:e,dimensions:t,form:n,bankAccount:r,isManual:a,conversationId:o,transactionId:i,initialTab:l,currentType:s}){const{nestedDimensionValues:c}=Sz(),u=void 0===i?bw[s]:yw[s],[h,p]=d(l??null),m=I(t_,{form:n,transaction:e,title:u,activeTab:h,tabOnClick:e=>p(e===h?null:e),conversationId:o,transactionId:i}),g=I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(hp,{disabled:e,isSubmitting:t})});return R(LB,{onSubmit:n.handleSubmit,Header:m,Footer:g,activeTab:h,conversationId:o,transactionId:i,transaction:e,children:[e?.description&&I(u_,{transaction:e,bankAccount:r}),I(n.AppField,{name:"amount",children:e=>I(a?e.EditableAmountField:e.DiscreetAmountField,{label:"Total"})}),I(n.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Transaction Date",maxDate:/* @__PURE__ */new Date,editable:a})}),I(c_,{form:n,transaction:e,isManual:a}),I(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=cH(a,e.id);return{fieldDimension:e.name,dimensionValueOptions:r,dimensionValueIndex:n,requiredness:e.requiredness}})}(e.flatMap(e=>"itemized"===e.lineItemType?e.dimensionValues:[]),t,c).map(({fieldDimension:e,dimensionValueOptions:r,requiredness:a,dimensionValueIndex:o})=>I(n.AppField,{name:`dimensionValues[${o}]`,validators:{onSubmit:({value:e})=>"REQUIRED"!==a||e?.id?void 0:{message:"Required"}},children:n=>I(n.DimensionValueField,{fieldDimension:e,dimensionValueOptions:r,dimensions:t,selectedDimensionValue:n.state.value,onSave:e=>n.handleChange(dH(e))})},r[0][0].id))}),I(n.Subscribe,{selector:e=>e.values.children,children:e=>Je(e)&&I(H_,{form:n})}),I(n.AppField,{name:"notes",children:e=>I(e.TextAreaInput,{label:"Note"})}),I(n.AppField,{name:"type",children:()=>null}),i&&I(g_,{form:n,transactionId:i})]})}function z_({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}=Sz(),{query:{data:a,isFetching:o,refetch:i},isFilling:l}=xs({id:e,enabled:void 0!==e});return{transaction:a,nestedDimensions:n,form:IH(a,r,t),bankAccount:lg(a?.bankAccount?.id??""),isManual:sr(a)||Am(a),isLoading:l||o&&!a,refetchTransaction:i}}({transactionId:e,initialType:n});if(s)return null;const c=r?.conversation?.id??null;return I(o.Subscribe,{selector:e=>e.values.type,children:n=>I(W_,{transaction:r??null,dimensions:a,form:o,bankAccount:i,isManual:l,conversationId:c,transactionId:e,initialTab:t,currentType:n})})}function __({transactionId:e,initialTab:t}){const{query:{data:n},isFilling:r}=xs({id:e});return s(()=>{!r&&sr(n)&&as()},[n,r]),sr(n)?null:I(z_,{transactionId:e,initialTab:t})}function j_({transactionId:e,initialTab:t,initialType:n}){return e?I(__,{transactionId:e,initialTab:t}):!e&&n?I(z_,{initialTab:t,initialType:(r=n,"TRANSFER_IN"===r||"TRANSFER_OUT"===r?"BANK_TRANSFER":r)}):void 0;var r}function q_({subject:e,children:t}){return R(Hv,{children:[R(zv,{children:[I($u,{}),I(To,{children:e})]}),I("div",{className:KN({alignItems:"center",gap:15}),children:t})]})}function K_({conversationId:e,defaultValues:t}){const[n,r]=d(e),{query:{data:a}}=Ll(n),o="CLOSED"===a?.resolutionStatus;return I(vU,{children:R(bU,{children:[I(q_,{subject:a?.subject??"Conversation"}),I(AB,{conversationId:n,setConversationId:r,isResolved:o,isUnread:"UNREAD"===a?.readStatus,defaultValues:t})]})})}const Y_=vi(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 Z_({onClick:e,active:t}){return I(Xs,{type:"button",onClick:e,active:t,children:I(Sd,{Component:Y_})})}const G_=tr({display:"flex",flexDirection:"column"});function Q_({label:e,data:t,isFilling:n,shimmerWidth:r}){return R("div",{className:G_,children:[I(Eo,{children:e}),n?I(wB,{width:r}):I(To,{wrap:"wrap",children:t??""})]})}function X_({transactionId:e,isOpen:t}){const{query:{data:n},isFilling:r}=xs({id:e}),a=lg(n?.bankAccount.id??"");if(sr(n))return null;const o=_N({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:KN({justifyContent:"space-between"}),children:[I(Q_,{label:"Date",data:n?.date,isFilling:r,shimmerWidth:"md"}),I(Q_,{label:"Amount",data:bo(sh(n.amount)),isFilling:r,shimmerWidth:"sm"})]}),I(Q_,{label:"Bank Account",data:uh(a?.name??"",a?.mask??""),isFilling:r,shimmerWidth:"lg"}),I(Q_,{label:"Description",data:n?.description,isFilling:r,shimmerWidth:"lg"})]})}function J_({conversationId:e,transactionId:t}){const[n,r]=d(e),[a,o]=d(!0),{query:{data:i}}=Ll(n),l="CLOSED"===i?.resolutionStatus;return I(vU,{children:R(bU,{children:[I(q_,{subject:i?.subject??"Conversation",children:cr(t)&&I(Z_,{onClick:()=>o(!a),active:a},"infoButton")}),cr(t)&&I(X_,{transactionId:t,isOpen:a}),I(AB,{conversationId:n,setConversationId:r,isResolved:l,isUnread:"UNREAD"===i?.readStatus})]})})}function $_(){const e=os().length>1;return I(vU,{children:R(bU,{background:"foreground",children:[I(Hv,{children:R(zv,{children:[I($u,e?{Icon:nl}:{}),I(To,{children:"Add New Connection"})]})}),I(BA,{})]})})}function ej(){return I(Hv,{children:R(zv,{children:[I($u,{}),I(To,{children:"Financial Summary"})]})})}const tj=tr({display:"flex",flexDirection:"column",flex:1,padding:"15px",gap:"8px",width:"512px",overflow:"scroll"}),nj=xr.raw({body:"default"}),rj=tr({backgroundColor:"surface.foreground",border:"{borderWidths.lg} solid {colors.border.layout}",borderRadius:"md",padding:"12px",whiteSpace:"pre-wrap",overflowWrap:"break-word"},nj);function aj({summaryText:e}){return I("div",{className:tj,children:I("div",{className:rj,children:e})})}const oj=tr({display:"flex",flexDirection:"column",overflow:"auto"});function ij({summary:e}){return R("div",{className:oj,children:[I(ej,{}),I(aj,{summaryText:e})]})}const lj=tr({display:"flex",flexDirection:"row",maxHeight:"100%",overflow:"hidden",flexShrink:1,flexGrow:1});function sj({summaryId:e,conversationId:t}){const{query:{data:n}}=function({id:e}){return Vr({queryKey:Ps({id:e}),queryFn:Ms})}({id:e});return I(vU,{children:R("div",{className:lj,children:[I(bU,{children:I(ij,{summary:n?.summary})}),I(ip,{}),I(SB,{conversationId:t??null,attachedEntityId:e})]})})}function cj(){return I(vU,{children:I(bU,{children:I($A,{showCloseButton:!0,inOverlay:!0})})})}const dj=S.object({id:S.string(),name:S.string({message:"Required"}).refine(e=>e.trim().length>0,{message:"Required"}),mask:S.string({message:"Required"}).refine(e=>e.trim().length<=4,{message:"Must be 4 digits or less"}),type:S.enum(["DEPOSITORY","CREDIT","INVESTMENT","EQUITY","LOAN","OTHER"],{message:"Required"})}).check(e=>{const{id:t,mask:n}=e.value;Ir(t)&&0===n.trim().length&&e.issues.push({code:"custom",message:"Required",input:e.value,path:["mask"]})}),uj={mergeDestination:Ng,selectedAccount:null};const hj=tr({display:"flex",flexDirection:"column",gap:"20px"}),pj=tr({display:"grid",gridTemplateColumns:{sm:"300px auto 300px",base:"100%"},gap:"10px",rowGap:"25px",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px"}),mj=tr.raw({display:"flex",flexDirection:"column",gap:"15px",width:"100%",maxWidth:"300px",height:"100%",justifyContent:"flex-start"}),gj=tr(mj,{placeSelf:{sm:"flex-start",base:"center"},alignItems:{sm:"flex-start",base:"center"},maxWidth:{sm:"300",base:"auto"}}),vj=tr(mj,{placeSelf:"center",alignItems:"center",maxWidth:{sm:"300",base:"auto"}}),fj=tr(mj,{placeSelf:{sm:"flex-end",base:"center"},alignItems:{sm:"flex-end",base:"center"},maxWidth:{sm:"300",base:"auto"}}),bj=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"}),yj=tr({justifyContent:"center",display:"flex",transform:{sm:"none",base:"rotate(90deg)"}}),wj=tr({width:"100%",display:"flex",justifyContent:"flex-start"}),Cj=tr({width:"100%",display:"flex",justifyContent:{sm:"center",base:"flex-start"}}),xj=tr({width:"100%",display:"flex",justifyContent:{sm:"flex-end",base:"flex-start"}}),Tj=e=>{kp(e),Ep(e)};function kj({account:e}){const t=kc(),n=function(e,t){const{mutateAsync:n}=Uh(),r=yH();return vb({defaultValues:uj,onSubmit:async a=>{if(await jh()===ju&&cr(e)&&cr(a.value.selectedAccount)){const s=(o=e,i=a.value.mergeDestination,l=a.value.selectedAccount,i===Ng?{...zh(l),duplicateBankAccountIds:[cs(o.id)]}:{...zh(o),duplicateBankAccountIds:[cs(l.id)]});try{await n(s),t.close(),a.value.mergeDestination===Ng&&r()}catch{await qh()}}var o,i,l},onSubmitInvalid:()=>{}})}(e,t),{query:{data:r},isFilling:a}=bh();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:hj,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),n.handleSubmit()},onKeyDown:Tj,children:[I(To,{children:"Merge Accounts"}),I("div",{className:pj,children:I(n.Subscribe,{selector:e=>e.values.mergeDestination,children:t=>R(N,{children:[R("div",{className:gj,children:[I("div",{className:wj,children:I(To,{children:"Duplicate Account"})}),t===Ng?I(Tg,{accountName:e.name,accountNo:e.mask,institutionId:e.integration?.apiInstitutionId??""}):I(n.AppField,{name:"selectedAccount",children:n=>I(Pg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Dg(t,e,n.state.value)})})]}),R("div",{className:vj,children:[I("div",{className:Cj,children:I(To,{children:"Into"})}),I(n.AppField,{name:"mergeDestination",children:e=>I("div",{className:yj,children:I(Xs,{onClick:()=>e.handleChange(e.state.value===Ng?Ig:Ng),children:I(Sd,{Component:rl})})})})]}),R("div",{className:fj,children:[I("div",{className:xj,children:I(To,{children:"Destination Account"})}),t===Ng?I(n.AppField,{name:"selectedAccount",children:n=>I(Pg,{selectedAccount:n.state.value,setSelectedAccount:n.handleChange,mergeDestination:t,bankAccounts:o,isFilling:a,warningMessage:Dg(t,e,n.state.value)})}):I(Tg,{accountName:e.name,accountNo:e.mask,institutionId:e?.integration?.apiInstitutionId??""})]})]})})}),R("div",{className:bj,children:[I(wb,{showIcon:!1,onClick:()=>{t.close()}}),I(n.Subscribe,{selector:e=>e.values.selectedAccount,children:e=>I(Jh,{disabled:sr(e),showIcon:!1,textContent:"Merge"})})]})]})}function Ej({bankAccount:e}){return I(Lm,{children:R(Tc,{placement:"right-start",children:[I(Ec,{children:e=>R(Wm,{...e,children:[I(Sd,{Component:fE}),I(To,{children:"Merge Account"})]})}),I(Pv,{children:I(Lv,{children:I(lE,{children:I(kj,{account:e})})})})]})})}const Aj=tr({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"}}}),Sj=({tranStartDate:e})=>R(N,{children:[I(Eo,{children:"Start Date"}),Nr(e)?I(To,{children:`${Ft(Nt(e))}`}):I(To,{children:"Set Start Date"})]});function Ij({bankAccount:e}){return R(Tc,{placement:"right-start",children:[I(Ec,{children:t=>I("button",{className:rr(ur(lr["start-date-form-section"]),Aj,ll),...t,type:"button",children:I(Sj,{tranStartDate:e.tranStartDate})})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(mE,{bankAccounts:[e]})})})})]})}const Nj=e=>["accounting/manualJournalEntry",e.id],Rj=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 Ai(a)};function Pj({id:e}){return Vr({queryKey:Nj({id:String(cs(e))}),queryFn:Rj,enabled:cr(e)})}const Dj=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:Oa(n)};return await Pa(r)})({data:e,accessToken:t,environment:n});const Mj=async({data:e,accessToken:t,environment:n})=>{const r={path:"/banks/beginningBalance",bodyParams:e,accessToken:t,endpointManager:Oa(n)};return await Pa(r)},Lj=S.object({amount:S.number({message:"Required"}).refine(e=>e>=0,{message:"Amount must be above 0"}),date:S.string("Required")}),Fj=(e,t)=>{const n=t?.transactions?.find(t=>e.glAccountId&&t?.glAccountId===cs(e.glAccountId));return 0===n?.crAmount?n?.drAmount:n?.crAmount},Oj=e=>{const t=e.beginningBalanceData.journalEntry?.id,{query:{data:n}}=Pj({id:t??null}),r=function(){const{query:{data:e}}=vC();return AC(e,["EQUITY"]).filter(e=>"CAPITAL"===e.equityType||"OPENING_BALANCE"===e.equityType)}(),{mutateAsync:a}=Dh({mutationFn:Mj,meta:{toastOptions:{defaultErrorMessage:"Couldn't save beginning balance"}},onSuccess:async()=>{ya("beginning balance mutation successful, invalidating bank account queries");try{return Lr.invalidateQueries({queryKey:["banks/accounts",{}]})}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}}});const{mutateAsync:o}=Dh({onSuccess:async()=>{ya("mutation successful, invalidating manual journal entry queries");try{return Promise.all([Lr.invalidateQueries({queryKey:["accounting/manualJournalEntry"]}),Lr.invalidateQueries({queryKey:["banks/accounts",{}]})])}catch(e){e instanceof Error&&wa({error:e,severity:"error"})}},mutationFn:Dj,meta:{toastOptions:{defaultErrorMessage:"Couldn't update journal entry"}}}),i=kc(),l=((e,t)=>{const n=Fj(e,t);return{amount:cr(e.beginningBalanceData.journalEntry?.id)?n:"",date:cr(t?.date)?t.date:""}})(e,n);return vb({defaultValues:l,validators:{onBlur:Lj},onSubmit:async l=>{if(sr(t)||sr(n))await a({bankAccountId:cs(e.id),balance:Number(l.value.amount),date:l.value.date});else{const t=((e,t,n,r,a)=>{if(sr(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))}),sr(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=Rt(t)??o.date,o)})(n,Nt(l.value.date)||new Date(l.value.date),Number(l.value.amount),e,r);cr(t)&&await o(t)}return i.close()}})},Vj=tr({display:"flex",flexDirection:"column",gap:"10px",justifyContent:"space-between",maxWidth:"900px",minWidth:"360px"}),Uj=tr({display:"flex",flexDirection:"row",gap:"15px",justifyContent:"flex-end"});function Bj({bankAccount:e}){const t=Oj(e),n=kc(),r=()=>{n.close()};return R("form",{className:Vj,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.handleSubmit()},children:[I(To,{children:"Set Beginning Balance"}),I(t.AppField,{name:"date",children:e=>I(e.DateInput,{label:"Beginning Balance Date",maxDate:/* @__PURE__ */new Date,editable:!0})}),I(t.AppField,{name:"amount",children:e=>I(e.EditableAmountField,{label:"Beginning Balance Amount"})}),I(t.Subscribe,{selector:e=>e,children:e=>R("div",{className:Uj,children:[I(wb,{showIcon:!1,onClick:r}),I(Jh,{showIcon:!1,textContent:"Confirm",disabled:!e.isDirty})]})})]})}const Hj=or({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"}}}}),Wj=tr({display:"flex",flexDirection:"row",gap:"8px",width:"100%"});function zj({bankAccount:e,hasMigrationDate:t,beginningBalanceAmount:n,beginningBalanceDate:r,layout:a="left"}){const o=gr(lr["beginning-balance-form-section"],Hj({layout:a}),ll),i=gr(lr["beginning-balance-form-section"],Hj({layout:"right"}),ll),l=r&&Ft(r);return R(Tc,{placement:"right-start",children:[I(Ec,{children:e=>R("div",{className:Wj,children:[R("button",{...o,...e,type:"button",children:[I(Eo,{children:"Beginning Balance"}),I(To,{children:cr(n)?`$${n}`:"Set Beginning Balance"})]}),t&&l&&R("button",{...i,...e,type:"button",children:[I(Eo,{children:"Migration Date"}),I(To,{children:l})]})]})}),I(Pv,{children:I(Lv,{children:I(lE,{width:"sm",children:I(Bj,{bankAccount:e})})})})]})}const _j=or({base:{display:"flex",gap:"8px",width:"100%"},variants:{layout:{stacked:{flexDirection:"column"},inline:{flexDirection:"row"}}}});function jj({bankAccount:e,showStartDate:t}){const{query:{data:n}}=Pj({id:e?.beginningBalanceData.journalEntry?.id??null}),r=Fj(e,n),a=cr(n?.date)?Nt(n?.date):null,o=cr(e.tranStartDate)?Nt(e.tranStartDate):null,i=cr(a)&&cr(o)&&!Tt(a,o),l=i?"left":t?"right":"left";return R("div",{className:_j({layout:i?"stacked":"inline"}),children:[t&&I(Ij,{bankAccount:e}),I(zj,{bankAccount:e,hasMigrationDate:i,layout:l,beginningBalanceAmount:r,beginningBalanceDate:a})]})}const qj=tr({marginTop:"15px",marginBottom:"15px"}),Kj={id:"",name:"",mask:"",type:void 0};const Yj=[{value:"DEPOSITORY",label:"Bank Account"},{value:"CREDIT",label:"Credit Card"}],Zj=e=>{kp(e),Ep(e)};function Gj({bankAccountId:e}){const t=lg(e),n=t?{id:t.id,name:t.name,mask:t.mask,type:t.type}:Kj,[r,a]=d(n),o=function(e,t){const{mutateAsync:n}=Uh(),{mutateAsync:r}=Vh({mutationFn:Lh,meta:{toastOptions:{defaultSuccessMessage:"Account created",defaultErrorMessage:"Couldn't create account"}}}),a=Nr(String(e.id)),o=yH();return vb({defaultValues:e,validators:{onBlur:dj},onSubmit:async e=>{if(a)await n(zh(e.value)),t(e.value),e.formApi.reset(e.value,{keepDefaultValues:!0});else{const n=await r((i=e.value,{apiAccountName:i.name,apiAccountNo:i.mask??void 0,apiAccountType:i.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 i;return o()},onSubmitInvalid:()=>{}})}(r,a),i=!t||Hh(t.apiName),l=!!t&&Wh(t.apiName),s=uh(r?.name??"",r?.mask??""),c=Nr(s)?s:"New Bank Account",u=l&&cr(t?.tranStartDate);return I(vU,{children:I(bU,{children:R("form",{onSubmit:e=>{e.preventDefault(),o.handleSubmit()},onKeyDown:Zj,children:[R(Hv,{children:[R(zv,{children:[I($u,{Icon:nl}),I(To,{children:c}),cr(t)&&I(aE,{shouldUseButtonDiscreteStyles:!0,children:I(Ej,{bankAccount:t})})]}),I(o.Subscribe,{selector:e=>e.isDefaultValue,children:e=>e?null:I(o.SaveButton,{})})]}),R(NB,{children:[I(o.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",disabled:!i,placeholder:"Enter name..."})}),I(o.AppField,{name:"mask",children:e=>I(e.TextField,{label:"Last 4 Digits (Mask)",type:"number",disabled:!i,placeholder:"0000",maxLength:4})}),I(o.AppField,{name:"type",children:e=>I(e.GenericSelectorField,{label:"Account Type",options:Yj,disabled:!i})}),cr(t)&&R(N,{children:[I("div",{className:qj,children:I(ip,{alignment:"horizontal"})}),I(jj,{bankAccount:t,showStartDate:u})]})]})]})})})}function Qj({filters:e,filterModels:t,setFilters:n}){const r=os().length>1,[a,o]=d(()=>KT(e,t));return I(vU,{children:R(bU,{children:[I(Hv,{children:R(zv,{children:[I($u,r?{Icon:nl}:{}),I(sc,{children:"Back"})]})}),I(HF,{filters:e,filterModels:t,setFilters:n,pendingFilters:a,setPendingFilters:o}),I(AS,{onClearAll:()=>{const e=/* @__PURE__ */new Map;t.forEach(t=>{e.set(t.key,[])}),o(e)},onApply:()=>{const e=GT(a);n(e),as()}})]})})}function Xj({dashboardKey:e,filterPopupModels:t}){const{filters:n,setFilters:r}=EI(e);return I(Qj,{filters:n,filterModels:t,setFilters:r})}function Jj(){const e=pP();return I(Xj,{dashboardKey:"expenseDashboard",filterPopupModels:e.filterPopupModels})}function $j(){const e=PP();return I(Xj,{dashboardKey:"incomeDashboard",filterPopupModels:e.filterPopupModels})}function eq(){const e=OI();return I(Xj,{dashboardKey:"transactionsDashboard",filterPopupModels:e.filterPopupModels})}function tq({Icon:e,label:t,popupTriggerChildrenProps:n}){return R(pf,{popupTriggerChildrenProps:n,children:[R(iS,{children:[I(Sd,{Component:e}),I(sc,{children:t})]}),I(Sd,{Component:rl})]})}const nq=vi(DH,"Expenses");function rq(){return I(tq,{Icon:nq,label:"Categories"})}const aq=vi(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"),oq=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function iq(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 lq(e,t){return{search:Nr(e)?e:void 0,status:{in:t}}}function sq(e){return e.pages.flatMap(e=>(e.data??[]).map(iq))}const cq=Object.freeze({state:"",city:"",zip:"",phoneWork:"",address1:"",address2:""});function dq(e){return{state:e?.state??"",city:e?.city??"",zip:e?.zip??"",phoneWork:e?.phoneWork??"",address1:e?.address1??"",address2:e?.address2??""}}function uq(e,t){const n=(e,n)=>pH(e=>!t(e),e,n);return{state:n("state",Ir(e.state)?void 0:e.state),city:n("city",Ir(e.city)?void 0:e.city),zip:n("zip",Ir(e.zip)?void 0:e.zip),phoneWork:n("phoneWork",Ir(e.phoneWork)?void 0:e.phoneWork),address1:n("address1",Ir(e.address1)?void 0:e.address1),address2:n("address2",Ir(e.address2)?void 0:e.address2)}}const hq=Object.freeze({id:void 0,status:"ACTIVE",name:"",billingContactName:"",email:"",ccEmails:[],bccEmails:[],invoicePrefix:"",address:cq});function pq(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:dq(e.address)}}const mq=S.object({state:S.string(),city:S.string(),zip:S.string(),phoneWork:S.string(),address1:S.string(),address2:S.string()}),gq=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),billingContactName:S.string().optional(),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),email:S.email().or(S.literal("")),ccEmails:S.array(S.email()),bccEmails:S.array(S.email()),invoicePrefix:S.string().optional(),address:mq.optional()});function vq({customer:e}){const{mutateAsync:t}=Ev(),n=kc();return vb({defaultValues:e??hq,validators:{onSubmit:gq},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t,n){const a=(e,t)=>pH(e=>!(e=>r.getFieldMeta(e)?.isDefaultValue??!0)(e),e,t),o=Object.keys(cq).filter(e=>e in cq).some(e=>!n(e))?uq(e.address??cq,n):void 0,i=a("invoicePrefix",Nr(e.invoicePrefix)?e.invoicePrefix:void 0);return{id:e.id,name:e.name,additionalContactName:a("billingContactName",Nr(e.billingContactName)?e.billingContactName:void 0),email:a("email",Nr(e.email)?e.email:void 0),ccEmails:a("ccEmails",e.ccEmails),bccEmails:a("bccEmails",e.bccEmails),invoiceSettings:sr(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 fq=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})),bq=tr({display:"flex",alignItems:"center",width:"100%",gap:"20px"}),yq=tr({width:"100%"}),wq=bb({defaultValues:cq,props:{disabled:!1},render:function({group:e,disabled:t}){return R(N,{children:[I(e.AppField,{name:"address1",children:e=>I(e.TextField,{label:"Address Line 1",placeholder:"Street address",disabled:t})}),I(e.AppField,{name:"address2",children:e=>I(e.TextField,{label:"Address Line 2",placeholder:"Apt, suite, unit, etc.",disabled:t})}),I(e.AppField,{name:"city",children:e=>I(e.TextField,{label:"City",placeholder:"City",disabled:t})}),R("div",{className:bq,children:[I("div",{className:yq,children:I(e.AppField,{name:"state",children:()=>I(hg,{label:"State",options:[{label:"Select State",value:""},...fq],isEmpty:Ir,disabled:t})})}),I("div",{className:yq,children:I(e.AppField,{name:"zip",children:e=>I(e.TextField,{label:"Zip Code",placeholder:"Zip code",disabled:t})})})]}),I(e.AppField,{name:"phoneWork",children:e=>I(e.PhoneNumberField,{label:"Phone Number",placeholder:"(555) 555-5555",disabled:t})})]})}}),Cq=tr.raw({width:"100%"});function xq({children:e,onSave:t,onRestore:n,restoreLabel:r,disabled:a,isArchived:o,isSubmitting:i}){const l=wT();return R(N,{children:[I(ip,{alignment:"horizontal",color:"normal"}),R("div",{className:lp,children:[!o&&I(ap,{disabled:a,onClick:t,isSubmitting:i}),o&&l&&I(Xs,{onClick:n,styles:Cq,children:I(sc,{children:r})}),e]})]})}const Tq=tr({display:"flex",gap:"8px"});function kq({title:e,customer:t}){const n=vq({customer:t}),[r,a]=d(n.state.values.ccEmails.length>0),[o,i]=d(n.state.values.bccEmails.length>0),l=kc(),s=wT(),c="ACTIVE"===t?.status,u="INACTIVE"===t?.status,h=u&&!s,{mutateAsync:p}=Xg({mutationFn:Tv,onSuccess:kv,meta:{toastOptions:{defaultSuccessMessage:"Customer deleted",defaultErrorMessage:"Couldn't delete customer"}}}),{mutateAsync:m}=Ev(),g=PH(n),v=async()=>{if(sr(t))return;"RESTORE"===await async function(e){return ih({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)&&await g(async()=>{await m({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),l.close()})},f=c||h?I(aE,{shouldUseButtonDiscreteStyles:!0,children:R(Lm,{children:[c&&I(NH,{onClick:async()=>{if(sr(t))return;const{id:e}=t;if(sr(e))return;"ARCHIVE"===await async function(e){return ih({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)&&await g(async()=>{await p({id:e}),l.close()})}}),u&&I(RH,{onClick:v})]})}):null,b=h?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:t})=>I(xq,{onSave:n.handleSubmit,disabled:e,restoreLabel:"Restore Customer",onRestore:v,isArchived:u,isSubmitting:t})});return I(qv,{title:e,HeaderRightAction:f,Footer:b,padChildren:!1,children:R(NB,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Customer Name",placeholder:"Enter customer name",maxLength:255,disabled:u})}),I(n.AppField,{name:"billingContactName",children:e=>I(e.TextField,{label:"Billing Contact Name",placeholder:"Enter contact name",disabled:u})}),I(n.AppField,{name:"email",children:e=>I(e.TextField,{label:"Billing Email",placeholder:"Add email address",disabled:u})}),I(n.AppField,{name:"ccEmails",children:e=>r&&I(e.MultiEmailField,{label:"CC Billing Emails",disabled:u})}),I(n.AppField,{name:"bccEmails",children:e=>o&&I(e.MultiEmailField,{label:"BCC Billing Emails",disabled:u})}),(!r||!o)&&R("div",{className:Tq,children:[!r&&I(zc,{onClick:()=>a(!0),children:"CC"}),!o&&I(zc,{onClick:()=>i(!0),children:"BCC"})]}),I(n.AppField,{name:"invoicePrefix",children:e=>I(e.TextField,{label:"Invoice Number Prefix",placeholder:"e.g. ACME",disabled:u})}),I(wq,{form:n,fields:"address",disabled:u})]})})}function Eq({title:e,customer:t}){const n=kc();return I(Ov,{children:n.open&&I(kq,{title:e,customer:t})})}const Aq=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function Sq({customer:e}){const t=kf(),[n,r]=d(!1),a=R(N,{children:[R(iS,{children:[I(Td,{Component:aq}),R("div",{className:Aq,children:[I(sc,{children:e.name}),e.email&&I(Eo,{children:e.email})]})]}),I(Sd,{Component:rl})]});if(t?.preventDefault)return I(pf,{handleClick:()=>{t.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null})},children:a});const o=()=>{t?.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:e,error:null}),r(!0)};return R(Tc,t?{enableClickMiddleware:!1,open:n,onOpenChange:r,children:[I(Ec,{children:e=>I(pf,{handleClick:o,popupTriggerChildrenProps:e,children:a})}),I(Eq,{title:"Edit Customer",customer:pq(e)})]}:{children:[I(Ec,{children:e=>I(pf,{popupTriggerChildrenProps:e,children:a})}),I(Eq,{title:"Edit Customer",customer:pq(e)})]})}const Iq=tr.raw({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"surface.foreground",height:"100%",minWidth:{sm:"80px",md:"110px"}});function Nq({selectedValue:e,Icon:t=Lp,options:n,onClick:r,additionalStyles:a=[]}){return R(Tc,{children:[I(Ec,{children:n=>R(Xs,{popupTriggerProps:n,styles:[Iq,...a],children:[I(sc,{children:e.label}),I(Sd,{Component:t})]})}),I(sg,{options:n,onClick:r})]})}const Rq=tr({display:"flex",flexDirection:"column",gap:"8px",width:"100%"}),Pq=tr({display:"flex",gap:"8px"}),Dq=tr.raw({minWidth:{sm:"80px",md:"110px"},borderRadius:"sm"});function Mq({searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:a,placeholder:o,isLoading:i}){return R("div",{className:Rq,children:[I(sc,{intent:"weak",children:"Search"}),R("div",{className:Pq,children:[I(WH,{searchTerm:e,onChange:t,isFetching:i,placeholder:o}),I(Nq,{selectedValue:n,options:a,onClick:e=>r(e),additionalStyles:[Dq]})]})]})}const Lq=R(N,{children:[I(Sd,{Component:Os}),I(sc,{children:"Add Customer"})]});function Fq(){const e=kf(),[t,n]=d(!1);if(e?.preventDefault)return I(Xs,{onClick:()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null})},children:Lq});if(cr(e)){const r=()=>{e.listener({type:"OPEN_CUSTOMER",result:"SUCCESS",data:null,error:null}),n(!0)};return R(Tc,{enableClickMiddleware:!1,open:t,onOpenChange:n,children:[I(Ec,{children:e=>I(Xs,{onClick:r,popupTriggerProps:e,children:Lq})}),I(Eq,{title:"Add Customer",customer:void 0})]})}return R(Tc,{children:[I(Ec,{children:e=>I(Xs,{popupTriggerProps:e,children:Lq})}),I(Eq,{title:"Add Customer",customer:void 0})]})}function Oq(){const[e,t]=d(""),[n,r]=d(oq[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 Hg({queryFn:Cv,queryKey:fv(e),...t})}({filter:lq(e,t)},{select:sq});return{list:ef({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(qv,{title:"Back",HeaderRightAction:I(Fq,{}),padChildren:!0,children:[I(Mq,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:oq,placeholder:"Search customers...",isLoading:l}),a.groups.map(e=>I(hS,{label:"Customers",pluralLabel:"customers",singularLabel:"customer",zeroState:!l&&0===e.getRows().length,children:e.getRows().map(e=>I(Sq,{customer:e.value},e.value.id))},e.key)),I(QH,{onIntersect:o,enable:i})]})}function Vq(){const e=kc();return I(Ov,{children:e.open&&I(Oq,{})})}function Uq(){return R(Tc,{children:[I(Ec,{children:e=>I(tq,{Icon:aq,label:"Customers",popupTriggerChildrenProps:e})}),I(Vq,{})]})}const Bq=vi(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"),Hq=Object.freeze({id:void 0,name:"",status:"ACTIVE",address:cq,iconUrl:void 0});function Wq(e){return{id:e.id,name:e.name,status:e.status,address:dq(e.address),iconUrl:e.iconUrl||void 0}}const zq=S.object({id:S.string().optional(),name:S.string().trim().min(1,{message:"Required"}).max(255,{message:"Name must be less than or equal to 255 characters"}),status:S.enum(["ACTIVE","INACTIVE","REMOVED"]),address:mq.optional(),iconUrl:S.string().optional()});const _q=[{label:"Active",value:["ACTIVE"]},{label:"Archived",value:["INACTIVE"]}];function jq(e){return{id:e.id,name:e.name,status:e.status,iconUrl:e.iconUrl,address:e.address}}function qq(e,t,n){return{search:Nr(e)?e:void 0,name:sr(n)?void 0:{notEqual:n},status:{in:t}}}function Kq(e){return e.pages.flatMap(e=>(e.data??[]).map(jq))}function Yq({searchTerm:e,statuses:t,excludeVendorName:n,selected:r,onSelectedChange:a}){const{query:{data:o,fetchNextPage:i,isFetching:l,hasNextPage:s,isFetchingNextPage:c}}=(d={filter:qq(e,t,n)},u={select:Kq},Hg({queryFn:Kg,queryKey:zg(d),...u}));var d,u;return{list:ef({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 Zq=vi(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"),Gq=tr({display:"flex",flexDirection:"column",gap:"16px",width:"100%"}),Qq=tr({display:"flex",flexDirection:{base:"column",md:"row"},alignItems:"center",gap:"8px",width:"100%"}),Xq=or({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"}}}}),Jq=tr({display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}),$q=tr({color:"icon.base.weak",transform:{base:"rotate(90deg)",md:"none"}});function eK({targetVendor:e,duplicateVendor:t}){return R("div",{className:Gq,children:[I(sc,{wrap:"wrap",children:`"${t.name}" will be archived after the transactions are merged into "${e.name}"`}),R("div",{className:Qq,children:[R("div",{className:Xq({archivedVendor:!0}),children:[I(Sd,{imageUrl:t.iconUrl,Component:Bq}),I(sc,{intent:"weak",children:t.name})]}),R("div",{className:Jq,children:[I(Sd,{Component:Zq,stylists:[gr(null,$q)]}),I(Eo,{intent:"weak",children:"Merging Into"})]}),R("div",{className:Xq({archivedVendor:!1}),children:[I(Sd,{imageUrl:e.iconUrl,Component:Bq}),I(sc,{children:e.name})]})]}),I(sc,{wrap:"wrap",children:"This process may take a moment to complete"})]})}function tK({vendor:e,onClose:t}){const{mutate:n}=Xg({mutationFn:nv,onSuccess:rv}),[r,a]=d({}),[o,i]=d(""),{list:l,data:s,fetchNextPage:c,isFetching:u,hasNextPage:h,isLoading:p}=Yq({searchTerm:o,statuses:["ACTIVE"],excludeVendorName:e.name,selected:r,onSelectedChange:a}),m=kc(),g=I(hp,{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 ih({title:"Confirm Merge",body:I(eK,{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()),m.close()},disabled:p||Object.values(r).every(e=>!e)});return R(qv,{title:"Back",Footer:g,padChildren:!0,children:[I(WH,{searchTerm:o,onChange:i,isFetching:p,placeholder:"Search vendors..."}),l.groups.map(e=>I(hS,{label:"Select Vendor",pluralLabel:"vendors",singularLabel:"vendor",zeroState:0===e.getRows().length,children:e.getRows().map(e=>I(mf,{selected:r[e.value.id],handleClick:()=>l.toggleSelected(e.value.id),children:R(iS,{children:[I(Td,{imageUrl:e.value.iconUrl??void 0,Component:Bq}),I(sc,{children:e.value.name})]})},e.value.id))},e.key)),I(QH,{onIntersect:c,enable:!u&&h})]})}function nK({vendor:e,onClose:t}){const n=kc();return I(Ov,{children:n.open&&I(tK,{vendor:e,onClose:()=>{t(),n.close()}})})}function rK({vendor:e,onClose:t}){return R(Tc,{children:[I(Ec,{children:e=>I(lN,{popupTriggerProps:e,closeOnClick:!0,children:"Merge"})}),I(nK,{vendor:e,onClose:t})]})}const aK=tr.raw({width:"100%"});function oK({vendor:e,onSave:t,onRestore:n,onClose:r,disabled:a,isArchived:o,isSubmitting:i}){const l=wT();return I(xq,{onSave:t,onRestore:n,restoreLabel:"Restore Vendor",disabled:a,isArchived:o,isSubmitting:i,children:l&&!sr(e)&&R(Tc,{children:[I(Ec,{children:e=>I(Xs,{popupTriggerProps:e,styles:aK,children:I(sc,{children:"Merge"})})}),I(nK,{vendor:e,onClose:r})]})})}function iK({title:e,vendor:t}){const n=function({vendor:e}){const{mutateAsync:t}=av(),n=kc();return vb({defaultValues:e??Hq,validators:{onSubmit:zq},onSubmit:async({value:e,formApi:r})=>{const a=function(e,t){const n=Object.keys(cq).filter(e=>e in cq).some(e=>!t(e))?uq(e.address??cq,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}),r=kc(),a=wT(),o="ACTIVE"===t?.status,i="INACTIVE"===t?.status,{mutateAsync:l}=Xg({mutationFn:tv,onSuccess:rv,meta:{toastOptions:{defaultSuccessMessage:"Vendor deleted",defaultErrorMessage:"Couldn't delete vendor"}}}),{mutateAsync:s}=av(),c=PH(n),d=async()=>{if(sr(t))return;"RESTORE"===await async function(e){return ih({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)&&await c(async()=>{await s({data:[{id:t.id,name:t.name,status:"ACTIVE"}]}),r.close()})},u=o&&(!a||o),h=i&&!a,p=sr(t)||!u&&!h?null:I(aE,{shouldUseButtonDiscreteStyles:!0,children:R(Lm,{children:[i&&I(RH,{onClick:d}),!a&&I(rK,{vendor:t,onClose:()=>r.close()}),o&&I(NH,{onClick:async()=>{if(sr(t)||sr(t.id))return;const{id:e}=t;if(sr(e))return;"ARCHIVE"===await async function(e){return ih({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)&&await c(async()=>{await l({id:e}),r.close()})}})]})}),m=i&&!a?null:I(n.Subscribe,{selector:e=>({isDefaultValue:e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({isDefaultValue:e,isSubmitting:a})=>I(oK,{vendor:t,onSave:n.handleSubmit,onRestore:d,onClose:()=>r.close(),disabled:e,isSubmitting:a,isArchived:i})});return I(qv,{title:e,HeaderRightAction:p,Footer:m,padChildren:!1,children:R(NB,{children:[I(n.AppField,{name:"name",children:e=>I(e.TextField,{label:"Name",placeholder:"Enter vendor name",disabled:i,maxLength:255})}),I(wq,{form:n,fields:"address",disabled:i})]})})}function lK({title:e,vendor:t}){const n=kc();return I(Ov,{children:n.open&&I(iK,{title:e,vendor:t})})}const sK=tr({display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",minWidth:0});function cK({vendor:e}){return R(Tc,{children:[I(Ec,{children:t=>R(pf,{popupTriggerChildrenProps:t,children:[R(iS,{children:[I(Td,{imageUrl:e.iconUrl??void 0,Component:Bq}),I("div",{className:sK,children:I(sc,{children:e.name})})]}),I(Sd,{Component:rl})]})}),I(lK,{title:"Edit Vendor",vendor:Wq(e)})]})}function dK(){const[e,t]=d(""),[n,r]=d(_q[0]),{list:a,fetchNextPage:o,isFetching:i,hasNextPage:l,isLoading:s}=Yq({searchTerm:e,statuses:n.value}),c=wT();return R(qv,{title:"Back",HeaderRightAction:R(Tc,{children:[I(Ec,{children:e=>R(Xs,{popupTriggerProps:e,children:[I(Sd,{Component:Os}),!c&&I(sc,{children:"Add Vendor"})]})}),I(lK,{title:"Add Vendor",vendor:void 0})]}),padChildren:!0,children:[I(Mq,{searchTerm:e,setSearchTerm:t,status:n,setStatus:r,statusOptions:_q,placeholder:"Search vendors...",isLoading:s}),a.groups.map(e=>I(hS,{label:"Vendors",pluralLabel:"vendors",singularLabel:"vendor",zeroState:!s&&0===e.getRows().length,children:e.getRows().map(e=>I(cK,{vendor:e.value},e.value.id))},e.key)),I(QH,{onIntersect:o,enable:!i&&l})]})}function uK(){const e=kc();return I(Ov,{children:e.open&&I(dK,{})})}function hK(){return R(Tc,{children:[I(Ec,{children:e=>I(tq,{Icon:Bq,label:"Vendors",popupTriggerChildrenProps:e})}),I(uK,{})]})}const pK=tr({padding:"16px"});function mK(){const e=dn(e=>e.FEATUREFLAG_CATEGORY_SETTINGS);return I(vU,{children:R(bU,{children:[I(Hv,{children:R(zv,{children:[I($u,{Icon:nl}),I(To,{children:"Back"})]})}),I("div",{className:pK,children:R(hS,{label:"Transaction Settings",children:[e&&I(rq,{}),I(hK,{}),I(Uq,{})]})})]})})}const gK=or({base:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"8px",cursor:"pointer",padding:"12px 16px",minHeight:"42px",width:"100%",borderRadius:"zero",borderWidth:"md",borderStyle:"solid",borderColor:"transparent",borderLeftWidth:"xl",color:"typography.intent.secondary",_supportHover:{_notDisabled:{backgroundColor:"surface.intent.action.discreet.hover",borderColor:"border.intent.action.hover"}},"&:focus-visible":{outlineWidth:"xl",outlineStyle:"solid",outlineColor:"border.layout"},"&:disabled":{cursor:"not-allowed",opacity:.6}},variants:{selected:{true:{backgroundColor:"surface.foreground",borderLeftColor:"border.intent.action.active"},false:{backgroundColor:"surface.background",borderLeftColor:"transparent"}}}});function vK({children:e,handleClick:t,selected:n=!1}){return I("button",{...gr(lr["selector-row"],gK({selected:n}),ol),"aria-current":n,onClick:t,type:"button",children:e})}const fK=tr({display:"flex",alignItems:"center",gap:"8px",flex:"1 0 0"});function bK({children:e}){return I("div",{className:fK,children:e})}const yK={FinancialOverview:"/",TransactionsDashboard:"/transactions",BanksAndIntegrations:"/banks",ExpenseDashboard:"/expense",IncomeDashboard:"/income",ReportDashboard:"/reports",Invoices_NOT_IMPL:"/invoices",TimeAndTasks_NOT_IMPL:"/time-and-tasks",Mileage_NOT_IMPL:"/mileage",Payroll_NOT_IMPL:"/payroll",ChartOfAccounts_NOT_IMPL:"/chart-of-accounts",GeneralLedger:"/general-ledger",Journal_NOT_IMPL:"/journal",Taxes_NOT_IMPL:"/taxes"};function wK(e,t){return yK[e.page]===t}const CK=tr({display:"flex",flexDirection:"column",gap:"8px"}),xK=tr({marginTop:"8px",marginBottom:"16px"});function TK({section:e,index:t,onClick:n}){const r=function(){const{isApp:e,navigate:t,location:n}=i(Pd);if(e)return{navigate:t,location:n}}();if(sr(r))return null;const{navigate:a,location:o}=r;return R("div",{className:CK,children:[t>0&&I("div",{className:xK,children:I(ip,{alignment:"horizontal"})}),void 0!==e.label&&I(Eo,{intent:"weak",children:e.label}),e.items.map(e=>I(vK,{selected:wK(e,o.pathname),handleClick:()=>{a&&(n?.(),a({page:e.page}))},children:R(bK,{children:[I(Sd,{Component:e.Icon}),I(sc,{children:e.label})]})},e.label))]})}const kK=l(null),EK=l(void 0),AK=tr({display:"flex",flexDirection:"row",minHeight:"55px",justifyContent:"flex-start",alignItems:"center",width:"fit-content",color:"typography.intent.secondary",fontWeight:"label.strong"}),SK=tr({height:"32px",width:"auto",maxWidth:"100%",objectFit:"contain",objectPosition:"left"}),IK=tr({flex:1,overflowY:"auto",display:"flex",flexDirection:"column",padding:"16px",height:"100%"}),NK=tr({paddingTop:"16px",paddingBottom:"16px"});function RK({onClick:e}){const t=i(kK),n=i(EK);if(sr(t))return null;const{sections:r}=t;return R("div",{className:IK,children:[void 0!==n&&R(N,{children:[I("div",{className:AK,children:I("img",{src:n.partnerLogoUrl,alt:n.partnerName,className:SK})}),I("div",{className:NK,children:I(vK,{handleClick:n.onRtlExit,children:R(bK,{children:[I(Sd,{Component:nl}),I(sc,{children:"Exit Bookkeeping"})]})})})]}),r.map((t,n)=>I(TK,{section:t,index:n,onClick:e},t.label??n))]})}function PK(){return I(vU,{side:"left",mobileCoverage:"partial",children:I(RK,{onClick:()=>as()})})}function DK(){return R(uU,{children:[I(pU,{name:"BankTransactionForm",Component:j_}),I(pU,{name:"Conversation",Component:K_}),I(pU,{name:"MobileConversation",Component:J_}),I(pU,{name:"FinancialSummary",Component:sj}),I(pU,{name:"BanksAndIntegrations",Component:cj}),I(pU,{name:"BankAccountForm",Component:Gj}),I(pU,{name:"NewConnection",Component:$_}),I(pU,{name:"TransactionsFilterList",Component:eq}),I(pU,{name:"ExpensesFilterList",Component:Jj}),I(pU,{name:"RevenueFilterList",Component:$j}),I(pU,{name:"TransactionSettingsDrawer",Component:mK}),I(pU,{name:"NavMenu",Component:PK})]})}const MK=({environment:e,children:t})=>I(Fr.Provider,{value:e,children:t});function LK({children:e}){const{query:{data:t}}=Pi(),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 I(Qc.Provider,{value:n,children:e})}const FK=e=>["whiteLabels",e??{}],OK=async e=>{const t=e.queryKey,n={path:"/v6/whiteLabels/query",bodyParams:{...t[1],cursor:t[2].cursor},accessToken:t[3].accessToken,endpointManager:xi(t[3].environment)},r=await Ra(n);return"SUCCESS"===r.result&&void 0!==r.data?{data:r.data,cursor:r.cursor}:{data:void 0,cursor:void 0}};function VK({children:e}){const t=Ii(),{query:{data:n}}=kl({queryKey:FK({filter:{name:{equal:t}}}),queryFn:OK}),r={icons:n?.data?.[0]?.icons};return I(mi.Provider,{value:r,children:e})}const UK=Object.freeze({CACHE_BUST:"CACHE_BUST",CONNECTED:"CONNECTED",HEARTBEAT:"HEARTBEAT",ERROR:"ERROR"});const BK="SSE connection failed with status";function HK({companyId:e,customerPartnerId:t,sseTypes:n}){const r=Or();s(()=>{if(!t)return;const a=new AbortController,o=function(e,t,n,r){const a=new URL(`${o=e,Fa[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 Me(o,{onopen:async e=>async function(e){if(e.status>=400&&e.status<500)throw new Error(`${BK} ${e.status}`)}(e),onmessage:a=>function({event:e,data:t,env:n,sseTypes:r,customerPartnerId:a,companyId:o}){switch(e){case UK.CONNECTED:return void ya("SSE connection established",{env:n,customerPartnerId:a,companyId:o,sseTypes:JSON.stringify(Array.from(r))});case UK.ERROR:throw wa({error:{name:"SSE error message from server",message:t},severity:"error"}),new Error("SSE error message from server");case UK.CACHE_BUST:return ya("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(()=>{Lr.invalidateQueries({predicate:t=>t.queryKey.includes(e)&&"fetching"!==t.state.fetchStatus}).catch(e=>wa({error:e,severity:"error"}))},500*Math.random()),ya(`invalidated query key: ${e} due to cache bust event`)})}catch(t){return void wa({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 wa({error:new Error("SSE connection closed by server"),severity:"warning"}),new Error("Connection closed unexpectedly")}(),onerror:e=>function(e,t){if(e.message.includes(BK))throw e;return 3e3*2**Math.min(t,3)}(e,i++),signal:a.signal}).catch(e=>wa({error:e,severity:"error"})),()=>a.abort("Closing SSE connection")},[r,t,e,n])}const WK=[UK.CACHE_BUST];function zK({children:e}){const{companyId:t,customerPartnerId:n}=i(Qc);return HK({companyId:t,customerPartnerId:n,sseTypes:WK}),e}const _K=l({dimensions:{width:null,height:null}}),jK="undefined"!=typeof window?m:s,qK="undefined"==typeof window;const KK=({children:e})=>{const{width:t,height:n}=function(e={}){let{initializeWithValue:t=!0}=e;qK&&(t=!1);const[n,r]=d(()=>t?{width:window.innerWidth,height:window.innerHeight}:{width:void 0,height:void 0}),o=PT(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);jK(()=>{o.current=t},[t]),s(()=>{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),jK(()=>{i()},[]),n}({debounceDelay:150}),r={dimensions:{width:t,height:n}};return I(_K.Provider,{value:r,children:e})},YK=({children:e})=>{const{dimensions:t}=i(_K),n=cr(t.width)&&t.width<parseInt(No("sizes.breakpoint-xl"));return I(yT.Provider,{value:n,children:e})},ZK=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",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",fill:"none",stroke:"inherit",strokeMiterlimit:10}),r.createElement("path",{d:"M8.00158 10.5132V11.7699",fill:"none",stroke:"inherit",strokeMiterlimit:10})),"ToastError"),GK=vi(e=>r.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"inherit",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{fill:"inherit",strokeWidth:0,stroke:"none",strokeMiterlimit:10,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"}),r.createElement("path",{stroke:"inherit",fill:"none",d:"M3.96962 7.99987L6.65645 10.68611L12.02905 5.31364",strokeMiterlimit:10})),"ToastSuccess"),QK=gr(lr.toast,tr({boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",width:{base:"92%",xl:"328px"},paddingInline:"16px",paddingBlock:"12px",borderRadius:"sm",backgroundColor:"surface.intent.notification",color:"typography.intent.notification",boxShadow:"box-shadow",willChange:"translate, opacity",transitionProperty:"opacity, translate",transitionDuration:"toast.enter",transitionTimingFunction:"toast.enter","&[data-state='closed']":{transitionDuration:"toast.exit",transitionTimingFunction:"toast.exit"}})),XK={translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)"},JK=tr({flex:"1 0 0",minWidth:0}),$K=tr.raw({lineClamp:2}),eY=gr(lr["toast-dismiss"],tr({display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",cursor:"pointer",padding:0,color:"typography.intent.notification",flexShrink:0,borderRadius:"sm",outline:"none","&:focus-visible":{outline:"2px solid",outlineColor:"border.layout",outlineOffset:"2px"}})),tY=or({base:{},variants:{type:{error:{fill:"typography.intent.notification",stroke:"surface.intent.notification"},success:{fill:"typography.intent.notification",stroke:"surface.intent.notification"}}}});function nY({title:e,type:t}){const n=gr(null,tY({type:t}));return R(Le.Root,{...QK,style:XK,children:[I(Sd,{Component:"success"===t?GK:ZK,stylists:[n]}),I(Le.Title,{className:JK,children:"string"==typeof e?I(sc,{intent:"notification",wrap:"wrap",extraClassNames:[$K],children:e}):e}),I(Le.CloseTrigger,{...eY,children:I(cl,{Component:Ac})})]})}const rY=Fe({placement:"bottom",offsets:{top:"0px",right:"0px",bottom:"60px",left:"0px"},gap:8,removeDelay:250,duration:3e3,max:24,pauseOnPageIdle:!0,overlap:!1}),aY={success:3e3,error:6e3};function oY(e,t,n){const r=n?.dedupeKey??`${e}:${t}`,a=Date.now();return function(e,t){const n=iY.get(e);return void 0!==n&&t-n<2e3}(r,a)?null:(function(e,t){for(const[n,r]of iY)t-r>=2e3&&iY.delete(n);iY.set(e,t)}(r,a),function(){const e=rY.getVisibleToasts();!function(e){for(const t of lY)e.has(t)||lY.delete(t)}(new Set(e.map(e=>e.id)));const t=e.filter(e=>void 0!==e.id&&!lY.has(e.id));if(t.length<3)return;const n=[...t].reverse().find(e=>"error"!==e.type)??t[t.length-1];void 0!==n?.id&&(lY.add(n.id),rY.update(n.id,{removeDelay:0}),rY.dismiss(n.id))}(),rY.create({type:e,title:t,duration:n?.duration??aY[e]}))}const iY=/* @__PURE__ */new Map,lY=/* @__PURE__ */new Set;function sY({children:e}){const t=o(()=>({createToast:oY,dismiss:rY.dismiss}),[]);return R(Sh.Provider,{value:t,children:[e,I(Ve,{children:I(Oe,{toaster:rY,children:e=>{return I(nY,{title:e.title,type:(t=e.type,"success"===t?"success":"error")},e.id);var t}})})]})}function cY({children:e,environment:t,accessToken:n}){const r={activeToken:n,accountantToken:void 0};return s(()=>{var e,r;e=n,r=t,ma.setProperties(fa),va=r,ga=e},[n,t]),I(MK,{environment:t,children:I(oU,{children:I(Rr.Provider,{value:r,children:I(LK,{children:I(VK,{children:I(zK,{children:I(KK,{children:I(YK,{children:R(sY,{children:[I(we.ConfirmationRoot,{}),e,I(DK,{})]})})})})})})})})})}function dY({children:e,initialNav:t}){const n=iL(),r=rL(),i=a(void 0),l=u(e=>{const t=document.getElementById(e);t?(t.scrollIntoView({behavior:"smooth"}),i.current=void 0):i.current=e},[]),c=u(e=>{i.current===e&&(document.getElementById(e)?.scrollIntoView({behavior:"smooth"}),i.current=void 0)},[]),d=u(e=>{const t=yK[e.page];t!==r.pathname&&(dn.getState().closeAllDrawers(),n(t)),e.anchor&&l(e.anchor);const{drawer:a}=e;a&&rs(a.name,{routeProps:a.props})},[r.pathname,n,l]),h=a(!1);s(()=>{if(h.current)return;h.current=!0,t.anchor&&l(t.anchor);const{drawer:e}=t;e&&rs(e.name,{replaceHistory:!0,routeProps:e.props})},[t,l]);const p=o(()=>({isApp:!0,navigate:d,registerAnchor:c,location:r,initialPageProps:t.pageProps}),[d,c,r,t.pageProps]);return I(Pd.Provider,{value:p,children:e})}const uY=_N({gap:"16px",alignItems:"stretch",width:"100%"});function hY({limit:e}){const t=ze(),n=dn(e=>e.generalLedgerGlAccountId),r=dn(e=>e.generalLedgerDateRange),a=dn(e=>e.generalLedgerAccountingMethod),o=dn(e=>e.setGeneralLedgerGlAccountId),i=dn(e=>e.setGeneralLedgerDateRange),l=dn(e=>e.setGeneralLedgerAccountingMethod);return t?R("div",{className:uY,children:[I(br,{children:I(kr,{children:"General Ledger"})}),I(QV,{glAccountId:n,onGlAccountChange:o,dateRange:r,onDateRangeChange:i,accountingMethod:a,onAccountingMethodChange:l,limit:e})]}):I(TV,{})}const pY={FinancialOverview:{path:yK.FinancialOverview,element:I(Zk,{})},FinancialOverviewDashboard:{path:yK.FinancialOverview,element:I(Zk,{})},TransactionsDashboard:{path:yK.TransactionsDashboard,element:I(dP,{})},BanksAndIntegrations:{path:yK.BanksAndIntegrations,element:I(nS,{})},ExpenseDashboard:{path:yK.ExpenseDashboard,element:I(IP,{})},IncomeDashboard:{path:yK.IncomeDashboard,element:I(LP,{})},Invoices_NOT_IMPL:{path:yK.Invoices_NOT_IMPL,element:I(TV,{})},TimeAndTasks_NOT_IMPL:{path:yK.TimeAndTasks_NOT_IMPL,element:I(TV,{})},Mileage_NOT_IMPL:{path:yK.Mileage_NOT_IMPL,element:I(TV,{})},Payroll_NOT_IMPL:{path:yK.Payroll_NOT_IMPL,element:I(TV,{})},ReportDashboard:{path:yK.ReportDashboard,element:I(nU,{})},ChartOfAccounts_NOT_IMPL:{path:yK.ChartOfAccounts_NOT_IMPL,element:I(TV,{})},GeneralLedger:{path:yK.GeneralLedger,element:I(function({limit:e=100}={}){return ze()?I(Kk,{children:I(hY,{limit:e})}):I(TV,{})},{})},Journal_NOT_IMPL:{path:yK.Journal_NOT_IMPL,element:I(TV,{})},Taxes_NOT_IMPL:{path:yK.Taxes_NOT_IMPL,element:I(TV,{})}},mY=vi(e=>r.createElement("svg",{width:12,height:13,viewBox:"0 0 12 13",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M4.03662 4.44452H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 6.4079H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.03662 8.37134H6.48826",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.9267 11.3112H2.07323C1.88019 11.3112 1.68904 11.2732 1.5107 11.1993C1.33236 11.1254 1.17031 11.0172 1.03381 10.8807C0.758141 10.605 0.603271 10.2311 0.603271 9.84124V1.01123L1.8882 1.99291L3.21938 1.01123L4.52487 1.99291L5.83549 1.01123L7.14098 1.99291L8.4516 1.01123V9.84124C8.45296 10.2316 8.60897 10.6054 8.88546 10.881C9.16195 11.1565 9.53637 11.3112 9.9267 11.3112Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M2.07324 4.44452H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 6.4079H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M2.07324 8.37134H3.05493",strokeMiterlimit:10}),r.createElement("path",{d:"M9.43334 4.93286H11.3967V9.84128C11.3745 10.2168 11.2097 10.5696 10.936 10.8276C10.6623 11.0856 10.3003 11.2293 9.92419 11.2293C9.54803 11.2293 9.18609 11.0856 8.91237 10.8276C8.63866 10.5696 8.47385 10.2168 8.45166 9.84128V4.93286H9.43334Z",strokeMiterlimit:10})),"Transactions"),gY=vi(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.8474 4.45435H2.84612C2.17063 4.45435 1.62305 5.00193 1.62305 5.67742V13.0094C1.62305 13.6849 2.17063 14.2325 2.84612 14.2325H13.8474C14.5228 14.2325 15.0704 13.6849 15.0704 13.0094V5.67742C15.0704 5.00193 14.5228 4.45435 13.8474 4.45435Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M10.7927 4.45439H5.90039L6.51513 2.01465H10.1779L10.7927 4.45439Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.12376 11.1779H8.6542C8.89706 11.1779 9.12997 11.0815 9.3017 10.9097C9.47342 10.738 9.5699 10.5051 9.5699 10.2622C9.5699 10.0194 9.47342 9.78647 9.3017 9.61474C9.12997 9.44302 8.89706 9.34654 8.6542 9.34654H8.01385C7.77099 9.34654 7.53808 9.25007 7.36635 9.07834C7.19462 8.90661 7.09814 8.6737 7.09814 8.43084C7.09814 8.18798 7.19462 7.95507 7.36635 7.78334C7.53808 7.61161 7.77099 7.51514 8.01385 7.51514H9.54429",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 6.90039V7.51513",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M8.34668 11.178V11.7927",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06922 13.6005C4.07207 13.816 4.03519 14.0302 3.96036 14.2326H2.84621C2.68367 14.2318 2.52291 14.1991 2.37322 14.1366C2.22354 14.0741 2.08791 13.9828 1.97417 13.8682C1.86044 13.7536 1.77085 13.6179 1.71061 13.4688C1.65037 13.3198 1.62066 13.1605 1.6232 13.0001V11.9003C1.82715 11.8223 2.04493 11.7858 2.26352 11.7928C2.74476 11.7995 3.20401 11.9929 3.54192 12.3312C3.87984 12.6694 4.06926 13.1254 4.06922 13.6005Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0703 11.9012V13.0126C15.0686 13.3356 14.9392 13.6449 14.7102 13.8733C14.4812 14.1017 14.1711 14.2308 13.8472 14.2325H12.733C12.6582 14.0279 12.6213 13.8115 12.6242 13.5938C12.6242 13.3533 12.6718 13.1153 12.7642 12.8932C12.8566 12.6712 12.9921 12.4696 13.1628 12.2999C13.3336 12.1301 13.5362 11.9957 13.7592 11.9043C13.9821 11.8129 14.2209 11.7663 14.462 11.7671C14.6715 11.7723 14.8781 11.8178 15.0703 11.9012Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.06919 5.06911C4.06919 5.31015 4.02223 5.54882 3.93098 5.77144C3.83974 5.99405 3.70602 6.19623 3.53748 6.36637C3.36895 6.53652 3.16892 6.67129 2.94886 6.76295C2.72881 6.8546 2.49305 6.90135 2.25513 6.90051C2.03959 6.90424 1.82525 6.86733 1.62305 6.79165V5.67744C1.62385 5.51434 1.65668 5.35304 1.71961 5.20292C1.78255 5.05281 1.87434 4.91688 1.98964 4.80305C2.10494 4.68922 2.24144 4.59977 2.3912 4.53991C2.54095 4.48005 2.70097 4.45097 2.86192 4.45437H3.96174C4.03315 4.65123 4.06953 4.85937 4.06919 5.06911Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M15.0702 5.68985V6.79252C14.8755 6.86364 14.6695 6.90011 14.4619 6.90025C14.2209 6.90109 13.9821 6.85482 13.7592 6.76411C13.5362 6.6734 13.3336 6.54003 13.1629 6.37165C12.9921 6.20327 12.8567 6.00318 12.7643 5.78287C12.6718 5.56257 12.6242 5.32637 12.6242 5.08782C12.6208 4.87175 12.6577 4.65691 12.7331 4.4541H13.8472C14.0098 4.45492 14.1705 4.48763 14.3202 4.55033C14.4699 4.61304 14.6055 4.7045 14.7193 4.81942C14.833 4.93434 14.9226 5.07044 14.9828 5.21985C15.0431 5.36926 15.0728 5.52901 15.0702 5.68985Z",strokeMiterlimit:10,strokeLinecap:"square"})),"Income"),vY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M3.0668 7.46405H1.11133V11.375H3.0668V7.46405Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.8887 4.53595H8.93323V11.375H10.8887V4.53595Z",strokeMiterlimit:10}),r.createElement("path",{d:"M6.97782 0.625H5.02234V11.375H6.97782V0.625Z",strokeMiterlimit:10}),r.createElement("path",{d:"M0.138672 11.375H11.8613",strokeMiterlimit:10})),"Reports"),fY={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:mY}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:gY},{page:"ExpenseDashboard",label:"Expenses",Icon:nq},{page:"IncomeDashboard",label:"Income",Icon:gY}]},{items:[{page:"ReportDashboard",label:"Reports",Icon:vY}]}]},bY=vi(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"),yY=vi(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:"M7.5 14.25C11.2279 14.25 14.25 11.2279 14.25 7.5C14.25 3.77208 11.2279 0.75 7.5 0.75C3.77208 0.75 0.75 3.77208 0.75 7.5C0.75 11.2279 3.77208 14.25 7.5 14.25Z",strokeMiterlimit:10}),r.createElement("path",{d:"M7.5 2.58856V7.49999L10.5664 10.5664",strokeMiterlimit:10})),"TimeAndTasks"),wY=vi(e=>r.createElement("svg",{stroke:"currentColor",width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M8.58591 0.969731H4.86823C4.67602 0.970222 4.4865 1.01495 4.31436 1.10046C4.14222 1.18597 3.99207 1.30996 3.87555 1.46283L2.38978 3.44818L0.53418 4.06455V8.3986H2.38978C2.38978 8.06994 2.52034 7.75473 2.75274 7.52233C2.98514 7.28993 3.30034 7.15937 3.629 7.15937C3.95766 7.15937 4.27287 7.28993 4.50527 7.52233C4.73767 7.75473 4.86823 8.06994 4.86823 8.3986H9.20228C9.20228 8.06994 9.33284 7.75473 9.56524 7.52233C9.79764 7.28993 10.1128 7.15937 10.4415 7.15937C10.7702 7.15937 11.0854 7.28993 11.3178 7.52233C11.5502 7.75473 11.6807 8.06994 11.6807 8.3986H14.1592V5.52437C14.1588 5.27713 14.0844 5.03565 13.9457 4.831C13.8069 4.62636 13.6101 4.46789 13.3806 4.37598L11.0644 3.44818L9.57858 1.46283C9.46275 1.30922 9.31275 1.18469 9.14045 1.09911C8.96815 1.01352 8.77829 0.969227 8.58591 0.969731Z",strokeMiterlimit:10}),r.createElement("path",{d:"M10.4414 9.63788C11.1258 9.63788 11.6806 9.08306 11.6806 8.39865C11.6806 7.71424 11.1258 7.15942 10.4414 7.15942C9.75697 7.15942 9.20215 7.71424 9.20215 8.39865C9.20215 9.08306 9.75697 9.63788 10.4414 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M3.62887 9.63788C4.31328 9.63788 4.8681 9.08306 4.8681 8.39865C4.8681 7.71424 4.31328 7.15942 3.62887 7.15942C2.94447 7.15942 2.38965 7.71424 2.38965 8.39865C2.38965 9.08306 2.94447 9.63788 3.62887 9.63788Z",strokeMiterlimit:10}),r.createElement("path",{d:"M12.6021 4.06445H4.25195",strokeMiterlimit:10}),r.createElement("path",{d:"M12.9199 6.54297H14.1591",strokeMiterlimit:10}),r.createElement("path",{d:"M7.34668 2.20898V4.06458",strokeMiterlimit:10})),"Mileage"),CY=vi(EW,"Payroll"),xY=vi(XF,"ChartOfAccounts"),TY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.930835 6.6925H4.15797V7.04359C4.15797 7.44029 4.00038 7.82073 3.71987 8.10124C3.43937 8.38174 3.05892 8.53933 2.66223 8.53933H2.42176C2.02507 8.53933 1.64462 8.38174 1.36412 8.10124C1.08361 7.82073 0.926025 7.44029 0.926025 7.04359V6.6925H0.930835Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M0.469116 3.00363H3.07583C3.28237 3.00199 3.48644 2.95853 3.67573 2.87588C3.86502 2.79322 4.0356 2.67307 4.17719 2.52269C4.31979 2.37361 4.49058 2.25433 4.67964 2.17177C4.8687 2.08921 5.07227 2.04502 5.27855 2.04175H6.72138C6.92915 2.04454 7.13431 2.08849 7.325 2.17104C7.51569 2.25359 7.68813 2.37311 7.83236 2.52269C7.97715 2.67285 8.15037 2.7927 8.34193 2.87527C8.53349 2.95784 8.73956 3.00147 8.94815 3.00363H11.5308",strokeMiterlimit:10}),r.createElement("path",{d:"M6 0.699951V11.2999",strokeMiterlimit:10}),r.createElement("path",{d:"M8.76535 11.2999H3.2345",strokeMiterlimit:10}),r.createElement("path",{d:"M2.7728 3.00366H2.31109L0.930786 6.23079V6.6925H4.15792V6.23079L2.7728 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M7.84197 6.6925H11.0691V7.04359C11.0691 7.44029 10.9115 7.82073 10.631 8.10124C10.3505 8.38174 9.97006 8.53933 9.57336 8.53933H9.33289C8.9362 8.53933 8.55575 8.38174 8.27525 8.10124C7.99474 7.82073 7.83716 7.44029 7.83716 7.04359V6.6925H7.84197Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M9.68886 3.00366H9.22716L7.84204 6.23079V6.6925H11.0692V6.23079L9.68886 3.00366Z",strokeMiterlimit:10,strokeLinecap:"square"})),"GeneralLedger"),kY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M0.650024 1.86523V8.67246H4.54278C4.73458 8.67246 4.92449 8.71032 5.10162 8.78387C5.27875 8.85742 5.43962 8.96522 5.57501 9.10108C5.71039 9.23693 5.81762 9.39818 5.89056 9.57557C5.96349 9.75295 6.00069 9.943 6.00002 10.1348V3.32247C6.00002 3.1311 5.96232 2.94161 5.88909 2.76481C5.81586 2.58801 5.70852 2.42737 5.5732 2.29205C5.43788 2.15673 5.27724 2.04939 5.10044 1.97616C4.92364 1.90293 4.73415 1.86523 4.54278 1.86523H0.650024Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 1.86523V8.67246H7.45724C7.26545 8.67246 7.07554 8.71032 6.89841 8.78387C6.72127 8.85742 6.5604 8.96522 6.42502 9.10108C6.28963 9.23693 6.1824 9.39818 6.10947 9.57557C6.03654 9.75295 5.99934 9.943 6.00001 10.1348V3.32247C6.00001 2.93599 6.15354 2.56533 6.42682 2.29205C6.70011 2.01876 7.07076 1.86523 7.45724 1.86523H11.35Z",strokeMiterlimit:10}),r.createElement("path",{d:"M11.35 8.67249V10.1348H7.45725H4.54278H0.650024V8.67249",strokeMiterlimit:10})),"Journal"),EY=vi(e=>r.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{d:"M6.32498 11.2259H0.775757V0.774048H8.37577V3.64998",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M6.47954 2.37524H2.677V4.84696H6.47954V2.37524Z",strokeMiterlimit:10,strokeLinecap:"square"}),r.createElement("path",{d:"M4.57825 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 6.53076V7.48139",strokeMiterlimit:10}),r.createElement("path",{d:"M4.57825 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M2.677 8.63464V9.58527",strokeMiterlimit:10}),r.createElement("path",{d:"M8.1449 7.27441C8.14484 7.32563 8.10334 7.36713 8.05212 7.36719C8.01365 7.36719 7.98028 7.34389 7.96619 7.31055L7.95935 7.27441C7.95935 7.22312 8.00083 7.18164 8.05212 7.18164L8.08826 7.18848C8.1216 7.20257 8.1449 7.23594 8.1449 7.27441Z"}),r.createElement("path",{d:"M9.77344 8.90295C9.77338 8.95417 9.73188 8.99567 9.68066 8.99573C9.64219 8.99573 9.60882 8.97243 9.59473 8.93909L9.58789 8.90295C9.58789 8.85166 9.62937 8.81018 9.68066 8.81018L9.7168 8.81702C9.75014 8.83111 9.77344 8.86448 9.77344 8.90295Z"}),r.createElement("path",{d:"M9.80828 6.96296L7.92403 9.21425",strokeMiterlimit:10}),r.createElement("path",{d:"M8.86626 10.6502C10.281 10.6502 11.428 9.50333 11.428 8.08855C11.428 6.67377 10.281 5.52686 8.86626 5.52686C7.45148 5.52686 6.30457 6.67377 6.30457 8.08855C6.30457 9.50333 7.45148 10.6502 8.86626 10.6502Z",strokeMiterlimit:10})),"Taxes"),AY={sections:[{items:[{page:"FinancialOverview",label:"Financial Overview",Icon:mY}]},{label:"Transactions",items:[{page:"TransactionsDashboard",label:"All Transactions",Icon:gY},{page:"ExpenseDashboard",label:"Expenses",Icon:nq},{page:"IncomeDashboard",label:"Income",Icon:gY}]},{items:[{page:"Invoices_NOT_IMPL",label:"Invoices",Icon:bY},{page:"TimeAndTasks_NOT_IMPL",label:"Time & Tasks",Icon:yY},{page:"Mileage_NOT_IMPL",label:"Mileage",Icon:wY},{page:"Payroll_NOT_IMPL",label:"Payroll",Icon:CY},{page:"ReportDashboard",label:"Reports",Icon:vY}]},{label:"Accounting",items:[{page:"ChartOfAccounts_NOT_IMPL",label:"Chart of Accounts",Icon:xY},{page:"GeneralLedger",label:"General Ledger",Icon:TY},{page:"Journal_NOT_IMPL",label:"Journal",Icon:kY}]},{items:[{page:"Taxes_NOT_IMPL",label:"Taxes",Icon:EY}]}]},SY=tr({position:"sticky",top:0,alignSelf:"flex-start",width:"256px",maxWidth:"256px",height:"100dvh",display:"flex",flexDirection:"column",backgroundColor:"surface.background",borderRight:"1px solid {colors.border.layout}",flexShrink:0});function IY(){return I("div",{className:SY,children:I(RK,{})})}const NY=tr({width:"100%",display:"flex",flexDirection:"row"}),RY=tr({flex:1,display:"flex",flexDirection:"column",padding:{xl:"50px",base:"16px"}});function PY(){const e=wT();return R("div",{className:NY,children:[!e&&I(IY,{}),I("div",{className:RY,children:I(DL,{children:Object.entries(pY).map(([e,t])=>I(NL,{path:t.path,element:t.element},e))})})]})}function DY(e){const{accessToken:t,environment:n="PRODUCTION",initialNav:r={page:"FinancialOverview"},buildTarget:a,rtlConfig:o}=e,i=/* @__PURE__ */function(e){return e?AY:fY}("PLAYGROUND"===a||"LAB"===a);return I(SL,{initialEntries:[pY[r.page].path],children:I(EK.Provider,{value:o,children:I(dY,{initialNav:r,children:I(kK.Provider,{value:i,children:I(cY,{environment:n,accessToken:t,children:I(PY,{})})})})})})}const MY=["BanksAndIntegrations"],LY={BanksAndIntegrations:!0,FinancialOverview:!0,TransactionsDashboard:!0,ExpenseDashboard:!0,IncomeDashboard:!0,ReportDashboard:!0,GeneralLedger:!0},FY=new Set(Object.values(pi).flatMap(e=>Object.values(e)));function OY(e){let t;try{t=new URL(e)}catch{return}const n=t.searchParams.get("bkPage");if(null===(r=n)||!LY[r]&&"FinancialOverviewDashboard"!==r)return;var r;const a=t.searchParams.get("bkDrawer");let o;if(null!==(i=a)&&MY.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)&&FY.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{nS as BanksAndIntegrations,IP as ExpenseDashboard,Zk as FinancialOverview,LP as IncomeDashboard,nU as ReportDashboard,cY as Tight,DY as TightApp,dP as TransactionsDashboard,OY as parseNavUrl,En as useEmbeddedEventListeners,kn as useEventSource,xn as useOptions};
3
2
  //# sourceMappingURL=index.js.map