@updog/data-editor-wc 0.1.48 → 0.1.49

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.
Files changed (3) hide show
  1. package/index.css +1 -1
  2. package/index.js +546 -450
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -32667,7 +32667,7 @@ var p_ = ({ children: e, anchor: t, items: n, onSelect: r, onOpenChange: i }) =>
32667
32667
  }, t))
32668
32668
  }), h_ = ({ ref: e, dir: t, style: n, originalItems: r, currentItems: i, empty: a }) => /* @__PURE__ */ (0, O.jsxs)("div", {
32669
32669
  ref: e,
32670
- className: "updog-grid-tooltip updog-grid-tooltip--dirty updog-grid-tooltip--multiselect",
32670
+ className: N("updog-grid-tooltip updog-grid-tooltip--dirty updog-grid-tooltip--multiselect", r.length === 1 && i.length === 1 && "updog-grid-tooltip--multiselect-single"),
32671
32671
  dir: t,
32672
32672
  style: n,
32673
32673
  children: [
@@ -45799,7 +45799,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
45799
45799
  return this.state.hasError ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: Oj }) : this.props.children;
45800
45800
  }
45801
45801
  }, Aj = ({ leftSlot: e }) => {
45802
- let { variant: t, setShowUploader: n } = th(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } = dN(), v = i && t === "editor", b = (0, y.useCallback)(() => {
45802
+ let { variant: t, setShowUploader: n } = th(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } = TN(), v = i && t === "editor", b = (0, y.useCallback)(() => {
45803
45803
  n(!1);
45804
45804
  }, [n]), x = p[m]?.id === "sheet-selection", S = (0, y.useCallback)(() => {
45805
45805
  a ? c() : x ? g() : o();
@@ -46567,73 +46567,16 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46567
46567
  i[e] = n, n && a.add(n);
46568
46568
  }
46569
46569
  return i;
46570
- }, Qj = (0, y.memo)(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, onSelectChange: a, onClear: o }) => {
46571
- let { t: s } = j(), c = (0, y.useCallback)((t) => {
46572
- a(e, t);
46573
- }, [e, a]), l = (0, y.useCallback)(() => {
46574
- o(e, void 0);
46575
- }, [e, o]);
46576
- return /* @__PURE__ */ (0, O.jsxs)("div", {
46577
- className: "updog__column-matching__row",
46578
- children: [
46579
- /* @__PURE__ */ (0, O.jsx)("div", {
46580
- className: "updog__column-matching__column",
46581
- children: /* @__PURE__ */ (0, O.jsx)("div", {
46582
- className: "updog__column-matching__csv-header",
46583
- children: /* @__PURE__ */ (0, O.jsx)(tc, { children: e })
46584
- })
46585
- }),
46586
- /* @__PURE__ */ (0, O.jsx)("div", {
46587
- className: "updog__column-matching__arrow-container",
46588
- children: /* @__PURE__ */ (0, O.jsx)(te, {
46589
- size: "1.25rem",
46590
- className: N("updog__column-matching__arrow", "rtl-mirror", t ? "updog__column-matching__arrow--matched" : "updog__column-matching__arrow--unmatched")
46591
- })
46592
- }),
46593
- /* @__PURE__ */ (0, O.jsx)("div", {
46594
- className: "updog__column-matching__column",
46595
- children: /* @__PURE__ */ (0, O.jsx)(jc, {
46596
- options: n,
46597
- value: t,
46598
- onChange: c,
46599
- onClear: l,
46600
- placeholder: i
46601
- })
46602
- }),
46603
- /* @__PURE__ */ (0, O.jsxs)("div", {
46604
- className: "updog__column-matching__action",
46605
- children: [t?.startsWith("__dynamic__:") && r && /* @__PURE__ */ (0, O.jsx)(Hs, {
46606
- content: /* @__PURE__ */ (0, O.jsx)(W, {
46607
- size: "sm",
46608
- children: s("dataEditor.uploader.matchColumns.createColumnWarning")
46609
- }),
46610
- placement: "bottom-end",
46611
- children: /* @__PURE__ */ (0, O.jsx)(He, {
46612
- size: "1.25rem",
46613
- className: "updog__column-matching__action-icon"
46614
- })
46615
- }), !t && /* @__PURE__ */ (0, O.jsx)(Hs, {
46616
- content: /* @__PURE__ */ (0, O.jsx)(W, {
46617
- size: "sm",
46618
- children: s("dataEditor.uploader.matchColumns.unmatchedWarning")
46619
- }),
46620
- placement: "bottom-end",
46621
- children: /* @__PURE__ */ (0, O.jsx)(be, {
46622
- size: "1.25rem",
46623
- className: "updog__column-matching__info-icon"
46624
- })
46625
- })]
46626
- })
46627
- ]
46628
- });
46629
- }), $j = () => {
46630
- let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = dN(), [l, u] = (0, y.useState)(null), d = (0, y.useRef)(null), f = (0, y.useCallback)((e, t) => {
46570
+ }, Qj = () => {
46571
+ let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = TN(), [l, u] = (0, y.useState)(null), d = (0, y.useRef)(null), f = i?.headers ?? [], p = (0, y.useRef)(null);
46572
+ p.current === null && (p.current = Zj(f, e, n));
46573
+ let m = (0, y.useCallback)((e, t) => {
46631
46574
  if (t === "action:create") {
46632
46575
  d.current = e, u({ title: e });
46633
46576
  return;
46634
46577
  }
46635
46578
  o(e, t);
46636
- }, [o]), p = (0, y.useCallback)((e) => {
46579
+ }, [o]), h = (0, y.useCallback)((e) => {
46637
46580
  if (d.current === null) return;
46638
46581
  let t = Math.random().toString(36).slice(2, 7), n = `${ad}${e.title}-${t}`;
46639
46582
  c((t) => [...t, {
@@ -46641,11 +46584,9 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46641
46584
  id: n,
46642
46585
  size: 150
46643
46586
  }]), o(d.current, n), d.current = null, u(null);
46644
- }, [o, c]), m = (0, y.useCallback)(() => {
46587
+ }, [o, c]), g = (0, y.useCallback)(() => {
46645
46588
  d.current = null, u(null);
46646
- }, []), h = (0, y.useMemo)(() => [...e.map((e) => e.title), ...s.map((e) => e.title)], [e, s]), g = i?.headers ?? [], _ = (0, y.useRef)(null);
46647
- _.current === null && (_.current = Zj(g, e, n));
46648
- let v = (0, y.useMemo)(() => {
46589
+ }, []), _ = (0, y.useMemo)(() => [...e.map((e) => e.title), ...s.map((e) => e.title)], [e, s]), v = (0, y.useMemo)(() => {
46649
46590
  let n = {
46650
46591
  text: r("dataEditor.uploader.matchColumns.bestMatch"),
46651
46592
  color: "green"
@@ -46653,8 +46594,8 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46653
46594
  text: r("dataEditor.uploader.matchColumns.newColumnTag"),
46654
46595
  color: "blue"
46655
46596
  }, a = r("dataEditor.uploader.matchColumns.createColumn");
46656
- return Object.fromEntries(g.map((r) => {
46657
- let o = _.current?.[r], c = e.map((e) => ({
46597
+ return Object.fromEntries(f.map((r) => {
46598
+ let o = p.current?.[r], c = e.map((e) => ({
46658
46599
  id: e.id,
46659
46600
  text: e.title,
46660
46601
  ...e.id === o && { tag: n }
@@ -46674,78 +46615,177 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46674
46615
  }), [r, c];
46675
46616
  }));
46676
46617
  }, [
46677
- g,
46618
+ f,
46678
46619
  e,
46679
46620
  s,
46680
46621
  r,
46681
46622
  t
46682
- ]), b = (0, y.useMemo)(() => g.filter((e) => a[e]).length, [g, a]), x = b === g.length, S = r("dataEditor.uploader.matchColumns.selectColumnPlaceholder");
46623
+ ]), b = (0, y.useMemo)(() => f.filter((e) => a[e]).length, [f, a]);
46624
+ return {
46625
+ headers: f,
46626
+ matchedCount: b,
46627
+ allMatched: b === f.length,
46628
+ placeholder: r("dataEditor.uploader.matchColumns.selectColumnPlaceholder"),
46629
+ existingNames: _,
46630
+ createModalValues: l,
46631
+ getRowData: (0, y.useCallback)((e) => ({
46632
+ mappedValue: a[e],
46633
+ options: v[e],
46634
+ autoMatchId: p.current?.[e]
46635
+ }), [a, v]),
46636
+ onSelectChange: m,
46637
+ onClear: o,
46638
+ submitCreate: h,
46639
+ closeCreate: g
46640
+ };
46641
+ }, $j = (0, y.createContext)(null);
46642
+ function eM({ children: e }) {
46643
+ let t = Qj();
46644
+ return /* @__PURE__ */ (0, O.jsx)($j.Provider, {
46645
+ value: t,
46646
+ children: e
46647
+ });
46648
+ }
46649
+ var tM = () => {
46650
+ let e = (0, y.useContext)($j);
46651
+ if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
46652
+ return e;
46653
+ }, nM = () => {
46654
+ let { t: e } = j(), { matchedCount: t, allMatched: n, headers: r } = tM(), i = n ? "green" : "yellow";
46655
+ return /* @__PURE__ */ (0, O.jsx)("header", {
46656
+ className: "updog__column-matching__header",
46657
+ children: /* @__PURE__ */ (0, O.jsxs)("div", {
46658
+ className: "updog__column-matching__header-content",
46659
+ children: [
46660
+ /* @__PURE__ */ (0, O.jsxs)("div", {
46661
+ className: "updog__column-matching__header-column updog__column-matching__header-column--with-items",
46662
+ children: [/* @__PURE__ */ (0, O.jsx)(W, {
46663
+ as: "div",
46664
+ size: "sm",
46665
+ weight: "medium",
46666
+ children: e("dataEditor.uploader.matchColumns.importedColumns")
46667
+ }), /* @__PURE__ */ (0, O.jsx)(sc, {
46668
+ color: i,
46669
+ text: e("dataEditor.uploader.matchColumns.matchedCount", {
46670
+ matched: t,
46671
+ total: r.length
46672
+ })
46673
+ })]
46674
+ }),
46675
+ /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__column-matching__header-spacer" }),
46676
+ /* @__PURE__ */ (0, O.jsx)(W, {
46677
+ as: "div",
46678
+ size: "sm",
46679
+ weight: "medium",
46680
+ className: "updog__column-matching__header-column",
46681
+ children: e("dataEditor.uploader.matchColumns.targetColumns")
46682
+ }),
46683
+ /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__column-matching__action" })
46684
+ ]
46685
+ })
46686
+ });
46687
+ }, rM = (0, y.memo)(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, onSelectChange: a, onClear: o }) => {
46688
+ let { t: s } = j(), c = !t, l = t?.startsWith("__dynamic__:") && !!r, u = (0, y.useCallback)((t) => {
46689
+ a(e, t);
46690
+ }, [e, a]), d = (0, y.useCallback)(() => {
46691
+ o(e, void 0);
46692
+ }, [e, o]);
46683
46693
  return /* @__PURE__ */ (0, O.jsxs)("div", {
46684
- className: "updog__column-matching",
46694
+ className: "updog__column-matching__row",
46685
46695
  children: [
46686
- /* @__PURE__ */ (0, O.jsx)("header", {
46687
- className: "updog__column-matching__header",
46688
- children: /* @__PURE__ */ (0, O.jsxs)("div", {
46689
- className: "updog__column-matching__header-content",
46690
- children: [
46691
- /* @__PURE__ */ (0, O.jsxs)("div", {
46692
- className: "updog__column-matching__header-column updog__column-matching__header-column--with-items",
46693
- children: [/* @__PURE__ */ (0, O.jsx)(W, {
46694
- as: "div",
46695
- size: "sm",
46696
- weight: "medium",
46697
- children: r("dataEditor.uploader.matchColumns.importedColumns")
46698
- }), /* @__PURE__ */ (0, O.jsx)(sc, {
46699
- color: x ? "green" : "yellow",
46700
- text: r("dataEditor.uploader.matchColumns.matchedCount", {
46701
- matched: b,
46702
- total: g.length
46703
- })
46704
- })]
46705
- }),
46706
- /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__column-matching__header-spacer" }),
46707
- /* @__PURE__ */ (0, O.jsx)(W, {
46708
- as: "div",
46709
- size: "sm",
46710
- weight: "medium",
46711
- className: "updog__column-matching__header-column",
46712
- children: r("dataEditor.uploader.matchColumns.targetColumns")
46713
- }),
46714
- /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__column-matching__action" })
46715
- ]
46696
+ /* @__PURE__ */ (0, O.jsx)("div", {
46697
+ className: "updog__column-matching__column",
46698
+ children: /* @__PURE__ */ (0, O.jsx)("div", {
46699
+ className: "updog__column-matching__csv-header",
46700
+ children: /* @__PURE__ */ (0, O.jsx)(tc, { children: e })
46716
46701
  })
46717
46702
  }),
46718
46703
  /* @__PURE__ */ (0, O.jsx)("div", {
46719
- className: "updog__column-matching__content",
46720
- children: /* @__PURE__ */ (0, O.jsx)("div", {
46721
- className: "updog__column-matching__content-inner",
46722
- children: g.map((e) => /* @__PURE__ */ (0, O.jsx)(Qj, {
46723
- csvHeader: e,
46724
- mappedValue: a[e],
46725
- options: v[e],
46726
- autoMatchId: _.current?.[e],
46727
- placeholder: S,
46728
- onSelectChange: f,
46729
- onClear: o
46730
- }, e))
46704
+ className: "updog__column-matching__arrow-container",
46705
+ children: /* @__PURE__ */ (0, O.jsx)(te, {
46706
+ size: "1.25rem",
46707
+ className: N("updog__column-matching__arrow", "rtl-mirror", c ? "updog__column-matching__arrow--unmatched" : "updog__column-matching__arrow--matched")
46708
+ })
46709
+ }),
46710
+ /* @__PURE__ */ (0, O.jsx)("div", {
46711
+ className: "updog__column-matching__column",
46712
+ children: /* @__PURE__ */ (0, O.jsx)(jc, {
46713
+ options: n,
46714
+ value: t,
46715
+ onChange: u,
46716
+ onClear: d,
46717
+ placeholder: i
46731
46718
  })
46732
46719
  }),
46733
- l && /* @__PURE__ */ (0, O.jsx)($h, {
46734
- open: !0,
46735
- onClose: m,
46736
- initialValues: l,
46737
- existingNames: h,
46738
- onSubmit: p
46720
+ /* @__PURE__ */ (0, O.jsxs)("div", {
46721
+ className: "updog__column-matching__action",
46722
+ children: [l && /* @__PURE__ */ (0, O.jsx)(Hs, {
46723
+ content: /* @__PURE__ */ (0, O.jsx)(W, {
46724
+ size: "sm",
46725
+ children: s("dataEditor.uploader.matchColumns.createColumnWarning")
46726
+ }),
46727
+ placement: "bottom-end",
46728
+ children: /* @__PURE__ */ (0, O.jsx)(He, {
46729
+ size: "1.25rem",
46730
+ className: "updog__column-matching__action-icon"
46731
+ })
46732
+ }), c && /* @__PURE__ */ (0, O.jsx)(Hs, {
46733
+ content: /* @__PURE__ */ (0, O.jsx)(W, {
46734
+ size: "sm",
46735
+ children: s("dataEditor.uploader.matchColumns.unmatchedWarning")
46736
+ }),
46737
+ placement: "bottom-end",
46738
+ children: /* @__PURE__ */ (0, O.jsx)(be, {
46739
+ size: "1.25rem",
46740
+ className: "updog__column-matching__info-icon"
46741
+ })
46742
+ })]
46739
46743
  })
46740
46744
  ]
46741
46745
  });
46742
- }, eM = () => {
46743
- let { parsedCsv: e } = dN();
46746
+ }), iM = () => {
46747
+ let { headers: e, placeholder: t, getRowData: n, onSelectChange: r, onClear: i } = tM();
46748
+ return /* @__PURE__ */ (0, O.jsx)("div", {
46749
+ className: "updog__column-matching__content",
46750
+ children: /* @__PURE__ */ (0, O.jsx)("div", {
46751
+ className: "updog__column-matching__content-inner",
46752
+ children: e.map((e) => {
46753
+ let { mappedValue: a, options: o, autoMatchId: s } = n(e);
46754
+ return /* @__PURE__ */ (0, O.jsx)(rM, {
46755
+ csvHeader: e,
46756
+ mappedValue: a,
46757
+ options: o,
46758
+ autoMatchId: s,
46759
+ placeholder: t,
46760
+ onSelectChange: r,
46761
+ onClear: i
46762
+ }, e);
46763
+ })
46764
+ })
46765
+ });
46766
+ }, aM = () => {
46767
+ let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = tM();
46768
+ return e ? /* @__PURE__ */ (0, O.jsx)($h, {
46769
+ open: !0,
46770
+ onClose: r,
46771
+ initialValues: e,
46772
+ existingNames: t,
46773
+ onSubmit: n
46774
+ }) : null;
46775
+ }, oM = () => /* @__PURE__ */ (0, O.jsxs)("div", {
46776
+ className: "updog__column-matching",
46777
+ children: [
46778
+ /* @__PURE__ */ (0, O.jsx)(nM, {}),
46779
+ /* @__PURE__ */ (0, O.jsx)(iM, {}),
46780
+ /* @__PURE__ */ (0, O.jsx)(aM, {})
46781
+ ]
46782
+ }), sM = () => {
46783
+ let { parsedCsv: e } = TN();
46744
46784
  return e ? /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
46745
46785
  className: "updog__step-column-matching__content updog__scrollbar",
46746
- children: /* @__PURE__ */ (0, O.jsx)($j, {})
46786
+ children: /* @__PURE__ */ (0, O.jsx)(eM, { children: /* @__PURE__ */ (0, O.jsx)(oM, {}) })
46747
46787
  }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }) : null;
46748
- }, tM = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
46788
+ }, cM = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
46749
46789
  let { t: a } = j();
46750
46790
  return /* @__PURE__ */ (0, O.jsx)(vs, {
46751
46791
  open: e,
@@ -46758,13 +46798,13 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46758
46798
  onSubmit: i
46759
46799
  })
46760
46800
  });
46761
- }, nM = [
46801
+ }, lM = [
46762
46802
  ",",
46763
46803
  ";",
46764
46804
  "|",
46765
46805
  "\n",
46766
46806
  " "
46767
- ], rM = (e, t, n) => {
46807
+ ], uM = (e, t, n) => {
46768
46808
  let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
46769
46809
  if (e.trim() === "") return [];
46770
46810
  if (i(e)) return [e.trim()];
@@ -46776,27 +46816,27 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46776
46816
  a.push(e);
46777
46817
  continue;
46778
46818
  }
46779
- a.push(...iM(e, t, i));
46819
+ a.push(...dM(e, t, i));
46780
46820
  }
46781
46821
  }
46782
46822
  return a;
46783
- }, iM = (e, t, n) => {
46784
- for (let r of nM) {
46823
+ }, dM = (e, t, n) => {
46824
+ for (let r of lM) {
46785
46825
  if (r === t || !e.includes(r)) continue;
46786
46826
  let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
46787
46827
  if (i.length >= 2 && i.every(n)) return i;
46788
46828
  }
46789
46829
  return [e];
46790
- }, aM = (e, t, n, r) => {
46830
+ }, fM = (e, t, n, r) => {
46791
46831
  let i = /* @__PURE__ */ new Set();
46792
46832
  for (let a of e) {
46793
46833
  let e = a[t];
46794
- if (!(e === void 0 || e === "")) if (r) for (let t of rM(e, r, n)) i.add(t);
46834
+ if (!(e === void 0 || e === "")) if (r) for (let t of uM(e, r, n)) i.add(t);
46795
46835
  else i.add(e);
46796
46836
  }
46797
46837
  return [...i];
46798
- }, oM = () => {
46799
- let { columns: e } = th(), { t } = j(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, multiselectDelimiters: s, setMultiselectDelimiter: c, reapplyMultiselectDelimiter: l, pendingOptions: u, addPendingOption: d } = dN(), [f, p] = (0, y.useState)({}), [m, h] = (0, y.useState)({}), [g, _] = (0, y.useState)(null), v = (0, y.useRef)(!1), b = (0, y.useMemo)(() => {
46838
+ }, pM = () => {
46839
+ let { columns: e } = th(), { t } = j(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, multiselectDelimiters: s, setMultiselectDelimiter: c, reapplyMultiselectDelimiter: l, pendingOptions: u, addPendingOption: d } = TN(), [f, p] = (0, y.useState)({}), [m, h] = (0, y.useState)({}), [g, _] = (0, y.useState)(null), v = (0, y.useRef)(!1), b = (0, y.useMemo)(() => {
46800
46840
  if (!n) return [];
46801
46841
  let t = [];
46802
46842
  for (let [a, o] of Object.entries(r)) {
@@ -46805,7 +46845,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46805
46845
  if (!r?.editor) continue;
46806
46846
  let c = r.editor.type;
46807
46847
  if (c !== "select" && c !== "multiselect") continue;
46808
- let l = r.editor.options, u = i[o] ?? {}, d = c === "multiselect", f = d ? s[o] ?? null : null, p = aM(n.rows, a, l, f).map((e) => ({
46848
+ let l = r.editor.options, u = i[o] ?? {}, d = c === "multiselect", f = d ? s[o] ?? null : null, p = fM(n.rows, a, l, f).map((e) => ({
46809
46849
  imported: e,
46810
46850
  mapped: u[e]
46811
46851
  }));
@@ -46926,20 +46966,20 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46926
46966
  submitCreate: N,
46927
46967
  closeCreate: P
46928
46968
  };
46929
- }, sM = (0, y.createContext)(null);
46930
- function cM({ children: e }) {
46931
- let t = oM();
46932
- return /* @__PURE__ */ (0, O.jsx)(sM.Provider, {
46969
+ }, mM = (0, y.createContext)(null);
46970
+ function hM({ children: e }) {
46971
+ let t = pM();
46972
+ return /* @__PURE__ */ (0, O.jsx)(mM.Provider, {
46933
46973
  value: t,
46934
46974
  children: e
46935
46975
  });
46936
46976
  }
46937
- var lM = () => {
46938
- let e = (0, y.useContext)(sM);
46977
+ var gM = () => {
46978
+ let e = (0, y.useContext)(mM);
46939
46979
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
46940
46980
  return e;
46941
- }, uM = ({ section: e }) => {
46942
- let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = lM(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = (0, y.useCallback)((t) => i(e.columnId, t), [i, e.columnId]), l = (0, y.useCallback)(() => a(e.columnId), [a, e.columnId]);
46981
+ }, _M = ({ section: e }) => {
46982
+ let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = gM(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = (0, y.useCallback)((t) => i(e.columnId, t), [i, e.columnId]), l = (0, y.useCallback)(() => a(e.columnId), [a, e.columnId]);
46943
46983
  return /* @__PURE__ */ (0, O.jsxs)("header", {
46944
46984
  className: "updog__value-matching__section-header",
46945
46985
  children: [/* @__PURE__ */ (0, O.jsx)("div", {
@@ -46983,14 +47023,14 @@ var lM = () => {
46983
47023
  })
46984
47024
  })]
46985
47025
  });
46986
- }, dM = {
47026
+ }, vM = {
46987
47027
  ",": ",",
46988
47028
  ";": ";",
46989
47029
  "|": "|",
46990
47030
  "\n": "\\n",
46991
47031
  " ": "\\t"
46992
- }, fM = (e) => e === null ? "" : dM[e] ?? e, pM = ({ section: e }) => {
46993
- let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } = lM(), i = (0, y.useRef)(e.delimiter), a = fM(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = gc(o, 300), l = (0, y.useRef)(a);
47032
+ }, yM = (e) => e === null ? "" : vM[e] ?? e, bM = ({ section: e }) => {
47033
+ let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } = gM(), i = (0, y.useRef)(e.delimiter), a = yM(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = gc(o, 300), l = (0, y.useRef)(a);
46994
47034
  (0, y.useEffect)(() => {
46995
47035
  s(a), l.current = a;
46996
47036
  }, [a]), (0, y.useEffect)(() => {
@@ -47033,8 +47073,8 @@ var lM = () => {
47033
47073
  })
47034
47074
  ]
47035
47075
  });
47036
- }, mM = ({ section: e, val: t }) => {
47037
- let { t: n } = j(), { getSelectOptions: r, selectValue: i } = lM(), a = t.mapped === void 0, o = (0, y.useCallback)((n) => i(e.columnId, t.imported, n), [
47076
+ }, xM = ({ section: e, val: t }) => {
47077
+ let { t: n } = j(), { getSelectOptions: r, selectValue: i } = gM(), a = t.mapped === void 0, o = (0, y.useCallback)((n) => i(e.columnId, t.imported, n), [
47038
47078
  i,
47039
47079
  e.columnId,
47040
47080
  t.imported
@@ -47086,8 +47126,8 @@ var lM = () => {
47086
47126
  })
47087
47127
  ]
47088
47128
  });
47089
- }, hM = ({ section: e }) => {
47090
- let { t } = j(), { getVisibleValues: n } = lM(), r = n(e);
47129
+ }, SM = ({ section: e }) => {
47130
+ let { t } = j(), { getVisibleValues: n } = gM(), r = n(e);
47091
47131
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47092
47132
  className: "updog__value-matching__table",
47093
47133
  children: [r.length === 0 ? /* @__PURE__ */ (0, O.jsx)("div", {
@@ -47107,7 +47147,7 @@ var lM = () => {
47107
47147
  size: "sm",
47108
47148
  weight: "medium",
47109
47149
  children: t("dataEditor.uploader.matchValues.importedValues")
47110
- }), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(pM, { section: e })]
47150
+ }), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(bM, { section: e })]
47111
47151
  }),
47112
47152
  /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__arrow-spacer" }),
47113
47153
  /* @__PURE__ */ (0, O.jsx)(W, {
@@ -47119,25 +47159,25 @@ var lM = () => {
47119
47159
  }),
47120
47160
  /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__action" })
47121
47161
  ]
47122
- }), r.map((t) => /* @__PURE__ */ (0, O.jsx)(mM, {
47162
+ }), r.map((t) => /* @__PURE__ */ (0, O.jsx)(xM, {
47123
47163
  section: e,
47124
47164
  val: t
47125
47165
  }, t.imported))]
47126
47166
  });
47127
- }, gM = ({ section: e }) => {
47128
- let { isCollapsed: t } = lM(), n = !t(e.columnId);
47167
+ }, CM = ({ section: e }) => {
47168
+ let { isCollapsed: t } = gM(), n = !t(e.columnId);
47129
47169
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47130
47170
  className: "updog__value-matching__section",
47131
- children: [/* @__PURE__ */ (0, O.jsx)(uM, { section: e }), /* @__PURE__ */ (0, O.jsx)("div", {
47171
+ children: [/* @__PURE__ */ (0, O.jsx)(_M, { section: e }), /* @__PURE__ */ (0, O.jsx)("div", {
47132
47172
  className: N("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
47133
- children: /* @__PURE__ */ (0, O.jsx)(hM, { section: e })
47173
+ children: /* @__PURE__ */ (0, O.jsx)(SM, { section: e })
47134
47174
  })]
47135
47175
  });
47136
- }, _M = () => {
47137
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = lM();
47176
+ }, wM = () => {
47177
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = gM();
47138
47178
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47139
47179
  className: "updog__value-matching",
47140
- children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(gM, { section: e }, e.columnId)), t && /* @__PURE__ */ (0, O.jsx)(tM, {
47180
+ children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(CM, { section: e }, e.columnId)), t && /* @__PURE__ */ (0, O.jsx)(cM, {
47141
47181
  open: !0,
47142
47182
  existingOptions: n,
47143
47183
  initialName: r,
@@ -47145,43 +47185,43 @@ var lM = () => {
47145
47185
  onSubmit: i
47146
47186
  })]
47147
47187
  });
47148
- }, vM = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47188
+ }, TM = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47149
47189
  className: "updog__step-match-values__content updog__scrollbar",
47150
- children: /* @__PURE__ */ (0, O.jsx)(cM, { children: /* @__PURE__ */ (0, O.jsx)(_M, {}) })
47151
- }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), yM = 20, bM = () => {
47152
- let { columns: e, store: t } = th(), { t: n } = j(), { primaryKey: r, onPrimaryKeyChange: i, parsedCsv: a, columnMapping: o } = dN(), s = t.isClient(), c = (0, y.useCallback)(() => i(null), [i]), l = e.filter((e) => e.unique), u = (0, y.useMemo)(() => {
47190
+ children: /* @__PURE__ */ (0, O.jsx)(hM, { children: /* @__PURE__ */ (0, O.jsx)(wM, {}) })
47191
+ }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), EM = 20, DM = () => {
47192
+ let { store: e } = th(), { t } = j(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, columnMapping: a, primaryKeyColumns: o } = TN(), s = e.isClient(), c = (0, y.useCallback)(() => r(null), [r]), l = (0, y.useMemo)(() => {
47153
47193
  let e = {};
47154
- for (let [t, n] of Object.entries(o)) n && (e[n] = t);
47194
+ for (let [t, n] of Object.entries(a)) n && (e[n] = t);
47155
47195
  return e;
47156
- }, [o]), d = a?.rows.slice(0, yM) ?? [];
47196
+ }, [a]), u = i?.rows.slice(0, EM) ?? [];
47157
47197
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47158
47198
  className: "updog__primary-key-selection updog__scrollbar",
47159
47199
  children: [s && /* @__PURE__ */ (0, O.jsxs)(hc, {
47160
47200
  name: "primaryKey",
47161
47201
  value: "",
47162
- checked: r === null,
47202
+ checked: n === null,
47163
47203
  onChange: c,
47164
47204
  radioPosition: "end",
47165
- className: N("updog__primary-key-selection__card", r === null && "updog__primary-key-selection__card--selected"),
47205
+ className: N("updog__primary-key-selection__card", n === null && "updog__primary-key-selection__card--selected"),
47166
47206
  children: [/* @__PURE__ */ (0, O.jsx)(W, {
47167
47207
  size: "sm",
47168
47208
  weight: "medium",
47169
47209
  className: "updog__primary-key-selection__title",
47170
- children: n("dataEditor.uploader.primaryKey.none")
47210
+ children: t("dataEditor.uploader.primaryKey.none")
47171
47211
  }), /* @__PURE__ */ (0, O.jsx)(W, {
47172
47212
  size: "sm",
47173
47213
  className: "updog__primary-key-selection__value-text updog__primary-key-selection__value-none",
47174
- children: n("dataEditor.uploader.primaryKey.noneHint")
47214
+ children: t("dataEditor.uploader.primaryKey.noneHint")
47175
47215
  })]
47176
- }), l.map((e) => {
47177
- let t = u[e.id], n = t ? d.map((e) => e[t] ?? "") : [];
47216
+ }), o.map((e) => {
47217
+ let t = l[e.id], i = t ? u.map((e) => e[t] ?? "") : [];
47178
47218
  return /* @__PURE__ */ (0, O.jsxs)(hc, {
47179
47219
  name: "primaryKey",
47180
47220
  value: e.id,
47181
- checked: r === e.id,
47182
- onChange: i,
47221
+ checked: n === e.id,
47222
+ onChange: r,
47183
47223
  radioPosition: "end",
47184
- className: N("updog__primary-key-selection__card", r === e.id && "updog__primary-key-selection__card--selected"),
47224
+ className: N("updog__primary-key-selection__card", n === e.id && "updog__primary-key-selection__card--selected"),
47185
47225
  children: [/* @__PURE__ */ (0, O.jsx)(W, {
47186
47226
  size: "sm",
47187
47227
  weight: "medium",
@@ -47189,7 +47229,7 @@ var lM = () => {
47189
47229
  children: e.title
47190
47230
  }), /* @__PURE__ */ (0, O.jsx)("div", {
47191
47231
  className: "updog__primary-key-selection__values",
47192
- children: n.map((e, t) => /* @__PURE__ */ (0, O.jsx)("div", {
47232
+ children: i.map((e, t) => /* @__PURE__ */ (0, O.jsx)("div", {
47193
47233
  className: "updog__primary-key-selection__value-row",
47194
47234
  children: /* @__PURE__ */ (0, O.jsx)(W, {
47195
47235
  size: "sm",
@@ -47201,7 +47241,91 @@ var lM = () => {
47201
47241
  }, e.id);
47202
47242
  })]
47203
47243
  });
47204
- }, xM = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(bM, {}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), SM = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, O.jsx)("span", {
47244
+ }, OM = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(DM, {}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), kM = () => {
47245
+ let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = th(), i = t === !1 ? [] : t, { t: a } = j(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: f, handleRemoteSourceSelect: p } = TN(), m = [
47246
+ {
47247
+ id: "csv",
47248
+ format: "csv",
47249
+ text: a("dataEditor.footer.csvFormat")
47250
+ },
47251
+ {
47252
+ id: "tsv",
47253
+ format: "tsv",
47254
+ text: a("dataEditor.footer.tsvFormat")
47255
+ },
47256
+ {
47257
+ id: "xlsx",
47258
+ format: "xlsx",
47259
+ text: a("dataEditor.footer.excelFormat")
47260
+ },
47261
+ {
47262
+ id: "json",
47263
+ format: "json",
47264
+ text: a("dataEditor.footer.jsonFormat")
47265
+ },
47266
+ {
47267
+ id: "xml",
47268
+ format: "xml",
47269
+ text: a("dataEditor.footer.xmlFormat")
47270
+ }
47271
+ ].filter((e) => i.includes(e.format)), h = (0, y.useCallback)((t) => {
47272
+ qh(e, t, r);
47273
+ }, [e, r]), g = rh(i), _ = !!o || !!s, v = _ || u || !!d, b = o?.fileName ?? s?.name, { getRootProps: x, getInputProps: S, isDragActive: C, open: w } = Zu({
47274
+ accept: g,
47275
+ maxFiles: 1,
47276
+ noClick: !0,
47277
+ disabled: v,
47278
+ onDrop: (0, y.useCallback)((e) => {
47279
+ let t = e[0];
47280
+ t && l(t);
47281
+ }, [l])
47282
+ });
47283
+ return {
47284
+ getRootProps: x,
47285
+ getInputProps: S,
47286
+ isDragActive: C,
47287
+ open: w,
47288
+ isParsing: u,
47289
+ hasFile: _,
47290
+ isBlocked: v,
47291
+ fileName: b,
47292
+ importFormats: i,
47293
+ remoteSources: n,
47294
+ remoteSourceLoading: d,
47295
+ remoteSourceError: f,
47296
+ exampleMenuOptions: m,
47297
+ onExampleDownload: h,
47298
+ onRemoveClick: (0, y.useCallback)((e) => {
47299
+ e.stopPropagation(), c();
47300
+ }, [c]),
47301
+ handleRemoteSourceSelect: p
47302
+ };
47303
+ }, AM = (0, y.createContext)(null);
47304
+ function jM({ children: e }) {
47305
+ let t = kM();
47306
+ return /* @__PURE__ */ (0, O.jsx)(AM.Provider, {
47307
+ value: t,
47308
+ children: e
47309
+ });
47310
+ }
47311
+ var MM = () => {
47312
+ let e = (0, y.useContext)(AM);
47313
+ if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
47314
+ return e;
47315
+ }, NM = () => {
47316
+ let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } = MM();
47317
+ return /* @__PURE__ */ (0, O.jsx)(fc, {
47318
+ options: t,
47319
+ onSelect: n,
47320
+ placement: "top-start",
47321
+ children: /* @__PURE__ */ (0, O.jsx)(ot, {
47322
+ variant: "outlined",
47323
+ color: "neutral",
47324
+ startIcon: /* @__PURE__ */ (0, O.jsx)(he, {}),
47325
+ children: e("dataEditor.uploader.uploadFile.downloadExample")
47326
+ })
47327
+ });
47328
+ }, PM = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, O.jsx)("span", {
47205
47329
  className: "updog__remote-source-btn__icon",
47206
47330
  dangerouslySetInnerHTML: { __html: e.icon }
47207
47331
  }) : /* @__PURE__ */ (0, O.jsx)("span", {
@@ -47210,7 +47334,7 @@ var lM = () => {
47210
47334
  src: e.icon,
47211
47335
  alt: e.label
47212
47336
  })
47213
- }), CM = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ (0, O.jsx)(ot, {
47337
+ }), FM = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ (0, O.jsx)(ot, {
47214
47338
  variant: "filled",
47215
47339
  color: "neutral",
47216
47340
  size: "sm",
@@ -47220,11 +47344,11 @@ var lM = () => {
47220
47344
  disabled: !t && n,
47221
47345
  loading: t,
47222
47346
  spinnerPosition: "start",
47223
- startIcon: /* @__PURE__ */ (0, O.jsx)(SM, { source: e }),
47347
+ startIcon: /* @__PURE__ */ (0, O.jsx)(PM, { source: e }),
47224
47348
  title: e.description,
47225
47349
  children: e.label
47226
- }), wM = () => {
47227
- let { importFormats: e, remoteSources: t } = th(), n = e === !1 ? [] : e, { t: r } = j(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = dN();
47350
+ }), IM = () => {
47351
+ let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = MM(), o = n.length > 0;
47228
47352
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47229
47353
  className: "updog__source-picker",
47230
47354
  children: [
@@ -47237,35 +47361,35 @@ var lM = () => {
47237
47361
  size: "sm",
47238
47362
  weight: "medium",
47239
47363
  className: "updog__source-picker__link",
47240
- children: r("dataEditor.uploader.uploadFile.clickToUpload")
47364
+ children: e("dataEditor.uploader.uploadFile.clickToUpload")
47241
47365
  }), /* @__PURE__ */ (0, O.jsx)(W, {
47242
47366
  as: "span",
47243
47367
  size: "sm",
47244
- children: r("dataEditor.uploader.uploadFile.orDragAndDrop")
47368
+ children: e("dataEditor.uploader.uploadFile.orDragAndDrop")
47245
47369
  })]
47246
47370
  }), /* @__PURE__ */ (0, O.jsx)(W, {
47247
47371
  as: "span",
47248
47372
  size: "xs",
47249
- children: n.map((e) => e.toUpperCase()).join(", ")
47373
+ children: t.map((e) => e.toUpperCase()).join(", ")
47250
47374
  })]
47251
47375
  }),
47252
- t.length > 0 && /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)(ac, {}), /* @__PURE__ */ (0, O.jsx)("div", {
47376
+ o && /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)(ac, {}), /* @__PURE__ */ (0, O.jsx)("div", {
47253
47377
  className: "updog__source-picker__sources-list",
47254
- children: t.map((e) => /* @__PURE__ */ (0, O.jsx)(CM, {
47378
+ children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(FM, {
47255
47379
  source: e,
47256
- loading: i === e.id,
47257
- disabled: !!i,
47258
- onSelect: o
47380
+ loading: r === e.id,
47381
+ disabled: !!r,
47382
+ onSelect: a
47259
47383
  }, e.id))
47260
47384
  })] }),
47261
- a && /* @__PURE__ */ (0, O.jsx)(W, {
47385
+ i && /* @__PURE__ */ (0, O.jsx)(W, {
47262
47386
  size: "sm",
47263
47387
  className: "updog__source-picker__error",
47264
- children: a
47388
+ children: i
47265
47389
  })
47266
47390
  ]
47267
47391
  });
47268
- }, TM = () => {
47392
+ }, LM = () => {
47269
47393
  let { t: e } = j();
47270
47394
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47271
47395
  className: "updog__uploading-state",
@@ -47278,98 +47402,52 @@ var lM = () => {
47278
47402
  children: e("dataEditor.uploader.uploadFile.uploading")
47279
47403
  })]
47280
47404
  });
