@layerfi/components 0.1.102-alpha → 0.1.102-alpha.2

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.
@@ -5602,7 +5602,7 @@ var import_react18 = require("react");
5602
5602
  var import_react16 = require("react");
5603
5603
 
5604
5604
  // package.json
5605
- var version = "0.1.102-alpha";
5605
+ var version = "0.1.102-alpha.2";
5606
5606
 
5607
5607
  // src/models/APIError.ts
5608
5608
  var APIError = class _APIError extends Error {
@@ -10448,7 +10448,7 @@ var OnboardingContent = ({
10448
10448
  };
10449
10449
 
10450
10450
  // src/components/LinkedAccounts/LinkedAccounts.tsx
10451
- var import_react51 = require("react");
10451
+ var import_react52 = require("react");
10452
10452
 
10453
10453
  // src/components/Loader/Loader.tsx
10454
10454
  var import_jsx_runtime53 = require("react/jsx-runtime");
@@ -10473,7 +10473,7 @@ var SmallLoader = ({ size = 28 }) => {
10473
10473
  };
10474
10474
 
10475
10475
  // src/components/LinkedAccounts/LinkedAccountsContent.tsx
10476
- var import_react44 = require("react");
10476
+ var import_react45 = require("react");
10477
10477
 
10478
10478
  // src/icons/PlusIcon.tsx
10479
10479
  var import_jsx_runtime55 = require("react/jsx-runtime");
@@ -11347,7 +11347,7 @@ var LinkedAccountItemThumb = ({
11347
11347
  var import_classnames24 = __toESM(require("classnames"));
11348
11348
 
11349
11349
  // src/components/LinkedAccounts/ConfirmationModal/LinkedAccountsConfirmationModal.tsx
11350
- var import_react43 = require("react");
11350
+ var import_react44 = require("react");
11351
11351
 
11352
11352
  // src/components/ui/Modal/Modal.tsx
11353
11353
  var import_react38 = require("react");
@@ -11533,20 +11533,34 @@ function ModalActions({ children }) {
11533
11533
  }
11534
11534
 
11535
11535
  // src/components/ui/Stack/Stack.tsx
11536
+ var import_react42 = require("react");
11536
11537
  var import_classnames22 = __toESM(require("classnames"));
11537
11538
  var import_jsx_runtime71 = require("react/jsx-runtime");
11538
11539
  var CLASS_NAME2 = "Layer__Stack";
11539
- function Stack(_a) {
11540
- var _b = _a, { align, children, direction, gap, justify, pbs, pbe, pis, pie, fluid, className } = _b, restProps = __objRest(_b, ["align", "children", "direction", "gap", "justify", "pbs", "pbe", "pis", "pie", "fluid", "className"]);
11541
- const dataProperties = toDataProperties({ align, direction, gap, justify, pbs, pbe, pis, pie, fluid });
11542
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: (0, import_classnames22.default)(CLASS_NAME2, className), children }));
11543
- }
11544
- function VStack(props) {
11545
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Stack, __spreadProps(__spreadValues({}, props), { direction: "column" }));
11546
- }
11547
- function HStack(props) {
11548
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Stack, __spreadProps(__spreadValues({}, props), { direction: "row" }));
11549
- }
11540
+ var Stack = (0, import_react42.forwardRef)(
11541
+ (_a, ref) => {
11542
+ var _b = _a, { align, children, direction, gap, justify, pbs, pbe, pis, pie, fluid, className } = _b, restProps = __objRest(_b, ["align", "children", "direction", "gap", "justify", "pbs", "pbe", "pis", "pie", "fluid", "className"]);
11543
+ const dataProperties = toDataProperties({ align, direction, gap, justify, pbs, pbe, pis, pie, fluid });
11544
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11545
+ "div",
11546
+ __spreadProps(__spreadValues(__spreadValues({
11547
+ ref
11548
+ }, restProps), dataProperties), {
11549
+ className: (0, import_classnames22.default)(CLASS_NAME2, className),
11550
+ children
11551
+ })
11552
+ );
11553
+ }
11554
+ );
11555
+ Stack.displayName = "Stack";
11556
+ var VStack = (0, import_react42.forwardRef)((props, ref) => {
11557
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "column" }));
11558
+ });
11559
+ VStack.displayName = "VStack";
11560
+ var HStack = (0, import_react42.forwardRef)((props, ref) => {
11561
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "row" }));
11562
+ });
11563
+ HStack.displayName = "HStack";
11550
11564
  var Spacer = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "Layer__Spacer" });
11551
11565
 
11552
11566
  // src/components/utility/ConditionalList.tsx
@@ -11576,14 +11590,14 @@ function ConditionalList({
11576
11590
 
11577
11591
  // src/components/ui/Checkbox/Checkbox.tsx
11578
11592
  var import_lucide_react4 = require("lucide-react");
11579
- var import_react42 = require("react");
11593
+ var import_react43 = require("react");
11580
11594
  var import_react_aria_components8 = require("react-aria-components");
11581
11595
  var import_classnames23 = __toESM(require("classnames"));
11582
11596
  var import_jsx_runtime73 = require("react/jsx-runtime");
11583
11597
  var CLASS_NAME3 = "Layer__Checkbox";
11584
11598
  function Checkbox(_a) {
11585
11599
  var _b = _a, { children, className, variant = "default", size = "md" } = _b, props = __objRest(_b, ["children", "className", "variant", "size"]);
11586
- const dataProperties = (0, import_react42.useMemo)(() => toDataProperties({
11600
+ const dataProperties = (0, import_react43.useMemo)(() => toDataProperties({
11587
11601
  size,
11588
11602
  variant,
11589
11603
  labeled: typeof children === "string" && children.length > 0
@@ -11803,7 +11817,7 @@ function LinkedAccountsConfirmationModalPreloadedContent({ onClose }) {
11803
11817
  }
11804
11818
  function LinkedAccountsConfirmationModalContent({ onClose }) {
11805
11819
  const { accounts, onFinish, refetchAccounts } = useLinkedAccountsConfirmationModal();
11806
- const [formState, setFormState] = (0, import_react43.useState)(() => Object.fromEntries(
11820
+ const [formState, setFormState] = (0, import_react44.useState)(() => Object.fromEntries(
11807
11821
  accounts.map(({ id }) => [id, true])
11808
11822
  ));
11809
11823
  const { trigger, isMutating, error } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
@@ -11875,7 +11889,7 @@ var LinkedAccountsContent = ({
11875
11889
  showUnlinkItem,
11876
11890
  showBreakConnection
11877
11891
  }) => {
11878
- const { data, addConnection } = (0, import_react44.useContext)(LinkedAccountsContext);
11892
+ const { data, addConnection } = (0, import_react45.useContext)(LinkedAccountsContext);
11879
11893
  const linkedAccountsNewAccountClassName = (0, import_classnames24.default)(
11880
11894
  "Layer__linked-accounts__new-account",
11881
11895
  asWidget && "--as-widget",
@@ -11916,7 +11930,7 @@ var LinkedAccountsContent = ({
11916
11930
  };
11917
11931
 
11918
11932
  // src/components/LinkedAccounts/OpeningBalanceModal/OpeningBalanceModal.tsx
11919
- var import_react50 = require("react");
11933
+ var import_react51 = require("react");
11920
11934
 
11921
11935
  // src/utils/business.ts
11922
11936
  var import_date_fns6 = require("date-fns");
@@ -11949,7 +11963,7 @@ var isDateAllowedToBrowse = (date, business) => {
11949
11963
  };
11950
11964
 
11951
11965
  // src/components/LinkedAccounts/AccountFormBox/AccountFormBox.tsx
11952
- var import_react49 = require("react");
11966
+ var import_react50 = require("react");
11953
11967
 
11954
11968
  // src/components/Input/Input.tsx
11955
11969
  var import_classnames25 = __toESM(require("classnames"));
@@ -12012,7 +12026,7 @@ var InputGroup = ({
12012
12026
  };
12013
12027
 
12014
12028
  // src/components/Input/FileInput.tsx
12015
- var import_react45 = require("react");
12029
+ var import_react46 = require("react");
12016
12030
 
12017
12031
  // src/icons/UploadCloud.tsx
12018
12032
  var import_jsx_runtime80 = require("react/jsx-runtime");
@@ -12081,7 +12095,7 @@ var FileInput = ({
12081
12095
  icon,
12082
12096
  allowMultipleUploads = false
12083
12097
  }) => {
12084
- const hiddenFileInput = (0, import_react45.useRef)(null);
12098
+ const hiddenFileInput = (0, import_react46.useRef)(null);
12085
12099
  const onClick = () => {
12086
12100
  if (hiddenFileInput.current) {
12087
12101
  hiddenFileInput.current.click();
@@ -12134,7 +12148,7 @@ var FileInput = ({
12134
12148
  };
12135
12149
 
12136
12150
  // src/components/Input/Select.tsx
12137
- var import_react46 = require("react");
12151
+ var import_react47 = require("react");
12138
12152
  var import_react_select = __toESM(require("react-select"));
12139
12153
 
12140
12154
  // src/icons/ChevronDownFill.tsx
@@ -12189,7 +12203,7 @@ var Select = ({
12189
12203
  isInvalid ? "Layer__select--error" : "",
12190
12204
  className
12191
12205
  );
12192
- const DropdownIndicator2 = (0, import_react46.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react_select.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ChevronDownFill_default, {}) })), []);
12206
+ const DropdownIndicator2 = (0, import_react47.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react_select.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ChevronDownFill_default, {}) })), []);
12193
12207
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
12194
12208
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
12195
12209
  import_react_select.default,
@@ -12216,42 +12230,9 @@ var Select = ({
12216
12230
  // src/components/Input/InputWithBadge.tsx
12217
12231
  var import_classnames28 = __toESM(require("classnames"));
12218
12232
  var import_jsx_runtime84 = require("react/jsx-runtime");
12219
- var InputWithBadge = (_a) => {
12220
- var _b = _a, {
12221
- className,
12222
- isInvalid,
12223
- errorMessage,
12224
- leftText,
12225
- badge,
12226
- variant = "default" /* DEFAULT */
12227
- } = _b, props = __objRest(_b, [
12228
- "className",
12229
- "isInvalid",
12230
- "errorMessage",
12231
- "leftText",
12232
- "badge",
12233
- "variant"
12234
- ]);
12235
- const baseClassName = (0, import_classnames28.default)(
12236
- "Layer__input",
12237
- isInvalid ? "Layer__input--error" : "",
12238
- leftText ? "Layer__input--with-left-text" : "",
12239
- className
12240
- );
12241
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
12242
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(TooltipTrigger, { className: "Layer__input-tooltip", children: [
12243
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "Layer__input-with-badge", children: [
12244
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("input", __spreadProps(__spreadValues({}, props), { className: baseClassName })),
12245
- badge && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Badge, { variant, children: badge })
12246
- ] }),
12247
- leftText && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "Layer__input-left-text", children: leftText })
12248
- ] }),
12249
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
12250
- ] });
12251
- };
12252
12233
 
12253
12234
  // src/components/Input/MultiSelect.tsx
12254
- var import_react47 = require("react");
12235
+ var import_react48 = require("react");
12255
12236
  var import_react_select2 = __toESM(require("react-select"));
12256
12237
  var import_classnames29 = __toESM(require("classnames"));
12257
12238
  var import_jsx_runtime85 = require("react/jsx-runtime");
@@ -12276,7 +12257,7 @@ var MultiSelect = ({
12276
12257
  isInvalid ? "Layer__select--error" : "",
12277
12258
  className
12278
12259
  );
12279
- const DropdownIndicator2 = (0, import_react47.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_select2.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChevronDownFill_default, {}) })), []);
12260
+ const DropdownIndicator2 = (0, import_react48.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_select2.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChevronDownFill_default, {}) })), []);
12280
12261
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
12281
12262
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
12282
12263
  import_react_select2.default,
@@ -12315,6 +12296,7 @@ var AmountInput = (_a) => {
12315
12296
  leftText,
12316
12297
  errorMessage,
12317
12298
  isInvalid,
12299
+ badge,
12318
12300
  placeholder = "$0.00"
12319
12301
  } = _b, props = __objRest(_b, [
12320
12302
  "onChange",
@@ -12322,30 +12304,38 @@ var AmountInput = (_a) => {
12322
12304
  "leftText",
12323
12305
  "errorMessage",
12324
12306
  "isInvalid",
12307
+ "badge",
12325
12308
  "placeholder"
12326
12309
  ]);
12327
12310
  const baseClassName = (0, import_classnames30.default)(
12328
12311
  "Layer__input Layer__amount-input",
12312
+ badge ? "Layer__amount-input--align-left" : "Layer__amount-input--align-right",
12329
12313
  isInvalid ? "Layer__input--error" : "",
12330
12314
  leftText ? "Layer__input--with-left-text" : "",
12331
12315
  className
12332
12316
  );
12317
+ const currencyInput = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
12318
+ import_react_currency_input_field.default,
12319
+ __spreadProps(__spreadValues({}, props), {
12320
+ intlConfig: {
12321
+ locale: "en-US",
12322
+ currency: "USD"
12323
+ },
12324
+ prefix: "$",
12325
+ placeholder,
12326
+ decimalScale: 2,
12327
+ decimalsLimit: 2,
12328
+ disableAbbreviations: true,
12329
+ onValueChange: onChange,
12330
+ className: baseClassName
12331
+ })
12332
+ );
12333
12333
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
12334
12334
  /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(TooltipTrigger, { className: "Layer__input-tooltip", children: [
12335
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
12336
- import_react_currency_input_field.default,
12337
- __spreadProps(__spreadValues({}, props), {
12338
- intlConfig: {
12339
- locale: "en-US",
12340
- currency: "USD"
12341
- },
12342
- prefix: "$",
12343
- placeholder,
12344
- decimalsLimit: 2,
12345
- onValueChange: onChange,
12346
- className: baseClassName
12347
- })
12348
- ),
12335
+ badge ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "Layer__input-with-badge", children: [
12336
+ currencyInput,
12337
+ badge
12338
+ ] }) : currencyInput,
12349
12339
  leftText && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "Layer__input-left-text", children: leftText })
12350
12340
  ] }),
12351
12341
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
@@ -12353,7 +12343,7 @@ var AmountInput = (_a) => {
12353
12343
  };
12354
12344
 
12355
12345
  // src/components/DatePicker/DatePicker.tsx
12356
- var import_react48 = require("react");
12346
+ var import_react49 = require("react");
12357
12347
  var RDP = __toESM(require("react-datepicker"));
12358
12348
 
12359
12349
  // src/icons/ChevronLeft.tsx
@@ -12524,8 +12514,8 @@ var DatePicker = (_a) => {
12524
12514
  "slots"
12525
12515
  ]);
12526
12516
  const { ModeSelector } = slots != null ? slots : {};
