@univerjs/sheets-data-validation-ui 0.4.2-nightly.202411031606 → 0.4.2-nightly.202411051606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/es/index.js +5 -5
- package/lib/umd/index.js +2 -2
- package/package.json +15 -15
package/lib/es/index.js
CHANGED
@@ -4,13 +4,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
5
5
|
import React, { useState, forwardRef, useRef, createElement, useMemo, useEffect } from "react";
|
6
6
|
import { Inject, LocaleService, Disposable, DataValidationErrorStyle, useDependency, ICommandService, numfmt, CellValueType, UniverInstanceType, toDisposable, IUniverInstanceService, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, CommandType, BuildTextUtils, DataValidationRenderMode, DataValidationType, IConfigService, UndoCommand, RedoCommand, isUnitRangesEqual, debounce, shallowEqual, Injector, DataValidationStatus, ObjectMatrix, Range, Rectangle, queryObjectMatrix, Optional, RxDisposable, InterceptorEffectEnum, sequenceExecute, bufferDebounceTime, isFormulaString, Tools, ThemeService, VerticalAlign, HorizontalAlign, DEFAULT_STYLES, WrapStrategy, DocumentDataModel, DEFAULT_EMPTY_DOCUMENT_VALUE, BooleanNumber, Plugin } from "@univerjs/core";
|
7
|
-
import { Button, DatePanel,
|
7
|
+
import { Button, DatePanel, Scrollbar, FormLayout, RadioGroup, Radio, Checkbox, Input, Select, DraggableList } from "@univerjs/design";
|
8
8
|
import { DeviceInputEventType, IRenderManagerService, fixLineWidthByScale, Transform, Checkbox as Checkbox$1, FontCache, Shape, Rect, getFontStyleString, getDocsSkeletonPageSize, DocumentViewModel, DocumentSkeleton, Documents } from "@univerjs/engine-render";
|
9
9
|
import { SheetInterceptorService, AFTER_CELL_EDIT_ASYNC, SetRangeValuesCommand, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, RangeProtectionPermissionEditPoint, WorksheetEditPermission, checkRangesEditablePermission, WorksheetSetCellStylePermission, INTERCEPTOR_POINT, InterceptCellContentPriority } from "@univerjs/sheets";
|
10
10
|
import { SheetDataValidationModel, getCellValueOrigin, getDataValidationCellValue, deserializeListOptions, serializeListOptions, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, createDefaultNewRule, AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, getDataValidationDiffMutations, DataValidationCacheService, DataValidationFormulaController, DataValidationFormulaService, getFormulaResult, isLegalFormulaResult, transformCheckboxValue, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2 } from "@univerjs/sheets-data-validation";
|
11
11
|
import { getPatternType } from "@univerjs/sheets-numfmt";
|
12
12
|
import { SetCellEditVisibleOperation, SheetCanvasPopManagerService, IEditorBridgeService, SheetPermissionInterceptorBaseController, IMarkSelectionService, HoverManagerService, CellAlertManagerService, CellAlertType, IAutoFillService, APPLY_TYPE, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, getCurrentRangeDisable$, AutoHeightController, SheetSkeletonManagerService } from "@univerjs/sheets-ui";
|
13
|
-
import { IDialogService, KeyCode, ISidebarService, useObservable, ComponentManager, IZenZoneService, useEvent, useSidebarClick, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
|
13
|
+
import { IDialogService, KeyCode, ISidebarService, useObservable, ComponentManager, IZenZoneService, RectPopup, useEvent, useSidebarClick, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
|
14
14
|
import { DataValidatorRegistryService, DataValidationModel, DataValidatorRegistryScope, TWO_FORMULA_OPERATOR_COUNT, getRuleOptions, getRuleSetting } from "@univerjs/data-validation";
|
15
15
|
import { RichTextEditingMutation } from "@univerjs/docs";
|
16
16
|
import { filter, BehaviorSubject, distinctUntilChanged, Subject, debounceTime, bufferTime } from "rxjs";
|
@@ -971,10 +971,10 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
|
|
971
971
|
] });
|
972
972
|
}, "SelectList");
|
973
973
|
function ListDropDown(props) {
|
974
|
-
var _a18, _b;
|
974
|
+
var _a18, _b, _c, _d, _e, _f;
|
975
975
|
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, dataValidationModel = useDependency(DataValidationModel), [editingText, setEditingText] = useState(""), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localValue, setLocalValue] = useState(""), editorBridgeService = useDependency(IEditorBridgeService), instanceService = useDependency(IUniverInstanceService), ruleChange$ = useMemo(() => dataValidationModel.ruleChange$.pipe(debounceTime(16)), []);
|
976
976
|
useObservable(ruleChange$);
|
977
|
-
const anchorRect = RectPopup.useContext(), cellWidth = anchorRect.right - anchorRect.left;
|
977
|
+
const anchorRect = RectPopup.useContext(), cellWidth = ((_b = (_a18 = anchorRect.current) == null ? void 0 : _a18.right) != null ? _b : 0) - ((_d = (_c = anchorRect.current) == null ? void 0 : _c.left) != null ? _d : 0);
|
978
978
|
if (useEffect(() => {
|
979
979
|
const dispose = commandService.onCommandExecuted((command) => {
|
980
980
|
var _a19, _b2;
|
@@ -991,7 +991,7 @@ function ListDropDown(props) {
|
|
991
991
|
};
|
992
992
|
}, [commandService, instanceService]), !worksheet)
|
993
993
|
return null;
|
994
|
-
const cellData = worksheet.getCell(row, col), rule = (
|
994
|
+
const cellData = worksheet.getCell(row, col), rule = (_e = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _e.rule, validator = (_f = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _f.validator, showColor = (rule == null ? void 0 : rule.renderMode) === DataValidationRenderMode.CUSTOM || (rule == null ? void 0 : rule.renderMode) === void 0;
|
995
995
|
if (!cellData || !rule || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0)
|
996
996
|
return;
|
997
997
|
const multiple = rule.type === DataValidationType.LIST_MULTIPLE, list = validator.getListWithColor(rule, unitId, subUnitId), cellStr = localValue || getDataValidationCellValue(worksheet.getCellRaw(row, col)), value = deserializeListOptions(cellStr), handleEdit = /* @__PURE__ */ __name(() => {
|
package/lib/umd/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(q,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("react"),require("@univerjs/core"),require("@univerjs/design"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-data-validation"),require("@univerjs/sheets-numfmt"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/data-validation"),require("@univerjs/docs"),require("rxjs"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula-ui")):typeof define=="function"&&define.amd?define(["exports","react","@univerjs/core","@univerjs/design","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-data-validation","@univerjs/sheets-numfmt","@univerjs/sheets-ui","@univerjs/ui","@univerjs/data-validation","@univerjs/docs","rxjs","@univerjs/engine-formula","@univerjs/sheets-formula-ui"],V):(q=typeof globalThis<"u"?globalThis:q||self,V(q.UniverSheetsDataValidationUi={},q.React,q.UniverCore,q.UniverDesign,q.UniverEngineRender,q.UniverSheets,q.UniverSheetsDataValidation,q.UniverSheetsNumfmt,q.UniverSheetsUi,q.UniverUi,q.UniverDataValidation,q.UniverDocs,q.rxjs,q.UniverEngineFormula,q.UniverSheetsFormulaUi))})(this,function(q,V,o,N,
|
1
|
+
(function(q,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("react"),require("@univerjs/core"),require("@univerjs/design"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-data-validation"),require("@univerjs/sheets-numfmt"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("@univerjs/data-validation"),require("@univerjs/docs"),require("rxjs"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula-ui")):typeof define=="function"&&define.amd?define(["exports","react","@univerjs/core","@univerjs/design","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-data-validation","@univerjs/sheets-numfmt","@univerjs/sheets-ui","@univerjs/ui","@univerjs/data-validation","@univerjs/docs","rxjs","@univerjs/engine-formula","@univerjs/sheets-formula-ui"],V):(q=typeof globalThis<"u"?globalThis:q||self,V(q.UniverSheetsDataValidationUi={},q.React,q.UniverCore,q.UniverDesign,q.UniverEngineRender,q.UniverSheets,q.UniverSheetsDataValidation,q.UniverSheetsNumfmt,q.UniverSheetsUi,q.UniverUi,q.UniverDataValidation,q.UniverDocs,q.rxjs,q.UniverEngineFormula,q.UniverSheetsFormulaUi))})(this,function(q,V,o,N,at,Q,x,an,K,tt,ot,on,dt,Qt,te){"use strict";var hi=Object.defineProperty;var fi=(q,V,o)=>V in q?hi(q,V,{enumerable:!0,configurable:!0,writable:!0,value:o}):q[V]=o;var B=(q,V,o)=>fi(q,typeof V!="symbol"?V+"":V,o);var qt,Jt;var De=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function we(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ye={exports:{}},At={};/**
|
2
2
|
* @license React
|
3
3
|
* react-jsx-runtime.production.min.js
|
4
4
|
*
|
@@ -6,4 +6,4 @@
|
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/var rn=V,sn=Symbol.for("react.element"),ln=Symbol.for("react.fragment"),dn=Object.prototype.hasOwnProperty,cn=rn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,un={key:!0,ref:!0,__self:!0,__source:!0};function Me(t,e,a){var n,i={},r=null,s=null;a!==void 0&&(r=""+a),e.key!==void 0&&(r=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)dn.call(e,n)&&!un.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:sn,type:t,key:r,ref:s,props:i,_owner:cn.current}}At.Fragment=ln,At.jsx=Me,At.jsxs=Me,ye.exports=At;var p=ye.exports,Ve={exports:{}};(function(t,e){(function(a,n){t.exports=n()})(De,function(){var a=1e3,n=6e4,i=36e5,r="millisecond",s="second",d="minute",l="hour",c="day",u="week",f="month",h="quarter",w="year",v="date",m="Invalid Date",M=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var S=["th","st","nd","rd"],g=D%100;return"["+D+(S[(g-20)%10]||S[g]||S[0])+"]"}},I=function(D,S,g){var C=String(D);return!C||C.length>=S?D:""+Array(S+1-C.length).join(g)+D},$={s:I,z:function(D){var S=-D.utcOffset(),g=Math.abs(S),C=Math.floor(g/60),_=g%60;return(S<=0?"+":"-")+I(C,2,"0")+":"+I(_,2,"0")},m:function D(S,g){if(S.date()<g.date())return-D(g,S);var C=12*(g.year()-S.year())+(g.month()-S.month()),_=S.clone().add(C,f),A=g-_<0,j=S.clone().add(C+(A?-1:1),f);return+(-(C+(g-_)/(A?_-j:j-_))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:f,y:w,w:u,d:c,D:v,h:l,m:d,s,ms:r,Q:h}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},L="en",T={};T[L]=E;var y="$isDayjsObject",P=function(D){return D instanceof H||!(!D||!D[y])},k=function D(S,g,C){var _;if(!S)return L;if(typeof S=="string"){var A=S.toLowerCase();T[A]&&(_=A),g&&(T[A]=g,_=A);var j=S.split("-");if(!_&&j.length>1)return D(j[0])}else{var X=S.name;T[X]=S,_=X}return!C&&_&&(L=_),_||!C&&L},U=function(D,S){if(P(D))return D.clone();var g=typeof S=="object"?S:{};return g.date=D,g.args=arguments,new H(g)},R=$;R.l=k,R.i=P,R.w=function(D,S){return U(D,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var H=function(){function D(g){this.$L=k(g.locale,null,!0),this.parse(g),this.$x=this.$x||g.x||{},this[y]=!0}var S=D.prototype;return S.parse=function(g){this.$d=function(C){var _=C.date,A=C.utc;if(_===null)return new Date(NaN);if(R.u(_))return new Date;if(_ instanceof Date)return new Date(_);if(typeof _=="string"&&!/Z$/i.test(_)){var j=_.match(M);if(j){var X=j[2]-1||0,Z=(j[7]||"0").substring(0,3);return A?new Date(Date.UTC(j[1],X,j[3]||1,j[4]||0,j[5]||0,j[6]||0,Z)):new Date(j[1],X,j[3]||1,j[4]||0,j[5]||0,j[6]||0,Z)}}return new Date(_)}(g),this.init()},S.init=function(){var g=this.$d;this.$y=g.getFullYear(),this.$M=g.getMonth(),this.$D=g.getDate(),this.$W=g.getDay(),this.$H=g.getHours(),this.$m=g.getMinutes(),this.$s=g.getSeconds(),this.$ms=g.getMilliseconds()},S.$utils=function(){return R},S.isValid=function(){return this.$d.toString()!==m},S.isSame=function(g,C){var _=U(g);return this.startOf(C)<=_&&_<=this.endOf(C)},S.isAfter=function(g,C){return U(g)<this.startOf(C)},S.isBefore=function(g,C){return this.endOf(C)<U(g)},S.$g=function(g,C,_){return R.u(g)?this[C]:this.set(_,g)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(g,C){var _=this,A=!!R.u(C)||C,j=R.p(g),X=function(z,W){var G=R.w(_.$u?Date.UTC(_.$y,W,z):new Date(_.$y,W,z),_);return A?G:G.endOf(c)},Z=function(z,W){return R.w(_.toDate()[z].apply(_.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(W)),_)},Q=this.$W,nt=this.$M,at=this.$D,rt="set"+(this.$u?"UTC":"");switch(j){case w:return A?X(1,0):X(31,11);case f:return A?X(1,nt):X(0,nt+1);case u:var F=this.$locale().weekStart||0,O=(Q<F?Q+7:Q)-F;return X(A?at-O:at+(6-O),nt);case c:case v:return Z(rt+"Hours",0);case l:return Z(rt+"Minutes",1);case d:return Z(rt+"Seconds",2);case s:return Z(rt+"Milliseconds",3);default:return this.clone()}},S.endOf=function(g){return this.startOf(g,!1)},S.$set=function(g,C){var _,A=R.p(g),j="set"+(this.$u?"UTC":""),X=(_={},_[c]=j+"Date",_[v]=j+"Date",_[f]=j+"Month",_[w]=j+"FullYear",_[l]=j+"Hours",_[d]=j+"Minutes",_[s]=j+"Seconds",_[r]=j+"Milliseconds",_)[A],Z=A===c?this.$D+(C-this.$W):C;if(A===f||A===w){var Q=this.clone().set(v,1);Q.$d[X](Z),Q.init(),this.$d=Q.set(v,Math.min(this.$D,Q.daysInMonth())).$d}else X&&this.$d[X](Z);return this.init(),this},S.set=function(g,C){return this.clone().$set(g,C)},S.get=function(g){return this[R.p(g)]()},S.add=function(g,C){var _,A=this;g=Number(g);var j=R.p(C),X=function(nt){var at=U(A);return R.w(at.date(at.date()+Math.round(nt*g)),A)};if(j===f)return this.set(f,this.$M+g);if(j===w)return this.set(w,this.$y+g);if(j===c)return X(1);if(j===u)return X(7);var Z=(_={},_[d]=n,_[l]=i,_[s]=a,_)[j]||1,Q=this.$d.getTime()+g*Z;return R.w(Q,this)},S.subtract=function(g,C){return this.add(-1*g,C)},S.format=function(g){var C=this,_=this.$locale();if(!this.isValid())return _.invalidDate||m;var A=g||"YYYY-MM-DDTHH:mm:ssZ",j=R.z(this),X=this.$H,Z=this.$m,Q=this.$M,nt=_.weekdays,at=_.months,rt=_.meridiem,F=function(W,G,lt,Ot){return W&&(W[G]||W(C,A))||lt[G].slice(0,Ot)},O=function(W){return R.s(X%12||12,W,"0")},z=rt||function(W,G,lt){var Ot=W<12?"AM":"PM";return lt?Ot.toLowerCase():Ot};return A.replace(b,function(W,G){return G||function(lt){switch(lt){case"YY":return String(C.$y).slice(-2);case"YYYY":return R.s(C.$y,4,"0");case"M":return Q+1;case"MM":return R.s(Q+1,2,"0");case"MMM":return F(_.monthsShort,Q,at,3);case"MMMM":return F(at,Q);case"D":return C.$D;case"DD":return R.s(C.$D,2,"0");case"d":return String(C.$W);case"dd":return F(_.weekdaysMin,C.$W,nt,2);case"ddd":return F(_.weekdaysShort,C.$W,nt,3);case"dddd":return nt[C.$W];case"H":return String(X);case"HH":return R.s(X,2,"0");case"h":return O(1);case"hh":return O(2);case"a":return z(X,Z,!0);case"A":return z(X,Z,!1);case"m":return String(Z);case"mm":return R.s(Z,2,"0");case"s":return String(C.$s);case"ss":return R.s(C.$s,2,"0");case"SSS":return R.s(C.$ms,3,"0");case"Z":return j}return null}(W)||j.replace(":","")})},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(g,C,_){var A,j=this,X=R.p(C),Z=U(g),Q=(Z.utcOffset()-this.utcOffset())*n,nt=this-Z,at=function(){return R.m(j,Z)};switch(X){case w:A=at()/12;break;case f:A=at();break;case h:A=at()/3;break;case u:A=(nt-Q)/6048e5;break;case c:A=(nt-Q)/864e5;break;case l:A=nt/i;break;case d:A=nt/n;break;case s:A=nt/a;break;default:A=nt}return _?A:R.a(A)},S.daysInMonth=function(){return this.endOf(f).$D},S.$locale=function(){return T[this.$L]},S.locale=function(g,C){if(!g)return this.$L;var _=this.clone(),A=k(g,C,!0);return A&&(_.$L=A),_},S.clone=function(){return R.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},D}(),Y=H.prototype;return U.prototype=Y,[["$ms",r],["$s",s],["$m",d],["$H",l],["$W",c],["$M",f],["$y",w],["$D",v]].forEach(function(D){Y[D[1]]=function(S){return this.$g(S,D[0],D[1])}}),U.extend=function(D,S){return D.$i||(D(S,H,U),D.$i=!0),U},U.locale=k,U.isDayjs=P,U.unix=function(D){return U(1e3*D)},U.en=T[L],U.Ls=T,U.p={},U})})(Ve);var hn=Ve.exports;const $t=we(hn);var be={exports:{}};(function(t,e){(function(a,n){t.exports=n()})(De,function(){var a="minute",n=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g;return function(r,s,d){var l=s.prototype;d.utc=function(m){var M={date:m,utc:!0,args:arguments};return new s(M)},l.utc=function(m){var M=d(this.toDate(),{locale:this.$L,utc:!0});return m?M.add(this.utcOffset(),a):M},l.local=function(){return d(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(m){m.utc&&(this.$u=!0),this.$utils().u(m.$offset)||(this.$offset=m.$offset),c.call(this,m)};var u=l.init;l.init=function(){if(this.$u){var m=this.$d;this.$y=m.getUTCFullYear(),this.$M=m.getUTCMonth(),this.$D=m.getUTCDate(),this.$W=m.getUTCDay(),this.$H=m.getUTCHours(),this.$m=m.getUTCMinutes(),this.$s=m.getUTCSeconds(),this.$ms=m.getUTCMilliseconds()}else u.call(this)};var f=l.utcOffset;l.utcOffset=function(m,M){var b=this.$utils().u;if(b(m))return this.$u?0:b(this.$offset)?f.call(this):this.$offset;if(typeof m=="string"&&(m=function(L){L===void 0&&(L="");var T=L.match(n);if(!T)return null;var y=(""+T[0]).match(i)||["-",0,0],P=y[0],k=60*+y[1]+ +y[2];return k===0?0:P==="+"?k:-k}(m),m===null))return this;var E=Math.abs(m)<=16?60*m:m,I=this;if(M)return I.$offset=E,I.$u=m===0,I;if(m!==0){var $=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(I=this.local().add(E+$,a)).$offset=E,I.$x.$localOffset=$}else I=this.utc();return I};var h=l.format;l.format=function(m){var M=m||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,M)},l.valueOf=function(){var m=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*m},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var w=l.toDate;l.toDate=function(m){return m==="s"&&this.$offset?d(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():w.call(this)};var v=l.diff;l.diff=function(m,M,b){if(m&&this.$u===m.$u)return v.call(this,m,M,b);var E=this.local(),I=d(m).local();return v.call(E,I,M,b)}}})})(be);var fn=be.exports;const pn=we(fn);var mn=Object.defineProperty,vn=Object.getOwnPropertyDescriptor,gn=(t,e,a,n)=>{for(var i=n>1?void 0:n?vn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&mn(e,a,i),i},Lt=(t,e)=>(a,n)=>e(a,n,t);let Tt=class extends o.Disposable{constructor(t,e,a,n,i){super(),this._sheetInterceptorService=t,this._dataValidationModel=e,this._dataValidatorRegistryService=a,this._dialogService=n,this._localeService=i,this._initEditorBridgeInterceptor()}_initEditorBridgeInterceptor(){this._sheetInterceptorService.writeCellInterceptor.intercept(J.AFTER_CELL_EDIT_ASYNC,{handler:async(t,e,a)=>{var m;const n=await t,{worksheet:i,row:r,col:s,unitId:d,subUnitId:l,workbook:c}=e,u=this._dataValidationModel.getRuleIdByLocation(d,l,r,s),f=u?this._dataValidationModel.getRuleById(d,l,u):void 0;if(!f||f.errorStyle!==o.DataValidationErrorStyle.STOP)return a(Promise.resolve(n));const h=await this._dataValidatorRegistryService.getValidatorItem(f.type);if(!h||await h.validator({value:x.getCellValueOrigin(n),interceptValue:x.getCellValueOrigin((m=e==null?void 0:e.origin)!=null?m:n),row:r,column:s,unitId:d,subUnitId:l,worksheet:i,workbook:c,t:n==null?void 0:n.t},f))return a(Promise.resolve(n));const v=i.getCellRaw(r,s);return this._dialogService.open({width:368,title:{title:this._localeService.t("dataValidation.alert.title")},id:"reject-input-dialog",children:{title:h.getRuleFinalError(f)},footer:{title:V.createElement(N.Button,{type:"primary",onClick:()=>this._dialogService.close("reject-input-dialog")},this._localeService.t("dataValidation.alert.ok"))},onClose:()=>{this._dialogService.close("reject-input-dialog")}}),a(Promise.resolve(v))}})}showReject(t){this._dialogService.open({width:368,title:{title:this._localeService.t("dataValidation.alert.title")},id:"reject-input-dialog",children:{title:t},footer:{title:V.createElement(N.Button,{type:"primary",onClick:()=>this._dialogService.close("reject-input-dialog")},this._localeService.t("dataValidation.alert.ok"))},onClose:()=>{this._dialogService.close("reject-input-dialog")}})}};Tt=gn([Lt(0,o.Inject(J.SheetInterceptorService)),Lt(1,o.Inject(x.SheetDataValidationModel)),Lt(2,o.Inject(it.DataValidatorRegistryService)),Lt(3,tt.IDialogService),Lt(4,o.Inject(o.LocaleService))],Tt);const Ee={dvDateDropdown:"univer-dv-date-dropdown",dvDateDropdownBtns:"univer-dv-date-dropdown-btns"};$t.extend(pn);const Sn=t=>{if(t==null||typeof t=="boolean")return;if(typeof t=="number"||!Number.isNaN(+t))return $t(o.numfmt.format("yyyy-MM-dd HH:mm:ss",Number(t)));const e=$t(t);if(e.isValid())return e};function _n(t){var T,y,P;const{location:e,hideFn:a}=t,{worksheet:n,row:i,col:r,unitId:s,subUnitId:d,workbook:l}=e,c=o.useDependency(o.ICommandService),u=o.useDependency(Tt),f=n.getCell(i,r),h=(T=f==null?void 0:f.dataValidation)==null?void 0:T.rule,w=(y=f==null?void 0:f.dataValidation)==null?void 0:y.validator,v=x.getCellValueOrigin(n.getCellRaw(i,r)),m=Sn(v),[M,b]=V.useState(m),E=!!((P=h==null?void 0:h.bizInfo)!=null&&P.showTime),I=M&&M.isValid()?M:$t(),$=o.useDependency(o.LocaleService);if(!f||!h||!w)return;const L=async()=>{var S,g,C;if(!I)return;const U=I.format(E?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD 00:00:00"),R=(S=o.numfmt.parseDate(U))==null?void 0:S.v,H=l.getStyles().getStyleByCell(f),Y=(C=(g=H==null?void 0:H.n)==null?void 0:g.pattern)!=null?C:"",D=an.getPatternType(Y);h.errorStyle!==o.DataValidationErrorStyle.STOP||await w.validator({value:R,unitId:s,subUnitId:d,row:i,column:r,worksheet:n,workbook:l,interceptValue:U.replace("Z","").replace("T"," "),t:o.CellValueType.NUMBER},h)?(a(),await c.executeCommand(K.SetCellEditVisibleOperation.id,{visible:!1,eventType:et.DeviceInputEventType.Keyboard,unitId:s,keycode:tt.KeyCode.ESC}),await c.executeCommand(J.SetRangeValuesCommand.id,{unitId:s,subUnitId:d,range:{startColumn:r,endColumn:r,startRow:i,endRow:i},value:{v:R,t:2,p:null,f:null,si:null,s:{n:{pattern:E?D==="datetime"?Y:"yyyy-MM-dd hh:mm:ss":D==="date"?Y:"yyyy-MM-dd"}}}})):u.showReject(w.getRuleFinalError(h))};return p.jsxs("div",{className:Ee.dvDateDropdown,children:[p.jsx(N.DatePanel,{defaultValue:I,pickerValue:I,showTime:E||void 0,onSelect:async k=>{b(k)},onPanelChange:k=>{b(k)},disabledDate:k=>!o.numfmt.parseDate(k.format("YYYY-MM-DD"))}),p.jsx("div",{className:Ee.dvDateDropdownBtns,children:p.jsx(N.Button,{size:"small",type:"primary",onClick:L,disabled:!I.isValid(),children:$.t("dataValidation.alert.ok")})})]})}var ct=function(){return ct=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++){e=arguments[a];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ct.apply(this,arguments)},In=function(t,e){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(a[n[i]]=t[n[i]]);return a},vt=V.forwardRef(function(t,e){var a=t.icon,n=t.id,i=t.className,r=t.extend,s=In(t,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=V.useRef("_".concat(wn()));return Re(a,"".concat(n),{defIds:a.defIds,idSuffix:l.current},ct({ref:e,className:d},s),r)});function Re(t,e,a,n,i){return V.createElement(t.tag,ct(ct({key:e},Cn(t,a,i)),n),(Dn(t,a).children||[]).map(function(r,s){return Re(r,"".concat(e,"-").concat(t.tag,"-").concat(s),a,void 0,i)}))}function Cn(t,e,a){var n=ct({},t.attrs);a!=null&&a.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=a.colorChannel1);var i=e.defIds;return!i||i.length===0||(t.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(r){var s=r[0],d=r[1];typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Dn(t,e){var a,n=e.defIds;return!n||n.length===0?t:t.tag==="defs"&&(!((a=t.children)===null||a===void 0)&&a.length)?ct(ct({},t),{children:t.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?ct(ct({},i),{attrs:ct(ct({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):t}function wn(){return Math.random().toString(36).substring(2,8)}vt.displayName="UniverIcon";var yn={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"}}]},Oe=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"check-mark-single",ref:e,icon:yn}))});Oe.displayName="CheckMarkSingle";var Mn={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"}}]},Le=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"data-validation-single",ref:e,icon:Mn}))});Le.displayName="DataValidationSingle";var Vn={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"}}]},ee=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"delete-single",ref:e,icon:Vn}))});ee.displayName="DeleteSingle";var bn={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"}}]},Te=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"increase-single",ref:e,icon:bn}))});Te.displayName="IncreaseSingle";var En={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"}}]},Pe=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"more-down-single",ref:e,icon:En}))});Pe.displayName="MoreDownSingle";var Rn={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"}}]},je=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"more-up-single",ref:e,icon:Rn}))});je.displayName="MoreUpSingle";var On={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"}}]}]},Ae=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"sequence-single",ref:e,icon:On}))});Ae.displayName="SequenceSingle";var Ln=Object.defineProperty,Tn=Object.getOwnPropertyDescriptor,Pn=(t,e,a,n)=>{for(var i=n>1?void 0:n?Tn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Ln(e,a,i),i},$e=(t,e)=>(a,n)=>e(a,n,t);let ht=class extends o.Disposable{constructor(e,a){super();B(this,"_open$",new dt.BehaviorSubject(!1));B(this,"open$",this._open$.pipe(dt.distinctUntilChanged()));B(this,"_activeRule");B(this,"_activeRule$",new dt.BehaviorSubject(void 0));B(this,"activeRule$",this._activeRule$.asObservable());B(this,"_closeDisposable",null);this._univerInstanceService=e,this._sidebarService=a,this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(dt.filter(n=>!n)).subscribe(()=>{this.close()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(n=>{n.id===ne&&(n.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}get activeRule(){return this._activeRule}get isOpen(){return this._open$.getValue()}dispose(){var e;super.dispose(),this._open$.next(!1),this._open$.complete(),this._activeRule$.complete(),(e=this._closeDisposable)==null||e.dispose()}open(){this._open$.next(!0)}close(){var e;this._open$.next(!1),(e=this._closeDisposable)==null||e.dispose()}setCloseDisposable(e){this._closeDisposable=o.toDisposable(()=>{e.dispose(),this._closeDisposable=null})}setActiveRule(e){this._activeRule=e,this._activeRule$.next(e)}};ht=Pn([$e(0,o.IUniverInstanceService),$e(1,tt.ISidebarService)],ht);function jn(){const t=o.useDependency(gt),e=tt.useObservable(t.activeDropdown$,t.activeDropdown),a=o.useDependency(tt.ComponentManager);if(!e)return null;const{location:n,componentKey:i}=e,r=a.get(i),s=`${n.unitId}-${n.subUnitId}-${n.row}-${n.col}`;if(!r)return null;const d=()=>{t.hideDropdown()};return p.jsx(r,{location:n,hideFn:d},s)}const Fe="sheet.ui.dropdown";var An=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Fn=(t,e,a,n)=>{for(var i=n>1?void 0:n?$n(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&An(e,a,i),i},St=(t,e)=>(a,n)=>e(a,n,t);let gt=class extends o.Disposable{constructor(e,a,n,i,r,s,d){super();B(this,"_activeDropdown");B(this,"_activeDropdown$",new dt.Subject);B(this,"_currentPopup",null);B(this,"activeDropdown$",this._activeDropdown$.asObservable());B(this,"_zenVisible",!1);this._canvasPopupManagerService=e,this._univerInstanceService=a,this._dataValidatorRegistryService=n,this._zenZoneService=i,this._renderManagerService=r,this._dataValidationModel=s,this._sheetsSelectionsService=d,this._init(),this._initSelectionChange(),this.disposeWithMe(()=>{this._activeDropdown$.complete()})}get activeDropdown(){return this._activeDropdown}_init(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{this._zenVisible=e,e&&this.hideDropdown()}))}_getDropdownByCell(e,a,n,i){const r=e?this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_SHEET):this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(!r)return;const s=a?r.getSheetBySheetId(a):r.getActiveSheet();if(!s)return;const d=this._dataValidationModel.getRuleByLocation(r.getUnitId(),s.getSheetId(),n,i);if(!d)return;const l=this._dataValidatorRegistryService.getValidatorItem(d.type);return l==null?void 0:l.dropdown}_initSelectionChange(){this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe(e=>{e&&e.every(a=>!(a.primary&&this._getDropdownByCell(a.primary.unitId,a.primary.sheetId,a.primary.actualRow,a.primary.actualColumn)))&&this.hideDropdown()}))}showDropdown(e,a=!0){const{location:n}=e,{row:i,col:r,unitId:s,subUnitId:d}=n;if(this._currentPopup&&this._currentPopup.dispose(),this._zenVisible)return;this._activeDropdown=e,this._activeDropdown$.next(this._activeDropdown);const l=this._renderManagerService.getRenderById(o.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY),c=this._canvasPopupManagerService.attachPopupToCell(i,r,{componentKey:Fe,onClickOutside:()=>{a&&this.hideDropdown()},offset:[0,3],excludeOutside:[l==null?void 0:l.engine.getCanvasElement()].filter(Boolean)},s,d);if(!c)throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");const u=new o.DisposableCollection;u.add(c),u.add({dispose:()=>{var f,h;(h=(f=this._activeDropdown)==null?void 0:f.onHide)==null||h.call(f)}}),this._currentPopup=u}hideDropdown(){this._activeDropdown&&(this._currentPopup&&this._currentPopup.dispose(),this._currentPopup=null,this._activeDropdown=null,this._activeDropdown$.next(null))}showDataValidationDropdown(e,a,n,i,r){const s=this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_SHEET);if(!s)return;const d=s.getSheetBySheetId(a);if(!d)return;const l=this._dataValidationModel.getRuleByLocation(s.getUnitId(),d.getSheetId(),n,i);if(!l)return;const c=this._dataValidatorRegistryService.getValidatorItem(l.type);if(!c||!c.dropdown){this.hideDropdown();return}this.showDropdown({location:{workbook:s,worksheet:d,row:n,col:i,unitId:e,subUnitId:a},componentKey:c.dropdown,onHide:r})}};gt=Fn([St(0,o.Inject(K.SheetCanvasPopManagerService)),St(1,o.IUniverInstanceService),St(2,o.Inject(it.DataValidatorRegistryService)),St(3,tt.IZenZoneService),St(4,et.IRenderManagerService),St(5,o.Inject(x.SheetDataValidationModel)),St(6,o.Inject(J.SheetsSelectionsService))],gt);const ne="DataValidationPanel",_t={id:"data-validation.operation.open-validation-panel",type:o.CommandType.OPERATION,handler(t,e){if(!e)return!1;const{ruleId:a,isAdd:n}=e,i=t.get(ht),r=t.get(it.DataValidationModel),s=t.get(o.IUniverInstanceService),d=t.get(tt.ISidebarService),l=J.getSheetCommandTarget(s);if(!l)return!1;const{unitId:c,subUnitId:u}=l,f=a?r.getRuleById(c,u,a):void 0;i.open(),i.setActiveRule(f&&{unitId:c,subUnitId:u,rule:f});const h=d.open({header:{title:n?"dataValidation.panel.addTitle":"dataValidation.panel.title"},children:{label:ne},width:312,onClose:()=>i.close()});return i.setCloseDisposable(h),!0}},ae={id:"data-validation.operation.close-validation-panel",type:o.CommandType.OPERATION,handler(t){return t.get(ht).close(),!0}},xe={id:"data-validation.operation.toggle-validation-panel",type:o.CommandType.OPERATION,handler(t){const e=t.get(o.ICommandService),a=t.get(ht);return a.open(),a.isOpen?e.executeCommand(ae.id):e.executeCommand(_t.id),!0}},Ft={type:o.CommandType.OPERATION,id:"sheet.operation.show-data-validation-dropdown",handler(t,e){if(!e)return!1;const a=t.get(gt),{unitId:n,subUnitId:i,row:r,column:s}=e,d=a.activeDropdown,l=d==null?void 0:d.location;return l&&l.unitId===n&&l.subUnitId===i&&l.row===r&&l.col===s||a.showDataValidationDropdown(n,i,r,s),!0}},Ne={type:o.CommandType.OPERATION,id:"sheet.operation.hide-data-validation-dropdown",handler(t,e){return e?(t.get(gt).hideDropdown(),!0):!1}},It="#ECECEC",ie="sheets-data-validation-ui.config",Ue={},mt={dvListDropdown:"univer-dv-list-dropdown",dvListDropdownTitle:"univer-dv-list-dropdown-title",dvListDropdownList:"univer-dv-list-dropdown-list",dvListDropdownListContainer:"univer-dv-list-dropdown-list-container",dvListDropdownSelectedIcon:"univer-dv-list-dropdown-selected-icon",dvListDropdownItemContainer:"univer-dv-list-dropdown-item-container",dvListDropdownItem:"univer-dv-list-dropdown-item",dvListDropdownSplit:"univer-dv-list-dropdown-split",dvListDropdownEdit:"univer-dv-list-dropdown-edit"},xn=t=>{var L,T;const{value:e,onChange:a,multiple:n,options:i,title:r,onEdit:s,style:d,filter:l,location:c}=t,u=o.useDependency(o.LocaleService),f=o.useDependency(o.IConfigService),h=l==null?void 0:l.toLowerCase(),{row:w,col:v,unitId:m,subUnitId:M}=c,b=i.filter(y=>h?y.label.toLowerCase().includes(h):!0),E=(T=(L=f.getConfig(ie))==null?void 0:L.showEditOnDropdown)!=null?T:!0,I=o.useDependency(K.SheetPermissionInterceptorBaseController),$=V.useMemo(()=>I.permissionCheckWithRanges({workbookTypes:[J.WorkbookEditablePermission],rangeTypes:[J.RangeProtectionPermissionEditPoint],worksheetTypes:[J.WorksheetEditPermission]},[{startColumn:v,startRow:w,endColumn:v,endRow:w}],m,M),[I,v,w,m,M]);return p.jsxs("div",{className:mt.dvListDropdown,style:d,children:[p.jsx("div",{className:mt.dvListDropdownTitle,children:r}),p.jsx("div",{className:mt.dvListDropdownList,children:p.jsx(N.Scrollbar,{children:p.jsx("div",{className:mt.dvListDropdownListContainer,children:b.map((y,P)=>{const k=e.indexOf(y.value)>-1,U=()=>{let H;k?H=new Set(e.filter(D=>D!==y.value)):H=new Set(n?[...e,y.value]:[y.value]);const Y=[];i.forEach(D=>{H.has(D.value)&&Y.push(D.value)}),a(Y)},R=y.label.toLocaleLowerCase().indexOf(h);return p.jsxs("div",{className:mt.dvListDropdownItemContainer,onClick:U,children:[p.jsx("div",{className:mt.dvListDropdownItem,style:{background:y.color||It},children:h&&y.label.toLowerCase().includes(h)?p.jsxs(p.Fragment,{children:[p.jsx("span",{children:y.label.substring(0,R)}),p.jsx("span",{style:{fontWeight:"bold"},children:y.label.substring(R,R+h.length)}),p.jsx("span",{children:y.label.substring(R+h.length)})]}):y.label}),p.jsx("div",{className:mt.dvListDropdownSelectedIcon,children:k?p.jsx(Oe,{}):null})]},P)})})},l)}),E&&$?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:mt.dvListDropdownSplit}),p.jsx("div",{className:mt.dvListDropdownEdit,children:p.jsx("a",{onClick:s,children:u.t("dataValidation.list.edit")})})]}):null]})};function Nn(t){var D,S;const{location:e,hideFn:a}=t,{worksheet:n,row:i,col:r,unitId:s,subUnitId:d}=e,l=o.useDependency(it.DataValidationModel),[c,u]=V.useState(""),f=o.useDependency(o.ICommandService),h=o.useDependency(o.LocaleService),[w,v]=V.useState(""),m=o.useDependency(K.IEditorBridgeService),M=o.useDependency(o.IUniverInstanceService),b=V.useMemo(()=>l.ruleChange$.pipe(dt.debounceTime(16)),[]);tt.useObservable(b);const E=N.RectPopup.useContext(),I=E.right-E.left;if(V.useEffect(()=>{const g=f.onCommandExecuted(C=>{var _,A;if(C.id===on.RichTextEditingMutation.id){const j=C.params,{unitId:X}=j,Z=M.getUnit(X,o.UniverInstanceType.UNIVER_DOC);if(!Z)return;const Q=o.BuildTextUtils.transform.getPlainText((A=(_=Z.getSnapshot().body)==null?void 0:_.dataStream)!=null?A:"");u(Q)}});return()=>{g.dispose()}},[f,M]),!n)return null;const $=n.getCell(i,r),L=(D=$==null?void 0:$.dataValidation)==null?void 0:D.rule,T=(S=$==null?void 0:$.dataValidation)==null?void 0:S.validator,y=(L==null?void 0:L.renderMode)===o.DataValidationRenderMode.CUSTOM||(L==null?void 0:L.renderMode)===void 0;if(!$||!L||!T||T.id.indexOf(o.DataValidationType.LIST)!==0)return;const P=L.type===o.DataValidationType.LIST_MULTIPLE,k=T.getListWithColor(L,s,d),U=w||x.getDataValidationCellValue(n.getCellRaw(i,r)),R=x.deserializeListOptions(U),H=()=>{f.executeCommand(_t.id,{ruleId:L.uid}),a()},Y=k.map(g=>({label:g.label,value:g.label,color:y?g.color:"transparent"}));return p.jsx(xn,{style:{minWidth:I,maxWidth:Math.max(I,200)},title:P?h.t("dataValidation.listMultiple.dropdown"):h.t("dataValidation.list.dropdown"),value:R,multiple:P,onChange:async g=>{const C=x.serializeListOptions(g),_={unitId:s,subUnitId:d,range:{startColumn:r,endColumn:r,startRow:i,endRow:i},value:{v:C,p:null,f:null,si:null}};m.isVisible()&&m.changeVisible({visible:!1,keycode:tt.KeyCode.ESC,eventType:et.DeviceInputEventType.Keyboard,unitId:s}),v(C),P||a(),m.isVisible().visible&&await f.executeCommand(K.SetCellEditVisibleOperation.id,{visible:!1,eventType:et.DeviceInputEventType.Keyboard,unitId:s,keycode:tt.KeyCode.ESC}),f.executeCommand(J.SetRangeValuesCommand.id,_)},options:Y,onEdit:H,filter:c,location:e})}const oe={dataValidationOptionsButton:"univer-data-validation-options-button",dataValidationOptionsButtonIcon:"univer-data-validation-options-button-icon"};function Un(t){var c;const e=o.useDependency(o.LocaleService),a=o.useDependency(tt.ComponentManager),{value:n,onChange:i,extraComponent:r}=t,[s,d]=V.useState(!1),l=r?a.get(r):null;return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:oe.dataValidationOptionsButton,onClick:()=>d(!s),children:[e.t("dataValidation.panel.options"),s?p.jsx(je,{className:oe.dataValidationOptionsButtonIcon}):p.jsx(Pe,{className:oe.dataValidationOptionsButtonIcon})]}),s&&p.jsxs(p.Fragment,{children:[l?p.jsx(l,{value:n,onChange:i}):null,p.jsx(N.FormLayout,{label:e.t("dataValidation.panel.invalid"),children:p.jsxs(N.RadioGroup,{value:`${(c=n.errorStyle)!=null?c:o.DataValidationErrorStyle.WARNING}`,onChange:u=>i({...n,errorStyle:+u}),children:[p.jsx(N.Radio,{value:`${o.DataValidationErrorStyle.WARNING}`,children:e.t("dataValidation.panel.showWarning")}),p.jsx(N.Radio,{value:`${o.DataValidationErrorStyle.STOP}`,children:e.t("dataValidation.panel.rejectInput")})]})}),p.jsx(N.FormLayout,{label:e.t("dataValidation.panel.messageInfo"),children:p.jsx(N.Checkbox,{checked:n.showErrorMessage,onChange:()=>i({...n,showErrorMessage:!n.showErrorMessage}),children:e.t("dataValidation.panel.showInfo")})}),n.showErrorMessage?p.jsx(N.FormLayout,{children:p.jsx(N.Input,{value:n.error,onChange:u=>i({...n,error:u})})}):null]})]})}const wt={dataValidationDetail:"univer-data-validation-detail",dataValidationDetailFormItem:"univer-data-validation-detail-form-item",dataValidationDetailButtons:"univer-data-validation-detail-buttons",dataValidationDetailButton:"univer-data-validation-detail-button"},kn=t=>o.debounce(async(e,a,n,i)=>{const r=await t.executeCommand(e,a,n);i==null||i(r)},1e3);function Bn(t,e,a){var n,i,r,s;return e?((i=(n=t.getUnit(e))==null?void 0:n.getSheetBySheetName(a))==null?void 0:i.getSheetId())||"":((s=(r=t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getSheetBySheetName(a))==null?void 0:s.getSheetId())||""}function Wn(){var rt;const[t,e]=V.useState(0),a=o.useDependency(ht),n=tt.useObservable(a.activeRule$,a.activeRule),{unitId:i,subUnitId:r,rule:s}=n||{},d=s.uid,l=o.useDependency(it.DataValidatorRegistryService),c=o.useDependency(o.IUniverInstanceService),u=o.useDependency(tt.ComponentManager),f=o.useDependency(o.ICommandService),h=o.useDependency(it.DataValidationModel),w=o.useDependency(o.LocaleService),[v,m]=V.useState(s),M=l.getValidatorItem(v.type),[b,E]=V.useState(!1),I=l.getValidatorsByScope(it.DataValidatorRegistryScope.SHEET),[$,L]=V.useState(()=>v.ranges.map(F=>({unitId:"",sheetId:"",range:F}))),T=V.useMemo(()=>kn(f),[f]),[y,P]=V.useState(!1),k=V.useRef({}),[U,R]=V.useState(!1),H=o.useDependency(J.SheetsSelectionsService);if(V.useEffect(()=>()=>{const F=H.getCurrentLastSelection();F&&H.setSelections([F])},[H]),V.useEffect(()=>{f.onCommandExecuted(F=>{(F.id===o.UndoCommand.id||F.id===o.RedoCommand.id)&&setTimeout(()=>{const O=h.getRuleById(i,r,d);e(z=>z+1),O&&(m(O),L(O.ranges.map(z=>({unitId:"",sheetId:"",range:z}))))},20)})},[f,h,d,r,i]),!M)return null;const Y=M.operators,D=M.operatorNames,S=v.operator?it.TWO_FORMULA_OPERATOR_COUNT.includes(v.operator):!1,g=()=>{!v.ranges.length||y||(M.validatorFormula(v,i,r).success?a.setActiveRule(null):E(!0))},C=tt.useEvent(F=>{const O=F.split(",").map(Qt.deserializeRangeWithSheet).map(G=>{const lt=G.sheetName;if(lt){const Ot=Bn(c,G.unitId,lt);return{...G,sheetId:Ot}}return{...G,sheetId:""}});if(o.isUnitRangesEqual(O,$))return;L(O);const z=O.filter(G=>(!G.unitId||G.unitId===i)&&(!G.sheetId||G.sheetId===r)).map(G=>G.range);if(m({...v,ranges:z}),z.length===0)return;const W={unitId:i,subUnitId:r,ruleId:d,ranges:z};T(x.UpdateSheetDataValidationRangeCommand.id,W)}),_=F=>{if(o.shallowEqual(F,it.getRuleSetting(v)))return;m({...v,...F});const O={unitId:i,subUnitId:r,ruleId:d,setting:F};T(x.UpdateSheetDataValidationSettingCommand.id,O,void 0)},A=async()=>{await f.executeCommand(x.RemoveSheetDataValidationCommand.id,{ruleId:d,unitId:i,subUnitId:r}),a.setActiveRule(null)},j={type:v.type,operator:v.operator,formula1:v.formula1,formula2:v.formula2,allowBlank:v.allowBlank},X=F=>{const O=l.getValidatorItem(F);if(!O)return;const z=O.operators,W=h.getRuleById(i,r,d),G=F===(W==null?void 0:W.type)||F.includes("list")&&(W!=null&&W.type.includes("list"))?{...W,type:F}:{...v,type:F,operator:z[0],formula1:void 0,formula2:void 0};m(G),f.executeCommand(x.UpdateSheetDataValidationSettingCommand.id,{unitId:i,subUnitId:r,ruleId:v.uid,setting:it.getRuleSetting(G)})},Z=u.get(M.formulaInput),Q=V.useMemo(()=>$.map(F=>Qt.serializeRange(F.range)).join(","),[]),nt=it.getRuleOptions(v),at=F=>{o.shallowEqual(F,it.getRuleOptions(v))||(m({...v,...F}),T(x.UpdateSheetDataValidationOptionsCommand.id,{unitId:i,subUnitId:r,ruleId:d,options:F}))};return tt.useSidebarClick(F=>{var z;const O=(z=k.current)==null?void 0:z.handleOutClick;O&&O(F,()=>R(!1))}),p.jsxs("div",{className:wt.dataValidationDetail,children:[p.jsx(N.FormLayout,{label:w.t("dataValidation.panel.range"),error:!v.ranges.length||y?w.t("dataValidation.panel.rangeError"):"",children:p.jsx(te.RangeSelector,{unitId:i,subUnitId:r,initValue:Q,onChange:C,onFocus:()=>R(!0),isFocus:U,actions:k.current,onVerify:F=>P(!F)})}),p.jsx(N.FormLayout,{label:w.t("dataValidation.panel.type"),children:p.jsx(N.Select,{options:I==null?void 0:I.map(F=>({label:w.t(F.title),value:F.id})),value:v.type,onChange:X,className:wt.dataValidationDetailFormItem})}),Y!=null&&Y.length?p.jsx(N.FormLayout,{label:w.t("dataValidation.panel.operator"),children:p.jsx(N.Select,{options:Y.map((F,O)=>({value:`${F}`,label:D[O]})),value:`${v.operator}`,onChange:F=>{_({...j,operator:F})},className:wt.dataValidationDetailFormItem})}):null,Z?p.jsx(Z,{isTwoFormula:S,value:{formula1:v.formula1,formula2:v.formula2},onChange:F=>{_({...j,...F})},showError:b,validResult:M.validatorFormula(v,i,r),unitId:i,subUnitId:r,ruleId:d},t+v.type):null,p.jsx(N.FormLayout,{children:p.jsx(N.Checkbox,{checked:(rt=v.allowBlank)!=null?rt:!0,onChange:()=>{var F;return _({...j,allowBlank:!((F=v.allowBlank)==null||F)})},children:w.t("dataValidation.panel.allowBlank")})}),p.jsx(Un,{value:nt,onChange:at,extraComponent:M.optionsInput}),p.jsxs("div",{className:wt.dataValidationDetailButtons,children:[p.jsx(N.Button,{className:wt.dataValidationDetailButton,onClick:A,children:w.t("dataValidation.panel.removeRule")}),p.jsx(N.Button,{className:wt.dataValidationDetailButton,type:"primary",onClick:g,children:w.t("dataValidation.panel.done")})]})]})}const xt={dataValidationItemContainer:"univer-data-validation-item-container",dataValidationItemTitle:"univer-data-validation-item-title",dataValidationItemContent:"univer-data-validation-item-content",dataValidationItemIcon:"univer-data-validation-item-icon"},Hn=t=>{const{rule:e,onClick:a,unitId:n,subUnitId:i,disable:r}=t,s=o.useDependency(it.DataValidatorRegistryService),d=o.useDependency(o.ICommandService),l=o.useDependency(K.IMarkSelectionService),c=s.getValidatorItem(e.type),u=V.useRef(),[f,h]=V.useState(!1),w=v=>{d.executeCommand(x.RemoveSheetDataValidationCommand.id,{ruleId:e.uid,unitId:n,subUnitId:i}),v.stopPropagation()};return V.useEffect(()=>()=>{var v;u.current&&((v=u.current)==null||v.forEach(m=>{m&&l.removeShape(m)}))},[l]),p.jsxs("div",{className:xt.dataValidationItemContainer,onClick:a,onMouseEnter:()=>{r||(h(!0),u.current=e.ranges.map(v=>l.addShape({range:v,style:{hasAutoFill:!1,fill:"rgba(73, 184, 17, 0.05)",strokeWidth:1,stroke:"#49B811",widgets:{}},primary:{startColumn:v.startColumn,endColumn:v.endColumn,startRow:v.startRow,endRow:v.endRow,actualRow:v.startRow,actualColumn:v.startColumn,isMerged:!1,isMergedMainCell:!1}})))},onMouseLeave:()=>{var v;h(!1),(v=u.current)==null||v.forEach(m=>{m&&l.removeShape(m)}),u.current=void 0},children:[p.jsx("div",{className:xt.dataValidationItemTitle,children:c==null?void 0:c.generateRuleName(e)}),p.jsx("div",{className:xt.dataValidationItemContent,children:e.ranges.map(v=>Qt.serializeRange(v)).join(",")}),f?p.jsx("div",{className:xt.dataValidationItemIcon,onClick:w,children:p.jsx(ee,{})}):null]})},Nt={dataValidationList:"univer-data-validation-list",dataValidationListButtons:"univer-data-validation-list-buttons",dataValidationListButton:"univer-data-validation-list-button"};function Yn(){const t=o.useDependency(o.IUniverInstanceService),e=tt.useObservable(()=>t.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]);return e?p.jsx(Xn,{workbook:e}):null}function Xn(t){const e=o.useDependency(x.SheetDataValidationModel),a=o.useDependency(o.IUniverInstanceService),n=o.useDependency(o.ICommandService),i=o.useDependency(o.Injector),r=o.useDependency(ht),s=o.useDependency(o.LocaleService),[d,l]=V.useState([]),{workbook:c}=t,u=tt.useObservable(c.activeSheet$,void 0,!0),f=c.getUnitId(),h=u==null?void 0:u.getSheetId();V.useEffect(()=>{l(e.getRules(f,h));const E=e.ruleChange$.subscribe(I=>{I.unitId===f&&I.subUnitId===h&&l(e.getRules(f,h))});return()=>{E.unsubscribe()}},[f,h,e]);const w=async()=>{const E=x.createDefaultNewRule(i),I={unitId:f,subUnitId:h,rule:E};await n.executeCommand(x.AddSheetDataValidationCommand.id,I),r.setActiveRule({unitId:f,subUnitId:h,rule:E})},v=()=>{n.executeCommand(x.RemoveSheetAllDataValidationCommand.id,{unitId:f,subUnitId:h})},M=(E=>{const I=a.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET),$=I.getActiveSheet(),L=I.getUnitId(),T=$.getSheetId();return E.map(P=>J.checkRangesEditablePermission(i,L,T,P.ranges)?{...P}:{...P,disable:!0})})(d),b=M==null?void 0:M.some(E=>E.disable);return p.jsxs("div",{className:Nt.dataValidationList,children:[M==null?void 0:M.map(E=>{var I;return p.jsx(Hn,{unitId:f,subUnitId:h,onClick:()=>{E.disable||r.setActiveRule({unitId:f,subUnitId:h,rule:E})},rule:E,disable:(I=E.disable)!=null?I:!1},E.uid)}),p.jsxs("div",{className:Nt.dataValidationListButtons,children:[d.length&&!b?p.jsx(N.Button,{className:Nt.dataValidationListButton,onClick:v,children:s.t("dataValidation.panel.removeAll")}):null,p.jsx(N.Button,{className:Nt.dataValidationListButton,type:"primary",onClick:w,children:s.t("dataValidation.panel.add")})]})]})}const zn=()=>{const t=o.useDependency(ht),e=tt.useObservable(t.activeRule$,t.activeRule);return e?p.jsx(Wn,{},e.rule.uid):p.jsx(Yn,{})},Ut="data-validation.list.dropdown",re="data-validation.date.dropdown",kt={type:o.CommandType.COMMAND,id:"data-validation.command.addRuleAndOpen",handler(t){const e=t.get(o.IUniverInstanceService),a=J.getSheetCommandTarget(e);if(!a)return!1;const{workbook:n,worksheet:i}=a,r=x.createDefaultNewRule(t),s=t.get(o.ICommandService),d=n.getUnitId(),l=i.getSheetId(),c={rule:r,unitId:d,subUnitId:l};return s.syncExecuteCommand(x.AddSheetDataValidationCommand.id,c)?(s.syncExecuteCommand(_t.id,{ruleId:r.uid,isAdd:!0}),!0):!1}};var Kn=Object.defineProperty,Gn=Object.getOwnPropertyDescriptor,Zn=(t,e,a,n)=>{for(var i=n>1?void 0:n?Gn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Kn(e,a,i),i},Pt=(t,e)=>(a,n)=>e(a,n,t);const Bt="SHEET_DATA_VALIDATION_ALERT";let jt=class extends o.Disposable{constructor(t,e,a,n,i){super(),this._hoverManagerService=t,this._cellAlertManagerService=e,this._univerInstanceService=a,this._localeService=n,this._zenZoneService=i,this._init()}_init(){this._initCellAlertPopup(),this._initZenService()}_initCellAlertPopup(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(dt.debounceTime(100)).subscribe(t=>{var e,a;if(t){const i=this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!i)return;const r=i.getCell(t.location.row,t.location.col);if(((e=r==null?void 0:r.dataValidation)==null?void 0:e.validStatus)===o.DataValidationStatus.INVALID){const s=this._cellAlertManagerService.currentAlert.get(Bt),d=(a=s==null?void 0:s.alert)==null?void 0:a.location;if(d&&d.row===t.location.row&&d.col===t.location.col&&d.subUnitId===t.location.subUnitId&&d.unitId===t.location.unitId)return;const l=r.dataValidation.validator,c=r.dataValidation.rule;if(!l)return;this._cellAlertManagerService.showAlert({type:K.CellAlertType.ERROR,title:this._localeService.t("dataValidation.error.title"),message:l==null?void 0:l.getRuleFinalError(c),location:t.location,width:200,height:74,key:Bt});return}}this._cellAlertManagerService.removeAlert(Bt)}))}_initZenService(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(t=>{t&&this._cellAlertManagerService.removeAlert(Bt)}))}};jt=Zn([Pt(0,o.Inject(K.HoverManagerService)),Pt(1,o.Inject(K.CellAlertManagerService)),Pt(2,o.IUniverInstanceService),Pt(3,o.Inject(o.LocaleService)),Pt(4,tt.IZenZoneService)],jt);var qn=Object.defineProperty,Jn=Object.getOwnPropertyDescriptor,Qn=(t,e,a,n)=>{for(var i=n>1?void 0:n?Jn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&qn(e,a,i),i},se=(t,e)=>(a,n)=>e(a,n,t);let yt=class extends o.Disposable{constructor(t,e,a){super(),this._autoFillService=t,this._dataValidationModel=e,this._injector=a,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(i,r)=>{const{source:s,target:d,unitId:l,subUnitId:c}=i,u=this._dataValidationModel.getRuleObjectMatrix(l,c).clone(),f=K.virtualizeDiscreteRanges([s,d]),[h,w]=f.ranges,{mapFunc:v}=f,m={row:h.startRow,col:h.startColumn},M=K.getAutoFillRepeatRange(h,w),b=new o.ObjectMatrix,E=new Set;M.forEach(y=>{const P=y.repeatStartCell,k=y.relativeRange,U={startRow:m.row,startColumn:m.col,endColumn:m.col,endRow:m.row},R={startRow:P.row,startColumn:P.col,endColumn:P.col,endRow:P.row};o.Range.foreach(k,(H,Y)=>{const D=o.Rectangle.getPositionRange({startRow:H,startColumn:Y,endColumn:Y,endRow:H},U),{row:S,col:g}=v(D.startRow,D.startColumn),C=this._dataValidationModel.getRuleIdByLocation(l,c,S,g);if(C){const _=o.Rectangle.getPositionRange({startRow:H,startColumn:Y,endColumn:Y,endRow:H},R),{row:A,col:j}=v(_.startRow,_.startColumn);b.setValue(A,j,C),E.add(C)}})});const I=Array.from(E).map(y=>({id:y,ranges:o.queryObjectMatrix(b,P=>P===y)}));u.addRangeRules(I);const $=u.diff(this._dataValidationModel.getRules(l,c)),{redoMutations:L,undoMutations:T}=x.getDataValidationDiffMutations(l,c,$,this._injector,"patched",r===K.APPLY_TYPE.ONLY_FORMAT);return{undos:T,redos:L}},a=[o.DataValidationType.CHECKBOX],n={id:x.DATA_VALIDATION_PLUGIN_NAME,onBeforeFillData:i=>{const{source:r,unitId:s,subUnitId:d}=i;for(const l of r.rows)for(const c of r.cols){const u=this._dataValidationModel.getRuleByLocation(s,d,l,c);if(u&&a.indexOf(u.type)>-1){this._autoFillService.setDisableApplyType(K.APPLY_TYPE.SERIES,!0);return}}},onFillData:(i,r,s)=>s===K.APPLY_TYPE.COPY||s===K.APPLY_TYPE.ONLY_FORMAT||s===K.APPLY_TYPE.SERIES?e(i,s):t(),onAfterFillData:()=>{}};this.disposeWithMe(this._autoFillService.addHook(n))}};yt=Qn([se(0,K.IAutoFillService),se(1,o.Inject(x.SheetDataValidationModel)),se(2,o.Inject(o.Injector))],yt);var ta=Object.defineProperty,ea=Object.getOwnPropertyDescriptor,na=(t,e,a,n)=>{for(var i=n>1?void 0:n?ea(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ta(e,a,i),i},le=(t,e)=>(a,n)=>e(a,n,t);let Mt=class extends o.Disposable{constructor(e,a,n){super();B(this,"_copyInfo");this._sheetClipboardService=e,this._sheetDataValidationModel=a,this._injector=n,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:x.DATA_VALIDATION_PLUGIN_NAME,onBeforeCopy:(e,a,n)=>this._collect(e,a,n),onPasteCells:(e,a,n,i)=>{const{copyType:r=K.COPY_TYPE.COPY,pasteType:s}=i,{range:d}=e||{},{range:l,unitId:c,subUnitId:u}=a;return this._generateMutations(l,{copyType:r,pasteType:s,copyRange:d,unitId:c,subUnitId:u})}})}_collect(e,a,n){const i=new o.ObjectMatrix;this._copyInfo={unitId:e,subUnitId:a,matrix:i};const r=this._injector.invoke(l=>K.rangeToDiscreteRange(n,l,e,a));if(!r)return;const{rows:s,cols:d}=r;s.forEach((l,c)=>{d.forEach((u,f)=>{const h=this._sheetDataValidationModel.getRuleIdByLocation(e,a,l,u);i.setValue(c,f,h!=null?h:"")})})}_generateMutations(e,a){if(!this._copyInfo)return{redos:[],undos:[]};if(a.copyType===K.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!a.copyRange)return{redos:[],undos:[]};if([K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(a.pasteType))return{redos:[],undos:[]};const{unitId:n,subUnitId:i}=this._copyInfo;if(a.unitId!==n||i!==a.subUnitId){const r=this._sheetDataValidationModel.getRuleObjectMatrix(a.unitId,a.subUnitId).clone(),s=new o.ObjectMatrix,d=new Set,{ranges:[l,c],mapFunc:u}=K.virtualizeDiscreteRanges([a.copyRange,e]),f=K.getRepeatRange(l,c,!0),h=new Map;f.forEach(({startRange:M})=>{var b;(b=this._copyInfo)==null||b.matrix.forValue((E,I,$)=>{const L=o.Rectangle.getPositionRange({startRow:E,endRow:E,startColumn:I,endColumn:I},M),T=`${i}-${$}`,y=this._sheetDataValidationModel.getRuleById(n,i,$);!this._sheetDataValidationModel.getRuleById(a.unitId,a.subUnitId,T)&&y&&h.set(T,{...y,uid:T});const{row:P,col:k}=u(L.startRow,L.startColumn);d.add(T),s.setValue(P,k,T)})});const w=Array.from(d).map(M=>({id:M,ranges:o.queryObjectMatrix(s,b=>b===M)}));r.addRangeRules(w);const{redoMutations:v,undoMutations:m}=x.getDataValidationDiffMutations(a.unitId,a.subUnitId,r.diffWithAddition(this._sheetDataValidationModel.getRules(a.unitId,a.subUnitId),h.values()),this._injector,"patched",!1);return{redos:v,undos:m}}else{const r=this._sheetDataValidationModel.getRuleObjectMatrix(n,i).clone(),s=new o.ObjectMatrix,d=new Set,{ranges:[l,c],mapFunc:u}=K.virtualizeDiscreteRanges([a.copyRange,e]);K.getRepeatRange(l,c,!0).forEach(({startRange:m})=>{var M;(M=this._copyInfo)==null||M.matrix.forValue((b,E,I)=>{const $=o.Rectangle.getPositionRange({startRow:b,endRow:b,startColumn:E,endColumn:E},m),{row:L,col:T}=u($.startRow,$.startColumn);s.setValue(L,T,I),d.add(I)})});const h=Array.from(d).map(m=>({id:m,ranges:o.queryObjectMatrix(s,M=>M===m)}));r.addRangeRules(h);const{redoMutations:w,undoMutations:v}=x.getDataValidationDiffMutations(n,i,r.diff(this._sheetDataValidationModel.getRules(n,i)),this._injector,"patched",!1);return{redos:w,undos:v}}}};Mt=na([le(0,K.ISheetClipboardService),le(1,o.Inject(x.SheetDataValidationModel)),le(2,o.Inject(o.Injector))],Mt);var aa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,oa=(t,e,a,n)=>{for(var i=n>1?void 0:n?ia(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&aa(e,a,i),i},de=(t,e)=>(a,n)=>e(a,n,t);let Vt=class extends o.Disposable{constructor(t,e,a){super(),this._localeService=t,this._commandService=e,this._sheetPermissionInterceptorBaseController=a,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===x.AddSheetDataValidationCommand.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[J.WorkbookEditablePermission],rangeTypes:[J.RangeProtectionPermissionEditPoint],worksheetTypes:[J.WorksheetEditPermission,J.WorksheetSetCellStylePermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr"))),t.id===x.UpdateSheetDataValidationRangeCommand.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[J.WorkbookEditablePermission],rangeTypes:[J.RangeProtectionPermissionEditPoint],worksheetTypes:[J.WorksheetEditPermission,J.WorksheetSetCellStylePermission]},t.params.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Vt=oa([de(0,o.Inject(o.LocaleService)),de(1,o.ICommandService),de(2,o.Inject(K.SheetPermissionInterceptorBaseController))],Vt);const ke="data-validation-single",Be="sheet.menu.data-validation";function ra(t){return{id:Be,type:tt.MenuItemType.SUBITEMS,icon:ke,tooltip:"dataValidation.title",hidden$:tt.getMenuHiddenObservable(t,o.UniverInstanceType.UNIVER_SHEET),disabled$:K.getCurrentRangeDisable$(t,{workbookTypes:[J.WorkbookEditablePermission],worksheetTypes:[J.WorksheetSetCellStylePermission,J.WorksheetEditPermission],rangeTypes:[J.RangeProtectionPermissionEditPoint]})}}function sa(t){return{id:_t.id,title:"dataValidation.panel.title",type:tt.MenuItemType.BUTTON}}function la(t){return{id:kt.id,title:"dataValidation.panel.add",type:tt.MenuItemType.BUTTON}}const da={[tt.RibbonStartGroup.FORMULAS_INSERT]:{[Be]:{order:9,menuItemFactory:ra,[_t.id]:{order:0,menuItemFactory:sa},[kt.id]:{order:1,menuItemFactory:la}}}};var ca=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,We=(t,e,a,n)=>{for(var i=n>1?void 0:n?ua(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ca(e,a,i),i},ot=(t,e)=>(a,n)=>e(a,n,t);const He={tr:{size:6,color:"#fe4b4b"}};let bt=class extends o.RxDisposable{constructor(t,e,a,n,i,r,s,d,l,c,u){super(),this._commandService=t,this._menuManagerService=e,this._renderManagerService=a,this._univerInstanceService=n,this._autoHeightController=i,this._dropdownManagerService=r,this._sheetDataValidationModel=s,this._dataValidatorRegistryService=d,this._sheetInterceptorService=l,this._dataValidationCacheService=c,this._editorBridgeService=u,this._initMenu(),this._initDropdown(),this._initViewModelIntercept(),this._initAutoHeight()}_initMenu(){this._menuManagerService.mergeMenu(da)}_initDropdown(){this._editorBridgeService&&this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{var a;if(!t.visible){((a=this._dropdownManagerService.activeDropdown)==null?void 0:a.trigger)==="editor-bridge"&&this._dropdownManagerService.hideDropdown();return}const e=this._editorBridgeService.getEditCellState();if(e){const{unitId:n,sheetId:i,row:r,column:s}=e,d=this._univerInstanceService.getUniverSheetInstance(n);if(!d)return;const l=this._sheetDataValidationModel.getRuleByLocation(n,i,r,s);if(!l)return;const c=this._dataValidatorRegistryService.getValidatorItem(l.type);if(!(c!=null&&c.dropdown))return;const u=d.getActiveSheet();if(!u)return;const f=this._dropdownManagerService.activeDropdown,h=f==null?void 0:f.location;if(h&&h.unitId===n&&h.subUnitId===i&&h.row===r&&h.col===s)return;this._dropdownManagerService.showDropdown({location:{unitId:n,subUnitId:i,row:r,col:s,workbook:d,worksheet:u},componentKey:c.dropdown,onHide:()=>{},trigger:"editor-bridge"},!1)}}))}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(J.INTERCEPTOR_POINT.CELL_CONTENT,{effect:o.InterceptorEffectEnum.Style,priority:J.InterceptCellContentPriority.DATA_VALIDATION,handler:(t,e,a)=>{var b,E,I,$,L,T;const{row:n,col:i,unitId:r,subUnitId:s,workbook:d,worksheet:l}=e,c=this._sheetDataValidationModel.getRuleIdByLocation(r,s,n,i);if(!c)return a(t);const u=this._sheetDataValidationModel.getRuleById(r,s,c);if(!u)return a(t);const f=(E=(b=this._dataValidationCacheService.getValue(r,s,n,i))==null?void 0:b.status)!=null?E:o.DataValidationStatus.VALID,h=this._dataValidatorRegistryService.getValidatorItem(u.type),w=e.rawData;let v;const m={get value(){var y;return v!==void 0||(v=(y=x.getCellValueOrigin(w))!=null?y:null),v}},M={get value(){var y;return`${(y=m.value)!=null?y:""}`}};return a({...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h},markers:{...t==null?void 0:t.markers,...f===o.DataValidationStatus.INVALID?He:null},customRender:[...(I=t==null?void 0:t.customRender)!=null?I:[],...h!=null&&h.canvasRender?[h.canvasRender]:[]],fontRenderExtension:{...t==null?void 0:t.fontRenderExtension,isSkip:(($=t==null?void 0:t.fontRenderExtension)==null?void 0:$.isSkip)||((L=h==null?void 0:h.skipDefaultFontRender)==null?void 0:L.call(h,u,m.value,e))},interceptorStyle:{...t==null?void 0:t.interceptorStyle,...h==null?void 0:h.getExtraStyle(u,M.value,{get style(){const y=d.getStyles();return(typeof(t==null?void 0:t.s)=="string"?y.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}}})},interceptorAutoHeight:()=>{var U,R,H,Y,D,S;const y=(R=(U=this._renderManagerService.getRenderById(r))==null?void 0:U.with(K.SheetSkeletonManagerService).getWorksheetSkeleton(s))==null?void 0:R.skeleton;if(!y)return;const P=y.worksheet.getMergedCell(n,i),k={data:{...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h}},style:y.getsStyles().getStyleByCell(t),primaryWithCoord:y.getCellByIndex((H=P==null?void 0:P.startRow)!=null?H:n,(Y=P==null?void 0:P.startColumn)!=null?Y:i),unitId:r,subUnitId:s,row:n,col:i,workbook:d,worksheet:l};return(S=(D=h==null?void 0:h.canvasRender)==null?void 0:D.calcCellAutoHeight)==null?void 0:S.call(D,k)},interceptorAutoWidth:()=>{var U,R,H,Y,D,S;const y=(R=(U=this._renderManagerService.getRenderById(r))==null?void 0:U.with(K.SheetSkeletonManagerService).getWorksheetSkeleton(s))==null?void 0:R.skeleton;if(!y)return;const P=y.worksheet.getMergedCell(n,i),k={data:{...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h}},style:y.getsStyles().getStyleByCell(t),primaryWithCoord:y.getCellByIndex((H=P==null?void 0:P.startRow)!=null?H:n,(Y=P==null?void 0:P.startColumn)!=null?Y:i),unitId:r,subUnitId:s,row:n,col:i,workbook:d,worksheet:l};return(S=(D=h==null?void 0:h.canvasRender)==null?void 0:D.calcCellAutoWidth)==null?void 0:S.call(D,k)},coverable:((T=t==null?void 0:t.coverable)!=null?T:!0)&&!(u.type===o.DataValidationType.LIST||u.type===o.DataValidationType.LIST_MULTIPLE)})}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe(dt.filter(t=>t.source==="command"),dt.bufferTime(16)).subscribe(t=>{const e=[];if(t.forEach(a=>{var n;(n=a.rule)!=null&&n.ranges&&e.push(...a.rule.ranges)}),e.length){const a=this._autoHeightController.getUndoRedoParamsOfAutoHeight(e);o.sequenceExecute(a.redos,this._commandService)}})}};bt=We([ot(0,o.ICommandService),ot(1,tt.IMenuManagerService),ot(2,et.IRenderManagerService),ot(3,o.IUniverInstanceService),ot(4,o.Inject(K.AutoHeightController)),ot(5,o.Inject(gt)),ot(6,o.Inject(x.SheetDataValidationModel)),ot(7,o.Inject(it.DataValidatorRegistryService)),ot(8,o.Inject(J.SheetInterceptorService)),ot(9,o.Inject(x.DataValidationCacheService)),ot(10,o.Optional(K.IEditorBridgeService))],bt);let Ye=class extends o.RxDisposable{constructor(t,e,a,n,i,r,s){super(),this._commandService=t,this._renderManagerService=e,this._autoHeightController=a,this._dataValidatorRegistryService=n,this._sheetInterceptorService=i,this._sheetDataValidationModel=r,this._dataValidationCacheService=s,this._initViewModelIntercept(),this._initAutoHeight()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(J.INTERCEPTOR_POINT.CELL_CONTENT,{effect:o.InterceptorEffectEnum.Style,priority:J.InterceptCellContentPriority.DATA_VALIDATION,handler:(t,e,a)=>{var M,b,E,I,$,L;const{row:n,col:i,unitId:r,subUnitId:s,workbook:d,worksheet:l}=e,c=this._sheetDataValidationModel.getRuleIdByLocation(r,s,n,i);if(!c)return a(t);const u=this._sheetDataValidationModel.getRuleById(r,s,c);if(!u)return a(t);const f=(b=(M=this._dataValidationCacheService.getValue(r,s,n,i))==null?void 0:M.status)!=null?b:o.DataValidationStatus.VALID,h=this._dataValidatorRegistryService.getValidatorItem(u.type),w=l.getCellRaw(n,i),v=x.getCellValueOrigin(w),m=`${v!=null?v:""}`;return a({...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h},markers:{...t==null?void 0:t.markers,...f===o.DataValidationStatus.INVALID?He:null},customRender:[...(E=t==null?void 0:t.customRender)!=null?E:[],...h!=null&&h.canvasRender?[h.canvasRender]:[]],fontRenderExtension:{...t==null?void 0:t.fontRenderExtension,isSkip:((I=t==null?void 0:t.fontRenderExtension)==null?void 0:I.isSkip)||(($=h==null?void 0:h.skipDefaultFontRender)==null?void 0:$.call(h,u,v,e))},interceptorStyle:{...t==null?void 0:t.interceptorStyle,...h==null?void 0:h.getExtraStyle(u,m,{get style(){const T=d.getStyles();return(typeof(t==null?void 0:t.s)=="string"?T.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}}})},interceptorAutoHeight:()=>{var k,U,R,H,Y,D;const T=(U=(k=this._renderManagerService.getRenderById(r))==null?void 0:k.with(K.SheetSkeletonManagerService).getWorksheetSkeleton(s))==null?void 0:U.skeleton;if(!T)return;const y=T.worksheet.getMergedCell(n,i),P={data:{...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h}},style:T.getsStyles().getStyleByCell(t),primaryWithCoord:T.getCellByIndex((R=y==null?void 0:y.startRow)!=null?R:n,(H=y==null?void 0:y.startColumn)!=null?H:i),unitId:r,subUnitId:s,row:n,col:i,workbook:d,worksheet:l};return(D=(Y=h==null?void 0:h.canvasRender)==null?void 0:Y.calcCellAutoHeight)==null?void 0:D.call(Y,P)},coverable:((L=t==null?void 0:t.coverable)!=null?L:!0)&&!(u.type===o.DataValidationType.LIST||u.type===o.DataValidationType.LIST_MULTIPLE)})}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe(dt.filter(t=>t.source==="command"),dt.bufferTime(16)).subscribe(t=>{const e=[];if(t.forEach(a=>{var n;(n=a.rule)!=null&&n.ranges&&e.push(...a.rule.ranges)}),e.length){const a=this._autoHeightController.getUndoRedoParamsOfAutoHeight(e);o.sequenceExecute(a.redos,this._commandService)}})}};Ye=We([ot(0,o.ICommandService),ot(1,et.IRenderManagerService),ot(2,o.Inject(K.AutoHeightController)),ot(3,o.Inject(it.DataValidatorRegistryService)),ot(4,o.Inject(J.SheetInterceptorService)),ot(5,o.Inject(x.SheetDataValidationModel)),ot(6,o.Inject(x.DataValidationCacheService))],Ye);var ha=Object.defineProperty,fa=Object.getOwnPropertyDescriptor,pa=(t,e,a,n)=>{for(var i=n>1?void 0:n?fa(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ha(e,a,i),i},Xe=(t,e)=>(a,n)=>e(a,n,t);let Wt=class extends o.Disposable{constructor(t,e,a){super(),this._context=t,this._sheetDataValidationModel=e,this._sheetSkeletonManagerService=a,this._initSkeletonChange()}_initSkeletonChange(){const t=e=>{var n;if(!e.length)return;const a=new Set;e.forEach(i=>{a.add(i.subUnitId)}),a.forEach(i=>{var r;(r=this._sheetSkeletonManagerService.getWorksheetSkeleton(i))==null||r.skeleton.makeDirty(!0)}),(n=this._context.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(o.bufferDebounceTime(16)).subscribe(t))}};Wt=pa([Xe(1,o.Inject(x.SheetDataValidationModel)),Xe(2,o.Inject(K.SheetSkeletonManagerService))],Wt);const st={dataValidationFormula:"univer-data-validation-formula",dataValidationFormulaAnd:"univer-data-validation-formula-and",dataValidationFormulaListItem:"univer-data-validation-formula-list-item",dataValidationFormulaListItemIcon:"univer-data-validation-formula-list-item-icon",dataValidationFormulaListItemDrag:"univer-data-validation-formula-list-item-drag",dataValidationFormulaListAdd:"univer-data-validation-formula-list-add",dataValidationFormulaColorSelect:"univer-data-validation-formula-color-select",dataValidationFormulaColorSelectPanel:"univer-data-validation-formula-color-select-panel",dataValidationFormulaColorItem:"univer-data-validation-formula-color-item"},ma=t=>{const{isTwoFormula:e=!1,value:a,onChange:n,showError:i,validResult:r}=t,s=o.useDependency(o.LocaleService),d=i?r==null?void 0:r.formula1:"",l=i?r==null?void 0:r.formula2:"";return e?p.jsxs(p.Fragment,{children:[p.jsx(N.FormLayout,{error:d,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:s.t("dataValidation.panel.formulaPlaceholder"),value:a==null?void 0:a.formula1,onChange:c=>{n==null||n({...a,formula1:c})}})}),p.jsx("div",{className:st.dataValidationFormulaAnd,children:s.t("dataValidation.panel.formulaAnd")}),p.jsx(N.FormLayout,{error:l,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:s.t("dataValidation.panel.formulaPlaceholder"),value:a==null?void 0:a.formula2,onChange:c=>{n==null||n({...a,formula2:c})}})})]}):p.jsx(N.FormLayout,{error:d,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:s.t("dataValidation.panel.formulaPlaceholder"),value:a==null?void 0:a.formula1,onChange:c=>{n==null||n({formula1:c})}})})};function va(t){const{value:e,onChange:a,showError:n,validResult:i}=t,r=o.useDependency(o.LocaleService),s=n?i==null?void 0:i.formula1:"",d=n?i==null?void 0:i.formula2:"",[l,c]=V.useState(!((e==null?void 0:e.formula1)===void 0&&(e==null?void 0:e.formula2)===void 0));return p.jsxs(p.Fragment,{children:[p.jsx(N.FormLayout,{children:p.jsx(N.Checkbox,{checked:l,onChange:u=>{u?c(!0):(c(!1),a==null||a({...e,formula1:void 0,formula2:void 0}))},children:r.t("dataValidation.checkbox.tips")})}),l?p.jsx(N.FormLayout,{label:r.t("dataValidation.checkbox.checked"),error:s,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:r.t("dataValidation.panel.valuePlaceholder"),value:e==null?void 0:e.formula1,onChange:u=>{a==null||a({...e,formula1:u||void 0})}})}):null,l?p.jsx(N.FormLayout,{label:r.t("dataValidation.checkbox.unchecked"),error:d,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:r.t("dataValidation.panel.valuePlaceholder"),value:e==null?void 0:e.formula2,onChange:u=>{a==null||a({...e,formula2:u||void 0})}})}):null]})}function ga(t){var f;const{unitId:e,subUnitId:a,value:n,onChange:i,showError:r,validResult:s}=t,d=r?s==null?void 0:s.formula1:void 0,l=V.useRef({}),[c,u]=V.useState(!1);return tt.useSidebarClick(h=>{var v;const w=(v=l.current)==null?void 0:v.handleOutClick;w&&w(h,()=>u(!1))}),p.jsx(te.FormulaEditor,{initValue:(f=n==null?void 0:n.formula1)!=null?f:"",unitId:e,subUnitId:a,isFocus:c,onChange:(h="")=>{const w=h||"";i==null||i({...n,formula1:w.trim()})},errorText:d,onFocus:()=>u(!0),actions:l.current})}function ze(t){var e,a,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(a=ze(t[e]))&&(n&&(n+=" "),n+=a)}else for(a in t)t[a]&&(n&&(n+=" "),n+=a);return n}function Sa(){for(var t,e,a=0,n="",i=arguments.length;a<i;a++)(t=arguments[a])&&(e=ze(t))&&(n&&(n+=" "),n+=e);return n}const _a=["#FFFFFF","#FEE7E7","#FEF0E6","#EFFBD0","#E4F4FE","#E8ECFD","#F1EAFA","#FDE8F3","#E5E5E5","#FDCECE","#FDC49B","#DEF6A2","#9FDAFF","#D0D9FB","#E3D5F6","#FBD0E8","#656565","#FE4B4B","#FF8C51","#8BBB11","#0B9EFB","#3A60F7","#9E6DE3","#F248A6"],Ia=t=>{const{value:e,onChange:a,disabled:n}=t,[i,r]=V.useState(!1);return p.jsx(N.Select,{disabled:n,open:i,onDropdownVisibleChange:r,dropdownStyle:{width:112},className:st.dataValidationFormulaColorSelect,value:e,onChange:a,labelRender:s=>p.jsx("div",{className:st.dataValidationFormulaColorItem,style:{background:s.value,marginTop:5}}),dropdownRender:()=>p.jsx("div",{className:st.dataValidationFormulaColorSelectPanel,children:_a.map(s=>p.jsx("div",{onClick:()=>{a(s),r(!1)},className:st.dataValidationFormulaColorItem,style:{background:s}},s))})})},Ke=t=>{const{item:e,commonProps:a,style:n}=t,{onItemChange:i,onItemDelete:r}=a;return p.jsxs("div",{className:st.dataValidationFormulaListItem,style:n,children:[e.isRef?null:p.jsx("div",{className:Sa(st.dataValidationFormulaListItemDrag,"draggableHandle"),children:p.jsx(Ae,{})}),p.jsx(Ia,{value:e.color,onChange:s=>{i(e.id,e.label,s)}}),p.jsx(N.Input,{disabled:e.isRef,value:e.label,onChange:s=>{i(e.id,s,e.color)}}),e.isRef?null:p.jsx("div",{className:st.dataValidationFormulaListItemIcon,children:p.jsx(ee,{onClick:()=>r(e.id)})})]})};function Ca(t){const{value:e,onChange:a=()=>{},unitId:n,subUnitId:i,validResult:r,showError:s,ruleId:d}=t,{formula1:l="",formula2:c=""}=e||{},u=V.useRef(null),[f,h]=V.useState(()=>o.isFormulaString(l)?"1":"0"),[w,v]=V.useState(f==="1"?l:"="),[m,M]=V.useState(f==="1"?l:"="),b=o.useDependency(o.LocaleService),E=o.useDependency(it.DataValidatorRegistryService),I=o.useDependency(it.DataValidationModel),$=o.useDependency(x.DataValidationFormulaController),[L,T]=V.useState(()=>c.split(",")),y=E.getValidatorItem(o.DataValidationType.LIST),[P,k]=V.useState([]),[U,R]=V.useState(""),H=s?r==null?void 0:r.formula1:"",Y=V.useMemo(()=>I.ruleChange$.pipe(dt.debounceTime(16)),[]),D=tt.useObservable(Y),S=tt.useEvent(a);V.useEffect(()=>{(async()=>{await new Promise(W=>{setTimeout(()=>W(!0),100)});const O=I.getRuleById(n,i,d),z=O==null?void 0:O.formula1;if(o.isFormulaString(z)&&y&&O){const W=await y.getListAsync(O,n,i);k(W)}})()},[I,D,y,d,i,n]),V.useEffect(()=>{o.isFormulaString(l)&&l!==m&&(v(l),M(m))},[m,l]);const[g,C]=V.useState(()=>{const O=f!=="1"?x.deserializeListOptions(l):[],z=c.split(",");return O.map((W,G)=>({label:W,color:z[G]||It,isRef:!1,id:o.Tools.generateRandomId(4)}))}),_=(O,z,W)=>{const G=g.find(lt=>lt.id===O);G&&(G.label=z,G.color=W,C([...g]))},A=O=>{const z=g.findIndex(W=>W.id===O);z!==-1&&(g.splice(z,1),C([...g]))},j=c.split(","),X=V.useMemo(()=>P.map((O,z)=>({label:O,color:j[z]||It,id:`${z}`,isRef:!0})),[j,P]),Z=(O,z,W)=>{const G=[...L];G[+O]=W,T(G),S({formula1:l,formula2:G.join(",")})},Q=()=>{C([...g,{label:"",color:It,isRef:!1,id:o.Tools.generateRandomId(4)}])};V.useEffect(()=>{if(f==="1")return;const O=new Set,z=[];g.map(W=>({labelList:W.label.split(","),item:W})).forEach(({item:W,labelList:G})=>{G.forEach(lt=>{O.has(lt)||(O.add(lt),z.push({label:lt,color:W.color}))})}),S({formula1:x.serializeListOptions(z.map(W=>W.label)),formula2:z.map(W=>W.color===It?"":W.color).join(",")})},[g,S,f,m,L]);const nt=V.useMemo(()=>async O=>{if(!o.isFormulaString(O)){S==null||S({formula1:"",formula2:c});return}$.getFormulaRefCheck(O)?(S==null||S({formula1:o.isFormulaString(O)?O:"",formula2:c}),R("")):(S==null||S({formula1:"",formula2:c}),v("="),R(b.t("dataValidation.validFail.formulaError")))},[c,S]),at=V.useRef({}),[rt,F]=V.useState(!1);return tt.useSidebarClick(O=>{var W;const z=(W=at.current)==null?void 0:W.handleOutClick;z&&z(O,()=>F(!1))}),p.jsxs(p.Fragment,{children:[p.jsx(N.FormLayout,{label:b.t("dataValidation.list.options"),children:p.jsxs(N.RadioGroup,{value:f,onChange:O=>{h(O),v(m),O==="1"&&S({formula1:m==="="?"":m,formula2:L.join(",")})},children:[p.jsx(N.Radio,{value:"0",children:b.t("dataValidation.list.customOptions")}),p.jsx(N.Radio,{value:"1",children:b.t("dataValidation.list.refOptions")})]})}),f==="1"?p.jsxs(p.Fragment,{children:[p.jsx(te.FormulaEditor,{initValue:w,unitId:n,subUnitId:i,isFocus:rt,onChange:(O="")=>{const z=(O!=null?O:"").trim();M(z),nt(z)},errorText:H||U||void 0,onFocus:()=>F(!0),actions:at.current}),p.jsx(N.FormLayout,{children:p.jsx("div",{ref:u,children:X.map(O=>p.jsx(Ke,{item:O,commonProps:{onItemChange:Z},style:{marginBottom:12}},O.id))})})]}):p.jsx(N.FormLayout,{error:H,children:p.jsxs("div",{ref:u,style:{marginTop:"-12px"},children:[p.jsx(N.DraggableList,{list:g,onListChange:C,rowHeight:32,margin:[0,12],draggableHandle:".draggableHandle",itemRender:O=>p.jsx(Ke,{item:O,commonProps:{onItemChange:_,onItemDelete:A}},O.id),idKey:"id"}),p.jsxs("a",{className:st.dataValidationFormulaListAdd,onClick:Q,children:[p.jsx(Te,{}),b.t("dataValidation.list.add")]})]})})]})}const Ge="data-validation.custom-formula-input",Ht="data-validation.formula-input",ce="data-validation.list-formula-input",Ze="data-validation.checkbox-formula-input",Da=[[Ge,ga],[Ht,ma],[ce,Ca],[Ze,va]],wa="LIST_RENDER_MODE_OPTION_INPUT";function Yt(t){var i;const{value:e,onChange:a}=t,n=o.useDependency(o.LocaleService);return p.jsx(N.FormLayout,{label:n.t("dataValidation.renderMode.label"),children:p.jsxs(N.RadioGroup,{value:`${(i=e.renderMode)!=null?i:o.DataValidationRenderMode.CUSTOM}`,onChange:r=>a({...e,renderMode:+r}),children:[p.jsx(N.Radio,{value:`${o.DataValidationRenderMode.CUSTOM}`,children:n.t("dataValidation.renderMode.chip")}),p.jsx(N.Radio,{value:`${o.DataValidationRenderMode.ARROW}`,children:n.t("dataValidation.renderMode.arrow")}),p.jsx(N.Radio,{value:`${o.DataValidationRenderMode.TEXT}`,children:n.t("dataValidation.renderMode.text")})]})})}Yt.componentKey=wa;const ya="DATE_SHOW_TIME_OPTION";function Xt(t){var i;const{value:e,onChange:a}=t,n=o.useDependency(o.LocaleService);return p.jsx(N.FormLayout,{children:p.jsx(N.Checkbox,{checked:(i=e.bizInfo)==null?void 0:i.showTime,onChange:r=>{a({...e,bizInfo:{...e.bizInfo,showTime:r}})},children:n.t("dataValidation.showTime.label")})})}Xt.componentKey=ya;var Ma=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,ba=(t,e,a,n)=>{for(var i=n>1?void 0:n?Va(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Ma(e,a,i),i},ue=(t,e)=>(a,n)=>e(a,n,t);const zt=6;let he=class{constructor(t,e,a){this._commandService=t,this._formulaService=e,this._themeService=a}_calc(t,e){var c,u,f;const{vt:a,ht:n}=e||{},i=t.endX-t.startX-zt*2,r=t.endY-t.startY,s=((c=e==null?void 0:e.fs)!=null?c:10)*1.6;let d=0,l=0;switch(a){case o.VerticalAlign.TOP:l=0;break;case o.VerticalAlign.BOTTOM:l=0+(r-s);break;default:l=0+(r-s)/2;break}switch(n){case o.HorizontalAlign.LEFT:d=zt;break;case o.HorizontalAlign.RIGHT:d=zt+(i-s);break;default:d=zt+(i-s)/2;break}return{left:t.startX+d,top:t.startY+l,width:((u=e==null?void 0:e.fs)!=null?u:10)*1.6,height:((f=e==null?void 0:e.fs)!=null?f:10)*1.6}}calcCellAutoHeight(t){var a;const{style:e}=t;return((a=e==null?void 0:e.fs)!=null?a:10)*1.6}calcCellAutoWidth(t){var a;const{style:e}=t;return((a=e==null?void 0:e.fs)!=null?a:10)*1.6}async _parseFormula(t,e,a){var c,u,f;const{formula1:n=x.CHECKBOX_FORMULA_1,formula2:i=x.CHECKBOX_FORMULA_2}=t,r=await this._formulaService.getRuleFormulaResult(e,a,t.uid),s=x.getFormulaResult((c=r==null?void 0:r[0])==null?void 0:c.result),d=x.getFormulaResult((u=r==null?void 0:r[1])==null?void 0:u.result),l=x.isLegalFormulaResult(String(s))&&x.isLegalFormulaResult(String(d));return{formula1:o.isFormulaString(n)?x.getFormulaResult((f=r==null?void 0:r[0])==null?void 0:f.result):n,formula2:o.isFormulaString(i)?d:i,isFormulaValid:l}}drawWith(t,e){var Y,D,S,g,C,_;const{style:a,data:n,primaryWithCoord:i,unitId:r,subUnitId:s,worksheet:d,row:l,col:c}=e,u=i.isMergedMainCell?i.mergeInfo:i,f=x.getCellValueOrigin(d.getCellRaw(l,c)),h=(Y=n.dataValidation)==null?void 0:Y.rule,w=(D=n.dataValidation)==null?void 0:D.validator;if(!h||!w)return;const v=this._themeService.getCurrentTheme();if(!((S=w.skipDefaultFontRender)!=null&&S.call(w,h,f,{unitId:r,subUnitId:s})))return;const m=w.parseFormulaSync(h,r,s),{formula1:M}=m,b=this._calc(u,a),{a:E,d:I}=t.getTransform(),$=et.fixLineWidthByScale(b.left,E),L=et.fixLineWidthByScale(b.top,I),T=et.Transform.create().composeMatrix({left:$,top:L,scaleX:1,scaleY:1,angle:0,skewX:0,skewY:0,flipX:!1,flipY:!1}),y=u.endX-u.startX,P=u.endY-u.startY;t.save(),t.beginPath(),t.rect(u.startX,u.startY,y,P),t.clip();const k=T.getMatrix();t.transform(k[0],k[1],k[2],k[3],k[4],k[5]);const U=((g=a==null?void 0:a.fs)!=null?g:10)*1.6,R=String(f)===String(M),H=v.hyacinth500;et.Checkbox.drawWith(t,{checked:R,width:U,height:U,fill:(_=(C=a==null?void 0:a.cl)==null?void 0:C.rgb)!=null?_:H}),t.restore()}isHit(t,e){const a=e.primaryWithCoord.isMergedMainCell?e.primaryWithCoord.mergeInfo:e.primaryWithCoord,n=this._calc(a,e.style),i=n.top,r=n.top+n.height,s=n.left,d=n.left+n.width,{x:l,y:c}=t;return l<=d&&l>=s&&c<=r&&c>=i}async onPointerDown(t,e){var m,M,b;if(e.button===2)return;const{primaryWithCoord:a,unitId:n,subUnitId:i,data:r,worksheet:s,row:d,col:l}=t,c=x.getCellValueOrigin(s.getCellRaw(d,l)),u=(m=r.dataValidation)==null?void 0:m.rule,f=(M=r.dataValidation)==null?void 0:M.validator;if(!u||!f||!((b=f.skipDefaultFontRender)!=null&&b.call(f,u,c,{unitId:n,subUnitId:i})))return;const{formula1:h,formula2:w}=await this._parseFormula(u,n,i),v={range:{startColumn:a.actualColumn,endColumn:a.actualColumn,startRow:a.actualRow,endRow:a.actualRow},value:{v:String(c)===x.transformCheckboxValue(String(h))?w:h,p:null}};this._commandService.executeCommand(J.SetRangeValuesCommand.id,v)}};he=ba([ue(0,o.ICommandService),ue(1,o.Inject(x.DataValidationFormulaService)),ue(2,o.Inject(o.ThemeService))],he);var Ea=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Oa=(t,e,a,n)=>{for(var i=n>1?void 0:n?Ra(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Ea(e,a,i),i},La=(t,e)=>(a,n)=>e(a,n,t);let ft=class{constructor(t){B(this,"canvasRender",null);B(this,"dropdown");B(this,"optionsInput");B(this,"formulaInput",ce);this.injector=t}};ft=Oa([La(0,o.Inject(o.Injector))],ft);class Ta extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.CHECKBOX);B(this,"canvasRender",this.injector.createInstance(he));B(this,"formulaInput",Ze)}}class Pa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.CUSTOM);B(this,"formulaInput",Ge)}}const ja="data-validation.formula-input";class Aa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.DATE);B(this,"formulaInput",ja);B(this,"optionsInput",Xt.componentKey);B(this,"dropdown",re)}}class $a extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.DECIMAL);B(this,"formulaInput",Ht)}}const qe=4,Fa=0,fe=4,Je=4,pe=6,Kt=6,Ct=14;function xa(t,e){const a=et.FontCache.getTextSize(t,e),n=a.width+qe*2,{ba:i,bd:r}=a,s=i+r;return{width:n,height:s+Fa*2,ba:i}}function me(t,e,a,n){const i=Ct+pe*2,r=a-i,s=n-Kt*2,d=t.map(h=>({layout:xa(h,e),text:h}));let l;const c=[];d.forEach(h=>{const{layout:w}=h,{width:v,height:m}=w;!l||l.width+v+fe>r?(l={width:v,height:m,items:[{...h,left:0}]},c.push(l)):(l.items.push({...h,left:l.width+fe}),l.width=l.width+v+fe)});let u=0,f=0;return c.forEach((h,w)=>{f=Math.max(f,h.width),w===c.length-1?u+=h.height:u+=h.height+Je}),{lines:c,totalHeight:u,contentWidth:r,contentHeight:s,cellAutoHeight:u+Kt*2,calcAutoWidth:f+i}}const Na=8;class Ua extends et.Shape{static drawWith(e,a){const{fontString:n,info:i,fill:r,color:s}=a,{layout:d,text:l}=i;e.save(),et.Rect.drawWith(e,{width:d.width,height:d.height,radius:Na,fill:r||It}),e.translateWithPrecision(qe,d.ba),e.font=n,e.fillStyle=s,e.fillText(l,0,0),e.restore()}}var ka=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,Wa=(t,e,a,n)=>{for(var i=n>1?void 0:n?Ba(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ka(e,a,i),i},Ha=(t,e)=>(a,n)=>e(a,n,t);const Ya=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 ve=class{constructor(t){B(this,"zIndex");B(this,"_dropdownInfoMap",new Map);this._commandService=t}_ensureMap(t){let e=this._dropdownInfoMap.get(t);return e||(e=new Map,this._dropdownInfoMap.set(t,e)),e}_generateKey(t,e){return`${t}.${e}`}_drawDownIcon(t,e,a,n,i){const r=a-Ct+4;let s=4;switch(i){case o.VerticalAlign.MIDDLE:s=(n-Ct)/2+4;break;case o.VerticalAlign.BOTTOM:s=n-Ct+4;break}t.save(),t.translateWithPrecision(e.startX+r,e.startY+s),t.fillStyle="#565656",t.fill(Ya),t.restore()}drawWith(t,e,a,n){var j,X;const{primaryWithCoord:i,row:r,col:s,style:d,data:l,subUnitId:c}=e,u=i.isMergedMainCell?i.mergeInfo:i,f=l.fontRenderExtension,{leftOffset:h=0,rightOffset:w=0,topOffset:v=0,downOffset:m=0}=f||{},M=l.dataValidation,b=this._ensureMap(c),E=this._generateKey(r,s);if(!M)return;const I={startX:u.startX+h,endX:u.endX-w,startY:u.startY+v,endY:u.endY-m},$=I.endX-I.startX,L=I.endY-I.startY,{cl:T}=d||{},y=(j=typeof T=="object"?T==null?void 0:T.rgb:T)!=null?j:"#000",P=et.getFontStyleString(d!=null?d:void 0),{rule:k,validator:U}=M,R=U,{vt:H,ht:Y}=d||{},D=H!=null?H:o.VerticalAlign.MIDDLE,S=(X=x.getCellValueOrigin(l))!=null?X:"",g=R.parseCellValue(S),C=R.getListWithColorMap(k),_=me(g,P,$,L);this._drawDownIcon(t,I,$,L,D),t.save(),t.translateWithPrecision(I.startX,I.startY),t.beginPath(),t.rect(0,0,$-Ct,L),t.clip(),t.translateWithPrecision(pe,Kt);let A=0;switch(D){case o.VerticalAlign.MIDDLE:A=(_.contentHeight-_.totalHeight)/2;break;case o.VerticalAlign.BOTTOM:A=_.contentHeight-_.totalHeight;break}t.translateWithPrecision(0,A),_.lines.forEach((Z,Q)=>{t.save();const{width:nt,height:at,items:rt}=Z;let F=0;switch(Y){case o.HorizontalAlign.RIGHT:F=_.contentWidth-nt;break;case o.HorizontalAlign.CENTER:F=(_.contentWidth-nt)/2;break}t.translate(F,Q*(at+Je)),rt.forEach(O=>{t.save(),t.translateWithPrecision(O.left,0),Ua.drawWith(t,{...P,info:O,color:y,fill:C[O.text]}),t.restore()}),t.restore()}),t.restore(),b.set(E,{left:I.startX,top:I.startY,width:_.contentWidth+pe+Ct,height:_.contentHeight+Kt*2})}calcCellAutoHeight(t){var $;const{primaryWithCoord:e,style:a,data:n}=t,i=n.fontRenderExtension,{leftOffset:r=0,rightOffset:s=0,topOffset:d=0,downOffset:l=0}=i||{},c=e.isMergedMainCell?e.mergeInfo:e,u={startX:c.startX+r,endX:c.endX-s,startY:c.startY+d,endY:c.endY-l},f=n.dataValidation;if(!f)return;const h=u.endX-u.startX,w=u.endY-u.startY,v=($=x.getCellValueOrigin(n))!=null?$:"",{validator:m}=f,b=m.parseCellValue(v),E=et.getFontStyleString(a!=null?a:void 0);return me(b,E,h,w).cellAutoHeight}calcCellAutoWidth(t){var $;const{primaryWithCoord:e,style:a,data:n}=t,i=n.fontRenderExtension,{leftOffset:r=0,rightOffset:s=0,topOffset:d=0,downOffset:l=0}=i||{},c=e.isMergedMainCell?e.mergeInfo:e,u={startX:c.startX+r,endX:c.endX-s,startY:c.startY+d,endY:c.endY-l},f=n.dataValidation;if(!f)return;const h=u.endX-u.startX,w=u.endY-u.startY,v=($=x.getCellValueOrigin(n))!=null?$:"",{validator:m}=f,b=m.parseCellValue(v),E=et.getFontStyleString(a!=null?a:void 0);return me(b,E,h,w).calcAutoWidth}isHit(t,e){const{primaryWithCoord:a}=e,n=a.isMergedMainCell?a.mergeInfo:a,{endX:i}=n,{x:r}=t;return r>=i-Ct&&r<=i}onPointerDown(t,e){if(e.button===2)return;const{unitId:a,subUnitId:n,row:i,col:r}=t,s={unitId:a,subUnitId:n,row:i,column:r};this._commandService.executeCommand(Ft.id,s)}};ve=Wa([Ha(0,o.ICommandService)],ve);class Xa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.LIST_MULTIPLE);B(this,"canvasRender",this.injector.createInstance(ve));B(this,"dropdown",Ut)}}var za=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,Ga=(t,e,a,n)=>{for(var i=n>1?void 0:n?Ka(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&za(e,a,i),i},Qe=(t,e)=>(a,n)=>e(a,n,t);const Dt=4,Gt=4,ut=14,pt=6,Et=4,ge=8,Za="#565656",tn=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 qa(t,e){const a=t.length;return{id:"d",body:{dataStream:`${t}${o.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[{ts:{fs:11,ff:void 0,it:o.BooleanNumber.FALSE,bl:o.BooleanNumber.FALSE,ul:{s:o.BooleanNumber.FALSE},st:{s:o.BooleanNumber.FALSE},ol:{s:o.BooleanNumber.FALSE},cl:void 0,...e,bg:void 0,bd:void 0},st:0,ed:a}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}}}}function en(t,e,a){const n=qa(t,a),i=new o.DocumentDataModel(n),r=new et.DocumentViewModel(i);return{documentSkeleton:et.DocumentSkeleton.create(r,e),docModel:i,docViewModel:r}}function Zt(t,e,a){const{documentSkeleton:n,docModel:i,docViewModel:r}=en(t,e,a);return{documents:new et.Documents(`DOCUMENTS_${o.Tools.generateRandomId()}`,n,{pageMarginLeft:0,pageMarginTop:0}),documentSkeleton:n,docModel:i,docViewModel:r}}function nn(t,e,a,n,i,r,s=!0){let d=0;const l=s?Et:0;switch(i){case o.VerticalAlign.BOTTOM:d=e-n-l;break;case o.VerticalAlign.MIDDLE:d=(e-n)/2;break;default:d=l;break}d=Math.max(Et,d);let c=0;switch(r){case o.HorizontalAlign.CENTER:c=(t-a)/2;break;case o.HorizontalAlign.RIGHT:c=t-a;break}return c=Math.max(pt,c),{paddingLeft:c,paddingTop:d}}let Se=class{constructor(t,e){B(this,"_dropdownInfoMap",new Map);B(this,"zIndex");B(this,"onPointerEnter");B(this,"onPointerLeave");this._localeService=t,this._commandService=e}_ensureMap(t){let e=this._dropdownInfoMap.get(t);return e||(e=new Map,this._dropdownInfoMap.set(t,e)),e}_generateKey(t,e){return`${t}.${e}`}_drawDownIcon(t,e,a,n,i,r,s){const{t:d=o.DEFAULT_STYLES.pd.t,b:l=o.DEFAULT_STYLES.pd.b}=s,c=a-ut;let u;switch(r){case o.VerticalAlign.MIDDLE:u=(n-Gt)/2;break;case o.VerticalAlign.BOTTOM:u=n-l-i-Et+(i/2-Gt/2);break;default:u=d+Et+(i/2-Gt/2);break}t.save(),t.translateWithPrecision(e.startX+c,e.startY+u),t.fillStyle="#565656",t.fill(tn),t.restore()}drawWith(t,e,a){var D,S;const{primaryWithCoord:n,row:i,col:r,style:s,data:d,subUnitId:l}=e,c=n.isMergedMainCell?n.mergeInfo:n,u=(D=d.dataValidation)==null?void 0:D.rule,f=(S=d.dataValidation)==null?void 0:S.validator,h=d.fontRenderExtension,{leftOffset:w=0,rightOffset:v=0,topOffset:m=0,downOffset:M=0}=h||{};if(!u||!f||!f||f.id.indexOf(o.DataValidationType.LIST)!==0||!f.skipDefaultFontRender(u))return;const b={startX:c.startX+w,endX:c.endX-v,startY:c.startY+m,endY:c.endY-M},E=b.endX-b.startX,I=b.endY-b.startY,$=this._ensureMap(l),L=this._generateKey(i,r),T=f.getListWithColor(u),y=x.getCellValueOrigin(d),P=`${y!=null?y:""}`,k=T.find(g=>g.label===P);let{tb:U,vt:R,ht:H,pd:Y}=s||{};if(U=U!=null?U:o.WrapStrategy.WRAP,R=R!=null?R:o.VerticalAlign.BOTTOM,H=H!=null?H:o.DEFAULT_STYLES.ht,Y=Y!=null?Y:o.DEFAULT_STYLES.pd,u.renderMode===o.DataValidationRenderMode.ARROW){const{l:g=o.DEFAULT_STYLES.pd.l,t:C=o.DEFAULT_STYLES.pd.t,r:_=o.DEFAULT_STYLES.pd.r,b:A=o.DEFAULT_STYLES.pd.b}=Y,j=E-g-_-ut-4,{documentSkeleton:X,documents:Z,docModel:Q}=Zt(P,this._localeService,s);U===o.WrapStrategy.WRAP&&Q.updateDocumentDataPageSize(Math.max(j,1)),X.calculate(),X.getActualSize();const nt=et.getDocsSkeletonPageSize(X),{height:at,width:rt}=nt,{paddingTop:F,paddingLeft:O}=nn(j,I-C-A,rt,at,R,H,!0);this._drawDownIcon(t,b,E,I,at,R,Y),t.save(),t.translateWithPrecision(b.startX+g,b.startY+C),t.beginPath(),t.rect(0,0,E-g-_,I-C-A),t.clip(),t.translateWithPrecision(0,F),t.save(),t.translateWithPrecision(Dt,0),t.beginPath(),t.rect(0,0,j,at),t.clip(),Z.render(t),t.translateWithPrecision(O,0),t.restore(),t.restore(),$.set(L,{left:b.endX+g+a.rowHeaderWidth-ut,top:b.startY+C+a.columnHeaderHeight,width:ut,height:I-C-A})}else{t.save(),t.translateWithPrecision(b.startX,b.startY),t.beginPath(),t.rect(0,0,E,I),t.clip();const g=E-pt*2-Dt-ut-4,{documentSkeleton:C,documents:_,docModel:A}=Zt(P,this._localeService,s);U===o.WrapStrategy.WRAP&&A.updateDocumentDataPageSize(Math.max(g,1)),C.calculate();const j=et.getDocsSkeletonPageSize(C),{height:X,width:Z}=j,{paddingTop:Q,paddingLeft:nt}=nn(g,I,Z,X,R,H);t.translateWithPrecision(pt,Q);const at=Math.max(E-pt*2,1),rt=X;et.Rect.drawWith(t,{width:at,height:rt,fill:(k==null?void 0:k.color)||It,radius:ge}),t.save(),t.translateWithPrecision(Dt,0),t.beginPath(),t.rect(0,0,g,X),t.clip(),t.translateWithPrecision(nt,0),_.render(t),t.restore(),t.translateWithPrecision(g+Dt+4,(X-Gt)/2),t.fillStyle=Za,t.fill(tn),t.restore(),$.set(L,{left:b.startX+pt+a.rowHeaderWidth,top:b.startY+Q+a.columnHeaderHeight,width:at,height:rt})}}calcCellAutoHeight(t){var I;const{primaryWithCoord:e,style:a,data:n}=t,i=e.isMergedMainCell?e.mergeInfo:e,r=n.fontRenderExtension,{leftOffset:s=0,rightOffset:d=0,topOffset:l=0,downOffset:c=0}=r||{},u=(I=n.dataValidation)==null?void 0:I.rule;if(!u||u.renderMode===o.DataValidationRenderMode.TEXT)return;const f={startX:i.startX+s,endX:i.endX-d,startY:i.startY+l,endY:i.endY-c},h=f.endX-f.startX,w=x.getCellValueOrigin(n),v=`${w!=null?w:""}`;let{tb:m,pd:M}=a||{};const{t:b=o.DEFAULT_STYLES.pd.t,b:E=o.DEFAULT_STYLES.pd.b}=M!=null?M:{};if(m=m!=null?m:o.WrapStrategy.WRAP,u.renderMode===o.DataValidationRenderMode.ARROW){const $=h-ut,{documentSkeleton:L,docModel:T}=Zt(v,this._localeService,a);m===o.WrapStrategy.WRAP&&T.updateDocumentDataPageSize(Math.max($,1)),L.calculate(),L.getActualSize();const y=et.getDocsSkeletonPageSize(L),{height:P}=y;return P+b+E+Et*2}else{const $=h-pt*2-Dt-ut,{documentSkeleton:L,docModel:T}=en(v,this._localeService,a);m===o.WrapStrategy.WRAP&&T.updateDocumentDataPageSize(Math.max($,1)),L.calculate();const y=et.getDocsSkeletonPageSize(L),{height:P}=y;return P+Et*2}}calcCellAutoWidth(t){var P;const{primaryWithCoord:e,style:a,data:n}=t,i=e.isMergedMainCell?e.mergeInfo:e,r=n.fontRenderExtension,{leftOffset:s=0,rightOffset:d=0,topOffset:l=0,downOffset:c=0}=r||{},u=(P=n.dataValidation)==null?void 0:P.rule;if(!u||u.renderMode===o.DataValidationRenderMode.TEXT)return;const f={startX:i.startX+s,endX:i.endX-d,startY:i.startY+l,endY:i.endY-c},h=f.endX-f.startX,w=x.getCellValueOrigin(n),v=`${w!=null?w:""}`;let{tb:m,pd:M}=a||{};const{l:b=o.DEFAULT_STYLES.pd.l,r:E=o.DEFAULT_STYLES.pd.r}=M!=null?M:{};m=m!=null?m:o.WrapStrategy.WRAP;let I=pt*2+ut;switch(u.renderMode){case o.DataValidationRenderMode.ARROW:I=ut+pt*2+E+b;break;case o.DataValidationRenderMode.CUSTOM:I=ut+pt*2+Dt*2+E+b+ge/2+1;break;default:I=ut+pt*2+Dt*2+E+b+ge/2+1}const $=h-I,{documentSkeleton:L,docModel:T}=Zt(v,this._localeService,a);return m===o.WrapStrategy.WRAP&&T.updateDocumentDataPageSize(Math.max($,1)),L.calculate(),L.getActualSize(),et.getDocsSkeletonPageSize(L).width+I}isHit(t,e){const{data:a,subUnitId:n,row:i,col:r}=e,d=this._ensureMap(n).get(this._generateKey(i,r)),l=a.dataValidation;if(!l||!d||l.rule.renderMode===o.DataValidationRenderMode.TEXT)return!1;const{top:c,left:u,width:f,height:h}=d,{x:w,y:v}=t;return w>=u&&w<=u+f&&v>=c&&v<=c+h}onPointerDown(t,e){if(e.button===2)return;const{unitId:a,subUnitId:n,row:i,col:r}=t,s={unitId:a,subUnitId:n,row:i,column:r};this._commandService.executeCommand(Ft.id,s)}};Se=Ga([Qe(0,o.Inject(o.LocaleService)),Qe(1,o.ICommandService)],Se);class Ja extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.LIST);B(this,"canvasRender",this.injector.createInstance(Se));B(this,"dropdown",Ut);B(this,"optionsInput",Yt.componentKey);B(this,"formulaInput",ce)}}class Qa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.TEXT_LENGTH);B(this,"formulaInput",Ht)}}class ti extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.WHOLE);B(this,"formulaInput",Ht)}}var ei=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,ai=(t,e,a,n)=>{for(var i=n>1?void 0:n?ni(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ei(e,a,i),i},_e=(t,e)=>(a,n)=>e(a,n,t);let Rt=class extends o.RxDisposable{constructor(t,e,a){super(),this._injector=t,this._componentManger=e,this._dataValidatorRegistryService=a,this._initComponents(),this._registerValidatorViews()}_initComponents(){[[ke,Le],[ne,zn],[Fe,jn],[Ut,Nn],[re,_n],[Yt.componentKey,Yt],[Xt.componentKey,Xt],...Da].forEach(([t,e])=>{this.disposeWithMe(this._componentManger.register(t,e))})}_registerValidatorViews(){[$a,ti,Qa,Aa,Ta,Ja,Xa,Pa].forEach(t=>{const e=this._injector.createInstance(t),a=this._dataValidatorRegistryService.getValidatorItem(e.id);a&&(a.formulaInput=e.formulaInput,a.canvasRender=e.canvasRender,a.dropdown=e.dropdown,a.optionsInput=e.optionsInput)})}};Rt=ai([_e(0,o.Inject(o.Injector)),_e(1,o.Inject(tt.ComponentManager)),_e(2,o.Inject(it.DataValidatorRegistryService))],Rt);var ii=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ri=(t,e,a,n)=>{for(var i=n>1?void 0:n?oi(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ii(e,a,i),i},Ie=(t,e)=>(a,n)=>e(a,n,t);const si="SHEET_DATA_VALIDATION_UI_PLUGIN";q.UniverSheetsDataValidationUIPlugin=(qt=class extends o.Plugin{constructor(e=Ue,a,n,i){super(),this._config=e,this._injector=a,this._commandService=n,this._configService=i;const{menu:r,...s}=this._config;r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(ie,s)}onStarting(){[[ht],[gt],[jt],[yt],[bt],[Vt],[Mt],[Tt],[Rt]].forEach(e=>{this._injector.add(e)}),[kt,Ft,Ne,ae,_t,xe].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(Mt),this._injector.get(Vt),this._injector.get(Tt),this._injector.get(jt),this._injector.get(et.IRenderManagerService).registerRenderModule(o.UniverInstanceType.UNIVER_SHEET,[Wt])}onRendered(){this._injector.get(Rt),this._injector.get(bt)}onSteady(){this._injector.get(yt)}},B(qt,"pluginName",si),B(qt,"type",o.UniverInstanceType.UNIVER_SHEET),qt),q.UniverSheetsDataValidationUIPlugin=ri([Ie(1,o.Inject(o.Injector)),Ie(2,o.ICommandService),Ie(3,o.IConfigService)],q.UniverSheetsDataValidationUIPlugin);var li=Object.defineProperty,di=Object.getOwnPropertyDescriptor,ci=(t,e,a,n)=>{for(var i=n>1?void 0:n?di(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&li(e,a,i),i},Ce=(t,e)=>(a,n)=>e(a,n,t);const ui="SHEET_DATA_VALIDATION_UI_PLUGIN";q.UniverSheetsDataValidationMobileUIPlugin=(Jt=class extends o.Plugin{constructor(e=Ue,a,n,i){super(),this._config=e,this._injector=a,this._commandService=n,this._configService=i;const{menu:r,...s}=this._config;r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(ie,s)}onStarting(){[[ht],[gt],[jt],[yt],[bt],[Vt],[Mt],[Rt]].forEach(e=>{this._injector.add(e)}),[kt,Ft,Ne,ae,_t,xe].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(Mt),this._injector.get(Vt),this._injector.get(et.IRenderManagerService).registerRenderModule(o.UniverInstanceType.UNIVER_SHEET,[Wt])}onRendered(){this._injector.get(Rt),this._injector.get(bt)}onSteady(){this._injector.get(yt)}},B(Jt,"pluginName",ui),B(Jt,"type",o.UniverInstanceType.UNIVER_SHEET),Jt),q.UniverSheetsDataValidationMobileUIPlugin=ci([Ce(1,o.Inject(o.Injector)),Ce(2,o.ICommandService),Ce(3,o.IConfigService)],q.UniverSheetsDataValidationMobileUIPlugin),q.DATE_DROPDOWN_KEY=re,q.LIST_DROPDOWN_KEY=Ut,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
9
|
+
*/var rn=V,sn=Symbol.for("react.element"),ln=Symbol.for("react.fragment"),dn=Object.prototype.hasOwnProperty,cn=rn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,un={key:!0,ref:!0,__self:!0,__source:!0};function Me(t,e,a){var n,i={},r=null,s=null;a!==void 0&&(r=""+a),e.key!==void 0&&(r=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)dn.call(e,n)&&!un.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:sn,type:t,key:r,ref:s,props:i,_owner:cn.current}}At.Fragment=ln,At.jsx=Me,At.jsxs=Me,ye.exports=At;var p=ye.exports,Ve={exports:{}};(function(t,e){(function(a,n){t.exports=n()})(De,function(){var a=1e3,n=6e4,i=36e5,r="millisecond",s="second",d="minute",l="hour",c="day",u="week",f="month",h="quarter",w="year",v="date",m="Invalid Date",M=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(C){var S=["th","st","nd","rd"],g=C%100;return"["+C+(S[(g-20)%10]||S[g]||S[0])+"]"}},I=function(C,S,g){var D=String(C);return!D||D.length>=S?C:""+Array(S+1-D.length).join(g)+C},F={s:I,z:function(C){var S=-C.utcOffset(),g=Math.abs(S),D=Math.floor(g/60),_=g%60;return(S<=0?"+":"-")+I(D,2,"0")+":"+I(_,2,"0")},m:function C(S,g){if(S.date()<g.date())return-C(g,S);var D=12*(g.year()-S.year())+(g.month()-S.month()),_=S.clone().add(D,f),A=g-_<0,T=S.clone().add(D+(A?-1:1),f);return+(-(D+(g-_)/(A?_-T:T-_))||0)},a:function(C){return C<0?Math.ceil(C)||0:Math.floor(C)},p:function(C){return{M:f,y:w,w:u,d:c,D:v,h:l,m:d,s,ms:r,Q:h}[C]||String(C||"").toLowerCase().replace(/s$/,"")},u:function(C){return C===void 0}},L="en",P={};P[L]=E;var y="$isDayjsObject",j=function(C){return C instanceof H||!(!C||!C[y])},k=function C(S,g,D){var _;if(!S)return L;if(typeof S=="string"){var A=S.toLowerCase();P[A]&&(_=A),g&&(P[A]=g,_=A);var T=S.split("-");if(!_&&T.length>1)return C(T[0])}else{var Y=S.name;P[Y]=S,_=Y}return!D&&_&&(L=_),_||!D&&L},U=function(C,S){if(j(C))return C.clone();var g=typeof S=="object"?S:{};return g.date=C,g.args=arguments,new H(g)},R=F;R.l=k,R.i=j,R.w=function(C,S){return U(C,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var H=function(){function C(g){this.$L=k(g.locale,null,!0),this.parse(g),this.$x=this.$x||g.x||{},this[y]=!0}var S=C.prototype;return S.parse=function(g){this.$d=function(D){var _=D.date,A=D.utc;if(_===null)return new Date(NaN);if(R.u(_))return new Date;if(_ instanceof Date)return new Date(_);if(typeof _=="string"&&!/Z$/i.test(_)){var T=_.match(M);if(T){var Y=T[2]-1||0,G=(T[7]||"0").substring(0,3);return A?new Date(Date.UTC(T[1],Y,T[3]||1,T[4]||0,T[5]||0,T[6]||0,G)):new Date(T[1],Y,T[3]||1,T[4]||0,T[5]||0,T[6]||0,G)}}return new Date(_)}(g),this.init()},S.init=function(){var g=this.$d;this.$y=g.getFullYear(),this.$M=g.getMonth(),this.$D=g.getDate(),this.$W=g.getDay(),this.$H=g.getHours(),this.$m=g.getMinutes(),this.$s=g.getSeconds(),this.$ms=g.getMilliseconds()},S.$utils=function(){return R},S.isValid=function(){return this.$d.toString()!==m},S.isSame=function(g,D){var _=U(g);return this.startOf(D)<=_&&_<=this.endOf(D)},S.isAfter=function(g,D){return U(g)<this.startOf(D)},S.isBefore=function(g,D){return this.endOf(D)<U(g)},S.$g=function(g,D,_){return R.u(g)?this[D]:this.set(_,g)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(g,D){var _=this,A=!!R.u(D)||D,T=R.p(g),Y=function(z,W){var Z=R.w(_.$u?Date.UTC(_.$y,W,z):new Date(_.$y,W,z),_);return A?Z:Z.endOf(c)},G=function(z,W){return R.w(_.toDate()[z].apply(_.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(W)),_)},J=this.$W,et=this.$M,nt=this.$D,it="set"+(this.$u?"UTC":"");switch(T){case w:return A?Y(1,0):Y(31,11);case f:return A?Y(1,et):Y(0,et+1);case u:var $=this.$locale().weekStart||0,O=(J<$?J+7:J)-$;return Y(A?nt-O:nt+(6-O),et);case c:case v:return G(it+"Hours",0);case l:return G(it+"Minutes",1);case d:return G(it+"Seconds",2);case s:return G(it+"Milliseconds",3);default:return this.clone()}},S.endOf=function(g){return this.startOf(g,!1)},S.$set=function(g,D){var _,A=R.p(g),T="set"+(this.$u?"UTC":""),Y=(_={},_[c]=T+"Date",_[v]=T+"Date",_[f]=T+"Month",_[w]=T+"FullYear",_[l]=T+"Hours",_[d]=T+"Minutes",_[s]=T+"Seconds",_[r]=T+"Milliseconds",_)[A],G=A===c?this.$D+(D-this.$W):D;if(A===f||A===w){var J=this.clone().set(v,1);J.$d[Y](G),J.init(),this.$d=J.set(v,Math.min(this.$D,J.daysInMonth())).$d}else Y&&this.$d[Y](G);return this.init(),this},S.set=function(g,D){return this.clone().$set(g,D)},S.get=function(g){return this[R.p(g)]()},S.add=function(g,D){var _,A=this;g=Number(g);var T=R.p(D),Y=function(et){var nt=U(A);return R.w(nt.date(nt.date()+Math.round(et*g)),A)};if(T===f)return this.set(f,this.$M+g);if(T===w)return this.set(w,this.$y+g);if(T===c)return Y(1);if(T===u)return Y(7);var G=(_={},_[d]=n,_[l]=i,_[s]=a,_)[T]||1,J=this.$d.getTime()+g*G;return R.w(J,this)},S.subtract=function(g,D){return this.add(-1*g,D)},S.format=function(g){var D=this,_=this.$locale();if(!this.isValid())return _.invalidDate||m;var A=g||"YYYY-MM-DDTHH:mm:ssZ",T=R.z(this),Y=this.$H,G=this.$m,J=this.$M,et=_.weekdays,nt=_.months,it=_.meridiem,$=function(W,Z,lt,Ot){return W&&(W[Z]||W(D,A))||lt[Z].slice(0,Ot)},O=function(W){return R.s(Y%12||12,W,"0")},z=it||function(W,Z,lt){var Ot=W<12?"AM":"PM";return lt?Ot.toLowerCase():Ot};return A.replace(b,function(W,Z){return Z||function(lt){switch(lt){case"YY":return String(D.$y).slice(-2);case"YYYY":return R.s(D.$y,4,"0");case"M":return J+1;case"MM":return R.s(J+1,2,"0");case"MMM":return $(_.monthsShort,J,nt,3);case"MMMM":return $(nt,J);case"D":return D.$D;case"DD":return R.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return $(_.weekdaysMin,D.$W,et,2);case"ddd":return $(_.weekdaysShort,D.$W,et,3);case"dddd":return et[D.$W];case"H":return String(Y);case"HH":return R.s(Y,2,"0");case"h":return O(1);case"hh":return O(2);case"a":return z(Y,G,!0);case"A":return z(Y,G,!1);case"m":return String(G);case"mm":return R.s(G,2,"0");case"s":return String(D.$s);case"ss":return R.s(D.$s,2,"0");case"SSS":return R.s(D.$ms,3,"0");case"Z":return T}return null}(W)||T.replace(":","")})},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(g,D,_){var A,T=this,Y=R.p(D),G=U(g),J=(G.utcOffset()-this.utcOffset())*n,et=this-G,nt=function(){return R.m(T,G)};switch(Y){case w:A=nt()/12;break;case f:A=nt();break;case h:A=nt()/3;break;case u:A=(et-J)/6048e5;break;case c:A=(et-J)/864e5;break;case l:A=et/i;break;case d:A=et/n;break;case s:A=et/a;break;default:A=et}return _?A:R.a(A)},S.daysInMonth=function(){return this.endOf(f).$D},S.$locale=function(){return P[this.$L]},S.locale=function(g,D){if(!g)return this.$L;var _=this.clone(),A=k(g,D,!0);return A&&(_.$L=A),_},S.clone=function(){return R.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},C}(),X=H.prototype;return U.prototype=X,[["$ms",r],["$s",s],["$m",d],["$H",l],["$W",c],["$M",f],["$y",w],["$D",v]].forEach(function(C){X[C[1]]=function(S){return this.$g(S,C[0],C[1])}}),U.extend=function(C,S){return C.$i||(C(S,H,U),C.$i=!0),U},U.locale=k,U.isDayjs=j,U.unix=function(C){return U(1e3*C)},U.en=P[L],U.Ls=P,U.p={},U})})(Ve);var hn=Ve.exports;const $t=we(hn);var be={exports:{}};(function(t,e){(function(a,n){t.exports=n()})(De,function(){var a="minute",n=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g;return function(r,s,d){var l=s.prototype;d.utc=function(m){var M={date:m,utc:!0,args:arguments};return new s(M)},l.utc=function(m){var M=d(this.toDate(),{locale:this.$L,utc:!0});return m?M.add(this.utcOffset(),a):M},l.local=function(){return d(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(m){m.utc&&(this.$u=!0),this.$utils().u(m.$offset)||(this.$offset=m.$offset),c.call(this,m)};var u=l.init;l.init=function(){if(this.$u){var m=this.$d;this.$y=m.getUTCFullYear(),this.$M=m.getUTCMonth(),this.$D=m.getUTCDate(),this.$W=m.getUTCDay(),this.$H=m.getUTCHours(),this.$m=m.getUTCMinutes(),this.$s=m.getUTCSeconds(),this.$ms=m.getUTCMilliseconds()}else u.call(this)};var f=l.utcOffset;l.utcOffset=function(m,M){var b=this.$utils().u;if(b(m))return this.$u?0:b(this.$offset)?f.call(this):this.$offset;if(typeof m=="string"&&(m=function(L){L===void 0&&(L="");var P=L.match(n);if(!P)return null;var y=(""+P[0]).match(i)||["-",0,0],j=y[0],k=60*+y[1]+ +y[2];return k===0?0:j==="+"?k:-k}(m),m===null))return this;var E=Math.abs(m)<=16?60*m:m,I=this;if(M)return I.$offset=E,I.$u=m===0,I;if(m!==0){var F=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(I=this.local().add(E+F,a)).$offset=E,I.$x.$localOffset=F}else I=this.utc();return I};var h=l.format;l.format=function(m){var M=m||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,M)},l.valueOf=function(){var m=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*m},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var w=l.toDate;l.toDate=function(m){return m==="s"&&this.$offset?d(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():w.call(this)};var v=l.diff;l.diff=function(m,M,b){if(m&&this.$u===m.$u)return v.call(this,m,M,b);var E=this.local(),I=d(m).local();return v.call(E,I,M,b)}}})})(be);var fn=be.exports;const pn=we(fn);var mn=Object.defineProperty,vn=Object.getOwnPropertyDescriptor,gn=(t,e,a,n)=>{for(var i=n>1?void 0:n?vn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&mn(e,a,i),i},Lt=(t,e)=>(a,n)=>e(a,n,t);let Tt=class extends o.Disposable{constructor(t,e,a,n,i){super(),this._sheetInterceptorService=t,this._dataValidationModel=e,this._dataValidatorRegistryService=a,this._dialogService=n,this._localeService=i,this._initEditorBridgeInterceptor()}_initEditorBridgeInterceptor(){this._sheetInterceptorService.writeCellInterceptor.intercept(Q.AFTER_CELL_EDIT_ASYNC,{handler:async(t,e,a)=>{var m;const n=await t,{worksheet:i,row:r,col:s,unitId:d,subUnitId:l,workbook:c}=e,u=this._dataValidationModel.getRuleIdByLocation(d,l,r,s),f=u?this._dataValidationModel.getRuleById(d,l,u):void 0;if(!f||f.errorStyle!==o.DataValidationErrorStyle.STOP)return a(Promise.resolve(n));const h=await this._dataValidatorRegistryService.getValidatorItem(f.type);if(!h||await h.validator({value:x.getCellValueOrigin(n),interceptValue:x.getCellValueOrigin((m=e==null?void 0:e.origin)!=null?m:n),row:r,column:s,unitId:d,subUnitId:l,worksheet:i,workbook:c,t:n==null?void 0:n.t},f))return a(Promise.resolve(n));const v=i.getCellRaw(r,s);return this._dialogService.open({width:368,title:{title:this._localeService.t("dataValidation.alert.title")},id:"reject-input-dialog",children:{title:h.getRuleFinalError(f)},footer:{title:V.createElement(N.Button,{type:"primary",onClick:()=>this._dialogService.close("reject-input-dialog")},this._localeService.t("dataValidation.alert.ok"))},onClose:()=>{this._dialogService.close("reject-input-dialog")}}),a(Promise.resolve(v))}})}showReject(t){this._dialogService.open({width:368,title:{title:this._localeService.t("dataValidation.alert.title")},id:"reject-input-dialog",children:{title:t},footer:{title:V.createElement(N.Button,{type:"primary",onClick:()=>this._dialogService.close("reject-input-dialog")},this._localeService.t("dataValidation.alert.ok"))},onClose:()=>{this._dialogService.close("reject-input-dialog")}})}};Tt=gn([Lt(0,o.Inject(Q.SheetInterceptorService)),Lt(1,o.Inject(x.SheetDataValidationModel)),Lt(2,o.Inject(ot.DataValidatorRegistryService)),Lt(3,tt.IDialogService),Lt(4,o.Inject(o.LocaleService))],Tt);const Ee={dvDateDropdown:"univer-dv-date-dropdown",dvDateDropdownBtns:"univer-dv-date-dropdown-btns"};$t.extend(pn);const Sn=t=>{if(t==null||typeof t=="boolean")return;if(typeof t=="number"||!Number.isNaN(+t))return $t(o.numfmt.format("yyyy-MM-dd HH:mm:ss",Number(t)));const e=$t(t);if(e.isValid())return e};function _n(t){var P,y,j;const{location:e,hideFn:a}=t,{worksheet:n,row:i,col:r,unitId:s,subUnitId:d,workbook:l}=e,c=o.useDependency(o.ICommandService),u=o.useDependency(Tt),f=n.getCell(i,r),h=(P=f==null?void 0:f.dataValidation)==null?void 0:P.rule,w=(y=f==null?void 0:f.dataValidation)==null?void 0:y.validator,v=x.getCellValueOrigin(n.getCellRaw(i,r)),m=Sn(v),[M,b]=V.useState(m),E=!!((j=h==null?void 0:h.bizInfo)!=null&&j.showTime),I=M&&M.isValid()?M:$t(),F=o.useDependency(o.LocaleService);if(!f||!h||!w)return;const L=async()=>{var S,g,D;if(!I)return;const U=I.format(E?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD 00:00:00"),R=(S=o.numfmt.parseDate(U))==null?void 0:S.v,H=l.getStyles().getStyleByCell(f),X=(D=(g=H==null?void 0:H.n)==null?void 0:g.pattern)!=null?D:"",C=an.getPatternType(X);h.errorStyle!==o.DataValidationErrorStyle.STOP||await w.validator({value:R,unitId:s,subUnitId:d,row:i,column:r,worksheet:n,workbook:l,interceptValue:U.replace("Z","").replace("T"," "),t:o.CellValueType.NUMBER},h)?(a(),await c.executeCommand(K.SetCellEditVisibleOperation.id,{visible:!1,eventType:at.DeviceInputEventType.Keyboard,unitId:s,keycode:tt.KeyCode.ESC}),await c.executeCommand(Q.SetRangeValuesCommand.id,{unitId:s,subUnitId:d,range:{startColumn:r,endColumn:r,startRow:i,endRow:i},value:{v:R,t:2,p:null,f:null,si:null,s:{n:{pattern:E?C==="datetime"?X:"yyyy-MM-dd hh:mm:ss":C==="date"?X:"yyyy-MM-dd"}}}})):u.showReject(w.getRuleFinalError(h))};return p.jsxs("div",{className:Ee.dvDateDropdown,children:[p.jsx(N.DatePanel,{defaultValue:I,pickerValue:I,showTime:E||void 0,onSelect:async k=>{b(k)},onPanelChange:k=>{b(k)},disabledDate:k=>!o.numfmt.parseDate(k.format("YYYY-MM-DD"))}),p.jsx("div",{className:Ee.dvDateDropdownBtns,children:p.jsx(N.Button,{size:"small",type:"primary",onClick:L,disabled:!I.isValid(),children:F.t("dataValidation.alert.ok")})})]})}var ct=function(){return ct=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++){e=arguments[a];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ct.apply(this,arguments)},In=function(t,e){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(a[n[i]]=t[n[i]]);return a},vt=V.forwardRef(function(t,e){var a=t.icon,n=t.id,i=t.className,r=t.extend,s=In(t,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),l=V.useRef("_".concat(wn()));return Re(a,"".concat(n),{defIds:a.defIds,idSuffix:l.current},ct({ref:e,className:d},s),r)});function Re(t,e,a,n,i){return V.createElement(t.tag,ct(ct({key:e},Cn(t,a,i)),n),(Dn(t,a).children||[]).map(function(r,s){return Re(r,"".concat(e,"-").concat(t.tag,"-").concat(s),a,void 0,i)}))}function Cn(t,e,a){var n=ct({},t.attrs);a!=null&&a.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=a.colorChannel1);var i=e.defIds;return!i||i.length===0||(t.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(r){var s=r[0],d=r[1];typeof d=="string"&&(n[s]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Dn(t,e){var a,n=e.defIds;return!n||n.length===0?t:t.tag==="defs"&&(!((a=t.children)===null||a===void 0)&&a.length)?ct(ct({},t),{children:t.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?ct(ct({},i),{attrs:ct(ct({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):t}function wn(){return Math.random().toString(36).substring(2,8)}vt.displayName="UniverIcon";var yn={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"}}]},Oe=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"check-mark-single",ref:e,icon:yn}))});Oe.displayName="CheckMarkSingle";var Mn={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"}}]},Le=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"data-validation-single",ref:e,icon:Mn}))});Le.displayName="DataValidationSingle";var Vn={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"}}]},ee=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"delete-single",ref:e,icon:Vn}))});ee.displayName="DeleteSingle";var bn={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"}}]},Te=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"increase-single",ref:e,icon:bn}))});Te.displayName="IncreaseSingle";var En={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"}}]},Pe=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"more-down-single",ref:e,icon:En}))});Pe.displayName="MoreDownSingle";var Rn={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"}}]},je=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"more-up-single",ref:e,icon:Rn}))});je.displayName="MoreUpSingle";var On={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"}}]}]},Ae=V.forwardRef(function(t,e){return V.createElement(vt,Object.assign({},t,{id:"sequence-single",ref:e,icon:On}))});Ae.displayName="SequenceSingle";var Ln=Object.defineProperty,Tn=Object.getOwnPropertyDescriptor,Pn=(t,e,a,n)=>{for(var i=n>1?void 0:n?Tn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Ln(e,a,i),i},$e=(t,e)=>(a,n)=>e(a,n,t);let ht=class extends o.Disposable{constructor(e,a){super();B(this,"_open$",new dt.BehaviorSubject(!1));B(this,"open$",this._open$.pipe(dt.distinctUntilChanged()));B(this,"_activeRule");B(this,"_activeRule$",new dt.BehaviorSubject(void 0));B(this,"activeRule$",this._activeRule$.asObservable());B(this,"_closeDisposable",null);this._univerInstanceService=e,this._sidebarService=a,this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(dt.filter(n=>!n)).subscribe(()=>{this.close()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(n=>{n.id===ne&&(n.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}get activeRule(){return this._activeRule}get isOpen(){return this._open$.getValue()}dispose(){var e;super.dispose(),this._open$.next(!1),this._open$.complete(),this._activeRule$.complete(),(e=this._closeDisposable)==null||e.dispose()}open(){this._open$.next(!0)}close(){var e;this._open$.next(!1),(e=this._closeDisposable)==null||e.dispose()}setCloseDisposable(e){this._closeDisposable=o.toDisposable(()=>{e.dispose(),this._closeDisposable=null})}setActiveRule(e){this._activeRule=e,this._activeRule$.next(e)}};ht=Pn([$e(0,o.IUniverInstanceService),$e(1,tt.ISidebarService)],ht);function jn(){const t=o.useDependency(gt),e=tt.useObservable(t.activeDropdown$,t.activeDropdown),a=o.useDependency(tt.ComponentManager);if(!e)return null;const{location:n,componentKey:i}=e,r=a.get(i),s=`${n.unitId}-${n.subUnitId}-${n.row}-${n.col}`;if(!r)return null;const d=()=>{t.hideDropdown()};return p.jsx(r,{location:n,hideFn:d},s)}const Fe="sheet.ui.dropdown";var An=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Fn=(t,e,a,n)=>{for(var i=n>1?void 0:n?$n(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&An(e,a,i),i},St=(t,e)=>(a,n)=>e(a,n,t);let gt=class extends o.Disposable{constructor(e,a,n,i,r,s,d){super();B(this,"_activeDropdown");B(this,"_activeDropdown$",new dt.Subject);B(this,"_currentPopup",null);B(this,"activeDropdown$",this._activeDropdown$.asObservable());B(this,"_zenVisible",!1);this._canvasPopupManagerService=e,this._univerInstanceService=a,this._dataValidatorRegistryService=n,this._zenZoneService=i,this._renderManagerService=r,this._dataValidationModel=s,this._sheetsSelectionsService=d,this._init(),this._initSelectionChange(),this.disposeWithMe(()=>{this._activeDropdown$.complete()})}get activeDropdown(){return this._activeDropdown}_init(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{this._zenVisible=e,e&&this.hideDropdown()}))}_getDropdownByCell(e,a,n,i){const r=e?this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_SHEET):this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET);if(!r)return;const s=a?r.getSheetBySheetId(a):r.getActiveSheet();if(!s)return;const d=this._dataValidationModel.getRuleByLocation(r.getUnitId(),s.getSheetId(),n,i);if(!d)return;const l=this._dataValidatorRegistryService.getValidatorItem(d.type);return l==null?void 0:l.dropdown}_initSelectionChange(){this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe(e=>{e&&e.every(a=>!(a.primary&&this._getDropdownByCell(a.primary.unitId,a.primary.sheetId,a.primary.actualRow,a.primary.actualColumn)))&&this.hideDropdown()}))}showDropdown(e,a=!0){const{location:n}=e,{row:i,col:r,unitId:s,subUnitId:d}=n;if(this._currentPopup&&this._currentPopup.dispose(),this._zenVisible)return;this._activeDropdown=e,this._activeDropdown$.next(this._activeDropdown);const l=this._renderManagerService.getRenderById(o.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY),c=this._canvasPopupManagerService.attachPopupToCell(i,r,{componentKey:Fe,onClickOutside:()=>{a&&this.hideDropdown()},offset:[0,3],excludeOutside:[l==null?void 0:l.engine.getCanvasElement()].filter(Boolean)},s,d);if(!c)throw new Error("[DataValidationDropdownManagerService]: cannot show dropdown!");const u=new o.DisposableCollection;u.add(c),u.add({dispose:()=>{var f,h;(h=(f=this._activeDropdown)==null?void 0:f.onHide)==null||h.call(f)}}),this._currentPopup=u}hideDropdown(){this._activeDropdown&&(this._currentPopup&&this._currentPopup.dispose(),this._currentPopup=null,this._activeDropdown=null,this._activeDropdown$.next(null))}showDataValidationDropdown(e,a,n,i,r){const s=this._univerInstanceService.getUnit(e,o.UniverInstanceType.UNIVER_SHEET);if(!s)return;const d=s.getSheetBySheetId(a);if(!d)return;const l=this._dataValidationModel.getRuleByLocation(s.getUnitId(),d.getSheetId(),n,i);if(!l)return;const c=this._dataValidatorRegistryService.getValidatorItem(l.type);if(!c||!c.dropdown){this.hideDropdown();return}this.showDropdown({location:{workbook:s,worksheet:d,row:n,col:i,unitId:e,subUnitId:a},componentKey:c.dropdown,onHide:r})}};gt=Fn([St(0,o.Inject(K.SheetCanvasPopManagerService)),St(1,o.IUniverInstanceService),St(2,o.Inject(ot.DataValidatorRegistryService)),St(3,tt.IZenZoneService),St(4,at.IRenderManagerService),St(5,o.Inject(x.SheetDataValidationModel)),St(6,o.Inject(Q.SheetsSelectionsService))],gt);const ne="DataValidationPanel",_t={id:"data-validation.operation.open-validation-panel",type:o.CommandType.OPERATION,handler(t,e){if(!e)return!1;const{ruleId:a,isAdd:n}=e,i=t.get(ht),r=t.get(ot.DataValidationModel),s=t.get(o.IUniverInstanceService),d=t.get(tt.ISidebarService),l=Q.getSheetCommandTarget(s);if(!l)return!1;const{unitId:c,subUnitId:u}=l,f=a?r.getRuleById(c,u,a):void 0;i.open(),i.setActiveRule(f&&{unitId:c,subUnitId:u,rule:f});const h=d.open({header:{title:n?"dataValidation.panel.addTitle":"dataValidation.panel.title"},children:{label:ne},width:312,onClose:()=>i.close()});return i.setCloseDisposable(h),!0}},ae={id:"data-validation.operation.close-validation-panel",type:o.CommandType.OPERATION,handler(t){return t.get(ht).close(),!0}},xe={id:"data-validation.operation.toggle-validation-panel",type:o.CommandType.OPERATION,handler(t){const e=t.get(o.ICommandService),a=t.get(ht);return a.open(),a.isOpen?e.executeCommand(ae.id):e.executeCommand(_t.id),!0}},Ft={type:o.CommandType.OPERATION,id:"sheet.operation.show-data-validation-dropdown",handler(t,e){if(!e)return!1;const a=t.get(gt),{unitId:n,subUnitId:i,row:r,column:s}=e,d=a.activeDropdown,l=d==null?void 0:d.location;return l&&l.unitId===n&&l.subUnitId===i&&l.row===r&&l.col===s||a.showDataValidationDropdown(n,i,r,s),!0}},Ne={type:o.CommandType.OPERATION,id:"sheet.operation.hide-data-validation-dropdown",handler(t,e){return e?(t.get(gt).hideDropdown(),!0):!1}},It="#ECECEC",ie="sheets-data-validation-ui.config",Ue={},mt={dvListDropdown:"univer-dv-list-dropdown",dvListDropdownTitle:"univer-dv-list-dropdown-title",dvListDropdownList:"univer-dv-list-dropdown-list",dvListDropdownListContainer:"univer-dv-list-dropdown-list-container",dvListDropdownSelectedIcon:"univer-dv-list-dropdown-selected-icon",dvListDropdownItemContainer:"univer-dv-list-dropdown-item-container",dvListDropdownItem:"univer-dv-list-dropdown-item",dvListDropdownSplit:"univer-dv-list-dropdown-split",dvListDropdownEdit:"univer-dv-list-dropdown-edit"},xn=t=>{var L,P;const{value:e,onChange:a,multiple:n,options:i,title:r,onEdit:s,style:d,filter:l,location:c}=t,u=o.useDependency(o.LocaleService),f=o.useDependency(o.IConfigService),h=l==null?void 0:l.toLowerCase(),{row:w,col:v,unitId:m,subUnitId:M}=c,b=i.filter(y=>h?y.label.toLowerCase().includes(h):!0),E=(P=(L=f.getConfig(ie))==null?void 0:L.showEditOnDropdown)!=null?P:!0,I=o.useDependency(K.SheetPermissionInterceptorBaseController),F=V.useMemo(()=>I.permissionCheckWithRanges({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint],worksheetTypes:[Q.WorksheetEditPermission]},[{startColumn:v,startRow:w,endColumn:v,endRow:w}],m,M),[I,v,w,m,M]);return p.jsxs("div",{className:mt.dvListDropdown,style:d,children:[p.jsx("div",{className:mt.dvListDropdownTitle,children:r}),p.jsx("div",{className:mt.dvListDropdownList,children:p.jsx(N.Scrollbar,{children:p.jsx("div",{className:mt.dvListDropdownListContainer,children:b.map((y,j)=>{const k=e.indexOf(y.value)>-1,U=()=>{let H;k?H=new Set(e.filter(C=>C!==y.value)):H=new Set(n?[...e,y.value]:[y.value]);const X=[];i.forEach(C=>{H.has(C.value)&&X.push(C.value)}),a(X)},R=y.label.toLocaleLowerCase().indexOf(h);return p.jsxs("div",{className:mt.dvListDropdownItemContainer,onClick:U,children:[p.jsx("div",{className:mt.dvListDropdownItem,style:{background:y.color||It},children:h&&y.label.toLowerCase().includes(h)?p.jsxs(p.Fragment,{children:[p.jsx("span",{children:y.label.substring(0,R)}),p.jsx("span",{style:{fontWeight:"bold"},children:y.label.substring(R,R+h.length)}),p.jsx("span",{children:y.label.substring(R+h.length)})]}):y.label}),p.jsx("div",{className:mt.dvListDropdownSelectedIcon,children:k?p.jsx(Oe,{}):null})]},j)})})},l)}),E&&F?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:mt.dvListDropdownSplit}),p.jsx("div",{className:mt.dvListDropdownEdit,children:p.jsx("a",{onClick:s,children:u.t("dataValidation.list.edit")})})]}):null]})};function Nn(t){var C,S,g,D,_,A;const{location:e,hideFn:a}=t,{worksheet:n,row:i,col:r,unitId:s,subUnitId:d}=e,l=o.useDependency(ot.DataValidationModel),[c,u]=V.useState(""),f=o.useDependency(o.ICommandService),h=o.useDependency(o.LocaleService),[w,v]=V.useState(""),m=o.useDependency(K.IEditorBridgeService),M=o.useDependency(o.IUniverInstanceService),b=V.useMemo(()=>l.ruleChange$.pipe(dt.debounceTime(16)),[]);tt.useObservable(b);const E=tt.RectPopup.useContext(),I=((S=(C=E.current)==null?void 0:C.right)!=null?S:0)-((D=(g=E.current)==null?void 0:g.left)!=null?D:0);if(V.useEffect(()=>{const T=f.onCommandExecuted(Y=>{var G,J;if(Y.id===on.RichTextEditingMutation.id){const et=Y.params,{unitId:nt}=et,it=M.getUnit(nt,o.UniverInstanceType.UNIVER_DOC);if(!it)return;const $=o.BuildTextUtils.transform.getPlainText((J=(G=it.getSnapshot().body)==null?void 0:G.dataStream)!=null?J:"");u($)}});return()=>{T.dispose()}},[f,M]),!n)return null;const F=n.getCell(i,r),L=(_=F==null?void 0:F.dataValidation)==null?void 0:_.rule,P=(A=F==null?void 0:F.dataValidation)==null?void 0:A.validator,y=(L==null?void 0:L.renderMode)===o.DataValidationRenderMode.CUSTOM||(L==null?void 0:L.renderMode)===void 0;if(!F||!L||!P||P.id.indexOf(o.DataValidationType.LIST)!==0)return;const j=L.type===o.DataValidationType.LIST_MULTIPLE,k=P.getListWithColor(L,s,d),U=w||x.getDataValidationCellValue(n.getCellRaw(i,r)),R=x.deserializeListOptions(U),H=()=>{f.executeCommand(_t.id,{ruleId:L.uid}),a()},X=k.map(T=>({label:T.label,value:T.label,color:y?T.color:"transparent"}));return p.jsx(xn,{style:{minWidth:I,maxWidth:Math.max(I,200)},title:j?h.t("dataValidation.listMultiple.dropdown"):h.t("dataValidation.list.dropdown"),value:R,multiple:j,onChange:async T=>{const Y=x.serializeListOptions(T),G={unitId:s,subUnitId:d,range:{startColumn:r,endColumn:r,startRow:i,endRow:i},value:{v:Y,p:null,f:null,si:null}};m.isVisible()&&m.changeVisible({visible:!1,keycode:tt.KeyCode.ESC,eventType:at.DeviceInputEventType.Keyboard,unitId:s}),v(Y),j||a(),m.isVisible().visible&&await f.executeCommand(K.SetCellEditVisibleOperation.id,{visible:!1,eventType:at.DeviceInputEventType.Keyboard,unitId:s,keycode:tt.KeyCode.ESC}),f.executeCommand(Q.SetRangeValuesCommand.id,G)},options:X,onEdit:H,filter:c,location:e})}const oe={dataValidationOptionsButton:"univer-data-validation-options-button",dataValidationOptionsButtonIcon:"univer-data-validation-options-button-icon"};function Un(t){var c;const e=o.useDependency(o.LocaleService),a=o.useDependency(tt.ComponentManager),{value:n,onChange:i,extraComponent:r}=t,[s,d]=V.useState(!1),l=r?a.get(r):null;return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:oe.dataValidationOptionsButton,onClick:()=>d(!s),children:[e.t("dataValidation.panel.options"),s?p.jsx(je,{className:oe.dataValidationOptionsButtonIcon}):p.jsx(Pe,{className:oe.dataValidationOptionsButtonIcon})]}),s&&p.jsxs(p.Fragment,{children:[l?p.jsx(l,{value:n,onChange:i}):null,p.jsx(N.FormLayout,{label:e.t("dataValidation.panel.invalid"),children:p.jsxs(N.RadioGroup,{value:`${(c=n.errorStyle)!=null?c:o.DataValidationErrorStyle.WARNING}`,onChange:u=>i({...n,errorStyle:+u}),children:[p.jsx(N.Radio,{value:`${o.DataValidationErrorStyle.WARNING}`,children:e.t("dataValidation.panel.showWarning")}),p.jsx(N.Radio,{value:`${o.DataValidationErrorStyle.STOP}`,children:e.t("dataValidation.panel.rejectInput")})]})}),p.jsx(N.FormLayout,{label:e.t("dataValidation.panel.messageInfo"),children:p.jsx(N.Checkbox,{checked:n.showErrorMessage,onChange:()=>i({...n,showErrorMessage:!n.showErrorMessage}),children:e.t("dataValidation.panel.showInfo")})}),n.showErrorMessage?p.jsx(N.FormLayout,{children:p.jsx(N.Input,{value:n.error,onChange:u=>i({...n,error:u})})}):null]})]})}const wt={dataValidationDetail:"univer-data-validation-detail",dataValidationDetailFormItem:"univer-data-validation-detail-form-item",dataValidationDetailButtons:"univer-data-validation-detail-buttons",dataValidationDetailButton:"univer-data-validation-detail-button"},kn=t=>o.debounce(async(e,a,n,i)=>{const r=await t.executeCommand(e,a,n);i==null||i(r)},1e3);function Bn(t,e,a){var n,i,r,s;return e?((i=(n=t.getUnit(e))==null?void 0:n.getSheetBySheetName(a))==null?void 0:i.getSheetId())||"":((s=(r=t.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getSheetBySheetName(a))==null?void 0:s.getSheetId())||""}function Wn(){var it;const[t,e]=V.useState(0),a=o.useDependency(ht),n=tt.useObservable(a.activeRule$,a.activeRule),{unitId:i,subUnitId:r,rule:s}=n||{},d=s.uid,l=o.useDependency(ot.DataValidatorRegistryService),c=o.useDependency(o.IUniverInstanceService),u=o.useDependency(tt.ComponentManager),f=o.useDependency(o.ICommandService),h=o.useDependency(ot.DataValidationModel),w=o.useDependency(o.LocaleService),[v,m]=V.useState(s),M=l.getValidatorItem(v.type),[b,E]=V.useState(!1),I=l.getValidatorsByScope(ot.DataValidatorRegistryScope.SHEET),[F,L]=V.useState(()=>v.ranges.map($=>({unitId:"",sheetId:"",range:$}))),P=V.useMemo(()=>kn(f),[f]),[y,j]=V.useState(!1),k=V.useRef({}),[U,R]=V.useState(!1),H=o.useDependency(Q.SheetsSelectionsService);if(V.useEffect(()=>()=>{const $=H.getCurrentLastSelection();$&&H.setSelections([$])},[H]),V.useEffect(()=>{f.onCommandExecuted($=>{($.id===o.UndoCommand.id||$.id===o.RedoCommand.id)&&setTimeout(()=>{const O=h.getRuleById(i,r,d);e(z=>z+1),O&&(m(O),L(O.ranges.map(z=>({unitId:"",sheetId:"",range:z}))))},20)})},[f,h,d,r,i]),!M)return null;const X=M.operators,C=M.operatorNames,S=v.operator?ot.TWO_FORMULA_OPERATOR_COUNT.includes(v.operator):!1,g=()=>{!v.ranges.length||y||(M.validatorFormula(v,i,r).success?a.setActiveRule(null):E(!0))},D=tt.useEvent($=>{const O=$.split(",").map(Qt.deserializeRangeWithSheet).map(Z=>{const lt=Z.sheetName;if(lt){const Ot=Bn(c,Z.unitId,lt);return{...Z,sheetId:Ot}}return{...Z,sheetId:""}});if(o.isUnitRangesEqual(O,F))return;L(O);const z=O.filter(Z=>(!Z.unitId||Z.unitId===i)&&(!Z.sheetId||Z.sheetId===r)).map(Z=>Z.range);if(m({...v,ranges:z}),z.length===0)return;const W={unitId:i,subUnitId:r,ruleId:d,ranges:z};P(x.UpdateSheetDataValidationRangeCommand.id,W)}),_=$=>{if(o.shallowEqual($,ot.getRuleSetting(v)))return;m({...v,...$});const O={unitId:i,subUnitId:r,ruleId:d,setting:$};P(x.UpdateSheetDataValidationSettingCommand.id,O,void 0)},A=async()=>{await f.executeCommand(x.RemoveSheetDataValidationCommand.id,{ruleId:d,unitId:i,subUnitId:r}),a.setActiveRule(null)},T={type:v.type,operator:v.operator,formula1:v.formula1,formula2:v.formula2,allowBlank:v.allowBlank},Y=$=>{const O=l.getValidatorItem($);if(!O)return;const z=O.operators,W=h.getRuleById(i,r,d),Z=$===(W==null?void 0:W.type)||$.includes("list")&&(W!=null&&W.type.includes("list"))?{...W,type:$}:{...v,type:$,operator:z[0],formula1:void 0,formula2:void 0};m(Z),f.executeCommand(x.UpdateSheetDataValidationSettingCommand.id,{unitId:i,subUnitId:r,ruleId:v.uid,setting:ot.getRuleSetting(Z)})},G=u.get(M.formulaInput),J=V.useMemo(()=>F.map($=>Qt.serializeRange($.range)).join(","),[]),et=ot.getRuleOptions(v),nt=$=>{o.shallowEqual($,ot.getRuleOptions(v))||(m({...v,...$}),P(x.UpdateSheetDataValidationOptionsCommand.id,{unitId:i,subUnitId:r,ruleId:d,options:$}))};return tt.useSidebarClick($=>{var z;const O=(z=k.current)==null?void 0:z.handleOutClick;O&&O($,()=>R(!1))}),p.jsxs("div",{className:wt.dataValidationDetail,children:[p.jsx(N.FormLayout,{label:w.t("dataValidation.panel.range"),error:!v.ranges.length||y?w.t("dataValidation.panel.rangeError"):"",children:p.jsx(te.RangeSelector,{unitId:i,subUnitId:r,initValue:J,onChange:D,onFocus:()=>R(!0),isFocus:U,actions:k.current,onVerify:$=>j(!$)})}),p.jsx(N.FormLayout,{label:w.t("dataValidation.panel.type"),children:p.jsx(N.Select,{options:I==null?void 0:I.map($=>({label:w.t($.title),value:$.id})),value:v.type,onChange:Y,className:wt.dataValidationDetailFormItem})}),X!=null&&X.length?p.jsx(N.FormLayout,{label:w.t("dataValidation.panel.operator"),children:p.jsx(N.Select,{options:X.map(($,O)=>({value:`${$}`,label:C[O]})),value:`${v.operator}`,onChange:$=>{_({...T,operator:$})},className:wt.dataValidationDetailFormItem})}):null,G?p.jsx(G,{isTwoFormula:S,value:{formula1:v.formula1,formula2:v.formula2},onChange:$=>{_({...T,...$})},showError:b,validResult:M.validatorFormula(v,i,r),unitId:i,subUnitId:r,ruleId:d},t+v.type):null,p.jsx(N.FormLayout,{children:p.jsx(N.Checkbox,{checked:(it=v.allowBlank)!=null?it:!0,onChange:()=>{var $;return _({...T,allowBlank:!(($=v.allowBlank)==null||$)})},children:w.t("dataValidation.panel.allowBlank")})}),p.jsx(Un,{value:et,onChange:nt,extraComponent:M.optionsInput}),p.jsxs("div",{className:wt.dataValidationDetailButtons,children:[p.jsx(N.Button,{className:wt.dataValidationDetailButton,onClick:A,children:w.t("dataValidation.panel.removeRule")}),p.jsx(N.Button,{className:wt.dataValidationDetailButton,type:"primary",onClick:g,children:w.t("dataValidation.panel.done")})]})]})}const xt={dataValidationItemContainer:"univer-data-validation-item-container",dataValidationItemTitle:"univer-data-validation-item-title",dataValidationItemContent:"univer-data-validation-item-content",dataValidationItemIcon:"univer-data-validation-item-icon"},Hn=t=>{const{rule:e,onClick:a,unitId:n,subUnitId:i,disable:r}=t,s=o.useDependency(ot.DataValidatorRegistryService),d=o.useDependency(o.ICommandService),l=o.useDependency(K.IMarkSelectionService),c=s.getValidatorItem(e.type),u=V.useRef(),[f,h]=V.useState(!1),w=v=>{d.executeCommand(x.RemoveSheetDataValidationCommand.id,{ruleId:e.uid,unitId:n,subUnitId:i}),v.stopPropagation()};return V.useEffect(()=>()=>{var v;u.current&&((v=u.current)==null||v.forEach(m=>{m&&l.removeShape(m)}))},[l]),p.jsxs("div",{className:xt.dataValidationItemContainer,onClick:a,onMouseEnter:()=>{r||(h(!0),u.current=e.ranges.map(v=>l.addShape({range:v,style:{hasAutoFill:!1,fill:"rgba(73, 184, 17, 0.05)",strokeWidth:1,stroke:"#49B811",widgets:{}},primary:{startColumn:v.startColumn,endColumn:v.endColumn,startRow:v.startRow,endRow:v.endRow,actualRow:v.startRow,actualColumn:v.startColumn,isMerged:!1,isMergedMainCell:!1}})))},onMouseLeave:()=>{var v;h(!1),(v=u.current)==null||v.forEach(m=>{m&&l.removeShape(m)}),u.current=void 0},children:[p.jsx("div",{className:xt.dataValidationItemTitle,children:c==null?void 0:c.generateRuleName(e)}),p.jsx("div",{className:xt.dataValidationItemContent,children:e.ranges.map(v=>Qt.serializeRange(v)).join(",")}),f?p.jsx("div",{className:xt.dataValidationItemIcon,onClick:w,children:p.jsx(ee,{})}):null]})},Nt={dataValidationList:"univer-data-validation-list",dataValidationListButtons:"univer-data-validation-list-buttons",dataValidationListButton:"univer-data-validation-list-button"};function Yn(){const t=o.useDependency(o.IUniverInstanceService),e=tt.useObservable(()=>t.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]);return e?p.jsx(Xn,{workbook:e}):null}function Xn(t){const e=o.useDependency(x.SheetDataValidationModel),a=o.useDependency(o.IUniverInstanceService),n=o.useDependency(o.ICommandService),i=o.useDependency(o.Injector),r=o.useDependency(ht),s=o.useDependency(o.LocaleService),[d,l]=V.useState([]),{workbook:c}=t,u=tt.useObservable(c.activeSheet$,void 0,!0),f=c.getUnitId(),h=u==null?void 0:u.getSheetId();V.useEffect(()=>{l(e.getRules(f,h));const E=e.ruleChange$.subscribe(I=>{I.unitId===f&&I.subUnitId===h&&l(e.getRules(f,h))});return()=>{E.unsubscribe()}},[f,h,e]);const w=async()=>{const E=x.createDefaultNewRule(i),I={unitId:f,subUnitId:h,rule:E};await n.executeCommand(x.AddSheetDataValidationCommand.id,I),r.setActiveRule({unitId:f,subUnitId:h,rule:E})},v=()=>{n.executeCommand(x.RemoveSheetAllDataValidationCommand.id,{unitId:f,subUnitId:h})},M=(E=>{const I=a.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET),F=I.getActiveSheet(),L=I.getUnitId(),P=F.getSheetId();return E.map(j=>Q.checkRangesEditablePermission(i,L,P,j.ranges)?{...j}:{...j,disable:!0})})(d),b=M==null?void 0:M.some(E=>E.disable);return p.jsxs("div",{className:Nt.dataValidationList,children:[M==null?void 0:M.map(E=>{var I;return p.jsx(Hn,{unitId:f,subUnitId:h,onClick:()=>{E.disable||r.setActiveRule({unitId:f,subUnitId:h,rule:E})},rule:E,disable:(I=E.disable)!=null?I:!1},E.uid)}),p.jsxs("div",{className:Nt.dataValidationListButtons,children:[d.length&&!b?p.jsx(N.Button,{className:Nt.dataValidationListButton,onClick:v,children:s.t("dataValidation.panel.removeAll")}):null,p.jsx(N.Button,{className:Nt.dataValidationListButton,type:"primary",onClick:w,children:s.t("dataValidation.panel.add")})]})]})}const zn=()=>{const t=o.useDependency(ht),e=tt.useObservable(t.activeRule$,t.activeRule);return e?p.jsx(Wn,{},e.rule.uid):p.jsx(Yn,{})},Ut="data-validation.list.dropdown",re="data-validation.date.dropdown",kt={type:o.CommandType.COMMAND,id:"data-validation.command.addRuleAndOpen",handler(t){const e=t.get(o.IUniverInstanceService),a=Q.getSheetCommandTarget(e);if(!a)return!1;const{workbook:n,worksheet:i}=a,r=x.createDefaultNewRule(t),s=t.get(o.ICommandService),d=n.getUnitId(),l=i.getSheetId(),c={rule:r,unitId:d,subUnitId:l};return s.syncExecuteCommand(x.AddSheetDataValidationCommand.id,c)?(s.syncExecuteCommand(_t.id,{ruleId:r.uid,isAdd:!0}),!0):!1}};var Kn=Object.defineProperty,Gn=Object.getOwnPropertyDescriptor,Zn=(t,e,a,n)=>{for(var i=n>1?void 0:n?Gn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Kn(e,a,i),i},Pt=(t,e)=>(a,n)=>e(a,n,t);const Bt="SHEET_DATA_VALIDATION_ALERT";let jt=class extends o.Disposable{constructor(t,e,a,n,i){super(),this._hoverManagerService=t,this._cellAlertManagerService=e,this._univerInstanceService=a,this._localeService=n,this._zenZoneService=i,this._init()}_init(){this._initCellAlertPopup(),this._initZenService()}_initCellAlertPopup(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(dt.debounceTime(100)).subscribe(t=>{var e,a;if(t){const i=this._univerInstanceService.getCurrentUnitForType(o.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!i)return;const r=i.getCell(t.location.row,t.location.col);if(((e=r==null?void 0:r.dataValidation)==null?void 0:e.validStatus)===o.DataValidationStatus.INVALID){const s=this._cellAlertManagerService.currentAlert.get(Bt),d=(a=s==null?void 0:s.alert)==null?void 0:a.location;if(d&&d.row===t.location.row&&d.col===t.location.col&&d.subUnitId===t.location.subUnitId&&d.unitId===t.location.unitId)return;const l=r.dataValidation.validator,c=r.dataValidation.rule;if(!l)return;this._cellAlertManagerService.showAlert({type:K.CellAlertType.ERROR,title:this._localeService.t("dataValidation.error.title"),message:l==null?void 0:l.getRuleFinalError(c),location:t.location,width:200,height:74,key:Bt});return}}this._cellAlertManagerService.removeAlert(Bt)}))}_initZenService(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(t=>{t&&this._cellAlertManagerService.removeAlert(Bt)}))}};jt=Zn([Pt(0,o.Inject(K.HoverManagerService)),Pt(1,o.Inject(K.CellAlertManagerService)),Pt(2,o.IUniverInstanceService),Pt(3,o.Inject(o.LocaleService)),Pt(4,tt.IZenZoneService)],jt);var qn=Object.defineProperty,Jn=Object.getOwnPropertyDescriptor,Qn=(t,e,a,n)=>{for(var i=n>1?void 0:n?Jn(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&qn(e,a,i),i},se=(t,e)=>(a,n)=>e(a,n,t);let yt=class extends o.Disposable{constructor(t,e,a){super(),this._autoFillService=t,this._dataValidationModel=e,this._injector=a,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(i,r)=>{const{source:s,target:d,unitId:l,subUnitId:c}=i,u=this._dataValidationModel.getRuleObjectMatrix(l,c).clone(),f=K.virtualizeDiscreteRanges([s,d]),[h,w]=f.ranges,{mapFunc:v}=f,m={row:h.startRow,col:h.startColumn},M=K.getAutoFillRepeatRange(h,w),b=new o.ObjectMatrix,E=new Set;M.forEach(y=>{const j=y.repeatStartCell,k=y.relativeRange,U={startRow:m.row,startColumn:m.col,endColumn:m.col,endRow:m.row},R={startRow:j.row,startColumn:j.col,endColumn:j.col,endRow:j.row};o.Range.foreach(k,(H,X)=>{const C=o.Rectangle.getPositionRange({startRow:H,startColumn:X,endColumn:X,endRow:H},U),{row:S,col:g}=v(C.startRow,C.startColumn),D=this._dataValidationModel.getRuleIdByLocation(l,c,S,g);if(D){const _=o.Rectangle.getPositionRange({startRow:H,startColumn:X,endColumn:X,endRow:H},R),{row:A,col:T}=v(_.startRow,_.startColumn);b.setValue(A,T,D),E.add(D)}})});const I=Array.from(E).map(y=>({id:y,ranges:o.queryObjectMatrix(b,j=>j===y)}));u.addRangeRules(I);const F=u.diff(this._dataValidationModel.getRules(l,c)),{redoMutations:L,undoMutations:P}=x.getDataValidationDiffMutations(l,c,F,this._injector,"patched",r===K.APPLY_TYPE.ONLY_FORMAT);return{undos:P,redos:L}},a=[o.DataValidationType.CHECKBOX],n={id:x.DATA_VALIDATION_PLUGIN_NAME,onBeforeFillData:i=>{const{source:r,unitId:s,subUnitId:d}=i;for(const l of r.rows)for(const c of r.cols){const u=this._dataValidationModel.getRuleByLocation(s,d,l,c);if(u&&a.indexOf(u.type)>-1){this._autoFillService.setDisableApplyType(K.APPLY_TYPE.SERIES,!0);return}}},onFillData:(i,r,s)=>s===K.APPLY_TYPE.COPY||s===K.APPLY_TYPE.ONLY_FORMAT||s===K.APPLY_TYPE.SERIES?e(i,s):t(),onAfterFillData:()=>{}};this.disposeWithMe(this._autoFillService.addHook(n))}};yt=Qn([se(0,K.IAutoFillService),se(1,o.Inject(x.SheetDataValidationModel)),se(2,o.Inject(o.Injector))],yt);var ta=Object.defineProperty,ea=Object.getOwnPropertyDescriptor,na=(t,e,a,n)=>{for(var i=n>1?void 0:n?ea(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ta(e,a,i),i},le=(t,e)=>(a,n)=>e(a,n,t);let Mt=class extends o.Disposable{constructor(e,a,n){super();B(this,"_copyInfo");this._sheetClipboardService=e,this._sheetDataValidationModel=a,this._injector=n,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:x.DATA_VALIDATION_PLUGIN_NAME,onBeforeCopy:(e,a,n)=>this._collect(e,a,n),onPasteCells:(e,a,n,i)=>{const{copyType:r=K.COPY_TYPE.COPY,pasteType:s}=i,{range:d}=e||{},{range:l,unitId:c,subUnitId:u}=a;return this._generateMutations(l,{copyType:r,pasteType:s,copyRange:d,unitId:c,subUnitId:u})}})}_collect(e,a,n){const i=new o.ObjectMatrix;this._copyInfo={unitId:e,subUnitId:a,matrix:i};const r=this._injector.invoke(l=>K.rangeToDiscreteRange(n,l,e,a));if(!r)return;const{rows:s,cols:d}=r;s.forEach((l,c)=>{d.forEach((u,f)=>{const h=this._sheetDataValidationModel.getRuleIdByLocation(e,a,l,u);i.setValue(c,f,h!=null?h:"")})})}_generateMutations(e,a){if(!this._copyInfo)return{redos:[],undos:[]};if(a.copyType===K.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!a.copyRange)return{redos:[],undos:[]};if([K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,K.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(a.pasteType))return{redos:[],undos:[]};const{unitId:n,subUnitId:i}=this._copyInfo;if(a.unitId!==n||i!==a.subUnitId){const r=this._sheetDataValidationModel.getRuleObjectMatrix(a.unitId,a.subUnitId).clone(),s=new o.ObjectMatrix,d=new Set,{ranges:[l,c],mapFunc:u}=K.virtualizeDiscreteRanges([a.copyRange,e]),f=K.getRepeatRange(l,c,!0),h=new Map;f.forEach(({startRange:M})=>{var b;(b=this._copyInfo)==null||b.matrix.forValue((E,I,F)=>{const L=o.Rectangle.getPositionRange({startRow:E,endRow:E,startColumn:I,endColumn:I},M),P=`${i}-${F}`,y=this._sheetDataValidationModel.getRuleById(n,i,F);!this._sheetDataValidationModel.getRuleById(a.unitId,a.subUnitId,P)&&y&&h.set(P,{...y,uid:P});const{row:j,col:k}=u(L.startRow,L.startColumn);d.add(P),s.setValue(j,k,P)})});const w=Array.from(d).map(M=>({id:M,ranges:o.queryObjectMatrix(s,b=>b===M)}));r.addRangeRules(w);const{redoMutations:v,undoMutations:m}=x.getDataValidationDiffMutations(a.unitId,a.subUnitId,r.diffWithAddition(this._sheetDataValidationModel.getRules(a.unitId,a.subUnitId),h.values()),this._injector,"patched",!1);return{redos:v,undos:m}}else{const r=this._sheetDataValidationModel.getRuleObjectMatrix(n,i).clone(),s=new o.ObjectMatrix,d=new Set,{ranges:[l,c],mapFunc:u}=K.virtualizeDiscreteRanges([a.copyRange,e]);K.getRepeatRange(l,c,!0).forEach(({startRange:m})=>{var M;(M=this._copyInfo)==null||M.matrix.forValue((b,E,I)=>{const F=o.Rectangle.getPositionRange({startRow:b,endRow:b,startColumn:E,endColumn:E},m),{row:L,col:P}=u(F.startRow,F.startColumn);s.setValue(L,P,I),d.add(I)})});const h=Array.from(d).map(m=>({id:m,ranges:o.queryObjectMatrix(s,M=>M===m)}));r.addRangeRules(h);const{redoMutations:w,undoMutations:v}=x.getDataValidationDiffMutations(n,i,r.diff(this._sheetDataValidationModel.getRules(n,i)),this._injector,"patched",!1);return{redos:w,undos:v}}}};Mt=na([le(0,K.ISheetClipboardService),le(1,o.Inject(x.SheetDataValidationModel)),le(2,o.Inject(o.Injector))],Mt);var aa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,oa=(t,e,a,n)=>{for(var i=n>1?void 0:n?ia(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&aa(e,a,i),i},de=(t,e)=>(a,n)=>e(a,n,t);let Vt=class extends o.Disposable{constructor(t,e,a){super(),this._localeService=t,this._commandService=e,this._sheetPermissionInterceptorBaseController=a,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===x.AddSheetDataValidationCommand.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint],worksheetTypes:[Q.WorksheetEditPermission,Q.WorksheetSetCellStylePermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr"))),t.id===x.UpdateSheetDataValidationRangeCommand.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint],worksheetTypes:[Q.WorksheetEditPermission,Q.WorksheetSetCellStylePermission]},t.params.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Vt=oa([de(0,o.Inject(o.LocaleService)),de(1,o.ICommandService),de(2,o.Inject(K.SheetPermissionInterceptorBaseController))],Vt);const ke="data-validation-single",Be="sheet.menu.data-validation";function ra(t){return{id:Be,type:tt.MenuItemType.SUBITEMS,icon:ke,tooltip:"dataValidation.title",hidden$:tt.getMenuHiddenObservable(t,o.UniverInstanceType.UNIVER_SHEET),disabled$:K.getCurrentRangeDisable$(t,{workbookTypes:[Q.WorkbookEditablePermission],worksheetTypes:[Q.WorksheetSetCellStylePermission,Q.WorksheetEditPermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint]})}}function sa(t){return{id:_t.id,title:"dataValidation.panel.title",type:tt.MenuItemType.BUTTON}}function la(t){return{id:kt.id,title:"dataValidation.panel.add",type:tt.MenuItemType.BUTTON}}const da={[tt.RibbonStartGroup.FORMULAS_INSERT]:{[Be]:{order:9,menuItemFactory:ra,[_t.id]:{order:0,menuItemFactory:sa},[kt.id]:{order:1,menuItemFactory:la}}}};var ca=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,We=(t,e,a,n)=>{for(var i=n>1?void 0:n?ua(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ca(e,a,i),i},rt=(t,e)=>(a,n)=>e(a,n,t);const He={tr:{size:6,color:"#fe4b4b"}};let bt=class extends o.RxDisposable{constructor(t,e,a,n,i,r,s,d,l,c,u){super(),this._commandService=t,this._menuManagerService=e,this._renderManagerService=a,this._univerInstanceService=n,this._autoHeightController=i,this._dropdownManagerService=r,this._sheetDataValidationModel=s,this._dataValidatorRegistryService=d,this._sheetInterceptorService=l,this._dataValidationCacheService=c,this._editorBridgeService=u,this._initMenu(),this._initDropdown(),this._initViewModelIntercept(),this._initAutoHeight()}_initMenu(){this._menuManagerService.mergeMenu(da)}_initDropdown(){this._editorBridgeService&&this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{var a;if(!t.visible){((a=this._dropdownManagerService.activeDropdown)==null?void 0:a.trigger)==="editor-bridge"&&this._dropdownManagerService.hideDropdown();return}const e=this._editorBridgeService.getEditCellState();if(e){const{unitId:n,sheetId:i,row:r,column:s}=e,d=this._univerInstanceService.getUniverSheetInstance(n);if(!d)return;const l=this._sheetDataValidationModel.getRuleByLocation(n,i,r,s);if(!l)return;const c=this._dataValidatorRegistryService.getValidatorItem(l.type);if(!(c!=null&&c.dropdown))return;const u=d.getActiveSheet();if(!u)return;const f=this._dropdownManagerService.activeDropdown,h=f==null?void 0:f.location;if(h&&h.unitId===n&&h.subUnitId===i&&h.row===r&&h.col===s)return;this._dropdownManagerService.showDropdown({location:{unitId:n,subUnitId:i,row:r,col:s,workbook:d,worksheet:u},componentKey:c.dropdown,onHide:()=>{},trigger:"editor-bridge"},!1)}}))}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(Q.INTERCEPTOR_POINT.CELL_CONTENT,{effect:o.InterceptorEffectEnum.Style,priority:Q.InterceptCellContentPriority.DATA_VALIDATION,handler:(t,e,a)=>{var b,E,I,F,L,P;const{row:n,col:i,unitId:r,subUnitId:s,workbook:d,worksheet:l}=e,c=this._sheetDataValidationModel.getRuleIdByLocation(r,s,n,i);if(!c)return a(t);const u=this._sheetDataValidationModel.getRuleById(r,s,c);if(!u)return a(t);const f=(E=(b=this._dataValidationCacheService.getValue(r,s,n,i))==null?void 0:b.status)!=null?E:o.DataValidationStatus.VALID,h=this._dataValidatorRegistryService.getValidatorItem(u.type),w=e.rawData;let v;const m={get value(){var y;return v!==void 0||(v=(y=x.getCellValueOrigin(w))!=null?y:null),v}},M={get value(){var y;return`${(y=m.value)!=null?y:""}`}};return a({...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h},markers:{...t==null?void 0:t.markers,...f===o.DataValidationStatus.INVALID?He:null},customRender:[...(I=t==null?void 0:t.customRender)!=null?I:[],...h!=null&&h.canvasRender?[h.canvasRender]:[]],fontRenderExtension:{...t==null?void 0:t.fontRenderExtension,isSkip:((F=t==null?void 0:t.fontRenderExtension)==null?void 0:F.isSkip)||((L=h==null?void 0:h.skipDefaultFontRender)==null?void 0:L.call(h,u,m.value,e))},interceptorStyle:{...t==null?void 0:t.interceptorStyle,...h==null?void 0:h.getExtraStyle(u,M.value,{get style(){const y=d.getStyles();return(typeof(t==null?void 0:t.s)=="string"?y.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}}})},interceptorAutoHeight:()=>{var U,R,H,X,C,S;const y=(R=(U=this._renderManagerService.getRenderById(r))==null?void 0:U.with(K.SheetSkeletonManagerService).getWorksheetSkeleton(s))==null?void 0:R.skeleton;if(!y)return;const j=y.worksheet.getMergedCell(n,i),k={data:{...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h}},style:y.getsStyles().getStyleByCell(t),primaryWithCoord:y.getCellByIndex((H=j==null?void 0:j.startRow)!=null?H:n,(X=j==null?void 0:j.startColumn)!=null?X:i),unitId:r,subUnitId:s,row:n,col:i,workbook:d,worksheet:l};return(S=(C=h==null?void 0:h.canvasRender)==null?void 0:C.calcCellAutoHeight)==null?void 0:S.call(C,k)},interceptorAutoWidth:()=>{var U,R,H,X,C,S;const y=(R=(U=this._renderManagerService.getRenderById(r))==null?void 0:U.with(K.SheetSkeletonManagerService).getWorksheetSkeleton(s))==null?void 0:R.skeleton;if(!y)return;const j=y.worksheet.getMergedCell(n,i),k={data:{...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h}},style:y.getsStyles().getStyleByCell(t),primaryWithCoord:y.getCellByIndex((H=j==null?void 0:j.startRow)!=null?H:n,(X=j==null?void 0:j.startColumn)!=null?X:i),unitId:r,subUnitId:s,row:n,col:i,workbook:d,worksheet:l};return(S=(C=h==null?void 0:h.canvasRender)==null?void 0:C.calcCellAutoWidth)==null?void 0:S.call(C,k)},coverable:((P=t==null?void 0:t.coverable)!=null?P:!0)&&!(u.type===o.DataValidationType.LIST||u.type===o.DataValidationType.LIST_MULTIPLE)})}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe(dt.filter(t=>t.source==="command"),dt.bufferTime(16)).subscribe(t=>{const e=[];if(t.forEach(a=>{var n;(n=a.rule)!=null&&n.ranges&&e.push(...a.rule.ranges)}),e.length){const a=this._autoHeightController.getUndoRedoParamsOfAutoHeight(e);o.sequenceExecute(a.redos,this._commandService)}})}};bt=We([rt(0,o.ICommandService),rt(1,tt.IMenuManagerService),rt(2,at.IRenderManagerService),rt(3,o.IUniverInstanceService),rt(4,o.Inject(K.AutoHeightController)),rt(5,o.Inject(gt)),rt(6,o.Inject(x.SheetDataValidationModel)),rt(7,o.Inject(ot.DataValidatorRegistryService)),rt(8,o.Inject(Q.SheetInterceptorService)),rt(9,o.Inject(x.DataValidationCacheService)),rt(10,o.Optional(K.IEditorBridgeService))],bt);let Ye=class extends o.RxDisposable{constructor(t,e,a,n,i,r,s){super(),this._commandService=t,this._renderManagerService=e,this._autoHeightController=a,this._dataValidatorRegistryService=n,this._sheetInterceptorService=i,this._sheetDataValidationModel=r,this._dataValidationCacheService=s,this._initViewModelIntercept(),this._initAutoHeight()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(Q.INTERCEPTOR_POINT.CELL_CONTENT,{effect:o.InterceptorEffectEnum.Style,priority:Q.InterceptCellContentPriority.DATA_VALIDATION,handler:(t,e,a)=>{var M,b,E,I,F,L;const{row:n,col:i,unitId:r,subUnitId:s,workbook:d,worksheet:l}=e,c=this._sheetDataValidationModel.getRuleIdByLocation(r,s,n,i);if(!c)return a(t);const u=this._sheetDataValidationModel.getRuleById(r,s,c);if(!u)return a(t);const f=(b=(M=this._dataValidationCacheService.getValue(r,s,n,i))==null?void 0:M.status)!=null?b:o.DataValidationStatus.VALID,h=this._dataValidatorRegistryService.getValidatorItem(u.type),w=l.getCellRaw(n,i),v=x.getCellValueOrigin(w),m=`${v!=null?v:""}`;return a({...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h},markers:{...t==null?void 0:t.markers,...f===o.DataValidationStatus.INVALID?He:null},customRender:[...(E=t==null?void 0:t.customRender)!=null?E:[],...h!=null&&h.canvasRender?[h.canvasRender]:[]],fontRenderExtension:{...t==null?void 0:t.fontRenderExtension,isSkip:((I=t==null?void 0:t.fontRenderExtension)==null?void 0:I.isSkip)||((F=h==null?void 0:h.skipDefaultFontRender)==null?void 0:F.call(h,u,v,e))},interceptorStyle:{...t==null?void 0:t.interceptorStyle,...h==null?void 0:h.getExtraStyle(u,m,{get style(){const P=d.getStyles();return(typeof(t==null?void 0:t.s)=="string"?P.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}}})},interceptorAutoHeight:()=>{var k,U,R,H,X,C;const P=(U=(k=this._renderManagerService.getRenderById(r))==null?void 0:k.with(K.SheetSkeletonManagerService).getWorksheetSkeleton(s))==null?void 0:U.skeleton;if(!P)return;const y=P.worksheet.getMergedCell(n,i),j={data:{...t,dataValidation:{ruleId:c,validStatus:f,rule:u,validator:h}},style:P.getsStyles().getStyleByCell(t),primaryWithCoord:P.getCellByIndex((R=y==null?void 0:y.startRow)!=null?R:n,(H=y==null?void 0:y.startColumn)!=null?H:i),unitId:r,subUnitId:s,row:n,col:i,workbook:d,worksheet:l};return(C=(X=h==null?void 0:h.canvasRender)==null?void 0:X.calcCellAutoHeight)==null?void 0:C.call(X,j)},coverable:((L=t==null?void 0:t.coverable)!=null?L:!0)&&!(u.type===o.DataValidationType.LIST||u.type===o.DataValidationType.LIST_MULTIPLE)})}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe(dt.filter(t=>t.source==="command"),dt.bufferTime(16)).subscribe(t=>{const e=[];if(t.forEach(a=>{var n;(n=a.rule)!=null&&n.ranges&&e.push(...a.rule.ranges)}),e.length){const a=this._autoHeightController.getUndoRedoParamsOfAutoHeight(e);o.sequenceExecute(a.redos,this._commandService)}})}};Ye=We([rt(0,o.ICommandService),rt(1,at.IRenderManagerService),rt(2,o.Inject(K.AutoHeightController)),rt(3,o.Inject(ot.DataValidatorRegistryService)),rt(4,o.Inject(Q.SheetInterceptorService)),rt(5,o.Inject(x.SheetDataValidationModel)),rt(6,o.Inject(x.DataValidationCacheService))],Ye);var ha=Object.defineProperty,fa=Object.getOwnPropertyDescriptor,pa=(t,e,a,n)=>{for(var i=n>1?void 0:n?fa(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ha(e,a,i),i},Xe=(t,e)=>(a,n)=>e(a,n,t);let Wt=class extends o.Disposable{constructor(t,e,a){super(),this._context=t,this._sheetDataValidationModel=e,this._sheetSkeletonManagerService=a,this._initSkeletonChange()}_initSkeletonChange(){const t=e=>{var n;if(!e.length)return;const a=new Set;e.forEach(i=>{a.add(i.subUnitId)}),a.forEach(i=>{var r;(r=this._sheetSkeletonManagerService.getWorksheetSkeleton(i))==null||r.skeleton.makeDirty(!0)}),(n=this._context.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(o.bufferDebounceTime(16)).subscribe(t))}};Wt=pa([Xe(1,o.Inject(x.SheetDataValidationModel)),Xe(2,o.Inject(K.SheetSkeletonManagerService))],Wt);const st={dataValidationFormula:"univer-data-validation-formula",dataValidationFormulaAnd:"univer-data-validation-formula-and",dataValidationFormulaListItem:"univer-data-validation-formula-list-item",dataValidationFormulaListItemIcon:"univer-data-validation-formula-list-item-icon",dataValidationFormulaListItemDrag:"univer-data-validation-formula-list-item-drag",dataValidationFormulaListAdd:"univer-data-validation-formula-list-add",dataValidationFormulaColorSelect:"univer-data-validation-formula-color-select",dataValidationFormulaColorSelectPanel:"univer-data-validation-formula-color-select-panel",dataValidationFormulaColorItem:"univer-data-validation-formula-color-item"},ma=t=>{const{isTwoFormula:e=!1,value:a,onChange:n,showError:i,validResult:r}=t,s=o.useDependency(o.LocaleService),d=i?r==null?void 0:r.formula1:"",l=i?r==null?void 0:r.formula2:"";return e?p.jsxs(p.Fragment,{children:[p.jsx(N.FormLayout,{error:d,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:s.t("dataValidation.panel.formulaPlaceholder"),value:a==null?void 0:a.formula1,onChange:c=>{n==null||n({...a,formula1:c})}})}),p.jsx("div",{className:st.dataValidationFormulaAnd,children:s.t("dataValidation.panel.formulaAnd")}),p.jsx(N.FormLayout,{error:l,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:s.t("dataValidation.panel.formulaPlaceholder"),value:a==null?void 0:a.formula2,onChange:c=>{n==null||n({...a,formula2:c})}})})]}):p.jsx(N.FormLayout,{error:d,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:s.t("dataValidation.panel.formulaPlaceholder"),value:a==null?void 0:a.formula1,onChange:c=>{n==null||n({formula1:c})}})})};function va(t){const{value:e,onChange:a,showError:n,validResult:i}=t,r=o.useDependency(o.LocaleService),s=n?i==null?void 0:i.formula1:"",d=n?i==null?void 0:i.formula2:"",[l,c]=V.useState(!((e==null?void 0:e.formula1)===void 0&&(e==null?void 0:e.formula2)===void 0));return p.jsxs(p.Fragment,{children:[p.jsx(N.FormLayout,{children:p.jsx(N.Checkbox,{checked:l,onChange:u=>{u?c(!0):(c(!1),a==null||a({...e,formula1:void 0,formula2:void 0}))},children:r.t("dataValidation.checkbox.tips")})}),l?p.jsx(N.FormLayout,{label:r.t("dataValidation.checkbox.checked"),error:s,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:r.t("dataValidation.panel.valuePlaceholder"),value:e==null?void 0:e.formula1,onChange:u=>{a==null||a({...e,formula1:u||void 0})}})}):null,l?p.jsx(N.FormLayout,{label:r.t("dataValidation.checkbox.unchecked"),error:d,children:p.jsx(N.Input,{className:st.dataValidationFormula,placeholder:r.t("dataValidation.panel.valuePlaceholder"),value:e==null?void 0:e.formula2,onChange:u=>{a==null||a({...e,formula2:u||void 0})}})}):null]})}function ga(t){var f;const{unitId:e,subUnitId:a,value:n,onChange:i,showError:r,validResult:s}=t,d=r?s==null?void 0:s.formula1:void 0,l=V.useRef({}),[c,u]=V.useState(!1);return tt.useSidebarClick(h=>{var v;const w=(v=l.current)==null?void 0:v.handleOutClick;w&&w(h,()=>u(!1))}),p.jsx(te.FormulaEditor,{initValue:(f=n==null?void 0:n.formula1)!=null?f:"",unitId:e,subUnitId:a,isFocus:c,onChange:(h="")=>{const w=h||"";i==null||i({...n,formula1:w.trim()})},errorText:d,onFocus:()=>u(!0),actions:l.current})}function ze(t){var e,a,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(a=ze(t[e]))&&(n&&(n+=" "),n+=a)}else for(a in t)t[a]&&(n&&(n+=" "),n+=a);return n}function Sa(){for(var t,e,a=0,n="",i=arguments.length;a<i;a++)(t=arguments[a])&&(e=ze(t))&&(n&&(n+=" "),n+=e);return n}const _a=["#FFFFFF","#FEE7E7","#FEF0E6","#EFFBD0","#E4F4FE","#E8ECFD","#F1EAFA","#FDE8F3","#E5E5E5","#FDCECE","#FDC49B","#DEF6A2","#9FDAFF","#D0D9FB","#E3D5F6","#FBD0E8","#656565","#FE4B4B","#FF8C51","#8BBB11","#0B9EFB","#3A60F7","#9E6DE3","#F248A6"],Ia=t=>{const{value:e,onChange:a,disabled:n}=t,[i,r]=V.useState(!1);return p.jsx(N.Select,{disabled:n,open:i,onDropdownVisibleChange:r,dropdownStyle:{width:112},className:st.dataValidationFormulaColorSelect,value:e,onChange:a,labelRender:s=>p.jsx("div",{className:st.dataValidationFormulaColorItem,style:{background:s.value,marginTop:5}}),dropdownRender:()=>p.jsx("div",{className:st.dataValidationFormulaColorSelectPanel,children:_a.map(s=>p.jsx("div",{onClick:()=>{a(s),r(!1)},className:st.dataValidationFormulaColorItem,style:{background:s}},s))})})},Ke=t=>{const{item:e,commonProps:a,style:n}=t,{onItemChange:i,onItemDelete:r}=a;return p.jsxs("div",{className:st.dataValidationFormulaListItem,style:n,children:[e.isRef?null:p.jsx("div",{className:Sa(st.dataValidationFormulaListItemDrag,"draggableHandle"),children:p.jsx(Ae,{})}),p.jsx(Ia,{value:e.color,onChange:s=>{i(e.id,e.label,s)}}),p.jsx(N.Input,{disabled:e.isRef,value:e.label,onChange:s=>{i(e.id,s,e.color)}}),e.isRef?null:p.jsx("div",{className:st.dataValidationFormulaListItemIcon,children:p.jsx(ee,{onClick:()=>r(e.id)})})]})};function Ca(t){const{value:e,onChange:a=()=>{},unitId:n,subUnitId:i,validResult:r,showError:s,ruleId:d}=t,{formula1:l="",formula2:c=""}=e||{},u=V.useRef(null),[f,h]=V.useState(()=>o.isFormulaString(l)?"1":"0"),[w,v]=V.useState(f==="1"?l:"="),[m,M]=V.useState(f==="1"?l:"="),b=o.useDependency(o.LocaleService),E=o.useDependency(ot.DataValidatorRegistryService),I=o.useDependency(ot.DataValidationModel),F=o.useDependency(x.DataValidationFormulaController),[L,P]=V.useState(()=>c.split(",")),y=E.getValidatorItem(o.DataValidationType.LIST),[j,k]=V.useState([]),[U,R]=V.useState(""),H=s?r==null?void 0:r.formula1:"",X=V.useMemo(()=>I.ruleChange$.pipe(dt.debounceTime(16)),[]),C=tt.useObservable(X),S=tt.useEvent(a);V.useEffect(()=>{(async()=>{await new Promise(W=>{setTimeout(()=>W(!0),100)});const O=I.getRuleById(n,i,d),z=O==null?void 0:O.formula1;if(o.isFormulaString(z)&&y&&O){const W=await y.getListAsync(O,n,i);k(W)}})()},[I,C,y,d,i,n]),V.useEffect(()=>{o.isFormulaString(l)&&l!==m&&(v(l),M(m))},[m,l]);const[g,D]=V.useState(()=>{const O=f!=="1"?x.deserializeListOptions(l):[],z=c.split(",");return O.map((W,Z)=>({label:W,color:z[Z]||It,isRef:!1,id:o.Tools.generateRandomId(4)}))}),_=(O,z,W)=>{const Z=g.find(lt=>lt.id===O);Z&&(Z.label=z,Z.color=W,D([...g]))},A=O=>{const z=g.findIndex(W=>W.id===O);z!==-1&&(g.splice(z,1),D([...g]))},T=c.split(","),Y=V.useMemo(()=>j.map((O,z)=>({label:O,color:T[z]||It,id:`${z}`,isRef:!0})),[T,j]),G=(O,z,W)=>{const Z=[...L];Z[+O]=W,P(Z),S({formula1:l,formula2:Z.join(",")})},J=()=>{D([...g,{label:"",color:It,isRef:!1,id:o.Tools.generateRandomId(4)}])};V.useEffect(()=>{if(f==="1")return;const O=new Set,z=[];g.map(W=>({labelList:W.label.split(","),item:W})).forEach(({item:W,labelList:Z})=>{Z.forEach(lt=>{O.has(lt)||(O.add(lt),z.push({label:lt,color:W.color}))})}),S({formula1:x.serializeListOptions(z.map(W=>W.label)),formula2:z.map(W=>W.color===It?"":W.color).join(",")})},[g,S,f,m,L]);const et=V.useMemo(()=>async O=>{if(!o.isFormulaString(O)){S==null||S({formula1:"",formula2:c});return}F.getFormulaRefCheck(O)?(S==null||S({formula1:o.isFormulaString(O)?O:"",formula2:c}),R("")):(S==null||S({formula1:"",formula2:c}),v("="),R(b.t("dataValidation.validFail.formulaError")))},[c,S]),nt=V.useRef({}),[it,$]=V.useState(!1);return tt.useSidebarClick(O=>{var W;const z=(W=nt.current)==null?void 0:W.handleOutClick;z&&z(O,()=>$(!1))}),p.jsxs(p.Fragment,{children:[p.jsx(N.FormLayout,{label:b.t("dataValidation.list.options"),children:p.jsxs(N.RadioGroup,{value:f,onChange:O=>{h(O),v(m),O==="1"&&S({formula1:m==="="?"":m,formula2:L.join(",")})},children:[p.jsx(N.Radio,{value:"0",children:b.t("dataValidation.list.customOptions")}),p.jsx(N.Radio,{value:"1",children:b.t("dataValidation.list.refOptions")})]})}),f==="1"?p.jsxs(p.Fragment,{children:[p.jsx(te.FormulaEditor,{initValue:w,unitId:n,subUnitId:i,isFocus:it,onChange:(O="")=>{const z=(O!=null?O:"").trim();M(z),et(z)},errorText:H||U||void 0,onFocus:()=>$(!0),actions:nt.current}),p.jsx(N.FormLayout,{children:p.jsx("div",{ref:u,children:Y.map(O=>p.jsx(Ke,{item:O,commonProps:{onItemChange:G},style:{marginBottom:12}},O.id))})})]}):p.jsx(N.FormLayout,{error:H,children:p.jsxs("div",{ref:u,style:{marginTop:"-12px"},children:[p.jsx(N.DraggableList,{list:g,onListChange:D,rowHeight:32,margin:[0,12],draggableHandle:".draggableHandle",itemRender:O=>p.jsx(Ke,{item:O,commonProps:{onItemChange:_,onItemDelete:A}},O.id),idKey:"id"}),p.jsxs("a",{className:st.dataValidationFormulaListAdd,onClick:J,children:[p.jsx(Te,{}),b.t("dataValidation.list.add")]})]})})]})}const Ge="data-validation.custom-formula-input",Ht="data-validation.formula-input",ce="data-validation.list-formula-input",Ze="data-validation.checkbox-formula-input",Da=[[Ge,ga],[Ht,ma],[ce,Ca],[Ze,va]],wa="LIST_RENDER_MODE_OPTION_INPUT";function Yt(t){var i;const{value:e,onChange:a}=t,n=o.useDependency(o.LocaleService);return p.jsx(N.FormLayout,{label:n.t("dataValidation.renderMode.label"),children:p.jsxs(N.RadioGroup,{value:`${(i=e.renderMode)!=null?i:o.DataValidationRenderMode.CUSTOM}`,onChange:r=>a({...e,renderMode:+r}),children:[p.jsx(N.Radio,{value:`${o.DataValidationRenderMode.CUSTOM}`,children:n.t("dataValidation.renderMode.chip")}),p.jsx(N.Radio,{value:`${o.DataValidationRenderMode.ARROW}`,children:n.t("dataValidation.renderMode.arrow")}),p.jsx(N.Radio,{value:`${o.DataValidationRenderMode.TEXT}`,children:n.t("dataValidation.renderMode.text")})]})})}Yt.componentKey=wa;const ya="DATE_SHOW_TIME_OPTION";function Xt(t){var i;const{value:e,onChange:a}=t,n=o.useDependency(o.LocaleService);return p.jsx(N.FormLayout,{children:p.jsx(N.Checkbox,{checked:(i=e.bizInfo)==null?void 0:i.showTime,onChange:r=>{a({...e,bizInfo:{...e.bizInfo,showTime:r}})},children:n.t("dataValidation.showTime.label")})})}Xt.componentKey=ya;var Ma=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,ba=(t,e,a,n)=>{for(var i=n>1?void 0:n?Va(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Ma(e,a,i),i},ue=(t,e)=>(a,n)=>e(a,n,t);const zt=6;let he=class{constructor(t,e,a){this._commandService=t,this._formulaService=e,this._themeService=a}_calc(t,e){var c,u,f;const{vt:a,ht:n}=e||{},i=t.endX-t.startX-zt*2,r=t.endY-t.startY,s=((c=e==null?void 0:e.fs)!=null?c:10)*1.6;let d=0,l=0;switch(a){case o.VerticalAlign.TOP:l=0;break;case o.VerticalAlign.BOTTOM:l=0+(r-s);break;default:l=0+(r-s)/2;break}switch(n){case o.HorizontalAlign.LEFT:d=zt;break;case o.HorizontalAlign.RIGHT:d=zt+(i-s);break;default:d=zt+(i-s)/2;break}return{left:t.startX+d,top:t.startY+l,width:((u=e==null?void 0:e.fs)!=null?u:10)*1.6,height:((f=e==null?void 0:e.fs)!=null?f:10)*1.6}}calcCellAutoHeight(t){var a;const{style:e}=t;return((a=e==null?void 0:e.fs)!=null?a:10)*1.6}calcCellAutoWidth(t){var a;const{style:e}=t;return((a=e==null?void 0:e.fs)!=null?a:10)*1.6}async _parseFormula(t,e,a){var c,u,f;const{formula1:n=x.CHECKBOX_FORMULA_1,formula2:i=x.CHECKBOX_FORMULA_2}=t,r=await this._formulaService.getRuleFormulaResult(e,a,t.uid),s=x.getFormulaResult((c=r==null?void 0:r[0])==null?void 0:c.result),d=x.getFormulaResult((u=r==null?void 0:r[1])==null?void 0:u.result),l=x.isLegalFormulaResult(String(s))&&x.isLegalFormulaResult(String(d));return{formula1:o.isFormulaString(n)?x.getFormulaResult((f=r==null?void 0:r[0])==null?void 0:f.result):n,formula2:o.isFormulaString(i)?d:i,isFormulaValid:l}}drawWith(t,e){var X,C,S,g,D,_;const{style:a,data:n,primaryWithCoord:i,unitId:r,subUnitId:s,worksheet:d,row:l,col:c}=e,u=i.isMergedMainCell?i.mergeInfo:i,f=x.getCellValueOrigin(d.getCellRaw(l,c)),h=(X=n.dataValidation)==null?void 0:X.rule,w=(C=n.dataValidation)==null?void 0:C.validator;if(!h||!w)return;const v=this._themeService.getCurrentTheme();if(!((S=w.skipDefaultFontRender)!=null&&S.call(w,h,f,{unitId:r,subUnitId:s})))return;const m=w.parseFormulaSync(h,r,s),{formula1:M}=m,b=this._calc(u,a),{a:E,d:I}=t.getTransform(),F=at.fixLineWidthByScale(b.left,E),L=at.fixLineWidthByScale(b.top,I),P=at.Transform.create().composeMatrix({left:F,top:L,scaleX:1,scaleY:1,angle:0,skewX:0,skewY:0,flipX:!1,flipY:!1}),y=u.endX-u.startX,j=u.endY-u.startY;t.save(),t.beginPath(),t.rect(u.startX,u.startY,y,j),t.clip();const k=P.getMatrix();t.transform(k[0],k[1],k[2],k[3],k[4],k[5]);const U=((g=a==null?void 0:a.fs)!=null?g:10)*1.6,R=String(f)===String(M),H=v.hyacinth500;at.Checkbox.drawWith(t,{checked:R,width:U,height:U,fill:(_=(D=a==null?void 0:a.cl)==null?void 0:D.rgb)!=null?_:H}),t.restore()}isHit(t,e){const a=e.primaryWithCoord.isMergedMainCell?e.primaryWithCoord.mergeInfo:e.primaryWithCoord,n=this._calc(a,e.style),i=n.top,r=n.top+n.height,s=n.left,d=n.left+n.width,{x:l,y:c}=t;return l<=d&&l>=s&&c<=r&&c>=i}async onPointerDown(t,e){var m,M,b;if(e.button===2)return;const{primaryWithCoord:a,unitId:n,subUnitId:i,data:r,worksheet:s,row:d,col:l}=t,c=x.getCellValueOrigin(s.getCellRaw(d,l)),u=(m=r.dataValidation)==null?void 0:m.rule,f=(M=r.dataValidation)==null?void 0:M.validator;if(!u||!f||!((b=f.skipDefaultFontRender)!=null&&b.call(f,u,c,{unitId:n,subUnitId:i})))return;const{formula1:h,formula2:w}=await this._parseFormula(u,n,i),v={range:{startColumn:a.actualColumn,endColumn:a.actualColumn,startRow:a.actualRow,endRow:a.actualRow},value:{v:String(c)===x.transformCheckboxValue(String(h))?w:h,p:null}};this._commandService.executeCommand(Q.SetRangeValuesCommand.id,v)}};he=ba([ue(0,o.ICommandService),ue(1,o.Inject(x.DataValidationFormulaService)),ue(2,o.Inject(o.ThemeService))],he);var Ea=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Oa=(t,e,a,n)=>{for(var i=n>1?void 0:n?Ra(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&Ea(e,a,i),i},La=(t,e)=>(a,n)=>e(a,n,t);let ft=class{constructor(t){B(this,"canvasRender",null);B(this,"dropdown");B(this,"optionsInput");B(this,"formulaInput",ce);this.injector=t}};ft=Oa([La(0,o.Inject(o.Injector))],ft);class Ta extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.CHECKBOX);B(this,"canvasRender",this.injector.createInstance(he));B(this,"formulaInput",Ze)}}class Pa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.CUSTOM);B(this,"formulaInput",Ge)}}const ja="data-validation.formula-input";class Aa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.DATE);B(this,"formulaInput",ja);B(this,"optionsInput",Xt.componentKey);B(this,"dropdown",re)}}class $a extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.DECIMAL);B(this,"formulaInput",Ht)}}const qe=4,Fa=0,fe=4,Je=4,pe=6,Kt=6,Ct=14;function xa(t,e){const a=at.FontCache.getTextSize(t,e),n=a.width+qe*2,{ba:i,bd:r}=a,s=i+r;return{width:n,height:s+Fa*2,ba:i}}function me(t,e,a,n){const i=Ct+pe*2,r=a-i,s=n-Kt*2,d=t.map(h=>({layout:xa(h,e),text:h}));let l;const c=[];d.forEach(h=>{const{layout:w}=h,{width:v,height:m}=w;!l||l.width+v+fe>r?(l={width:v,height:m,items:[{...h,left:0}]},c.push(l)):(l.items.push({...h,left:l.width+fe}),l.width=l.width+v+fe)});let u=0,f=0;return c.forEach((h,w)=>{f=Math.max(f,h.width),w===c.length-1?u+=h.height:u+=h.height+Je}),{lines:c,totalHeight:u,contentWidth:r,contentHeight:s,cellAutoHeight:u+Kt*2,calcAutoWidth:f+i}}const Na=8;class Ua extends at.Shape{static drawWith(e,a){const{fontString:n,info:i,fill:r,color:s}=a,{layout:d,text:l}=i;e.save(),at.Rect.drawWith(e,{width:d.width,height:d.height,radius:Na,fill:r||It}),e.translateWithPrecision(qe,d.ba),e.font=n,e.fillStyle=s,e.fillText(l,0,0),e.restore()}}var ka=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,Wa=(t,e,a,n)=>{for(var i=n>1?void 0:n?Ba(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ka(e,a,i),i},Ha=(t,e)=>(a,n)=>e(a,n,t);const Ya=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 ve=class{constructor(t){B(this,"zIndex");B(this,"_dropdownInfoMap",new Map);this._commandService=t}_ensureMap(t){let e=this._dropdownInfoMap.get(t);return e||(e=new Map,this._dropdownInfoMap.set(t,e)),e}_generateKey(t,e){return`${t}.${e}`}_drawDownIcon(t,e,a,n,i){const r=a-Ct+4;let s=4;switch(i){case o.VerticalAlign.MIDDLE:s=(n-Ct)/2+4;break;case o.VerticalAlign.BOTTOM:s=n-Ct+4;break}t.save(),t.translateWithPrecision(e.startX+r,e.startY+s),t.fillStyle="#565656",t.fill(Ya),t.restore()}drawWith(t,e,a,n){var T,Y;const{primaryWithCoord:i,row:r,col:s,style:d,data:l,subUnitId:c}=e,u=i.isMergedMainCell?i.mergeInfo:i,f=l.fontRenderExtension,{leftOffset:h=0,rightOffset:w=0,topOffset:v=0,downOffset:m=0}=f||{},M=l.dataValidation,b=this._ensureMap(c),E=this._generateKey(r,s);if(!M)return;const I={startX:u.startX+h,endX:u.endX-w,startY:u.startY+v,endY:u.endY-m},F=I.endX-I.startX,L=I.endY-I.startY,{cl:P}=d||{},y=(T=typeof P=="object"?P==null?void 0:P.rgb:P)!=null?T:"#000",j=at.getFontStyleString(d!=null?d:void 0),{rule:k,validator:U}=M,R=U,{vt:H,ht:X}=d||{},C=H!=null?H:o.VerticalAlign.MIDDLE,S=(Y=x.getCellValueOrigin(l))!=null?Y:"",g=R.parseCellValue(S),D=R.getListWithColorMap(k),_=me(g,j,F,L);this._drawDownIcon(t,I,F,L,C),t.save(),t.translateWithPrecision(I.startX,I.startY),t.beginPath(),t.rect(0,0,F-Ct,L),t.clip(),t.translateWithPrecision(pe,Kt);let A=0;switch(C){case o.VerticalAlign.MIDDLE:A=(_.contentHeight-_.totalHeight)/2;break;case o.VerticalAlign.BOTTOM:A=_.contentHeight-_.totalHeight;break}t.translateWithPrecision(0,A),_.lines.forEach((G,J)=>{t.save();const{width:et,height:nt,items:it}=G;let $=0;switch(X){case o.HorizontalAlign.RIGHT:$=_.contentWidth-et;break;case o.HorizontalAlign.CENTER:$=(_.contentWidth-et)/2;break}t.translate($,J*(nt+Je)),it.forEach(O=>{t.save(),t.translateWithPrecision(O.left,0),Ua.drawWith(t,{...j,info:O,color:y,fill:D[O.text]}),t.restore()}),t.restore()}),t.restore(),b.set(E,{left:I.startX,top:I.startY,width:_.contentWidth+pe+Ct,height:_.contentHeight+Kt*2})}calcCellAutoHeight(t){var F;const{primaryWithCoord:e,style:a,data:n}=t,i=n.fontRenderExtension,{leftOffset:r=0,rightOffset:s=0,topOffset:d=0,downOffset:l=0}=i||{},c=e.isMergedMainCell?e.mergeInfo:e,u={startX:c.startX+r,endX:c.endX-s,startY:c.startY+d,endY:c.endY-l},f=n.dataValidation;if(!f)return;const h=u.endX-u.startX,w=u.endY-u.startY,v=(F=x.getCellValueOrigin(n))!=null?F:"",{validator:m}=f,b=m.parseCellValue(v),E=at.getFontStyleString(a!=null?a:void 0);return me(b,E,h,w).cellAutoHeight}calcCellAutoWidth(t){var F;const{primaryWithCoord:e,style:a,data:n}=t,i=n.fontRenderExtension,{leftOffset:r=0,rightOffset:s=0,topOffset:d=0,downOffset:l=0}=i||{},c=e.isMergedMainCell?e.mergeInfo:e,u={startX:c.startX+r,endX:c.endX-s,startY:c.startY+d,endY:c.endY-l},f=n.dataValidation;if(!f)return;const h=u.endX-u.startX,w=u.endY-u.startY,v=(F=x.getCellValueOrigin(n))!=null?F:"",{validator:m}=f,b=m.parseCellValue(v),E=at.getFontStyleString(a!=null?a:void 0);return me(b,E,h,w).calcAutoWidth}isHit(t,e){const{primaryWithCoord:a}=e,n=a.isMergedMainCell?a.mergeInfo:a,{endX:i}=n,{x:r}=t;return r>=i-Ct&&r<=i}onPointerDown(t,e){if(e.button===2)return;const{unitId:a,subUnitId:n,row:i,col:r}=t,s={unitId:a,subUnitId:n,row:i,column:r};this._commandService.executeCommand(Ft.id,s)}};ve=Wa([Ha(0,o.ICommandService)],ve);class Xa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.LIST_MULTIPLE);B(this,"canvasRender",this.injector.createInstance(ve));B(this,"dropdown",Ut)}}var za=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,Ga=(t,e,a,n)=>{for(var i=n>1?void 0:n?Ka(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&za(e,a,i),i},Qe=(t,e)=>(a,n)=>e(a,n,t);const Dt=4,Gt=4,ut=14,pt=6,Et=4,ge=8,Za="#565656",tn=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 qa(t,e){const a=t.length;return{id:"d",body:{dataStream:`${t}${o.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[{ts:{fs:11,ff:void 0,it:o.BooleanNumber.FALSE,bl:o.BooleanNumber.FALSE,ul:{s:o.BooleanNumber.FALSE},st:{s:o.BooleanNumber.FALSE},ol:{s:o.BooleanNumber.FALSE},cl:void 0,...e,bg:void 0,bd:void 0},st:0,ed:a}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}}}}function en(t,e,a){const n=qa(t,a),i=new o.DocumentDataModel(n),r=new at.DocumentViewModel(i);return{documentSkeleton:at.DocumentSkeleton.create(r,e),docModel:i,docViewModel:r}}function Zt(t,e,a){const{documentSkeleton:n,docModel:i,docViewModel:r}=en(t,e,a);return{documents:new at.Documents(`DOCUMENTS_${o.Tools.generateRandomId()}`,n,{pageMarginLeft:0,pageMarginTop:0}),documentSkeleton:n,docModel:i,docViewModel:r}}function nn(t,e,a,n,i,r,s=!0){let d=0;const l=s?Et:0;switch(i){case o.VerticalAlign.BOTTOM:d=e-n-l;break;case o.VerticalAlign.MIDDLE:d=(e-n)/2;break;default:d=l;break}d=Math.max(Et,d);let c=0;switch(r){case o.HorizontalAlign.CENTER:c=(t-a)/2;break;case o.HorizontalAlign.RIGHT:c=t-a;break}return c=Math.max(pt,c),{paddingLeft:c,paddingTop:d}}let Se=class{constructor(t,e){B(this,"_dropdownInfoMap",new Map);B(this,"zIndex");B(this,"onPointerEnter");B(this,"onPointerLeave");this._localeService=t,this._commandService=e}_ensureMap(t){let e=this._dropdownInfoMap.get(t);return e||(e=new Map,this._dropdownInfoMap.set(t,e)),e}_generateKey(t,e){return`${t}.${e}`}_drawDownIcon(t,e,a,n,i,r,s){const{t:d=o.DEFAULT_STYLES.pd.t,b:l=o.DEFAULT_STYLES.pd.b}=s,c=a-ut;let u;switch(r){case o.VerticalAlign.MIDDLE:u=(n-Gt)/2;break;case o.VerticalAlign.BOTTOM:u=n-l-i-Et+(i/2-Gt/2);break;default:u=d+Et+(i/2-Gt/2);break}t.save(),t.translateWithPrecision(e.startX+c,e.startY+u),t.fillStyle="#565656",t.fill(tn),t.restore()}drawWith(t,e,a){var C,S;const{primaryWithCoord:n,row:i,col:r,style:s,data:d,subUnitId:l}=e,c=n.isMergedMainCell?n.mergeInfo:n,u=(C=d.dataValidation)==null?void 0:C.rule,f=(S=d.dataValidation)==null?void 0:S.validator,h=d.fontRenderExtension,{leftOffset:w=0,rightOffset:v=0,topOffset:m=0,downOffset:M=0}=h||{};if(!u||!f||!f||f.id.indexOf(o.DataValidationType.LIST)!==0||!f.skipDefaultFontRender(u))return;const b={startX:c.startX+w,endX:c.endX-v,startY:c.startY+m,endY:c.endY-M},E=b.endX-b.startX,I=b.endY-b.startY,F=this._ensureMap(l),L=this._generateKey(i,r),P=f.getListWithColor(u),y=x.getCellValueOrigin(d),j=`${y!=null?y:""}`,k=P.find(g=>g.label===j);let{tb:U,vt:R,ht:H,pd:X}=s||{};if(U=U!=null?U:o.WrapStrategy.WRAP,R=R!=null?R:o.VerticalAlign.BOTTOM,H=H!=null?H:o.DEFAULT_STYLES.ht,X=X!=null?X:o.DEFAULT_STYLES.pd,u.renderMode===o.DataValidationRenderMode.ARROW){const{l:g=o.DEFAULT_STYLES.pd.l,t:D=o.DEFAULT_STYLES.pd.t,r:_=o.DEFAULT_STYLES.pd.r,b:A=o.DEFAULT_STYLES.pd.b}=X,T=E-g-_-ut-4,{documentSkeleton:Y,documents:G,docModel:J}=Zt(j,this._localeService,s);U===o.WrapStrategy.WRAP&&J.updateDocumentDataPageSize(Math.max(T,1)),Y.calculate(),Y.getActualSize();const et=at.getDocsSkeletonPageSize(Y),{height:nt,width:it}=et,{paddingTop:$,paddingLeft:O}=nn(T,I-D-A,it,nt,R,H,!0);this._drawDownIcon(t,b,E,I,nt,R,X),t.save(),t.translateWithPrecision(b.startX+g,b.startY+D),t.beginPath(),t.rect(0,0,E-g-_,I-D-A),t.clip(),t.translateWithPrecision(0,$),t.save(),t.translateWithPrecision(Dt,0),t.beginPath(),t.rect(0,0,T,nt),t.clip(),G.render(t),t.translateWithPrecision(O,0),t.restore(),t.restore(),F.set(L,{left:b.endX+g+a.rowHeaderWidth-ut,top:b.startY+D+a.columnHeaderHeight,width:ut,height:I-D-A})}else{t.save(),t.translateWithPrecision(b.startX,b.startY),t.beginPath(),t.rect(0,0,E,I),t.clip();const g=E-pt*2-Dt-ut-4,{documentSkeleton:D,documents:_,docModel:A}=Zt(j,this._localeService,s);U===o.WrapStrategy.WRAP&&A.updateDocumentDataPageSize(Math.max(g,1)),D.calculate();const T=at.getDocsSkeletonPageSize(D),{height:Y,width:G}=T,{paddingTop:J,paddingLeft:et}=nn(g,I,G,Y,R,H);t.translateWithPrecision(pt,J);const nt=Math.max(E-pt*2,1),it=Y;at.Rect.drawWith(t,{width:nt,height:it,fill:(k==null?void 0:k.color)||It,radius:ge}),t.save(),t.translateWithPrecision(Dt,0),t.beginPath(),t.rect(0,0,g,Y),t.clip(),t.translateWithPrecision(et,0),_.render(t),t.restore(),t.translateWithPrecision(g+Dt+4,(Y-Gt)/2),t.fillStyle=Za,t.fill(tn),t.restore(),F.set(L,{left:b.startX+pt+a.rowHeaderWidth,top:b.startY+J+a.columnHeaderHeight,width:nt,height:it})}}calcCellAutoHeight(t){var I;const{primaryWithCoord:e,style:a,data:n}=t,i=e.isMergedMainCell?e.mergeInfo:e,r=n.fontRenderExtension,{leftOffset:s=0,rightOffset:d=0,topOffset:l=0,downOffset:c=0}=r||{},u=(I=n.dataValidation)==null?void 0:I.rule;if(!u||u.renderMode===o.DataValidationRenderMode.TEXT)return;const f={startX:i.startX+s,endX:i.endX-d,startY:i.startY+l,endY:i.endY-c},h=f.endX-f.startX,w=x.getCellValueOrigin(n),v=`${w!=null?w:""}`;let{tb:m,pd:M}=a||{};const{t:b=o.DEFAULT_STYLES.pd.t,b:E=o.DEFAULT_STYLES.pd.b}=M!=null?M:{};if(m=m!=null?m:o.WrapStrategy.WRAP,u.renderMode===o.DataValidationRenderMode.ARROW){const F=h-ut,{documentSkeleton:L,docModel:P}=Zt(v,this._localeService,a);m===o.WrapStrategy.WRAP&&P.updateDocumentDataPageSize(Math.max(F,1)),L.calculate(),L.getActualSize();const y=at.getDocsSkeletonPageSize(L),{height:j}=y;return j+b+E+Et*2}else{const F=h-pt*2-Dt-ut,{documentSkeleton:L,docModel:P}=en(v,this._localeService,a);m===o.WrapStrategy.WRAP&&P.updateDocumentDataPageSize(Math.max(F,1)),L.calculate();const y=at.getDocsSkeletonPageSize(L),{height:j}=y;return j+Et*2}}calcCellAutoWidth(t){var j;const{primaryWithCoord:e,style:a,data:n}=t,i=e.isMergedMainCell?e.mergeInfo:e,r=n.fontRenderExtension,{leftOffset:s=0,rightOffset:d=0,topOffset:l=0,downOffset:c=0}=r||{},u=(j=n.dataValidation)==null?void 0:j.rule;if(!u||u.renderMode===o.DataValidationRenderMode.TEXT)return;const f={startX:i.startX+s,endX:i.endX-d,startY:i.startY+l,endY:i.endY-c},h=f.endX-f.startX,w=x.getCellValueOrigin(n),v=`${w!=null?w:""}`;let{tb:m,pd:M}=a||{};const{l:b=o.DEFAULT_STYLES.pd.l,r:E=o.DEFAULT_STYLES.pd.r}=M!=null?M:{};m=m!=null?m:o.WrapStrategy.WRAP;let I=pt*2+ut;switch(u.renderMode){case o.DataValidationRenderMode.ARROW:I=ut+pt*2+E+b;break;case o.DataValidationRenderMode.CUSTOM:I=ut+pt*2+Dt*2+E+b+ge/2+1;break;default:I=ut+pt*2+Dt*2+E+b+ge/2+1}const F=h-I,{documentSkeleton:L,docModel:P}=Zt(v,this._localeService,a);return m===o.WrapStrategy.WRAP&&P.updateDocumentDataPageSize(Math.max(F,1)),L.calculate(),L.getActualSize(),at.getDocsSkeletonPageSize(L).width+I}isHit(t,e){const{data:a,subUnitId:n,row:i,col:r}=e,d=this._ensureMap(n).get(this._generateKey(i,r)),l=a.dataValidation;if(!l||!d||l.rule.renderMode===o.DataValidationRenderMode.TEXT)return!1;const{top:c,left:u,width:f,height:h}=d,{x:w,y:v}=t;return w>=u&&w<=u+f&&v>=c&&v<=c+h}onPointerDown(t,e){if(e.button===2)return;const{unitId:a,subUnitId:n,row:i,col:r}=t,s={unitId:a,subUnitId:n,row:i,column:r};this._commandService.executeCommand(Ft.id,s)}};Se=Ga([Qe(0,o.Inject(o.LocaleService)),Qe(1,o.ICommandService)],Se);class Ja extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.LIST);B(this,"canvasRender",this.injector.createInstance(Se));B(this,"dropdown",Ut);B(this,"optionsInput",Yt.componentKey);B(this,"formulaInput",ce)}}class Qa extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.TEXT_LENGTH);B(this,"formulaInput",Ht)}}class ti extends ft{constructor(){super(...arguments);B(this,"id",o.DataValidationType.WHOLE);B(this,"formulaInput",Ht)}}var ei=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,ai=(t,e,a,n)=>{for(var i=n>1?void 0:n?ni(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ei(e,a,i),i},_e=(t,e)=>(a,n)=>e(a,n,t);let Rt=class extends o.RxDisposable{constructor(t,e,a){super(),this._injector=t,this._componentManger=e,this._dataValidatorRegistryService=a,this._initComponents(),this._registerValidatorViews()}_initComponents(){[[ke,Le],[ne,zn],[Fe,jn],[Ut,Nn],[re,_n],[Yt.componentKey,Yt],[Xt.componentKey,Xt],...Da].forEach(([t,e])=>{this.disposeWithMe(this._componentManger.register(t,e))})}_registerValidatorViews(){[$a,ti,Qa,Aa,Ta,Ja,Xa,Pa].forEach(t=>{const e=this._injector.createInstance(t),a=this._dataValidatorRegistryService.getValidatorItem(e.id);a&&(a.formulaInput=e.formulaInput,a.canvasRender=e.canvasRender,a.dropdown=e.dropdown,a.optionsInput=e.optionsInput)})}};Rt=ai([_e(0,o.Inject(o.Injector)),_e(1,o.Inject(tt.ComponentManager)),_e(2,o.Inject(ot.DataValidatorRegistryService))],Rt);var ii=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,ri=(t,e,a,n)=>{for(var i=n>1?void 0:n?oi(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&ii(e,a,i),i},Ie=(t,e)=>(a,n)=>e(a,n,t);const si="SHEET_DATA_VALIDATION_UI_PLUGIN";q.UniverSheetsDataValidationUIPlugin=(qt=class extends o.Plugin{constructor(e=Ue,a,n,i){super(),this._config=e,this._injector=a,this._commandService=n,this._configService=i;const{menu:r,...s}=this._config;r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(ie,s)}onStarting(){[[ht],[gt],[jt],[yt],[bt],[Vt],[Mt],[Tt],[Rt]].forEach(e=>{this._injector.add(e)}),[kt,Ft,Ne,ae,_t,xe].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(Mt),this._injector.get(Vt),this._injector.get(Tt),this._injector.get(jt),this._injector.get(at.IRenderManagerService).registerRenderModule(o.UniverInstanceType.UNIVER_SHEET,[Wt])}onRendered(){this._injector.get(Rt),this._injector.get(bt)}onSteady(){this._injector.get(yt)}},B(qt,"pluginName",si),B(qt,"type",o.UniverInstanceType.UNIVER_SHEET),qt),q.UniverSheetsDataValidationUIPlugin=ri([Ie(1,o.Inject(o.Injector)),Ie(2,o.ICommandService),Ie(3,o.IConfigService)],q.UniverSheetsDataValidationUIPlugin);var li=Object.defineProperty,di=Object.getOwnPropertyDescriptor,ci=(t,e,a,n)=>{for(var i=n>1?void 0:n?di(e,a):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,a,i):s(i))||i);return n&&i&&li(e,a,i),i},Ce=(t,e)=>(a,n)=>e(a,n,t);const ui="SHEET_DATA_VALIDATION_UI_PLUGIN";q.UniverSheetsDataValidationMobileUIPlugin=(Jt=class extends o.Plugin{constructor(e=Ue,a,n,i){super(),this._config=e,this._injector=a,this._commandService=n,this._configService=i;const{menu:r,...s}=this._config;r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(ie,s)}onStarting(){[[ht],[gt],[jt],[yt],[bt],[Vt],[Mt],[Rt]].forEach(e=>{this._injector.add(e)}),[kt,Ft,Ne,ae,_t,xe].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(Mt),this._injector.get(Vt),this._injector.get(at.IRenderManagerService).registerRenderModule(o.UniverInstanceType.UNIVER_SHEET,[Wt])}onRendered(){this._injector.get(Rt),this._injector.get(bt)}onSteady(){this._injector.get(yt)}},B(Jt,"pluginName",ui),B(Jt,"type",o.UniverInstanceType.UNIVER_SHEET),Jt),q.UniverSheetsDataValidationMobileUIPlugin=ci([Ce(1,o.Inject(o.Injector)),Ce(2,o.ICommandService),Ce(3,o.IConfigService)],q.UniverSheetsDataValidationMobileUIPlugin),q.DATE_DROPDOWN_KEY=re,q.LIST_DROPDOWN_KEY=Ut,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@univerjs/sheets-data-validation-ui",
|
3
|
-
"version": "0.4.2-nightly.
|
3
|
+
"version": "0.4.2-nightly.202411051606",
|
4
4
|
"private": false,
|
5
5
|
"description": "Data validation UI for Univer Sheets",
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
@@ -52,23 +52,23 @@
|
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
54
|
"@flatten-js/interval-tree": "^1.1.3",
|
55
|
-
"@univerjs/icons": "^0.2.
|
55
|
+
"@univerjs/icons": "^0.2.3",
|
56
56
|
"@univerjs/protocol": "0.1.39-alpha.38",
|
57
57
|
"clsx": "^2.1.1",
|
58
58
|
"dayjs": "^1.11.13",
|
59
|
-
"@univerjs/core": "0.4.2-nightly.
|
60
|
-
"@univerjs/data-validation": "0.4.2-nightly.
|
61
|
-
"@univerjs/design": "0.4.2-nightly.
|
62
|
-
"@univerjs/docs": "0.4.2-nightly.
|
63
|
-
"@univerjs/
|
64
|
-
"@univerjs/
|
65
|
-
"@univerjs/sheets
|
66
|
-
"@univerjs/engine-
|
67
|
-
"@univerjs/sheets-
|
68
|
-
"@univerjs/sheets": "0.4.2-nightly.
|
69
|
-
"@univerjs/sheets-numfmt": "0.4.2-nightly.
|
70
|
-
"@univerjs/sheets-ui": "0.4.2-nightly.
|
71
|
-
"@univerjs/ui": "0.4.2-nightly.
|
59
|
+
"@univerjs/core": "0.4.2-nightly.202411051606",
|
60
|
+
"@univerjs/data-validation": "0.4.2-nightly.202411051606",
|
61
|
+
"@univerjs/design": "0.4.2-nightly.202411051606",
|
62
|
+
"@univerjs/docs": "0.4.2-nightly.202411051606",
|
63
|
+
"@univerjs/docs-ui": "0.4.2-nightly.202411051606",
|
64
|
+
"@univerjs/engine-formula": "0.4.2-nightly.202411051606",
|
65
|
+
"@univerjs/sheets": "0.4.2-nightly.202411051606",
|
66
|
+
"@univerjs/engine-render": "0.4.2-nightly.202411051606",
|
67
|
+
"@univerjs/sheets-data-validation": "0.4.2-nightly.202411051606",
|
68
|
+
"@univerjs/sheets-formula-ui": "0.4.2-nightly.202411051606",
|
69
|
+
"@univerjs/sheets-numfmt": "0.4.2-nightly.202411051606",
|
70
|
+
"@univerjs/sheets-ui": "0.4.2-nightly.202411051606",
|
71
|
+
"@univerjs/ui": "0.4.2-nightly.202411051606"
|
72
72
|
},
|
73
73
|
"devDependencies": {
|
74
74
|
"less": "^4.2.0",
|