@universe-platform/ui 0.1.0-beta.33 → 0.1.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8402,9 +8402,10 @@ function TableBlock(props) {
8402
8402
  }
8403
8403
 
8404
8404
  // src/components/PlacementBlock/PlacementBlock.tsx
8405
- var import_react19 = require("react");
8405
+ var import_react20 = require("react");
8406
8406
  var import_ag_grid_react = require("ag-grid-react");
8407
8407
  var import_ag_grid_community = require("ag-grid-community");
8408
+ var import_lucide_react10 = require("lucide-react");
8408
8409
 
8409
8410
  // src/components/PlacementBlock/PlacementSettings.tsx
8410
8411
  var import_react18 = __toESM(require("react"));
@@ -8799,8 +8800,107 @@ var PlacementSettings = ({ config, onChange, tables }) => {
8799
8800
  ] });
8800
8801
  };
8801
8802
 
8802
- // src/components/PlacementBlock/PlacementBlock.tsx
8803
+ // src/components/PlacementBlock/PlacementRelationButtons.tsx
8804
+ var import_react19 = require("react");
8803
8805
  var import_jsx_runtime18 = require("react/jsx-runtime");
8806
+ var GROUP_COLORS = [
8807
+ { title: "bg-blue-600 text-white", active: "bg-blue-600 border-blue-600 text-white hover:bg-blue-700", count: "text-blue-700" },
8808
+ { title: "bg-violet-600 text-white", active: "bg-violet-600 border-violet-600 text-white hover:bg-violet-700", count: "text-violet-700" },
8809
+ { title: "bg-emerald-600 text-white", active: "bg-emerald-600 border-emerald-600 text-white hover:bg-emerald-700", count: "text-emerald-700" },
8810
+ { title: "bg-amber-500 text-white", active: "bg-amber-500 border-amber-500 text-white hover:bg-amber-600", count: "text-amber-700" },
8811
+ { title: "bg-rose-600 text-white", active: "bg-rose-600 border-rose-600 text-white hover:bg-rose-700", count: "text-rose-700" }
8812
+ ];
8813
+ var isRawObjectId2 = (s) => /^[0-9a-fA-F]{24}$/.test(s);
8814
+ function rowMatchesRelationFilter(row, colName, id) {
8815
+ var _a;
8816
+ return normalizeRelationValue((_a = row.data) == null ? void 0 : _a[colName]).includes(id);
8817
+ }
8818
+ var PlacementRelationButtons = ({
8819
+ columnNames,
8820
+ rows,
8821
+ filters,
8822
+ onFilterChange,
8823
+ relationOptions,
8824
+ className = ""
8825
+ }) => {
8826
+ const groups = (0, import_react19.useMemo)(() => {
8827
+ const activeEntries = Object.entries(filters).filter(([, v]) => v !== void 0 && v !== null && v !== "");
8828
+ return (columnNames || []).map((colName) => {
8829
+ var _a, _b, _c, _d;
8830
+ const otherEntries = activeEntries.filter(([name]) => name !== colName);
8831
+ const base = otherEntries.length === 0 ? rows : rows.filter((r) => otherEntries.every(([name, val]) => rowMatchesRelationFilter(r, name, val)));
8832
+ const counts = /* @__PURE__ */ new Map();
8833
+ for (const r of base) {
8834
+ new Set(normalizeRelationValue((_a = r.data) == null ? void 0 : _a[colName])).forEach((id) => counts.set(id, (counts.get(id) || 0) + 1));
8835
+ }
8836
+ const activeId = filters[colName] ? String(filters[colName]) : null;
8837
+ const labelById = /* @__PURE__ */ new Map();
8838
+ for (const opt of relationOptions[colName] || []) {
8839
+ const id = String((_c = (_b = opt == null ? void 0 : opt.id) != null ? _b : opt == null ? void 0 : opt._id) != null ? _c : "");
8840
+ const label = String((_d = opt == null ? void 0 : opt.label) != null ? _d : "").trim();
8841
+ if (id && label && !isRawObjectId2(label)) labelById.set(id, label);
8842
+ }
8843
+ const options = [];
8844
+ const ids = /* @__PURE__ */ new Set([...counts.keys(), ...activeId ? [activeId] : []]);
8845
+ ids.forEach((id) => {
8846
+ const label = labelById.get(id);
8847
+ if (!label) return;
8848
+ options.push({ id, label, count: counts.get(id) || 0 });
8849
+ });
8850
+ options.sort((a, b) => a.label.localeCompare(b.label, "he"));
8851
+ return { key: colName, title: colName, options, activeId };
8852
+ });
8853
+ }, [columnNames, rows, filters, relationOptions]);
8854
+ if (!columnNames || columnNames.length === 0) return null;
8855
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8856
+ "div",
8857
+ {
8858
+ className: `border-t border-slate-100 pt-3 ${className}`,
8859
+ "data-testid": "placement-relation-buttons",
8860
+ children: groups.every((g) => g.options.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "py-2 text-xs text-slate-400", children: "\u05D0\u05D9\u05DF \u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D4\u05E6\u05D2\u05D4 \u05D1\u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5" }) : (
8861
+ // כל עמודה במתחם נפרד: בשורה הראשונה הכותרת (תגית צבעונית), ומהשורה שמתחת הכפתורים
8862
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2.5", children: groups.map((group, gi) => {
8863
+ if (group.options.length === 0) return null;
8864
+ const color = GROUP_COLORS[gi % GROUP_COLORS.length];
8865
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "bg-white border border-slate-200 rounded-xl p-3 flex flex-col gap-2.5 shadow-2xs", children: [
8866
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2 pb-2 border-b border-slate-100", children: [
8867
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `px-2.5 py-0.5 rounded-md text-xs font-bold truncate ${color.title}`, title: group.title, children: group.title }),
8868
+ group.activeId && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8869
+ "button",
8870
+ {
8871
+ type: "button",
8872
+ onClick: () => onFilterChange(group.key, ""),
8873
+ className: "text-[11px] font-semibold text-rose-600 hover:text-rose-700 hover:underline cursor-pointer shrink-0",
8874
+ children: "\u05E0\u05E7\u05D4 \u05E1\u05D9\u05E0\u05D5\u05DF"
8875
+ }
8876
+ )
8877
+ ] }),
8878
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-wrap items-end gap-x-2 gap-y-2.5", children: group.options.map((opt) => {
8879
+ const active = group.activeId === opt.id;
8880
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col items-center gap-0.5", children: [
8881
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `text-[11px] font-bold leading-none ${active ? color.count : "text-slate-500"}`, children: opt.count }),
8882
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8883
+ "button",
8884
+ {
8885
+ type: "button",
8886
+ onClick: () => onFilterChange(group.key, active ? "" : opt.id),
8887
+ title: active ? "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D9\u05D8\u05D5\u05DC \u05D4\u05E1\u05D9\u05E0\u05D5\u05DF" : `\u05E1\u05E0\u05DF \u05DC\u05E4\u05D9: ${opt.label}`,
8888
+ "aria-pressed": active,
8889
+ className: `px-3 h-8 rounded-md border text-xs font-semibold whitespace-nowrap shadow-2xs transition-colors cursor-pointer ${active ? color.active : "bg-white border-slate-300 text-slate-700 hover:bg-slate-50 hover:border-slate-400"}`,
8890
+ children: opt.label
8891
+ }
8892
+ )
8893
+ ] }, opt.id);
8894
+ }) })
8895
+ ] }, group.key);
8896
+ }) })
8897
+ )
8898
+ }
8899
+ );
8900
+ };
8901
+
8902
+ // src/components/PlacementBlock/PlacementBlock.tsx
8903
+ var import_jsx_runtime19 = require("react/jsx-runtime");
8804
8904
  import_ag_grid_community.ModuleRegistry.registerModules([import_ag_grid_community.AllCommunityModule]);
8805
8905
  var FETCH_LIMIT = 1e3;
8806
8906
  function normalizeRows(records) {
@@ -8837,7 +8937,7 @@ var ColorDotRenderer = (props) => {
8837
8937
  const { statuses, defaultStatusId } = props;
8838
8938
  const status = statuses.find((c) => c.id === item.statusId) || statuses.find((c) => c.id === defaultStatusId) || statuses[0];
8839
8939
  if (!status) return null;
8840
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8940
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8841
8941
  "button",
8842
8942
  {
8843
8943
  type: "button",
@@ -8851,7 +8951,7 @@ var ColorDotRenderer = (props) => {
8851
8951
  };
8852
8952
  var CheckCellRenderer = (props) => {
8853
8953
  if (!props.data) return null;
8854
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8954
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8855
8955
  "input",
8856
8956
  {
8857
8957
  type: "checkbox",
@@ -8862,7 +8962,7 @@ var CheckCellRenderer = (props) => {
8862
8962
  }
8863
8963
  ) });
8864
8964
  };
8865
- var CheckHeader = (props) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8965
+ var CheckHeader = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8866
8966
  "input",
8867
8967
  {
8868
8968
  type: "checkbox",
@@ -8875,23 +8975,48 @@ var CheckHeader = (props) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div"
8875
8975
  "aria-label": "\u05D1\u05D7\u05D9\u05E8\u05EA \u05DB\u05DC \u05D4\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD"
8876
8976
  }
8877
8977
  ) });
