@updog/data-editor 0.1.51 → 0.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.css +1 -1
  2. package/index.js +319 -323
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -13117,7 +13117,7 @@ function ff(e, t, n) {
13117
13117
  //#endregion
13118
13118
  //#region src/components/PreviewTable/index.tsx
13119
13119
  var pf = 15, mf = { width: 1 }, hf = { height: 1 }, gf = ({ headers: e, rows: t, lockedColumns: n, displayRows: r = pf, blur: i = !0, scrollbars: a = !0, selectedRow: o, onSelectRow: s, className: c }) => {
13120
- let l = e.length, u = Array.from({ length: r }, (e, n) => t[n]), d = a === !0, p = a === !0 || a === "empty", h = y(null), g = y(null), _ = y(null), x = y(null), T = y(null), D = y(null), [O, k] = b(!1), [A, j] = b(!1);
13120
+ let l = e ? e.length : Math.max(0, ...t.map((e) => e?.length ?? 0)), u = Array.from({ length: r }, (e, n) => t[n]), d = a === !0, p = a === !0 || a === "empty", h = y(null), g = y(null), _ = y(null), x = y(null), T = y(null), D = y(null), [O, k] = b(!1), [A, j] = b(!1);
13121
13121
  m(() => {
13122
13122
  if (!d) return;
13123
13123
  let e = h.current, t = _.current, n = x.current, r = T.current, i = D.current;
@@ -13157,38 +13157,34 @@ var pf = 15, mf = { width: 1 }, hf = { height: 1 }, gf = ({ headers: e, rows: t,
13157
13157
  className: "updog__preview-table__grid",
13158
13158
  style: P,
13159
13159
  ref: g,
13160
- children: [
13161
- /* @__PURE__ */ C("div", { className: "updog__preview-table-marker" }),
13162
- l === 0 ? /* @__PURE__ */ C("div", { className: E("updog__preview-table-th", "updog__preview-table-cell--last-col") }) : e.map((e, t) => /* @__PURE__ */ w("div", {
13163
- className: E("updog__preview-table-th", t === l - 1 && "updog__preview-table-cell--last-col"),
13164
- children: [/* @__PURE__ */ C("span", {
13165
- className: "updog__preview-table-th__label",
13166
- children: e
13167
- }), n?.[t] && /* @__PURE__ */ C(ge, {
13168
- size: "0.875rem",
13169
- className: "updog__preview-table-th__lock-icon"
13170
- })]
13171
- }, t)),
13172
- u.map((t, n) => {
13173
- let i = n === r - 1, a = !!s && t !== void 0, c = o === n;
13174
- return /* @__PURE__ */ w("div", {
13175
- className: E("updog__preview-table-row", a && "updog__preview-table-row--interactive", c && "updog__preview-table-row--selected"),
13176
- "data-row-index": n,
13177
- role: a ? "row" : void 0,
13178
- tabIndex: a ? 0 : void 0,
13179
- "aria-selected": a ? c : void 0,
13180
- onClick: a ? M : void 0,
13181
- onKeyDown: a ? N : void 0,
13182
- children: [/* @__PURE__ */ C("div", {
13183
- className: E("updog__preview-table-marker", i && "updog__preview-table-cell--last-row"),
13184
- children: n + 1
13185
- }), l === 0 ? /* @__PURE__ */ C("div", { className: E("updog__preview-table-td", "updog__preview-table-cell--last-col", i && "updog__preview-table-cell--last-row") }) : e.map((e, n) => /* @__PURE__ */ C("div", {
13186
- className: E("updog__preview-table-td", n === l - 1 && "updog__preview-table-cell--last-col", i && "updog__preview-table-cell--last-row"),
13187
- children: t?.[n] ?? ""
13188
- }, n))]
13189
- }, n);
13190
- })
13191
- ]
13160
+ children: [e !== void 0 && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", { className: "updog__preview-table-marker" }), l === 0 ? /* @__PURE__ */ C("div", { className: E("updog__preview-table-th", "updog__preview-table-cell--last-col") }) : e.map((e, t) => /* @__PURE__ */ w("div", {
13161
+ className: E("updog__preview-table-th", t === l - 1 && "updog__preview-table-cell--last-col"),
13162
+ children: [/* @__PURE__ */ C("span", {
13163
+ className: "updog__preview-table-th__label",
13164
+ children: e
13165
+ }), n?.[t] && /* @__PURE__ */ C(ge, {
13166
+ size: "0.875rem",
13167
+ className: "updog__preview-table-th__lock-icon"
13168
+ })]
13169
+ }, t))] }), u.map((e, t) => {
13170
+ let n = t === r - 1, i = !!s && e !== void 0, a = o === t;
13171
+ return /* @__PURE__ */ w("div", {
13172
+ className: E("updog__preview-table-row", i && "updog__preview-table-row--interactive", a && "updog__preview-table-row--selected"),
13173
+ "data-row-index": t,
13174
+ role: i ? "row" : void 0,
13175
+ tabIndex: i ? 0 : void 0,
13176
+ "aria-selected": i ? a : void 0,
13177
+ onClick: i ? M : void 0,
13178
+ onKeyDown: i ? N : void 0,
13179
+ children: [/* @__PURE__ */ C("div", {
13180
+ className: E("updog__preview-table-marker", n && "updog__preview-table-cell--last-row"),
13181
+ children: t + 1
13182
+ }), l === 0 ? /* @__PURE__ */ C("div", { className: E("updog__preview-table-td", "updog__preview-table-cell--last-col", n && "updog__preview-table-cell--last-row") }) : Array.from({ length: l }, (t, r) => /* @__PURE__ */ C("div", {
13183
+ className: E("updog__preview-table-td", r === l - 1 && "updog__preview-table-cell--last-col", n && "updog__preview-table-cell--last-row"),
13184
+ children: e?.[r] ?? ""
13185
+ }, r))]
13186
+ }, t);
13187
+ })]
13192
13188
  })
13193
13189
  })
13194
13190
  }),
@@ -20912,7 +20908,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
20912
20908
  return this.state.hasError ? /* @__PURE__ */ C(_v, { error: vv }) : this.props.children;
20913
20909
  }
20914
20910
  }, bv = ({ leftSlot: e }) => {
20915
- let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } = Bb(), y = i && t === "editor", b = f(() => {
20911
+ let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } = Vb(), y = i && t === "editor", b = f(() => {
20916
20912
  n(!1);
20917
20913
  }, [n]), x = m[h]?.id === "sheet-selection", S = f(() => {
20918
20914
  a ? c() : x ? _() : o();
@@ -21681,7 +21677,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
21681
21677
  }
21682
21678
  return i;
21683
21679
  }, Hv = () => {
21684
- let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = Bb(), [l, u] = b(null), d = y(null), p = v(() => Vv(i, e, n), [
21680
+ let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = Vb(), [l, u] = b(null), d = y(null), p = v(() => Vv(i, e, n), [
21685
21681
  i,
21686
21682
  e,
21687
21683
  n
@@ -21900,99 +21896,93 @@ var Gv = () => {
21900
21896
  /* @__PURE__ */ C(Yv, {})
21901
21897
  ]
21902
21898
  }), Zv = () => {
21903
- let { parsedCsv: e } = Bb();
21899
+ let { parsedCsv: e } = Vb();
21904
21900
  return e ? /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
21905
21901
  className: "updog__step-column-matching__content updog__scrollbar",
21906
21902
  children: /* @__PURE__ */ C(Wv, { children: /* @__PURE__ */ C(Xv, {}) })
21907
21903
  }), /* @__PURE__ */ C(bv, {})] }) }) : null;