47281
- }, EM = () => {
47282
- let { columns: e, importFormats: t, sampleData: n } = th(), r = t === !1 ? [] : t, { t: i } = j(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c, isParsing: l, remoteSourceLoading: u } = dN(), d = [
47283
- {
47284
- id: "csv",
47285
- format: "csv",
47286
- text: i("dataEditor.footer.csvFormat")
47287
- },
47288
- {
47289
- id: "tsv",
47290
- format: "tsv",
47291
- text: i("dataEditor.footer.tsvFormat")
47292
- },
47293
- {
47294
- id: "xlsx",
47295
- format: "xlsx",
47296
- text: i("dataEditor.footer.excelFormat")
47297
- },
47298
- {
47299
- id: "json",
47300
- format: "json",
47301
- text: i("dataEditor.footer.jsonFormat")
47302
- },
47303
- {
47304
- id: "xml",
47305
- format: "xml",
47306
- text: i("dataEditor.footer.xmlFormat")
47307
- }
47308
- ].filter((e) => r.includes(e.format)), f = (0, y.useCallback)((t) => {
47309
- qh(e, t, n);
47310
- }, [e, n]), p = rh(r), m = !!a || !!o, h = m || l || !!u, g = a?.fileName ?? o?.name, { getRootProps: _, getInputProps: v, isDragActive: b, open: x } = Zu({
47311
- accept: p,
47312
- maxFiles: 1,
47313
- noClick: !0,
47314
- disabled: h,
47315
- onDrop: (0, y.useCallback)((e) => {
47316
- let t = e[0];
47317
- t && c(t);
47318
- }, [c])
47319
- }), S = (0, y.useCallback)((e) => {
47320
- e.stopPropagation(), s();
47321
- }, [s]);
47405
+ }, RM = () => {
47406
+ let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = MM();
47407
+ return /* @__PURE__ */ (0, O.jsx)("div", {
47408
+ className: N("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
47409
+ onClick: t ? void 0 : a,
47410
+ children: n ? /* @__PURE__ */ (0, O.jsx)(LM, {}) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
47411
+ /* @__PURE__ */ (0, O.jsx)("div", {
47412
+ className: "updog__step-select-files__icon-container",
47413
+ children: r ? /* @__PURE__ */ (0, O.jsx)(oe, {
47414
+ size: "1rem",
47415
+ className: "updog__step-select-files__icon rtl-mirror"
47416
+ }) : /* @__PURE__ */ (0, O.jsx)(We, {
47417
+ size: "1rem",
47418
+ className: "updog__step-select-files__icon"
47419
+ })
47420
+ }),
47421
+ !r && /* @__PURE__ */ (0, O.jsx)(IM, {}),
47422
+ r && /* @__PURE__ */ (0, O.jsxs)("div", {
47423
+ className: "updog__step-select-files__info",
47424
+ children: [/* @__PURE__ */ (0, O.jsx)(W, {
47425
+ as: "span",
47426
+ size: "sm",
47427
+ children: i
47428
+ }), /* @__PURE__ */ (0, O.jsx)(ot, {
47429
+ size: "xs",
47430
+ variant: "ghost",
47431
+ color: "danger",
47432
+ onClick: o,
47433
+ children: e("dataEditor.common.remove")
47434
+ })]
47435
+ })
47436
+ ] })
47437
+ });
47438
+ }, zM = () => {
47439
+ let { getRootProps: e, getInputProps: t, isDragActive: n } = MM();
47322
47440
  return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
47323
47441
  className: "updog__step-select-files__dropzone",
47324
- ..._(),
47442
+ ...e(),
47325
47443
  children: [
47326
- /* @__PURE__ */ (0, O.jsx)("input", { ...v() }),
47327
- /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47328
- className: N("updog__step-select-files__upload-area", h && "updog__step-select-files__upload-area--disabled"),
47329
- onClick: h ? void 0 : x,
47330
- children: l ? /* @__PURE__ */ (0, O.jsx)(TM, {}) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
47331
- /* @__PURE__ */ (0, O.jsx)("div", {
47332
- className: "updog__step-select-files__icon-container",
47333
- children: m ? /* @__PURE__ */ (0, O.jsx)(oe, {
47334
- size: "1rem",
47335
- className: "updog__step-select-files__icon rtl-mirror"
47336
- }) : /* @__PURE__ */ (0, O.jsx)(We, {
47337
- size: "1rem",
47338
- className: "updog__step-select-files__icon"
47339
- })
47340
- }),
47341
- !m && /* @__PURE__ */ (0, O.jsx)(wM, {}),
47342
- m && /* @__PURE__ */ (0, O.jsxs)("div", {
47343
- className: "updog__step-select-files__info",
47344
- children: [/* @__PURE__ */ (0, O.jsx)(W, {
47345
- as: "span",
47346
- size: "sm",
47347
- children: g
47348
- }), /* @__PURE__ */ (0, O.jsx)(ot, {
47349
- size: "xs",
47350
- variant: "ghost",
47351
- color: "danger",
47352
- onClick: S,
47353
- children: i("dataEditor.common.remove")
47354
- })]
47355
- })
47356
- ] })
47357
- }), /* @__PURE__ */ (0, O.jsx)(Aj, { leftSlot: /* @__PURE__ */ (0, O.jsx)(fc, {
47358
- options: d,
47359
- onSelect: f,
47360
- placement: "top-start",
47361
- children: /* @__PURE__ */ (0, O.jsx)(ot, {
47362
- variant: "outlined",
47363
- color: "neutral",
47364
- startIcon: /* @__PURE__ */ (0, O.jsx)(he, {}),
47365
- children: i("dataEditor.uploader.uploadFile.downloadExample")
47366
- })
47367
- }) })] }),
47368
- b && /* @__PURE__ */ (0, O.jsx)(oh, {})
47444
+ /* @__PURE__ */ (0, O.jsx)("input", { ...t() }),
47445
+ /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(RM, {}), /* @__PURE__ */ (0, O.jsx)(Aj, { leftSlot: /* @__PURE__ */ (0, O.jsx)(NM, {}) })] }),
47446
+ n && /* @__PURE__ */ (0, O.jsx)(oh, {})
47369
47447
  ]