8978
+ var RelationFilterHeader = (props) => {
8979
+ const btnRef = (0, import_react20.useRef)(null);
8980
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col items-center justify-center w-full min-w-0 leading-tight select-none", title: props.displayName, children: [
8981
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8982
+ "button",
8983
+ {
8984
+ ref: btnRef,
8985
+ type: "button",
8986
+ onMouseDown: (e) => e.stopPropagation(),
8987
+ onClick: (e) => {
8988
+ var _a;
8989
+ e.stopPropagation();
8990
+ e.preventDefault();
8991
+ const rect = (_a = btnRef.current) == null ? void 0 : _a.getBoundingClientRect();
8992
+ if (rect) props.onOpen(props.colName, rect);
8993
+ },
8994
+ className: `p-0.5 rounded transition-colors cursor-pointer mb-0.5 shrink-0 ${props.active ? "text-blue-600 bg-blue-100 hover:bg-blue-200" : "text-slate-400 hover:text-slate-600 hover:bg-slate-200/60"}`,
8995
+ title: props.active ? "\u05E1\u05D9\u05E0\u05D5\u05DF \u05E4\u05E2\u05D9\u05DC - \u05DC\u05D7\u05E5 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9" : "\u05E1\u05D9\u05E0\u05D5\u05DF \u05DC\u05E4\u05D9 \u05E2\u05DE\u05D5\u05D3\u05D4",
8996
+ "aria-label": `\u05E1\u05D9\u05E0\u05D5\u05DF \u05DC\u05E4\u05D9 ${props.displayName}`,
8997
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Filter, { className: "w-3 h-3" })
8998
+ }
8999
+ ),
9000
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate w-full text-center", children: props.displayName })
9001
+ ] });
9002
+ };
8878
9003
  var PlacementBlock = (props) => {
8879
9004
  var _a, _b;
8880
9005
  const { executeAction, fetchSourceData, fetchTargetData, updateAssignment, className = "" } = props;
8881
- const config = (0, import_react19.useMemo)(() => {
9006
+ const config = (0, import_react20.useMemo)(() => {
8882
9007
  var _a2, _b2, _c;
8883
9008
  const raw = (_a2 = props.config) != null ? _a2 : props.settings;
8884
9009
  if (!raw) return void 0;
8885
9010
  return ((_b2 = raw.config) == null ? void 0 : _b2.sourceTableId) || ((_c = raw.config) == null ? void 0 : _c.targetTableId) ? raw.config : raw;
8886
9011
  }, [props.config, props.settings]);
8887
- const statuses = (0, import_react19.useMemo)(
9012
+ const statuses = (0, import_react20.useMemo)(
8888
9013
  () => {
8889
9014
  var _a2;
8890
9015
  return ((_a2 = config == null ? void 0 : config.statusColors) == null ? void 0 : _a2.length) ? config.statusColors : DEFAULT_PLACEMENT_STATUS_COLORS;
8891
9016
  },
8892
9017
  [config == null ? void 0 : config.statusColors]
8893
9018
  );
8894
- const defaultStatusId = (0, import_react19.useMemo)(
9019
+ const defaultStatusId = (0, import_react20.useMemo)(
8895
9020
  () => resolveDefaultStatusId(statuses, config == null ? void 0 : config.defaultReturnStatusId),
8896
9021
  [statuses, config == null ? void 0 : config.defaultReturnStatusId]
8897
9022
  );
@@ -8899,27 +9024,31 @@ var PlacementBlock = (props) => {
8899
9024
  const targetTableId = config == null ? void 0 : config.targetTableId;
8900
9025
  const displayField = (config == null ? void 0 : config.sourceDisplayFieldId) || "name";
8901
9026
  const assignmentField = config == null ? void 0 : config.targetAssignmentFieldId;
8902
- const executeActionRef = (0, import_react19.useRef)(executeAction);
9027
+ const executeActionRef = (0, import_react20.useRef)(executeAction);
8903
9028
  executeActionRef.current = executeAction;
8904
- const legacyRef = (0, import_react19.useRef)({ fetchSourceData, fetchTargetData, updateAssignment });
9029
+ const legacyRef = (0, import_react20.useRef)({ fetchSourceData, fetchTargetData, updateAssignment });
8905
9030
  legacyRef.current = { fetchSourceData, fetchTargetData, updateAssignment };
8906
- const [sourceRows, setSourceRows] = (0, import_react19.useState)([]);
8907
- const [sourceColumns, setSourceColumns] = (0, import_react19.useState)([]);
8908
- const [targetRows, setTargetRows] = (0, import_react19.useState)([]);
8909
- const [targetColumns, setTargetColumns] = (0, import_react19.useState)([]);
8910
- const [targetRelOptions, setTargetRelOptions] = (0, import_react19.useState)({});
8911
- const [selectedTargetId, setSelectedTargetId] = (0, import_react19.useState)("");
8912
- const [candidateIds, setCandidateIds] = (0, import_react19.useState)([]);
8913
- const [checkedIds, setCheckedIds] = (0, import_react19.useState)([]);
8914
- const [isSaving, setIsSaving] = (0, import_react19.useState)(false);
8915
- const [sourceSearch, setSourceSearch] = (0, import_react19.useState)("");
8916
- const [candidateSearch, setCandidateSearch] = (0, import_react19.useState)("");
8917
- const [statusMap, setStatusMap] = (0, import_react19.useState)({});
8918
- const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
8919
- const [loadError, setLoadError] = (0, import_react19.useState)(null);
8920
- const [saveError, setSaveError] = (0, import_react19.useState)(null);
8921
- const [targetFilters, setTargetFilters] = (0, import_react19.useState)({});
8922
- const loadTable = (0, import_react19.useCallback)(async (tableId, kind) => {
9031
+ const [sourceRows, setSourceRows] = (0, import_react20.useState)([]);
9032
+ const [sourceColumns, setSourceColumns] = (0, import_react20.useState)([]);
9033
+ const [sourceRelOptions, setSourceRelOptions] = (0, import_react20.useState)({});
9034
+ const [sourceRelFilters, setSourceRelFilters] = (0, import_react20.useState)({});
9035
+ const [targetRows, setTargetRows] = (0, import_react20.useState)([]);
9036
+ const [targetColumns, setTargetColumns] = (0, import_react20.useState)([]);
9037
+ const [targetRelOptions, setTargetRelOptions] = (0, import_react20.useState)({});
9038
+ const [selectedTargetId, setSelectedTargetId] = (0, import_react20.useState)("");
9039
+ const [candidateIds, setCandidateIds] = (0, import_react20.useState)([]);
9040
+ const [checkedIds, setCheckedIds] = (0, import_react20.useState)([]);
9041
+ const [isSaving, setIsSaving] = (0, import_react20.useState)(false);
9042
+ const [sourceSearch, setSourceSearch] = (0, import_react20.useState)("");
9043
+ const [candidateSearch, setCandidateSearch] = (0, import_react20.useState)("");
9044
+ const [statusMap, setStatusMap] = (0, import_react20.useState)({});
9045
+ const [isLoading, setIsLoading] = (0, import_react20.useState)(false);
9046
+ const [loadError, setLoadError] = (0, import_react20.useState)(null);
9047
+ const [saveError, setSaveError] = (0, import_react20.useState)(null);
9048
+ const [colFilters, setColFilters] = (0, import_react20.useState)({ source: {}, cand: {} });
9049
+ const [filterPopover, setFilterPopover] = (0, import_react20.useState)(null);
9050
+ const [targetFilters, setTargetFilters] = (0, import_react20.useState)({});
9051
+ const loadTable = (0, import_react20.useCallback)(async (tableId, kind) => {
8923
9052
  const exec = executeActionRef.current;
8924
9053
  if (exec) {
8925
9054
  const res = await exec("FETCH_TABLE_DATA", { tableId, tableMetaId: tableId, limit: FETCH_LIMIT, skip: 0 });
@@ -8932,7 +9061,7 @@ var PlacementBlock = (props) => {
8932
9061
  }
8933
9062
  throw new Error("executeAction \u05DC\u05D0 \u05D4\u05D5\u05E2\u05D1\u05E8 \u05DC\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5");
8934
9063
  }, []);
8935
- (0, import_react19.useEffect)(() => {
9064
+ (0, import_react20.useEffect)(() => {
8936
9065
  if (!sourceTableId || !targetTableId) return;
8937
9066
  let cancelled = false;
8938
9067
  (async () => {
@@ -8946,6 +9075,7 @@ var PlacementBlock = (props) => {
8946
9075
  if (cancelled) return;
8947
9076
  setSourceRows(src.rows);
8948
9077
  setSourceColumns(src.columns);
9078
+ setSourceRelOptions(src.relationOptions || {});
8949
9079
  setTargetRows(tgt.rows);
8950
9080
  setTargetColumns(tgt.columns);
8951
9081
  setTargetRelOptions(tgt.relationOptions || {});
@@ -8959,7 +9089,7 @@ var PlacementBlock = (props) => {
8959
9089
  cancelled = true;
8960
9090
  };
8961
9091
  }, [sourceTableId, targetTableId, loadTable]);
8962
- const displayValue = (0, import_react19.useCallback)((col, val) => {
9092
+ const displayValue = (0, import_react20.useCallback)((col, val) => {
8963
9093
  var _a2, _b2, _c, _d, _e;
8964
9094
  let text2 = cellText(val);
8965
9095
  if (text2 && /^[a-fA-F0-9]{24}$/.test(text2)) {
@@ -8979,7 +9109,50 @@ var PlacementBlock = (props) => {
8979
9109
  }
8980
9110
  return text2;
8981
9111
  }, [targetRelOptions, targetRows, sourceRows]);
8982
- const filterColumns = (0, import_react19.useMemo)(() => {
9112
+ const relationLabelMaps = (0, import_react20.useMemo)(() => {
9113
+ const maps = {};
9114
+ Object.entries(sourceRelOptions || {}).forEach(([colName, opts]) => {
9115
+ const m = /* @__PURE__ */ new Map();
9116
+ (opts || []).forEach((o) => {
9117
+ var _a2, _b2, _c;
9118
+ const label = cellText((_b2 = (_a2 = o == null ? void 0 : o.label) != null ? _a2 : o == null ? void 0 : o.title) != null ? _b2 : o == null ? void 0 : o.name);
9119
+ if (label) m.set(String((_c = o.id) != null ? _c : o._id), label);
9120
+ });
9121
+ maps[colName] = m;
9122
+ });
9123
+ return maps;
9124
+ }, [sourceRelOptions]);
9125
+ const relationLabelsOf = (0, import_react20.useCallback)((row, colName) => {
9126
+ var _a2;
9127
+ const map = relationLabelMaps[colName];
9128
+ const ids = normalizeRelationValue((_a2 = row.data) == null ? void 0 : _a2[colName]);
9129
+ const labels = map ? ids.map((id) => map.get(String(id))).filter((l) => !!l) : [];
9130
+ if (labels.length) return labels;
9131
+ const txt = cellText(readColumnValue(row.data, colName));
9132
+ return txt && !/^[a-fA-F0-9]{24}$/.test(txt) ? txt.split(", ").filter(Boolean) : [];
9133
+ }, [relationLabelMaps]);
9134
+ const rowPassesColFilters = (0, import_react20.useCallback)((row, filters) => {
9135
+ return Object.entries(filters).every(([colName, f]) => {
9136
+ if (!f) return true;
9137
+ const labels = relationLabelsOf(row, colName);
9138
+ if (Array.isArray(f)) return f.length === 0 || labels.some((l) => f.includes(l));
9139
+ if (f.operator === "notIn") return !labels.some((l) => f.values.includes(l));
9140
+ return true;
9141
+ });
9142
+ }, [relationLabelsOf]);
9143
+ const setColFilter = (0, import_react20.useCallback)((grid, colName, payload) => {
9144
+ setColFilters((prev) => {
9145
+ const next = __spreadValues({}, prev[grid]);
9146
+ if (payload === void 0) delete next[colName];
9147
+ else next[colName] = payload;
9148
+ return __spreadProps(__spreadValues({}, prev), { [grid]: next });
9149
+ });
9150
+ }, []);
9151
+ const openColFilter = (0, import_react20.useCallback)((grid, colName, rect) => {
9152
+ setFilterPopover((cur) => cur && cur.grid === grid && cur.colName === colName ? null : { grid, colName, rect });
9153
+ }, []);
9154
+ const closeColFilter = (0, import_react20.useCallback)(() => setFilterPopover(null), []);
9155
+ const filterColumns = (0, import_react20.useMemo)(() => {
8983
9156
  const definedFilters = (config == null ? void 0 : config.filterFields) || [];
8984
9157
  const legacyFilters = [config == null ? void 0 : config.targetFilterField1Id, config == null ? void 0 : config.targetFilterField2Id].filter(Boolean);
8985
9158
  const fieldsToUse = definedFilters.length > 0 ? definedFilters : legacyFilters;
@@ -9005,7 +9178,7 @@ var PlacementBlock = (props) => {
9005
9178
  return targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)).slice(0, 3);
9006
9179
  }, [targetColumns, assignmentField, config]);
9007
9180
  const rawSelectorField = (config == null ? void 0 : config.targetSelectorFieldId) || (config == null ? void 0 : config.targetDisplayFieldId) || ((_a = filterColumns[0]) == null ? void 0 : _a.name) || "";
9008
- const selectorField = (0, import_react19.useMemo)(() => {
9181
+ const selectorField = (0, import_react20.useMemo)(() => {
9009
9182
  const { relationColumn } = parseColumnRef(rawSelectorField);
9010
9183
  if (relationColumn && !targetColumns.some((c) => c.name === rawSelectorField) && targetColumns.some((c) => {
9011
9184
  var _a2;
@@ -9015,7 +9188,7 @@ var PlacementBlock = (props) => {
9015
9188
  }
9016
9189
  return rawSelectorField;
9017
9190
  }, [rawSelectorField, targetColumns]);
9018
- const filteredTargetRows = (0, import_react19.useMemo)(() => {
9191
+ const filteredTargetRows = (0, import_react20.useMemo)(() => {
9019
9192
  return targetRows.filter((r) => {
9020
9193
  return filterColumns.every((col) => {
9021
9194
  const filterVal = targetFilters[col.name];
@@ -9024,7 +9197,7 @@ var PlacementBlock = (props) => {
9024
9197
  });
9025
9198
  });
9026
9199
  }, [targetRows, targetFilters, filterColumns, displayValue]);
9027
- (0, import_react19.useEffect)(() => {
9200
+ (0, import_react20.useEffect)(() => {
9028
9201
  if (filteredTargetRows.length > 0) {
9029
9202
  if (!selectedTargetId || !filteredTargetRows.some((r) => r.id === selectedTargetId)) {
9030
9203
  setSelectedTargetId(filteredTargetRows[0].id);
@@ -9033,11 +9206,11 @@ var PlacementBlock = (props) => {
9033
9206
  setSelectedTargetId("");
9034
9207
  }
9035
9208
  }, [filteredTargetRows, selectedTargetId]);
9036
- const assignmentColumn = (0, import_react19.useMemo)(() => targetColumns.find((c) => c.name === assignmentField), [targetColumns, assignmentField]);
9209
+ const assignmentColumn = (0, import_react20.useMemo)(() => targetColumns.find((c) => c.name === assignmentField), [targetColumns, assignmentField]);
9037
9210
  const isRelationField = ((_b = assignmentColumn == null ? void 0 : assignmentColumn.type) == null ? void 0 : _b.toUpperCase()) === "RELATION";
9038
9211
  const assignmentLabel = (assignmentColumn == null ? void 0 : assignmentColumn.label) || (assignmentColumn == null ? void 0 : assignmentColumn.name) || assignmentField || "";
9039
- const nameOf = (0, import_react19.useCallback)((row) => cellText(readColumnValue(row.data, displayField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD", [displayField]);
9040
- const assignedIds = (0, import_react19.useMemo)(() => {
9212
+ const nameOf = (0, import_react20.useCallback)((row) => cellText(readColumnValue(row.data, displayField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD", [displayField]);
9213
+ const assignedIds = (0, import_react20.useMemo)(() => {
9041
9214
  var _a2;
9042
9215
  const target = targetRows.find((r) => r.id === selectedTargetId);
9043
9216
  if (!target || !assignmentField) return [];
@@ -9051,22 +9224,36 @@ var PlacementBlock = (props) => {
9051
9224
  }).filter((id) => !!id && sourceRows.some((s) => s.id === id));
9052
9225
  return Array.from(new Set(ids));
9053
9226
  }, [selectedTargetId, targetRows, sourceRows, assignmentField, isRelationField, nameOf]);
9054
- const assignedIdsRef = (0, import_react19.useRef)(assignedIds);
9227
+ const assignedIdsRef = (0, import_react20.useRef)(assignedIds);
9055
9228
  assignedIdsRef.current = assignedIds;
9056
- (0, import_react19.useEffect)(() => {
9229
+ (0, import_react20.useEffect)(() => {
9057
9230
  setCandidateIds(assignedIdsRef.current);
9058
9231
  setCheckedIds(assignedIdsRef.current);
9059
9232
  }, [selectedTargetId, sourceRows]);
9060
- const toGridRow = (0, import_react19.useCallback)((r, checked = false) => __spreadProps(__spreadValues({}, r.data), { id: r.id, __label: nameOf(r), __checked: checked, statusId: statusMap[r.id] || defaultStatusId }), [nameOf, statusMap, defaultStatusId]);
9061
- const candidateGridData = (0, import_react19.useMemo)(() => {
9233
+ const toGridRow = (0, import_react20.useCallback)((r, checked = false) => __spreadProps(__spreadValues({}, r.data), { id: r.id, __label: nameOf(r), __checked: checked, statusId: statusMap[r.id] || defaultStatusId }), [nameOf, statusMap, defaultStatusId]);
9234
+ const candidateRows = (0, import_react20.useMemo)(() => candidateIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r), [candidateIds, sourceRows]);
9235
+ const candidateGridData = (0, import_react20.useMemo)(() => {
9062
9236
  const checked = new Set(checkedIds);
9063
- return candidateIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map((r) => toGridRow(r, checked.has(r.id)));
9064
- }, [candidateIds, checkedIds, sourceRows, toGridRow]);
9065
- const availableGridData = (0, import_react19.useMemo)(() => {
9237
+ return candidateRows.filter((r) => rowPassesColFilters(r, colFilters.cand)).map((r) => toGridRow(r, checked.has(r.id)));
9238
+ }, [candidateRows, checkedIds, toGridRow, rowPassesColFilters, colFilters.cand]);
9239
+ const availableRows = (0, import_react20.useMemo)(() => {
9066
9240
  const set = new Set(candidateIds);
9067
- return sourceRows.filter((r) => !set.has(r.id)).map((r) => toGridRow(r));
9068
- }, [candidateIds, sourceRows, toGridRow]);
9069
- const persistAssignment = (0, import_react19.useCallback)(async (nextIds) => {
9241
+ return sourceRows.filter((r) => !set.has(r.id));
9242
+ }, [candidateIds, sourceRows]);
9243
+ const relationButtonColumns = (0, import_react20.useMemo)(() => {
9244
+ const wanted = Array.isArray(config == null ? void 0 : config.relationButtonColumns) ? config.relationButtonColumns : [];
9245
+ return wanted.filter((name) => sourceColumns.some((c) => (c == null ? void 0 : c.name) === name && String(c == null ? void 0 : c.type).toUpperCase() === "RELATION"));
9246
+ }, [config, sourceColumns]);
9247
+ const hasRelationButtons = relationButtonColumns.length > 0;
9248
+ const handleRelationFilterChange = (0, import_react20.useCallback)((colName, id) => {
9249
+ setSourceRelFilters((prev) => __spreadProps(__spreadValues({}, prev), { [colName]: id }));
9250
+ }, []);
9251
+ const availableGridData = (0, import_react20.useMemo)(() => {
9252
+ const active = Object.entries(sourceRelFilters).filter(([name, v]) => !!v && relationButtonColumns.includes(name));
9253
+ const byButtons = active.length === 0 ? availableRows : availableRows.filter((r) => active.every(([name, v]) => rowMatchesRelationFilter(r, name, v)));
9254
+ return byButtons.filter((r) => rowPassesColFilters(r, colFilters.source)).map((r) => toGridRow(r));
9255
+ }, [availableRows, sourceRelFilters, relationButtonColumns, toGridRow, rowPassesColFilters, colFilters.source]);
9256
+ const persistAssignment = (0, import_react20.useCallback)(async (nextIds) => {
9070
9257
  const exec = executeActionRef.current;
9071
9258
  if (exec && targetTableId && assignmentField && selectedTargetId) {
9072
9259
  const value = isRelationField ? nextIds : nextIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", ");
@@ -9078,33 +9265,33 @@ var PlacementBlock = (props) => {
9078
9265
  for (const id of nextIds.filter((i) => !assignedIds.includes(i))) await legacyRef.current.updateAssignment(selectedTargetId, id);
9079
9266
  }
9080
9267
  }, [targetTableId, assignmentField, selectedTargetId, isRelationField, sourceRows, nameOf, assignedIds]);
9081
- const moveToCandidates = (0, import_react19.useCallback)((id) => {
9268
+ const moveToCandidates = (0, import_react20.useCallback)((id) => {
9082
9269
  setCandidateIds((prev) => prev.includes(id) ? prev : [...prev, id]);
9083
9270
  }, []);
9084
- const moveToSource = (0, import_react19.useCallback)((id) => {
9271
+ const moveToSource = (0, import_react20.useCallback)((id) => {
9085
9272
  setCandidateIds((prev) => prev.filter((x) => x !== id));
9086
9273
  setCheckedIds((prev) => prev.filter((x) => x !== id));
9087
9274
  setStatusMap((prev) => __spreadProps(__spreadValues({}, prev), { [id]: defaultStatusId }));
9088
9275
  }, [defaultStatusId]);
9089
- const moveToCandidatesRef = (0, import_react19.useRef)(moveToCandidates);
9276
+ const moveToCandidatesRef = (0, import_react20.useRef)(moveToCandidates);
9090
9277
  moveToCandidatesRef.current = moveToCandidates;
9091
- const moveToSourceRef = (0, import_react19.useRef)(moveToSource);
9278
+ const moveToSourceRef = (0, import_react20.useRef)(moveToSource);
9092
9279
  moveToSourceRef.current = moveToSource;
9093
- const toggleChecked = (0, import_react19.useCallback)((id) => {
9280
+ const toggleChecked = (0, import_react20.useCallback)((id) => {
9094
9281
  setCheckedIds((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]);
9095
9282
  }, []);
9096
9283
  const allChecked = candidateIds.length > 0 && candidateIds.every((id) => checkedIds.includes(id));
9097
9284
  const someChecked = candidateIds.some((id) => checkedIds.includes(id));
9098
- const toggleAll = (0, import_react19.useCallback)(() => {
9285
+ const toggleAll = (0, import_react20.useCallback)(() => {
9099
9286
  setCheckedIds(allChecked ? [] : [...candidateIds]);
9100
9287
  }, [allChecked, candidateIds]);
9101
- const returnAll = (0, import_react19.useCallback)(() => {
9288
+ const returnAll = (0, import_react20.useCallback)(() => {
9102
9289
  setCandidateIds([]);
9103
9290
  setCheckedIds([]);
9104
9291
  }, []);
9105
- const checkedCandidates = (0, import_react19.useMemo)(() => candidateIds.filter((id) => checkedIds.includes(id)), [candidateIds, checkedIds]);
9292
+ const checkedCandidates = (0, import_react20.useMemo)(() => candidateIds.filter((id) => checkedIds.includes(id)), [candidateIds, checkedIds]);
9106
9293
  const isDirty = checkedCandidates.length !== assignedIds.length || checkedCandidates.some((id) => !assignedIds.includes(id));
9107
- const submitAssignment = (0, import_react19.useCallback)(async () => {
9294
+ const submitAssignment = (0, import_react20.useCallback)(async () => {
9108
9295
  if (!selectedTargetId) {
9109
9296
  alert("\u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E7\u05D5\u05D3\u05DD \u05E8\u05E9\u05D5\u05DE\u05EA \u05D9\u05E2\u05D3 \u05DC\u05E4\u05E0\u05D9 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5");
9110
9297
  return;
@@ -9120,14 +9307,14 @@ var PlacementBlock = (props) => {
9120
9307
  setIsSaving(false);
9121
9308
  }
9122
9309
  }, [selectedTargetId, persistAssignment, checkedCandidates]);
9123
- const cycleStatus = (0, import_react19.useCallback)((recordId) => {
9310
+ const cycleStatus = (0, import_react20.useCallback)((recordId) => {
9124
9311
  setStatusMap((prev) => {
9125
9312
  const current = prev[recordId] || defaultStatusId;
9126
9313
  const idx = statuses.findIndex((c) => c.id === current);
9127
9314
  return __spreadProps(__spreadValues({}, prev), { [recordId]: statuses[(idx + 1) % statuses.length].id });
9128
9315
  });
9129
9316
  }, [statuses, defaultStatusId]);
9130
- const cancelAssignment = (0, import_react19.useCallback)(async () => {
9317
+ const cancelAssignment = (0, import_react20.useCallback)(async () => {
9131
9318
  if (!selectedTargetId || assignedIds.length === 0) return;
9132
9319
  if (!window.confirm(`\u05DC\u05D1\u05D8\u05DC \u05D0\u05EA \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5 \u05D5\u05DC\u05DE\u05D7\u05D5\u05E7 \u05D0\u05EA \u05D4\u05E0\u05EA\u05D5\u05DF \u05DE\u05E9\u05D3\u05D4 "${assignmentLabel}"?`)) return;
9133
9320
  const removed = new Set(assignedIds);
@@ -9143,7 +9330,8 @@ var PlacementBlock = (props) => {
9143
9330
  setIsSaving(false);
9144
9331
  }
9145
9332
  }, [selectedTargetId, assignedIds, assignmentLabel, persistAssignment]);
9146
- const makeColDefs = (0, import_react19.useCallback)((columns, fallbackName, withCheckbox = false) => {
9333
+ const makeColDefs = (0, import_react20.useCallback)((columns, fallbackName, grid, withCheckbox = false) => {
9334
+ const gridFilters = colFilters[grid];
9147
9335
  const defs = [];
9148
9336
  if (withCheckbox) {
9149
9337
  defs.push({
@@ -9173,21 +9361,50 @@ var PlacementBlock = (props) => {
9173
9361
  var _a2;
9174
9362
  return (_a2 = p.data) == null ? void 0 : _a2[displayField];
9175
9363
  }, valueFormatter: (p) => cellText(p.value), getQuickFilterText: (p) => cellText(p.value), rowDrag: true, flex: 1, minWidth: 120 });
9176
- ordered.forEach((c, i) => defs.push({ colId: c.name, field: c.name, headerName: c.label || c.name, valueGetter: (p) => readColumnValue(p.data, c.name), valueFormatter: (p) => displayValue(c, p.value), getQuickFilterText: (p) => cellText(displayValue(c, p.value)), rowDrag: !displayIsRelated && i === 0, flex: 1, minWidth: 120 }));
9364
+ ordered.forEach((c, i) => {
9365
+ const def = { colId: c.name, field: c.name, headerName: c.label || c.name, valueGetter: (p) => readColumnValue(p.data, c.name), valueFormatter: (p) => displayValue(c, p.value), getQuickFilterText: (p) => cellText(displayValue(c, p.value)), rowDrag: !displayIsRelated && i === 0, flex: 1, minWidth: 120 };
9366
+ if (String(c.type).toUpperCase() === "RELATION") {
9367
+ def.headerComponent = RelationFilterHeader;
9368
+ def.headerComponentParams = { colName: c.name, active: !!gridFilters[c.name], onOpen: (name, rect) => openColFilter(grid, name, rect) };
9369
+ }
9370
+ defs.push(def);
9371
+ });
9177
9372
  } else {
9178
9373
  defs.push({ field: "__label", headerName: fallbackName, rowDrag: true, flex: 1 });
9179
9374
  }
9180
9375
  return defs;
9181
- }, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked]);
9376
+ }, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked, colFilters, openColFilter]);
9182
9377
  const sourceHeader = displayField === "name" ? "\u05E9\u05DD" : columnRefLabel(displayField);
9183
- const sourceColDefs = (0, import_react19.useMemo)(() => makeColDefs(sourceColumns, sourceHeader), [makeColDefs, sourceColumns, sourceHeader]);
9184
- const candidateColDefs = (0, import_react19.useMemo)(() => makeColDefs(sourceColumns, sourceHeader, true), [makeColDefs, sourceColumns, sourceHeader]);
9185
- const getRowId = (0, import_react19.useCallback)((p) => p.data.id, []);
9186
- const sourceContainerRef = (0, import_react19.useRef)(null);
9187
- const assignedContainerRef = (0, import_react19.useRef)(null);
9188
- const [sourceApi, setSourceApi] = (0, import_react19.useState)(null);
9189
- const [assignedApi, setAssignedApi] = (0, import_react19.useState)(null);
9190
- (0, import_react19.useEffect)(() => {
9378
+ const sourceColDefs = (0, import_react20.useMemo)(() => makeColDefs(sourceColumns, sourceHeader, "source"), [makeColDefs, sourceColumns, sourceHeader]);
9379
+ const candidateColDefs = (0, import_react20.useMemo)(() => makeColDefs(sourceColumns, sourceHeader, "cand", true), [makeColDefs, sourceColumns, sourceHeader]);
9380
+ const defaultColDef = (0, import_react20.useMemo)(() => ({ resizable: true }), []);
9381
+ const scrollableColIds = (defs) => defs.filter((d) => !d.pinned).map((d) => {
9382
+ var _a2;
9383
+ return (_a2 = d.colId) != null ? _a2 : d.field;
9384
+ }).filter(Boolean);
9385
+ const expandColumns = (0, import_react20.useCallback)((api) => {
9386
+ api == null ? void 0 : api.sizeColumnsToFit();
9387
+ }, []);
9388
+ const shrinkColumns = (0, import_react20.useCallback)((api, defs) => {
9389
+ api == null ? void 0 : api.autoSizeColumns(scrollableColIds(defs));
9390
+ }, []);
9391
+ const popoverOptions = (0, import_react20.useMemo)(() => {
9392
+ if (!filterPopover) return [];
9393
+ const rows = filterPopover.grid === "source" ? availableRows : candidateRows;
9394
+ const set = /* @__PURE__ */ new Set();
9395
+ rows.forEach((r) => relationLabelsOf(r, filterPopover.colName).forEach((l) => set.add(l)));
9396
+ return Array.from(set).sort((a, b) => a.localeCompare(b, "he")).map((label) => ({ id: label, label }));
9397
+ }, [filterPopover, availableRows, candidateRows, relationLabelsOf]);
9398
+ const popoverColumn = (0, import_react20.useMemo)(
9399
+ () => filterPopover ? sourceColumns.find((c) => c.name === filterPopover.colName) : void 0,
9400
+ [filterPopover, sourceColumns]
9401
+ );
9402
+ const getRowId = (0, import_react20.useCallback)((p) => p.data.id, []);
9403
+ const sourceContainerRef = (0, import_react20.useRef)(null);
9404
+ const assignedContainerRef = (0, import_react20.useRef)(null);
9405
+ const [sourceApi, setSourceApi] = (0, import_react20.useState)(null);
9406
+ const [assignedApi, setAssignedApi] = (0, import_react20.useState)(null);
9407
+ (0, import_react20.useEffect)(() => {
9191
9408
  if (!sourceApi || !assignedApi) return;
9192
9409
  const toAssigned = { getContainer: () => assignedContainerRef.current, onDragStop: (p) => {
9193
9410
  var _a2, _b2;
@@ -9210,61 +9427,61 @@ var PlacementBlock = (props) => {
9210
9427
  }
9211
9428
  };
9212
9429
  }, [sourceApi, assignedApi]);
9213
- const selectorLabel = (0, import_react19.useMemo)(() => {
9430
+ const selectorLabel = (0, import_react20.useMemo)(() => {
9214
9431
  const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
9215
9432
  return (col == null ? void 0 : col.label) || columnRefLabel(selectorField) || "\u05D1\u05D7\u05D9\u05E8\u05EA \u05E8\u05E9\u05D5\u05DE\u05D4 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5";
9216
9433
  }, [targetColumns, selectorField]);
9217
- const assignedText = (0, import_react19.useMemo)(
9434
+ const assignedText = (0, import_react20.useMemo)(
9218
9435
  () => assignedIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", "),
9219
9436
  [assignedIds, sourceRows, nameOf]
9220
9437
  );
9221
9438
  const activeTarget = targetRows.find((r) => r.id === selectedTargetId);
9222
- const targetLabel = (0, import_react19.useCallback)((r) => {
9439
+ const targetLabel = (0, import_react20.useCallback)((r) => {
9223
9440
  const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
9224
9441
  return displayValue(col || { name: selectorField }, readColumnValue(r.data, selectorField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD";
9225
9442
  }, [selectorField, targetColumns, displayValue]);
9226
- const previewColumns = (0, import_react19.useMemo)(() => targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)), [targetColumns, assignmentField]);
9443
+ const previewColumns = (0, import_react20.useMemo)(() => targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)), [targetColumns, assignmentField]);
9227
9444
  if (!config || !sourceTableId || !targetTableId) {
9228
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "p-4 text-xs text-slate-500 border border-dashed border-slate-300 rounded-xl", dir: "rtl", children: "\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5 \u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8 (\u05D7\u05E1\u05E8\u05D5\u05EA \u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 / \u05D8\u05D1\u05DC\u05EA \u05D9\u05E2\u05D3)." });
9445
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-4 text-xs text-slate-500 border border-dashed border-slate-300 rounded-xl", dir: "rtl", children: "\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5 \u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8 (\u05D7\u05E1\u05E8\u05D5\u05EA \u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 / \u05D8\u05D1\u05DC\u05EA \u05D9\u05E2\u05D3)." });
9229
9446
  }
9230
9447
  const selectClass = "w-full p-2 border border-slate-300 rounded-lg text-xs font-medium text-slate-700 bg-slate-50 outline-none focus:border-brand";
9231
9448
  const labelClass = "block text-[11px] font-semibold text-slate-500 mb-1";
9232
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `w-full flex flex-col gap-4 p-4 bg-slate-50 min-h-[850px] rounded-xl border border-slate-200 ${className}`, dir: "rtl", children: [
9233
- (loadError || saveError) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "p-3 text-xs rounded-lg bg-rose-50 border border-rose-200 text-rose-700", children: loadError || saveError }),
9234
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4", children: [
9235
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "w-full lg:w-1/3 bg-teal-50/40 p-4 rounded-xl border border-teal-100 shadow-xs flex flex-col", children: [
9236
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h4", { className: "font-bold text-teal-900 border-b border-teal-200 pb-2 mb-3 text-sm flex items-center gap-2", children: [
9237
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u{1F4CC}" }),
9449
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `w-full flex flex-col gap-4 p-4 bg-slate-50 min-h-[850px] rounded-xl border border-slate-200 ${className}`, dir: "rtl", children: [
9450
+ (loadError || saveError) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-3 text-xs rounded-lg bg-rose-50 border border-rose-200 text-rose-700", children: loadError || saveError }),
9451
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4", children: [
9452
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w-full lg:w-1/2 bg-teal-50/40 p-4 rounded-xl border border-teal-100 shadow-xs flex flex-col", children: [
9453
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("h4", { className: "font-bold text-teal-900 border-b border-teal-200 pb-2 mb-3 text-base flex items-center gap-2", children: [
9454
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u{1F4CC}" }),
9238
9455
  " \u05E4\u05E8\u05D8\u05D9 \u05D4\u05D9\u05E2\u05D3 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5"
9239
9456
  ] }),
9240
- activeTarget ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2 text-xs text-slate-700 overflow-y-auto pr-1 max-h-32", children: [
9241
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "font-bold text-slate-900 text-sm mb-1", children: targetLabel(activeTarget) }),
9457
+ activeTarget ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3 content-start text-base text-slate-700 flex-1", children: [
9458
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "col-span-full font-bold text-slate-900 text-lg mb-1", children: targetLabel(activeTarget) }),
9242
9459
  previewColumns.map((col) => ({ col, text: displayValue(col, readColumnValue(activeTarget.data, col.name)) })).filter(({ col, text: text2 }) => {
9243
9460
  var _a2;
9244
9461
  return text2 && (col.type === "RELATION" || typeof ((_a2 = activeTarget.data) == null ? void 0 : _a2[col.name]) !== "object");
9245
- }).map(({ col, text: text2 }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2 items-start", children: [
9246
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-semibold shrink-0", children: [
9462
+ }).map(({ col, text: text2 }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex gap-2 items-start ${(col.label || col.name) === "\u05E4\u05E8\u05D8\u05D9\u05DD \u05E0\u05D5\u05E1\u05E4\u05D9\u05DD" ? "sm:col-span-2" : ""}`, children: [
9463
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-semibold shrink-0", children: [
9247
9464
  col.label || col.name,
9248
9465
  ":"
9249
9466
  ] }),
9250
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "break-words line-clamp-2", children: text2 })
9467
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "break-words", children: text2 })
9251
9468
  ] }, col.name)),
9252
- assignmentField && assignedText && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2 items-start", children: [
9253
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-semibold shrink-0", children: [
9469
+ assignmentField && assignedText && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-2 items-start", children: [
9470
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-semibold shrink-0", children: [
9254
9471
  assignmentLabel,
9255
9472
  ":"
9256
9473
  ] }),
9257
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "break-words line-clamp-2", title: assignedText, children: assignedText })
9474
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "break-words", title: assignedText, children: assignedText })
9258
9475
  ] }),
9259
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mt-3 pt-3 border-t border-teal-200/60 text-teal-800 font-bold", children: [
9476
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "col-span-full self-end mt-1 pt-1.5 border-t border-teal-200/60 text-teal-800 font-bold text-xs leading-none whitespace-nowrap overflow-hidden text-ellipsis", children: [
9260
9477
  "\u05DE\u05E9\u05D5\u05D1\u05E6\u05D9\u05DD \u05DB\u05E8\u05D2\u05E2: ",
9261
9478
  assignedIds.length
9262
9479
  ] })
9263
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-slate-500 text-xs text-center py-6", children: isLoading ? "\u05D8\u05D5\u05E2\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD..." : "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05E8\u05E9\u05D5\u05DE\u05EA \u05D9\u05E2\u05D3." })
9480
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-slate-500 text-xs text-center py-6", children: isLoading ? "\u05D8\u05D5\u05E2\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD..." : "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05E8\u05E9\u05D5\u05DE\u05EA \u05D9\u05E2\u05D3." })
9264
9481
  ] }),
9265
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full lg:w-2/3 bg-white p-4 rounded-xl border border-slate-200 shadow-xs flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
9266
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { className: "font-bold text-slate-800 mb-3 text-sm", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05D4\u05D9\u05E2\u05D3" }),
9267
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col sm:flex-row gap-3", children: [
9482
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full lg:w-1/2 bg-white p-4 rounded-xl border border-slate-200 shadow-xs flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
9483
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h4", { className: "font-bold text-slate-800 mb-3 text-sm", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05D4\u05D9\u05E2\u05D3" }),
9484
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col sm:flex-row gap-3", children: [
9268
9485
  filterColumns.map((col, index) => {
9269
9486
  const previousColumns = filterColumns.slice(0, index);
9270
9487
  const validRowsForThisFilter = targetRows.filter((r) => {
@@ -9277,9 +9494,9 @@ var PlacementBlock = (props) => {
9277
9494
  const uniqueValues = Array.from(new Set(
9278
9495
  validRowsForThisFilter.map((r) => displayValue(col, readColumnValue(r.data, col.name)))
9279
9496
  )).filter(Boolean).sort((a, b) => a.localeCompare(b, "he"));
9280
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
9281
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { className: labelClass, children: col.label || columnRefLabel(col.name) }),
9282
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
9497
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
9498
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: labelClass, children: col.label || columnRefLabel(col.name) }),
9499
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
9283
9500
  "select",
9284
9501
  {
9285
9502
  className: selectClass,
@@ -9295,64 +9512,93 @@ var PlacementBlock = (props) => {
9295
9512
  });
9296
9513
  },
9297
9514
  children: [
9298
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
9299
- uniqueValues.map((v) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: v, children: v }, v))
9515
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
9516
+ uniqueValues.map((v) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: v, children: v }, v))
9300
9517
  ]
9301
9518
  }
9302
9519
  )
9303
9520
  ] }, col.name);
9304
9521
  }),
9305
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
9306
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { className: labelClass, children: selectorLabel }),
9307
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { className: selectClass, value: selectedTargetId, onChange: (e) => setSelectedTargetId(e.target.value), children: [
9308
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("option", { value: "", children: [
9522
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
9523
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: labelClass, children: selectorLabel }),
9524
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { className: selectClass, value: selectedTargetId, onChange: (e) => setSelectedTargetId(e.target.value), children: [
9525
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: "", children: [
9309
9526
  "-- \u05D1\u05D7\u05E8 \u05DE\u05EA\u05D5\u05DA ",
9310
9527
  filteredTargetRows.length,
9311
9528
  " \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA --"
9312
9529
  ] }),
9313
- filteredTargetRows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: r.id, children: targetLabel(r) }, r.id))
9530
+ filteredTargetRows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: r.id, children: targetLabel(r) }, r.id))
9314
9531
  ] })
9315
9532
  ] })
9316
- ] })
9533
+ ] }),
9534
+ hasRelationButtons && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
9535
+ PlacementRelationButtons,
9536
+ {
9537
+ className: "mt-4 pb-24",
9538
+ columnNames: relationButtonColumns,
9539
+ rows: availableRows,
9540
+ filters: sourceRelFilters,
9541
+ onFilterChange: handleRelationFilterChange,
9542
+ relationOptions: sourceRelOptions
9543
+ }
9544
+ )
9317
9545
  ] }) })
9318
9546
  ] }),
9319
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col lg:flex-row w-full gap-4 h-[550px]", children: [
9320
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "w-full lg:w-1/2 flex flex-col border border-slate-200 rounded-xl shadow-xs bg-white overflow-hidden", children: [
9321
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "bg-slate-100 p-3 border-b border-slate-200 flex flex-col gap-2", children: [
9322
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between items-center font-bold text-slate-800 text-sm", children: [
9323
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
9547
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col lg:flex-row w-full gap-4 h-[550px]", children: [
9548
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `w-full ${hasRelationButtons ? "lg:flex-1 lg:min-w-0" : "lg:w-1/2"} flex flex-col border border-slate-200 rounded-xl shadow-xs bg-white overflow-hidden`, children: [
9549
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "bg-slate-100 p-3 border-b border-slate-200 flex flex-col gap-2", children: [
9550
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex justify-between items-center font-bold text-slate-800 text-sm", children: [
9551
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
9324
9552
  "\u05E8\u05E9\u05D9\u05DE\u05EA \u05DE\u05E7\u05D5\u05E8 (",
9325
9553
  availableGridData.length,
9326
9554
  ")"
9327
9555
  ] }),
9328
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] font-normal text-slate-500 bg-white px-2 py-0.5 rounded-full shadow-sm border border-slate-200", children: "\u05D2\u05E8\u05D5\u05E8 \u05E9\u05DE\u05D0\u05DC\u05D4 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 \u2190" })
9556
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
9557
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => shrinkColumns(sourceApi, sourceColDefs), title: "\u05E6\u05DE\u05E6\u05DD \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E4\u05D9 \u05D4\u05EA\u05D5\u05DB\u05DF", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-slate-200 text-slate-600 hover:bg-slate-50 cursor-pointer", children: "\u2192\u2190 \u05E6\u05DE\u05E6\u05DD" }),
9558
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => expandColumns(sourceApi), title: "\u05D4\u05E8\u05D7\u05D1 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E8\u05D5\u05D7\u05D1 \u05D4\u05D8\u05D1\u05DC\u05D4", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-slate-200 text-slate-600 hover:bg-slate-50 cursor-pointer", children: "\u2190\u2192 \u05D4\u05E8\u05D7\u05D1" }),
9559
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[11px] font-normal text-slate-500 bg-white px-2 py-0.5 rounded-full shadow-sm border border-slate-200", children: "\u05D2\u05E8\u05D5\u05E8 \u05E9\u05DE\u05D0\u05DC\u05D4 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 \u2190" })
9560
+ ] })
9329
9561
  ] }),
9330
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "search", value: sourceSearch, onChange: (e) => setSourceSearch(e.target.value), placeholder: "\u05E1\u05D9\u05E0\u05D5\u05DF...", className: "w-full p-2 border border-slate-300 rounded-lg text-xs bg-white outline-none focus:border-brand" })
9562
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "search", value: sourceSearch, onChange: (e) => setSourceSearch(e.target.value), placeholder: "\u05E1\u05D9\u05E0\u05D5\u05DF...", className: "w-full p-2 border border-slate-300 rounded-lg text-xs bg-white outline-none focus:border-brand" })
9331
9563
  ] }),
9332
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: sourceContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_ag_grid_react.AgGridReact, { rowData: availableGridData, columnDefs: sourceColDefs, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: sourceSearch, onGridReady: (e) => setSourceApi(e.api), loading: isLoading }) })
9564
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: sourceContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ag_grid_react.AgGridReact, { rowData: availableGridData, columnDefs: sourceColDefs, defaultColDef, headerHeight: 56, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: sourceSearch, onGridReady: (e) => setSourceApi(e.api), loading: isLoading }) })
9333
9565
  ] }),
9334
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "w-full lg:w-1/2 flex flex-col border border-blue-200 rounded-xl shadow-xs bg-white overflow-hidden ring-1 ring-blue-100", children: [
9335
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "bg-blue-50/80 p-3 border-b border-blue-100 flex flex-col gap-2", children: [
9336
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [
9337
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2 font-bold text-blue-900 text-sm", children: [
9338
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
9566
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `w-full ${hasRelationButtons ? "lg:flex-1 lg:min-w-0" : "lg:w-1/2"} flex flex-col border border-blue-200 rounded-xl shadow-xs bg-white overflow-hidden ring-1 ring-blue-100`, children: [
9567
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "bg-blue-50/80 p-3 border-b border-blue-100 flex flex-col gap-2", children: [
9568
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [
9569
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2 font-bold text-blue-900 text-sm", children: [
9570
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
9339
9571
  "\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 (",
9340
9572
  candidateGridData.length,
9341
9573
  ")"
9342
9574
  ] }),
9343
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] font-normal text-blue-700 bg-white px-2 py-0.5 rounded-full shadow-sm border border-blue-100", children: "\u2192 \u05D2\u05E8\u05D5\u05E8 \u05D9\u05DE\u05D9\u05E0\u05D4 \u05DC\u05D4\u05D7\u05D6\u05E8\u05D4" })
9575
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[11px] font-normal text-blue-700 bg-white px-2 py-0.5 rounded-full shadow-sm border border-blue-100", children: "\u2192 \u05D2\u05E8\u05D5\u05E8 \u05D9\u05DE\u05D9\u05E0\u05D4 \u05DC\u05D4\u05D7\u05D6\u05E8\u05D4" }),
9576
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => shrinkColumns(assignedApi, candidateColDefs), title: "\u05E6\u05DE\u05E6\u05DD \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E4\u05D9 \u05D4\u05EA\u05D5\u05DB\u05DF", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-blue-100 text-slate-600 hover:bg-blue-50 cursor-pointer", children: "\u2192\u2190 \u05E6\u05DE\u05E6\u05DD" }),
9577
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => expandColumns(assignedApi), title: "\u05D4\u05E8\u05D7\u05D1 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E8\u05D5\u05D7\u05D1 \u05D4\u05D8\u05D1\u05DC\u05D4", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-blue-100 text-slate-600 hover:bg-blue-50 cursor-pointer", children: "\u2190\u2192 \u05D4\u05E8\u05D7\u05D1" })
9344
9578
  ] }),
9345
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
9346
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: returnAll, disabled: candidateIds.length === 0, className: "px-3 py-1.5 rounded-lg text-xs font-bold bg-amber-400 hover:bg-amber-500 text-slate-900 disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: "\u21BA \u05D4\u05D7\u05D6\u05E8 \u05D4\u05DB\u05DC" }),
9347
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: submitAssignment, disabled: !selectedTargetId || !isDirty || isSaving, className: "px-4 py-1.5 rounded-lg text-xs font-bold bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: isSaving ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05D1\u05E5" }),
9348
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: cancelAssignment, disabled: !selectedTargetId || assignedIds.length === 0 || isSaving, className: "px-3 py-1.5 rounded-lg text-xs font-bold bg-white hover:bg-rose-50 text-rose-600 border border-rose-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: "\u05D1\u05D9\u05D8\u05D5\u05DC \u05E9\u05D9\u05D1\u05D5\u05E5" })
9579
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
9580
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: returnAll, disabled: candidateIds.length === 0, className: "px-3 py-1.5 rounded-lg text-xs font-bold bg-amber-400 hover:bg-amber-500 text-slate-900 disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: "\u21BA \u05D4\u05D7\u05D6\u05E8 \u05D4\u05DB\u05DC" }),
9581
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: submitAssignment, disabled: !selectedTargetId || !isDirty || isSaving, className: "px-4 py-1.5 rounded-lg text-xs font-bold bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: isSaving ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05D1\u05E5" }),
9582
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: cancelAssignment, disabled: !selectedTargetId || assignedIds.length === 0 || isSaving, className: "px-3 py-1.5 rounded-lg text-xs font-bold bg-white hover:bg-rose-50 text-rose-600 border border-rose-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: "\u05D1\u05D9\u05D8\u05D5\u05DC \u05E9\u05D9\u05D1\u05D5\u05E5" })
9349
9583
  ] })
9350
9584
  ] }),
9351
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "search", value: candidateSearch, onChange: (e) => setCandidateSearch(e.target.value), placeholder: "\u05E1\u05D9\u05E0\u05D5\u05DF...", className: "w-full p-2 border border-slate-300 rounded-lg text-xs bg-white outline-none focus:border-brand" })
9585
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "search", value: candidateSearch, onChange: (e) => setCandidateSearch(e.target.value), placeholder: "\u05E1\u05D9\u05E0\u05D5\u05DF...", className: "w-full p-2 border border-slate-300 rounded-lg text-xs bg-white outline-none focus:border-brand" })
9352
9586
  ] }),
9353
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: assignedContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_ag_grid_react.AgGridReact, { rowData: candidateGridData, columnDefs: candidateColDefs, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: candidateSearch, onGridReady: (e) => setAssignedApi(e.api), loading: isLoading }) })
9587
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: assignedContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ag_grid_react.AgGridReact, { rowData: candidateGridData, columnDefs: candidateColDefs, defaultColDef, headerHeight: 56, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: candidateSearch, onGridReady: (e) => setAssignedApi(e.api), loading: isLoading }) })
9354
9588
  ] })
9355
- ] })
9589
+ ] }),
9590
+ filterPopover && popoverColumn && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
9591
+ RelationFilterPopover,
9592
+ {
9593
+ isOpen: true,
9594
+ onClose: closeColFilter,
9595
+ column: popoverColumn,
9596
+ triggerRect: filterPopover.rect,
9597
+ options: popoverOptions,
9598
+ filterValue: colFilters[filterPopover.grid][filterPopover.colName],
9599
+ onSelectionChange: (payload) => setColFilter(filterPopover.grid, filterPopover.colName, payload)
9600
+ }
9601
+ )
9356
9602
  ] });
9357
9603
  };
9358
9604
 
@@ -9361,8 +9607,8 @@ var import_react26 = __toESM(require("react"));
9361
9607
  var import_lucide_react17 = require("lucide-react");
9362
9608
 
9363
9609
  // src/components/WhatsAppComponent/CreateTemplateModal.tsx
9364
- var import_react20 = require("react");
9365
- var import_lucide_react10 = require("lucide-react");
9610
+ var import_react21 = require("react");
9611
+ var import_lucide_react11 = require("lucide-react");
9366
9612
  var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
9367
9613
 
9368
9614
  // src/components/WhatsAppComponent/utils/templateModalHelpers.ts
@@ -9481,7 +9727,7 @@ function readFileAsBase64(file) {
9481
9727
  }
9482
9728
 
9483
9729
  // src/components/WhatsAppComponent/CreateTemplateModal.tsx
9484
- var import_jsx_runtime19 = require("react/jsx-runtime");
9730
+ var import_jsx_runtime20 = require("react/jsx-runtime");
9485
9731
  function CreateTemplateModal({
9486
9732
  isOpen,
9487
9733
  onClose,
@@ -9491,26 +9737,26 @@ function CreateTemplateModal({
9491
9737
  executeAction,
9492
9738
  orgId
9493
9739
  }) {
9494
- const [templateName, setTemplateName] = (0, import_react20.useState)("");
9495
- const [language, setLanguage] = (0, import_react20.useState)("he");
9496
- const [category, setCategory] = (0, import_react20.useState)("MARKETING");
9497
- const [bodyText, setBodyText] = (0, import_react20.useState)("");
9498
- const [variableSamples, setVariableSamples] = (0, import_react20.useState)({});
9499
- const [hasFileHeader, setHasFileHeader] = (0, import_react20.useState)(false);
9500
- const [selectedFile, setSelectedFile] = (0, import_react20.useState)(null);
9501
- const [fileBase64, setFileBase64] = (0, import_react20.useState)("");
9502
- const [buttons, setButtons] = (0, import_react20.useState)([]);
9503
- const [isAddButtonOpen, setIsAddButtonOpen] = (0, import_react20.useState)(false);
9504
- const addButtonDropdownRef = (0, import_react20.useRef)(null);
9505
- const [isSubmitting, setIsSubmitting] = (0, import_react20.useState)(false);
9506
- const [submittingStep, setSubmittingStep] = (0, import_react20.useState)("");
9507
- const [submitError, setSubmitError] = (0, import_react20.useState)(null);
9508
- const [fileError, setFileError] = (0, import_react20.useState)(null);
9509
- const textareaRef = (0, import_react20.useRef)(null);
9510
- const fileInputRef = (0, import_react20.useRef)(null);
9511
- const emojiPickerRef = (0, import_react20.useRef)(null);
9512
- const [isEmojiPickerOpen, setIsEmojiPickerOpen] = (0, import_react20.useState)(false);
9513
- (0, import_react20.useEffect)(() => {
9740
+ const [templateName, setTemplateName] = (0, import_react21.useState)("");
9741
+ const [language, setLanguage] = (0, import_react21.useState)("he");
9742
+ const [category, setCategory] = (0, import_react21.useState)("MARKETING");
9743
+ const [bodyText, setBodyText] = (0, import_react21.useState)("");
9744
+ const [variableSamples, setVariableSamples] = (0, import_react21.useState)({});
9745
+ const [hasFileHeader, setHasFileHeader] = (0, import_react21.useState)(false);
9746
+ const [selectedFile, setSelectedFile] = (0, import_react21.useState)(null);
9747
+ const [fileBase64, setFileBase64] = (0, import_react21.useState)("");
9748
+ const [buttons, setButtons] = (0, import_react21.useState)([]);
9749
+ const [isAddButtonOpen, setIsAddButtonOpen] = (0, import_react21.useState)(false);
9750
+ const addButtonDropdownRef = (0, import_react21.useRef)(null);
9751
+ const [isSubmitting, setIsSubmitting] = (0, import_react21.useState)(false);
9752
+ const [submittingStep, setSubmittingStep] = (0, import_react21.useState)("");
9753
+ const [submitError, setSubmitError] = (0, import_react21.useState)(null);
9754
+ const [fileError, setFileError] = (0, import_react21.useState)(null);
9755
+ const textareaRef = (0, import_react21.useRef)(null);
9756
+ const fileInputRef = (0, import_react21.useRef)(null);
9757
+ const emojiPickerRef = (0, import_react21.useRef)(null);
9758
+ const [isEmojiPickerOpen, setIsEmojiPickerOpen] = (0, import_react21.useState)(false);
9759
+ (0, import_react21.useEffect)(() => {
9514
9760
  function handleClickOutside(event) {
9515
9761
  if (emojiPickerRef.current && !emojiPickerRef.current.contains(event.target)) {
9516
9762
  setIsEmojiPickerOpen(false);
@@ -9534,7 +9780,7 @@ function CreateTemplateModal({
9534
9780
  document.removeEventListener("keydown", handleKeyDown2);
9535
9781
  };
9536
9782
  }, [isEmojiPickerOpen, isAddButtonOpen]);
9537
- (0, import_react20.useEffect)(() => {
9783
+ (0, import_react21.useEffect)(() => {
9538
9784
  if (isOpen) {
9539
9785
  setTemplateName("");
9540
9786
  setLanguage("he");
@@ -9553,10 +9799,10 @@ function CreateTemplateModal({
9553
9799
  setIsEmojiPickerOpen(false);
9554
9800
  }
9555
9801
  }, [isOpen]);
9556
- const uniqueVariables = (0, import_react20.useMemo)(() => {
9802
+ const uniqueVariables = (0, import_react21.useMemo)(() => {
9557
9803
  return extractUniqueVariableIndices(bodyText);
9558
9804
  }, [bodyText]);
9559
- (0, import_react20.useEffect)(() => {
9805
+ (0, import_react21.useEffect)(() => {
9560
9806
  setVariableSamples((prev) => {
9561
9807
  const next = {};
9562
9808
  uniqueVariables.forEach((idx) => {
@@ -9567,7 +9813,7 @@ function CreateTemplateModal({
9567
9813
  }, [uniqueVariables]);
9568
9814
  const isNameEmpty = templateName.trim().length === 0;
9569
9815
  const isNamePatternValid = isValidTemplateName(templateName);
9570
- const isNameDuplicate = (0, import_react20.useMemo)(() => {
9816
+ const isNameDuplicate = (0, import_react21.useMemo)(() => {
9571
9817
  const trimmedName = templateName.trim().toLowerCase();
9572
9818
  if (!trimmedName) return false;
9573
9819
  if (existingTemplates && existingTemplates.length > 0) {
@@ -9577,9 +9823,9 @@ function CreateTemplateModal({
9577
9823
  }
9578
9824
  return isDuplicateTemplateName(trimmedName, existingTemplateNames, language);
9579
9825
  }, [templateName, language, existingTemplates, existingTemplateNames]);
9580
- const ratioInfo = (0, import_react20.useMemo)(() => validateWordToVariableRatio(bodyText), [bodyText]);
9581
- const seqInfo = (0, import_react20.useMemo)(() => validateSequentialVariables(bodyText), [bodyText]);
9582
- const validationResult = (0, import_react20.useMemo)(() => {
9826
+ const ratioInfo = (0, import_react21.useMemo)(() => validateWordToVariableRatio(bodyText), [bodyText]);
9827
+ const seqInfo = (0, import_react21.useMemo)(() => validateSequentialVariables(bodyText), [bodyText]);
9828
+ const validationResult = (0, import_react21.useMemo)(() => {
9583
9829
  return validateWhatsAppTemplate({
9584
9830
  name: templateName,
9585
9831
  language,
@@ -9833,12 +10079,12 @@ function CreateTemplateModal({
9833
10079
  }
9834
10080
  };
9835
10081
  if (!isOpen) return null;
9836
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10082
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9837
10083
  "div",
9838
10084
  {
9839
10085
  className: "fixed inset-0 bg-slate-900/60 backdrop-blur-xs z-50 flex items-center justify-center p-4 overflow-y-auto animate-in fade-in duration-200",
9840
10086
  dir: "rtl",
9841
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10087
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
9842
10088
  "div",
9843
10089
  {
9844
10090
  className: "bg-white rounded-2xl border border-slate-200 shadow-2xl w-full max-w-2xl max-h-[92vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150",
@@ -9846,43 +10092,43 @@ function CreateTemplateModal({
9846
10092
  "aria-modal": "true",
9847
10093
  "aria-labelledby": "modal-title",
9848
10094
  children: [
9849
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
9850
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2.5", children: [
9851
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Plus, { className: "w-4 h-4" }) }),
9852
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
9853
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { id: "modal-title", className: "text-sm font-bold text-slate-900", children: "\u05D9\u05E6\u05D9\u05E8\u05EA \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4" }),
9854
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-slate-500", children: "\u05D4\u05D2\u05D3\u05E8\u05EA \u05EA\u05D5\u05DB\u05DF \u05D4\u05D5\u05D3\u05E2\u05D4 \u05D5\u05DE\u05E9\u05EA\u05E0\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta Cloud API" })
10095
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
10096
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2.5", children: [
10097
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Plus, { className: "w-4 h-4" }) }),
10098
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
10099
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { id: "modal-title", className: "text-sm font-bold text-slate-900", children: "\u05D9\u05E6\u05D9\u05E8\u05EA \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4" }),
10100
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs text-slate-500", children: "\u05D4\u05D2\u05D3\u05E8\u05EA \u05EA\u05D5\u05DB\u05DF \u05D4\u05D5\u05D3\u05E2\u05D4 \u05D5\u05DE\u05E9\u05EA\u05E0\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta Cloud API" })
9855
10101
  ] })
9856
10102
  ] }),
9857
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10103
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9858
10104
  "button",
9859
10105
  {
9860
10106
  type: "button",
9861
10107
  onClick: onClose,
9862
10108
  className: "p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer",
9863
10109
  "aria-label": "\u05E1\u05D2\u05D5\u05E8",
9864
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.X, { className: "w-5 h-5" })
10110
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.X, { className: "w-5 h-5" })
9865
10111
  }
9866
10112
  )
9867
10113
  ] }),
9868
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col overflow-hidden flex-1", children: [
9869
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-6 overflow-y-auto space-y-5 flex-1", children: [
9870
- submitError && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-800 flex items-center gap-2", children: [
9871
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
9872
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: submitError })
10114
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col overflow-hidden flex-1", children: [
10115
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-6 overflow-y-auto space-y-5 flex-1", children: [
10116
+ submitError && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-800 flex items-center gap-2", children: [
10117
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
10118
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: submitError })
9873
10119
  ] }),
9874
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1.5", children: [
9875
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
9876
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
10120
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
10121
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
10122
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
9877
10123
  "\u05E9\u05DD \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4 ",
9878
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10124
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
9879
10125
  ] }),
9880
- templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[11px] text-emerald-600 font-semibold flex items-center gap-1", children: [
9881
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.CheckCircle2, { className: "w-3.5 h-3.5" }),
10126
+ templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[11px] text-emerald-600 font-semibold flex items-center gap-1", children: [
10127
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.CheckCircle2, { className: "w-3.5 h-3.5" }),
9882
10128
  " \u05E9\u05DD \u05EA\u05E7\u05D9\u05DF"
9883
10129
  ] })
9884
10130
  ] }),
9885
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10131
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9886
10132
  "input",
9887
10133
  {
9888
10134
  type: "text",
@@ -9894,47 +10140,47 @@ function CreateTemplateModal({
9894
10140
  required: true
9895
10141
  }
9896
10142
  ),
9897
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-400 mt-1", children: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA \u05E7\u05D8\u05E0\u05D5\u05EA \u05D1\u05D0\u05E0\u05D2\u05DC\u05D9\u05EA, \u05DE\u05E1\u05E4\u05E8\u05D9\u05DD \u05D5\u05E7\u05D5\u05D5\u05D9\u05DD \u05EA\u05D7\u05EA\u05D5\u05E0\u05D9\u05DD \u05D1\u05DC\u05D1\u05D3." }),
9898
- !isNameEmpty && isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-rose-600 font-semibold flex items-center gap-1 mt-1", children: [
9899
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.AlertCircle, { className: "w-3.5 h-3.5 shrink-0" }),
10143
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400 mt-1", children: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA \u05E7\u05D8\u05E0\u05D5\u05EA \u05D1\u05D0\u05E0\u05D2\u05DC\u05D9\u05EA, \u05DE\u05E1\u05E4\u05E8\u05D9\u05DD \u05D5\u05E7\u05D5\u05D5\u05D9\u05DD \u05EA\u05D7\u05EA\u05D5\u05E0\u05D9\u05DD \u05D1\u05DC\u05D1\u05D3." }),
10144
+ !isNameEmpty && isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-[11px] text-rose-600 font-semibold flex items-center gap-1 mt-1", children: [
10145
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-3.5 h-3.5 shrink-0" }),
9900
10146
  "\u05E9\u05DD \u05D4\u05EA\u05D1\u05E0\u05D9\u05EA \u05DB\u05D1\u05E8 \u05E7\u05D9\u05D9\u05DD \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF \u05E2\u05D1\u05D5\u05E8 \u05E9\u05E4\u05D4 \u05D6\u05D5 (",
9901
10147
  language,
9902
10148
  "). \u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E9\u05DD \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05D0\u05D5 \u05E9\u05E4\u05D4 \u05D0\u05D7\u05E8\u05EA."
9903
10149
  ] })
9904
10150
  ] }),
9905
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
9906
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1.5", children: [
9907
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E9\u05E4\u05D4" }),
9908
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10151
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
10152
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
10153
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E9\u05E4\u05D4" }),
10154
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9909
10155
  "select",
9910
10156
  {
9911
10157
  value: language,
9912
10158
  onChange: (e) => setLanguage(e.target.value),
9913
10159
  className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
9914
- children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
10160
+ children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
9915
10161
  }
9916
10162
  )
9917
10163
  ] }),
9918
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1.5", children: [
9919
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E7\u05D8\u05D2\u05D5\u05E8\u05D9\u05D4" }),
9920
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10164
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
10165
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E7\u05D8\u05D2\u05D5\u05E8\u05D9\u05D4" }),
10166
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9921
10167
  "select",
9922
10168
  {
9923
10169
  value: category,
9924
10170
  onChange: (e) => setCategory(e.target.value),
9925
10171
  className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
9926
- children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
10172
+ children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
9927
10173
  }
9928
10174
  )
9929
10175
  ] })
9930
10176
  ] }),
9931
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-2", children: [
9932
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
10177
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-2", children: [
10178
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
9933
10179
  "\u05EA\u05D5\u05DB\u05DF \u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 ",
9934
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10180
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
9935
10181
  ] }),
9936
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "border border-slate-200 focus-within:border-emerald-500 focus-within:ring-1 focus-within:ring-emerald-500 rounded-xl overflow-visible bg-white transition-all shadow-xs relative", children: [
9937
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10182
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "border border-slate-200 focus-within:border-emerald-500 focus-within:ring-1 focus-within:ring-emerald-500 rounded-xl overflow-visible bg-white transition-all shadow-xs relative", children: [
10183
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9938
10184
  "textarea",
9939
10185
  {
9940
10186
  ref: textareaRef,
@@ -9949,14 +10195,14 @@ function CreateTemplateModal({
9949
10195
  required: true
9950
10196
  }
9951
10197
  ),
9952
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10198
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
9953
10199
  "div",
9954
10200
  {
9955
10201
  className: "bg-slate-50/90 border-t border-slate-100 px-3 py-1.5 flex items-center justify-between gap-2 select-none relative",
9956
10202
  dir: language === "en_US" ? "ltr" : "rtl",
9957
10203
  children: [
9958
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
9959
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10204
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
10205
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9960
10206
  "button",
9961
10207
  {
9962
10208
  type: "button",
@@ -9964,10 +10210,10 @@ function CreateTemplateModal({
9964
10210
  onClick: () => handleApplyFormatting("*"),
9965
10211
  title: "\u05DE\u05D5\u05D3\u05D2\u05E9 (Bold) *\u05D8\u05E7\u05E1\u05D8*",
9966
10212
  className: "w-7 h-7 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center justify-center font-bold text-xs transition-colors cursor-pointer",
9967
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Bold, { className: "w-3.5 h-3.5" })
10213
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Bold, { className: "w-3.5 h-3.5" })
9968
10214
  }
9969
10215
  ),
9970
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10216
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9971
10217
  "button",
9972
10218
  {
9973
10219
  type: "button",
@@ -9975,10 +10221,10 @@ function CreateTemplateModal({
9975
10221
  onClick: () => handleApplyFormatting("_"),
9976
10222
  title: "\u05E0\u05D8\u05D5\u05D9 (Italic) _\u05D8\u05E7\u05E1\u05D8_",
9977
10223
  className: "w-7 h-7 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center justify-center italic text-xs transition-colors cursor-pointer",
9978
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Italic, { className: "w-3.5 h-3.5" })
10224
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Italic, { className: "w-3.5 h-3.5" })
9979
10225
  }
9980
10226
  ),
9981
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10227
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9982
10228
  "button",
9983
10229
  {
9984
10230
  type: "button",
@@ -9986,12 +10232,12 @@ function CreateTemplateModal({
9986
10232
  onClick: () => handleApplyFormatting("~"),
9987
10233
  title: "\u05E7\u05D5 \u05D7\u05D5\u05E6\u05D4 (Strikethrough) ~\u05D8\u05E7\u05E1\u05D8~",
9988
10234
  className: "w-7 h-7 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center justify-center text-xs transition-colors cursor-pointer",
9989
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Strikethrough, { className: "w-3.5 h-3.5" })
10235
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Strikethrough, { className: "w-3.5 h-3.5" })
9990
10236
  }
9991
10237
  ),
9992
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
9993
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative inline-block", ref: emojiPickerRef, children: [
9994
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10238
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
10239
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative inline-block", ref: emojiPickerRef, children: [
10240
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9995
10241
  "button",
9996
10242
  {
9997
10243
  type: "button",
@@ -9999,16 +10245,16 @@ function CreateTemplateModal({
9999
10245
  onClick: () => setIsEmojiPickerOpen(!isEmojiPickerOpen),
10000
10246
  title: "\u05D4\u05D5\u05E1\u05E3 \u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9 (Emoji)",
10001
10247
  className: `w-7 h-7 rounded-lg flex items-center justify-center transition-colors cursor-pointer ${isEmojiPickerOpen ? "bg-emerald-100 text-emerald-700" : "text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80"}`,
10002
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Smile, { className: "w-4 h-4" })
10248
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Smile, { className: "w-4 h-4" })
10003
10249
  }
10004
10250
  ),
10005
- isEmojiPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10251
+ isEmojiPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10006
10252
  "div",
10007
10253
  {
10008
10254
  className: `absolute bottom-full mb-2 ${language === "en_US" ? "left-0" : "right-0"} z-50 shadow-2xl rounded-2xl overflow-hidden border border-slate-200 animate-in fade-in zoom-in-95 duration-100`,
10009
10255
  dir: "ltr",
10010
10256
  onMouseDown: (e) => e.stopPropagation(),
10011
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10257
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10012
10258
  import_emoji_picker_react.default,
10013
10259
  {
10014
10260
  onEmojiClick: (emojiData) => {
@@ -10025,8 +10271,8 @@ function CreateTemplateModal({
10025
10271
  }
10026
10272
  )
10027
10273
  ] }),
10028
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
10029
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10274
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
10275
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10030
10276
  "button",
10031
10277
  {
10032
10278
  type: "button",
@@ -10036,28 +10282,28 @@ function CreateTemplateModal({
10036
10282
  "aria-label": language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4",
10037
10283
  className: "h-7 px-2 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center gap-1 text-xs font-medium transition-colors cursor-pointer",
10038
10284
  children: [
10039
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Plus, { className: "w-3.5 h-3.5" }),
10040
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4" })
10285
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Plus, { className: "w-3.5 h-3.5" }),
10286
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4" })
10041
10287
  ]
10042
10288
  }
10043
10289
  )
10044
10290
  ] }),
10045
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10291
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10046
10292
  "div",
10047
10293
  {
10048
10294
  className: "flex items-center gap-1 font-mono text-[11px]",
10049
10295
  dir: "ltr",
10050
10296
  title: "\u05DE\u05D2\u05D1\u05DC\u05EA \u05EA\u05D5\u05D5\u05D9\u05DD (1024 \u05EA\u05D5\u05D5\u05D9\u05DD \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8)",
10051
10297
  children: [
10052
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10298
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10053
10299
  "span",
10054
10300
  {
10055
10301
  className: `font-semibold transition-colors ${bodyText.length >= 1024 ? "text-rose-600" : bodyText.length >= 950 ? "text-amber-600" : "text-slate-500"}`,
10056
10302
  children: bodyText.length
10057
10303
  }
10058
10304
  ),
10059
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-300", children: "/" }),
10060
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "1024" })
10305
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-300", children: "/" }),
10306
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "1024" })
10061
10307
  ]
10062
10308
  }
10063
10309
  )
@@ -10065,30 +10311,30 @@ function CreateTemplateModal({
10065
10311
  }
10066
10312
  )
10067
10313
  ] }),
10068
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-wrap items-center justify-between text-[11px] text-slate-400 px-1 gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3", children: [
10069
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
10314
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap items-center justify-between text-[11px] text-slate-400 px-1 gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-3", children: [
10315
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
10070
10316
  ratioInfo.staticWordsCount,
10071
10317
  " \u05DE\u05D9\u05DC\u05D9\u05DD"
10072
10318
  ] }),
10073
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
10319
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
10074
10320
  ratioInfo.variableCount,
10075
10321
  " \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
10076
10322
  ] })
10077
10323
  ] }) }),
10078
- uniqueVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
10079
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1.5 text-xs font-bold text-slate-800", children: [
10080
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Info, { className: "w-4 h-4 text-emerald-600" }),
10081
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D3\u05D5\u05D2\u05DE\u05D4 \u05DC\u05DE\u05E9\u05EA\u05E0\u05D9\u05DD (\u05D7\u05D5\u05D1\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta)" })
10324
+ uniqueVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
10325
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 text-xs font-bold text-slate-800", children: [
10326
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Info, { className: "w-4 h-4 text-emerald-600" }),
10327
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D3\u05D5\u05D2\u05DE\u05D4 \u05DC\u05DE\u05E9\u05EA\u05E0\u05D9\u05DD (\u05D7\u05D5\u05D1\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta)" })
10082
10328
  ] }),
10083
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-slate-500 leading-relaxed", children: "Meta \u05D3\u05D5\u05E8\u05E9\u05EA \u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 \u05DB\u05DC \u05DE\u05E9\u05EA\u05E0\u05D4 \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05DB\u05D3\u05D9 \u05DC\u05D5\u05D5\u05D3\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA \u05EA\u05D5\u05DB\u05DF." }),
10084
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1", children: uniqueVariables.map((idx) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10085
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "block text-[11px] font-semibold text-slate-700 font-mono", children: [
10329
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-slate-500 leading-relaxed", children: "Meta \u05D3\u05D5\u05E8\u05E9\u05EA \u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 \u05DB\u05DC \u05DE\u05E9\u05EA\u05E0\u05D4 \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05DB\u05D3\u05D9 \u05DC\u05D5\u05D5\u05D3\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA \u05EA\u05D5\u05DB\u05DF." }),
10330
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1", children: uniqueVariables.map((idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10331
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "block text-[11px] font-semibold text-slate-700 font-mono", children: [
10086
10332
  "\u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 ",
10087
10333
  `{{${idx}}}`,
10088
10334
  " ",
10089
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10335
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10090
10336
  ] }),
10091
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10337
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10092
10338
  "input",
10093
10339
  {
10094
10340
  type: "text",
@@ -10103,21 +10349,21 @@ function CreateTemplateModal({
10103
10349
  )
10104
10350
  ] }, idx)) })
10105
10351
  ] }),
10106
- bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-3.5 bg-amber-50 border border-amber-200 rounded-xl space-y-1.5 text-xs text-amber-900", children: [
10107
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1.5 font-bold", children: [
10108
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.AlertCircle, { className: "w-4 h-4 text-amber-600 shrink-0" }),
10109
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05D3\u05E8\u05D9\u05E9\u05D5\u05EA \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA Meta \u05DC\u05D7\u05E1\u05D9\u05DE\u05EA \u05E9\u05D2\u05D9\u05D0\u05D5\u05EA:" })
10352
+ bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-3.5 bg-amber-50 border border-amber-200 rounded-xl space-y-1.5 text-xs text-amber-900", children: [
10353
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 font-bold", children: [
10354
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-4 h-4 text-amber-600 shrink-0" }),
10355
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05D3\u05E8\u05D9\u05E9\u05D5\u05EA \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA Meta \u05DC\u05D7\u05E1\u05D9\u05DE\u05EA \u05E9\u05D2\u05D9\u05D0\u05D5\u05EA:" })
10110
10356
  ] }),
10111
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "list-disc list-inside space-y-1 text-[11px] pr-2 leading-relaxed", children: validationResult.errors.map((err, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("li", { children: err }, i)) })
10357
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "list-disc list-inside space-y-1 text-[11px] pr-2 leading-relaxed", children: validationResult.errors.map((err, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { children: err }, i)) })
10112
10358
  ] })
10113
10359
  ] }),
10114
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
10115
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
10116
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
10117
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Paperclip, { className: "w-4 h-4 text-slate-600" }),
10118
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: "modalHeaderFileCheckbox", className: "text-xs font-bold text-slate-800 cursor-pointer", children: "\u05E7\u05D5\u05D1\u05E5 \u05DB\u05D5\u05EA\u05E8\u05EA \u05DE\u05E6\u05D5\u05E8\u05E3 (\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
10360
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
10361
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
10362
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
10363
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Paperclip, { className: "w-4 h-4 text-slate-600" }),
10364
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { htmlFor: "modalHeaderFileCheckbox", className: "text-xs font-bold text-slate-800 cursor-pointer", children: "\u05E7\u05D5\u05D1\u05E5 \u05DB\u05D5\u05EA\u05E8\u05EA \u05DE\u05E6\u05D5\u05E8\u05E3 (\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
10119
10365
  ] }),
10120
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10366
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10121
10367
  "input",
10122
10368
  {
10123
10369
  type: "checkbox",
@@ -10133,12 +10379,12 @@ function CreateTemplateModal({
10133
10379
  }
10134
10380
  )
10135
10381
  ] }),
10136
- hasFileHeader && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-3 pt-1", children: [
10137
- fileError && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl flex items-center gap-2 text-xs text-rose-700 font-semibold animate-in fade-in duration-150", children: [
10138
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
10139
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: fileError })
10382
+ hasFileHeader && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-3 pt-1", children: [
10383
+ fileError && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl flex items-center gap-2 text-xs text-rose-700 font-semibold animate-in fade-in duration-150", children: [
10384
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
10385
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: fileError })
10140
10386
  ] }),
10141
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10387
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10142
10388
  "input",
10143
10389
  {
10144
10390
  ref: fileInputRef,
@@ -10148,7 +10394,7 @@ function CreateTemplateModal({
10148
10394
  className: "hidden"
10149
10395
  }
10150
10396
  ),
10151
- !selectedFile && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10397
+ !selectedFile && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10152
10398
  "button",
10153
10399
  {
10154
10400
  type: "button",
@@ -10158,49 +10404,49 @@ function CreateTemplateModal({
10158
10404
  },
10159
10405
  className: "w-full p-4 border-2 border-dashed border-slate-300 hover:border-emerald-500 rounded-xl flex flex-col items-center justify-center gap-2 bg-white hover:bg-emerald-50/30 transition-all cursor-pointer",
10160
10406
  children: [
10161
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-9 h-9 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Upload, { className: "w-4 h-4" }) }),
10162
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "text-center", children: [
10163
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs font-bold text-emerald-700 block", children: "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D7\u05D9\u05E8\u05EA \u05E7\u05D5\u05D1\u05E5" }),
10164
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[10px] text-slate-400", children: "PDF, JPG, PNG, MP4 \u05E2\u05D3 5MB" })
10407
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-9 h-9 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Upload, { className: "w-4 h-4" }) }),
10408
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "text-center", children: [
10409
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-bold text-emerald-700 block", children: "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D7\u05D9\u05E8\u05EA \u05E7\u05D5\u05D1\u05E5" }),
10410
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-400", children: "PDF, JPG, PNG, MP4 \u05E2\u05D3 5MB" })
10165
10411
  ] })
10166
10412
  ]
10167
10413
  }
10168
10414
  ),
10169
- selectedFile && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-3 bg-white border border-emerald-200 rounded-xl flex items-center justify-between gap-3 shadow-2xs", children: [
10170
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: [
10171
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-8 h-8 rounded-lg bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0", children: selectedFile.type.includes("pdf") || selectedFile.name.toLowerCase().endsWith(".pdf") ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.FileText, { className: "w-4 h-4" }) : selectedFile.type.includes("video") || selectedFile.name.toLowerCase().match(/\.(mp4|mov|avi|webm)$/) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Video, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Image, { className: "w-4 h-4" }) }),
10172
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "overflow-hidden", children: [
10173
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs font-bold text-slate-800 truncate", title: selectedFile.name, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { dir: "ltr", className: "inline-block truncate max-w-full", children: selectedFile.name }) }),
10174
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { dir: "ltr", className: "inline-block", children: [
10415
+ selectedFile && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-3 bg-white border border-emerald-200 rounded-xl flex items-center justify-between gap-3 shadow-2xs", children: [
10416
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: [
10417
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-8 h-8 rounded-lg bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0", children: selectedFile.type.includes("pdf") || selectedFile.name.toLowerCase().endsWith(".pdf") ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.FileText, { className: "w-4 h-4" }) : selectedFile.type.includes("video") || selectedFile.name.toLowerCase().match(/\.(mp4|mov|avi|webm)$/) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Video, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Image, { className: "w-4 h-4" }) }),
10418
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
10419
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-bold text-slate-800 truncate", title: selectedFile.name, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { dir: "ltr", className: "inline-block truncate max-w-full", children: selectedFile.name }) }),
10420
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { dir: "ltr", className: "inline-block", children: [
10175
10421
  formatFileSize(selectedFile.size),
10176
10422
  selectedFile.type ? ` \u2022 ${selectedFile.type}` : ""
10177
10423
  ] }) })
10178
10424
  ] })
10179
10425
  ] }),
10180
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10426
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10181
10427
  "button",
10182
10428
  {
10183
10429
  type: "button",
10184
10430
  onClick: handleRemoveFile,
10185
10431
  className: "p-1 text-slate-400 hover:text-rose-600 rounded-md transition-colors cursor-pointer",
10186
10432
  title: "\u05D4\u05E1\u05E8 \u05E7\u05D5\u05D1\u05E5",
10187
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Trash2, { className: "w-4 h-4" })
10433
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Trash2, { className: "w-4 h-4" })
10188
10434
  }
10189
10435
  )
10190
10436
  ] })
10191
10437
  ] })
10192
10438
  ] }),
10193
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3.5", children: [
10194
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
10195
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
10196
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.MousePointerClick, { className: "w-4 h-4 text-slate-600" }),
10197
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
10198
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs font-bold text-slate-800 block", children: "\u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD \u05D0\u05D9\u05E0\u05D8\u05E8\u05D0\u05E7\u05D8\u05D9\u05D1\u05D9\u05D9\u05DD (\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" }),
10199
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[10px] text-slate-400 block", children: "\u05D4\u05D5\u05E1\u05E4\u05EA \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05DC\u05E4\u05E2\u05D5\u05DC\u05D4 (CTA) \u05D5\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4 (\u05E2\u05D3 10 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD)" })
10439
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3.5", children: [
10440
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
10441
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
10442
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.MousePointerClick, { className: "w-4 h-4 text-slate-600" }),
10443
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
10444
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-bold text-slate-800 block", children: "\u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD \u05D0\u05D9\u05E0\u05D8\u05E8\u05D0\u05E7\u05D8\u05D9\u05D1\u05D9\u05D9\u05DD (\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" }),
10445
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-400 block", children: "\u05D4\u05D5\u05E1\u05E4\u05EA \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05DC\u05E4\u05E2\u05D5\u05DC\u05D4 (CTA) \u05D5\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4 (\u05E2\u05D3 10 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD)" })
10200
10446
  ] })
10201
10447
  ] }),
10202
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
10203
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10448
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
10449
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10204
10450
  "span",
10205
10451
  {
10206
10452
  className: `text-[10px] font-mono px-2 py-0.5 rounded-full border ${buttons.length >= 10 ? "bg-amber-50 text-amber-700 border-amber-200 font-bold" : "bg-white text-slate-500 border-slate-200"}`,
@@ -10210,8 +10456,8 @@ function CreateTemplateModal({
10210
10456
  ]
10211
10457
  }
10212
10458
  ),
10213
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", ref: addButtonDropdownRef, children: [
10214
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10459
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", ref: addButtonDropdownRef, children: [
10460
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10215
10461
  "button",
10216
10462
  {
10217
10463
  type: "button",
@@ -10220,10 +10466,10 @@ function CreateTemplateModal({
10220
10466
  className: `inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-xl border transition-all ${buttons.length >= 10 ? "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed opacity-60" : "bg-white text-emerald-700 border-emerald-200 hover:bg-emerald-50/80 active:scale-[0.98] shadow-2xs cursor-pointer"}`,
10221
10467
  title: buttons.length >= 10 ? "\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05D2\u05D1\u05DC\u05D4 \u05D4\u05DE\u05E8\u05D1\u05D9\u05EA \u05E9\u05DC 10 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD" : "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8 \u05D7\u05D3\u05E9",
10222
10468
  children: [
10223
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Plus, { className: "w-3.5 h-3.5" }),
10224
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" }),
10225
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10226
- import_lucide_react10.ChevronDown,
10469
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Plus, { className: "w-3.5 h-3.5" }),
10470
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" }),
10471
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10472
+ import_lucide_react11.ChevronDown,
10227
10473
  {
10228
10474
  className: `w-3.5 h-3.5 transition-transform ${isAddButtonOpen ? "rotate-180" : ""}`
10229
10475
  }
@@ -10231,63 +10477,63 @@ function CreateTemplateModal({
10231
10477
  ]
10232
10478
  }
10233
10479
  ),
10234
- isAddButtonOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "absolute top-full left-0 mt-1.5 w-64 bg-white border border-slate-200 rounded-xl shadow-xl z-30 p-1.5 space-y-1 animate-in fade-in-50 zoom-in-95 duration-100 divide-y divide-slate-100", children: [
10235
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10480
+ isAddButtonOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "absolute top-full left-0 mt-1.5 w-64 bg-white border border-slate-200 rounded-xl shadow-xl z-30 p-1.5 space-y-1 animate-in fade-in-50 zoom-in-95 duration-100 divide-y divide-slate-100", children: [
10481
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10236
10482
  "button",
10237
10483
  {
10238
10484
  type: "button",
10239
10485
  onClick: () => handleAddButton("QUICK_REPLY"),
10240
10486
  className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group",
10241
10487
  children: [
10242
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-7 h-7 rounded-md bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-emerald-100", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.MessageSquare, { className: "w-3.5 h-3.5" }) }),
10243
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
10244
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" }),
10245
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05DE\u05E2\u05E0\u05D4 \u05DE\u05D4\u05D9\u05E8 \u05D1\u05DC\u05D7\u05D9\u05E6\u05D4 \u05D0\u05D7\u05EA" })
10488
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-7 h-7 rounded-md bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-emerald-100", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.MessageSquare, { className: "w-3.5 h-3.5" }) }),
10489
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
10490
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" }),
10491
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05DE\u05E2\u05E0\u05D4 \u05DE\u05D4\u05D9\u05E8 \u05D1\u05DC\u05D7\u05D9\u05E6\u05D4 \u05D0\u05D7\u05EA" })
10246
10492
  ] })
10247
10493
  ]
10248
10494
  }
10249
10495
  ),
10250
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10496
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10251
10497
  "button",
10252
10498
  {
10253
10499
  type: "button",
10254
10500
  onClick: () => handleAddButton("URL"),
10255
10501
  className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group pt-2",
10256
10502
  children: [
10257
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-7 h-7 rounded-md bg-sky-50 text-sky-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-sky-100", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.ExternalLink, { className: "w-3.5 h-3.5" }) }),
10258
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
10259
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" }),
10260
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D0\u05D9\u05E0\u05D8\u05E8\u05E0\u05D8 \u05E1\u05D8\u05D8\u05D9" })
10503
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-7 h-7 rounded-md bg-sky-50 text-sky-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-sky-100", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.ExternalLink, { className: "w-3.5 h-3.5" }) }),
10504
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
10505
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" }),
10506
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D0\u05D9\u05E0\u05D8\u05E8\u05E0\u05D8 \u05E1\u05D8\u05D8\u05D9" })
10261
10507
  ] })
10262
10508
  ]
10263
10509
  }
10264
10510
  ),
10265
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10511
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10266
10512
  "button",
10267
10513
  {
10268
10514
  type: "button",
10269
10515
  onClick: () => handleAddButton("PHONE_NUMBER"),
10270
10516
  className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group pt-2",
10271
10517
  children: [
10272
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-7 h-7 rounded-md bg-violet-50 text-violet-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-violet-100", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Phone, { className: "w-3.5 h-3.5" }) }),
10273
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
10274
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" }),
10275
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05D7\u05D9\u05D5\u05D2 \u05D9\u05E9\u05D9\u05E8 \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF" })
10518
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-7 h-7 rounded-md bg-violet-50 text-violet-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-violet-100", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Phone, { className: "w-3.5 h-3.5" }) }),
10519
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
10520
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" }),
10521
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05D7\u05D9\u05D5\u05D2 \u05D9\u05E9\u05D9\u05E8 \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF" })
10276
10522
  ] })
10277
10523
  ]
10278
10524
  }
10279
10525
  ),
10280
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10526
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10281
10527
  "button",
10282
10528
  {
10283
10529
  type: "button",
10284
10530
  onClick: () => handleAddButton("COPY_CODE"),
10285
10531
  className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group pt-2",
10286
10532
  children: [
10287
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-7 h-7 rounded-md bg-amber-50 text-amber-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-amber-100", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Copy, { className: "w-3.5 h-3.5" }) }),
10288
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
10289
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" }),
10290
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3 \u05E7\u05D5\u05E4\u05D5\u05DF \u05DC\u05DC\u05D5\u05D7" })
10533
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-7 h-7 rounded-md bg-amber-50 text-amber-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-amber-100", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Copy, { className: "w-3.5 h-3.5" }) }),
10534
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
10535
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" }),
10536
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3 \u05E7\u05D5\u05E4\u05D5\u05DF \u05DC\u05DC\u05D5\u05D7" })
10291
10537
  ] })
10292
10538
  ]
10293
10539
  }
@@ -10296,55 +10542,55 @@ function CreateTemplateModal({
10296
10542
  ] })
10297
10543
  ] })
10298
10544
  ] }),
10299
- buttons.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-3 text-center border border-dashed border-slate-200 rounded-lg text-slate-400 text-xs bg-white/60", children: '\u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8\u05D5 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD. \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D5\u05E1\u05D9\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8 \u05E8\u05D0\u05E9\u05D5\u05DF \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA.' }),
10300
- buttons.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-2.5", children: buttons.map((btn, index) => {
10545
+ buttons.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "p-3 text-center border border-dashed border-slate-200 rounded-lg text-slate-400 text-xs bg-white/60", children: '\u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8\u05D5 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD. \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D5\u05E1\u05D9\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8 \u05E8\u05D0\u05E9\u05D5\u05DF \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA.' }),
10546
+ buttons.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-2.5", children: buttons.map((btn, index) => {
10301
10547
  const btnNum = index + 1;
10302
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10548
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10303
10549
  "div",
10304
10550
  {
10305
10551
  className: "p-3 bg-white border border-slate-200 rounded-xl space-y-2.5 shadow-2xs transition-all hover:border-slate-300",
10306
10552
  children: [
10307
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
10308
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
10309
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[11px] font-bold text-slate-400 font-mono", children: [
10553
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
10554
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
10555
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[11px] font-bold text-slate-400 font-mono", children: [
10310
10556
  "#",
10311
10557
  btnNum
10312
10558
  ] }),
10313
- btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-emerald-50 text-emerald-700 border border-emerald-200 text-[10px] font-semibold", children: [
10314
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.MessageSquare, { className: "w-3 h-3" }),
10315
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" })
10559
+ btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-emerald-50 text-emerald-700 border border-emerald-200 text-[10px] font-semibold", children: [
10560
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.MessageSquare, { className: "w-3 h-3" }),
10561
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" })
10316
10562
  ] }),
10317
- btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-sky-50 text-sky-700 border border-sky-200 text-[10px] font-semibold", children: [
10318
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.ExternalLink, { className: "w-3 h-3" }),
10319
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" })
10563
+ btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-sky-50 text-sky-700 border border-sky-200 text-[10px] font-semibold", children: [
10564
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.ExternalLink, { className: "w-3 h-3" }),
10565
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" })
10320
10566
  ] }),
10321
- btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-violet-50 text-violet-700 border border-violet-200 text-[10px] font-semibold", children: [
10322
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Phone, { className: "w-3 h-3" }),
10323
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" })
10567
+ btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-violet-50 text-violet-700 border border-violet-200 text-[10px] font-semibold", children: [
10568
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Phone, { className: "w-3 h-3" }),
10569
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" })
10324
10570
  ] }),
10325
- btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-amber-50 text-amber-700 border border-amber-200 text-[10px] font-semibold", children: [
10326
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Copy, { className: "w-3 h-3" }),
10327
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" })
10571
+ btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-amber-50 text-amber-700 border border-amber-200 text-[10px] font-semibold", children: [
10572
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Copy, { className: "w-3 h-3" }),
10573
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" })
10328
10574
  ] })
10329
10575
  ] }),
10330
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10576
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10331
10577
  "button",
10332
10578
  {
10333
10579
  type: "button",
10334
10580
  onClick: () => handleRemoveButton(index),
10335
10581
  className: "p-1 text-slate-400 hover:text-rose-600 hover:bg-rose-50 rounded-lg transition-colors cursor-pointer",
10336
10582
  title: "\u05D4\u05E1\u05E8 \u05DB\u05E4\u05EA\u05D5\u05E8",
10337
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Trash2, { className: "w-3.5 h-3.5" })
10583
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Trash2, { className: "w-3.5 h-3.5" })
10338
10584
  }
10339
10585
  )
10340
10586
  ] }),
10341
- btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10342
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10343
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10587
+ btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10588
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10589
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10344
10590
  "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
10345
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10591
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10346
10592
  ] }),
10347
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10593
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10348
10594
  "span",
10349
10595
  {
10350
10596
  className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
@@ -10355,7 +10601,7 @@ function CreateTemplateModal({
10355
10601
  }
10356
10602
  )
10357
10603
  ] }),
10358
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10604
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10359
10605
  "input",
10360
10606
  {
10361
10607
  type: "text",
@@ -10367,14 +10613,14 @@ function CreateTemplateModal({
10367
10613
  }
10368
10614
  )
10369
10615
  ] }),
10370
- btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
10371
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10372
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10373
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10616
+ btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
10617
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10618
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10619
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10374
10620
  "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
10375
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10621
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10376
10622
  ] }),
10377
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10623
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10378
10624
  "span",
10379
10625
  {
10380
10626
  className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
@@ -10385,7 +10631,7 @@ function CreateTemplateModal({
10385
10631
  }
10386
10632
  )
10387
10633
  ] }),
10388
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10634
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10389
10635
  "input",
10390
10636
  {
10391
10637
  type: "text",
@@ -10397,18 +10643,18 @@ function CreateTemplateModal({
10397
10643
  }
10398
10644
  )
10399
10645
  ] }),
10400
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10401
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10402
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10646
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10647
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10648
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10403
10649
  "\u05DB\u05EA\u05D5\u05D1\u05EA URL \u05E1\u05D8\u05D8\u05D9\u05EA ",
10404
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10650
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10405
10651
  ] }),
10406
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
10652
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
10407
10653
  (btn.url || "").length,
10408
10654
  "/2000"
10409
10655
  ] })
10410
10656
  ] }),
10411
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10657
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10412
10658
  "input",
10413
10659
  {
10414
10660
  type: "url",
@@ -10422,14 +10668,14 @@ function CreateTemplateModal({
10422
10668
  )
10423
10669
  ] })
10424
10670
  ] }),
10425
- btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
10426
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10427
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10428
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10671
+ btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
10672
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10673
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10674
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10429
10675
  "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
10430
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10676
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10431
10677
  ] }),
10432
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10678
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10433
10679
  "span",
10434
10680
  {
10435
10681
  className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
@@ -10440,7 +10686,7 @@ function CreateTemplateModal({
10440
10686
  }
10441
10687
  )
10442
10688
  ] }),
10443
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10689
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10444
10690
  "input",
10445
10691
  {
10446
10692
  type: "text",
@@ -10452,18 +10698,18 @@ function CreateTemplateModal({
10452
10698
  }
10453
10699
  )
10454
10700
  ] }),
10455
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10456
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10457
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10701
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10702
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10703
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10458
10704
  "\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF (\u05E4\u05D5\u05E8\u05DE\u05D8: +[\u05E7\u05D9\u05D3\u05D5\u05DE\u05EA][\u05DE\u05E1\u05E4\u05E8]) ",
10459
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10705
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10460
10706
  ] }),
10461
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
10707
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
10462
10708
  (btn.phone_number || "").length,
10463
10709
  "/20"
10464
10710
  ] })
10465
10711
  ] }),
10466
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10712
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10467
10713
  "input",
10468
10714
  {
10469
10715
  type: "tel",
@@ -10477,14 +10723,14 @@ function CreateTemplateModal({
10477
10723
  )
10478
10724
  ] })
10479
10725
  ] }),
10480
- btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
10481
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10482
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10483
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10726
+ btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
10727
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10728
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10729
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
10484
10730
  "\u05E7\u05D5\u05D3 \u05D4\u05E6\u05E2\u05D4 / \u05E7\u05D5\u05E4\u05D5\u05DF ",
10485
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-rose-500", children: "*" })
10731
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
10486
10732
  ] }),
10487
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
10733
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
10488
10734
  "span",
10489
10735
  {
10490
10736
  className: `font-mono text-[10px] ${(btn.example || "").length >= 15 ? "text-amber-600 font-bold" : "text-slate-400"}`,
@@ -10495,7 +10741,7 @@ function CreateTemplateModal({
10495
10741
  }
10496
10742
  )
10497
10743
  ] }),
10498
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10744
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10499
10745
  "input",
10500
10746
  {
10501
10747
  type: "text",
@@ -10508,15 +10754,15 @@ function CreateTemplateModal({
10508
10754
  }
10509
10755
  )
10510
10756
  ] }),
10511
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
10512
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10513
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "font-semibold text-slate-700", children: "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 (\u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC: \u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3)" }),
10514
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
10757
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
10758
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
10759
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "font-semibold text-slate-700", children: "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 (\u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC: \u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3)" }),
10760
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
10515
10761
  (btn.text || "").length,
10516
10762
  "/25"
10517
10763
  ] })
10518
10764
  ] }),
10519
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10765
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10520
10766
  "input",
10521
10767
  {
10522
10768
  type: "text",
@@ -10536,8 +10782,8 @@ function CreateTemplateModal({
10536
10782
  }) })
10537
10783
  ] })
10538
10784
  ] }),
10539
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "px-6 py-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-slate-50/50", children: [
10540
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10785
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "px-6 py-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-slate-50/50", children: [
10786
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10541
10787
  "button",
10542
10788
  {
10543
10789
  type: "button",
@@ -10547,19 +10793,19 @@ function CreateTemplateModal({
10547
10793
  children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
10548
10794
  }
10549
10795
  ),
10550
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
10796
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10551
10797
  "button",
10552
10798
  {
10553
10799
  type: "submit",
10554
10800
  disabled: !canSubmit,
10555
10801
  className: `inline-flex items-center gap-2 px-5 py-2 text-xs font-semibold text-white rounded-xl shadow-xs transition-all cursor-pointer active:scale-[0.98] ${canSubmit ? "bg-emerald-600 hover:bg-emerald-700" : "bg-slate-300 text-slate-500 cursor-not-allowed opacity-60"}`,
10556
10802
  title: !canSubmit ? fileError || validationResult.errors[0] || "\u05D9\u05E9 \u05DC\u05D4\u05E9\u05DC\u05D9\u05DD \u05D0\u05EA \u05DB\u05DC \u05E9\u05D3\u05D5\u05EA \u05D4\u05D7\u05D5\u05D1\u05D4 \u05D1\u05D0\u05D5\u05E4\u05DF \u05EA\u05E7\u05D9\u05DF" : "\u05E9\u05DC\u05D7 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta",
10557
- children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
10558
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Loader2, { className: "w-4 h-4 animate-spin" }),
10559
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: submittingStep || "\u05D9\u05D5\u05E6\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA..." })
10560
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
10561
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.CheckCircle2, { className: "w-4 h-4" }),
10562
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E9\u05DC\u05D7 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4" })
10803
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
10804
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Loader2, { className: "w-4 h-4 animate-spin" }),
10805
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: submittingStep || "\u05D9\u05D5\u05E6\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA..." })
10806
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
10807
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.CheckCircle2, { className: "w-4 h-4" }),
10808
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05E9\u05DC\u05D7 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4" })
10563
10809
  ] })
10564
10810
  }
10565
10811
  )
@@ -10573,11 +10819,11 @@ function CreateTemplateModal({
10573
10819
  }
10574
10820
 
10575
10821
  // src/components/WhatsAppComponent/hooks/useWhatsAppState.ts
10576
- var import_react21 = require("react");
10822
+ var import_react22 = require("react");
10577
10823
 
10578
10824
  // src/components/WhatsAppComponent/utils/recipientEngine.ts
10579
10825
  var STORAGE_KEY_TEST_PHONE = "whatsapp_test_phone";
10580
- function isRawObjectId2(str) {
10826
+ function isRawObjectId3(str) {
10581
10827
  if (typeof str !== "string") return false;
10582
10828
  const trimmed = str.trim();
10583
10829
  return /^[0-9a-fA-F]{24}$/.test(trimmed) || trimmed.startsWith("temp_");
@@ -10587,14 +10833,14 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
10587
10833
  if (!opt) return "";
10588
10834
  if (typeof opt === "string") {
10589
10835
  const trimmed = opt.trim();
10590
- if (!isRawObjectId2(trimmed)) return trimmed;
10836
+ if (!isRawObjectId3(trimmed)) return trimmed;
10591
10837
  if (allRelationOptions) {
10592
10838
  for (const list of Object.values(allRelationOptions)) {
10593
10839
  if (Array.isArray(list)) {
10594
10840
  const match = list.find((item) => ((item == null ? void 0 : item.id) || (item == null ? void 0 : item._id)) === trimmed);
10595
10841
  if (match) {
10596
10842
  const resolved = getRelationOptionLabel(match, colDef);
10597
- if (resolved && !isRawObjectId2(resolved)) {
10843
+ if (resolved && !isRawObjectId3(resolved)) {
10598
10844
  return resolved;
10599
10845
  }
10600
10846
  }
@@ -10607,11 +10853,11 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
10607
10853
  const displayField = (_a = colDef == null ? void 0 : colDef.config) == null ? void 0 : _a.displayField;
10608
10854
  if (displayField && opt.data && opt.data[displayField] !== void 0 && opt.data[displayField] !== null) {
10609
10855
  const val = String(opt.data[displayField]).trim();
10610
- if (val && !isRawObjectId2(val) && val !== rawId) return val;
10856
+ if (val && !isRawObjectId3(val) && val !== rawId) return val;
10611
10857
  }
10612
10858
  if (opt.label && typeof opt.label === "string") {
10613
10859
  const trimmed = opt.label.trim();
10614
- if (trimmed && !isRawObjectId2(trimmed) && trimmed !== rawId) {
10860
+ if (trimmed && !isRawObjectId3(trimmed) && trimmed !== rawId) {
10615
10861
  return trimmed;
10616
10862
  }
10617
10863
  }
@@ -10634,14 +10880,14 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
10634
10880
  const val = opt.data[key];
10635
10881
  if (val !== void 0 && val !== null) {
10636
10882
  const str = String(val).trim();
10637
- if (str && !isRawObjectId2(str) && str !== rawId) return str;
10883
+ if (str && !isRawObjectId3(str) && str !== rawId) return str;
10638
10884
  }
10639
10885
  }
10640
10886
  for (const [k, v] of Object.entries(opt.data)) {
10641
10887
  if (k.startsWith("_") || k.toLowerCase().endsWith("id") || k.toLowerCase() === "id") continue;
10642
10888
  if (v !== void 0 && v !== null) {
10643
10889
  const str = String(v).trim();
10644
- if (str && !isRawObjectId2(str) && str !== rawId) return str;
10890
+ if (str && !isRawObjectId3(str) && str !== rawId) return str;
10645
10891
  }
10646
10892
  }
10647
10893
  }
@@ -10650,7 +10896,7 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
10650
10896
  const val = opt[key];
10651
10897
  if (val !== void 0 && val !== null) {
10652
10898
  const str = String(val).trim();
10653
- if (str && !isRawObjectId2(str) && str !== rawId) return str;
10899
+ if (str && !isRawObjectId3(str) && str !== rawId) return str;
10654
10900
  }
10655
10901
  }
10656
10902
  if (opt.label && typeof opt.label === "string" && opt.label.trim()) {
@@ -11878,29 +12124,29 @@ function useWhatsAppState(props) {
11878
12124
  data: injectedData
11879
12125
  } = props;
11880
12126
  const orgId = props.orgId || props.organizationId || (settings == null ? void 0 : settings.orgId) || (settings == null ? void 0 : settings.organizationId) || (injectedData == null ? void 0 : injectedData.orgId) || (injectedData == null ? void 0 : injectedData.organizationId);
11881
- const [tableColumns2, setTableColumns] = (0, import_react21.useState)(() => {
12127
+ const [tableColumns2, setTableColumns] = (0, import_react22.useState)(() => {
11882
12128
  return Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
11883
12129
  });
11884
- const [rawRecords, setRawRecords] = (0, import_react21.useState)(() => {
12130
+ const [rawRecords, setRawRecords] = (0, import_react22.useState)(() => {
11885
12131
  if (Array.isArray(injectedData)) return injectedData;
11886
12132
  if (Array.isArray(injectedData == null ? void 0 : injectedData.records)) return injectedData.records;
11887
12133
  return [];
11888
12134
  });
11889
- const [relationOptions, setRelationOptions] = (0, import_react21.useState)(() => {
12135
+ const [relationOptions, setRelationOptions] = (0, import_react22.useState)(() => {
11890
12136
  return (injectedData == null ? void 0 : injectedData.relationOptions) || {};
11891
12137
  });
11892
- const [isLoadingTableData, setIsLoadingTableData] = (0, import_react21.useState)(() => Boolean(settings == null ? void 0 : settings.tableMetaId));
11893
- const [activeSubtableScans, setActiveSubtableScans] = (0, import_react21.useState)(0);
11894
- const [tableError, setTableError] = (0, import_react21.useState)(null);
11895
- const [filters, setFilters] = (0, import_react21.useState)({});
11896
- const [selectedRowIds, setSelectedRowIds] = (0, import_react21.useState)([]);
11897
- const [autoSelectCount, setAutoSelectCount] = (0, import_react21.useState)(null);
11898
- const isAutoSelectingRef = (0, import_react21.useRef)(false);
11899
- const isManualOverrideRef = (0, import_react21.useRef)(false);
11900
- const prevAutoSelectCountRef = (0, import_react21.useRef)(null);
11901
- const fetchedTableIdsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
11902
- const fullyFetchedRelationKeysRef = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
11903
- const loadTableData = (0, import_react21.useCallback)(async () => {
12138
+ const [isLoadingTableData, setIsLoadingTableData] = (0, import_react22.useState)(() => Boolean(settings == null ? void 0 : settings.tableMetaId));
12139
+ const [activeSubtableScans, setActiveSubtableScans] = (0, import_react22.useState)(0);
12140
+ const [tableError, setTableError] = (0, import_react22.useState)(null);
12141
+ const [filters, setFilters] = (0, import_react22.useState)({});
12142
+ const [selectedRowIds, setSelectedRowIds] = (0, import_react22.useState)([]);
12143
+ const [autoSelectCount, setAutoSelectCount] = (0, import_react22.useState)(null);
12144
+ const isAutoSelectingRef = (0, import_react22.useRef)(false);
12145
+ const isManualOverrideRef = (0, import_react22.useRef)(false);
12146
+ const prevAutoSelectCountRef = (0, import_react22.useRef)(null);
12147
+ const fetchedTableIdsRef = (0, import_react22.useRef)(/* @__PURE__ */ new Set());
12148
+ const fullyFetchedRelationKeysRef = (0, import_react22.useRef)(/* @__PURE__ */ new Set());
12149
+ const loadTableData = (0, import_react22.useCallback)(async () => {
11904
12150
  var _a2;
11905
12151
  const tableId = (settings == null ? void 0 : settings.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableId);
11906
12152
  if (!tableId || !executeAction) return;
@@ -11967,10 +12213,10 @@ function useWhatsAppState(props) {
11967
12213
  executeAction,
11968
12214
  orgId
11969
12215
  ]);
11970
- (0, import_react21.useEffect)(() => {
12216
+ (0, import_react22.useEffect)(() => {
11971
12217
  loadTableData();
11972
12218
  }, [loadTableData]);
11973
- const filterableColumns = (0, import_react21.useMemo)(() => {
12219
+ const filterableColumns = (0, import_react22.useMemo)(() => {
11974
12220
  return (tableColumns2 || []).filter((col) => {
11975
12221
  var _a2;
11976
12222
  if (!col || col.name === "_id" || col.id === "_id") return false;
@@ -11978,15 +12224,15 @@ function useWhatsAppState(props) {
11978
12224
  return type === "RELATION" || type === "BOOLEAN";
11979
12225
  });
11980
12226
  }, [tableColumns2]);
11981
- const [referencedTableSchemas, setReferencedTableSchemas] = (0, import_react21.useState)({});
11982
- const subtableCols = (0, import_react21.useMemo)(() => {
12227
+ const [referencedTableSchemas, setReferencedTableSchemas] = (0, import_react22.useState)({});
12228
+ const subtableCols = (0, import_react22.useMemo)(() => {
11983
12229
  return (tableColumns2 || []).filter((col) => {
11984
12230
  var _a2;
11985
12231
  const type = (_a2 = col.type) == null ? void 0 : _a2.toUpperCase();
11986
12232
  return type === "RELATION" || type === "SUB_TABLE" || type === "SUBTABLE";
11987
12233
  });
11988
12234
  }, [tableColumns2]);
11989
- (0, import_react21.useEffect)(() => {
12235
+ (0, import_react22.useEffect)(() => {
11990
12236
  if (!executeAction) return;
11991
12237
  const unrequestedCols = subtableCols.filter((col) => {
11992
12238
  var _a2;
@@ -12032,20 +12278,20 @@ function useWhatsAppState(props) {
12032
12278
  const isScanningPhoneColumns = Boolean(
12033
12279
  isLoadingTableData || activeSubtableScans > 0 || tableColumns2.length === 0 && Boolean(settings == null ? void 0 : settings.tableMetaId)
12034
12280
  );
12035
- const targetPhoneOptions = (0, import_react21.useMemo)(() => {
12281
+ const targetPhoneOptions = (0, import_react22.useMemo)(() => {
12036
12282
  const cols = tableColumns2 && tableColumns2.length > 0 ? tableColumns2 : Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
12037
12283
  return scanTargetPhoneOptions(cols, referencedTableSchemas);
12038
12284
  }, [tableColumns2, settings == null ? void 0 : settings.columns, referencedTableSchemas]);
12039
- const phoneColumns = (0, import_react21.useMemo)(() => {
12285
+ const phoneColumns = (0, import_react22.useMemo)(() => {
12040
12286
  return targetPhoneOptions.map((opt) => ({ name: opt.label, id: opt.id, type: "PHONE" }));
12041
12287
  }, [targetPhoneOptions]);
12042
- const [phoneColumnId, setPhoneColumnId] = (0, import_react21.useState)("");
12043
- const [subtableFilterColumn, setSubtableFilterColumn] = (0, import_react21.useState)("");
12044
- const [subtableFilterValue, setSubtableFilterValue] = (0, import_react21.useState)("");
12045
- const [subtableSendLimit, setSubtableSendLimit] = (0, import_react21.useState)(
12288
+ const [phoneColumnId, setPhoneColumnId] = (0, import_react22.useState)("");
12289
+ const [subtableFilterColumn, setSubtableFilterColumn] = (0, import_react22.useState)("");
12290
+ const [subtableFilterValue, setSubtableFilterValue] = (0, import_react22.useState)("");
12291
+ const [subtableSendLimit, setSubtableSendLimit] = (0, import_react22.useState)(
12046
12292
  (settings == null ? void 0 : settings.subtableSendLimit) || "PRIMARY"
12047
12293
  );
12048
- (0, import_react21.useEffect)(() => {
12294
+ (0, import_react22.useEffect)(() => {
12049
12295
  if (targetPhoneOptions.length > 0) {
12050
12296
  const isValid = targetPhoneOptions.some(
12051
12297
  (opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
@@ -12057,13 +12303,13 @@ function useWhatsAppState(props) {
12057
12303
  setPhoneColumnId("");
12058
12304
  }
12059
12305
  }, [targetPhoneOptions, phoneColumnId]);
12060
- const selectedPhoneOption = (0, import_react21.useMemo)(() => {
12306
+ const selectedPhoneOption = (0, import_react22.useMemo)(() => {
12061
12307
  if (!phoneColumnId) return targetPhoneOptions[0] || null;
12062
12308
  return targetPhoneOptions.find(
12063
12309
  (opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
12064
12310
  ) || targetPhoneOptions[0] || null;
12065
12311
  }, [targetPhoneOptions, phoneColumnId]);
12066
- const subtableFilterableColumns = (0, import_react21.useMemo)(() => {
12312
+ const subtableFilterableColumns = (0, import_react22.useMemo)(() => {
12067
12313
  var _a2, _b2, _c;
12068
12314
  if (!selectedPhoneOption || selectedPhoneOption.type !== "SUBTABLE") {
12069
12315
  return [];
@@ -12082,14 +12328,14 @@ function useWhatsAppState(props) {
12082
12328
  return type === "BOOLEAN" || type === "RELATION";
12083
12329
  });
12084
12330
  }, [selectedPhoneOption, referencedTableSchemas, tableColumns2]);
12085
- const selectedSubtableFilterCol = (0, import_react21.useMemo)(() => {
12331
+ const selectedSubtableFilterCol = (0, import_react22.useMemo)(() => {
12086
12332
  return subtableFilterableColumns.find((c) => c.name === subtableFilterColumn);
12087
12333
  }, [subtableFilterableColumns, subtableFilterColumn]);
12088
- const [enablePostSendAction, setEnablePostSendAction] = (0, import_react21.useState)(false);
12089
- const [postSendActionColumn, setPostSendActionColumn] = (0, import_react21.useState)("");
12090
- const [postSendActionValue, setPostSendActionValue] = (0, import_react21.useState)("");
12091
- const [postSendActionTargetType, setPostSendActionTargetType] = (0, import_react21.useState)("MAIN");
12092
- const postSendActionTargetOptions = (0, import_react21.useMemo)(() => {
12334
+ const [enablePostSendAction, setEnablePostSendAction] = (0, import_react22.useState)(false);
12335
+ const [postSendActionColumn, setPostSendActionColumn] = (0, import_react22.useState)("");
12336
+ const [postSendActionValue, setPostSendActionValue] = (0, import_react22.useState)("");
12337
+ const [postSendActionTargetType, setPostSendActionTargetType] = (0, import_react22.useState)("MAIN");
12338
+ const postSendActionTargetOptions = (0, import_react22.useMemo)(() => {
12093
12339
  var _a2, _b2, _c;
12094
12340
  const options = [];
12095
12341
  (tableColumns2 || []).forEach((col) => {
@@ -12134,14 +12380,14 @@ function useWhatsAppState(props) {
12134
12380
  }
12135
12381
  return options;
12136
12382
  }, [tableColumns2, selectedPhoneOption, referencedTableSchemas]);
12137
- const selectedPostSendOption = (0, import_react21.useMemo)(() => {
12383
+ const selectedPostSendOption = (0, import_react22.useMemo)(() => {
12138
12384
  return postSendActionTargetOptions.find(
12139
12385
  (opt) => opt.id === postSendActionColumn || opt.columnName === postSendActionColumn
12140
12386
  );
12141
12387
  }, [postSendActionTargetOptions, postSendActionColumn]);
12142
12388
  const selectedPostSendCol = selectedPostSendOption;
12143
- const [isTestPromptOpen, setIsTestPromptOpen] = (0, import_react21.useState)(false);
12144
- const [testPhoneNumber, setTestPhoneNumber] = (0, import_react21.useState)(() => {
12389
+ const [isTestPromptOpen, setIsTestPromptOpen] = (0, import_react22.useState)(false);
12390
+ const [testPhoneNumber, setTestPhoneNumber] = (0, import_react22.useState)(() => {
12145
12391
  if (typeof window !== "undefined") {
12146
12392
  try {
12147
12393
  return localStorage.getItem(STORAGE_KEY_TEST_PHONE) || "";
@@ -12151,10 +12397,10 @@ function useWhatsAppState(props) {
12151
12397
  }
12152
12398
  return "";
12153
12399
  });
12154
- const [testFeedback, setTestFeedback] = (0, import_react21.useState)(null);
12155
- const [isSendingTest, setIsSendingTest] = (0, import_react21.useState)(false);
12156
- const [isSendingBroadcast, setIsSendingBroadcast] = (0, import_react21.useState)(false);
12157
- const [broadcastProgress, setBroadcastProgress] = (0, import_react21.useState)({
12400
+ const [testFeedback, setTestFeedback] = (0, import_react22.useState)(null);
12401
+ const [isSendingTest, setIsSendingTest] = (0, import_react22.useState)(false);
12402
+ const [isSendingBroadcast, setIsSendingBroadcast] = (0, import_react22.useState)(false);
12403
+ const [broadcastProgress, setBroadcastProgress] = (0, import_react22.useState)({
12158
12404
  current: 0,
12159
12405
  total: 0,
12160
12406
  successful: 0,
@@ -12162,12 +12408,12 @@ function useWhatsAppState(props) {
12162
12408
  skipped: 0,
12163
12409
  percent: 0
12164
12410
  });
12165
- const [broadcastSummary, setBroadcastSummary] = (0, import_react21.useState)(null);
12166
- const [rowStatusMap, setRowStatusMap] = (0, import_react21.useState)({});
12167
- const clearBroadcastSummary = (0, import_react21.useCallback)(() => {
12411
+ const [broadcastSummary, setBroadcastSummary] = (0, import_react22.useState)(null);
12412
+ const [rowStatusMap, setRowStatusMap] = (0, import_react22.useState)({});
12413
+ const clearBroadcastSummary = (0, import_react22.useCallback)(() => {
12168
12414
  setBroadcastSummary(null);
12169
12415
  }, []);
12170
- const handleTestPhoneChange = (0, import_react21.useCallback)((val) => {
12416
+ const handleTestPhoneChange = (0, import_react22.useCallback)((val) => {
12171
12417
  setTestPhoneNumber(val);
12172
12418
  if (typeof window !== "undefined") {
12173
12419
  try {
@@ -12177,7 +12423,7 @@ function useWhatsAppState(props) {
12177
12423
  }
12178
12424
  }
12179
12425
  }, []);
12180
- const getRelationOptionsForCol = (0, import_react21.useCallback)(
12426
+ const getRelationOptionsForCol = (0, import_react22.useCallback)(
12181
12427
  (colName, parentColName) => {
12182
12428
  var _a2, _b2, _c, _d;
12183
12429
  if (parentColName) {
@@ -12220,7 +12466,7 @@ function useWhatsAppState(props) {
12220
12466
  },
12221
12467
  [relationOptions, subtableFilterableColumns, postSendActionTargetOptions, tableColumns2, filterableColumns]
12222
12468
  );
12223
- (0, import_react21.useEffect)(() => {
12469
+ (0, import_react22.useEffect)(() => {
12224
12470
  var _a2, _b2, _c, _d, _e;
12225
12471
  if (!executeAction) return;
12226
12472
  const targets = [];
@@ -12314,7 +12560,7 @@ function useWhatsAppState(props) {
12314
12560
  }
12315
12561
  });
12316
12562
  }, [filterableColumns, selectedPhoneOption, referencedTableSchemas, tableColumns2, executeAction, selectedPostSendOption, orgId]);
12317
- (0, import_react21.useEffect)(() => {
12563
+ (0, import_react22.useEffect)(() => {
12318
12564
  var _a2, _b2, _c;
12319
12565
  if (!executeAction || !selectedSubtableFilterCol) return;
12320
12566
  if (((_a2 = selectedSubtableFilterCol.type) == null ? void 0 : _a2.toUpperCase()) !== "RELATION") return;
@@ -12365,7 +12611,7 @@ function useWhatsAppState(props) {
12365
12611
  }
12366
12612
  })();
12367
12613
  }, [selectedSubtableFilterCol, selectedPhoneOption, executeAction, orgId]);
12368
- (0, import_react21.useEffect)(() => {
12614
+ (0, import_react22.useEffect)(() => {
12369
12615
  var _a2, _b2;
12370
12616
  if (!executeAction || !selectedPostSendOption) return;
12371
12617
  if (selectedPostSendOption.type !== "RELATION") return;
@@ -12418,7 +12664,7 @@ function useWhatsAppState(props) {
12418
12664
  }
12419
12665
  })();
12420
12666
  }, [selectedPostSendOption, executeAction, orgId]);
12421
- const filteredRecords = (0, import_react21.useMemo)(() => {
12667
+ const filteredRecords = (0, import_react22.useMemo)(() => {
12422
12668
  const activeEntries = Object.entries(filters).filter(
12423
12669
  ([_, val]) => val !== void 0 && val !== null && val !== ""
12424
12670
  );
@@ -12450,7 +12696,7 @@ function useWhatsAppState(props) {
12450
12696
  });
12451
12697
  }, [rawRecords, filters, filterableColumns]);
12452
12698
  const filteredData = filteredRecords;
12453
- (0, import_react21.useEffect)(() => {
12699
+ (0, import_react22.useEffect)(() => {
12454
12700
  if (autoSelectCount !== null && autoSelectCount > 0) {
12455
12701
  isAutoSelectingRef.current = true;
12456
12702
  const sliced = filteredData.slice(0, autoSelectCount);
@@ -12468,7 +12714,7 @@ function useWhatsAppState(props) {
12468
12714
  isManualOverrideRef.current = false;
12469
12715
  prevAutoSelectCountRef.current = autoSelectCount;
12470
12716
  }, [autoSelectCount, filteredData]);
12471
- const embeddedTableExecuteAction = (0, import_react21.useCallback)(async (actionType, payload) => {
12717
+ const embeddedTableExecuteAction = (0, import_react22.useCallback)(async (actionType, payload) => {
12472
12718
  if (actionType === "FETCH_TABLE_DATA") {
12473
12719
  const colFilters = (payload == null ? void 0 : payload.columnFilters) || (payload == null ? void 0 : payload.filters);
12474
12720
  const searchQuery = payload == null ? void 0 : payload.search;
@@ -12511,10 +12757,10 @@ function useWhatsAppState(props) {
12511
12757
  const handleClearFilters = () => {
12512
12758
  setFilters({});
12513
12759
  };
12514
- const activeFiltersCount = (0, import_react21.useMemo)(() => {
12760
+ const activeFiltersCount = (0, import_react22.useMemo)(() => {
12515
12761
  return Object.values(filters).filter((v) => v !== "").length;
12516
12762
  }, [filters]);
12517
- const handleSelectionChange = (0, import_react21.useCallback)((selectedIds) => {
12763
+ const handleSelectionChange = (0, import_react22.useCallback)((selectedIds) => {
12518
12764
  setSelectedRowIds((prev) => {
12519
12765
  if (prev.length === selectedIds.length && prev.every((id, idx) => id === selectedIds[idx])) {
12520
12766
  return prev;
@@ -12528,13 +12774,13 @@ function useWhatsAppState(props) {
12528
12774
  return selectedIds;
12529
12775
  });
12530
12776
  }, [autoSelectCount]);
12531
- const handleRowToggle = (0, import_react21.useCallback)((rowId, checked) => {
12777
+ const handleRowToggle = (0, import_react22.useCallback)((rowId, checked) => {
12532
12778
  if (autoSelectCount !== null && autoSelectCount > 0) {
12533
12779
  isManualOverrideRef.current = true;
12534
12780
  setAutoSelectCount(null);
12535
12781
  }
12536
12782
  }, [autoSelectCount]);
12537
- const toggleRowSelection = (0, import_react21.useCallback)((rowId, checked) => {
12783
+ const toggleRowSelection = (0, import_react22.useCallback)((rowId, checked) => {
12538
12784
  if (autoSelectCount !== null && autoSelectCount > 0) {
12539
12785
  isManualOverrideRef.current = true;
12540
12786
  setAutoSelectCount(null);
@@ -12550,15 +12796,15 @@ function useWhatsAppState(props) {
12550
12796
  return prev;
12551
12797
  });
12552
12798
  }, [autoSelectCount]);
12553
- const [templates, setTemplates] = (0, import_react21.useState)([]);
12554
- const [selectedTemplateId, setSelectedTemplateId] = (0, import_react21.useState)(null);
12555
- const [isLoading, setIsLoading] = (0, import_react21.useState)(true);
12556
- const [fetchError, setFetchError] = (0, import_react21.useState)(null);
12557
- const [isModalOpen, setIsModalOpen] = (0, import_react21.useState)(false);
12558
- const [isDropdownOpen, setIsDropdownOpen] = (0, import_react21.useState)(false);
12559
- const [isDeleting, setIsDeleting] = (0, import_react21.useState)(false);
12560
- const [feedback, setFeedback] = (0, import_react21.useState)(null);
12561
- const loadTemplates = (0, import_react21.useCallback)(async () => {
12799
+ const [templates, setTemplates] = (0, import_react22.useState)([]);
12800
+ const [selectedTemplateId, setSelectedTemplateId] = (0, import_react22.useState)(null);
12801
+ const [isLoading, setIsLoading] = (0, import_react22.useState)(true);
12802
+ const [fetchError, setFetchError] = (0, import_react22.useState)(null);
12803
+ const [isModalOpen, setIsModalOpen] = (0, import_react22.useState)(false);
12804
+ const [isDropdownOpen, setIsDropdownOpen] = (0, import_react22.useState)(false);
12805
+ const [isDeleting, setIsDeleting] = (0, import_react22.useState)(false);
12806
+ const [feedback, setFeedback] = (0, import_react22.useState)(null);
12807
+ const loadTemplates = (0, import_react22.useCallback)(async () => {
12562
12808
  var _a2, _b2;
12563
12809
  if (!executeAction) {
12564
12810
  setIsLoading(false);
@@ -12610,13 +12856,13 @@ function useWhatsAppState(props) {
12610
12856
  setIsLoading(false);
12611
12857
  }
12612
12858
  }, [executeAction, orgId]);
12613
- (0, import_react21.useEffect)(() => {
12859
+ (0, import_react22.useEffect)(() => {
12614
12860
  loadTemplates();
12615
12861
  }, [loadTemplates]);
12616
- const selectedTemplate = (0, import_react21.useMemo)(() => {
12862
+ const selectedTemplate = (0, import_react22.useMemo)(() => {
12617
12863
  return templates.find((t) => t.id === selectedTemplateId) || null;
12618
12864
  }, [templates, selectedTemplateId]);
12619
- const templateBodyText = (0, import_react21.useMemo)(() => {
12865
+ const templateBodyText = (0, import_react22.useMemo)(() => {
12620
12866
  if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return "";
12621
12867
  const bodyComp = selectedTemplate.components.find(
12622
12868
  (c) => {
@@ -12626,7 +12872,7 @@ function useWhatsAppState(props) {
12626
12872
  );
12627
12873
  return (bodyComp == null ? void 0 : bodyComp.text) || "";
12628
12874
  }, [selectedTemplate]);
12629
- const templateHeaderComp = (0, import_react21.useMemo)(() => {
12875
+ const templateHeaderComp = (0, import_react22.useMemo)(() => {
12630
12876
  if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return null;
12631
12877
  return selectedTemplate.components.find(
12632
12878
  (c) => {
@@ -12635,8 +12881,8 @@ function useWhatsAppState(props) {
12635
12881
  }
12636
12882
  ) || null;
12637
12883
  }, [selectedTemplate]);
12638
- const [headerMediaUrl, setHeaderMediaUrl] = (0, import_react21.useState)("");
12639
- (0, import_react21.useEffect)(() => {
12884
+ const [headerMediaUrl, setHeaderMediaUrl] = (0, import_react22.useState)("");
12885
+ (0, import_react22.useEffect)(() => {
12640
12886
  if (!templateHeaderComp) {
12641
12887
  setHeaderMediaUrl("");
12642
12888
  return;
@@ -12653,7 +12899,7 @@ function useWhatsAppState(props) {
12653
12899
  setHeaderMediaUrl("");
12654
12900
  }
12655
12901
  }, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
12656
- const handleHeaderMediaUrlChange = (0, import_react21.useCallback)(
12902
+ const handleHeaderMediaUrlChange = (0, import_react22.useCallback)(
12657
12903
  (newUrl) => {
12658
12904
  setHeaderMediaUrl(newUrl);
12659
12905
  if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
@@ -12672,7 +12918,7 @@ function useWhatsAppState(props) {
12672
12918
  },
12673
12919
  [selectedTemplate == null ? void 0 : selectedTemplate.name]
12674
12920
  );
12675
- const handleResetHeaderMediaUrl = (0, import_react21.useCallback)(() => {
12921
+ const handleResetHeaderMediaUrl = (0, import_react22.useCallback)(() => {
12676
12922
  if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
12677
12923
  try {
12678
12924
  localStorage.removeItem(`whatsapp_template_media_${selectedTemplate.name}`);
@@ -12686,8 +12932,8 @@ function useWhatsAppState(props) {
12686
12932
  );
12687
12933
  setHeaderMediaUrl(defaultUrl || "");
12688
12934
  }, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
12689
- const [isUploadingMedia, setIsUploadingMedia] = (0, import_react21.useState)(false);
12690
- const handleFileUpload = (0, import_react21.useCallback)(
12935
+ const [isUploadingMedia, setIsUploadingMedia] = (0, import_react22.useState)(false);
12936
+ const handleFileUpload = (0, import_react22.useCallback)(
12691
12937
  async (file, templateName) => {
12692
12938
  const tplName = templateName || (selectedTemplate == null ? void 0 : selectedTemplate.name) || "";
12693
12939
  if (!file) return;
@@ -12728,14 +12974,14 @@ function useWhatsAppState(props) {
12728
12974
  },
12729
12975
  [selectedTemplate == null ? void 0 : selectedTemplate.name]
12730
12976
  );
12731
- const templateVariables = (0, import_react21.useMemo)(() => {
12977
+ const templateVariables = (0, import_react22.useMemo)(() => {
12732
12978
  return extractTemplateVariables(selectedTemplate);
12733
12979
  }, [selectedTemplate]);
12734
- const [variableMapping, setVariableMapping] = (0, import_react21.useState)({});
12735
- (0, import_react21.useEffect)(() => {
12980
+ const [variableMapping, setVariableMapping] = (0, import_react22.useState)({});
12981
+ (0, import_react22.useEffect)(() => {
12736
12982
  setVariableMapping({});
12737
12983
  }, [selectedTemplateId]);
12738
- const textableColumnOptions = (0, import_react21.useMemo)(() => {
12984
+ const textableColumnOptions = (0, import_react22.useMemo)(() => {
12739
12985
  return getTextableColumnOptions({
12740
12986
  tableColumns: tableColumns2,
12741
12987
  selectedPhoneOption,
@@ -12761,7 +13007,7 @@ function useWhatsAppState(props) {
12761
13007
  });
12762
13008
  });
12763
13009
  };
12764
- const existingTemplateNames = (0, import_react21.useMemo)(() => {
13010
+ const existingTemplateNames = (0, import_react22.useMemo)(() => {
12765
13011
  return templates.map((t) => t.name);
12766
13012
  }, [templates]);
12767
13013
  const handleDeleteTemplate = async () => {
@@ -12808,14 +13054,14 @@ function useWhatsAppState(props) {
12808
13054
  postSendActionColumn,
12809
13055
  postSendActionValue
12810
13056
  );
12811
- const isStaticVariableMissing = (0, import_react21.useMemo)(() => {
13057
+ const isStaticVariableMissing = (0, import_react22.useMemo)(() => {
12812
13058
  return isStaticVariableIncomplete(templateVariables, variableMapping);
12813
13059
  }, [templateVariables, variableMapping]);
12814
- const currentRecords = (0, import_react21.useMemo)(() => {
13060
+ const currentRecords = (0, import_react22.useMemo)(() => {
12815
13061
  var _a2;
12816
13062
  return rawRecords && rawRecords.length > 0 ? rawRecords : Array.isArray(props.data) ? props.data : Array.isArray((_a2 = props.data) == null ? void 0 : _a2.records) ? props.data.records : [];
12817
13063
  }, [rawRecords, props.data]);
12818
- const preparedRecipients = (0, import_react21.useMemo)(() => {
13064
+ const preparedRecipients = (0, import_react22.useMemo)(() => {
12819
13065
  return prepareRecipients({
12820
13066
  selectedIds: selectedRowIds,
12821
13067
  records: currentRecords,
@@ -12835,7 +13081,7 @@ function useWhatsAppState(props) {
12835
13081
  selectedSubtableFilterCol
12836
13082
  ]);
12837
13083
  const finalRecipientCount = preparedRecipients.length;
12838
- const validMainRowsCount = (0, import_react21.useMemo)(() => {
13084
+ const validMainRowsCount = (0, import_react22.useMemo)(() => {
12839
13085
  const rowIdSet = new Set(
12840
13086
  preparedRecipients.map((r) => r.mainRowId).filter(Boolean)
12841
13087
  );
@@ -12944,7 +13190,7 @@ function useWhatsAppState(props) {
12944
13190
  setIsSendingTest(false);
12945
13191
  }
12946
13192
  };
12947
- const handleSendMessages = (0, import_react21.useCallback)(async () => {
13193
+ const handleSendMessages = (0, import_react22.useCallback)(async () => {
12948
13194
  var _a2, _b2;
12949
13195
  if (isSendDisabled || isSendingBroadcast) return;
12950
13196
  const recipients = preparedRecipients;
@@ -13250,9 +13496,9 @@ function useWhatsAppState(props) {
13250
13496
  }
13251
13497
 
13252
13498
  // src/components/WhatsAppComponent/ui/TemplateSelectionBlock.tsx
13253
- var import_react22 = require("react");
13254
- var import_lucide_react11 = require("lucide-react");
13255
- var import_jsx_runtime20 = require("react/jsx-runtime");
13499
+ var import_react23 = require("react");
13500
+ var import_lucide_react12 = require("lucide-react");
13501
+ var import_jsx_runtime21 = require("react/jsx-runtime");
13256
13502
  function TemplateSelectionBlock({
13257
13503
  selectedTemplate,
13258
13504
  selectedTemplateId,
@@ -13278,16 +13524,16 @@ function TemplateSelectionBlock({
13278
13524
  isUploadingMedia = false,
13279
13525
  handleFileUpload
13280
13526
  }) {
13281
- const fileInputRef = (0, import_react22.useRef)(null);
13282
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "col-span-12 lg:col-span-5 min-h-[26rem] h-full flex flex-col bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 relative", children: [
13283
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5 shrink-0", children: [
13284
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between pb-1.5 border-b border-slate-200/70 shrink-0 gap-2", children: [
13285
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
13286
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.FileText, { className: "w-4 h-4 text-emerald-600 shrink-0" }),
13287
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-bold text-slate-800 truncate", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05D5\u05EA\u05D5\u05DB\u05DF \u05D4\u05D5\u05D3\u05E2\u05D4" })
13527
+ const fileInputRef = (0, import_react23.useRef)(null);
13528
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "col-span-12 lg:col-span-5 min-h-[26rem] h-full flex flex-col bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 relative", children: [
13529
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1.5 shrink-0", children: [
13530
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between pb-1.5 border-b border-slate-200/70 shrink-0 gap-2", children: [
13531
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
13532
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.FileText, { className: "w-4 h-4 text-emerald-600 shrink-0" }),
13533
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 truncate", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05D5\u05EA\u05D5\u05DB\u05DF \u05D4\u05D5\u05D3\u05E2\u05D4" })
13288
13534
  ] }),
13289
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0", children: [
13290
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13535
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0", children: [
13536
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13291
13537
  "button",
13292
13538
  {
13293
13539
  type: "button",
@@ -13296,12 +13542,12 @@ function TemplateSelectionBlock({
13296
13542
  className: `h-7 px-2 text-[11px] font-semibold rounded-lg border transition-all flex items-center gap-1 ${selectedTemplate && !isDeleting ? "bg-white text-rose-600 hover:bg-rose-50 border-rose-200 active:scale-[0.98] shadow-2xs cursor-pointer" : "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed opacity-60"}`,
13297
13543
  title: !selectedTemplate ? "\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DB\u05D3\u05D9 \u05DC\u05DE\u05D7\u05D5\u05E7 \u05D0\u05D5\u05EA\u05D4" : `\u05DE\u05D7\u05E7 \u05D0\u05EA \u05D4\u05EA\u05D1\u05E0\u05D9\u05EA "${selectedTemplate.name}"`,
13298
13544
  children: [
13299
- isDeleting ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Loader2, { className: "w-3.5 h-3.5 animate-spin text-rose-500" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Trash2, { className: "w-3.5 h-3.5 text-rose-500" }),
13300
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05DE\u05D7\u05D9\u05E7\u05D4" })
13545
+ isDeleting ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Loader2, { className: "w-3.5 h-3.5 animate-spin text-rose-500" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Trash2, { className: "w-3.5 h-3.5 text-rose-500" }),
13546
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05DE\u05D7\u05D9\u05E7\u05D4" })
13301
13547
  ]
13302
13548
  }
13303
13549
  ),
13304
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13550
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13305
13551
  "button",
13306
13552
  {
13307
13553
  type: "button",
@@ -13309,41 +13555,41 @@ function TemplateSelectionBlock({
13309
13555
  className: "h-7 px-2.5 text-[11px] font-semibold text-white bg-emerald-600 hover:bg-emerald-700 active:scale-[0.98] rounded-lg shadow-2xs transition-all flex items-center gap-1 cursor-pointer",
13310
13556
  title: "\u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4",
13311
13557
  children: [
13312
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Plus, { className: "w-3.5 h-3.5" }),
13313
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05D7\u05D3\u05E9" })
13558
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Plus, { className: "w-3.5 h-3.5" }),
13559
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05D7\u05D3\u05E9" })
13314
13560
  ]
13315
13561
  }
13316
13562
  )
13317
13563
  ] })
13318
13564
  ] }),
13319
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", children: [
13320
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13565
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
13566
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13321
13567
  "button",
13322
13568
  {
13323
13569
  type: "button",
13324
13570
  onClick: () => setIsDropdownOpen((prev) => !prev),
13325
13571
  className: "w-full h-8.5 px-3 bg-white hover:bg-slate-100/70 border border-slate-200 rounded-xl text-right flex items-center justify-between transition-colors cursor-pointer text-xs",
13326
13572
  children: [
13327
- selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
13328
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13573
+ selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
13574
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13329
13575
  "span",
13330
13576
  {
13331
13577
  className: `w-2 h-2 rounded-full shrink-0 ${getStatusConfig(selectedTemplate.status).dotColor}`
13332
13578
  }
13333
13579
  ),
13334
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-semibold text-slate-900 truncate", children: selectedTemplate.name }),
13335
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[10px] text-slate-400 shrink-0", children: [
13580
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-semibold text-slate-900 truncate", children: selectedTemplate.name }),
13581
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-[10px] text-slate-400 shrink-0", children: [
13336
13582
  "(",
13337
13583
  selectedTemplate.category,
13338
13584
  " \u2022 ",
13339
13585
  selectedTemplate.language,
13340
13586
  ")"
13341
13587
  ] })
13342
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-slate-400", children: "\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05E7\u05D9\u05D9\u05DE\u05EA \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4..." }),
13343
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0 mr-1", children: [
13344
- isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Loader2, { className: "w-3.5 h-3.5 text-emerald-600 animate-spin" }),
13345
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13346
- import_lucide_react11.ChevronDown,
13588
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-slate-400", children: "\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05E7\u05D9\u05D9\u05DE\u05EA \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4..." }),
13589
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0 mr-1", children: [
13590
+ isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Loader2, { className: "w-3.5 h-3.5 text-emerald-600 animate-spin" }),
13591
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13592
+ import_lucide_react12.ChevronDown,
13347
13593
  {
13348
13594
  className: `w-3.5 h-3.5 text-slate-400 transition-transform ${isDropdownOpen ? "rotate-180" : ""}`
13349
13595
  }
@@ -13352,21 +13598,21 @@ function TemplateSelectionBlock({
13352
13598
  ]
13353
13599
  }
13354
13600
  ),
13355
- isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13356
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13601
+ isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13602
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13357
13603
  "div",
13358
13604
  {
13359
13605
  className: "fixed inset-0 z-40",
13360
13606
  onClick: () => setIsDropdownOpen(false)
13361
13607
  }
13362
13608
  ),
13363
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "absolute top-full left-0 right-0 mt-1 bg-white border border-slate-200 rounded-xl shadow-xl z-50 max-h-52 overflow-y-auto divide-y divide-slate-100 animate-in fade-in-50 zoom-in-95 duration-100", children: [
13364
- templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "p-3 text-center text-xs text-slate-400", children: '\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA. \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4".' }),
13609
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "absolute top-full left-0 right-0 mt-1 bg-white border border-slate-200 rounded-xl shadow-xl z-50 max-h-52 overflow-y-auto divide-y divide-slate-100 animate-in fade-in-50 zoom-in-95 duration-100", children: [
13610
+ templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "p-3 text-center text-xs text-slate-400", children: '\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA. \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4".' }),
13365
13611
  templates.map((tpl) => {
13366
13612
  const statusConfig = getStatusConfig(tpl.status);
13367
13613
  const isSelected = tpl.id === selectedTemplateId;
13368
13614
  const canSelect = statusConfig.isSelectable;
13369
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13615
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13370
13616
  "div",
13371
13617
  {
13372
13618
  onClick: () => {
@@ -13379,29 +13625,29 @@ function TemplateSelectionBlock({
13379
13625
  className: `p-2.5 flex items-center justify-between gap-2.5 transition-colors ${canSelect ? "hover:bg-slate-50 cursor-pointer" : "opacity-60 bg-slate-50/60 cursor-not-allowed"} ${isSelected ? "bg-emerald-50/50" : ""}`,
13380
13626
  title: !canSelect ? `\u05E1\u05D8\u05D8\u05D5\u05E1 \u05EA\u05D1\u05E0\u05D9\u05EA: ${tpl.status}. \u05E8\u05E7 \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05D1\u05DE\u05E6\u05D1 \u05DE\u05D0\u05D5\u05E9\u05E8 \u05D0\u05D5 \u05E4\u05E2\u05D9\u05DC \u05E0\u05D9\u05EA\u05E0\u05D5\u05EA \u05DC\u05D1\u05D7\u05D9\u05E8\u05D4.` : void 0,
13381
13627
  children: [
13382
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
13383
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13628
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
13629
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13384
13630
  "span",
13385
13631
  {
13386
13632
  className: `w-2 h-2 rounded-full shrink-0 ${statusConfig.dotColor}`
13387
13633
  }
13388
13634
  ),
13389
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
13390
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13635
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
13636
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13391
13637
  "p",
13392
13638
  {
13393
13639
  className: `text-xs font-semibold truncate ${isSelected ? "text-emerald-700" : canSelect ? "text-slate-800" : "text-slate-500"}`,
13394
13640
  children: tpl.name
13395
13641
  }
13396
13642
  ),
13397
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-[10px] text-slate-400", children: [
13643
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-[10px] text-slate-400", children: [
13398
13644
  tpl.category,
13399
13645
  " \u2022 ",
13400
13646
  tpl.language
13401
13647
  ] })
13402
13648
  ] })
13403
13649
  ] }),
13404
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13650
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13405
13651
  "span",
13406
13652
  {
13407
13653
  className: `text-[9px] font-semibold px-2 py-0.5 rounded-full border shrink-0 ${statusConfig.badgeBg} ${statusConfig.badgeText}`,
@@ -13417,18 +13663,18 @@ function TemplateSelectionBlock({
13417
13663
  ] })
13418
13664
  ] })
13419
13665
  ] }),
13420
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 min-h-0 flex flex-col gap-2", children: [
13421
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-600 shrink-0", children: [
13422
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05EA\u05E6\u05D5\u05D2\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" }),
13423
- selectedTemplate && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[10px] text-slate-400", children: [
13666
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1 min-h-0 flex flex-col gap-2", children: [
13667
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-600 shrink-0", children: [
13668
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05EA\u05E6\u05D5\u05D2\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" }),
13669
+ selectedTemplate && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-[10px] text-slate-400", children: [
13424
13670
  "(",
13425
13671
  templateBodyText.length,
13426
13672
  " \u05EA\u05D5\u05D5\u05D9\u05DD)"
13427
13673
  ] })
13428
13674
  ] }),
13429
- selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto bg-white border border-slate-200 rounded-lg p-3 text-sm text-slate-700 leading-relaxed font-sans whitespace-pre-wrap select-all shadow-2xs", children: templateBodyText || "(\u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E8\u05D9\u05E7)" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 min-h-0 py-3 bg-white border border-dashed border-slate-200 rounded-lg text-center text-sm text-slate-400 flex flex-col items-center justify-center gap-0.5", children: [
13430
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" }),
13431
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-slate-400", children: '\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4 \u05D0\u05D5 \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05D7\u05D3\u05E9"' })
13675
+ selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto bg-white border border-slate-200 rounded-lg p-3 text-sm text-slate-700 leading-relaxed font-sans whitespace-pre-wrap select-all shadow-2xs", children: templateBodyText || "(\u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E8\u05D9\u05E7)" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1 min-h-0 py-3 bg-white border border-dashed border-slate-200 rounded-lg text-center text-sm text-slate-400 flex flex-col items-center justify-center gap-0.5", children: [
13676
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" }),
13677
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-slate-400", children: '\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4 \u05D0\u05D5 \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05D7\u05D3\u05E9"' })
13432
13678
  ] }),
13433
13679
  selectedTemplate && (() => {
13434
13680
  var _a;
@@ -13437,19 +13683,19 @@ function TemplateSelectionBlock({
13437
13683
  );
13438
13684
  const tplButtons = (buttonsComp == null ? void 0 : buttonsComp.buttons) || [];
13439
13685
  if (!tplButtons || tplButtons.length === 0) return null;
13440
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1.5 shrink-0 pt-0.5", children: tplButtons.map((btn, idx) => {
13686
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1.5 shrink-0 pt-0.5", children: tplButtons.map((btn, idx) => {
13441
13687
  const btnType = (btn.type || "").toUpperCase();
13442
13688
  const btnText = btn.text || (btnType === "COPY_CODE" ? `\u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3: ${btn.example}` : "\u05DB\u05E4\u05EA\u05D5\u05E8");
13443
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13689
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13444
13690
  "div",
13445
13691
  {
13446
13692
  className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white border border-slate-200/90 text-slate-700 text-xs font-semibold shadow-2xs select-none",
13447
13693
  children: [
13448
- btnType === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.MessageSquare, { className: "w-3 h-3 text-emerald-600" }),
13449
- btnType === "URL" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.ExternalLink, { className: "w-3 h-3 text-sky-600" }),
13450
- btnType === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Phone, { className: "w-3 h-3 text-violet-600" }),
13451
- btnType === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Copy, { className: "w-3 h-3 text-amber-600" }),
13452
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate max-w-[180px]", children: btnText })
13694
+ btnType === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.MessageSquare, { className: "w-3 h-3 text-emerald-600" }),
13695
+ btnType === "URL" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ExternalLink, { className: "w-3 h-3 text-sky-600" }),
13696
+ btnType === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Phone, { className: "w-3 h-3 text-violet-600" }),
13697
+ btnType === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Copy, { className: "w-3 h-3 text-amber-600" }),
13698
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate max-w-[180px]", children: btnText })
13453
13699
  ]
13454
13700
  },
13455
13701
  idx
@@ -13464,9 +13710,9 @@ function TemplateSelectionBlock({
13464
13710
  const docFilename = resolveDocumentFilename(templateHeaderComp, headerMediaUrl);
13465
13711
  const hasValidMedia = Boolean(headerMediaUrl && headerMediaUrl.trim() && headerMediaUrl.startsWith("http"));
13466
13712
  const uploadButtonLabel = headerFormat === "DOCUMENT" ? "\u05D4\u05E2\u05DC\u05D4 \u05DE\u05E1\u05DE\u05DA" : headerFormat === "IMAGE" ? "\u05D4\u05E2\u05DC\u05D4 \u05EA\u05DE\u05D5\u05E0\u05D4" : "\u05D4\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5";
13467
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-2.5 bg-slate-50 border border-slate-200/90 rounded-xl flex items-center justify-between gap-3 shrink-0 shadow-2xs", children: [
13468
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13469
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-8 h-8 rounded-lg overflow-hidden border border-slate-200 shrink-0 bg-slate-100 flex items-center justify-center", children: hasValidMedia ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13713
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "p-2.5 bg-slate-50 border border-slate-200/90 rounded-xl flex items-center justify-between gap-3 shrink-0 shadow-2xs", children: [
13714
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13715
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-8 h-8 rounded-lg overflow-hidden border border-slate-200 shrink-0 bg-slate-100 flex items-center justify-center", children: hasValidMedia ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13470
13716
  "img",
13471
13717
  {
13472
13718
  src: headerMediaUrl,
@@ -13476,33 +13722,33 @@ function TemplateSelectionBlock({
13476
13722
  e.currentTarget.style.display = "none";
13477
13723
  }
13478
13724
  }
13479
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Image, { className: "w-4 h-4 text-amber-600" }) }),
13480
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
13481
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" }),
13482
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-400 block truncate", children: hasValidMedia ? "\u05E7\u05D5\u05D1\u05E5 \u05EA\u05DE\u05D5\u05E0\u05D4 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA" : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05EA\u05DE\u05D5\u05E0\u05D4" })
13725
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Image, { className: "w-4 h-4 text-amber-600" }) }),
13726
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
13727
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" }),
13728
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-slate-400 block truncate", children: hasValidMedia ? "\u05E7\u05D5\u05D1\u05E5 \u05EA\u05DE\u05D5\u05E0\u05D4 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA" : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05EA\u05DE\u05D5\u05E0\u05D4" })
13483
13729
  ] })
13484
- ] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13485
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border ${hasValidMedia ? "bg-rose-50 text-rose-600 border-rose-100" : "bg-slate-100 text-slate-400 border-slate-200"}`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.FileText, { className: "w-4 h-4" }) }),
13486
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
13487
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
13488
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: hasValidMedia ? docFilename : void 0, children: hasValidMedia ? docFilename : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E1\u05DE\u05DA" })
13730
+ ] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13731
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border ${hasValidMedia ? "bg-rose-50 text-rose-600 border-rose-100" : "bg-slate-100 text-slate-400 border-slate-200"}`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.FileText, { className: "w-4 h-4" }) }),
13732
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
13733
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
13734
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: hasValidMedia ? docFilename : void 0, children: hasValidMedia ? docFilename : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E1\u05DE\u05DA" })
13489
13735
  ] })
13490
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13491
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border ${hasValidMedia ? "bg-indigo-50 text-indigo-600 border-indigo-100" : "bg-slate-100 text-slate-400 border-slate-200"}`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Video, { className: "w-4 h-4" }) }),
13492
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
13493
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" }),
13494
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-400 block truncate", children: hasValidMedia ? "\u05E7\u05D5\u05D1\u05E5 \u05D5\u05D9\u05D3\u05D0\u05D5 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA" : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05D5\u05D9\u05D3\u05D0\u05D5" })
13736
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13737
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border ${hasValidMedia ? "bg-indigo-50 text-indigo-600 border-indigo-100" : "bg-slate-100 text-slate-400 border-slate-200"}`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Video, { className: "w-4 h-4" }) }),
13738
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
13739
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" }),
13740
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-slate-400 block truncate", children: hasValidMedia ? "\u05E7\u05D5\u05D1\u05E5 \u05D5\u05D9\u05D3\u05D0\u05D5 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA" : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05D5\u05D9\u05D3\u05D0\u05D5" })
13495
13741
  ] })
13496
13742
  ] }) }),
13497
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2 shrink-0", children: [
13498
- hasValidMedia ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "inline-flex items-center gap-1 text-[10px] font-medium text-emerald-800 px-2 py-0.5 bg-emerald-50 border border-emerald-200 rounded-lg", children: [
13499
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.CheckCircle2, { className: "w-3 h-3 text-emerald-600" }),
13743
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 shrink-0", children: [
13744
+ hasValidMedia ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "inline-flex items-center gap-1 text-[10px] font-medium text-emerald-800 px-2 py-0.5 bg-emerald-50 border border-emerald-200 rounded-lg", children: [
13745
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.CheckCircle2, { className: "w-3 h-3 text-emerald-600" }),
13500
13746
  "\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF"
13501
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "inline-flex items-center gap-1 text-[10px] font-semibold text-amber-800 px-2 py-0.5 bg-amber-50 border border-amber-200 rounded-lg", children: [
13502
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-3 h-3 text-amber-600 shrink-0" }),
13747
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "inline-flex items-center gap-1 text-[10px] font-semibold text-amber-800 px-2 py-0.5 bg-amber-50 border border-amber-200 rounded-lg", children: [
13748
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.AlertCircle, { className: "w-3 h-3 text-amber-600 shrink-0" }),
13503
13749
  "\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5"
13504
13750
  ] }),
13505
- hasValidMedia && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13751
+ hasValidMedia && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13506
13752
  "a",
13507
13753
  {
13508
13754
  href: headerMediaUrl,
@@ -13510,10 +13756,10 @@ function TemplateSelectionBlock({
13510
13756
  rel: "noopener noreferrer",
13511
13757
  title: "\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05E9\u05DC \u05D4\u05E7\u05D5\u05D1\u05E5",
13512
13758
  className: "p-1 text-slate-400 hover:text-emerald-700 hover:bg-slate-200/60 rounded-md transition-colors",
13513
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.ExternalLink, { className: "w-3.5 h-3.5" })
13759
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ExternalLink, { className: "w-3.5 h-3.5" })
13514
13760
  }
13515
13761
  ),
13516
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13762
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13517
13763
  "input",
13518
13764
  {
13519
13765
  ref: fileInputRef,
@@ -13531,7 +13777,7 @@ function TemplateSelectionBlock({
13531
13777
  disabled: isUploadingMedia
13532
13778
  }
13533
13779
  ),
13534
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13780
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13535
13781
  "button",
13536
13782
  {
13537
13783
  type: "button",
@@ -13542,39 +13788,39 @@ function TemplateSelectionBlock({
13542
13788
  },
13543
13789
  className: `inline-flex items-center gap-1.5 px-2.5 py-1 text-[11px] font-medium rounded-lg transition-colors border shadow-2xs ${isUploadingMedia ? "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed" : hasValidMedia ? "bg-white text-slate-700 hover:bg-slate-50 border-slate-200 hover:border-slate-300" : "bg-emerald-600 text-white hover:bg-emerald-700 border-emerald-600"}`,
13544
13790
  title: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05D3\u05D9\u05D4 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5" : `${uploadButtonLabel} \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5`,
13545
- children: isUploadingMedia ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13546
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
13547
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05DE\u05E2\u05DC\u05D4..." })
13548
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13549
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Upload, { className: "w-3.5 h-3.5" }),
13550
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5" : uploadButtonLabel })
13791
+ children: isUploadingMedia ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13792
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
13793
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05DE\u05E2\u05DC\u05D4..." })
13794
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13795
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Upload, { className: "w-3.5 h-3.5" }),
13796
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5" : uploadButtonLabel })
13551
13797
  ] })
13552
13798
  }
13553
13799
  )
13554
13800
  ] })
13555
13801
  ] });
13556
13802
  })(),
13557
- selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "shrink-0 flex flex-col gap-1.5 pt-2 border-t border-slate-200/80 pb-0", children: [
13558
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between shrink-0", children: [
13559
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[11px] font-bold text-slate-700", children: "\u05DE\u05D9\u05E4\u05D5\u05D9 \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD" }),
13560
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[9px] font-semibold text-emerald-700 bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-200", children: [
13803
+ selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "shrink-0 flex flex-col gap-1.5 pt-2 border-t border-slate-200/80 pb-0", children: [
13804
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between shrink-0", children: [
13805
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] font-bold text-slate-700", children: "\u05DE\u05D9\u05E4\u05D5\u05D9 \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD" }),
13806
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-[9px] font-semibold text-emerald-700 bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-200", children: [
13561
13807
  templateVariables.length,
13562
13808
  " \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
13563
13809
  ] })
13564
13810
  ] }),
13565
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "max-h-48 overflow-y-auto space-y-1.5 pr-0.5", children: templateVariables.map((varKey) => {
13811
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-h-48 overflow-y-auto space-y-1.5 pr-0.5", children: templateVariables.map((varKey) => {
13566
13812
  var _a;
13567
13813
  const mapping = variableMapping[varKey] || { type: "column", value: "" };
13568
13814
  const isStatic = mapping.type === "static";
13569
13815
  const selectedColVal = textableColumnOptions.some((o) => o.id === mapping.value) ? mapping.value : ((_a = textableColumnOptions.find((o) => o.columnName === mapping.value)) == null ? void 0 : _a.id) || mapping.value || "";
13570
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13816
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13571
13817
  "div",
13572
13818
  {
13573
13819
  className: "flex items-center gap-1.5 p-1 bg-white border border-slate-200 rounded-xl text-xs shrink-0",
13574
13820
  children: [
13575
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "px-2 py-0.5 bg-emerald-50 text-emerald-800 font-mono font-bold text-[11px] rounded-lg border border-emerald-200/80 shrink-0", children: `{{${varKey}}}` }),
13576
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "inline-flex items-center p-0.5 bg-slate-100 rounded-lg border border-slate-200/80 shrink-0 text-[10px] font-medium", children: [
13577
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13821
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "px-2 py-0.5 bg-emerald-50 text-emerald-800 font-mono font-bold text-[11px] rounded-lg border border-emerald-200/80 shrink-0", children: `{{${varKey}}}` }),
13822
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "inline-flex items-center p-0.5 bg-slate-100 rounded-lg border border-slate-200/80 shrink-0 text-[10px] font-medium", children: [
13823
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13578
13824
  "button",
13579
13825
  {
13580
13826
  type: "button",
@@ -13583,7 +13829,7 @@ function TemplateSelectionBlock({
13583
13829
  children: "\u05E2\u05DE\u05D5\u05D3\u05D4"
13584
13830
  }
13585
13831
  ),
13586
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13832
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13587
13833
  "button",
13588
13834
  {
13589
13835
  type: "button",
@@ -13593,7 +13839,7 @@ function TemplateSelectionBlock({
13593
13839
  }
13594
13840
  )
13595
13841
  ] }),
13596
- isStatic ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13842
+ isStatic ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13597
13843
  "input",
13598
13844
  {
13599
13845
  type: "text",
@@ -13602,20 +13848,20 @@ function TemplateSelectionBlock({
13602
13848
  placeholder: "\u05D4\u05D6\u05DF \u05E2\u05E8\u05DA \u05E7\u05D1\u05D5\u05E2 (\u05D7\u05D5\u05D1\u05D4)...",
13603
13849
  className: `flex-1 min-w-0 h-7 px-2 text-[11px] rounded-lg border bg-white text-slate-800 placeholder:text-slate-400 focus:outline-none transition-colors ${!mapping.value || mapping.value.trim() === "" ? "border-amber-300 focus:border-amber-500 focus:ring-1 focus:ring-amber-500/20" : "border-slate-200 focus:border-emerald-500 focus:ring-1 focus:ring-emerald-500/20"}`
13604
13850
  }
13605
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative flex-1 min-w-0", children: [
13606
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13851
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative flex-1 min-w-0", children: [
13852
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13607
13853
  "select",
13608
13854
  {
13609
13855
  value: selectedColVal,
13610
13856
  onChange: (e) => handleVariableValueChange(varKey, e.target.value),
13611
13857
  className: "w-full h-7 pr-2.5 pl-6 text-[11px] rounded-lg border border-slate-200 bg-white text-slate-700 focus:border-emerald-500 focus:ring-1 focus:ring-emerald-500/20 cursor-pointer truncate appearance-none",
13612
13858
  children: [
13613
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
13614
- textableColumnOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: opt.id, children: opt.label }, opt.id))
13859
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
13860
+ textableColumnOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: opt.id, children: opt.label }, opt.id))
13615
13861
  ]
13616
13862
  }
13617
13863
  ),
13618
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
13864
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
13619
13865
  ] })
13620
13866
  ]
13621
13867
  },
@@ -13628,8 +13874,8 @@ function TemplateSelectionBlock({
13628
13874
  }
13629
13875
 
13630
13876
  // src/components/WhatsAppComponent/ui/DynamicFiltersBlock.tsx
13631
- var import_lucide_react12 = require("lucide-react");
13632
- var import_jsx_runtime21 = require("react/jsx-runtime");
13877
+ var import_lucide_react13 = require("lucide-react");
13878
+ var import_jsx_runtime22 = require("react/jsx-runtime");
13633
13879
  function DynamicFiltersBlock({
13634
13880
  filterableColumns,
13635
13881
  filters,
@@ -13644,31 +13890,31 @@ function DynamicFiltersBlock({
13644
13890
  loadTableData,
13645
13891
  isLoadingTableData
13646
13892
  }) {
13647
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "col-span-12 lg:col-span-3 min-h-[26rem] h-full flex flex-col justify-between bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 gap-2", children: [
13648
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-2", children: [
13649
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: [
13650
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
13651
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Filter, { className: "w-4 h-4 text-emerald-600" }),
13652
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05D3\u05D9\u05E0\u05DE\u05D9" }),
13653
- activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-800 border border-emerald-200", children: activeFiltersCount })
13893
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "col-span-12 lg:col-span-3 min-h-[26rem] h-full flex flex-col justify-between bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 gap-2", children: [
13894
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-2", children: [
13895
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: [
13896
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
13897
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Filter, { className: "w-4 h-4 text-emerald-600" }),
13898
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05D3\u05D9\u05E0\u05DE\u05D9" }),
13899
+ activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[10px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-800 border border-emerald-200", children: activeFiltersCount })
13654
13900
  ] }),
13655
- activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13901
+ activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13656
13902
  "button",
13657
13903
  {
13658
13904
  type: "button",
13659
13905
  onClick: handleClearFilters,
13660
13906
  className: "text-[11px] text-rose-600 hover:text-rose-700 font-semibold hover:underline flex items-center gap-1 cursor-pointer",
13661
13907
  children: [
13662
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.X, { className: "w-3 h-3" }),
13663
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05E0\u05E7\u05D4" })
13908
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.X, { className: "w-3 h-3" }),
13909
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "\u05E0\u05E7\u05D4" })
13664
13910
  ]
13665
13911
  }
13666
13912
  )
13667
13913
  ] }),
13668
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "py-1", children: filterableColumns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col items-center justify-center text-center p-4 text-xs text-slate-400 gap-1", children: [
13669
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05D0\u05D9\u05DF \u05E9\u05D3\u05D5\u05EA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D6\u05D5" }),
13670
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-slate-400", children: "\u05E9\u05D3\u05D5\u05EA \u05DE\u05E1\u05D5\u05D2 \u05E7\u05E9\u05E8 \u05D5\u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9 \u05D1\u05DC\u05D1\u05D3" })
13671
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-2", children: filterableColumns.map((col) => {
13914
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "py-1", children: filterableColumns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col items-center justify-center text-center p-4 text-xs text-slate-400 gap-1", children: [
13915
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "\u05D0\u05D9\u05DF \u05E9\u05D3\u05D5\u05EA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D6\u05D5" }),
13916
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[10px] text-slate-400", children: "\u05E9\u05D3\u05D5\u05EA \u05DE\u05E1\u05D5\u05D2 \u05E7\u05E9\u05E8 \u05D5\u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9 \u05D1\u05DC\u05D1\u05D3" })
13917
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-2", children: filterableColumns.map((col) => {
13672
13918
  var _a, _b, _c;
13673
13919
  const colType = (_a = col.type) == null ? void 0 : _a.toUpperCase();
13674
13920
  const isBoolean = colType === "BOOLEAN";
@@ -13676,9 +13922,9 @@ function DynamicFiltersBlock({
13676
13922
  const isActive = Boolean(currentValue);
13677
13923
  const refTableId = ((_b = col == null ? void 0 : col.config) == null ? void 0 : _b.referencedTableId) || (col == null ? void 0 : col.referencedTableId);
13678
13924
  const options = ((_c = getRelationOptionsForCol ? getRelationOptionsForCol(col.name) : []) == null ? void 0 : _c.length) > 0 ? getRelationOptionsForCol(col.name) : relationOptions[col.name] && relationOptions[col.name].length > 0 ? relationOptions[col.name] : refTableId && relationOptions[refTableId] && relationOptions[refTableId].length > 0 ? relationOptions[refTableId] : col.id && relationOptions[col.id] && relationOptions[col.id].length > 0 ? relationOptions[col.id] : [];
13679
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1", children: [
13680
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
13681
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13925
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1", children: [
13926
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
13927
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13682
13928
  "label",
13683
13929
  {
13684
13930
  className: "text-[11px] font-semibold text-slate-700 truncate max-w-[130px]",
@@ -13686,49 +13932,49 @@ function DynamicFiltersBlock({
13686
13932
  children: col.name
13687
13933
  }
13688
13934
  ),
13689
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[9px] text-slate-400 font-mono", children: isBoolean ? "\u05DB\u05DF/\u05DC\u05D0" : "\u05E7\u05E9\u05E8" })
13935
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[9px] text-slate-400 font-mono", children: isBoolean ? "\u05DB\u05DF/\u05DC\u05D0" : "\u05E7\u05E9\u05E8" })
13690
13936
  ] }),
13691
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
13692
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13937
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
13938
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13693
13939
  "select",
13694
13940
  {
13695
13941
  value: currentValue,
13696
13942
  onChange: (e) => handleFilterChange(col.name, e.target.value),
13697
13943
  className: `w-full h-8 px-2 pr-2.5 pl-6 text-[11px] rounded-lg border transition-all appearance-none bg-white cursor-pointer truncate ${isActive ? "border-emerald-500 bg-emerald-50/20 text-emerald-900 font-medium ring-1 ring-emerald-500/20" : "border-slate-200 text-slate-700 hover:border-slate-300 focus:border-emerald-500"}`,
13698
13944
  children: [
13699
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
13700
- isBoolean ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13701
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "true", children: "\u05DB\u05DF" }),
13702
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "false", children: "\u05DC\u05D0" })
13703
- ] }) : options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: opt.id || opt._id, children: getRelationOptionLabel(opt, col, relationOptions) }, opt.id || opt._id))
13945
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
13946
+ isBoolean ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
13947
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "true", children: "\u05DB\u05DF" }),
13948
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "false", children: "\u05DC\u05D0" })
13949
+ ] }) : options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: opt.id || opt._id, children: getRelationOptionLabel(opt, col, relationOptions) }, opt.id || opt._id))
13704
13950
  ]
13705
13951
  }
13706
13952
  ),
13707
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
13953
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
13708
13954
  ] })
13709
13955
  ] }, col.name);
13710
13956
  }) }) })
13711
13957
  ] }),
13712
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "pt-2.5 mt-2 border-t border-slate-200/80 flex items-center justify-between gap-1.5 shrink-0", children: [
13713
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13958
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "pt-2.5 mt-2 border-t border-slate-200/80 flex items-center justify-between gap-1.5 shrink-0", children: [
13959
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13714
13960
  "div",
13715
13961
  {
13716
13962
  className: `inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-[11px] font-semibold border transition-all ${selectedRowIds.length > 0 ? "bg-emerald-50 text-emerald-800 border-emerald-200 shadow-2xs" : "bg-white text-slate-600 border-slate-200"}`,
13717
13963
  children: [
13718
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13719
- import_lucide_react12.CheckSquare,
13964
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13965
+ import_lucide_react13.CheckSquare,
13720
13966
  {
13721
13967
  className: `w-3 h-3 ${selectedRowIds.length > 0 ? "text-emerald-600" : "text-slate-400"}`
13722
13968
  }
13723
13969
  ),
13724
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
13970
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
13725
13971
  "\u05E0\u05D1\u05D7\u05E8\u05D5 ",
13726
13972
  selectedRowIds.length
13727
13973
  ] })
13728
13974
  ]
13729
13975
  }
13730
13976
  ),
13731
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13977
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13732
13978
  "button",
13733
13979
  {
13734
13980
  type: "button",
@@ -13736,8 +13982,8 @@ function DynamicFiltersBlock({
13736
13982
  disabled: isLoadingTableData,
13737
13983
  className: "p-1.5 text-slate-500 hover:text-slate-800 bg-white hover:bg-slate-100 border border-slate-200 rounded-lg transition-colors cursor-pointer disabled:opacity-50 shrink-0",
13738
13984
  title: "\u05E8\u05E2\u05E0\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9 \u05D8\u05D1\u05DC\u05D4",
13739
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13740
- import_lucide_react12.RefreshCw,
13985
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13986
+ import_lucide_react13.RefreshCw,
13741
13987
  {
13742
13988
  className: `w-3.5 h-3.5 ${isLoadingTableData ? "animate-spin text-emerald-600" : ""}`
13743
13989
  }
@@ -13748,85 +13994,6 @@ function DynamicFiltersBlock({
13748
13994
  ] });
13749
13995
  }
13750
13996
 
13751
- // src/components/WhatsAppComponent/ui/WhatsAppRelationButtons.tsx
13752
- var import_react23 = require("react");
13753
- var import_lucide_react13 = require("lucide-react");
13754
- var import_jsx_runtime22 = require("react/jsx-runtime");
13755
- var isRawObjectId3 = (s) => /^[0-9a-fA-F]{24}$/.test(s);
13756
- function recordMatches(record, colDef, filterVal) {
13757
- var _a;
13758
- if (!colDef) return true;
13759
- const cell = ((record == null ? void 0 : record.data) || {})[colDef.name];
13760
- const type = (_a = colDef.type) == null ? void 0 : _a.toUpperCase();
13761
- if (type === "BOOLEAN") {
13762
- const isTrue = cell === true || cell === "true" || cell === 1;
13763
- return isTrue === (filterVal === "true");
13764
- }
13765
- if (type === "RELATION") {
13766
- return normalizeRelationValue(cell).includes(filterVal);
13767
- }
13768
- return true;
13769
- }
13770
- function WhatsAppRelationButtons({
13771
- columnNames,
13772
- tableColumns: tableColumns2,
13773
- records,
13774
- filters,
13775
- onFilterChange,
13776
- relationOptions,
13777
- getRelationOptionsForCol
13778
- }) {
13779
- const groups = (0, import_react23.useMemo)(() => {
13780
- var _a, _b;
13781
- const activeEntries = Object.entries(filters).filter(([, v]) => v !== void 0 && v !== null && v !== "");
13782
- const result = [];
13783
- for (const colName of columnNames || []) {
13784
- const colDef = (tableColumns2 || []).find((c) => c.name === colName);
13785
- if (!colDef || ((_a = colDef.type) == null ? void 0 : _a.toUpperCase()) !== "RELATION") continue;
13786
- const otherEntries = activeEntries.filter(([name]) => name !== colName);
13787
- const base = otherEntries.length === 0 ? records : records.filter(
13788
- (rec) => otherEntries.every(
13789
- ([name, val]) => recordMatches(rec, (tableColumns2 || []).find((c) => c.name === name), val)
13790
- )
13791
- );
13792
- const counts = /* @__PURE__ */ new Map();
13793
- for (const rec of base) {
13794
- const ids = new Set(normalizeRelationValue(((rec == null ? void 0 : rec.data) || {})[colName]));
13795
- ids.forEach((id) => counts.set(id, (counts.get(id) || 0) + 1));
13796
- }
13797
- const optionList = ((_b = getRelationOptionsForCol ? getRelationOptionsForCol(colName) : []) == null ? void 0 : _b.length) > 0 ? getRelationOptionsForCol(colName) : relationOptions[colName] || [];
13798
- const activeId = filters[colName] ? String(filters[colName]) : null;
13799
- const seen = /* @__PURE__ */ new Set();
13800
- const options = [];
13801
- for (const opt of optionList) {
13802
- const id = String((opt == null ? void 0 : opt.id) || (opt == null ? void 0 : opt._id) || "");
13803
- if (!id || seen.has(id)) continue;
13804
- const count = counts.get(id) || 0;
13805
- if (count === 0 && id !== activeId) continue;
13806
- seen.add(id);
13807
- options.push({ id, label: getRelationOptionLabel(opt, colDef, relationOptions), count });
13808
- }
13809
- counts.forEach((count, id) => {
13810
- if (seen.has(id)) return;
13811
- const label = getRelationOptionLabel(id, colDef, relationOptions);
13812
- if (!label || isRawObjectId3(label)) return;
13813
- seen.add(id);
13814
- options.push({ id, label, count });
13815
- });
13816
- result.push({ key: colName, title: colName, options, activeId });
13817
- }
13818
- return result;
13819
- }, [columnNames, tableColumns2, records, filters, relationOptions, getRelationOptionsForCol]);
13820
- if (!columnNames || columnNames.length === 0) return null;
13821
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "relative min-h-[12rem] 2xl:min-h-0", "data-testid": "whatsapp-relation-buttons", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "2xl:absolute 2xl:inset-0 flex flex-col bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 gap-2 overflow-hidden", children: [
13822
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-200/70 shrink-0", children: [
13823
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Zap, { className: "w-4 h-4 text-emerald-600" }),
13824
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05DE\u05D4\u05D9\u05E8" })
13825
- ] }),
13826
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto max-h-[22rem] 2xl:max-h-none pr-0.5", children: groups.every((g) => g.options.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "p-4 text-center text-xs text-slate-400", children: "\u05D0\u05D9\u05DF \u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D4\u05E6\u05D2\u05D4 \u05D1\u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RelationButtonsView, { groups, stacked: true, onSelect: (col, id) => onFilterChange(col, id || "") }) })
13827
- ] }) });
13828
- }
13829
-
13830
13997
  // src/components/WhatsAppComponent/ui/SettingsAndActionsBlock.tsx
13831
13998
  var import_lucide_react14 = require("lucide-react");
13832
13999
  var import_jsx_runtime23 = require("react/jsx-runtime");
@@ -14569,13 +14736,6 @@ function WhatsAppComponent(props) {
14569
14736
  const { className = "", settings, orgId, componentId, executeAction } = props;
14570
14737
  const state = useWhatsAppState(props);
14571
14738
  const [activeTab, setActiveTab] = import_react26.default.useState("broadcast");
14572
- const relationButtonColumns = (Array.isArray(settings == null ? void 0 : settings.relationButtonColumns) ? settings.relationButtonColumns : []).filter(
14573
- (name) => (state.tableColumns || []).some((c) => {
14574
- var _a2;
14575
- return c.name === name && ((_a2 = c.type) == null ? void 0 : _a2.toUpperCase()) === "RELATION";
14576
- })
14577
- );
14578
- const hasRelationButtons = relationButtonColumns.length > 0;
14579
14739
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
14580
14740
  "div",
14581
14741
  {
@@ -14683,111 +14843,97 @@ function WhatsAppComponent(props) {
14683
14843
  )
14684
14844
  ] }),
14685
14845
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-4 flex flex-col gap-4", children: [
14686
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `grid grid-cols-1 gap-4 shrink-0 items-stretch ${hasRelationButtons ? "2xl:grid-cols-2" : ""}`, children: [
14687
- hasRelationButtons && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14688
- WhatsAppRelationButtons,
14846
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
14847
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14848
+ TemplateSelectionBlock,
14849
+ {
14850
+ selectedTemplate: state.selectedTemplate,
14851
+ selectedTemplateId: state.selectedTemplateId,
14852
+ setSelectedTemplateId: state.setSelectedTemplateId,
14853
+ templates: state.templates,
14854
+ isLoadingTemplates: state.isLoadingTemplates,
14855
+ isDropdownOpen: state.isDropdownOpen,
14856
+ setIsDropdownOpen: state.setIsDropdownOpen,
14857
+ templateBodyText: state.templateBodyText,
14858
+ templateHeaderComp: state.templateHeaderComp,
14859
+ headerMediaUrl: state.headerMediaUrl,
14860
+ handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
14861
+ handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
14862
+ templateVariables: state.templateVariables,
14863
+ variableMapping: state.variableMapping,
14864
+ handleVariableTypeChange: state.handleVariableTypeChange,
14865
+ handleVariableValueChange: state.handleVariableValueChange,
14866
+ textableColumnOptions: state.textableColumnOptions,
14867
+ handleDeleteTemplate: state.handleDeleteTemplate,
14868
+ isDeleting: state.isDeleting,
14869
+ setIsModalOpen: state.setIsModalOpen,
14870
+ setFeedback: state.setFeedback,
14871
+ isUploadingMedia: state.isUploadingMedia,
14872
+ handleFileUpload: state.handleFileUpload
14873
+ }
14874
+ ),
14875
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14876
+ DynamicFiltersBlock,
14689
14877
  {
14690
- columnNames: relationButtonColumns,
14691
- tableColumns: state.tableColumns,
14692
- records: state.rawRecords,
14878
+ filterableColumns: state.filterableColumns,
14693
14879
  filters: state.filters,
14694
- onFilterChange: state.handleFilterChange,
14880
+ handleFilterChange: state.handleFilterChange,
14881
+ handleClearFilters: state.handleClearFilters,
14882
+ activeFiltersCount: state.activeFiltersCount,
14695
14883
  relationOptions: state.relationOptions,
14696
- getRelationOptionsForCol: state.getRelationOptionsForCol
14884
+ getRelationOptionsForCol: state.getRelationOptionsForCol,
14885
+ selectedRowIds: state.selectedRowIds,
14886
+ filteredRecordsCount: state.filteredRecords.length,
14887
+ rawRecordsCount: state.rawRecords.length,
14888
+ loadTableData: state.loadTableData,
14889
+ isLoadingTableData: state.isLoadingTableData
14697
14890
  }
14698
14891
  ),
14699
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 items-stretch", children: [
14700
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14701
- TemplateSelectionBlock,
14702
- {
14703
- selectedTemplate: state.selectedTemplate,
14704
- selectedTemplateId: state.selectedTemplateId,
14705
- setSelectedTemplateId: state.setSelectedTemplateId,
14706
- templates: state.templates,
14707
- isLoadingTemplates: state.isLoadingTemplates,
14708
- isDropdownOpen: state.isDropdownOpen,
14709
- setIsDropdownOpen: state.setIsDropdownOpen,
14710
- templateBodyText: state.templateBodyText,
14711
- templateHeaderComp: state.templateHeaderComp,
14712
- headerMediaUrl: state.headerMediaUrl,
14713
- handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
14714
- handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
14715
- templateVariables: state.templateVariables,
14716
- variableMapping: state.variableMapping,
14717
- handleVariableTypeChange: state.handleVariableTypeChange,
14718
- handleVariableValueChange: state.handleVariableValueChange,
14719
- textableColumnOptions: state.textableColumnOptions,
14720
- handleDeleteTemplate: state.handleDeleteTemplate,
14721
- isDeleting: state.isDeleting,
14722
- setIsModalOpen: state.setIsModalOpen,
14723
- setFeedback: state.setFeedback,
14724
- isUploadingMedia: state.isUploadingMedia,
14725
- handleFileUpload: state.handleFileUpload
14726
- }
14727
- ),
14728
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14729
- DynamicFiltersBlock,
14730
- {
14731
- filterableColumns: state.filterableColumns,
14732
- filters: state.filters,
14733
- handleFilterChange: state.handleFilterChange,
14734
- handleClearFilters: state.handleClearFilters,
14735
- activeFiltersCount: state.activeFiltersCount,
14736
- relationOptions: state.relationOptions,
14737
- getRelationOptionsForCol: state.getRelationOptionsForCol,
14738
- selectedRowIds: state.selectedRowIds,
14739
- filteredRecordsCount: state.filteredRecords.length,
14740
- rawRecordsCount: state.rawRecords.length,
14741
- loadTableData: state.loadTableData,
14742
- isLoadingTableData: state.isLoadingTableData
14743
- }
14744
- ),
14745
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14746
- SettingsAndActionsBlock,
14747
- {
14748
- isScanningPhoneColumns: state.isScanningPhoneColumns,
14749
- targetPhoneOptions: state.targetPhoneOptions,
14750
- phoneColumnId: state.phoneColumnId,
14751
- setPhoneColumnId: state.setPhoneColumnId,
14752
- selectedPhoneOption: state.selectedPhoneOption,
14753
- autoSelectCount: state.autoSelectCount,
14754
- setAutoSelectCount: state.setAutoSelectCount,
14755
- subtableFilterColumn: state.subtableFilterColumn,
14756
- setSubtableFilterColumn: state.setSubtableFilterColumn,
14757
- subtableFilterValue: state.subtableFilterValue,
14758
- setSubtableFilterValue: state.setSubtableFilterValue,
14759
- subtableSendLimit: state.subtableSendLimit,
14760
- setSubtableSendLimit: state.setSubtableSendLimit,
14761
- subtableFilterableColumns: state.subtableFilterableColumns,
14762
- selectedSubtableFilterCol: state.selectedSubtableFilterCol,
14763
- getRelationOptionsForCol: state.getRelationOptionsForCol,
14764
- relationOptions: state.relationOptions,
14765
- enablePostSendAction: state.enablePostSendAction,
14766
- setEnablePostSendAction: state.setEnablePostSendAction,
14767
- postSendActionColumn: state.postSendActionColumn,
14768
- setPostSendActionColumn: state.setPostSendActionColumn,
14769
- postSendActionValue: state.postSendActionValue,
14770
- setPostSendActionValue: state.setPostSendActionValue,
14771
- postSendActionTargetType: state.postSendActionTargetType,
14772
- setPostSendActionTargetType: state.setPostSendActionTargetType,
14773
- postSendActionTargetOptions: state.postSendActionTargetOptions,
14774
- selectedPostSendOption: state.selectedPostSendCol,
14775
- isTestDisabled: state.isTestDisabled,
14776
- testButtonTitle: state.testButtonTitle,
14777
- setIsTestPromptOpen: state.setIsTestPromptOpen,
14778
- isSendDisabled: state.isSendDisabled,
14779
- sendButtonTitle: state.sendButtonTitle,
14780
- handleSendMessages: state.handleSendMessages,
14781
- selectedRowIdsCount: state.selectedRowIds.length,
14782
- finalRecipientCount: state.finalRecipientCount,
14783
- validMainRowsCount: state.validMainRowsCount,
14784
- isSendingBroadcast: state.isSendingBroadcast,
14785
- broadcastProgress: state.broadcastProgress,
14786
- broadcastSummary: state.broadcastSummary,
14787
- clearBroadcastSummary: state.clearBroadcastSummary
14788
- }
14789
- )
14790
- ] })
14892
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14893
+ SettingsAndActionsBlock,
14894
+ {
14895
+ isScanningPhoneColumns: state.isScanningPhoneColumns,
14896
+ targetPhoneOptions: state.targetPhoneOptions,
14897
+ phoneColumnId: state.phoneColumnId,
14898
+ setPhoneColumnId: state.setPhoneColumnId,
14899
+ selectedPhoneOption: state.selectedPhoneOption,
14900
+ autoSelectCount: state.autoSelectCount,
14901
+ setAutoSelectCount: state.setAutoSelectCount,
14902
+ subtableFilterColumn: state.subtableFilterColumn,
14903
+ setSubtableFilterColumn: state.setSubtableFilterColumn,
14904
+ subtableFilterValue: state.subtableFilterValue,
14905
+ setSubtableFilterValue: state.setSubtableFilterValue,
14906
+ subtableSendLimit: state.subtableSendLimit,
14907
+ setSubtableSendLimit: state.setSubtableSendLimit,
14908
+ subtableFilterableColumns: state.subtableFilterableColumns,
14909
+ selectedSubtableFilterCol: state.selectedSubtableFilterCol,
14910
+ getRelationOptionsForCol: state.getRelationOptionsForCol,
14911
+ relationOptions: state.relationOptions,
14912
+ enablePostSendAction: state.enablePostSendAction,
14913
+ setEnablePostSendAction: state.setEnablePostSendAction,
14914
+ postSendActionColumn: state.postSendActionColumn,
14915
+ setPostSendActionColumn: state.setPostSendActionColumn,
14916
+ postSendActionValue: state.postSendActionValue,
14917
+ setPostSendActionValue: state.setPostSendActionValue,
14918
+ postSendActionTargetType: state.postSendActionTargetType,
14919
+ setPostSendActionTargetType: state.setPostSendActionTargetType,
14920
+ postSendActionTargetOptions: state.postSendActionTargetOptions,
14921
+ selectedPostSendOption: state.selectedPostSendCol,
14922
+ isTestDisabled: state.isTestDisabled,
14923
+ testButtonTitle: state.testButtonTitle,
14924
+ setIsTestPromptOpen: state.setIsTestPromptOpen,
14925
+ isSendDisabled: state.isSendDisabled,
14926
+ sendButtonTitle: state.sendButtonTitle,
14927
+ handleSendMessages: state.handleSendMessages,
14928
+ selectedRowIdsCount: state.selectedRowIds.length,
14929
+ finalRecipientCount: state.finalRecipientCount,
14930
+ validMainRowsCount: state.validMainRowsCount,
14931
+ isSendingBroadcast: state.isSendingBroadcast,
14932
+ broadcastProgress: state.broadcastProgress,
14933
+ broadcastSummary: state.broadcastSummary,
14934
+ clearBroadcastSummary: state.clearBroadcastSummary
14935
+ }
14936
+ )
14791
14937
  ] }),
14792
14938
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-full h-[calc(100vh-420px)] min-h-[320px] overflow-hidden border border-slate-200 rounded-2xl shadow-xs bg-white flex flex-col", children: state.isLoadingTableData && state.rawRecords.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
14793
14939
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.Loader2, { className: "w-6 h-6 animate-spin text-emerald-600" }),
@@ -14813,8 +14959,7 @@ function WhatsAppComponent(props) {
14813
14959
  orgId,
14814
14960
  componentId: `${componentId || "whatsapp"}-embedded-table`,
14815
14961
  className: "h-full flex-1 border-0 rounded-2xl shadow-none",
14816
- rowStatusMap: state.rowStatusMap,
14817
- hideRelationButtons: true
14962
+ rowStatusMap: state.rowStatusMap
14818
14963
  }
14819
14964
  ) })
14820
14965
  ] }),