12527
- const pickerRef = (0, import_react48.useRef)(null);
12528
- const pickerMode = (0, import_react48.useMemo)(() => {
12517
+ const pickerRef = (0, import_react49.useRef)(null);
12518
+ const pickerMode = (0, import_react49.useMemo)(() => {
12529
12519
  var _a2;
12530
12520
  if (!allowedModes) {
12531
12521
  return displayMode;
@@ -12538,7 +12528,7 @@ var DatePicker = (_a) => {
12538
12528
  }
12539
12529
  return (_a2 = allowedModes[0]) != null ? _a2 : displayMode;
12540
12530
  }, [displayMode, allowedModes]);
12541
- const [firstDate, secondDate] = (0, import_react48.useMemo)(() => {
12531
+ const [firstDate, secondDate] = (0, import_react49.useMemo)(() => {
12542
12532
  if (selected instanceof Date) {
12543
12533
  return [selected, null];
12544
12534
  }
@@ -12567,8 +12557,8 @@ var DatePicker = (_a) => {
12567
12557
  displayMode === "timePicker" && "Layer__datepicker__time__popper",
12568
12558
  popperClassName
12569
12559
  );
12570
- const [internalStart, setInternalStart] = (0, import_react48.useState)(null);
12571
- const [internalEnd, setInternalEnd] = (0, import_react48.useState)(null);
12560
+ const [internalStart, setInternalStart] = (0, import_react49.useState)(null);
12561
+ const [internalEnd, setInternalEnd] = (0, import_react49.useState)(null);
12572
12562
  const isMidSelection = internalStart !== null && internalEnd === null;
12573
12563
  const handleDateChange = (selectedDate) => {
12574
12564
  if (selectedDate instanceof Date) {
@@ -12623,7 +12613,7 @@ var DatePicker = (_a) => {
12623
12613
  break;
12624
12614
  }
12625
12615
  };
12626
- const isTodayOrAfter = (0, import_react48.useMemo)(() => {
12616
+ const isTodayOrAfter = (0, import_react49.useMemo)(() => {
12627
12617
  switch (displayMode) {
12628
12618
  case "dayPicker":
12629
12619
  return firstDate >= (0, import_date_fns8.endOfDay)(/* @__PURE__ */ new Date()) || maxDate && firstDate >= maxDate;
@@ -12803,7 +12793,7 @@ var AccountFormBox = ({
12803
12793
  errors = []
12804
12794
  }) => {
12805
12795
  var _a, _b, _c, _d, _e;
12806
- const dataProps = (0, import_react49.useMemo)(() => toDataProperties({
12796
+ const dataProps = (0, import_react50.useMemo)(() => toDataProperties({
12807
12797
  saved: isSaved,
12808
12798
  confirmed: value.isConfirmed
12809
12799
  }), [isSaved, value.isConfirmed]);
@@ -13015,10 +13005,14 @@ var humanizeEnum = (text) => {
13015
13005
  };
13016
13006
  var convertNumberToCurrency = (amount) => {
13017
13007
  if (typeof amount !== "number" || isNaN(amount)) return "";
13018
- const formattedValue = amount.toLocaleString("en-US");
13019
- return formattedValue.length > 0 ? `$${formattedValue}` : "";
13008
+ const formattedValue = amount.toLocaleString("en-US", {
13009
+ style: "currency",
13010
+ currency: "USD",
13011
+ minimumFractionDigits: 2,
13012
+ maximumFractionDigits: 2
13013
+ });
13014
+ return formattedValue;
13020
13015
  };
13021
- var convertCurrencyToNumber = (amount) => amount.replace("$", "").replace(",", "").replace(/[^\d.]/g, "").replace(/(?!^)-/g, "").replace(/(\..*)\./g, "$1").replace(/(\.\d{2})\d+/, "$1").replace(/^0(?!\.)/, "");
13022
13016
  var convertToCents = (amount) => {
13023
13017
  try {
13024
13018
  if (amount === void 0 || amount === null) {
@@ -13090,9 +13084,9 @@ function LinkedAccountsOpeningBalanceModalContent({
13090
13084
  var _a, _b;
13091
13085
  const { business } = useLayerContext();
13092
13086
  const { refetchAccounts } = useLinkedAccounts();
13093
- const [touched, setTouched] = (0, import_react50.useState)(false);
13094
- const [results, setResults] = (0, import_react50.useState)({});
13095
- const [formsData, setFormsData] = (0, import_react50.useState)(accounts.map((item) => {
13087
+ const [touched, setTouched] = (0, import_react51.useState)(false);
13088
+ const [results, setResults] = (0, import_react51.useState)({});
13089
+ const [formsData, setFormsData] = (0, import_react51.useState)(accounts.map((item) => {
13096
13090
  var _a2;
13097
13091
  return {
13098
13092
  account: item,
@@ -13100,7 +13094,7 @@ function LinkedAccountsOpeningBalanceModalContent({
13100
13094
  openingDate: (_a2 = getActivationDate(business)) != null ? _a2 : (0, import_date_fns11.startOfYear)(/* @__PURE__ */ new Date())
13101
13095
  };
13102
13096
  }));
13103
- const formsDataToSave = (0, import_react50.useMemo)(
13097
+ const formsDataToSave = (0, import_react51.useMemo)(
13104
13098
  () => ignoreAlreadySaved(formsData, results),
13105
13099
  [formsData, results]
13106
13100
  );
@@ -13167,7 +13161,7 @@ function OpeningBalanceModal({
13167
13161
  const {
13168
13162
  accountsToAddOpeningBalanceInModal,
13169
13163
  setAccountsToAddOpeningBalanceInModal
13170
- } = (0, import_react50.useContext)(LinkedAccountsContext);
13164
+ } = (0, import_react51.useContext)(LinkedAccountsContext);
13171
13165
  const shouldShowModal = Boolean(accountsToAddOpeningBalanceInModal.length);
13172
13166
  if (!shouldShowModal) {
13173
13167
  return null;
@@ -13214,7 +13208,7 @@ var LinkedAccountsComponent = ({
13214
13208
  error,
13215
13209
  isValidating,
13216
13210
  refetchAccounts
13217
- } = (0, import_react51.useContext)(LinkedAccountsContext);
13211
+ } = (0, import_react52.useContext)(LinkedAccountsContext);
13218
13212
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Container, { name: COMPONENT_NAME, elevated, children: [
13219
13213
  /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Header, { className: "Layer__linked-accounts__header", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
13220
13214
  Heading,
@@ -13249,36 +13243,36 @@ var LinkedAccountsComponent = ({
13249
13243
  };
13250
13244
 
13251
13245
  // src/components/UploadTransactions/UploadTransactions.tsx
13252
- var import_react61 = require("react");
13246
+ var import_react62 = require("react");
13253
13247
 
13254
13248
  // src/components/Wizard/Wizard.tsx
13255
- var import_react52 = require("react");
13249
+ var import_react53 = require("react");
13256
13250
  var import_jsx_runtime93 = require("react/jsx-runtime");
13257
13251
  function useWizardStep({
13258
13252
  steps,
13259
13253
  onComplete
13260
13254
  }) {
13261
13255
  const stepCount = steps.length;
13262
- const [activeStepIndex, setActiveStepIndex] = (0, import_react52.useState)(0);
13263
- const next = (0, import_react52.useCallback)(() => __async(null, null, function* () {
13256
+ const [activeStepIndex, setActiveStepIndex] = (0, import_react53.useState)(0);
13257
+ const next = (0, import_react53.useCallback)(() => __async(null, null, function* () {
13264
13258
  setActiveStepIndex((stepIndex) => Math.min(stepIndex + 1, stepCount - 1));
13265
13259
  if (activeStepIndex === stepCount - 1 && onComplete) {
13266
13260
  yield onComplete == null ? void 0 : onComplete();
13267
13261
  }
13268
13262
  }), [stepCount, activeStepIndex, onComplete]);
13269
- const previous = (0, import_react52.useCallback)(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
13263
+ const previous = (0, import_react53.useCallback)(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
13270
13264
  const effectiveStepIndex = Math.min(activeStepIndex, stepCount - 1);
13271
13265
  const currentStep = steps.at(effectiveStepIndex);
13272
13266
  return { currentStep, next, previous };
13273
13267
  }
13274
- var WizardContext = (0, import_react52.createContext)({
13268
+ var WizardContext = (0, import_react53.createContext)({
13275
13269
  next: () => {
13276
13270
  },
13277
13271
  previous: () => {
13278
13272
  }
13279
13273
  });
13280
13274
  function useWizard() {
13281
- return (0, import_react52.useContext)(WizardContext);
13275
+ return (0, import_react53.useContext)(WizardContext);
13282
13276
  }
13283
13277
  function Wizard({
13284
13278
  Header: Header4,
@@ -13286,12 +13280,12 @@ function Wizard({
13286
13280
  onComplete,
13287
13281
  children
13288
13282
  }) {
13289
- const childrenArray = import_react52.Children.toArray(children);
13283
+ const childrenArray = import_react53.Children.toArray(children);
13290
13284
  const { currentStep, next, previous } = useWizardStep({
13291
13285
  steps: childrenArray,
13292
13286
  onComplete
13293
13287
  });
13294
- const value = (0, import_react52.useMemo)(() => ({ next, previous }), [next, previous]);
13288
+ const value = (0, import_react53.useMemo)(() => ({ next, previous }), [next, previous]);
13295
13289
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(WizardContext.Provider, { value, children: [
13296
13290
  Header4,
13297
13291
  currentStep,
@@ -13300,7 +13294,7 @@ function Wizard({
13300
13294
  }
13301
13295
 
13302
13296
  // src/components/UploadTransactions/UploadTransactionsUploadCsvStep.tsx
13303
- var import_react58 = require("react");
13297
+ var import_react59 = require("react");
13304
13298
 
13305
13299
  // src/hooks/customAccounts/useCustomAccounts.ts
13306
13300
  var import_swr8 = __toESM(require("swr"));
@@ -13355,7 +13349,7 @@ function useCustomAccounts() {
13355
13349
  }
13356
13350
 
13357
13351
  // src/components/Input/CreatableSelect.tsx
13358
- var import_react53 = require("react");
13352
+ var import_react54 = require("react");
13359
13353
  var import_react_select3 = require("react-select");
13360
13354
  var import_creatable = __toESM(require("react-select/creatable"));
13361
13355
  var import_classnames32 = __toESM(require("classnames"));
@@ -13383,7 +13377,7 @@ var CreatableSelect = ({
13383
13377
  isInvalid ? "Layer__select--error" : "",
13384
13378
  className
13385
13379
  );
13386
- const DropdownIndicator2 = (0, import_react53.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_select3.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ChevronDownFill_default, {}) })), []);
13380
+ const DropdownIndicator2 = (0, import_react54.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_select3.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ChevronDownFill_default, {}) })), []);
13387
13381
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
13388
13382
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
13389
13383
  import_creatable.default,
@@ -13413,7 +13407,7 @@ var CreatableSelect = ({
13413
13407
  };
13414
13408
 
13415
13409
  // src/components/CustomAccountForm/CustomAccountForm.tsx
13416
- var import_react56 = require("react");
13410
+ var import_react57 = require("react");
13417
13411
 
13418
13412
  // src/utils/form.ts
13419
13413
  var notEmpty = (value) => {
@@ -13430,11 +13424,11 @@ var validateEmailFormat = (email, required = false) => {
13430
13424
  };
13431
13425
 
13432
13426
  // src/components/CustomAccountForm/useCustomAccountForm.ts
13433
- var import_react55 = require("react");
13427
+ var import_react56 = require("react");
13434
13428
  var import_react_form = require("@tanstack/react-form");
13435
13429
 
13436
13430
  // src/hooks/customAccounts/useCreateCustomAccount.ts
13437
- var import_react54 = require("react");
13431
+ var import_react55 = require("react");
13438
13432
  var import_mutation5 = __toESM(require("swr/mutation"));
13439
13433
  var import_swr9 = require("swr");
13440
13434
  var createCustomAccount = post(({ businessId }) => `/v1/businesses/${businessId}/custom-accounts`);
@@ -13473,7 +13467,7 @@ function useCreateCustomAccount() {
13473
13467
  }
13474
13468
  );
13475
13469
  const { trigger: originalTrigger } = mutationResponse;
13476
- const stableProxiedTrigger = (0, import_react54.useCallback)(
13470
+ const stableProxiedTrigger = (0, import_react55.useCallback)(
13477
13471
  (...triggerParameters) => __async(null, null, function* () {
13478
13472
  const triggerResult = yield originalTrigger(...triggerParameters);
13479
13473
  void mutate((key) => withSWRKeyTags(
@@ -13513,7 +13507,7 @@ var getCustomAccountTypeFromSubtype = (subtype) => {
13513
13507
  }
13514
13508
  };
13515
13509
  var useCustomAccountForm = ({ onSuccess }) => {
13516
- const [submitError, setSubmitError] = (0, import_react55.useState)(void 0);
13510
+ const [submitError, setSubmitError] = (0, import_react56.useState)(void 0);
13517
13511
  const { trigger: createCustomAccount2 } = useCreateCustomAccount();
13518
13512
  const form = (0, import_react_form.useForm)({
13519
13513
  defaultValues: {
@@ -13554,12 +13548,12 @@ var accountTypeOptions = [
13554
13548
  var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
13555
13549
  const { form, submitError, isFormValid } = useCustomAccountForm({ onSuccess });
13556
13550
  const { isSubmitting } = form.state;
13557
- const onSubmit = (0, import_react56.useCallback)((e) => {
13551
+ const onSubmit = (0, import_react57.useCallback)((e) => {
13558
13552
  e.preventDefault();
13559
13553
  e.stopPropagation();
13560
13554
  void form.handleSubmit();
13561
13555
  }, [form]);
13562
- (0, import_react56.useEffect)(() => {
13556
+ (0, import_react57.useEffect)(() => {
13563
13557
  form.setFieldValue("account_name", initialAccountName);
13564
13558
  }, [form, initialAccountName]);
13565
13559
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
@@ -13639,7 +13633,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
13639
13633
  };
13640
13634
 
13641
13635
  // src/components/CsvUpload/CsvUpload.tsx
13642
- var import_react57 = require("react");
13636
+ var import_react58 = require("react");
13643
13637
  var import_react_dropzone = require("react-dropzone");
13644
13638
  var import_classnames33 = __toESM(require("classnames"));
13645
13639
  var import_lucide_react5 = require("lucide-react");
@@ -13682,8 +13676,8 @@ var FileRow = ({ file, onClearFile, asDropTarget }) => {
13682
13676
  ] });
13683
13677
  };
13684
13678
  var CsvUpload = ({ file, onFileSelected, replaceDropTarget = false }) => {
13685
- const [errorMessage, setErrorMessage] = (0, import_react57.useState)();
13686
- const fileInputRef = (0, import_react57.useRef)(null);
13679
+ const [errorMessage, setErrorMessage] = (0, import_react58.useState)();
13680
+ const fileInputRef = (0, import_react58.useRef)(null);
13687
13681
  const handleBrowseClick = (e) => {
13688
13682
  var _a;
13689
13683
  e.preventDefault();
@@ -13695,7 +13689,7 @@ var CsvUpload = ({ file, onFileSelected, replaceDropTarget = false }) => {
13695
13689
  const fileArray = Array.from(files);
13696
13690
  onDrop(fileArray);
13697
13691
  };
13698
- const onDrop = (0, import_react57.useCallback)(
13692
+ const onDrop = (0, import_react58.useCallback)(
13699
13693
  ([firstFile, ...restFiles], rejections = []) => {
13700
13694
  const hasTooManyFiles = rejections.some((r) => r.errors.some((e) => e.code === "too-many-files"));
13701
13695
  if (restFiles.length > 0 || hasTooManyFiles) {
@@ -13907,38 +13901,38 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
13907
13901
  var _a;
13908
13902
  const { data: customAccounts, isLoading: isLoadingCustomAccounts, error: customAccountsError } = useCustomAccounts();
13909
13903
  const { trigger: parseCsv2, isMutating: isParsingCsv } = useCustomAccountParseCsv();
13910
- const [hasParseCsvError, setHasParseCsvError] = (0, import_react58.useState)(false);
13911
- const accountOptions = (0, import_react58.useMemo)(() => {
13904
+ const [hasParseCsvError, setHasParseCsvError] = (0, import_react59.useState)(false);
13905
+ const accountOptions = (0, import_react59.useMemo)(() => {
13912
13906
  if (!customAccounts) return [];
13913
13907
  return customAccounts.map((account) => ({
13914
13908
  value: account.id,
13915
13909
  label: account.accountName
13916
13910
  }));
13917
13911
  }, [customAccounts]);
13918
- const onChange = (0, import_react58.useCallback)((option) => {
13912
+ const onChange = (0, import_react59.useCallback)((option) => {
13919
13913
  onSelectAccount(option);
13920
13914
  }, [onSelectAccount]);
13921
- const onCreateOption = (0, import_react58.useCallback)((inputValue) => {
13915
+ const onCreateOption = (0, import_react59.useCallback)((inputValue) => {
13922
13916
  onSelectAccount({
13923
13917
  value: "new_account",
13924
13918
  label: "Create new account",
13925
13919
  createdAccountName: inputValue
13926
13920
  });
13927
13921
  }, [onSelectAccount]);
13928
- const onCancelCreateAccount = (0, import_react58.useCallback)(() => {
13922
+ const onCancelCreateAccount = (0, import_react59.useCallback)(() => {
13929
13923
  onSelectAccount(null);
13930
13924
  }, [onSelectAccount]);
13931
- const onCreateAccountSuccess = (0, import_react58.useCallback)((account) => {
13925
+ const onCreateAccountSuccess = (0, import_react59.useCallback)((account) => {
13932
13926
  onSelectAccount({
13933
13927
  value: account.id,
13934
13928
  label: account.accountName
13935
13929
  });
13936
13930
  }, [onSelectAccount]);
13937
- const onFileSelected = (0, import_react58.useCallback)((file) => {
13931
+ const onFileSelected = (0, import_react59.useCallback)((file) => {
13938
13932
  setHasParseCsvError(false);
13939
13933
  onSelectFile(file);
13940
13934
  }, [onSelectFile]);
13941
- const onClickContinue = (0, import_react58.useCallback)(() => {
13935
+ const onClickContinue = (0, import_react59.useCallback)(() => {
13942
13936
  if (!selectedAccount || selectedAccount.value === "new_account" || !selectedFile) return;
13943
13937
  void parseCsv2({
13944
13938
  customAccountId: selectedAccount.value,
@@ -14021,7 +14015,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
14021
14015
  }
14022
14016
 
14023
14017
  // src/components/UploadTransactions/UploadTransactionsValidateCsvStep.tsx
14024
- var import_react60 = require("react");
14018
+ var import_react61 = require("react");
14025
14019
  var import_lucide_react8 = require("lucide-react");
14026
14020
 
14027
14021
  // src/hooks/customAccounts/useCreateCustomAccountTransactions.ts
@@ -14070,7 +14064,7 @@ function useCreateCustomAccountTransactions() {
14070
14064
  }
14071
14065
 
14072
14066
  // src/components/CsvUpload/ValidateCsvTable.tsx
14073
- var import_react59 = require("react");
14067
+ var import_react60 = require("react");
14074
14068
  var import_classnames35 = __toESM(require("classnames"));
14075
14069
  var import_react_table = require("@tanstack/react-table");
14076
14070
  var import_react_virtual = require("@tanstack/react-virtual");
@@ -14078,7 +14072,7 @@ var import_jsx_runtime101 = require("react/jsx-runtime");
14078
14072
  var ROW_HEIGHT = 52;
14079
14073
  var BODY_HEIGHT = ROW_HEIGHT * 10;
14080
14074
  function ValidateCsvTable({ data, headers, formatters: formatters2, className }) {
14081
- const columns = (0, import_react59.useMemo)(
14075
+ const columns = (0, import_react60.useMemo)(
14082
14076
  () => {
14083
14077
  const baseCellClassName = "Layer__table-cell-content Layer__csv-upload__validate-csv-table__cell-content";
14084
14078
  const columnDefs = [{
@@ -14119,7 +14113,7 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
14119
14113
  },
14120
14114
  [headers, formatters2]
14121
14115
  );
14122
- const state = (0, import_react59.useMemo)(() => ({
14116
+ const state = (0, import_react60.useMemo)(() => ({
14123
14117
  sorting: [{ id: "is_valid", desc: false }],
14124
14118
  columnVisibility: {
14125
14119
  ["is_valid"]: false
@@ -14132,7 +14126,6 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
14132
14126
  getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
14133
14127
  getSortedRowModel: (0, import_react_table.getSortedRowModel)()
14134
14128
  });
14135
- const tableContainerRef = (0, import_react59.useRef)(null);
14136
14129
  return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: `${className} Layer__csv-upload__validate-csv-table__container`, children: [
14137
14130
  /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("table", { className: "Layer__table", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("thead", { className: "Layer__csv-upload__validate-csv-table__thead", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("tr", { className: "Layer__csv-upload__validate-csv-table__header-row", children: headerGroup.headers.map((header) => {
14138
14131
  const headerCellClassName = (0, import_classnames35.default)(
@@ -14142,19 +14135,20 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
14142
14135
  );
14143
14136
  return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { className: headerCellClassName, children: (0, import_react_table.flexRender)(header.column.columnDef.header, header.getContext()) }, header.id);
14144
14137
  }) }, headerGroup.id)) }) }),
14145
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { ref: tableContainerRef, className: "Layer__csv-upload__validate-csv-table__scroll_container", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("table", { className: "Layer__table", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ValidateCsvTableBody, { table, tableContainerRef }) }) })
14138
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ValidateCsvTableBody, { table })
14146
14139
  ] });
14147
14140
  }
14148
- function ValidateCsvTableBody({ table, tableContainerRef }) {
14141
+ function ValidateCsvTableBody({ table }) {
14149
14142
  const { rows } = table.getRowModel();
14143
+ const containerRef = (0, import_react60.useRef)(null);
14150
14144
  const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
14151
14145
  count: rows.length,
14152
14146
  estimateSize: () => ROW_HEIGHT,
14153
- getScrollElement: () => tableContainerRef.current,
14147
+ getScrollElement: () => containerRef.current,
14154
14148
  measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element == null ? void 0 : element.getBoundingClientRect().height : void 0,
14155
14149
  overscan: 5
14156
14150
  });
14157
- return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("tbody", { children: [
14151
+ return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { ref: containerRef, className: "Layer__csv-upload__validate-csv-table__scroll_container", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("table", { className: "Layer__table", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("tbody", { children: [
14158
14152
  /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("tr", { style: { height: BODY_HEIGHT }, children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { style: { height: BODY_HEIGHT, padding: 0 }, colSpan: table.getAllColumns().length - 1 }) }),
14159
14153
  rowVirtualizer.getVirtualItems().map((virtualRow) => {
14160
14154
  const row = rows[virtualRow.index];
@@ -14168,7 +14162,7 @@ function ValidateCsvTableBody({ table, tableContainerRef }) {
14168
14162
  row.id
14169
14163
  );
14170
14164
  })
14171
- ] });
14165
+ ] }) }) });
14172
14166
  }
14173
14167
  function ValidateCsvTableRow({ row, virtualRow, rowVirtualizer }) {
14174
14168
  const tableRowClassName = (0, import_classnames35.default)(
@@ -14212,7 +14206,7 @@ function UploadTransactionsValidateCsvStep({ parseCsvResponse, selectedAccountId
14212
14206
  new_transactions_preview: transactionsPreview,
14213
14207
  new_transactions_request: transactionsRequest
14214
14208
  } = parseCsvResponse;
14215
- const onClickUploadTransactions = (0, import_react60.useCallback)(() => {
14209
+ const onClickUploadTransactions = (0, import_react61.useCallback)(() => {
14216
14210
  void uploadTransactions(__spreadProps(__spreadValues({}, transactionsRequest), {
14217
14211
  customAccountId: selectedAccountId
14218
14212
  }));
@@ -14258,29 +14252,30 @@ function UploadTransactionsValidateCsvStep({ parseCsvResponse, selectedAccountId
14258
14252
  // src/components/UploadTransactions/UploadTransactions.tsx
14259
14253
  var import_jsx_runtime103 = require("react/jsx-runtime");
14260
14254
  function UploadTransactions({ onComplete }) {
14261
- const [currentStep, setCurrentStep] = (0, import_react61.useState)(0 /* UploadCsv */);
14262
- const [selectedAccount, setSelectedAccount] = (0, import_react61.useState)(null);
14263
- const [file, setFile] = (0, import_react61.useState)(null);
14264
- const [parseCsvResponse, setParseCsvResponse] = (0, import_react61.useState)(null);
14255
+ const [currentStep, setCurrentStep] = (0, import_react62.useState)(0 /* UploadCsv */);
14256
+ const [selectedAccount, setSelectedAccount] = (0, import_react62.useState)(null);
14257
+ const [file, setFile] = (0, import_react62.useState)(null);
14258
+ const [parseCsvResponse, setParseCsvResponse] = (0, import_react62.useState)(null);
14265
14259
  const isValid2 = parseCsvResponse == null ? void 0 : parseCsvResponse.is_valid;
14266
- const onSelectAccount = (0, import_react61.useCallback)((account) => {
14260
+ const onSelectAccount = (0, import_react62.useCallback)((account) => {
14267
14261
  setSelectedAccount(account);
14268
14262
  }, []);
14269
- const onSelectFile = (0, import_react61.useCallback)((file2) => {
14263
+ const onSelectFile = (0, import_react62.useCallback)((file2) => {
14270
14264
  setFile(file2);
14271
14265
  setParseCsvResponse(null);
14272
14266
  }, []);
14273
- const goBack = (0, import_react61.useCallback)((step = 1) => setCurrentStep(currentStep - step), [currentStep]);
14274
- const goForward = (0, import_react61.useCallback)((step = 1) => setCurrentStep(currentStep + step), [currentStep]);
14275
- const onParseCsv = (0, import_react61.useCallback)((parseCsvResponse2) => {
14267
+ const onParseCsv = (0, import_react62.useCallback)((parseCsvResponse2) => {
14276
14268
  setParseCsvResponse(parseCsvResponse2);
14277
- goForward();
14278
- }, [goForward]);
14279
- const onReupload = (0, import_react61.useCallback)(() => {
14269
+ setCurrentStep(1 /* ValidateCsv */);
14270
+ }, []);
14271
+ const goRestartFlow = (0, import_react62.useCallback)(() => {
14272
+ setCurrentStep(0 /* UploadCsv */);
14273
+ }, []);
14274
+ const onReupload = (0, import_react62.useCallback)(() => {
14280
14275
  setFile(null);
14281
14276
  setParseCsvResponse(null);
14282
- goBack();
14283
- }, [goBack]);
14277
+ setCurrentStep(0 /* UploadCsv */);
14278
+ }, []);
14284
14279
  return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("section", { className: "Layer__component", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
14285
14280
  Wizard,
14286
14281
  {
@@ -14316,7 +14311,7 @@ function UploadTransactions({ onComplete }) {
14316
14311
  {
14317
14312
  selectedAccountId: selectedAccount.value,
14318
14313
  parseCsvResponse,
14319
- onGoBack: goBack,
14314
+ onGoBack: goRestartFlow,
14320
14315
  onReupload
14321
14316
  }
14322
14317
  )
@@ -14327,14 +14322,14 @@ function UploadTransactions({ onComplete }) {
14327
14322
 
14328
14323
  // src/components/BankTransactions/BankTransactions.tsx
14329
14324
  var import_lodash2 = __toESM(require_lodash());
14330
- var import_react92 = require("react");
14325
+ var import_react93 = require("react");
14331
14326
 
14332
14327
  // src/hooks/useElementSize/useElementSize.ts
14333
- var import_react62 = require("react");
14328
+ var import_react63 = require("react");
14334
14329
  var useElementSize = (callback) => {
14335
- const ref = (0, import_react62.useRef)(null);
14336
- const resizeTimeout = (0, import_react62.useRef)(null);
14337
- (0, import_react62.useLayoutEffect)(() => {
14330
+ const ref = (0, import_react63.useRef)(null);
14331
+ const resizeTimeout = (0, import_react63.useRef)(null);
14332
+ (0, import_react63.useLayoutEffect)(() => {
14338
14333
  const element = ref == null ? void 0 : ref.current;
14339
14334
  if (!element) {
14340
14335
  return;
@@ -14365,10 +14360,10 @@ var useElementSize = (callback) => {
14365
14360
  };
14366
14361
 
14367
14362
  // src/hooks/useIsVisible/useIsVisible.ts
14368
- var import_react63 = require("react");
14363
+ var import_react64 = require("react");
14369
14364
  var useIsVisible = (ref) => {
14370
- const [isIntersecting, setIntersecting] = (0, import_react63.useState)(false);
14371
- (0, import_react63.useEffect)(() => {
14365
+ const [isIntersecting, setIntersecting] = (0, import_react64.useState)(false);
14366
+ (0, import_react64.useEffect)(() => {
14372
14367
  if (!ref.current) {
14373
14368
  return;
14374
14369
  }
@@ -14384,7 +14379,7 @@ var useIsVisible = (ref) => {
14384
14379
  };
14385
14380
 
14386
14381
  // src/components/BankTransactionList/BankTransactionListItem.tsx
14387
- var import_react77 = require("react");
14382
+ var import_react78 = require("react");
14388
14383
 
14389
14384
  // src/icons/File.tsx
14390
14385
  var import_jsx_runtime104 = require("react/jsx-runtime");
@@ -14452,7 +14447,7 @@ var File = (_a) => {
14452
14447
  var File_default = File;
14453
14448
 
14454
14449
  // src/components/BankTransactionRow/BankTransactionRow.tsx
14455
- var import_react76 = require("react");
14450
+ var import_react77 = require("react");
14456
14451
 
14457
14452
  // src/icons/Scissors.tsx
14458
14453
  var import_jsx_runtime105 = require("react/jsx-runtime");
@@ -14753,10 +14748,10 @@ var MinimizeTwo = (_a) => {
14753
14748
  var MinimizeTwo_default = MinimizeTwo;
14754
14749
 
14755
14750
  // src/components/CategorySelect/CategorySelectDrawer.tsx
14756
- var import_react65 = require("react");
14751
+ var import_react66 = require("react");
14757
14752
 
14758
14753
  // src/components/BankTransactionMobileList/BusinessCategories.tsx
14759
- var import_react64 = require("react");
14754
+ var import_react65 = require("react");
14760
14755
 
14761
14756
  // src/components/ActionableList/ActionableList.tsx
14762
14757
  var import_classnames36 = __toESM(require("classnames"));
@@ -14922,8 +14917,8 @@ var BusinessCategories = ({
14922
14917
  const categoryOptions = flattenCategories(
14923
14918
  (categories != null ? categories : []).filter((category) => category.type != "ExclusionNested")
14924
14919
  );
14925
- const [optionsToShow, setOptionsToShow] = (0, import_react64.useState)(categoryOptions);
14926
- const [selectedGroup, setSelectedGroup] = (0, import_react64.useState)();
14920
+ const [optionsToShow, setOptionsToShow] = (0, import_react65.useState)(categoryOptions);
14921
+ const [selectedGroup, setSelectedGroup] = (0, import_react65.useState)();
14927
14922
  const onCategorySelect = (v) => {
14928
14923
  if (v.value.type === "GROUP" && v.value.items) {
14929
14924
  setOptionsToShow(v.value.items);
@@ -14962,7 +14957,7 @@ var CategorySelectDrawer = ({
14962
14957
  showTooltips: _showTooltips
14963
14958
  }) => {
14964
14959
  var _a, _b;
14965
- const { setContent, close: close2 } = (0, import_react65.useContext)(DrawerContext);
14960
+ const { setContent, close: close2 } = (0, import_react66.useContext)(DrawerContext);
14966
14961
  const onDrawerCategorySelect = (value) => {
14967
14962
  close2();
14968
14963
  onSelect(value);
@@ -15257,7 +15252,7 @@ var CategorySelect = ({
15257
15252
  };
15258
15253
 
15259
15254
  // src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
15260
- var import_react74 = require("react");
15255
+ var import_react75 = require("react");
15261
15256
 
15262
15257
  // src/icons/ScissorsFullOpen.tsx
15263
15258
  var import_jsx_runtime114 = require("react/jsx-runtime");
@@ -15386,19 +15381,19 @@ var Trash = (_a) => {
15386
15381
  var Trash_default = Trash;
15387
15382
 
15388
15383
  // src/components/BankTransactionReceipts/BankTransactionReceipts.tsx
15389
- var import_react68 = require("react");
15384
+ var import_react69 = require("react");
15390
15385
 
15391
15386
  // src/contexts/ReceiptsContext/ReceiptsContext.ts
15392
- var import_react66 = require("react");
15393
- var ReceiptsContext = (0, import_react66.createContext)({
15387
+ var import_react67 = require("react");
15388
+ var ReceiptsContext = (0, import_react67.createContext)({
15394
15389
  receiptUrls: [],
15395
15390
  uploadReceipt: () => Promise.resolve(),
15396
15391
  archiveDocument: () => Promise.resolve()
15397
15392
  });
15398
- var useReceiptsContext = () => (0, import_react66.useContext)(ReceiptsContext);
15393
+ var useReceiptsContext = () => (0, import_react67.useContext)(ReceiptsContext);
15399
15394
 
15400
15395
  // src/hooks/useReceipts/useReceipts.ts
15401
- var import_react67 = require("react");
15396
+ var import_react68 = require("react");
15402
15397
  var import_date_fns13 = require("date-fns");
15403
15398
  var readDate = (date) => {
15404
15399
  if (!date) return void 0;
@@ -15412,8 +15407,8 @@ var useReceipts = ({
15412
15407
  const { apiUrl } = useEnvironment();
15413
15408
  const { data: auth } = useAuth();
15414
15409
  const { updateOneLocal: updateBankTransaction } = useBankTransactionsContext();
15415
- const [receiptUrls, setReceiptUrls] = (0, import_react67.useState)([]);
15416
- (0, import_react67.useEffect)(() => {
15410
+ const [receiptUrls, setReceiptUrls] = (0, import_react68.useState)([]);
15411
+ (0, import_react68.useEffect)(() => {
15417
15412
  if (isActive && receiptUrls.length === 0 && hasReceipts(bankTransaction)) {
15418
15413
  void fetchDocuments();
15419
15414
  }
@@ -15706,12 +15701,12 @@ var openReceiptInNewTab = (url, index) => (e) => {
15706
15701
  `);
15707
15702
  }
15708
15703
  };
15709
- var BankTransactionReceiptsWithProvider = (0, import_react68.forwardRef)((_a, ref) => {
15704
+ var BankTransactionReceiptsWithProvider = (0, import_react69.forwardRef)((_a, ref) => {
15710
15705
  var _b = _a, { bankTransaction, isActive } = _b, props = __objRest(_b, ["bankTransaction", "isActive"]);
15711
15706
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
15712
15707
  });
15713
15708
  BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
15714
- var BankTransactionReceipts = (0, import_react68.forwardRef)(
15709
+ var BankTransactionReceipts = (0, import_react69.forwardRef)(
15715
15710
  ({
15716
15711
  classNamePrefix = "Layer",
15717
15712
  floatingActions = false,
@@ -15719,7 +15714,7 @@ var BankTransactionReceipts = (0, import_react68.forwardRef)(
15719
15714
  label
15720
15715
  }, ref) => {
15721
15716
  const { receiptUrls, uploadReceipt, archiveDocument } = useReceiptsContext();
15722
- (0, import_react68.useImperativeHandle)(ref, () => ({
15717
+ (0, import_react69.useImperativeHandle)(ref, () => ({
15723
15718
  uploadReceipt
15724
15719
  }));
15725
15720
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: `${classNamePrefix}__file-upload`, children: [
@@ -15763,19 +15758,19 @@ BankTransactionReceipts.displayName = "BankTransactionReceipts";
15763
15758
  var import_swr11 = __toESM(require("swr"));
15764
15759
 
15765
15760
  // src/providers/LegacyModeProvider/LegacyModeProvider.tsx
15766
- var import_react69 = require("react");
15761
+ var import_react70 = require("react");
15767
15762
  var import_jsx_runtime120 = require("react/jsx-runtime");
15768
- var LegacyModeContext = (0, import_react69.createContext)({
15763
+ var LegacyModeContext = (0, import_react70.createContext)({
15769
15764
  overrideMode: void 0
15770
15765
  });
15771
15766
  function useLegacyMode() {
15772
- return (0, import_react69.useContext)(LegacyModeContext);
15767
+ return (0, import_react70.useContext)(LegacyModeContext);
15773
15768
  }
15774
15769
  function LegacyModeProvider({
15775
15770
  overrideMode,
15776
15771
  children
15777
15772
  }) {
15778
- const memoizedValue = (0, import_react69.useMemo)(() => ({ overrideMode }), [overrideMode]);
15773
+ const memoizedValue = (0, import_react70.useMemo)(() => ({ overrideMode }), [overrideMode]);
15779
15774
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(LegacyModeContext.Provider, { value: memoizedValue, children });
15780
15775
  }
15781
15776
 
@@ -16088,10 +16083,10 @@ var MatchFormMobile = ({
16088
16083
  };
16089
16084
 
16090
16085
  // src/components/Toggle/Toggle.tsx
16091
- var import_react70 = require("react");
16086
+ var import_react71 = require("react");
16092
16087
  var import_classnames42 = __toESM(require("classnames"));
16093
16088
  var import_jsx_runtime124 = require("react/jsx-runtime");
16094
- var import_react71 = require("react");
16089
+ var import_react72 = require("react");
16095
16090
  var Toggle = ({
16096
16091
  name,
16097
16092
  options,
@@ -16099,10 +16094,10 @@ var Toggle = ({
16099
16094
  onChange,
16100
16095
  size = "medium" /* medium */
16101
16096
  }) => {
16102
- const [currentWidth, setCurrentWidth] = (0, import_react70.useState)(0);
16103
- const [thumbPos, setThumbPos] = (0, import_react70.useState)({ left: 0, width: 0 });
16104
- const [initialized, setInitialized] = (0, import_react70.useState)(false);
16105
- const activeOption = (0, import_react70.useMemo)(() => {
16097
+ const [currentWidth, setCurrentWidth] = (0, import_react71.useState)(0);
16098
+ const [thumbPos, setThumbPos] = (0, import_react71.useState)({ left: 0, width: 0 });
16099
+ const [initialized, setInitialized] = (0, import_react71.useState)(false);
16100
+ const activeOption = (0, import_react71.useMemo)(() => {
16106
16101
  return selected ? selected : options.length > 0 ? options[0].value : void 0;
16107
16102
  }, [selected, options]);
16108
16103
  const toggleRef = useElementSize((_a, _b, c) => {
@@ -16142,14 +16137,14 @@ var Toggle = ({
16142
16137
  shift2 = shift2 + (size === "medium" /* medium */ ? 2 : 1.5);
16143
16138
  setThumbPos({ left: shift2, width });
16144
16139
  };
16145
- (0, import_react70.useEffect)(() => {
16140
+ (0, import_react71.useEffect)(() => {
16146
16141
  const selectedIndex = getSelectedIndex();
16147
16142
  updateThumbPosition(selectedIndex);
16148
16143
  setTimeout(() => {
16149
16144
  setInitialized(true);
16150
16145
  }, 400);
16151
16146
  }, []);
16152
- (0, import_react70.useEffect)(() => {
16147
+ (0, import_react71.useEffect)(() => {
16153
16148
  const selectedIndex = getSelectedIndex();
16154
16149
  updateThumbPosition(selectedIndex);
16155
16150
  }, [currentWidth]);
@@ -16165,7 +16160,7 @@ var Toggle = ({
16165
16160
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: baseClassName, ref: toggleRef, children: [
16166
16161
  options.map((option, index) => {
16167
16162
  var _a;
16168
- return /* @__PURE__ */ (0, import_react71.createElement)(
16163
+ return /* @__PURE__ */ (0, import_react72.createElement)(
16169
16164
  ToggleOption,
16170
16165
  __spreadProps(__spreadValues({}, option), {
16171
16166
  size,
@@ -16250,7 +16245,7 @@ var ToggleOption = ({
16250
16245
  };
16251
16246
 
16252
16247
  // src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
16253
- var import_react72 = require("react");
16248
+ var import_react73 = require("react");
16254
16249
  var import_jsx_runtime125 = require("react/jsx-runtime");
16255
16250
  var ERROR_TITLE = "Approval Failed";
16256
16251
  var ERROR_MESSAGE = "Something went wrong, try again later";
@@ -16261,7 +16256,7 @@ var APIErrorNotifications = ({
16261
16256
  bankTransaction,
16262
16257
  containerWidth
16263
16258
  }) => {
16264
- const [notifications, setNotifications] = (0, import_react72.useState)([]);
16259
+ const [notifications, setNotifications] = (0, import_react73.useState)([]);
16265
16260
  const pushNotification = (title, message) => {
16266
16261
  const timestamp = (/* @__PURE__ */ new Date()).valueOf();
16267
16262
  if (notificationsCache.find(
@@ -16290,7 +16285,7 @@ var APIErrorNotifications = ({
16290
16285
  );
16291
16286
  setNotifications(notificationsCache.concat());
16292
16287
  };
16293
- (0, import_react72.useEffect)(() => {
16288
+ (0, import_react73.useEffect)(() => {
16294
16289
  if (bankTransaction.error) {
16295
16290
  pushNotification(ERROR_TITLE, ERROR_MESSAGE);
16296
16291
  }
@@ -16315,8 +16310,8 @@ var Notification = ({
16315
16310
  notification,
16316
16311
  deleteNotification
16317
16312
  }) => {
16318
- const [visible, setVisible] = (0, import_react72.useState)(false);
16319
- (0, import_react72.useEffect)(() => {
16313
+ const [visible, setVisible] = (0, import_react73.useState)(false);
16314
+ (0, import_react73.useEffect)(() => {
16320
16315
  setVisible(true);
16321
16316
  const timer = setTimeout(() => {
16322
16317
  hideNotification();
@@ -16427,7 +16422,7 @@ function useBankTransactionMetadata({ bankTransactionId }) {
16427
16422
  // src/hooks/useBankTransactions/useUpdateBankTransactionMetadata.ts
16428
16423
  var import_mutation8 = __toESM(require("swr/mutation"));
16429
16424
  var import_swr13 = require("swr");
16430
- var import_react73 = require("react");
16425
+ var import_react74 = require("react");
16431
16426
  var UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
16432
16427
  function buildKey15({
16433
16428
  access_token: accessToken,
@@ -16476,7 +16471,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
16476
16471
  }
16477
16472
  );
16478
16473
  const { trigger: originalTrigger } = mutationResponse;
16479
- const stableProxiedTrigger = (0, import_react73.useCallback)(
16474
+ const stableProxiedTrigger = (0, import_react74.useCallback)(
16480
16475
  (...triggerParameters) => __async(null, null, function* () {
16481
16476
  const triggerResult = yield originalTrigger(...triggerParameters);
16482
16477
  void mutate((key) => withSWRKeyTags(
@@ -16571,7 +16566,7 @@ var validateSplit = (splitData) => {
16571
16566
  });
16572
16567
  return valid;
16573
16568
  };
16574
- var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
16569
+ var ExpandedBankTransactionRow = (0, import_react75.forwardRef)(
16575
16570
  ({
16576
16571
  bankTransaction,
16577
16572
  isOpen = false,
@@ -16589,19 +16584,19 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
16589
16584
  categorize: categorizeBankTransaction2,
16590
16585
  match: matchBankTransaction2
16591
16586
  } = useBankTransactionsContext();
16592
- const [purpose, setPurpose] = (0, import_react74.useState)(
16587
+ const [purpose, setPurpose] = (0, import_react75.useState)(
16593
16588
  bankTransaction.category ? "categorize" /* categorize */ : hasMatch(bankTransaction) ? "match" /* match */ : "categorize" /* categorize */
16594
16589
  );
16595
- const [selectedMatchId, setSelectedMatchId] = (0, import_react74.useState)(
16590
+ const [selectedMatchId, setSelectedMatchId] = (0, import_react75.useState)(
16596
16591
  (_c = isAlreadyMatched2(bankTransaction)) != null ? _c : (_b = (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0]) == null ? void 0 : _b.id
16597
16592
  );
16598
- const [matchFormError, setMatchFormError] = (0, import_react74.useState)();
16599
- const [splitFormError, setSplitFormError] = (0, import_react74.useState)();
16600
- const [height, setHeight] = (0, import_react74.useState)(0);
16601
- const [isOver, setOver] = (0, import_react74.useState)(false);
16602
- const bodyRef = (0, import_react74.useRef)(null);
16593
+ const [matchFormError, setMatchFormError] = (0, import_react75.useState)();
16594
+ const [splitFormError, setSplitFormError] = (0, import_react75.useState)();
16595
+ const [height, setHeight] = (0, import_react75.useState)(0);
16596
+ const [isOver, setOver] = (0, import_react75.useState)(false);
16597
+ const bodyRef = (0, import_react75.useRef)(null);
16603
16598
  const defaultCategory = bankTransaction.category ? bankTransaction.category : hasSuggestions(bankTransaction.categorization_flow) ? (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions.at(0) : void 0;
16604
- const [rowState, updateRowState] = (0, import_react74.useState)({
16599
+ const [rowState, updateRowState] = (0, import_react75.useState)({
16605
16600
  splits: ((_e = bankTransaction.category) == null ? void 0 : _e.entries) ? (_f = bankTransaction.category) == null ? void 0 : _f.entries.map((c) => {
16606
16601
  return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
16607
16602
  amount: c.amount || 0,
@@ -16732,7 +16727,7 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
16732
16727
  );
16733
16728
  close2();
16734
16729
  });
16735
- (0, import_react74.useImperativeHandle)(ref, () => ({
16730
+ (0, import_react75.useImperativeHandle)(ref, () => ({
16736
16731
  save
16737
16732
  }));
16738
16733
  const onMatchSubmit = (matchId) => __async(null, null, function* () {
@@ -16746,11 +16741,11 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
16746
16741
  yield matchBankTransaction2(bankTransaction.id, foundMatch.id);
16747
16742
  close2();
16748
16743
  });
16749
- const getDivHeight = (0, import_react74.useCallback)(() => {
16744
+ const getDivHeight = (0, import_react75.useCallback)(() => {
16750
16745
  const { height: height2 } = bodyRef.current ? bodyRef.current.getBoundingClientRect() : { height: void 0 };
16751
16746
  return height2 || 0;
16752
16747
  }, []);
16753
- const handleTransitionEnd = (0, import_react74.useCallback)(
16748
+ const handleTransitionEnd = (0, import_react75.useCallback)(
16754
16749
  (e) => {
16755
16750
  if (e.propertyName === "height") {
16756
16751
  setHeight(isOpen ? "auto" : 0);
@@ -16761,7 +16756,7 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
16761
16756
  },
16762
16757
  [isOpen]
16763
16758
  );
16764
- (0, import_react74.useEffect)(() => {
16759
+ (0, import_react75.useEffect)(() => {
16765
16760
  setHeight(getDivHeight());
16766
16761
  setOver(false);
16767
16762
  if (!isOpen) {
@@ -17265,13 +17260,13 @@ var BankTransactionProcessingInfo = () => /* @__PURE__ */ (0, import_jsx_runtime
17265
17260
  ] });
17266
17261
 
17267
17262
  // src/hooks/visibility/useDelayedVisibility.ts
17268
- var import_react75 = require("react");
17263
+ var import_react76 = require("react");
17269
17264
  function useDelayedVisibility({
17270
17265
  delay,
17271
17266
  initialVisibility = false
17272
17267
  }) {
17273
- const [isVisible, setIsVisible] = (0, import_react75.useState)(initialVisibility);
17274
- (0, import_react75.useEffect)(
17268
+ const [isVisible, setIsVisible] = (0, import_react76.useState)(initialVisibility);
17269
+ (0, import_react76.useEffect)(
17275
17270
  () => {
17276
17271
  const timer = setTimeout(() => {
17277
17272
  setIsVisible(true);
@@ -17320,17 +17315,17 @@ var BankTransactionRow = ({
17320
17315
  stringOverrides
17321
17316
  }) => {
17322
17317
  var _a, _b, _c, _d, _e, _f;
17323
- const expandedRowRef = (0, import_react76.useRef)(null);
17324
- const [showRetry, setShowRetry] = (0, import_react76.useState)(false);
17318
+ const expandedRowRef = (0, import_react77.useRef)(null);
17319
+ const [showRetry, setShowRetry] = (0, import_react77.useState)(false);
17325
17320
  const {
17326
17321
  categorize: categorizeBankTransaction2,
17327
17322
  match: matchBankTransaction2,
17328
17323
  shouldHideAfterCategorize
17329
17324
  } = useBankTransactionsContext();
17330
- const [selectedCategory, setSelectedCategory] = (0, import_react76.useState)(
17325
+ const [selectedCategory, setSelectedCategory] = (0, import_react77.useState)(
17331
17326
  getDefaultSelectedCategory(bankTransaction)
17332
17327
  );
17333
- const [open2, setOpen] = (0, import_react76.useState)(false);
17328
+ const [open2, setOpen] = (0, import_react77.useState)(false);
17334
17329
  const toggleOpen = () => {
17335
17330
  setShowRetry(false);
17336
17331
  setOpen(!open2);
@@ -17346,12 +17341,12 @@ var BankTransactionRow = ({
17346
17341
  }
17347
17342
  }
17348
17343
  };
17349
- (0, import_react76.useEffect)(() => {
17344
+ (0, import_react77.useEffect)(() => {
17350
17345
  if (bankTransaction.error) {
17351
17346
  setShowRetry(true);
17352
17347
  }
17353
17348
  }, [bankTransaction.error]);
17354
- (0, import_react76.useEffect)(() => {
17349
+ (0, import_react77.useEffect)(() => {
17355
17350
  if (editable && bankTransaction.recently_categorized && shouldHideAfterCategorize()) {
17356
17351
  setTimeout(() => {
17357
17352
  removeTransaction(bankTransaction);
@@ -17394,7 +17389,7 @@ var BankTransactionRow = ({
17394
17389
  initialLoad ? "initial-load" : "",
17395
17390
  isVisible ? "show" : ""
17396
17391
  );
17397
- const showReceiptDataProperties = (0, import_react76.useMemo)(
17392
+ const showReceiptDataProperties = (0, import_react77.useMemo)(
17398
17393
  () => toDataProperties({ "show-receipt-upload-column": showReceiptUploadColumn }),
17399
17394
  [showReceiptUploadColumn]
17400
17395
  );
@@ -17664,17 +17659,17 @@ var BankTransactionListItem = ({
17664
17659
  stringOverrides
17665
17660
  }) => {
17666
17661
  var _a, _b;
17667
- const expandedRowRef = (0, import_react77.useRef)(null);
17668
- const [showRetry, setShowRetry] = (0, import_react77.useState)(false);
17662
+ const expandedRowRef = (0, import_react78.useRef)(null);
17663
+ const [showRetry, setShowRetry] = (0, import_react78.useState)(false);
17669
17664
  const {
17670
17665
  categorize: categorizeBankTransaction2,
17671
17666
  match: matchBankTransaction2,
17672
17667
  shouldHideAfterCategorize
17673
17668
  } = useBankTransactionsContext();
17674
- const [selectedCategory, setSelectedCategory] = (0, import_react77.useState)(
17669
+ const [selectedCategory, setSelectedCategory] = (0, import_react78.useState)(
17675
17670
  getDefaultSelectedCategory(bankTransaction)
17676
17671
  );
17677
- const [open2, setOpen] = (0, import_react77.useState)(false);
17672
+ const [open2, setOpen] = (0, import_react78.useState)(false);
17678
17673
  const toggleOpen = () => {
17679
17674
  setShowRetry(false);
17680
17675
  setOpen(!open2);
@@ -17682,12 +17677,12 @@ var BankTransactionListItem = ({
17682
17677
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
17683
17678
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
17684
17679
  const { isVisible } = useDelayedVisibility({ delay: index * 80 });
17685
- (0, import_react77.useEffect)(() => {
17680
+ (0, import_react78.useEffect)(() => {
17686
17681
  if (bankTransaction.error) {
17687
17682
  setShowRetry(true);
17688
17683
  }
17689
17684
  }, [bankTransaction.error]);
17690
- (0, import_react77.useEffect)(() => {
17685
+ (0, import_react78.useEffect)(() => {
17691
17686
  if (editable && bankTransaction.recently_categorized && shouldHideAfterCategorize()) {
17692
17687
  setTimeout(() => {
17693
17688
  removeTransaction(bankTransaction);
@@ -17855,10 +17850,10 @@ var BankTransactionList = ({
17855
17850
  };
17856
17851
 
17857
17852
  // src/components/BankTransactionMobileList/BankTransactionMobileListItem.tsx
17858
- var import_react84 = require("react");
17853
+ var import_react85 = require("react");
17859
17854
 
17860
17855
  // src/components/BankTransactionMobileList/BusinessForm.tsx
17861
- var import_react78 = require("react");
17856
+ var import_react79 = require("react");
17862
17857
 
17863
17858
  // src/icons/Paperclip.tsx
17864
17859
  var import_jsx_runtime139 = require("react/jsx-runtime");
@@ -17897,19 +17892,19 @@ var BusinessForm = ({
17897
17892
  showReceiptUploads,
17898
17893
  showDescriptions
17899
17894
  }) => {
17900
- const receiptsRef = (0, import_react78.useRef)(null);
17901
- const { setContent, close: close2 } = (0, import_react78.useContext)(DrawerContext);
17895
+ const receiptsRef = (0, import_react79.useRef)(null);
17896
+ const { setContent, close: close2 } = (0, import_react79.useContext)(DrawerContext);
17902
17897
  const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
17903
- const [selectedCategory, setSelectedCategory] = (0, import_react78.useState)(
17898
+ const [selectedCategory, setSelectedCategory] = (0, import_react79.useState)(
17904
17899
  getAssignedValue(bankTransaction)
17905
17900
  );
17906
- const [showRetry, setShowRetry] = (0, import_react78.useState)(false);
17907
- (0, import_react78.useEffect)(() => {
17901
+ const [showRetry, setShowRetry] = (0, import_react79.useState)(false);
17902
+ (0, import_react79.useEffect)(() => {
17908
17903
  if (bankTransaction.error) {
17909
17904
  setShowRetry(true);
17910
17905
  }
17911
17906
  }, [bankTransaction.error]);
17912
- const options = (0, import_react78.useMemo)(() => {
17907
+ const options = (0, import_react79.useMemo)(() => {
17913
17908
  var _a;
17914
17909
  const options2 = ((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === "ASK_FROM_SUGGESTIONS" /* ASK_FROM_SUGGESTIONS */ ? bankTransaction.categorization_flow.suggestions.map(
17915
17910
  (x) => mapCategoryToOption(x)
@@ -18045,7 +18040,7 @@ var BusinessForm = ({
18045
18040
  };
18046
18041
 
18047
18042
  // src/components/BankTransactionMobileList/PersonalForm.tsx
18048
- var import_react79 = require("react");
18043
+ var import_react80 = require("react");
18049
18044
 
18050
18045
  // src/components/BankTransactionMobileList/constants.ts
18051
18046
  var PersonalCategories = /* @__PURE__ */ ((PersonalCategories2) => {
@@ -18073,10 +18068,10 @@ var PersonalForm = ({
18073
18068
  showDescriptions,
18074
18069
  showCategorization
18075
18070
  }) => {
18076
- const receiptsRef = (0, import_react79.useRef)(null);
18071
+ const receiptsRef = (0, import_react80.useRef)(null);
18077
18072
  const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
18078
- const [showRetry, setShowRetry] = (0, import_react79.useState)(false);
18079
- (0, import_react79.useEffect)(() => {
18073
+ const [showRetry, setShowRetry] = (0, import_react80.useState)(false);
18074
+ (0, import_react80.useEffect)(() => {
18080
18075
  if (bankTransaction.error) {
18081
18076
  setShowRetry(true);
18082
18077
  }
@@ -18146,10 +18141,10 @@ var PersonalForm = ({
18146
18141
  };
18147
18142
 
18148
18143
  // src/components/BankTransactionMobileList/SplitAndMatchForm.tsx
18149
- var import_react82 = require("react");
18144
+ var import_react83 = require("react");
18150
18145
 
18151
18146
  // src/components/BankTransactionMobileList/MatchForm.tsx
18152
- var import_react80 = require("react");
18147
+ var import_react81 = require("react");
18153
18148
  var import_classnames49 = __toESM(require("classnames"));
18154
18149
  var import_jsx_runtime142 = require("react/jsx-runtime");
18155
18150
  var MatchForm2 = ({
@@ -18159,14 +18154,14 @@ var MatchForm2 = ({
18159
18154
  showCategorization
18160
18155
  }) => {
18161
18156
  var _a, _b;
18162
- const receiptsRef = (0, import_react80.useRef)(null);
18157
+ const receiptsRef = (0, import_react81.useRef)(null);
18163
18158
  const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
18164
- const [selectedMatchId, setSelectedMatchId] = (0, import_react80.useState)(
18159
+ const [selectedMatchId, setSelectedMatchId] = (0, import_react81.useState)(
18165
18160
  (_b = isAlreadyMatched(bankTransaction)) != null ? _b : bankTransaction.suggested_matches && ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a.length) > 0 ? bankTransaction.suggested_matches[0].id : void 0
18166
18161
  );
18167
- const [formError, setFormError] = (0, import_react80.useState)();
18168
- const [showRetry, setShowRetry] = (0, import_react80.useState)(false);
18169
- (0, import_react80.useEffect)(() => {
18162
+ const [formError, setFormError] = (0, import_react81.useState)();
18163
+ const [showRetry, setShowRetry] = (0, import_react81.useState)(false);
18164
+ (0, import_react81.useEffect)(() => {
18170
18165
  if (bankTransaction.error) {
18171
18166
  setShowRetry(true);
18172
18167
  } else if (showRetry) {
@@ -18257,7 +18252,7 @@ var MatchForm2 = ({
18257
18252
  };
18258
18253
 
18259
18254
  // src/components/BankTransactionMobileList/SplitForm.tsx
18260
- var import_react81 = require("react");
18255
+ var import_react82 = require("react");
18261
18256
  var import_classnames50 = __toESM(require("classnames"));
18262
18257
  var import_jsx_runtime143 = require("react/jsx-runtime");
18263
18258
  var SplitForm = ({
@@ -18268,13 +18263,13 @@ var SplitForm = ({
18268
18263
  showDescriptions
18269
18264
  }) => {
18270
18265
  var _a, _b, _c, _d;
18271
- const receiptsRef = (0, import_react81.useRef)(null);
18266
+ const receiptsRef = (0, import_react82.useRef)(null);
18272
18267
  const {
18273
18268
  categorize: categorizeBankTransaction2,
18274
18269
  isLoading
18275
18270
  } = useBankTransactionsContext();
18276
18271
  const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_b = (_a = bankTransaction.categorization_flow) == null ? void 0 : _a.suggestions) == null ? void 0 : _b[0]);
18277
- const [rowState, updateRowState] = (0, import_react81.useState)({
18272
+ const [rowState, updateRowState] = (0, import_react82.useState)({
18278
18273
  splits: ((_c = bankTransaction.category) == null ? void 0 : _c.entries) ? (_d = bankTransaction.category) == null ? void 0 : _d.entries.map((c) => {
18279
18274
  return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
18280
18275
  amount: c.amount || 0,
@@ -18300,9 +18295,9 @@ var SplitForm = ({
18300
18295
  description: "",
18301
18296
  file: void 0
18302
18297
  });
18303
- const [formError, setFormError] = (0, import_react81.useState)();
18304
- const [showRetry, setShowRetry] = (0, import_react81.useState)(false);
18305
- (0, import_react81.useEffect)(() => {
18298
+ const [formError, setFormError] = (0, import_react82.useState)();
18299
+ const [showRetry, setShowRetry] = (0, import_react82.useState)(false);
18300
+ (0, import_react82.useEffect)(() => {
18306
18301
  if (bankTransaction.error) {
18307
18302
  setShowRetry(true);
18308
18303
  }
@@ -18526,7 +18521,7 @@ var SplitAndMatchForm = ({
18526
18521
  showCategorization
18527
18522
  }) => {
18528
18523
  const anyMatch = hasMatch(bankTransaction);
18529
- const [formType, setFormType] = (0, import_react82.useState)(
18524
+ const [formType, setFormType] = (0, import_react83.useState)(
18530
18525
  bankTransaction.category ? "categorize" /* categorize */ : anyMatch ? "match" /* match */ : "categorize" /* categorize */
18531
18526
  );
18532
18527
  return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "Layer__bank-transaction-mobile-list-item__split-and-match-form", children: [
@@ -18606,9 +18601,9 @@ var BankTransactionMobileForms = ({
18606
18601
  };
18607
18602
 
18608
18603
  // src/components/BankTransactionMobileList/TransactionToOpenContext.ts
18609
- var import_react83 = require("react");
18604
+ var import_react84 = require("react");
18610
18605
  var useTransactionToOpen = () => {
18611
- const [transactionIdToOpen, setTransactionIdToOpen] = (0, import_react83.useState)(void 0);
18606
+ const [transactionIdToOpen, setTransactionIdToOpen] = (0, import_react84.useState)(void 0);
18612
18607
  const clearTransactionIdToOpen = () => setTransactionIdToOpen(void 0);
18613
18608
  return {
18614
18609
  transactionIdToOpen,
@@ -18616,7 +18611,7 @@ var useTransactionToOpen = () => {
18616
18611
  clearTransactionIdToOpen
18617
18612
  };
18618
18613
  };
18619
- var TransactionToOpenContext = (0, import_react83.createContext)({
18614
+ var TransactionToOpenContext = (0, import_react84.createContext)({
18620
18615
  transactionIdToOpen: void 0,
18621
18616
  setTransactionIdToOpen: () => void 0,
18622
18617
  clearTransactionIdToOpen: () => void 0
@@ -18653,7 +18648,7 @@ var BankTransactionMobileListItem = ({
18653
18648
  transactionIdToOpen,
18654
18649
  setTransactionIdToOpen,
18655
18650
  clearTransactionIdToOpen
18656
- } = (0, import_react84.useContext)(TransactionToOpenContext);
18651
+ } = (0, import_react85.useContext)(TransactionToOpenContext);
18657
18652
  const { shouldHideAfterCategorize } = useBankTransactionsContext();
18658
18653
  const formRowRef = useElementSize(
18659
18654
  (_a2, _b, { height: height2 }) => setHeight(height2)
@@ -18661,14 +18656,14 @@ var BankTransactionMobileListItem = ({
18661
18656
  const headingRowRef = useElementSize((_a2, _b, { height: height2 }) => {
18662
18657
  setHeadingHeight(height2);
18663
18658
  });
18664
- const itemRef = (0, import_react84.useRef)(null);
18665
- const [removeAnim, setRemoveAnim] = (0, import_react84.useState)(false);
18666
- const [purpose, setPurpose] = (0, import_react84.useState)(
18659
+ const itemRef = (0, import_react85.useRef)(null);
18660
+ const [removeAnim, setRemoveAnim] = (0, import_react85.useState)(false);
18661
+ const [purpose, setPurpose] = (0, import_react85.useState)(
18667
18662
  bankTransaction.category ? bankTransaction.category.type === "ExclusionNested" ? "personal" /* personal */ : bankTransaction.categorization_status === "SPLIT" /* SPLIT */ ? "more" /* more */ : "business" /* business */ : hasMatch(bankTransaction) ? "more" /* more */ : "business" /* business */
18668
18663
  );
18669
- const [open2, setOpen] = (0, import_react84.useState)(isFirstItem);
18670
- const [height, setHeight] = (0, import_react84.useState)(0);
18671
- const [headingHeight, setHeadingHeight] = (0, import_react84.useState)(63);
18664
+ const [open2, setOpen] = (0, import_react85.useState)(isFirstItem);
18665
+ const [height, setHeight] = (0, import_react85.useState)(0);
18666
+ const [headingHeight, setHeadingHeight] = (0, import_react85.useState)(63);
18672
18667
  const openNext = () => {
18673
18668
  if (editable && itemRef.current && itemRef.current.nextSibling) {
18674
18669
  const txId = itemRef.current.nextSibling.getAttribute(
@@ -18679,13 +18674,13 @@ var BankTransactionMobileListItem = ({
18679
18674
  }
18680
18675
  }
18681
18676
  };
18682
- (0, import_react84.useEffect)(() => {
18677
+ (0, import_react85.useEffect)(() => {
18683
18678
  if (transactionIdToOpen && transactionIdToOpen === bankTransaction.id) {
18684
18679
  setOpen(true);
18685
18680
  clearTransactionIdToOpen();
18686
18681
  }
18687
18682
  }, [transactionIdToOpen]);
18688
- (0, import_react84.useEffect)(() => {
18683
+ (0, import_react85.useEffect)(() => {
18689
18684
  if (!removeAnim && bankTransaction.recently_categorized) {
18690
18685
  if (editable && shouldHideAfterCategorize()) {
18691
18686
  setRemoveAnim(true);
@@ -18709,7 +18704,7 @@ var BankTransactionMobileListItem = ({
18709
18704
  setOpen(false);
18710
18705
  setHeight(0);
18711
18706
  };
18712
- (0, import_react84.useEffect)(() => {
18707
+ (0, import_react85.useEffect)(() => {
18713
18708
  if (editable && bankTransaction.recently_categorized && shouldHideAfterCategorize()) {
18714
18709
  setTimeout(() => {
18715
18710
  removeTransaction(bankTransaction);
@@ -18856,7 +18851,7 @@ var BankTransactionMobileList = ({
18856
18851
  };
18857
18852
 
18858
18853
  // src/components/BankTransactionsTable/BankTransactionsTable.tsx
18859
- var import_react85 = require("react");
18854
+ var import_react86 = require("react");
18860
18855
 
18861
18856
  // src/components/SkeletonLoader/SkeletonLoader.tsx
18862
18857
  var import_classnames52 = __toESM(require("classnames"));
@@ -19028,7 +19023,7 @@ var BankTransactionsTable = ({
19028
19023
  return ((_a2 = transaction.document_ids) == null ? void 0 : _a2.length) > 0;
19029
19024
  }
19030
19025
  ))) != null ? _a : false;
19031
- const showReceiptDataProperties = (0, import_react85.useMemo)(
19026
+ const showReceiptDataProperties = (0, import_react86.useMemo)(
19032
19027
  () => toDataProperties({ "show-receipt-upload-column": showReceiptColumn }),
19033
19028
  [showReceiptColumn]
19034
19029
  );
@@ -19093,7 +19088,7 @@ var BankTransactionsTable = ({
19093
19088
  };
19094
19089
 
19095
19090
  // src/components/ErrorBoundary/ErrorBoundary.tsx
19096
- var import_react86 = require("react");
19091
+ var import_react87 = require("react");
19097
19092
 
19098
19093
  // src/components/ErrorBoundary/ErrorBoundaryMessage.tsx
19099
19094
  var import_jsx_runtime153 = require("react/jsx-runtime");
@@ -19110,7 +19105,7 @@ var ErrorBoundaryMessage = () => {
19110
19105
 
19111
19106
  // src/components/ErrorBoundary/ErrorBoundary.tsx
19112
19107
  var import_jsx_runtime154 = require("react/jsx-runtime");
19113
- var ErrorBoundary = class extends import_react86.Component {
19108
+ var ErrorBoundary = class extends import_react87.Component {
19114
19109
  constructor(props) {
19115
19110
  super(props);
19116
19111
  __publicField(this, "onError");
@@ -19136,7 +19131,7 @@ var ErrorBoundary = class extends import_react86.Component {
19136
19131
  };
19137
19132
 
19138
19133
  // src/hooks/usePagination/usePagination.ts
19139
- var import_react87 = require("react");
19134
+ var import_react88 = require("react");
19140
19135
 
19141
19136
  // src/utils/helpers.ts
19142
19137
  var range = (start, end) => {
@@ -19152,7 +19147,7 @@ var usePagination = ({
19152
19147
  siblingCount = 1,
19153
19148
  currentPage
19154
19149
  }) => {
19155
- const paginationRange = (0, import_react87.useMemo)(() => {
19150
+ const paginationRange = (0, import_react88.useMemo)(() => {
19156
19151
  const totalPageCount = Math.ceil(totalCount / pageSize);
19157
19152
  const totalPageNumbers = siblingCount + 5;
19158
19153
  if (totalPageNumbers >= totalPageCount) {
@@ -19288,21 +19283,21 @@ var PaginationContent = ({
19288
19283
  };
19289
19284
 
19290
19285
  // src/components/BankTransactions/BankTransactionsHeader.tsx
19291
- var import_react90 = require("react");
19286
+ var import_react91 = require("react");
19292
19287
  var import_classnames55 = __toESM(require("classnames"));
19293
19288
  var import_date_fns21 = require("date-fns");
19294
19289
 
19295
19290
  // src/hooks/useDebounce/useDebounce.ts
19296
- var import_react88 = require("react");
19291
+ var import_react89 = require("react");
19297
19292
  var import_lodash = __toESM(require_lodash());
19298
19293
  var DEFAULT_WAIT = 300;
19299
19294
  var DEFAULT_MAX_WAIT = 2 * DEFAULT_WAIT;
19300
19295
  function useDebounce(fn) {
19301
- const internalFnRef = (0, import_react88.useRef)(fn);
19302
- (0, import_react88.useEffect)(() => {
19296
+ const internalFnRef = (0, import_react89.useRef)(fn);
19297
+ (0, import_react89.useEffect)(() => {
19303
19298
  internalFnRef.current = fn;
19304
19299
  }, [fn]);
19305
- const debouncedCallback = (0, import_react88.useMemo)(() => {
19300
+ const debouncedCallback = (0, import_react89.useMemo)(() => {
19306
19301
  const internalFn = (...args) => {
19307
19302
  internalFnRef.current(...args);
19308
19303
  };
@@ -19421,7 +19416,7 @@ function useBankTransactionsDownload() {
19421
19416
  }
19422
19417
 
19423
19418
  // src/components/utility/InvisibleDownload.tsx
19424
- var import_react89 = require("react");
19419
+ var import_react90 = require("react");
19425
19420
 
19426
19421
  // src/utils/delay/runDelayed.ts
19427
19422
  var DEFAULT_DELAY_MS = 50;
@@ -19434,17 +19429,17 @@ function runDelayedSync(block, delayMs = DEFAULT_DELAY_MS) {
19434
19429
  // src/components/utility/InvisibleDownload.tsx
19435
19430
  var import_jsx_runtime159 = require("react/jsx-runtime");
19436
19431
  function useInvisibleDownload() {
19437
- const invisibleDownloadRef = (0, import_react89.useRef)(null);
19438
- const triggerInvisibleDownload = (0, import_react89.useCallback)((options) => {
19432
+ const invisibleDownloadRef = (0, import_react90.useRef)(null);
19433
+ const triggerInvisibleDownload = (0, import_react90.useCallback)((options) => {
19439
19434
  var _a;
19440
19435
  void ((_a = invisibleDownloadRef.current) == null ? void 0 : _a.trigger(options));
19441
19436
  }, []);
19442
19437
  return { invisibleDownloadRef, triggerInvisibleDownload };
19443
19438
  }
19444
19439
  var CLASS_NAME9 = "Layer__InvisibleDownload";
19445
- var InvisibleDownload = (0, import_react89.forwardRef)((_props, ref) => {
19446
- const internalRef = (0, import_react89.useRef)(null);
19447
- (0, import_react89.useImperativeHandle)(ref, () => ({
19440
+ var InvisibleDownload = (0, import_react90.forwardRef)((_props, ref) => {
19441
+ const internalRef = (0, import_react90.useRef)(null);
19442
+ (0, import_react90.useImperativeHandle)(ref, () => ({
19448
19443
  trigger: (_0) => __async(null, [_0], function* ({ url }) {
19449
19444
  var _a;
19450
19445
  (_a = internalRef.current) == null ? void 0 : _a.setAttribute("href", url);
@@ -19454,7 +19449,7 @@ var InvisibleDownload = (0, import_react89.forwardRef)((_props, ref) => {
19454
19449
  });
19455
19450
  })
19456
19451
  }));
19457
- const handleContainClick = (0, import_react89.useCallback)((event) => {
19452
+ const handleContainClick = (0, import_react90.useCallback)((event) => {
19458
19453
  event.stopPropagation();
19459
19454
  }, []);
19460
19455
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("a", { download: true, className: CLASS_NAME9, ref: internalRef, onClick: handleContainClick });
@@ -19466,14 +19461,14 @@ var InvisibleDownload_default = InvisibleDownload;
19466
19461
  var import_jsx_runtime160 = require("react/jsx-runtime");
19467
19462
  function TransactionsSearch({ slot }) {
19468
19463
  const { filters, setFilters } = useBankTransactionsContext();
19469
- const [localSearch, setLocalSearch] = (0, import_react90.useState)(() => {
19464
+ const [localSearch, setLocalSearch] = (0, import_react91.useState)(() => {
19470
19465
  var _a;
19471
19466
  return (_a = filters == null ? void 0 : filters.descriptionFilter) != null ? _a : "";
19472
19467
  });
19473
19468
  const debouncedSetDescription = useDebounce((value) => {
19474
19469
  setFilters({ descriptionFilter: value });
19475
19470
  });
19476
- const handleSearch = (0, import_react90.useCallback)((value) => {
19471
+ const handleSearch = (0, import_react91.useCallback)((value) => {
19477
19472
  setLocalSearch(value);
19478
19473
  void debouncedSetDescription(value);
19479
19474
  }, [debouncedSetDescription]);
@@ -19605,7 +19600,7 @@ var BankTransactionsHeader = ({
19605
19600
  };
19606
19601
 
19607
19602
  // src/components/BankTransactions/BankTransactionsTableEmptyState.tsx
19608
- var import_react91 = require("react");
19603
+ var import_react92 = require("react");
19609
19604
 
19610
19605
  // src/icons/Inbox.tsx
19611
19606
  var import_jsx_runtime161 = require("react/jsx-runtime");
@@ -19655,7 +19650,7 @@ function BankTransactionsTableEmptyStates({
19655
19650
  isFiltered,
19656
19651
  isLoadingWithoutData
19657
19652
  }) {
19658
- const StateComponent = (0, import_react91.useMemo)(() => {
19653
+ const StateComponent = (0, import_react92.useMemo)(() => {
19659
19654
  if (isError) {
19660
19655
  return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
19661
19656
  DataState,
@@ -19728,13 +19723,13 @@ var BankTransactionsContent = ({
19728
19723
  stringOverrides
19729
19724
  }) => {
19730
19725
  var _a;
19731
- const [defaultDateRange] = (0, import_react92.useState)(() => ({
19726
+ const [defaultDateRange] = (0, import_react93.useState)(() => ({
19732
19727
  startDate: (0, import_date_fns22.startOfMonth)(/* @__PURE__ */ new Date()),
19733
19728
  endDate: (0, import_date_fns22.endOfMonth)(/* @__PURE__ */ new Date())
19734
19729
  }));
19735
- const scrollPaginationRef = (0, import_react92.useRef)(null);
19730
+ const scrollPaginationRef = (0, import_react93.useRef)(null);
19736
19731
  const isVisible = useIsVisible(scrollPaginationRef);
19737
- const [currentPage, setCurrentPage] = (0, import_react92.useState)(1);
19732
+ const [currentPage, setCurrentPage] = (0, import_react93.useState)(1);
19738
19733
  const effectiveBookkeepingStatus = useEffectiveBookkeepingStatus();
19739
19734
  const categorizationEnabled = isCategorizationEnabledForStatus(effectiveBookkeepingStatus);
19740
19735
  const categorizeView = categorizeViewProp != null ? categorizeViewProp : categorizationEnabled;
@@ -19751,21 +19746,21 @@ var BankTransactionsContent = ({
19751
19746
  removeAfterCategorize
19752
19747
  } = useBankTransactionsContext();
19753
19748
  const { data: linkedAccounts } = useLinkedAccounts();
19754
- const isSyncing = (0, import_react92.useMemo)(
19749
+ const isSyncing = (0, import_react93.useMemo)(
19755
19750
  () => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
19756
19751
  [linkedAccounts]
19757
19752
  );
19758
- (0, import_react92.useEffect)(() => {
19753
+ (0, import_react93.useEffect)(() => {
19759
19754
  if (!monthlyView && (filters == null ? void 0 : filters.dateRange)) {
19760
19755
  setFilters(__spreadProps(__spreadValues({}, filters), { dateRange: void 0 }));
19761
19756
  }
19762
19757
  }, [monthlyView]);
19763
- (0, import_react92.useEffect)(() => {
19758
+ (0, import_react93.useEffect)(() => {
19764
19759
  if (monthlyView && isVisible && !isLoading && hasMore) {
19765
19760
  fetchMore();
19766
19761
  }
19767
19762
  }, [monthlyView, isVisible, isLoading, hasMore]);
19768
- (0, import_react92.useEffect)(() => {
19763
+ (0, import_react93.useEffect)(() => {
19769
19764
  if (JSON.stringify(inputFilters) !== JSON.stringify(filters)) {
19770
19765
  if (effectiveBookkeepingStatus === "ACTIVE" /* ACTIVE */) {
19771
19766
  setFilters(__spreadProps(__spreadValues(__spreadValues({}, filters), inputFilters), {
@@ -19792,10 +19787,10 @@ var BankTransactionsContent = ({
19792
19787
  });
19793
19788
  }
19794
19789
  }, [inputFilters, categorizeView, categorizationEnabled]);
19795
- (0, import_react92.useEffect)(() => {
19790
+ (0, import_react93.useEffect)(() => {
19796
19791
  setCurrentPage(1);
19797
19792
  }, [filters]);
19798
- const bankTransactions = (0, import_react92.useMemo)(() => {
19793
+ const bankTransactions = (0, import_react93.useMemo)(() => {
19799
19794
  if (monthlyView) {
19800
19795
  return data;
19801
19796
  }
@@ -19809,10 +19804,10 @@ var BankTransactionsContent = ({
19809
19804
  });
19810
19805
  setCurrentPage(1);
19811
19806
  };
19812
- const [shiftStickyHeader, setShiftStickyHeader] = (0, import_react92.useState)(0);
19807
+ const [shiftStickyHeader, setShiftStickyHeader] = (0, import_react93.useState)(0);
19813
19808
  const debounceShiftStickyHeader = (0, import_lodash2.debounce)(setShiftStickyHeader, 500);
19814
- const [listView, setListView] = (0, import_react92.useState)(false);
19815
- const [containerWidth, setContainerWidth] = (0, import_react92.useState)(0);
19809
+ const [listView, setListView] = (0, import_react93.useState)(false);
19810
+ const [containerWidth, setContainerWidth] = (0, import_react93.useState)(0);
19816
19811
  const debounceContainerWidth = (0, import_lodash2.debounce)(setContainerWidth, 500);
19817
19812
  const removeTransaction = (bankTransaction) => removeAfterCategorize(bankTransaction);
19818
19813
  const containerRef = useElementSize((_el, _en, size) => {
@@ -19938,13 +19933,13 @@ var BankTransactionsContent = ({
19938
19933
  };
19939
19934
 
19940
19935
  // src/components/Integrations/Integrations.tsx
19941
- var import_react101 = require("react");
19936
+ var import_react102 = require("react");
19942
19937
 
19943
19938
  // src/components/Integrations/IntegrationsContent.tsx
19944
- var import_react97 = require("react");
19939
+ var import_react98 = require("react");
19945
19940
 
19946
19941
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
19947
- var import_react96 = require("react");
19942
+ var import_react97 = require("react");
19948
19943
 
19949
19944
  // src/icons/QuickbooksIcon.tsx
19950
19945
  var import_jsx_runtime164 = require("react/jsx-runtime");
@@ -20030,8 +20025,8 @@ var Card = ({ children, className }) => {
20030
20025
  };
20031
20026
 
20032
20027
  // src/contexts/QuickbooksContext/QuickbooksContext.tsx
20033
- var import_react93 = require("react");
20034
- var QuickbooksContext = (0, import_react93.createContext)({
20028
+ var import_react94 = require("react");
20029
+ var QuickbooksContext = (0, import_react94.createContext)({
20035
20030
  linkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
20036
20031
  unlinkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
20037
20032
  syncFromQuickbooks: () => {
@@ -20041,7 +20036,7 @@ var QuickbooksContext = (0, import_react93.createContext)({
20041
20036
  });
20042
20037
 
20043
20038
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
20044
- var import_react94 = require("react");
20039
+ var import_react95 = require("react");
20045
20040
  var import_date_fns23 = require("date-fns");
20046
20041
 
20047
20042
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/utils.ts
@@ -20099,7 +20094,7 @@ var getFooterConfig = (quickbooksUiState, lastSyncedAt) => {
20099
20094
  }
20100
20095
  };
20101
20096
  var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
20102
- const { quickbooksConnectionStatus } = (0, import_react94.useContext)(QuickbooksContext);
20097
+ const { quickbooksConnectionStatus } = (0, import_react95.useContext)(QuickbooksContext);
20103
20098
  if (!quickbooksConnectionStatus) return null;
20104
20099
  const { title, description, badgeVariant } = getFooterConfig(quickbooksUiState, quickbooksConnectionStatus.last_synced_at);
20105
20100
  return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(HStack, { className: "loadingbar", children: [
@@ -20116,14 +20111,14 @@ var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
20116
20111
  var import_lucide_react11 = require("lucide-react");
20117
20112
 
20118
20113
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksUnlinkConfirmationModal.tsx
20119
- var import_react95 = require("react");
20114
+ var import_react96 = require("react");
20120
20115
  var import_jsx_runtime169 = require("react/jsx-runtime");
20121
20116
  function IntegrationsQuickbooksUnlinkConfirmationModalContent({ onClose }) {
20122
- const { unlinkQuickbooks } = (0, import_react95.useContext)(QuickbooksContext);
20123
- const [isProcessing, setIsProcessing] = (0, import_react95.useState)(false);
20124
- const [hasFailed, setHasFailed] = (0, import_react95.useState)(false);
20117
+ const { unlinkQuickbooks } = (0, import_react96.useContext)(QuickbooksContext);
20118
+ const [isProcessing, setIsProcessing] = (0, import_react96.useState)(false);
20119
+ const [hasFailed, setHasFailed] = (0, import_react96.useState)(false);
20125
20120
  const unlinkErrorText = "Unlink failed. Check connection and retry in few seconds.";
20126
- const onClickUnlinkQuickbooks = (0, import_react95.useCallback)(() => {
20121
+ const onClickUnlinkQuickbooks = (0, import_react96.useCallback)(() => {
20127
20122
  setIsProcessing(true);
20128
20123
  unlinkQuickbooks().then(() => {
20129
20124
  onClose();
@@ -20202,14 +20197,14 @@ var getBadgeConfig = (quickbooksUiState, hasSynced) => {
20202
20197
  }
20203
20198
  };
20204
20199
  var IntegrationsQuickbooksItemThumb = () => {
20205
- const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = (0, import_react96.useContext)(QuickbooksContext);
20206
- const [hasSynced, setHasSynced] = (0, import_react96.useState)(false);
20207
- const [isConfirmationModalOpen, setIsConfirmationModalOpen] = (0, import_react96.useState)(false);
20208
- const onSync = (0, import_react96.useCallback)(() => {
20200
+ const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = (0, import_react97.useContext)(QuickbooksContext);
20201
+ const [hasSynced, setHasSynced] = (0, import_react97.useState)(false);
20202
+ const [isConfirmationModalOpen, setIsConfirmationModalOpen] = (0, import_react97.useState)(false);
20203
+ const onSync = (0, import_react97.useCallback)(() => {
20209
20204
  setHasSynced(true);
20210
20205
  syncFromQuickbooks2();
20211
20206
  }, [syncFromQuickbooks2]);
20212
- const menuConfig = (0, import_react96.useMemo)(() => {
20207
+ const menuConfig = (0, import_react97.useMemo)(() => {
20213
20208
  return [
20214
20209
  {
20215
20210
  name: "Unlink account",
@@ -20251,28 +20246,28 @@ var IntegrationsQuickbooksItemThumb = () => {
20251
20246
  // src/components/Integrations/IntegrationsContent.tsx
20252
20247
  var import_jsx_runtime171 = require("react/jsx-runtime");
20253
20248
  var IntegrationsContent = () => {
20254
- const { quickbooksConnectionStatus } = (0, import_react97.useContext)(QuickbooksContext);
20249
+ const { quickbooksConnectionStatus } = (0, import_react98.useContext)(QuickbooksContext);
20255
20250
  return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "Layer__linked-accounts__list", children: (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(IntegrationsQuickbooksItemThumb, {}) });
20256
20251
  };
20257
20252
 
20258
20253
  // src/hooks/useQuickbooks/useQuickbooks.ts
20259
- var import_react98 = require("react");
20254
+ var import_react99 = require("react");
20260
20255
  var import_date_fns24 = require("date-fns");
20261
20256
  var useQuickbooks = () => {
20262
20257
  var _a;
20263
20258
  const { businessId } = useLayerContext();
20264
20259
  const { apiUrl } = useEnvironment();
20265
20260
  const { data: auth } = useAuth();
20266
- const [quickbooksConnectionStatus, setQuickbooksConnectionStatus] = (0, import_react98.useState)(void 0);
20261
+ const [quickbooksConnectionStatus, setQuickbooksConnectionStatus] = (0, import_react99.useState)(void 0);
20267
20262
  const isSyncingFromQuickbooks = (_a = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_syncing) != null ? _a : false;
20268
- const syncStatusIntervalRef = (0, import_react98.useRef)(null);
20269
- const fetchQuickbooksConnectionStatus = (0, import_react98.useCallback)(() => __async(null, null, function* () {
20263
+ const syncStatusIntervalRef = (0, import_react99.useRef)(null);
20264
+ const fetchQuickbooksConnectionStatus = (0, import_react99.useCallback)(() => __async(null, null, function* () {
20270
20265
  const newQuickbooksConnectionStatus = (yield Layer.statusOfQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
20271
20266
  params: { businessId }
20272
20267
  })()).data;
20273
20268
  setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
20274
20269
  }), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, setQuickbooksConnectionStatus]);
20275
- (0, import_react98.useEffect)(() => {
20270
+ (0, import_react99.useEffect)(() => {
20276
20271
  if (isSyncingFromQuickbooks && syncStatusIntervalRef.current === null) {
20277
20272
  const interval = window.setInterval(() => void fetchQuickbooksConnectionStatus(), 2e3);
20278
20273
  syncStatusIntervalRef.current = interval;
@@ -20282,12 +20277,12 @@ var useQuickbooks = () => {
20282
20277
  syncStatusIntervalRef.current = null;
20283
20278
  }
20284
20279
  }, [fetchQuickbooksConnectionStatus, isSyncingFromQuickbooks]);
20285
- (0, import_react98.useEffect)(() => {
20280
+ (0, import_react99.useEffect)(() => {
20286
20281
  if (auth == null ? void 0 : auth.access_token) {
20287
20282
  void fetchQuickbooksConnectionStatus();
20288
20283
  }
20289
20284
  }, [auth == null ? void 0 : auth.access_token, fetchQuickbooksConnectionStatus]);
20290
- const handleSyncError = (0, import_react98.useCallback)(() => {
20285
+ const handleSyncError = (0, import_react99.useCallback)(() => {
20291
20286
  setQuickbooksConnectionStatus({
20292
20287
  is_connected: true,
20293
20288
  is_syncing: false,
@@ -20295,19 +20290,19 @@ var useQuickbooks = () => {
20295
20290
  last_synced_at: (0, import_date_fns24.format)(/* @__PURE__ */ new Date(), "yyyy-MM-dd'T'HH:mm:ss")
20296
20291
  });
20297
20292
  }, []);
20298
- const syncFromQuickbooks2 = (0, import_react98.useCallback)(() => {
20293
+ const syncFromQuickbooks2 = (0, import_react99.useCallback)(() => {
20299
20294
  const newQuickbooksConnectionStatus = quickbooksConnectionStatus ? __spreadProps(__spreadValues({}, quickbooksConnectionStatus), { is_syncing: true }) : void 0;
20300
20295
  setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
20301
20296
  void Layer.syncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
20302
20297
  params: { businessId }
20303
20298
  }).catch(handleSyncError);
20304
20299
  }, [apiUrl, auth == null ? void 0 : auth.access_token, businessId, quickbooksConnectionStatus, handleSyncError]);
20305
- const linkQuickbooks = (0, import_react98.useCallback)(() => __async(null, null, function* () {
20300
+ const linkQuickbooks = (0, import_react99.useCallback)(() => __async(null, null, function* () {
20306
20301
  return Layer.initQuickbooksOAuth(apiUrl, auth == null ? void 0 : auth.access_token, {
20307
20302
  params: { businessId }
20308
20303
  }).then((res) => res.data.redirect_url);
20309
20304
  }), [apiUrl, auth == null ? void 0 : auth.access_token, businessId]);
20310
- const unlinkQuickbooks = (0, import_react98.useCallback)(() => __async(null, null, function* () {
20305
+ const unlinkQuickbooks = (0, import_react99.useCallback)(() => __async(null, null, function* () {
20311
20306
  return Layer.unlinkQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
20312
20307
  params: { businessId }
20313
20308
  }).then(() => fetchQuickbooksConnectionStatus());
@@ -20328,7 +20323,7 @@ function QuickbooksContextProvider({ children }) {
20328
20323
  }
20329
20324
 
20330
20325
  // src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
20331
- var import_react100 = require("react");
20326
+ var import_react101 = require("react");
20332
20327
 
20333
20328
  // src/components/ui/DropdownMenu/DropdownMenu.tsx
20334
20329
  var import_react_aria_components11 = require("react-aria-components");
@@ -20347,11 +20342,11 @@ var DropdownMenu = ({ children, ariaLabel, slots, slotProps }) => {
20347
20342
  };
20348
20343
 
20349
20344
  // src/icons/Cog.tsx
20350
- var import_react99 = require("react");
20345
+ var import_react100 = require("react");
20351
20346
  var import_jsx_runtime174 = require("react/jsx-runtime");
20352
20347
  var Cog = (_a) => {
20353
20348
  var _b = _a, { size = 12 } = _b, props = __objRest(_b, ["size"]);
20354
- const id = (0, import_react99.useId)();
20349
+ const id = (0, import_react100.useId)();
20355
20350
  return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
20356
20351
  "svg",
20357
20352
  __spreadProps(__spreadValues({
@@ -20381,10 +20376,10 @@ var MenuTriggerButton = () => /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(Bu
20381
20376
  ] });
20382
20377
  var IntegrationsConnectMenu = () => {
20383
20378
  const { addToast } = useLayerContext();
20384
- const { quickbooksConnectionStatus, linkQuickbooks } = (0, import_react100.useContext)(QuickbooksContext);
20379
+ const { quickbooksConnectionStatus, linkQuickbooks } = (0, import_react101.useContext)(QuickbooksContext);
20385
20380
  const quickbooksIsConnected = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected;
20386
- const [isLinkQuickbooksError, setIsLinkQuickbooksError] = (0, import_react100.useState)(false);
20387
- const initiateQuickbooksOAuth = (0, import_react100.useCallback)(() => {
20381
+ const [isLinkQuickbooksError, setIsLinkQuickbooksError] = (0, import_react101.useState)(false);
20382
+ const initiateQuickbooksOAuth = (0, import_react101.useCallback)(() => {
20388
20383
  linkQuickbooks().then((res) => {
20389
20384
  window.location.href = res;
20390
20385
  }).catch(() => {
@@ -20426,7 +20421,7 @@ var IntegrationsComponent = ({
20426
20421
  elevated,
20427
20422
  stringOverrides
20428
20423
  }) => {
20429
- const { quickbooksConnectionStatus } = (0, import_react101.useContext)(QuickbooksContext);
20424
+ const { quickbooksConnectionStatus } = (0, import_react102.useContext)(QuickbooksContext);
20430
20425
  const isLoading = quickbooksConnectionStatus === void 0;
20431
20426
  return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(Container, { name: COMPONENT_NAME3, elevated, children: [
20432
20427
  /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(Header, { className: "Layer__linked-accounts__header", children: [
@@ -20453,11 +20448,11 @@ var IntegrationsComponent = ({
20453
20448
  };
20454
20449
 
20455
20450
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
20456
- var import_react129 = require("react");
20451
+ var import_react130 = require("react");
20457
20452
 
20458
20453
  // src/contexts/ProfitAndLossComparisonContext/ProfitAndLossComparisonContext.tsx
20459
- var import_react102 = require("react");
20460
- var PNLComparisonContext = (0, import_react102.createContext)({
20454
+ var import_react103 = require("react");
20455
+ var PNLComparisonContext = (0, import_react103.createContext)({
20461
20456
  data: void 0,
20462
20457
  isLoading: true,
20463
20458
  isValidating: false,
@@ -20478,7 +20473,7 @@ var PNLComparisonContext = (0, import_react102.createContext)({
20478
20473
  });
20479
20474
 
20480
20475
  // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
20481
- var import_react105 = require("react");
20476
+ var import_react106 = require("react");
20482
20477
 
20483
20478
  // src/utils/profitAndLossUtils.ts
20484
20479
  var doesLineItemQualifies = (item) => {
@@ -20534,7 +20529,7 @@ var applyShare = (items, total) => {
20534
20529
  };
20535
20530
 
20536
20531
  // src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
20537
- var import_react103 = require("react");
20532
+ var import_react104 = require("react");
20538
20533
  var import_date_fns25 = require("date-fns");
20539
20534
  var import_swr15 = __toESM(require("swr"));
20540
20535
  var buildDates = ({ currentDate }) => {
@@ -20562,10 +20557,10 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
20562
20557
  const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
20563
20558
  const { apiUrl } = useEnvironment();
20564
20559
  const { data: auth } = useAuth();
20565
- const [date, setDate] = (0, import_react103.useState)(currentDate);
20566
- const [loaded, setLoaded] = (0, import_react103.useState)("initial");
20567
- const [data, setData] = (0, import_react103.useState)([]);
20568
- const { startYear, startMonth, endYear, endMonth } = (0, import_react103.useMemo)(() => {
20560
+ const [date, setDate] = (0, import_react104.useState)(currentDate);
20561
+ const [loaded, setLoaded] = (0, import_react104.useState)("initial");
20562
+ const [data, setData] = (0, import_react104.useState)([]);
20563
+ const { startYear, startMonth, endYear, endMonth } = (0, import_react104.useMemo)(() => {
20569
20564
  return buildDates({ currentDate: date });
20570
20565
  }, [date, businessId, tagFilter, reportingBasis]);
20571
20566
  const queryKey = businessId && Boolean(startYear) && Boolean(startMonth) && Boolean(endYear) && Boolean(endMonth) && (auth == null ? void 0 : auth.access_token) && `profit-and-loss-summaries-${businessId}-${startYear.toString()}-${startMonth.toString()}-${tagFilter == null ? void 0 : tagFilter.key}-${(_a = tagFilter == null ? void 0 : tagFilter.values) == null ? void 0 : _a.join(
@@ -20592,7 +20587,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
20592
20587
  }
20593
20588
  })
20594
20589
  );
20595
- (0, import_react103.useEffect)(() => {
20590
+ (0, import_react104.useEffect)(() => {
20596
20591
  const newData = data.slice();
20597
20592
  const newPeriod = buildMonthsArray((0, import_date_fns25.sub)(date, { years: 1 }), date);
20598
20593
  if (newData && newPeriod) {
@@ -20628,7 +20623,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
20628
20623
  );
20629
20624
  }
20630
20625
  }, [startYear, startMonth, tagFilter]);
20631
- (0, import_react103.useEffect)(() => {
20626
+ (0, import_react104.useEffect)(() => {
20632
20627
  var _a2, _b2;
20633
20628
  const newData = (_b2 = (_a2 = rawData == null ? void 0 : rawData.data) == null ? void 0 : _a2.months) == null ? void 0 : _b2.slice();
20634
20629
  if (data && newData) {
@@ -20646,7 +20641,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
20646
20641
  );
20647
20642
  }
20648
20643
  }, [rawData]);
20649
- (0, import_react103.useEffect)(() => {
20644
+ (0, import_react104.useEffect)(() => {
20650
20645
  if (isLoading && loaded === "initial") {
20651
20646
  setLoaded("loading");
20652
20647
  return;
@@ -20656,12 +20651,12 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
20656
20651
  }
20657
20652
  }, [data, isLoading]);
20658
20653
  const pullData = (date2) => setDate(date2);
20659
- (0, import_react103.useEffect)(() => {
20654
+ (0, import_react104.useEffect)(() => {
20660
20655
  if (queryKey && (isLoading || isValidating)) {
20661
20656
  read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
20662
20657
  }
20663
20658
  }, [isLoading, isValidating]);
20664
- (0, import_react103.useEffect)(() => {
20659
+ (0, import_react104.useEffect)(() => {
20665
20660
  if (queryKey && hasBeenTouched(queryKey)) {
20666
20661
  mutate();
20667
20662
  }
@@ -20688,7 +20683,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
20688
20683
  };
20689
20684
 
20690
20685
  // src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
20691
- var import_react104 = require("react");
20686
+ var import_react105 = require("react");
20692
20687
  var import_date_fns26 = require("date-fns");
20693
20688
  var import_swr16 = __toESM(require("swr"));
20694
20689
  var useProfitAndLossQuery = ({
@@ -20727,12 +20722,12 @@ var useProfitAndLossQuery = ({
20727
20722
  const refetch = () => {
20728
20723
  mutate();
20729
20724
  };
20730
- (0, import_react104.useEffect)(() => {
20725
+ (0, import_react105.useEffect)(() => {
20731
20726
  if (queryKey && (isLoading || isValidating)) {
20732
20727
  read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
20733
20728
  }
20734
20729
  }, [isLoading, isValidating]);
20735
- (0, import_react104.useEffect)(() => {
20730
+ (0, import_react105.useEffect)(() => {
20736
20731
  if (queryKey && hasBeenTouched(queryKey)) {
20737
20732
  refetch();
20738
20733
  }
@@ -20755,16 +20750,16 @@ var useProfitAndLoss = ({
20755
20750
  }) => {
20756
20751
  const { start, end } = useGlobalDateRange();
20757
20752
  const { setRange } = useGlobalDateRangeActions();
20758
- const dateRange = (0, import_react105.useMemo)(() => ({ startDate: start, endDate: end }), [start, end]);
20759
- const changeDateRange = (0, import_react105.useCallback)(
20753
+ const dateRange = (0, import_react106.useMemo)(() => ({ startDate: start, endDate: end }), [start, end]);
20754
+ const changeDateRange = (0, import_react106.useCallback)(
20760
20755
  ({ startDate: start2, endDate: end2 }) => setRange({ start: start2, end: end2 }),
20761
20756
  [setRange]
20762
20757
  );
20763
- const [filters, setFilters] = (0, import_react105.useState)({
20758
+ const [filters, setFilters] = (0, import_react106.useState)({
20764
20759
  expenses: void 0,
20765
20760
  revenue: void 0
20766
20761
  });
20767
- const [sidebarScope, setSidebarScope] = (0, import_react105.useState)(void 0);
20762
+ const [sidebarScope, setSidebarScope] = (0, import_react106.useState)(void 0);
20768
20763
  const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
20769
20764
  startDate: start,
20770
20765
  endDate: end,
@@ -20791,7 +20786,7 @@ var useProfitAndLoss = ({
20791
20786
  })
20792
20787
  }));
20793
20788
  };
20794
- const { filteredDataRevenue, filteredTotalRevenue } = (0, import_react105.useMemo)(() => {
20789
+ const { filteredDataRevenue, filteredTotalRevenue } = (0, import_react106.useMemo)(() => {
20795
20790
  var _a;
20796
20791
  if (!data) {
20797
20792
  return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
@@ -20843,7 +20838,7 @@ var useProfitAndLoss = ({
20843
20838
  const withShare = applyShare(sorted, total);
20844
20839
  return { filteredDataRevenue: withShare, filteredTotalRevenue: total };
20845
20840
  }, [data, start, filters, summaryData]);
20846
- const { filteredDataExpenses, filteredTotalExpenses } = (0, import_react105.useMemo)(() => {
20841
+ const { filteredDataExpenses, filteredTotalExpenses } = (0, import_react106.useMemo)(() => {
20847
20842
  var _a;
20848
20843
  if (!data) {
20849
20844
  return { filteredDataExpenses: [], filteredTotalExpenses: void 0 };
@@ -20917,7 +20912,7 @@ var useProfitAndLoss = ({
20917
20912
  };
20918
20913
 
20919
20914
  // src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
20920
- var import_react106 = require("react");
20915
+ var import_react107 = require("react");
20921
20916
 
20922
20917
  // src/hooks/useProfitAndLossComparison/utils.ts
20923
20918
  var import_date_fns27 = require("date-fns");
@@ -21071,15 +21066,15 @@ function useProfitAndLossComparison({
21071
21066
  comparisonConfig
21072
21067
  }) {
21073
21068
  var _a, _b;
21074
- const [comparePeriods, setComparePeriods] = (0, import_react106.useState)((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
21075
- const [selectedCompareOptions, setSelectedCompareOptionsState] = (0, import_react106.useState)(
21069
+ const [comparePeriods, setComparePeriods] = (0, import_react107.useState)((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
21070
+ const [selectedCompareOptions, setSelectedCompareOptionsState] = (0, import_react107.useState)(
21076
21071
  (comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
21077
21072
  );
21078
21073
  const { rangeDisplayMode, start, end } = useGlobalDateRange();
21079
21074
  const dateRange = { startDate: start, endDate: end };
21080
21075
  const isPeriodsSelectEnabled = COMPARE_MODES_SUPPORTING_MULTI_PERIOD.includes(rangeDisplayMode);
21081
21076
  const effectiveComparePeriods = isPeriodsSelectEnabled ? comparePeriods : 1;
21082
- const compareModeActive = (0, import_react106.useMemo)(() => effectiveComparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [effectiveComparePeriods, selectedCompareOptions]);
21077
+ const compareModeActive = (0, import_react107.useMemo)(() => effectiveComparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [effectiveComparePeriods, selectedCompareOptions]);
21083
21078
  const setSelectedCompareOptions = (values) => {
21084
21079
  const options = values.map(
21085
21080
  (option) => comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions.find(
@@ -21152,7 +21147,7 @@ function useProfitAndLossComparison({
21152
21147
  }
21153
21148
 
21154
21149
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
21155
- var import_react107 = require("react");
21150
+ var import_react108 = require("react");
21156
21151
 
21157
21152
  // src/icons/BarChart2.tsx
21158
21153
  var import_jsx_runtime177 = require("react/jsx-runtime");
@@ -21335,32 +21330,32 @@ var ProfitAndLossChart = ({
21335
21330
  tagFilter = void 0
21336
21331
  }) => {
21337
21332
  var _c, _d, _e, _f, _g, _h;
21338
- const [compactView, setCompactView] = (0, import_react107.useState)(false);
21333
+ const [compactView, setCompactView] = (0, import_react108.useState)(false);
21339
21334
  const barSize = compactView ? 10 : 20;
21340
21335
  const { getColor, business } = useLayerContext();
21341
21336
  const { start, end, rangeDisplayMode } = useGlobalDateRange();
21342
21337
  const { setMonth } = useGlobalDateRangeActions();
21343
21338
  const showIndicator = rangeDisplayMode === "monthPicker";
21344
- const dateRange = (0, import_react107.useMemo)(() => ({ startDate: start, endDate: end }), [start, end]);
21345
- const [localDateRange, setLocalDateRange] = (0, import_react107.useState)(dateRange);
21346
- const [customCursorSize, setCustomCursorSize] = (0, import_react107.useState)({
21339
+ const dateRange = (0, import_react108.useMemo)(() => ({ startDate: start, endDate: end }), [start, end]);
21340
+ const [localDateRange, setLocalDateRange] = (0, import_react108.useState)(dateRange);
21341
+ const [customCursorSize, setCustomCursorSize] = (0, import_react108.useState)({
21347
21342
  width: 0,
21348
21343
  height: 0,
21349
21344
  x: 0
21350
21345
  });
21351
- const [barAnimActive, setBarAnimActive] = (0, import_react107.useState)(true);
21352
- const [chartWindow, setChartWindow] = (0, import_react107.useState)({
21346
+ const [barAnimActive, setBarAnimActive] = (0, import_react108.useState)(true);
21347
+ const [chartWindow, setChartWindow] = (0, import_react108.useState)({
21353
21348
  start: (0, import_date_fns28.startOfMonth)((0, import_date_fns28.sub)(Date.now(), { months: 11 })),
21354
21349
  end: (0, import_date_fns28.endOfMonth)(Date.now())
21355
21350
  });
21356
- const selectionMonth = (0, import_react107.useMemo)(
21351
+ const selectionMonth = (0, import_react108.useMemo)(
21357
21352
  () => ({
21358
21353
  year: localDateRange.startDate.getFullYear(),
21359
21354
  month: localDateRange.startDate.getMonth()
21360
21355
  }),
21361
21356
  [localDateRange]
21362
21357
  );
21363
- (0, import_react107.useEffect)(() => {
21358
+ (0, import_react108.useEffect)(() => {
21364
21359
  if (Number(dateRange.startDate) !== Number(localDateRange.startDate) || Number(dateRange.endDate) !== Number(localDateRange.endDate)) {
21365
21360
  setLocalDateRange(dateRange);
21366
21361
  }
@@ -21369,7 +21364,7 @@ var ProfitAndLossChart = ({
21369
21364
  currentDate: (0, import_date_fns28.startOfMonth)(Date.now()),
21370
21365
  tagFilter
21371
21366
  });
21372
- const anyData = (0, import_react107.useMemo)(() => {
21367
+ const anyData = (0, import_react108.useMemo)(() => {
21373
21368
  return Boolean(
21374
21369
  data == null ? void 0 : data.find(
21375
21370
  (x) => x.income !== 0 || x.costOfGoodsSold !== 0 || x.grossProfit !== 0 || x.operatingExpenses !== 0 || x.profitBeforeTaxes !== 0 || x.taxes !== 0 || x.totalExpenses !== 0 || x.uncategorizedInflows !== 0 || x.uncategorizedOutflows !== 0
@@ -21377,12 +21372,12 @@ var ProfitAndLossChart = ({
21377
21372
  );
21378
21373
  }, [data]);
21379
21374
  const { data: linkedAccounts } = useLinkedAccounts();
21380
- const isSyncing = (0, import_react107.useMemo)(
21375
+ const isSyncing = (0, import_react108.useMemo)(
21381
21376
  () => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
21382
21377
  [linkedAccounts]
21383
21378
  );
21384
- const loadingValue = (0, import_react107.useMemo)(() => getLoadingValue(data), [data]);
21385
- (0, import_react107.useEffect)(() => {
21379
+ const loadingValue = (0, import_react108.useMemo)(() => getLoadingValue(data), [data]);
21380
+ (0, import_react108.useEffect)(() => {
21386
21381
  if (loaded === "complete" && data) {
21387
21382
  const foundCurrent = data.find(
21388
21383
  (x) => Number((0, import_date_fns28.startOfMonth)(new Date(x.year, x.month - 1, 1))) >= Number(localDateRange.startDate) && Number((0, import_date_fns28.startOfMonth)(new Date(x.year, x.month - 1, 1))) < Number(localDateRange.endDate)
@@ -21403,7 +21398,7 @@ var ProfitAndLossChart = ({
21403
21398
  }
21404
21399
  }
21405
21400
  }, [localDateRange]);
21406
- (0, import_react107.useEffect)(() => {
21401
+ (0, import_react108.useEffect)(() => {
21407
21402
  const newChartWindow = getChartWindow({
21408
21403
  chartWindow,
21409
21404
  currentYear: localDateRange.startDate.getFullYear(),
@@ -21413,7 +21408,7 @@ var ProfitAndLossChart = ({
21413
21408
  setChartWindow(newChartWindow);
21414
21409
  }
21415
21410
  }, [localDateRange]);
21416
- (0, import_react107.useEffect)(() => {
21411
+ (0, import_react108.useEffect)(() => {
21417
21412
  if (loaded === "complete") {
21418
21413
  setTimeout(() => {
21419
21414
  setBarAnimActive(false);
@@ -21440,7 +21435,7 @@ var ProfitAndLossChart = ({
21440
21435
  loading: (pnl == null ? void 0 : pnl.isLoading) ? loadingValue : 0,
21441
21436
  loadingExpenses: (pnl == null ? void 0 : pnl.isLoading) ? -loadingValue : 0
21442
21437
  });
21443
- const theData = (0, import_react107.useMemo)(() => {
21438
+ const theData = (0, import_react108.useMemo)(() => {
21444
21439
  var _a;
21445
21440
  if (loaded !== "complete" || loaded === "complete" && !anyData) {
21446
21441
  const loadingData = [];
@@ -21971,7 +21966,7 @@ var ProfitAndLossChart = ({
21971
21966
  };
21972
21967
 
21973
21968
  // src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
21974
- var import_react108 = require("react");
21969
+ var import_react109 = require("react");
21975
21970
  var import_jsx_runtime181 = require("react/jsx-runtime");
21976
21971
  var selectStyles = {
21977
21972
  valueContainer: (styles) => {
@@ -22011,9 +22006,9 @@ var ProfitAndLossCompareOptions = () => {
22011
22006
  compareOptions,
22012
22007
  selectedCompareOptions,
22013
22008
  comparisonConfig
22014
- } = (0, import_react108.useContext)(ProfitAndLoss.ComparisonContext);
22009
+ } = (0, import_react109.useContext)(ProfitAndLoss.ComparisonContext);
22015
22010
  const { rangeDisplayMode } = useGlobalDateRange();
22016
- const periods = (0, import_react108.useMemo)(
22011
+ const periods = (0, import_react109.useMemo)(
22017
22012
  () => comparePeriods !== 0 ? comparePeriods : 1,
22018
22013
  [comparePeriods]
22019
22014
  );
@@ -22106,7 +22101,7 @@ function DatePickerModeSelector({
22106
22101
  }
22107
22102
 
22108
22103
  // src/providers/GlobalDateStore/useGlobalDateRangePicker.ts
22109
- var import_react109 = require("react");
22104
+ var import_react110 = require("react");
22110
22105
  function useGlobalDateRangePicker({
22111
22106
  allowedDatePickerModes,
22112
22107
  defaultDatePickerMode,
@@ -22123,7 +22118,7 @@ function useGlobalDateRangePicker({
22123
22118
  DEFAULT_ALLOWED_PICKER_MODES
22124
22119
  );
22125
22120
  const desiredRangeMode = allowedDateRangePickerModes.includes(rangeDisplayMode) ? rangeDisplayMode : allowedDateRangePickerModes[0];
22126
- const { dateFormat, selected } = (0, import_react109.useMemo)(() => {
22121
+ const { dateFormat, selected } = (0, import_react110.useMemo)(() => {
22127
22122
  if (rangeDisplayMode === "monthPicker") {
22128
22123
  return {
22129
22124
  selected: start,
@@ -22143,7 +22138,7 @@ function useGlobalDateRangePicker({
22143
22138
  end,
22144
22139
  rangeDisplayMode
22145
22140
  ]);
22146
- const { setSelected } = (0, import_react109.useMemo)(() => {
22141
+ const { setSelected } = (0, import_react110.useMemo)(() => {
22147
22142
  if (desiredRangeMode === "monthPicker") {
22148
22143
  return {
22149
22144
  setSelected: ({ start: start2 }) => {
@@ -22223,10 +22218,10 @@ var ProfitAndLossDatePicker = ({
22223
22218
  };
22224
22219
 
22225
22220
  // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
22226
- var import_react111 = require("react");
22221
+ var import_react112 = require("react");
22227
22222
 
22228
22223
  // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
22229
- var import_react110 = require("react");
22224
+ var import_react111 = require("react");
22230
22225
 
22231
22226
  // src/config/charts.ts
22232
22227
  var DEFAULT_CHART_COLOR_TYPE = [
@@ -22511,7 +22506,7 @@ var DetailedChart = ({
22511
22506
  isLoading,
22512
22507
  showDatePicker = true
22513
22508
  }) => {
22514
- const chartData = (0, import_react110.useMemo)(() => {
22509
+ const chartData = (0, import_react111.useMemo)(() => {
22515
22510
  if (!filteredData) {
22516
22511
  return [];
22517
22512
  }
@@ -22883,11 +22878,11 @@ var ProfitAndLossDetailedCharts = ({
22883
22878
  sidebarScope,
22884
22879
  setSidebarScope,
22885
22880
  setFilterTypes
22886
- } = (0, import_react111.useContext)(ProfitAndLoss.Context);
22881
+ } = (0, import_react112.useContext)(ProfitAndLoss.Context);
22887
22882
  const theScope = scope ? scope : sidebarScope;
22888
22883
  const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
22889
22884
  const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
22890
- const [hoveredItem, setHoveredItem] = (0, import_react111.useState)();
22885
+ const [hoveredItem, setHoveredItem] = (0, import_react112.useState)();
22891
22886
  return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("div", { className: "Layer__profit-and-loss-detailed-charts", children: [
22892
22887
  /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("header", { className: "Layer__profit-and-loss-detailed-charts__header", children: [
22893
22888
  /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
@@ -22956,7 +22951,7 @@ var ProfitAndLossDetailedCharts = ({
22956
22951
  };
22957
22952
 
22958
22953
  // src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
22959
- var import_react112 = require("react");
22954
+ var import_react113 = require("react");
22960
22955
  var import_jsx_runtime189 = require("react/jsx-runtime");
22961
22956
  var ProfitAndLossDownloadButton = ({
22962
22957
  stringOverrides,
@@ -22964,15 +22959,15 @@ var ProfitAndLossDownloadButton = ({
22964
22959
  moneyFormat,
22965
22960
  view
22966
22961
  }) => {
22967
- const { dateRange, tagFilter } = (0, import_react112.useContext)(ProfitAndLoss.Context);
22968
- const { getProfitAndLossComparisonCsv } = (0, import_react112.useContext)(
22962
+ const { dateRange, tagFilter } = (0, import_react113.useContext)(ProfitAndLoss.Context);
22963
+ const { getProfitAndLossComparisonCsv } = (0, import_react113.useContext)(
22969
22964
  ProfitAndLoss.ComparisonContext
22970
22965
  );
22971
22966
  const { businessId } = useLayerContext();
22972
22967
  const { apiUrl } = useEnvironment();
22973
22968
  const { data: auth } = useAuth();
22974
- const [requestFailed, setRequestFailed] = (0, import_react112.useState)(false);
22975
- const [isDownloading, setIsDownloading] = (0, import_react112.useState)(false);
22969
+ const [requestFailed, setRequestFailed] = (0, import_react113.useState)(false);
22970
+ const [isDownloading, setIsDownloading] = (0, import_react113.useState)(false);
22976
22971
  const handleClick = () => __async(null, null, function* () {
22977
22972
  var _a;
22978
22973
  setIsDownloading(true);
@@ -23016,7 +23011,7 @@ var ProfitAndLossDownloadButton = ({
23016
23011
  };
23017
23012
 
23018
23013
  // src/components/ProfitAndLossHeader/ProfitAndLossHeader.tsx
23019
- var import_react114 = require("react");
23014
+ var import_react115 = require("react");
23020
23015
 
23021
23016
  // src/components/SyncingBadge/SyncingBadge.tsx
23022
23017
  var import_jsx_runtime190 = require("react/jsx-runtime");
@@ -23033,13 +23028,13 @@ var SyncingBadge = () => {
23033
23028
  };
23034
23029
 
23035
23030
  // src/hooks/bookkeeping/periods/useActiveBookkeepingPeriod.ts
23036
- var import_react113 = require("react");
23031
+ var import_react114 = require("react");
23037
23032
  function useActiveBookkeepingPeriod() {
23038
23033
  const { date } = useGlobalDate();
23039
23034
  const { data, isLoading } = useBookkeepingPeriods();
23040
23035
  const currentMonth = date.getMonth() + 1;
23041
23036
  const currentYear = date.getFullYear();
23042
- const activePeriod = (0, import_react113.useMemo)(
23037
+ const activePeriod = (0, import_react114.useMemo)(
23043
23038
  () => data == null ? void 0 : data.find((period) => currentYear === period.year && currentMonth === period.month),
23044
23039
  [data, currentMonth, currentYear]
23045
23040
  );
@@ -23058,7 +23053,7 @@ var ProfitAndLossHeader = ({
23058
23053
  const { data: linkedAccounts } = useLinkedAccounts();
23059
23054
  const { activePeriod } = useActiveBookkeepingPeriod();
23060
23055
  const activePeriodStatus = activePeriod == null ? void 0 : activePeriod.status;
23061
- const isSyncing = (0, import_react114.useMemo)(
23056
+ const isSyncing = (0, import_react115.useMemo)(
23062
23057
  () => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
23063
23058
  [linkedAccounts]
23064
23059
  );
@@ -23073,13 +23068,13 @@ var ProfitAndLossHeader = ({
23073
23068
  };
23074
23069
 
23075
23070
  // src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
23076
- var import_react118 = require("react");
23071
+ var import_react119 = require("react");
23077
23072
 
23078
23073
  // src/components/Header/Header.tsx
23079
- var import_react115 = require("react");
23074
+ var import_react116 = require("react");
23080
23075
  var import_classnames60 = __toESM(require("classnames"));
23081
23076
  var import_jsx_runtime192 = require("react/jsx-runtime");
23082
- var Header3 = (0, import_react115.forwardRef)(
23077
+ var Header3 = (0, import_react116.forwardRef)(
23083
23078
  ({ className, children, style, sticky, asHeader, rounded }, ref) => {
23084
23079
  const baseClassName = (0, import_classnames60.default)(
23085
23080
  "Layer__header",
@@ -23120,7 +23115,7 @@ var HeaderCol = ({ className, children, style, noPadding = false }) => {
23120
23115
  };
23121
23116
 
23122
23117
  // src/components/Panel/Panel.tsx
23123
- var import_react116 = require("react");
23118
+ var import_react117 = require("react");
23124
23119
  var import_classnames63 = __toESM(require("classnames"));
23125
23120
  var import_jsx_runtime195 = require("react/jsx-runtime");
23126
23121
  var Panel = ({
@@ -23134,8 +23129,8 @@ var Panel = ({
23134
23129
  floating = false
23135
23130
  }) => {
23136
23131
  var _a;
23137
- const [sidebarHeight, setSidebarHeight] = (0, import_react116.useState)(0);
23138
- (0, import_react116.useEffect)(() => {
23132
+ const [sidebarHeight, setSidebarHeight] = (0, import_react117.useState)(0);
23133
+ (0, import_react117.useEffect)(() => {
23139
23134
  var _a2, _b;
23140
23135
  if ((_a2 = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _a2.offsetHeight) {
23141
23136
  setSidebarHeight((_b = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _b.offsetHeight);
@@ -23175,7 +23170,7 @@ var Panel = ({
23175
23170
  };
23176
23171
 
23177
23172
  // src/components/View/View.tsx
23178
- var import_react117 = require("react");
23173
+ var import_react118 = require("react");
23179
23174
 
23180
23175
  // src/components/ViewHeader/ViewHeader.tsx
23181
23176
  var import_classnames64 = __toESM(require("classnames"));
@@ -23190,7 +23185,7 @@ var ViewHeader = ({ title, className, children }) => {
23190
23185
  // src/components/View/View.tsx
23191
23186
  var import_classnames65 = __toESM(require("classnames"));
23192
23187
  var import_jsx_runtime197 = require("react/jsx-runtime");
23193
- var View = (0, import_react117.forwardRef)(
23188
+ var View = (0, import_react118.forwardRef)(
23194
23189
  ({
23195
23190
  title,
23196
23191
  showHeader = true,
@@ -23241,8 +23236,8 @@ var ProfitAndLossReport = ({
23241
23236
  view
23242
23237
  }) => {
23243
23238
  var _a, _b;
23244
- const { sidebarScope } = (0, import_react118.useContext)(ProfitAndLoss.Context);
23245
- const { comparisonConfig } = (0, import_react118.useContext)(ProfitAndLoss.ComparisonContext);
23239
+ const { sidebarScope } = (0, import_react119.useContext)(ProfitAndLoss.Context);
23240
+ const { comparisonConfig } = (0, import_react119.useContext)(ProfitAndLoss.ComparisonContext);
23246
23241
  return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
23247
23242
  View,
23248
23243
  {
@@ -23299,10 +23294,10 @@ var ProfitAndLossReport = ({
23299
23294
  };
23300
23295
 
23301
23296
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
23302
- var import_react122 = require("react");
23297
+ var import_react123 = require("react");
23303
23298
 
23304
23299
  // src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
23305
- var import_react119 = require("react");
23300
+ var import_react120 = require("react");
23306
23301
  var import_jsx_runtime199 = require("react/jsx-runtime");
23307
23302
  var LIST_ITEM_CLASS_NAME = "Layer__ProfitAndLossSummariesListItem";
23308
23303
  function ProfitAndLossSummariesListItem({
@@ -23310,7 +23305,7 @@ function ProfitAndLossSummariesListItem({
23310
23305
  isActive,
23311
23306
  onClick
23312
23307
  }) {
23313
- const dataProperties = (0, import_react119.useMemo)(
23308
+ const dataProperties = (0, import_react120.useMemo)(
23314
23309
  () => toDataProperties({ active: isActive, clickable: !!onClick }),
23315
23310
  [isActive]
23316
23311
  );
@@ -23321,7 +23316,7 @@ function ProfitAndLossSummariesList({
23321
23316
  children,
23322
23317
  itemCount
23323
23318
  }) {
23324
- const dataProperties = (0, import_react119.useMemo)(
23319
+ const dataProperties = (0, import_react120.useMemo)(
23325
23320
  () => toDataProperties({ ["column-count"]: itemCount }),
23326
23321
  [itemCount]
23327
23322
  );
@@ -23414,10 +23409,10 @@ function ProfitAndLossSummariesMiniChart({
23414
23409
  }
23415
23410
 
23416
23411
  // src/components/ui/Typography/MoneyText.tsx
23417
- var import_react120 = require("react");
23412
+ var import_react121 = require("react");
23418
23413
  var import_jsx_runtime201 = require("react/jsx-runtime");
23419
23414
  var CLASS_NAME10 = "Layer__MoneyText";
23420
- var MoneySpan = (0, import_react120.forwardRef)(
23415
+ var MoneySpan = (0, import_react121.forwardRef)(
23421
23416
  (_a, ref) => {
23422
23417
  var _b = _a, { amount, bold, size } = _b, restProps = __objRest(_b, ["amount", "bold", "size"]);
23423
23418
  const dataProperties = toDataProperties({
@@ -23464,7 +23459,7 @@ function ProfitAndLossSummariesSummary({
23464
23459
  }
23465
23460
 
23466
23461
  // src/views/AccountingOverview/internal/TransactionsToReview.tsx
23467
- var import_react121 = require("react");
23462
+ var import_react122 = require("react");
23468
23463
  var import_date_fns30 = require("date-fns");
23469
23464
  var import_jsx_runtime204 = require("react/jsx-runtime");
23470
23465
  var CLASS_NAME12 = "Layer__TransactionsToReview";
@@ -23475,17 +23470,17 @@ function TransactionsToReview({
23475
23470
  variants
23476
23471
  }) {
23477
23472
  const { size = "sm" } = variants != null ? variants : {};
23478
- const { dateRange: contextDateRange } = (0, import_react121.useContext)(ProfitAndLoss.Context);
23473
+ const { dateRange: contextDateRange } = (0, import_react122.useContext)(ProfitAndLoss.Context);
23479
23474
  const dateRange = usePnlDateRange ? contextDateRange : void 0;
23480
- const [toReview, setToReview] = (0, import_react121.useState)(0);
23475
+ const [toReview, setToReview] = (0, import_react122.useState)(0);
23481
23476
  const { data, loaded, error, refetch } = useProfitAndLossLTM({
23482
23477
  currentDate: dateRange ? dateRange.startDate : (0, import_date_fns30.startOfMonth)(/* @__PURE__ */ new Date()),
23483
23478
  tagFilter
23484
23479
  });
23485
- (0, import_react121.useEffect)(() => {
23480
+ (0, import_react122.useEffect)(() => {
23486
23481
  checkTransactionsToReview();
23487
23482
  }, []);
23488
- (0, import_react121.useEffect)(() => {
23483
+ (0, import_react122.useEffect)(() => {
23489
23484
  checkTransactionsToReview();
23490
23485
  }, [dateRange, loaded]);
23491
23486
  const checkTransactionsToReview = () => {
@@ -23566,8 +23561,8 @@ function Internal_ProfitAndLossSummaries({
23566
23561
  isLoading,
23567
23562
  setSidebarScope,
23568
23563
  sidebarScope
23569
- } = (0, import_react122.useContext)(ProfitAndLoss.Context);
23570
- const { revenueChartData, expensesChartData } = (0, import_react122.useMemo)(
23564
+ } = (0, import_react123.useContext)(ProfitAndLoss.Context);
23565
+ const { revenueChartData, expensesChartData } = (0, import_react123.useMemo)(
23571
23566
  () => ({
23572
23567
  revenueChartData: toMiniChartData({ scope: "revenue", data }),
23573
23568
  expensesChartData: toMiniChartData({ scope: "expenses", data })
@@ -23669,10 +23664,10 @@ function ProfitAndLossSummaries(_a) {
23669
23664
  }
23670
23665
 
23671
23666
  // src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
23672
- var import_react128 = require("react");
23667
+ var import_react129 = require("react");
23673
23668
 
23674
23669
  // src/contexts/TableContext/TableContext.tsx
23675
- var import_react123 = require("react");
23670
+ var import_react124 = require("react");
23676
23671
  var import_jsx_runtime206 = require("react/jsx-runtime");
23677
23672
  var defaultValue = {
23678
23673
  expandedRows: [],
@@ -23684,10 +23679,10 @@ var defaultValue = {
23684
23679
  setExpandedAllRows: () => {
23685
23680
  }
23686
23681
  };
23687
- var TableContext = (0, import_react123.createContext)(defaultValue);
23682
+ var TableContext = (0, import_react124.createContext)(defaultValue);
23688
23683
  var TableProvider = ({ children }) => {
23689
- const [expandedRows, setExpandedRowsState] = (0, import_react123.useState)([]);
23690
- const [expandedAllRows, setExpandedAllRows] = (0, import_react123.useState)(false);
23684
+ const [expandedRows, setExpandedRowsState] = (0, import_react124.useState)([]);
23685
+ const [expandedAllRows, setExpandedAllRows] = (0, import_react124.useState)(false);
23691
23686
  const toggleRow = (rowKey) => {
23692
23687
  setExpandedRowsState((prevRows) => {
23693
23688
  const rows = [...prevRows];
@@ -23713,10 +23708,10 @@ var TableProvider = ({ children }) => {
23713
23708
  };
23714
23709
 
23715
23710
  // src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
23716
- var import_react126 = require("react");
23711
+ var import_react127 = require("react");
23717
23712
 
23718
23713
  // src/hooks/useTableExpandRow/useTableExpandRow.tsx
23719
- var import_react124 = require("react");
23714
+ var import_react125 = require("react");
23720
23715
  var useTableExpandRow = () => {
23721
23716
  const {
23722
23717
  expandedAllRows,
@@ -23724,7 +23719,7 @@ var useTableExpandRow = () => {
23724
23719
  expandAllRows,
23725
23720
  expandedRows,
23726
23721
  setExpandedRows
23727
- } = (0, import_react124.useContext)(TableContext);
23722
+ } = (0, import_react125.useContext)(TableContext);
23728
23723
  const toggleAllRows = () => {
23729
23724
  if (expandedAllRows) {
23730
23725
  setIsOpen([]);
@@ -23945,7 +23940,7 @@ var TableRow = ({
23945
23940
  };
23946
23941
 
23947
23942
  // src/components/Table/Table.tsx
23948
- var import_react125 = require("react");
23943
+ var import_react126 = require("react");
23949
23944
  var import_classnames68 = __toESM(require("classnames"));
23950
23945
  var import_jsx_runtime211 = require("react/jsx-runtime");
23951
23946
  var Table2 = ({
@@ -23954,9 +23949,9 @@ var Table2 = ({
23954
23949
  borderCollapse = "separate",
23955
23950
  bottomSpacing = true
23956
23951
  }) => {
23957
- const tableRef = (0, import_react125.useRef)(null);
23958
- const prevChildrenRef = (0, import_react125.useRef)([]);
23959
- (0, import_react125.useEffect)(() => {
23952
+ const tableRef = (0, import_react126.useRef)(null);
23953
+ const prevChildrenRef = (0, import_react126.useRef)([]);
23954
+ (0, import_react126.useEffect)(() => {
23960
23955
  if (tableRef.current) {
23961
23956
  const tbody = tableRef.current.querySelector("tbody");
23962
23957
  const rows = tbody ? Array.from(tbody.querySelectorAll("tr")) : [];
@@ -24005,17 +24000,17 @@ var import_jsx_runtime212 = require("react/jsx-runtime");
24005
24000
  var ProfitAndLossCompareTable = ({
24006
24001
  stringOverrides
24007
24002
  }) => {
24008
- const { dateRange } = (0, import_react126.useContext)(ProfitAndLoss.Context);
24003
+ const { dateRange } = (0, import_react127.useContext)(ProfitAndLoss.Context);
24009
24004
  const {
24010
24005
  data: comparisonData,
24011
24006
  isLoading,
24012
24007
  comparePeriods,
24013
24008
  selectedCompareOptions
24014
- } = (0, import_react126.useContext)(ProfitAndLoss.ComparisonContext);
24009
+ } = (0, import_react127.useContext)(ProfitAndLoss.ComparisonContext);
24015
24010
  const { isOpen, setIsOpen } = useTableExpandRow();
24016
24011
  const { rangeDisplayMode } = useGlobalDateRange();
24017
24012
  const { data: bookkeepingPeriods } = useBookkeepingPeriods();
24018
- (0, import_react126.useEffect)(() => {
24013
+ (0, import_react127.useEffect)(() => {
24019
24014
  setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
24020
24015
  }, []);
24021
24016
  if (isLoading || comparisonData === void 0) {
@@ -24059,7 +24054,7 @@ var ProfitAndLossCompareTable = ({
24059
24054
  }
24060
24055
  const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
24061
24056
  const expanded = expandable ? isOpen(rowKey) : true;
24062
- return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react126.Fragment, { children: [
24057
+ return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react127.Fragment, { children: [
24063
24058
  /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
24064
24059
  TableRow,
24065
24060
  {
@@ -24093,7 +24088,7 @@ var ProfitAndLossCompareTable = ({
24093
24088
  return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(Table2, { borderCollapse: "collapse", bottomSpacing: false, children: [
24094
24089
  /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(TableRow, { rowKey: "", children: [
24095
24090
  /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { isHeaderCell: true }),
24096
- selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react126.Fragment, { children: [
24091
+ selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react127.Fragment, { children: [
24097
24092
  /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
24098
24093
  comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
24099
24094
  ] }, option.displayName + "-" + i))
@@ -24101,7 +24096,7 @@ var ProfitAndLossCompareTable = ({
24101
24096
  /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(TableBody, { children: [
24102
24097
  comparePeriods && /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(TableRow, { rowKey: "", children: [
24103
24098
  /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { isHeaderCell: true }),
24104
- selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_react126.Fragment, { children: generateComparisonPeriods(
24099
+ selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_react127.Fragment, { children: generateComparisonPeriods(
24105
24100
  dateRange.startDate,
24106
24101
  comparePeriods,
24107
24102
  rangeDisplayMode
@@ -24109,7 +24104,7 @@ var ProfitAndLossCompareTable = ({
24109
24104
  month.label,
24110
24105
  " ",
24111
24106
  getBookkeepingPeriodStatus(month.date)
24112
- ] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_react126.Fragment, { children: generateComparisonPeriods(
24107
+ ] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_react127.Fragment, { children: generateComparisonPeriods(
24113
24108
  dateRange.startDate,
24114
24109
  comparePeriods,
24115
24110
  rangeDisplayMode
@@ -24141,7 +24136,7 @@ var ProfitAndLossCompareTable = ({
24141
24136
  };
24142
24137
 
24143
24138
  // src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
24144
- var import_react127 = require("react");
24139
+ var import_react128 = require("react");
24145
24140
 
24146
24141
  // src/icons/PieChart.tsx
24147
24142
  var import_jsx_runtime213 = require("react/jsx-runtime");
@@ -24240,9 +24235,9 @@ var ProfitAndLossTableComponent = ({
24240
24235
  data: actualData,
24241
24236
  isLoading,
24242
24237
  setSidebarScope
24243
- } = (0, import_react127.useContext)(ProfitAndLoss.Context);
24238
+ } = (0, import_react128.useContext)(ProfitAndLoss.Context);
24244
24239
  const { isOpen, setIsOpen } = useTableExpandRow();
24245
- (0, import_react127.useEffect)(() => {
24240
+ (0, import_react128.useEffect)(() => {
24246
24241
  setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
24247
24242
  }, []);
24248
24243
  const currentData = Array.isArray(actualData) ? actualData[actualData.length - 1] : actualData;
@@ -24262,7 +24257,7 @@ var ProfitAndLossTableComponent = ({
24262
24257
  const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
24263
24258
  const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
24264
24259
  const expanded = expandable ? isOpen(rowKey) : true;
24265
- return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(import_react127.Fragment, { children: [
24260
+ return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(import_react128.Fragment, { children: [
24266
24261
  /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
24267
24262
  TableRow,
24268
24263
  {
@@ -24386,14 +24381,14 @@ var ProfitAndLossTableComponent = ({
24386
24381
  // src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
24387
24382
  var import_jsx_runtime215 = require("react/jsx-runtime");
24388
24383
  var ProfitAndLossTableWithProvider = (props) => {
24389
- const { compareModeActive } = (0, import_react128.useContext)(ProfitAndLoss.ComparisonContext);
24384
+ const { compareModeActive } = (0, import_react129.useContext)(ProfitAndLoss.ComparisonContext);
24390
24385
  return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(TableProvider, { children: compareModeActive ? /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(ProfitAndLossTableComponent, __spreadValues({}, props)) });
24391
24386
  };
24392
24387
 
24393
24388
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
24394
24389
  var import_date_fns32 = require("date-fns");
24395
24390
  var import_jsx_runtime216 = require("react/jsx-runtime");
24396
- var PNLContext = (0, import_react129.createContext)({
24391
+ var PNLContext = (0, import_react130.createContext)({
24397
24392
  data: void 0,
24398
24393
  filteredDataRevenue: [],
24399
24394
  filteredTotalRevenue: void 0,
@@ -24491,12 +24486,12 @@ function useBalanceSheet({
24491
24486
  }
24492
24487
 
24493
24488
  // src/hooks/useElementViewSize/useElementViewSize.tsx
24494
- var import_react130 = require("react");
24489
+ var import_react131 = require("react");
24495
24490
  var useElementViewSize = () => {
24496
- const containerRef = (0, import_react130.useRef)(null);
24497
- const [view, setView] = (0, import_react130.useState)("desktop");
24498
- const resizeTimeout = (0, import_react130.useRef)(null);
24499
- (0, import_react130.useLayoutEffect)(() => {
24491
+ const containerRef = (0, import_react131.useRef)(null);
24492
+ const [view, setView] = (0, import_react131.useState)("desktop");
24493
+ const resizeTimeout = (0, import_react131.useRef)(null);
24494
+ (0, import_react131.useLayoutEffect)(() => {
24500
24495
  const element = containerRef == null ? void 0 : containerRef.current;
24501
24496
  if (!element) {
24502
24497
  return;
@@ -24565,7 +24560,7 @@ var BalanceSheetExpandAllButton = ({
24565
24560
  };
24566
24561
 
24567
24562
  // src/components/BalanceSheetTable/BalanceSheetTable.tsx
24568
- var import_react131 = require("react");
24563
+ var import_react132 = require("react");
24569
24564
  var import_jsx_runtime219 = require("react/jsx-runtime");
24570
24565
  var BalanceSheetTable = ({
24571
24566
  data,
@@ -24574,12 +24569,12 @@ var BalanceSheetTable = ({
24574
24569
  }) => {
24575
24570
  const { isOpen, setIsOpen, expandedAllRows } = useTableExpandRow();
24576
24571
  const allRowKeys = [];
24577
- (0, import_react131.useEffect)(() => {
24572
+ (0, import_react132.useEffect)(() => {
24578
24573
  if (expandedAllRows) {
24579
24574
  setIsOpen(allRowKeys, true);
24580
24575
  }
24581
24576
  }, [expandedAllRows]);
24582
- (0, import_react131.useEffect)(() => {
24577
+ (0, import_react132.useEffect)(() => {
24583
24578
  setIsOpen(["assets"]);
24584
24579
  }, []);
24585
24580
  const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
@@ -24589,7 +24584,7 @@ var BalanceSheetTable = ({
24589
24584
  if (expandable) {
24590
24585
  allRowKeys.push(rowKey);
24591
24586
  }
24592
- return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(import_react131.Fragment, { children: [
24587
+ return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(import_react132.Fragment, { children: [
24593
24588
  /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(
24594
24589
  TableRow,
24595
24590
  {
@@ -24640,7 +24635,7 @@ var BalanceSheetTable = ({
24640
24635
  /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
24641
24636
  /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
24642
24637
  ] }) }),
24643
- /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_react131.Fragment, { children: data[row.lineItem] && renderLineItem(
24638
+ /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_react132.Fragment, { children: data[row.lineItem] && renderLineItem(
24644
24639
  data[row.lineItem],
24645
24640
  0,
24646
24641
  row.lineItem,
@@ -24814,7 +24809,7 @@ var BalanceSheetView = ({
24814
24809
  };
24815
24810
 
24816
24811
  // src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
24817
- var import_react132 = require("react");
24812
+ var import_react133 = require("react");
24818
24813
  var import_jsx_runtime222 = require("react/jsx-runtime");
24819
24814
  var StatementOfCashFlowTable = ({
24820
24815
  data,
@@ -24825,7 +24820,7 @@ var StatementOfCashFlowTable = ({
24825
24820
  const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
24826
24821
  const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
24827
24822
  const expanded = expandable ? isOpen(rowKey) : true;
24828
- return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(import_react132.Fragment, { children: [
24823
+ return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(import_react133.Fragment, { children: [
24829
24824
  /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(
24830
24825
  TableRow,
24831
24826
  {
@@ -24877,7 +24872,7 @@ var StatementOfCashFlowTable = ({
24877
24872
  ] }) }),
24878
24873
  /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(TableBody, { children: config.map((row, idx) => {
24879
24874
  if (row.type === "line_item") {
24880
- return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(import_react132.Fragment, { children: data[row.lineItem] && renderLineItem(
24875
+ return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(import_react133.Fragment, { children: data[row.lineItem] && renderLineItem(
24881
24876
  data[row.lineItem],
24882
24877
  0,
24883
24878
  row.lineItem ? row.lineItem : "",
@@ -25177,12 +25172,12 @@ var StatementOfCashFlowView = ({
25177
25172
  };
25178
25173
 
25179
25174
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
25180
- var import_react146 = require("react");
25175
+ var import_react147 = require("react");
25181
25176
 
25182
25177
  // src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
25183
- var import_react133 = require("react");
25178
+ var import_react134 = require("react");
25184
25179
  var import_date_fns35 = require("date-fns");
25185
- var ChartOfAccountsContext = (0, import_react133.createContext)(
25180
+ var ChartOfAccountsContext = (0, import_react134.createContext)(
25186
25181
  {
25187
25182
  data: void 0,
25188
25183
  isLoading: false,
@@ -25213,8 +25208,8 @@ var ChartOfAccountsContext = (0, import_react133.createContext)(
25213
25208
  );
25214
25209
 
25215
25210
  // src/contexts/LedgerAccountsContext/LedgerAccountsContext.tsx
25216
- var import_react134 = require("react");
25217
- var LedgerAccountsContext = (0, import_react134.createContext)({
25211
+ var import_react135 = require("react");
25212
+ var LedgerAccountsContext = (0, import_react135.createContext)({
25218
25213
  data: void 0,
25219
25214
  entryData: void 0,
25220
25215
  isLoading: false,
@@ -25236,7 +25231,7 @@ var LedgerAccountsContext = (0, import_react134.createContext)({
25236
25231
  });
25237
25232
 
25238
25233
  // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
25239
- var import_react135 = require("react");
25234
+ var import_react136 = require("react");
25240
25235
 
25241
25236
  // src/components/ChartOfAccountsForm/constants.ts
25242
25237
  var LEDGER_ACCOUNT_TYPES = [
@@ -25536,13 +25531,13 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
25536
25531
  } = useLayerContext();
25537
25532
  const { apiUrl } = useEnvironment();
25538
25533
  const { data: auth } = useAuth();
25539
- const [form, setForm] = (0, import_react135.useState)();
25540
- const [sendingForm, setSendingForm] = (0, import_react135.useState)(false);
25541
- const [apiError, setApiError] = (0, import_react135.useState)(void 0);
25542
- const [startDate, setStartDate] = (0, import_react135.useState)(
25534
+ const [form, setForm] = (0, import_react136.useState)();
25535
+ const [sendingForm, setSendingForm] = (0, import_react136.useState)(false);
25536
+ const [apiError, setApiError] = (0, import_react136.useState)(void 0);
25537
+ const [startDate, setStartDate] = (0, import_react136.useState)(
25543
25538
  initialStartDate != null ? initialStartDate : (0, import_date_fns36.startOfMonth)(Date.now())
25544
25539
  );
25545
- const [endDate, setEndDate] = (0, import_react135.useState)(
25540
+ const [endDate, setEndDate] = (0, import_react136.useState)(
25546
25541
  initialEndDate != null ? initialEndDate : (0, import_date_fns36.endOfMonth)(Date.now())
25547
25542
  );
25548
25543
  const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `chart-of-accounts-${businessId}-${startDate == null ? void 0 : startDate.valueOf()}-${endDate == null ? void 0 : endDate.valueOf()}`;
@@ -25724,12 +25719,12 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
25724
25719
  newEndDate && setEndDate(newEndDate);
25725
25720
  };
25726
25721
  const refetch = () => mutate();
25727
- (0, import_react135.useEffect)(() => {
25722
+ (0, import_react136.useEffect)(() => {
25728
25723
  if (queryKey && (isLoading || isValidating)) {
25729
25724
  read("CHART_OF_ACCOUNTS" /* CHART_OF_ACCOUNTS */, queryKey);
25730
25725
  }
25731
25726
  }, [isLoading, isValidating]);
25732
- (0, import_react135.useEffect)(() => {
25727
+ (0, import_react136.useEffect)(() => {
25733
25728
  if (queryKey && hasBeenTouched(queryKey)) {
25734
25729
  refetch();
25735
25730
  }
@@ -25757,17 +25752,17 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
25757
25752
  // src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
25758
25753
  var import_mutation12 = __toESM(require("swr/mutation"));
25759
25754
  var import_swr21 = require("swr");
25760
- var import_react136 = require("react");
25755
+ var import_react137 = require("react");
25761
25756
 
25762
25757
  // src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
25763
- var import_react137 = require("react");
25758
+ var import_react138 = require("react");
25764
25759
  var import_swr22 = __toESM(require("swr"));
25765
25760
  var useLedgerAccounts = (showReversalEntries = false) => {
25766
25761
  const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
25767
25762
  const { apiUrl } = useEnvironment();
25768
25763
  const { data: auth } = useAuth();
25769
- const [accountId, setAccountId] = (0, import_react137.useState)();
25770
- const [selectedEntryId, setSelectedEntryId] = (0, import_react137.useState)();
25764
+ const [accountId, setAccountId] = (0, import_react138.useState)();
25765
+ const [selectedEntryId, setSelectedEntryId] = (0, import_react138.useState)();
25771
25766
  const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
25772
25767
  const { data, isLoading, isValidating, error, mutate } = (0, import_swr22.default)(
25773
25768
  queryKey,
@@ -25796,12 +25791,12 @@ var useLedgerAccounts = (showReversalEntries = false) => {
25796
25791
  setSelectedEntryId(void 0);
25797
25792
  mutateEntryData();
25798
25793
  };
25799
- (0, import_react137.useEffect)(() => {
25794
+ (0, import_react138.useEffect)(() => {
25800
25795
  if (queryKey && (isLoading || isValidating)) {
25801
25796
  read("LEDGER_ACCOUNTS" /* LEDGER_ACCOUNTS */, queryKey);
25802
25797
  }
25803
25798
  }, [isLoading, isValidating]);
25804
- (0, import_react137.useEffect)(() => {
25799
+ (0, import_react138.useEffect)(() => {
25805
25800
  if (queryKey && hasBeenTouched(queryKey)) {
25806
25801
  refetch();
25807
25802
  }
@@ -25825,7 +25820,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
25825
25820
  };
25826
25821
 
25827
25822
  // src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
25828
- var import_react142 = require("react");
25823
+ var import_react143 = require("react");
25829
25824
 
25830
25825
  // src/icons/Plus.tsx
25831
25826
  var import_jsx_runtime226 = require("react/jsx-runtime");
@@ -25866,11 +25861,11 @@ var Plus = (_a) => {
25866
25861
  var Plus_default = Plus;
25867
25862
 
25868
25863
  // src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
25869
- var import_react138 = require("react");
25864
+ var import_react139 = require("react");
25870
25865
  var import_date_fns37 = require("date-fns");
25871
25866
  var import_jsx_runtime227 = require("react/jsx-runtime");
25872
25867
  var ChartOfAccountsDatePicker = () => {
25873
- const { changeDateRange, dateRange } = (0, import_react138.useContext)(ChartOfAccountsContext);
25868
+ const { changeDateRange, dateRange } = (0, import_react139.useContext)(ChartOfAccountsContext);
25874
25869
  return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
25875
25870
  DatePicker,
25876
25871
  {
@@ -25889,13 +25884,13 @@ var ChartOfAccountsDatePicker = () => {
25889
25884
  };
25890
25885
 
25891
25886
  // src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
25892
- var import_react140 = require("react");
25887
+ var import_react141 = require("react");
25893
25888
 
25894
25889
  // src/components/ChartOfAccountsForm/useParentOptions.ts
25895
- var import_react139 = require("react");
25890
+ var import_react140 = require("react");
25896
25891
  var useParentOptions = (data) => {
25897
25892
  var _a;
25898
- return (0, import_react139.useMemo)(
25893
+ return (0, import_react140.useMemo)(
25899
25894
  () => flattenAccounts((data == null ? void 0 : data.accounts) || []).sort((a, b) => (a == null ? void 0 : a.name) && (b == null ? void 0 : b.name) ? a.name.localeCompare(b.name) : 0).map((x) => {
25900
25895
  return {
25901
25896
  label: x.name,
@@ -25920,9 +25915,9 @@ var ChartOfAccountsForm = ({
25920
25915
  submitForm,
25921
25916
  sendingForm,
25922
25917
  apiError
25923
- } = (0, import_react140.useContext)(ChartOfAccountsContext);
25918
+ } = (0, import_react141.useContext)(ChartOfAccountsContext);
25924
25919
  const parentOptions = useParentOptions(data);
25925
- const entry = (0, import_react140.useMemo)(() => {
25920
+ const entry = (0, import_react141.useMemo)(() => {
25926
25921
  if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
25927
25922
  return flattenAccounts((data == null ? void 0 : data.accounts) || []).find(
25928
25923
  (x) => x.id === form.accountId
@@ -26135,7 +26130,7 @@ var ChartOfAccountsSidebar = ({
26135
26130
  };
26136
26131
 
26137
26132
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
26138
- var import_react141 = require("react");
26133
+ var import_react142 = require("react");
26139
26134
 
26140
26135
  // src/icons/Edit2.tsx
26141
26136
  var import_jsx_runtime230 = require("react/jsx-runtime");
@@ -26195,18 +26190,18 @@ var ChartOfAccountsTableContent = ({
26195
26190
  expandAll,
26196
26191
  templateAccountsEditable
26197
26192
  }) => {
26198
- const { setAccountId } = (0, import_react141.useContext)(LedgerAccountsContext);
26199
- const { editAccount } = (0, import_react141.useContext)(ChartOfAccountsContext);
26193
+ const { setAccountId } = (0, import_react142.useContext)(LedgerAccountsContext);
26194
+ const { editAccount } = (0, import_react142.useContext)(ChartOfAccountsContext);
26200
26195
  const { isOpen, setIsOpen } = useTableExpandRow();
26201
- const [accountsRowKeys, setAccountsRowKeys] = (0, import_react141.useState)([]);
26202
- (0, import_react141.useEffect)(() => {
26196
+ const [accountsRowKeys, setAccountsRowKeys] = (0, import_react142.useState)([]);
26197
+ (0, import_react142.useEffect)(() => {
26203
26198
  if (expandAll === "expanded") {
26204
26199
  setIsOpen(accountsRowKeys);
26205
26200
  } else if (expandAll === "collapsed") {
26206
26201
  setIsOpen([]);
26207
26202
  }
26208
26203
  }, [expandAll]);
26209
- (0, import_react141.useEffect)(() => {
26204
+ (0, import_react142.useEffect)(() => {
26210
26205
  const defaultExpanded = data.accounts.map(
26211
26206
  (account) => "coa-row-" + account.id
26212
26207
  );
@@ -26225,7 +26220,7 @@ var ChartOfAccountsTableContent = ({
26225
26220
  var _a, _b;
26226
26221
  const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
26227
26222
  const expanded = expandable ? isOpen(rowKey) : true;
26228
- return /* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(import_react141.Fragment, { children: [
26223
+ return /* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(import_react142.Fragment, { children: [
26229
26224
  /* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(
26230
26225
  TableRow,
26231
26226
  {
@@ -26401,8 +26396,8 @@ var ChartOfAccountsTableWithPanel = ({
26401
26396
  templateAccountsEditable
26402
26397
  }) => {
26403
26398
  var _a;
26404
- const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react142.useContext)(ChartOfAccountsContext);
26405
- const [expandAll, setExpandAll] = (0, import_react142.useState)();
26399
+ const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react143.useContext)(ChartOfAccountsContext);
26400
+ const [expandAll, setExpandAll] = (0, import_react143.useState)();
26406
26401
  const cumulativeIndex = 0;
26407
26402
  const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
26408
26403
  return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(
@@ -26507,10 +26502,10 @@ var ChartOfAccountsTableWithPanel = ({
26507
26502
  };
26508
26503
 
26509
26504
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
26510
- var import_react145 = require("react");
26505
+ var import_react146 = require("react");
26511
26506
 
26512
26507
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
26513
- var import_react143 = require("react");
26508
+ var import_react144 = require("react");
26514
26509
 
26515
26510
  // src/utils/journal.ts
26516
26511
  var getAccountIdentifierPayload = (journalLineItem) => {
@@ -26754,8 +26749,8 @@ var LedgerAccountEntryDetails = ({
26754
26749
  stringOverrides
26755
26750
  }) => {
26756
26751
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
26757
- const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react143.useContext)(LedgerAccountsContext);
26758
- const { totalDebit, totalCredit } = (0, import_react143.useMemo)(() => {
26752
+ const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react144.useContext)(LedgerAccountsContext);
26753
+ const { totalDebit, totalCredit } = (0, import_react144.useMemo)(() => {
26759
26754
  var _a2;
26760
26755
  let totalDebit2 = 0;
26761
26756
  let totalCredit2 = 0;
@@ -26901,7 +26896,7 @@ var LedgerAccountEntryDetails = ({
26901
26896
  };
26902
26897
 
26903
26898
  // src/components/LedgerAccount/LedgerAccountRow.tsx
26904
- var import_react144 = require("react");
26899
+ var import_react145 = require("react");
26905
26900
  var import_classnames72 = __toESM(require("classnames"));
26906
26901
  var import_date_fns39 = require("date-fns");
26907
26902
  var import_jsx_runtime238 = require("react/jsx-runtime");
@@ -26912,9 +26907,9 @@ var LedgerAccountRow = ({
26912
26907
  view
26913
26908
  }) => {
26914
26909
  var _a, _b, _c, _d, _e, _f;
26915
- const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react144.useContext)(LedgerAccountsContext);
26916
- const [showComponent, setShowComponent] = (0, import_react144.useState)(false);
26917
- (0, import_react144.useEffect)(() => {
26910
+ const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react145.useContext)(LedgerAccountsContext);
26911
+ const [showComponent, setShowComponent] = (0, import_react145.useState)(false);
26912
+ (0, import_react145.useEffect)(() => {
26918
26913
  if (initialLoad) {
26919
26914
  const timeoutId = setTimeout(() => {
26920
26915
  setShowComponent(true);
@@ -27058,9 +27053,9 @@ var LedgerAccount = ({
27058
27053
  stringOverrides
27059
27054
  }) => {
27060
27055
  var _a, _b, _c, _d, _e, _f, _g, _h;
27061
- const [currentPage, setCurrentPage] = (0, import_react145.useState)(1);
27062
- const [initialLoad, setInitialLoad] = (0, import_react145.useState)(true);
27063
- const { data: accountData } = (0, import_react145.useContext)(ChartOfAccountsContext);
27056
+ const [currentPage, setCurrentPage] = (0, import_react146.useState)(1);
27057
+ const [initialLoad, setInitialLoad] = (0, import_react146.useState)(true);
27058
+ const { data: accountData } = (0, import_react146.useContext)(ChartOfAccountsContext);
27064
27059
  const {
27065
27060
  data: rawData,
27066
27061
  error,
@@ -27071,8 +27066,8 @@ var LedgerAccount = ({
27071
27066
  selectedEntryId,
27072
27067
  closeSelectedEntry,
27073
27068
  refetch
27074
- } = (0, import_react145.useContext)(LedgerAccountsContext);
27075
- (0, import_react145.useEffect)(() => {
27069
+ } = (0, import_react146.useContext)(LedgerAccountsContext);
27070
+ (0, import_react146.useEffect)(() => {
27076
27071
  if (!isLoading) {
27077
27072
  const timeoutLoad = setTimeout(() => {
27078
27073
  setInitialLoad(false);
@@ -27084,12 +27079,12 @@ var LedgerAccount = ({
27084
27079
  "Layer__ledger-account__index",
27085
27080
  accountId && "open"
27086
27081
  );
27087
- const account = (0, import_react145.useMemo)(() => {
27082
+ const account = (0, import_react146.useMemo)(() => {
27088
27083
  return flattenAccounts((accountData == null ? void 0 : accountData.accounts) || []).find(
27089
27084
  (x) => x.id === accountId
27090
27085
  );
27091
27086
  }, [accountId]);
27092
- const data = (0, import_react145.useMemo)(() => {
27087
+ const data = (0, import_react146.useMemo)(() => {
27093
27088
  var _a2;
27094
27089
  const firstPageIndex = (currentPage - 1) * pageSize;
27095
27090
  const lastPageIndex = firstPageIndex + pageSize;
@@ -27227,7 +27222,7 @@ var ChartOfAccountsContent = ({
27227
27222
  templateAccountsEditable,
27228
27223
  showAddAccountButton
27229
27224
  }) => {
27230
- const { accountId } = (0, import_react146.useContext)(LedgerAccountsContext);
27225
+ const { accountId } = (0, import_react147.useContext)(LedgerAccountsContext);
27231
27226
  const { view, containerRef } = useElementViewSize();
27232
27227
  return /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(
27233
27228
  LedgerAccount,
@@ -27252,8 +27247,8 @@ var ChartOfAccountsContent = ({
27252
27247
  };
27253
27248
 
27254
27249
  // src/contexts/JournalContext/JournalContext.tsx
27255
- var import_react147 = require("react");
27256
- var JournalContext = (0, import_react147.createContext)({
27250
+ var import_react148 = require("react");
27251
+ var JournalContext = (0, import_react148.createContext)({
27257
27252
  data: void 0,
27258
27253
  isLoading: false,
27259
27254
  error: void 0,
@@ -27287,7 +27282,7 @@ var JournalContext = (0, import_react147.createContext)({
27287
27282
  });
27288
27283
 
27289
27284
  // src/hooks/useJournal/useJournal.tsx
27290
- var import_react148 = require("react");
27285
+ var import_react149 = require("react");
27291
27286
  var import_swr23 = __toESM(require("swr"));
27292
27287
  var useJournal = () => {
27293
27288
  const {
@@ -27299,11 +27294,11 @@ var useJournal = () => {
27299
27294
  } = useLayerContext();
27300
27295
  const { apiUrl } = useEnvironment();
27301
27296
  const { data: auth } = useAuth();
27302
- const [selectedEntryId, setSelectedEntryId] = (0, import_react148.useState)();
27303
- const [form, setForm] = (0, import_react148.useState)();
27304
- const [addingEntry, setAddingEntry] = (0, import_react148.useState)(false);
27305
- const [sendingForm, setSendingForm] = (0, import_react148.useState)(false);
27306
- const [apiError, setApiError] = (0, import_react148.useState)(void 0);
27297
+ const [selectedEntryId, setSelectedEntryId] = (0, import_react149.useState)();
27298
+ const [form, setForm] = (0, import_react149.useState)();
27299
+ const [addingEntry, setAddingEntry] = (0, import_react149.useState)(false);
27300
+ const [sendingForm, setSendingForm] = (0, import_react149.useState)(false);
27301
+ const [apiError, setApiError] = (0, import_react149.useState)(void 0);
27307
27302
  const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
27308
27303
  const { data, isLoading, isValidating, error, mutate } = (0, import_swr23.default)(
27309
27304
  queryKey,
@@ -27519,12 +27514,12 @@ var useJournal = () => {
27519
27514
  params: { businessId, entryId }
27520
27515
  });
27521
27516
  });
27522
- (0, import_react148.useEffect)(() => {
27517
+ (0, import_react149.useEffect)(() => {
27523
27518
  if (queryKey && (isLoading || isValidating)) {
27524
27519
  read("JOURNAL" /* JOURNAL */, queryKey);
27525
27520
  }
27526
27521
  }, [isLoading, isValidating]);
27527
- (0, import_react148.useEffect)(() => {
27522
+ (0, import_react149.useEffect)(() => {
27528
27523
  if (queryKey && hasBeenTouched(queryKey)) {
27529
27524
  refetch();
27530
27525
  }
@@ -27556,13 +27551,13 @@ var useJournal = () => {
27556
27551
  };
27557
27552
 
27558
27553
  // src/components/JournalTable/JournalTableWithPanel.tsx
27559
- var import_react154 = require("react");
27554
+ var import_react155 = require("react");
27560
27555
 
27561
27556
  // src/components/JournalSidebar/JournalSidebar.tsx
27562
- var import_react152 = require("react");
27557
+ var import_react153 = require("react");
27563
27558
 
27564
27559
  // src/components/JournalEntryDetails/JournalEntryDetails.tsx
27565
- var import_react149 = require("react");
27560
+ var import_react150 = require("react");
27566
27561
  var import_jsx_runtime241 = require("react/jsx-runtime");
27567
27562
  var JournalEntryDetails = () => {
27568
27563
  var _a, _b, _c, _d;
@@ -27574,16 +27569,16 @@ var JournalEntryDetails = () => {
27574
27569
  selectedEntryId,
27575
27570
  reverseEntry,
27576
27571
  refetch
27577
- } = (0, import_react149.useContext)(JournalContext);
27578
- const [reverseEntryProcessing, setReverseEntryProcessing] = (0, import_react149.useState)(false);
27579
- const [reverseEntryError, setReverseEntryError] = (0, import_react149.useState)();
27580
- const entry = (0, import_react149.useMemo)(() => {
27572
+ } = (0, import_react150.useContext)(JournalContext);
27573
+ const [reverseEntryProcessing, setReverseEntryProcessing] = (0, import_react150.useState)(false);
27574
+ const [reverseEntryError, setReverseEntryError] = (0, import_react150.useState)();
27575
+ const entry = (0, import_react150.useMemo)(() => {
27581
27576
  if (selectedEntryId && data) {
27582
27577
  return data.find((x) => x.id === selectedEntryId);
27583
27578
  }
27584
27579
  return;
27585
27580
  }, [data, selectedEntryId]);
27586
- const sortedLineItems = (0, import_react149.useMemo)(
27581
+ const sortedLineItems = (0, import_react150.useMemo)(
27587
27582
  () => {
27588
27583
  var _a2;
27589
27584
  return (_a2 = entry == null ? void 0 : entry.line_items) == null ? void 0 : _a2.sort(
@@ -27761,10 +27756,10 @@ var JournalEntryDetails = () => {
27761
27756
  };
27762
27757
 
27763
27758
  // src/components/JournalForm/JournalForm.tsx
27764
- var import_react151 = require("react");
27759
+ var import_react152 = require("react");
27765
27760
 
27766
27761
  // src/components/JournalForm/JournalFormEntryLines.tsx
27767
- var import_react150 = require("react");
27762
+ var import_react151 = require("react");
27768
27763
  var import_jsx_runtime242 = require("react/jsx-runtime");
27769
27764
  function recursiveFlattenCategories(accounts) {
27770
27765
  const flattenedResult = accounts.flatMap((a) => {
@@ -27785,8 +27780,8 @@ var JournalFormEntryLines = ({
27785
27780
  config
27786
27781
  }) => {
27787
27782
  const { data: categories } = useCategories({ mode: "ALL" });
27788
- const { form } = (0, import_react150.useContext)(JournalContext);
27789
- const { flattenedCategories, parentOptions } = (0, import_react150.useMemo)(() => {
27783
+ const { form } = (0, import_react151.useContext)(JournalContext);
27784
+ const { flattenedCategories, parentOptions } = (0, import_react151.useMemo)(() => {
27790
27785
  const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
27791
27786
  const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
27792
27787
  switch (account.type) {
@@ -27897,20 +27892,19 @@ var JournalFormEntryLines = ({
27897
27892
  className: "Layer__journal__form__input-group__line-item",
27898
27893
  children: [
27899
27894
  /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(InputGroup, { name: direction, label: "Amount", inline: true, children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
27900
- InputWithBadge,
27895
+ AmountInput,
27901
27896
  {
27902
27897
  name: direction,
27903
- placeholder: "$0.00",
27904
- value: convertNumberToCurrency(item.amount),
27898
+ onChange: (value) => changeFormData("amount", value, idx2),
27899
+ value: item.amount,
27905
27900
  disabled: sendingForm,
27906
- badge: humanizeEnum(direction),
27907
- variant: item.direction === "CREDIT" ? "success" /* SUCCESS */ : "warning" /* WARNING */,
27908
- onChange: (e) => changeFormData(
27909
- "amount",
27910
- convertCurrencyToNumber(
27911
- e.target.value
27912
- ),
27913
- idx2
27901
+ allowNegativeValue: false,
27902
+ badge: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
27903
+ Badge,
27904
+ {
27905
+ variant: item.direction === "CREDIT" ? "success" /* SUCCESS */ : "warning" /* WARNING */,
27906
+ children: humanizeEnum(direction)
27907
+ }
27914
27908
  ),
27915
27909
  isInvalid: Boolean(
27916
27910
  (_a = form == null ? void 0 : form.errors) == null ? void 0 : _a.lineItems.find(
@@ -27998,7 +27992,7 @@ var JournalForm = ({
27998
27992
  changeFormData,
27999
27993
  addEntryLine,
28000
27994
  removeEntryLine
28001
- } = (0, import_react151.useContext)(JournalContext);
27995
+ } = (0, import_react152.useContext)(JournalContext);
28002
27996
  return /* @__PURE__ */ (0, import_jsx_runtime243.jsxs)(
28003
27997
  "form",
28004
27998
  {
@@ -28146,7 +28140,7 @@ var JournalSidebar = ({
28146
28140
  config,
28147
28141
  stringOverrides
28148
28142
  }) => {
28149
- const { selectedEntryId } = (0, import_react152.useContext)(JournalContext);
28143
+ const { selectedEntryId } = (0, import_react153.useContext)(JournalContext);
28150
28144
  if (selectedEntryId !== "new") {
28151
28145
  return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(JournalEntryDetails, {});
28152
28146
  }
@@ -28154,7 +28148,7 @@ var JournalSidebar = ({
28154
28148
  };
28155
28149
 
28156
28150
  // src/components/JournalTable/JournalTable.tsx
28157
- var import_react153 = require("react");
28151
+ var import_react154 = require("react");
28158
28152
  var import_date_fns40 = require("date-fns");
28159
28153
  var import_jsx_runtime245 = require("react/jsx-runtime");
28160
28154
  var accountName = (row) => {
@@ -28182,9 +28176,9 @@ var JournalTableContent = ({
28182
28176
  data,
28183
28177
  stringOverrides
28184
28178
  }) => {
28185
- const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react153.useContext)(JournalContext);
28179
+ const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react154.useContext)(JournalContext);
28186
28180
  const { isOpen, setIsOpen } = useTableExpandRow();
28187
- (0, import_react153.useEffect)(() => {
28181
+ (0, import_react154.useEffect)(() => {
28188
28182
  if (data.length > 0) {
28189
28183
  setIsOpen(data.map((x) => `journal-row-${x.id}`));
28190
28184
  }
@@ -28192,7 +28186,7 @@ var JournalTableContent = ({
28192
28186
  const renderJournalRow = (row, index, rowKey, depth) => {
28193
28187
  const expandable = !!row.line_items && row.line_items.length > 0;
28194
28188
  const expanded = expandable ? isOpen(rowKey) : true;
28195
- return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(import_react153.Fragment, { children: [
28189
+ return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(import_react154.Fragment, { children: [
28196
28190
  /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(
28197
28191
  TableRow,
28198
28192
  {
@@ -28368,7 +28362,7 @@ var JournalTableWithPanel = ({
28368
28362
  stringOverrides,
28369
28363
  view
28370
28364
  }) => {
28371
- const [currentPage, setCurrentPage] = (0, import_react154.useState)(1);
28365
+ const [currentPage, setCurrentPage] = (0, import_react155.useState)(1);
28372
28366
  const {
28373
28367
  data: rawData,
28374
28368
  isLoading,
@@ -28377,8 +28371,8 @@ var JournalTableWithPanel = ({
28377
28371
  refetch,
28378
28372
  selectedEntryId,
28379
28373
  addEntry
28380
- } = (0, import_react154.useContext)(JournalContext);
28381
- const data = (0, import_react154.useMemo)(() => {
28374
+ } = (0, import_react155.useContext)(JournalContext);
28375
+ const data = (0, import_react155.useMemo)(() => {
28382
28376
  var _a;
28383
28377
  const firstPageIndex = (currentPage - 1) * pageSize;
28384
28378
  const lastPageIndex = firstPageIndex + pageSize;
@@ -28515,7 +28509,7 @@ var TasksHeader = ({
28515
28509
  };
28516
28510
 
28517
28511
  // src/components/Tasks/TasksList.tsx
28518
- var import_react162 = require("react");
28512
+ var import_react163 = require("react");
28519
28513
 
28520
28514
  // src/icons/SmileIcon.tsx
28521
28515
  var import_jsx_runtime250 = require("react/jsx-runtime");
@@ -28574,7 +28568,7 @@ var SmileIcon = (_a) => {
28574
28568
  var SmileIcon_default = SmileIcon;
28575
28569
 
28576
28570
  // src/components/Tasks/TasksListItem.tsx
28577
- var import_react159 = require("react");
28571
+ var import_react160 = require("react");
28578
28572
  var import_classnames74 = __toESM(require("classnames"));
28579
28573
 
28580
28574
  // src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
@@ -28632,7 +28626,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
28632
28626
  }
28633
28627
 
28634
28628
  // src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
28635
- var import_react155 = require("react");
28629
+ var import_react156 = require("react");
28636
28630
  function buildKey25({
28637
28631
  access_token: accessToken,
28638
28632
  apiUrl,
@@ -28675,7 +28669,7 @@ function useSubmitUserResponseForTask() {
28675
28669
  }
28676
28670
  );
28677
28671
  const { trigger: originalTrigger } = mutationResponse;
28678
- const stableProxiedTrigger = (0, import_react155.useCallback)(
28672
+ const stableProxiedTrigger = (0, import_react156.useCallback)(
28679
28673
  (...triggerParameters) => __async(null, null, function* () {
28680
28674
  const triggerResult = yield originalTrigger(...triggerParameters);
28681
28675
  void mutate((key) => withSWRKeyTags(
@@ -28702,7 +28696,7 @@ function useSubmitUserResponseForTask() {
28702
28696
  // src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
28703
28697
  var import_swr25 = require("swr");
28704
28698
  var import_mutation16 = __toESM(require("swr/mutation"));
28705
- var import_react156 = require("react");
28699
+ var import_react157 = require("react");
28706
28700
  function buildKey26({
28707
28701
  access_token: accessToken,
28708
28702
  apiUrl,
@@ -28741,7 +28735,7 @@ function useUploadDocumentsForTask() {
28741
28735
  }
28742
28736
  );
28743
28737
  const { trigger: originalTrigger } = mutationResponse;
28744
- const stableProxiedTrigger = (0, import_react156.useCallback)(
28738
+ const stableProxiedTrigger = (0, import_react157.useCallback)(
28745
28739
  (...triggerParameters) => __async(null, null, function* () {
28746
28740
  const triggerResult = yield originalTrigger(...triggerParameters);
28747
28741
  void mutate((key) => withSWRKeyTags(
@@ -28768,7 +28762,7 @@ function useUploadDocumentsForTask() {
28768
28762
  // src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
28769
28763
  var import_swr26 = require("swr");
28770
28764
  var import_mutation17 = __toESM(require("swr/mutation"));
28771
- var import_react157 = require("react");
28765
+ var import_react158 = require("react");
28772
28766
  function buildKey27({
28773
28767
  access_token: accessToken,
28774
28768
  apiUrl,
@@ -28804,7 +28798,7 @@ function useDeleteUploadsOnTask() {
28804
28798
  }
28805
28799
  );
28806
28800
  const { trigger: originalTrigger } = mutationResponse;
28807
- const stableProxiedTrigger = (0, import_react157.useCallback)(
28801
+ const stableProxiedTrigger = (0, import_react158.useCallback)(
28808
28802
  (...triggerParameters) => __async(null, null, function* () {
28809
28803
  const triggerResult = yield originalTrigger(...triggerParameters);
28810
28804
  void mutate((key) => withSWRKeyTags(
@@ -28831,7 +28825,7 @@ function useDeleteUploadsOnTask() {
28831
28825
  // src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
28832
28826
  var import_swr27 = require("swr");
28833
28827
  var import_mutation18 = __toESM(require("swr/mutation"));
28834
- var import_react158 = require("react");
28828
+ var import_react159 = require("react");
28835
28829
  function buildKey28({
28836
28830
  access_token: accessToken,
28837
28831
  apiUrl,
@@ -28871,7 +28865,7 @@ function useUpdateTaskUploadDescription() {
28871
28865
  }
28872
28866
  );
28873
28867
  const { trigger: originalTrigger } = mutationResponse;
28874
- const stableProxiedTrigger = (0, import_react158.useCallback)(
28868
+ const stableProxiedTrigger = (0, import_react159.useCallback)(
28875
28869
  (...triggerParameters) => __async(null, null, function* () {
28876
28870
  const triggerResult = yield originalTrigger(...triggerParameters);
28877
28871
  void mutate((key) => withSWRKeyTags(
@@ -28902,9 +28896,9 @@ var TasksListItem = ({
28902
28896
  defaultOpen
28903
28897
  }) => {
28904
28898
  var _a, _b;
28905
- const [isOpen, setIsOpen] = (0, import_react159.useState)(defaultOpen);
28906
- const [userResponse, setUserResponse] = (0, import_react159.useState)((_a = task.user_response) != null ? _a : "");
28907
- const [selectedFiles, setSelectedFiles] = (0, import_react159.useState)();
28899
+ const [isOpen, setIsOpen] = (0, import_react160.useState)(defaultOpen);
28900
+ const [userResponse, setUserResponse] = (0, import_react160.useState)((_a = task.user_response) != null ? _a : "");
28901
+ const [selectedFiles, setSelectedFiles] = (0, import_react160.useState)();
28908
28902
  const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
28909
28903
  const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
28910
28904
  const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
@@ -28922,7 +28916,7 @@ var TasksListItem = ({
28922
28916
  "Layer__tasks-list-item",
28923
28917
  isOpen && "Layer__tasks-list-item__expanded"
28924
28918
  );
28925
- (0, import_react159.useEffect)(() => {
28919
+ (0, import_react160.useEffect)(() => {
28926
28920
  setIsOpen(defaultOpen);
28927
28921
  }, [defaultOpen]);
28928
28922
  const submit = () => __async(null, null, function* () {
@@ -28937,7 +28931,7 @@ var TasksListItem = ({
28937
28931
  setIsOpen(false);
28938
28932
  setSelectedFiles(void 0);
28939
28933
  });
28940
- const uploadDocumentAction = (0, import_react159.useMemo)(() => {
28934
+ const uploadDocumentAction = (0, import_react160.useMemo)(() => {
28941
28935
  if (task.user_response_type === "UPLOAD_DOCUMENT") {
28942
28936
  if (task.status === "TODO") {
28943
28937
  if (!selectedFiles) {
@@ -29082,7 +29076,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
29082
29076
  };
29083
29077
 
29084
29078
  // src/components/Tasks/TasksListMobile.tsx
29085
- var import_react160 = require("react");
29079
+ var import_react161 = require("react");
29086
29080
  var import_jsx_runtime254 = require("react/jsx-runtime");
29087
29081
  var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
29088
29082
  var TasksListMobile = ({
@@ -29093,7 +29087,7 @@ var TasksListMobile = ({
29093
29087
  pageSize,
29094
29088
  setCurrentPage
29095
29089
  }) => {
29096
- const [showMobilePanel, setShowMobilePanel] = (0, import_react160.useState)(false);
29090
+ const [showMobilePanel, setShowMobilePanel] = (0, import_react161.useState)(false);
29097
29091
  const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
29098
29092
  return /* @__PURE__ */ (0, import_jsx_runtime254.jsxs)("div", { className: "Layer__tasks-list", children: [
29099
29093
  unresolvedTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
@@ -29141,27 +29135,27 @@ var TasksListMobile = ({
29141
29135
  };
29142
29136
 
29143
29137
  // src/hooks/array/usePaginatedList.ts
29144
- var import_react161 = require("react");
29138
+ var import_react162 = require("react");
29145
29139
  function usePaginatedList(list, pageSize) {
29146
- const [internalPageIndex, setInternalPageIndex] = (0, import_react161.useState)(0);
29140
+ const [internalPageIndex, setInternalPageIndex] = (0, import_react162.useState)(0);
29147
29141
  const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
29148
29142
  const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
29149
- const pageItems = (0, import_react161.useMemo)(() => {
29143
+ const pageItems = (0, import_react162.useMemo)(() => {
29150
29144
  return list.slice(
29151
29145
  effectivePageIndex * pageSize,
29152
29146
  (effectivePageIndex + 1) * pageSize
29153
29147
  );
29154
29148
  }, [list, effectivePageIndex, pageSize]);
29155
- const next = (0, import_react161.useCallback)(() => {
29149
+ const next = (0, import_react162.useCallback)(() => {
29156
29150
  setInternalPageIndex(Math.min(effectivePageIndex + 1, pageCount - 1));
29157
29151
  }, [effectivePageIndex, pageCount]);
29158
- const set2 = (0, import_react161.useCallback)((pageIndex) => {
29152
+ const set2 = (0, import_react162.useCallback)((pageIndex) => {
29159
29153
  setInternalPageIndex(Math.max(0, Math.min(pageIndex, pageCount - 1)));
29160
29154
  }, [pageCount]);
29161
- const previous = (0, import_react161.useCallback)(() => {
29155
+ const previous = (0, import_react162.useCallback)(() => {
29162
29156
  setInternalPageIndex(Math.max(effectivePageIndex - 1, 0));
29163
29157
  }, [effectivePageIndex]);
29164
- const reset = (0, import_react161.useCallback)(() => {
29158
+ const reset = (0, import_react162.useCallback)(() => {
29165
29159
  setInternalPageIndex(0);
29166
29160
  }, []);
29167
29161
  return {
@@ -29189,7 +29183,7 @@ var TasksEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)("div
29189
29183
  ] });
29190
29184
  function TasksList({ pageSize = 8, mobile }) {
29191
29185
  const { activePeriod } = useActiveBookkeepingPeriod();
29192
- const sortedTasks = (0, import_react162.useMemo)(() => {
29186
+ const sortedTasks = (0, import_react163.useMemo)(() => {
29193
29187
  var _a;
29194
29188
  const tasksInPeriod = (_a = activePeriod == null ? void 0 : activePeriod.tasks) != null ? _a : [];
29195
29189
  return tasksInPeriod.sort((taskA, taskB) => {
@@ -29331,7 +29325,7 @@ var TasksPending = () => {
29331
29325
  };
29332
29326
 
29333
29327
  // src/components/Tasks/TasksMonthSelector.tsx
29334
- var import_react163 = require("react");
29328
+ var import_react164 = require("react");
29335
29329
  var import_date_fns42 = require("date-fns");
29336
29330
 
29337
29331
  // src/components/Tasks/TaskStatusBadge.tsx
@@ -29433,7 +29427,7 @@ function useActiveYearBookkeepingPeriods() {
29433
29427
  const { date } = useGlobalDate();
29434
29428
  const { data } = useBookkeepingPeriods();
29435
29429
  const activeYear = (0, import_date_fns42.getYear)(date);
29436
- const periodsInActiveYear = (0, import_react163.useMemo)(() => {
29430
+ const periodsInActiveYear = (0, import_react164.useMemo)(() => {
29437
29431
  return data == null ? void 0 : data.filter((period) => period.year === activeYear);
29438
29432
  }, [data, activeYear]);
29439
29433
  return { periodsInActiveYear };
@@ -29444,7 +29438,7 @@ function TasksMonthSelector() {
29444
29438
  const { periodsInActiveYear } = useActiveYearBookkeepingPeriods();
29445
29439
  const activeMonthNumber = (0, import_date_fns42.getMonth)(date) + 1;
29446
29440
  const activeYear = (0, import_date_fns42.getYear)(date);
29447
- const monthsData = (0, import_react163.useMemo)(() => {
29441
+ const monthsData = (0, import_react164.useMemo)(() => {
29448
29442
  return Array.from({ length: 12 }, (_, index) => {
29449
29443
  var _a, _b;
29450
29444
  const date2 = (0, import_date_fns42.set)(
@@ -29494,13 +29488,13 @@ var import_classnames78 = __toESM(require("classnames"));
29494
29488
  var import_pluralize3 = __toESM(require("pluralize"));
29495
29489
 
29496
29490
  // src/hooks/bookkeeping/periods/useBookkeepingYearsStatus.ts
29497
- var import_react164 = require("react");
29491
+ var import_react165 = require("react");
29498
29492
  var import_date_fns43 = require("date-fns");
29499
29493
  var useBookkeepingYearsStatus = () => {
29500
29494
  const { business } = useLayerContext();
29501
29495
  const activationDate = getActivationDate(business);
29502
29496
  const { data, isLoading } = useBookkeepingPeriods();
29503
- const yearStatuses = (0, import_react164.useMemo)(() => {
29497
+ const yearStatuses = (0, import_react165.useMemo)(() => {
29504
29498
  const startYear = (0, import_date_fns43.getYear)(activationDate != null ? activationDate : /* @__PURE__ */ new Date());
29505
29499
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
29506
29500
  const count = currentYear - startYear + 1;
@@ -29515,7 +29509,7 @@ var useBookkeepingYearsStatus = () => {
29515
29509
  };
29516
29510
  }).filter(({ year }) => data == null ? void 0 : data.some((period) => period.year === year)).sort((a, b) => b.year - a.year);
29517
29511
  }, [activationDate, data]);
29518
- const earliestIncompletePeriod = (0, import_react164.useMemo)(
29512
+ const earliestIncompletePeriod = (0, import_react165.useMemo)(
29519
29513
  () => [...data != null ? data : []].sort((a, b) => {
29520
29514
  if (a.year === b.year) {
29521
29515
  return b.month - a.month;
@@ -29658,10 +29652,10 @@ var TasksPanelNotification = ({
29658
29652
  };
29659
29653
 
29660
29654
  // src/components/Tasks/TasksYearsTabs.tsx
29661
- var import_react167 = require("react");
29655
+ var import_react168 = require("react");
29662
29656
 
29663
29657
  // src/components/Tabs/Tabs.tsx
29664
- var import_react165 = require("react");
29658
+ var import_react166 = require("react");
29665
29659
 
29666
29660
  // src/components/Tabs/Tab.tsx
29667
29661
  var import_jsx_runtime263 = require("react/jsx-runtime");
@@ -29725,12 +29719,12 @@ var Tab = ({
29725
29719
  // src/components/Tabs/Tabs.tsx
29726
29720
  var import_classnames77 = __toESM(require("classnames"));
29727
29721
  var import_jsx_runtime264 = require("react/jsx-runtime");
29728
- var import_react166 = require("react");
29722
+ var import_react167 = require("react");
29729
29723
  var STARTING_PADDING = 12;
29730
29724
  var Tabs = ({ name, options, selected, onChange }) => {
29731
- const [initialized, setInitialized] = (0, import_react165.useState)(false);
29732
- const [thumbPos, setThumbPos] = (0, import_react165.useState)({ left: 0, width: 0 });
29733
- const [currentWidth, setCurrentWidth] = (0, import_react165.useState)(0);
29725
+ const [initialized, setInitialized] = (0, import_react166.useState)(false);
29726
+ const [thumbPos, setThumbPos] = (0, import_react166.useState)({ left: 0, width: 0 });
29727
+ const [currentWidth, setCurrentWidth] = (0, import_react166.useState)(0);
29734
29728
  const selectedValue = selected || options[0].value;
29735
29729
  const baseClassName = (0, import_classnames77.default)(
29736
29730
  "Layer__tabs",
@@ -29765,14 +29759,14 @@ var Tabs = ({ name, options, selected, onChange }) => {
29765
29759
  shift2 = shift2 + STARTING_PADDING;
29766
29760
  setThumbPos({ left: shift2, width });
29767
29761
  };
29768
- (0, import_react165.useEffect)(() => {
29762
+ (0, import_react166.useEffect)(() => {
29769
29763
  const selectedIndex = getSelectedIndex();
29770
29764
  updateSelectPosition(selectedIndex);
29771
29765
  setTimeout(() => {
29772
29766
  setInitialized(true);
29773
29767
  }, 400);
29774
29768
  }, []);
29775
- (0, import_react165.useEffect)(() => {
29769
+ (0, import_react166.useEffect)(() => {
29776
29770
  const selectedIndex = getSelectedIndex();
29777
29771
  updateSelectPosition(selectedIndex);
29778
29772
  }, [selectedValue, currentWidth]);
@@ -29788,7 +29782,7 @@ var Tabs = ({ name, options, selected, onChange }) => {
29788
29782
  return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "Layer__tabs__container", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: baseClassName, ref: elementRef, children: [
29789
29783
  options.map((option, index) => {
29790
29784
  var _a;
29791
- return /* @__PURE__ */ (0, import_react166.createElement)(
29785
+ return /* @__PURE__ */ (0, import_react167.createElement)(
29792
29786
  Tab,
29793
29787
  __spreadProps(__spreadValues({}, option), {
29794
29788
  key: option.value,
@@ -29820,7 +29814,7 @@ var TasksYearsTabs = () => {
29820
29814
  yearNumber: Number(year)
29821
29815
  });
29822
29816
  };
29823
- const yearsList = (0, import_react167.useMemo)(() => {
29817
+ const yearsList = (0, import_react168.useMemo)(() => {
29824
29818
  return yearStatuses == null ? void 0 : yearStatuses.sort((a, b) => a.year - b.year).map((y) => {
29825
29819
  return {
29826
29820
  value: `${y.year}`,
@@ -29923,10 +29917,10 @@ function Tasks({
29923
29917
  }
29924
29918
 
29925
29919
  // src/components/PlatformOnboarding/LinkAccounts.tsx
29926
- var import_react170 = require("react");
29920
+ var import_react171 = require("react");
29927
29921
 
29928
29922
  // src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
29929
- var import_react168 = require("react");
29923
+ var import_react169 = require("react");
29930
29924
  var import_react_form3 = require("@tanstack/react-form");
29931
29925
 
29932
29926
  // src/components/PlatformOnboarding/Container/LinkAccountsListContainer.tsx
@@ -29962,7 +29956,7 @@ function LinkAccountsConfirmationStep() {
29962
29956
  data: linkedAccounts,
29963
29957
  loadingStatus: linkedAccountsLoadingStatus,
29964
29958
  refetchAccounts
29965
- } = (0, import_react168.useContext)(LinkedAccountsContext);
29959
+ } = (0, import_react169.useContext)(LinkedAccountsContext);
29966
29960
  const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
29967
29961
  const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
29968
29962
  const { previous, next } = useWizard();
@@ -30035,7 +30029,7 @@ function LinkAccountsConfirmationStep() {
30035
30029
  }
30036
30030
 
30037
30031
  // src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
30038
- var import_react169 = require("react");
30032
+ var import_react170 = require("react");
30039
30033
  var import_pluralize4 = __toESM(require("pluralize"));
30040
30034
  var import_jsx_runtime270 = require("react/jsx-runtime");
30041
30035
  function LinkAccountsLinkStep() {
@@ -30045,7 +30039,7 @@ function LinkAccountsLinkStep() {
30045
30039
  error,
30046
30040
  refetchAccounts,
30047
30041
  addConnection
30048
- } = (0, import_react169.useContext)(LinkedAccountsContext);
30042
+ } = (0, import_react170.useContext)(LinkedAccountsContext);
30049
30043
  const { next } = useWizard();
30050
30044
  const effectiveAccounts = data != null ? data : [];
30051
30045
  return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
@@ -30125,7 +30119,7 @@ function LinkAccounts(props) {
30125
30119
  function LinkAccountsContent({
30126
30120
  onComplete
30127
30121
  }) {
30128
- const { data: linkedAccounts, loadingStatus } = (0, import_react170.useContext)(LinkedAccountsContext);
30122
+ const { data: linkedAccounts, loadingStatus } = (0, import_react171.useContext)(LinkedAccountsContext);
30129
30123
  const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
30130
30124
  const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
30131
30125
  return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
@@ -30143,7 +30137,7 @@ function LinkAccountsContent({
30143
30137
  }
30144
30138
 
30145
30139
  // src/components/PlatformOnboarding/PlatformOnboarding.tsx
30146
- var import_react175 = require("react");
30140
+ var import_react176 = require("react");
30147
30141
 
30148
30142
  // src/components/ProgressSteps/ProgressSteps.tsx
30149
30143
  var import_jsx_runtime272 = require("react/jsx-runtime");
@@ -30526,7 +30520,7 @@ function useBusinessPersonnel() {
30526
30520
  // src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
30527
30521
  var import_mutation19 = __toESM(require("swr/mutation"));
30528
30522
  var import_swr29 = require("swr");
30529
- var import_react171 = require("react");
30523
+ var import_react172 = require("react");
30530
30524
  var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
30531
30525
  function buildKey30({
30532
30526
  access_token: accessToken,
@@ -30564,7 +30558,7 @@ function useCreateBusinessPersonnel() {
30564
30558
  }
30565
30559
  );
30566
30560
  const { trigger: originalTrigger } = mutationResponse;
30567
- const stableProxiedTrigger = (0, import_react171.useCallback)(
30561
+ const stableProxiedTrigger = (0, import_react172.useCallback)(
30568
30562
  (...triggerParameters) => __async(null, null, function* () {
30569
30563
  const triggerResult = yield originalTrigger(...triggerParameters);
30570
30564
  void mutate((key) => withSWRKeyTags(
@@ -30598,7 +30592,7 @@ var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
30598
30592
  });
30599
30593
 
30600
30594
  // src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
30601
- var import_react172 = require("react");
30595
+ var import_react173 = require("react");
30602
30596
  function buildKey31({
30603
30597
  access_token: accessToken,
30604
30598
  apiUrl,
@@ -30641,7 +30635,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
30641
30635
  }
30642
30636
  );
30643
30637
  const { trigger: originalTrigger } = mutationResponse;
30644
- const stableProxiedTrigger = (0, import_react172.useCallback)(
30638
+ const stableProxiedTrigger = (0, import_react173.useCallback)(
30645
30639
  (...triggerParameters) => __async(null, null, function* () {
30646
30640
  const triggerResult = yield originalTrigger(...triggerParameters);
30647
30641
  void mutate((key) => withSWRKeyTags(
@@ -30668,7 +30662,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
30668
30662
  // src/hooks/business/useUpdateBusiness.ts
30669
30663
  var import_mutation21 = __toESM(require("swr/mutation"));
30670
30664
  var import_swr31 = require("swr");
30671
- var import_react173 = require("react");
30665
+ var import_react174 = require("react");
30672
30666
  var BUSINESS_TAG_KEY = "business";
30673
30667
  function buildKey32({
30674
30668
  access_token: accessToken,
@@ -30706,7 +30700,7 @@ function useUpdateBusiness() {
30706
30700
  }
30707
30701
  );
30708
30702
  const { trigger: originalTrigger } = mutationResponse;
30709
- const stableProxiedTrigger = (0, import_react173.useCallback)(
30703
+ const stableProxiedTrigger = (0, import_react174.useCallback)(
30710
30704
  (...triggerParameters) => __async(null, null, function* () {
30711
30705
  const triggerResult = yield originalTrigger(...triggerParameters);
30712
30706
  void mutate((key) => withSWRKeyTags(
@@ -30731,7 +30725,7 @@ function useUpdateBusiness() {
30731
30725
  }
30732
30726
 
30733
30727
  // src/components/BusinessForm/useBusinessForm.ts
30734
- var import_react174 = require("react");
30728
+ var import_react175 = require("react");
30735
30729
  var getPerson = (personnel) => {
30736
30730
  const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
30737
30731
  if (owners && owners.length > 0) {
@@ -30742,7 +30736,7 @@ var getPerson = (personnel) => {
30742
30736
  var useBusinessForm = ({ onSuccess }) => {
30743
30737
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
30744
30738
  const { business } = useLayerContext();
30745
- const [submitError, setSubmitError] = (0, import_react174.useState)(void 0);
30739
+ const [submitError, setSubmitError] = (0, import_react175.useState)(void 0);
30746
30740
  const { data: personnel } = useBusinessPersonnel();
30747
30741
  const person = getPerson(personnel);
30748
30742
  const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
@@ -31158,7 +31152,7 @@ var PLATFORM_ONBOARDING_STEPS = [
31158
31152
  }
31159
31153
  ];
31160
31154
  var PlatformOnboarding = ({ onComplete }) => {
31161
- const [step, setStep] = (0, import_react175.useState)(PLATFORM_ONBOARDING_STEPS[0].id);
31155
+ const [step, setStep] = (0, import_react176.useState)(PLATFORM_ONBOARDING_STEPS[0].id);
31162
31156
  const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
31163
31157
  const nextStep = () => {
31164
31158
  const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
@@ -31320,7 +31314,7 @@ var BookkeepingUpsellBar = ({
31320
31314
  };
31321
31315
 
31322
31316
  // src/views/BookkeepingOverview/BookkeepingOverview.tsx
31323
- var import_react177 = require("react");
31317
+ var import_react178 = require("react");
31324
31318
 
31325
31319
  // src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
31326
31320
  var import_jsx_runtime286 = require("react/jsx-runtime");
@@ -31335,15 +31329,15 @@ function BookkeepingProfitAndLossSummariesContainer({
31335
31329
  var import_classnames79 = __toESM(require("classnames"));
31336
31330
 
31337
31331
  // src/views/BookkeepingOverview/useKeepInMobileViewport.tsx
31338
- var import_react176 = require("react");
31332
+ var import_react177 = require("react");
31339
31333
  var TASKS_MOBILE_VIEWPORT_WIDTH = 1100;
31340
31334
  var useKeepInMobileViewport = () => {
31341
- const upperContentRef = (0, import_react176.useRef)(null);
31342
- const targetElementRef = (0, import_react176.useRef)(null);
31343
- const lastKnownSizeRef = (0, import_react176.useRef)(null);
31344
- const lastKnownTargetPositionRef = (0, import_react176.useRef)(null);
31345
- const upperElementInFocus = (0, import_react176.useRef)(false);
31346
- (0, import_react176.useEffect)(() => {
31335
+ const upperContentRef = (0, import_react177.useRef)(null);
31336
+ const targetElementRef = (0, import_react177.useRef)(null);
31337
+ const lastKnownSizeRef = (0, import_react177.useRef)(null);
31338
+ const lastKnownTargetPositionRef = (0, import_react177.useRef)(null);
31339
+ const upperElementInFocus = (0, import_react177.useRef)(false);
31340
+ (0, import_react177.useEffect)(() => {
31347
31341
  if (!upperContentRef.current || !targetElementRef.current) return;
31348
31342
  lastKnownSizeRef.current = upperContentRef.current.getBoundingClientRect().height;
31349
31343
  lastKnownTargetPositionRef.current = targetElementRef.current.getBoundingClientRect().top;
@@ -31400,7 +31394,7 @@ var BookkeepingOverview = ({
31400
31394
  slotProps
31401
31395
  }) => {
31402
31396
  var _a, _b, _c, _d, _e, _f;
31403
- const [pnlToggle, setPnlToggle] = (0, import_react177.useState)("expenses");
31397
+ const [pnlToggle, setPnlToggle] = (0, import_react178.useState)("expenses");
31404
31398
  const [width] = useWindowSize();
31405
31399
  const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
31406
31400
  const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
@@ -31531,7 +31525,7 @@ var BookkeepingOverview = ({
31531
31525
  };
31532
31526
 
31533
31527
  // src/views/AccountingOverview/AccountingOverview.tsx
31534
- var import_react178 = require("react");
31528
+ var import_react179 = require("react");
31535
31529
  var import_classnames80 = __toESM(require("classnames"));
31536
31530
  var import_jsx_runtime288 = require("react/jsx-runtime");
31537
31531
  var AccountingOverview = ({
@@ -31547,7 +31541,7 @@ var AccountingOverview = ({
31547
31541
  slotProps
31548
31542
  }) => {
31549
31543
  var _a, _b, _c, _d, _e;
31550
- const [pnlToggle, setPnlToggle] = (0, import_react178.useState)("expenses");
31544
+ const [pnlToggle, setPnlToggle] = (0, import_react179.useState)("expenses");
31551
31545
  const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
31552
31546
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
31553
31547
  ProfitAndLoss,
@@ -31714,7 +31708,7 @@ var BankTransactionsWithLinkedAccounts = ({
31714
31708
  };
31715
31709
 
31716
31710
  // src/views/GeneralLedger/GeneralLedger.tsx
31717
- var import_react179 = require("react");
31711
+ var import_react180 = require("react");
31718
31712
  var import_jsx_runtime290 = require("react/jsx-runtime");
31719
31713
  var GeneralLedgerView = ({
31720
31714
  title,
@@ -31723,7 +31717,7 @@ var GeneralLedgerView = ({
31723
31717
  stringOverrides,
31724
31718
  chartOfAccountsOptions
31725
31719
  }) => {
31726
- const [activeTab, setActiveTab] = (0, import_react179.useState)("chartOfAccounts");
31720
+ const [activeTab, setActiveTab] = (0, import_react180.useState)("chartOfAccounts");
31727
31721
  return /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ (0, import_jsx_runtime290.jsxs)(
31728
31722
  View,
31729
31723
  {
@@ -31765,7 +31759,7 @@ var GeneralLedgerView = ({
31765
31759
  };
31766
31760
 
31767
31761
  // src/views/ProjectProfitability/ProjectProfitability.tsx
31768
- var import_react180 = require("react");
31762
+ var import_react181 = require("react");
31769
31763
  var import_react_select6 = __toESM(require("react-select"));
31770
31764
  var import_jsx_runtime291 = require("react/jsx-runtime");
31771
31765
  var ProjectProfitabilityView = ({
@@ -31775,9 +31769,9 @@ var ProjectProfitabilityView = ({
31775
31769
  datePickerMode = "monthPicker",
31776
31770
  csvMoneyFormat = "DOLLAR_STRING"
31777
31771
  }) => {
31778
- const [activeTab, setActiveTab] = (0, import_react180.useState)("overview");
31779
- const [tagFilter, setTagFilter] = (0, import_react180.useState)(null);
31780
- const [pnlTagFilter, setPnlTagFilter] = (0, import_react180.useState)(
31772
+ const [activeTab, setActiveTab] = (0, import_react181.useState)("overview");
31773
+ const [tagFilter, setTagFilter] = (0, import_react181.useState)(null);
31774
+ const [pnlTagFilter, setPnlTagFilter] = (0, import_react181.useState)(
31781
31775
  void 0
31782
31776
  );
31783
31777
  const isOptionSelected = (option, selectValue) => {
@@ -31876,7 +31870,7 @@ var ProjectProfitabilityView = ({
31876
31870
  };
31877
31871
 
31878
31872
  // src/views/Reports/Reports.tsx
31879
- var import_react181 = require("react");
31873
+ var import_react182 = require("react");
31880
31874
  var import_jsx_runtime292 = require("react/jsx-runtime");
31881
31875
  var getOptions = (enabledReports) => {
31882
31876
  return [
@@ -31904,7 +31898,7 @@ var Reports = ({
31904
31898
  statementOfCashFlowConfig
31905
31899
  }) => {
31906
31900
  var _a;
31907
- const [activeTab, setActiveTab] = (0, import_react181.useState)(enabledReports[0]);
31901
+ const [activeTab, setActiveTab] = (0, import_react182.useState)(enabledReports[0]);
31908
31902
  const { view, containerRef } = useElementViewSize();
31909
31903
  const options = getOptions(enabledReports);
31910
31904
  const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
@@ -31966,11 +31960,11 @@ var ReportsPanel = ({
31966
31960
  };
31967
31961
 
31968
31962
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
31969
- var import_react182 = require("react");
31963
+ var import_react183 = require("react");
31970
31964
  var import_jsx_runtime293 = require("react/jsx-runtime");
31971
31965
  var COMPONENT_NAME8 = "profit-and-loss";
31972
31966
  var ProfitAndLossView = (props) => {
31973
- const containerRef = (0, import_react182.useRef)(null);
31967
+ const containerRef = (0, import_react183.useRef)(null);
31974
31968
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(Container, { name: COMPONENT_NAME8, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(ProfitAndLoss, { children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
31975
31969
  };
31976
31970
  var ProfitAndLossPanel = (_a) => {
@@ -31981,7 +31975,7 @@ var ProfitAndLossPanel = (_a) => {
31981
31975
  "containerRef",
31982
31976
  "stringOverrides"
31983
31977
  ]);
31984
- const { sidebarScope } = (0, import_react182.useContext)(ProfitAndLoss.Context);
31978
+ const { sidebarScope } = (0, import_react183.useContext)(ProfitAndLoss.Context);
31985
31979
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
31986
31980
  Panel,
31987
31981
  {
@@ -32012,7 +32006,7 @@ var Components = ({
32012
32006
  hideTable = false,
32013
32007
  stringOverrides
32014
32008
  }) => {
32015
- const { error, isLoading, isValidating, refetch } = (0, import_react182.useContext)(
32009
+ const { error, isLoading, isValidating, refetch } = (0, import_react183.useContext)(
32016
32010
  ProfitAndLoss.Context
32017
32011
  );
32018
32012
  if (!isLoading && error) {