47370
47448
  }) });
47371
- }, DM = ({ preview: e }) => {
47372
- let { selectedSheet: t, setSelectedSheet: n } = dN(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
47449
+ }, BM = () => /* @__PURE__ */ (0, O.jsx)(jM, { children: /* @__PURE__ */ (0, O.jsx)(zM, {}) }), VM = ({ preview: e }) => {
47450
+ let { selectedSheet: t, setSelectedSheet: n } = TN(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
47373
47451
  let { headers: t, rows: n } = e;
47374
47452
  return n.map((e) => t.map((t) => e[t] ?? ""));
47375
47453
  }, [e]);
@@ -47406,16 +47484,16 @@ var lM = () => {
47406
47484
  })]
47407
47485
  })
47408
47486
  });
47409
- }, OM = () => {
47410
- let { sheetPreviews: e } = dN();
47487
+ }, HM = () => {
47488
+ let { sheetPreviews: e } = TN();
47411
47489
  return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47412
47490
  className: "updog__sheet-preview-wrapper updog__scrollbar",
47413
47491
  children: /* @__PURE__ */ (0, O.jsx)("div", {
47414
47492
  className: "updog__sheet-preview-grid",
47415
- children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(DM, { preview: e }, e.name))
47493
+ children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(VM, { preview: e }, e.name))
47416
47494
  })
