@updog/data-editor-wc 0.1.88 → 0.1.89

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.d.ts +72 -1
  2. package/index.js +608 -550
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -28150,6 +28150,9 @@ var vy = class {
28150
28150
  message: b_(t)
28151
28151
  });
28152
28152
  }
28153
+ readFieldValue(e, t) {
28154
+ return this.fieldReader(e)(t);
28155
+ }
28153
28156
  fieldReader(e) {
28154
28157
  let t = this._effectiveColumns.find((t) => t.id === e);
28155
28158
  return t ? Hh(t).reader(null, t, this.getFormatContext()) : (e) => e;
@@ -30112,29 +30115,29 @@ var Ly = (e, t, n) => {
30112
30115
  let r = Od(t, n.map((e) => e.id));
30113
30116
  return r.length === 0 ? "" : `[updog] primaryKey names ${r.map((e) => `"${e}"`).join(", ")}, which no column declares. Imported rows are appended instead of merged.`;
30114
30117
  };
30115
- function Ry({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i, showUploader: a, setShowUploader: o, storeRef: s, enableDeleteRow: c, enableAddRow: l, enableAddSource: u, blockSubmitOnError: d, importFormats: f, exportFormats: p, rowHeight: m, headerHeight: h, readonly: g, enableCreateColumn: _, onColumnMatch: v, onValueMatch: b, synonyms: x, sampleData: S, chat: C, remoteSources: w, customFormats: T, onUnstructuredFile: E, onError: D, errorHandler: O }) {
30116
- let k = Oy(O ?? new xd(D)), { t: A, locale: j } = W();
30117
- k.setSchemaColumns(e), k.setI18n({
30118
- t: A,
30119
- locale: j
30118
+ function Ry({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i, showUploader: a, setShowUploader: o, storeRef: s, enableDeleteRow: c, enableAddRow: l, enableAddSource: u, blockSubmitOnError: d, importFormats: f, exportFormats: p, rowHeight: m, headerHeight: h, readonly: g, enableCreateColumn: _, onColumnMatch: v, onValueMatch: b, onRowImport: x, context: S, synonyms: C, sampleData: w, chat: T, remoteSources: E, customFormats: D, onUnstructuredFile: O, onError: k, errorHandler: A }) {
30119
+ let j = Oy(A ?? new xd(k)), { t: M, locale: N } = W();
30120
+ j.setSchemaColumns(e), j.setI18n({
30121
+ t: M,
30122
+ locale: N
30120
30123
  });
30121
- let { addDynamicColumns: M, removeDynamicColumn: N, updateColumn: P } = My(k), F = (0, y.useCallback)((e) => {
30122
- k.setDynamicColumns(e);
30123
- }, [k]), I = (0, y.useSyncExternalStore)(k.subscribe, k.getEffectiveColumns), { navigateToCell: L, navigateToCellRef: R, resetScrollRef: z, scrollToGridTop: B } = Ny(k), { validator: V, validatorRef: H, findReplace: U } = Iy(k, I), { search: ee, setSearch: G, matchCase: te, setMatchCase: ne, matchEntireCell: re, setMatchEntireCell: ie, searchMode: ae, setSearchMode: oe, filterColumns: se, setFilterColumns: ce, filtersResetKey: le, resetFilters: K } = Fy(k, U, L, B);
30124
- jy(k, H, n);
30125
- let { portalRef: ue } = Py(), de = (0, y.useCallback)((e, t) => {
30126
- k.setViewportRange(e, t);
30127
- }, [k]), [fe, pe] = (0, y.useState)(null), [me, he] = (0, y.useState)([]), ge = (0, y.useCallback)((e) => {
30128
- he(e), o(!0);
30124
+ let { addDynamicColumns: P, removeDynamicColumn: F, updateColumn: I } = My(j), L = (0, y.useCallback)((e) => {
30125
+ j.setDynamicColumns(e);
30126
+ }, [j]), R = (0, y.useSyncExternalStore)(j.subscribe, j.getEffectiveColumns), { navigateToCell: z, navigateToCellRef: B, resetScrollRef: V, scrollToGridTop: H } = Ny(j), { validator: U, validatorRef: ee, findReplace: G } = Iy(j, R), { search: te, setSearch: ne, matchCase: re, setMatchCase: ie, matchEntireCell: ae, setMatchEntireCell: oe, searchMode: se, setSearchMode: ce, filterColumns: le, setFilterColumns: K, filtersResetKey: ue, resetFilters: de } = Fy(j, G, z, H);
30127
+ jy(j, ee, n);
30128
+ let { portalRef: fe } = Py(), pe = (0, y.useCallback)((e, t) => {
30129
+ j.setViewportRange(e, t);
30130
+ }, [j]), [me, he] = (0, y.useState)(null), [ge, _e] = (0, y.useState)([]), ve = (0, y.useCallback)((e) => {
30131
+ _e(e), o(!0);
30129
30132
  }, [o]);
30130
- (0, y.useEffect)(() => (s && (s.current = k), () => {
30133
+ (0, y.useEffect)(() => (s && (s.current = j), () => {
30131
30134
  s && (s.current = null);
30132
- }), [k, s]);
30133
- let _e = wd(t), ve = Ly(t != null, _e, e);
30135
+ }), [j, s]);
30136
+ let ye = wd(t), be = Ly(t != null, ye, e);
30134
30137
  return (0, y.useEffect)(() => {
30135
- ve !== "" && console.warn(ve);
30136
- }, [ve]), {
30137
- columns: I,
30138
+ be !== "" && console.warn(be);
30139
+ }, [be]), {
30140
+ columns: R,
30138
30141
  primaryKey: t,
30139
30142
  enableDeleteRow: c ?? !1,
30140
30143
  enableAddRow: l ?? !0,
@@ -30144,53 +30147,55 @@ function Ry({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i,
30144
30147
  exportFormats: p ?? hd,
30145
30148
  rowHeight: m ?? 34,
30146
30149
  headerHeight: h ?? 36,
30147
- store: k,
30148
- validator: V,
30149
- findReplace: U,
30150
+ store: j,
30151
+ validator: U,
30152
+ findReplace: G,
30150
30153
  onComplete: r,
30151
30154
  showUploader: a,
30152
30155
  setShowUploader: o,
30153
- pendingImportFiles: me,
30154
- setPendingImportFiles: he,
30155
- openUploaderWithFiles: ge,
30156
+ pendingImportFiles: ge,
30157
+ setPendingImportFiles: _e,
30158
+ openUploaderWithFiles: ve,
30156
30159
  variant: i ?? "editor",
30157
30160
  isViewer: i === "viewer",
30158
- search: ee,
30159
- setSearch: G,
30160
- matchCase: te,
30161
- setMatchCase: ne,
30162
- matchEntireCell: re,
30163
- setMatchEntireCell: ie,
30164
- searchMode: ae,
30165
- setSearchMode: oe,
30166
- filterColumns: se,
30167
- setFilterColumns: ce,
30168
- navigateToCell: L,
30169
- navigateToCellRef: R,
30170
- resetScrollRef: z,
30171
- scrollToGridTop: B,
30172
- portalRef: ue,
30161
+ search: te,
30162
+ setSearch: ne,
30163
+ matchCase: re,
30164
+ setMatchCase: ie,
30165
+ matchEntireCell: ae,
30166
+ setMatchEntireCell: oe,
30167
+ searchMode: se,
30168
+ setSearchMode: ce,
30169
+ filterColumns: le,
30170
+ setFilterColumns: K,
30171
+ navigateToCell: z,
30172
+ navigateToCellRef: B,
30173
+ resetScrollRef: V,
30174
+ scrollToGridTop: H,
30175
+ portalRef: fe,
30173
30176
  readonly: i === "viewer" ? !0 : g ?? !1,
30174
- filtersResetKey: le,
30175
- resetFilters: K,
30177
+ filtersResetKey: ue,
30178
+ resetFilters: de,
30176
30179
  originalColumns: e,
30177
- dynamicColumns: k.getDynamicColumns(),
30178
- setDynamicColumns: F,
30179
- addDynamicColumns: M,
30180
- removeDynamicColumn: N,
30181
- updateColumn: P,
30182
- gridClipboard: fe,
30183
- setGridClipboard: pe,
30180
+ dynamicColumns: j.getDynamicColumns(),
30181
+ setDynamicColumns: L,
30182
+ addDynamicColumns: P,
30183
+ removeDynamicColumn: F,
30184
+ updateColumn: I,
30185
+ gridClipboard: me,
30186
+ setGridClipboard: he,
30184
30187
  enableCreateColumn: _ ?? !0,
30185
30188
  onColumnMatch: v,
30186
30189
  onValueMatch: b,
30187
- synonyms: x,
30188
- sampleData: S,
30189
- onVisibleRangeChange: de,
30190
- chat: C,
30191
- remoteSources: w ?? [],
30192
- customFormats: f === !1 ? [] : T ?? [],
30193
- onUnstructuredFile: f === !1 ? void 0 : E
30190
+ onRowImport: x,
30191
+ context: S,
30192
+ synonyms: C,
30193
+ sampleData: w,
30194
+ onVisibleRangeChange: pe,
30195
+ chat: T,
30196
+ remoteSources: E ?? [],
30197
+ customFormats: f === !1 ? [] : D ?? [],
30198
+ onUnstructuredFile: f === !1 ? void 0 : O
30194
30199
  };
30195
30200
  }
30196
30201
  //#endregion
@@ -50843,37 +50848,34 @@ var FH = (e, t) => {
50843
50848
  column: n.has(a) ? void 0 : r.get(a)
50844
50849
  });
50845
50850
  return i;
50846
- }, DU = (e, t, n, r) => {
50851
+ }, DU = Symbol("keep-cell"), OU = (e, t, n, r, i) => {
50852
+ if (!e) return n;
50853
+ let a = Hh(e);
50854
+ if (a.options(e) !== null && a.storage === "string") {
50855
+ let r = typeof n == "string" ? n : String(n ?? ""), o = i.valueMapping[t]?.[r];
50856
+ return o === void 0 ? a.matchImported ? r : DU : e.transformer ? rg(e.transformer, o) : o;
50857
+ }
50858
+ if (a.storage === "string[]") {
50859
+ let r = typeof n == "string" ? n : String(n ?? ""), o = i.multiselectDelimiters[t], s = a.options(e) ?? [], c = o ? Vd(r, o, s, TU(e)) : r === "" ? [] : [r], l = [], u = /* @__PURE__ */ new Set();
50860
+ for (let e of c) {
50861
+ let n = e.trim(), r = i.valueMapping[t]?.[n] ?? (a.matchImported ? n : void 0);
50862
+ r !== void 0 && !u.has(r) && (u.add(r), l.push(r));
50863
+ }
50864
+ return e.transformer ? rg(e.transformer, l) : l;
50865
+ }
50866
+ let o = r(n);
50867
+ return e.transformer ? rg(e.transformer, o) : o;
50868
+ }, kU = (e, t, n, r) => {
50847
50869
  let i = r();
50848
50870
  for (let { csvHeader: r, columnId: a, column: o } of t) {
50849
- let t = e[r] ?? "";
50850
- if (!o) {
50851
- i[a] = t;
50852
- continue;
50853
- }
50854
- let s = Hh(o);
50855
- if (s.options(o) !== null && s.storage === "string") {
50856
- let e = n.valueMapping[a]?.[t];
50857
- e === void 0 ? s.matchImported && (i[a] = t) : i[a] = o.transformer ? rg(o.transformer, e) : e;
50858
- continue;
50859
- }
50860
- if (s.storage === "string[]") {
50861
- let e = n.multiselectDelimiters[a], r = s.options(o) ?? [], c = e ? Vd(t, e, r, TU(o)) : t === "" ? [] : [t], l = [], u = /* @__PURE__ */ new Set();
50862
- for (let e of c) {
50863
- let t = e.trim(), r = n.valueMapping[a]?.[t] ?? (s.matchImported ? t : void 0);
50864
- r !== void 0 && !u.has(r) && (u.add(r), l.push(r));
50865
- }
50866
- i[a] = o.transformer ? rg(o.transformer, l) : l;
50867
- continue;
50868
- }
50869
- let c = n.read(r)(t);
50870
- i[a] = o.transformer ? rg(o.transformer, c) : c;
50871
+ let t = OU(o, a, e[r] ?? "", (e) => n.read(r)(e), n);
50872
+ t !== DU && (i[a] = t);
50871
50873
  }
50872
50874
  return i;
50873
50875
  };
50874
50876
  //#endregion
50875
50877
  //#region src/components/DataUploader/core/importing/raggedRows/computeDisputeSpans.ts
50876
- function OU(e) {
50878
+ function AU(e) {
50877
50879
  if (e.length <= 1) return [];
50878
50880
  let t = e[0].cells.length, n = [], r = -1;
50879
50881
  for (let i = 0; i < t; i++) {
@@ -50888,16 +50890,16 @@ function OU(e) {
50888
50890
  end: t - 1
50889
50891
  }), n;
50890
50892
  }
50891
- function kU(e, t, n) {
50893
+ function jU(e, t, n) {
50892
50894
  let r = e.length, i = t;
50893
- return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? AU(i, i - r) : AU(r - 1, i - 1)) > 1e3 ? [] : r < i ? jU(e, i) : MU(e, i, n);
50895
+ return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? MU(i, i - r) : MU(r - 1, i - 1)) > 1e3 ? [] : r < i ? NU(e, i) : PU(e, i, n);
50894
50896
  }
50895
- function AU(e, t) {
50897
+ function MU(e, t) {
50896
50898
  let n = Math.min(t, e - t), r = 1;
50897
50899
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
50898
50900
  return r;
50899
50901
  }
50900
- function jU(e, t) {
50902
+ function NU(e, t) {
50901
50903
  let n = e.length, r = [], i = [], a = (o) => {
50902
50904
  if (i.length === n) {
50903
50905
  let a = Array(t).fill("");
@@ -50909,7 +50911,7 @@ function jU(e, t) {
50909
50911
  };
50910
50912
  return a(0), r;
50911
50913
  }
50912
- function MU(e, t, n) {
50914
+ function PU(e, t, n) {
50913
50915
  let r = e.length, i = [], a = [], o = (s) => {
50914
50916
  if (a.length === t - 1) {
50915
50917
  let o = [
@@ -50927,45 +50929,45 @@ function MU(e, t, n) {
50927
50929
  }
50928
50930
  //#endregion
50929
50931
  //#region src/components/DataUploader/core/importing/raggedRows/pruneByValidators.ts
50930
- var NU = {};
50931
- function PU(e, t) {
50932
+ var FU = {};
50933
+ function IU(e, t) {
50932
50934
  for (let n of t.validators ?? []) if (!sv(n) && n.type !== "asyncFunction") {
50933
50935
  if (n.type === "function") {
50934
- if (n.fn(e, NU) != null) return !1;
50936
+ if (n.fn(e, FU) != null) return !1;
50935
50937
  continue;
50936
50938
  }
50937
- if (_y(n, e, NU) != null) return !1;
50939
+ if (_y(n, e, FU) != null) return !1;
50938
50940
  }
50939
50941
  return !0;
50940
50942
  }
50941
- function FU(e, t) {
50942
- for (let n = 0; n < t.length; n++) if (!PU(e.cells[n] ?? "", t[n])) return !1;
50943
+ function LU(e, t) {
50944
+ for (let n = 0; n < t.length; n++) if (!IU(e.cells[n] ?? "", t[n])) return !1;
50943
50945
  return !0;
50944
50946
  }
50945
- function IU(e, t) {
50946
- return e.filter((e) => FU(e, t));
50947
+ function RU(e, t) {
50948
+ return e.filter((e) => LU(e, t));
50947
50949
  }
50948
50950
  //#endregion
50949
50951
  //#region src/components/DataUploader/core/importing/raggedRows/alignRow.ts
50950
- function LU(e, t, n) {
50951
- let r = kU(e, t.length, n), i = IU(r, t);
50952
+ function zU(e, t, n) {
50953
+ let r = jU(e, t.length, n), i = RU(r, t);
50952
50954
  return i.length === 1 ? {
50953
50955
  kind: "confident",
50954
50956
  alignment: i[0]
50955
50957
  } : i.length > 1 ? {
50956
50958
  kind: "ambiguous",
50957
50959
  candidates: i,
50958
- disputeSpans: OU(i)
50960
+ disputeSpans: AU(i)
50959
50961
  } : {
50960
50962
  kind: "invalid",
50961
50963
  candidates: r,
50962
- disputeSpans: OU(r)
50964
+ disputeSpans: AU(r)
50963
50965
  };
50964
50966
  }
50965
50967
  //#endregion
50966
50968
  //#region src/components/DataUploader/core/importing/raggedRows/resolveRaggedRow.ts
50967
- function RU(e, t, n) {
50968
- let r = LU(e, t, n);
50969
+ function BU(e, t, n) {
50970
+ let r = zU(e, t, n);
50969
50971
  if (r.kind === "confident") return {
50970
50972
  cells: r.alignment.cells,
50971
50973
  conflictColumns: []
@@ -50984,7 +50986,7 @@ function RU(e, t, n) {
50984
50986
  }
50985
50987
  //#endregion
50986
50988
  //#region src/components/DataUploader/core/importing/scheduler.ts
50987
- var zU = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
50989
+ var VU = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
50988
50990
  let { port1: t, port2: n } = new MessageChannel();
50989
50991
  t.onmessage = () => {
50990
50992
  t.close(), e();
@@ -50992,32 +50994,33 @@ var zU = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)
50992
50994
  });
50993
50995
  //#endregion
50994
50996
  //#region src/components/DataUploader/core/importing/runChunked.ts
50995
- async function BU(e, t) {
50997
+ async function HU(e, t) {
50996
50998
  let { rawRows: n, dataStartIndex: r, chunkSize: i, signal: a } = e, o = [];
50997
50999
  for (let e = r; e < n.length; e++) {
50998
51000
  let t = n[e];
50999
51001
  t && !mH(t) && o.push(e);
51000
51002
  }
51001
- let s = 0, c = 0;
51002
- for (; s < o.length;) {
51003
+ let s = Math.ceil(o.length / i), c = 0, l = 0;
51004
+ for (; c < o.length;) {
51003
51005
  if (a.aborted) return "cancelled";
51004
- let e = Math.min(s + i, o.length), r = [];
51005
- for (let t = s; t < e; t++) {
51006
+ let e = Math.min(c + i, o.length), r = [];
51007
+ for (let t = c; t < e; t++) {
51006
51008
  let e = n[o[t]];
51007
51009
  e && r.push(e);
51008
51010
  }
51009
51011
  await t(r, {
51010
- chunkIndex: c,
51012
+ chunkIndex: l,
51013
+ chunkCount: s,
51011
51014
  isLastChunk: e >= o.length
51012
51015
  });
51013
- for (let t = s; t < e; t++) n[o[t]] = void 0;
51014
- s = e, c++, s < o.length && await zU();
51016
+ for (let t = c; t < e; t++) n[o[t]] = void 0;
51017
+ c = e, l++, c < o.length && await VU();
51015
51018
  }
51016
51019
  return "completed";
51017
51020
  }
51018
51021
  //#endregion
51019
51022
  //#region src/components/DataUploader/core/importing/runImport.ts
51020
- var VU = 5e3, HU = async (e) => {
51023
+ var UU = 5e3, WU = async (e) => {
51021
51024
  let t = e.rawRows;
51022
51025
  if (!t) return {
51023
51026
  outcome: "completed",
@@ -51042,49 +51045,122 @@ var VU = 5e3, HU = async (e) => {
51042
51045
  read: u.reader,
51043
51046
  valueMapping: e.valueMapping,
51044
51047
  multiselectDelimiters: e.multiselectDelimiters
51045
- }, f = i.map((t) => {
51048
+ }, f = e.onRowImport, p = e.hookRunState ?? { rowImportHookDisabled: !1 }, m = /* @__PURE__ */ new Map();
51049
+ for (let t of [...e.columns, ...e.pendingColumns]) m.set(t.id, t);
51050
+ let h = /* @__PURE__ */ new Map();
51051
+ for (let e of s) h.set(e.columnId, e.csvHeader);
51052
+ let g = /* @__PURE__ */ new Map(), _ = (t) => {
51053
+ let n = g.get(t);
51054
+ if (!n) {
51055
+ let r = h.get(t);
51056
+ n = r === void 0 ? (n) => e.store.readFieldValue(t, n) : (e) => d.read(r)(e), g.set(t, n);
51057
+ }
51058
+ return n;
51059
+ }, v = (e, t) => OU(n.has(e) ? void 0 : m.get(e), e, t, _(e), d), y = (e, t) => {
51060
+ let n = { ...e };
51061
+ for (let r of c.keys) {
51062
+ let i = t[r];
51063
+ if (Object.is(i, e[r])) continue;
51064
+ let a = v(r, i);
51065
+ n[r] = a === DU ? "" : a;
51066
+ }
51067
+ return n;
51068
+ }, b = (e) => {
51069
+ let t = c.make();
51070
+ for (let n of c.keys) {
51071
+ if (!(n in e)) continue;
51072
+ let r = v(n, e[n]);
51073
+ r !== DU && (t[n] = r);
51074
+ }
51075
+ return t;
51076
+ }, x = i.map((t) => {
51046
51077
  let n = e.columnMapping[t];
51047
51078
  return (n ? e.columns.find((e) => e.id === n) : void 0) ?? {
51048
51079
  id: t,
51049
51080
  title: t
51050
51081
  };
51051
- }), p = 0, m = 0, h = await BU({
51082
+ }), S = 0, C = 0, w = await HU({
51052
51083
  rawRows: t,
51053
51084
  dataStartIndex: e.workbook.dataStartIndex,
51054
- chunkSize: VU,
51085
+ chunkSize: UU,
51055
51086
  signal: e.signal
51056
- }, async (t) => {
51057
- let n = [], o = [];
51058
- for (let r = 0; r < t.length; r++) {
51059
- let l = t[r], u = GH(l, i);
51060
- if (l.length !== i.length) {
51061
- let { cells: t, conflictColumns: n } = RU(l.map((e) => String(e ?? "")), f, a);
51087
+ }, async (t, n) => {
51088
+ let o = [], l = f && !p.rowImportHookDisabled ? [] : null, u = [];
51089
+ for (let n = 0; n < t.length; n++) {
51090
+ let r = t[n], f = GH(r, i);
51091
+ if (r.length !== i.length) {
51092
+ let { cells: t, conflictColumns: o } = BU(r.map((e) => String(e ?? "")), x, a);
51062
51093
  if (t.length) {
51063
51094
  let e = {};
51064
51095
  for (let n = 0; n < i.length; n++) e[i[n]] = t[n] ?? "";
51065
- u = e;
51096
+ f = e;
51066
51097
  }
51067
- if (n.length) {
51098
+ if (o.length) {
51068
51099
  let t = [];
51069
- for (let r of n) {
51070
- let n = e.columnMapping[i[r]];
51071
- n && t.push(n);
51100
+ for (let n of o) {
51101
+ let r = e.columnMapping[i[n]];
51102
+ r && t.push(r);
51072
51103
  }
51073
- t.length && o.push({
51074
- localIndex: r,
51104
+ t.length && u.push({
51105
+ localIndex: n,
51075
51106
  columnIds: t
51076
51107
  });
51077
51108
  }
51078
51109
  }
51079
- n.push(DU(u, s, d, c.make));
51110
+ l && l.push(f), o.push(kU(f, s, d, c.make));
51111
+ }
51112
+ let m = o, h = null;
51113
+ if (f && l && !p.rowImportHookDisabled) try {
51114
+ let t = o.map((e, t) => ({
51115
+ row: { ...e },
51116
+ raw: l[t]
51117
+ })), r = {
51118
+ chunkIndex: n.chunkIndex,
51119
+ chunkCount: n.chunkCount,
51120
+ isLastChunk: n.isLastChunk,
51121
+ workbook: {
51122
+ name: YH(e.workbook),
51123
+ ...e.workbook.origin.kind === "sheet" ? { sheetName: e.workbook.origin.sheetName } : {},
51124
+ headers: i
51125
+ },
51126
+ mapping: e.columnMapping,
51127
+ context: e.hookContext
51128
+ }, a = await QH(Promise.resolve(f(t, r)), ZH);
51129
+ if (a !== void 0) {
51130
+ if (!Array.isArray(a) || a.length < o.length) throw Error(`onRowImport broke its contract: got ${Array.isArray(a) ? `${a.length} rows` : typeof a} for a chunk of ${o.length} rows`);
51131
+ let e = [], t = Array(o.length).fill(null);
51132
+ for (let n = 0; n < o.length; n++) {
51133
+ let r = a[n];
51134
+ r !== null && (t[n] = e.length, e.push(y(o[n], r)));
51135
+ }
51136
+ for (let t = o.length; t < a.length; t++) {
51137
+ let n = a[t];
51138
+ n !== null && e.push(b(n));
51139
+ }
51140
+ m = e, h = t;
51141
+ }
51142
+ } catch (t) {
51143
+ p.rowImportHookDisabled = !0, m = o, h = null, e.store.errorHandler.handleError({
51144
+ code: "HOOK_ERROR",
51145
+ source: "onRowImport",
51146
+ message: t instanceof Error ? t.message : String(t),
51147
+ originalError: t
51148
+ });
51080
51149
  }
51081
- let { rows: l, rowIds: u, addedCount: h } = e.store.upsertRows(r, n, {
51150
+ let { rows: g, rowIds: _, addedCount: v } = e.store.upsertRows(r, m, {
51082
51151
  anchorKey: e.primaryKey ?? void 0,
51083
51152
  skipRowValidation: !0
51084
51153
  });
51085
- p += n.length, m += h, await zU(), e.validator.validateRows(l, u);
51086
- for (let { localIndex: t, columnIds: n } of o) {
51087
- let r = u[t];
51154
+ S += m.length, C += v, await VU(), e.validator.validateRows(g, _);
51155
+ let w = h, T = w ? u.flatMap(({ localIndex: e, columnIds: t }) => {
51156
+ let n = w[e];
51157
+ return n === null ? [] : [{
51158
+ localIndex: n,
51159
+ columnIds: t
51160
+ }];
51161
+ }) : u;
51162
+ for (let { localIndex: t, columnIds: n } of T) {
51163
+ let r = _[t];
51088
51164
  for (let t of n) {
51089
51165
  let n = e.store.getCellValidation(r, t) ?? [];
51090
51166
  e.store.setCellValidation(r, t, [...n, {
@@ -51093,9 +51169,9 @@ var VU = 5e3, HU = async (e) => {
51093
51169
  }]);
51094
51170
  }
51095
51171
  }
51096
- o.length > 0 && e.store.notify();
51172
+ T.length > 0 && e.store.notify();
51097
51173
  });
51098
- h === "completed" && e.store.recordLearnedSynonyms(CU({
51174
+ w === "completed" && e.store.recordLearnedSynonyms(CU({
51099
51175
  columnMapping: e.columnMapping,
51100
51176
  baselineColumnMapping: e.baselineColumnMapping,
51101
51177
  valueMapping: e.valueMapping,
@@ -51104,38 +51180,38 @@ var VU = 5e3, HU = async (e) => {
51104
51180
  knownColumnSynonyms: NV(kV, e.extraSynonyms.columns),
51105
51181
  knownValueSynonyms: NV(kV, e.extraSynonyms.values)
51106
51182
  }));
51107
- let g = h === "completed" && p > 0 && m === 0;
51183
+ let T = w === "completed" && S > 0 && C === 0;
51108
51184
  return await e.store.finalizeSource(r), e.validator.validateUniqueness(), {
51109
- outcome: h,
51110
- collapsed: g,
51185
+ outcome: w,
51186
+ collapsed: T,
51111
51187
  ambiguous: u.ambiguous
51112
51188
  };
51113
51189
  };
51114
- async function UU(e) {
51115
- return HU(e);
51190
+ async function GU(e) {
51191
+ return WU(e);
51116
51192
  }
51117
51193
  //#endregion
51118
51194
  //#region src/components/DataUploader/core/parser/headerView.ts
51119
- var WU = (e, t, n, r) => {
51195
+ var KU = (e, t, n, r) => {
51120
51196
  let i = RH(t, n);
51121
51197
  return {
51122
51198
  dataStartIndex: i,
51123
51199
  headers: zH(e, n, i, r)
51124
51200
  };
51125
- }, GU = (e, t) => {
51201
+ }, qU = (e, t) => {
51126
51202
  let n = e.toLowerCase();
51127
51203
  return t.some((e) => e.startsWith(".") && n.endsWith(e.toLowerCase()));
51128
- }, KU = (e, t) => {
51204
+ }, JU = (e, t) => {
51129
51205
  if (!e || !t) return !1;
51130
51206
  let n = e.toLowerCase(), r = n.replace(/\/.*$/, "");
51131
51207
  return t.some((e) => {
51132
51208
  let t = e.trim().toLowerCase();
51133
51209
  return t.endsWith("/*") ? r === t.replace(/\/.*$/, "") : n === t;
51134
51210
  });
51135
- }, qU = (e, t) => {
51136
- for (let n of t) if (GU(e.name, n.extensions) || KU(e.type, n.mimeTypes)) return n;
51211
+ }, YU = (e, t) => {
51212
+ for (let n of t) if (qU(e.name, n.extensions) || JU(e.type, n.mimeTypes)) return n;
51137
51213
  return null;
51138
- }, JU = class {
51214
+ }, XU = class {
51139
51215
  tokens = /* @__PURE__ */ new Map();
51140
51216
  issue(e) {
51141
51217
  this.abort(e);
@@ -51152,15 +51228,15 @@ var WU = (e, t, n, r) => {
51152
51228
  release(e) {
51153
51229
  this.tokens.delete(e);
51154
51230
  }
51155
- }, YU = (e) => e.kind === "remote" ? `remote:${e.sourceId}` : `file:${e.file.name}:${e.file.size}:${e.file.lastModified}`, XU = (e, t, n, r) => {
51156
- let { headers: i, dataStartIndex: a } = WU(t.rawRows, t.detection, n, r);
51231
+ }, ZU = (e) => e.kind === "remote" ? `remote:${e.sourceId}` : `file:${e.file.name}:${e.file.size}:${e.file.lastModified}`, QU = (e, t, n, r) => {
51232
+ let { headers: i, dataStartIndex: a } = KU(t.rawRows, t.detection, n, r);
51157
51233
  return {
51158
51234
  name: e,
51159
51235
  headers: i,
51160
51236
  rows: KH(t.rawRows, i, a, 15),
51161
51237
  totalRows: hH(t.rawRows, a)
51162
51238
  };
51163
- }, ZU = .02, QU = .5, $U = 2, eW = 2, tW = 3, nW = .6, rW = .25, iW = 3, aW = .2, oW = 1 / 3, sW = 3, cW = (e) => {
51239
+ }, $U = .02, eW = .5, tW = 2, nW = 2, rW = 3, iW = .6, aW = .25, oW = 3, sW = .2, cW = 1 / 3, lW = 3, uW = (e) => {
51164
51240
  let t = [];
51165
51241
  for (let n of e) {
51166
51242
  if (n == null) continue;
@@ -51168,18 +51244,18 @@ var WU = (e, t, n, r) => {
51168
51244
  e !== "" && t.push(e);
51169
51245
  }
51170
51246
  return t;
51171
- }, lW = (e) => e.filter((e) => !mH(e)), uW = (e) => {
51247
+ }, dW = (e) => e.filter((e) => !mH(e)), fW = (e) => {
51172
51248
  let { span: t } = vH(e);
51173
51249
  if (t < 2) return 0;
51174
- let n = lW(e);
51250
+ let n = dW(e);
51175
51251
  if (n.length === 0) return 0;
51176
51252
  let r = 0;
51177
51253
  for (let e of n) bH(e, t) && r++;
51178
51254
  return r / n.length;
51179
- }, dW = (e) => {
51255
+ }, pW = (e) => {
51180
51256
  let t = vH(e);
51181
51257
  if (t.span === 0) return 0;
51182
- let n = lW(e);
51258
+ let n = dW(e);
51183
51259
  if (n.length === 0) return 0;
51184
51260
  let r = 0;
51185
51261
  for (let e of n) {
@@ -51187,10 +51263,10 @@ var WU = (e, t, n, r) => {
51187
51263
  r += Math.min(1, a);
51188
51264
  }
51189
51265
  return r / n.length;
51190
- }, fW = (e) => {
51266
+ }, mW = (e) => {
51191
51267
  let t = vH(e);
51192
51268
  if (t.span < 5) return 0;
51193
- let n = lW(e).filter((e) => !bH(e, t.span));
51269
+ let n = dW(e).filter((e) => !bH(e, t.span));
51194
51270
  if (n.length < 3) return 0;
51195
51271
  let r = [], i = [];
51196
51272
  for (let e = t.first; e <= t.last; e++) {
@@ -51203,8 +51279,8 @@ var WU = (e, t, n, r) => {
51203
51279
  }
51204
51280
  let a = n[0], o = (e, t) => {
51205
51281
  let n = e;
51206
- for (; n >= 0 && n < r.length && r[n] >= QU;) n += t;
51207
- if (Math.abs(n - e) < $U) return null;
51282
+ for (; n >= 0 && n < r.length && r[n] >= eW;) n += t;
51283
+ if (Math.abs(n - e) < tW) return null;
51208
51284
  let [a, o] = t === 1 ? [e, n - 1] : [n + 1, e], s = -1;
51209
51285
  for (let e = a; e <= o; e++) s = Math.max(s, i[e]);
51210
51286
  return {
@@ -51214,34 +51290,34 @@ var WU = (e, t, n, r) => {
51214
51290
  };
51215
51291
  }, s = 0, c = 0;
51216
51292
  for (; c < r.length;) {
51217
- if (r[c] > ZU) {
51293
+ if (r[c] > $U) {
51218
51294
  c++;
51219
51295
  continue;
51220
51296
  }
51221
51297
  let e = c;
51222
- for (; e < r.length && r[e] <= ZU;) e++;
51298
+ for (; e < r.length && r[e] <= $U;) e++;
51223
51299
  let n = o(c - 1, -1), i = o(e, 1);
51224
51300
  if (n && i) {
51225
51301
  let r = Array.from({ length: e - c }, (e, n) => a[t.first + c + n]).some((e) => e != null && String(e).trim() !== ""), o = r ? .3 : .5;
51226
- !r && Math.abs(n.lastRow - i.lastRow) >= eW && (o = 1), s = Math.max(s, o);
51302
+ !r && Math.abs(n.lastRow - i.lastRow) >= nW && (o = 1), s = Math.max(s, o);
51227
51303
  }
51228
51304
  c = e;
51229
51305
  }
51230
51306
  return s;
51231
- }, pW = (e) => {
51307
+ }, hW = (e) => {
51232
51308
  if (vH(e).span === 0) return 0;
51233
- let t = lW(e);
51234
- if (t.length < tW) return 0;
51309
+ let t = dW(e);
51310
+ if (t.length < rW) return 0;
51235
51311
  let n = t.map((e) => {
51236
51312
  let { first: t, last: n, width: r } = _H(e);
51237
51313
  return {
51238
51314
  first: t,
51239
51315
  last: n,
51240
- density: cW(e).length / r
51316
+ density: uW(e).length / r
51241
51317
  };
51242
51318
  }), r = (e, t) => {
51243
51319
  let n = Math.max(e.first, t.first), r = Math.min(e.last, t.last);
51244
- return Math.max(0, r - n + 1) / Math.max(e.last - e.first + 1, t.last - t.first + 1) >= nW && Math.abs(e.density - t.density) <= rW;
51320
+ return Math.max(0, r - n + 1) / Math.max(e.last - e.first + 1, t.last - t.first + 1) >= iW && Math.abs(e.density - t.density) <= aW;
51245
51321
  }, i = [];
51246
51322
  for (let e of n) {
51247
51323
  let t = i[i.length - 1];
@@ -51250,68 +51326,68 @@ var WU = (e, t, n, r) => {
51250
51326
  length: 1
51251
51327
  });
51252
51328
  }
51253
- let a = i.findIndex((e) => e.length >= tW);
51329
+ let a = i.findIndex((e) => e.length >= rW);
51254
51330
  if (a === -1) return 0;
51255
51331
  let o = a;
51256
- for (let e = i.length - 1; e >= 0; e--) if (i[e].length >= tW) {
51332
+ for (let e = i.length - 1; e >= 0; e--) if (i[e].length >= rW) {
51257
51333
  o = e;
51258
51334
  break;
51259
51335
  }
51260
51336
  let s = 0, c = 0;
51261
- for (let e = a; e <= o; e++) i[e].length >= tW ? s++ : c++;
51337
+ for (let e = a; e <= o; e++) i[e].length >= rW ? s++ : c++;
51262
51338
  let l = s - 1 + c;
51263
- return Math.min(1, Math.max(0, l) / iW);
51264
- }, mW = (e, t) => {
51339
+ return Math.min(1, Math.max(0, l) / oW);
51340
+ }, gW = (e, t) => {
51265
51341
  if (t <= 0) return 0;
51266
51342
  let n = 0;
51267
51343
  for (let t of e) n += Math.max(0, t.endRow - t.startRow);
51268
51344
  return Math.min(1, n / t);
51269
- }, hW = (e) => {
51345
+ }, _W = (e) => {
51270
51346
  let t = -1, n = -1;
51271
51347
  for (let r = 0; r < e.length; r++) mH(e[r]) || (t === -1 && (t = r), n = r);
51272
51348
  if (t === -1 || n <= t) return 0;
51273
51349
  let r = 0;
51274
51350
  for (let i = t; i <= n; i++) mH(e[i]) && r++;
51275
51351
  return r / (n - t + 1);
51276
- }, gW = (e) => {
51352
+ }, vW = (e) => {
51277
51353
  let t = vH(e);
51278
- if (t.span < sW) return 0;
51279
- let n = lW(e);
51354
+ if (t.span < lW) return 0;
51355
+ let n = dW(e);
51280
51356
  if (n.length === 0) return 0;
51281
- let r = Math.max(1, Math.round(n.length * aW)), i = n.slice(n.length - r), a = 0;
51282
- for (let e of i) cW(e).length / t.span <= oW && a++;
51357
+ let r = Math.max(1, Math.round(n.length * sW)), i = n.slice(n.length - r), a = 0;
51358
+ for (let e of i) uW(e).length / t.span <= cW && a++;
51283
51359
  return a / i.length;
51284
- }, _W = 30, vW = 10, yW = (e) => {
51360
+ }, yW = 30, bW = 10, xW = (e) => {
51285
51361
  let t = 0;
51286
51362
  for (let n of e) t = Math.max(t, n.length);
51287
51363
  return t;
51288
- }, bW = (e, t) => {
51289
- let n = yW(e);
51364
+ }, SW = (e, t) => {
51365
+ let n = xW(e);
51290
51366
  if (n === 0) return 0;
51291
51367
  let r = 0;
51292
51368
  for (let i = Math.max(0, t); i < e.length; i++) {
51293
51369
  let t = e[i];
51294
51370
  if (!t || mH(t)) continue;
51295
- let a = Math.min(e.length, i + 1 + _W);
51371
+ let a = Math.min(e.length, i + 1 + yW);
51296
51372
  if (a - i < 2) break;
51297
51373
  let o = SH(e, i, a, n);
51298
51374
  o > r && (r = o);
51299
51375
  }
51300
51376
  return r;
51301
- }, xW = (e, t) => {
51377
+ }, CW = (e, t) => {
51302
51378
  let n = [];
51303
51379
  for (let r = Math.max(0, t); r < e.length; r++) {
51304
51380
  let t = e[r];
51305
51381
  t && !mH(t) && n.push(t);
51306
51382
  }
51307
51383
  if (n.length < 6) return 0;
51308
- let r = Math.floor(n.length / 2), i = yW(n), a = 0, o = 0;
51384
+ let r = Math.floor(n.length / 2), i = xW(n), a = 0, o = 0;
51309
51385
  for (let e = 0; e < i; e++) {
51310
51386
  let t = xH(n, 0, r, e), i = xH(n, r, n.length, e);
51311
51387
  t !== "empty" && i !== "empty" && (o++, t !== i && a++);
51312
51388
  }
51313
51389
  return o === 0 ? 0 : a / o;
51314
- }, SW = (e) => e <= 0 ? 0 : Math.min(1, e / vW), CW = (e, t) => {
51390
+ }, wW = (e) => e <= 0 ? 0 : Math.min(1, e / bW), TW = (e, t) => {
51315
51391
  let n = 0, r = 0;
51316
51392
  for (let i = Math.max(0, t); i < e.length; i++) {
51317
51393
  let t = e[i];
@@ -51322,7 +51398,7 @@ var WU = (e, t, n, r) => {
51322
51398
  }
51323
51399
  }
51324
51400
  return n === 0 ? 0 : r / n;
51325
- }, wW = {
51401
+ }, EW = {
51326
51402
  banner: {
51327
51403
  weight: .85,
51328
51404
  tau: .05,
@@ -51378,64 +51454,64 @@ var WU = (e, t, n, r) => {
51378
51454
  tau: .3,
51379
51455
  tier: "semantics"
51380
51456
  }
51381
- }, TW = .65, EW = 300, DW = 50, OW = 100, kW = [
51457
+ }, DW = .65, OW = 300, kW = 50, AW = 100, jW = [
51382
51458
  .25,
51383
51459
  .5,
51384
51460
  .75
51385
- ], AW = (e, t) => e <= t ? 0 : (e - t) / (1 - t), jW = (e) => {
51461
+ ], MW = (e, t) => e <= t ? 0 : (e - t) / (1 - t), NW = (e) => {
51386
51462
  let t = 1;
51387
51463
  for (let { weight: n, evidence: r } of e) t *= 1 - n * Math.min(1, Math.max(0, r));
51388
51464
  return 1 - t;
51389
- }, MW = (e) => {
51465
+ }, PW = (e) => {
51390
51466
  if (e.length <= 1e3) return e.length ? [e] : [];
51391
- let t = [[0, EW]];
51392
- for (let n of kW) {
51467
+ let t = [[0, OW]];
51468
+ for (let n of jW) {
51393
51469
  let r = Math.floor(e.length * n);
51394
- t.push([r, r + DW]);
51470
+ t.push([r, r + kW]);
51395
51471
  }
51396
- t.push([e.length - OW, e.length]);
51472
+ t.push([e.length - AW, e.length]);
51397
51473
  let n = [], r = 0;
51398
51474
  for (let [i, a] of t) {
51399
51475
  let t = Math.max(i, r), o = Math.min(a, e.length);
51400
51476
  o <= t || (n.push(e.slice(t, o)), r = o);
51401
51477
  }
51402
51478
  return n;
51403
- }, NW = (e, t, n) => {
51404
- let r = MW(e);
51479
+ }, FW = (e, t, n) => {
51480
+ let r = PW(e);
51405
51481
  if (r.length === 0) return {
51406
51482
  score: 0,
51407
51483
  geometryScore: 0,
51408
- signals: FW()
51409
- };
51410
- let i = r.flat(), a = r[0], o = r[r.length - 1], s = r.length === 1, c = s ? n.dataStartIndex : PW(a) + 1, l = {
51411
- banner: uW(i),
51412
- alignmentChurn: dW(i),
51413
- columnIslands: fW(i),
51414
- layoutChurn: Math.max(...r.map((e) => pW(e))),
51415
- verticalMerges: mW(t, e.length),
51416
- gaps: hW(i),
51417
- tailSparse: gW(o),
51418
- headerLikeRow: bW(i, c),
51419
- typeChurn: xW(i, c),
51420
- preamble: SW(s ? n.headerRowIndex : PW(a)),
51421
- multiline: CW(i, c)
51484
+ signals: LW()
51485
+ };
51486
+ let i = r.flat(), a = r[0], o = r[r.length - 1], s = r.length === 1, c = s ? n.dataStartIndex : IW(a) + 1, l = {
51487
+ banner: fW(i),
51488
+ alignmentChurn: pW(i),
51489
+ columnIslands: mW(i),
51490
+ layoutChurn: Math.max(...r.map((e) => hW(e))),
51491
+ verticalMerges: gW(t, e.length),
51492
+ gaps: _W(i),
51493
+ tailSparse: vW(o),
51494
+ headerLikeRow: SW(i, c),
51495
+ typeChurn: CW(i, c),
51496
+ preamble: wW(s ? n.headerRowIndex : IW(a)),
51497
+ multiline: TW(i, c)
51422
51498
  }, u = [], d = [];
51423
- for (let e of Object.keys(wW)) {
51424
- let { weight: t, tau: n, tier: r } = wW[e], i = {
51499
+ for (let e of Object.keys(EW)) {
51500
+ let { weight: t, tau: n, tier: r } = EW[e], i = {
51425
51501
  weight: t,
51426
- evidence: AW(l[e], n)
51502
+ evidence: MW(l[e], n)
51427
51503
  };
51428
51504
  u.push(i), r === "geometry" && d.push(i);
51429
51505
  }
51430
51506
  return {
51431
- score: jW(u),
51432
- geometryScore: jW(d),
51507
+ score: NW(u),
51508
+ geometryScore: NW(d),
51433
51509
  signals: l
51434
51510
  };
51435
- }, PW = (e) => {
51511
+ }, IW = (e) => {
51436
51512
  for (let t = 0; t < e.length; t++) if (e[t]?.some((e) => e != null && String(e).trim() !== "")) return t;
51437
51513
  return 0;
51438
- }, FW = () => ({
51514
+ }, LW = () => ({
51439
51515
  banner: 0,
51440
51516
  alignmentChurn: 0,
51441
51517
  columnIslands: 0,
@@ -51447,7 +51523,7 @@ var WU = (e, t, n, r) => {
51447
51523
  typeChurn: 0,
51448
51524
  preamble: 0,
51449
51525
  multiline: 0
51450
- }), IW = (e, t, n) => NW(e, t, n).score > TW, LW = (e, t, n) => {
51526
+ }), RW = (e, t, n) => FW(e, t, n).score > DW, zW = (e, t, n) => {
51451
51527
  let r = NH(e.rows), i = RH(r, r.headerRowIndex), a = zH(e.rows, r.headerRowIndex, i, t);
51452
51528
  return {
51453
51529
  preview: {
@@ -51456,9 +51532,9 @@ var WU = (e, t, n, r) => {
51456
51532
  rows: KH(e.rows, a, i, 15),
51457
51533
  totalRows: e.totalRows - 1
51458
51534
  },
51459
- unstructured: n ? IW(e.rows, [], r) : !1
51535
+ unstructured: n ? RW(e.rows, [], r) : !1
51460
51536
  };
51461
- }, RW = (e, t, n, r, i) => {
51537
+ }, BW = (e, t, n, r, i) => {
51462
51538
  let a = NH(e);
51463
51539
  return {
51464
51540
  kind: "parsed",
@@ -51469,10 +51545,10 @@ var WU = (e, t, n, r) => {
51469
51545
  },
51470
51546
  headerRowIndex: a.headerRowIndex,
51471
51547
  csvErrors: n,
51472
- unstructured: i ? IW(e, r, a) : !1
51548
+ unstructured: i ? RW(e, r, a) : !1
51473
51549
  };
51474
51550
  };
51475
- async function zW(e, t, n, r, i = {}) {
51551
+ async function VW(e, t, n, r, i = {}) {
51476
51552
  let a = i.score ?? !1;
51477
51553
  try {
51478
51554
  if (n === "csv") {
@@ -51480,7 +51556,7 @@ async function zW(e, t, n, r, i = {}) {
51480
51556
  format: "csv",
51481
51557
  signal: i.signal
51482
51558
  });
51483
- return n.kind === "rows" ? RW(n.rows, n.delimiter, n.errors, n.merges ?? [], a) : { kind: "unexpected" };
51559
+ return n.kind === "rows" ? BW(n.rows, n.delimiter, n.errors, n.merges ?? [], a) : { kind: "unexpected" };
51484
51560
  }
51485
51561
  if (n === "json" || n === "xml") {
51486
51562
  let r = await e.parse(t, {
@@ -51504,14 +51580,14 @@ async function zW(e, t, n, r, i = {}) {
51504
51580
  signal: i.signal
51505
51581
  });
51506
51582
  if (!i.sheetName && o.kind === "sheets") {
51507
- let e = o.sheets.map((e) => LW(e, r, a));
51583
+ let e = o.sheets.map((e) => zW(e, r, a));
51508
51584
  return {
51509
51585
  kind: "sheets",
51510
51586
  previews: e.map((e) => e.preview),
51511
51587
  unstructured: e.some((e) => e.unstructured)
51512
51588
  };
51513
51589
  }
51514
- return o.kind === "rows" ? RW(o.rows, ",", [], o.merges ?? [], a) : { kind: "unexpected" };
51590
+ return o.kind === "rows" ? BW(o.rows, ",", [], o.merges ?? [], a) : { kind: "unexpected" };
51515
51591
  } catch (e) {
51516
51592
  return {
51517
51593
  kind: "error",
@@ -51523,7 +51599,7 @@ async function zW(e, t, n, r, i = {}) {
51523
51599
  //#endregion
51524
51600
  //#region src/components/DataUploader/core/parser/recordsToGrid.ts
51525
51601
  Xg();
51526
- var BW = (e) => {
51602
+ var HW = (e) => {
51527
51603
  if (e.length === 0) return null;
51528
51604
  let t = /* @__PURE__ */ new Set(), n = [];
51529
51605
  for (let r of e) for (let e of Object.keys(r)) t.has(e) || (t.add(e), n.push(e));
@@ -51538,23 +51614,23 @@ var BW = (e) => {
51538
51614
  })),
51539
51615
  detection: BH()
51540
51616
  };
51541
- }, VW = /* @__PURE__ */ new Set([
51617
+ }, UW = /* @__PURE__ */ new Set([
51542
51618
  "xlsx",
51543
51619
  "xls",
51544
51620
  "xlsb",
51545
51621
  "ods"
51546
- ]), HW = (e) => {
51622
+ ]), WW = (e) => {
51547
51623
  let t = e.split(".").pop()?.toLowerCase();
51548
- return t && VW.has(t) ? "xlsx" : t === "json" ? "json" : t === "xml" ? "xml" : "csv";
51549
- }, UW = 20, WW = {
51624
+ return t && UW.has(t) ? "xlsx" : t === "json" ? "json" : t === "xml" ? "xml" : "csv";
51625
+ }, GW = 20, KW = {
51550
51626
  workbooks: [],
51551
51627
  parsing: null,
51552
51628
  stagedItems: [],
51553
51629
  unionHeaders: []
51554
- }, GW = (e) => {
51630
+ }, qW = (e) => {
51555
51631
  let t = e[0];
51556
51632
  return typeof t?.name == "string" && Array.isArray(t.rows);
51557
- }, KW = (e) => e.source.kind === "remote" ? {
51633
+ }, JW = (e) => e.source.kind === "remote" ? {
51558
51634
  kind: "remote",
51559
51635
  sourceId: e.source.sourceId
51560
51636
  } : e.materialize.kind === "sheet" ? {
@@ -51568,18 +51644,18 @@ var BW = (e) => {
51568
51644
  } : {
51569
51645
  kind: "file",
51570
51646
  file: e.source.file
51571
- }, qW = class {
51647
+ }, YW = class {
51572
51648
  client;
51573
51649
  synthesize;
51574
51650
  customFormats;
51575
51651
  onUnstructuredFile;
51576
- tokens = new JU();
51652
+ tokens = new XU();
51577
51653
  workbookSeq = 0;
51578
51654
  stagedSeq = 0;
51579
51655
  queue = [];
51580
51656
  pumping = !1;
51581
51657
  escalated = /* @__PURE__ */ new Set();
51582
- _state = WW;
51658
+ _state = KW;
51583
51659
  constructor(e, t, n = [], r) {
51584
51660
  this.client = e, this.synthesize = t, this.customFormats = n, this.onUnstructuredFile = r;
51585
51661
  }
@@ -51597,29 +51673,29 @@ var BW = (e) => {
51597
51673
  kind: "file",
51598
51674
  file: e
51599
51675
  };
51600
- this.escalated.delete(YU(t));
51601
- let n = qU(e, this.customFormats);
51676
+ this.escalated.delete(ZU(t));
51677
+ let n = YU(e, this.customFormats);
51602
51678
  return n ? this.runCustomFormat(e, n, t) : this.enqueue(e, t, e.name);
51603
51679
  }
51604
51680
  stageGrid(e, t, n, r) {
51605
- let i = this.readyItem(t, n, XU(n, e, r, this.synthesize), {
51681
+ let i = this.readyItem(t, n, QU(n, e, r, this.synthesize), {
51606
51682
  kind: "grid",
51607
51683
  grid: e,
51608
51684
  headerRowIndex: r
51609
51685
  });
51610
51686
  this.patch({
51611
- stagedItems: [...this.itemsWithoutSource(YU(t)), i],
51687
+ stagedItems: [...this.itemsWithoutSource(ZU(t)), i],
51612
51688
  parsing: null
51613
51689
  });
51614
51690
  }
51615
51691
  stageGrids(e, t) {
51616
- let n = e.map((e) => this.readyItem(t, e.name, XU(e.name, e.grid, e.headerRowIndex, this.synthesize), {
51692
+ let n = e.map((e) => this.readyItem(t, e.name, QU(e.name, e.grid, e.headerRowIndex, this.synthesize), {
51617
51693
  kind: "custom",
51618
51694
  grid: e.grid,
51619
51695
  headerRowIndex: e.headerRowIndex,
51620
51696
  tableName: e.name
51621
51697
  }));
51622
- this.patch({ stagedItems: [...this.itemsWithoutSource(YU(t)), ...n] });
51698
+ this.patch({ stagedItems: [...this.itemsWithoutSource(ZU(t)), ...n] });
51623
51699
  }
51624
51700
  toggleItem(e) {
51625
51701
  this.patch({ stagedItems: this._state.stagedItems.map((t) => t.id === e && t.status === "ready" ? {
@@ -51633,19 +51709,19 @@ var BW = (e) => {
51633
51709
  ok: !1,
51634
51710
  attempt: null
51635
51711
  };
51636
- let t = e.map((e) => KW(e)), n = this._state.workbooks.filter((e) => t.some((t) => XH(e.origin, t)));
51712
+ let t = e.map((e) => JW(e)), n = this._state.workbooks.filter((e) => t.some((t) => XH(e.origin, t)));
51637
51713
  n.length !== this._state.workbooks.length && this.setWorkbooks(n);
51638
51714
  for (let t of e) {
51639
- let e = KW(t);
51715
+ let e = JW(t);
51640
51716
  if (this._state.workbooks.some((t) => XH(t.origin, e))) continue;
51641
51717
  if (t.materialize.kind === "grid" || t.materialize.kind === "custom") {
51642
51718
  this.addWorkbook(t.materialize.grid, e, t.name, t.materialize.headerRowIndex);
51643
51719
  continue;
51644
51720
  }
51645
51721
  if (t.source.kind !== "file") continue;
51646
- let { file: n } = t.source, r = YU(t.source), i = this.tokens.issue(r);
51722
+ let { file: n } = t.source, r = ZU(t.source), i = this.tokens.issue(r);
51647
51723
  this.patch({ parsing: { file: n } });
51648
- let a = await zW(this.client, n, "xlsx", this.synthesize, {
51724
+ let a = await VW(this.client, n, "xlsx", this.synthesize, {
51649
51725
  sheetName: t.materialize.sheetName,
51650
51726
  signal: i
51651
51727
  });
@@ -51669,7 +51745,7 @@ var BW = (e) => {
51669
51745
  }
51670
51746
  removeWorkbook(e) {
51671
51747
  let t = this._state.workbooks.find((t) => t.id === e);
51672
- t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !XH(KW(e), t.origin)) });
51748
+ t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !XH(JW(e), t.origin)) });
51673
51749
  }
51674
51750
  cancel(e) {
51675
51751
  if (e.kind === "all") {
@@ -51681,16 +51757,16 @@ var BW = (e) => {
51681
51757
  }
51682
51758
  let t = this._state.stagedItems.find((t) => t.id === e.id);
51683
51759
  if (t?.status !== "pending") return;
51684
- let n = YU(t.source);
51760
+ let n = ZU(t.source);
51685
51761
  this.tokens.abort(n), this.dropQueued(n);
51686
51762
  let { parsing: r } = this._state;
51687
- r && YU({
51763
+ r && ZU({
51688
51764
  kind: "file",
51689
51765
  file: r.file
51690
51766
  }) === n && this.patch({ parsing: null }), this.patch({ stagedItems: this._state.stagedItems.filter((t) => t.id !== e.id) });
51691
51767
  }
51692
51768
  reset() {
51693
- this.tokens.abortAll(), this.flushQueue(), this.escalated.clear(), this._state = WW;
51769
+ this.tokens.abortAll(), this.flushQueue(), this.escalated.clear(), this._state = KW;
51694
51770
  }
51695
51771
  clearWorkbooks() {
51696
51772
  this.setWorkbooks([]);
@@ -51698,7 +51774,7 @@ var BW = (e) => {
51698
51774
  takeRawRows(e) {
51699
51775
  let t = this._state.workbooks.find((t) => t.id === e);
51700
51776
  if (!t) return null;
51701
- let n = t.rawRows, r = Math.max(UW, t.dataStartIndex + 1);
51777
+ let n = t.rawRows, r = Math.max(GW, t.dataStartIndex + 1);
51702
51778
  return this.setWorkbooks(this._state.workbooks.map((t) => t.id === e ? {
51703
51779
  ...t,
51704
51780
  rawRows: n.slice(0, r)
@@ -51720,7 +51796,7 @@ var BW = (e) => {
51720
51796
  }) : n));
51721
51797
  }
51722
51798
  enqueue(e, t, n) {
51723
- let r = YU(t);
51799
+ let r = ZU(t);
51724
51800
  this.dropQueued(r);
51725
51801
  let i = this.tokens.issue(r), a = {
51726
51802
  id: `st-${++this.stagedSeq}`,
@@ -51740,7 +51816,7 @@ var BW = (e) => {
51740
51816
  });
51741
51817
  }
51742
51818
  async runCustomFormat(e, t, n) {
51743
- let r = YU(n);
51819
+ let r = ZU(n);
51744
51820
  this.dropQueued(r);
51745
51821
  let i = this.tokens.issue(r), a = {
51746
51822
  id: `st-${++this.stagedSeq}`,
@@ -51788,12 +51864,12 @@ var BW = (e) => {
51788
51864
  return i.length === 0 ? null : (this.stageGrids(i, t.source), this.patch({ parsing: null }), { kind: "staged" });
51789
51865
  }
51790
51866
  toStageEntries(e, t) {
51791
- let n = GW(e) ? e : [{
51867
+ let n = qW(e) ? e : [{
51792
51868
  name: t,
51793
51869
  rows: e
51794
51870
  }], r = [];
51795
51871
  for (let e of n) {
51796
- let n = BW(e.rows);
51872
+ let n = HW(e.rows);
51797
51873
  n && r.push({
51798
51874
  grid: n,
51799
51875
  name: e.name || t,
@@ -51814,7 +51890,7 @@ var BW = (e) => {
51814
51890
  continue;
51815
51891
  }
51816
51892
  this.patch({ parsing: { file: e.source.file } });
51817
- let t = HW(e.file.name), n = await zW(this.client, e.file, t, this.synthesize, {
51893
+ let t = WW(e.file.name), n = await VW(this.client, e.file, t, this.synthesize, {
51818
51894
  signal: e.signal,
51819
51895
  score: !!this.onUnstructuredFile && !this.escalated.has(e.key)
51820
51896
  });
@@ -51855,7 +51931,7 @@ var BW = (e) => {
51855
51931
  this.queue = this.queue.filter((e) => !t.includes(e));
51856
51932
  }
51857
51933
  itemsWithoutSource(e) {
51858
- return this._state.stagedItems.filter((t) => YU(t.source) !== e);
51934
+ return this._state.stagedItems.filter((t) => ZU(t.source) !== e);
51859
51935
  }
51860
51936
  readyItem(e, t, n, r) {
51861
51937
  return {
@@ -51869,10 +51945,10 @@ var BW = (e) => {
51869
51945
  };
51870
51946
  }
51871
51947
  applyOutcome(e, t, n) {
51872
- let r = this.itemsWithoutSource(YU(t));
51948
+ let r = this.itemsWithoutSource(ZU(t));
51873
51949
  switch (e.kind) {
51874
51950
  case "parsed": {
51875
- let i = this.readyItem(t, n, XU(n, e.grid, e.headerRowIndex, this.synthesize), {
51951
+ let i = this.readyItem(t, n, QU(n, e.grid, e.headerRowIndex, this.synthesize), {
51876
51952
  kind: "grid",
51877
51953
  grid: e.grid,
51878
51954
  headerRowIndex: e.headerRowIndex
@@ -51917,7 +51993,7 @@ var BW = (e) => {
51917
51993
  return this.setWorkbooks(o, { parsing: null }), i;
51918
51994
  }
51919
51995
  reproject(e) {
51920
- let { headers: t, dataStartIndex: n } = WU(e.rawRows, e.detection, e.headerRowIndex, this.synthesize);
51996
+ let { headers: t, dataStartIndex: n } = KU(e.rawRows, e.detection, e.headerRowIndex, this.synthesize);
51921
51997
  return {
51922
51998
  ...e,
51923
51999
  headers: t,
@@ -51939,7 +52015,7 @@ var BW = (e) => {
51939
52015
  ...e
51940
52016
  };
51941
52017
  }
51942
- }, JW = class {
52018
+ }, XW = class {
51943
52019
  columns;
51944
52020
  declaredKey;
51945
52021
  _state;
@@ -51967,11 +52043,11 @@ var BW = (e) => {
51967
52043
  composite: i
51968
52044
  });
51969
52045
  }
51970
- }, YW = {
52046
+ }, ZW = {
51971
52047
  loadingId: null,
51972
52048
  error: null
51973
- }, XW = class {
51974
- _state = YW;
52049
+ }, QW = class {
52050
+ _state = ZW;
51975
52051
  get state() {
51976
52052
  return this._state;
51977
52053
  }
@@ -51993,37 +52069,37 @@ var BW = (e) => {
51993
52069
  loadingId: null
51994
52070
  };
51995
52071
  }
51996
- }, ZW = (e, t, n) => {
52072
+ }, $W = (e, t, n) => {
51997
52073
  let r = /* @__PURE__ */ new Set();
51998
52074
  for (let i of e) if (i !== "") if (n) for (let e of Vd(i, n, t, wU)) r.add(e);
51999
52075
  else r.add(i);
52000
52076
  return [...r];
52001
- }, QW = (e, t) => {
52077
+ }, eG = (e, t) => {
52002
52078
  let n = /* @__PURE__ */ new Map();
52003
52079
  for (let [r, i] of Object.entries(e)) {
52004
52080
  let e = t.find((e) => e.id === r);
52005
52081
  !e || Hh(e).options(e) === null || n.set(r, i);
52006
52082
  }
52007
52083
  return n;
52008
- }, $W = (e, t) => {
52084
+ }, tG = (e, t) => {
52009
52085
  let n = Hh(t), r = n.options(t);
52010
52086
  if (r === null) return null;
52011
52087
  if (n.storage === "string[]") {
52012
52088
  let i = C_(e, r, n.delimiter(t), TU(t));
52013
52089
  return {
52014
- importedValues: ZW(e, r, i),
52090
+ importedValues: $W(e, r, i),
52015
52091
  options: r,
52016
52092
  delimiter: i,
52017
52093
  isMultiselect: !0
52018
52094
  };
52019
52095
  }
52020
52096
  return {
52021
- importedValues: ZW(e, r, null),
52097
+ importedValues: $W(e, r, null),
52022
52098
  options: r,
52023
52099
  delimiter: null,
52024
52100
  isMultiselect: !1
52025
52101
  };
52026
- }, eG = (e, t) => {
52102
+ }, nG = (e, t) => {
52027
52103
  let n = /* @__PURE__ */ new Set();
52028
52104
  for (let r of t) {
52029
52105
  let t = e.find((e) => e.id === r.workbookId);
@@ -52032,12 +52108,12 @@ var BW = (e) => {
52032
52108
  if (i !== void 0) for (let e of WH(t.rawRows, t.dataStartIndex, i)) n.add(e);
52033
52109
  }
52034
52110
  return [...n];
52035
- }, tG = (e, t, n) => {
52111
+ }, rG = (e, t, n) => {
52036
52112
  let r = {}, i = {}, a = {};
52037
- for (let [o, s] of QW(t, n)) {
52113
+ for (let [o, s] of eG(t, n)) {
52038
52114
  let t = n.find((e) => e.id === o);
52039
52115
  if (!t) continue;
52040
- let c = eG(e, s), l = $W(c, t);
52116
+ let c = nG(e, s), l = tG(c, t);
52041
52117
  l && (a[o] = c, l.isMultiselect && (i[o] = l.delimiter), r[o] = {
52042
52118
  importedValues: l.importedValues,
52043
52119
  options: l.options
@@ -52048,27 +52124,27 @@ var BW = (e) => {
52048
52124
  delimiters: i,
52049
52125
  rawCellsByColumn: a
52050
52126
  };
52051
- }, nG = (e, t) => {
52127
+ }, iG = (e, t) => {
52052
52128
  let n = {};
52053
52129
  for (let [r, i] of Object.entries(e)) n[r] = {
52054
52130
  ...i,
52055
52131
  ...t[r]
52056
52132
  };
52057
52133
  return n;
52058
- }, rG = (e, t, n, r) => ({
52134
+ }, aG = (e, t, n, r) => ({
52059
52135
  ...e,
52060
52136
  [t]: {
52061
52137
  ...e[t],
52062
52138
  [n]: r
52063
52139
  }
52064
- }), iG = (e, t, n) => aG(e, t, [n]), aG = (e, t, n) => {
52140
+ }), oG = (e, t, n) => sG(e, t, [n]), sG = (e, t, n) => {
52065
52141
  let r = e[t] ?? [], i = new Set(r), a = [];
52066
52142
  for (let e of n) i.has(e) || (i.add(e), a.push(e));
52067
52143
  return a.length === 0 ? e : {
52068
52144
  ...e,
52069
52145
  [t]: [...r, ...a]
52070
52146
  };
52071
- }, oG = (e, t, n, r) => {
52147
+ }, cG = (e, t, n, r) => {
52072
52148
  let i = t[r];
52073
52149
  if (!i || i.length === 0) return null;
52074
52150
  let a = n.find((e) => e.id === r);
@@ -52083,7 +52159,7 @@ var BW = (e) => {
52083
52159
  if (!s) return null;
52084
52160
  let c = Hh(a);
52085
52161
  return { delimiter: C_(o, c.options(a) ?? [], c.delimiter(a), TU(a)) };
52086
- }, sG = new Intl.Collator(), cG = {
52162
+ }, lG = new Intl.Collator(), uG = {
52087
52163
  merged: {},
52088
52164
  computed: {},
52089
52165
  multiselectDelimiters: {},
@@ -52091,7 +52167,7 @@ var BW = (e) => {
52091
52167
  importedValues: {},
52092
52168
  verdicts: {},
52093
52169
  isMatching: !1
52094
- }, lG = (e, t) => {
52170
+ }, dG = (e, t) => {
52095
52171
  let n = [], r = [];
52096
52172
  for (let [r, i] of t) {
52097
52173
  let t = e.get(r);
@@ -52102,7 +52178,7 @@ var BW = (e) => {
52102
52178
  changed: n,
52103
52179
  removed: r
52104
52180
  };
52105
- }, uG = class {
52181
+ }, fG = class {
52106
52182
  deps;
52107
52183
  notify;
52108
52184
  seq = 0;
@@ -52112,7 +52188,7 @@ var BW = (e) => {
52112
52188
  lastInputs = null;
52113
52189
  cellCache = /* @__PURE__ */ new Map();
52114
52190
  hookOutput = null;
52115
- _state = cG;
52191
+ _state = uG;
52116
52192
  constructor(e, t) {
52117
52193
  this.deps = e, this.notify = t;
52118
52194
  }
@@ -52130,12 +52206,12 @@ var BW = (e) => {
52130
52206
  });
52131
52207
  return;
52132
52208
  }
52133
- let n = QW(e.headersByColumn, this.deps.columns), r = this.lastInputs;
52209
+ let n = eG(e.headersByColumn, this.deps.columns), r = this.lastInputs;
52134
52210
  if (this.lastInputs = {
52135
52211
  workbooks: t,
52136
52212
  associations: n
52137
52213
  }, r !== null && r.workbooks === t) {
52138
- let e = lG(r.associations, n);
52214
+ let e = dG(r.associations, n);
52139
52215
  if (e.changed.length === 0 && e.removed.length === 0) return;
52140
52216
  this.recomputeChanged(t, e);
52141
52217
  return;
@@ -52143,14 +52219,14 @@ var BW = (e) => {
52143
52219
  this.cellCache.clear(), this.fullRecompute(t, e.headersByColumn);
52144
52220
  }
52145
52221
  fullRecompute(e, t) {
52146
- let { selectData: n, delimiters: r, rawCellsByColumn: i } = tG(e, t, this.deps.columns);
52222
+ let { selectData: n, delimiters: r, rawCellsByColumn: i } = rG(e, t, this.deps.columns);
52147
52223
  this.rawCellsByColumn = i, this.lastSelectData = n;
52148
52224
  for (let [e, t] of this.lastInputs?.associations ?? []) {
52149
52225
  let n = i[e];
52150
52226
  n && this.cellCache.set(lU(t), n);
52151
52227
  }
52152
52228
  let a = {};
52153
- for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(sG.compare);
52229
+ for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(lG.compare);
52154
52230
  this.patch({
52155
52231
  multiselectDelimiters: r,
52156
52232
  importedValues: a,
@@ -52164,13 +52240,13 @@ var BW = (e) => {
52164
52240
  let t = this.deps.columns.find((e) => e.id === c);
52165
52241
  if (!t) continue;
52166
52242
  let u = lU(l), d = this.cellCache.get(u);
52167
- d || (d = eG(e, l), this.cellCache.set(u, d));
52168
- let f = $W(d, t);
52243
+ d || (d = nG(e, l), this.cellCache.set(u, d));
52244
+ let f = tG(d, t);
52169
52245
  if (!f) continue;
52170
52246
  r[c] = d, n[c] = {
52171
52247
  importedValues: f.importedValues,
52172
52248
  options: f.options
52173
- }, f.isMultiselect && (i[c] = f.delimiter), a[c] = [...f.importedValues].sort(sG.compare);
52249
+ }, f.isMultiselect && (i[c] = f.delimiter), a[c] = [...f.importedValues].sort(lG.compare);
52174
52250
  let p = this.computeMatches({ [c]: n[c] });
52175
52251
  o[c] = p.computed[c], p.verdicts[c] ? s[c] = p.verdicts[c] : delete s[c];
52176
52252
  }
@@ -52231,7 +52307,7 @@ var BW = (e) => {
52231
52307
  this.hookOutput = null, this.cancelHook();
52232
52308
  }
52233
52309
  updateValueMapping(e, t, n) {
52234
- this.manual = rG(this.manual, e, t, n), this.patch({});
52310
+ this.manual = aG(this.manual, e, t, n), this.patch({});
52235
52311
  }
52236
52312
  applyValueMappingBatch(e, t) {
52237
52313
  if (t.length === 0) return;
@@ -52248,7 +52324,7 @@ var BW = (e) => {
52248
52324
  [e]: t
52249
52325
  } }, r = this.rawCellsByColumn[e];
52250
52326
  if (r) {
52251
- let i = this.deps.columns.find((t) => t.id === e), a = i ? Hh(i).options(i) ?? [] : [], o = ZW(r, a, t), s = {
52327
+ let i = this.deps.columns.find((t) => t.id === e), a = i ? Hh(i).options(i) ?? [] : [], o = $W(r, a, t), s = {
52252
52328
  importedValues: o,
52253
52329
  options: a
52254
52330
  };
@@ -52257,7 +52333,7 @@ var BW = (e) => {
52257
52333
  [e]: s
52258
52334
  }, n.importedValues = {
52259
52335
  ...this._state.importedValues,
52260
- [e]: [...o].sort(sG.compare)
52336
+ [e]: [...o].sort(lG.compare)
52261
52337
  };
52262
52338
  let c = this.computeMatches({ [e]: s });
52263
52339
  n.computed = {
@@ -52270,14 +52346,14 @@ var BW = (e) => {
52270
52346
  this.patch(n);
52271
52347
  }
52272
52348
  addPendingOption(e, t) {
52273
- let n = iG(this._state.pendingOptions, e, t);
52349
+ let n = oG(this._state.pendingOptions, e, t);
52274
52350
  n !== this._state.pendingOptions && (this._state = {
52275
52351
  ...this._state,
52276
52352
  pendingOptions: n
52277
52353
  });
52278
52354
  }
52279
52355
  addPendingOptions(e, t) {
52280
- let n = aG(this._state.pendingOptions, e, t);
52356
+ let n = sG(this._state.pendingOptions, e, t);
52281
52357
  n !== this._state.pendingOptions && (this._state = {
52282
52358
  ...this._state,
52283
52359
  pendingOptions: n
@@ -52293,10 +52369,10 @@ var BW = (e) => {
52293
52369
  };
52294
52370
  this._state = {
52295
52371
  ...t,
52296
- merged: nG(t.computed, this.manual)
52372
+ merged: iG(t.computed, this.manual)
52297
52373
  };
52298
52374
  }
52299
- }, dG = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), fG = (e, t) => e === t ? !0 : e === null || t === null ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, pG = class {
52375
+ }, pG = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), mG = (e, t) => e === t ? !0 : e === null || t === null ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, hG = class {
52300
52376
  snapshots = new gU();
52301
52377
  deps;
52302
52378
  parser;
@@ -52304,7 +52380,7 @@ var BW = (e) => {
52304
52380
  valueMapping;
52305
52381
  primaryKey;
52306
52382
  importRunner;
52307
- remoteSource = new XW();
52383
+ remoteSource = new QW();
52308
52384
  navigator = new xU();
52309
52385
  hookGate;
52310
52386
  lastNavInputs = null;
@@ -52314,17 +52390,17 @@ var BW = (e) => {
52314
52390
  lastNavigation = null;
52315
52391
  importAbort = null;
52316
52392
  constructor(e) {
52317
- this.deps = e, this.parser = new qW(e.createParseClient(), e.synthesizeHeader, e.customFormats, e.onUnstructuredFile), this.columnMapping = new fU({
52393
+ this.deps = e, this.parser = new YW(e.createParseClient(), e.synthesizeHeader, e.customFormats, e.onUnstructuredFile), this.columnMapping = new fU({
52318
52394
  columns: e.columns,
52319
52395
  onColumnMatch: e.onColumnMatch,
52320
52396
  extraSynonyms: e.extraSynonyms.columns
52321
52397
  }, () => {
52322
52398
  this.primaryKey.refreshEligible(this.columnMapping.state.mappedColumnIds), this.refreshValueMatch(), this.commit();
52323
- }), this.valueMapping = new uG({
52399
+ }), this.valueMapping = new fG({
52324
52400
  columns: e.columns,
52325
52401
  onValueMatch: e.onValueMatch,
52326
52402
  extraSynonyms: e.extraSynonyms.values
52327
- }, () => this.commit()), this.primaryKey = new JW(e.columns, e.defaultPrimaryKey), this.importRunner = new SU(() => this.commit()), this.hookGate = new _U({
52403
+ }, () => this.commit()), this.primaryKey = new XW(e.columns, e.defaultPrimaryKey), this.importRunner = new SU(() => this.commit()), this.hookGate = new _U({
52328
52404
  "column-matching": !!e.onColumnMatch,
52329
52405
  "match-values": !!e.onValueMatch
52330
52406
  }), this.commit();
@@ -52397,7 +52473,7 @@ var BW = (e) => {
52397
52473
  this.valueMapping.setDelimiter(e, t), this.commit();
52398
52474
  }
52399
52475
  reapplyMultiselectDelimiter(e) {
52400
- let t = oG(this.parser.state.workbooks, this.columnMapping.state.headersByColumn, this.deps.columns, e);
52476
+ let t = cG(this.parser.state.workbooks, this.columnMapping.state.headersByColumn, this.deps.columns, e);
52401
52477
  t && this.valueMapping.setDelimiter(e, t.delimiter), this.commit();
52402
52478
  }
52403
52479
  addPendingOption(e, t) {
@@ -52421,7 +52497,7 @@ var BW = (e) => {
52421
52497
  let t = await e.fetch();
52422
52498
  if (t instanceof File) return this.parseFile(t);
52423
52499
  if (Array.isArray(t)) {
52424
- let n = BW(t);
52500
+ let n = HW(t);
52425
52501
  if (!n) return this.remoteSource.fail({ kind: "empty" }), null;
52426
52502
  this.parser.stageGrid(n, {
52427
52503
  kind: "remote",
@@ -52455,11 +52531,11 @@ var BW = (e) => {
52455
52531
  rawRows: this.parser.takeRawRows(e.id)
52456
52532
  }));
52457
52533
  this.commit();
52458
- let a = 0, o = [];
52534
+ let a = 0, o = [], s = { rowImportHookDisabled: !1 };
52459
52535
  try {
52460
52536
  let t = await this.importRunner.run(() => Md(this.deps.store, "importing", Infinity, async () => {
52461
52537
  for (; a < i.length; a++) {
52462
- let { workbook: t, rawRows: r } = i[a], s = await UU({
52538
+ let { workbook: t, rawRows: r } = i[a], c = await GU({
52463
52539
  workbook: t,
52464
52540
  rawRows: r,
52465
52541
  signal: n.signal,
@@ -52476,10 +52552,13 @@ var BW = (e) => {
52476
52552
  primaryKey: this.primaryKey.state.selected,
52477
52553
  extraSynonyms: this.deps.extraSynonyms,
52478
52554
  addDynamicColumns: this.deps.addDynamicColumns,
52479
- structuralMismatchMessage: e.structuralMismatchMessage
52555
+ structuralMismatchMessage: e.structuralMismatchMessage,
52556
+ onRowImport: this.deps.onRowImport,
52557
+ hookContext: this.deps.context,
52558
+ hookRunState: s
52480
52559
  });
52481
- if (s.outcome === "cancelled") return "cancelled";
52482
- s.collapsed && o.push(YH(t)), this.importRunner.markImported(t.id);
52560
+ if (c.outcome === "cancelled") return "cancelled";
52561
+ c.collapsed && o.push(YH(t)), this.importRunner.markImported(t.id);
52483
52562
  }
52484
52563
  return "completed";
52485
52564
  }));
@@ -52559,7 +52638,7 @@ var BW = (e) => {
52559
52638
  if (!this.lastNavInputs || this.lastNavInputs.parser !== a.parser || this.lastNavInputs.mapping !== a.mapping || this.lastNavInputs.eligible !== a.eligible || this.lastNavInputs.composite !== a.composite) {
52560
52639
  let n = new Set(t), o = this.deps.columns.some((e) => Hh(e).options(e) !== null && n.has(e.id)), s = [];
52561
52640
  for (let t of e.workbooks) (t.detection.review.kind !== "none" || this.manualHeaderReviewIds.has(t.id)) && s.push(t.id);
52562
- dG(s, this.lastHeaderReviewIds) || (this.lastHeaderReviewIds = s), this.lastStepIds = mU({
52641
+ pG(s, this.lastHeaderReviewIds) || (this.lastHeaderReviewIds = s), this.lastStepIds = mU({
52563
52642
  headerReviewCount: this.lastHeaderReviewIds.length,
52564
52643
  columnMatchingCount: e.workbooks.length,
52565
52644
  hasSelectColumns: o,
@@ -52577,7 +52656,7 @@ var BW = (e) => {
52577
52656
  headerReview: bU(this.lastStepIds, o, this.lastHeaderReviewIds),
52578
52657
  columnMatching: vU(this.lastStepIds, o, e.workbooks.map((e) => e.id))
52579
52658
  }, l = this.lastNavigation;
52580
- return l && l.stepIds === c.stepIds && l.activeStepIndex === c.activeStepIndex && l.currentStepIndex === c.currentStepIndex && l.isFirstStep === c.isFirstStep && l.isLastStep === c.isLastStep && fG(l.headerReview, c.headerReview) && yU(l.columnMatching, c.columnMatching) ? l : (this.lastNavigation = c, c);
52659
+ return l && l.stepIds === c.stepIds && l.activeStepIndex === c.activeStepIndex && l.currentStepIndex === c.currentStepIndex && l.isFirstStep === c.isFirstStep && l.isLastStep === c.isLastStep && mG(l.headerReview, c.headerReview) && yU(l.columnMatching, c.columnMatching) ? l : (this.lastNavigation = c, c);
52581
52660
  }
52582
52661
  commit() {
52583
52662
  this.snapshots.commit({
@@ -52590,7 +52669,7 @@ var BW = (e) => {
52590
52669
  remoteSource: this.remoteSource.state
52591
52670
  });
52592
52671
  }
52593
- }, mG = (e, t) => {
52672
+ }, gG = (e, t) => {
52594
52673
  let n = /* @__PURE__ */ new Map();
52595
52674
  for (let e of t) {
52596
52675
  let t = e.toLowerCase();
@@ -52616,7 +52695,7 @@ var BW = (e) => {
52616
52695
  createdOptions: r,
52617
52696
  updates: i
52618
52697
  };
52619
- }, hG = (e, t) => {
52698
+ }, _G = (e, t) => {
52620
52699
  let n = 0;
52621
52700
  for (let r of e.headers) t[r] && n++;
52622
52701
  return {
@@ -52627,12 +52706,12 @@ var BW = (e) => {
52627
52706
  matchedCount: n,
52628
52707
  allMatched: n === e.headers.length
52629
52708
  };
52630
- }, gG = {}, _G = {}, vG = [], yG = () => {
52631
- let { columns: e, enableCreateColumn: t } = Vy(), { t: n } = W(), r = dV(), i = SV(r, xV), a = SV(r, pV), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = SV(r, mV), d = o ? s[o.id] ?? gG : gG, f = o?.id ?? null, p = (0, y.useCallback)((e, t) => {
52709
+ }, vG = {}, yG = {}, bG = [], xG = () => {
52710
+ let { columns: e, enableCreateColumn: t } = Vy(), { t: n } = W(), r = dV(), i = SV(r, xV), a = SV(r, pV), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = SV(r, mV), d = o ? s[o.id] ?? vG : vG, f = o?.id ?? null, p = (0, y.useCallback)((e, t) => {
52632
52711
  f !== null && r.updateColumnMapping(f, e, t);
52633
52712
  }, [r, f]), m = (0, y.useCallback)((e) => {
52634
52713
  r.setPendingColumns(e);
52635
- }, [r]), h = (0, y.useMemo)(() => o ? hG(o, d) : null, [o, d]), g = (i?.total ?? 0) > 1, _ = h?.headers ?? vG, [v, b] = (0, y.useState)(null), { value: x, setTrue: S, setFalse: C } = Ql(!1), [w, T] = (0, y.useState)({}), E = (0, y.useRef)(null), D = (0, y.useCallback)((e) => w[e] ?? !0, [w]), O = (0, y.useCallback)((e, t) => {
52714
+ }, [r]), h = (0, y.useMemo)(() => o ? _G(o, d) : null, [o, d]), g = (i?.total ?? 0) > 1, _ = h?.headers ?? bG, [v, b] = (0, y.useState)(null), { value: x, setTrue: S, setFalse: C } = Ql(!1), [w, T] = (0, y.useState)({}), E = (0, y.useRef)(null), D = (0, y.useCallback)((e) => w[e] ?? !0, [w]), O = (0, y.useCallback)((e, t) => {
52636
52715
  T((n) => ({
52637
52716
  ...n,
52638
52717
  [e]: t
@@ -52657,7 +52736,7 @@ var BW = (e) => {
52657
52736
  C
52658
52737
  ]), j = (0, y.useCallback)(() => {
52659
52738
  E.current = null, C();
52660
- }, [C]), M = (0, y.useMemo)(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), N = f ? l[f] ?? _G : _G, P = (0, y.useMemo)(() => {
52739
+ }, [C]), M = (0, y.useMemo)(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), N = f ? l[f] ?? yG : yG, P = (0, y.useMemo)(() => {
52661
52740
  let r = {
52662
52741
  text: n("dataEditor.uploader.matchColumns.bestMatch"),
52663
52742
  color: "green"
@@ -52718,19 +52797,19 @@ var BW = (e) => {
52718
52797
  submitCreate: A,
52719
52798
  closeCreate: j
52720
52799
  };
52721
- }, bG = (0, y.createContext)(null);
52722
- function xG({ children: e }) {
52723
- let t = yG();
52724
- return /* @__PURE__ */ (0, B.jsx)(bG.Provider, {
52800
+ }, SG = (0, y.createContext)(null);
52801
+ function CG({ children: e }) {
52802
+ let t = xG();
52803
+ return /* @__PURE__ */ (0, B.jsx)(SG.Provider, {
52725
52804
  value: t,
52726
52805
  children: e
52727
52806
  });
52728
52807
  }
52729
- var SG = () => {
52730
- let e = (0, y.useContext)(bG);
52808
+ var wG = () => {
52809
+ let e = (0, y.useContext)(SG);
52731
52810
  if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
52732
52811
  return e;
52733
- }, CG = ({ name: e, fileName: t, size: n = "sm", as: r = "div", className: i }) => /* @__PURE__ */ (0, B.jsxs)(q, {
52812
+ }, TG = ({ name: e, fileName: t, size: n = "sm", as: r = "div", className: i }) => /* @__PURE__ */ (0, B.jsxs)(q, {
52734
52813
  as: r,
52735
52814
  size: n,
52736
52815
  weight: "medium",
@@ -52750,15 +52829,15 @@ var SG = () => {
52750
52829
  tooltipProps: { placement: "bottom-start" },
52751
52830
  children: e
52752
52831
  })]
52753
- }), wG = ({ view: e }) => {
52754
- let { t } = W(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } = SG(), o = e.allMatched ? "green" : "yellow", s = !n, c = (0, y.useCallback)((t) => {
52832
+ }), EG = ({ view: e }) => {
52833
+ let { t } = W(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } = wG(), o = e.allMatched ? "green" : "yellow", s = !n, c = (0, y.useCallback)((t) => {
52755
52834
  a(e.workbookId, t);
52756
52835
  }, [a, e.workbookId]);
52757
52836
  return /* @__PURE__ */ (0, B.jsx)("header", {
52758
52837
  className: "updog__column-matching__header",
52759
52838
  children: /* @__PURE__ */ (0, B.jsxs)("div", {
52760
52839
  className: "updog__column-matching__header-inner",
52761
- children: [r && /* @__PURE__ */ (0, B.jsx)(CG, {
52840
+ children: [r && /* @__PURE__ */ (0, B.jsx)(TG, {
52762
52841
  name: e.name,
52763
52842
  fileName: e.fileName,
52764
52843
  className: "updog__column-matching__header-source"
@@ -52802,7 +52881,7 @@ var SG = () => {
52802
52881
  })]
52803
52882
  })
52804
52883
  });
52805
- }, TG = (0, y.forwardRef)(({ csvHeader: e, limit: t, getSampleValues: n }, r) => {
52884
+ }, DG = (0, y.forwardRef)(({ csvHeader: e, limit: t, getSampleValues: n }, r) => {
52806
52885
  let { t: i } = W(), a = n(e, t);
52807
52886
  return /* @__PURE__ */ (0, B.jsx)("div", {
52808
52887
  ref: r,
@@ -52826,15 +52905,15 @@ var SG = () => {
52826
52905
  }, e))
52827
52906
  })
52828
52907
  });
52829
- }), EG = 5, DG = ({ labelId: e, csvHeader: t, getSampleValues: n }) => {
52908
+ }), OG = 5, kG = ({ labelId: e, csvHeader: t, getSampleValues: n }) => {
52830
52909
  let { t: r } = W(), [i, a] = (0, y.useState)(!1), o = (0, y.useRef)(null), s = (0, y.useMemo)(() => ({ initialFocus: o }), []);
52831
52910
  return /* @__PURE__ */ (0, B.jsx)(Cl, {
52832
52911
  open: i,
52833
52912
  onOpenChange: a,
52834
- content: /* @__PURE__ */ (0, B.jsx)(TG, {
52913
+ content: /* @__PURE__ */ (0, B.jsx)(DG, {
52835
52914
  ref: o,
52836
52915
  csvHeader: t,
52837
- limit: EG,
52916
+ limit: OG,
52838
52917
  getSampleValues: n
52839
52918
  }),
52840
52919
  floatingFocusManager: s,
@@ -52871,7 +52950,7 @@ var SG = () => {
52871
52950
  })]
52872
52951
  })
52873
52952
  });
52874
- }, OG = (0, y.memo)(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, getSampleValues: o, onSelectChange: s, onClear: c }) => {
52953
+ }, AG = (0, y.memo)(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, getSampleValues: o, onSelectChange: s, onClear: c }) => {
52875
52954
  let { t: l } = W(), u = (0, y.useId)(), d = !t, f = t?.startsWith("__dynamic__:") && !!r && !a, p = d && !a, m = (0, y.useCallback)((t) => {
52876
52955
  s(e, t);
52877
52956
  }, [e, s]), h = (0, y.useCallback)(() => {
@@ -52882,7 +52961,7 @@ var SG = () => {
52882
52961
  children: [
52883
52962
  /* @__PURE__ */ (0, B.jsx)("div", {
52884
52963
  className: "updog__column-matching__column",
52885
- children: /* @__PURE__ */ (0, B.jsx)(DG, {
52964
+ children: /* @__PURE__ */ (0, B.jsx)(kG, {
52886
52965
  labelId: u,
52887
52966
  csvHeader: e,
52888
52967
  getSampleValues: o
@@ -52935,8 +53014,8 @@ var SG = () => {
52935
53014
  })
52936
53015
  ]
52937
53016
  });
52938
- }), kG = ({ view: e }) => {
52939
- let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, getSampleValues: a, onSelectChange: o, onClear: s } = SG(), { t: c } = W(), l = n(e.workbookId), u = e.headers.map((e) => ({
53017
+ }), jG = ({ view: e }) => {
53018
+ let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, getSampleValues: a, onSelectChange: o, onClear: s } = wG(), { t: c } = W(), l = n(e.workbookId), u = e.headers.map((e) => ({
52940
53019
  csvHeader: e,
52941
53020
  ...i(e)
52942
53021
  })).filter((e) => l || !e.mappedValue);
@@ -52954,7 +53033,7 @@ var SG = () => {
52954
53033
  className: "updog__column-matching__content",
52955
53034
  children: /* @__PURE__ */ (0, B.jsx)("div", {
52956
53035
  className: "updog__column-matching__content-inner",
52957
- children: u.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: c }) => /* @__PURE__ */ (0, B.jsx)(OG, {
53036
+ children: u.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: c }) => /* @__PURE__ */ (0, B.jsx)(AG, {
52958
53037
  csvHeader: e,
52959
53038
  mappedValue: n,
52960
53039
  options: i,
@@ -52967,8 +53046,8 @@ var SG = () => {
52967
53046
  }, e))
52968
53047
  })
52969
53048
  });
52970
- }, AG = () => {
52971
- let { createModalValues: e, createModalOpen: t, existingNames: n, submitCreate: r, closeCreate: i } = SG();
53049
+ }, MG = () => {
53050
+ let { createModalValues: e, createModalOpen: t, existingNames: n, submitCreate: r, closeCreate: i } = wG();
52972
53051
  return /* @__PURE__ */ (0, B.jsx)(Fx, {
52973
53052
  open: t,
52974
53053
  onClose: i,
@@ -52976,23 +53055,23 @@ var SG = () => {
52976
53055
  existingNames: n,
52977
53056
  onSubmit: r
52978
53057
  });
52979
- }, jG = () => {
52980
- let { view: e } = SG();
53058
+ }, NG = () => {
53059
+ let { view: e } = wG();
52981
53060
  return e ? /* @__PURE__ */ (0, B.jsxs)("div", {
52982
53061
  className: "updog__column-matching",
52983
53062
  children: [
52984
- /* @__PURE__ */ (0, B.jsx)(wG, { view: e }),
52985
- /* @__PURE__ */ (0, B.jsx)(kG, { view: e }),
52986
- /* @__PURE__ */ (0, B.jsx)(AG, {})
53063
+ /* @__PURE__ */ (0, B.jsx)(EG, { view: e }),
53064
+ /* @__PURE__ */ (0, B.jsx)(jG, { view: e }),
53065
+ /* @__PURE__ */ (0, B.jsx)(MG, {})
52987
53066
  ]
52988
53067
  }) : null;
52989
- }, MG = () => SV(dV(), bV) ? /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)(Jy, { children: [/* @__PURE__ */ (0, B.jsx)("div", {
53068
+ }, PG = () => SV(dV(), bV) ? /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)(Jy, { children: [/* @__PURE__ */ (0, B.jsx)("div", {
52990
53069
  className: "updog__step-column-matching__content updog__scrollbar",
52991
- children: /* @__PURE__ */ (0, B.jsx)(xG, { children: /* @__PURE__ */ (0, B.jsx)(jG, {}) })
53070
+ children: /* @__PURE__ */ (0, B.jsx)(CG, { children: /* @__PURE__ */ (0, B.jsx)(NG, {}) })
52992
53071
  }), /* @__PURE__ */ (0, B.jsx)(DV, { leftSlot: /* @__PURE__ */ (0, B.jsx)(OV, {}) })] }) }) : null;
52993
53072
  //#endregion
52994
53073
  //#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
52995
- function NG(e, t, n, r, i) {
53074
+ function FG(e, t, n, r, i) {
52996
53075
  return (0, y.useMemo)(() => ({
52997
53076
  sample: e,
52998
53077
  columnHeaders: t,
@@ -53009,20 +53088,20 @@ function NG(e, t, n, r, i) {
53009
53088
  }
53010
53089
  //#endregion
53011
53090
  //#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
53012
- var PG = (0, y.createContext)(null);
53013
- function FG({ sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i, children: a }) {
53014
- let o = NG(e, t, n, r, i);
53015
- return /* @__PURE__ */ (0, B.jsx)(PG.Provider, {
53091
+ var IG = (0, y.createContext)(null);
53092
+ function LG({ sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i, children: a }) {
53093
+ let o = FG(e, t, n, r, i);
53094
+ return /* @__PURE__ */ (0, B.jsx)(IG.Provider, {
53016
53095
  value: o,
53017
53096
  children: a
53018
53097
  });
53019
53098
  }
53020
- var IG = () => {
53021
- let e = (0, y.useContext)(PG);
53099
+ var RG = () => {
53100
+ let e = (0, y.useContext)(IG);
53022
53101
  if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
53023
53102
  return e;
53024
- }, LG = () => {
53025
- let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } = IG(), { headers: a, rows: o } = (0, y.useMemo)(() => {
53103
+ }, zG = () => {
53104
+ let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } = RG(), { headers: a, rows: o } = (0, y.useMemo)(() => {
53026
53105
  let n = t.length;
53027
53106
  return {
53028
53107
  headers: t.map((e) => i ? e : ""),
@@ -53042,7 +53121,7 @@ var IG = () => {
53042
53121
  selectedRow: i ? void 0 : n,
53043
53122
  onSelectRow: i ? void 0 : r
53044
53123
  });
53045
- }, RG = () => {
53124
+ }, BG = () => {
53046
53125
  let { t: e } = W(), t = dV(), { headerReview: n } = SV(t, _V), r = SV(t, pV), i = n ? r.find((e) => e.id === n.workbookId) ?? null : null, a = (0, y.useCallback)((e) => {
53047
53126
  i && t.setHeaderRowIndex(i.id, e);
53048
53127
  }, [t, i]), o = (0, y.useCallback)((e) => {
@@ -53050,7 +53129,7 @@ var IG = () => {
53050
53129
  }, [a, i]);
53051
53130
  if (!i) return null;
53052
53131
  let s = i.rawRows.slice(0, 50), c = i.headerRowIndex < 0, l = c ? void 0 : i.headerRowIndex, u = i.origin.kind === "sheet" ? i.origin.file.name : null;
53053
- return /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsx)(Jy, { children: /* @__PURE__ */ (0, B.jsxs)(FG, {
53132
+ return /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsx)(Jy, { children: /* @__PURE__ */ (0, B.jsxs)(LG, {
53054
53133
  sample: s,
53055
53134
  columnHeaders: i.headers,
53056
53135
  selectedRow: l,
@@ -53059,7 +53138,7 @@ var IG = () => {
53059
53138
  children: [/* @__PURE__ */ (0, B.jsxs)("div", {
53060
53139
  className: "updog__step-header-selection__content updog__scrollbar",
53061
53140
  children: [
53062
- /* @__PURE__ */ (0, B.jsx)(CG, {
53141
+ /* @__PURE__ */ (0, B.jsx)(TG, {
53063
53142
  as: "h3",
53064
53143
  size: "md",
53065
53144
  name: i.name,
@@ -53074,11 +53153,11 @@ var IG = () => {
53074
53153
  label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
53075
53154
  })
53076
53155
  }),
53077
- /* @__PURE__ */ (0, B.jsx)(LG, {})
53156
+ /* @__PURE__ */ (0, B.jsx)(zG, {})
53078
53157
  ]
53079
53158
  }), /* @__PURE__ */ (0, B.jsx)(DV, {})]
53080
53159
  }) }) });
53081
- }, zG = "updog__value-matching__create-divider", BG = ({ options: e, extraOptions: t, enableCustomValue: n, createLabel: r, label: i, tags: a }) => {
53160
+ }, VG = "updog__value-matching__create-divider", HG = ({ options: e, extraOptions: t, enableCustomValue: n, createLabel: r, label: i, tags: a }) => {
53082
53161
  let o = new Map(a?.map(({ id: e, tag: t }) => [e, t])), s = e.map((e) => {
53083
53162
  let t = o.get(e);
53084
53163
  return {
@@ -53094,14 +53173,14 @@ var IG = () => {
53094
53173
  text: e
53095
53174
  }));
53096
53175
  return s.push({
53097
- id: zG,
53176
+ id: VG,
53098
53177
  type: "divider"
53099
53178
  }, {
53100
53179
  id: yd,
53101
53180
  text: r,
53102
53181
  icon: /* @__PURE__ */ (0, B.jsx)(He, { size: "1rem" })
53103
53182
  }), s;
53104
- }, VG = (e, t) => {
53183
+ }, UG = (e, t) => {
53105
53184
  let n = e.values.filter((e) => t || e.mapped === void 0);
53106
53185
  return e.values.length > 500 && n.length > 3 ? {
53107
53186
  visible: n.slice(0, 3),
@@ -53110,13 +53189,13 @@ var IG = () => {
53110
53189
  visible: n,
53111
53190
  overflow: 0
53112
53191
  };
53113
- }, HG = (e, t) => e === void 0 ? [] : [{
53192
+ }, WG = (e, t) => e === void 0 ? [] : [{
53114
53193
  id: e,
53115
53194
  tag: t
53116
- }], UG = (e, t) => e?.kind === "ambiguous" ? e.candidates.map((e) => ({
53195
+ }], GG = (e, t) => e?.kind === "ambiguous" ? e.candidates.map((e) => ({
53117
53196
  id: e,
53118
53197
  tag: t
53119
- })) : [], WG = () => {
53198
+ })) : [], KG = () => {
53120
53199
  let { columns: e } = Vy(), { t, locale: n } = W(), r = dV(), i = SV(r, bV), { mappedColumnIds: a } = SV(r, mV), { merged: o, computed: s, multiselectDelimiters: c, pendingOptions: l, importedValues: u, verdicts: d, isMatching: f } = SV(r, hV), p = (0, y.useCallback)((e, t, n) => r.updateValueMapping(e, t, n), [r]), m = (0, y.useCallback)((e, t) => r.setMultiselectDelimiter(e, t), [r]), h = (0, y.useCallback)((e) => r.reapplyMultiselectDelimiter(e), [r]), g = (0, y.useCallback)((e, t) => r.addPendingOption(e, t), [r]), [_, v] = (0, y.useState)({}), [b, x] = (0, y.useState)({}), [S, C] = (0, y.useState)(null), w = (0, y.useRef)(!1), T = (0, y.useMemo)(() => {
53121
53200
  if (!i) return [];
53122
53201
  let r = [];
@@ -53182,14 +53261,14 @@ var IG = () => {
53182
53261
  color: "neutral"
53183
53262
  }, r = t("dataEditor.uploader.matchValues.createOption"), i = {};
53184
53263
  for (let t of T) {
53185
- let a = l[t.columnId] ?? [], o = {}, { visible: c } = VG(t, _[t.columnId] ?? !0), u = d[t.columnId];
53186
- for (let i of c) o[i.imported] = BG({
53264
+ let a = l[t.columnId] ?? [], o = {}, { visible: c } = UG(t, _[t.columnId] ?? !0), u = d[t.columnId];
53265
+ for (let i of c) o[i.imported] = HG({
53187
53266
  options: t.options,
53188
53267
  extraOptions: a,
53189
53268
  enableCustomValue: t.enableCustomValue,
53190
53269
  createLabel: r,
53191
53270
  label: t.label,
53192
- tags: u ? UG(u[i.imported], n) : HG(s[t.columnId]?.[i.imported], e)
53271
+ tags: u ? GG(u[i.imported], n) : WG(s[t.columnId]?.[i.imported], e)
53193
53272
  });
53194
53273
  i[t.columnId] = o;
53195
53274
  }
@@ -53201,7 +53280,7 @@ var IG = () => {
53201
53280
  l,
53202
53281
  _,
53203
53282
  t
53204
- ]), D = (0, y.useCallback)((e) => _[e] ?? !0, [_]), O = (0, y.useCallback)((e) => b[e] ?? !1, [b]), k = (0, y.useCallback)((e) => VG(e, _[e.columnId] ?? !0), [_]), A = (0, y.useCallback)((e, t) => E[e]?.[t] ?? [], [E]), j = (0, y.useCallback)((e, t) => {
53283
+ ]), D = (0, y.useCallback)((e) => _[e] ?? !0, [_]), O = (0, y.useCallback)((e) => b[e] ?? !1, [b]), k = (0, y.useCallback)((e) => UG(e, _[e.columnId] ?? !0), [_]), A = (0, y.useCallback)((e, t) => E[e]?.[t] ?? [], [E]), j = (0, y.useCallback)((e, t) => {
53205
53284
  v((n) => ({
53206
53285
  ...n,
53207
53286
  [e]: t
@@ -53253,20 +53332,20 @@ var IG = () => {
53253
53332
  submitCreate: L,
53254
53333
  closeCreate: R
53255
53334
  };
53256
- }, GG = (0, y.createContext)(null);
53257
- function KG({ children: e }) {
53258
- let t = WG();
53259
- return /* @__PURE__ */ (0, B.jsx)(GG.Provider, {
53335
+ }, qG = (0, y.createContext)(null);
53336
+ function JG({ children: e }) {
53337
+ let t = KG();
53338
+ return /* @__PURE__ */ (0, B.jsx)(qG.Provider, {
53260
53339
  value: t,
53261
53340
  children: e
53262
53341
  });
53263
53342
  }
53264
- var qG = () => {
53265
- let e = (0, y.useContext)(GG);
53343
+ var YG = () => {
53344
+ let e = (0, y.useContext)(qG);
53266
53345
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
53267
53346
  return e;
53268
- }, JG = ({ section: e, panelId: t }) => {
53269
- let { t: n } = W(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } = qG(), c = i(e.columnId), l = !s, u = n(c ? "dataEditor.common.expand" : "dataEditor.common.collapse"), d = (0, y.useCallback)((t) => a(e.columnId, t), [a, e.columnId]), f = (0, y.useCallback)(() => o(e.columnId), [o, e.columnId]);
53347
+ }, XG = ({ section: e, panelId: t }) => {
53348
+ let { t: n } = W(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } = YG(), c = i(e.columnId), l = !s, u = n(c ? "dataEditor.common.expand" : "dataEditor.common.collapse"), d = (0, y.useCallback)((t) => a(e.columnId, t), [a, e.columnId]), f = (0, y.useCallback)(() => o(e.columnId), [o, e.columnId]);
53270
53349
  return /* @__PURE__ */ (0, B.jsxs)("header", {
53271
53350
  className: "updog__value-matching__section-header",
53272
53351
  children: [/* @__PURE__ */ (0, B.jsx)("div", {
@@ -53313,14 +53392,14 @@ var qG = () => {
53313
53392
  })
53314
53393
  })]
53315
53394
  });
53316
- }, YG = {
53395
+ }, ZG = {
53317
53396
  ",": ",",
53318
53397
  ";": ";",
53319
53398
  "|": "|",
53320
53399
  "\n": "\\n",
53321
53400
  " ": "\\t"
53322
- }, XG = (e) => e === null ? "" : YG[e] ?? e, ZG = ({ section: e }) => {
53323
- let { t } = W(), { changeDelimiter: n, reapplyDelimiter: r } = qG(), i = (0, y.useRef)(e.delimiter), a = XG(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = sn(o, 300), l = (0, y.useRef)(a);
53401
+ }, QG = (e) => e === null ? "" : ZG[e] ?? e, $G = ({ section: e }) => {
53402
+ let { t } = W(), { changeDelimiter: n, reapplyDelimiter: r } = YG(), i = (0, y.useRef)(e.delimiter), a = QG(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = sn(o, 300), l = (0, y.useRef)(a);
53324
53403
  (0, y.useEffect)(() => {
53325
53404
  s(a), l.current = a;
53326
53405
  }, [a]), (0, y.useEffect)(() => {
@@ -53363,7 +53442,7 @@ var qG = () => {
53363
53442
  })
53364
53443
  ]
53365
53444
  });
53366
- }, QG = (0, y.memo)(({ value: e, options: t, isMatching: n = !1, fluid: r = !1, onSelect: i }) => {
53445
+ }, eK = (0, y.memo)(({ value: e, options: t, isMatching: n = !1, fluid: r = !1, onSelect: i }) => {
53367
53446
  let { t: a } = W(), o = (0, y.useId)(), s = e.mapped === void 0, c = s && !n, l = (0, y.useCallback)((t) => {
53368
53447
  i(e.imported, t);
53369
53448
  }, [i, e.imported]), u = (0, y.useCallback)(() => {
@@ -53425,28 +53504,28 @@ var qG = () => {
53425
53504
  })
53426
53505
  ]
53427
53506
  });
53428
- }), $G = ({ section: e, value: t }) => {
53429
- let { getSelectOptions: n, selectValue: r, isMatching: i } = qG(), a = (0, y.useCallback)((t, n) => {
53507
+ }), tK = ({ section: e, value: t }) => {
53508
+ let { getSelectOptions: n, selectValue: r, isMatching: i } = YG(), a = (0, y.useCallback)((t, n) => {
53430
53509
  r(e.columnId, t, n);
53431
53510
  }, [r, e.columnId]);
53432
- return /* @__PURE__ */ (0, B.jsx)(QG, {
53511
+ return /* @__PURE__ */ (0, B.jsx)(eK, {
53433
53512
  value: t,
53434
53513
  options: n(e.columnId, t.imported),
53435
53514
  isMatching: i,
53436
53515
  onSelect: a
53437
53516
  });
53438
- }, eK = (e, t) => {
53517
+ }, nK = (e, t) => {
53439
53518
  let n = new Map(e.map((e) => [e.imported, e.mapped])), r = [];
53440
53519
  for (let e of t) n.get(e.imported) !== e.mapped && r.push({
53441
53520
  importedValue: e.imported,
53442
53521
  mappedValue: e.mapped
53443
53522
  });
53444
53523
  return r;
53445
- }, tK = ({ scrollTop: e, viewportHeight: t, rowHeight: n, count: r, overscan: i }) => ({
53524
+ }, rK = ({ scrollTop: e, viewportHeight: t, rowHeight: n, count: r, overscan: i }) => ({
53446
53525
  start: Math.max(0, Math.floor(e / n) - i),
53447
53526
  end: Math.min(r, Math.ceil((e + t) / n) + i)
53448
- }), nK = 3.625, rK = 5, iK = 16, aK = ({ values: e, options: t, onSelect: n }) => {
53449
- let r = (0, y.useRef)(null), [i, a] = (0, y.useState)(iK), [o, s] = (0, y.useState)({
53527
+ }), iK = 3.625, aK = 5, oK = 16, sK = ({ values: e, options: t, onSelect: n }) => {
53528
+ let r = (0, y.useRef)(null), [i, a] = (0, y.useState)(oK), [o, s] = (0, y.useState)({
53450
53529
  start: 0,
53451
53530
  end: 0
53452
53531
  });
@@ -53457,12 +53536,12 @@ var qG = () => {
53457
53536
  let c = (0, y.useCallback)(() => {
53458
53537
  let t = r.current;
53459
53538
  if (!t) return;
53460
- let n = tK({
53539
+ let n = rK({
53461
53540
  scrollTop: t.scrollTop,
53462
53541
  viewportHeight: t.clientHeight,
53463
- rowHeight: nK * i,
53542
+ rowHeight: iK * i,
53464
53543
  count: e.length,
53465
- overscan: rK
53544
+ overscan: aK
53466
53545
  });
53467
53546
  s((e) => e.start === n.start && e.end === n.end ? e : n);
53468
53547
  }, [i, e.length]);
@@ -53482,14 +53561,14 @@ var qG = () => {
53482
53561
  className: "updog__values-drawer__list updog__scrollbar",
53483
53562
  children: /* @__PURE__ */ (0, B.jsx)("div", {
53484
53563
  className: "updog__values-drawer__list-inner",
53485
- style: { height: `${e.length * nK}rem` },
53564
+ style: { height: `${e.length * iK}rem` },
53486
53565
  children: l.map((e, r) => /* @__PURE__ */ (0, B.jsx)("div", {
53487
53566
  className: "updog__values-drawer__list-item",
53488
53567
  style: {
53489
- height: `${nK}rem`,
53490
- transform: `translateY(${(o.start + r) * nK}rem)`
53568
+ height: `${iK}rem`,
53569
+ transform: `translateY(${(o.start + r) * iK}rem)`
53491
53570
  },
53492
- children: /* @__PURE__ */ (0, B.jsx)(QG, {
53571
+ children: /* @__PURE__ */ (0, B.jsx)(eK, {
53493
53572
  value: e,
53494
53573
  options: t,
53495
53574
  fluid: !0,
@@ -53498,7 +53577,7 @@ var qG = () => {
53498
53577
  }, e.imported))
53499
53578
  })
53500
53579
  });
53501
- }, oK = ({ section: e, onCancel: t, onSave: n }) => {
53580
+ }, cK = ({ section: e, onCancel: t, onSave: n }) => {
53502
53581
  let { t: r } = W(), [i] = (0, y.useState)(e.values), [a, o] = (0, y.useState)(i), [s] = (0, y.useState)(e.delimiter), [c, l] = (0, y.useState)([]), [u, d] = (0, y.useState)(null), f = (0, y.useMemo)(() => [
53503
53582
  ...e.options,
53504
53583
  ...e.pendingOptions,
@@ -53507,7 +53586,7 @@ var qG = () => {
53507
53586
  e.options,
53508
53587
  e.pendingOptions,
53509
53588
  c
53510
- ]), p = (0, y.useMemo)(() => BG({
53589
+ ]), p = (0, y.useMemo)(() => HG({
53511
53590
  options: e.options,
53512
53591
  extraOptions: [...e.pendingOptions, ...c],
53513
53592
  enableCustomValue: e.enableCustomValue,
@@ -53536,7 +53615,7 @@ var qG = () => {
53536
53615
  }, []), _ = (0, y.useCallback)((e) => {
53537
53616
  u !== null && (l((t) => [...t, e]), m(u, e), d(null));
53538
53617
  }, [u, m]), v = (0, y.useCallback)(() => {
53539
- let e = mG(a, f);
53618
+ let e = gG(a, f);
53540
53619
  if (e.updates.length === 0) return;
53541
53620
  let t = new Map(e.updates.map((e) => [e.importedValue, e.mappedValue]));
53542
53621
  l((t) => [...t, ...e.createdOptions]), o((e) => e.map((e) => {
@@ -53548,7 +53627,7 @@ var qG = () => {
53548
53627
  }));
53549
53628
  }, [a, f]), b = (0, y.useCallback)(() => {
53550
53629
  n({
53551
- updates: eK(i, a),
53630
+ updates: nK(i, a),
53552
53631
  delimiter: s,
53553
53632
  createdOptions: c
53554
53633
  });
@@ -53572,7 +53651,7 @@ var qG = () => {
53572
53651
  }) }),
53573
53652
  /* @__PURE__ */ (0, B.jsx)(rl, {
53574
53653
  className: "updog__values-drawer__body",
53575
- children: /* @__PURE__ */ (0, B.jsx)(aK, {
53654
+ children: /* @__PURE__ */ (0, B.jsx)(sK, {
53576
53655
  values: a,
53577
53656
  options: p,
53578
53657
  onSelect: h
@@ -53605,8 +53684,8 @@ var qG = () => {
53605
53684
  onSubmit: _
53606
53685
  })
53607
53686
  ] });
53608
- }, sK = ({ open: e, onDismiss: t, section: n }) => {
53609
- let { applyValueMappingBatch: r } = qG(), i = (0, y.useCallback)((e) => {
53687
+ }, lK = ({ open: e, onDismiss: t, section: n }) => {
53688
+ let { applyValueMappingBatch: r } = YG(), i = (0, y.useCallback)((e) => {
53610
53689
  e || t();
53611
53690
  }, [t]), a = (0, y.useCallback)((e) => {
53612
53691
  r(n.columnId, e.updates, e.createdOptions), t();
@@ -53620,14 +53699,14 @@ var qG = () => {
53620
53699
  onOpenChange: i,
53621
53700
  className: "updog__values-drawer",
53622
53701
  closeOnOutsidePress: !1,
53623
- children: /* @__PURE__ */ (0, B.jsx)(oK, {
53702
+ children: /* @__PURE__ */ (0, B.jsx)(cK, {
53624
53703
  section: n,
53625
53704
  onCancel: t,
53626
53705
  onSave: a
53627
53706
  })
53628
53707
  });
53629
- }, cK = ({ section: e }) => {
53630
- let { t } = W(), { getVisibleValues: n } = qG(), { visible: r, overflow: i } = n(e), a = r.length === 0, { value: o, setTrue: s, setFalse: c } = Ql(!1);
53708
+ }, uK = ({ section: e }) => {
53709
+ let { t } = W(), { getVisibleValues: n } = YG(), { visible: r, overflow: i } = n(e), a = r.length === 0, { value: o, setTrue: s, setFalse: c } = Ql(!1);
53631
53710
  return /* @__PURE__ */ (0, B.jsxs)("div", {
53632
53711
  className: "updog__value-matching__table",
53633
53712
  children: [
@@ -53648,7 +53727,7 @@ var qG = () => {
53648
53727
  size: "sm",
53649
53728
  weight: "medium",
53650
53729
  children: t("dataEditor.uploader.matchValues.importedValues")
53651
- }), e.isMultiselect && /* @__PURE__ */ (0, B.jsx)(ZG, { section: e })]
53730
+ }), e.isMultiselect && /* @__PURE__ */ (0, B.jsx)($G, { section: e })]
53652
53731
  }),
53653
53732
  /* @__PURE__ */ (0, B.jsx)("div", { className: "updog__value-matching__arrow-spacer" }),
53654
53733
  /* @__PURE__ */ (0, B.jsx)(q, {
@@ -53661,7 +53740,7 @@ var qG = () => {
53661
53740
  /* @__PURE__ */ (0, B.jsx)("div", { className: "updog__value-matching__action" })
53662
53741
  ]
53663
53742
  }),
53664
- r.map((t) => /* @__PURE__ */ (0, B.jsx)($G, {
53743
+ r.map((t) => /* @__PURE__ */ (0, B.jsx)(tK, {
53665
53744
  section: e,
53666
53745
  value: t
53667
53746
  }, t.imported)),
@@ -53682,7 +53761,7 @@ var qG = () => {
53682
53761
  onClick: s,
53683
53762
  children: t("dataEditor.uploader.matchValues.showAll")
53684
53763
  }),
53685
- /* @__PURE__ */ (0, B.jsx)(sK, {
53764
+ /* @__PURE__ */ (0, B.jsx)(lK, {
53686
53765
  open: o,
53687
53766
  onDismiss: c,
53688
53767
  section: e
@@ -53691,25 +53770,25 @@ var qG = () => {
53691
53770
  })
53692
53771
  ]
53693
53772
  });
53694
- }, lK = ({ section: e }) => {
53695
- let { isCollapsed: t } = qG(), n = !t(e.columnId), r = (0, y.useId)();
53773
+ }, dK = ({ section: e }) => {
53774
+ let { isCollapsed: t } = YG(), n = !t(e.columnId), r = (0, y.useId)();
53696
53775
  return /* @__PURE__ */ (0, B.jsxs)("div", {
53697
53776
  className: "updog__value-matching__section",
53698
- children: [/* @__PURE__ */ (0, B.jsx)(JG, {
53777
+ children: [/* @__PURE__ */ (0, B.jsx)(XG, {
53699
53778
  section: e,
53700
53779
  panelId: r
53701
53780
  }), /* @__PURE__ */ (0, B.jsx)("div", {
53702
53781
  id: r,
53703
53782
  inert: !n,
53704
53783
  className: G("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
53705
- children: /* @__PURE__ */ (0, B.jsx)(cK, { section: e })
53784
+ children: /* @__PURE__ */ (0, B.jsx)(uK, { section: e })
53706
53785
  })]
53707
53786
  });
53708
- }, uK = () => {
53709
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = qG();
53787
+ }, fK = () => {
53788
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = YG();
53710
53789
  return /* @__PURE__ */ (0, B.jsxs)("div", {
53711
53790
  className: "updog__value-matching",
53712
- children: [e.map((e) => /* @__PURE__ */ (0, B.jsx)(lK, { section: e }, e.columnId)), /* @__PURE__ */ (0, B.jsx)(Nx, {
53791
+ children: [e.map((e) => /* @__PURE__ */ (0, B.jsx)(dK, { section: e }, e.columnId)), /* @__PURE__ */ (0, B.jsx)(Nx, {
53713
53792
  open: t,
53714
53793
  existingOptions: n,
53715
53794
  initialName: r,
@@ -53717,13 +53796,13 @@ var qG = () => {
53717
53796
  onSubmit: i
53718
53797
  })]
53719
53798
  });
53720
- }, dK = () => /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)(Jy, { children: [/* @__PURE__ */ (0, B.jsx)("div", {
53799
+ }, pK = () => /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)(Jy, { children: [/* @__PURE__ */ (0, B.jsx)("div", {
53721
53800
  className: "updog__step-match-values__content updog__scrollbar",
53722
- children: /* @__PURE__ */ (0, B.jsx)(KG, { children: /* @__PURE__ */ (0, B.jsx)(uK, {}) })
53723
- }), /* @__PURE__ */ (0, B.jsx)(DV, {})] }) }), fK = 20, pK = (e, t) => {
53801
+ children: /* @__PURE__ */ (0, B.jsx)(JG, { children: /* @__PURE__ */ (0, B.jsx)(fK, {}) })
53802
+ }), /* @__PURE__ */ (0, B.jsx)(DV, {})] }) }), mK = 20, hK = (e, t) => {
53724
53803
  let n = /* @__PURE__ */ new Map(), r = (e) => {
53725
53804
  let t = n.get(e.id);
53726
- return t || (t = KH(e.rawRows, e.headers, e.dataStartIndex, fK), n.set(e.id, t)), t;
53805
+ return t || (t = KH(e.rawRows, e.headers, e.dataStartIndex, mK), n.set(e.id, t)), t;
53727
53806
  }, i = {};
53728
53807
  for (let [n, a] of Object.entries(t)) for (let t of a) {
53729
53808
  let a = e.find((e) => e.id === t.workbookId);
@@ -53735,7 +53814,7 @@ var qG = () => {
53735
53814
  }
53736
53815
  }
53737
53816
  return i;
53738
- }, mK = (e, t, n) => {
53817
+ }, gK = (e, t, n) => {
53739
53818
  let r = e.find((e) => n.every((n) => (t[n] ?? []).some((t) => t.workbookId === e.id)));
53740
53819
  if (!r) return [];
53741
53820
  let i = [];
@@ -53744,13 +53823,13 @@ var qG = () => {
53744
53823
  if (!n) return [];
53745
53824
  i.push(n.header);
53746
53825
  }
53747
- let a = KH(r.rawRows, r.headers, r.dataStartIndex, fK), o = [];
53826
+ let a = KH(r.rawRows, r.headers, r.dataStartIndex, mK), o = [];
53748
53827
  for (let e of a) {
53749
53828
  let t = i.map((t) => (e[t] ?? "").trim());
53750
53829
  t.some((e) => e === "") || o.push(Ed(t));
53751
53830
  }
53752
53831
  return o;
53753
- }, hK = ({ name: e, value: t, title: n, checked: r, onChange: i, autoFocus: a, className: o, children: s }) => {
53832
+ }, _K = ({ name: e, value: t, title: n, checked: r, onChange: i, autoFocus: a, className: o, children: s }) => {
53754
53833
  let c = (0, y.useId)(), l = (0, y.useId)(), u = (0, y.useCallback)((e) => {
53755
53834
  e.target.checked && i(t);
53756
53835
  }, [i, t]);
@@ -53789,15 +53868,15 @@ var qG = () => {
53789
53868
  children: s
53790
53869
  })]
53791
53870
  });
53792
- }, gK = () => {
53793
- let { columns: e } = Vy(), { t } = W(), n = dV(), r = SV(n, pV), { headersByColumn: i } = SV(n, mV), { selected: a, eligibleColumns: o, composite: s } = SV(n, gV), c = (0, y.useMemo)(() => pK(r, i), [r, i]), l = (0, y.useMemo)(() => {
53871
+ }, vK = () => {
53872
+ let { columns: e } = Vy(), { t } = W(), n = dV(), r = SV(n, pV), { headersByColumn: i } = SV(n, mV), { selected: a, eligibleColumns: o, composite: s } = SV(n, gV), c = (0, y.useMemo)(() => hK(r, i), [r, i]), l = (0, y.useMemo)(() => {
53794
53873
  let t = [];
53795
53874
  if (s) {
53796
53875
  let n = s.map((t) => e.find((e) => e.id === t)?.title ?? t);
53797
53876
  t.push({
53798
53877
  value: Ed(s),
53799
53878
  title: Ed(n),
53800
- values: mK(r, i, s)
53879
+ values: gK(r, i, s)
53801
53880
  });
53802
53881
  }
53803
53882
  for (let e of o) t.push({
@@ -53822,7 +53901,7 @@ var qG = () => {
53822
53901
  }, [l, d]);
53823
53902
  return /* @__PURE__ */ (0, B.jsxs)("div", {
53824
53903
  className: "updog__primary-key-selection updog__scrollbar",
53825
- children: [/* @__PURE__ */ (0, B.jsx)(hK, {
53904
+ children: [/* @__PURE__ */ (0, B.jsx)(_K, {
53826
53905
  name: "primaryKey",
53827
53906
  value: "",
53828
53907
  title: t("dataEditor.uploader.addOrUpdate.addEvery"),
@@ -53835,7 +53914,7 @@ var qG = () => {
53835
53914
  className: "updog__primary-key-selection__hint",
53836
53915
  children: t("dataEditor.uploader.addOrUpdate.addEveryHint")
53837
53916
  })
53838
- }), l.map((e) => /* @__PURE__ */ (0, B.jsx)(hK, {
53917
+ }), l.map((e) => /* @__PURE__ */ (0, B.jsx)(_K, {
53839
53918
  name: "primaryKey",
53840
53919
  value: e.value,
53841
53920
  title: t("dataEditor.uploader.addOrUpdate.updateBy", { column: e.title }),
@@ -53853,10 +53932,10 @@ var qG = () => {
53853
53932
  }, t))
53854
53933
  }, e.value))]
53855
53934
  });
53856
- }, _K = () => /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)(Jy, { children: [/* @__PURE__ */ (0, B.jsx)(gK, {}), /* @__PURE__ */ (0, B.jsx)(DV, {})] }) });
53935
+ }, yK = () => /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)(Jy, { children: [/* @__PURE__ */ (0, B.jsx)(vK, {}), /* @__PURE__ */ (0, B.jsx)(DV, {})] }) });
53857
53936
  //#endregion
53858
53937
  //#region src/components/DataUploader/hooks/useRemoteSource.ts
53859
- function vK(e) {
53938
+ function bK(e) {
53860
53939
  let { t } = W(), { loadingId: n, error: r } = SV(e, yV), i = wV(), a = (0, y.useCallback)((t) => {
53861
53940
  e.loadRemoteSource(t).then(i);
53862
53941
  }, [e, i]);
@@ -53868,8 +53947,8 @@ function vK(e) {
53868
53947
  }
53869
53948
  //#endregion
53870
53949
  //#region src/components/DataUploader/components/StepSelectFiles/context/useViewModel.tsx
53871
- var yK = () => {
53872
- let { columns: e, importFormats: t, remoteSources: n, customFormats: r, sampleData: i } = Vy(), a = t === !1 ? [] : t, { t: o } = W(), s = dV(), { stagedItems: c } = SV(s, fV), { remoteSourceLoading: l, remoteSourceError: u, handleRemoteSourceSelect: d } = vK(s), f = TV(s), p = (0, y.useCallback)((e) => {
53950
+ var xK = () => {
53951
+ let { columns: e, importFormats: t, remoteSources: n, customFormats: r, sampleData: i } = Vy(), a = t === !1 ? [] : t, { t: o } = W(), s = dV(), { stagedItems: c } = SV(s, fV), { remoteSourceLoading: l, remoteSourceError: u, handleRemoteSourceSelect: d } = bK(s), f = TV(s), p = (0, y.useCallback)((e) => {
53873
53952
  s.toggleStagedItem(e);
53874
53953
  }, [s]), m = (0, y.useCallback)((e) => {
53875
53954
  s.cancelStagedItem(e);
@@ -53930,19 +54009,19 @@ var yK = () => {
53930
54009
  onExampleDownload: _,
53931
54010
  handleRemoteSourceSelect: d
53932
54011
  };
53933
- }, bK = (0, y.createContext)(null);
53934
- function xK({ children: e }) {
53935
- let t = yK();
53936
- return /* @__PURE__ */ (0, B.jsx)(bK.Provider, {
54012
+ }, SK = (0, y.createContext)(null);
54013
+ function CK({ children: e }) {
54014
+ let t = xK();
54015
+ return /* @__PURE__ */ (0, B.jsx)(SK.Provider, {
53937
54016
  value: t,
53938
54017
  children: e
53939
54018
  });
53940
54019
  }
53941
- var SK = () => {
53942
- let e = (0, y.useContext)(bK);
54020
+ var wK = () => {
54021
+ let e = (0, y.useContext)(SK);
53943
54022
  if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
53944
54023
  return e;
53945
- }, CK = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, B.jsx)("span", {
54024
+ }, TK = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, B.jsx)("span", {
53946
54025
  className: "updog__remote-source-btn__icon",
53947
54026
  dangerouslySetInnerHTML: { __html: e.icon }
53948
54027
  }) : /* @__PURE__ */ (0, B.jsx)("span", {
@@ -53951,7 +54030,7 @@ var SK = () => {
53951
54030
  src: e.icon,
53952
54031
  alt: e.label
53953
54032
  })
53954
- }), wK = ({ source: e, loading: t, disabled: n, onSelect: r }) => {
54033
+ }), EK = ({ source: e, loading: t, disabled: n, onSelect: r }) => {
53955
54034
  let i = (0, y.useCallback)((t) => {
53956
54035
  t.stopPropagation(), r(e);
53957
54036
  }, [r, e]);
@@ -53963,12 +54042,12 @@ var SK = () => {
53963
54042
  disabled: !t && n,
53964
54043
  loading: t,
53965
54044
  spinnerPosition: "start",
53966
- startIcon: /* @__PURE__ */ (0, B.jsx)(CK, { source: e }),
54045
+ startIcon: /* @__PURE__ */ (0, B.jsx)(TK, { source: e }),
53967
54046
  title: e.description,
53968
54047
  children: e.label
53969
54048
  });
53970
- }, TK = () => {
53971
- let { t: e } = W(), { importFormats: t, customFormats: n, remoteSources: r, remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = SK(), s = r.length > 0;
54049
+ }, DK = () => {
54050
+ let { t: e } = W(), { importFormats: t, customFormats: n, remoteSources: r, remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = wK(), s = r.length > 0;
53972
54051
  return /* @__PURE__ */ (0, B.jsxs)("div", {
53973
54052
  className: "updog__source-picker",
53974
54053
  children: [
@@ -53995,7 +54074,7 @@ var SK = () => {
53995
54074
  }),
53996
54075
  s && /* @__PURE__ */ (0, B.jsxs)(B.Fragment, { children: [/* @__PURE__ */ (0, B.jsx)(Qc, {}), /* @__PURE__ */ (0, B.jsx)("div", {
53997
54076
  className: "updog__source-picker__sources-list",
53998
- children: r.map((e) => /* @__PURE__ */ (0, B.jsx)(wK, {
54077
+ children: r.map((e) => /* @__PURE__ */ (0, B.jsx)(EK, {
53999
54078
  source: e,
54000
54079
  loading: i === e.id,
54001
54080
  disabled: !!i,
@@ -54009,18 +54088,18 @@ var SK = () => {
54009
54088
  })
54010
54089
  ]
54011
54090
  });
54012
- }, EK = () => /* @__PURE__ */ (0, B.jsxs)(B.Fragment, { children: [/* @__PURE__ */ (0, B.jsx)("div", {
54091
+ }, OK = () => /* @__PURE__ */ (0, B.jsxs)(B.Fragment, { children: [/* @__PURE__ */ (0, B.jsx)("div", {
54013
54092
  className: "updog__upload-prompt__icon-container",
54014
54093
  children: /* @__PURE__ */ (0, B.jsx)(nt, {
54015
54094
  size: "1rem",
54016
54095
  className: "updog__upload-prompt__icon"
54017
54096
  })
54018
- }), /* @__PURE__ */ (0, B.jsx)(TK, {})] }), DK = ({ onClick: e }) => /* @__PURE__ */ (0, B.jsx)("div", {
54097
+ }), /* @__PURE__ */ (0, B.jsx)(DK, {})] }), kK = ({ onClick: e }) => /* @__PURE__ */ (0, B.jsx)("div", {
54019
54098
  className: "updog__add-files-card",
54020
54099
  onClick: e,
54021
- children: /* @__PURE__ */ (0, B.jsx)(EK, {})
54022
- }), OK = () => {
54023
- let { t: e } = W(), { exampleMenuOptions: t, onExampleDownload: n } = SK();
54100
+ children: /* @__PURE__ */ (0, B.jsx)(OK, {})
54101
+ }), AK = () => {
54102
+ let { t: e } = W(), { exampleMenuOptions: t, onExampleDownload: n } = wK();
54024
54103
  return /* @__PURE__ */ (0, B.jsx)(dl, {
54025
54104
  options: t,
54026
54105
  onSelect: n,
@@ -54032,8 +54111,8 @@ var SK = () => {
54032
54111
  children: e("dataEditor.uploader.uploadFile.downloadExample")
54033
54112
  })
54034
54113
  });
54035
- }, kK = () => {
54036
- let { t: e } = W(), { reset: t } = SK();
54114
+ }, jK = () => {
54115
+ let { t: e } = W(), { reset: t } = wK();
54037
54116
  return /* @__PURE__ */ (0, B.jsx)(vt, {
54038
54117
  variant: "outlined",
54039
54118
  color: "neutral",
@@ -54041,7 +54120,7 @@ var SK = () => {
54041
54120
  onClick: t,
54042
54121
  children: e("dataEditor.uploader.uploadFile.reset")
54043
54122
  });
54044
- }, AK = ({ item: e, onToggle: t, onCancel: n }) => {
54123
+ }, MK = ({ item: e, onToggle: t, onCancel: n }) => {
54045
54124
  let { t: r } = W(), i = e.status === "ready", a = e.status === "ready" && e.selected, o = e.status === "ready" ? Math.max(0, e.preview.totalRows) : 0, s = (0, y.useCallback)(() => {
54046
54125
  t(e.id);
54047
54126
  }, [t, e.id]), c = (0, y.useCallback)((t) => {
@@ -54106,15 +54185,15 @@ var SK = () => {
54106
54185
  })]
54107
54186
  })
54108
54187
  });
54109
- }, jK = () => {
54110
- let { isBlocked: e, open: t } = SK();
54188
+ }, NK = () => {
54189
+ let { isBlocked: e, open: t } = wK();
54111
54190
  return /* @__PURE__ */ (0, B.jsx)("div", {
54112
54191
  className: G("updog__step-select-files__upload-area", e && "updog__step-select-files__upload-area--disabled"),
54113
54192
  onClick: e ? void 0 : t,
54114
- children: /* @__PURE__ */ (0, B.jsx)(EK, {})
54193
+ children: /* @__PURE__ */ (0, B.jsx)(OK, {})
54115
54194
  });
54116
- }, MK = () => {
54117
- let { t: e } = W(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o, cancelItem: s } = SK(), c = a.length > 0;
54195
+ }, PK = () => {
54196
+ let { t: e } = W(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o, cancelItem: s } = wK(), c = a.length > 0;
54118
54197
  return /* @__PURE__ */ (0, B.jsx)(Xy, { children: /* @__PURE__ */ (0, B.jsxs)("div", {
54119
54198
  className: "updog__step-select-files__dropzone",
54120
54199
  ...t(),
@@ -54124,20 +54203,20 @@ var SK = () => {
54124
54203
  className: "updog__sheet-preview-wrapper updog__scrollbar",
54125
54204
  children: /* @__PURE__ */ (0, B.jsxs)("div", {
54126
54205
  className: "updog__sheet-preview-grid",
54127
- children: [a.map((e) => /* @__PURE__ */ (0, B.jsx)(AK, {
54206
+ children: [a.map((e) => /* @__PURE__ */ (0, B.jsx)(MK, {
54128
54207
  item: e,
54129
54208
  onToggle: o,
54130
54209
  onCancel: s
54131
- }, e.id)), /* @__PURE__ */ (0, B.jsx)(DK, { onClick: i })]
54210
+ }, e.id)), /* @__PURE__ */ (0, B.jsx)(kK, { onClick: i })]
54132
54211
  })
54133
- }) : /* @__PURE__ */ (0, B.jsx)(jK, {}), /* @__PURE__ */ (0, B.jsx)(DV, { leftSlot: c ? /* @__PURE__ */ (0, B.jsx)(kK, {}) : /* @__PURE__ */ (0, B.jsx)(OK, {}) })] }),
54212
+ }) : /* @__PURE__ */ (0, B.jsx)(NK, {}), /* @__PURE__ */ (0, B.jsx)(DV, { leftSlot: c ? /* @__PURE__ */ (0, B.jsx)(jK, {}) : /* @__PURE__ */ (0, B.jsx)(AK, {}) })] }),
54134
54213
  r && /* @__PURE__ */ (0, B.jsx)(Yy, {})
54135
54214
  ]
54136
54215
  }) });
54137
- }, NK = () => /* @__PURE__ */ (0, B.jsx)(xK, { children: /* @__PURE__ */ (0, B.jsx)(MK, {}) });
54216
+ }, FK = () => /* @__PURE__ */ (0, B.jsx)(CK, { children: /* @__PURE__ */ (0, B.jsx)(PK, {}) });
54138
54217
  //#endregion
54139
54218
  //#region src/components/DataUploader/hooks/useUploadFlow.ts
54140
- function PK(e) {
54219
+ function IK(e) {
54141
54220
  let t = (0, y.useRef)(null);
54142
54221
  t.current === null && (t.current = e());
54143
54222
  let n = t.current;
@@ -54145,70 +54224,72 @@ function PK(e) {
54145
54224
  }
54146
54225
  //#endregion
54147
54226
  //#region src/components/DataUploader/context/index.tsx
54148
- function FK({ children: e }) {
54149
- let { store: t, validator: n, columns: r, primaryKey: i, pendingImportFiles: a, setPendingImportFiles: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, customFormats: d, onUnstructuredFile: f } = Vy(), { t: p } = W(), m = (0, y.useCallback)((e, t) => t ? p("dataEditor.uploader.matchColumns.syntheticColumnValue", {
54227
+ function LK({ children: e }) {
54228
+ let { store: t, validator: n, columns: r, primaryKey: i, pendingImportFiles: a, setPendingImportFiles: o, onColumnMatch: s, onValueMatch: c, onRowImport: l, context: u, synonyms: d, addDynamicColumns: f, customFormats: p, onUnstructuredFile: m } = Vy(), { t: h } = W(), g = (0, y.useCallback)((e, t) => t ? h("dataEditor.uploader.matchColumns.syntheticColumnValue", {
54150
54229
  index: e + 1,
54151
54230
  value: t
54152
- }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), h = PK(() => new pG({
54231
+ }) : h("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [h]), _ = IK(() => new hG({
54153
54232
  store: t,
54154
54233
  validator: n,
54155
54234
  columns: r,
54156
54235
  defaultPrimaryKey: i ? wd(i) : null,
54157
54236
  onColumnMatch: s,
54158
54237
  onValueMatch: c,
54159
- extraSynonyms: MV(l),
54160
- addDynamicColumns: u,
54161
- synthesizeHeader: m,
54162
- customFormats: d ?? [],
54163
- onUnstructuredFile: f,
54238
+ onRowImport: l,
54239
+ context: u,
54240
+ extraSynonyms: MV(d),
54241
+ addDynamicColumns: f,
54242
+ synthesizeHeader: g,
54243
+ customFormats: p ?? [],
54244
+ onUnstructuredFile: m,
54164
54245
  hasExistingData: t.getLocalRowCount() > 0,
54165
54246
  createParseClient: () => new bx()
54166
- })), g = (0, y.useRef)(!0);
54247
+ })), v = (0, y.useRef)(!0);
54167
54248
  (0, y.useEffect)(() => {
54168
- if (g.current) {
54169
- g.current = !1;
54249
+ if (v.current) {
54250
+ v.current = !1;
54170
54251
  return;
54171
54252
  }
54172
- h.setSynthesizeHeader(m);
54173
- }, [h, m]);
54174
- let _ = TV(h);
54253
+ _.setSynthesizeHeader(g);
54254
+ }, [_, g]);
54255
+ let b = TV(_);
54175
54256
  return (0, y.useEffect)(() => {
54176
54257
  if (a.length > 0) {
54177
- for (let e of a) _(e);
54258
+ for (let e of a) b(e);
54178
54259
  o([]);
54179
54260
  }
54180
54261
  }, [
54181
54262
  a,
54182
54263
  o,
54183
- _
54264
+ b
54184
54265
  ]), /* @__PURE__ */ (0, B.jsx)(uV.Provider, {
54185
- value: h,
54266
+ value: _,
54186
54267
  children: e
54187
54268
  });
54188
54269
  }
54189
54270
  //#endregion
54190
54271
  //#region src/components/DataUploader/index.tsx
54191
- var IK = () => {
54272
+ var RK = () => {
54192
54273
  let { stepIds: e, activeStepIndex: t, headerReview: n, columnMatching: r } = SV(dV(), _V), i = cV(), { t: a } = W(), o = (0, y.useMemo)(() => ({
54193
54274
  "select-files": {
54194
54275
  title: a("dataEditor.uploader.steps.selectFiles"),
54195
- content: /* @__PURE__ */ (0, B.jsx)(NK, {})
54276
+ content: /* @__PURE__ */ (0, B.jsx)(FK, {})
54196
54277
  },
54197
54278
  "header-selection": {
54198
54279
  title: a("dataEditor.uploader.steps.headerSelection"),
54199
- content: /* @__PURE__ */ (0, B.jsx)(RG, {})
54280
+ content: /* @__PURE__ */ (0, B.jsx)(BG, {})
54200
54281
  },
54201
54282
  "column-matching": {
54202
54283
  title: a("dataEditor.uploader.steps.matchColumns"),
54203
- content: /* @__PURE__ */ (0, B.jsx)(MG, {})
54284
+ content: /* @__PURE__ */ (0, B.jsx)(PG, {})
54204
54285
  },
54205
54286
  "match-values": {
54206
54287
  title: a("dataEditor.uploader.steps.matchValues"),
54207
- content: /* @__PURE__ */ (0, B.jsx)(dK, {})
54288
+ content: /* @__PURE__ */ (0, B.jsx)(pK, {})
54208
54289
  },
54209
54290
  "primary-key": {
54210
54291
  title: a("dataEditor.uploader.steps.addOrUpdate"),
54211
- content: /* @__PURE__ */ (0, B.jsx)(_K, {})
54292
+ content: /* @__PURE__ */ (0, B.jsx)(yK, {})
54212
54293
  }
54213
54294
  }), [a]), s = e[t], c = s ? o[s] : void 0, l = s === "header-selection" && n && n.total > 1 ? a("dataEditor.uploader.steps.headerSelectionOf", {
54214
54295
  current: n.position + 1,
@@ -54226,82 +54307,82 @@ var IK = () => {
54226
54307
  children: c?.content
54227
54308
  })]
54228
54309
  });
54229
- }, LK = () => /* @__PURE__ */ (0, B.jsx)(FK, { children: /* @__PURE__ */ (0, B.jsxs)("div", {
54310
+ }, zK = () => /* @__PURE__ */ (0, B.jsx)(LK, { children: /* @__PURE__ */ (0, B.jsxs)("div", {
54230
54311
  className: "updog__data-uploader",
54231
- children: [/* @__PURE__ */ (0, B.jsx)(IK, {}), /* @__PURE__ */ (0, B.jsx)(ob, {})]
54232
- }) }), RK = {
54312
+ children: [/* @__PURE__ */ (0, B.jsx)(RK, {}), /* @__PURE__ */ (0, B.jsx)(ob, {})]
54313
+ }) }), BK = {
54233
54314
  kty: "EC",
54234
54315
  crv: "P-256",
54235
54316
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
54236
54317
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
54237
- }, zK = "updog_license_grant", BK = /* @__PURE__ */ new Set([
54318
+ }, VK = "updog_license_grant", HK = /* @__PURE__ */ new Set([
54238
54319
  "updog.tech",
54239
54320
  "landing.updog.tech",
54240
54321
  "demo.updog.tech"
54241
54322
  ]);
54242
- function VK() {
54243
- return BK.has(window.location.hostname);
54323
+ function UK() {
54324
+ return HK.has(window.location.hostname);
54244
54325
  }
54245
- function HK() {
54326
+ function WK() {
54246
54327
  return !1;
54247
54328
  }
54248
- function UK() {
54329
+ function GK() {
54249
54330
  return "https://api.updog.tech";
54250
54331
  }
54251
- function WK(e) {
54332
+ function KK(e) {
54252
54333
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
54253
54334
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
54254
54335
  return i;
54255
54336
  }
54256
- async function GK(e) {
54337
+ async function qK(e) {
54257
54338
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
54258
54339
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
54259
54340
  }
54260
- var KK = null;
54261
- async function qK() {
54262
- return KK || (KK = await crypto.subtle.importKey("jwk", RK, {
54341
+ var JK = null;
54342
+ async function YK() {
54343
+ return JK || (JK = await crypto.subtle.importKey("jwk", BK, {
54263
54344
  name: "ECDSA",
54264
54345
  namedCurve: "P-256"
54265
- }, !1, ["verify"]), KK);
54346
+ }, !1, ["verify"]), JK);
54266
54347
  }
54267
- function JK() {
54348
+ function XK() {
54268
54349
  try {
54269
- return localStorage.getItem(zK);
54350
+ return localStorage.getItem(VK);
54270
54351
  } catch {
54271
54352
  return null;
54272
54353
  }
54273
54354
  }
54274
- function YK(e) {
54355
+ function ZK(e) {
54275
54356
  try {
54276
- localStorage.setItem(zK, e);
54357
+ localStorage.setItem(VK, e);
54277
54358
  } catch {}
54278
54359
  }
54279
- function XK() {
54360
+ function QK() {
54280
54361
  try {
54281
- localStorage.removeItem(zK);
54362
+ localStorage.removeItem(VK);
54282
54363
  } catch {}
54283
54364
  }
54284
- async function ZK(e, t, n) {
54365
+ async function $K(e, t, n) {
54285
54366
  let r = e.indexOf(".");
54286
54367
  if (r === -1) return !1;
54287
- let i = e.slice(0, r), a = e.slice(r + 1), o = WK(i), s = WK(a), c = await qK();
54368
+ let i = e.slice(0, r), a = e.slice(r + 1), o = KK(i), s = KK(a), c = await YK();
54288
54369
  if (!await crypto.subtle.verify({
54289
54370
  name: "ECDSA",
54290
54371
  hash: "SHA-256"
54291
54372
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
54292
54373
  let l = JSON.parse(new TextDecoder().decode(o));
54293
54374
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
54294
- let u = await GK(t);
54375
+ let u = await qK(t);
54295
54376
  return l.key === u && l.domain === n;
54296
54377
  }
54297
- async function QK(e) {
54298
- let t = JK();
54378
+ async function eq(e) {
54379
+ let t = XK();
54299
54380
  if (!t) return {
54300
54381
  valid: !1,
54301
54382
  errorCode: "license.invalid"
54302
54383
  };
54303
54384
  try {
54304
- if (await ZK(t, e, window.location.hostname.toLowerCase().trim())) return {
54385
+ if (await $K(t, e, window.location.hostname.toLowerCase().trim())) return {
54305
54386
  valid: !0,
54306
54387
  errorCode: null
54307
54388
  };
@@ -54311,23 +54392,23 @@ async function QK(e) {
54311
54392
  errorCode: "license.invalid"
54312
54393
  };
54313
54394
  }
54314
- async function $K(e, t = !0) {
54315
- if (VK() || HK()) return {
54395
+ async function tq(e, t = !0) {
54396
+ if (UK() || WK()) return {
54316
54397
  valid: !0,
54317
54398
  errorCode: null
54318
54399
  };
54319
- let n = UK();
54400
+ let n = GK();
54320
54401
  try {
54321
54402
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
54322
54403
  if (r.ok) {
54323
54404
  let e = await r.json();
54324
- return t && e.grant && YK(e.grant), {
54405
+ return t && e.grant && ZK(e.grant), {
54325
54406
  valid: !0,
54326
54407
  errorCode: null
54327
54408
  };
54328
54409
  }
54329
54410
  if (r.status >= 400 && r.status < 500) {
54330
- t && XK();
54411
+ t && QK();
54331
54412
  try {
54332
54413
  return await r.json();
54333
54414
  } catch {
@@ -54339,7 +54420,7 @@ async function $K(e, t = !0) {
54339
54420
  }
54340
54421
  throw Error(`Server error: ${r.status}`);
54341
54422
  } catch {
54342
- return t ? QK(e) : {
54423
+ return t ? eq(e) : {
54343
54424
  valid: !1,
54344
54425
  errorCode: "license.invalid"
54345
54426
  };
@@ -54347,7 +54428,7 @@ async function $K(e, t = !0) {
54347
54428
  }
54348
54429
  //#endregion
54349
54430
  //#region src/hooks/useLicenseValidation.ts
54350
- function eq(e, t, n = !0) {
54431
+ function nq(e, t, n = !0) {
54351
54432
  let [r, i] = (0, y.useState)({
54352
54433
  isValidating: t,
54353
54434
  isValid: !1,
@@ -54367,7 +54448,7 @@ function eq(e, t, n = !0) {
54367
54448
  isValidating: !0,
54368
54449
  isValid: !1,
54369
54450
  errorCode: null
54370
- }), $K(e, n).then((e) => {
54451
+ }), tq(e, n).then((e) => {
54371
54452
  r || i({
54372
54453
  isValidating: !1,
54373
54454
  isValid: e.valid,
@@ -54390,22 +54471,22 @@ function eq(e, t, n = !0) {
54390
54471
  }
54391
54472
  //#endregion
54392
54473
  //#region src/index.tsx
54393
- function tq(e) {
54474
+ function rq(e) {
54394
54475
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
54395
54476
  }
54396
- function nq(e) {
54477
+ function iq(e) {
54397
54478
  let t = (0, y.useMemo)(() => new xd(e.onError), [e.onError]);
54398
54479
  return /* @__PURE__ */ (0, B.jsx)(aV, {
54399
54480
  errorHandler: t,
54400
54481
  children: /* @__PURE__ */ (0, B.jsx)(By, {
54401
54482
  ...e,
54402
54483
  errorHandler: t,
54403
- children: e.showUploader ? /* @__PURE__ */ (0, B.jsx)(LK, {}) : /* @__PURE__ */ (0, B.jsx)(tV, {})
54484
+ children: e.showUploader ? /* @__PURE__ */ (0, B.jsx)(zK, {}) : /* @__PURE__ */ (0, B.jsx)(tV, {})
54404
54485
  })
54405
54486
  });
54406
54487
  }
54407
- function rq(e) {
54408
- let t = e.mode ?? "modal", { t: n, rtl: r } = W(), i = r ? "rtl" : "ltr", a = tq(e.localStorage), o = t !== "modal" || e.open, { isValidating: s, isValid: c, errorCode: l } = eq(e.apiKey, t !== "modal" || o, a.licenseGrant), [u, d] = (0, y.useState)(e.variant === "uploader"), f = (0, y.useRef)(null), { value: p, setTrue: m, setFalse: h } = Ql(!1), g = t === "modal" ? e.onClose : void 0, _ = (0, y.useCallback)(() => {
54488
+ function aq(e) {
54489
+ let t = e.mode ?? "modal", { t: n, rtl: r } = W(), i = r ? "rtl" : "ltr", a = rq(e.localStorage), o = t !== "modal" || e.open, { isValidating: s, isValid: c, errorCode: l } = nq(e.apiKey, t !== "modal" || o, a.licenseGrant), [u, d] = (0, y.useState)(e.variant === "uploader"), f = (0, y.useRef)(null), { value: p, setTrue: m, setFalse: h } = Ql(!1), g = t === "modal" ? e.onClose : void 0, _ = (0, y.useCallback)(() => {
54409
54490
  let t = f.current?.getSnapshot();
54410
54491
  t && (t.dirtyRowCount > 0 || t.deletedRowCount > 0) && !e.readonly ? m() : g?.();
54411
54492
  }, [
@@ -54421,33 +54502,10 @@ function rq(e) {
54421
54502
  t
54422
54503
  ]);
54423
54504
  let w = {
54424
- columns: e.columns,
54425
- primaryKey: e.primaryKey,
54426
- loadData: e.loadData,
54427
- onComplete: e.onComplete,
54428
- variant: e.variant,
54505
+ ...e,
54429
54506
  showUploader: u,
54430
54507
  setShowUploader: d,
54431
- storeRef: f,
54432
- enableDeleteRow: e.enableDeleteRow,
54433
- enableAddRow: e.enableAddRow,
54434
- enableAddSource: e.enableAddSource,
54435
- blockSubmitOnError: e.blockSubmitOnError,
54436
- importFormats: e.importFormats,
54437
- exportFormats: e.exportFormats,
54438
- readonly: e.readonly,
54439
- rowHeight: e.rowHeight,
54440
- headerHeight: e.headerHeight,
54441
- enableCreateColumn: e.enableCreateColumn,
54442
- onColumnMatch: e.onColumnMatch,
54443
- onValueMatch: e.onValueMatch,
54444
- synonyms: e.synonyms,
54445
- sampleData: e.sampleData,
54446
- chat: e.chat,
54447
- remoteSources: e.remoteSources,
54448
- customFormats: e.customFormats,
54449
- onUnstructuredFile: e.onUnstructuredFile,
54450
- onError: e.onError
54508
+ storeRef: f
54451
54509
  }, T = (e) => /* @__PURE__ */ (0, B.jsxs)("div", {
54452
54510
  className: "updog__license-validation__loading",
54453
54511
  children: [/* @__PURE__ */ (0, B.jsx)(dt, { size: "lg" }), /* @__PURE__ */ (0, B.jsx)(q, { children: e })]
@@ -54455,7 +54513,7 @@ function rq(e) {
54455
54513
  code: e,
54456
54514
  message: "License validation failed",
54457
54515
  source: "license"
54458
- } }), D = () => s ? T(n("dataEditor.license.loading")) : c ? /* @__PURE__ */ (0, B.jsx)(nq, { ...w }) : E(l ?? "license.invalid");
54516
+ } }), D = () => s ? T(n("dataEditor.license.loading")) : c ? /* @__PURE__ */ (0, B.jsx)(iq, { ...w }) : E(l ?? "license.invalid");
54459
54517
  return t === "inline" ? /* @__PURE__ */ (0, B.jsx)("div", {
54460
54518
  className: "updog__data-editor updog__data-editor-inline",
54461
54519
  dir: i,
@@ -54478,18 +54536,18 @@ function rq(e) {
54478
54536
  })
54479
54537
  });
54480
54538
  }
54481
- function iq(e) {
54539
+ function oq(e) {
54482
54540
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
54483
54541
  return /* @__PURE__ */ (0, B.jsx)(U, {
54484
54542
  translations: t,
54485
54543
  rtl: n,
54486
54544
  locale: r,
54487
- children: /* @__PURE__ */ (0, B.jsx)(rq, { ...a })
54545
+ children: /* @__PURE__ */ (0, B.jsx)(aq, { ...a })
54488
54546
  });
54489
54547
  }
54490
54548
  //#endregion
54491
54549
  //#region src/wc.ts
54492
- var aq = {
54550
+ var sq = {
54493
54551
  "api-key": {
54494
54552
  prop: "apiKey",
54495
54553
  type: "string"
@@ -54522,12 +54580,12 @@ var aq = {
54522
54580
  prop: "mode",
54523
54581
  type: "string"
54524
54582
  }
54525
- }, oq = new Set(Object.values(aq).filter((e) => e.type === "boolean").map((e) => e.prop)), sq = (e, t) => oq.has(e) && t === "" ? !0 : t, cq = class extends HTMLElement {
54583
+ }, cq = new Set(Object.values(sq).filter((e) => e.type === "boolean").map((e) => e.prop)), lq = (e, t) => cq.has(e) && t === "" ? !0 : t, uq = class extends HTMLElement {
54526
54584
  _root = null;
54527
54585
  _props = {};
54528
54586
  _renderScheduled = !1;
54529
54587
  static get observedAttributes() {
54530
- return Object.keys(aq);
54588
+ return Object.keys(sq);
54531
54589
  }
54532
54590
  connectedCallback() {
54533
54591
  this._root = (0, b.createRoot)(this), this._props.mode !== "inline" && (this._props.onClose = () => {
@@ -54538,7 +54596,7 @@ var aq = {
54538
54596
  this._root?.unmount(), this._root = null;
54539
54597
  }
54540
54598
  attributeChangedCallback(e, t, n) {
54541
- let r = aq[e];
54599
+ let r = sq[e];
54542
54600
  r && (this._props[r.prop] = r.type === "boolean" ? n !== null : n, e === "mode" && (n === "inline" ? delete this._props.onClose : this._props.onClose = () => {
54543
54601
  this.dispatchEvent(new CustomEvent("close", { bubbles: !0 }));
54544
54602
  }), this._scheduleRender());
@@ -54555,28 +54613,28 @@ var aq = {
54555
54613
  }
54556
54614
  _scheduleRender() {
54557
54615
  this._renderScheduled || (this._renderScheduled = !0, queueMicrotask(() => {
54558
- this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(iq, this._props));
54616
+ this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(oq, this._props));
54559
54617
  }));
54560
54618
  }
54561
54619
  };
54562
- for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.onComplete.translations.importFormats.exportFormats.remoteSources.customFormats.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(cq.prototype, e, {
54620
+ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.onComplete.translations.importFormats.exportFormats.remoteSources.customFormats.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.onRowImport.context.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(uq.prototype, e, {
54563
54621
  get() {
54564
54622
  return this._props[e];
54565
54623
  },
54566
54624
  set(t) {
54567
- this._props[e] = sq(e, t), this._scheduleRender();
54625
+ this._props[e] = lq(e, t), this._scheduleRender();
54568
54626
  },
54569
54627
  enumerable: !0,
54570
54628
  configurable: !0
54571
54629
  });
54572
- Object.defineProperty(cq.prototype, "open", {
54630
+ Object.defineProperty(uq.prototype, "open", {
54573
54631
  get() {
54574
54632
  return this.hasAttribute("open");
54575
54633
  },
54576
54634
  set(e) {
54577
- sq("open", e) ? this.setAttribute("open", "") : this.removeAttribute("open");
54635
+ lq("open", e) ? this.setAttribute("open", "") : this.removeAttribute("open");
54578
54636
  },
54579
54637
  enumerable: !0,
54580
54638
  configurable: !0
54581
- }), customElements.define("updog-editor", cq);
54639
+ }), customElements.define("updog-editor", uq);
54582
54640
  //#endregion