@univerjs/sheets-conditional-formatting-ui 1.0.0 → 1.0.2
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/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +13 -13
- package/lib/types/components/color-picker/index.d.ts +0 -25
- package/lib/types/components/conditional-style-editor/index.d.ts +0 -23
- package/lib/types/components/panel/index.d.ts +0 -21
- package/lib/types/components/panel/rule-edit/ColorScale.d.ts +0 -17
- package/lib/types/components/panel/rule-edit/DataBar.d.ts +0 -17
- package/lib/types/components/panel/rule-edit/Formula.d.ts +0 -17
- package/lib/types/components/panel/rule-edit/HighlightCell.d.ts +0 -18
- package/lib/types/components/panel/rule-edit/IconSet.d.ts +0 -18
- package/lib/types/components/panel/rule-edit/Rank.d.ts +0 -17
- package/lib/types/components/panel/rule-edit/index.d.ts +0 -22
- package/lib/types/components/panel/rule-edit/styles.d.ts +0 -16
- package/lib/types/components/panel/rule-edit/type.d.ts +0 -27
- package/lib/types/components/panel/rule-list/index.d.ts +0 -22
- package/lib/types/components/preview/index.d.ts +0 -19
- package/lib/types/components/wrapper-error/WrapperError.d.ts +0 -20
package/lib/cjs/index.js
CHANGED
package/lib/es/index.js
CHANGED
package/lib/index.js
CHANGED
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("rxjs/operators"),require("@univerjs/engine-render"),require("@univerjs/sheets-formula"),require("@univerjs/sheets-formula-ui"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`@univerjs/sheets-conditional-formatting`,`@univerjs/ui`,`@univerjs/sheets-ui`,`rxjs`,`rxjs/operators`,`@univerjs/engine-render`,`@univerjs/sheets-formula`,`@univerjs/sheets-formula-ui`,`react`,`@univerjs/design`,`@univerjs/engine-formula`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsConditionalFormattingUi={},e.UniverCore,e.UniverSheets,e.UniverSheetsConditionalFormatting,e.UniverUi,e.UniverSheetsUi,e.rxjs,e.rxjs.operators,e.UniverEngineRender,e.UniverSheetsFormula,e.UniverSheetsFormulaUi,e.React,e.UniverDesign,e.UniverEngineFormula,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let h={type:t.CommandType.COMMAND,id:`sheet.command.add-average-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c}=i,l=e.get(r.ConditionalFormattingRuleModel),u=e.get(t.ICommandService),d=e.get(t.IUniverInstanceService),f=(0,n.getSheetCommandTarget)(d);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h={ranges:a,cfId:l.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:c,style:o}};return u.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:h})}},g={type:t.CommandType.COMMAND,id:`sheet.command.add-color-scale-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,config:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.ICommandService),u=e.get(t.IUniverInstanceService),d=(0,n.getSheetCommandTarget)(u);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.colorScale,config:o}};return l.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},_={type:t.CommandType.COMMAND,id:`sheet.command.add-data-bar-conditional-rule`,handler(e,i){if(!i)return!1;let{min:a,max:o,nativeColor:s,positiveColor:c,isGradient:l,stopIfTrue:u,isShowValue:d}=i,f=i.ranges??e.get(n.SheetsSelectionsService).getCurrentSelections().map(e=>e.range);if(!f.length)return!1;let p=e.get(r.ConditionalFormattingRuleModel),m=e.get(t.IUniverInstanceService),h=(0,n.getSheetCommandTarget)(m);if(!h)return!1;let{unitId:g,subUnitId:_}=h,v=e.get(t.ICommandService),y={ranges:f,cfId:p.createCfId(g,_),stopIfTrue:!!u,rule:{type:r.CFRuleType.dataBar,isShowValue:d,config:{min:a,max:o,nativeColor:s,positiveColor:c,isGradient:l}}};return v.executeCommand(r.AddConditionalRuleMutation.id,{unitId:g,subUnitId:_,rule:y})}},v={type:t.CommandType.COMMAND,id:`sheet.command.add-duplicate-values-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.ICommandService),u=e.get(t.IUniverInstanceService),d=(0,n.getSheetCommandTarget)(u);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:o}};return l.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},y={type:t.CommandType.COMMAND,id:`sheet.command.add-icon-set-conditional-rule`,handler(e,i){if(!i)return!1;let a=i.ranges??e.get(n.SheetsSelectionsService).getCurrentSelections().map(e=>e.range);if(!a.length)return!1;let o=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!o)return!1;let{unitId:s,subUnitId:c}=o,l={ranges:a,cfId:e.get(r.ConditionalFormattingRuleModel).createCfId(s,c),stopIfTrue:!!i.stopIfTrue,rule:{type:r.CFRuleType.iconSet,config:i.config,isShowValue:i.isShowValue}};return e.get(t.ICommandService).executeCommand(r.AddConditionalRuleMutation.id,{unitId:s,subUnitId:c,rule:l})}},b={type:t.CommandType.COMMAND,id:`sheet.command.add-number-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c,value:l}=i,u=e.get(r.ConditionalFormattingRuleModel),d=e.get(t.ICommandService),f=e.get(t.IUniverInstanceService),p=(0,n.getSheetCommandTarget)(f);if(!p)return!1;let{unitId:m,subUnitId:h}=p,g=u.createCfId(m,h),_;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(c)){let e=l;if(e.length!==2||!Array.isArray(e))return!1;_={ranges:a,cfId:g,stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:c,style:o,value:e}}}else{let e=l;if(typeof e!=`number`)return!1;_={ranges:a,cfId:g,stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:c,style:o,value:e}}}return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:m,subUnitId:h,rule:_})}},x={type:t.CommandType.COMMAND,id:`sheet.command.add-rank-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,isPercent:c,isBottom:l,value:u}=i,d=e.get(r.ConditionalFormattingRuleModel),f=e.get(t.IUniverInstanceService),p=e.get(t.ICommandService),m=(0,n.getSheetCommandTarget)(f);if(!m)return!1;let{unitId:h,subUnitId:g}=m,_={ranges:a,cfId:d.createCfId(h,g),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:c,isBottom:l,style:o,value:u}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:g,rule:_})}},S={type:t.CommandType.COMMAND,id:`sheet.command.add-text-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c,value:l}=i,u=e.get(r.ConditionalFormattingRuleModel),d=e.get(t.IUniverInstanceService),f=(0,n.getSheetCommandTarget)(d);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h=e.get(t.ICommandService),g={ranges:a,cfId:u.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:c,style:o,value:l}};return h.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:g})}},C={type:t.CommandType.COMMAND,id:`sheet.command.add-time-period-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c}=i,l=e.get(r.ConditionalFormattingRuleModel),u=e.get(t.IUniverInstanceService),d=e.get(t.ICommandService),f=(0,n.getSheetCommandTarget)(u);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h={ranges:a,cfId:l.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:c,style:o}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:h})}},w={type:t.CommandType.COMMAND,id:`sheet.command.add-uniqueValues-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.IUniverInstanceService),u=e.get(t.ICommandService),d=(0,n.getSheetCommandTarget)(l);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:o}};return u.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},T=`sheet.conditional.formatting.panel`;function E(e){"@babel/helpers - typeof";return E=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},E(e)}function D(e,t){if(E(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(E(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function O(e){var t=D(e,`string`);return E(t)==`symbol`?t:t+``}function k(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){return function(n,r){t(n,r,e)}}function j(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let M=class extends t.Disposable{constructor(e,n,r){super(),this._univerInstanceService=e,this._sidebarService=n,this._localeService=r,k(this,`_sidebarDisposable`,null),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{var t;e||(t=this._sidebarDisposable)==null||t.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.id===`sheet.conditional.formatting.panel`&&(e.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){let n={id:T,header:{title:this._localeService.t(`sheets-conditional-formatting-ui.title`)},children:{label:T,rule:e,key:(0,t.generateRandomId)(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}};M=j([A(0,t.IUniverInstanceService),A(1,(0,t.Inject)(i.ISidebarService)),A(2,(0,t.Inject)(t.LocaleService))],M);let N={id:`sheet.operation.open.conditional.formatting.panel`,type:t.CommandType.OPERATION,handler:(e,i)=>{var a;let o=e.get(M),s=e.get(n.SheetsSelectionsService),c=e.get(t.ICommandService),l=((a=s.getCurrentSelections())==null?void 0:a.map(e=>e.range))||[];switch(i.value){case 3:o.openPanel({...(0,r.createDefaultRule)(),ranges:l});break;case 4:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};o.openPanel(e);break}case 5:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:`=`}};o.openPanel(e);break}case 6:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.colorScale,config:[]}};o.openPanel(e);break}case 7:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};o.openPanel(e);break}case 8:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};o.openPanel(e);break}case 2:o.openPanel();break;case 1:o.openPanel({...(0,r.createDefaultRule)(),ranges:l});break;case 9:c.executeCommand(r.ClearRangeCfCommand.id,{ranges:l});break;case 10:c.executeCommand(r.ClearWorksheetCfCommand.id)}return!0}},P=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRangeIndexModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{let r=[],i=[],a={redos:r,undos:i};if([n.ClearSelectionFormatCommand.id,n.ClearSelectionAllCommand.id].includes(e.id)){var o;let e=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(e=>e.range);if(!e)return a;let n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),s=n.getActiveSheet();if(!s)return a;let c=n.getUnitId(),l=s.getSheetId(),u=this._conditionalFormattingRangeIndexModel.getRulesByRanges(c,l,e);if(!u||!u.length)return a;let{redos:d,undos:f}=F(this._injector,u,e,c,l);r.push(...d),i.push(...f)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{let r=[],i=[],a={redos:r,undos:i};if(!n||!n.length)return a;let o=this._conditionalFormattingRangeIndexModel.getRulesByRanges(e,t,n);if(!o||!o.length)return a;let{redos:s,undos:c}=F(this._injector,o,n,e,t);return r.push(...s),i.push(...c),a}}))}};P=j([A(0,(0,t.Inject)(t.Injector)),A(1,(0,t.Inject)(t.IUniverInstanceService)),A(2,(0,t.Inject)(n.SheetInterceptorService)),A(3,(0,t.Inject)(n.SheetsSelectionsService)),A(4,(0,t.Inject)(r.ConditionalFormattingRangeIndexModel))],P);function F(e,t,n,i,a){let o=[],s=[],c=e.get(r.ConditionalFormattingRangeTransformService);return t.forEach(t=>{let l=c.subtractRanges(t.ranges,n);if(l.length){let n={id:r.SetConditionalRuleMutation.id,params:{unitId:i,subUnitId:a,rule:{...t,ranges:l}}},c=(0,r.setConditionalRuleMutationUndoFactory)(e,n.params);o.push(n),s.push(...c)}else{let n={id:r.DeleteConditionalRuleMutation.id,params:{unitId:i,subUnitId:a,cfId:t.cfId}},c=(0,r.DeleteConditionalRuleMutationUndoFactory)(e,n.params);o.push(n),s.push(...c)}}),{redos:o,undos:s}}let I=[n.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],L=[{label:{name:`sheets-conditional-formatting-ui.ruleType.highlightCell`,selectable:!1},value:3},{label:{name:`sheets-conditional-formatting-ui.panel.rankAndAverage`,selectable:!1},value:4},{label:{name:`sheets-conditional-formatting-ui.ruleType.formula`,selectable:!1},value:5},{label:{name:`sheets-conditional-formatting-ui.ruleType.colorScale`,selectable:!1},value:6},{label:{name:`sheets-conditional-formatting-ui.ruleType.dataBar`,selectable:!1},value:7},{label:{name:`sheets-conditional-formatting-ui.ruleType.iconSet`,selectable:!1},value:8},{label:{name:`sheets-conditional-formatting-ui.menu.manageConditionalFormatting`,selectable:!1},value:2},{label:{name:`sheets-conditional-formatting-ui.menu.createConditionalFormatting`,selectable:!1},value:1},{label:{name:`sheets-conditional-formatting-ui.menu.clearRangeRules`,selectable:!1},value:9,disabled:!1},{label:{name:`sheets-conditional-formatting-ui.menu.clearWorkSheetRules`,selectable:!1},value:10}];function R(e){let c=e.get(n.SheetsSelectionsService),l=e.get(t.ICommandService),u=e.get(t.IUniverInstanceService),d=e.get(r.ConditionalFormattingRuleModel),f=new o.Observable(r=>(0,o.merge)(c.selectionMoveEnd$,c.selectionSet$,new o.Observable(e=>{let n=l.onCommandExecuted(n=>{var r;let{id:i,params:a}=n,o=(r=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getUnitId();I.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()})).pipe((0,s.debounceTime)(16)).subscribe(()=>{var i;let a=((i=c.getCurrentSelections())==null?void 0:i.map(e=>e.range))||[],o=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!o)return;let s=o.getActiveSheet();if(!s)return;let l=(d.getSubunitRules(o.getUnitId(),s.getSheetId())||[]).filter(e=>e.ranges.some(e=>a.some(n=>t.Rectangle.intersects(n,e)))).map(e=>e.ranges).every(t=>(0,n.checkRangesEditablePermission)(e,o.getUnitId(),s.getSheetId(),t));r.next(l)})),p=new o.Observable(r=>new o.Observable(e=>{let n=l.onCommandExecuted(n=>{var r;let{id:i,params:a}=n,o=(r=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getUnitId();I.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()}).pipe((0,s.debounceTime)(16)).subscribe(()=>{let i=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!i)return;let a=i.getActiveSheet();if(!a)return;let o=d.getSubunitRules(i.getUnitId(),a.getSheetId())||[];if(!o.length)return r.next(!1),!1;let s=o.map(e=>e.ranges).every(t=>(0,n.checkRangesEditablePermission)(e,i.getUnitId(),a.getSheetId(),t));r.next(s)})),m=new o.Observable(e=>{let t=f.subscribe(t=>{let n=L.find(e=>e.value===9);n&&(n.disabled=!t,e.next(L))}),n=p.subscribe(t=>{let n=L.find(e=>e.value===10);n&&(n.disabled=!t,e.next(L))});return e.next(L),()=>{t.unsubscribe(),n.unsubscribe()}});return{id:N.id,type:i.MenuItemType.SELECTOR,icon:`ConditionsDoubleIcon`,tooltip:`sheets-conditional-formatting-ui.title`,selections:m,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,a.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookEditablePermission],worksheetTypes:[n.WorksheetSetCellStylePermission,n.WorksheetEditPermission],rangeTypes:[n.RangeProtectionPermissionEditPoint]})}}let ee={min:{type:r.CFValueType.min},max:{type:r.CFValueType.max},nativeColor:r.defaultDataBarNativeColor,positiveColor:r.defaultDataBarPositiveColor,isGradient:!1,isShowValue:!0};function te(e){return{config:[{iconType:e,iconId:`0`,operator:r.CFNumberOperator.greaterThanOrEqual,value:{type:r.CFValueType.percent,value:67}},{iconType:e,iconId:`1`,operator:r.CFNumberOperator.greaterThanOrEqual,value:{type:r.CFValueType.percent,value:33}},{iconType:e,iconId:`2`,operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.percent,value:2**53-1}}],isShowValue:!0}}function ne(e){return{hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,a.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookEditablePermission],worksheetTypes:[n.WorksheetSetCellStylePermission,n.WorksheetEditPermission],rangeTypes:[n.RangeProtectionPermissionEditPoint]})}}function re(e){return{id:_.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`DataBarIcon`,tooltip:`sheets-conditional-formatting-ui.ruleType.dataBar`,params:ee,selectionsCommandId:_.id,selections:[{label:`sheets-conditional-formatting-ui.ruleType.dataBar`,value:r.CFRuleType.dataBar,params:ee},{id:N.id,label:`sheets-conditional-formatting-ui.menu.createConditionalFormatting`,value:7,params:{value:7}},{id:r.ClearRangeCfCommand.id,label:`sheets-conditional-formatting-ui.menu.clearRangeRules`,value:r.CFRuleType.dataBar,params:{types:[r.CFRuleType.dataBar]}}],...ne(e)}}function ie(e){let t=te(r.IIconSetType.threeStars);return{id:y.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`RatingIcon`,tooltip:`sheets-conditional-formatting-ui.ruleType.iconSet`,params:t,selectionsCommandId:y.id,selections:[{label:`sheets-conditional-formatting-ui.iconSet.rank`,value:r.IIconSetType.threeStars,params:t},{label:`sheets-conditional-formatting-ui.iconSet.shape`,value:r.IIconSetType.threeTrafficLights1,params:te(r.IIconSetType.threeTrafficLights1)},{label:`sheets-conditional-formatting-ui.iconSet.direction`,value:r.IIconSetType.threeArrows,params:te(r.IIconSetType.threeArrows)},{id:N.id,label:`sheets-conditional-formatting-ui.menu.createConditionalFormatting`,value:8,params:{value:8}},{id:r.ClearRangeCfCommand.id,label:`sheets-conditional-formatting-ui.menu.clearRangeRules`,value:r.CFRuleType.iconSet,params:{types:[r.CFRuleType.iconSet]}}],...ne(e)}}let ae={[i.RibbonDataGroup.RULES]:{[N.id]:{order:1,gridLayout:{row:2,column:1,showLabel:!0},menuItemFactory:R}}},oe={[i.RibbonInsertGroup.CELL]:{[_.id]:{order:3,menuItemFactory:re},[y.id]:{order:4,menuItemFactory:ie}},...ae};var se=`@univerjs/sheets-conditional-formatting-ui`,ce=`1.0.0`;let le=`sheets-conditional-formatting-ui.config`,z={},B=class extends t.Disposable{constructor(e,t,n){super(),this._conditionalFormattingRuleModel=e,this._formulaRefRangeService=t,this._injector=n,k(this,`_disposableMap`,new Map),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}_${t}_${n}`}_getRuleFormulas(e){let t=[],n=e.rule;switch(n.type){case r.CFRuleType.highlightCell:n.subType===r.CFSubRuleType.formula&&t.push(n.value);break;case r.CFRuleType.dataBar:{let e=n;e.config.min.type===r.CFValueType.formula&&t.push(e.config.min.value),e.config.max.type===r.CFValueType.formula&&t.push(e.config.max.value);break}case r.CFRuleType.colorScale:n.config.forEach(e=>{e.value.type===r.CFValueType.formula&&t.push(e.value.value)});break;case r.CFRuleType.iconSet:n.config.forEach(e=>{e.value.type===r.CFValueType.formula&&t.push(e.value.value)})}return t}_updateRuleFormulas(e,n){let i=t.Tools.deepClone(e),a=i.rule,o=0;switch(a.type){case r.CFRuleType.highlightCell:a.subType===r.CFSubRuleType.formula&&(a.value=n[o++]);break;case r.CFRuleType.dataBar:{let e=a;e.config.min.type===r.CFValueType.formula&&(e.config.min.value=n[o++]),e.config.max.type===r.CFValueType.formula&&(e.config.max.value=n[o++]);break}case r.CFRuleType.colorScale:a.config.forEach(e=>{e.value.type===r.CFValueType.formula&&(e.value.value=n[o++])});break;case r.CFRuleType.iconSet:a.config.forEach(e=>{e.value.type===r.CFValueType.formula&&(e.value.value=n[o++])})}return i}register(e,t,n){let i=n.ranges,a=this._getRuleFormulas(n),o=this._formulaRefRangeService.registerRangeFormula(e,t,i,a,i=>{if(i.length===0)return{undos:[{id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:n}}],redos:[{id:r.DeleteConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId}}]};let a=[],o=[],s=i[0],c=this._updateRuleFormulas(n,s.formulas);c.ranges=s.ranges,a.push({id:r.SetConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId,rule:c}}),o.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,{unitId:e,subUnitId:t,cfId:n.cfId,rule:c}));for(let s=1;s<i.length;s++){let c=i[s],l=(0,r.createCfId)(),u=this._updateRuleFormulas(n,c.formulas);u.cfId=l,u.ranges=c.ranges,a.push({id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:u}}),o.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,{unitId:e,subUnitId:t,rule:u}))}return{undos:o,redos:a}}),s=this._getIdWithUnitId(e,t,n.cfId);this._disposableMap.set(s,o)}_initRefRange(){let e=this._conditionalFormattingRuleModel.getAll();for(let[t,n]of e)for(let[e,r]of n)for(let n of r)this.register(t,e,n);this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{let{unitId:t,subUnitId:n,rule:r}=e;switch(e.type){case`add`:this.register(t,n,r);break;case`delete`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e));break}case`set`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e)),this.register(t,n,r);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};B=j([A(0,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(1,(0,t.Inject)(l.FormulaRefRangeService)),A(2,(0,t.Inject)(t.Injector))],B);let ue=[a.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,a.PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE,a.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER],V=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=n,this._univerInstanceService=r,this._conditionalFormattingRangeTransformService=i,k(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,t,n)=>this._collectConditionalRule(e,t,n),onPasteCells:(e,t,n,r)=>!e||!this._copyInfo||!ue.includes(r.pasteType)?{redos:[],undos:[]}:this._generateConditionalFormattingMutations(e,t,r)}))}_collectConditionalRule(e,r,i){var o;let s=new Map,c={};this._copyInfo={rules:s,info:{unitId:e,subUnitId:r,cfMap:c}};let l=this._injector.invoke(t=>(0,n.rangeToDiscreteRange)(i,t,e,r));if(!l)return;let{projectRange:u}=(0,a.virtualizeDiscreteRanges)([l]);(o=this._conditionalFormattingRuleModel.getSubunitRules(e,r))==null||o.forEach(e=>{let n=e.ranges.flatMap(e=>{let t=u(e);return t?[t]:[]});n.length&&(s.set(e.cfId,n.length>1?t.Rectangle.mergeRanges(n):n),c[e.cfId]={rule:e.rule,stopIfTrue:e.stopIfTrue})})}_generateConditionalFormattingMutations(e,i,o){var s;let c=this._copyInfo;if(!c)return{redos:[],undos:[]};let{unitId:l,subUnitId:u,range:d}=e,{unitId:f,subUnitId:p,range:m}=i,{copyType:h=a.COPY_TYPE.COPY}=o;if(!(0,n.getSheetCommandTarget)(this._univerInstanceService,{unitId:f,subUnitId:p}))return{redos:[],undos:[]};if(h===a.COPY_TYPE.CUT&&f===l&&p===u)return this._copyInfo=null,{redos:[],undos:[]};let g=(0,a.virtualizeDiscreteRanges)([d]),_=g.ranges[0],v=(0,a.virtualizeDiscreteRanges)([m]),y=v.ranges[0],b=(0,a.getRepeatRange)(_,y,!0),x=v.mapRange(y),S=f===l&&p===u,C=new Map,w=(e,t,n)=>JSON.stringify([e,t,n]);if((s=this._conditionalFormattingRuleModel.getSubunitRules(f,p))==null||s.forEach(e=>{t.Rectangle.doAnyRangesIntersect(e.ranges,x)&&C.set(w(f,p,e.cfId),{cfId:e.cfId,unitId:f,subUnitId:p,ranges:e.ranges,add:[],remove:x})}),h===a.COPY_TYPE.CUT&&(f!==l||p!==u)){let e=g.mapRange(_);c.rules.forEach((t,n)=>{let r=this._conditionalFormattingRuleModel.getRule(l,u,n);r&&C.set(w(l,u,n),{cfId:n,unitId:l,subUnitId:u,ranges:r.ranges,add:[],remove:e})})}let{rules:T,info:E}=c,D=new Map,O={},k=e=>{let t=E==null?void 0:E.cfMap[e];if(S){let t=this._conditionalFormattingRuleModel.getRule(f,p,e);if(t)return O[e]=t,t}let n={rule:t.rule,cfId:this._conditionalFormattingRuleModel.createCfId(f,p),ranges:[],stopIfTrue:t.stopIfTrue};return O[e]=n,D.set(n.cfId,n),n},A=Array.from(T.entries());S||A.reverse(),A.forEach(([e,n])=>{let r=O[e]||k(e),i=w(f,p,r.cfId);C.has(i)||C.set(i,{cfId:r.cfId,unitId:f,subUnitId:p,ranges:r.ranges,add:[],remove:[]}),C.get(i).add.push(...b.flatMap(e=>n.flatMap(n=>v.mapRange(t.Rectangle.getPositionRange(n,e.startRange)))))});let j=[],M=[];for(let e of C.values()){let{cfId:t,unitId:n,subUnitId:i,ranges:a,add:o,remove:s}=e,c=this._conditionalFormattingRangeTransformService.applyRangeDelta(a,s,o);if(!c.length){let e={unitId:n,subUnitId:i,cfId:t};j.push({id:r.DeleteConditionalRuleMutation.id,params:e}),M.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e));continue}let l=D.get(t);if(l){let e={unitId:f,subUnitId:p,rule:{...l,ranges:c}};j.push({id:r.AddConditionalRuleMutation.id,params:e}),M.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,e))}else{let e=this._conditionalFormattingRuleModel.getRule(n,i,t);if(!e)continue;let a={unitId:n,subUnitId:i,rule:{...e,ranges:c}};j.push({id:r.SetConditionalRuleMutation.id,params:a}),M.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,a))}}return{redos:j,undos:M}}};V=j([A(0,(0,t.Inject)(a.ISheetClipboardService)),A(1,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(2,(0,t.Inject)(t.Injector)),A(3,(0,t.Inject)(t.IUniverInstanceService)),A(4,(0,t.Inject)(r.ConditionalFormattingRangeTransformService))],V);let H=class extends t.Disposable{constructor(e){super(),this._localeService=e,k(this,`_initLocal`,()=>{}),k(this,`_findReplaceIndex`,e=>{let t=/\{([^}]+)?\}/g,n=[],r=t.exec(e);for(;r;)n.push({startIndex:r.index,key:Number(r[1]),endIndex:r.index+r[0].length-1}),r=t.exec(e);return n}),this._initLocal()}tWithReactNode(e,...t){let n=this._localeService.getLocales(),r=e.split(`.`),i=n&&this._localeService.resolveKeyPath(n,r);if(typeof i==`string`){let e=[];return this._findReplaceIndex(i).forEach((n,r,a)=>{let o=a[r-1]||{startIndex:0,endIndex:-1};if(o.endIndex+1<n.startIndex){let t=i.slice(o.endIndex+1,n.startIndex);t&&e.push(t)}if(t[n.key]&&e.push(t[n.key]),r===a.length-1){let t=i.slice(n.endIndex+1);t&&e.push(t)}}),e}return[]}};H=j([A(0,(0,t.Inject)(t.LocaleService))],H);let U=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===r.AddCfCommand.id){let{unitId:t,subUnitId:r,rule:{ranges:i}}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookEditablePermission],rangeTypes:[n.RangeProtectionPermissionEditPoint],worksheetTypes:[n.WorksheetEditPermission,n.WorksheetSetCellStylePermission]},i,t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-conditional-formatting-ui.permission.dialog.setStyleErr`))}}))}};U=j([A(0,(0,t.Inject)(t.LocaleService)),A(1,t.ICommandService),A(2,(0,t.Inject)(n.SheetPermissionCheckController))],U);let W=class extends t.Disposable{constructor(e,t,n,r,i,a,o){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=a,this._conditionalFormattingRangeIndexModel=o,k(this,`_ruleChangeCacheMap`,new Map),k(this,`_boundRenderExtensions`,new Map),this._initViewModelInterceptor(),this._initRenderRangeResolvers(),this._initSkeleton(),queueMicrotask(()=>this._markActiveSheetRulesDirty()),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear(),this._boundRenderExtensions.forEach(e=>{e.forEach(e=>e.setRenderRangeResolver(null))}),this._boundRenderExtensions.clear()})}_initRenderRangeResolvers(){let e=this._createRenderRangeResolver(r.CFRuleType.dataBar),n=this._createRenderRangeResolver(r.CFRuleType.iconSet),i=t=>{var i;this._unbindRenderRangeResolvers(t);let a=(i=this._renderManagerService.getRenderUnitById(t))==null?void 0:i.mainComponent;if(!a||!(`getExtensionByKey`in a))return;let o=new Set,s=a.getExtensionByKey(r.dataBarUKey);s instanceof r.DataBar&&(s.setRenderRangeResolver(e),o.add(s));let c=a.getExtensionByKey(r.IconUKey);c instanceof r.ConditionalFormattingIcon&&(c.setRenderRangeResolver(n),o.add(c)),o.size&&this._boundRenderExtensions.set(t,o)};this._renderManagerService.getAllRenderersOfType(t.UniverInstanceType.UNIVER_SHEET).forEach(e=>i(e.unitId)),this.disposeWithMe(this._renderManagerService.created$.subscribe(e=>{e.type===t.UniverInstanceType.UNIVER_SHEET&&i(e.unitId)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(e=>this._unbindRenderRangeResolvers(e)))}_createRenderRangeResolver(e){return(n,r,i)=>{let a=[],o=this._conditionalFormattingRangeIndexModel.getRulesByRanges(n,r,i).filter(t=>t.rule.type===e),s=o.length?o:(this._conditionalFormattingRuleModel.getSubunitRules(n,r)??[]).filter(t=>t.rule.type===e);return i.forEach(e=>{s.forEach(n=>{n.ranges.forEach(n=>{let r=(0,t.getIntersectRange)(e,n);r&&a.push(r)})})}),a.length>1?t.Rectangle.mergeRanges(a):a}}_unbindRenderRangeResolvers(e){let t=this._boundRenderExtensions.get(e);t==null||t.forEach(e=>e.setRenderRangeResolver(null)),this._boundRenderExtensions.delete(e)}_collectDirtyRanges(e,t,n){let r=[];return e.forEach(e=>{var i;if(e.unitId!==t||e.subUnitId!==n)return;let a=e.rule??(e.cfId?this._conditionalFormattingRuleModel.getRule(t,n,e.cfId):null);a!=null&&(i=a.ranges)!=null&&i.length&&r.push(...a.ranges)}),r}_intersectDirtyRangesWithRenderedRange(e,t){return!t||t.startRow<0||t.startColumn<0?[]:e.map(e=>({startRow:Math.max(e.startRow,t.startRow),endRow:Math.min(e.endRow,t.endRow),startColumn:Math.max(e.startColumn,t.startColumn),endColumn:Math.min(e.endColumn,t.endColumn)})).filter(e=>e.startRow<=e.endRow&&e.startColumn<=e.endColumn)}_markDirtySkeleton(e){var n;let r=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),i=r==null?void 0:r.getActiveSheet();if(!r||!i)return;let o=r.getUnitId(),s=i.getSheetId(),c=this._renderManagerService.getRenderUnitById(o),l=c==null?void 0:c.with(a.SheetSkeletonManagerService),u=l==null?void 0:l.getCurrentSkeleton(),d=this._intersectDirtyRangesWithRenderedRange(this._collectDirtyRanges(e,o,s),u==null?void 0:u.rowColumnSegment);d.length&&(u==null||u.resetRangeCache(d)),l==null||l.reCalculate(),c==null||(n=c.mainComponent)==null||n.makeDirty()}_markActiveSheetRulesDirty(){let e=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),n=e==null?void 0:e.getActiveSheet();if(!e||!n)return;let r=e.getUnitId(),i=n.getSheetId(),a=this._conditionalFormattingRuleModel.getSubunitRules(r,i)??[];a.length&&this._markDirtySkeleton(a.map(e=>({rule:e,subUnitId:i,unitId:r})))}_initSkeleton(){this.disposeWithMe((0,o.merge)(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe((0,s.bufferTime)(16),(0,s.filter)(e=>!!e.length),(0,s.filter)(e=>{let n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;let r=n.getActiveSheet();return r?e.some(e=>e.unitId===n.getUnitId()&&e.subUnitId===r.getSheetId()):!1})).subscribe(e=>this._markDirtySkeleton(e)))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(n.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(e,t,n)=>{let i=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!i)return n(e);let a=t.workbook.getStyles(),o=(typeof(e==null?void 0:e.s)==`string`?a.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},s=e===t.rawData?{...t.rawData}:e;if(i.style){let e={...o,...i.style};Object.assign(s,{s:e})}return s.fontRenderExtension||(s.fontRenderExtension={},i.isShowValue!==void 0&&(s.fontRenderExtension.isSkip=!i.isShowValue)),i.dataBar&&(s.dataBar=i.dataBar),i.iconSet&&(s.iconSet=i.iconSet,s.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),n(s)},priority:10}))}};W=j([A(0,(0,t.Inject)(n.SheetInterceptorService)),A(1,(0,t.Inject)(r.ConditionalFormattingService)),A(2,(0,t.Inject)(t.IUniverInstanceService)),A(3,(0,t.Inject)(c.IRenderManagerService)),A(4,(0,t.Inject)(r.ConditionalFormattingViewModel)),A(5,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(6,(0,t.Inject)(r.ConditionalFormattingRangeIndexModel))],W);function G({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),l=`_${(0,d.useId)()}`,u=(0,d.useRef)(null);return(0,d.useImperativeHandle)(e,()=>u.current),(0,d.useLayoutEffect)(()=>{if(n&&u.current&&u.current.localName===r.tag)return me(u.current)},[n,r]),de(r,`${i}`,{defIds:r.defIds,idSuffix:l},{ref:u,className:c,...s},o)}function de(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...fe(e,n,i),...r},(pe(e,n).children||[]).map((r,a)=>de(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function fe(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function pe(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function me(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:he(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(ge(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function he(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function ge(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}G.displayName=`UniverIcon`;let _e={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ve=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`bold-icon`,ref:t,icon:_e}))});ve.displayName=`BoldIcon`;let ye={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`rect`,attrs:{width:13,height:5,x:1.5,y:5.5,stroke:`currentColor`,rx:2.5,strokeWidth:1.2}},{tag:`rect`,attrs:{width:6.4,height:2.6,x:2.7,y:6.7,fill:`currentColor`,rx:1.3}}]},be=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`data-bar-icon`,ref:t,icon:ye}))});be.displayName=`DataBarIcon`;let xe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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`}}]},K=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`delete-icon`,ref:t,icon:xe}))});K.displayName=`DeleteIcon`;let Se={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`circle`,attrs:{cx:7,cy:5,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:13,cy:5,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:7,cy:10,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:13,cy:10,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:7,cy:15,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:13,cy:15,r:1.1,fill:`currentColor`}}]},Ce=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`grip-vertical-icon`,ref:t,icon:Se}))});Ce.displayName=`GripVerticalIcon`;let we={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`increase-icon`,ref:t,icon:we}))});Te.displayName=`IncreaseIcon`;let Ee={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z`}}]},De=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`italic-icon`,ref:t,icon:Ee}))});De.displayName=`ItalicIcon`;let Oe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},ke=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`more-down-icon`,ref:t,icon:Oe}))});ke.displayName=`MoreDownIcon`;let Ae={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`rect`,attrs:{width:13,height:13,x:1.5,y:1.5,stroke:`currentColor`,rx:1.5,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M8 4L9.19 6.42L11.85 6.81L9.93 8.68L10.38 11.33L8 10.08L5.62 11.33L6.07 8.68L4.15 6.81L6.81 6.42L8 4Z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.2}}]},je=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`rating-icon`,ref:t,icon:Ae}))});je.displayName=`RatingIcon`;let Me={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z`}}]},Ne=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`strikethrough-icon`,ref:t,icon:Me}))});Ne.displayName=`StrikethroughIcon`;let Pe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z`}}]},Fe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`underline-icon`,ref:t,icon:Pe}))});Fe.displayName=`UnderlineIcon`;let Ie={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`colorChannel1`,d:`M5.59 1.51H10.46V14.46H5.59z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.34863 2.53325C1.34863 1.87051 1.88589 1.33325 2.54863 1.33325H13.482C14.1447 1.33325 14.682 1.87051 14.682 2.53325V13.4666C14.682 14.1294 14.1447 14.6666 13.482 14.6666H2.54863C1.88589 14.6666 1.34863 14.1294 1.34863 13.4666V2.53325ZM13.082 2.63325C13.2477 2.63325 13.382 2.76757 13.382 2.93325V5.09946C13.382 5.26515 13.2477 5.39946 13.082 5.39946H10.9708C10.8052 5.39946 10.6708 5.26515 10.6708 5.09946V2.93325C10.6708 2.76757 10.8052 2.63325 10.9708 2.63325H13.082ZM9.37085 2.93325C9.37085 2.76757 9.23653 2.63325 9.07085 2.63325H6.95974C6.79406 2.63325 6.65974 2.76757 6.65974 2.93325V5.09946C6.65974 5.26515 6.79406 5.39946 6.95974 5.39946L9.07085 5.39946C9.23654 5.39946 9.37085 5.26515 9.37085 5.09946V2.93325ZM5.35974 2.93325C5.35974 2.76757 5.22543 2.63325 5.05974 2.63325H2.94863C2.78295 2.63325 2.64863 2.76757 2.64863 2.93325V5.09946C2.64863 5.26515 2.78295 5.39946 2.94863 5.39946H5.05974C5.22543 5.39946 5.35974 5.26515 5.35974 5.09946V2.93325ZM2.94863 6.69946C2.78295 6.69946 2.64863 6.83378 2.64863 6.99946V9.11045C2.64863 9.27613 2.78295 9.41045 2.94863 9.41045H5.05974C5.22543 9.41045 5.35974 9.27613 5.35974 9.11045V6.99946C5.35974 6.83378 5.22543 6.69946 5.05974 6.69946H2.94863ZM2.94863 10.7104C2.78295 10.7104 2.64863 10.8448 2.64863 11.0104V13.0666C2.64863 13.2323 2.78295 13.3666 2.94863 13.3666H5.05974C5.22543 13.3666 5.35974 13.2323 5.35974 13.0666V11.0104C5.35974 10.8448 5.22543 10.7104 5.05974 10.7104H2.94863ZM6.65974 13.0666C6.65974 13.2323 6.79406 13.3666 6.95974 13.3666H9.07085C9.23653 13.3666 9.37085 13.2323 9.37085 13.0666V11.0104C9.37085 10.8448 9.23653 10.7104 9.07085 10.7104L6.95974 10.7104C6.79406 10.7104 6.65974 10.8448 6.65974 11.0104V13.0666ZM10.6708 13.0666C10.6708 13.2323 10.8052 13.3666 10.9708 13.3666H13.082C13.2477 13.3666 13.382 13.2323 13.382 13.0666V11.0104C13.382 10.8448 13.2477 10.7104 13.082 10.7104H10.9708C10.8052 10.7104 10.6708 10.8448 10.6708 11.0104V13.0666ZM13.082 9.41045C13.2477 9.41045 13.382 9.27613 13.382 9.11045V6.99946C13.382 6.83378 13.2477 6.69946 13.082 6.69946H10.9708C10.8052 6.69946 10.6708 6.83378 10.6708 6.99946V9.11045C10.6708 9.27613 10.8052 9.41045 10.9708 9.41045H13.082ZM6.95974 9.41045C6.79406 9.41045 6.65974 9.27613 6.65974 9.11045V6.99946C6.65974 6.83378 6.79406 6.69946 6.95974 6.69946L9.07085 6.69946C9.23653 6.69946 9.37085 6.83378 9.37085 6.99946V9.11045C9.37085 9.27613 9.23653 9.41045 9.07085 9.41045H6.95974Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Le=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`conditions-double-icon`,ref:t,icon:Ie}))});Le.displayName=`ConditionsDoubleIcon`;let Re={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`colorChannel1`,d:`M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ze=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`font-color-double-icon`,ref:t,icon:Re}))});ze.displayName=`FontColorDoubleIcon`;let Be={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z`}}]},Ve=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`paint-bucket-double-icon`,ref:t,icon:Be}))});Ve.displayName=`PaintBucketDoubleIcon`;let He={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Ue=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`slash-double-icon`,ref:t,icon:He}))});Ue.displayName=`SlashDoubleIcon`;let We=e=>{let{color:n,onChange:r,disable:i=!1,Icon:a=Ve,className:o,DropdownComponent:s=f.Dropdown,PickerComponent:c=f.ColorPicker}=e,l=(0,d.useMemo)(()=>new t.ColorKit(n),[n]),u=()=>{let e={className:(0,f.clsx)(`univer-fill-primary-600`,i&&o),extend:{colorChannel1:l.isValid?n:``}};return(0,m.jsx)(a,{...e})};return i?u():(0,m.jsx)(s,{overlay:(0,m.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,m.jsx)(c,{value:n,onChange:r})}),children:(0,m.jsx)(`span`,{className:(0,f.clsx)(`univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`,o),children:u()})})};function q(e){let{rule:n}=e,i=(0,d.useMemo)(()=>{if((n==null?void 0:n.type)===r.CFRuleType.colorScale){let e=n.config.map((e,n)=>({color:new t.ColorKit(e.color),value:n})),i=e.length-1;return[,,,,,].fill(``).map((e,t,n)=>t*i/(n.length-1)).map(t=>(0,r.getColorScaleFromValue)(e,t))}return null},[n]),a=(0,d.useMemo)(()=>{if((n==null?void 0:n.type)===r.CFRuleType.iconSet)return n.config.map(e=>{let t=r.iconMap[e.iconType];return t&&t[Number(e.iconId)]})},[n]);if(!n)return null;let o=`univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs`;switch(n.type){case r.CFRuleType.dataBar:{let{isGradient:e}=n.config,t=e?`linear-gradient(to right, ${n.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:n.config.positiveColor,i=e?`linear-gradient(to right, rgb(255 255 255),${n.config.nativeColor||r.defaultDataBarNativeColor})`:n.config.nativeColor;return(0,m.jsxs)(`div`,{className:o,children:[(0,m.jsx)(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:i,borderColor:n.config.nativeColor??r.defaultDataBarNativeColor}}),(0,m.jsx)(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:t,borderColor:n.config.positiveColor??r.defaultDataBarPositiveColor}})]})}case r.CFRuleType.colorScale:return i&&(0,m.jsx)(`div`,{className:o,children:i.map((e,t)=>(0,m.jsx)(`div`,{className:`univer-h-full`,style:{width:`${100/i.length}%`,background:e}},t))});case r.CFRuleType.iconSet:return a&&(0,m.jsx)(`div`,{className:o,children:a.map((e,t)=>e?(0,m.jsx)(`img`,{className:`univer-h-full`,src:e,draggable:!1},t):(0,m.jsx)(Ue,{},t))});case r.CFRuleType.highlightCell:{let{ul:e,st:i,it:a,bl:s,bg:c,cl:l}=n.style,u=(e==null?void 0:e.s)===t.BooleanNumber.TRUE,d=(i==null?void 0:i.s)===t.BooleanNumber.TRUE,p=a===t.BooleanNumber.TRUE,h=s===t.BooleanNumber.TRUE,g=(c==null?void 0:c.rgb)??r.DEFAULT_BG_COLOR,_=(l==null?void 0:l.rgb)??r.DEFAULT_FONT_COLOR,v={textDecoration:`${u?`underline`:``} ${d?`line-through`:``}`.replace(/^ /,``)??void 0,backgroundColor:g,color:_};return(0,m.jsx)(`div`,{className:(0,f.clsx)(o,{"univer-font-bold":h,"univer-italic":p}),style:v,children:`123`})}}}let J=(0,f.clsx)(`univer-mt-5 univer-px-1 univer-py-2 univer-rounded`,f.borderClassName),Y=e=>({label:`sheets-conditional-formatting-ui.valueType.${e}`,value:e}),Ge=e=>{var n;let{type:a,className:o,onChange:s,value:c,FormulaEditorComponent:l}=e,u=(0,i.useDependency)(t.IUniverInstanceService),p=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(n=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),g=(0,d.useMemo)(()=>String(c).startsWith(`=`)?String(c):`=`,[c]),_=(0,d.useMemo)(()=>[r.CFValueType.max,r.CFValueType.min,`none`].includes(a)?{disabled:!0}:[r.CFValueType.percent,r.CFValueType.percentile].includes(a)?{min:0,max:100}:{min:-(2**53-1),max:2**53-1},[a]),v=(0,d.useRef)(null),[y,b]=(0,d.useState)(!1);return(0,i.useSidebarClick)(e=>{var t;(t=v.current)!=null&&t.isClickOutSide(e)&&b(!1)}),a===r.CFValueType.formula?(0,m.jsx)(`div`,{className:`univer-w-full`,children:(0,m.jsx)(l,{ref:v,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),initValue:g,unitId:p,subUnitId:h,isFocus:y,onChange:(e=``)=>{s(e||``)},onFocus:()=>b(!0)})}):(0,m.jsx)(f.InputNumber,{className:o,value:Number(e.value)||0,onChange:t=>e.onChange(t||0),..._})},Ke=e=>{var n;let{interceptorManager:a,SelectComponent:o=f.Select,ColorPickerComponent:s=We,FormulaEditorComponent:c=u.FormulaEditor}=e,l=(0,i.useDependency)(t.LocaleService),p=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.colorScale?e.rule:void 0,h=[Y(r.CFValueType.num),Y(r.CFValueType.percent),Y(r.CFValueType.percentile),Y(r.CFValueType.formula)],g=[Y(r.CFValueType.min),...h].map(e=>({...e,label:l.t(e.label)})),_=[Y(`none`),...h].map(e=>({...e,label:l.t(e.label)})),v=[Y(r.CFValueType.max),...h].map(e=>({...e,label:l.t(e.label)})),[y,b]=(0,d.useState)(()=>{var e;let t=r.CFValueType.min;return p&&((e=p.config[0])==null?void 0:e.value.type)||t}),[x,S]=(0,d.useState)(()=>{var e;let t=`none`;return!p||p.config.length!==3?t:((e=p.config[1])==null?void 0:e.value.type)||t}),[C,w]=(0,d.useState)(()=>{var e;let t=r.CFValueType.max;return p&&((e=p.config[p.config.length-1])==null?void 0:e.value.type)||t}),[T,E]=(0,d.useState)(()=>{if(!p)return 10;let e=p.config[0];return(e==null?void 0:e.value.value)===void 0?10:e==null?void 0:e.value.value}),[D,O]=(0,d.useState)(()=>{var e;if(!p||p.config.length!==3)return 50;let t=(e=p.config[1])==null?void 0:e.value.value;return t===void 0?50:t}),[k,A]=(0,d.useState)(()=>{var e;if(!p)return 90;let t=(e=p.config[p.config.length-1])==null?void 0:e.value.value;return t===void 0?90:t}),[j,M]=(0,d.useState)(()=>{var e;return p&&((e=p.config[0])==null?void 0:e.color)||`#d0d9fb`}),[N,P]=(0,d.useState)(()=>{var e;let t=`#7790f3`;return!p||p.config.length!==3?t:((e=p.config[1])==null?void 0:e.color)||t}),[F,I]=(0,d.useState)(()=>{var e;return p&&((e=p.config[p.config.length-1])==null?void 0:e.color)||`#2e55ef`}),L=(0,d.useMemo)(()=>e=>{let{minType:t,medianType:n,maxType:i,minValue:a,medianValue:o,maxValue:s,minColor:c,medianColor:l,maxColor:u}=e,d=[];return d.push({color:c,value:{type:t,value:a}}),n!==`none`&&d.push({color:l,value:{type:n,value:o}}),d.push({color:u,value:{type:i,value:s}}),{config:d.map((e,t)=>({...e,index:t})),type:r.CFRuleType.colorScale}},[]);(0,d.useEffect)(()=>a.intercept(a.getInterceptPoints().submit,{handler(){return L({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),[L,y,x,C,T,D,k,j,N,F,a]);let R=t=>{e.onChange(L(t))};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:L({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})})}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.min`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-flex-shrink-0`,options:g,value:y,onChange:e=>{b(e);let t=(0,r.createDefaultValueByValueType)(e,10);E(t),R({minType:e,medianType:x,maxType:C,minValue:t,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(Ge,{id:`min`,value:T,type:y,FormulaEditorComponent:c,onChange:e=>{E(e),R({minType:y,medianType:x,maxType:C,minValue:e,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(s,{color:j,onChange:e=>{M(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:e,medianColor:N,maxColor:F})}})]}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.medianValue`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-flex-shrink-0`,options:_,value:x,onChange:e=>{S(e);let t=(0,r.createDefaultValueByValueType)(e,50);O(t),R({minType:y,medianType:e,maxType:C,minValue:T,medianValue:t,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(Ge,{id:`median`,value:D,type:x,FormulaEditorComponent:c,onChange:e=>{O(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:e,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),x===`none`?(0,m.jsx)(`div`,{"aria-hidden":!0,className:`univer-size-6 univer-flex-shrink-0`}):(0,m.jsx)(s,{color:N,onChange:e=>{P(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:e,maxColor:F})}})]}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.max`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-flex-shrink-0`,options:v,value:C,onChange:e=>{w(e);let t=(0,r.createDefaultValueByValueType)(e,90);A(t),R({minType:y,medianType:x,maxType:e,minValue:T,medianValue:D,maxValue:t,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(Ge,{id:`max`,value:k,type:C,FormulaEditorComponent:c,onChange:e=>{A(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:e,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(s,{color:F,onChange:e=>{I(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:e})}})]})]})},X=e=>({label:`sheets-conditional-formatting-ui.valueType.${e}`,value:e}),qe=e=>{var n;let{onChange:a,className:o,value:s,type:c,disabled:l=!1,FormulaEditorComponent:u}=e,p=(0,i.useDependency)(t.IUniverInstanceService),h=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),g=(n=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),_=(0,d.useRef)(null),[v,y]=(0,d.useState)(!1);(0,i.useSidebarClick)(e=>{var t;(t=_.current)!=null&&t.isClickOutSide(e)&&y(!1)});let b=(0,d.useRef)(s),x=(0,d.useMemo)(()=>[r.CFValueType.percentile,r.CFValueType.percent].includes(c)?{max:100,min:0}:{min:-(2**53-1),max:2**53-1},[c]);if(c===r.CFValueType.formula){let e=String(b.current).startsWith(`=`)?String(b.current)||``:`=`;return(0,m.jsx)(`div`,{className:`univer-w-full`,children:(0,m.jsx)(u,{ref:_,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),initValue:e,unitId:h,subUnitId:g,isFocus:v,onChange:(e=``)=>{a(e||``)},onFocus:()=>y(!0)})})}return(0,m.jsx)(f.InputNumber,{className:o,value:Number(s)||0,disabled:l,onChange:e=>{a(e||0)},...x})},Je=e=>{var n;let{interceptorManager:a,SelectComponent:o=f.Select,ColorPickerComponent:s=We,FormulaEditorComponent:c=u.FormulaEditor}=e,l=(0,i.useDependency)(t.LocaleService),p=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.dataBar?e.rule:void 0,[h,g]=(0,d.useState)(()=>{var e;return p&&(e=p.config)!=null&&e.isGradient?`1`:`0`}),[_,v]=(0,d.useState)(()=>{var e;return p&&((e=p.config)==null?void 0:e.positiveColor)||r.defaultDataBarPositiveColor}),[y,b]=(0,d.useState)(()=>{var e;return p&&((e=p.config)==null?void 0:e.nativeColor)||r.defaultDataBarNativeColor}),x=[X(r.CFValueType.num),X(r.CFValueType.percent),X(r.CFValueType.percentile),X(r.CFValueType.formula)],S=[X(r.CFValueType.min),...x].map(e=>({...e,label:l.t(e.label)})),C=[X(r.CFValueType.max),...x].map(e=>({...e,label:l.t(e.label)})),[w,T]=(0,d.useState)(()=>{var e;let t=S[0].value;return p&&((e=p.config)==null?void 0:e.min.type)||t}),[E,D]=(0,d.useState)(()=>{var e;let t=C[0].value;return p&&((e=p.config)==null?void 0:e.max.type)||t}),[O,k]=(0,d.useState)(()=>{var e;if(!p)return 0;let t=((e=p.config)==null?void 0:e.min)||{};return t.type===r.CFValueType.formula?t.value||`=`:t.value||0}),[A,j]=(0,d.useState)(()=>{var e;if(!p)return 100;let t=((e=p.config)==null?void 0:e.max)||{};return t.type===r.CFValueType.formula?t.value||`=`:t.value===void 0?100:t.value}),[M,N]=(0,d.useState)(()=>!p||p.isShowValue===void 0||!!p.isShowValue),P=e=>({config:{min:{type:e.minValueType,value:e.minValue},max:{type:e.maxValueType,value:e.maxValue},isGradient:e.isGradient===`1`,positiveColor:e.positiveColor||r.defaultDataBarPositiveColor,nativeColor:e.nativeColor||r.defaultDataBarNativeColor},type:r.CFRuleType.dataBar,isShowValue:e.isShowValue});(0,d.useEffect)(()=>a.intercept(a.getInterceptPoints().submit,{handler(){return P({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}}),[h,O,w,A,E,_,y,a,M]);let F=t=>{e.onChange(P(t))},I=e=>{v(e),F({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:e,nativeColor:y,isShowValue:M})},L=e=>{b(e),F({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:e,isShowValue:M})},R=e=>x.map(e=>e.value).includes(e);return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:P({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.fillType`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-3`,children:[(0,m.jsxs)(f.RadioGroup,{value:h,onChange:e=>{g(e),F({isGradient:e,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})},children:[(0,m.jsx)(f.Radio,{value:`0`,children:(0,m.jsx)(`span`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.pureColor`)})}),(0,m.jsx)(f.Radio,{value:`1`,children:(0,m.jsx)(`span`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.gradient`)})})]}),(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{checked:!M,onChange:e=>{N(!e),F({isGradient:e,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:!e})}}),l.t(`sheets-conditional-formatting-ui.panel.onlyShowDataBar`)]})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.colorSet`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center`,children:[(0,m.jsx)(`div`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.native`)}),(0,m.jsx)(s,{color:y,onChange:L})]}),(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center univer-gap-3`,children:[(0,m.jsx)(`div`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.positive`)}),(0,m.jsx)(s,{color:_,onChange:I})]})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.min`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-w-1/2 univer-flex-shrink-0`,options:S,value:w,onChange:e=>{T(e);let t=(0,r.createDefaultValueByValueType)(e,10);k(t),F({isGradient:h,minValue:t,minValueType:e,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}}),(0,m.jsx)(qe,{id:`min`,disabled:!R(w),type:w,value:O,FormulaEditorComponent:c,onChange:e=>{k(e||0),F({isGradient:h,minValue:e||0,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}})]}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.max`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-w-1/2 univer-flex-shrink-0`,options:C,value:E,onChange:e=>{D(e);let t=(0,r.createDefaultValueByValueType)(e,90);j(t),F({isGradient:h,minValue:O,minValueType:w,maxValue:t,maxValueType:e,positiveColor:_,nativeColor:y,isShowValue:M})}}),(0,m.jsx)(qe,{disabled:!R(E),id:`max`,type:E,value:A,FormulaEditorComponent:c,onChange:e=>{j(e||0),F({isGradient:h,minValue:O,minValueType:w,maxValue:e||0,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}})]})]})]})},Ye=e=>[t.BooleanNumber.FALSE,void 0].includes(e)?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE,Xe=e=>e!==t.BooleanNumber.FALSE,Ze=e=>{let{style:n,onChange:i,className:a,ColorPickerComponent:o=We}=e,[s,c]=(0,d.useState)(()=>{if(n!=null&&n.bl)return n.bl}),[l,u]=(0,d.useState)(()=>{if(n!=null&&n.it)return n.it}),[p,h]=(0,d.useState)(()=>{if(n!=null&&n.ul)return n.ul.s}),[g,_]=(0,d.useState)(()=>{if(n!=null&&n.st)return n.st.s}),[v,y]=(0,d.useState)(()=>{var e;return n!=null&&(e=n.cl)!=null&&e.rgb?n.cl.rgb:`#2f56ef`}),[b,x]=(0,d.useState)(()=>{var e;return n!=null&&(e=n.bg)!=null&&e.rgb?n.bg.rgb:`#e8ecfc`});(0,d.useEffect)(()=>{let e={bl:s,it:l};v!==void 0&&(e.cl={rgb:v}),b!==void 0&&(e.bg={rgb:b}),g!==void 0&&(e.st={s:g}),p!==void 0&&(e.ul={s:p}),i((0,r.removeUndefinedAttr)(e))},[s,l,p,g,v,b]);let S=`univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1`;return(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-my-2.5 univer-flex univer-justify-between`,a),children:[(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(s||t.BooleanNumber.FALSE)}),onClick:()=>c(Ye(s)),children:(0,m.jsx)(ve,{})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(l||t.BooleanNumber.FALSE)}),onClick:()=>u(Ye(l)),children:(0,m.jsx)(De,{})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(p||t.BooleanNumber.FALSE)}),onClick:()=>h(Ye(p)),children:(0,m.jsx)(Fe,{})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(g||t.BooleanNumber.FALSE)}),onClick:()=>_(Ye(g)),children:(0,m.jsx)(Ne,{})}),(0,m.jsx)(o,{color:v,onChange:y,Icon:ze}),(0,m.jsx)(o,{color:b,onChange:x})]})},Qe=e=>{var n;let{onChange:a,interceptorManager:o,ColorPickerComponent:s,FormulaEditorComponent:c=u.FormulaEditor}=e,l=(0,i.useDependency)(t.LocaleService),h=(0,i.useDependency)(p.LexerTreeBuilder),g=(0,i.useDependency)(t.IUniverInstanceService).getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),_=g.getActiveSheet(),v=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,y=(0,d.useRef)(null),[b,x]=(0,d.useState)(!1),S=(0,d.useRef)(null),[C,w]=(0,d.useState)({}),[T,E]=(0,d.useState)(()=>(v==null?void 0:v.subType)===r.CFSubRuleType.formula?v.value:`=`),[D,O]=(0,d.useState)(void 0),k=e=>({style:e.style,value:T,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});(0,d.useEffect)(()=>o.intercept(o.getInterceptPoints().submit,{handler(){return k({style:C,formula:T})}}),[C,T,o]),(0,d.useEffect)(()=>o.intercept(o.getInterceptPoints().beforeSubmit,{handler:(e,t,n)=>{let r=T.length>1&&T.startsWith(p.operatorToken.EQUALS)&&h.checkIfAddBracket(T)===0;return D||!r?(O(l.t(`sheets-conditional-formatting-ui.errorMessage.formulaError`)),!1):n(e)}}),[D,T,o,h,l]);let A=e=>{a(k(e))};return(0,i.useSidebarClick)(e=>{var t;(t=S.current)!=null&&t.isClickOutSide(e)&&x(!1)}),(0,m.jsxs)(`div`,{ref:y,children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)(c,{ref:S,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),errorText:D,isFocus:b,initValue:T,unitId:g.getUnitId(),subUnitId:_==null?void 0:_.getSheetId(),onFocus:()=>{x(!0)},onChange:e=>{E(e),A({style:C,formula:e})},onVerify:(e,t)=>{!e||t.length===1?O(l.t(`sheets-conditional-formatting-ui.errorMessage.formulaError`)):O(void 0)}})}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:k({style:C,formula:T})})}),(0,m.jsx)(Ze,{ColorPickerComponent:s,style:v==null?void 0:v.style,className:`univer-mt-3`,onChange:e=>{w(e),A({style:e,formula:T})}})]})},$e=e=>(0,m.jsxs)(`div`,{children:[e.children,e.errorText&&(0,m.jsx)(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:e.errorText})]}),et=new Set(Object.values(r.CFTextOperator)),tt=new Set(Object.values(r.CFNumberOperator)),nt=new Set(Object.values(r.CFTimePeriodOperator)),rt=e=>typeof e==`string`&&et.has(e),it=e=>typeof e==`string`&&tt.has(e),at=e=>typeof e==`string`&&nt.has(e),Z=e=>({label:`sheets-conditional-formatting-ui.operator.${e}`,value:e});function ot(e){let{type:n,operator:a,onChange:o,value:s,interceptorManager:c}=e,l=(0,i.useDependency)(t.LocaleService),[u,p]=(0,d.useState)(()=>typeof s==`number`?s:0),[h,g]=(0,d.useState)(``),[_,v]=(0,d.useState)(()=>typeof s==`string`?s:``),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(()=>Array.isArray(s)?s[0]===void 0?0:s[0]:0),[C,w]=(0,d.useState)(``),[T,E]=(0,d.useState)(()=>Array.isArray(s)?s[1]===void 0?100:s[1]:100),[D,O]=(0,d.useState)(``);switch((0,d.useEffect)(()=>{switch(n){case r.CFSubRuleType.text:[r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(a)&&o(_);break;case r.CFSubRuleType.number:[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(a)&&o(u),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(a)&&o([x,T])}},[n]),(0,d.useEffect)(()=>{let e=c.intercept(c.getInterceptPoints().beforeSubmit,{handler:(e,t,i)=>{switch(n){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.containsText,r.CFTextOperator.endsWith,r.CFTextOperator.notEqual,r.CFTextOperator.notContainsText,r.CFTextOperator.equal].includes(a))return _?i(e):(b(l.t(`sheets-conditional-formatting-ui.errorMessage.notBlank`)),!1)}return i(e)}});return()=>{e()}},[n,u,_,a]),n){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(a)){let e=e=>{v(e),o(e)};return(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)($e,{errorText:y,children:(0,m.jsx)(f.Input,{value:_,onChange:t=>{b(``),e(t)}})})})}break;case r.CFSubRuleType.number:if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(a))return(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)($e,{errorText:h,children:(0,m.jsx)(f.InputNumber,{className:`univer-w-full`,min:-(2**53-1),max:2**53-1,value:u,onChange:e=>{p(e||0),o(e||0),g(``)}})})});if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(a))return(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[(0,m.jsx)($e,{errorText:C,children:(0,m.jsx)(f.InputNumber,{min:-(2**53-1),max:2**53-1,value:x,onChange:e=>{S(e||0),o([e||0,T]),w(``)}})}),(0,m.jsx)($e,{errorText:D,children:(0,m.jsx)(f.InputNumber,{className:`univer-ml-3`,min:-(2**53-1),max:2**53-1,value:T,onChange:e=>{E(e||0),o([x,e||0]),O(``)}})})]})}return null}let st=e=>{switch(e){case r.CFSubRuleType.text:return[Z(r.CFTextOperator.containsText),Z(r.CFTextOperator.notContainsText),Z(r.CFTextOperator.beginsWith),Z(r.CFTextOperator.endsWith),Z(r.CFTextOperator.equal),Z(r.CFTextOperator.notEqual),Z(r.CFTextOperator.containsBlanks),Z(r.CFTextOperator.notContainsBlanks),Z(r.CFTextOperator.containsErrors),Z(r.CFTextOperator.notContainsErrors)];case r.CFSubRuleType.number:return[Z(r.CFNumberOperator.between),Z(r.CFNumberOperator.notBetween),Z(r.CFNumberOperator.equal),Z(r.CFNumberOperator.notEqual),Z(r.CFNumberOperator.greaterThan),Z(r.CFNumberOperator.greaterThanOrEqual),Z(r.CFNumberOperator.lessThan),Z(r.CFNumberOperator.lessThanOrEqual)];case r.CFSubRuleType.timePeriod:return[Z(r.CFTimePeriodOperator.yesterday),Z(r.CFTimePeriodOperator.today),Z(r.CFTimePeriodOperator.tomorrow),Z(r.CFTimePeriodOperator.last7Days),Z(r.CFTimePeriodOperator.lastWeek),Z(r.CFTimePeriodOperator.thisWeek),Z(r.CFTimePeriodOperator.nextWeek),Z(r.CFTimePeriodOperator.lastMonth),Z(r.CFTimePeriodOperator.thisMonth),Z(r.CFTimePeriodOperator.nextMonth)];default:return[]}},ct=e=>{var n;let{interceptorManager:a,onChange:o,SelectComponent:s=f.Select,ColorPickerComponent:c}=e,l=(0,i.useDependency)(t.LocaleService),u=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,[p,h]=(0,d.useState)(()=>{let e=r.CFSubRuleType.text;return u&&u.subType||e}),g=[{value:r.CFSubRuleType.text,label:l.t(`sheets-conditional-formatting-ui.subRuleType.text`)},{value:r.CFSubRuleType.number,label:l.t(`sheets-conditional-formatting-ui.subRuleType.number`)},{value:r.CFSubRuleType.timePeriod,label:l.t(`sheets-conditional-formatting-ui.subRuleType.timePeriod`)},{value:r.CFSubRuleType.duplicateValues,label:l.t(`sheets-conditional-formatting-ui.subRuleType.duplicateValues`)},{value:r.CFSubRuleType.uniqueValues,label:l.t(`sheets-conditional-formatting-ui.subRuleType.uniqueValues`)}],_=(0,d.useMemo)(()=>st(p).map(e=>({...e,label:l.t(e.label)})),[l,p]),[v,y]=(0,d.useState)(()=>{var e;let t=(e=_[0])==null?void 0:e.value;return u&&`operator`in u?u.operator:t}),[b,x]=(0,d.useState)(()=>u?`value`in u&&u.value!==void 0?u.value:`operator`in u?(0,r.createDefaultValue)(u.subType,u.operator):``:``),[S,C]=(0,d.useState)({}),w=(0,d.useMemo)(()=>e=>{let t=e.subType??p,n=e.operator??v,i=e.value??b,a=e.style??S;switch(t){case r.CFSubRuleType.duplicateValues:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:a};case r.CFSubRuleType.uniqueValues:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:a};case r.CFSubRuleType.text:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:rt(n)?n:r.CFTextOperator.containsText,style:a,value:typeof i==`string`?i:void 0};case r.CFSubRuleType.timePeriod:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:at(n)?n:r.CFTimePeriodOperator.today,style:a};case r.CFSubRuleType.number:{let e=it(n)?n:r.CFNumberOperator.equal;if(e===r.CFNumberOperator.between||e===r.CFNumberOperator.notBetween){let t=Array.isArray(i)?i:[0,100];return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:e,style:a,value:t}}return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:e,style:a,value:typeof i==`number`?i:void 0}}}},[p,v,b,S]);return(0,d.useEffect)(()=>a.intercept(a.getInterceptPoints().submit,{handler(){return w({})}}),[w,a]),(0,d.useEffect)(()=>{g.some(e=>e.value===p)||h(g[0].value)},[g]),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsxs)(`div`,{className:`univer-flex univer-justify-between univer-gap-4`,children:[(0,m.jsx)(s,{className:`univer-mt-3 univer-w-full`,onChange:e=>{var t,n;let i=(t=g.find(t=>t.value===e))==null?void 0:t.value;if(!i)return;let a=(n=st(i).map(e=>({...e,label:l.t(e.label)}))[0])==null?void 0:n.value;h(i),y(a),a&&x((0,r.createDefaultValue)(i,a)),o(w({subType:i,operator:a}))},value:p,options:g}),(_==null?void 0:_.length)&&(0,m.jsx)(s,{className:`univer-mt-3 univer-w-full`,onChange:e=>{var t;let n=(t=_.find(t=>t.value===e))==null?void 0:t.value;n&&(y(n),o(w({operator:n})))},value:v||``,options:_})]}),(0,m.jsx)(ot,{value:b,interceptorManager:a,type:p,operator:v,rule:u,onChange:e=>{x(e),o(w({value:e}))}},`${p}_${v}`),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:w({})})}),(0,m.jsx)(Ze,{ColorPickerComponent:c,style:u==null?void 0:u.style,className:`univer-ml-1`,onChange:e=>{C(e),o(w({style:e}))}})]})},lt=(e,t)=>(r.iconMap[e]||[])[Number(t)]||``,ut=e=>{var n;let{error:a,type:o,onChange:s,FormulaEditorComponent:c}=e,l=(0,i.useDependency)(t.IUniverInstanceService),u=l.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),p=(n=l.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),h=(0,d.useRef)(null),[g,_]=(0,d.useState)(!1);return(0,i.useSidebarClick)(e=>{var t;(t=h.current)!=null&&t.isClickOutSide(e)&&_(!1)}),(0,m.jsx)(`div`,{className:`univer-relative`,children:o===r.CFValueType.formula?(0,m.jsx)(`div`,{className:`univer-w-full`,children:(0,m.jsx)(c,{ref:h,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),initValue:String(e.value),unitId:u,subUnitId:p,isFocus:g,onChange:(e=``)=>{s(e||``)},onFocus:()=>_(!0)})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.InputNumber,{className:(0,f.clsx)({"univer-border-red-500":a}),value:Number(e.value)||0,onChange:e=>s(e??0)}),a&&(0,m.jsx)(`div`,{className:`univer-absolute univer-text-xs univer-text-red-500`,children:a})]})})},dt=(e,t,n)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),ft=e=>{let{iconType:n,onClick:a}=e,o=(0,i.useDependency)(t.LocaleService),s=(0,i.useObservable)(o.direction$,o.getDirection());return(0,m.jsx)(`div`,{dir:s,className:`univer-w-80`,children:r.iconGroup.map(e=>(0,m.jsxs)(`div`,{className:`univer-mb-4 last:univer-mb-0`,children:[(0,m.jsx)(`div`,{className:`univer-mb-2 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400`,children:o.t(e.title)}),(0,m.jsx)(`div`,{dir:s,"data-u-comp":`cf-icon-set-group-grid`,className:`univer-grid univer-grid-cols-2 univer-gap-1`,children:e.group.map((t,r)=>{let i=t.name===n;return(0,m.jsx)(`button`,{type:`button`,"aria-label":`${o.t(e.title)} ${r+1}`,"aria-pressed":i,className:(0,f.clsx)(`univer-flex univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-justify-start univer-rounded-md univer-border-0 univer-bg-transparent univer-px-2 univer-outline-none univer-transition-colors focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600`,i?`univer-bg-primary-50 univer-ring-1 univer-ring-primary-600 dark:!univer-bg-primary-900`:`hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`),onClick:()=>{a(t.name)},children:(0,m.jsx)(`span`,{dir:s,className:`univer-flex univer-items-center univer-gap-0.5`,children:t.list.map((e,t)=>(0,m.jsx)(`img`,{alt:``,className:`univer-size-5`,src:e,draggable:!1},t))})},t.name)})})]},e.title))})},pt=e=>{let{onClick:n}=e,a=(0,i.useDependency)(t.LocaleService),o=(0,i.useObservable)(a.direction$,a.getDirection()),s=(0,d.useMemo)(()=>{let e=[];for(let t in r.iconMap){let n=t;r.iconMap[n].forEach((t,r)=>{e.push({iconType:n,base64:t,iconId:String(r)})})}return e},[]),c=e=>{n(e.iconType,e.iconId)};return(0,m.jsxs)(`div`,{dir:o,children:[(0,m.jsx)(`div`,{"data-u-comp":`cf-icon-set-no-icon-option`,className:`univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-text-sm`,onClick:()=>c({iconType:r.IIconSetType.empty,iconId:``,base64:``}),children:a.t(`sheets-conditional-formatting-ui.iconSet.noCellIcon`)}),(0,m.jsx)(`div`,{className:`univer-flex univer-w-64 univer-flex-wrap univer-gap-2`,children:s.map(e=>(0,m.jsx)(`div`,{className:`univer-mb-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`,children:(0,m.jsx)(`img`,{className:`univer-size-5`,src:e.base64,draggable:!1,onClick:()=>c(e)})},`${e.iconType}_${e.iconId}`))})]})},mt=e=>{let{onChange:n,configList:a,errorMap:o={},DropdownComponent:s,SelectComponent:c,FormulaEditorComponent:l}=e,u=(0,i.useDependency)(t.LocaleService),p=[{label:u.t(`sheets-conditional-formatting-ui.symbol.${r.CFNumberOperator.greaterThan}`),value:r.CFNumberOperator.greaterThan},{label:u.t(`sheets-conditional-formatting-ui.symbol.${r.CFNumberOperator.greaterThanOrEqual}`),value:r.CFNumberOperator.greaterThanOrEqual}],h=[{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.num}`),value:r.CFValueType.num},{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.percent}`),value:r.CFValueType.percent},{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.percentile}`),value:r.CFValueType.percentile},{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.formula}`),value:r.CFValueType.formula}],g=(e,t)=>{n([String(t),`value`,`value`],e)},_=(e,t)=>{n([String(t),`operator`],e);let i=(0,r.createDefaultValue)(r.CFSubRuleType.number,e);g(i,t)},v=(e,t)=>{n([String(t),`value`,`type`],e);let i=a[t],o=(0,r.createDefaultValue)(r.CFSubRuleType.number,i.operator);g(o,t)};return(0,d.useMemo)(()=>a.map((e,t)=>{let i=o[t],d=lt(e.iconType,e.iconId),y=t===a.length-1,b=t===0,x=a[t-1],S=(x==null?void 0:x.value.type)===r.CFValueType.formula?u.t(`sheets-conditional-formatting-ui.valueType.formula`):x==null?void 0:x.value.value;return(0,m.jsxs)(`div`,{className:t?`univer-mt-6`:`univer-mt-3`,children:[(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[(0,m.jsxs)(`div`,{className:`univer-w-[45%]`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.icon`),t+1]}),(0,m.jsx)(`div`,{className:`univer-w-[45%]`,children:(0,m.jsxs)(m.Fragment,{children:[!b&&!y&&u.t(`sheets-conditional-formatting-ui.iconSet.rule`),!b&&!y&&(0,m.jsxs)(`span`,{className:`univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.when`),` `,u.t(`sheets-conditional-formatting-ui.symbol.${(0,r.getOppositeOperator)(x.operator)}`),S,y?``:` ${u.t(`sheets-conditional-formatting-ui.iconSet.and`)} `]})]})})]}),(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-rule-grid`,className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 rtl:univer-grid-flow-dense`,children:[(0,m.jsx)(`div`,{className:`univer-flex univer-items-center`,children:(0,m.jsx)(s,{overlay:(0,m.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,m.jsx)(pt,{onClick:(r,i)=>{let a={...e,iconId:i,iconType:r};n([String(t)],a)},iconId:e.iconId,iconType:e.iconType})}),children:(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200`,f.borderClassName),children:[d?(0,m.jsx)(`img`,{src:d,className:`univer-size-4`,draggable:!1}):(0,m.jsx)(Ue,{}),(0,m.jsx)(ke,{})]})})}),y?(0,m.jsxs)(`div`,{className:`univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.rule`),(0,m.jsxs)(`span`,{className:`univer-font-medium`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.when`),` `,u.t(`sheets-conditional-formatting-ui.symbol.${(0,r.getOppositeOperator)(x.operator)}`),S,y?``:` ${u.t(`sheets-conditional-formatting-ui.iconSet.and`)} `]})]}):(0,m.jsx)(c,{options:p,value:e.operator,onChange:e=>{_(e,t)}})]}),y?(0,m.jsx)(`div`,{}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[(0,m.jsx)(`div`,{children:u.t(`sheets-conditional-formatting-ui.iconSet.type`)}),(0,m.jsx)(`div`,{children:u.t(`sheets-conditional-formatting-ui.iconSet.value`)})]}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4`,children:[(0,m.jsx)(c,{options:h,value:e.value.type,onChange:e=>{v(e,t)}}),(0,m.jsx)(ut,{id:t,type:e.value.type,error:i,value:e.value.value||``,FormulaEditorComponent:l,onChange:e=>{g(e,t)}})]})]})]},t)}),[a,s,o,l,c])},ht=e=>{var n;let{interceptorManager:a,DropdownComponent:o=f.Dropdown,SelectComponent:s=f.Select,FormulaEditorComponent:c=u.FormulaEditor}=e,l=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.iconSet?e.rule:void 0,p=(0,i.useDependency)(t.LocaleService),h=(0,i.useObservable)(p.direction$,p.getDirection()),[g,_]=(0,d.useState)({}),[v,y]=(0,d.useState)(()=>{let e=Object.keys(r.iconMap)[0];if(l&&l.config.length){let e=l.config[0].iconType;if(!l.config.some(t=>t.iconType!==e))return e}return e}),[b,x]=(0,d.useState)(()=>{if(l&&l.config.length)return t.Tools.deepClone(l==null?void 0:l.config);let e=r.iconMap[v]||[];return Array(e.length).fill(``).map((e,t,n)=>t===n.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:2**53-1},iconType:v,iconId:String(t)}:dt(v,t,n))}),[S,C]=(0,d.useState)(()=>!l||!!l.isShowValue),w=(0,d.useMemo)(()=>{let e=b.map(e=>lt(e.iconType,e.iconId));return(0,m.jsx)(`div`,{"data-u-comp":`cf-icon-set-preview`,className:`univer-flex univer-items-center rtl:univer-flex-row-reverse`,children:e.map((e,t)=>e?(0,m.jsx)(`img`,{className:`univer-size-5`,src:e},t):(0,m.jsx)(Ue,{className:`univer-size-5`},t))})},[b]),T=e=>{if(e.reduce((t,n,i)=>t.preType&&!t.result||e.length-1===i?t:n.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:t.preType?{result:t.preType===n.value.type,preType:n.value.type}:{result:!0,preType:n.value.type},{result:!0,preType:``}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(e[0].value.type)){let t={};return e.forEach((n,i,a)=>{if(i-1<0||i===a.length-1)return;let o=e[i-1],s=(0,r.getOppositeOperator)(o.operator);(0,r.compareWithNumber)({operator:s,value:o.value.value},n.value.value)||(t[i]=`${p.t(`sheets-conditional-formatting-ui.form.${s}`,String(o.value.value))} `)}),t}return{}};return(0,d.useEffect)(()=>{let e=a.intercept(a.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:S,config:b}}});return()=>{e()}},[S,b,a]),(0,d.useEffect)(()=>{let e=a.intercept(a.getInterceptPoints().beforeSubmit,{handler(){let e=T(b);return _(e),Object.keys(e).length===0}});return()=>{e()}},[S,b,a,g]),(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-editor`,dir:h,children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600`,children:p.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)(o,{overlay:(0,m.jsx)(`div`,{dir:h,className:`univer-rounded-lg univer-p-3`,children:(0,m.jsx)(ft,{iconType:v,onClick:e=>{y(e);let t=r.iconMap[e]||[],n=Array(t.length).fill(``).map((t,n,r)=>dt(e,n,r));x(n),_(T(n))}})}),children:(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600`,f.borderClassName),children:[w,(0,m.jsx)(ke,{})]})})}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2 univer-text-xs rtl:univer-flex-row-reverse rtl:univer-justify-end`,children:[(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-option-row`,className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{onChange:()=>{let e=b.map(e=>({...e}));b.forEach((t,n)=>{let r=b.length-1-n,i=e[r];t.iconId=i.iconId,t.iconType=i.iconType}),x([...b])}}),p.t(`sheets-conditional-formatting-ui.iconSet.reverseIconOrder`)]}),(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-option-row`,className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{checked:!S,onChange:e=>{C(!e)}}),p.t(`sheets-conditional-formatting-ui.iconSet.onlyShowIcon`)]})]}),(0,m.jsx)(mt,{errorMap:g,onChange:(e,n)=>{(0,t.get)(b,e)!==n&&((0,t.set)(b,e,n),x([...b]),_(T(b)))},configList:b,DropdownComponent:o,SelectComponent:s,FormulaEditorComponent:c})]})},gt=e=>{var n;let{onChange:a,interceptorManager:o,SelectComponent:s=f.Select,ColorPickerComponent:c}=e,l=(0,i.useDependency)(t.LocaleService),u=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,p=[{label:l.t(`sheets-conditional-formatting-ui.panel.isNotBottom`),value:`isNotBottom`},{label:l.t(`sheets-conditional-formatting-ui.panel.isBottom`),value:`isBottom`},{label:l.t(`sheets-conditional-formatting-ui.panel.greaterThanAverage`),value:`greaterThanAverage`},{label:l.t(`sheets-conditional-formatting-ui.panel.lessThanAverage`),value:`lessThanAverage`}],[h,g]=(0,d.useState)(()=>{let e=p[0].value,t=u==null?void 0:u.type;if(!u)return e;switch(t){case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.average:return[r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual].includes(u.operator)?`greaterThanAverage`:[r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(u.operator)?`lessThanAverage`:e;case r.CFSubRuleType.rank:return u.isBottom?`isBottom`:`isNotBottom`}}return e}),[_,v]=(0,d.useState)(()=>{let e=u==null?void 0:u.type;if(!u)return 10;switch(e){case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.rank:return u.value||10}}return 10}),[y,b]=(0,d.useState)(()=>{let e=u==null?void 0:u.type;if(!u)return!1;switch(e){case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.rank:return u.isPercent||!1}}return!1}),[x,S]=(0,d.useState)({}),C=e=>{let{type:t,isPercent:n,value:i,style:a}=e;switch(t){case`isNotBottom`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:n,isBottom:!1,value:i,style:a};case`isBottom`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:n,isBottom:!0,value:i,style:a};case`greaterThanAverage`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:a};case`lessThanAverage`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:a}}};(0,d.useEffect)(()=>o.intercept(o.getInterceptPoints().submit,{handler(){return C({type:h,isPercent:y,value:_,style:x})}}),[h,y,_,x,o]);let w=e=>{a(C(e))};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(s,{className:`univer-mt-3 univer-w-full`,value:h,options:p,onChange:e=>{var t;let n=(t=p.find(t=>t.value===e))==null?void 0:t.value;n&&(g(n),w({type:n,isPercent:y,value:_,style:x}))}}),[`isNotBottom`,`isBottom`].includes(h)&&(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsx)(f.InputNumber,{min:1,max:1e3,value:_,onChange:e=>{let t=e||0;v(t),w({type:h,isPercent:y,value:t,style:x})}}),(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{checked:y,onChange:e=>{b(!!e),w({type:h,isPercent:!!e,value:_,style:x})}}),l.t(`sheets-conditional-formatting-ui.valueType.percent`)]})]}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:C({type:h,isPercent:y,value:_,style:x})})}),(0,m.jsx)(Ze,{ColorPickerComponent:c,style:u==null?void 0:u.style,className:`univer-mt-3`,onChange:e=>{S(e),w({type:h,isPercent:y,value:_,style:e})}})]})},_t=(0,t.createInterceptorKey)(`beforeSubmit`),vt=(0,t.createInterceptorKey)(`submit`),yt=e=>e.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),bt=e=>{var n;return(n=e.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId()},xt=e=>{var a,o;let{SelectComponent:s=f.Select,DropdownComponent:c,ColorPickerComponent:l,RangeSelectorComponent:h=u.RangeSelector,FormulaEditorComponent:g=u.FormulaEditor}=e,_=(0,i.useDependency)(t.LocaleService),v=(0,i.useDependency)(t.ICommandService),y=(0,i.useDependency)(t.IUniverInstanceService),b=(0,i.useDependency)(r.ConditionalFormattingRuleModel),x=(0,i.useDependency)(n.SheetsSelectionsService),S=yt(y),C=bt(y),[w,T]=(0,d.useState)(void 0),E=(0,d.useRef)(((a=e.rule)==null?void 0:a.ranges)??[]),D=(0,d.useRef)(!1),O=(0,d.useMemo)(()=>{var t;let n=(t=e.rule)==null?void 0:t.ranges;if(!(n!=null&&n.length)){var r;n=((r=x.getCurrentSelections())==null?void 0:r.map(e=>e.range))??[]}return E.current=n,n!=null&&n.length?n.map(e=>{let t=(0,p.serializeRange)(e);return t===`NaN`?``:t}).filter(e=>!!e).join(`,`):``},[e.rule]),k=[{label:_.t(`sheets-conditional-formatting-ui.ruleType.highlightCell`),value:`1`},{label:_.t(`sheets-conditional-formatting-ui.panel.rankAndAverage`),value:`2`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.dataBar`),value:`3`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.colorScale`),value:`4`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.formula`),value:`5`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.iconSet`),value:`6`}],[A,j]=(0,d.useState)(()=>{var t;let n=(t=e.rule)==null?void 0:t.rule.type,i=k[0].value;if(!n)return i;switch(n){case r.CFRuleType.highlightCell:var a;switch((a=e.rule)==null?void 0:a.rule.subType){case r.CFSubRuleType.number:case r.CFSubRuleType.text:case r.CFSubRuleType.duplicateValues:case r.CFSubRuleType.uniqueValues:case r.CFSubRuleType.timePeriod:return`1`;case r.CFSubRuleType.average:case r.CFSubRuleType.rank:return`2`;case r.CFSubRuleType.formula:return`5`}break;case r.CFRuleType.dataBar:return`3`;case r.CFRuleType.colorScale:return`4`;case r.CFRuleType.iconSet:return`6`}return i}),M=(0,d.useRef)(void 0),N=(0,d.useMemo)(()=>new t.InterceptorManager({beforeSubmit:_t,submit:vt}),[]),P=(0,d.useMemo)(()=>{switch(A){case`1`:return ct;case`2`:return gt;case`3`:return Je;case`4`:return Ke;case`5`:return Qe;case`6`:return ht;default:return ct}},[A]);(0,d.useEffect)(()=>{let t=v.onCommandExecuted(t=>{if(t.id===n.RemoveSheetMutation.id){let n=t.params;n.subUnitId===C&&n.unitId===S&&e.onCancel()}t.id===n.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>t.dispose()},[]);let F=e=>{M.current=e},I=e=>{if(!D.current&&e.length<1&&E.current.length>0)return;D.current=!0;let t=e.split(`,`).filter(e=>!!e).map(p.deserializeRangeWithSheet).map(e=>e.range);E.current=t};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:_.t(`sheets-conditional-formatting-ui.panel.range`)}),(0,m.jsxs)(`div`,{className:`univer-mt-4`,children:[(0,m.jsx)(h,{unitId:S,subUnitId:C,initialValue:O,onChange:(e,t)=>I(t),onVerify:(e,t)=>{if(!D.current&&!e&&t.length<1){T(void 0);return}e?t.length<1?T(_.t(`sheets-conditional-formatting-ui.errorMessage.rangeError`)):T(void 0):T(_.t(`sheets-conditional-formatting-ui.errorMessage.rangeError`))}}),w&&(0,m.jsx)(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:w})]}),(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:_.t(`sheets-conditional-formatting-ui.panel.styleType`)}),(0,m.jsx)(s,{className:`univer-mt-4 univer-w-full`,value:A,options:k,onChange:e=>j(e)}),(0,m.jsx)(P,{interceptorManager:N,rule:(o=e.rule)==null?void 0:o.rule,onChange:F,SelectComponent:s,DropdownComponent:c,ColorPickerComponent:l,FormulaEditorComponent:g}),(0,m.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-end univer-gap-2`,children:[(0,m.jsx)(f.Button,{onClick:()=>{e.onCancel()},children:_.t(`sheets-conditional-formatting-ui.panel.cancel`)}),(0,m.jsx)(f.Button,{variant:`primary`,onClick:()=>{let i=(()=>{let e=y.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!e)throw Error(`No active sheet found`);return E.current.map(t=>(0,n.setEndForRange)(t,e.getRowCount(),e.getColumnCount())).filter(e=>!(Number.isNaN(e.startRow)||Number.isNaN(e.startColumn)))})();if(i.length<1){T(_.t(`sheets-conditional-formatting-ui.errorMessage.rangeError`));return}if(N.fetchThroughInterceptors(N.getInterceptPoints().beforeSubmit)(!0,null)){let t=N.fetchThroughInterceptors(N.getInterceptPoints().submit)(null,null);if(t){let n=yt(y),a=bt(y);if(!n||!a)throw Error(`No active sheet found`);let o={};e.rule&&e.rule.cfId?(o={...e.rule,ranges:i,rule:t},v.executeCommand(r.SetCfCommand.id,{unitId:n,subUnitId:a,rule:o}),e.onCancel()):(o={cfId:b.createCfId(n,a),ranges:i,rule:t,stopIfTrue:!1},v.executeCommand(r.AddCfCommand.id,{unitId:n,subUnitId:a,rule:o}),e.onCancel())}}},children:_.t(`sheets-conditional-formatting-ui.panel.submit`)})]})]})},St=(e,t)=>{let n=e.rule;switch(n.type){case r.CFRuleType.colorScale:return t.t(`sheets-conditional-formatting-ui.ruleType.colorScale`);case r.CFRuleType.dataBar:return t.t(`sheets-conditional-formatting-ui.ruleType.dataBar`);case r.CFRuleType.iconSet:return t.t(`sheets-conditional-formatting-ui.ruleType.iconSet`);case r.CFRuleType.highlightCell:switch(n.subType){case r.CFSubRuleType.average:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`,t.t(`sheets-conditional-formatting-ui.subRuleType.average`))}case r.CFSubRuleType.duplicateValues:return t.t(`sheets-conditional-formatting-ui.subRuleType.duplicateValues`);case r.CFSubRuleType.uniqueValues:return t.t(`sheets-conditional-formatting-ui.subRuleType.uniqueValues`);case r.CFSubRuleType.number:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`,...Array.isArray(n.value)?n.value.map(e=>String(e)):[String(n.value||``)])}case r.CFSubRuleType.text:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`,n.value||``)}case r.CFSubRuleType.timePeriod:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`)}case r.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t(`sheets-conditional-formatting-ui.preview.describe.bottomNPercent`,String(n.value)):t.t(`sheets-conditional-formatting-ui.preview.describe.topNPercent`,String(n.value)):n.isBottom?t.t(`sheets-conditional-formatting-ui.preview.describe.bottomN`,String(n.value)):t.t(`sheets-conditional-formatting-ui.preview.describe.topN`,String(n.value));case r.CFSubRuleType.formula:return t.t(`sheets-conditional-formatting-ui.ruleType.formula`)}}};function Ct(e){let{SelectComponent:s=f.Select}=e,{onClick:c}=e,l=(0,i.useDependency)(r.ConditionalFormattingRuleModel),u=(0,i.useDependency)(t.IUniverInstanceService),h=(0,i.useDependency)(n.SheetsSelectionsService),g=(0,i.useDependency)(t.ICommandService),_=(0,i.useDependency)(t.LocaleService),v=(0,i.useDependency)(t.Injector),y=(0,i.useDependency)(H),b=(0,i.useObservable)(()=>u.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),x=b.getUnitId(),S=b.getActiveSheet().getSheetId(),[C,w]=(0,d.useState)([]),[T,E]=(0,d.useState)(`2`),[D,O]=(0,d.useState)(``),k=[{label:_.t(`sheets-conditional-formatting-ui.panel.workSheet`),value:`2`},{label:_.t(`sheets-conditional-formatting-ui.panel.selectedRange`),value:`1`}],A=()=>{let e=l.getSubunitRules(x,S);if(!e||!e.length)return[];if(T===`1`){let n=h.getCurrentLastSelection();if(!n)return[];let r=n.range;return e.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,r)))}return T===`2`?[...e]:[]},j=(0,i.useObservable)(()=>{let e=new o.Observable(e=>{let t=[n.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],i=g.onCommandExecuted(r=>{var i;if(r.id===n.SetWorksheetActiveOperation.id){e.next(`immediate`);return}let a=(i=r.params)==null?void 0:i.unitId;T===`1`&&t.includes(r.id)&&a===x&&e.next(`debounced`)});return()=>i.dispose()}).pipe((0,o.share)());return(0,o.merge)(l.$ruleChange,e.pipe((0,o.filter)(e=>e===`immediate`)),e.pipe((0,o.filter)(e=>e===`debounced`),(0,o.debounceTime)(16))).pipe((0,o.map)(A),(0,o.startWith)(A()))},[],!1,[g,l,T,S,x]);(0,a.useHighlightRange)(C);let M=e=>{var n;let i=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=(n=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId();if(!i||!a)throw Error(`No active sheet found`);g.executeCommand(r.DeleteCfCommand.id,{unitId:i,subUnitId:a,cfId:e.cfId})},N=(e,t)=>{let n=L[t.y];O((n==null?void 0:n.cfId)??``)},P=(e,n,i)=>{var a,o,s;O(``);let c=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(a=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:a.getSheetId();if(!c||!l)throw Error(`No active sheet found`);let d=e=>{let t=L.length;return Math.min(t-1,Math.max(0,e))},f=(o=L[d(n.y)])==null?void 0:o.cfId,p=(s=L[d(i.y)])==null?void 0:s.cfId;f&&p&&f!==p&&g.executeCommand(r.MoveCfCommand.id,{unitId:c,subUnitId:l,start:{id:f,type:`self`},end:{id:p,type:i.y>n.y?`after`:`before`}})},F=()=>{e.onCreate()},I=()=>{T===`2`?g.executeCommand(r.ClearWorksheetCfCommand.id):T===`1`&&j.map(e=>({unitId:x,subUnitId:S,cfId:e.cfId})).forEach(e=>{g.executeCommand(r.DeleteCfCommand.id,e)})},L=(0,d.useMemo)(()=>{let e=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),r=e.getActiveSheet();return j.filter(t=>{let i=t.ranges;return(0,n.checkRangesEditablePermission)(v,e.getUnitId(),r.getSheetId(),i)})},[j]),R=(0,d.useMemo)(()=>{let e=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),r=e.getActiveSheet();return j.every(t=>{let i=t.ranges;return(0,n.checkRangesEditablePermission)(v,e.getUnitId(),r.getSheetId(),i)})},[j]);return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`univer-mb-2 univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm`,children:[(0,m.jsx)(`div`,{className:`univer-flex univer-items-center univer-gap-2`,children:y.tWithReactNode(`sheets-conditional-formatting-ui.panel.managerRuleSelect`,(0,m.jsx)(s,{className:`univer-w-36`,options:k,value:T,onChange:e=>{E(e)}})).map((e,t)=>(0,m.jsx)(`span`,{children:e},t))}),(0,m.jsxs)(`div`,{className:`univer-flex univer-justify-end univer-gap-2`,children:[(0,m.jsx)(f.Tooltip,{title:_.t(`sheets-conditional-formatting-ui.panel.createRule`),placement:`bottom`,children:(0,m.jsx)(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:F,children:(0,m.jsx)(Te,{})})}),j.length&&R?(0,m.jsx)(f.Tooltip,{title:_.t(`sheets-conditional-formatting-ui.panel.clear`),placement:`bottom`,children:(0,m.jsx)(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:I,children:(0,m.jsx)(K,{className:`univer-text-red-500`})})}):(0,m.jsx)(`div`,{children:(0,m.jsx)(K,{className:`univer-text-gray-300`})})]})]}),(0,m.jsx)(`div`,{children:(0,m.jsx)(f.DraggableList,{className:`univer-w-full`,draggableHandle:`.draggableHandle`,list:L,onListChange:()=>void 0,idKey:`cfId`,rowHeight:60,margin:[0,10],onDragStop:P,onDragStart:N,itemRender:e=>(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 rtl:univer-pl-8 rtl:univer-pr-5 dark:hover:!univer-bg-gray-700`,{"univer-bg-gray-100 dark:!univer-bg-gray-700":D===e.cfId}),onMouseMove:()=>{e.ranges!==C&&w(e.ranges)},onMouseLeave:()=>w([]),onClick:()=>{c(e)},children:[(0,m.jsx)(`div`,{className:(0,f.clsx)(`univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex rtl:univer-left-auto rtl:univer-right-0`,`draggableHandle`),onClick:e=>e.stopPropagation(),children:(0,m.jsx)(Ce,{})}),(0,m.jsxs)(`div`,{className:`univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden`,children:[(0,m.jsx)(`div`,{className:`univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0`,children:St(e,_)}),(0,m.jsx)(`div`,{className:`univer-max-w-[250px] univer-overflow-hidden univer-text-ellipsis univer-text-xs univer-text-gray-400`,children:e.ranges.map(e=>(0,p.serializeRange)(e)).join(`,`)})]}),(0,m.jsx)(`div`,{children:(0,m.jsx)(q,{rule:e.rule})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(`univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200 rtl:univer-left-1 rtl:univer-right-auto`,{"univer-flex univer-items-center univer-justify-center":D===e.cfId}),onClick:t=>{t.stopPropagation(),M(e),w([])},children:(0,m.jsx)(K,{})})]})})})]})}let wt=e=>{let{RuleEditComponent:t=xt,RuleListComponent:n=Ct}=e,[r,i]=(0,d.useState)(e.rule),[a,o]=(0,d.useState)(!!e.rule);return(0,m.jsx)(`div`,{className:`univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4`,children:a?(0,m.jsx)(t,{onCancel:()=>{o(!1),i(void 0)},rule:r}):(0,m.jsx)(n,{onClick:e=>{i(e),o(!0)},onCreate:()=>{o(!0)}})})};function Tt(e){return(0,m.jsx)(We,{...e,DropdownComponent:f.MobileDropdown,PickerComponent:f.MobileColorPicker})}function Et(e){let t=(0,i.useDependency)(i.ComponentManager).get(a.EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);return(0,m.jsx)(xt,{...e,SelectComponent:f.MobileSelect,DropdownComponent:f.MobileDropdown,ColorPickerComponent:Tt,RangeSelectorComponent:u.MobileRangeSelector,FormulaEditorComponent:t})}function Dt(e){return(0,m.jsx)(Ct,{...e,SelectComponent:f.MobileSelect})}function Ot(e){return(0,m.jsx)(wt,{...e,RuleEditComponent:Et,RuleListComponent:Dt})}let kt=class extends t.Disposable{constructor(e,t){super(),this.disposeWithMe(e.register(T,Ot)),this.disposeWithMe(t.register({ConditionsDoubleIcon:Le,DataBarIcon:be,RatingIcon:je}))}};kt=j([A(0,(0,t.Inject)(i.ComponentManager)),A(1,(0,t.Inject)(i.IconManager))],kt);let At={[i.RibbonDataGroup.RULES]:{[N.id]:{order:1,menuItemFactory:R}}},jt=class extends t.Disposable{constructor(e){super(),e.mergeMenu(At)}};jt=j([A(0,i.IMenuManagerService)],jt);let Q=class extends t.Plugin{constructor(e=z,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},z,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(le,o),this._initCommand()}onStarting(){(0,t.registerDependencies)(this._injector,[[kt],[W],[V],[U],[H],[B],[M],[jt]]),(0,t.touchDependencies)(this._injector,[[kt],[W],[B]])}onReady(){(0,t.touchDependencies)(this._injector,[[jt],[M]])}onRendered(){(0,t.touchDependencies)(this._injector,[[V],[U],[H]])}_initCommand(){[h,g,_,y,v,b,x,S,C,w,N].forEach(e=>{this._commandService.registerCommand(e)})}};k(Q,`pluginName`,`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),k(Q,`packageName`,se),k(Q,`version`,ce),k(Q,`type`,t.UniverInstanceType.UNIVER_SHEET),Q=j([(0,t.DependentOn)(c.UniverRenderEnginePlugin,n.UniverSheetsPlugin,l.UniverSheetsFormulaPlugin,u.UniverSheetsFormulaMobileUIPlugin,r.UniverSheetsConditionalFormattingPlugin,a.UniverSheetsMobileUIPlugin),A(1,(0,t.Inject)(t.Injector)),A(2,(0,t.Inject)(t.ICommandService)),A(3,t.IConfigService)],Q);let Mt=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingRangeTransformService=i,this._initAutoFill()}_initAutoFill(){let e=()=>({redos:[],undos:[]}),i=(i,o)=>{var s,c;let l=(s=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getUnitId(),u=(c=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(c=c.getActiveSheet())==null?void 0:c.getSheetId(),d=new Map,f=new Map,p=[],m=[];if(!l||!u)return e();let h=(0,a.virtualizeDiscreteRanges)([i,o]),[g,_]=h.ranges,v=n.AutoFillTools.getAutoFillRepeatRange(g,_),y=v.flatMap(e=>h.mapRange(t.Rectangle.getPositionRange(e.relativeRange,{startRow:e.repeatStartCell.row,endRow:e.repeatStartCell.row,startColumn:e.repeatStartCell.col,endColumn:e.repeatStartCell.col}))),b=e=>{let t=f.get(e);return t||(t={add:[],remove:[]},f.set(e,t)),t};return(this._conditionalFormattingRuleModel.getSubunitRules(l,u)??[]).forEach(e=>{t.Rectangle.doAnyRangesIntersect(e.ranges,y)&&(d.set(e.cfId,e.ranges),b(e.cfId).remove.push(...y));let n=e.ranges.flatMap(e=>{let n=h.projectRange(e),r=n&&(0,t.getIntersectRange)(n,g);return r?[t.Rectangle.getRelativeRange(r,g)]:[]}),r=v.flatMap(e=>n.flatMap(n=>{let r=(0,t.getIntersectRange)(n,e.relativeRange);return r?h.mapRange(t.Rectangle.getPositionRange(r,{startRow:e.repeatStartCell.row,endRow:e.repeatStartCell.row,startColumn:e.repeatStartCell.col,endColumn:e.repeatStartCell.col})):[]}));r.length&&(d.set(e.cfId,e.ranges),b(e.cfId).add.push(...r))}),f.forEach((e,t)=>{let n=d.get(t);n&&d.set(t,this._conditionalFormattingRangeTransformService.applyRangeDelta(n,e.remove,e.add))}),d.forEach((e,t)=>{let n=this._conditionalFormattingRuleModel.getRule(l,u,t);if(n){if(e.length){let t={unitId:l,subUnitId:u,rule:{...n,ranges:e}};p.push({id:r.SetConditionalRuleMutation.id,params:t}),m.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,t))}else{let e={unitId:l,subUnitId:u,cfId:n.cfId};p.push({id:r.DeleteConditionalRuleMutation.id,params:e}),m.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}),{undos:m,redos:p}},o={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(t,r,a)=>{if(a===n.AUTO_FILL_APPLY_TYPE.COPY||a===n.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||a===n.AUTO_FILL_APPLY_TYPE.SERIES){let{source:e,target:n}=t;return i(e,n)}return e()}};this.disposeWithMe(this._autoFillService.addHook(o))}};Mt=j([A(0,(0,t.Inject)(t.Injector)),A(1,(0,t.Inject)(t.IUniverInstanceService)),A(2,(0,t.Inject)(n.IAutoFillService)),A(3,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(4,(0,t.Inject)(r.ConditionalFormattingRangeTransformService))],Mt);let Nt=class extends t.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(n.AFTER_CELL_EDIT,{handler:(e,t,n)=>{e||n(e);let r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),i=(r==null?void 0:r.style)??{},a=Object.keys(i);if(e!=null&&e.p){var o;return(o=e.p.body)==null||(o=o.textRuns)==null||o.forEach(e=>{e.ts&&a.forEach(t=>{var n;(n=e.ts)==null||delete n[t]})}),n(e)}{let r={...(typeof(e==null?void 0:e.s)==`string`?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};return a.forEach(e=>{delete r[e]}),n({...e,s:{...r}})}}})))}};Nt=j([A(0,(0,t.Inject)(n.SheetInterceptorService)),A(1,(0,t.Inject)(r.ConditionalFormattingService))],Nt);let Pt=(e,t)=>{let n=e=>e.endRow-e.startRow+1,r=e=>e.endColumn-e.startColumn+1,i=n(t)%n(e),a=r(t)%r(e),o=Math.floor(n(t)/n(e)),s=Math.floor(r(t)/r(e)),c=[],l={startRow:0,endRow:n(e)-1,startColumn:0,endColumn:r(e)-1};if(n(t)===1&&r(t)===1){let e={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return c.push({repeatRelativeRange:l,startRange:e}),c}for(let u=0;u<o+(i?.1:0);u++)for(let d=0;d<s+(a?.1:0);d++){let f=n(e)*u,p=r(e)*d,m={startRow:f+t.startRow,endRow:f+t.startRow,startColumn:p+t.startColumn,endColumn:p+t.startColumn},h=l;u===o&&i&&(h={...h},h.endRow-=n(e)-i),d===s&&a&&(h={...h},h.endColumn-=r(e)-a),c.push({repeatRelativeRange:h,startRange:m})}return c},Ft=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._injector=e,this._univerInstanceService=t,this._formatPainterService=n,this._sheetsSelectionsService=r,this._conditionalFormattingRuleModel=i,this._conditionalFormattingRangeTransformService=a,k(this,`_painterConfig`,null),this._initFormattingPainter()}_initFormattingPainter(){let e=()=>({redos:[],undos:[]}),n=(n,i,a)=>{let{range:o,unitId:s,subUnitId:c}=this._painterConfig,l=n!==s||c!==i,u=new Map,d=new Map,f=[],p=[];if(!n||!i||!s||!c)return e();let m=Pt(o,a),h=m.map(e=>t.Rectangle.getPositionRange(e.repeatRelativeRange,e.startRange)),g=e=>{let t=d.get(e);return t||(t={add:[],remove:[]},d.set(e,t)),t},_=this._conditionalFormattingRuleModel.getSubunitRules(n,i)??[],v=new Map;_.forEach(e=>{t.Rectangle.doAnyRangesIntersect(e.ranges,h)&&(u.set(e.cfId,e.ranges),g(e.cfId).remove.push(...h))});let y=this._conditionalFormattingRuleModel.getSubunitRules(s,c)??[];return(l?[...y].reverse():y).forEach(e=>{let r=e.ranges.flatMap(e=>{let n=(0,t.getIntersectRange)(e,o);return n?[t.Rectangle.getRelativeRange(n,o)]:[]}),a=m.flatMap(e=>r.flatMap(n=>{let r=(0,t.getIntersectRange)(n,e.repeatRelativeRange);return r?[t.Rectangle.getPositionRange(r,e.startRange)]:[]}));if(a.length){let r=e.cfId;l&&(r=this._conditionalFormattingRuleModel.createCfId(n,i),v.set(r,{...t.Tools.deepClone(e),cfId:r,ranges:[]}),u.set(r,[])),u.has(r)||u.set(r,e.ranges),g(r).add.push(...a)}}),d.forEach((e,t)=>{let n=u.get(t);n&&u.set(t,this._conditionalFormattingRangeTransformService.applyRangeDelta(n,e.remove,e.add))}),u.forEach((e,t)=>{if(l){let a=v.get(t);if(a){if(e.length){let t={unitId:n,subUnitId:i,rule:{...a,ranges:e}};f.push({id:r.AddConditionalRuleMutation.id,params:t}),p.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,t))}return}let o=this._conditionalFormattingRuleModel.getRule(n,i,t);if(o){if(e.length){let t={unitId:n,subUnitId:i,rule:{...o,ranges:e}};f.push({id:r.SetConditionalRuleMutation.id,params:t}),p.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,t))}else{let e={unitId:n,subUnitId:i,cfId:o.cfId};f.push({id:r.DeleteConditionalRuleMutation.id,params:e}),p.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}else{let n=this._conditionalFormattingRuleModel.getRule(s,c,t);if(!n)return;if(e.length){let t={unitId:s,subUnitId:c,rule:{...n,ranges:e}};f.push({id:r.SetConditionalRuleMutation.id,params:t}),p.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,t))}else{let e={unitId:s,subUnitId:c,cfId:n.cfId};f.push({id:r.DeleteConditionalRuleMutation.id,params:e}),p.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}),{undos:p,redos:f}},i={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:e=>{switch(e){case a.FormatPainterStatus.INFINITE:case a.FormatPainterStatus.ONCE:{var n,r;let e=(n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId(),i=(r=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(r=r.getActiveSheet())==null?void 0:r.getSheetId(),a=this._sheetsSelectionsService.getCurrentLastSelection(),o=a==null?void 0:a.range;e&&i&&o&&(this._painterConfig={unitId:e,subUnitId:i,range:o});break}case a.FormatPainterStatus.OFF:this._painterConfig=null}},onApply:(e,t,r)=>this._painterConfig?n(e,t,r):{redos:[],undos:[]}};this._formatPainterService.addHook(i)}};Ft=j([A(0,(0,t.Inject)(t.Injector)),A(1,(0,t.Inject)(t.IUniverInstanceService)),A(2,(0,t.Inject)(a.IFormatPainterService)),A(3,(0,t.Inject)(n.SheetsSelectionsService)),A(4,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(5,(0,t.Inject)(r.ConditionalFormattingRangeTransformService))],Ft);let It=class extends t.Disposable{constructor(e,n,r){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=n,this._renderManagerService=r,k(this,`_unitDisposable`,new t.DisposableCollection),this._init()}_init(){let e=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),n=e=>{this._unitDisposable.dispose(),this._unitDisposable=new t.DisposableCollection;let n=e.getUnitId(),i=this._renderManagerService.getRenderUnitById(n);if(!i)return;let o=i.with(a.SheetSkeletonManagerService);this._unitDisposable.add(o.currentSkeleton$.subscribe(e=>{if(e){let t=e.skeleton.rowColumnSegment,n=t.endColumn-t.startColumn+1,i=(t.endRow-t.startRow+1)*n*9,a=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,i);this._conditionalFormattingViewModel.setCacheLength(a)}}))};e&&n(e),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{if(!e){this._unitDisposable.dispose();return}n(e)}))}dispose(){this._unitDisposable.dispose(),super.dispose()}};It=j([A(0,(0,t.Inject)(r.ConditionalFormattingViewModel)),A(1,t.IUniverInstanceService),A(2,c.IRenderManagerService)],It);let Lt=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){this.disposeWithMe(this._componentManager.register(T,wt))}_registerIcons(){this.disposeWithMe(this._iconManager.register({ConditionsDoubleIcon:Le,DataBarIcon:be,RatingIcon:je}))}};Lt=j([A(0,(0,t.Inject)(i.ComponentManager)),A(1,(0,t.Inject)(i.IconManager))],Lt);let Rt=class extends t.Disposable{constructor(e){super(),this._menuManagerService=e,this._menuManagerService.mergeMenu(oe)}};Rt=j([A(0,i.IMenuManagerService)],Rt);let $=class extends t.Plugin{constructor(e=z,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},z,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(le,o),this._initCommand()}onStarting(){this._injector.add([Lt]),this._injector.get(Lt),(0,t.registerDependencies)(this._injector,[[W],[V],[Mt],[U],[M],[Rt],[H],[Nt],[P],[Ft],[It],[B]]),(0,t.touchDependencies)(this._injector,[[W],[B]])}onReady(){(0,t.touchDependencies)(this._injector,[[Rt],[M]])}onRendered(){(0,t.touchDependencies)(this._injector,[[Mt],[P],[V],[Nt],[H],[Ft],[U],[It]])}_initCommand(){[h,g,_,y,v,b,x,S,C,w,N].forEach(e=>{this._commandService.registerCommand(e)})}};k($,`pluginName`,`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),k($,`packageName`,se),k($,`version`,ce),k($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=j([(0,t.DependentOn)(c.UniverRenderEnginePlugin,n.UniverSheetsPlugin,l.UniverSheetsFormulaPlugin,r.UniverSheetsConditionalFormattingPlugin,a.UniverSheetsUIPlugin),A(1,(0,t.Inject)(t.Injector)),A(2,(0,t.Inject)(t.ICommandService)),A(3,t.IConfigService)],$),e.AddAverageCfCommand=h,e.AddColorScaleConditionalRuleCommand=g,e.AddDataBarConditionalRuleCommand=_,e.AddDuplicateValuesCfCommand=v,e.AddIconSetConditionalRuleCommand=y,e.AddNumberCfCommand=b,e.AddRankCfCommand=x,e.AddTextCfCommand=S,e.AddTimePeriodCfCommand=C,e.AddUniqueValuesCfCommand=w,Object.defineProperty(e,"ConditionalFormattingClearController",{enumerable:!0,get:function(){return P}}),e.OpenConditionalFormattingOperator=N,e.SheetsConditionalFormattingUIMenuSchema=oe,Object.defineProperty(e,"UniverSheetsConditionalFormattingMobileUIPlugin",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UniverSheetsConditionalFormattingUIPlugin",{enumerable:!0,get:function(){return $}})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("rxjs/operators"),require("@univerjs/engine-render"),require("@univerjs/sheets-formula"),require("@univerjs/sheets-formula-ui"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`@univerjs/sheets-conditional-formatting`,`@univerjs/ui`,`@univerjs/sheets-ui`,`rxjs`,`rxjs/operators`,`@univerjs/engine-render`,`@univerjs/sheets-formula`,`@univerjs/sheets-formula-ui`,`react`,`@univerjs/design`,`@univerjs/engine-formula`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsConditionalFormattingUi={},e.UniverCore,e.UniverSheets,e.UniverSheetsConditionalFormatting,e.UniverUi,e.UniverSheetsUi,e.rxjs,e.rxjs.operators,e.UniverEngineRender,e.UniverSheetsFormula,e.UniverSheetsFormulaUi,e.React,e.UniverDesign,e.UniverEngineFormula,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let h={type:t.CommandType.COMMAND,id:`sheet.command.add-average-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c}=i,l=e.get(r.ConditionalFormattingRuleModel),u=e.get(t.ICommandService),d=e.get(t.IUniverInstanceService),f=(0,n.getSheetCommandTarget)(d);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h={ranges:a,cfId:l.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:c,style:o}};return u.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:h})}},g={type:t.CommandType.COMMAND,id:`sheet.command.add-color-scale-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,config:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.ICommandService),u=e.get(t.IUniverInstanceService),d=(0,n.getSheetCommandTarget)(u);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.colorScale,config:o}};return l.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},_={type:t.CommandType.COMMAND,id:`sheet.command.add-data-bar-conditional-rule`,handler(e,i){if(!i)return!1;let{min:a,max:o,nativeColor:s,positiveColor:c,isGradient:l,stopIfTrue:u,isShowValue:d}=i,f=i.ranges??e.get(n.SheetsSelectionsService).getCurrentSelections().map(e=>e.range);if(!f.length)return!1;let p=e.get(r.ConditionalFormattingRuleModel),m=e.get(t.IUniverInstanceService),h=(0,n.getSheetCommandTarget)(m);if(!h)return!1;let{unitId:g,subUnitId:_}=h,v=e.get(t.ICommandService),y={ranges:f,cfId:p.createCfId(g,_),stopIfTrue:!!u,rule:{type:r.CFRuleType.dataBar,isShowValue:d,config:{min:a,max:o,nativeColor:s,positiveColor:c,isGradient:l}}};return v.executeCommand(r.AddConditionalRuleMutation.id,{unitId:g,subUnitId:_,rule:y})}},v={type:t.CommandType.COMMAND,id:`sheet.command.add-duplicate-values-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.ICommandService),u=e.get(t.IUniverInstanceService),d=(0,n.getSheetCommandTarget)(u);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:o}};return l.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},y={type:t.CommandType.COMMAND,id:`sheet.command.add-icon-set-conditional-rule`,handler(e,i){if(!i)return!1;let a=i.ranges??e.get(n.SheetsSelectionsService).getCurrentSelections().map(e=>e.range);if(!a.length)return!1;let o=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!o)return!1;let{unitId:s,subUnitId:c}=o,l={ranges:a,cfId:e.get(r.ConditionalFormattingRuleModel).createCfId(s,c),stopIfTrue:!!i.stopIfTrue,rule:{type:r.CFRuleType.iconSet,config:i.config,isShowValue:i.isShowValue}};return e.get(t.ICommandService).executeCommand(r.AddConditionalRuleMutation.id,{unitId:s,subUnitId:c,rule:l})}},b={type:t.CommandType.COMMAND,id:`sheet.command.add-number-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c,value:l}=i,u=e.get(r.ConditionalFormattingRuleModel),d=e.get(t.ICommandService),f=e.get(t.IUniverInstanceService),p=(0,n.getSheetCommandTarget)(f);if(!p)return!1;let{unitId:m,subUnitId:h}=p,g=u.createCfId(m,h),_;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(c)){let e=l;if(e.length!==2||!Array.isArray(e))return!1;_={ranges:a,cfId:g,stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:c,style:o,value:e}}}else{let e=l;if(typeof e!=`number`)return!1;_={ranges:a,cfId:g,stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:c,style:o,value:e}}}return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:m,subUnitId:h,rule:_})}},x={type:t.CommandType.COMMAND,id:`sheet.command.add-rank-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,isPercent:c,isBottom:l,value:u}=i,d=e.get(r.ConditionalFormattingRuleModel),f=e.get(t.IUniverInstanceService),p=e.get(t.ICommandService),m=(0,n.getSheetCommandTarget)(f);if(!m)return!1;let{unitId:h,subUnitId:g}=m,_={ranges:a,cfId:d.createCfId(h,g),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:c,isBottom:l,style:o,value:u}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:g,rule:_})}},S={type:t.CommandType.COMMAND,id:`sheet.command.add-text-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c,value:l}=i,u=e.get(r.ConditionalFormattingRuleModel),d=e.get(t.IUniverInstanceService),f=(0,n.getSheetCommandTarget)(d);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h=e.get(t.ICommandService),g={ranges:a,cfId:u.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:c,style:o,value:l}};return h.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:g})}},C={type:t.CommandType.COMMAND,id:`sheet.command.add-time-period-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c}=i,l=e.get(r.ConditionalFormattingRuleModel),u=e.get(t.IUniverInstanceService),d=e.get(t.ICommandService),f=(0,n.getSheetCommandTarget)(u);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h={ranges:a,cfId:l.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:c,style:o}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:h})}},w={type:t.CommandType.COMMAND,id:`sheet.command.add-uniqueValues-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.IUniverInstanceService),u=e.get(t.ICommandService),d=(0,n.getSheetCommandTarget)(l);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:o}};return u.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},T=`sheet.conditional.formatting.panel`;function E(e){"@babel/helpers - typeof";return E=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},E(e)}function D(e,t){if(E(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(E(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function O(e){var t=D(e,`string`);return E(t)==`symbol`?t:t+``}function k(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){return function(n,r){t(n,r,e)}}function j(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let M=class extends t.Disposable{constructor(e,n,r){super(),this._univerInstanceService=e,this._sidebarService=n,this._localeService=r,k(this,`_sidebarDisposable`,null),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{var t;e||(t=this._sidebarDisposable)==null||t.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.id===`sheet.conditional.formatting.panel`&&(e.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){let n={id:T,header:{title:this._localeService.t(`sheets-conditional-formatting-ui.title`)},children:{label:T,rule:e,key:(0,t.generateRandomId)(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}};M=j([A(0,t.IUniverInstanceService),A(1,(0,t.Inject)(i.ISidebarService)),A(2,(0,t.Inject)(t.LocaleService))],M);let N={id:`sheet.operation.open.conditional.formatting.panel`,type:t.CommandType.OPERATION,handler:(e,i)=>{var a;let o=e.get(M),s=e.get(n.SheetsSelectionsService),c=e.get(t.ICommandService),l=((a=s.getCurrentSelections())==null?void 0:a.map(e=>e.range))||[];switch(i.value){case 3:o.openPanel({...(0,r.createDefaultRule)(),ranges:l});break;case 4:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};o.openPanel(e);break}case 5:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:`=`}};o.openPanel(e);break}case 6:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.colorScale,config:[]}};o.openPanel(e);break}case 7:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};o.openPanel(e);break}case 8:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};o.openPanel(e);break}case 2:o.openPanel();break;case 1:o.openPanel({...(0,r.createDefaultRule)(),ranges:l});break;case 9:c.executeCommand(r.ClearRangeCfCommand.id,{ranges:l});break;case 10:c.executeCommand(r.ClearWorksheetCfCommand.id)}return!0}},P=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRangeIndexModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{let r=[],i=[],a={redos:r,undos:i};if([n.ClearSelectionFormatCommand.id,n.ClearSelectionAllCommand.id].includes(e.id)){var o;let e=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(e=>e.range);if(!e)return a;let n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),s=n.getActiveSheet();if(!s)return a;let c=n.getUnitId(),l=s.getSheetId(),u=this._conditionalFormattingRangeIndexModel.getRulesByRanges(c,l,e);if(!u||!u.length)return a;let{redos:d,undos:f}=F(this._injector,u,e,c,l);r.push(...d),i.push(...f)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{let r=[],i=[],a={redos:r,undos:i};if(!n||!n.length)return a;let o=this._conditionalFormattingRangeIndexModel.getRulesByRanges(e,t,n);if(!o||!o.length)return a;let{redos:s,undos:c}=F(this._injector,o,n,e,t);return r.push(...s),i.push(...c),a}}))}};P=j([A(0,(0,t.Inject)(t.Injector)),A(1,(0,t.Inject)(t.IUniverInstanceService)),A(2,(0,t.Inject)(n.SheetInterceptorService)),A(3,(0,t.Inject)(n.SheetsSelectionsService)),A(4,(0,t.Inject)(r.ConditionalFormattingRangeIndexModel))],P);function F(e,t,n,i,a){let o=[],s=[],c=e.get(r.ConditionalFormattingRangeTransformService);return t.forEach(t=>{let l=c.subtractRanges(t.ranges,n);if(l.length){let n={id:r.SetConditionalRuleMutation.id,params:{unitId:i,subUnitId:a,rule:{...t,ranges:l}}},c=(0,r.setConditionalRuleMutationUndoFactory)(e,n.params);o.push(n),s.push(...c)}else{let n={id:r.DeleteConditionalRuleMutation.id,params:{unitId:i,subUnitId:a,cfId:t.cfId}},c=(0,r.DeleteConditionalRuleMutationUndoFactory)(e,n.params);o.push(n),s.push(...c)}}),{redos:o,undos:s}}let I=[n.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],L=[{label:{name:`sheets-conditional-formatting-ui.ruleType.highlightCell`,selectable:!1},value:3},{label:{name:`sheets-conditional-formatting-ui.panel.rankAndAverage`,selectable:!1},value:4},{label:{name:`sheets-conditional-formatting-ui.ruleType.formula`,selectable:!1},value:5},{label:{name:`sheets-conditional-formatting-ui.ruleType.colorScale`,selectable:!1},value:6},{label:{name:`sheets-conditional-formatting-ui.ruleType.dataBar`,selectable:!1},value:7},{label:{name:`sheets-conditional-formatting-ui.ruleType.iconSet`,selectable:!1},value:8},{label:{name:`sheets-conditional-formatting-ui.menu.manageConditionalFormatting`,selectable:!1},value:2},{label:{name:`sheets-conditional-formatting-ui.menu.createConditionalFormatting`,selectable:!1},value:1},{label:{name:`sheets-conditional-formatting-ui.menu.clearRangeRules`,selectable:!1},value:9,disabled:!1},{label:{name:`sheets-conditional-formatting-ui.menu.clearWorkSheetRules`,selectable:!1},value:10}];function R(e){let c=e.get(n.SheetsSelectionsService),l=e.get(t.ICommandService),u=e.get(t.IUniverInstanceService),d=e.get(r.ConditionalFormattingRuleModel),f=new o.Observable(r=>(0,o.merge)(c.selectionMoveEnd$,c.selectionSet$,new o.Observable(e=>{let n=l.onCommandExecuted(n=>{var r;let{id:i,params:a}=n,o=(r=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getUnitId();I.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()})).pipe((0,s.debounceTime)(16)).subscribe(()=>{var i;let a=((i=c.getCurrentSelections())==null?void 0:i.map(e=>e.range))||[],o=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!o)return;let s=o.getActiveSheet();if(!s)return;let l=(d.getSubunitRules(o.getUnitId(),s.getSheetId())||[]).filter(e=>e.ranges.some(e=>a.some(n=>t.Rectangle.intersects(n,e)))).map(e=>e.ranges).every(t=>(0,n.checkRangesEditablePermission)(e,o.getUnitId(),s.getSheetId(),t));r.next(l)})),p=new o.Observable(r=>new o.Observable(e=>{let n=l.onCommandExecuted(n=>{var r;let{id:i,params:a}=n,o=(r=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getUnitId();I.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()}).pipe((0,s.debounceTime)(16)).subscribe(()=>{let i=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!i)return;let a=i.getActiveSheet();if(!a)return;let o=d.getSubunitRules(i.getUnitId(),a.getSheetId())||[];if(!o.length)return r.next(!1),!1;let s=o.map(e=>e.ranges).every(t=>(0,n.checkRangesEditablePermission)(e,i.getUnitId(),a.getSheetId(),t));r.next(s)})),m=new o.Observable(e=>{let t=f.subscribe(t=>{let n=L.find(e=>e.value===9);n&&(n.disabled=!t,e.next(L))}),n=p.subscribe(t=>{let n=L.find(e=>e.value===10);n&&(n.disabled=!t,e.next(L))});return e.next(L),()=>{t.unsubscribe(),n.unsubscribe()}});return{id:N.id,type:i.MenuItemType.SELECTOR,icon:`ConditionsDoubleIcon`,tooltip:`sheets-conditional-formatting-ui.title`,selections:m,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,a.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookEditablePermission],worksheetTypes:[n.WorksheetSetCellStylePermission,n.WorksheetEditPermission],rangeTypes:[n.RangeProtectionPermissionEditPoint]})}}let ee={min:{type:r.CFValueType.min},max:{type:r.CFValueType.max},nativeColor:r.defaultDataBarNativeColor,positiveColor:r.defaultDataBarPositiveColor,isGradient:!1,isShowValue:!0};function te(e){return{config:[{iconType:e,iconId:`0`,operator:r.CFNumberOperator.greaterThanOrEqual,value:{type:r.CFValueType.percent,value:67}},{iconType:e,iconId:`1`,operator:r.CFNumberOperator.greaterThanOrEqual,value:{type:r.CFValueType.percent,value:33}},{iconType:e,iconId:`2`,operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.percent,value:2**53-1}}],isShowValue:!0}}function ne(e){return{hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,a.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookEditablePermission],worksheetTypes:[n.WorksheetSetCellStylePermission,n.WorksheetEditPermission],rangeTypes:[n.RangeProtectionPermissionEditPoint]})}}function re(e){return{id:_.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`DataBarIcon`,tooltip:`sheets-conditional-formatting-ui.ruleType.dataBar`,params:ee,selectionsCommandId:_.id,selections:[{label:`sheets-conditional-formatting-ui.ruleType.dataBar`,value:r.CFRuleType.dataBar,params:ee},{id:N.id,label:`sheets-conditional-formatting-ui.menu.createConditionalFormatting`,value:7,params:{value:7}},{id:r.ClearRangeCfCommand.id,label:`sheets-conditional-formatting-ui.menu.clearRangeRules`,value:r.CFRuleType.dataBar,params:{types:[r.CFRuleType.dataBar]}}],...ne(e)}}function ie(e){let t=te(r.IIconSetType.threeStars);return{id:y.id,type:i.MenuItemType.BUTTON_SELECTOR,icon:`RatingIcon`,tooltip:`sheets-conditional-formatting-ui.ruleType.iconSet`,params:t,selectionsCommandId:y.id,selections:[{label:`sheets-conditional-formatting-ui.iconSet.rank`,value:r.IIconSetType.threeStars,params:t},{label:`sheets-conditional-formatting-ui.iconSet.shape`,value:r.IIconSetType.threeTrafficLights1,params:te(r.IIconSetType.threeTrafficLights1)},{label:`sheets-conditional-formatting-ui.iconSet.direction`,value:r.IIconSetType.threeArrows,params:te(r.IIconSetType.threeArrows)},{id:N.id,label:`sheets-conditional-formatting-ui.menu.createConditionalFormatting`,value:8,params:{value:8}},{id:r.ClearRangeCfCommand.id,label:`sheets-conditional-formatting-ui.menu.clearRangeRules`,value:r.CFRuleType.iconSet,params:{types:[r.CFRuleType.iconSet]}}],...ne(e)}}let ae={[i.RibbonDataGroup.RULES]:{[N.id]:{order:1,gridLayout:{row:2,column:1,showLabel:!0},menuItemFactory:R}}},oe={[i.RibbonInsertGroup.CELL]:{[_.id]:{order:3,menuItemFactory:re},[y.id]:{order:4,menuItemFactory:ie}},...ae};var se=`@univerjs/sheets-conditional-formatting-ui`,ce=`1.0.2`;let le=`sheets-conditional-formatting-ui.config`,z={},B=class extends t.Disposable{constructor(e,t,n){super(),this._conditionalFormattingRuleModel=e,this._formulaRefRangeService=t,this._injector=n,k(this,`_disposableMap`,new Map),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}_${t}_${n}`}_getRuleFormulas(e){let t=[],n=e.rule;switch(n.type){case r.CFRuleType.highlightCell:n.subType===r.CFSubRuleType.formula&&t.push(n.value);break;case r.CFRuleType.dataBar:{let e=n;e.config.min.type===r.CFValueType.formula&&t.push(e.config.min.value),e.config.max.type===r.CFValueType.formula&&t.push(e.config.max.value);break}case r.CFRuleType.colorScale:n.config.forEach(e=>{e.value.type===r.CFValueType.formula&&t.push(e.value.value)});break;case r.CFRuleType.iconSet:n.config.forEach(e=>{e.value.type===r.CFValueType.formula&&t.push(e.value.value)})}return t}_updateRuleFormulas(e,n){let i=t.Tools.deepClone(e),a=i.rule,o=0;switch(a.type){case r.CFRuleType.highlightCell:a.subType===r.CFSubRuleType.formula&&(a.value=n[o++]);break;case r.CFRuleType.dataBar:{let e=a;e.config.min.type===r.CFValueType.formula&&(e.config.min.value=n[o++]),e.config.max.type===r.CFValueType.formula&&(e.config.max.value=n[o++]);break}case r.CFRuleType.colorScale:a.config.forEach(e=>{e.value.type===r.CFValueType.formula&&(e.value.value=n[o++])});break;case r.CFRuleType.iconSet:a.config.forEach(e=>{e.value.type===r.CFValueType.formula&&(e.value.value=n[o++])})}return i}register(e,t,n){let i=n.ranges,a=this._getRuleFormulas(n),o=this._formulaRefRangeService.registerRangeFormula(e,t,i,a,i=>{if(i.length===0)return{undos:[{id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:n}}],redos:[{id:r.DeleteConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId}}]};let a=[],o=[],s=i[0],c=this._updateRuleFormulas(n,s.formulas);c.ranges=s.ranges,a.push({id:r.SetConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId,rule:c}}),o.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,{unitId:e,subUnitId:t,cfId:n.cfId,rule:c}));for(let s=1;s<i.length;s++){let c=i[s],l=(0,r.createCfId)(),u=this._updateRuleFormulas(n,c.formulas);u.cfId=l,u.ranges=c.ranges,a.push({id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:u}}),o.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,{unitId:e,subUnitId:t,rule:u}))}return{undos:o,redos:a}}),s=this._getIdWithUnitId(e,t,n.cfId);this._disposableMap.set(s,o)}_initRefRange(){let e=this._conditionalFormattingRuleModel.getAll();for(let[t,n]of e)for(let[e,r]of n)for(let n of r)this.register(t,e,n);this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{let{unitId:t,subUnitId:n,rule:r}=e;switch(e.type){case`add`:this.register(t,n,r);break;case`delete`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e));break}case`set`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e)),this.register(t,n,r);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};B=j([A(0,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(1,(0,t.Inject)(l.FormulaRefRangeService)),A(2,(0,t.Inject)(t.Injector))],B);let ue=[a.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,a.PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE,a.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER],V=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=n,this._univerInstanceService=r,this._conditionalFormattingRangeTransformService=i,k(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,t,n)=>this._collectConditionalRule(e,t,n),onPasteCells:(e,t,n,r)=>!e||!this._copyInfo||!ue.includes(r.pasteType)?{redos:[],undos:[]}:this._generateConditionalFormattingMutations(e,t,r)}))}_collectConditionalRule(e,r,i){var o;let s=new Map,c={};this._copyInfo={rules:s,info:{unitId:e,subUnitId:r,cfMap:c}};let l=this._injector.invoke(t=>(0,n.rangeToDiscreteRange)(i,t,e,r));if(!l)return;let{projectRange:u}=(0,a.virtualizeDiscreteRanges)([l]);(o=this._conditionalFormattingRuleModel.getSubunitRules(e,r))==null||o.forEach(e=>{let n=e.ranges.flatMap(e=>{let t=u(e);return t?[t]:[]});n.length&&(s.set(e.cfId,n.length>1?t.Rectangle.mergeRanges(n):n),c[e.cfId]={rule:e.rule,stopIfTrue:e.stopIfTrue})})}_generateConditionalFormattingMutations(e,i,o){var s;let c=this._copyInfo;if(!c)return{redos:[],undos:[]};let{unitId:l,subUnitId:u,range:d}=e,{unitId:f,subUnitId:p,range:m}=i,{copyType:h=a.COPY_TYPE.COPY}=o;if(!(0,n.getSheetCommandTarget)(this._univerInstanceService,{unitId:f,subUnitId:p}))return{redos:[],undos:[]};if(h===a.COPY_TYPE.CUT&&f===l&&p===u)return this._copyInfo=null,{redos:[],undos:[]};let g=(0,a.virtualizeDiscreteRanges)([d]),_=g.ranges[0],v=(0,a.virtualizeDiscreteRanges)([m]),y=v.ranges[0],b=(0,a.getRepeatRange)(_,y,!0),x=v.mapRange(y),S=f===l&&p===u,C=new Map,w=(e,t,n)=>JSON.stringify([e,t,n]);if((s=this._conditionalFormattingRuleModel.getSubunitRules(f,p))==null||s.forEach(e=>{t.Rectangle.doAnyRangesIntersect(e.ranges,x)&&C.set(w(f,p,e.cfId),{cfId:e.cfId,unitId:f,subUnitId:p,ranges:e.ranges,add:[],remove:x})}),h===a.COPY_TYPE.CUT&&(f!==l||p!==u)){let e=g.mapRange(_);c.rules.forEach((t,n)=>{let r=this._conditionalFormattingRuleModel.getRule(l,u,n);r&&C.set(w(l,u,n),{cfId:n,unitId:l,subUnitId:u,ranges:r.ranges,add:[],remove:e})})}let{rules:T,info:E}=c,D=new Map,O={},k=e=>{let t=E==null?void 0:E.cfMap[e];if(S){let t=this._conditionalFormattingRuleModel.getRule(f,p,e);if(t)return O[e]=t,t}let n={rule:t.rule,cfId:this._conditionalFormattingRuleModel.createCfId(f,p),ranges:[],stopIfTrue:t.stopIfTrue};return O[e]=n,D.set(n.cfId,n),n},A=Array.from(T.entries());S||A.reverse(),A.forEach(([e,n])=>{let r=O[e]||k(e),i=w(f,p,r.cfId);C.has(i)||C.set(i,{cfId:r.cfId,unitId:f,subUnitId:p,ranges:r.ranges,add:[],remove:[]}),C.get(i).add.push(...b.flatMap(e=>n.flatMap(n=>v.mapRange(t.Rectangle.getPositionRange(n,e.startRange)))))});let j=[],M=[];for(let e of C.values()){let{cfId:t,unitId:n,subUnitId:i,ranges:a,add:o,remove:s}=e,c=this._conditionalFormattingRangeTransformService.applyRangeDelta(a,s,o);if(!c.length){let e={unitId:n,subUnitId:i,cfId:t};j.push({id:r.DeleteConditionalRuleMutation.id,params:e}),M.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e));continue}let l=D.get(t);if(l){let e={unitId:f,subUnitId:p,rule:{...l,ranges:c}};j.push({id:r.AddConditionalRuleMutation.id,params:e}),M.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,e))}else{let e=this._conditionalFormattingRuleModel.getRule(n,i,t);if(!e)continue;let a={unitId:n,subUnitId:i,rule:{...e,ranges:c}};j.push({id:r.SetConditionalRuleMutation.id,params:a}),M.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,a))}}return{redos:j,undos:M}}};V=j([A(0,(0,t.Inject)(a.ISheetClipboardService)),A(1,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(2,(0,t.Inject)(t.Injector)),A(3,(0,t.Inject)(t.IUniverInstanceService)),A(4,(0,t.Inject)(r.ConditionalFormattingRangeTransformService))],V);let H=class extends t.Disposable{constructor(e){super(),this._localeService=e,k(this,`_initLocal`,()=>{}),k(this,`_findReplaceIndex`,e=>{let t=/\{([^}]+)?\}/g,n=[],r=t.exec(e);for(;r;)n.push({startIndex:r.index,key:Number(r[1]),endIndex:r.index+r[0].length-1}),r=t.exec(e);return n}),this._initLocal()}tWithReactNode(e,...t){let n=this._localeService.getLocales(),r=e.split(`.`),i=n&&this._localeService.resolveKeyPath(n,r);if(typeof i==`string`){let e=[];return this._findReplaceIndex(i).forEach((n,r,a)=>{let o=a[r-1]||{startIndex:0,endIndex:-1};if(o.endIndex+1<n.startIndex){let t=i.slice(o.endIndex+1,n.startIndex);t&&e.push(t)}if(t[n.key]&&e.push(t[n.key]),r===a.length-1){let t=i.slice(n.endIndex+1);t&&e.push(t)}}),e}return[]}};H=j([A(0,(0,t.Inject)(t.LocaleService))],H);let U=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===r.AddCfCommand.id){let{unitId:t,subUnitId:r,rule:{ranges:i}}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookEditablePermission],rangeTypes:[n.RangeProtectionPermissionEditPoint],worksheetTypes:[n.WorksheetEditPermission,n.WorksheetSetCellStylePermission]},i,t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-conditional-formatting-ui.permission.dialog.setStyleErr`))}}))}};U=j([A(0,(0,t.Inject)(t.LocaleService)),A(1,t.ICommandService),A(2,(0,t.Inject)(n.SheetPermissionCheckController))],U);let W=class extends t.Disposable{constructor(e,t,n,r,i,a,o){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=a,this._conditionalFormattingRangeIndexModel=o,k(this,`_ruleChangeCacheMap`,new Map),k(this,`_boundRenderExtensions`,new Map),this._initViewModelInterceptor(),this._initRenderRangeResolvers(),this._initSkeleton(),queueMicrotask(()=>this._markActiveSheetRulesDirty()),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear(),this._boundRenderExtensions.forEach(e=>{e.forEach(e=>e.setRenderRangeResolver(null))}),this._boundRenderExtensions.clear()})}_initRenderRangeResolvers(){let e=this._createRenderRangeResolver(r.CFRuleType.dataBar),n=this._createRenderRangeResolver(r.CFRuleType.iconSet),i=t=>{var i;this._unbindRenderRangeResolvers(t);let a=(i=this._renderManagerService.getRenderUnitById(t))==null?void 0:i.mainComponent;if(!a||!(`getExtensionByKey`in a))return;let o=new Set,s=a.getExtensionByKey(r.dataBarUKey);s instanceof r.DataBar&&(s.setRenderRangeResolver(e),o.add(s));let c=a.getExtensionByKey(r.IconUKey);c instanceof r.ConditionalFormattingIcon&&(c.setRenderRangeResolver(n),o.add(c)),o.size&&this._boundRenderExtensions.set(t,o)};this._renderManagerService.getAllRenderersOfType(t.UniverInstanceType.UNIVER_SHEET).forEach(e=>i(e.unitId)),this.disposeWithMe(this._renderManagerService.created$.subscribe(e=>{e.type===t.UniverInstanceType.UNIVER_SHEET&&i(e.unitId)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(e=>this._unbindRenderRangeResolvers(e)))}_createRenderRangeResolver(e){return(n,r,i)=>{let a=[],o=this._conditionalFormattingRangeIndexModel.getRulesByRanges(n,r,i).filter(t=>t.rule.type===e),s=o.length?o:(this._conditionalFormattingRuleModel.getSubunitRules(n,r)??[]).filter(t=>t.rule.type===e);return i.forEach(e=>{s.forEach(n=>{n.ranges.forEach(n=>{let r=(0,t.getIntersectRange)(e,n);r&&a.push(r)})})}),a.length>1?t.Rectangle.mergeRanges(a):a}}_unbindRenderRangeResolvers(e){let t=this._boundRenderExtensions.get(e);t==null||t.forEach(e=>e.setRenderRangeResolver(null)),this._boundRenderExtensions.delete(e)}_collectDirtyRanges(e,t,n){let r=[];return e.forEach(e=>{var i;if(e.unitId!==t||e.subUnitId!==n)return;let a=e.rule??(e.cfId?this._conditionalFormattingRuleModel.getRule(t,n,e.cfId):null);a!=null&&(i=a.ranges)!=null&&i.length&&r.push(...a.ranges)}),r}_intersectDirtyRangesWithRenderedRange(e,t){return!t||t.startRow<0||t.startColumn<0?[]:e.map(e=>({startRow:Math.max(e.startRow,t.startRow),endRow:Math.min(e.endRow,t.endRow),startColumn:Math.max(e.startColumn,t.startColumn),endColumn:Math.min(e.endColumn,t.endColumn)})).filter(e=>e.startRow<=e.endRow&&e.startColumn<=e.endColumn)}_markDirtySkeleton(e){var n;let r=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),i=r==null?void 0:r.getActiveSheet();if(!r||!i)return;let o=r.getUnitId(),s=i.getSheetId(),c=this._renderManagerService.getRenderUnitById(o),l=c==null?void 0:c.with(a.SheetSkeletonManagerService),u=l==null?void 0:l.getCurrentSkeleton(),d=this._intersectDirtyRangesWithRenderedRange(this._collectDirtyRanges(e,o,s),u==null?void 0:u.rowColumnSegment);d.length&&(u==null||u.resetRangeCache(d)),l==null||l.reCalculate(),c==null||(n=c.mainComponent)==null||n.makeDirty()}_markActiveSheetRulesDirty(){let e=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),n=e==null?void 0:e.getActiveSheet();if(!e||!n)return;let r=e.getUnitId(),i=n.getSheetId(),a=this._conditionalFormattingRuleModel.getSubunitRules(r,i)??[];a.length&&this._markDirtySkeleton(a.map(e=>({rule:e,subUnitId:i,unitId:r})))}_initSkeleton(){this.disposeWithMe((0,o.merge)(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe((0,s.bufferTime)(16),(0,s.filter)(e=>!!e.length),(0,s.filter)(e=>{let n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;let r=n.getActiveSheet();return r?e.some(e=>e.unitId===n.getUnitId()&&e.subUnitId===r.getSheetId()):!1})).subscribe(e=>this._markDirtySkeleton(e)))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(n.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(e,t,n)=>{let i=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!i)return n(e);let a=t.workbook.getStyles(),o=(typeof(e==null?void 0:e.s)==`string`?a.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},s=e===t.rawData?{...t.rawData}:e;if(i.style){let e={...o,...i.style};Object.assign(s,{s:e})}return s.fontRenderExtension||(s.fontRenderExtension={},i.isShowValue!==void 0&&(s.fontRenderExtension.isSkip=!i.isShowValue)),i.dataBar&&(s.dataBar=i.dataBar),i.iconSet&&(s.iconSet=i.iconSet,s.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),n(s)},priority:10}))}};W=j([A(0,(0,t.Inject)(n.SheetInterceptorService)),A(1,(0,t.Inject)(r.ConditionalFormattingService)),A(2,(0,t.Inject)(t.IUniverInstanceService)),A(3,(0,t.Inject)(c.IRenderManagerService)),A(4,(0,t.Inject)(r.ConditionalFormattingViewModel)),A(5,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(6,(0,t.Inject)(r.ConditionalFormattingRangeIndexModel))],W);function G({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),l=`_${(0,d.useId)()}`,u=(0,d.useRef)(null);return(0,d.useImperativeHandle)(e,()=>u.current),(0,d.useLayoutEffect)(()=>{if(n&&u.current&&u.current.localName===r.tag)return me(u.current)},[n,r]),de(r,`${i}`,{defIds:r.defIds,idSuffix:l},{ref:u,className:c,...s},o)}function de(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...fe(e,n,i),...r},(pe(e,n).children||[]).map((r,a)=>de(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function fe(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function pe(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function me(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:he(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(ge(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function he(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function ge(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}G.displayName=`UniverIcon`;let _e={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ve=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`bold-icon`,ref:t,icon:_e}))});ve.displayName=`BoldIcon`;let ye={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`rect`,attrs:{width:13,height:5,x:1.5,y:5.5,stroke:`currentColor`,rx:2.5,strokeWidth:1.2}},{tag:`rect`,attrs:{width:6.4,height:2.6,x:2.7,y:6.7,fill:`currentColor`,rx:1.3}}]},be=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`data-bar-icon`,ref:t,icon:ye}))});be.displayName=`DataBarIcon`;let xe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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`}}]},K=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`delete-icon`,ref:t,icon:xe}))});K.displayName=`DeleteIcon`;let Se={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`,width:`1em`,height:`1em`},children:[{tag:`circle`,attrs:{cx:7,cy:5,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:13,cy:5,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:7,cy:10,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:13,cy:10,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:7,cy:15,r:1.1,fill:`currentColor`}},{tag:`circle`,attrs:{cx:13,cy:15,r:1.1,fill:`currentColor`}}]},Ce=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`grip-vertical-icon`,ref:t,icon:Se}))});Ce.displayName=`GripVerticalIcon`;let we={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`increase-icon`,ref:t,icon:we}))});Te.displayName=`IncreaseIcon`;let Ee={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z`}}]},De=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`italic-icon`,ref:t,icon:Ee}))});De.displayName=`ItalicIcon`;let Oe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},ke=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`more-down-icon`,ref:t,icon:Oe}))});ke.displayName=`MoreDownIcon`;let Ae={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`rect`,attrs:{width:13,height:13,x:1.5,y:1.5,stroke:`currentColor`,rx:1.5,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M8 4L9.19 6.42L11.85 6.81L9.93 8.68L10.38 11.33L8 10.08L5.62 11.33L6.07 8.68L4.15 6.81L6.81 6.42L8 4Z`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.2}}]},je=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`rating-icon`,ref:t,icon:Ae}))});je.displayName=`RatingIcon`;let Me={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z`}}]},Ne=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`strikethrough-icon`,ref:t,icon:Me}))});Ne.displayName=`StrikethroughIcon`;let Pe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z`}}]},Fe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`underline-icon`,ref:t,icon:Pe}))});Fe.displayName=`UnderlineIcon`;let Ie={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`colorChannel1`,d:`M5.59 1.51H10.46V14.46H5.59z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.34863 2.53325C1.34863 1.87051 1.88589 1.33325 2.54863 1.33325H13.482C14.1447 1.33325 14.682 1.87051 14.682 2.53325V13.4666C14.682 14.1294 14.1447 14.6666 13.482 14.6666H2.54863C1.88589 14.6666 1.34863 14.1294 1.34863 13.4666V2.53325ZM13.082 2.63325C13.2477 2.63325 13.382 2.76757 13.382 2.93325V5.09946C13.382 5.26515 13.2477 5.39946 13.082 5.39946H10.9708C10.8052 5.39946 10.6708 5.26515 10.6708 5.09946V2.93325C10.6708 2.76757 10.8052 2.63325 10.9708 2.63325H13.082ZM9.37085 2.93325C9.37085 2.76757 9.23653 2.63325 9.07085 2.63325H6.95974C6.79406 2.63325 6.65974 2.76757 6.65974 2.93325V5.09946C6.65974 5.26515 6.79406 5.39946 6.95974 5.39946L9.07085 5.39946C9.23654 5.39946 9.37085 5.26515 9.37085 5.09946V2.93325ZM5.35974 2.93325C5.35974 2.76757 5.22543 2.63325 5.05974 2.63325H2.94863C2.78295 2.63325 2.64863 2.76757 2.64863 2.93325V5.09946C2.64863 5.26515 2.78295 5.39946 2.94863 5.39946H5.05974C5.22543 5.39946 5.35974 5.26515 5.35974 5.09946V2.93325ZM2.94863 6.69946C2.78295 6.69946 2.64863 6.83378 2.64863 6.99946V9.11045C2.64863 9.27613 2.78295 9.41045 2.94863 9.41045H5.05974C5.22543 9.41045 5.35974 9.27613 5.35974 9.11045V6.99946C5.35974 6.83378 5.22543 6.69946 5.05974 6.69946H2.94863ZM2.94863 10.7104C2.78295 10.7104 2.64863 10.8448 2.64863 11.0104V13.0666C2.64863 13.2323 2.78295 13.3666 2.94863 13.3666H5.05974C5.22543 13.3666 5.35974 13.2323 5.35974 13.0666V11.0104C5.35974 10.8448 5.22543 10.7104 5.05974 10.7104H2.94863ZM6.65974 13.0666C6.65974 13.2323 6.79406 13.3666 6.95974 13.3666H9.07085C9.23653 13.3666 9.37085 13.2323 9.37085 13.0666V11.0104C9.37085 10.8448 9.23653 10.7104 9.07085 10.7104L6.95974 10.7104C6.79406 10.7104 6.65974 10.8448 6.65974 11.0104V13.0666ZM10.6708 13.0666C10.6708 13.2323 10.8052 13.3666 10.9708 13.3666H13.082C13.2477 13.3666 13.382 13.2323 13.382 13.0666V11.0104C13.382 10.8448 13.2477 10.7104 13.082 10.7104H10.9708C10.8052 10.7104 10.6708 10.8448 10.6708 11.0104V13.0666ZM13.082 9.41045C13.2477 9.41045 13.382 9.27613 13.382 9.11045V6.99946C13.382 6.83378 13.2477 6.69946 13.082 6.69946H10.9708C10.8052 6.69946 10.6708 6.83378 10.6708 6.99946V9.11045C10.6708 9.27613 10.8052 9.41045 10.9708 9.41045H13.082ZM6.95974 9.41045C6.79406 9.41045 6.65974 9.27613 6.65974 9.11045V6.99946C6.65974 6.83378 6.79406 6.69946 6.95974 6.69946L9.07085 6.69946C9.23653 6.69946 9.37085 6.83378 9.37085 6.99946V9.11045C9.37085 9.27613 9.23653 9.41045 9.07085 9.41045H6.95974Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Le=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`conditions-double-icon`,ref:t,icon:Ie}))});Le.displayName=`ConditionsDoubleIcon`;let Re={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`colorChannel1`,d:`M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ze=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`font-color-double-icon`,ref:t,icon:Re}))});ze.displayName=`FontColorDoubleIcon`;let Be={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z`}}]},Ve=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`paint-bucket-double-icon`,ref:t,icon:Be}))});Ve.displayName=`PaintBucketDoubleIcon`;let He={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},Ue=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(G,Object.assign({},e,{id:`slash-double-icon`,ref:t,icon:He}))});Ue.displayName=`SlashDoubleIcon`;let We=e=>{let{color:n,onChange:r,disable:i=!1,Icon:a=Ve,className:o,DropdownComponent:s=f.Dropdown,PickerComponent:c=f.ColorPicker}=e,l=(0,d.useMemo)(()=>new t.ColorKit(n),[n]),u=()=>{let e={className:(0,f.clsx)(`univer-fill-primary-600`,i&&o),extend:{colorChannel1:l.isValid?n:``}};return(0,m.jsx)(a,{...e})};return i?u():(0,m.jsx)(s,{overlay:(0,m.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,m.jsx)(c,{value:n,onChange:r})}),children:(0,m.jsx)(`span`,{className:(0,f.clsx)(`univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`,o),children:u()})})};function q(e){let{rule:n}=e,i=(0,d.useMemo)(()=>{if((n==null?void 0:n.type)===r.CFRuleType.colorScale){let e=n.config.map((e,n)=>({color:new t.ColorKit(e.color),value:n})),i=e.length-1;return[,,,,,].fill(``).map((e,t,n)=>t*i/(n.length-1)).map(t=>(0,r.getColorScaleFromValue)(e,t))}return null},[n]),a=(0,d.useMemo)(()=>{if((n==null?void 0:n.type)===r.CFRuleType.iconSet)return n.config.map(e=>{let t=r.iconMap[e.iconType];return t&&t[Number(e.iconId)]})},[n]);if(!n)return null;let o=`univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs`;switch(n.type){case r.CFRuleType.dataBar:{let{isGradient:e}=n.config,t=e?`linear-gradient(to right, ${n.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:n.config.positiveColor,i=e?`linear-gradient(to right, rgb(255 255 255),${n.config.nativeColor||r.defaultDataBarNativeColor})`:n.config.nativeColor;return(0,m.jsxs)(`div`,{className:o,children:[(0,m.jsx)(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:i,borderColor:n.config.nativeColor??r.defaultDataBarNativeColor}}),(0,m.jsx)(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:t,borderColor:n.config.positiveColor??r.defaultDataBarPositiveColor}})]})}case r.CFRuleType.colorScale:return i&&(0,m.jsx)(`div`,{className:o,children:i.map((e,t)=>(0,m.jsx)(`div`,{className:`univer-h-full`,style:{width:`${100/i.length}%`,background:e}},t))});case r.CFRuleType.iconSet:return a&&(0,m.jsx)(`div`,{className:o,children:a.map((e,t)=>e?(0,m.jsx)(`img`,{className:`univer-h-full`,src:e,draggable:!1},t):(0,m.jsx)(Ue,{},t))});case r.CFRuleType.highlightCell:{let{ul:e,st:i,it:a,bl:s,bg:c,cl:l}=n.style,u=(e==null?void 0:e.s)===t.BooleanNumber.TRUE,d=(i==null?void 0:i.s)===t.BooleanNumber.TRUE,p=a===t.BooleanNumber.TRUE,h=s===t.BooleanNumber.TRUE,g=(c==null?void 0:c.rgb)??r.DEFAULT_BG_COLOR,_=(l==null?void 0:l.rgb)??r.DEFAULT_FONT_COLOR,v={textDecoration:`${u?`underline`:``} ${d?`line-through`:``}`.replace(/^ /,``)??void 0,backgroundColor:g,color:_};return(0,m.jsx)(`div`,{className:(0,f.clsx)(o,{"univer-font-bold":h,"univer-italic":p}),style:v,children:`123`})}}}let J=(0,f.clsx)(`univer-mt-5 univer-px-1 univer-py-2 univer-rounded`,f.borderClassName),Y=e=>({label:`sheets-conditional-formatting-ui.valueType.${e}`,value:e}),Ge=e=>{var n;let{type:a,className:o,onChange:s,value:c,FormulaEditorComponent:l}=e,u=(0,i.useDependency)(t.IUniverInstanceService),p=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(n=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),g=(0,d.useMemo)(()=>String(c).startsWith(`=`)?String(c):`=`,[c]),_=(0,d.useMemo)(()=>[r.CFValueType.max,r.CFValueType.min,`none`].includes(a)?{disabled:!0}:[r.CFValueType.percent,r.CFValueType.percentile].includes(a)?{min:0,max:100}:{min:-(2**53-1),max:2**53-1},[a]),v=(0,d.useRef)(null),[y,b]=(0,d.useState)(!1);return(0,i.useSidebarClick)(e=>{var t;(t=v.current)!=null&&t.isClickOutSide(e)&&b(!1)}),a===r.CFValueType.formula?(0,m.jsx)(`div`,{className:`univer-w-full`,children:(0,m.jsx)(l,{ref:v,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),initValue:g,unitId:p,subUnitId:h,isFocus:y,onChange:(e=``)=>{s(e||``)},onFocus:()=>b(!0)})}):(0,m.jsx)(f.InputNumber,{className:o,value:Number(e.value)||0,onChange:t=>e.onChange(t||0),..._})},Ke=e=>{var n;let{interceptorManager:a,SelectComponent:o=f.Select,ColorPickerComponent:s=We,FormulaEditorComponent:c=u.FormulaEditor}=e,l=(0,i.useDependency)(t.LocaleService),p=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.colorScale?e.rule:void 0,h=[Y(r.CFValueType.num),Y(r.CFValueType.percent),Y(r.CFValueType.percentile),Y(r.CFValueType.formula)],g=[Y(r.CFValueType.min),...h].map(e=>({...e,label:l.t(e.label)})),_=[Y(`none`),...h].map(e=>({...e,label:l.t(e.label)})),v=[Y(r.CFValueType.max),...h].map(e=>({...e,label:l.t(e.label)})),[y,b]=(0,d.useState)(()=>{var e;let t=r.CFValueType.min;return p&&((e=p.config[0])==null?void 0:e.value.type)||t}),[x,S]=(0,d.useState)(()=>{var e;let t=`none`;return!p||p.config.length!==3?t:((e=p.config[1])==null?void 0:e.value.type)||t}),[C,w]=(0,d.useState)(()=>{var e;let t=r.CFValueType.max;return p&&((e=p.config[p.config.length-1])==null?void 0:e.value.type)||t}),[T,E]=(0,d.useState)(()=>{if(!p)return 10;let e=p.config[0];return(e==null?void 0:e.value.value)===void 0?10:e==null?void 0:e.value.value}),[D,O]=(0,d.useState)(()=>{var e;if(!p||p.config.length!==3)return 50;let t=(e=p.config[1])==null?void 0:e.value.value;return t===void 0?50:t}),[k,A]=(0,d.useState)(()=>{var e;if(!p)return 90;let t=(e=p.config[p.config.length-1])==null?void 0:e.value.value;return t===void 0?90:t}),[j,M]=(0,d.useState)(()=>{var e;return p&&((e=p.config[0])==null?void 0:e.color)||`#d0d9fb`}),[N,P]=(0,d.useState)(()=>{var e;let t=`#7790f3`;return!p||p.config.length!==3?t:((e=p.config[1])==null?void 0:e.color)||t}),[F,I]=(0,d.useState)(()=>{var e;return p&&((e=p.config[p.config.length-1])==null?void 0:e.color)||`#2e55ef`}),L=(0,d.useMemo)(()=>e=>{let{minType:t,medianType:n,maxType:i,minValue:a,medianValue:o,maxValue:s,minColor:c,medianColor:l,maxColor:u}=e,d=[];return d.push({color:c,value:{type:t,value:a}}),n!==`none`&&d.push({color:l,value:{type:n,value:o}}),d.push({color:u,value:{type:i,value:s}}),{config:d.map((e,t)=>({...e,index:t})),type:r.CFRuleType.colorScale}},[]);(0,d.useEffect)(()=>a.intercept(a.getInterceptPoints().submit,{handler(){return L({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),[L,y,x,C,T,D,k,j,N,F,a]);let R=t=>{e.onChange(L(t))};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:L({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})})}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.min`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-flex-shrink-0`,options:g,value:y,onChange:e=>{b(e);let t=(0,r.createDefaultValueByValueType)(e,10);E(t),R({minType:e,medianType:x,maxType:C,minValue:t,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(Ge,{id:`min`,value:T,type:y,FormulaEditorComponent:c,onChange:e=>{E(e),R({minType:y,medianType:x,maxType:C,minValue:e,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(s,{color:j,onChange:e=>{M(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:e,medianColor:N,maxColor:F})}})]}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.medianValue`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-flex-shrink-0`,options:_,value:x,onChange:e=>{S(e);let t=(0,r.createDefaultValueByValueType)(e,50);O(t),R({minType:y,medianType:e,maxType:C,minValue:T,medianValue:t,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(Ge,{id:`median`,value:D,type:x,FormulaEditorComponent:c,onChange:e=>{O(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:e,maxValue:k,minColor:j,medianColor:N,maxColor:F})}}),x===`none`?(0,m.jsx)(`div`,{"aria-hidden":!0,className:`univer-size-6 univer-flex-shrink-0`}):(0,m.jsx)(s,{color:N,onChange:e=>{P(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:e,maxColor:F})}})]}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.max`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-flex-shrink-0`,options:v,value:C,onChange:e=>{w(e);let t=(0,r.createDefaultValueByValueType)(e,90);A(t),R({minType:y,medianType:x,maxType:e,minValue:T,medianValue:D,maxValue:t,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(Ge,{id:`max`,value:k,type:C,FormulaEditorComponent:c,onChange:e=>{A(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:e,minColor:j,medianColor:N,maxColor:F})}}),(0,m.jsx)(s,{color:F,onChange:e=>{I(e),R({minType:y,medianType:x,maxType:C,minValue:T,medianValue:D,maxValue:k,minColor:j,medianColor:N,maxColor:e})}})]})]})},X=e=>({label:`sheets-conditional-formatting-ui.valueType.${e}`,value:e}),qe=e=>{var n;let{onChange:a,className:o,value:s,type:c,disabled:l=!1,FormulaEditorComponent:u}=e,p=(0,i.useDependency)(t.IUniverInstanceService),h=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),g=(n=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),_=(0,d.useRef)(null),[v,y]=(0,d.useState)(!1);(0,i.useSidebarClick)(e=>{var t;(t=_.current)!=null&&t.isClickOutSide(e)&&y(!1)});let b=(0,d.useRef)(s),x=(0,d.useMemo)(()=>[r.CFValueType.percentile,r.CFValueType.percent].includes(c)?{max:100,min:0}:{min:-(2**53-1),max:2**53-1},[c]);if(c===r.CFValueType.formula){let e=String(b.current).startsWith(`=`)?String(b.current)||``:`=`;return(0,m.jsx)(`div`,{className:`univer-w-full`,children:(0,m.jsx)(u,{ref:_,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),initValue:e,unitId:h,subUnitId:g,isFocus:v,onChange:(e=``)=>{a(e||``)},onFocus:()=>y(!0)})})}return(0,m.jsx)(f.InputNumber,{className:o,value:Number(s)||0,disabled:l,onChange:e=>{a(e||0)},...x})},Je=e=>{var n;let{interceptorManager:a,SelectComponent:o=f.Select,ColorPickerComponent:s=We,FormulaEditorComponent:c=u.FormulaEditor}=e,l=(0,i.useDependency)(t.LocaleService),p=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.dataBar?e.rule:void 0,[h,g]=(0,d.useState)(()=>{var e;return p&&(e=p.config)!=null&&e.isGradient?`1`:`0`}),[_,v]=(0,d.useState)(()=>{var e;return p&&((e=p.config)==null?void 0:e.positiveColor)||r.defaultDataBarPositiveColor}),[y,b]=(0,d.useState)(()=>{var e;return p&&((e=p.config)==null?void 0:e.nativeColor)||r.defaultDataBarNativeColor}),x=[X(r.CFValueType.num),X(r.CFValueType.percent),X(r.CFValueType.percentile),X(r.CFValueType.formula)],S=[X(r.CFValueType.min),...x].map(e=>({...e,label:l.t(e.label)})),C=[X(r.CFValueType.max),...x].map(e=>({...e,label:l.t(e.label)})),[w,T]=(0,d.useState)(()=>{var e;let t=S[0].value;return p&&((e=p.config)==null?void 0:e.min.type)||t}),[E,D]=(0,d.useState)(()=>{var e;let t=C[0].value;return p&&((e=p.config)==null?void 0:e.max.type)||t}),[O,k]=(0,d.useState)(()=>{var e;if(!p)return 0;let t=((e=p.config)==null?void 0:e.min)||{};return t.type===r.CFValueType.formula?t.value||`=`:t.value||0}),[A,j]=(0,d.useState)(()=>{var e;if(!p)return 100;let t=((e=p.config)==null?void 0:e.max)||{};return t.type===r.CFValueType.formula?t.value||`=`:t.value===void 0?100:t.value}),[M,N]=(0,d.useState)(()=>!p||p.isShowValue===void 0||!!p.isShowValue),P=e=>({config:{min:{type:e.minValueType,value:e.minValue},max:{type:e.maxValueType,value:e.maxValue},isGradient:e.isGradient===`1`,positiveColor:e.positiveColor||r.defaultDataBarPositiveColor,nativeColor:e.nativeColor||r.defaultDataBarNativeColor},type:r.CFRuleType.dataBar,isShowValue:e.isShowValue});(0,d.useEffect)(()=>a.intercept(a.getInterceptPoints().submit,{handler(){return P({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}}),[h,O,w,A,E,_,y,a,M]);let F=t=>{e.onChange(P(t))},I=e=>{v(e),F({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:e,nativeColor:y,isShowValue:M})},L=e=>{b(e),F({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:e,isShowValue:M})},R=e=>x.map(e=>e.value).includes(e);return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:P({isGradient:h,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.fillType`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-3`,children:[(0,m.jsxs)(f.RadioGroup,{value:h,onChange:e=>{g(e),F({isGradient:e,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})},children:[(0,m.jsx)(f.Radio,{value:`0`,children:(0,m.jsx)(`span`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.pureColor`)})}),(0,m.jsx)(f.Radio,{value:`1`,children:(0,m.jsx)(`span`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.gradient`)})})]}),(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{checked:!M,onChange:e=>{N(!e),F({isGradient:e,minValue:O,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:!e})}}),l.t(`sheets-conditional-formatting-ui.panel.onlyShowDataBar`)]})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.colorSet`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center`,children:[(0,m.jsx)(`div`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.native`)}),(0,m.jsx)(s,{color:y,onChange:L})]}),(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center univer-gap-3`,children:[(0,m.jsx)(`div`,{className:`univer-text-xs`,children:l.t(`sheets-conditional-formatting-ui.panel.positive`)}),(0,m.jsx)(s,{color:_,onChange:I})]})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.min`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-w-1/2 univer-flex-shrink-0`,options:S,value:w,onChange:e=>{T(e);let t=(0,r.createDefaultValueByValueType)(e,10);k(t),F({isGradient:h,minValue:t,minValueType:e,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}}),(0,m.jsx)(qe,{id:`min`,disabled:!R(w),type:w,value:O,FormulaEditorComponent:c,onChange:e=>{k(e||0),F({isGradient:h,minValue:e||0,minValueType:w,maxValue:A,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}})]}),(0,m.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.valueType.max`)}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsx)(o,{className:`univer-w-1/2 univer-flex-shrink-0`,options:C,value:E,onChange:e=>{D(e);let t=(0,r.createDefaultValueByValueType)(e,90);j(t),F({isGradient:h,minValue:O,minValueType:w,maxValue:t,maxValueType:e,positiveColor:_,nativeColor:y,isShowValue:M})}}),(0,m.jsx)(qe,{disabled:!R(E),id:`max`,type:E,value:A,FormulaEditorComponent:c,onChange:e=>{j(e||0),F({isGradient:h,minValue:O,minValueType:w,maxValue:e||0,maxValueType:E,positiveColor:_,nativeColor:y,isShowValue:M})}})]})]})]})},Ye=e=>[t.BooleanNumber.FALSE,void 0].includes(e)?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE,Xe=e=>e!==t.BooleanNumber.FALSE,Ze=e=>{let{style:n,onChange:i,className:a,ColorPickerComponent:o=We}=e,[s,c]=(0,d.useState)(()=>{if(n!=null&&n.bl)return n.bl}),[l,u]=(0,d.useState)(()=>{if(n!=null&&n.it)return n.it}),[p,h]=(0,d.useState)(()=>{if(n!=null&&n.ul)return n.ul.s}),[g,_]=(0,d.useState)(()=>{if(n!=null&&n.st)return n.st.s}),[v,y]=(0,d.useState)(()=>{var e;return n!=null&&(e=n.cl)!=null&&e.rgb?n.cl.rgb:`#2f56ef`}),[b,x]=(0,d.useState)(()=>{var e;return n!=null&&(e=n.bg)!=null&&e.rgb?n.bg.rgb:`#e8ecfc`});(0,d.useEffect)(()=>{let e={bl:s,it:l};v!==void 0&&(e.cl={rgb:v}),b!==void 0&&(e.bg={rgb:b}),g!==void 0&&(e.st={s:g}),p!==void 0&&(e.ul={s:p}),i((0,r.removeUndefinedAttr)(e))},[s,l,p,g,v,b]);let S=`univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1`;return(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-my-2.5 univer-flex univer-justify-between`,a),children:[(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(s||t.BooleanNumber.FALSE)}),onClick:()=>c(Ye(s)),children:(0,m.jsx)(ve,{})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(l||t.BooleanNumber.FALSE)}),onClick:()=>u(Ye(l)),children:(0,m.jsx)(De,{})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(p||t.BooleanNumber.FALSE)}),onClick:()=>h(Ye(p)),children:(0,m.jsx)(Fe,{})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(S,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Xe(g||t.BooleanNumber.FALSE)}),onClick:()=>_(Ye(g)),children:(0,m.jsx)(Ne,{})}),(0,m.jsx)(o,{color:v,onChange:y,Icon:ze}),(0,m.jsx)(o,{color:b,onChange:x})]})},Qe=e=>{var n;let{onChange:a,interceptorManager:o,ColorPickerComponent:s,FormulaEditorComponent:c=u.FormulaEditor}=e,l=(0,i.useDependency)(t.LocaleService),h=(0,i.useDependency)(p.LexerTreeBuilder),g=(0,i.useDependency)(t.IUniverInstanceService).getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),_=g.getActiveSheet(),v=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,y=(0,d.useRef)(null),[b,x]=(0,d.useState)(!1),S=(0,d.useRef)(null),[C,w]=(0,d.useState)({}),[T,E]=(0,d.useState)(()=>(v==null?void 0:v.subType)===r.CFSubRuleType.formula?v.value:`=`),[D,O]=(0,d.useState)(void 0),k=e=>({style:e.style,value:T,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});(0,d.useEffect)(()=>o.intercept(o.getInterceptPoints().submit,{handler(){return k({style:C,formula:T})}}),[C,T,o]),(0,d.useEffect)(()=>o.intercept(o.getInterceptPoints().beforeSubmit,{handler:(e,t,n)=>{let r=T.length>1&&T.startsWith(p.operatorToken.EQUALS)&&h.checkIfAddBracket(T)===0;return D||!r?(O(l.t(`sheets-conditional-formatting-ui.errorMessage.formulaError`)),!1):n(e)}}),[D,T,o,h,l]);let A=e=>{a(k(e))};return(0,i.useSidebarClick)(e=>{var t;(t=S.current)!=null&&t.isClickOutSide(e)&&x(!1)}),(0,m.jsxs)(`div`,{ref:y,children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)(c,{ref:S,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),errorText:D,isFocus:b,initValue:T,unitId:g.getUnitId(),subUnitId:_==null?void 0:_.getSheetId(),onFocus:()=>{x(!0)},onChange:e=>{E(e),A({style:C,formula:e})},onVerify:(e,t)=>{!e||t.length===1?O(l.t(`sheets-conditional-formatting-ui.errorMessage.formulaError`)):O(void 0)}})}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:k({style:C,formula:T})})}),(0,m.jsx)(Ze,{ColorPickerComponent:s,style:v==null?void 0:v.style,className:`univer-mt-3`,onChange:e=>{w(e),A({style:e,formula:T})}})]})},$e=e=>(0,m.jsxs)(`div`,{children:[e.children,e.errorText&&(0,m.jsx)(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:e.errorText})]}),et=new Set(Object.values(r.CFTextOperator)),tt=new Set(Object.values(r.CFNumberOperator)),nt=new Set(Object.values(r.CFTimePeriodOperator)),rt=e=>typeof e==`string`&&et.has(e),it=e=>typeof e==`string`&&tt.has(e),at=e=>typeof e==`string`&&nt.has(e),Z=e=>({label:`sheets-conditional-formatting-ui.operator.${e}`,value:e});function ot(e){let{type:n,operator:a,onChange:o,value:s,interceptorManager:c}=e,l=(0,i.useDependency)(t.LocaleService),[u,p]=(0,d.useState)(()=>typeof s==`number`?s:0),[h,g]=(0,d.useState)(``),[_,v]=(0,d.useState)(()=>typeof s==`string`?s:``),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(()=>Array.isArray(s)?s[0]===void 0?0:s[0]:0),[C,w]=(0,d.useState)(``),[T,E]=(0,d.useState)(()=>Array.isArray(s)?s[1]===void 0?100:s[1]:100),[D,O]=(0,d.useState)(``);switch((0,d.useEffect)(()=>{switch(n){case r.CFSubRuleType.text:[r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(a)&&o(_);break;case r.CFSubRuleType.number:[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(a)&&o(u),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(a)&&o([x,T])}},[n]),(0,d.useEffect)(()=>{let e=c.intercept(c.getInterceptPoints().beforeSubmit,{handler:(e,t,i)=>{switch(n){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.containsText,r.CFTextOperator.endsWith,r.CFTextOperator.notEqual,r.CFTextOperator.notContainsText,r.CFTextOperator.equal].includes(a))return _?i(e):(b(l.t(`sheets-conditional-formatting-ui.errorMessage.notBlank`)),!1)}return i(e)}});return()=>{e()}},[n,u,_,a]),n){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(a)){let e=e=>{v(e),o(e)};return(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)($e,{errorText:y,children:(0,m.jsx)(f.Input,{value:_,onChange:t=>{b(``),e(t)}})})})}break;case r.CFSubRuleType.number:if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(a))return(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)($e,{errorText:h,children:(0,m.jsx)(f.InputNumber,{className:`univer-w-full`,min:-(2**53-1),max:2**53-1,value:u,onChange:e=>{p(e||0),o(e||0),g(``)}})})});if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(a))return(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[(0,m.jsx)($e,{errorText:C,children:(0,m.jsx)(f.InputNumber,{min:-(2**53-1),max:2**53-1,value:x,onChange:e=>{S(e||0),o([e||0,T]),w(``)}})}),(0,m.jsx)($e,{errorText:D,children:(0,m.jsx)(f.InputNumber,{className:`univer-ml-3`,min:-(2**53-1),max:2**53-1,value:T,onChange:e=>{E(e||0),o([x,e||0]),O(``)}})})]})}return null}let st=e=>{switch(e){case r.CFSubRuleType.text:return[Z(r.CFTextOperator.containsText),Z(r.CFTextOperator.notContainsText),Z(r.CFTextOperator.beginsWith),Z(r.CFTextOperator.endsWith),Z(r.CFTextOperator.equal),Z(r.CFTextOperator.notEqual),Z(r.CFTextOperator.containsBlanks),Z(r.CFTextOperator.notContainsBlanks),Z(r.CFTextOperator.containsErrors),Z(r.CFTextOperator.notContainsErrors)];case r.CFSubRuleType.number:return[Z(r.CFNumberOperator.between),Z(r.CFNumberOperator.notBetween),Z(r.CFNumberOperator.equal),Z(r.CFNumberOperator.notEqual),Z(r.CFNumberOperator.greaterThan),Z(r.CFNumberOperator.greaterThanOrEqual),Z(r.CFNumberOperator.lessThan),Z(r.CFNumberOperator.lessThanOrEqual)];case r.CFSubRuleType.timePeriod:return[Z(r.CFTimePeriodOperator.yesterday),Z(r.CFTimePeriodOperator.today),Z(r.CFTimePeriodOperator.tomorrow),Z(r.CFTimePeriodOperator.last7Days),Z(r.CFTimePeriodOperator.lastWeek),Z(r.CFTimePeriodOperator.thisWeek),Z(r.CFTimePeriodOperator.nextWeek),Z(r.CFTimePeriodOperator.lastMonth),Z(r.CFTimePeriodOperator.thisMonth),Z(r.CFTimePeriodOperator.nextMonth)];default:return[]}},ct=e=>{var n;let{interceptorManager:a,onChange:o,SelectComponent:s=f.Select,ColorPickerComponent:c}=e,l=(0,i.useDependency)(t.LocaleService),u=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,[p,h]=(0,d.useState)(()=>{let e=r.CFSubRuleType.text;return u&&u.subType||e}),g=[{value:r.CFSubRuleType.text,label:l.t(`sheets-conditional-formatting-ui.subRuleType.text`)},{value:r.CFSubRuleType.number,label:l.t(`sheets-conditional-formatting-ui.subRuleType.number`)},{value:r.CFSubRuleType.timePeriod,label:l.t(`sheets-conditional-formatting-ui.subRuleType.timePeriod`)},{value:r.CFSubRuleType.duplicateValues,label:l.t(`sheets-conditional-formatting-ui.subRuleType.duplicateValues`)},{value:r.CFSubRuleType.uniqueValues,label:l.t(`sheets-conditional-formatting-ui.subRuleType.uniqueValues`)}],_=(0,d.useMemo)(()=>st(p).map(e=>({...e,label:l.t(e.label)})),[l,p]),[v,y]=(0,d.useState)(()=>{var e;let t=(e=_[0])==null?void 0:e.value;return u&&`operator`in u?u.operator:t}),[b,x]=(0,d.useState)(()=>u?`value`in u&&u.value!==void 0?u.value:`operator`in u?(0,r.createDefaultValue)(u.subType,u.operator):``:``),[S,C]=(0,d.useState)({}),w=(0,d.useMemo)(()=>e=>{let t=e.subType??p,n=e.operator??v,i=e.value??b,a=e.style??S;switch(t){case r.CFSubRuleType.duplicateValues:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:a};case r.CFSubRuleType.uniqueValues:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:a};case r.CFSubRuleType.text:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:rt(n)?n:r.CFTextOperator.containsText,style:a,value:typeof i==`string`?i:void 0};case r.CFSubRuleType.timePeriod:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:at(n)?n:r.CFTimePeriodOperator.today,style:a};case r.CFSubRuleType.number:{let e=it(n)?n:r.CFNumberOperator.equal;if(e===r.CFNumberOperator.between||e===r.CFNumberOperator.notBetween){let t=Array.isArray(i)?i:[0,100];return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:e,style:a,value:t}}return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:e,style:a,value:typeof i==`number`?i:void 0}}}},[p,v,b,S]);return(0,d.useEffect)(()=>a.intercept(a.getInterceptPoints().submit,{handler(){return w({})}}),[w,a]),(0,d.useEffect)(()=>{g.some(e=>e.value===p)||h(g[0].value)},[g]),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsxs)(`div`,{className:`univer-flex univer-justify-between univer-gap-4`,children:[(0,m.jsx)(s,{className:`univer-mt-3 univer-w-full`,onChange:e=>{var t,n;let i=(t=g.find(t=>t.value===e))==null?void 0:t.value;if(!i)return;let a=(n=st(i).map(e=>({...e,label:l.t(e.label)}))[0])==null?void 0:n.value;h(i),y(a),a&&x((0,r.createDefaultValue)(i,a)),o(w({subType:i,operator:a}))},value:p,options:g}),(_==null?void 0:_.length)&&(0,m.jsx)(s,{className:`univer-mt-3 univer-w-full`,onChange:e=>{var t;let n=(t=_.find(t=>t.value===e))==null?void 0:t.value;n&&(y(n),o(w({operator:n})))},value:v||``,options:_})]}),(0,m.jsx)(ot,{value:b,interceptorManager:a,type:p,operator:v,rule:u,onChange:e=>{x(e),o(w({value:e}))}},`${p}_${v}`),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:w({})})}),(0,m.jsx)(Ze,{ColorPickerComponent:c,style:u==null?void 0:u.style,className:`univer-ml-1`,onChange:e=>{C(e),o(w({style:e}))}})]})},lt=(e,t)=>(r.iconMap[e]||[])[Number(t)]||``,ut=e=>{var n;let{error:a,type:o,onChange:s,FormulaEditorComponent:c}=e,l=(0,i.useDependency)(t.IUniverInstanceService),u=l.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),p=(n=l.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),h=(0,d.useRef)(null),[g,_]=(0,d.useState)(!1);return(0,i.useSidebarClick)(e=>{var t;(t=h.current)!=null&&t.isClickOutSide(e)&&_(!1)}),(0,m.jsx)(`div`,{className:`univer-relative`,children:o===r.CFValueType.formula?(0,m.jsx)(`div`,{className:`univer-w-full`,children:(0,m.jsx)(c,{ref:h,className:(0,f.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,f.borderClassName),initValue:String(e.value),unitId:u,subUnitId:p,isFocus:g,onChange:(e=``)=>{s(e||``)},onFocus:()=>_(!0)})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.InputNumber,{className:(0,f.clsx)({"univer-border-red-500":a}),value:Number(e.value)||0,onChange:e=>s(e??0)}),a&&(0,m.jsx)(`div`,{className:`univer-absolute univer-text-xs univer-text-red-500`,children:a})]})})},dt=(e,t,n)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),ft=e=>{let{iconType:n,onClick:a}=e,o=(0,i.useDependency)(t.LocaleService),s=(0,i.useObservable)(o.direction$,o.getDirection());return(0,m.jsx)(`div`,{dir:s,className:`univer-w-80`,children:r.iconGroup.map(e=>(0,m.jsxs)(`div`,{className:`univer-mb-4 last:univer-mb-0`,children:[(0,m.jsx)(`div`,{className:`univer-mb-2 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400`,children:o.t(e.title)}),(0,m.jsx)(`div`,{dir:s,"data-u-comp":`cf-icon-set-group-grid`,className:`univer-grid univer-grid-cols-2 univer-gap-1`,children:e.group.map((t,r)=>{let i=t.name===n;return(0,m.jsx)(`button`,{type:`button`,"aria-label":`${o.t(e.title)} ${r+1}`,"aria-pressed":i,className:(0,f.clsx)(`univer-flex univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-justify-start univer-rounded-md univer-border-0 univer-bg-transparent univer-px-2 univer-outline-none univer-transition-colors focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600`,i?`univer-bg-primary-50 univer-ring-1 univer-ring-primary-600 dark:!univer-bg-primary-900`:`hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`),onClick:()=>{a(t.name)},children:(0,m.jsx)(`span`,{dir:s,className:`univer-flex univer-items-center univer-gap-0.5`,children:t.list.map((e,t)=>(0,m.jsx)(`img`,{alt:``,className:`univer-size-5`,src:e,draggable:!1},t))})},t.name)})})]},e.title))})},pt=e=>{let{onClick:n}=e,a=(0,i.useDependency)(t.LocaleService),o=(0,i.useObservable)(a.direction$,a.getDirection()),s=(0,d.useMemo)(()=>{let e=[];for(let t in r.iconMap){let n=t;r.iconMap[n].forEach((t,r)=>{e.push({iconType:n,base64:t,iconId:String(r)})})}return e},[]),c=e=>{n(e.iconType,e.iconId)};return(0,m.jsxs)(`div`,{dir:o,children:[(0,m.jsx)(`div`,{"data-u-comp":`cf-icon-set-no-icon-option`,className:`univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-text-sm`,onClick:()=>c({iconType:r.IIconSetType.empty,iconId:``,base64:``}),children:a.t(`sheets-conditional-formatting-ui.iconSet.noCellIcon`)}),(0,m.jsx)(`div`,{className:`univer-flex univer-w-64 univer-flex-wrap univer-gap-2`,children:s.map(e=>(0,m.jsx)(`div`,{className:`univer-mb-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`,children:(0,m.jsx)(`img`,{className:`univer-size-5`,src:e.base64,draggable:!1,onClick:()=>c(e)})},`${e.iconType}_${e.iconId}`))})]})},mt=e=>{let{onChange:n,configList:a,errorMap:o={},DropdownComponent:s,SelectComponent:c,FormulaEditorComponent:l}=e,u=(0,i.useDependency)(t.LocaleService),p=[{label:u.t(`sheets-conditional-formatting-ui.symbol.${r.CFNumberOperator.greaterThan}`),value:r.CFNumberOperator.greaterThan},{label:u.t(`sheets-conditional-formatting-ui.symbol.${r.CFNumberOperator.greaterThanOrEqual}`),value:r.CFNumberOperator.greaterThanOrEqual}],h=[{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.num}`),value:r.CFValueType.num},{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.percent}`),value:r.CFValueType.percent},{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.percentile}`),value:r.CFValueType.percentile},{label:u.t(`sheets-conditional-formatting-ui.valueType.${r.CFValueType.formula}`),value:r.CFValueType.formula}],g=(e,t)=>{n([String(t),`value`,`value`],e)},_=(e,t)=>{n([String(t),`operator`],e);let i=(0,r.createDefaultValue)(r.CFSubRuleType.number,e);g(i,t)},v=(e,t)=>{n([String(t),`value`,`type`],e);let i=a[t],o=(0,r.createDefaultValue)(r.CFSubRuleType.number,i.operator);g(o,t)};return(0,d.useMemo)(()=>a.map((e,t)=>{let i=o[t],d=lt(e.iconType,e.iconId),y=t===a.length-1,b=t===0,x=a[t-1],S=(x==null?void 0:x.value.type)===r.CFValueType.formula?u.t(`sheets-conditional-formatting-ui.valueType.formula`):x==null?void 0:x.value.value;return(0,m.jsxs)(`div`,{className:t?`univer-mt-6`:`univer-mt-3`,children:[(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[(0,m.jsxs)(`div`,{className:`univer-w-[45%]`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.icon`),t+1]}),(0,m.jsx)(`div`,{className:`univer-w-[45%]`,children:(0,m.jsxs)(m.Fragment,{children:[!b&&!y&&u.t(`sheets-conditional-formatting-ui.iconSet.rule`),!b&&!y&&(0,m.jsxs)(`span`,{className:`univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.when`),` `,u.t(`sheets-conditional-formatting-ui.symbol.${(0,r.getOppositeOperator)(x.operator)}`),S,y?``:` ${u.t(`sheets-conditional-formatting-ui.iconSet.and`)} `]})]})})]}),(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-rule-grid`,className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 rtl:univer-grid-flow-dense`,children:[(0,m.jsx)(`div`,{className:`univer-flex univer-items-center`,children:(0,m.jsx)(s,{overlay:(0,m.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,m.jsx)(pt,{onClick:(r,i)=>{let a={...e,iconId:i,iconType:r};n([String(t)],a)},iconId:e.iconId,iconType:e.iconType})}),children:(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200`,f.borderClassName),children:[d?(0,m.jsx)(`img`,{src:d,className:`univer-size-4`,draggable:!1}):(0,m.jsx)(Ue,{}),(0,m.jsx)(ke,{})]})})}),y?(0,m.jsxs)(`div`,{className:`univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.rule`),(0,m.jsxs)(`span`,{className:`univer-font-medium`,children:[u.t(`sheets-conditional-formatting-ui.iconSet.when`),` `,u.t(`sheets-conditional-formatting-ui.symbol.${(0,r.getOppositeOperator)(x.operator)}`),S,y?``:` ${u.t(`sheets-conditional-formatting-ui.iconSet.and`)} `]})]}):(0,m.jsx)(c,{options:p,value:e.operator,onChange:e=>{_(e,t)}})]}),y?(0,m.jsx)(`div`,{}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[(0,m.jsx)(`div`,{children:u.t(`sheets-conditional-formatting-ui.iconSet.type`)}),(0,m.jsx)(`div`,{children:u.t(`sheets-conditional-formatting-ui.iconSet.value`)})]}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4`,children:[(0,m.jsx)(c,{options:h,value:e.value.type,onChange:e=>{v(e,t)}}),(0,m.jsx)(ut,{id:t,type:e.value.type,error:i,value:e.value.value||``,FormulaEditorComponent:l,onChange:e=>{g(e,t)}})]})]})]},t)}),[a,s,o,l,c])},ht=e=>{var n;let{interceptorManager:a,DropdownComponent:o=f.Dropdown,SelectComponent:s=f.Select,FormulaEditorComponent:c=u.FormulaEditor}=e,l=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.iconSet?e.rule:void 0,p=(0,i.useDependency)(t.LocaleService),h=(0,i.useObservable)(p.direction$,p.getDirection()),[g,_]=(0,d.useState)({}),[v,y]=(0,d.useState)(()=>{let e=Object.keys(r.iconMap)[0];if(l&&l.config.length){let e=l.config[0].iconType;if(!l.config.some(t=>t.iconType!==e))return e}return e}),[b,x]=(0,d.useState)(()=>{if(l&&l.config.length)return t.Tools.deepClone(l==null?void 0:l.config);let e=r.iconMap[v]||[];return Array(e.length).fill(``).map((e,t,n)=>t===n.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:2**53-1},iconType:v,iconId:String(t)}:dt(v,t,n))}),[S,C]=(0,d.useState)(()=>!l||!!l.isShowValue),w=(0,d.useMemo)(()=>{let e=b.map(e=>lt(e.iconType,e.iconId));return(0,m.jsx)(`div`,{"data-u-comp":`cf-icon-set-preview`,className:`univer-flex univer-items-center rtl:univer-flex-row-reverse`,children:e.map((e,t)=>e?(0,m.jsx)(`img`,{className:`univer-size-5`,src:e},t):(0,m.jsx)(Ue,{className:`univer-size-5`},t))})},[b]),T=e=>{if(e.reduce((t,n,i)=>t.preType&&!t.result||e.length-1===i?t:n.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:t.preType?{result:t.preType===n.value.type,preType:n.value.type}:{result:!0,preType:n.value.type},{result:!0,preType:``}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(e[0].value.type)){let t={};return e.forEach((n,i,a)=>{if(i-1<0||i===a.length-1)return;let o=e[i-1],s=(0,r.getOppositeOperator)(o.operator);(0,r.compareWithNumber)({operator:s,value:o.value.value},n.value.value)||(t[i]=`${p.t(`sheets-conditional-formatting-ui.form.${s}`,String(o.value.value))} `)}),t}return{}};return(0,d.useEffect)(()=>{let e=a.intercept(a.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:S,config:b}}});return()=>{e()}},[S,b,a]),(0,d.useEffect)(()=>{let e=a.intercept(a.getInterceptPoints().beforeSubmit,{handler(){let e=T(b);return _(e),Object.keys(e).length===0}});return()=>{e()}},[S,b,a,g]),(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-editor`,dir:h,children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600`,children:p.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(`div`,{className:`univer-mt-3`,children:(0,m.jsx)(o,{overlay:(0,m.jsx)(`div`,{dir:h,className:`univer-rounded-lg univer-p-3`,children:(0,m.jsx)(ft,{iconType:v,onClick:e=>{y(e);let t=r.iconMap[e]||[],n=Array(t.length).fill(``).map((t,n,r)=>dt(e,n,r));x(n),_(T(n))}})}),children:(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600`,f.borderClassName),children:[w,(0,m.jsx)(ke,{})]})})}),(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2 univer-text-xs rtl:univer-flex-row-reverse rtl:univer-justify-end`,children:[(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-option-row`,className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{onChange:()=>{let e=b.map(e=>({...e}));b.forEach((t,n)=>{let r=b.length-1-n,i=e[r];t.iconId=i.iconId,t.iconType=i.iconType}),x([...b])}}),p.t(`sheets-conditional-formatting-ui.iconSet.reverseIconOrder`)]}),(0,m.jsxs)(`div`,{"data-u-comp":`cf-icon-set-option-row`,className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{checked:!S,onChange:e=>{C(!e)}}),p.t(`sheets-conditional-formatting-ui.iconSet.onlyShowIcon`)]})]}),(0,m.jsx)(mt,{errorMap:g,onChange:(e,n)=>{(0,t.get)(b,e)!==n&&((0,t.set)(b,e,n),x([...b]),_(T(b)))},configList:b,DropdownComponent:o,SelectComponent:s,FormulaEditorComponent:c})]})},gt=e=>{var n;let{onChange:a,interceptorManager:o,SelectComponent:s=f.Select,ColorPickerComponent:c}=e,l=(0,i.useDependency)(t.LocaleService),u=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,p=[{label:l.t(`sheets-conditional-formatting-ui.panel.isNotBottom`),value:`isNotBottom`},{label:l.t(`sheets-conditional-formatting-ui.panel.isBottom`),value:`isBottom`},{label:l.t(`sheets-conditional-formatting-ui.panel.greaterThanAverage`),value:`greaterThanAverage`},{label:l.t(`sheets-conditional-formatting-ui.panel.lessThanAverage`),value:`lessThanAverage`}],[h,g]=(0,d.useState)(()=>{let e=p[0].value,t=u==null?void 0:u.type;if(!u)return e;switch(t){case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.average:return[r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual].includes(u.operator)?`greaterThanAverage`:[r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(u.operator)?`lessThanAverage`:e;case r.CFSubRuleType.rank:return u.isBottom?`isBottom`:`isNotBottom`}}return e}),[_,v]=(0,d.useState)(()=>{let e=u==null?void 0:u.type;if(!u)return 10;switch(e){case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.rank:return u.value||10}}return 10}),[y,b]=(0,d.useState)(()=>{let e=u==null?void 0:u.type;if(!u)return!1;switch(e){case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.rank:return u.isPercent||!1}}return!1}),[x,S]=(0,d.useState)({}),C=e=>{let{type:t,isPercent:n,value:i,style:a}=e;switch(t){case`isNotBottom`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:n,isBottom:!1,value:i,style:a};case`isBottom`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:n,isBottom:!0,value:i,style:a};case`greaterThanAverage`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:a};case`lessThanAverage`:return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:a}}};(0,d.useEffect)(()=>o.intercept(o.getInterceptPoints().submit,{handler(){return C({type:h,isPercent:y,value:_,style:x})}}),[h,y,_,x,o]);let w=e=>{a(C(e))};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:l.t(`sheets-conditional-formatting-ui.panel.styleRule`)}),(0,m.jsx)(s,{className:`univer-mt-3 univer-w-full`,value:h,options:p,onChange:e=>{var t;let n=(t=p.find(t=>t.value===e))==null?void 0:t.value;n&&(g(n),w({type:n,isPercent:y,value:_,style:x}))}}),[`isNotBottom`,`isBottom`].includes(h)&&(0,m.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-gap-2`,children:[(0,m.jsx)(f.InputNumber,{min:1,max:1e3,value:_,onChange:e=>{let t=e||0;v(t),w({type:h,isPercent:y,value:t,style:x})}}),(0,m.jsxs)(`div`,{className:`univer-flex univer-items-center univer-text-xs`,children:[(0,m.jsx)(f.Checkbox,{checked:y,onChange:e=>{b(!!e),w({type:h,isPercent:!!e,value:_,style:x})}}),l.t(`sheets-conditional-formatting-ui.valueType.percent`)]})]}),(0,m.jsx)(`div`,{className:J,children:(0,m.jsx)(q,{rule:C({type:h,isPercent:y,value:_,style:x})})}),(0,m.jsx)(Ze,{ColorPickerComponent:c,style:u==null?void 0:u.style,className:`univer-mt-3`,onChange:e=>{S(e),w({type:h,isPercent:y,value:_,style:e})}})]})},_t=(0,t.createInterceptorKey)(`beforeSubmit`),vt=(0,t.createInterceptorKey)(`submit`),yt=e=>e.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),bt=e=>{var n;return(n=e.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId()},xt=e=>{var a,o;let{SelectComponent:s=f.Select,DropdownComponent:c,ColorPickerComponent:l,RangeSelectorComponent:h=u.RangeSelector,FormulaEditorComponent:g=u.FormulaEditor}=e,_=(0,i.useDependency)(t.LocaleService),v=(0,i.useDependency)(t.ICommandService),y=(0,i.useDependency)(t.IUniverInstanceService),b=(0,i.useDependency)(r.ConditionalFormattingRuleModel),x=(0,i.useDependency)(n.SheetsSelectionsService),S=yt(y),C=bt(y),[w,T]=(0,d.useState)(void 0),E=(0,d.useRef)(((a=e.rule)==null?void 0:a.ranges)??[]),D=(0,d.useRef)(!1),O=(0,d.useMemo)(()=>{var t;let n=(t=e.rule)==null?void 0:t.ranges;if(!(n!=null&&n.length)){var r;n=((r=x.getCurrentSelections())==null?void 0:r.map(e=>e.range))??[]}return E.current=n,n!=null&&n.length?n.map(e=>{let t=(0,p.serializeRange)(e);return t===`NaN`?``:t}).filter(e=>!!e).join(`,`):``},[e.rule]),k=[{label:_.t(`sheets-conditional-formatting-ui.ruleType.highlightCell`),value:`1`},{label:_.t(`sheets-conditional-formatting-ui.panel.rankAndAverage`),value:`2`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.dataBar`),value:`3`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.colorScale`),value:`4`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.formula`),value:`5`},{label:_.t(`sheets-conditional-formatting-ui.ruleType.iconSet`),value:`6`}],[A,j]=(0,d.useState)(()=>{var t;let n=(t=e.rule)==null?void 0:t.rule.type,i=k[0].value;if(!n)return i;switch(n){case r.CFRuleType.highlightCell:var a;switch((a=e.rule)==null?void 0:a.rule.subType){case r.CFSubRuleType.number:case r.CFSubRuleType.text:case r.CFSubRuleType.duplicateValues:case r.CFSubRuleType.uniqueValues:case r.CFSubRuleType.timePeriod:return`1`;case r.CFSubRuleType.average:case r.CFSubRuleType.rank:return`2`;case r.CFSubRuleType.formula:return`5`}break;case r.CFRuleType.dataBar:return`3`;case r.CFRuleType.colorScale:return`4`;case r.CFRuleType.iconSet:return`6`}return i}),M=(0,d.useRef)(void 0),N=(0,d.useMemo)(()=>new t.InterceptorManager({beforeSubmit:_t,submit:vt}),[]),P=(0,d.useMemo)(()=>{switch(A){case`1`:return ct;case`2`:return gt;case`3`:return Je;case`4`:return Ke;case`5`:return Qe;case`6`:return ht;default:return ct}},[A]);(0,d.useEffect)(()=>{let t=v.onCommandExecuted(t=>{if(t.id===n.RemoveSheetMutation.id){let n=t.params;n.subUnitId===C&&n.unitId===S&&e.onCancel()}t.id===n.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>t.dispose()},[]);let F=e=>{M.current=e},I=e=>{if(!D.current&&e.length<1&&E.current.length>0)return;D.current=!0;let t=e.split(`,`).filter(e=>!!e).map(p.deserializeRangeWithSheet).map(e=>e.range);E.current=t};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:_.t(`sheets-conditional-formatting-ui.panel.range`)}),(0,m.jsxs)(`div`,{className:`univer-mt-4`,children:[(0,m.jsx)(h,{unitId:S,subUnitId:C,initialValue:O,onChange:(e,t)=>I(t),onVerify:(e,t)=>{if(!D.current&&!e&&t.length<1){T(void 0);return}e?t.length<1?T(_.t(`sheets-conditional-formatting-ui.errorMessage.rangeError`)):T(void 0):T(_.t(`sheets-conditional-formatting-ui.errorMessage.rangeError`))}}),w&&(0,m.jsx)(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:w})]}),(0,m.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:_.t(`sheets-conditional-formatting-ui.panel.styleType`)}),(0,m.jsx)(s,{className:`univer-mt-4 univer-w-full`,value:A,options:k,onChange:e=>j(e)}),(0,m.jsx)(P,{interceptorManager:N,rule:(o=e.rule)==null?void 0:o.rule,onChange:F,SelectComponent:s,DropdownComponent:c,ColorPickerComponent:l,FormulaEditorComponent:g}),(0,m.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-end univer-gap-2`,children:[(0,m.jsx)(f.Button,{onClick:()=>{e.onCancel()},children:_.t(`sheets-conditional-formatting-ui.panel.cancel`)}),(0,m.jsx)(f.Button,{variant:`primary`,onClick:()=>{let i=(()=>{let e=y.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!e)throw Error(`No active sheet found`);return E.current.map(t=>(0,n.setEndForRange)(t,e.getRowCount(),e.getColumnCount())).filter(e=>!(Number.isNaN(e.startRow)||Number.isNaN(e.startColumn)))})();if(i.length<1){T(_.t(`sheets-conditional-formatting-ui.errorMessage.rangeError`));return}if(N.fetchThroughInterceptors(N.getInterceptPoints().beforeSubmit)(!0,null)){let t=N.fetchThroughInterceptors(N.getInterceptPoints().submit)(null,null);if(t){let n=yt(y),a=bt(y);if(!n||!a)throw Error(`No active sheet found`);let o={};e.rule&&e.rule.cfId?(o={...e.rule,ranges:i,rule:t},v.executeCommand(r.SetCfCommand.id,{unitId:n,subUnitId:a,rule:o}),e.onCancel()):(o={cfId:b.createCfId(n,a),ranges:i,rule:t,stopIfTrue:!1},v.executeCommand(r.AddCfCommand.id,{unitId:n,subUnitId:a,rule:o}),e.onCancel())}}},children:_.t(`sheets-conditional-formatting-ui.panel.submit`)})]})]})},St=(e,t)=>{let n=e.rule;switch(n.type){case r.CFRuleType.colorScale:return t.t(`sheets-conditional-formatting-ui.ruleType.colorScale`);case r.CFRuleType.dataBar:return t.t(`sheets-conditional-formatting-ui.ruleType.dataBar`);case r.CFRuleType.iconSet:return t.t(`sheets-conditional-formatting-ui.ruleType.iconSet`);case r.CFRuleType.highlightCell:switch(n.subType){case r.CFSubRuleType.average:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`,t.t(`sheets-conditional-formatting-ui.subRuleType.average`))}case r.CFSubRuleType.duplicateValues:return t.t(`sheets-conditional-formatting-ui.subRuleType.duplicateValues`);case r.CFSubRuleType.uniqueValues:return t.t(`sheets-conditional-formatting-ui.subRuleType.uniqueValues`);case r.CFSubRuleType.number:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`,...Array.isArray(n.value)?n.value.map(e=>String(e)):[String(n.value||``)])}case r.CFSubRuleType.text:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`,n.value||``)}case r.CFSubRuleType.timePeriod:{let e=n.operator;return t.t(`sheets-conditional-formatting-ui.preview.describe.${e}`)}case r.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t(`sheets-conditional-formatting-ui.preview.describe.bottomNPercent`,String(n.value)):t.t(`sheets-conditional-formatting-ui.preview.describe.topNPercent`,String(n.value)):n.isBottom?t.t(`sheets-conditional-formatting-ui.preview.describe.bottomN`,String(n.value)):t.t(`sheets-conditional-formatting-ui.preview.describe.topN`,String(n.value));case r.CFSubRuleType.formula:return t.t(`sheets-conditional-formatting-ui.ruleType.formula`)}}};function Ct(e){let{SelectComponent:s=f.Select}=e,{onClick:c}=e,l=(0,i.useDependency)(r.ConditionalFormattingRuleModel),u=(0,i.useDependency)(t.IUniverInstanceService),h=(0,i.useDependency)(n.SheetsSelectionsService),g=(0,i.useDependency)(t.ICommandService),_=(0,i.useDependency)(t.LocaleService),v=(0,i.useDependency)(t.Injector),y=(0,i.useDependency)(H),b=(0,i.useObservable)(()=>u.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),x=b.getUnitId(),S=b.getActiveSheet().getSheetId(),[C,w]=(0,d.useState)([]),[T,E]=(0,d.useState)(`2`),[D,O]=(0,d.useState)(``),k=[{label:_.t(`sheets-conditional-formatting-ui.panel.workSheet`),value:`2`},{label:_.t(`sheets-conditional-formatting-ui.panel.selectedRange`),value:`1`}],A=()=>{let e=l.getSubunitRules(x,S);if(!e||!e.length)return[];if(T===`1`){let n=h.getCurrentLastSelection();if(!n)return[];let r=n.range;return e.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,r)))}return T===`2`?[...e]:[]},j=(0,i.useObservable)(()=>{let e=new o.Observable(e=>{let t=[n.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],i=g.onCommandExecuted(r=>{var i;if(r.id===n.SetWorksheetActiveOperation.id){e.next(`immediate`);return}let a=(i=r.params)==null?void 0:i.unitId;T===`1`&&t.includes(r.id)&&a===x&&e.next(`debounced`)});return()=>i.dispose()}).pipe((0,o.share)());return(0,o.merge)(l.$ruleChange,e.pipe((0,o.filter)(e=>e===`immediate`)),e.pipe((0,o.filter)(e=>e===`debounced`),(0,o.debounceTime)(16))).pipe((0,o.map)(A),(0,o.startWith)(A()))},[],!1,[g,l,T,S,x]);(0,a.useHighlightRange)(C);let M=e=>{var n;let i=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=(n=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId();if(!i||!a)throw Error(`No active sheet found`);g.executeCommand(r.DeleteCfCommand.id,{unitId:i,subUnitId:a,cfId:e.cfId})},N=(e,t)=>{let n=L[t.y];O((n==null?void 0:n.cfId)??``)},P=(e,n,i)=>{var a,o,s;O(``);let c=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(a=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:a.getSheetId();if(!c||!l)throw Error(`No active sheet found`);let d=e=>{let t=L.length;return Math.min(t-1,Math.max(0,e))},f=(o=L[d(n.y)])==null?void 0:o.cfId,p=(s=L[d(i.y)])==null?void 0:s.cfId;f&&p&&f!==p&&g.executeCommand(r.MoveCfCommand.id,{unitId:c,subUnitId:l,start:{id:f,type:`self`},end:{id:p,type:i.y>n.y?`after`:`before`}})},F=()=>{e.onCreate()},I=()=>{T===`2`?g.executeCommand(r.ClearWorksheetCfCommand.id):T===`1`&&j.map(e=>({unitId:x,subUnitId:S,cfId:e.cfId})).forEach(e=>{g.executeCommand(r.DeleteCfCommand.id,e)})},L=(0,d.useMemo)(()=>{let e=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),r=e.getActiveSheet();return j.filter(t=>{let i=t.ranges;return(0,n.checkRangesEditablePermission)(v,e.getUnitId(),r.getSheetId(),i)})},[j]),R=(0,d.useMemo)(()=>{let e=u.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),r=e.getActiveSheet();return j.every(t=>{let i=t.ranges;return(0,n.checkRangesEditablePermission)(v,e.getUnitId(),r.getSheetId(),i)})},[j]);return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`univer-mb-2 univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm`,children:[(0,m.jsx)(`div`,{className:`univer-flex univer-items-center univer-gap-2`,children:y.tWithReactNode(`sheets-conditional-formatting-ui.panel.managerRuleSelect`,(0,m.jsx)(s,{className:`univer-w-36`,options:k,value:T,onChange:e=>{E(e)}})).map((e,t)=>(0,m.jsx)(`span`,{children:e},t))}),(0,m.jsxs)(`div`,{className:`univer-flex univer-justify-end univer-gap-2`,children:[(0,m.jsx)(f.Tooltip,{title:_.t(`sheets-conditional-formatting-ui.panel.createRule`),placement:`bottom`,children:(0,m.jsx)(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:F,children:(0,m.jsx)(Te,{})})}),j.length&&R?(0,m.jsx)(f.Tooltip,{title:_.t(`sheets-conditional-formatting-ui.panel.clear`),placement:`bottom`,children:(0,m.jsx)(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:I,children:(0,m.jsx)(K,{className:`univer-text-red-500`})})}):(0,m.jsx)(`div`,{children:(0,m.jsx)(K,{className:`univer-text-gray-300`})})]})]}),(0,m.jsx)(`div`,{children:(0,m.jsx)(f.DraggableList,{className:`univer-w-full`,draggableHandle:`.draggableHandle`,list:L,onListChange:()=>void 0,idKey:`cfId`,rowHeight:60,margin:[0,10],onDragStop:P,onDragStart:N,itemRender:e=>(0,m.jsxs)(`div`,{className:(0,f.clsx)(`univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 rtl:univer-pl-8 rtl:univer-pr-5 dark:hover:!univer-bg-gray-700`,{"univer-bg-gray-100 dark:!univer-bg-gray-700":D===e.cfId}),onMouseMove:()=>{e.ranges!==C&&w(e.ranges)},onMouseLeave:()=>w([]),onClick:()=>{c(e)},children:[(0,m.jsx)(`div`,{className:(0,f.clsx)(`univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex rtl:univer-left-auto rtl:univer-right-0`,`draggableHandle`),onClick:e=>e.stopPropagation(),children:(0,m.jsx)(Ce,{})}),(0,m.jsxs)(`div`,{className:`univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden`,children:[(0,m.jsx)(`div`,{className:`univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0`,children:St(e,_)}),(0,m.jsx)(`div`,{className:`univer-max-w-[250px] univer-overflow-hidden univer-text-ellipsis univer-text-xs univer-text-gray-400`,children:e.ranges.map(e=>(0,p.serializeRange)(e)).join(`,`)})]}),(0,m.jsx)(`div`,{children:(0,m.jsx)(q,{rule:e.rule})}),(0,m.jsx)(`div`,{className:(0,f.clsx)(`univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200 rtl:univer-left-1 rtl:univer-right-auto`,{"univer-flex univer-items-center univer-justify-center":D===e.cfId}),onClick:t=>{t.stopPropagation(),M(e),w([])},children:(0,m.jsx)(K,{})})]})})})]})}let wt=e=>{let{RuleEditComponent:t=xt,RuleListComponent:n=Ct}=e,[r,i]=(0,d.useState)(e.rule),[a,o]=(0,d.useState)(!!e.rule);return(0,m.jsx)(`div`,{className:`univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4`,children:a?(0,m.jsx)(t,{onCancel:()=>{o(!1),i(void 0)},rule:r}):(0,m.jsx)(n,{onClick:e=>{i(e),o(!0)},onCreate:()=>{o(!0)}})})};function Tt(e){return(0,m.jsx)(We,{...e,DropdownComponent:f.MobileDropdown,PickerComponent:f.MobileColorPicker})}function Et(e){let t=(0,i.useDependency)(i.ComponentManager).get(a.EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);return(0,m.jsx)(xt,{...e,SelectComponent:f.MobileSelect,DropdownComponent:f.MobileDropdown,ColorPickerComponent:Tt,RangeSelectorComponent:u.MobileRangeSelector,FormulaEditorComponent:t})}function Dt(e){return(0,m.jsx)(Ct,{...e,SelectComponent:f.MobileSelect})}function Ot(e){return(0,m.jsx)(wt,{...e,RuleEditComponent:Et,RuleListComponent:Dt})}let kt=class extends t.Disposable{constructor(e,t){super(),this.disposeWithMe(e.register(T,Ot)),this.disposeWithMe(t.register({ConditionsDoubleIcon:Le,DataBarIcon:be,RatingIcon:je}))}};kt=j([A(0,(0,t.Inject)(i.ComponentManager)),A(1,(0,t.Inject)(i.IconManager))],kt);let At={[i.RibbonDataGroup.RULES]:{[N.id]:{order:1,menuItemFactory:R}}},jt=class extends t.Disposable{constructor(e){super(),e.mergeMenu(At)}};jt=j([A(0,i.IMenuManagerService)],jt);let Q=class extends t.Plugin{constructor(e=z,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},z,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(le,o),this._initCommand()}onStarting(){(0,t.registerDependencies)(this._injector,[[kt],[W],[V],[U],[H],[B],[M],[jt]]),(0,t.touchDependencies)(this._injector,[[kt],[W],[B]])}onReady(){(0,t.touchDependencies)(this._injector,[[jt],[M]])}onRendered(){(0,t.touchDependencies)(this._injector,[[V],[U],[H]])}_initCommand(){[h,g,_,y,v,b,x,S,C,w,N].forEach(e=>{this._commandService.registerCommand(e)})}};k(Q,`pluginName`,`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),k(Q,`packageName`,se),k(Q,`version`,ce),k(Q,`type`,t.UniverInstanceType.UNIVER_SHEET),Q=j([(0,t.DependentOn)(c.UniverRenderEnginePlugin,n.UniverSheetsPlugin,l.UniverSheetsFormulaPlugin,u.UniverSheetsFormulaMobileUIPlugin,r.UniverSheetsConditionalFormattingPlugin,a.UniverSheetsMobileUIPlugin),A(1,(0,t.Inject)(t.Injector)),A(2,(0,t.Inject)(t.ICommandService)),A(3,t.IConfigService)],Q);let Mt=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingRangeTransformService=i,this._initAutoFill()}_initAutoFill(){let e=()=>({redos:[],undos:[]}),i=(i,o)=>{var s,c;let l=(s=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getUnitId(),u=(c=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(c=c.getActiveSheet())==null?void 0:c.getSheetId(),d=new Map,f=new Map,p=[],m=[];if(!l||!u)return e();let h=(0,a.virtualizeDiscreteRanges)([i,o]),[g,_]=h.ranges,v=n.AutoFillTools.getAutoFillRepeatRange(g,_),y=v.flatMap(e=>h.mapRange(t.Rectangle.getPositionRange(e.relativeRange,{startRow:e.repeatStartCell.row,endRow:e.repeatStartCell.row,startColumn:e.repeatStartCell.col,endColumn:e.repeatStartCell.col}))),b=e=>{let t=f.get(e);return t||(t={add:[],remove:[]},f.set(e,t)),t};return(this._conditionalFormattingRuleModel.getSubunitRules(l,u)??[]).forEach(e=>{t.Rectangle.doAnyRangesIntersect(e.ranges,y)&&(d.set(e.cfId,e.ranges),b(e.cfId).remove.push(...y));let n=e.ranges.flatMap(e=>{let n=h.projectRange(e),r=n&&(0,t.getIntersectRange)(n,g);return r?[t.Rectangle.getRelativeRange(r,g)]:[]}),r=v.flatMap(e=>n.flatMap(n=>{let r=(0,t.getIntersectRange)(n,e.relativeRange);return r?h.mapRange(t.Rectangle.getPositionRange(r,{startRow:e.repeatStartCell.row,endRow:e.repeatStartCell.row,startColumn:e.repeatStartCell.col,endColumn:e.repeatStartCell.col})):[]}));r.length&&(d.set(e.cfId,e.ranges),b(e.cfId).add.push(...r))}),f.forEach((e,t)=>{let n=d.get(t);n&&d.set(t,this._conditionalFormattingRangeTransformService.applyRangeDelta(n,e.remove,e.add))}),d.forEach((e,t)=>{let n=this._conditionalFormattingRuleModel.getRule(l,u,t);if(n){if(e.length){let t={unitId:l,subUnitId:u,rule:{...n,ranges:e}};p.push({id:r.SetConditionalRuleMutation.id,params:t}),m.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,t))}else{let e={unitId:l,subUnitId:u,cfId:n.cfId};p.push({id:r.DeleteConditionalRuleMutation.id,params:e}),m.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}),{undos:m,redos:p}},o={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(t,r,a)=>{if(a===n.AUTO_FILL_APPLY_TYPE.COPY||a===n.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||a===n.AUTO_FILL_APPLY_TYPE.SERIES){let{source:e,target:n}=t;return i(e,n)}return e()}};this.disposeWithMe(this._autoFillService.addHook(o))}};Mt=j([A(0,(0,t.Inject)(t.Injector)),A(1,(0,t.Inject)(t.IUniverInstanceService)),A(2,(0,t.Inject)(n.IAutoFillService)),A(3,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(4,(0,t.Inject)(r.ConditionalFormattingRangeTransformService))],Mt);let Nt=class extends t.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(n.AFTER_CELL_EDIT,{handler:(e,t,n)=>{e||n(e);let r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),i=(r==null?void 0:r.style)??{},a=Object.keys(i);if(e!=null&&e.p){var o;return(o=e.p.body)==null||(o=o.textRuns)==null||o.forEach(e=>{e.ts&&a.forEach(t=>{var n;(n=e.ts)==null||delete n[t]})}),n(e)}{let r={...(typeof(e==null?void 0:e.s)==`string`?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};return a.forEach(e=>{delete r[e]}),n({...e,s:{...r}})}}})))}};Nt=j([A(0,(0,t.Inject)(n.SheetInterceptorService)),A(1,(0,t.Inject)(r.ConditionalFormattingService))],Nt);let Pt=(e,t)=>{let n=e=>e.endRow-e.startRow+1,r=e=>e.endColumn-e.startColumn+1,i=n(t)%n(e),a=r(t)%r(e),o=Math.floor(n(t)/n(e)),s=Math.floor(r(t)/r(e)),c=[],l={startRow:0,endRow:n(e)-1,startColumn:0,endColumn:r(e)-1};if(n(t)===1&&r(t)===1){let e={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return c.push({repeatRelativeRange:l,startRange:e}),c}for(let u=0;u<o+(i?.1:0);u++)for(let d=0;d<s+(a?.1:0);d++){let f=n(e)*u,p=r(e)*d,m={startRow:f+t.startRow,endRow:f+t.startRow,startColumn:p+t.startColumn,endColumn:p+t.startColumn},h=l;u===o&&i&&(h={...h},h.endRow-=n(e)-i),d===s&&a&&(h={...h},h.endColumn-=r(e)-a),c.push({repeatRelativeRange:h,startRange:m})}return c},Ft=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._injector=e,this._univerInstanceService=t,this._formatPainterService=n,this._sheetsSelectionsService=r,this._conditionalFormattingRuleModel=i,this._conditionalFormattingRangeTransformService=a,k(this,`_painterConfig`,null),this._initFormattingPainter()}_initFormattingPainter(){let e=()=>({redos:[],undos:[]}),n=(n,i,a)=>{let{range:o,unitId:s,subUnitId:c}=this._painterConfig,l=n!==s||c!==i,u=new Map,d=new Map,f=[],p=[];if(!n||!i||!s||!c)return e();let m=Pt(o,a),h=m.map(e=>t.Rectangle.getPositionRange(e.repeatRelativeRange,e.startRange)),g=e=>{let t=d.get(e);return t||(t={add:[],remove:[]},d.set(e,t)),t},_=this._conditionalFormattingRuleModel.getSubunitRules(n,i)??[],v=new Map;_.forEach(e=>{t.Rectangle.doAnyRangesIntersect(e.ranges,h)&&(u.set(e.cfId,e.ranges),g(e.cfId).remove.push(...h))});let y=this._conditionalFormattingRuleModel.getSubunitRules(s,c)??[];return(l?[...y].reverse():y).forEach(e=>{let r=e.ranges.flatMap(e=>{let n=(0,t.getIntersectRange)(e,o);return n?[t.Rectangle.getRelativeRange(n,o)]:[]}),a=m.flatMap(e=>r.flatMap(n=>{let r=(0,t.getIntersectRange)(n,e.repeatRelativeRange);return r?[t.Rectangle.getPositionRange(r,e.startRange)]:[]}));if(a.length){let r=e.cfId;l&&(r=this._conditionalFormattingRuleModel.createCfId(n,i),v.set(r,{...t.Tools.deepClone(e),cfId:r,ranges:[]}),u.set(r,[])),u.has(r)||u.set(r,e.ranges),g(r).add.push(...a)}}),d.forEach((e,t)=>{let n=u.get(t);n&&u.set(t,this._conditionalFormattingRangeTransformService.applyRangeDelta(n,e.remove,e.add))}),u.forEach((e,t)=>{if(l){let a=v.get(t);if(a){if(e.length){let t={unitId:n,subUnitId:i,rule:{...a,ranges:e}};f.push({id:r.AddConditionalRuleMutation.id,params:t}),p.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,t))}return}let o=this._conditionalFormattingRuleModel.getRule(n,i,t);if(o){if(e.length){let t={unitId:n,subUnitId:i,rule:{...o,ranges:e}};f.push({id:r.SetConditionalRuleMutation.id,params:t}),p.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,t))}else{let e={unitId:n,subUnitId:i,cfId:o.cfId};f.push({id:r.DeleteConditionalRuleMutation.id,params:e}),p.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}else{let n=this._conditionalFormattingRuleModel.getRule(s,c,t);if(!n)return;if(e.length){let t={unitId:s,subUnitId:c,rule:{...n,ranges:e}};f.push({id:r.SetConditionalRuleMutation.id,params:t}),p.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,t))}else{let e={unitId:s,subUnitId:c,cfId:n.cfId};f.push({id:r.DeleteConditionalRuleMutation.id,params:e}),p.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}),{undos:p,redos:f}},i={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:e=>{switch(e){case a.FormatPainterStatus.INFINITE:case a.FormatPainterStatus.ONCE:{var n,r;let e=(n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId(),i=(r=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(r=r.getActiveSheet())==null?void 0:r.getSheetId(),a=this._sheetsSelectionsService.getCurrentLastSelection(),o=a==null?void 0:a.range;e&&i&&o&&(this._painterConfig={unitId:e,subUnitId:i,range:o});break}case a.FormatPainterStatus.OFF:this._painterConfig=null}},onApply:(e,t,r)=>this._painterConfig?n(e,t,r):{redos:[],undos:[]}};this._formatPainterService.addHook(i)}};Ft=j([A(0,(0,t.Inject)(t.Injector)),A(1,(0,t.Inject)(t.IUniverInstanceService)),A(2,(0,t.Inject)(a.IFormatPainterService)),A(3,(0,t.Inject)(n.SheetsSelectionsService)),A(4,(0,t.Inject)(r.ConditionalFormattingRuleModel)),A(5,(0,t.Inject)(r.ConditionalFormattingRangeTransformService))],Ft);let It=class extends t.Disposable{constructor(e,n,r){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=n,this._renderManagerService=r,k(this,`_unitDisposable`,new t.DisposableCollection),this._init()}_init(){let e=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),n=e=>{this._unitDisposable.dispose(),this._unitDisposable=new t.DisposableCollection;let n=e.getUnitId(),i=this._renderManagerService.getRenderUnitById(n);if(!i)return;let o=i.with(a.SheetSkeletonManagerService);this._unitDisposable.add(o.currentSkeleton$.subscribe(e=>{if(e){let t=e.skeleton.rowColumnSegment,n=t.endColumn-t.startColumn+1,i=(t.endRow-t.startRow+1)*n*9,a=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,i);this._conditionalFormattingViewModel.setCacheLength(a)}}))};e&&n(e),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{if(!e){this._unitDisposable.dispose();return}n(e)}))}dispose(){this._unitDisposable.dispose(),super.dispose()}};It=j([A(0,(0,t.Inject)(r.ConditionalFormattingViewModel)),A(1,t.IUniverInstanceService),A(2,c.IRenderManagerService)],It);let Lt=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){this.disposeWithMe(this._componentManager.register(T,wt))}_registerIcons(){this.disposeWithMe(this._iconManager.register({ConditionsDoubleIcon:Le,DataBarIcon:be,RatingIcon:je}))}};Lt=j([A(0,(0,t.Inject)(i.ComponentManager)),A(1,(0,t.Inject)(i.IconManager))],Lt);let Rt=class extends t.Disposable{constructor(e){super(),this._menuManagerService=e,this._menuManagerService.mergeMenu(oe)}};Rt=j([A(0,i.IMenuManagerService)],Rt);let $=class extends t.Plugin{constructor(e=z,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},z,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(le,o),this._initCommand()}onStarting(){this._injector.add([Lt]),this._injector.get(Lt),(0,t.registerDependencies)(this._injector,[[W],[V],[Mt],[U],[M],[Rt],[H],[Nt],[P],[Ft],[It],[B]]),(0,t.touchDependencies)(this._injector,[[W],[B]])}onReady(){(0,t.touchDependencies)(this._injector,[[Rt],[M]])}onRendered(){(0,t.touchDependencies)(this._injector,[[Mt],[P],[V],[Nt],[H],[Ft],[U],[It]])}_initCommand(){[h,g,_,y,v,b,x,S,C,w,N].forEach(e=>{this._commandService.registerCommand(e)})}};k($,`pluginName`,`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),k($,`packageName`,se),k($,`version`,ce),k($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=j([(0,t.DependentOn)(c.UniverRenderEnginePlugin,n.UniverSheetsPlugin,l.UniverSheetsFormulaPlugin,r.UniverSheetsConditionalFormattingPlugin,a.UniverSheetsUIPlugin),A(1,(0,t.Inject)(t.Injector)),A(2,(0,t.Inject)(t.ICommandService)),A(3,t.IConfigService)],$),e.AddAverageCfCommand=h,e.AddColorScaleConditionalRuleCommand=g,e.AddDataBarConditionalRuleCommand=_,e.AddDuplicateValuesCfCommand=v,e.AddIconSetConditionalRuleCommand=y,e.AddNumberCfCommand=b,e.AddRankCfCommand=x,e.AddTextCfCommand=S,e.AddTimePeriodCfCommand=C,e.AddUniqueValuesCfCommand=w,Object.defineProperty(e,"ConditionalFormattingClearController",{enumerable:!0,get:function(){return P}}),e.OpenConditionalFormattingOperator=N,e.SheetsConditionalFormattingUIMenuSchema=oe,Object.defineProperty(e,"UniverSheetsConditionalFormattingMobileUIPlugin",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UniverSheetsConditionalFormattingUIPlugin",{enumerable:!0,get:function(){return $}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-conditional-formatting-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Conditional formatting UI for Univer Sheets.",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/core": "1.0.
|
|
62
|
-
"@univerjs/design": "1.0.
|
|
63
|
-
"@univerjs/engine-formula": "1.0.
|
|
64
|
-
"@univerjs/engine-render": "1.0.
|
|
65
|
-
"@univerjs/icons": "1.43.
|
|
66
|
-
"@univerjs/sheets": "1.0.
|
|
67
|
-
"@univerjs/sheets-conditional-formatting": "1.0.
|
|
68
|
-
"@univerjs/sheets-formula": "1.0.
|
|
69
|
-
"@univerjs/sheets-formula-ui": "1.0.
|
|
70
|
-
"@univerjs/sheets-ui": "1.0.
|
|
71
|
-
"@univerjs/ui": "1.0.
|
|
61
|
+
"@univerjs/core": "1.0.2",
|
|
62
|
+
"@univerjs/design": "1.0.2",
|
|
63
|
+
"@univerjs/engine-formula": "1.0.2",
|
|
64
|
+
"@univerjs/engine-render": "1.0.2",
|
|
65
|
+
"@univerjs/icons": "1.43.1",
|
|
66
|
+
"@univerjs/sheets": "1.0.2",
|
|
67
|
+
"@univerjs/sheets-conditional-formatting": "1.0.2",
|
|
68
|
+
"@univerjs/sheets-formula": "1.0.2",
|
|
69
|
+
"@univerjs/sheets-formula-ui": "1.0.2",
|
|
70
|
+
"@univerjs/sheets-ui": "1.0.2",
|
|
71
|
+
"@univerjs/ui": "1.0.2"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@univerjs-infra/shared": "1.0.
|
|
74
|
+
"@univerjs-infra/shared": "1.0.2",
|
|
75
75
|
"postcss": "^8.5.28",
|
|
76
76
|
"react": "18.3.1",
|
|
77
77
|
"rxjs": "^7.8.2",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { FC } from 'react';
|
|
17
|
-
interface IColorPickerProps {
|
|
18
|
-
color: string;
|
|
19
|
-
onChange: (color: string) => void;
|
|
20
|
-
disable?: boolean;
|
|
21
|
-
Icon?: FC;
|
|
22
|
-
className?: string;
|
|
23
|
-
}
|
|
24
|
-
export declare const ColorPicker: (props: IColorPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IHighlightCell } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
interface IConditionalStyleEditorProps {
|
|
18
|
-
className?: string;
|
|
19
|
-
style?: IHighlightCell['style'];
|
|
20
|
-
onChange: (style: IHighlightCell['style']) => void;
|
|
21
|
-
}
|
|
22
|
-
export declare const ConditionalStyleEditor: (props: IConditionalStyleEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
interface IConditionFormattingPanelProps {
|
|
18
|
-
rule?: IConditionFormattingRule;
|
|
19
|
-
}
|
|
20
|
-
export declare const ConditionFormattingPanel: (props: IConditionFormattingPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IStyleEditorProps } from './type';
|
|
17
|
-
export declare const ColorScaleStyleEditor: (props: IStyleEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IStyleEditorProps } from './type';
|
|
17
|
-
export declare const DataBarStyleEditor: (props: IStyleEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IStyleEditorProps } from './type';
|
|
17
|
-
export declare const FormulaStyleEditor: (props: IStyleEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { INumberHighlightCell, ITextHighlightCell, ITimePeriodHighlightCell } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
import type { IStyleEditorProps } from './type';
|
|
18
|
-
export declare const HighlightCellStyleEditor: (props: IStyleEditorProps<any, ITextHighlightCell | INumberHighlightCell | ITimePeriodHighlightCell>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IIconSet } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
import type { IStyleEditorProps } from './type';
|
|
18
|
-
export declare const IconSet: (props: IStyleEditorProps<unknown, IIconSet>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IStyleEditorProps } from './type';
|
|
17
|
-
export declare const RankStyleEditor: (props: IStyleEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
interface IRuleEditProps {
|
|
18
|
-
rule?: IConditionFormattingRule;
|
|
19
|
-
onCancel: () => void;
|
|
20
|
-
}
|
|
21
|
-
export declare const RuleEdit: (props: IRuleEditProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export declare const previewClassName: string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { InterceptorManager } from '@univerjs/core';
|
|
17
|
-
import type { IConditionalFormattingRuleConfig } from '@univerjs/sheets-conditional-formatting';
|
|
18
|
-
export declare const beforeSubmit: import("@univerjs/core").IInterceptor<boolean, null>;
|
|
19
|
-
export declare const submit: import("@univerjs/core").IInterceptor<any, null>;
|
|
20
|
-
export interface IStyleEditorProps<S = any, R = IConditionalFormattingRuleConfig> {
|
|
21
|
-
onChange: (style: S) => void;
|
|
22
|
-
rule?: R;
|
|
23
|
-
interceptorManager: InterceptorManager<{
|
|
24
|
-
beforeSubmit: typeof beforeSubmit;
|
|
25
|
-
submit: typeof submit;
|
|
26
|
-
}>;
|
|
27
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
interface IRuleListProps {
|
|
18
|
-
onClick: (rule: IConditionFormattingRule) => void;
|
|
19
|
-
onCreate: () => void;
|
|
20
|
-
}
|
|
21
|
-
export declare const RuleList: (props: IRuleListProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IConditionalFormattingRuleConfig } from '@univerjs/sheets-conditional-formatting';
|
|
17
|
-
export declare const Preview: (props: {
|
|
18
|
-
rule?: IConditionalFormattingRuleConfig;
|
|
19
|
-
}) => import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { ReactElement } from 'react';
|
|
17
|
-
export declare const WrapperError: (props: {
|
|
18
|
-
errorText: string;
|
|
19
|
-
children: ReactElement;
|
|
20
|
-
}) => import("react/jsx-runtime").JSX.Element;
|