47417
47495
  }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) });
47418
- }, kM = (e, t, n) => {
47496
+ }, UM = (e, t, n) => {
47419
47497
  let r = new Map(t.map((e) => [e.id, e])), i = [];
47420
47498
  for (let [t, a] of Object.entries(e)) a && i.push({
47421
47499
  csvHeader: t,
@@ -47423,11 +47501,11 @@ var lM = () => {
47423
47501
  column: n.has(a) ? void 0 : r.get(a)
47424
47502
  });
47425
47503
  return i;
47426
- }, AM = (e) => {
47504
+ }, WM = (e) => {
47427
47505
  let t = [];
47428
47506
  for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
47429
47507
  return t;
47430
- }, jM = (e, t, n) => {
47508
+ }, GM = (e, t, n) => {
47431
47509
  let r = {};
47432
47510
  for (let { csvHeader: i, columnId: a, column: o } of t) {
47433
47511
  let t = e[i] ?? "";
@@ -47442,7 +47520,7 @@ var lM = () => {
47442
47520
  continue;
47443
47521
  }
47444
47522
  if (s === "multiselect") {
47445
- let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? rM(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
47523
+ let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? uM(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
47446
47524
  for (let e of s) {
47447
47525
  let t = n.valueMapping[a]?.[e.trim()];
47448
47526
  t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
@@ -47454,35 +47532,35 @@ var lM = () => {
47454
47532
  r[a] = o.transformer ? o.transformer(c) : c;
47455
47533
  }
47456
47534
  return r;
47457
- }, MM = /^-?\d+([.,]\d+)?%?$/, NM = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, PM = new Set([
47535
+ }, KM = /^-?\d+([.,]\d+)?%?$/, qM = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, JM = new Set([
47458
47536
  "true",
47459
47537
  "false",
47460
47538
  "yes",
47461
47539
  "no"
47462
- ]), FM = 50;
47463
- function IM(e) {
47464
- return !!(MM.test(e) || NM.test(e) || PM.has(e.toLowerCase()));
47540
+ ]), YM = 50;
47541
+ function XM(e) {
47542
+ return !!(KM.test(e) || qM.test(e) || JM.has(e.toLowerCase()));
47465
47543
  }
47466
- function LM(e) {
47544
+ function ZM(e) {
47467
47545
  return e.filter((e) => e != null && String(e).trim().length > 0).length;
47468
47546
  }
47469
- function RM(e) {
47547
+ function QM(e) {
47470
47548
  let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
47471
47549
  for (let i of e) {
47472
- let e = LM(i);
47550
+ let e = ZM(i);
47473
47551
  if (e === 0) continue;
47474
47552
  let a = (t.get(e) ?? 0) + 1;
47475
47553
  t.set(e, a), a > n && (n = a, r = e);
47476
47554
  }
47477
47555
  return r;
47478
47556
  }
47479
- function zM(e, t) {
47557
+ function $M(e, t) {
47480
47558
  let n = e.map((e) => String(e ?? "").trim()), r = n.filter((e) => e.length > 0);
47481
47559
  if (r.length === 0) return 0;
47482
- let i = r.filter((e) => IM(e)).length === 0 ? 1 : 0, a = r.length / Math.max(n.length, 1), o = new Set(r.map((e) => e.toLowerCase())).size / r.length, s = r.filter((e) => e.length <= FM).length / r.length, c = t > 0 ? 1 - Math.abs(r.length - t) / t : 0;
47560
+ let i = r.filter((e) => XM(e)).length === 0 ? 1 : 0, a = r.length / Math.max(n.length, 1), o = new Set(r.map((e) => e.toLowerCase())).size / r.length, s = r.filter((e) => e.length <= YM).length / r.length, c = t > 0 ? 1 - Math.abs(r.length - t) / t : 0;
47483
47561
  return .3 * i + .25 * a + .2 * o + .15 * s + .1 * Math.max(0, c);
47484
47562
  }
47485
- function BM(e, t = 100) {
47563
+ function eN(e, t = 100) {
47486
47564
  if (e.length === 0) return {
47487
47565
  headerRowIndex: 0,
47488
47566
  confidence: 0
@@ -47491,17 +47569,17 @@ function BM(e, t = 100) {
47491
47569
  headerRowIndex: 0,
47492
47570
  confidence: 1
47493
47571
  };
47494
- let n = Math.min(t, e.length), r = RM(e.slice(0, n)), i = 0, a = -1;
47572
+ let n = Math.min(t, e.length), r = QM(e.slice(0, n)), i = 0, a = -1;
47495
47573
  for (let t = 0; t < n; t++) {
47496
- let n = zM(e[t], r);
47497
- if (n > a && (a = n, i = t), t === 0 && n > .85 && LM(e[0]) === r) break;
47574
+ let n = $M(e[t], r);
47575
+ if (n > a && (a = n, i = t), t === 0 && n > .85 && ZM(e[0]) === r) break;
47498
47576
  }
47499
47577
  return {
47500
47578
  headerRowIndex: i,
47501
47579
  confidence: Math.round(a * 100) / 100
47502
47580
  };
47503
47581
  }
47504
- function VM(e) {
47582
+ function tN(e) {
47505
47583
  let t = /* @__PURE__ */ new Set();
47506
47584
  return e.map((e) => {
47507
47585
  let n = e, r = 2;
@@ -47509,8 +47587,8 @@ function VM(e) {
47509
47587
  return t.add(n), n;
47510
47588
  });
47511
47589
  }
47512
- function HM(e) {
47513
- let { headerRowIndex: t } = BM(e), n = VM((e[t] ?? []).map((e) => String(e ?? "").trim())), r = [], i = [];
47590
+ function nN(e) {
47591
+ let { headerRowIndex: t } = eN(e), n = tN((e[t] ?? []).map((e) => String(e ?? "").trim())), r = [], i = [];
47514
47592
  for (let a of e.slice(t + 1)) {
47515
47593
  if (!a.some((e) => e != null && String(e).trim() !== "")) continue;
47516
47594
  let e = {};
@@ -47526,16 +47604,16 @@ function HM(e) {
47526
47604
  }
47527
47605
  //#endregion
47528
47606
  //#region src/components/DataUploader/utils/detectMultiValueDelimiter.ts
47529
- var UM = 200, WM = (e, t, n) => {
47607
+ var rN = 200, iN = (e, t, n) => {
47530
47608
  if (n) return n;
47531
47609
  let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
47532
47610
  for (let t of e) {
47533
47611
  let e = t.trim();
47534
- if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= UM)) break;
47612
+ if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= rN)) break;
47535
47613
  }
47536
47614
  if (o.length === 0) return null;
47537
47615
  let s = null, c = 0, l = 0;
47538
- for (let e of nM) {
47616
+ for (let e of lM) {
47539
47617
  let n = 0, r = 0;
47540
47618
  for (let a of o) {
47541
47619
  if (i(a) || !a.includes(e)) continue;
@@ -47548,7 +47626,7 @@ var UM = 200, WM = (e, t, n) => {
47548
47626
  (n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
47549
47627
  }
47550
47628
  return c > 0 ? s : null;
47551
- }, GM = (e) => {
47629
+ }, aN = (e) => {
47552
47630
  let t = /* @__PURE__ */ new Map();
47553
47631
  for (let [n, r] of Object.entries(e)) {
47554
47632
  let e = Pj(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
@@ -47556,8 +47634,8 @@ var UM = 200, WM = (e, t, n) => {
47556
47634
  t.set(e, i);
47557
47635
  }
47558
47636
  return t;
47559
- }, KM = (e, t, n, r) => {
47560
- let i = GM(r), a = (e, t) => i.get(Pj(e))?.has(Pj(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
47637
+ }, oN = (e, t, n, r) => {
47638
+ let i = aN(r), a = (e, t) => i.get(Pj(e))?.has(Pj(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
47561
47639
  if (Pj(n) === Pj(r) || a(r, n)) return;
47562
47640
  let i = `${n} ${r}`;
47563
47641
  t.has(i) || (t.add(i), e.push({
@@ -47577,16 +47655,16 @@ var UM = 200, WM = (e, t, n) => {
47577
47655
  for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
47578
47656
  return c;
47579
47657
  };
47580
- function qM(e, t, n) {
47658
+ function sN(e, t, n) {
47581
47659
  let r = e.length, i = t;
47582
- return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? JM(i, i - r) : JM(r - 1, i - 1)) > 1e3 ? [] : r < i ? YM(e, i) : XM(e, i, n);
47660
+ return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? cN(i, i - r) : cN(r - 1, i - 1)) > 1e3 ? [] : r < i ? lN(e, i) : uN(e, i, n);
47583
47661
  }
47584
- function JM(e, t) {
47662
+ function cN(e, t) {
47585
47663
  let n = Math.min(t, e - t), r = 1;
47586
47664
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
47587
47665
  return r;
47588
47666
  }
47589
- function YM(e, t) {
47667
+ function lN(e, t) {
47590
47668
  let n = e.length, r = [], i = [], a = (o) => {
47591
47669
  if (i.length === n) {
47592
47670
  let a = Array(t).fill("");
@@ -47598,7 +47676,7 @@ function YM(e, t) {
47598
47676
  };
47599
47677
  return a(0), r;
47600
47678
  }
47601
- function XM(e, t, n) {
47679
+ function uN(e, t, n) {
47602
47680
  let r = e.length, i = [], a = [], o = (s) => {
47603
47681
  if (a.length === t - 1) {
47604
47682
  let o = [
@@ -47616,27 +47694,27 @@ function XM(e, t, n) {
47616
47694
  }
47617
47695
  //#endregion
47618
47696
  //#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
47619
- var ZM = {};
47620
- function QM(e, t) {
47697
+ var dN = {};
47698
+ function fN(e, t) {
47621
47699
  for (let n of t.validators ?? []) if (n.type !== "expression") {
47622
47700
  if (n.type === "function") {
47623
- if (n.fn(e, ZM) != null) return !1;
47701
+ if (n.fn(e, dN) != null) return !1;
47624
47702
  continue;
47625
47703
  }
47626
- if (Bm(n, e, ZM) != null) return !1;
47704
+ if (Bm(n, e, dN) != null) return !1;
47627
47705
  }
47628
47706
  return !0;
47629
47707
  }
47630
- function $M(e, t) {
47631
- for (let n = 0; n < t.length; n++) if (!QM(e.cells[n] ?? "", t[n])) return !1;
47708
+ function pN(e, t) {
47709
+ for (let n = 0; n < t.length; n++) if (!fN(e.cells[n] ?? "", t[n])) return !1;
47632
47710
  return !0;
47633
47711
  }
47634
- function eN(e, t) {
47635
- return e.filter((e) => $M(e, t));
47712
+ function mN(e, t) {
47713
+ return e.filter((e) => pN(e, t));
47636
47714
  }
47637
47715
  //#endregion
47638
47716
  //#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
47639
- function tN(e) {
47717
+ function hN(e) {
47640
47718
  if (e.length <= 1) return [];
47641
47719
  let t = e[0].cells.length, n = [], r = -1;
47642
47720
  for (let i = 0; i < t; i++) {
@@ -47653,25 +47731,25 @@ function tN(e) {
47653
47731
  }
47654
47732
  //#endregion
47655
47733
  //#region src/components/DataUploader/utils/raggedRows/alignRow.ts
47656
- function nN(e, t, n) {
47657
- let r = qM(e, t.length, n), i = eN(r, t);
47734
+ function gN(e, t, n) {
47735
+ let r = sN(e, t.length, n), i = mN(r, t);
47658
47736
  return i.length === 1 ? {
47659
47737
  kind: "confident",
47660
47738
  alignment: i[0]
47661
47739
  } : i.length > 1 ? {
47662
47740
  kind: "ambiguous",
47663
47741
  candidates: i,
47664
- disputeSpans: tN(i)
47742
+ disputeSpans: hN(i)
47665
47743
  } : {
47666
47744
  kind: "invalid",
47667
47745
  candidates: r,
47668
- disputeSpans: tN(r)
47746
+ disputeSpans: hN(r)
47669
47747
  };
47670
47748
  }
47671
47749
  //#endregion
47672
47750
  //#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
47673
- function rN(e, t, n) {
47674
- let r = nN(e, t, n);
47751
+ function _N(e, t, n) {
47752
+ let r = gN(e, t, n);
47675
47753
  if (r.kind === "confident") return {
47676
47754
  cells: r.alignment.cells,
47677
47755
  conflictColumns: []
@@ -47690,14 +47768,17 @@ function rN(e, t, n) {
47690
47768
  }
47691
47769
  //#endregion
47692
47770
  //#region src/components/DataUploader/context/useViewModel.tsx
47693
- var iN = 5e3, aN = 15, oN = 20, sN = new Set([
47771
+ var vN = 5e3, yN = 15, bN = 20, xN = new Set([
47694
47772
  "xlsx",
47695
47773
  "xls",
47696
47774
  "xlsb",
47697
47775
  "ods"
47698
47776
  ]);
47699
- function cN() {
47700
- let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = th(), { t: f } = j(), [p, m] = (0, y.useState)(0), [h, g] = (0, y.useState)(0), [_, v] = (0, y.useState)(null), [b, x] = (0, y.useState)({}), S = n.filter((e) => e.unique), [C, w] = (0, y.useState)(() => r), [T, E] = (0, y.useState)(!1), [D, k] = (0, y.useState)(!1), [A, M] = (0, y.useState)(null), [N, P] = (0, y.useState)([]), [F, I] = (0, y.useState)(null), [L, R] = (0, y.useState)([]), [ee, z] = (0, y.useState)({}), [B, V] = (0, y.useState)([]), [H, te] = (0, y.useState)({}), ne = (0, y.useRef)(null), [re, ie] = (0, y.useState)(0), ae = (0, y.useCallback)((e) => {
47777
+ function SN() {
47778
+ let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = th(), { t: f } = j(), [p, m] = (0, y.useState)(0), [h, g] = (0, y.useState)(0), [_, v] = (0, y.useState)(null), [b, x] = (0, y.useState)({}), S = (0, y.useMemo)(() => {
47779
+ let e = new Set(Object.values(b).filter(Boolean));
47780
+ return n.filter((t) => t.unique && e.has(t.id));
47781
+ }, [b, n]), [C, w] = (0, y.useState)(() => r), [T, E] = (0, y.useState)(!1), [D, k] = (0, y.useState)(!1), [A, M] = (0, y.useState)(null), [N, P] = (0, y.useState)([]), [F, I] = (0, y.useState)(null), [L, R] = (0, y.useState)([]), [ee, z] = (0, y.useState)({}), [B, V] = (0, y.useState)([]), [H, te] = (0, y.useState)({}), ne = (0, y.useRef)(null), [re, ie] = (0, y.useState)(0), ae = (0, y.useCallback)((e) => {
47701
47782
  D || w(e);
47702
47783
  }, [D]), oe = (0, y.useRef)(null);
47703
47784
  oe.current ||= new Bh();
@@ -47710,24 +47791,24 @@ function cN() {
47710
47791
  let e = [{
47711
47792
  id: "select-files",
47712
47793
  title: f("dataEditor.uploader.steps.selectFiles"),
47713
- content: /* @__PURE__ */ (0, O.jsx)(EM, {})
47794
+ content: /* @__PURE__ */ (0, O.jsx)(BM, {})
47714
47795
  }];
47715
47796
  return N.length > 1 && e.push({
47716
47797
  id: "sheet-selection",
47717
47798
  title: f("dataEditor.uploader.steps.sheetSelection"),
47718
- content: /* @__PURE__ */ (0, O.jsx)(OM, {})
47799
+ content: /* @__PURE__ */ (0, O.jsx)(HM, {})
47719
47800
  }), e.push({
47720
47801
  id: "column-matching",
47721
47802
  title: f("dataEditor.uploader.steps.matchColumns"),
47722
- content: /* @__PURE__ */ (0, O.jsx)(eM, {})
47803
+ content: /* @__PURE__ */ (0, O.jsx)(sM, {})
47723
47804
  }), se && e.push({
47724
47805
  id: "match-values",
47725
47806
  title: f("dataEditor.uploader.steps.matchValues"),
47726
- content: /* @__PURE__ */ (0, O.jsx)(vM, {})
47807
+ content: /* @__PURE__ */ (0, O.jsx)(TM, {})
47727
47808
  }), S.length > 0 && ce && e.push({
47728
47809
  id: "primary-key",
47729
47810
  title: f("dataEditor.uploader.steps.primaryKey"),
47730
- content: /* @__PURE__ */ (0, O.jsx)(xM, {})
47811
+ content: /* @__PURE__ */ (0, O.jsx)(OM, {})
47731
47812
  }), e;
47732
47813
  }, [
47733
47814
  S.length,
@@ -47760,7 +47841,7 @@ function cN() {
47760
47841
  sheetName: F
47761
47842
  }).then((e) => {
47762
47843
  if (e.kind !== "rows") return;
47763
- let t = HM(e.rows);
47844
+ let t = nN(e.rows);
47764
47845
  ie(t.headerRowIndex), he({
47765
47846
  fileName: A.name,
47766
47847
  headers: t.headers,
@@ -47778,27 +47859,41 @@ function cN() {
47778
47859
  U,
47779
47860
  he,
47780
47861
  de
47781
- ]), ye = (0, y.useCallback)(async (e) => {
47782
- let t = await U.parse(e, { format: "csv" });
47783
- if (t.kind !== "rows") return;
47784
- let n = HM(t.rows);
47785
- if (ie(n.headerRowIndex), he({
47786
- fileName: e.name,
47787
- headers: n.headers,
47788
- rows: n.rows,
47789
- isParsing: !1,
47790
- rawCells: n.rawCells,
47791
- delimiter: t.delimiter
47792
- }), t.errors.length > 0) {
47793
- let e = t.errors.slice(0, 3).map((e) => e.row == null ? "?" : String(e.row + 1)).join(", ");
47794
- Gd.info(f("dataEditor.uploader.uploadFile.csvWarning", {
47795
- count: t.errors.length,
47796
- rows: e
47797
- }));
47862
+ ]), ye = (0, y.useCallback)(async (t) => {
47863
+ try {
47864
+ let e = await U.parse(t, { format: "csv" });
47865
+ if (e.kind !== "rows") {
47866
+ E(!1);
47867
+ return;
47868
+ }
47869
+ let n = nN(e.rows);
47870
+ if (ie(n.headerRowIndex), he({
47871
+ fileName: t.name,
47872
+ headers: n.headers,
47873
+ rows: n.rows,
47874
+ isParsing: !1,
47875
+ rawCells: n.rawCells,
47876
+ delimiter: e.delimiter
47877
+ }), e.errors.length > 0) {
47878
+ let t = e.errors.slice(0, 3).map((e) => e.row == null ? "?" : String(e.row + 1)).join(", ");
47879
+ Gd.info(f("dataEditor.uploader.uploadFile.csvWarning", {
47880
+ count: e.errors.length,
47881
+ rows: t
47882
+ }));
47883
+ }
47884
+ } catch (t) {
47885
+ E(!1), e.errorHandler.handleError({
47886
+ code: "PARSE_ERROR",
47887
+ message: "Failed to parse CSV file",
47888
+ source: "csv-parser",
47889
+ originalError: t
47890
+ });
47798
47891
  }
47799
47892
  }, [
47800
47893
  U,
47801
47894
  he,
47895
+ E,
47896
+ e,
47802
47897
  f
47803
47898
  ]), be = (0, y.useCallback)(async (t) => {
47804
47899
  try {
@@ -47850,11 +47945,11 @@ function cN() {
47850
47945
  U.parse(t, { format: "xlsx" }).then((e) => {
47851
47946
  if (e.kind === "sheets") {
47852
47947
  let n = e.sheets.map((e) => {
47853
- let { headers: t, rows: n } = HM(e.rows);
47948
+ let { headers: t, rows: n } = nN(e.rows);
47854
47949
  return {
47855
47950
  name: e.name,
47856
47951
  headers: t,
47857
- rows: n.slice(0, aN),
47952
+ rows: n.slice(0, yN),
47858
47953
  totalRows: e.totalRows - 1
47859
47954
  };
47860
47955
  });
@@ -47862,7 +47957,7 @@ function cN() {
47862
47957
  return;
47863
47958
  }
47864
47959
  if (e.kind !== "rows") return;
47865
- let n = HM(e.rows);
47960
+ let n = nN(e.rows);
47866
47961
  ie(n.headerRowIndex), he({
47867
47962
  fileName: t.name,
47868
47963
  headers: n.headers,
@@ -47888,7 +47983,7 @@ function cN() {
47888
47983
  ]), Ce = (0, y.useCallback)((e) => {
47889
47984
  E(!0), ne.current = e;
47890
47985
  let t = e.name.split(".").pop()?.toLowerCase();
47891
- t && sN.has(t) ? Se(e) : t === "json" ? be(e) : t === "xml" ? xe(e) : ye(e);
47986
+ t && xN.has(t) ? Se(e) : t === "json" ? be(e) : t === "xml" ? xe(e) : ye(e);
47892
47987
  }, [
47893
47988
  ye,
47894
47989
  be,
@@ -47968,7 +48063,7 @@ function cN() {
47968
48063
  t === void 0 || t === "" || c.push(t);
47969
48064
  }
47970
48065
  if (o === "multiselect") {
47971
- let n = a.editor.delimiter, r = WM(c, s, n);
48066
+ let n = a.editor.delimiter, r = iN(c, s, n);
47972
48067
  t[i] = r;
47973
48068
  let o = new Set(s.map((e) => e.trim().toLowerCase())), l = /* @__PURE__ */ new Set();
47974
48069
  for (let e of c) {
@@ -48035,7 +48130,7 @@ function cN() {
48035
48130
  n !== void 0 && n !== "" && i.push(n);
48036
48131
  }
48037
48132
  let a = r.editor.delimiter;
48038
- Re(e, WM(i, r.editor.options, a));
48133
+ Re(e, iN(i, r.editor.options, a));
48039
48134
  }, [
48040
48135
  _,
48041
48136
  b,
@@ -48054,7 +48149,7 @@ function cN() {
48054
48149
  for (let [r, i] of Object.entries(b)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
48055
48150
  return t;
48056
48151
  }, [b, n]), He = (0, y.useCallback)(() => {
48057
- let e = new Set(B.map((e) => e.id)), t = kM(b, n, e), i = rp(_?.rows ?? [], AM(t)), a = Ve(e), o = cp(_?.rows ?? [], a);
48152
+ let e = new Set(B.map((e) => e.id)), t = UM(b, n, e), i = rp(_?.rows ?? [], WM(t)), a = Ve(e), o = cp(_?.rows ?? [], a);
48058
48153
  return {
48059
48154
  columnMapping: b,
48060
48155
  valueMapping: Ie,
@@ -48093,7 +48188,7 @@ function cN() {
48093
48188
  if (!_ || !d?.onRowsImport) return;
48094
48189
  let t = _;
48095
48190
  v(null);
48096
- let r = crypto.randomUUID(), i = He(), a = new AbortController(), o = d.importChunkSize ?? iN, s = kM(b, n, new Set(B.map((e) => e.id))), c = {
48191
+ let r = crypto.randomUUID(), i = He(), a = new AbortController(), o = d.importChunkSize ?? vN, s = UM(b, n, new Set(B.map((e) => e.id))), c = {
48097
48192
  numberFormat: i.numberFormat,
48098
48193
  dateFormat: i.dateFormat,
48099
48194
  monthTable: op(f),
@@ -48102,7 +48197,7 @@ function cN() {
48102
48197
  }, l = t.rows, u = 0;
48103
48198
  for (; u < l.length;) {
48104
48199
  let e = Math.min(u + o, l.length), n = [];
48105
- for (let t = u; t < e; t++) n.push(jM(l[t], s, c));
48200
+ for (let t = u; t < e; t++) n.push(GM(l[t], s, c));
48106
48201
  let f = e >= l.length, p = Math.floor(u / o);
48107
48202
  await d.onRowsImport({
48108
48203
  importId: r,
@@ -48140,9 +48235,9 @@ function cN() {
48140
48235
  B.length > 0 && u(B);
48141
48236
  for (let [t, n] of Object.entries(H)) e.addColumnOptions(t, n);
48142
48237
  let o = e.registerSource({ name: i.fileName });
48143
- e.setSourceLoading(o, !0), e.recordLearnedSynonyms(KM(b, Ie, [...n, ...B], Mj(jj, l)));
48144
- let s = kM(b, n, a), c = {
48145
- numberFormat: rp(i.rows, AM(s)),
48238
+ e.setSourceLoading(o, !0), e.recordLearnedSynonyms(oN(b, Ie, [...n, ...B], Mj(jj, l)));
48239
+ let s = UM(b, n, a), c = {
48240
+ numberFormat: rp(i.rows, WM(s)),
48146
48241
  dateFormat: cp(i.rows, Ve(a)),
48147
48242
  monthTable: op(f),
48148
48243
  valueMapping: Ie,
@@ -48154,11 +48249,11 @@ function cN() {
48154
48249
  title: e
48155
48250
  };
48156
48251
  }), _ = 0, v = () => {
48157
- let n = Math.min(_ + iN, d.length), i = [], a = [];
48252
+ let n = Math.min(_ + vN, d.length), i = [], a = [];
48158
48253
  for (let e = _; e < n; e++) {
48159
48254
  let t = d[e], n = p[e];
48160
48255
  if (n) {
48161
- let { cells: r, conflictColumns: i } = rN(n, g, m);
48256
+ let { cells: r, conflictColumns: i } = _N(n, g, m);
48162
48257
  if (r.length) {
48163
48258
  let e = {};
48164
48259
  for (let t = 0; t < h.length; t++) e[h[t]] = r[t] ?? "";
@@ -48176,10 +48271,10 @@ function cN() {
48176
48271
  });
48177
48272
  }
48178
48273
  }
48179
- i.push(jM(t, s, c));
48274
+ i.push(GM(t, s, c));
48180
48275
  }
48181
48276
  let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: C ?? void 0 });
48182
- for (let e = _; e < n; e++) e < oN || (d[e] = null, e < p.length && (p[e] = null));
48277
+ for (let e = _; e < n; e++) e < bN || (d[e] = null, e < p.length && (p[e] = null));
48183
48278
  _ = n, setTimeout(() => {
48184
48279
  t.validateRows(l, u);
48185
48280
  for (let { localIndex: t, columnIds: n } of a) {
@@ -48246,6 +48341,7 @@ function cN() {
48246
48341
  sheetPreviews: L,
48247
48342
  primaryKey: C,
48248
48343
  onPrimaryKeyChange: ae,
48344
+ primaryKeyColumns: S,
48249
48345
  pendingColumns: B,
48250
48346
  setPendingColumns: V,
48251
48347
  isParsing: T,
@@ -48280,20 +48376,20 @@ function cN() {
48280
48376
  }
48281
48377
  //#endregion
48282
48378
  //#region src/components/DataUploader/context/index.tsx
48283
- var lN = (0, y.createContext)(null);
48284
- function uN({ children: e }) {
48285
- let t = cN();
48286
- return /* @__PURE__ */ (0, O.jsx)(lN.Provider, {
48379
+ var CN = (0, y.createContext)(null);
48380
+ function wN({ children: e }) {
48381
+ let t = SN();
48382
+ return /* @__PURE__ */ (0, O.jsx)(CN.Provider, {
48287
48383
  value: t,
48288
48384
  children: e
48289
48385
  });
48290
48386
  }
48291
- var dN = () => {
48292
- let e = (0, y.useContext)(lN);
48387
+ var TN = () => {
48388
+ let e = (0, y.useContext)(CN);
48293
48389
  if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
48294
48390
  return e;
48295
- }, fN = () => {
48296
- let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = dN();
48391
+ }, EN = () => {
48392
+ let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = TN();
48297
48393
  return /* @__PURE__ */ (0, O.jsx)(zc, {
48298
48394
  steps: e,
48299
48395
  activeStepIndex: t,
@@ -48301,79 +48397,79 @@ var dN = () => {
48301
48397
  onStepChange: r,
48302
48398
  isProgressive: !0
48303
48399
  });
48304
- }, pN = () => /* @__PURE__ */ (0, O.jsx)(uN, { children: /* @__PURE__ */ (0, O.jsx)(fN, {}) }), mN = {
48400
+ }, DN = () => /* @__PURE__ */ (0, O.jsx)(wN, { children: /* @__PURE__ */ (0, O.jsx)(EN, {}) }), ON = {
48305
48401
  kty: "EC",
48306
48402
  crv: "P-256",
48307
48403
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
48308
48404
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
48309
- }, hN = "updog_license_grant", gN = new Set([
48405
+ }, kN = "updog_license_grant", AN = new Set([
48310
48406
  "updog.tech",
48311
48407
  "landing.updog.tech",
48312
48408
  "demo.updog.tech"
48313
48409
  ]);
48314
- function _N() {
48315
- return gN.has(window.location.hostname);
48410
+ function jN() {
48411
+ return AN.has(window.location.hostname);
48316
48412
  }
48317
- function vN() {
48413
+ function MN() {
48318
48414
  return !1;
48319
48415
  }
48320
- function yN() {
48416
+ function NN() {
48321
48417
  return "https://api.updog.tech";
48322
48418
  }
48323
- function bN(e) {
48419
+ function PN(e) {
48324
48420
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
48325
48421
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
48326
48422
  return i;
48327
48423
  }
48328
- async function xN(e) {
48424
+ async function FN(e) {
48329
48425
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
48330
48426
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
48331
48427
  }
48332
- var SN = null;
48333
- async function CN() {
48334
- return SN || (SN = await crypto.subtle.importKey("jwk", mN, {
48428
+ var IN = null;
48429
+ async function LN() {
48430
+ return IN || (IN = await crypto.subtle.importKey("jwk", ON, {
48335
48431
  name: "ECDSA",
48336
48432
  namedCurve: "P-256"
48337
- }, !1, ["verify"]), SN);
48433
+ }, !1, ["verify"]), IN);
48338
48434
  }
48339
- function wN() {
48435
+ function RN() {
48340
48436
  try {
48341
- return localStorage.getItem(hN);
48437
+ return localStorage.getItem(kN);
48342
48438
  } catch {
48343
48439
  return null;
48344
48440
  }
48345
48441
  }
48346
- function TN(e) {
48442
+ function zN(e) {
48347
48443
  try {
48348
- localStorage.setItem(hN, e);
48444
+ localStorage.setItem(kN, e);
48349
48445
  } catch {}
48350
48446
  }
48351
- function EN() {
48447
+ function BN() {
48352
48448
  try {
48353
- localStorage.removeItem(hN);
48449
+ localStorage.removeItem(kN);
48354
48450
  } catch {}
48355
48451
  }
48356
- async function DN(e, t, n) {
48452
+ async function VN(e, t, n) {
48357
48453
  let r = e.indexOf(".");
48358
48454
  if (r === -1) return !1;
48359
- let i = e.slice(0, r), a = e.slice(r + 1), o = bN(i), s = bN(a), c = await CN();
48455
+ let i = e.slice(0, r), a = e.slice(r + 1), o = PN(i), s = PN(a), c = await LN();
48360
48456
  if (!await crypto.subtle.verify({
48361
48457
  name: "ECDSA",
48362
48458
  hash: "SHA-256"
48363
48459
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
48364
48460
  let l = JSON.parse(new TextDecoder().decode(o));
48365
48461
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
48366
- let u = await xN(t);
48462
+ let u = await FN(t);
48367
48463
  return !(l.key !== u || l.domain !== n);
48368
48464
  }
48369
- async function ON(e) {
48370
- let t = wN();
48465
+ async function HN(e) {
48466
+ let t = RN();
48371
48467
  if (!t) return {
48372
48468
  valid: !1,
48373
48469
  errorCode: "license.invalid"
48374
48470
  };
48375
48471
  try {
48376
- if (await DN(t, e, window.location.hostname.toLowerCase().trim())) return {
48472
+ if (await VN(t, e, window.location.hostname.toLowerCase().trim())) return {
48377
48473
  valid: !0,
48378
48474
  errorCode: null
48379
48475
  };
@@ -48383,23 +48479,23 @@ async function ON(e) {
48383
48479
  errorCode: "license.invalid"
48384
48480
  };
48385
48481
  }
48386
- async function kN(e, t = !0) {
48387
- if (_N() || vN()) return {
48482
+ async function UN(e, t = !0) {
48483
+ if (jN() || MN()) return {
48388
48484
  valid: !0,
48389
48485
  errorCode: null
48390
48486
  };
48391
- let n = yN();
48487
+ let n = NN();
48392
48488
  try {
48393
48489
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
48394
48490
  if (r.ok) {
48395
48491
  let e = await r.json();
48396
- return t && e.grant && TN(e.grant), {
48492
+ return t && e.grant && zN(e.grant), {
48397
48493
  valid: !0,
48398
48494
  errorCode: null
48399
48495
  };
48400
48496
  }
48401
48497
  if (r.status >= 400 && r.status < 500) {
48402
- t && EN();
48498
+ t && BN();
48403
48499
  try {
48404
48500
  return await r.json();
48405
48501
  } catch {
@@ -48411,7 +48507,7 @@ async function kN(e, t = !0) {
48411
48507
  }
48412
48508
  throw Error(`Server error: ${r.status}`);
48413
48509
  } catch {
48414
- return t ? ON(e) : {
48510
+ return t ? HN(e) : {
48415
48511
  valid: !1,
48416
48512
  errorCode: "license.invalid"
48417
48513
  };
@@ -48419,7 +48515,7 @@ async function kN(e, t = !0) {
48419
48515
  }
48420
48516
  //#endregion
48421
48517
  //#region src/hooks/useLicenseValidation.ts
48422
- function AN(e, t, n = !0) {
48518
+ function WN(e, t, n = !0) {
48423
48519
  let [r, i] = (0, y.useState)({
48424
48520
  isValidating: t,
48425
48521
  isValid: !1,
@@ -48439,7 +48535,7 @@ function AN(e, t, n = !0) {
48439
48535
  isValidating: !0,
48440
48536
  isValid: !1,
48441
48537
  errorCode: null
48442
- }), kN(e, n).then((e) => {
48538
+ }), UN(e, n).then((e) => {
48443
48539
  r || i({
48444
48540
  isValidating: !1,
48445
48541
  isValid: e.valid,
@@ -48462,7 +48558,7 @@ function AN(e, t, n = !0) {
48462
48558
  }
48463
48559
  //#endregion
48464
48560
  //#region src/server/auth/AuthState.ts
48465
- var jN = class {
48561
+ var GN = class {
48466
48562
  token = null;
48467
48563
  get() {
48468
48564
  return this.token;
@@ -48473,13 +48569,13 @@ var jN = class {
48473
48569
  clear() {
48474
48570
  this.token = null;
48475
48571
  }
48476
- }, MN = class extends Error {
48572
+ }, KN = class extends Error {
48477
48573
  status;
48478
48574
  code;
48479
48575
  constructor(e) {
48480
48576
  super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
48481
48577
  }
48482
- }, NN = class {
48578
+ }, qN = class {
48483
48579
  baseUrl;
48484
48580
  apiKey;
48485
48581
  auth;
@@ -48509,7 +48605,7 @@ var jN = class {
48509
48605
  signal: r?.signal
48510
48606
  });
48511
48607
  } catch (e) {
48512
- this.notify(new MN({
48608
+ this.notify(new KN({
48513
48609
  status: 0,
48514
48610
  code: "network",
48515
48611
  message: e instanceof Error ? e.message : String(e)
@@ -48520,7 +48616,7 @@ var jN = class {
48520
48616
  try {
48521
48617
  e = await s.json();
48522
48618
  } catch {}
48523
- this.notify(new MN({
48619
+ this.notify(new KN({
48524
48620
  status: s.status,
48525
48621
  code: e.error ?? `http_${s.status}`,
48526
48622
  message: e.message ?? s.statusText
@@ -48531,23 +48627,23 @@ var jN = class {
48531
48627
  };
48532
48628
  //#endregion
48533
48629
  //#region src/server/endpoints/workspaces.ts
48534
- async function PN(e, t) {
48630
+ async function JN(e, t) {
48535
48631
  return e.post("/workspaces", {
48536
48632
  primaryKey: t.primaryKey,
48537
48633
  columns: t.columns
48538
48634
  }, { signal: t.signal });
48539
48635
  }
48540
- async function FN(e) {
48636
+ async function YN(e) {
48541
48637
  try {
48542
48638
  await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
48543
48639
  } catch (e) {
48544
- if (e instanceof MN && e.status === 404) return;
48640
+ if (e instanceof KN && e.status === 404) return;
48545
48641
  throw e;
48546
48642
  }
48547
48643
  }
48548
48644
  //#endregion
48549
48645
  //#region src/server/endpoints/query.ts
48550
- async function IN(e, t) {
48646
+ async function XN(e, t) {
48551
48647
  let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
48552
48648
  page: {
48553
48649
  limit: t.limit,
@@ -48565,12 +48661,12 @@ async function IN(e, t) {
48565
48661
  }
48566
48662
  //#endregion
48567
48663
  //#region src/server/ScaleClient.ts
48568
- var LN = class {
48664
+ var ZN = class {
48569
48665
  disposed = !1;
48570
48666
  constructor(e) {
48571
48667
  this.deps = e;
48572
48668
  }
48573
- onQuery = (e) => IN(this.deps, e);
48669
+ onQuery = (e) => XN(this.deps, e);
48574
48670
  onEdit = async (e) => ({
48575
48671
  rejected: !0,
48576
48672
  reason: "Edits are not yet supported in server mode (v0)."
@@ -48587,7 +48683,7 @@ var LN = class {
48587
48683
  pageSize = void 0;
48588
48684
  scrollSensitivity = void 0;
48589
48685
  dispose = async () => {
48590
- this.disposed || (this.disposed = !0, await FN({
48686
+ this.disposed || (this.disposed = !0, await YN({
48591
48687
  http: this.deps.http,
48592
48688
  workspaceId: this.deps.workspaceId
48593
48689
  }));
@@ -48595,25 +48691,25 @@ var LN = class {
48595
48691
  };
48596
48692
  //#endregion
48597
48693
  //#region src/server/createScaleClient.ts
48598
- async function RN(e) {
48599
- let t = new jN(), n = new NN({
48694
+ async function QN(e) {
48695
+ let t = new GN(), n = new qN({
48600
48696
  baseUrl: e.url,
48601
48697
  apiKey: e.apiKey,
48602
48698
  auth: t,
48603
48699
  onDegraded: e.onDegraded
48604
- }), { workspaceId: r, accessToken: i } = await PN(n, {
48700
+ }), { workspaceId: r, accessToken: i } = await JN(n, {
48605
48701
  primaryKey: e.primaryKey,
48606
48702
  columns: e.columns,
48607
48703
  signal: e.signal
48608
48704
  });
48609
- return t.set(i), new LN({
48705
+ return t.set(i), new ZN({
48610
48706
  workspaceId: r,
48611
48707
  http: n
48612
48708
  });
48613
48709
  }
48614
48710
  //#endregion
48615
48711
  //#region src/server/errors.ts
48616
- function zN(e, t, n) {
48712
+ function $N(e, t, n) {
48617
48713
  return {
48618
48714
  code: e,
48619
48715
  message: t,
@@ -48623,7 +48719,7 @@ function zN(e, t, n) {
48623
48719
  }
48624
48720
  //#endregion
48625
48721
  //#region src/hooks/useScaleClient.ts
48626
- function BN(e) {
48722
+ function eP(e) {
48627
48723
  let [t, n] = (0, y.useState)({ status: "idle" }), r = (0, y.useRef)(e.columns), i = (0, y.useRef)(e.primaryKey);
48628
48724
  return (0, y.useEffect)(() => {
48629
48725
  if (!e.enabled) {
@@ -48632,7 +48728,7 @@ function BN(e) {
48632
48728
  }
48633
48729
  n({ status: "bootstrapping" });
48634
48730
  let t = new AbortController(), a = null;
48635
- return RN({
48731
+ return QN({
48636
48732
  url: e.url,
48637
48733
  apiKey: e.apiKey,
48638
48734
  primaryKey: i.current,
@@ -48641,7 +48737,7 @@ function BN(e) {
48641
48737
  onDegraded: (e) => {
48642
48738
  t.signal.aborted || n({
48643
48739
  status: "failed",
48644
- error: HN(e)
48740
+ error: nP(e)
48645
48741
  });
48646
48742
  }
48647
48743
  }).then((e) => {
@@ -48656,7 +48752,7 @@ function BN(e) {
48656
48752
  }).catch((e) => {
48657
48753
  t.signal.aborted || n({
48658
48754
  status: "failed",
48659
- error: VN(e)
48755
+ error: tP(e)
48660
48756
  });
48661
48757
  }), () => {
48662
48758
  t.abort(), a?.dispose().catch(() => {});
@@ -48667,30 +48763,30 @@ function BN(e) {
48667
48763
  e.apiKey
48668
48764
  ]), t;
48669
48765
  }
48670
- function VN(e) {
48671
- return e instanceof MN ? e.status === 401 ? zN(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? zN("scale.unreachable", e.message, e) : e.status >= 500 ? zN("scale.server_error", e.message, e) : zN("scale.bootstrap_failed", e.message, e) : zN("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
48766
+ function tP(e) {
48767
+ return e instanceof KN ? e.status === 401 ? $N(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? $N("scale.unreachable", e.message, e) : e.status >= 500 ? $N("scale.server_error", e.message, e) : $N("scale.bootstrap_failed", e.message, e) : $N("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
48672
48768
  }
48673
- function HN(e) {
48674
- return e.status === 0 ? zN("scale.unreachable", e.message, e) : e.status === 404 ? zN("scale.workspace_lost", e.message, e) : zN("scale.server_error", e.message, e);
48769
+ function nP(e) {
48770
+ return e.status === 0 ? $N("scale.unreachable", e.message, e) : e.status === 404 ? $N("scale.workspace_lost", e.message, e) : $N("scale.server_error", e.message, e);
48675
48771
  }
48676
48772
  //#endregion
48677
48773
  //#region src/index.tsx
48678
- function UN(e) {
48774
+ function rP(e) {
48679
48775
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
48680
48776
  }
48681
- function WN(e) {
48777
+ function iP(e) {
48682
48778
  let t = (0, y.useMemo)(() => new ed(e.onError), [e.onError]);
48683
48779
  return /* @__PURE__ */ (0, O.jsx)(kj, {
48684
48780
  errorHandler: t,
48685
48781
  children: /* @__PURE__ */ (0, O.jsx)(eh, {
48686
48782
  ...e,
48687
48783
  errorHandler: t,
48688
- children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(pN, {}) : /* @__PURE__ */ (0, O.jsx)(Tj, {})
48784
+ children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(DN, {}) : /* @__PURE__ */ (0, O.jsx)(Tj, {})
48689
48785
  })
48690
48786
  });
48691
48787
  }
48692
- function GN(e) {
48693
- let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a = UN(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = AN(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = BN({
48788
+ function aP(e) {
48789
+ let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a = rP(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = WN(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = eP({
48694
48790
  enabled: !s && c && u,
48695
48791
  url: e.__server?.url ?? "",
48696
48792
  apiKey: e.apiKey,
@@ -48745,7 +48841,7 @@ function GN(e) {
48745
48841
  code: e,
48746
48842
  message: "License validation failed",
48747
48843
  source: "license"
48748
- } }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(WN, { ...C }) : T(l ?? "license.invalid");
48844
+ } }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(iP, { ...C }) : T(l ?? "license.invalid");
48749
48845
  return t === "inline" ? /* @__PURE__ */ (0, O.jsx)("div", {
48750
48846
  className: "updog__data-editor updog__data-editor-inline",
48751
48847
  dir: i,
@@ -48765,18 +48861,18 @@ function GN(e) {
48765
48861
  submitText: n("dataEditor.confirmClose.action")
48766
48862
  })] });
48767
48863
  }
48768
- function KN(e) {
48864
+ function oP(e) {
48769
48865
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
48770
48866
  return /* @__PURE__ */ (0, O.jsx)(A, {
48771
48867
  translations: t,
48772
48868
  rtl: n,
48773
48869
  locale: r,
48774
- children: /* @__PURE__ */ (0, O.jsx)(GN, { ...a })
48870
+ children: /* @__PURE__ */ (0, O.jsx)(aP, { ...a })
48775
48871
  });
48776
48872
  }
48777
48873
  //#endregion
48778
48874
  //#region src/wc.ts
48779
- var qN = {
48875
+ var sP = {
48780
48876
  "api-key": {
48781
48877
  prop: "apiKey",
48782
48878
  type: "string"
@@ -48809,12 +48905,12 @@ var qN = {
48809
48905
  prop: "mode",
48810
48906
  type: "string"
48811
48907
  }
48812
- }, JN = class extends HTMLElement {
48908
+ }, cP = class extends HTMLElement {
48813
48909
  _root = null;
48814
48910
  _props = {};
48815
48911
  _renderScheduled = !1;
48816
48912
  static get observedAttributes() {
48817
- return Object.keys(qN);
48913
+ return Object.keys(sP);
48818
48914
  }
48819
48915
  connectedCallback() {
48820
48916
  this._root = (0, v.createRoot)(this), this._props.mode !== "inline" && (this._props.onClose = () => {
@@ -48825,7 +48921,7 @@ var qN = {
48825
48921
  this._root?.unmount(), this._root = null;
48826
48922
  }
48827
48923
  attributeChangedCallback(e, t, n) {
48828
- let r = qN[e];
48924
+ let r = sP[e];
48829
48925
  r && (this._props[r.prop] = r.type === "boolean" ? n !== null : n, e === "mode" && (n === "inline" ? delete this._props.onClose : this._props.onClose = () => {
48830
48926
  this.dispatchEvent(new CustomEvent("close", { bubbles: !0 }));
48831
48927
  }), this._scheduleRender());
@@ -48842,11 +48938,11 @@ var qN = {
48842
48938
  }
48843
48939
  _scheduleRender() {
48844
48940
  this._renderScheduled || (this._renderScheduled = !0, queueMicrotask(() => {
48845
- this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(KN, this._props));
48941
+ this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(oP, this._props));
48846
48942
  }));
48847
48943
  }
48848
48944
  };
48849
- for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(JN.prototype, e, {
48945
+ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(cP.prototype, e, {
48850
48946
  get() {
48851
48947
  return this._props[e];
48852
48948
  },
@@ -48856,7 +48952,7 @@ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.
48856
48952
  enumerable: !0,
48857
48953
  configurable: !0
48858
48954
  });
48859
- Object.defineProperty(JN.prototype, "open", {
48955
+ Object.defineProperty(cP.prototype, "open", {
48860
48956
  get() {
48861
48957
  return this.hasAttribute("open");
48862
48958
  },
@@ -48865,5 +48961,5 @@ Object.defineProperty(JN.prototype, "open", {
48865
48961
  },
48866
48962
  enumerable: !0,
48867
48963
  configurable: !0
48868
- }), customElements.define("updog-editor", JN);
48964
+ }), customElements.define("updog-editor", cP);
48869
48965
  //#endregion