var ko = Object.defineProperty; var Wo = (e, t, o) => t in e ? ko(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o; var M = (e, t, o) => Wo(e, typeof t != "symbol" ? t + "" : t, o); import Zt, { useState as W, forwardRef as we, useRef as We, createElement as Re, useMemo as He, useEffect as Ce } from "react"; import { Inject as b, LocaleService as J, Disposable as De, DataValidationErrorStyle as it, useDependency as L, ICommandService as Q, dayjs as qt, numfmt as Jt, CellValueType as Ho, UniverInstanceType as Y, toDisposable as Yo, IUniverInstanceService as ge, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Xo, DisposableCollection as zo, CommandType as Je, BuildTextUtils as Ko, DataValidationRenderMode as de, DataValidationType as z, IConfigService as pn, UndoCommand as Go, RedoCommand as Zo, isUnitRangesEqual as qo, debounce as Jo, shallowEqual as bn, Injector as Fe, DataValidationStatus as rt, ObjectMatrix as _t, Range as Qo, Rectangle as St, queryObjectMatrix as Qt, Optional as ea, RxDisposable as fn, InterceptorEffectEnum as Kn, sequenceExecute as Gn, bufferDebounceTime as ta, isFormulaString as Pe, Tools as en, ThemeService as na, VerticalAlign as ue, HorizontalAlign as Ye, DEFAULT_STYLES as le, WrapStrategy as Se, DocumentDataModel as oa, DEFAULT_EMPTY_DOCUMENT_VALUE as aa, BooleanNumber as Qe, Plugin as Zn, merge as qn } from "@univerjs/core"; import { Button as je, DatePanel as ia, Scrollbar as ra, FormLayout as Z, RadioGroup as mn, Radio as Ae, Checkbox as Ot, Input as xe, Select as tn, DraggableList as sa } from "@univerjs/design"; import { DeviceInputEventType as nn, IRenderManagerService as Ve, fixLineWidthByScale as En, Transform as la, CheckboxShape as da, CURSOR_TYPE as Xe, FontCache as ca, Shape as ua, Rect as Jn, getFontStyleString as jt, getDocsSkeletonPageSize as et, DocumentViewModel as ha, DocumentSkeleton as pa, Documents as fa } from "@univerjs/engine-render"; import { SheetInterceptorService as gn, AFTER_CELL_EDIT_ASYNC as ma, SetRangeValuesCommand as vn, SheetsSelectionsService as Qn, getSheetCommandTarget as eo, SheetPermissionCheckController as to, WorkbookEditablePermission as Ct, RangeProtectionPermissionEditPoint as It, WorksheetEditPermission as wt, checkRangesEditablePermission as ga, WorksheetSetCellStylePermission as on, INTERCEPTOR_POINT as no, InterceptCellContentPriority as oo } from "@univerjs/sheets"; import { SheetDataValidationModel as oe, getCellValueOrigin as ie, getDataValidationCellValue as va, deserializeListOptions as ao, serializeListOptions as io, UpdateSheetDataValidationRangeCommand as ro, UpdateSheetDataValidationSettingCommand as On, RemoveSheetDataValidationCommand as so, UpdateSheetDataValidationOptionsCommand as _a, createDefaultNewRule as lo, AddSheetDataValidationCommand as _n, RemoveSheetAllDataValidationCommand as Sa, DATA_VALIDATION_PLUGIN_NAME as co, getDataValidationDiffMutations as an, DataValidationCacheService as uo, DataValidationFormulaController as Ca, DataValidationFormulaService as Ia, getFormulaResult as Ft, isLegalFormulaResult as Ln, transformCheckboxValue as wa, CHECKBOX_FORMULA_1 as Ra, CHECKBOX_FORMULA_2 as Da } from "@univerjs/sheets-data-validation"; import { getPatternType as Va } from "@univerjs/sheets-numfmt"; import { SetCellEditVisibleOperation as ho, SheetCanvasPopManagerService as ya, IEditorBridgeService as po, IMarkSelectionService as Ma, HoverManagerService as ba, CellAlertManagerService as Ea, CellAlertType as Oa, IAutoFillService as La, APPLY_TYPE as tt, virtualizeDiscreteRanges as rn, getAutoFillRepeatRange as Pa, COPY_TYPE as Pn, rangeToDiscreteRange as Ta, PREDEFINED_HOOK_NAME as dt, getRepeatRange as Tn, ISheetClipboardService as Aa, getCurrentRangeDisable$ as xa, AutoHeightController as fo, SheetSkeletonManagerService as Rt } from "@univerjs/sheets-ui"; import { IDialogService as ja, KeyCode as sn, ISidebarService as mo, useObservable as Ne, ComponentManager as Lt, IZenZoneService as go, RectPopup as Fa, useEvent as ln, useSidebarClick as Sn, MenuItemType as Cn, getMenuHiddenObservable as Na, RibbonStartGroup as Ua, IMenuManagerService as Ba } from "@univerjs/ui"; import { DataValidatorRegistryService as ye, DataValidationModel as Pt, DataValidatorRegistryScope as $a, TWO_FORMULA_OPERATOR_COUNT as ka, getRuleOptions as An, getRuleSetting as xn } from "@univerjs/data-validation"; import { RichTextEditingMutation as Wa } from "@univerjs/docs"; import { filter as In, BehaviorSubject as jn, distinctUntilChanged as Ha, Subject as Ya, debounceTime as wn, bufferTime as vo } from "rxjs"; import { deserializeRangeWithSheet as Xa, serializeRange as _o } from "@univerjs/engine-formula"; import { RangeSelector as za, FormulaEditor as So } from "@univerjs/sheets-formula-ui"; var Nt = { exports: {} }, nt = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Fn; function Ka() { if (Fn) return nt; Fn = 1; var e = Zt, t = Symbol.for("react.element"), o = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, a = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 }; function r(l, s, c) { var u, p = {}, d = null, g = null; c !== void 0 && (d = "" + c), s.key !== void 0 && (d = "" + s.key), s.ref !== void 0 && (g = s.ref); for (u in s) n.call(s, u) && !i.hasOwnProperty(u) && (p[u] = s[u]); if (l && l.defaultProps) for (u in s = l.defaultProps, s) p[u] === void 0 && (p[u] = s[u]); return { $$typeof: t, type: l, key: d, ref: g, props: p, _owner: a.current }; } return nt.Fragment = o, nt.jsx = r, nt.jsxs = r, nt; } var Nn; function Ga() { return Nn || (Nn = 1, Nt.exports = Ka()), Nt.exports; } var h = Ga(), Za = Object.defineProperty, qa = Object.getOwnPropertyDescriptor, Ja = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? qa(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && Za(t, o, a), a; }, ot = (e, t) => (o, n) => t(o, n, e); let st = class extends De { constructor(e, t, o, n, a) { super(), this._sheetInterceptorService = e, this._dataValidationModel = t, this._dataValidatorRegistryService = o, this._dialogService = n, this._localeService = a, this._initEditorBridgeInterceptor(); } _initEditorBridgeInterceptor() { this._sheetInterceptorService.writeCellInterceptor.intercept( ma, { handler: async (e, t, o) => { var C; const n = await e, { worksheet: a, row: i, col: r, unitId: l, subUnitId: s, workbook: c } = t, u = this._dataValidationModel.getRuleIdByLocation(l, s, i, r), p = u ? this._dataValidationModel.getRuleById(l, s, u) : void 0; if (!p || p.errorStyle !== it.STOP) return o(Promise.resolve(n)); const d = await this._dataValidatorRegistryService.getValidatorItem(p.type); if (!d || await d.validator( { value: ie(n), interceptValue: ie((C = t == null ? void 0 : t.origin) != null ? C : n), row: i, column: r, unitId: l, subUnitId: s, worksheet: a, workbook: c, t: n == null ? void 0 : n.t }, p )) return o(Promise.resolve(n)); const f = a.getCellRaw(i, r); return this._dialogService.open({ width: 368, title: { title: this._localeService.t("dataValidation.alert.title") }, id: "reject-input-dialog", children: { title: d.getRuleFinalError(p, { row: i, col: r, unitId: l, subUnitId: s }) }, footer: { title: Zt.createElement( je, { type: "primary", onClick: () => this._dialogService.close("reject-input-dialog") }, this._localeService.t("dataValidation.alert.ok") ) }, onClose: () => { this._dialogService.close("reject-input-dialog"); } }), o(Promise.resolve(f)); } } ); } showReject(e) { this._dialogService.open({ width: 368, title: { title: this._localeService.t("dataValidation.alert.title") }, id: "reject-input-dialog", children: { title: e }, footer: { title: Zt.createElement( je, { type: "primary", onClick: () => this._dialogService.close("reject-input-dialog") }, this._localeService.t("dataValidation.alert.ok") ) }, onClose: () => { this._dialogService.close("reject-input-dialog"); } }); } }; st = Ja([ ot(0, b(gn)), ot(1, b(oe)), ot(2, b(ye)), ot(3, ja), ot(4, b(J)) ], st); const Qa = "univer-dv-date-dropdown", ei = "univer-dv-date-dropdown-btns", Un = { dvDateDropdown: Qa, dvDateDropdownBtns: ei }, ti = (e) => { if (e == null || typeof e == "boolean") return; if (typeof e == "number" || !Number.isNaN(+e)) return qt(Jt.format("yyyy-MM-dd HH:mm:ss", Number(e))); const t = qt(e); if (t.isValid()) return t; }; function ni(e) { var m; const { location: t, hideFn: o } = e, { worksheet: n, row: a, col: i, unitId: r, subUnitId: l, workbook: s } = t, c = L(Q), u = L(st), p = n.getCell(a, i), d = ie(n.getCellRaw(a, i)), g = ti(d), [f, C] = W(g), R = f && f.isValid() ? f : qt(), v = L(J), w = L(oe), I = w.getRuleByLocation(r, l, a, i); if (!I) return null; const V = w.getValidator(I.type); if (!p || !V) return; const _ = !!((m = I.bizInfo) != null && m.showTime), S = async () => { var x, j, N; if (!R) return; const P = R.format(_ ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), F = (x = Jt.parseDate(P)) == null ? void 0 : x.v, T = s.getStyles().getStyleByCell(p), E = (N = (j = T == null ? void 0 : T.n) == null ? void 0 : j.pattern) != null ? N : "", A = Va(E); I.errorStyle !== it.STOP || await V.validator({ value: F, unitId: r, subUnitId: l, row: a, column: i, worksheet: n, workbook: s, interceptValue: P.replace("Z", "").replace("T", " "), t: Ho.NUMBER }, I) ? (o(), await c.executeCommand(ho.id, { visible: !1, eventType: nn.Keyboard, unitId: r, keycode: sn.ESC }), await c.executeCommand(vn.id, { unitId: r, subUnitId: l, range: { startColumn: i, endColumn: i, startRow: a, endRow: a }, value: { v: F, t: 2, p: null, f: null, si: null, s: { n: { pattern: _ ? A === "datetime" ? E : "yyyy-MM-dd hh:mm:ss" : A === "date" ? E : "yyyy-MM-dd" } } } })) : u.showReject(V.getRuleFinalError(I, { row: a, col: i, unitId: r, subUnitId: l })); }; return /* @__PURE__ */ h.jsxs("div", { className: Un.dvDateDropdown, children: [ /* @__PURE__ */ h.jsx( ia, { defaultValue: R, pickerValue: R, showTime: _ || void 0, onSelect: async (y) => { C(y); }, onPanelChange: (y) => { C(y); }, disabledDate: (y) => !Jt.parseDate(y.format("YYYY-MM-DD")) } ), /* @__PURE__ */ h.jsx("div", { className: Un.dvDateDropdownBtns, children: /* @__PURE__ */ h.jsx(je, { size: "small", type: "primary", onClick: S, disabled: !R.isValid(), children: v.t("dataValidation.alert.ok") }) }) ] }); } var ce = function() { return ce = Object.assign || function(e) { for (var t, o = 1, n = arguments.length; o < n; o++) { t = arguments[o]; for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]); } return e; }, ce.apply(this, arguments); }, oi = function(e, t) { var o = {}; for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++) t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]); return o; }, Me = we(function(e, t) { var o = e.icon, n = e.id, a = e.className, i = e.extend, r = oi(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(a || "").trim(), s = We("_".concat(ri())); return Co(o, "".concat(n), { defIds: o.defIds, idSuffix: s.current }, ce({ ref: t, className: l }, r), i); }); function Co(e, t, o, n, a) { return Re(e.tag, ce(ce({ key: t }, ai(e, o, a)), n), (ii(e, o).children || []).map(function(i, r) { return Co(i, "".concat(t, "-").concat(e.tag, "-").concat(r), o, void 0, a); })); } function ai(e, t, o) { var n = ce({}, e.attrs); o != null && o.colorChannel1 && n.fill === "colorChannel1" && (n.fill = o.colorChannel1); var a = t.defIds; return !a || a.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) { var r = i[0], l = i[1]; typeof l == "string" && (n[r] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")"))); })), n; } function ii(e, t) { var o, n = t.defIds; return !n || n.length === 0 ? e : e.tag === "defs" && (!((o = e.children) === null || o === void 0) && o.length) ? ce(ce({}, e), { children: e.children.map(function(a) { return typeof a.attrs.id == "string" && n && n.indexOf(a.attrs.id) > -1 ? ce(ce({}, a), { attrs: ce(ce({}, a.attrs), { id: a.attrs.id + t.idSuffix }) }) : a; }) }) : e; } function ri() { return Math.random().toString(36).substring(2, 8); } Me.displayName = "UniverIcon"; var si = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Io = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "check-mark-single", ref: t, icon: si })); }); Io.displayName = "CheckMarkSingle"; var li = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.4917 3.07803C1.4917 2.19437 2.20804 1.47803 3.0917 1.47803H5.6917C6.57536 1.47803 7.2917 2.19437 7.2917 3.07803V5.67803C7.2917 6.56168 6.57535 7.27803 5.6917 7.27803H3.0917C2.20804 7.27803 1.4917 6.56168 1.4917 5.67803V3.07803ZM3.0917 2.67803C2.87078 2.67803 2.6917 2.85711 2.6917 3.07803V5.67803C2.6917 5.89894 2.87079 6.07803 3.0917 6.07803H5.6917C5.91261 6.07803 6.0917 5.89894 6.0917 5.67803V3.07803C6.0917 2.85711 5.91261 2.67803 5.6917 2.67803H3.0917Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.6175 2.45279C14.8518 2.68711 14.8518 3.06701 14.6175 3.30132L11.6151 6.30365C11.3957 6.52307 11.0451 6.53897 10.8067 6.34031L8.80915 4.67566C8.55458 4.46352 8.52019 4.08518 8.73233 3.83062 8.94447 3.57605 9.32281 3.54166 9.57737 3.7538L11.154 5.06767 13.769 2.45278C14.0033 2.21847 14.3832 2.21848 14.6175 2.45279zM14.1175 9.19746C14.3518 9.43178 14.3518 9.81168 14.1175 10.046L12.5418 11.6217 14.1175 13.1975C14.3518 13.4318 14.3518 13.8117 14.1175 14.046 13.8832 14.2803 13.5033 14.2803 13.269 14.046L11.6933 12.4703 10.1175 14.046C9.88321 14.2803 9.50331 14.2803 9.269 14.046 9.03468 13.8117 9.03468 13.4318 9.269 13.1975L10.8447 11.6217 9.269 10.046C9.03468 9.81168 9.03468 9.43178 9.269 9.19746 9.50331 8.96315 9.88321 8.96315 10.1175 9.19746L11.6933 10.7732 13.269 9.19746C13.5033 8.96315 13.8832 8.96315 14.1175 9.19746z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.0917 8.72168C2.20804 8.72168 1.4917 9.43802 1.4917 10.3217V12.9217C1.4917 13.8053 2.20804 14.5217 3.0917 14.5217H5.6917C6.57535 14.5217 7.2917 13.8053 7.2917 12.9217V10.3217C7.2917 9.43802 6.57536 8.72168 5.6917 8.72168H3.0917ZM2.6917 10.3217C2.6917 10.1008 2.87078 9.92168 3.0917 9.92168H5.6917C5.91261 9.92168 6.0917 10.1008 6.0917 10.3217V12.9217C6.0917 13.1426 5.91261 13.3217 5.6917 13.3217H3.0917C2.87079 13.3217 2.6917 13.1426 2.6917 12.9217V10.3217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, wo = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "data-validation-single", ref: t, icon: li })); }); wo.displayName = "DataValidationSingle"; var di = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Rn = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "delete-single", ref: t, icon: di })); }); Rn.displayName = "DeleteSingle"; var ci = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, Ro = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "increase-single", ref: t, icon: ci })); }); Ro.displayName = "IncreaseSingle"; var ui = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Do = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "more-down-single", ref: t, icon: ui })); }); Do.displayName = "MoreDownSingle"; var hi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.64645 9.85355C4.45118 9.65829 4.45118 9.34171 4.64645 9.14645L7.64645 6.14645C7.84171 5.95118 8.15829 5.95118 8.35355 6.14645L11.3536 9.14645C11.5488 9.34171 11.5488 9.65829 11.3536 9.85355C11.1583 10.0488 10.8417 10.0488 10.6464 9.85355L8 7.20711L5.35355 9.85355C5.15829 10.0488 4.84171 10.0488 4.64645 9.85355Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vo = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "more-up-single", ref: t, icon: hi })); }); Vo.displayName = "MoreUpSingle"; var pi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] }, yo = we(function(e, t) { return Re(Me, Object.assign({}, e, { id: "sequence-single", ref: t, icon: pi })); }); yo.displayName = "SequenceSingle"; var fi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, gi = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? mi(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && fi(t, o, a), a; }, Bn = (e, t) => (o, n) => t(o, n, e); let fe = class extends De { constructor(t, o) { super(); M(this, "_open$", new jn(!1)); M(this, "open$", this._open$.pipe(Ha())); M(this, "_activeRule"); M(this, "_activeRule$", new jn(void 0)); M(this, "activeRule$", this._activeRule$.asObservable()); M(this, "_closeDisposable", null); this._univerInstanceService = t, this._sidebarService = o, this.disposeWithMe( this._univerInstanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(In((n) => !n)).subscribe(() => { this.close(); }) ), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((n) => { n.id === Dt && (n.visible || setTimeout(() => { this._sidebarService.sidebarOptions$.next({ visible: !1 }); })); })); } get activeRule() { return this._activeRule; } get isOpen() { return this._open$.getValue(); } dispose() { var t; super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (t = this._closeDisposable) == null || t.dispose(); } open() { this._open$.next(!0); } close() { var t; this._open$.next(!1), (t = this._closeDisposable) == null || t.dispose(); } setCloseDisposable(t) { this._closeDisposable = Yo(() => { t.dispose(), this._closeDisposable = null; }); } setActiveRule(t) { this._activeRule = t, this._activeRule$.next(t); } }; fe = gi([ Bn(0, ge), Bn(1, mo) ], fe); function vi() { const e = L(Ie), t = Ne(e.activeDropdown$, e.activeDropdown), o = L(Lt); if (!t) return null; const { location: n, componentKey: a } = t, i = o.get(a), r = `${n.unitId}-${n.subUnitId}-${n.row}-${n.col}`; if (!i) return null; const l = () => { e.hideDropdown(); }; return /* @__PURE__ */ h.jsx( i, { location: n, hideFn: l }, r ); } const Mo = "sheet.ui.dropdown"; var _i = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, Ci = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? Si(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && _i(t, o, a), a; }, be = (e, t) => (o, n) => t(o, n, e); let Ie = class extends De { constructor(t, o, n, a, i, r, l) { super(); M(this, "_activeDropdown"); M(this, "_activeDropdown$", new Ya()); M(this, "_currentPopup", null); M(this, "activeDropdown$", this._activeDropdown$.asObservable()); M(this, "_zenVisible", !1); this._canvasPopupManagerService = t, this._univerInstanceService = o, this._dataValidatorRegistryService = n, this._zenZoneService = a, this._renderManagerService = i, this._dataValidationModel = r, this._sheetsSelectionsService = l, this._init(), this._initSelectionChange(), this.disposeWithMe(() => { this._activeDropdown$.complete(); }); } get activeDropdown() { return this._activeDropdown; } _init() { this.disposeWithMe(this._zenZoneService.visible$.subscribe((t) => { this._zenVisible = t, t && this.hideDropdown(); })); } _getDropdownByCell(t, o, n, a) { const i = t ? this._univerInstanceService.getUnit(t, Y.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(Y.UNIVER_SHEET); if (!i) return; const r = o ? i.getSheetBySheetId(o) : i.getActiveSheet(); if (!r) return; const l = this._dataValidationModel.getRuleByLocation(i.getUnitId(), r.getSheetId(), n, a); if (!l) return; const s = this._dataValidatorRegistryService.getValidatorItem(l.type); return s == null ? void 0 : s.dropdown; } _initSelectionChange() { this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe((t) => { t && t.every((o) => !(o.primary && this._getDropdownByCell(o.primary.unitId, o.primary.sheetId, o.primary.actualRow, o.primary.actualColumn))) && this.hideDropdown(); })); } showDropdown(t, o = !0) { const { location: n } = t, { row: a, col: i, unitId: r, subUnitId: l } = n; if (this._currentPopup && this._currentPopup.dispose(), this._zenVisible) return; this._activeDropdown = t, this._activeDropdown$.next(this._activeDropdown); const s = this._renderManagerService.getRenderById(Xo), c = this._canvasPopupManagerService.attachPopupToCell( a, i, { componentKey: Mo, onClickOutside: () => { o && this.hideDropdown(); }, offset: [0, 3], excludeOutside: [s == null ? void 0 : s.engine.getCanvasElement()].filter(Boolean) }, r, l ); if (!c) throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!"); const u = new zo(); u.add(c), u.add({ dispose: () => { var p, d; (d = (p = this._activeDropdown) == null ? void 0 : p.onHide) == null || d.call(p); } }), this._currentPopup = u; } hideDropdown() { this._activeDropdown && (this._currentPopup && this._currentPopup.dispose(), this._currentPopup = null, this._activeDropdown = null, this._activeDropdown$.next(null)); } showDataValidationDropdown(t, o, n, a, i) { const r = this._univerInstanceService.getUnit(t, Y.UNIVER_SHEET); if (!r) return; const l = r.getSheetBySheetId(o); if (!l) return; const s = this._dataValidationModel.getRuleByLocation(r.getUnitId(), l.getSheetId(), n, a); if (!s) return; const c = this._dataValidatorRegistryService.getValidatorItem(s.type); if (!c || !c.dropdown) { this.hideDropdown(); return; } this.showDropdown({ location: { workbook: r, worksheet: l, row: n, col: a, unitId: t, subUnitId: o }, componentKey: c.dropdown, onHide: i }); } }; Ie = Ci([ be(0, b(ya)), be(1, ge), be(2, b(ye)), be(3, go), be(4, Ve), be(5, b(oe)), be(6, b(Qn)) ], Ie); const Dt = "DataValidationPanel", Ue = { id: "data-validation.operation.open-validation-panel", type: Je.OPERATION, handler(e, t) { if (!t) return !1; const { ruleId: o, isAdd: n } = t, a = e.get(fe), i = e.get(Pt), r = e.get(ge), l = e.get(mo), s = eo(r); if (!s) return !1; const { unitId: c, subUnitId: u } = s, p = o ? i.getRuleById(c, u, o) : void 0; a.open(), a.setActiveRule(p && { unitId: c, subUnitId: u, rule: p }); const d = l.open({ id: Dt, header: { title: n ? "dataValidation.panel.addTitle" : "dataValidation.panel.title" }, children: { label: Dt }, width: 312, onClose: () => a.close() }); return a.setCloseDisposable(d), !0; } }, Dn = { id: "data-validation.operation.close-validation-panel", type: Je.OPERATION, handler(e) { return e.get(fe).close(), !0; } }, bo = { id: "data-validation.operation.toggle-validation-panel", type: Je.OPERATION, handler(e) { const t = e.get(Q), o = e.get(fe); return o.open(), o.isOpen ? t.executeCommand(Dn.id) : t.executeCommand(Ue.id), !0; } }, Tt = { type: Je.OPERATION, id: "sheet.operation.show-data-validation-dropdown", handler(e, t) { if (!t) return !1; const o = e.get(Ie), { unitId: n, subUnitId: a, row: i, column: r } = t, l = o.activeDropdown, s = l == null ? void 0 : l.location; return s && s.unitId === n && s.subUnitId === a && s.row === i && s.col === r || o.showDataValidationDropdown( n, a, i, r ), !0; } }, Eo = { type: Je.OPERATION, id: "sheet.operation.hide-data-validation-dropdown", handler(e, t) { return t ? (e.get(Ie).hideDropdown(), !0) : !1; } }, Te = "#ECECEC", Vn = "sheets-data-validation-ui.config", Vt = {}, Ii = "univer-dv-list-dropdown", wi = "univer-dv-list-dropdown-title", Ri = "univer-dv-list-dropdown-list", Di = "univer-dv-list-dropdown-list-container", Vi = "univer-dv-list-dropdown-selected-icon", yi = "univer-dv-list-dropdown-item-container", Mi = "univer-dv-list-dropdown-item", bi = "univer-dv-list-dropdown-split", Ei = "univer-dv-list-dropdown-edit", ve = { dvListDropdown: Ii, dvListDropdownTitle: wi, dvListDropdownList: Ri, dvListDropdownListContainer: Di, dvListDropdownSelectedIcon: Vi, dvListDropdownItemContainer: yi, dvListDropdownItem: Mi, dvListDropdownSplit: bi, dvListDropdownEdit: Ei }, Oi = (e) => { var _, S; const { value: t, onChange: o, multiple: n, options: a, title: i, onEdit: r, style: l, filter: s, location: c } = e, u = L(J), p = L(pn), d = s == null ? void 0 : s.toLowerCase(), { row: g, col: f, unitId: C, subUnitId: R } = c, v = a.filter((m) => d ? m.label.toLowerCase().includes(d) : !0), w = (S = (_ = p.getConfig(Vn)) == null ? void 0 : _.showEditOnDropdown) != null ? S : !0, I = L(to), V = He(() => I.permissionCheckWithRanges( { workbookTypes: [Ct], rangeTypes: [It], worksheetTypes: [wt] }, [{ startColumn: f, startRow: g, endColumn: f, endRow: g }], C, R ), [I, f, g, C, R]); return /* @__PURE__ */ h.jsxs("div", { className: ve.dvListDropdown, style: l, children: [ /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownTitle, children: i }), /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownList, children: /* @__PURE__ */ h.jsx(ra, { children: /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownListContainer, children: v.map((m, y) => { const P = t.indexOf(m.value) > -1, F = () => { let E; P ? E = new Set(t.filter((x) => x !== m.value)) : E = new Set(n ? [...t, m.value] : [m.value]); const A = []; a.forEach((x) => { E.has(x.value) && A.push(x.value); }), o(A); }, T = m.label.toLocaleLowerCase().indexOf(d); return /* @__PURE__ */ h.jsxs("div", { className: ve.dvListDropdownItemContainer, onClick: F, children: [ /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownItem, style: { background: m.color || Te }, children: d && m.label.toLowerCase().includes(d) ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsx("span", { children: m.label.substring(0, T) }), /* @__PURE__ */ h.jsx("span", { style: { fontWeight: "bold" }, children: m.label.substring(T, T + d.length) }), /* @__PURE__ */ h.jsx("span", { children: m.label.substring(T + d.length) }) ] }) : m.label }), /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownSelectedIcon, children: P ? /* @__PURE__ */ h.jsx(Io, {}) : null }) ] }, y); }) }) }, s) }), w && V ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownSplit }), /* @__PURE__ */ h.jsx("div", { className: ve.dvListDropdownEdit, children: /* @__PURE__ */ h.jsx("a", { onClick: r, children: u.t("dataValidation.list.edit") }) }) ] }) : null ] }); }; function Li(e) { var j, N, H, X; const { location: t, hideFn: o } = e, { worksheet: n, row: a, col: i, unitId: r, subUnitId: l } = t, s = L(Pt), [c, u] = W(""), p = L(Q), d = L(J), [g, f] = W(""), C = L(po), R = L(ge), v = He(() => s.ruleChange$.pipe(wn(16)), []), w = L(oe); Ne(v); const I = Fa.useContext(), V = ((N = (j = I.current) == null ? void 0 : j.right) != null ? N : 0) - ((X = (H = I.current) == null ? void 0 : H.left) != null ? X : 0); if (Ce(() => { const k = p.onCommandExecuted((K) => { var q, ee; if (K.id === Wa.id) { const te = K.params, { unitId: re } = te, ae = R.getUnit(re, Y.UNIVER_DOC); if (!ae || !C.isVisible().visible) return; const se = Ko.transform.getPlainText((ee = (q = ae.getSnapshot().body) == null ? void 0 : q.dataStream) != null ? ee : ""); u(se); } }); return () => { k.dispose(); }; }, [p, C, R]), !n) return null; const _ = w.getRuleByLocation(r, l, a, i); if (!_) return null; const S = w.getValidator(_.type); if (!S) return null; const m = n.getCell(a, i), y = (_ == null ? void 0 : _.renderMode) === de.CUSTOM || (_ == null ? void 0 : _.renderMode) === void 0; if (!m || !_ || !S || S.id.indexOf(z.LIST) !== 0) return; const P = _.type === z.LIST_MULTIPLE, F = S.getListWithColor(_, r, l), T = g || va(n.getCellRaw(a, i)), E = ao(T), A = () => { p.executeCommand(Ue.id, { ruleId: _.uid }), o(); }, x = F.map((k) => ({ label: k.label, value: k.label, color: y || k.color ? k.color : "transparent" })); return /* @__PURE__ */ h.jsx( Oi, { style: { minWidth: V, maxWidth: Math.max(V, 200) }, title: P ? d.t("dataValidation.listMultiple.dropdown") : d.t("dataValidation.list.dropdown"), value: E, multiple: P, onChange: async (k) => { const K = io(k), q = { unitId: r, subUnitId: l, range: { startColumn: i, endColumn: i, startRow: a, endRow: a }, value: { v: K, p: null, f: null, si: null } }; C.isVisible() && C.changeVisible({ visible: !1, keycode: sn.ESC, eventType: nn.Keyboard, unitId: r }), f(K), P || o(), C.isVisible().visible && await p.executeCommand(ho.id, { visible: !1, eventType: nn.Keyboard, unitId: r, keycode: sn.ESC }), p.executeCommand(vn.id, q); }, options: x, onEdit: A, filter: c, location: t } ); } const Pi = "univer-data-validation-options-button", Ti = "univer-data-validation-options-button-icon", Ut = { dataValidationOptionsButton: Pi, dataValidationOptionsButtonIcon: Ti }; function Ai(e) { var c; const t = L(J), o = L(Lt), { value: n, onChange: a, extraComponent: i } = e, [r, l] = W(!1), s = i ? o.get(i) : null; return /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsxs("div", { className: Ut.dataValidationOptionsButton, onClick: () => l(!r), children: [ t.t("dataValidation.panel.options"), r ? /* @__PURE__ */ h.jsx(Vo, { className: Ut.dataValidationOptionsButtonIcon }) : /* @__PURE__ */ h.jsx(Do, { className: Ut.dataValidationOptionsButtonIcon }) ] }), r && /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ s ? /* @__PURE__ */ h.jsx(s, { value: n, onChange: a }) : null, /* @__PURE__ */ h.jsx( Z, { label: t.t("dataValidation.panel.invalid"), children: /* @__PURE__ */ h.jsxs( mn, { value: `${(c = n.errorStyle) != null ? c : it.WARNING}`, onChange: (u) => a({ ...n, errorStyle: +u }), children: [ /* @__PURE__ */ h.jsx(Ae, { value: `${it.WARNING}`, children: t.t("dataValidation.panel.showWarning") }), /* @__PURE__ */ h.jsx(Ae, { value: `${it.STOP}`, children: t.t("dataValidation.panel.rejectInput") }) ] } ) } ), /* @__PURE__ */ h.jsx( Z, { label: t.t("dataValidation.panel.messageInfo"), children: /* @__PURE__ */ h.jsx( Ot, { checked: n.showErrorMessage, onChange: () => a({ ...n, showErrorMessage: !n.showErrorMessage }), children: t.t("dataValidation.panel.showInfo") } ) } ), n.showErrorMessage ? /* @__PURE__ */ h.jsx(Z, { children: /* @__PURE__ */ h.jsx(xe, { value: n.error, onChange: (u) => a({ ...n, error: u }) }) }) : null ] }) ] }); } const xi = "univer-data-validation-detail", ji = "univer-data-validation-detail-form-item", Fi = "univer-data-validation-detail-buttons", Ni = "univer-data-validation-detail-button", Be = { dataValidationDetail: xi, dataValidationDetailFormItem: ji, dataValidationDetailButtons: Fi, dataValidationDetailButton: Ni }, Ui = (e) => Jo( async (t, o, n, a) => { const i = await e.executeCommand(t, o, n); a == null || a(i); }, 1e3 ); function Bi(e, t, o) { var n, a, i, r; return t ? ((a = (n = e.getUnit(t)) == null ? void 0 : n.getSheetBySheetName(o)) == null ? void 0 : a.getSheetId()) || "" : ((r = (i = e.getCurrentUnitForType(Y.UNIVER_SHEET)) == null ? void 0 : i.getSheetBySheetName(o)) == null ? void 0 : r.getSheetId()) || ""; } function $i() { var se; const [e, t] = W(0), o = L(fe), n = Ne(o.activeRule$, o.activeRule), { unitId: a, subUnitId: i, rule: r } = n || {}, l = r.uid, s = L(ye), c = L(ge), u = L(Lt), p = L(Q), d = L(Pt), g = L(J), [f, C] = W(r), R = s.getValidatorItem(f.type), [v, w] = W(!1), I = s.getValidatorsByScope($a.SHEET), [V, _] = W(() => f.ranges.map((O) => ({ unitId: "", sheetId: "", range: O }))), S = He(() => Ui(p), [p]), [m, y] = W(!1), P = We({}), [F, T] = W(!1), E = L(Qn); if (Ce(() => () => { const O = E.getCurrentLastSelection(); O && E.setSelections([O]); }, [E]), Ce(() => { p.onCommandExecuted((O) => { (O.id === Go.id || O.id === Zo.id) && setTimeout(() => { const D = d.getRuleById(a, i, l); t((U) => U + 1), D && (C(D), _(D.ranges.map((U) => ({ unitId: "", sheetId: "", range: U })))); }, 20); }); }, [p, d, l, i, a]), !R) return null; const A = R.operators, x = R.operatorNames, j = f.operator ? ka.includes(f.operator) : !1, N = () => { !f.ranges.length || m || (R.validatorFormula(f, a, i).success ? o.setActiveRule(null) : w(!0)); }, H = ln((O) => { const D = O.split(",").filter(Boolean).map(Xa).map(($) => { const _e = $.sheetName; if (_e) { const $o = Bi(c, $.unitId, _e); return { ...$, sheetId: $o }; } return { ...$, sheetId: "" }; }); if (qo(D, V)) return; _(D); const U = D.filter(($) => (!$.unitId || $.unitId === a) && (!$.sheetId || $.sheetId === i)).map(($) => $.range); if (C({ ...f, ranges: U }), U.length === 0) return; const B = { unitId: a, subUnitId: i, ruleId: l, ranges: U }; S(ro.id, B); }), X = (O) => { if (bn(O, xn(f))) return; C({ ...f, ...O }); const D = { unitId: a, subUnitId: i, ruleId: l, setting: O }; S( On.id, D, void 0 ); }, k = async () => { await p.executeCommand(so.id, { ruleId: l, unitId: a, subUnitId: i }), o.setActiveRule(null); }, K = { type: f.type, operator: f.operator, formula1: f.formula1, formula2: f.formula2, allowBlank: f.allowBlank }, q = (O) => { const D = s.getValidatorItem(O); if (!D) return; const U = D.operators, B = d.getRuleById(a, i, l), $ = O === (B == null ? void 0 : B.type) || O.includes("list") && (B != null && B.type.includes("list")) ? { ...B, type: O } : { ...f, type: O, operator: U[0], formula1: void 0, formula2: void 0 }; C($), p.executeCommand(On.id, { unitId: a, subUnitId: i, ruleId: f.uid, setting: xn($) }); }, ee = u.get(R.formulaInput), te = He(() => V.map((O) => _o(O.range)).join(","), []), re = An(f), ae = (O) => { bn(O, An(f)) || (C({ ...f, ...O }), S( _a.id, { unitId: a, subUnitId: i, ruleId: l, options: O } )); }; return Sn((O) => { var U; const D = (U = P.current) == null ? void 0 : U.handleOutClick; D && D(O, () => T(!1)); }), /* @__PURE__ */ h.jsxs("div", { className: Be.dataValidationDetail, children: [ /* @__PURE__ */ h.jsx( Z, { label: g.t("dataValidation.panel.range"), error: !f.ranges.length || m ? g.t("dataValidation.panel.rangeError") : "", children: /* @__PURE__ */ h.jsx( za, { unitId: a, subUnitId: i, initValue: te, onChange: H, onFocus: () => T(!0), isFocus: F, actions: P.current, onVerify: (O) => y(!O) } ) } ), /* @__PURE__ */ h.jsx(Z, { label: g.t("dataValidation.panel.type"), children: /* @__PURE__ */ h.jsx( tn, { options: I == null ? void 0 : I.map((O) => ({ label: g.t(O.title), value: O.id })), value: f.type, onChange: q, className: Be.dataValidationDetailFormItem } ) }), A != null && A.length ? /* @__PURE__ */ h.jsx(Z, { label: g.t("dataValidation.panel.operator"), children: /* @__PURE__ */ h.jsx( tn, { options: A.map((O, D) => ({ value: `${O}`, label: x[D] })), value: `${f.operator}`, onChange: (O) => { X({ ...K, operator: O }); }, className: Be.dataValidationDetailFormItem } ) }) : null, ee ? /* @__PURE__ */ h.jsx( ee, { isTwoFormula: j, value: { formula1: f.formula1, formula2: f.formula2 }, onChange: (O) => { X({ ...K, ...O }); }, showError: v, validResult: R.validatorFormula(f, a, i), unitId: a, subUnitId: i, ruleId: l }, e + f.type ) : null, /* @__PURE__ */ h.jsx(Z, { children: /* @__PURE__ */ h.jsx( Ot, { checked: (se = f.allowBlank) != null ? se : !0, onChange: () => { var O; return X({ ...K, allowBlank: !((O = f.allowBlank) == null || O) }); }, children: g.t("dataValidation.panel.allowBlank") } ) }), /* @__PURE__ */ h.jsx(Ai, { value: re, onChange: ae, extraComponent: R.optionsInput }), /* @__PURE__ */ h.jsxs("div", { className: Be.dataValidationDetailButtons, children: [ /* @__PURE__ */ h.jsx(je, { className: Be.dataValidationDetailButton, onClick: k, children: g.t("dataValidation.panel.removeRule") }), /* @__PURE__ */ h.jsx(je, { className: Be.dataValidationDetailButton, type: "primary", onClick: N, children: g.t("dataValidation.panel.done") }) ] }) ] }); } const ki = "univer-data-validation-item-container", Wi = "univer-data-validation-item-title", Hi = "univer-data-validation-item-content", Yi = "univer-data-validation-item-icon", ct = { dataValidationItemContainer: ki, dataValidationItemTitle: Wi, dataValidationItemContent: Hi, dataValidationItemIcon: Yi }, Xi = (e) => { const { rule: t, onClick: o, unitId: n, subUnitId: a, disable: i } = e, r = L(ye), l = L(Q), s = L(Ma), c = r.getValidatorItem(t.type), u = We(), [p, d] = W(!1), g = (f) => { l.executeCommand(so.id, { ruleId: t.uid, unitId: n, subUnitId: a }), f.stopPropagation(); }; return Ce(() => () => { var f; u.current && ((f = u.current) == null || f.forEach((C) => { C && s.removeShape(C); })); }, [s]), /* @__PURE__ */ h.jsxs( "div", { className: ct.dataValidationItemContainer, onClick: o, onMouseEnter: () => { i || (d(!0), u.current = t.ranges.map((f) => s.addShape({ range: f, style: { // hasAutoFill: false, fill: "rgba(73, 184, 17, 0.05)", strokeWidth: 1, stroke: "#49B811", widgets: {} }, primary: null }))); }, onMouseLeave: () => { var f; d(!1), (f = u.current) == null || f.forEach((C) => { C && s.removeShape(C); }), u.current = void 0; }, children: [ /* @__PURE__ */ h.jsx("div", { className: ct.dataValidationItemTitle, children: c == null ? void 0 : c.generateRuleName(t) }), /* @__PURE__ */ h.jsx("div", { className: ct.dataValidationItemContent, children: t.ranges.map((f) => _o(f)).join(",") }), p ? /* @__PURE__ */ h.jsx("div", { className: ct.dataValidationItemIcon, onClick: g, children: /* @__PURE__ */ h.jsx(Rn, {}) }) : null ] } ); }, zi = "univer-data-validation-list", Ki = "univer-data-validation-list-buttons", Gi = "univer-data-validation-list-button", ut = { dataValidationList: zi, dataValidationListButtons: Ki, dataValidationListButton: Gi }; function Zi() { const e = L(ge), t = Ne( () => e.getCurrentTypeOfUnit$(Y.UNIVER_SHEET), void 0, void 0, [] ); return t ? /* @__PURE__ */ h.jsx(qi, { workbook: t }) : null; } function qi(e) { const t = L(oe), o = L(ge), n = L(Q), a = L(Fe), i = L(fe), r = L(J), [l, s] = W([]), { workbook: c } = e, u = Ne(c.activeSheet$, void 0, !0), p = c.getUnitId(), d = u == null ? void 0 : u.getSheetId(); Ce(() => { s(t.getRules(p, d)); const w = t.ruleChange$.subscribe((I) => { I.unitId === p && I.subUnitId === d && s(t.getRules(p, d)); }); return () => { w.unsubscribe(); }; }, [p, d, t]); const g = async () => { const w = lo(a), I = { unitId: p, subUnitId: d, rule: w }; await n.executeCommand(_n.id, I), i.setActiveRule({ unitId: p, subUnitId: d, rule: w }); }, f = () => { n.executeCommand(Sa.id, { unitId: p, subUnitId: d }); }, R = ((w) => { const I = o.getCurrentUnitForType(Y.UNIVER_SHEET), V = I.getActiveSheet(), _ = I.getUnitId(), S = V.getSheetId(); return w.map((y) => ga(a, _, S, y.ranges) ? { ...y } : { ...y, disable: !0 }); })(l), v = R == null ? void 0 : R.some((w) => w.disable); return /* @__PURE__ */ h.jsxs("div", { className: ut.dataValidationList, children: [ R == null ? void 0 : R.map((w) => { var I; return /* @__PURE__ */ h.jsx( Xi, { unitId: p, subUnitId: d, onClick: () => { w.disable || i.setActiveRule({ unitId: p, subUnitId: d, rule: w }); }, rule: w, disable: (I = w.disable) != null ? I : !1 }, w.uid ); }), /* @__PURE__ */ h.jsxs("div", { className: ut.dataValidationListButtons, children: [ l.length && !v ? /* @__PURE__ */ h.jsx(je, { className: ut.dataValidationListButton, onClick: f, children: r.t("dataValidation.panel.removeAll") }) : null, /* @__PURE__ */ h.jsx(je, { className: ut.dataValidationListButton, type: "primary", onClick: g, children: r.t("dataValidation.panel.add") }) ] }) ] }); } const Ji = () => { const e = L(fe), t = Ne(e.activeRule$, e.activeRule); return t ? /* @__PURE__ */ h.jsx($i, {}, t.rule.uid) : /* @__PURE__ */ h.jsx(Zi, {}); }, yn = "data-validation.list.dropdown", Oo = "data-validation.date.dropdown", At = { type: Je.COMMAND, id: "data-validation.command.addRuleAndOpen", handler(e) { const t = e.get(ge), o = eo(t); if (!o) return !1; const { workbook: n, worksheet: a } = o, i = lo(e), r = e.get(Q), l = n.getUnitId(), s = a.getSheetId(), c = { rule: i, unitId: l, subUnitId: s }; return r.syncExecuteCommand(_n.id, c) ? (r.syncExecuteCommand(Ue.id, { ruleId: i.uid, isAdd: !0 }), !0) : !1; } }; var Qi = Object.defineProperty, er = Object.getOwnPropertyDescriptor, tr = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? er(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && Qi(t, o, a), a; }, $e = (e, t) => (o, n) => t(o, n, e); const Ee = "SHEET_DATA_VALIDATION_ALERT"; let lt = class extends De { constructor(e, t, o, n, a, i) { super(), this._hoverManagerService = e, this._cellAlertManagerService = t, this._univerInstanceService = o, this._localeService = n, this._zenZoneService = a, this._dataValidationModel = i, this._init(); } _init() { this._initCellAlertPopup(), this._initZenService(); } _initCellAlertPopup() { this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(wn(100)).subscribe((e) => { var t; if (e) { const o = this._univerInstanceService.getUnit(e.location.unitId, Y.UNIVER_SHEET), n = o.getSheetBySheetId(e.location.subUnitId); if (!n) return; const a = this._dataValidationModel.getRuleByLocation(e.location.unitId, e.location.subUnitId, e.location.row, e.location.col); if (!a) { this._cellAlertManagerService.removeAlert(Ee); return; } if (this._dataValidationModel.validator(a, { ...e.location, workbook: o, worksheet: n }) === rt.INVALID) { const r = this._cellAlertManagerService.currentAlert.get(Ee), l = (t = r == null ? void 0 : r.alert) == null ? void 0 : t.location; if (l && l.row === e.location.row && l.col === e.location.col && l.subUnitId === e.location.subUnitId && l.unitId === e.location.unitId) { this._cellAlertManagerService.removeAlert(Ee); return; } const s = this._dataValidationModel.getValidator(a.type); if (!s) { this._cellAlertManagerService.removeAlert(Ee); return; } this._cellAlertManagerService.showAlert({ type: Oa.ERROR, title: this._localeService.t("dataValidation.error.title"), message: s == null ? void 0 : s.getRuleFinalError(a, e.location), location: e.location, width: 200, height: 74, key: Ee }); return; } } this._cellAlertManagerService.removeAlert(Ee); })); } _initZenService() { this.disposeWithMe(this._zenZoneService.visible$.subscribe((e) => { e && this._cellAlertManagerService.removeAlert(Ee); })); } }; lt = tr([ $e(0, b(ba)), $e(1, b(Ea)), $e(2, ge), $e(3, b(J)), $e(4, go), $e(5, b(oe)) ], lt); var nr = Object.defineProperty, or = Object.getOwnPropertyDescriptor, ar = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? or(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && nr(t, o, a), a; }, Bt = (e, t) => (o, n) => t(o, n, e); let ze = class extends De { constructor(e, t, o) { super(), this._autoFillService = e, this._sheetDataValidationModel = t, this._injector = o, this._initAutoFill(); } // eslint-disable-next-line max-lines-per-function _initAutoFill() { const e = () => ({ redos: [], undos: [] }), t = (n, a) => { const { source: i, target: r, unitId: l, subUnitId: s } = n, c = this._sheetDataValidationModel.getRuleObjectMatrix(l, s).clone(), u = rn([i, r]), [p, d] = u.ranges, { mapFunc: g } = u, f = { row: p.startRow, col: p.startColumn }, C = Pa(p, d), R = new _t(), v = /* @__PURE__ */ new Set(); C.forEach((S) => { const m = S.repeatStartCell, y = S.relativeRange, P = { startRow: f.row, startColumn: f.col, endColumn: f.col, endRow: f.row }, F = { startRow: m.row, startColumn: m.col, endColumn: m.col, endRow: m.row }; Qo.foreach(y, (T, E) => { const A = St.getPositionRange( { startRow: T, startColumn: E, endColumn: E, endRow: T }, P ), { row: x, col: j } = g(A.startRow, A.startColumn), N = this._sheetDataValidationModel.getRuleIdByLocation(l, s, x, j) || "", H = St.getPositionRange( { startRow: T, startColumn: E, endColumn: E, endRow: T }, F ), { row: X, col: k } = g(H.startRow, H.startColumn); R.setValue(X, k, N), v.add(N); }); }); const w = Array.from(v).map((S) => ({ id: S, ranges: Qt(R, (m) => m === S) })); c.addRangeRules(w); const I = c.diff(this._sheetDataValidationModel.getRules(l, s)), { redoMutations: V, undoMutations: _ } = an(l, s, I, this._injector, "patched", a === tt.ONLY_FORMAT); return { undos: _, redos: V }; }, o = { id: co, onBeforeFillData: (n) => { const { source: a, unitId: i, subUnitId: r } = n; for (const l of a.rows) for (const s of a.cols) { const c = this._sheetDataValidationModel.getRuleByLocation(i, r, l, s); if (c && c.type === z.CHECKBOX) { this._autoFillService.setDisableApplyType(tt.SERIES, !0); return; } } }, onFillData: (n, a, i) => i === tt.COPY || i === tt.ONLY_FORMAT || i === tt.SERIES ? t(n, i) : e(), onAfterFillData: () => { } }; this.disposeWithMe(this._autoFillService.addHook(o)); } }; ze = ar([ Bt(0, La), Bt(1, b(oe)), Bt(2, b(Fe)) ], ze); var ir = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, sr = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? rr(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && ir(t, o, a), a; }, $t = (e, t) => (o, n) => t(o, n, e); let Ke = class extends De { constructor(t, o, n) { super(); M(this, "_copyInfo"); this._sheetClipboardService = t, this._sheetDataValidationModel = o, this._injector = n, this._initCopyPaste(); } _initCopyPaste() { this._sheetClipboardService.addClipboardHook({ id: co, onBeforeCopy: (t, o, n) => this._collect(t, o, n), onPasteCells: (t, o, n, a) => { const { copyType: i = Pn.COPY, pasteType: r } = a, { range: l } = t || {}, { range: s, unitId: c, subUnitId: u } = o; return this._generateMutations(s, { copyType: i, pasteType: r, copyRange: l, unitId: c, subUnitId: u }); } }); } _collect(t, o, n) { const a = new _t(); this._copyInfo = { unitId: t, subUnitId: o, matrix: a }; const i = this._injector.invoke((s) => Ta(n, s, t, o)); if (!i) return; const { rows: r, cols: l } = i; r.forEach((s, c) => { l.forEach((u, p) => { const d = this._sheetDataValidationModel.getRuleIdByLocation(t, o, s, u); a.setValue(c, p, d != null ? d : ""); }); }); } // eslint-disable-next-line max-lines-per-function _generateMutations(t, o) { if (!this._copyInfo) return { redos: [], undos: [] }; if (o.copyType === Pn.CUT) return this._copyInfo = null, { redos: [], undos: [] }; if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !o.copyRange) return { redos: [], undos: [] }; if ([ dt.SPECIAL_PASTE_COL_WIDTH, dt.SPECIAL_PASTE_VALUE, dt.SPECIAL_PASTE_FORMAT, dt.SPECIAL_PASTE_FORMULA ].includes(o.pasteType)) return { redos: [], undos: [] }; const { unitId: a, subUnitId: i } = this._copyInfo; if (o.unitId !== a || i !== o.subUnitId) { const r = this._sheetDataValidationModel.getRuleObjectMatrix(o.unitId, o.subUnitId).clone(), l = new _t(), s = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: p } = rn([o.copyRange, t]), d = Tn(c, u, !0), g = /* @__PURE__ */ new Map(); d.forEach(({ startRange: v }) => { var w; (w = this._copyInfo) == null || w.matrix.forValue((I, V, _) => { const S = St.getPositionRange( { startRow: I, endRow: I, startColumn: V, endColumn: V }, v ), m = `${i}-${_}`, y = this._sheetDataValidationModel.getRuleById(a, i, _); !this._sheetDataValidationModel.getRuleById(o.unitId, o.subUnitId, m) && y && g.set(m, { ...y, uid: m }); const { row: P, col: F } = p(S.startRow, S.startColumn); s.add(m), l.setValue(P, F, m); }); }); const f = Array.from(s).map((v) => ({ id: v, ranges: Qt(l, (w) => w === v) })); r.addRangeRules(f); const { redoMutations: C, undoMutations: R } = an( o.unitId, o.subUnitId, r.diffWithAddition(this._sheetDataValidationModel.getRules(o.unitId, o.subUnitId), g.values()), this._injector, "patched", !1 ); return { redos: C, undos: R }; } else { const r = this._sheetDataValidationModel.getRuleObjectMatrix(a, i).clone(), l = new _t(), s = /* @__PURE__ */ new Set(), { ranges: [c, u], mapFunc: p } = rn([o.copyRange, t]); Tn(c, u, !0).forEach(({ startRange: R }) => { var v; (v = this._copyInfo) == null || v.matrix.forValue((w, I, V) => { const _ = St.getPositionRange( { startRow: w, endRow: w, startColumn: I, endColumn: I }, R ), { row: S, col: m } = p(_.startRow, _.startColumn); l.setValue(S, m, V), s.add(V); }); }); const g = Array.from(s).map((R) => ({ id: R, ranges: Qt(l, (v) => v === R) })); r.addRangeRules(g); const { redoMutations: f, undoMutations: C } = an( a, i, r.diff(this._sheetDataValidationModel.getRules(a, i)), this._injector, "patched", !1 ); return { redos: f, undos: C }; } } }; Ke = sr([ $t(0, Aa), $t(1, b(oe)), $t(2, b(Fe)) ], Ke); var lr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, cr = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? dr(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && lr(t, o, a), a; }, kt = (e, t) => (o, n) => t(o, n, e); let Ge = class extends De { constructor(e, t, o) { super(), this._localeService = e, this._commandService = t, this._sheetPermissionCheckController = o, this._commandExecutedListener(); } _commandExecutedListener() { this.disposeWithMe( this._commandService.beforeCommandExecuted((e) => { e.id === _n.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({ workbookTypes: [Ct], rangeTypes: [It], worksheetTypes: [wt, on] }) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))), e.id === ro.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({ workbookTypes: [Ct], rangeTypes: [It], worksheetTypes: [wt, on] }, e.params.ranges) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))); }) ); } }; Ge = cr([ kt(0, b(J)), kt(1, Q), kt(2, b(to)) ], Ge); const Lo = "data-validation-single", Po = "sheet.menu.data-validation"; function ur(e) { return { id: Po, type: Cn.SUBITEMS, icon: Lo, tooltip: "dataValidation.title", hidden$: Na(e, Y.UNIVER_SHEET), disabled$: xa(e, { workbookTypes: [Ct], worksheetTypes: [on, wt], rangeTypes: [It] }) }; } function hr(e) { return { id: Ue.id, title: "dataValidation.panel.title", type: Cn.BUTTON }; } function pr(e) { return { id: At.id, title: "dataValidation.panel.add", type: Cn.BUTTON }; } const fr = { [Ua.FORMULAS_INSERT]: { [Po]: { order: 9, menuItemFactory: ur, [Ue.id]: { order: 0, menuItemFactory: hr }, [At.id]: { order: 1, menuItemFactory: pr } } } }; var mr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, To = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? gr(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && mr(t, o, a), a; }, G = (e, t) => (o, n) => t(o, n, e); const Ao = { tr: { size: 6, color: "#fe4b4b" } }; let Ze = class extends fn { constructor(e, t, o, n, a, i, r, l, s, c, u) { super(), this._commandService = e, this._menuManagerService = t, this._renderManagerService = o, this._univerInstanceService = n, this._autoHeightController = a, this._dropdownManagerService = i, this._sheetDataValidationModel = r, this._dataValidatorRegistryService = l, this._sheetInterceptorService = s, this._dataValidationCacheService = c, this._editorBridgeService = u, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight(); } _initMenu() { this._menuManagerService.mergeMenu(fr); } _initDropdown() { this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((e) => { var o; if (!e.visible) { ((o = this._dropdownManagerService.activeDropdown) == null ? void 0 : o.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown(); return; } const t = this._editorBridgeService.getEditCellState(); if (t) { const { unitId: n, sheetId: a, row: i, column: r } = t, l = this._univerInstanceService.getUniverSheetInstance(n); if (!l) return; const s = this._sheetDataValidationModel.getRuleByLocation(n, a, i, r); if (!s) return; const c = this._dataValidatorRegistryService.getValidatorItem(s.type); if (!(c != null && c.dropdown)) return; const u = l.getActiveSheet(); if (!u) return; const p = this._dropdownManagerService.activeDropdown, d = p == null ? void 0 : p.location; if (d && d.unitId === n && d.subUnitId === a && d.row === i && d.col === r) return; this._dropdownManagerService.showDropdown( { location: { unitId: n, subUnitId: a, row: i, col: r, workbook: l, worksheet: u }, componentKey: c.dropdown, onHide: () => { }, trigger: "editor-bridge" }, !1 ); } })); } // eslint-disable-next-line max-lines-per-function _initViewModelIntercept() { this.disposeWithMe( this._sheetInterceptorService.intercept( no.CELL_CONTENT, { effect: Kn.Style, // must be after numfmt priority: oo.DATA_VALIDATION, // eslint-disable-next-line max-lines-per-function, complexity handler: (e, t, o) => { var v, w, I, V, _; const { row: n, col: a, unitId: i, subUnitId: r, workbook: l, worksheet: s } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(i, r, n, a); if (!c) return o(e); const u = this._sheetDataValidationModel.getRuleById(i, r, c); if (!u) return o(e); const p = (v = this._dataValidationCacheService.getValue(i, r, n, a)) != null ? v : rt.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), g = t.rawData; let f; const C = { get value() { var S; return f !== void 0 || (f = (S = ie(g)) != null ? S : null), f; } }, R = { get value() { var S; return `${(S = C.value) != null ? S : ""}`; } }; return o({ ...e, markers: { ...e == null ? void 0 : e.markers, ...p === rt.INVALID ? Ao : null }, customRender: [ ...(w = e == null ? void 0 : e.customRender) != null ? w : [], ...d != null && d.canvasRender ? [d.canvasRender] : [] ], fontRenderExtension: { ...e == null ? void 0 : e.fontRenderExtension, isSkip: ((I = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : I.isSkip) || ((V = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : V.call(d, u, C.value, t)) }, interceptorStyle: { ...e == null ? void 0 : e.interceptorStyle, ...d == null ? void 0 : d.getExtraStyle(u, R.value, { get style() { const S = l.getStyles(); return (typeof (e == null ? void 0 : e.s) == "string" ? S.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {}; } }, n, a) }, interceptorAutoHeight: () => { var P, F, T, E, A, x; const S = (F = (P = this._renderManagerService.getRenderById(i)) == null ? void 0 : P.with(Rt).getWorksheetSkeleton(r)) == null ? void 0 : F.skeleton; if (!S) return; const m = S.worksheet.getMergedCell(n, a), y = { data: e, style: S.getsStyles().getStyleByCell(e), primaryWithCoord: S.getCellWithCoordByIndex((T = m == null ? void 0 : m.startRow) != null ? T : n, (E = m == null ? void 0 : m.startColumn) != null ? E : a), unitId: i, subUnitId: r, row: n, col: a, workbook: l, worksheet: s }; return (x = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoHeight) == null ? void 0 : x.call(A, y); }, interceptorAutoWidth: () => { var P, F, T, E, A, x; const S = (F = (P = this._renderManagerService.getRenderById(i)) == null ? void 0 : P.with(Rt).getWorksheetSkeleton(r)) == null ? void 0 : F.skeleton; if (!S) return; const m = S.worksheet.getMergedCell(n, a), y = { data: e, style: S.getsStyles().getStyleByCell(e), primaryWithCoord: S.getCellWithCoordByIndex((T = m == null ? void 0 : m.startRow) != null ? T : n, (E = m == null ? void 0 : m.startColumn) != null ? E : a), unitId: i, subUnitId: r, row: n, col: a, workbook: l, worksheet: s }; return (x = (A = d == null ? void 0 : d.canvasRender) == null ? void 0 : A.calcCellAutoWidth) == null ? void 0 : x.call(A, y); }, coverable: ((_ = e == null ? void 0 : e.coverable) != null ? _ : !0) && !(u.type === z.LIST || u.type === z.LIST_MULTIPLE) }); } } ) ); } _initAutoHeight() { this._sheetDataValidationModel.ruleChange$.pipe( // patched data-validation change don't need to re-calc row height // re-calc of row height will be triggered precisely by the origin command In((e) => e.source === "command"), vo(100) ).subscribe((e) => { if (e.length === 0) return; const t = []; if (e.forEach((o) => { var n; (o.rule.type === z.LIST_MULTIPLE || o.rule.type === z.LIST) && (n = o.rule) != null && n.ranges && t.push(...o.rule.ranges); }), t.length) { const o = this._autoHeightController.getUndoRedoParamsOfAutoHeight(t); Gn(o.redos, this._commandService); } }); } }; Ze = To([ G(0, Q), G(1, Ba), G(2, Ve), G(3, ge), G(4, b(fo)), G(5, b(Ie)), G(6, b(oe)), G(7, b(ye)), G(8, b(gn)), G(9, b(uo)), G(10, ea(po)) ], Ze); let $n = class extends fn { constructor(e, t, o, n, a, i, r) { super(), this._commandService = e, this._renderManagerService = t, this._autoHeightController = o, this._dataValidatorRegistryService = n, this._sheetInterceptorService = a, this._sheetDataValidationModel = i, this._dataValidationCacheService = r, this._initViewModelIntercept(), this._initAutoHeight(); } _initViewModelIntercept() { this.disposeWithMe( this._sheetInterceptorService.intercept( no.CELL_CONTENT, { effect: Kn.Style, // must be after numfmt priority: oo.DATA_VALIDATION, // eslint-disable-next-line complexity handler: (e, t, o) => { var R, v, w, I, V; const { row: n, col: a, unitId: i, subUnitId: r, workbook: l, worksheet: s } = t, c = this._sheetDataValidationModel.getRuleIdByLocation(i, r, n, a); if (!c) return o(e); const u = this._sheetDataValidationModel.getRuleById(i, r, c); if (!u) return o(e); const p = (R = this._dataValidationCacheService.getValue(i, r, n, a)) != null ? R : rt.VALID, d = this._dataValidatorRegistryService.getValidatorItem(u.type), g = s.getCellRaw(n, a), f = ie(g), C = `${f != null ? f : ""}`; return o({ ...e, markers: { ...e == null ? void 0 : e.markers, ...p === rt.INVALID ? Ao : null }, customRender: [ ...(v = e == null ? void 0 : e.customRender) != null ? v : [], ...d != null && d.canvasRender ? [d.canvasRender] : [] ], fontRenderExtension: { ...e == null ? void 0 : e.fontRenderExtension, isSkip: ((w = e == null ? void 0 : e.fontRenderExtension) == null ? void 0 : w.isSkip) || ((I = d == null ? void 0 : d.skipDefaultFontRender) == null ? void 0 : I.call(d, u, f, t)) }, interceptorStyle: { ...e == null ? void 0 : e.interceptorStyle, ...d == null ? void 0 : d.getExtraStyle(u, C, { get style() { const _ = l.getStyles(); return (typeof (e == null ? void 0 : e.s) == "string" ? _.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {}; } }, n, a) }, interceptorAutoHeight: () => { var y, P, F, T, E, A; const _ = (P = (y = this._renderManagerService.getRenderById(i)) == null ? void 0 : y.with(Rt).getWorksheetSkeleton(r)) == null ? void 0 : P.skeleton; if (!_) return; const S = _.worksheet.getMergedCell(n, a), m = { data: e, style: _.getsStyles().getStyleByCell(e), primaryWithCoord: _.getCellWithCoordByIndex((F = S == null ? void 0 : S.startRow) != null ? F : n, (T = S == null ? void 0 : S.startColumn) != null ? T : a), unitId: i, subUnitId: r, row: n, col: a, workbook: l, worksheet: s }; return (A = (E = d == null ? void 0 : d.canvasRender) == null ? void 0 : E.calcCellAutoHeight) == null ? void 0 : A.call(E, m); }, coverable: ((V = e == null ? void 0 : e.coverable) != null ? V : !0) && !(u.type === z.LIST || u.type === z.LIST_MULTIPLE) }); } } ) ); } _initAutoHeight() { this._sheetDataValidationModel.ruleChange$.pipe( In((e) => e.source === "command"), vo(16) ).subscribe((e) => { const t = []; if (e.forEach((o) => { var n; (n = o.rule) != null && n.ranges && t.push(...o.rule.ranges); }), t.length) { const o = this._autoHeightController.getUndoRedoParamsOfAutoHeight(t); Gn(o.redos, this._commandService); } }); } }; $n = To([ G(0, Q), G(1, Ve), G(2, b(fo)), G(3, b(ye)), G(4, b(gn)), G(5, b(oe)), G(6, b(uo)) ], $n); var vr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, Sr = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? _r(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && vr(t, o, a), a; }, kn = (e, t) => (o, n) => t(o, n, e); let yt = class extends De { constructor(e, t, o) { super(), this._context = e, this._sheetDataValidationModel = t, this._sheetSkeletonManagerService = o, this._initSkeletonChange(); } _initSkeletonChange() { const e = (t) => { var n; if (!t.length) return; const o = /* @__PURE__ */ new Set(); t.forEach((a) => { o.add(a.subUnitId); }), o.forEach((a) => { var i; (i = this._sheetSkeletonManagerService.getWorksheetSkeleton(a)) == null || i.skeleton.makeDirty(!0); }), (n = this._context.mainComponent) == null || n.makeForceDirty(); }; this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(ta(16)).subscribe(e)); } }; yt = Sr([ kn(1, b(oe)), kn(2, b(Rt)) ], yt); const Cr = "univer-data-validation-formula", Ir = "univer-data-validation-formula-and", wr = "univer-data-validation-formula-list-item", Rr = "univer-data-validation-formula-list-item-icon", Dr = "univer-data-validation-formula-list-item-drag", Vr = "univer-data-validation-formula-list-add", yr = "univer-data-validation-formula-color-select", Mr = "univer-data-validation-formula-color-select-panel", br = "univer-data-validation-formula-color-item", ne = { dataValidationFormula: Cr, dataValidationFormulaAnd: Ir, dataValidationFormulaListItem: wr, dataValidationFormulaListItemIcon: Rr, dataValidationFormulaListItemDrag: Dr, dataValidationFormulaListAdd: Vr, dataValidationFormulaColorSelect: yr, dataValidationFormulaColorSelectPanel: Mr, dataValidationFormulaColorItem: br }, Er = (e) => { const { isTwoFormula: t = !1, value: o, onChange: n, showError: a, validResult: i } = e, r = L(J), l = a ? i == null ? void 0 : i.formula1 : "", s = a ? i == null ? void 0 : i.formula2 : ""; return t ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsx(Z, { error: l, children: /* @__PURE__ */ h.jsx( xe, { className: ne.dataValidationFormula, placeholder: r.t("dataValidation.panel.formulaPlaceholder"), value: o == null ? void 0 : o.formula1, onChange: (c) => { n == null || n({ ...o, formula1: c }); } } ) }), /* @__PURE__ */ h.jsx("div", { className: ne.dataValidationFormulaAnd, children: r.t("dataValidation.panel.formulaAnd") }), /* @__PURE__ */ h.jsx(Z, { error: s, children: /* @__PURE__ */ h.jsx( xe, { className: ne.dataValidationFormula, placeholder: r.t("dataValidation.panel.formulaPlaceholder"), value: o == null ? void 0 : o.formula2, onChange: (c) => { n == null || n({ ...o, formula2: c }); } } ) }) ] }) : /* @__PURE__ */ h.jsx(Z, { error: l, children: /* @__PURE__ */ h.jsx( xe, { className: ne.dataValidationFormula, placeholder: r.t("dataValidation.panel.formulaPlaceholder"), value: o == null ? void 0 : o.formula1, onChange: (c) => { n == null || n({ formula1: c }); } } ) }); }; function Or(e) { const { value: t, onChange: o, showError: n, validResult: a } = e, i = L(J), r = n ? a == null ? void 0 : a.formula1 : "", l = n ? a == null ? void 0 : a.formula2 : "", [s, c] = W(!((t == null ? void 0 : t.formula1) === void 0 && (t == null ? void 0 : t.formula2) === void 0)); return /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsx(Z, { children: /* @__PURE__ */ h.jsx( Ot, { checked: s, onChange: (u) => { u ? c(!0) : (c(!1), o == null || o({ ...t, formula1: void 0, formula2: void 0 })); }, children: i.t("dataValidation.checkbox.tips") } ) }), s ? /* @__PURE__ */ h.jsx(Z, { label: i.t("dataValidation.checkbox.checked"), error: r, children: /* @__PURE__ */ h.jsx( xe, { className: ne.dataValidationFormula, placeholder: i.t("dataValidation.panel.valuePlaceholder"), value: t == null ? void 0 : t.formula1, onChange: (u) => { o == null || o({ ...t, formula1: u || void 0 }); } } ) }) : null, s ? /* @__PURE__ */ h.jsx(Z, { label: i.t("dataValidation.checkbox.unchecked"), error: l, children: /* @__PURE__ */ h.jsx( xe, { className: ne.dataValidationFormula, placeholder: i.t("dataValidation.panel.valuePlaceholder"), value: t == null ? void 0 : t.formula2, onChange: (u) => { o == null || o({ ...t, formula2: u || void 0 }); } } ) }) : null ] }); } function Lr(e) { var p; const { unitId: t, subUnitId: o, value: n, onChange: a, showError: i, validResult: r } = e, l = i ? r == null ? void 0 : r.formula1 : void 0, s = We({}), [c, u] = W(!1); return Sn((d) => { var f; const g = (f = s.current) == null ? void 0 : f.handleOutClick; g && g(d, () => u(!1)); }), /* @__PURE__ */ h.jsx( So, { initValue: (p = n == null ? void 0 : n.formula1) != null ? p : "=", unitId: t, subUnitId: o, isFocus: c, onChange: (d) => { const g = (d != null ? d : "").trim(); g !== (n == null ? void 0 : n.formula1) && (a == null || a({ ...n, formula1: g })); }, errorText: l, onFocus: () => u(!0), actions: s.current, isSupportAcrossSheet: !0 } ); } function xo(e) { var t, o, n = ""; if (typeof e == "string" || typeof e == "number") n += e; else if (typeof e == "object") if (Array.isArray(e)) { var a = e.length; for (t = 0; t < a; t++) e[t] && (o = xo(e[t])) && (n && (n += " "), n += o); } else for (o in e) e[o] && (n && (n += " "), n += o); return n; } function Pr() { for (var e, t, o = 0, n = "", a = arguments.length; o < a; o++) (e = arguments[o]) && (t = xo(e)) && (n && (n += " "), n += t); return n; } const Tr = [ "#FFFFFF", "#FEE7E7", "#FEF0E6", "#EFFBD0", "#E4F4FE", "#E8ECFD", "#F1EAFA", "#FDE8F3", "#E5E5E5", "#FDCECE", "#FDC49B", "#DEF6A2", "#9FDAFF", "#D0D9FB", "#E3D5F6", "#FBD0E8", "#656565", "#FE4B4B", "#FF8C51", "#8BBB11", "#0B9EFB", "#3A60F7", "#9E6DE3", "#F248A6" ], Ar = (e) => { const { value: t, onChange: o, disabled: n } = e, [a, i] = W(!1); return /* @__PURE__ */ h.jsx( tn, { disabled: n, open: a, onDropdownVisibleChange: i, dropdownStyle: { width: 112 }, style: { width: 96, cursor: "pointer" }, className: ne.dataValidationFormulaColorSelect, value: t, onChange: o, labelRender: (r) => /* @__PURE__ */ h.jsx( "div", { className: ne.dataValidationFormulaColorItem, style: { background: r.value, marginTop: 5 } } ), dropdownRender: () => /* @__PURE__ */ h.jsx("div", { className: ne.dataValidationFormulaColorSelectPanel, children: Tr.map( (r) => /* @__PURE__ */ h.jsx( "div", { onClick: () => { o(r), i(!1); }, className: ne.dataValidationFormulaColorItem, style: { background: r } }, r ) ) }) } ); }, Wn = (e) => { const { item: t, commonProps: o, style: n } = e, { onItemChange: a, onItemDelete: i } = o; return /* @__PURE__ */ h.jsxs("div", { className: ne.dataValidationFormulaListItem, style: n, children: [ t.isRef ? null : /* @__PURE__ */ h.jsx("div", { className: Pr(ne.dataValidationFormulaListItemDrag, "draggableHandle"), children: /* @__PURE__ */ h.jsx(yo, {}) }), /* @__PURE__ */ h.jsx( Ar, { value: t.color, onChange: (r) => { a(t.id, t.label, r); } } ), /* @__PURE__ */ h.jsx( xe, { disabled: t.isRef, value: t.label, onChange: (r) => { a(t.id, r, t.color); } } ), t.isRef ? null : /* @__PURE__ */ h.jsx("div", { className: ne.dataValidationFormulaListItemIcon, children: /* @__PURE__ */ h.jsx(Rn, { onClick: () => i(t.id) }) }) ] }); }; function xr(e) { const { value: t, onChange: o = () => { }, unitId: n, subUnitId: a, validResult: i, showError: r, ruleId: l } = e, { formula1: s = "", formula2: c = "" } = t || {}, u = We(null), [p, d] = W(() => Pe(s) ? "1" : "0"), [g, f] = W(p === "1" ? s : "="), [C, R] = W(p === "1" ? s : "="), v = L(J), w = L(ye), I = L(Pt), V = L(Ca), [_, S] = W(() => c.split(",")), m = w.getValidatorItem(z.LIST), [y, P] = W([]), [F, T] = W(""), E = r ? i == null ? void 0 : i.formula1 : "", A = He(() => I.ruleChange$.pipe(wn(16)), []), x = Ne(A), j = ln(o); Ce(() => { (async () => { await new Promise((B) => { setTimeout(() => B(!0), 100); }); const D = I.getRuleById(n, a, l), U = D == null ? void 0 : D.formula1; if (Pe(U) && m && D) { const B = await m.getListAsync(D, n, a); P(B); } })(); }, [I, x, m, l, a, n]), Ce(() => { Pe(s) && s !== C && (f(s), R(C)); }, [C, s]); const [N, H] = W(() => { const D = p !== "1" ? ao(s) : [], U = c.split(","); return D.map((B, $) => ({ label: B, color: U[$] || Te, isRef: !1, id: en.generateRandomId(4) })); }), X = (D, U, B) => { const $ = N.find((_e) => _e.id === D); $ && ($.label = U, $.color = B, H([...N])); }, k = (D) => { const U = N.findIndex((B) => B.id === D); U !== -1 && (N.splice(U, 1), H([...N])); }, K = c.split(","), q = He(() => y.map((D, U) => ({ label: D, color: K[U] || Te, id: `${U}`, isRef: !0 })), [K, y]), ee = (D, U, B) => { const $ = [..._]; $[+D] = B, S($), j({ formula1: s, formula2: $.join(",") }); }, te = () => { H([ ...N, { label: "", color: Te, isRef: !1, id: en.generateRandomId(4) } ]); }; Ce(() => { if (p === "1") return; const D = /* @__PURE__ */ new Set(), U = []; N.map((B) => ({ labelList: B.label.split(","), item: B })).forEach(({ item: B, labelList: $ }) => { $.forEach((_e) => { D.has(_e) || (D.add(_e), U.push({ label: _e, color: B.color })); }); }), j({ formula1: io(U.map((B) => B.label)), formula2: U.map((B) => B.color === Te ? "" : B.color).join(",") }); }, [N, j, p, C, _]); const re = ln(async (D) => { if (!Pe(D)) { j == null || j({ formula1: "", formula2: c }); return; } V.getFormulaRefCheck(D) ? (j == null || j({ formula1: Pe(D) ? D : "", formula2: c }), T("")) : (j == null || j({ formula1: "", formula2: c }), f("="), T(v.t("dataValidation.validFail.formulaError"))); }), ae = We({}), [se, O] = W(!1); return Sn((D) => { var B; const U = (B = ae.current) == null ? void 0 : B.handleOutClick; U && U(D, () => O(!1)); }), /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsx(Z, { label: v.t("dataValidation.list.options"), children: /* @__PURE__ */ h.jsxs( mn, { value: p, onChange: (D) => { d(D), f(C), D === "1" && j({ formula1: C === "=" ? "" : C, formula2: _.join(",") }); }, children: [ /* @__PURE__ */ h.jsx(Ae, { value: "0", children: v.t("dataValidation.list.customOptions") }), /* @__PURE__ */ h.jsx(Ae, { value: "1", children: v.t("dataValidation.list.refOptions") }) ] } ) }), p === "1" ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [ /* @__PURE__ */ h.jsx( So, { initValue: g, unitId: n, subUnitId: a, isFocus: se, onChange: (D = "") => { const U = (D != null ? D : "").trim(); R(U), re(U); }, errorText: E || F || void 0, onFocus: () => O(!0), actions: ae.current, isSupportAcrossSheet: !0 } ), /* @__PURE__ */ h.jsx("div", { ref: u, style: { marginTop: "12px" }, children: q.map((D) => /* @__PURE__ */ h.jsx(Wn, { item: D, commonProps: { onItemChange: ee }, style: { marginBottom: 12 } }, D.id)) }) ] }) : /* @__PURE__ */ h.jsx(Z, { error: E, children: /* @__PURE__ */ h.jsxs("div", { ref: u, style: { marginTop: "-12px" }, children: [ /* @__PURE__ */ h.jsx( sa, { list: N, onListChange: H, rowHeight: 32, margin: [0, 12], draggableHandle: ".draggableHandle", itemRender: (D) => /* @__PURE__ */ h.jsx( Wn, { item: D, commonProps: { onItemChange: X, onItemDelete: k } }, D.id ), idKey: "id" } ), /* @__PURE__ */ h.jsxs("a", { className: ne.dataValidationFormulaListAdd, onClick: te, children: [ /* @__PURE__ */ h.jsx(Ro, {}), v.t("dataValidation.list.add") ] }) ] }) }) ] }); } const jo = "data-validation.custom-formula-input", xt = "data-validation.formula-input", Mn = "data-validation.list-formula-input", Fo = "data-validation.checkbox-formula-input", jr = [ [ jo, Lr ], [ xt, Er ], [ Mn, xr ], [ Fo, Or ] ], Fr = "LIST_RENDER_MODE_OPTION_INPUT"; function Mt(e) { var a; const { value: t, onChange: o } = e, n = L(J); return /* @__PURE__ */ h.jsx(Z, { label: n.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ h.jsxs(mn, { value: `${(a = t.renderMode) != null ? a : de.CUSTOM}`, onChange: (i) => o({ ...t, renderMode: +i }), children: [ /* @__PURE__ */ h.jsx(Ae, { value: `${de.CUSTOM}`, children: n.t("dataValidation.renderMode.chip") }), /* @__PURE__ */ h.jsx(Ae, { value: `${de.ARROW}`, children: n.t("dataValidation.renderMode.arrow") }), /* @__PURE__ */ h.jsx(Ae, { value: `${de.TEXT}`, children: n.t("dataValidation.renderMode.text") }) ] }) }); } Mt.componentKey = Fr; const Nr = "DATE_SHOW_TIME_OPTION"; function bt(e) { var a; const { value: t, onChange: o } = e, n = L(J); return /* @__PURE__ */ h.jsx(Z, { children: /* @__PURE__ */ h.jsx( Ot, { checked: (a = t.bizInfo) == null ? void 0 : a.showTime, onChange: (i) => { o({ ...t, bizInfo: { ...t.bizInfo, showTime: i } }); }, children: n.t("dataValidation.showTime.label") } ) }); } bt.componentKey = Nr; var Ur = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, $r = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? Br(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && Ur(t, o, a), a; }, at = (e, t) => (o, n) => t(o, n, e); const ht = 6; let dn = class { constructor(e, t, o, n, a) { this._commandService = e, this._formulaService = t, this._themeService = o, this._renderManagerService = n, this._dataValidationModel = a; } _calc(e, t) { var c, u, p; const { vt: o, ht: n } = t || {}, a = e.endX - e.startX - ht * 2, i = e.endY - e.startY, r = ((c = t == null ? void 0 : t.fs) != null ? c : 10) * 1.6; let l = 0, s = 0; switch (o) { case ue.TOP: s = 0; break; case ue.BOTTOM: s = 0 + (i - r); break; default: s = 0 + (i - r) / 2; break; } switch (n) { case Ye.LEFT: l = ht; break; case Ye.RIGHT: l = ht + (a - r); break; default: l = ht + (a - r) / 2; break; } return { left: e.startX + l, top: e.startY + s, width: ((u = t == null ? void 0 : t.fs) != null ? u : 10) * 1.6, height: ((p = t == null ? void 0 : t.fs) != null ? p : 10) * 1.6 }; } calcCellAutoHeight(e) { var o; const { style: t } = e; return ((o = t == null ? void 0 : t.fs) != null ? o : 10) * 1.6; } calcCellAutoWidth(e) { var o; const { style: t } = e; return ((o = t == null ? void 0 : t.fs) != null ? o : 10) * 1.6; } async _parseFormula(e, t, o) { var c, u, p, d, g, f, C, R, v; const { formula1: n = Ra, formula2: a = Da } = e, i = await this._formulaService.getRuleFormulaResult(t, o, e.uid), r = Ft((p = (u = (c = i == null ? void 0 : i[0]) == null ? void 0 : c.result) == null ? void 0 : u[0]) == null ? void 0 : p[0]), l = Ft((f = (g = (d = i == null ? void 0 : i[1]) == null ? void 0 : d.result) == null ? void 0 : g[0]) == null ? void 0 : f[0]), s = Ln(String(r)) && Ln(String(l)); return { formula1: Pe(n) ? Ft((v = (R = (C = i == null ? void 0 : i[0]) == null ? void 0 : C.result) == null ? void 0 : R[0]) == null ? void 0 : v[0]) : n, formula2: Pe(a) ? l : a, isFormulaValid: s }; } drawWith(e, t) { var E, A, x, j; const { style: o, primaryWithCoord: n, unitId: a, subUnitId: i, worksheet: r, row: l, col: s } = t, c = n.isMergedMainCell ? n.mergeInfo : n, u = ie(r.getCellRaw(l, s)), p = this._dataValidationModel.getRuleByLocation(a, i, l, s); if (!p) return; const d = this._dataValidationModel.getValidator(p.type); if (!d) return; const g = this._themeService.getCurrentTheme(); if (!((E = d.skipDefaultFontRender) != null && E.call(d, p, u, { unitId: a, subUnitId: i, row: l, column: s }))) return; const f = d.parseFormulaSync(p, a, i), { formula1: C } = f, R = this._calc(c, o), { a: v, d: w } = e.getTransform(), I = En(R.left, v), V = En(R.top, w), _ = la.create().composeMatrix({ left: I, top: V, scaleX: 1, scaleY: 1, angle: 0, skewX: 0, skewY: 0, flipX: !1, flipY: !1 }), S = c.endX - c.startX, m = c.endY - c.startY; e.save(), e.beginPath(), e.rect(c.startX, c.startY, S, m), e.clip(); const y = _.getMatrix(); e.transform(y[0], y[1], y[2], y[3], y[4], y[5]); const P = ((A = o == null ? void 0 : o.fs) != null ? A : 10) * 1.6, F = String(u) === String(C), T = g.hyacinth500; da.drawWith(e, { checked: F, width: P, height: P, fill: (j = (x = o == null ? void 0 : o.cl) == null ? void 0 : x.rgb) != null ? j : T }), e.restore(); } isHit(e, t) { const o = t.primaryWithCoord.isMergedMainCell ? t.primaryWithCoord.mergeInfo : t.primaryWithCoord, n = this._calc(o, t.style), a = n.top, i = n.top + n.height, r = n.left, l = n.left + n.width, { x: s, y: c } = e; return s <= l && s >= r && c <= i && c >= a; } async onPointerDown(e, t) { var f; if (t.button === 2) return; const { primaryWithCoord: o, unitId: n, subUnitId: a, worksheet: i, row: r, col: l } = e, s = ie(i.getCellRaw(r, l)), c = this._dataValidationModel.getRuleByLocation(n, a, r, l); if (!c) return; const u = this._dataValidationModel.getValidator(c.type); if (!u || !((f = u.skipDefaultFontRender) != null && f.call(u, c, s, { unitId: n, subUnitId: a, row: r, column: l }))) return; const { formula1: p, formula2: d } = await this._parseFormula(c, n, a), g = { range: { startColumn: o.actualColumn, endColumn: o.actualColumn, startRow: o.actualRow, endRow: o.actualRow }, value: { v: String(s) === wa(String(p)) ? d : p, p: null } }; this._commandService.executeCommand( vn.id, g ); } onPointerEnter(e, t) { var o, n; (n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Xe.POINTER); } onPointerLeave(e, t) { var o, n; (n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Xe.DEFAULT); } }; dn = $r([ at(0, Q), at(1, b(Ia)), at(2, b(na)), at(3, b(Ve)), at(4, b(oe)) ], dn); var kr = Object.defineProperty, Wr = Object.getOwnPropertyDescriptor, Hr = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? Wr(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && kr(t, o, a), a; }, Yr = (e, t) => (o, n) => t(o, n, e); let me = class { constructor(e) { M(this, "canvasRender", null); M(this, "dropdown"); M(this, "optionsInput"); M(this, "formulaInput", Mn); this.injector = e; } }; me = Hr([ Yr(0, b(Fe)) ], me); class Xr extends me { constructor() { super(...arguments); M(this, "id", z.CHECKBOX); M(this, "canvasRender", this.injector.createInstance(dn)); M(this, "formulaInput", Fo); } } class zr extends me { constructor() { super(...arguments); M(this, "id", z.CUSTOM); M(this, "formulaInput", jo); } } const Kr = "data-validation.formula-input"; class Gr extends me { constructor() { super(...arguments); M(this, "id", z.DATE); M(this, "formulaInput", Kr); M(this, "optionsInput", bt.componentKey); M(this, "dropdown", Oo); } } class Zr extends me { constructor() { super(...arguments); M(this, "id", z.DECIMAL); M(this, "formulaInput", xt); } } const No = 4, qr = 0, Wt = 4, Uo = 4, cn = 6, Et = 6, Le = 14; function Jr(e, t) { const o = ca.getTextSize(e, t), n = o.width + No * 2, { ba: a, bd: i } = o, r = a + i; return { width: n, height: r + qr * 2, ba: a }; } function Ht(e, t, o, n) { const a = Le + cn * 2, i = o - a, r = n - Et * 2, l = e.map((d) => ({ layout: Jr(d, t), text: d })); let s; const c = []; l.forEach((d) => { const { layout: g } = d, { width: f, height: C } = g; !s || s.width + f + Wt > i ? (s = { width: f, height: C, items: [{ ...d, left: 0 }] }, c.push(s)) : (s.items.push({ ...d, left: s.width + Wt }), s.width = s.width + f + Wt); }); let u = 0, p = 0; return c.forEach((d, g) => { p = Math.max(p, d.width), g === c.length - 1 ? u += d.height : u += d.height + Uo; }), { lines: c, totalHeight: u, contentWidth: i, contentHeight: r, cellAutoHeight: u + Et * 2, calcAutoWidth: p + a }; } const Qr = 8; class es extends ua { static drawWith(t, o) { const { fontString: n, info: a, fill: i, color: r } = o, { layout: l, text: s } = a; t.save(), Jn.drawWith(t, { width: l.width, height: l.height, radius: Qr, fill: i || Te }), t.translateWithPrecision(No, l.ba), t.font = n, t.fillStyle = r, t.fillText(s, 0, 0), t.restore(); } } var ts = Object.defineProperty, ns = Object.getOwnPropertyDescriptor, os = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? ns(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && ts(t, o, a), a; }, Yt = (e, t) => (o, n) => t(o, n, e); const as = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z"); let un = class { constructor(e, t, o) { M(this, "zIndex"); M(this, "_dropdownInfoMap", /* @__PURE__ */ new Map()); this._commandService = e, this._renderManagerService = t, this._dataValidationModel = o; } _ensureMap(e) { let t = this._dropdownInfoMap.get(e); return t || (t = /* @__PURE__ */ new Map(), this._dropdownInfoMap.set(e, t)), t; } _generateKey(e, t) { return `${e}.${t}`; } _drawDownIcon(e, t, o, n, a) { const i = o - Le + 4; let r = 4; switch (a) { case ue.MIDDLE: r = (n - Le) / 2 + 4; break; case ue.BOTTOM: r = n - Le + 4; break; } e.save(), e.translateWithPrecision(t.startX + i, t.startY + r), e.fillStyle = "#565656", e.fill(as), e.restore(); } // eslint-disable-next-line max-lines-per-function drawWith(e, t, o, n) { var X, k; const { primaryWithCoord: a, row: i, col: r, style: l, data: s, subUnitId: c } = t, u = a.isMergedMainCell ? a.mergeInfo : a, p = s == null ? void 0 : s.fontRenderExtension, { leftOffset: d = 0, rightOffset: g = 0, topOffset: f = 0, downOffset: C = 0 } = p || {}, R = this._ensureMap(c), v = this._generateKey(i, r), w = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, i, r); if (!w) return; const I = this._dataValidationModel.getValidator(w.type); if (!I) return; const V = { startX: u.startX + d, endX: u.endX - g, startY: u.startY + f, endY: u.endY - C }, _ = V.endX - V.startX, S = V.endY - V.startY, { cl: m } = l || {}, y = (X = typeof m == "object" ? m == null ? void 0 : m.rgb : m) != null ? X : "#000", P = jt(l != null ? l : void 0), { vt: F, ht: T } = l || {}, E = F != null ? F : ue.MIDDLE, A = (k = ie(s)) != null ? k : "", x = I.parseCellValue(A), j = I.getListWithColorMap(w), N = Ht(x, P, _, S); this._drawDownIcon(e, V, _, S, E), e.save(), e.translateWithPrecision(V.startX, V.startY), e.beginPath(), e.rect(0, 0, _ - Le, S), e.clip(), e.translateWithPrecision(cn, Et); let H = 0; switch (E) { case ue.MIDDLE: H = (N.contentHeight - N.totalHeight) / 2; break; case ue.BOTTOM: H = N.contentHeight - N.totalHeight; break; } e.translateWithPrecision(0, H), N.lines.forEach((K, q) => { e.save(); const { width: ee, height: te, items: re } = K; let ae = 0; switch (T) { case Ye.RIGHT: ae = N.contentWidth - ee; break; case Ye.CENTER: ae = (N.contentWidth - ee) / 2; break; } e.translate(ae, q * (te + Uo)), re.forEach((se) => { e.save(), e.translateWithPrecision(se.left, 0), es.drawWith(e, { ...P, info: se, color: y, fill: j[se.text] }), e.restore(); }), e.restore(); }), e.restore(), R.set(v, { left: V.startX, top: V.startY, width: N.contentWidth + cn + Le, height: N.contentHeight + Et * 2 }); } calcCellAutoHeight(e) { var _; const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: s = 0, topOffset: c = 0, downOffset: u = 0 } = r || {}, p = t.isMergedMainCell ? t.mergeInfo : t, d = { startX: p.startX + l, endX: p.endX - s, startY: p.startY + c, endY: p.endY - u }, g = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i); if (!g) return; const f = this._dataValidationModel.getValidator(g.type); if (!f) return; const C = d.endX - d.startX, R = d.endY - d.startY, v = (_ = ie(n)) != null ? _ : "", w = f.parseCellValue(v), I = jt(o != null ? o : void 0); return Ht(w, I, C, R).cellAutoHeight; } calcCellAutoWidth(e) { var _; const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = n == null ? void 0 : n.fontRenderExtension, { leftOffset: l = 0, rightOffset: s = 0, topOffset: c = 0, downOffset: u = 0 } = r || {}, p = t.isMergedMainCell ? t.mergeInfo : t, d = { startX: p.startX + l, endX: p.endX - s, startY: p.startY + c, endY: p.endY - u }, g = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i); if (!g) return; const f = this._dataValidationModel.getValidator(g.type); if (!f) return; const C = d.endX - d.startX, R = d.endY - d.startY, v = (_ = ie(n)) != null ? _ : "", w = f.parseCellValue(v), I = jt(o != null ? o : void 0); return Ht(w, I, C, R).calcAutoWidth; } isHit(e, t) { const { primaryWithCoord: o } = t, n = o.isMergedMainCell ? o.mergeInfo : o, { endX: a } = n, { x: i } = e; return i >= a - Le && i <= a; } onPointerDown(e, t) { if (t.button === 2) return; const { unitId: o, subUnitId: n, row: a, col: i } = e, r = { unitId: o, subUnitId: n, row: a, column: i }; this._commandService.executeCommand(Tt.id, r); } onPointerEnter(e, t) { var o, n; (n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Xe.POINTER); } onPointerLeave(e, t) { var o, n; (n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Xe.DEFAULT); } }; un = os([ Yt(0, Q), Yt(1, b(Ve)), Yt(2, b(oe)) ], un); class is extends me { constructor() { super(...arguments); M(this, "id", z.LIST_MULTIPLE); M(this, "canvasRender", this.injector.createInstance(un)); M(this, "dropdown", yn); } } var rs = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, ls = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? ss(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && rs(t, o, a), a; }, pt = (e, t) => (o, n) => t(o, n, e); const Oe = 4, ft = 4, he = 14, pe = 6, ke = 4, Xt = 8, ds = "#565656", Hn = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z"); function cs(e, t) { const o = e.length; return { id: "d", body: { dataStream: `${e}${aa}`, textRuns: [ { ts: { fs: 11, ff: void 0, it: Qe.FALSE, bl: Qe.FALSE, ul: { s: Qe.FALSE }, st: { s: Qe.FALSE }, ol: { s: Qe.FALSE }, cl: void 0, ...t, bg: void 0, bd: void 0 }, st: 0, ed: o } ] }, documentStyle: { pageSize: { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY } } }; } function Bo(e, t, o) { const n = cs(e, o), a = new oa(n), i = new ha(a); return { documentSkeleton: pa.create(i, t), docModel: a, docViewModel: i }; } function mt(e, t, o) { const { documentSkeleton: n, docModel: a, docViewModel: i } = Bo(e, t, o); return { documents: new fa(`DOCUMENTS_${en.generateRandomId()}`, n, { pageMarginLeft: 0, pageMarginTop: 0 }), documentSkeleton: n, docModel: a, docViewModel: i }; } function Yn(e, t, o, n, a, i, r = !0) { let l = 0; const s = r ? ke : 0; switch (a) { case ue.BOTTOM: l = t - n - s; break; case ue.MIDDLE: l = (t - n) / 2; break; default: l = s; break; } l = Math.max(ke, l); let c = 0; switch (i) { case Ye.CENTER: c = (e - o) / 2; break; case Ye.RIGHT: c = e - o; break; } return c = Math.max(pe, c), { paddingLeft: c, paddingTop: l }; } let hn = class { constructor(e, t, o, n) { M(this, "_dropdownInfoMap", /* @__PURE__ */ new Map()); M(this, "zIndex"); this._localeService = e, this._commandService = t, this._renderManagerService = o, this._dataValidationModel = n; } _ensureMap(e) { let t = this._dropdownInfoMap.get(e); return t || (t = /* @__PURE__ */ new Map(), this._dropdownInfoMap.set(e, t)), t; } _generateKey(e, t) { return `${e}.${t}`; } _drawDownIcon(e, t, o, n, a, i, r) { const { t: l = le.pd.t, b: s = le.pd.b } = r, c = o - he; let u; switch (i) { case ue.MIDDLE: u = (n - ft) / 2; break; case ue.BOTTOM: u = n - s - a - ke + (a / 2 - ft / 2); break; default: u = l + ke + (a / 2 - ft / 2); break; } e.save(), e.translateWithPrecision(t.startX + c, t.startY + u), e.fillStyle = "#565656", e.fill(Hn), e.restore(); } // eslint-disable-next-line max-lines-per-function, complexity drawWith(e, t, o) { const { primaryWithCoord: n, row: a, col: i, style: r, data: l, subUnitId: s } = t, c = n.isMergedMainCell ? n.mergeInfo : n, u = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, a, i); if (!u) return; const p = this._dataValidationModel.getValidator(u.type); if (!p) return; const d = l == null ? void 0 : l.fontRenderExtension, { leftOffset: g = 0, rightOffset: f = 0, topOffset: C = 0, downOffset: R = 0 } = d || {}; if (!u || !p || !p || p.id.indexOf(z.LIST) !== 0 || !p.skipDefaultFontRender(u)) return; const v = { startX: c.startX + g, endX: c.endX - f, startY: c.startY + C, endY: c.endY - R }, w = v.endX - v.startX, I = v.endY - v.startY, V = this._ensureMap(s), _ = this._generateKey(a, i), S = p.getListWithColor(u), m = ie(l), y = `${m != null ? m : ""}`, P = S.find((x) => x.label === y); let { tb: F, vt: T, ht: E, pd: A } = r || {}; if (F = F != null ? F : Se.WRAP, T = T != null ? T : ue.BOTTOM, E = E != null ? E : le.ht, A = A != null ? A : le.pd, u.renderMode === de.ARROW) { const { l: x = le.pd.l, t: j = le.pd.t, r: N = le.pd.r, b: H = le.pd.b } = A, X = w - x - N - he - 4, { documentSkeleton: k, documents: K, docModel: q } = mt(y, this._localeService, r); F === Se.WRAP && q.updateDocumentDataPageSize(Math.max(X, 1)), k.calculate(), k.getActualSize(); const ee = et(k), { height: te, width: re } = ee, { paddingTop: ae, paddingLeft: se } = Yn(X, I - j - H, re, te, T, E, !0); this._drawDownIcon(e, v, w, I, te, T, A), e.save(), e.translateWithPrecision(v.startX + x, v.startY + j), e.beginPath(), e.rect(0, 0, w - x - N, I - j - H), e.clip(), e.translateWithPrecision(0, ae), e.save(), e.translateWithPrecision(Oe, 0), e.beginPath(), e.rect(0, 0, X, te), e.clip(), K.render(e), e.translateWithPrecision(se, 0), e.restore(), e.restore(), V.set(_, { left: v.endX + x + o.rowHeaderWidth - he, top: v.startY + j + o.columnHeaderHeight, width: he, height: I - j - H }); } else { e.save(), e.translateWithPrecision(v.startX, v.startY), e.beginPath(), e.rect(0, 0, w, I), e.clip(); const x = w - pe * 2 - Oe - he - 4, { documentSkeleton: j, documents: N, docModel: H } = mt(y, this._localeService, r); F === Se.WRAP && H.updateDocumentDataPageSize(Math.max(x, 1)), j.calculate(); const X = et(j), { height: k, width: K } = X, { paddingTop: q, paddingLeft: ee } = Yn(x, I, K, k, T, E); e.translateWithPrecision(pe, q); const te = Math.max(w - pe * 2, 1), re = k; Jn.drawWith(e, { width: te, height: re, fill: (P == null ? void 0 : P.color) || Te, radius: Xt }), e.save(), e.translateWithPrecision(Oe, 0), e.beginPath(), e.rect(0, 0, x, k), e.clip(), e.translateWithPrecision(ee, 0), N.render(e), e.restore(), e.translateWithPrecision(x + Oe + 4, (k - ft) / 2), e.fillStyle = ds, e.fill(Hn), e.restore(), V.set(_, { left: v.startX + pe + o.rowHeaderWidth, top: v.startY + q + o.columnHeaderHeight, width: te, height: re }); } } calcCellAutoHeight(e) { const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = t.isMergedMainCell ? t.mergeInfo : t, l = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: c = 0, topOffset: u = 0, downOffset: p = 0 } = l || {}, d = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i); if (!d || d.renderMode === de.TEXT) return; const g = { startX: r.startX + s, endX: r.endX - c, startY: r.startY + u, endY: r.endY - p }, f = g.endX - g.startX, C = ie(n), R = `${C != null ? C : ""}`; let { tb: v, pd: w } = o || {}; const { t: I = le.pd.t, b: V = le.pd.b } = w != null ? w : {}; if (v = v != null ? v : Se.WRAP, d.renderMode === de.ARROW) { const _ = f - he, { documentSkeleton: S, docModel: m } = mt(R, this._localeService, o); v === Se.WRAP && m.updateDocumentDataPageSize(Math.max(_, 1)), S.calculate(), S.getActualSize(); const y = et(S), { height: P } = y; return P + I + V + ke * 2; } else { const _ = f - pe * 2 - Oe - he, { documentSkeleton: S, docModel: m } = Bo(R, this._localeService, o); v === Se.WRAP && m.updateDocumentDataPageSize(Math.max(_, 1)), S.calculate(); const y = et(S), { height: P } = y; return P + ke * 2; } } calcCellAutoWidth(e) { const { primaryWithCoord: t, style: o, data: n, row: a, col: i } = e, r = t.isMergedMainCell ? t.mergeInfo : t, l = n == null ? void 0 : n.fontRenderExtension, { leftOffset: s = 0, rightOffset: c = 0, topOffset: u = 0, downOffset: p = 0 } = l || {}, d = this._dataValidationModel.getRuleByLocation(e.unitId, e.subUnitId, a, i); if (!d || d.renderMode === de.TEXT) return; const g = { startX: r.startX + s, endX: r.endX - c, startY: r.startY + u, endY: r.endY - p }, f = g.endX - g.startX, C = ie(n), R = `${C != null ? C : ""}`; let { tb: v, pd: w } = o || {}; const { l: I = le.pd.l, r: V = le.pd.r } = w != null ? w : {}; v = v != null ? v : Se.WRAP; let _ = pe * 2 + he; switch (d.renderMode) { case de.ARROW: _ = he + pe * 2 + V + I; break; case de.CUSTOM: _ = he + pe * 2 + Oe * 2 + V + I + Xt / 2 + 1; break; // default is CUSTOM default: _ = he + pe * 2 + Oe * 2 + V + I + Xt / 2 + 1; } const S = f - _, { documentSkeleton: m, docModel: y } = mt(R, this._localeService, o); return v === Se.WRAP && y.updateDocumentDataPageSize(Math.max(S, 1)), m.calculate(), m.getActualSize(), et(m).width + _; } isHit(e, t) { const { subUnitId: o, row: n, col: a } = t, r = this._ensureMap(o).get(this._generateKey(n, a)), l = this._dataValidationModel.getRuleByLocation(t.unitId, t.subUnitId, n, a); if (!l || !r || l.renderMode === de.TEXT) return !1; const { top: s, left: c, width: u, height: p } = r, { x: d, y: g } = e; return d >= c && d <= c + u && g >= s && g <= s + p; } onPointerDown(e, t) { if (t.button === 2) return; const { unitId: o, subUnitId: n, row: a, col: i } = e, r = { unitId: o, subUnitId: n, row: a, column: i }; this._commandService.executeCommand(Tt.id, r); } onPointerEnter(e, t) { var o, n; (n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Xe.POINTER); } onPointerLeave(e, t) { var o, n; (n = (o = this._renderManagerService.getCurrentTypeOfRenderer(Y.UNIVER_SHEET)) == null ? void 0 : o.mainComponent) == null || n.setCursor(Xe.DEFAULT); } }; hn = ls([ pt(0, b(J)), pt(1, Q), pt(2, b(Ve)), pt(3, b(oe)) ], hn); class us extends me { constructor() { super(...arguments); M(this, "id", z.LIST); M(this, "canvasRender", this.injector.createInstance(hn)); M(this, "dropdown", yn); M(this, "optionsInput", Mt.componentKey); M(this, "formulaInput", Mn); } } class hs extends me { constructor() { super(...arguments); M(this, "id", z.TEXT_LENGTH); M(this, "formulaInput", xt); } } class ps extends me { constructor() { super(...arguments); M(this, "id", z.WHOLE); M(this, "formulaInput", xt); } } var fs = Object.defineProperty, ms = Object.getOwnPropertyDescriptor, gs = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? ms(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && fs(t, o, a), a; }, zt = (e, t) => (o, n) => t(o, n, e); let qe = class extends fn { constructor(e, t, o) { super(), this._injector = e, this._componentManger = t, this._dataValidatorRegistryService = o, this._initComponents(), this._registerValidatorViews(); } _initComponents() { [ [Lo, wo], [Dt, Ji], [Mo, vi], [yn, Li], [Oo, ni], [Mt.componentKey, Mt], [bt.componentKey, bt], ...jr ].forEach(([e, t]) => { this.disposeWithMe(this._componentManger.register( e, t )); }); } _registerValidatorViews() { [ Zr, ps, hs, Gr, Xr, us, is, zr ].forEach((e) => { const t = this._injector.createInstance(e), o = this._dataValidatorRegistryService.getValidatorItem(t.id); o && (o.formulaInput = t.formulaInput, o.canvasRender = t.canvasRender, o.dropdown = t.dropdown, o.optionsInput = t.optionsInput); }); } }; qe = gs([ zt(0, b(Fe)), zt(1, b(Lt)), zt(2, b(ye)) ], qe); var vs = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, Ss = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? _s(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && vs(t, o, a), a; }, Kt = (e, t) => (o, n) => t(o, n, e); const Cs = "SHEET_DATA_VALIDATION_UI_PLUGIN"; var gt; let Xn = (gt = class extends Zn { constructor(e = Vt, t, o, n) { super(), this._config = e, this._injector = t, this._commandService = o, this._configService = n; const { menu: a, ...i } = qn( {}, Vt, this._config ); a && this._configService.setConfig("menu", a, { merge: !0 }), this._configService.setConfig(Vn, i); } onStarting() { [ [fe], [Ie], [lt], [ze], [Ze], [Ge], [Ke], [st], [qe] ].forEach((e) => { this._injector.add(e); }), [ At, Tt, Eo, Dn, Ue, bo ].forEach((e) => { this._commandService.registerCommand(e); }); } onReady() { this._injector.get(Ke), this._injector.get(Ge), this._injector.get(st), this._injector.get(lt), this._injector.get(Ve).registerRenderModule( Y.UNIVER_SHEET, [yt] ); } onRendered() { this._injector.get(qe), this._injector.get(Ze); } onSteady() { this._injector.get(ze); } }, M(gt, "pluginName", Cs), M(gt, "type", Y.UNIVER_SHEET), gt); Xn = Ss([ Kt(1, b(Fe)), Kt(2, Q), Kt(3, pn) ], Xn); var Is = Object.defineProperty, ws = Object.getOwnPropertyDescriptor, Rs = (e, t, o, n) => { for (var a = n > 1 ? void 0 : n ? ws(t, o) : t, i = e.length - 1, r; i >= 0; i--) (r = e[i]) && (a = (n ? r(t, o, a) : r(a)) || a); return n && a && Is(t, o, a), a; }, Gt = (e, t) => (o, n) => t(o, n, e); const Ds = "SHEET_DATA_VALIDATION_UI_PLUGIN"; var vt; let zn = (vt = class extends Zn { constructor(e = Vt, t, o, n) { super(), this._config = e, this._injector = t, this._commandService = o, this._configService = n; const { menu: a, ...i } = qn( {}, Vt, this._config ); a && this._configService.setConfig("menu", a, { merge: !0 }), this._configService.setConfig(Vn, i); } onStarting() { [ [fe], [Ie], [lt], [ze], [Ze], [Ge], [Ke], [qe] ].forEach((e) => { this._injector.add(e); }), [ At, Tt, Eo, Dn, Ue, bo ].forEach((e) => { this._commandService.registerCommand(e); }); } onReady() { this._injector.get(Ke), this._injector.get(Ge), this._injector.get(Ve).registerRenderModule( Y.UNIVER_SHEET, [yt] ); } onRendered() { this._injector.get(qe), this._injector.get(Ze); } onSteady() { this._injector.get(ze); } }, M(vt, "pluginName", Ds), M(vt, "type", Y.UNIVER_SHEET), vt); zn = Rs([ Gt(1, b(Fe)), Gt(2, Q), Gt(3, pn) ], zn); export { Oo as DATE_DROPDOWN_KEY, yn as LIST_DROPDOWN_KEY, zn as UniverSheetsDataValidationMobileUIPlugin, Xn as UniverSheetsDataValidationUIPlugin };