21908
- }, Qv = new Set([
21904
+ }, Qv = .5, $v = new Set([
21909
21905
  "true",
21910
21906
  "false",
21911
21907
  "yes",
21912
21908
  "no"
21913
- ]), $v = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, ey = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, ty = new Set([
21909
+ ]), ey = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, ty = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, ny = new Set([
21914
21910
  "number",
21915
21911
  "date",
21916
21912
  "bool"
21917
21913
  ]);
21918
- function ny(e) {
21914
+ function ry(e) {
21919
21915
  if (e == null) return "empty";
21920
21916
  let t = String(e).trim();
21921
- return t.length === 0 ? "empty" : Qv.has(t.toLowerCase()) ? "bool" : $v.test(t) ? "date" : ey.test(t) ? "number" : "text";
21917
+ return t.length === 0 ? "empty" : $v.has(t.toLowerCase()) ? "bool" : ey.test(t) ? "date" : ty.test(t) ? "number" : "text";
21922
21918
  }
21923
- function ry(e) {
21919
+ function iy(e) {
21924
21920
  return e.filter((e) => e != null && String(e).trim().length > 0).length;
21925
21921
  }
21926
- function iy(e) {
21922
+ function ay(e) {
21923
+ let t = 0;
21924
+ for (let n of e) t = Math.max(t, n.length);
21925
+ return t;
21926
+ }
21927
+ function oy(e) {
21927
21928
  let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
21928
21929
  for (let i of e) {
21929
- let e = ry(i);
21930
+ let e = i.length;
21930
21931
  if (e === 0) continue;
21931
21932
  let a = (t.get(e) ?? 0) + 1;
21932
21933
  t.set(e, a), a > n && (n = a, r = e);
21933
21934
  }
21934
21935
  return r;
21935
21936
  }
21936
- function ay(e) {
21937
- let t = 0;
21938
- for (let n of e) t = Math.max(t, n.length);
21939
- return t;
21940
- }
21941
- function oy(e, t, n) {
21937
+ function sy(e, t, n) {
21942
21938
  if (t <= 0) return 0;
21943
- let r = -1, i = 0;
21944
- for (let a = 0; a < e.length; a++) if (ry(e[a]) === t) {
21945
- if (r < 0 && (r = a), i++, i >= n) return r;
21946
- } else r = -1, i = 0;
21947
- for (let n = 0; n < e.length; n++) if (ry(e[n]) === t) return n;
21939
+ for (let r = 0; r < e.length; r++) if (iy(e[r]) / t >= n) return r;
21948
21940
  return 0;
21949
21941
  }
21950
- function sy(e, t, n, r) {
21942
+ function cy(e, t, n, r) {
21951
21943
  let i = /* @__PURE__ */ new Map();
21952
21944
  for (let a = t; a < n; a++) {
21953
- let t = ny(e[a]?.[r]);
21945
+ let t = ry(e[a]?.[r]);
21954
21946
  t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
21955
21947
  }
21956
21948
  let a = "empty", o = 0;
21957
21949
  for (let [e, t] of i) t > o && (o = t, a = e);
21958
21950
  return a;
21959
21951
  }
21960
- function cy(e, t, n, r) {
21952
+ function ly(e, t, n, r) {
21961
21953
  let i = 0, a = 0;
21962
21954
  for (let o = 0; o < r; o++) {
21963
- let r = sy(e, t + 1, n, o);
21964
- r !== "empty" && (a++, ny(e[t]?.[o]) === "text" && ty.has(r) && i++);
21955
+ let r = cy(e, t + 1, n, o);
21956
+ r !== "empty" && (a++, ry(e[t]?.[o]) === "text" && ny.has(r) && i++);
21965
21957
  }
21966
21958
  return a === 0 ? 0 : i / a;
21967
21959
  }
21968
- function ly(e, t, n, r) {
21960
+ function uy(e, t, n, r) {
21969
21961
  let i = 0, a = 0;
21970
21962
  for (let o = 0; o < r; o++) {
21971
- let r = sy(e, t, n, o);
21963
+ let r = cy(e, t, n, o);
21972
21964
  if (r !== "empty") for (let s = t; s < n; s++) {
21973
- let t = ny(e[s]?.[o]);
21965
+ let t = ry(e[s]?.[o]);
21974
21966
  t !== "empty" && (a++, t === r && i++);
21975
21967
  }
21976
21968
  }
21977
21969
  return a === 0 ? 0 : i / a;
21978
21970
  }
21979
- function uy(e) {
21980
- let t = e.map(ny).filter((e) => e !== "empty");
21971
+ function dy(e) {
21972
+ let t = e.map(ry).filter((e) => e !== "empty");
21981
21973
  return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
21982
21974
  }
21983
- function dy(e, t) {
21984
- if (t <= 0) return 0;
21985
- let n = ry(e);
21986
- return Math.max(0, 1 - Math.abs(n - t) / t);
21975
+ function fy(e, t) {
21976
+ return t <= 0 ? 0 : Math.min(1, iy(e) / t);
21987
21977
  }
21988
- function fy(e) {
21978
+ function py(e) {
21989
21979
  let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
21990
21980
  return t.length === 0 ? 0 : new Set(t).size / t.length;
21991
21981
  }
21992
- function py(e, t, n, r, i) {
21993
- return .45 * cy(e, t, n, r) + .25 * ly(e, t + 1, n, r) + .15 * uy(e[t] ?? []) + .1 * dy(e[t] ?? [], i) + .05 * fy(e[t] ?? []);
21982
+ function my(e, t, n, r, i) {
21983
+ return .45 * ly(e, t, n, r) + .25 * uy(e, t + 1, n, r) + .15 * dy(e[t] ?? []) + .1 * fy(e[t] ?? [], i) + .05 * py(e[t] ?? []);
21994
21984
  }
21995
- function my(e, t = 100) {
21985
+ function hy(e, t = 100) {
21996
21986
  if (e.length === 0) return {
21997
21987
  headerRowIndex: 0,
21998
21988
  dataStartIndex: 0,
@@ -22000,7 +21990,7 @@ function my(e, t = 100) {
22000
21990
  mode: "header",
22001
21991
  review: { kind: "none" }
22002
21992
  };
22003
- let n = Math.min(t, e.length), r = e.slice(0, n), i = ay(r), a = iy(r), o = oy(r, a, 3), s = e[o] ?? [], c = cy(e, o, n, i), l = ly(e, o + 1, n, i), u = ry(s) > 0 && uy(s) === 0, d = Math.round(Math.max(0, py(e, o, n, i, a)) * 100) / 100;
21993
+ let n = Math.min(t, e.length), r = e.slice(0, n), i = ay(r), a = oy(r), o = sy(r, a, Qv), s = e[o] ?? [], c = ly(e, o, n, i), l = uy(e, o + 1, n, i), u = iy(s) > 0 && dy(s) === 0, d = Math.round(Math.max(0, my(e, o, n, i, a)) * 100) / 100;
22004
21994
  if (u && c <= .15 && l >= .7) return {
22005
21995
  headerRowIndex: -1,
22006
21996
  dataStartIndex: o,
@@ -22020,7 +22010,7 @@ function my(e, t = 100) {
22020
22010
  review: f
22021
22011
  };
22022
22012
  }
22023
- function hy(e) {
22013
+ function gy(e) {
22024
22014
  let t = /* @__PURE__ */ new Set();
22025
22015
  return e.map((e) => {
22026
22016
  let n = e, r = 2;
@@ -22030,7 +22020,7 @@ function hy(e) {
22030
22020
  }
22031
22021
  //#endregion
22032
22022
  //#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
22033
- function gy(e, t, n, r) {
22023
+ function _y(e, t, n, r) {
22034
22024
  return v(() => ({
22035
22025
  sample: e,
22036
22026
  selectedRow: t,
@@ -22045,20 +22035,20 @@ function gy(e, t, n, r) {
22045
22035
  }
22046
22036
  //#endregion
22047
22037
  //#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
22048
- var _y = s(null);
22049
- function vy({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
22050
- let a = gy(e, t, n, r);
22051
- return /* @__PURE__ */ C(_y.Provider, {
22038
+ var vy = s(null);
22039
+ function yy({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
22040
+ let a = _y(e, t, n, r);
22041
+ return /* @__PURE__ */ C(vy.Provider, {
22052
22042
  value: a,
22053
22043
  children: i
22054
22044
  });
22055
22045
  }
22056
- var yy = () => {
22057
- let e = p(_y);
22046
+ var by = () => {
22047
+ let e = p(vy);
22058
22048
  if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
22059
22049
  return e;
22060
- }, by = () => {
22061
- let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = yy(), { headers: i } = Bb(), { headers: a, rows: o } = v(() => {
22050
+ }, xy = () => {
22051
+ let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = by(), { headers: i } = Vb(), { headers: a, rows: o } = v(() => {
22062
22052
  let t = i.length;
22063
22053
  return {
22064
22054
  headers: i.map((e) => r ? e : ""),
@@ -22078,27 +22068,30 @@ var yy = () => {
22078
22068
  selectedRow: r ? void 0 : t,
22079
22069
  onSelectRow: r ? void 0 : n
22080
22070
  });
22081
- }, xy = () => {
22082
- let { t: e } = K(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = Bb(), i = f((e) => {
22071
+ }, Sy = () => {
22072
+ let { t: e } = K(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = Vb(), i = f((e) => {
22083
22073
  r(e ? -1 : Math.max(0, t?.detection.headerRowIndex ?? 0));
22084
22074
  }, [r, t]);
22085
22075
  if (!t) return null;
22086
22076
  let a = t.rawRows.slice(0, 50), o = n < 0;
22087
- return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(vy, {
22077
+ return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(yy, {
22088
22078
  sample: a,
22089
22079
  selectedRow: o ? void 0 : n,
22090
22080
  selectRow: r,
22091
22081
  noHeader: o,
22092
22082
  children: [/* @__PURE__ */ w("div", {
22093
22083
  className: "updog__step-header-selection__content updog__scrollbar",
22094
- children: [/* @__PURE__ */ C(Ni, {
22095
- checked: o,
22096
- onChange: i,
22097
- label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
22098
- }), /* @__PURE__ */ C(by, {})]
22084
+ children: [/* @__PURE__ */ C("div", {
22085
+ className: "updog__step-header-selection__noHeadersWrapper",
22086
+ children: /* @__PURE__ */ C(Ni, {
22087
+ checked: o,
22088
+ onChange: i,
22089
+ label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
22090
+ })
22091
+ }), /* @__PURE__ */ C(xy, {})]
22099
22092
  }), /* @__PURE__ */ C(bv, {})]
22100
22093
  }) }) });
22101
- }, Sy = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
22094
+ }, Cy = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
22102
22095
  let { t: a } = K();
22103
22096
  return /* @__PURE__ */ C(Vi, {
22104
22097
  open: e,
@@ -22111,13 +22104,13 @@ var yy = () => {
22111
22104
  onSubmit: i
22112
22105
  })
22113
22106
  });
22114
- }, Cy = [
22107
+ }, wy = [
22115
22108
  ",",
22116
22109
  ";",
22117
22110
  "|",
22118
22111
  "\n",
22119
22112
  " "
22120
- ], wy = (e, t, n) => {
22113
+ ], Ty = (e, t, n) => {
22121
22114
  let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
22122
22115
  if (e.trim() === "") return [];
22123
22116
  if (i(e)) return [e.trim()];
@@ -22129,31 +22122,31 @@ var yy = () => {
22129
22122
  a.push(e);
22130
22123
  continue;
22131
22124
  }
22132
- a.push(...Ty(e, t, i));
22125
+ a.push(...Ey(e, t, i));
22133
22126
  }
22134
22127
  }
22135
22128
  return a;
22136
- }, Ty = (e, t, n) => {
22137
- for (let r of Cy) {
22129
+ }, Ey = (e, t, n) => {
22130
+ for (let r of wy) {
22138
22131
  if (r === t || !e.includes(r)) continue;
22139
22132
  let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
22140
22133
  if (i.length >= 2 && i.every(n)) return i;
22141
22134
  }
22142
22135
  return [e];
22143
- }, Ey = (e, t, n) => {
22136
+ }, Dy = (e, t, n) => {
22144
22137
  let r = /* @__PURE__ */ new Set();
22145
- for (let i of e) if (i !== "") if (n) for (let e of wy(i, n, t)) r.add(e);
22138
+ for (let i of e) if (i !== "") if (n) for (let e of Ty(i, n, t)) r.add(e);
22146
22139
  else r.add(i);
22147
22140
  return [...r];
22148
- }, Dy = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Oy = (e, t) => {
22141
+ }, Oy = (e) => !e.some((e) => e != null && String(e).trim() !== ""), ky = (e, t) => {
22149
22142
  let n = 0;
22150
22143
  for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
22151
22144
  return n;
22152
- }, ky = 50, Ay = (e, t, n) => {
22153
- let r = Math.min(e.length, t + ky);
22145
+ }, Ay = 50, jy = (e, t, n) => {
22146
+ let r = Math.min(e.length, t + Ay);
22154
22147
  for (let i = t; i < r; i++) {
22155
22148
  let t = e[i];
22156
- if (!t || Dy(t)) continue;
22149
+ if (!t || Oy(t)) continue;
22157
22150
  let r = !0;
22158
22151
  for (let e = 0; e < n; e++) {
22159
22152
  let n = t[e];
@@ -22167,60 +22160,64 @@ var yy = () => {
22167
22160
  return Array.from({ length: n }, (n, i) => {
22168
22161
  for (let n = t; n < r; n++) {
22169
22162
  let t = e[n];
22170
- if (!t || Dy(t)) continue;
22163
+ if (!t || Oy(t)) continue;
22171
22164
  let r = t[i], a = r == null ? "" : String(r).trim();
22172
22165
  if (a !== "") return a;
22173
22166
  }
22174
22167
  return "";
22175
22168
  });
22176
- }, jy = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, My = (e, t, n, r) => {
22169
+ }, My = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, Ny = (e, t, n, r) => {
22177
22170
  if (t < 0) {
22178
- let t = Oy(e, n), i = Ay(e, n, t);
22171
+ let t = ky(e, n), i = jy(e, n, t);
22179
22172
  return Array.from({ length: t }, (e, t) => r(t, i[t]));
22180
22173
  }
22181
- return hy((e[t] ?? []).map((e) => String(e ?? "").trim()));
22182
- }, Ny = () => ({
22174
+ let i = e[t] ?? [], a = Math.max(i.length, ky(e, n)), o = jy(e, n, a);
22175
+ return gy(Array.from({ length: a }, (e, t) => {
22176
+ let n = String(i[t] ?? "").trim();
22177
+ return n === "" ? r(t, o[t]) : n;
22178
+ }));
22179
+ }, Py = () => ({
22183
22180
  headerRowIndex: 0,
22184
22181
  dataStartIndex: 1,
22185
22182
  confidence: 1,
22186
22183
  mode: "header",
22187
22184
  review: { kind: "none" }
22188
- }), Py = (e, t) => {
22185
+ }), Fy = (e, t) => {
22189
22186
  let n = [e];
22190
22187
  for (let r of t) n.push(e.map((e) => r[e] ?? ""));
22191
22188
  return n;
22192
- }, Fy = (e) => {
22189
+ }, Iy = (e) => {
22193
22190
  let t = /* @__PURE__ */ new Map();
22194
22191
  for (let n = 0; n < e.length; n++) t.set(e[n], n);
22195
22192
  return t;
22196
- }, Iy = (e, t, n) => {
22193
+ }, Ly = (e, t, n) => {
22197
22194
  let r = [];
22198
22195
  for (let i = t; i < e.length; i++) {
22199
22196
  let t = e[i];
22200
- if (Dy(t)) continue;
22197
+ if (Oy(t)) continue;
22201
22198
  let a = t[n], o = a == null ? "" : String(a);
22202
22199
  o !== "" && r.push(o);
22203
22200
  }
22204
22201
  return r;
22205
- }, Ly = (e, t) => {
22202
+ }, Ry = (e, t) => {
22206
22203
  let n = {};
22207
22204
  for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
22208
22205
  return n;
22209
- }, Ry = (e, t, n, r) => {
22206
+ }, zy = (e, t, n, r) => {
22210
22207
  let i = [];
22211
- for (let a = n; a < e.length && i.length < r; a++) Dy(e[a]) || i.push(Ly(e[a], t));
22208
+ for (let a = n; a < e.length && i.length < r; a++) Oy(e[a]) || i.push(Ry(e[a], t));
22212
22209
  return i;
22213
- }, zy = () => {
22214
- let { columns: e } = X(), { t } = K(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: p, addPendingOption: h } = Bb(), [g, _] = b({}), [x, S] = b({}), [w, T] = b(null), E = y(!1), D = v(() => {
22210
+ }, By = () => {
22211
+ let { columns: e } = X(), { t } = K(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: p, addPendingOption: h } = Vb(), [g, _] = b({}), [x, S] = b({}), [w, T] = b(null), E = y(!1), D = v(() => {
22215
22212
  if (!n) return [];
22216
- let t = [], s = Fy(r);
22213
+ let t = [], s = Iy(r);
22217
22214
  for (let [r, c] of Object.entries(a)) {
22218
22215
  if (!c) continue;
22219
22216
  let a = e.find((e) => e.id === c);
22220
22217
  if (!a?.editor) continue;
22221
22218
  let u = a.editor.type;
22222
22219
  if (u !== "select" && u !== "multiselect") continue;
22223
- let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = Ey(h === void 0 ? [] : Iy(n.rawRows, i, h), d, m).map((e) => ({
22220
+ let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = Dy(h === void 0 ? [] : Ly(n.rawRows, i, h), d, m).map((e) => ({
22224
22221
  imported: e,
22225
22222
  mapped: f[e]
22226
22223
  }));
@@ -22343,20 +22340,20 @@ var yy = () => {
22343
22340
  submitCreate: R,
22344
22341
  closeCreate: z
22345
22342
  };
22346
- }, By = s(null);
22347
- function Vy({ children: e }) {
22348
- let t = zy();
22349
- return /* @__PURE__ */ C(By.Provider, {
22343
+ }, Vy = s(null);
22344
+ function Hy({ children: e }) {
22345
+ let t = By();
22346
+ return /* @__PURE__ */ C(Vy.Provider, {
22350
22347
  value: t,
22351
22348
  children: e
22352
22349
  });
22353
22350
  }
22354
- var Hy = () => {
22355
- let e = p(By);
22351
+ var Uy = () => {
22352
+ let e = p(Vy);
22356
22353
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
22357
22354
  return e;
22358
- }, Uy = ({ section: e }) => {
22359
- let { t } = K(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = Hy(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = f((t) => i(e.columnId, t), [i, e.columnId]), l = f(() => a(e.columnId), [a, e.columnId]);
22355
+ }, Wy = ({ section: e }) => {
22356
+ let { t } = K(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = Uy(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = f((t) => i(e.columnId, t), [i, e.columnId]), l = f(() => a(e.columnId), [a, e.columnId]);
22360
22357
  return /* @__PURE__ */ w("header", {
22361
22358
  className: "updog__value-matching__section-header",
22362
22359
  children: [/* @__PURE__ */ C("div", {
@@ -22400,14 +22397,14 @@ var Hy = () => {
22400
22397
  })
22401
22398
  })]
22402
22399
  });
22403
- }, Wy = {
22400
+ }, Gy = {
22404
22401
  ",": ",",
22405
22402
  ";": ";",
22406
22403
  "|": "|",
22407
22404
  "\n": "\\n",
22408
22405
  " ": "\\t"
22409
- }, Gy = (e) => e === null ? "" : Wy[e] ?? e, Ky = ({ section: e }) => {
22410
- let { t } = K(), { changeDelimiter: n, reapplyDelimiter: r } = Hy(), i = y(e.delimiter), a = Gy(e.delimiter), [o, s] = b(a), { debouncedValue: c } = za(o, 300), l = y(a);
22406
+ }, Ky = (e) => e === null ? "" : Gy[e] ?? e, qy = ({ section: e }) => {
22407
+ let { t } = K(), { changeDelimiter: n, reapplyDelimiter: r } = Uy(), i = y(e.delimiter), a = Ky(e.delimiter), [o, s] = b(a), { debouncedValue: c } = za(o, 300), l = y(a);
22411
22408
  m(() => {
22412
22409
  s(a), l.current = a;
22413
22410
  }, [a]), m(() => {
@@ -22450,8 +22447,8 @@ var Hy = () => {
22450
22447
  })
22451
22448
  ]
22452
22449
  });
22453
- }, qy = ({ section: e, val: t }) => {
22454
- let { t: n } = K(), { getSelectOptions: r, selectValue: i } = Hy(), a = t.mapped === void 0, o = f((n) => i(e.columnId, t.imported, n), [
22450
+ }, Jy = ({ section: e, val: t }) => {
22451
+ let { t: n } = K(), { getSelectOptions: r, selectValue: i } = Uy(), a = t.mapped === void 0, o = f((n) => i(e.columnId, t.imported, n), [
22455
22452
  i,
22456
22453
  e.columnId,
22457
22454
  t.imported
@@ -22503,8 +22500,8 @@ var Hy = () => {
22503
22500
  })
22504
22501
  ]
22505
22502
  });
22506
- }, Jy = ({ section: e }) => {
22507
- let { t } = K(), { getVisibleValues: n } = Hy(), r = n(e);
22503
+ }, Yy = ({ section: e }) => {
22504
+ let { t } = K(), { getVisibleValues: n } = Uy(), r = n(e);
22508
22505
  return /* @__PURE__ */ w("div", {
22509
22506
  className: "updog__value-matching__table",
22510
22507
  children: [r.length === 0 ? /* @__PURE__ */ C("div", {
@@ -22524,7 +22521,7 @@ var Hy = () => {
22524
22521
  size: "sm",
22525
22522
  weight: "medium",
22526
22523
  children: t("dataEditor.uploader.matchValues.importedValues")
22527
- }), e.isMultiselect && /* @__PURE__ */ C(Ky, { section: e })]
22524
+ }), e.isMultiselect && /* @__PURE__ */ C(qy, { section: e })]
22528
22525
  }),
22529
22526
  /* @__PURE__ */ C("div", { className: "updog__value-matching__arrow-spacer" }),
22530
22527
  /* @__PURE__ */ C(q, {
@@ -22536,25 +22533,25 @@ var Hy = () => {
22536
22533
  }),
22537
22534
  /* @__PURE__ */ C("div", { className: "updog__value-matching__action" })
22538
22535
  ]
22539
- }), r.map((t) => /* @__PURE__ */ C(qy, {
22536
+ }), r.map((t) => /* @__PURE__ */ C(Jy, {
22540
22537
  section: e,
22541
22538
  val: t
22542
22539
  }, t.imported))]
22543
22540
  });
22544
- }, Yy = ({ section: e }) => {
22545
- let { isCollapsed: t } = Hy(), n = !t(e.columnId);
22541
+ }, Xy = ({ section: e }) => {
22542
+ let { isCollapsed: t } = Uy(), n = !t(e.columnId);
22546
22543
  return /* @__PURE__ */ w("div", {
22547
22544
  className: "updog__value-matching__section",
22548
- children: [/* @__PURE__ */ C(Uy, { section: e }), /* @__PURE__ */ C("div", {
22545
+ children: [/* @__PURE__ */ C(Wy, { section: e }), /* @__PURE__ */ C("div", {
22549
22546
  className: E("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
22550
- children: /* @__PURE__ */ C(Jy, { section: e })
22547
+ children: /* @__PURE__ */ C(Yy, { section: e })
22551
22548
  })]
22552
22549
  });
22553
- }, Xy = () => {
22554
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = Hy();
22550
+ }, Zy = () => {
22551
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = Uy();
22555
22552
  return /* @__PURE__ */ w("div", {
22556
22553
  className: "updog__value-matching",
22557
- children: [e.map((e) => /* @__PURE__ */ C(Yy, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Sy, {
22554
+ children: [e.map((e) => /* @__PURE__ */ C(Xy, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Cy, {
22558
22555
  open: !0,
22559
22556
  existingOptions: n,
22560
22557
  initialName: r,
@@ -22562,15 +22559,15 @@ var Hy = () => {
22562
22559
  onSubmit: i
22563
22560
  })]
22564
22561
  });
22565
- }, Zy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22562
+ }, Qy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22566
22563
  className: "updog__step-match-values__content updog__scrollbar",
22567
- children: /* @__PURE__ */ C(Vy, { children: /* @__PURE__ */ C(Xy, {}) })
22568
- }), /* @__PURE__ */ C(bv, {})] }) }), Qy = 20, $y = () => {
22569
- let { store: e } = X(), { t } = K(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = Bb(), l = e.isClient(), u = f(() => r(null), [r]), d = v(() => {
22564
+ children: /* @__PURE__ */ C(Hy, { children: /* @__PURE__ */ C(Zy, {}) })
22565
+ }), /* @__PURE__ */ C(bv, {})] }) }), $y = 20, eb = () => {
22566
+ let { store: e } = X(), { t } = K(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = Vb(), l = e.isClient(), u = f(() => r(null), [r]), d = v(() => {
22570
22567
  let e = {};
22571
22568
  for (let [t, n] of Object.entries(s)) n && (e[n] = t);
22572
22569
  return e;
22573
- }, [s]), p = v(() => i ? Ry(i.rawRows, a, o, Qy) : [], [
22570
+ }, [s]), p = v(() => i ? zy(i.rawRows, a, o, $y) : [], [
22574
22571
  i,
22575
22572
  a,
22576
22573
  o
@@ -22622,8 +22619,8 @@ var Hy = () => {
22622
22619
  }, e.id);
22623
22620
  })]
22624
22621
  });
22625
- }, eb = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C($y, {}), /* @__PURE__ */ C(bv, {})] }) }), tb = () => {
22626
- let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = X(), i = t === !1 ? [] : t, { t: a } = K(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: p, handleRemoteSourceSelect: m } = Bb(), h = [
22622
+ }, tb = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(eb, {}), /* @__PURE__ */ C(bv, {})] }) }), nb = () => {
22623
+ let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = X(), i = t === !1 ? [] : t, { t: a } = K(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: p, handleRemoteSourceSelect: m } = Vb(), h = [
22627
22624
  {
22628
22625
  id: "csv",
22629
22626
  format: "csv",
@@ -22681,20 +22678,20 @@ var Hy = () => {
22681
22678
  }, [c]),
22682
22679
  handleRemoteSourceSelect: m
22683
22680
  };
22684
- }, nb = s(null);
22685
- function rb({ children: e }) {
22686
- let t = tb();
22687
- return /* @__PURE__ */ C(nb.Provider, {
22681
+ }, rb = s(null);
22682
+ function ib({ children: e }) {
22683
+ let t = nb();
22684
+ return /* @__PURE__ */ C(rb.Provider, {
22688
22685
  value: t,
22689
22686
  children: e
22690
22687
  });
22691
22688
  }
22692
- var ib = () => {
22693
- let e = p(nb);
22689
+ var ab = () => {
22690
+ let e = p(rb);
22694
22691
  if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
22695
22692
  return e;
22696
- }, ab = () => {
22697
- let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = ib();
22693
+ }, ob = () => {
22694
+ let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = ab();
22698
22695
  return /* @__PURE__ */ C(Fa, {
22699
22696
  options: t,
22700
22697
  onSelect: n,
@@ -22706,7 +22703,7 @@ var ib = () => {
22706
22703
  children: e("dataEditor.uploader.uploadFile.downloadExample")
22707
22704
  })
22708
22705
  });
22709
- }, ob = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
22706
+ }, sb = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
22710
22707
  className: "updog__remote-source-btn__icon",
22711
22708
  dangerouslySetInnerHTML: { __html: e.icon }
22712
22709
  }) : /* @__PURE__ */ C("span", {
@@ -22715,7 +22712,7 @@ var ib = () => {
22715
22712
  src: e.icon,
22716
22713
  alt: e.label
22717
22714
  })
22718
- }), sb = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
22715
+ }), cb = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
22719
22716
  variant: "filled",
22720
22717
  color: "neutral",
22721
22718
  size: "sm",
@@ -22725,11 +22722,11 @@ var ib = () => {
22725
22722
  disabled: !t && n,
22726
22723
  loading: t,
22727
22724
  spinnerPosition: "start",
22728
- startIcon: /* @__PURE__ */ C(ob, { source: e }),
22725
+ startIcon: /* @__PURE__ */ C(sb, { source: e }),
22729
22726
  title: e.description,
22730
22727
  children: e.label
22731
- }), cb = () => {
22732
- let { t: e } = K(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = ib(), o = n.length > 0;
22728
+ }), lb = () => {
22729
+ let { t: e } = K(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = ab(), o = n.length > 0;
22733
22730
  return /* @__PURE__ */ w("div", {
22734
22731
  className: "updog__source-picker",
22735
22732
  children: [
@@ -22756,7 +22753,7 @@ var ib = () => {
22756
22753
  }),
22757
22754
  o && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Oa, {}), /* @__PURE__ */ C("div", {
22758
22755
  className: "updog__source-picker__sources-list",
22759
- children: n.map((e) => /* @__PURE__ */ C(sb, {
22756
+ children: n.map((e) => /* @__PURE__ */ C(cb, {
22760
22757
  source: e,
22761
22758
  loading: r === e.id,
22762
22759
  disabled: !!r,
@@ -22770,7 +22767,7 @@ var ib = () => {
22770
22767
  })
22771
22768
  ]
22772
22769
  });
22773
- }, lb = () => {
22770
+ }, ub = () => {
22774
22771
  let { t: e } = K();
22775
22772
  return /* @__PURE__ */ w("div", {
22776
22773
  className: "updog__uploading-state",
@@ -22783,12 +22780,12 @@ var ib = () => {
22783
22780
  children: e("dataEditor.uploader.uploadFile.uploading")
22784
22781
  })]
22785
22782
  });
22786
- }, ub = () => {
22787
- let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = ib();
22783
+ }, db = () => {
22784
+ let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = ab();
22788
22785
  return /* @__PURE__ */ C("div", {
22789
22786
  className: E("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
22790
22787
  onClick: t ? void 0 : a,
22791
- children: n ? /* @__PURE__ */ C(lb, {}) : /* @__PURE__ */ w(S, { children: [
22788
+ children: n ? /* @__PURE__ */ C(ub, {}) : /* @__PURE__ */ w(S, { children: [
22792
22789
  /* @__PURE__ */ C("div", {
22793
22790
  className: "updog__step-select-files__icon-container",
22794
22791
  children: r ? /* @__PURE__ */ C(I, {
@@ -22799,7 +22796,7 @@ var ib = () => {
22799
22796
  className: "updog__step-select-files__icon"
22800
22797
  })
22801
22798
  }),
22802
- !r && /* @__PURE__ */ C(cb, {}),
22799
+ !r && /* @__PURE__ */ C(lb, {}),
22803
22800
  r && /* @__PURE__ */ w("div", {
22804
22801
  className: "updog__step-select-files__info",
22805
22802
  children: [/* @__PURE__ */ C(q, {
@@ -22816,21 +22813,21 @@ var ib = () => {
22816
22813
  })
22817
22814
  ] })
22818
22815
  });
22819
- }, db = () => {
22820
- let { getRootProps: e, getInputProps: t, isDragActive: n } = ib();
22816
+ }, fb = () => {
22817
+ let { getRootProps: e, getInputProps: t, isDragActive: n } = ab();
22821
22818
  return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w("div", {
22822
22819
  className: "updog__step-select-files__dropzone",
22823
22820
  ...e(),
22824
22821
  children: [
22825
22822
  /* @__PURE__ */ C("input", { ...t() }),
22826
- /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(ub, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(ab, {}) })] }),
22823
+ /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(db, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(ob, {}) })] }),
22827
22824
  n && /* @__PURE__ */ C(Yl, {})
22828
22825
  ]
22829
22826
  }) });
22830
- }, fb = () => /* @__PURE__ */ C(rb, { children: /* @__PURE__ */ C(db, {}) }), pb = ({ preview: e }) => {
22831
- let { selectedSheet: t, setSelectedSheet: n } = Bb(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
22827
+ }, pb = () => /* @__PURE__ */ C(ib, { children: /* @__PURE__ */ C(fb, {}) }), mb = ({ preview: e }) => {
22828
+ let { selectedSheet: t, setSelectedSheet: n } = Vb(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
22832
22829
  let { headers: t, rows: n } = e;
22833
- return n.map((e) => t.map((t) => e[t] ?? ""));
22830
+ return [t, ...n.map((e) => t.map((t) => e[t] ?? ""))];
22834
22831
  }, [e]);
22835
22832
  return /* @__PURE__ */ C(Ra, {
22836
22833
  name: "sheetSelection",
@@ -22858,23 +22855,22 @@ var ib = () => {
22858
22855
  className: "updog__sheet-preview-emptyText",
22859
22856
  children: r("dataEditor.uploader.sheetSelection.emptySheet")
22860
22857
  }) : /* @__PURE__ */ C(gf, {
22861
- headers: e.headers,
22862
22858
  rows: o,
22863
22859
  scrollbars: !1
22864
22860
  })
22865
22861
  })]
22866
22862
  })
22867
22863
  });
22868
- }, mb = () => {
22869
- let { sheetPreviews: e } = Bb();
22864
+ }, hb = () => {
22865
+ let { sheetPreviews: e } = Vb();
22870
22866
  return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22871
22867
  className: "updog__sheet-preview-wrapper updog__scrollbar",
22872
22868
  children: /* @__PURE__ */ C("div", {
22873
22869
  className: "updog__sheet-preview-grid",
22874
- children: e.map((e) => /* @__PURE__ */ C(pb, { preview: e }, e.name))
22870
+ children: e.map((e) => /* @__PURE__ */ C(mb, { preview: e }, e.name))
22875
22871
  })
22876
22872
  }), /* @__PURE__ */ C(bv, {})] }) });
22877
- }, hb = (e, t, n) => {
22873
+ }, gb = (e, t, n) => {
22878
22874
  let r = new Map(t.map((e) => [e.id, e])), i = [];
22879
22875
  for (let [t, a] of Object.entries(e)) a && i.push({
22880
22876
  csvHeader: t,
@@ -22882,11 +22878,11 @@ var ib = () => {
22882
22878
  column: n.has(a) ? void 0 : r.get(a)
22883
22879
  });
22884
22880
  return i;
22885
- }, gb = (e) => {
22881
+ }, _b = (e) => {
22886
22882
  let t = [];
22887
22883
  for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
22888
22884
  return t;
22889
- }, _b = (e, t, n) => {
22885
+ }, vb = (e, t, n) => {
22890
22886
  let r = {};
22891
22887
  for (let { csvHeader: i, columnId: a, column: o } of t) {
22892
22888
  let t = e[i] ?? "";
@@ -22901,7 +22897,7 @@ var ib = () => {
22901
22897
  continue;
22902
22898
  }
22903
22899
  if (s === "multiselect") {
22904
- let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? wy(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
22900
+ let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? Ty(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
22905
22901
  for (let e of s) {
22906
22902
  let t = n.valueMapping[a]?.[e.trim()];
22907
22903
  t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
@@ -22913,16 +22909,16 @@ var ib = () => {
22913
22909
  r[a] = o.transformer ? o.transformer(c) : c;
22914
22910
  }
22915
22911
  return r;
22916
- }, vb = 200, yb = (e, t, n) => {
22912
+ }, yb = 200, bb = (e, t, n) => {
22917
22913
  if (n) return n;
22918
22914
  let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
22919
22915
  for (let t of e) {
22920
22916
  let e = t.trim();
22921
- if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= vb)) break;
22917
+ if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= yb)) break;
22922
22918
  }
22923
22919
  if (o.length === 0) return null;
22924
22920
  let s = null, c = 0, l = 0;
22925
- for (let e of Cy) {
22921
+ for (let e of wy) {
22926
22922
  let n = 0, r = 0;
22927
22923
  for (let a of o) {
22928
22924
  if (i(a) || !a.includes(e)) continue;
@@ -22935,7 +22931,7 @@ var ib = () => {
22935
22931
  (n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
22936
22932
  }
22937
22933
  return c > 0 ? s : null;
22938
- }, bb = (e) => {
22934
+ }, xb = (e) => {
22939
22935
  let t = /* @__PURE__ */ new Map();
22940
22936
  for (let [n, r] of Object.entries(e)) {
22941
22937
  let e = wv(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
@@ -22943,8 +22939,8 @@ var ib = () => {
22943
22939
  t.set(e, i);
22944
22940
  }
22945
22941
  return t;
22946
- }, xb = (e, t, n, r) => {
22947
- let i = bb(r), a = (e, t) => i.get(wv(e))?.has(wv(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
22942
+ }, Sb = (e, t, n, r) => {
22943
+ let i = xb(r), a = (e, t) => i.get(wv(e))?.has(wv(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
22948
22944
  if (wv(n) === wv(r) || a(r, n)) return;
22949
22945
  let i = `${n} ${r}`;
22950
22946
  t.has(i) || (t.add(i), e.push({
@@ -22964,16 +22960,16 @@ var ib = () => {
22964
22960
  for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
22965
22961
  return c;
22966
22962
  };
22967
- function Sb(e, t, n) {
22963
+ function Cb(e, t, n) {
22968
22964
  let r = e.length, i = t;
22969
- return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? Cb(i, i - r) : Cb(r - 1, i - 1)) > 1e3 ? [] : r < i ? wb(e, i) : Tb(e, i, n);
22965
+ return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? wb(i, i - r) : wb(r - 1, i - 1)) > 1e3 ? [] : r < i ? Tb(e, i) : Eb(e, i, n);
22970
22966
  }
22971
- function Cb(e, t) {
22967
+ function wb(e, t) {
22972
22968
  let n = Math.min(t, e - t), r = 1;
22973
22969
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
22974
22970
  return r;
22975
22971
  }
22976
- function wb(e, t) {
22972
+ function Tb(e, t) {
22977
22973
  let n = e.length, r = [], i = [], a = (o) => {
22978
22974
  if (i.length === n) {
22979
22975
  let a = Array(t).fill("");
@@ -22985,7 +22981,7 @@ function wb(e, t) {
22985
22981
  };
22986
22982
  return a(0), r;
22987
22983
  }
22988
- function Tb(e, t, n) {
22984
+ function Eb(e, t, n) {
22989
22985
  let r = e.length, i = [], a = [], o = (s) => {
22990
22986
  if (a.length === t - 1) {
22991
22987
  let o = [
@@ -23003,27 +22999,27 @@ function Tb(e, t, n) {
23003
22999
  }
23004
23000
  //#endregion
23005
23001
  //#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
23006
- var Eb = {};
23007
- function Db(e, t) {
23002
+ var Db = {};
23003
+ function Ob(e, t) {
23008
23004
  for (let n of t.validators ?? []) if (n.type !== "expression") {
23009
23005
  if (n.type === "function") {
23010
- if (n.fn(e, Eb) != null) return !1;
23006
+ if (n.fn(e, Db) != null) return !1;
23011
23007
  continue;
23012
23008
  }
23013
- if (Al(n, e, Eb) != null) return !1;
23009
+ if (Al(n, e, Db) != null) return !1;
23014
23010
  }
23015
23011
  return !0;
23016
23012
  }
23017
- function Ob(e, t) {
23018
- for (let n = 0; n < t.length; n++) if (!Db(e.cells[n] ?? "", t[n])) return !1;
23013
+ function kb(e, t) {
23014
+ for (let n = 0; n < t.length; n++) if (!Ob(e.cells[n] ?? "", t[n])) return !1;
23019
23015
  return !0;
23020
23016
  }
23021
- function kb(e, t) {
23022
- return e.filter((e) => Ob(e, t));
23017
+ function Ab(e, t) {
23018
+ return e.filter((e) => kb(e, t));
23023
23019
  }
23024
23020
  //#endregion
23025
23021
  //#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
23026
- function Ab(e) {
23022
+ function jb(e) {
23027
23023
  if (e.length <= 1) return [];
23028
23024
  let t = e[0].cells.length, n = [], r = -1;
23029
23025
  for (let i = 0; i < t; i++) {
@@ -23040,25 +23036,25 @@ function Ab(e) {
23040
23036
  }
23041
23037
  //#endregion
23042
23038
  //#region src/components/DataUploader/utils/raggedRows/alignRow.ts
23043
- function jb(e, t, n) {
23044
- let r = Sb(e, t.length, n), i = kb(r, t);
23039
+ function Mb(e, t, n) {
23040
+ let r = Cb(e, t.length, n), i = Ab(r, t);
23045
23041
  return i.length === 1 ? {
23046
23042
  kind: "confident",
23047
23043
  alignment: i[0]
23048
23044
  } : i.length > 1 ? {
23049
23045
  kind: "ambiguous",
23050
23046
  candidates: i,
23051
- disputeSpans: Ab(i)
23047
+ disputeSpans: jb(i)
23052
23048
  } : {
23053
23049
  kind: "invalid",
23054
23050
  candidates: r,
23055
- disputeSpans: Ab(r)
23051
+ disputeSpans: jb(r)
23056
23052
  };
23057
23053
  }
23058
23054
  //#endregion
23059
23055
  //#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
23060
- function Mb(e, t, n) {
23061
- let r = jb(e, t, n);
23056
+ function Nb(e, t, n) {
23057
+ let r = Mb(e, t, n);
23062
23058
  if (r.kind === "confident") return {
23063
23059
  cells: r.alignment.cells,
23064
23060
  conflictColumns: []
@@ -23077,20 +23073,20 @@ function Mb(e, t, n) {
23077
23073
  }
23078
23074
  //#endregion
23079
23075
  //#region src/components/DataUploader/context/useViewModel.tsx
23080
- var Nb = 5e3, Pb = 15, Fb = 20, Ib = new Set([
23076
+ var Pb = 5e3, Fb = 15, Ib = 20, Lb = new Set([
23081
23077
  "xlsx",
23082
23078
  "xls",
23083
23079
  "xlsb",
23084
23080
  "ods"
23085
23081
  ]);
23086
- function Lb() {
23082
+ function Rb() {
23087
23083
  let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = X(), { t: p } = K(), [h, g] = b(0), [_, x] = b(0), [S, w] = b(null), [T, E] = b({}), D = v(() => {
23088
23084
  let e = new Set(Object.values(T).filter(Boolean));
23089
23085
  return n.filter((t) => t.unique && e.has(t.id));
23090
23086
  }, [T, n]), [O, k] = b(() => r), [A, j] = b(!1), [M, N] = b(!1), [P, F] = b(null), [I, L] = b([]), [R, z] = b(null), [B, V] = b([]), [ee, te] = b({}), [H, ne] = b([]), [re, ie] = b({}), ae = y(null), [oe, se] = b(-1), ce = f((e, t) => t ? p("dataEditor.uploader.matchColumns.syntheticColumnValue", {
23091
23087
  index: e + 1,
23092
23088
  value: t
23093
- }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), le = v(() => S ? jy(S.detection, oe) : 0, [S, oe]), ue = v(() => S ? My(S.rawRows, oe, le, ce) : [], [
23089
+ }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), le = v(() => S ? My(S.detection, oe) : 0, [S, oe]), ue = v(() => S ? Ny(S.rawRows, oe, le, ce) : [], [
23094
23090
  S,
23095
23091
  oe,
23096
23092
  le,
@@ -23108,16 +23104,16 @@ function Lb() {
23108
23104
  let e = [{
23109
23105
  id: "select-files",
23110
23106
  title: p("dataEditor.uploader.steps.selectFiles"),
23111
- content: /* @__PURE__ */ C(fb, {})
23107
+ content: /* @__PURE__ */ C(pb, {})
23112
23108
  }];
23113
23109
  return I.length > 1 && e.push({
23114
23110
  id: "sheet-selection",
23115
23111
  title: p("dataEditor.uploader.steps.sheetSelection"),
23116
- content: /* @__PURE__ */ C(mb, {})
23112
+ content: /* @__PURE__ */ C(hb, {})
23117
23113
  }), S && S.detection.review.kind !== "none" && e.push({
23118
23114
  id: "header-selection",
23119
23115
  title: p("dataEditor.uploader.steps.headerSelection"),
23120
- content: /* @__PURE__ */ C(xy, {})
23116
+ content: /* @__PURE__ */ C(Sy, {})
23121
23117
  }), e.push({
23122
23118
  id: "column-matching",
23123
23119
  title: p("dataEditor.uploader.steps.matchColumns"),
@@ -23125,11 +23121,11 @@ function Lb() {
23125
23121
  }), me && e.push({
23126
23122
  id: "match-values",
23127
23123
  title: p("dataEditor.uploader.steps.matchValues"),
23128
- content: /* @__PURE__ */ C(Zy, {})
23124
+ content: /* @__PURE__ */ C(Qy, {})
23129
23125
  }), D.length > 0 && he && e.push({
23130
23126
  id: "primary-key",
23131
23127
  title: p("dataEditor.uploader.steps.primaryKey"),
23132
- content: /* @__PURE__ */ C(eb, {})
23128
+ content: /* @__PURE__ */ C(tb, {})
23133
23129
  }), e;
23134
23130
  }, [
23135
23131
  D.length,
@@ -23173,7 +23169,7 @@ function Lb() {
23173
23169
  sheetName: R
23174
23170
  }).then((e) => {
23175
23171
  if (e.kind !== "rows") return;
23176
- let t = my(e.rows);
23172
+ let t = hy(e.rows);
23177
23173
  se(t.headerRowIndex), Se({
23178
23174
  fileName: P.name,
23179
23175
  rawRows: e.rows,
@@ -23197,7 +23193,7 @@ function Lb() {
23197
23193
  j(!1);
23198
23194
  return;
23199
23195
  }
23200
- let n = my(e.rows);
23196
+ let n = hy(e.rows);
23201
23197
  if (se(n.headerRowIndex), Se({
23202
23198
  fileName: t.name,
23203
23199
  rawRows: e.rows,
@@ -23231,8 +23227,8 @@ function Lb() {
23231
23227
  if (e.kind !== "records") return;
23232
23228
  se(0), Se({
23233
23229
  fileName: t.name,
23234
- rawRows: Py(e.headers, e.rows),
23235
- detection: Ny()
23230
+ rawRows: Fy(e.headers, e.rows),
23231
+ detection: Py()
23236
23232
  });
23237
23233
  } catch (t) {
23238
23234
  j(!1), e.errorHandler.handleError({
@@ -23253,8 +23249,8 @@ function Lb() {
23253
23249
  if (e.kind !== "records") return;
23254
23250
  se(0), Se({
23255
23251
  fileName: t.name,
23256
- rawRows: Py(e.headers, e.rows),
23257
- detection: Ny()
23252
+ rawRows: Fy(e.headers, e.rows),
23253
+ detection: Py()
23258
23254
  });
23259
23255
  } catch (t) {
23260
23256
  j(!1), e.errorHandler.handleError({
@@ -23273,11 +23269,11 @@ function Lb() {
23273
23269
  pe.parse(t, { format: "xlsx" }).then((e) => {
23274
23270
  if (e.kind === "sheets") {
23275
23271
  let n = e.sheets.map((e) => {
23276
- let t = my(e.rows), n = jy(t, t.headerRowIndex), r = My(e.rows, t.headerRowIndex, n, ce);
23272
+ let t = hy(e.rows), n = My(t, t.headerRowIndex), r = Ny(e.rows, t.headerRowIndex, n, ce);
23277
23273
  return {
23278
23274
  name: e.name,
23279
23275
  headers: r,
23280
- rows: Ry(e.rows, r, n, Pb),
23276
+ rows: zy(e.rows, r, n, Fb),
23281
23277
  totalRows: e.totalRows - 1
23282
23278
  };
23283
23279
  });
@@ -23285,7 +23281,7 @@ function Lb() {
23285
23281
  return;
23286
23282
  }
23287
23283
  if (e.kind !== "rows") return;
23288
- let n = my(e.rows);
23284
+ let n = hy(e.rows);
23289
23285
  se(n.headerRowIndex), Se({
23290
23286
  fileName: t.name,
23291
23287
  rawRows: e.rows,
@@ -23310,7 +23306,7 @@ function Lb() {
23310
23306
  ]), je = f((e) => {
23311
23307
  j(!0), ae.current = e;
23312
23308
  let t = e.name.split(".").pop()?.toLowerCase();
23313
- t && Ib.has(t) ? Ae(e) : t === "json" ? Oe(e) : t === "xml" ? ke(e) : De(e);
23309
+ t && Lb.has(t) ? Ae(e) : t === "json" ? Oe(e) : t === "xml" ? ke(e) : De(e);
23314
23310
  }, [
23315
23311
  De,
23316
23312
  Oe,
@@ -23347,8 +23343,8 @@ function Lb() {
23347
23343
  });
23348
23344
  se(0), Se({
23349
23345
  fileName: e.label,
23350
- rawRows: Py(n, r),
23351
- detection: Ny()
23346
+ rawRows: Fy(n, r),
23347
+ detection: Py()
23352
23348
  });
23353
23349
  }
23354
23350
  } catch (e) {
@@ -23376,7 +23372,7 @@ function Lb() {
23376
23372
  return;
23377
23373
  }
23378
23374
  if (M) return;
23379
- let e = {}, t = {}, r = Fy(ue);
23375
+ let e = {}, t = {}, r = Iy(ue);
23380
23376
  for (let [i, a] of Object.entries(T)) {
23381
23377
  if (!a) continue;
23382
23378
  let o = n.find((e) => e.id === a);
@@ -23385,9 +23381,9 @@ function Lb() {
23385
23381
  if (s !== "select" && s !== "multiselect") continue;
23386
23382
  let c = o.editor.options, l = r.get(i);
23387
23383
  if (l === void 0) continue;
23388
- let u = Iy(S.rawRows, le, l);
23384
+ let u = Ly(S.rawRows, le, l);
23389
23385
  if (s === "multiselect") {
23390
- let n = o.editor.delimiter, r = yb(u, c, n);
23386
+ let n = o.editor.delimiter, r = bb(u, c, n);
23391
23387
  t[a] = r;
23392
23388
  let i = new Set(c.map((e) => e.trim().toLowerCase())), s = /* @__PURE__ */ new Set();
23393
23389
  for (let e of u) {
@@ -23450,10 +23446,10 @@ function Lb() {
23450
23446
  if (!t) return;
23451
23447
  let r = n.find((t) => t.id === e);
23452
23448
  if (r?.editor?.type !== "multiselect") return;
23453
- let i = Fy(ue).get(t);
23449
+ let i = Iy(ue).get(t);
23454
23450
  if (i === void 0) return;
23455
- let a = Iy(S.rawRows, le, i), o = r.editor.delimiter;
23456
- Ke(e, yb(a, r.editor.options, o));
23451
+ let a = Ly(S.rawRows, le, i), o = r.editor.delimiter;
23452
+ Ke(e, bb(a, r.editor.options, o));
23457
23453
  }, [
23458
23454
  S,
23459
23455
  T,
@@ -23474,7 +23470,7 @@ function Lb() {
23474
23470
  for (let [r, i] of Object.entries(T)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
23475
23471
  return t;
23476
23472
  }, [T, n]), Xe = f(() => {
23477
- let e = new Set(H.map((e) => e.id)), t = hb(T, n, e), i = S ? Ry(S.rawRows, ue, le, 1e3) : [], a = tc(i, gb(t)), o = oc(i, Ye(e));
23473
+ let e = new Set(H.map((e) => e.id)), t = gb(T, n, e), i = S ? zy(S.rawRows, ue, le, 1e3) : [], a = tc(i, _b(t)), o = oc(i, Ye(e));
23478
23474
  return {
23479
23475
  columnMapping: T,
23480
23476
  valueMapping: We,
@@ -23515,7 +23511,7 @@ function Lb() {
23515
23511
  if (!S || !d?.onRowsImport) return;
23516
23512
  let t = S;
23517
23513
  w(null);
23518
- let r = crypto.randomUUID(), i = Xe(), a = new AbortController(), o = d.importChunkSize ?? Nb, s = hb(T, n, new Set(H.map((e) => e.id))), c = {
23514
+ let r = crypto.randomUUID(), i = Xe(), a = new AbortController(), o = d.importChunkSize ?? Pb, s = gb(T, n, new Set(H.map((e) => e.id))), c = {
23519
23515
  numberFormat: i.numberFormat,
23520
23516
  dateFormat: i.dateFormat,
23521
23517
  monthTable: ic(p),
@@ -23524,14 +23520,14 @@ function Lb() {
23524
23520
  }, l = ue, u = t.rawRows, f = [];
23525
23521
  for (let e = le; e < u.length; e++) {
23526
23522
  let t = u[e];
23527
- t && !Dy(t) && f.push(e);
23523
+ t && !Oy(t) && f.push(e);
23528
23524
  }
23529
23525
  let m = 0;
23530
23526
  for (; m < f.length;) {
23531
23527
  let e = Math.min(m + o, f.length), n = [];
23532
23528
  for (let t = m; t < e; t++) {
23533
- let e = Ly(u[f[t]] ?? [], l);
23534
- n.push(_b(e, s, c));
23529
+ let e = Ry(u[f[t]] ?? [], l);
23530
+ n.push(vb(e, s, c));
23535
23531
  }
23536
23532
  let p = e >= f.length, h = Math.floor(m / o);
23537
23533
  await d.onRowsImport({
@@ -23572,14 +23568,14 @@ function Lb() {
23572
23568
  H.length > 0 && u(H);
23573
23569
  for (let [t, n] of Object.entries(re)) e.addColumnOptions(t, n);
23574
23570
  let o = e.registerSource({ name: i.fileName });
23575
- e.setSourceLoading(o, !0), e.recordLearnedSynonyms(xb(T, We, [...n, ...H], Sv(xv, l)));
23571
+ e.setSourceLoading(o, !0), e.recordLearnedSynonyms(Sb(T, We, [...n, ...H], Sv(xv, l)));
23576
23572
  let s = ue, c = i.delimiter ?? ",", d = i.rawRows, f = [];
23577
23573
  for (let e = le; e < d.length; e++) {
23578
23574
  let t = d[e];
23579
- t && !Dy(t) && f.push(e);
23575
+ t && !Oy(t) && f.push(e);
23580
23576
  }
23581
- let m = Ry(i.rawRows, s, le, 1e3), h = hb(T, n, a), g = {
23582
- numberFormat: tc(m, gb(h)),
23577
+ let m = zy(i.rawRows, s, le, 1e3), h = gb(T, n, a), g = {
23578
+ numberFormat: tc(m, _b(h)),
23583
23579
  dateFormat: oc(m, Ye(a)),
23584
23580
  monthTable: ic(p),
23585
23581
  valueMapping: We,
@@ -23591,11 +23587,11 @@ function Lb() {
23591
23587
  title: e
23592
23588
  };
23593
23589
  }), v = 0, y = () => {
23594
- let n = Math.min(v + Nb, f.length), i = [], a = [];
23590
+ let n = Math.min(v + Pb, f.length), i = [], a = [];
23595
23591
  for (let e = v; e < n; e++) {
23596
- let t = d[f[e]] ?? [], n = Ly(t, s);
23592
+ let t = d[f[e]] ?? [], n = Ry(t, s);
23597
23593
  if (t.length !== s.length) {
23598
- let { cells: r, conflictColumns: i } = Mb(t.map((e) => String(e ?? "")), _, c);
23594
+ let { cells: r, conflictColumns: i } = Nb(t.map((e) => String(e ?? "")), _, c);
23599
23595
  if (r.length) {
23600
23596
  let e = {};
23601
23597
  for (let t = 0; t < s.length; t++) e[s[t]] = r[t] ?? "";
@@ -23613,10 +23609,10 @@ function Lb() {
23613
23609
  });
23614
23610
  }
23615
23611
  }
23616
- i.push(_b(n, h, g));
23612
+ i.push(vb(n, h, g));
23617
23613
  }
23618
23614
  let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: O ?? void 0 });
23619
- for (let e = v; e < n; e++) e < Fb || (d[f[e]] = void 0);
23615
+ for (let e = v; e < n; e++) e < Ib || (d[f[e]] = void 0);
23620
23616
  v = n, setTimeout(() => {
23621
23617
  t.validateRows(l, u);
23622
23618
  for (let { localIndex: t, columnIds: n } of a) {
@@ -23724,20 +23720,20 @@ function Lb() {
23724
23720
  }
23725
23721
  //#endregion
23726
23722
  //#region src/components/DataUploader/context/index.tsx
23727
- var Rb = s(null);
23728
- function zb({ children: e }) {
23729
- let t = Lb();
23730
- return /* @__PURE__ */ C(Rb.Provider, {
23723
+ var zb = s(null);
23724
+ function Bb({ children: e }) {
23725
+ let t = Rb();
23726
+ return /* @__PURE__ */ C(zb.Provider, {
23731
23727
  value: t,
23732
23728
  children: e
23733
23729
  });
23734
23730
  }
23735
- var Bb = () => {
23736
- let e = p(Rb);
23731
+ var Vb = () => {
23732
+ let e = p(zb);
23737
23733
  if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
23738
23734
  return e;
23739
- }, Vb = () => {
23740
- let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = Bb();
23735
+ }, Hb = () => {
23736
+ let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = Vb();
23741
23737
  return /* @__PURE__ */ C(co, {
23742
23738
  steps: e,
23743
23739
  activeStepIndex: t,
@@ -23745,79 +23741,79 @@ var Bb = () => {
23745
23741
  onStepChange: r,
23746
23742
  isProgressive: !0
23747
23743
  });
23748
- }, Hb = () => /* @__PURE__ */ C(zb, { children: /* @__PURE__ */ C(Vb, {}) }), Ub = {
23744
+ }, Ub = () => /* @__PURE__ */ C(Bb, { children: /* @__PURE__ */ C(Hb, {}) }), Wb = {
23749
23745
  kty: "EC",
23750
23746
  crv: "P-256",
23751
23747
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
23752
23748
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
23753
- }, Wb = "updog_license_grant", Gb = new Set([
23749
+ }, Gb = "updog_license_grant", Kb = new Set([
23754
23750
  "updog.tech",
23755
23751
  "landing.updog.tech",
23756
23752
  "demo.updog.tech"
23757
23753
  ]);
23758
- function Kb() {
23759
- return Gb.has(window.location.hostname);
23760
- }
23761
23754
  function qb() {
23762
- return !1;
23755
+ return Kb.has(window.location.hostname);
23763
23756
  }
23764
23757
  function Jb() {
23758
+ return !1;
23759
+ }
23760
+ function Yb() {
23765
23761
  return "https://api.updog.tech";
23766
23762
  }
23767
- function Yb(e) {
23763
+ function Xb(e) {
23768
23764
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
23769
23765
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
23770
23766
  return i;
23771
23767
  }
23772
- async function Xb(e) {
23768
+ async function Zb(e) {
23773
23769
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
23774
23770
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
23775
23771
  }
23776
- var Zb = null;
23777
- async function Qb() {
23778
- return Zb || (Zb = await crypto.subtle.importKey("jwk", Ub, {
23772
+ var Qb = null;
23773
+ async function $b() {
23774
+ return Qb || (Qb = await crypto.subtle.importKey("jwk", Wb, {
23779
23775
  name: "ECDSA",
23780
23776
  namedCurve: "P-256"
23781
- }, !1, ["verify"]), Zb);
23777
+ }, !1, ["verify"]), Qb);
23782
23778
  }
23783
- function $b() {
23779
+ function ex() {
23784
23780
  try {
23785
- return localStorage.getItem(Wb);
23781
+ return localStorage.getItem(Gb);
23786
23782
  } catch {
23787
23783
  return null;
23788
23784
  }
23789
23785
  }
23790
- function ex(e) {
23786
+ function tx(e) {
23791
23787
  try {
23792
- localStorage.setItem(Wb, e);
23788
+ localStorage.setItem(Gb, e);
23793
23789
  } catch {}
23794
23790
  }
23795
- function tx() {
23791
+ function nx() {
23796
23792
  try {
23797
- localStorage.removeItem(Wb);
23793
+ localStorage.removeItem(Gb);
23798
23794
  } catch {}
23799
23795
  }
23800
- async function nx(e, t, n) {
23796
+ async function rx(e, t, n) {
23801
23797
  let r = e.indexOf(".");
23802
23798
  if (r === -1) return !1;
23803
- let i = e.slice(0, r), a = e.slice(r + 1), o = Yb(i), s = Yb(a), c = await Qb();
23799
+ let i = e.slice(0, r), a = e.slice(r + 1), o = Xb(i), s = Xb(a), c = await $b();
23804
23800
  if (!await crypto.subtle.verify({
23805
23801
  name: "ECDSA",
23806
23802
  hash: "SHA-256"
23807
23803
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
23808
23804
  let l = JSON.parse(new TextDecoder().decode(o));
23809
23805
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
23810
- let u = await Xb(t);
23806
+ let u = await Zb(t);
23811
23807
  return !(l.key !== u || l.domain !== n);
23812
23808
  }
23813
- async function rx(e) {
23814
- let t = $b();
23809
+ async function ix(e) {
23810
+ let t = ex();
23815
23811
  if (!t) return {
23816
23812
  valid: !1,
23817
23813
  errorCode: "license.invalid"
23818
23814
  };
23819
23815
  try {
23820
- if (await nx(t, e, window.location.hostname.toLowerCase().trim())) return {
23816
+ if (await rx(t, e, window.location.hostname.toLowerCase().trim())) return {
23821
23817
  valid: !0,
23822
23818
  errorCode: null
23823
23819
  };
@@ -23827,23 +23823,23 @@ async function rx(e) {
23827
23823
  errorCode: "license.invalid"
23828
23824
  };
23829
23825
  }
23830
- async function ix(e, t = !0) {
23831
- if (Kb() || qb()) return {
23826
+ async function ax(e, t = !0) {
23827
+ if (qb() || Jb()) return {
23832
23828
  valid: !0,
23833
23829
  errorCode: null
23834
23830
  };
23835
- let n = Jb();
23831
+ let n = Yb();
23836
23832
  try {
23837
23833
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
23838
23834
  if (r.ok) {
23839
23835
  let e = await r.json();
23840
- return t && e.grant && ex(e.grant), {
23836
+ return t && e.grant && tx(e.grant), {
23841
23837
  valid: !0,
23842
23838
  errorCode: null
23843
23839
  };
23844
23840
  }
23845
23841
  if (r.status >= 400 && r.status < 500) {
23846
- t && tx();
23842
+ t && nx();
23847
23843
  try {
23848
23844
  return await r.json();
23849
23845
  } catch {
@@ -23855,7 +23851,7 @@ async function ix(e, t = !0) {
23855
23851
  }
23856
23852
  throw Error(`Server error: ${r.status}`);
23857
23853
  } catch {
23858
- return t ? rx(e) : {
23854
+ return t ? ix(e) : {
23859
23855
  valid: !1,
23860
23856
  errorCode: "license.invalid"
23861
23857
  };
@@ -23863,7 +23859,7 @@ async function ix(e, t = !0) {
23863
23859
  }
23864
23860
  //#endregion
23865
23861
  //#region src/hooks/useLicenseValidation.ts
23866
- function ax(e, t, n = !0) {
23862
+ function ox(e, t, n = !0) {
23867
23863
  let [r, i] = b({
23868
23864
  isValidating: t,
23869
23865
  isValid: !1,
@@ -23883,7 +23879,7 @@ function ax(e, t, n = !0) {
23883
23879
  isValidating: !0,
23884
23880
  isValid: !1,
23885
23881
  errorCode: null
23886
- }), ix(e, n).then((e) => {
23882
+ }), ax(e, n).then((e) => {
23887
23883
  r || i({
23888
23884
  isValidating: !1,
23889
23885
  isValid: e.valid,
@@ -23906,7 +23902,7 @@ function ax(e, t, n = !0) {
23906
23902
  }
23907
23903
  //#endregion
23908
23904
  //#region src/server/auth/AuthState.ts
23909
- var ox = class {
23905
+ var sx = class {
23910
23906
  token = null;
23911
23907
  get() {
23912
23908
  return this.token;
@@ -23917,13 +23913,13 @@ var ox = class {
23917
23913
  clear() {
23918
23914
  this.token = null;
23919
23915
  }
23920
- }, sx = class extends Error {
23916
+ }, cx = class extends Error {
23921
23917
  status;
23922
23918
  code;
23923
23919
  constructor(e) {
23924
23920
  super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
23925
23921
  }
23926
- }, cx = class {
23922
+ }, lx = class {
23927
23923
  baseUrl;
23928
23924
  apiKey;
23929
23925
  auth;
@@ -23953,7 +23949,7 @@ var ox = class {
23953
23949
  signal: r?.signal
23954
23950
  });
23955
23951
  } catch (e) {
23956
- this.notify(new sx({
23952
+ this.notify(new cx({
23957
23953
  status: 0,
23958
23954
  code: "network",
23959
23955
  message: e instanceof Error ? e.message : String(e)
@@ -23964,7 +23960,7 @@ var ox = class {
23964
23960
  try {
23965
23961
  e = await s.json();
23966
23962
  } catch {}
23967
- this.notify(new sx({
23963
+ this.notify(new cx({
23968
23964
  status: s.status,
23969
23965
  code: e.error ?? `http_${s.status}`,
23970
23966
  message: e.message ?? s.statusText
@@ -23975,23 +23971,23 @@ var ox = class {
23975
23971
  };
23976
23972
  //#endregion
23977
23973
  //#region src/server/endpoints/workspaces.ts
23978
- async function lx(e, t) {
23974
+ async function ux(e, t) {
23979
23975
  return e.post("/workspaces", {
23980
23976
  primaryKey: t.primaryKey,
23981
23977
  columns: t.columns
23982
23978
  }, { signal: t.signal });
23983
23979
  }
23984
- async function ux(e) {
23980
+ async function dx(e) {
23985
23981
  try {
23986
23982
  await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
23987
23983
  } catch (e) {
23988
- if (e instanceof sx && e.status === 404) return;
23984
+ if (e instanceof cx && e.status === 404) return;
23989
23985
  throw e;
23990
23986
  }
23991
23987
  }
23992
23988
  //#endregion
23993
23989
  //#region src/server/endpoints/query.ts
23994
- async function dx(e, t) {
23990
+ async function fx(e, t) {
23995
23991
  let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
23996
23992
  page: {
23997
23993
  limit: t.limit,
@@ -24009,12 +24005,12 @@ async function dx(e, t) {
24009
24005
  }
24010
24006
  //#endregion
24011
24007
  //#region src/server/ScaleClient.ts
24012
- var fx = class {
24008
+ var px = class {
24013
24009
  disposed = !1;
24014
24010
  constructor(e) {
24015
24011
  this.deps = e;
24016
24012
  }
24017
- onQuery = (e) => dx(this.deps, e);
24013
+ onQuery = (e) => fx(this.deps, e);
24018
24014
  onEdit = async (e) => ({
24019
24015
  rejected: !0,
24020
24016
  reason: "Edits are not yet supported in server mode (v0)."
@@ -24031,7 +24027,7 @@ var fx = class {
24031
24027
  pageSize = void 0;
24032
24028
  scrollSensitivity = void 0;
24033
24029
  dispose = async () => {
24034
- this.disposed || (this.disposed = !0, await ux({
24030
+ this.disposed || (this.disposed = !0, await dx({
24035
24031
  http: this.deps.http,
24036
24032
  workspaceId: this.deps.workspaceId
24037
24033
  }));
@@ -24039,25 +24035,25 @@ var fx = class {
24039
24035
  };
24040
24036
  //#endregion
24041
24037
  //#region src/server/createScaleClient.ts
24042
- async function px(e) {
24043
- let t = new ox(), n = new cx({
24038
+ async function mx(e) {
24039
+ let t = new sx(), n = new lx({
24044
24040
  baseUrl: e.url,
24045
24041
  apiKey: e.apiKey,
24046
24042
  auth: t,
24047
24043
  onDegraded: e.onDegraded
24048
- }), { workspaceId: r, accessToken: i } = await lx(n, {
24044
+ }), { workspaceId: r, accessToken: i } = await ux(n, {
24049
24045
  primaryKey: e.primaryKey,
24050
24046
  columns: e.columns,
24051
24047
  signal: e.signal
24052
24048
  });
24053
- return t.set(i), new fx({
24049
+ return t.set(i), new px({
24054
24050
  workspaceId: r,
24055
24051
  http: n
24056
24052
  });
24057
24053
  }
24058
24054
  //#endregion
24059
24055
  //#region src/server/errors.ts
24060
- function mx(e, t, n) {
24056
+ function hx(e, t, n) {
24061
24057
  return {
24062
24058
  code: e,
24063
24059
  message: t,
@@ -24067,7 +24063,7 @@ function mx(e, t, n) {
24067
24063
  }
24068
24064
  //#endregion
24069
24065
  //#region src/hooks/useScaleClient.ts
24070
- function hx(e) {
24066
+ function gx(e) {
24071
24067
  let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
24072
24068
  return m(() => {
24073
24069
  if (!e.enabled) {
@@ -24076,7 +24072,7 @@ function hx(e) {
24076
24072
  }
24077
24073
  n({ status: "bootstrapping" });
24078
24074
  let t = new AbortController(), a = null;
24079
- return px({
24075
+ return mx({
24080
24076
  url: e.url,
24081
24077
  apiKey: e.apiKey,
24082
24078
  primaryKey: i.current,
@@ -24085,7 +24081,7 @@ function hx(e) {
24085
24081
  onDegraded: (e) => {
24086
24082
  t.signal.aborted || n({
24087
24083
  status: "failed",
24088
- error: _x(e)
24084
+ error: vx(e)
24089
24085
  });
24090
24086
  }
24091
24087
  }).then((e) => {
@@ -24100,7 +24096,7 @@ function hx(e) {
24100
24096
  }).catch((e) => {
24101
24097
  t.signal.aborted || n({
24102
24098
  status: "failed",
24103
- error: gx(e)
24099
+ error: _x(e)
24104
24100
  });
24105
24101
  }), () => {
24106
24102
  t.abort(), a?.dispose().catch(() => {});
@@ -24111,30 +24107,30 @@ function hx(e) {
24111
24107
  e.apiKey
24112
24108
  ]), t;
24113
24109
  }
24114
- function gx(e) {
24115
- return e instanceof sx ? e.status === 401 ? mx(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? mx("scale.unreachable", e.message, e) : e.status >= 500 ? mx("scale.server_error", e.message, e) : mx("scale.bootstrap_failed", e.message, e) : mx("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
24116
- }
24117
24110
  function _x(e) {
24118
- return e.status === 0 ? mx("scale.unreachable", e.message, e) : e.status === 404 ? mx("scale.workspace_lost", e.message, e) : mx("scale.server_error", e.message, e);
24111
+ return e instanceof cx ? e.status === 401 ? hx(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? hx("scale.unreachable", e.message, e) : e.status >= 500 ? hx("scale.server_error", e.message, e) : hx("scale.bootstrap_failed", e.message, e) : hx("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
24112
+ }
24113
+ function vx(e) {
24114
+ return e.status === 0 ? hx("scale.unreachable", e.message, e) : e.status === 404 ? hx("scale.workspace_lost", e.message, e) : hx("scale.server_error", e.message, e);
24119
24115
  }
24120
24116
  //#endregion
24121
24117
  //#region src/index.tsx
24122
- function vx(e) {
24118
+ function yx(e) {
24123
24119
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
24124
24120
  }
24125
- function yx(e) {
24121
+ function bx(e) {
24126
24122
  let t = v(() => new Bo(e.onError), [e.onError]);
24127
24123
  return /* @__PURE__ */ C(yv, {
24128
24124
  errorHandler: t,
24129
24125
  children: /* @__PURE__ */ C(Wl, {
24130
24126
  ...e,
24131
24127
  errorHandler: t,
24132
- children: e.showUploader ? /* @__PURE__ */ C(Hb, {}) : /* @__PURE__ */ C(hv, {})
24128
+ children: e.showUploader ? /* @__PURE__ */ C(Ub, {}) : /* @__PURE__ */ C(hv, {})
24133
24129
  })
24134
24130
  });
24135
24131
  }
24136
- function bx(e) {
24137
- let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a = vx(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = ax(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = hx({
24132
+ function xx(e) {
24133
+ let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a = yx(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = ox(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = gx({
24138
24134
  enabled: !s && c && u,
24139
24135
  url: e.__server?.url ?? "",
24140
24136
  apiKey: e.apiKey,
@@ -24189,7 +24185,7 @@ function bx(e) {
24189
24185
  code: e,
24190
24186
  message: "License validation failed",
24191
24187
  source: "license"
24192
- } }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(_v, { error: d.error }) : /* @__PURE__ */ C(yx, { ...k }) : j(l ?? "license.invalid");
24188
+ } }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(_v, { error: d.error }) : /* @__PURE__ */ C(bx, { ...k }) : j(l ?? "license.invalid");
24193
24189
  return t === "inline" ? /* @__PURE__ */ C("div", {
24194
24190
  className: "updog__data-editor updog__data-editor-inline",
24195
24191
  dir: i,
@@ -24209,14 +24205,14 @@ function bx(e) {
24209
24205
  submitText: n("dataEditor.confirmClose.action")
24210
24206
  })] });
24211
24207
  }
24212
- function xx(e) {
24208
+ function Sx(e) {
24213
24209
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
24214
24210
  return /* @__PURE__ */ C(Zr, {
24215
24211
  translations: t,
24216
24212
  rtl: n,
24217
24213
  locale: r,
24218
- children: /* @__PURE__ */ C(bx, { ...a })
24214
+ children: /* @__PURE__ */ C(xx, { ...a })
24219
24215
  });
24220
24216
  }
24221
24217
  //#endregion
24222
- export { xx as DataEditor, ou as downloadExampleFile, su as exportDataEditor };
24218
+ export { Sx as DataEditor, ou as downloadExampleFile, su as exportDataEditor };