@univerjs/sheets-conditional-formatting-ui 0.2.4-alpha.0 → 0.2.5
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 +3 -3
- package/lib/es/index.js +693 -696
- package/lib/umd/index.js +3 -3
- package/package.json +19 -19
package/lib/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ni=Object.defineProperty;var ji=(e,t,n)=>t in e?Ni(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var St=(e,t,n)=>ji(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@univerjs/core"),s=require("@univerjs/sheets-conditional-formatting"),L=require("@univerjs/sheets"),fe=require("@univerjs/ui"),De=require("rxjs"),We=require("rxjs/operators"),le=require("@univerjs/sheets-ui"),w=require("react"),q=require("@univerjs/design"),Co=require("@univerjs/engine-formula"),ke=require("clsx"),So=require("react-dom"),$i=require("@univerjs/engine-render"),Jn={type:u.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(u.ICommandService),l=e.get(u.IUniverInstanceService),d=L.getSheetCommandTarget(l);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=a.createCfId(f,m),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:i,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:v})}},Qn={type:u.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.ICommandService),c=e.get(u.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},er={type:u.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c,stopIfTrue:l,isShowValue:d}=t,f=e.get(s.ConditionalFormattingRuleModel),m=e.get(u.IUniverInstanceService),h=L.getSheetCommandTarget(m);if(!h)return!1;const{unitId:v,subUnitId:y}=h,R=e.get(u.ICommandService),E=f.createCfId(v,y),C={ranges:n,cfId:E,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:d,config:{min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c}}};return R.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:C})}},tr={type:u.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.ICommandService),c=e.get(u.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},nr={type:u.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(u.ICommandService),d=e.get(u.IUniverInstanceService),f=L.getSheetCommandTarget(d);if(!f)return!1;const{unitId:m,subUnitId:h}=f,v=c.createCfId(m,h);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(i)){const R=a;if(R.length!==2||!Array.isArray(R))return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}else{const R=a;if(typeof R!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:m,subUnitId:h,rule:y})}},rr={type:u.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:i,isBottom:a,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),d=e.get(u.IUniverInstanceService),f=e.get(u.ICommandService),m=L.getSheetCommandTarget(d);if(!m)return!1;const{unitId:h,subUnitId:v}=m,y=l.createCfId(h,v),R={ranges:n,cfId:y,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:i,isBottom:a,style:r,value:c}};return f.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:v,rule:R})}},or={type:u.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(u.IUniverInstanceService),d=L.getSheetCommandTarget(l);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=e.get(u.ICommandService),v=c.createCfId(f,m),y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:i,style:r,value:a}};return h.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:y})}},ir={type:u.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(u.IUniverInstanceService),l=e.get(u.ICommandService),d=L.getSheetCommandTarget(c);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=a.createCfId(f,m),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:i,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:v})}},ar={type:u.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.IUniverInstanceService),c=e.get(u.ICommandService),l=L.getSheetCommandTarget(a);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},an={type:u.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var R;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(u.IUniverInstanceService),o=e.get(u.ICommandService),i=e.get(u.IUndoRedoService),a=e.get(L.SheetsSelectionsService),c=L.getSheetCommandTarget(r,t);if(!c)return!1;const{unitId:l,subUnitId:d}=c,f=((R=a.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],m=n.getSubunitRules(l,d);if(!(m!=null&&m.length)||!f.length)return!1;const h=[],v=[];m.forEach(E=>{const C=new u.ObjectMatrix;E.ranges.forEach(_=>{u.Range.foreach(_,(I,g)=>{C.setValue(I,g,1)})}),f.forEach(_=>{u.Range.foreach(_,(I,g)=>{C.realDeleteValue(I,g)})});const T=L.findAllRectangle(L.createTopMatrixFromMatrix(C));if(T.length){const _={...E,ranges:T},I={unitId:l,subUnitId:d,rule:_},g=s.setConditionalRuleMutationUndoFactory(e,I);h.push({id:s.SetConditionalRuleMutation.id,params:I}),v.push(...g)}else{const _={unitId:l,subUnitId:d,cfId:E.cfId},I=s.DeleteConditionalRuleMutationUndoFactory(e,_);h.push({id:s.DeleteConditionalRuleMutation.id,params:_}),v.push(...I)}});const y=u.sequenceExecute(h,o).result;return y&&i.pushUndoRedo({unitID:l,redoMutations:h,undoMutations:v}),y}},Lt={type:u.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(u.IUniverInstanceService),o=e.get(u.ICommandService),i=e.get(u.IUndoRedoService),a=L.getSheetCommandTarget(r,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,d=n.getSubunitRules(c,l);if(!(d!=null&&d.length))return!1;const f=d.map(y=>({cfId:y.cfId,unitId:c,subUnitId:l})),m=f.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),h=f.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=u.sequenceExecute(m,o).result;return v&&i.pushUndoRedo({unitID:c,redoMutations:m,undoMutations:h}),v}};var Ft=(e=>(e[e.View=0]="View",e[e.Edit=1]="Edit",e[e.ManageCollaborator=2]="ManageCollaborator",e[e.Print=3]="Print",e[e.Duplicate=4]="Duplicate",e[e.Comment=5]="Comment",e[e.Copy=6]="Copy",e[e.Share=7]="Share",e[e.Export=8]="Export",e[e.MoveWorksheet=9]="MoveWorksheet",e[e.DeleteWorksheet=10]="DeleteWorksheet",e[e.HideWorksheet=11]="HideWorksheet",e[e.RenameWorksheet=12]="RenameWorksheet",e[e.CreateWorksheet=13]="CreateWorksheet",e[e.SetWorksheetStyle=14]="SetWorksheetStyle",e[e.EditWorksheetCell=15]="EditWorksheetCell",e[e.InsertHyperlink=16]="InsertHyperlink",e[e.Sort=17]="Sort",e[e.Filter=18]="Filter",e[e.PivotTable=19]="PivotTable",e[e.FloatImg=20]="FloatImg",e[e.History=21]="History",e[e.RwHgtClWdt=22]="RwHgtClWdt",e[e.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",e[e.ViewFilter=24]="ViewFilter",e[e.MoveSheet=25]="MoveSheet",e[e.DeleteSheet=26]="DeleteSheet",e[e.HideSheet=27]="HideSheet",e[e.CopySheet=28]="CopySheet",e[e.RenameSheet=29]="RenameSheet",e[e.CreateSheet=30]="CreateSheet",e[e.SelectProtectedCells=31]="SelectProtectedCells",e[e.SelectUnProtectedCells=32]="SelectUnProtectedCells",e[e.SetCellStyle=33]="SetCellStyle",e[e.SetCellValue=34]="SetCellValue",e[e.SetRowStyle=35]="SetRowStyle",e[e.SetColumnStyle=36]="SetColumnStyle",e[e.InsertRow=37]="InsertRow",e[e.InsertColumn=38]="InsertColumn",e[e.DeleteRow=39]="DeleteRow",e[e.DeleteColumn=40]="DeleteColumn",e[e.EditExtraObject=41]="EditExtraObject",e[e.Delete=42]="Delete",e[e.RecoverHistory=43]="RecoverHistory",e[e.ViewHistory=44]="ViewHistory",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ft||{});const zr=[L.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],Li=e=>{const t=[{label:"sheet.cf.ruleType.highlightCell",value:_e.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:_e.rank},{label:"sheet.cf.ruleType.formula",value:_e.formula},{label:"sheet.cf.ruleType.colorScale",value:_e.colorScale},{label:"sheet.cf.ruleType.dataBar",value:_e.dataBar},{label:"sheet.cf.ruleType.iconSet",value:_e.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:_e.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:_e.createRule},{label:"sheet.cf.menu.clearRangeRules",value:_e.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:_e.clearWorkSheetRules}],n=e.get(L.SheetsSelectionsService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=new De.Observable(d=>De.merge(n.selectionMoveEnd$,new De.Observable(f=>{const m=r.onCommandExecuted(h=>{var E;const{id:v,params:y}=h,R=(E=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();zr.includes(v)&&y.unitId===R&&f.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{var R;const f=((R=n.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],m=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!m)return;const h=m.getActiveSheet();if(!h)return;const y=(i.getSubunitRules(m.getUnitId(),h.getSheetId())||[]).filter(E=>E.ranges.some(C=>f.some(T=>u.Rectangle.intersects(T,C))));d.next(!!y.length)})),c=new De.Observable(d=>De.merge(n.selectionMoveEnd$,new De.Observable(f=>{const m=r.onCommandExecuted(h=>{var E;const{id:v,params:y}=h,R=(E=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();zr.includes(v)&&y.unitId===R&&f.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{const f=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!f)return;const m=f.getActiveSheet();if(!m)return;const h=i.getSubunitRules(f.getUnitId(),m.getSheetId())||[];if(!h.length)return d.next(!1),!1;const v=h.some(y=>y.ranges.some(E=>{var g,x;const{startRow:C,startColumn:T,endRow:_,endColumn:I}=E;for(let O=C;O<=_;O++)for(let S=T;S<=I;S++){const M=(x=(g=m.getCell(O,S))==null?void 0:g.selectionProtection)==null?void 0:x[0];if((M==null?void 0:M[Ft.Edit])===!1||(M==null?void 0:M[Ft.View])===!1)return!0}return!1}));d.next(!v)})),l=new De.Observable(d=>{a.subscribe(f=>{const m=t.find(h=>h.value===_e.clearRangeRules);m&&(m.disabled=!f,d.next(t))}),c.subscribe(f=>{const m=t.find(h=>h.value===_e.clearWorkSheetRules);m&&(m.disabled=!f,d.next(t))}),d.next(t)});return{id:On.id,type:fe.MenuItemType.SELECTOR,group:fe.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[fe.MenuPosition.TOOLBAR_START],icon:"Conditions",tooltip:"sheet.cf.title",selections:l,hidden$:fe.getMenuHiddenObservable(e,u.UniverInstanceType.UNIVER_SHEET),disabled$:le.getCurrentRangeDisable$(e,{workbookTypes:[L.WorkbookEditablePermission],worksheetTypes:[L.WorksheetSetCellStylePermission,L.WorksheetEditPermission],rangeTypes:[L.RangeProtectionPermissionEditPoint]})}};var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ui(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var bo={exports:{}},sn={};/**
|
|
1
|
+
"use strict";var Ni=Object.defineProperty;var ji=(e,t,n)=>t in e?Ni(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var St=(e,t,n)=>ji(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@univerjs/core"),s=require("@univerjs/sheets-conditional-formatting"),L=require("@univerjs/sheets"),fe=require("@univerjs/ui"),De=require("rxjs"),We=require("rxjs/operators"),le=require("@univerjs/sheets-ui"),x=require("react"),q=require("@univerjs/design"),Co=require("@univerjs/engine-formula"),ke=require("clsx"),So=require("react-dom"),$i=require("@univerjs/engine-render"),Jn={type:u.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(u.ICommandService),l=e.get(u.IUniverInstanceService),d=L.getSheetCommandTarget(l);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=a.createCfId(f,m),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:i,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:v})}},Qn={type:u.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.ICommandService),c=e.get(u.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},er={type:u.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c,stopIfTrue:l,isShowValue:d}=t,f=e.get(s.ConditionalFormattingRuleModel),m=e.get(u.IUniverInstanceService),h=L.getSheetCommandTarget(m);if(!h)return!1;const{unitId:v,subUnitId:y}=h,R=e.get(u.ICommandService),E=f.createCfId(v,y),S={ranges:n,cfId:E,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:d,config:{min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c}}};return R.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:S})}},tr={type:u.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.ICommandService),c=e.get(u.IUniverInstanceService),l=L.getSheetCommandTarget(c);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},nr={type:u.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(u.ICommandService),d=e.get(u.IUniverInstanceService),f=L.getSheetCommandTarget(d);if(!f)return!1;const{unitId:m,subUnitId:h}=f,v=c.createCfId(m,h);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(i)){const R=a;if(R.length!==2||!Array.isArray(R))return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}else{const R=a;if(typeof R!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:R}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:m,subUnitId:h,rule:y})}},rr={type:u.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:i,isBottom:a,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),d=e.get(u.IUniverInstanceService),f=e.get(u.ICommandService),m=L.getSheetCommandTarget(d);if(!m)return!1;const{unitId:h,subUnitId:v}=m,y=l.createCfId(h,v),R={ranges:n,cfId:y,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:i,isBottom:a,style:r,value:c}};return f.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:v,rule:R})}},or={type:u.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(u.IUniverInstanceService),d=L.getSheetCommandTarget(l);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=e.get(u.ICommandService),v=c.createCfId(f,m),y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:i,style:r,value:a}};return h.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:y})}},ir={type:u.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(u.IUniverInstanceService),l=e.get(u.ICommandService),d=L.getSheetCommandTarget(c);if(!d)return!1;const{unitId:f,subUnitId:m}=d,h=a.createCfId(f,m),v={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:i,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:m,rule:v})}},ar={type:u.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.IUniverInstanceService),c=e.get(u.ICommandService),l=L.getSheetCommandTarget(a);if(!l)return!1;const{unitId:d,subUnitId:f}=l,m=i.createCfId(d,f),h={ranges:n,cfId:m,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:h})}},an={type:u.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var R;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(u.IUniverInstanceService),o=e.get(u.ICommandService),i=e.get(u.IUndoRedoService),a=e.get(L.SheetsSelectionsService),c=L.getSheetCommandTarget(r,t);if(!c)return!1;const{unitId:l,subUnitId:d}=c,f=((R=a.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],m=n.getSubunitRules(l,d);if(!(m!=null&&m.length)||!f.length)return!1;const h=[],v=[];m.forEach(E=>{const S=new u.ObjectMatrix;E.ranges.forEach(_=>{u.Range.foreach(_,(w,g)=>{S.setValue(w,g,1)})}),f.forEach(_=>{u.Range.foreach(_,(w,g)=>{S.realDeleteValue(w,g)})});const I=L.findAllRectangle(L.createTopMatrixFromMatrix(S));if(I.length){const _={...E,ranges:I},w={unitId:l,subUnitId:d,rule:_},g=s.setConditionalRuleMutationUndoFactory(e,w);h.push({id:s.SetConditionalRuleMutation.id,params:w}),v.push(...g)}else{const _={unitId:l,subUnitId:d,cfId:E.cfId},w=s.DeleteConditionalRuleMutationUndoFactory(e,_);h.push({id:s.DeleteConditionalRuleMutation.id,params:_}),v.push(...w)}});const y=u.sequenceExecute(h,o).result;return y&&i.pushUndoRedo({unitID:l,redoMutations:h,undoMutations:v}),y}},Lt={type:u.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(u.IUniverInstanceService),o=e.get(u.ICommandService),i=e.get(u.IUndoRedoService),a=L.getSheetCommandTarget(r,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,d=n.getSubunitRules(c,l);if(!(d!=null&&d.length))return!1;const f=d.map(y=>({cfId:y.cfId,unitId:c,subUnitId:l})),m=f.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),h=f.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=u.sequenceExecute(m,o).result;return v&&i.pushUndoRedo({unitID:c,redoMutations:m,undoMutations:h}),v}};var Ft=(e=>(e[e.View=0]="View",e[e.Edit=1]="Edit",e[e.ManageCollaborator=2]="ManageCollaborator",e[e.Print=3]="Print",e[e.Duplicate=4]="Duplicate",e[e.Comment=5]="Comment",e[e.Copy=6]="Copy",e[e.Share=7]="Share",e[e.Export=8]="Export",e[e.MoveWorksheet=9]="MoveWorksheet",e[e.DeleteWorksheet=10]="DeleteWorksheet",e[e.HideWorksheet=11]="HideWorksheet",e[e.RenameWorksheet=12]="RenameWorksheet",e[e.CreateWorksheet=13]="CreateWorksheet",e[e.SetWorksheetStyle=14]="SetWorksheetStyle",e[e.EditWorksheetCell=15]="EditWorksheetCell",e[e.InsertHyperlink=16]="InsertHyperlink",e[e.Sort=17]="Sort",e[e.Filter=18]="Filter",e[e.PivotTable=19]="PivotTable",e[e.FloatImg=20]="FloatImg",e[e.History=21]="History",e[e.RwHgtClWdt=22]="RwHgtClWdt",e[e.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",e[e.ViewFilter=24]="ViewFilter",e[e.MoveSheet=25]="MoveSheet",e[e.DeleteSheet=26]="DeleteSheet",e[e.HideSheet=27]="HideSheet",e[e.CopySheet=28]="CopySheet",e[e.RenameSheet=29]="RenameSheet",e[e.CreateSheet=30]="CreateSheet",e[e.SelectProtectedCells=31]="SelectProtectedCells",e[e.SelectUnProtectedCells=32]="SelectUnProtectedCells",e[e.SetCellStyle=33]="SetCellStyle",e[e.SetCellValue=34]="SetCellValue",e[e.SetRowStyle=35]="SetRowStyle",e[e.SetColumnStyle=36]="SetColumnStyle",e[e.InsertRow=37]="InsertRow",e[e.InsertColumn=38]="InsertColumn",e[e.DeleteRow=39]="DeleteRow",e[e.DeleteColumn=40]="DeleteColumn",e[e.EditExtraObject=41]="EditExtraObject",e[e.Delete=42]="Delete",e[e.RecoverHistory=43]="RecoverHistory",e[e.ViewHistory=44]="ViewHistory",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ft||{});const zr=[L.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],Li=e=>{const t=[{label:"sheet.cf.ruleType.highlightCell",value:_e.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:_e.rank},{label:"sheet.cf.ruleType.formula",value:_e.formula},{label:"sheet.cf.ruleType.colorScale",value:_e.colorScale},{label:"sheet.cf.ruleType.dataBar",value:_e.dataBar},{label:"sheet.cf.ruleType.iconSet",value:_e.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:_e.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:_e.createRule},{label:"sheet.cf.menu.clearRangeRules",value:_e.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:_e.clearWorkSheetRules}],n=e.get(L.SheetsSelectionsService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=new De.Observable(d=>De.merge(n.selectionMoveEnd$,new De.Observable(f=>{const m=r.onCommandExecuted(h=>{var E;const{id:v,params:y}=h,R=(E=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();zr.includes(v)&&y.unitId===R&&f.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{var R;const f=((R=n.getCurrentSelections())==null?void 0:R.map(E=>E.range))||[],m=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!m)return;const h=m.getActiveSheet();if(!h)return;const y=(i.getSubunitRules(m.getUnitId(),h.getSheetId())||[]).filter(E=>E.ranges.some(S=>f.some(I=>u.Rectangle.intersects(I,S))));d.next(!!y.length)})),c=new De.Observable(d=>De.merge(n.selectionMoveEnd$,new De.Observable(f=>{const m=r.onCommandExecuted(h=>{var E;const{id:v,params:y}=h,R=(E=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getUnitId();zr.includes(v)&&y.unitId===R&&f.next(null)});return()=>m.dispose()})).pipe(We.debounceTime(16)).subscribe(()=>{const f=o.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!f)return;const m=f.getActiveSheet();if(!m)return;const h=i.getSubunitRules(f.getUnitId(),m.getSheetId())||[];if(!h.length)return d.next(!1),!1;const v=h.some(y=>y.ranges.some(E=>{var g,O;const{startRow:S,startColumn:I,endRow:_,endColumn:w}=E;for(let T=S;T<=_;T++)for(let b=I;b<=w;b++){const M=(O=(g=m.getCell(T,b))==null?void 0:g.selectionProtection)==null?void 0:O[0];if((M==null?void 0:M[Ft.Edit])===!1||(M==null?void 0:M[Ft.View])===!1)return!0}return!1}));d.next(!v)})),l=new De.Observable(d=>{a.subscribe(f=>{const m=t.find(h=>h.value===_e.clearRangeRules);m&&(m.disabled=!f,d.next(t))}),c.subscribe(f=>{const m=t.find(h=>h.value===_e.clearWorkSheetRules);m&&(m.disabled=!f,d.next(t))}),d.next(t)});return{id:On.id,type:fe.MenuItemType.SELECTOR,group:fe.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[fe.MenuPosition.TOOLBAR_START],icon:"Conditions",tooltip:"sheet.cf.title",selections:l,hidden$:fe.getMenuHiddenObservable(e,u.UniverInstanceType.UNIVER_SHEET),disabled$:le.getCurrentRangeDisable$(e,{workbookTypes:[L.WorkbookEditablePermission],worksheetTypes:[L.WorksheetSetCellStylePermission,L.WorksheetEditPermission],rangeTypes:[L.RangeProtectionPermissionEditPoint]})}};var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ui(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var bo={exports:{}},sn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Vi=w,zi=Symbol.for("react.element"),Ai=Symbol.for("react.fragment"),Hi=Object.prototype.hasOwnProperty,Wi=Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ki={key:!0,ref:!0,__self:!0,__source:!0};function Ro(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Hi.call(t,r)&&!ki.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:zi,type:e,key:i,ref:a,props:o,_owner:Wi.current}}sn.Fragment=Ai;sn.jsx=Ro;sn.jsxs=Ro;bo.exports=sn;var p=bo.exports;const qi="univer-conditional-formatting-wrap",Bi="univer-cf-rule-item",Gi="univer-preview",Xi="univer-create-rule",Yi="univer-button",Ki="univer-title",Zi="univer-label",Ji="univer-label-container",Qi="univer-input-width",ea="univer-m-t-base",ta="univer-m-t-sm",na="univer-m-t-xl",ra="univer-m-l-sm",oa="univer-m-l-xl",ia="univer-m-l-xxs",aa="univer-m-l-0",sa="univer-m-r-0",P={conditionalFormattingWrap:qi,cfRuleItem:Bi,preview:Gi,createRule:Xi,button:Yi,title:Ki,label:Zi,labelContainer:Ji,inputWidth:Qi,mTBase:ea,mTSm:ta,mTXl:na,mLSm:ra,mLXl:oa,mLXxs:ia,mL0:aa,mR0:sa};var we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},we.apply(this,arguments)},la=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},gt=w.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,a=la(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=w.useRef("_".concat(da()));return _o(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},we({ref:t,className:c},a),i)});function _o(e,t,n,r,o){return w.createElement(e.tag,we(we({key:t},ca(e,n,o)),r),(ua(e,n).children||[]).map(function(i,a){return _o(i,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function ca(e,t,n){var r=we({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function ua(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?we(we({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?we(we({},o),{attrs:we(we({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function da(){return Math.random().toString(36).substring(2,8)}gt.displayName="UniverIcon";var fa={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Zt=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"delete-single",ref:t,icon:fa}))});Zt.displayName="DeleteSingle";var pa={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},To=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"increase-single",ref:t,icon:pa}))});To.displayName="IncreaseSingle";var ha={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ln=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"more-down-single",ref:t,icon:ha}))});ln.displayName="MoreDownSingle";var ma={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},Io=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"sequence-single",ref:t,icon:ma}))});Io.displayName="SequenceSingle";var ga={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_436_41",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.35 0.48H16.35V16.48H0.35z"}}]},{tag:"g",attrs:{mask:"url(#mask0_436_41)",fillRule:"evenodd",clipRule:"evenodd"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z"}},{tag:"path",attrs:{fill:"#E5E5E5",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"}}]}]},Ut=w.forwardRef(function(e,t){return w.createElement(gt,Object.assign({},e,{id:"slash-single",ref:t,icon:ga}))});Ut.displayName="SlashSingle";var wo={exports:{}},Vt={},An={exports:{}};(function(e,t){(function(n,r){r(t)})(Ve,function(n){function r(F){return function(G,X,B,te,oe,me,J){return F(G,X,J)}}function o(F){return function(G,X,B,te){if(!G||!X||typeof G!="object"||typeof X!="object")return F(G,X,B,te);var oe=te.get(G),me=te.get(X);if(oe&&me)return oe===X&&me===G;te.set(G,X),te.set(X,G);var J=F(G,X,B,te);return te.delete(G),te.delete(X),J}}function i(F,U){var G={};for(var X in F)G[X]=F[X];for(var X in U)G[X]=U[X];return G}function a(F){return F.constructor===Object||F.constructor==null}function c(F){return typeof F.then=="function"}function l(F,U){return F===U||F!==F&&U!==U}var d="[object Arguments]",f="[object Boolean]",m="[object Date]",h="[object RegExp]",v="[object Map]",y="[object Number]",R="[object Object]",E="[object Set]",C="[object String]",T=Object.prototype.toString;function _(F){var U=F.areArraysEqual,G=F.areDatesEqual,X=F.areMapsEqual,B=F.areObjectsEqual,te=F.areRegExpsEqual,oe=F.areSetsEqual,me=F.createIsNestedEqual,J=me(Pe);function Pe(ne,ae,Me){if(ne===ae)return!0;if(!ne||!ae||typeof ne!="object"||typeof ae!="object")return ne!==ne&&ae!==ae;if(a(ne)&&a(ae))return B(ne,ae,J,Me);var Ur=Array.isArray(ne),Vr=Array.isArray(ae);if(Ur||Vr)return Ur===Vr&&U(ne,ae,J,Me);var Fe=T.call(ne);return Fe!==T.call(ae)?!1:Fe===m?G(ne,ae,J,Me):Fe===h?te(ne,ae,J,Me):Fe===v?X(ne,ae,J,Me):Fe===E?oe(ne,ae,J,Me):Fe===R||Fe===d?c(ne)||c(ae)?!1:B(ne,ae,J,Me):Fe===f||Fe===y||Fe===C?l(ne.valueOf(),ae.valueOf()):!1}return Pe}function I(F,U,G,X){var B=F.length;if(U.length!==B)return!1;for(;B-- >0;)if(!G(F[B],U[B],B,B,F,U,X))return!1;return!0}var g=o(I);function x(F,U){return l(F.valueOf(),U.valueOf())}function O(F,U,G,X){var B=F.size===U.size;if(!B)return!1;if(!F.size)return!0;var te={},oe=0;return F.forEach(function(me,J){if(B){var Pe=!1,ne=0;U.forEach(function(ae,Me){!Pe&&!te[ne]&&(Pe=G(J,Me,oe,ne,F,U,X)&&G(me,ae,J,Me,F,U,X))&&(te[ne]=!0),ne++}),oe++,B=Pe}}),B}var S=o(O),M="_owner",j=Object.prototype.hasOwnProperty;function $(F,U,G,X){var B=Object.keys(F),te=B.length;if(Object.keys(U).length!==te)return!1;for(var oe;te-- >0;){if(oe=B[te],oe===M){var me=!!F.$$typeof,J=!!U.$$typeof;if((me||J)&&me!==J)return!1}if(!j.call(U,oe)||!G(F[oe],U[oe],oe,oe,F,U,X))return!1}return!0}var A=o($);function b(F,U){return F.source===U.source&&F.flags===U.flags}function D(F,U,G,X){var B=F.size===U.size;if(!B)return!1;if(!F.size)return!0;var te={};return F.forEach(function(oe,me){if(B){var J=!1,Pe=0;U.forEach(function(ne,ae){!J&&!te[Pe]&&(J=G(oe,ne,me,ae,F,U,X))&&(te[Pe]=!0),Pe++}),B=J}}),B}var Z=o(D),Ce=Object.freeze({areArraysEqual:I,areDatesEqual:x,areMapsEqual:O,areObjectsEqual:$,areRegExpsEqual:b,areSetsEqual:D,createIsNestedEqual:r}),pe=Object.freeze({areArraysEqual:g,areDatesEqual:x,areMapsEqual:S,areObjectsEqual:A,areRegExpsEqual:b,areSetsEqual:Z,createIsNestedEqual:r}),he=_(Ce);function xe(F,U){return he(F,U,void 0)}var V=_(i(Ce,{createIsNestedEqual:function(){return l}}));function Y(F,U){return V(F,U,void 0)}var ee=_(pe);function re(F,U){return ee(F,U,new WeakMap)}var se=_(i(pe,{createIsNestedEqual:function(){return l}}));function ue(F,U){return se(F,U,new WeakMap)}function Ie(F){return _(i(Ce,F(Ce)))}function Oe(F){var U=_(i(pe,F(pe)));return function(G,X,B){return B===void 0&&(B=new WeakMap),U(G,X,B)}}n.circularDeepEqual=re,n.circularShallowEqual=ue,n.createCustomCircularEqual=Oe,n.createCustomEqual=Ie,n.deepEqual=xe,n.sameValueZeroEqual=l,n.shallowEqual=Y,Object.defineProperty(n,"__esModule",{value:!0})})})(An,An.exports);var lr=An.exports,k={},va=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(k,"__esModule",{value:!0});k.bottom=cr;k.childrenEqual=Sa;k.cloneLayout=xo;k.cloneLayoutItem=Ze;k.collides=cn;k.compact=Eo;k.compactItem=Do;k.compactType=Na;k.correctBounds=Po;k.fastPositionEqual=ba;k.fastRGLPropsEqual=void 0;k.getAllCollisions=Mo;k.getFirstCollision=Ye;k.getLayoutItem=ur;k.getStatics=dr;k.modifyLayout=Oo;k.moveElement=xt;k.moveElementAwayFromCollision=Wn;k.noop=void 0;k.perc=_a;k.resizeItemInDirection=Ea;k.setTopLeft=Pa;k.setTransform=Da;k.sortLayoutItems=vr;k.sortLayoutItemsByColRow=Lo;k.sortLayoutItemsByRowCol=$o;k.synchronizeLayoutWithChildren=Ma;k.validateLayout=Fa;k.withLayoutItem=Ca;var Ar=lr,wt=ya(w);function ya(e){return e&&e.__esModule?e:{default:e}}function cr(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function xo(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Ze(e[n]);return t}function Oo(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function Ca(e,t,n){let r=ur(e,t);return r?(r=n(Ze(r)),e=Oo(e,r),[e,r]):[e,null]}function Ze(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function Sa(e,t){return(0,Ar.deepEqual)(wt.default.Children.map(e,n=>n==null?void 0:n.key),wt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Ar.deepEqual)(wt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),wt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}k.fastRGLPropsEqual=va;function ba(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Eo(e,t,n,r){const o=dr(e),i=vr(e,t),a=Array(e.length);for(let c=0,l=i.length;c<l;c++){let d=Ze(i[c]);d.static||(d=Do(o,d,t,n,i,r),o.push(d)),a[e.indexOf(i[c])]=d,d.moved=!1}return a}const Ra={x:"w",y:"h"};function Hn(e,t,n,r){const o=Ra[r];t[r]+=1;const i=e.map(a=>a.i).indexOf(t.i);for(let a=i+1;a<e.length;a++){const c=e[a];if(!c.static){if(c.y>t.y+t.h)break;cn(t,c)&&Hn(e,c,n+t[o],r)}}t[r]=n}function Do(e,t,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(t.y=Math.min(cr(e),t.y);t.y>0&&!Ye(e,t);)t.y--;else if(c)for(;t.x>0&&!Ye(e,t);)t.x--;let l;for(;(l=Ye(e,t))&&!(n===null&&i);)if(c?Hn(o,t,l.x+l.w,"x"):Hn(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ye(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Po(e,t){const n=dr(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Ye(n,i);)i.y++}return e}function ur(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ye(e,t){for(let n=0,r=e.length;n<r;n++)if(cn(e[n],t))return e[n]}function Mo(e,t){return e.filter(n=>cn(n,t))}function dr(e){return e.filter(t=>t.static)}function xt(e,t,n,r,o,i,a,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const d=t.x,f=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let m=vr(e,a);(a==="vertical"&&typeof r=="number"?f>=r:a==="horizontal"&&typeof n=="number"?d>=n:!1)&&(m=m.reverse());const v=Mo(m,t),y=v.length>0;if(y&&l)return xo(e);if(y&&i)return`${t.i}`,t.x=d,t.y=f,t.moved=!1,e;for(let R=0,E=v.length;R<E;R++){const C=v[R];`${t.i}${t.x}${t.y}${C.i}${C.x}${C.y}`,!C.moved&&(C.static?e=Wn(e,C,t,o,a):e=Wn(e,t,C,o,a))}return e}function Wn(e,t,n,r,o,i){const a=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const m={x:a?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=Ye(e,m),v=h&&h.y+h.h>t.y,y=h&&t.x+t.w>h.x;if(h){if(v&&c)return xt(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&a)return xt(e,t,n.x,void 0,r,l,o)}else return`${n.i}${m.x}${m.y}`,xt(e,n,a?m.x:void 0,c?m.y:void 0,r,l,o)}const d=a?n.x+1:void 0,f=c?n.y+1:void 0;return d==null&&f==null?e:xt(e,n,a?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function _a(e){return e*100+"%"}const Fo=(e,t,n,r)=>e+n>r?t:n,No=(e,t,n)=>e<0?t:n,jo=e=>Math.max(0,e),fr=e=>Math.max(0,e),pr=(e,t,n)=>{let{left:r,height:o,width:i}=t;const a=e.top-(o-e.height);return{left:r,width:i,height:No(a,e.height,o),top:fr(a)}},hr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{top:r,height:i,width:Fo(e.left,e.width,a,n),left:jo(o)}},mr=(e,t,n)=>{let{top:r,height:o,width:i}=t;const a=e.left-(i-e.width);return{height:o,width:a<0?e.width:Fo(e.left,e.width,i,n),top:fr(r),left:jo(a)}},gr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{width:a,left:o,height:No(r,e.height,i),top:fr(r)}},Ta=function(){return pr(arguments.length<=0?void 0:arguments[0],hr(...arguments))},Ia=function(){return pr(arguments.length<=0?void 0:arguments[0],mr(...arguments))},wa=function(){return gr(arguments.length<=0?void 0:arguments[0],hr(...arguments))},xa=function(){return gr(arguments.length<=0?void 0:arguments[0],mr(...arguments))},Oa={n:pr,ne:Ta,e:hr,se:wa,s:gr,sw:xa,w:mr,nw:Ia};function Ea(e,t,n,r){const o=Oa[e];return o?o(t,{...t,...n},r):n}function Da(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Pa(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function vr(e,t){return t==="horizontal"?Lo(e):t==="vertical"?$o(e):e}function $o(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function Lo(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function Ma(e,t,n,r,o){e=e||[];const i=[];wt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=ur(e,String(c.key)),d=c.props["data-grid"];l&&d==null?i.push(Ze(l)):d?i.push(Ze({...d,i:c.key})):i.push(Ze({w:1,h:1,x:0,y:cr(i),i:String(c.key)}))});const a=Po(i,{cols:n});return o?a:Eo(a,r,n)}function Fa(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!")}}function Na(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const ja=()=>{};k.noop=ja;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.calcGridColWidth=un;je.calcGridItemPosition=$a;je.calcGridItemWHPx=kn;je.calcWH=Ua;je.calcXY=La;je.clamp=Ke;function un(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function kn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function $a(e,t,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:l}=e,d=un(e),f={};return i&&i.resizing?(f.width=Math.round(i.resizing.width),f.height=Math.round(i.resizing.height)):(f.width=kn(r,d,a[0]),f.height=kn(o,l,a[1])),i&&i.dragging?(f.top=Math.round(i.dragging.top),f.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(f.top=Math.round(i.resizing.top),f.left=Math.round(i.resizing.left)):(f.top=Math.round((l+a[1])*n+c[1]),f.left=Math.round((d+a[0])*t+c[0])),f}function La(e,t,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:l}=e,d=un(e);let f=Math.round((n-i[0])/(d+i[0])),m=Math.round((t-i[1])/(c+i[1]));return f=Ke(f,0,a-r),m=Ke(m,0,l-o),{x:f,y:m}}function Ua(e,t,n,r,o,i){const{margin:a,maxRows:c,cols:l,rowHeight:d}=e,f=un(e);let m=Math.round((t+a[0])/(f+a[0])),h=Math.round((n+a[1])/(d+a[1])),v=Ke(m,0,l-r),y=Ke(h,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Ke(m,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(y=Ke(h,0,c)),{w:v,h:y}}function Ke(e,t,n){return Math.max(Math.min(e,n),t)}var dn={},Uo={exports:{}},Va="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",za=Va,Aa=za;function Vo(){}function zo(){}zo.resetWarningCache=Vo;var Ha=function(){function e(r,o,i,a,c,l){if(l!==Aa){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:zo,resetWarningCache:Vo};return n.PropTypes=n,n};Uo.exports=Ha();var qe=Uo.exports,fn={exports:{}},Ao={},ie={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.dontSetMe=Ga;$e.findInArray=Wa;$e.int=Ba;$e.isFunction=ka;$e.isNum=qa;function Wa(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function ka(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function qa(e){return typeof e=="number"&&!isNaN(e)}function Ba(e){return parseInt(e,10)}function Ga(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var tt={};Object.defineProperty(tt,"__esModule",{value:!0});tt.browserPrefixToKey=Wo;tt.browserPrefixToStyle=Xa;tt.default=void 0;tt.getPrefix=Ho;const En=["Moz","Webkit","O","ms"];function Ho(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<En.length;r++)if(Wo(t,En[r])in n)return En[r];return""}function Wo(e,t){return t?"".concat(t).concat(Ya(e)):e}function Xa(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Ya(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}tt.default=Ho();Object.defineProperty(ie,"__esModule",{value:!0});ie.addClassName=Bo;ie.addEvent=Ja;ie.addUserSelectStyles=cs;ie.createCSSTransform=is;ie.createSVGTransform=as;ie.getTouch=ss;ie.getTouchIdentifier=ls;ie.getTranslation=yr;ie.innerHeight=ns;ie.innerWidth=rs;ie.matchesSelector=qo;ie.matchesSelectorAndParentsTo=Za;ie.offsetXYFromParent=os;ie.outerHeight=es;ie.outerWidth=ts;ie.removeClassName=Go;ie.removeEvent=Qa;ie.removeUserSelectStyles=us;var Te=$e,Hr=Ka(tt);function ko(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ko=function(r){return r?n:t})(e)}function Ka(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ko(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let Wt="";function qo(e,t){return Wt||(Wt=(0,Te.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Te.isFunction)(e[n])})),(0,Te.isFunction)(e[Wt])?e[Wt](t):!1}function Za(e,t,n){let r=e;do{if(qo(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ja(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function Qa(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function es(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Te.int)(n.borderTopWidth),t+=(0,Te.int)(n.borderBottomWidth),t}function ts(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Te.int)(n.borderLeftWidth),t+=(0,Te.int)(n.borderRightWidth),t}function ns(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Te.int)(n.paddingTop),t-=(0,Te.int)(n.paddingBottom),t}function rs(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Te.int)(n.paddingLeft),t-=(0,Te.int)(n.paddingRight),t}function os(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-o.left)/n,a=(e.clientY+t.scrollTop-o.top)/n;return{x:i,y:a}}function is(e,t){const n=yr(e,t,"px");return{[(0,Hr.browserPrefixToKey)("transform",Hr.default)]:n}}function as(e,t){return yr(e,t,"")}function yr(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const a="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function ss(e,t){return e.targetTouches&&(0,Te.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Te.findInArray)(e.changedTouches,n=>t===n.identifier)}function ls(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function cs(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
9
|
+
*/var Vi=x,zi=Symbol.for("react.element"),Ai=Symbol.for("react.fragment"),Hi=Object.prototype.hasOwnProperty,Wi=Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ki={key:!0,ref:!0,__self:!0,__source:!0};function Ro(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Hi.call(t,r)&&!ki.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:zi,type:e,key:i,ref:a,props:o,_owner:Wi.current}}sn.Fragment=Ai;sn.jsx=Ro;sn.jsxs=Ro;bo.exports=sn;var p=bo.exports;const qi="univer-conditional-formatting-wrap",Bi="univer-cf-rule-item",Gi="univer-preview",Xi="univer-create-rule",Yi="univer-button",Ki="univer-title",Zi="univer-label",Ji="univer-label-container",Qi="univer-input-width",ea="univer-m-t-base",ta="univer-m-t-sm",na="univer-m-t-xl",ra="univer-m-l-sm",oa="univer-m-l-xl",ia="univer-m-l-xxs",aa="univer-m-l-0",sa="univer-m-r-0",P={conditionalFormattingWrap:qi,cfRuleItem:Bi,preview:Gi,createRule:Xi,button:Yi,title:Ki,label:Zi,labelContainer:Ji,inputWidth:Qi,mTBase:ea,mTSm:ta,mTXl:na,mLSm:ra,mLXl:oa,mLXxs:ia,mL0:aa,mR0:sa};var we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},we.apply(this,arguments)},la=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},gt=x.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,a=la(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=x.useRef("_".concat(da()));return _o(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},we({ref:t,className:c},a),i)});function _o(e,t,n,r,o){return x.createElement(e.tag,we(we({key:t},ca(e,n,o)),r),(ua(e,n).children||[]).map(function(i,a){return _o(i,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function ca(e,t,n){var r=we({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function ua(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?we(we({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?we(we({},o),{attrs:we(we({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function da(){return Math.random().toString(36).substring(2,8)}gt.displayName="UniverIcon";var fa={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Zt=x.forwardRef(function(e,t){return x.createElement(gt,Object.assign({},e,{id:"delete-single",ref:t,icon:fa}))});Zt.displayName="DeleteSingle";var pa={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},To=x.forwardRef(function(e,t){return x.createElement(gt,Object.assign({},e,{id:"increase-single",ref:t,icon:pa}))});To.displayName="IncreaseSingle";var ha={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ln=x.forwardRef(function(e,t){return x.createElement(gt,Object.assign({},e,{id:"more-down-single",ref:t,icon:ha}))});ln.displayName="MoreDownSingle";var ma={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},Io=x.forwardRef(function(e,t){return x.createElement(gt,Object.assign({},e,{id:"sequence-single",ref:t,icon:ma}))});Io.displayName="SequenceSingle";var ga={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_436_41",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.35 0.48H16.35V16.48H0.35z"}}]},{tag:"g",attrs:{mask:"url(#mask0_436_41)",fillRule:"evenodd",clipRule:"evenodd"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z"}},{tag:"path",attrs:{fill:"#E5E5E5",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"}}]}]},Ut=x.forwardRef(function(e,t){return x.createElement(gt,Object.assign({},e,{id:"slash-single",ref:t,icon:ga}))});Ut.displayName="SlashSingle";var wo={exports:{}},Vt={},An={exports:{}};(function(e,t){(function(n,r){r(t)})(Ve,function(n){function r(F){return function(G,X,B,te,oe,me,J){return F(G,X,J)}}function o(F){return function(G,X,B,te){if(!G||!X||typeof G!="object"||typeof X!="object")return F(G,X,B,te);var oe=te.get(G),me=te.get(X);if(oe&&me)return oe===X&&me===G;te.set(G,X),te.set(X,G);var J=F(G,X,B,te);return te.delete(G),te.delete(X),J}}function i(F,U){var G={};for(var X in F)G[X]=F[X];for(var X in U)G[X]=U[X];return G}function a(F){return F.constructor===Object||F.constructor==null}function c(F){return typeof F.then=="function"}function l(F,U){return F===U||F!==F&&U!==U}var d="[object Arguments]",f="[object Boolean]",m="[object Date]",h="[object RegExp]",v="[object Map]",y="[object Number]",R="[object Object]",E="[object Set]",S="[object String]",I=Object.prototype.toString;function _(F){var U=F.areArraysEqual,G=F.areDatesEqual,X=F.areMapsEqual,B=F.areObjectsEqual,te=F.areRegExpsEqual,oe=F.areSetsEqual,me=F.createIsNestedEqual,J=me(Pe);function Pe(ne,ae,Me){if(ne===ae)return!0;if(!ne||!ae||typeof ne!="object"||typeof ae!="object")return ne!==ne&&ae!==ae;if(a(ne)&&a(ae))return B(ne,ae,J,Me);var Ur=Array.isArray(ne),Vr=Array.isArray(ae);if(Ur||Vr)return Ur===Vr&&U(ne,ae,J,Me);var Fe=I.call(ne);return Fe!==I.call(ae)?!1:Fe===m?G(ne,ae,J,Me):Fe===h?te(ne,ae,J,Me):Fe===v?X(ne,ae,J,Me):Fe===E?oe(ne,ae,J,Me):Fe===R||Fe===d?c(ne)||c(ae)?!1:B(ne,ae,J,Me):Fe===f||Fe===y||Fe===S?l(ne.valueOf(),ae.valueOf()):!1}return Pe}function w(F,U,G,X){var B=F.length;if(U.length!==B)return!1;for(;B-- >0;)if(!G(F[B],U[B],B,B,F,U,X))return!1;return!0}var g=o(w);function O(F,U){return l(F.valueOf(),U.valueOf())}function T(F,U,G,X){var B=F.size===U.size;if(!B)return!1;if(!F.size)return!0;var te={},oe=0;return F.forEach(function(me,J){if(B){var Pe=!1,ne=0;U.forEach(function(ae,Me){!Pe&&!te[ne]&&(Pe=G(J,Me,oe,ne,F,U,X)&&G(me,ae,J,Me,F,U,X))&&(te[ne]=!0),ne++}),oe++,B=Pe}}),B}var b=o(T),M="_owner",N=Object.prototype.hasOwnProperty;function $(F,U,G,X){var B=Object.keys(F),te=B.length;if(Object.keys(U).length!==te)return!1;for(var oe;te-- >0;){if(oe=B[te],oe===M){var me=!!F.$$typeof,J=!!U.$$typeof;if((me||J)&&me!==J)return!1}if(!N.call(U,oe)||!G(F[oe],U[oe],oe,oe,F,U,X))return!1}return!0}var A=o($);function C(F,U){return F.source===U.source&&F.flags===U.flags}function D(F,U,G,X){var B=F.size===U.size;if(!B)return!1;if(!F.size)return!0;var te={};return F.forEach(function(oe,me){if(B){var J=!1,Pe=0;U.forEach(function(ne,ae){!J&&!te[Pe]&&(J=G(oe,ne,me,ae,F,U,X))&&(te[Pe]=!0),Pe++}),B=J}}),B}var Z=o(D),Ce=Object.freeze({areArraysEqual:w,areDatesEqual:O,areMapsEqual:T,areObjectsEqual:$,areRegExpsEqual:C,areSetsEqual:D,createIsNestedEqual:r}),pe=Object.freeze({areArraysEqual:g,areDatesEqual:O,areMapsEqual:b,areObjectsEqual:A,areRegExpsEqual:C,areSetsEqual:Z,createIsNestedEqual:r}),he=_(Ce);function xe(F,U){return he(F,U,void 0)}var V=_(i(Ce,{createIsNestedEqual:function(){return l}}));function Y(F,U){return V(F,U,void 0)}var ee=_(pe);function re(F,U){return ee(F,U,new WeakMap)}var se=_(i(pe,{createIsNestedEqual:function(){return l}}));function ue(F,U){return se(F,U,new WeakMap)}function Ie(F){return _(i(Ce,F(Ce)))}function Oe(F){var U=_(i(pe,F(pe)));return function(G,X,B){return B===void 0&&(B=new WeakMap),U(G,X,B)}}n.circularDeepEqual=re,n.circularShallowEqual=ue,n.createCustomCircularEqual=Oe,n.createCustomEqual=Ie,n.deepEqual=xe,n.sameValueZeroEqual=l,n.shallowEqual=Y,Object.defineProperty(n,"__esModule",{value:!0})})})(An,An.exports);var lr=An.exports,k={},va=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(k,"__esModule",{value:!0});k.bottom=cr;k.childrenEqual=Sa;k.cloneLayout=xo;k.cloneLayoutItem=Ze;k.collides=cn;k.compact=Eo;k.compactItem=Do;k.compactType=Na;k.correctBounds=Po;k.fastPositionEqual=ba;k.fastRGLPropsEqual=void 0;k.getAllCollisions=Mo;k.getFirstCollision=Ye;k.getLayoutItem=ur;k.getStatics=dr;k.modifyLayout=Oo;k.moveElement=xt;k.moveElementAwayFromCollision=Wn;k.noop=void 0;k.perc=_a;k.resizeItemInDirection=Ea;k.setTopLeft=Pa;k.setTransform=Da;k.sortLayoutItems=vr;k.sortLayoutItemsByColRow=Lo;k.sortLayoutItemsByRowCol=$o;k.synchronizeLayoutWithChildren=Ma;k.validateLayout=Fa;k.withLayoutItem=Ca;var Ar=lr,wt=ya(x);function ya(e){return e&&e.__esModule?e:{default:e}}function cr(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function xo(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Ze(e[n]);return t}function Oo(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function Ca(e,t,n){let r=ur(e,t);return r?(r=n(Ze(r)),e=Oo(e,r),[e,r]):[e,null]}function Ze(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function Sa(e,t){return(0,Ar.deepEqual)(wt.default.Children.map(e,n=>n==null?void 0:n.key),wt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Ar.deepEqual)(wt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),wt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}k.fastRGLPropsEqual=va;function ba(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Eo(e,t,n,r){const o=dr(e),i=vr(e,t),a=Array(e.length);for(let c=0,l=i.length;c<l;c++){let d=Ze(i[c]);d.static||(d=Do(o,d,t,n,i,r),o.push(d)),a[e.indexOf(i[c])]=d,d.moved=!1}return a}const Ra={x:"w",y:"h"};function Hn(e,t,n,r){const o=Ra[r];t[r]+=1;const i=e.map(a=>a.i).indexOf(t.i);for(let a=i+1;a<e.length;a++){const c=e[a];if(!c.static){if(c.y>t.y+t.h)break;cn(t,c)&&Hn(e,c,n+t[o],r)}}t[r]=n}function Do(e,t,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(t.y=Math.min(cr(e),t.y);t.y>0&&!Ye(e,t);)t.y--;else if(c)for(;t.x>0&&!Ye(e,t);)t.x--;let l;for(;(l=Ye(e,t))&&!(n===null&&i);)if(c?Hn(o,t,l.x+l.w,"x"):Hn(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ye(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Po(e,t){const n=dr(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Ye(n,i);)i.y++}return e}function ur(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ye(e,t){for(let n=0,r=e.length;n<r;n++)if(cn(e[n],t))return e[n]}function Mo(e,t){return e.filter(n=>cn(n,t))}function dr(e){return e.filter(t=>t.static)}function xt(e,t,n,r,o,i,a,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const d=t.x,f=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let m=vr(e,a);(a==="vertical"&&typeof r=="number"?f>=r:a==="horizontal"&&typeof n=="number"?d>=n:!1)&&(m=m.reverse());const v=Mo(m,t),y=v.length>0;if(y&&l)return xo(e);if(y&&i)return`${t.i}`,t.x=d,t.y=f,t.moved=!1,e;for(let R=0,E=v.length;R<E;R++){const S=v[R];`${t.i}${t.x}${t.y}${S.i}${S.x}${S.y}`,!S.moved&&(S.static?e=Wn(e,S,t,o,a):e=Wn(e,t,S,o,a))}return e}function Wn(e,t,n,r,o,i){const a=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const m={x:a?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=Ye(e,m),v=h&&h.y+h.h>t.y,y=h&&t.x+t.w>h.x;if(h){if(v&&c)return xt(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&a)return xt(e,t,n.x,void 0,r,l,o)}else return`${n.i}${m.x}${m.y}`,xt(e,n,a?m.x:void 0,c?m.y:void 0,r,l,o)}const d=a?n.x+1:void 0,f=c?n.y+1:void 0;return d==null&&f==null?e:xt(e,n,a?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function _a(e){return e*100+"%"}const Fo=(e,t,n,r)=>e+n>r?t:n,No=(e,t,n)=>e<0?t:n,jo=e=>Math.max(0,e),fr=e=>Math.max(0,e),pr=(e,t,n)=>{let{left:r,height:o,width:i}=t;const a=e.top-(o-e.height);return{left:r,width:i,height:No(a,e.height,o),top:fr(a)}},hr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{top:r,height:i,width:Fo(e.left,e.width,a,n),left:jo(o)}},mr=(e,t,n)=>{let{top:r,height:o,width:i}=t;const a=e.left-(i-e.width);return{height:o,width:a<0?e.width:Fo(e.left,e.width,i,n),top:fr(r),left:jo(a)}},gr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{width:a,left:o,height:No(r,e.height,i),top:fr(r)}},Ta=function(){return pr(arguments.length<=0?void 0:arguments[0],hr(...arguments))},Ia=function(){return pr(arguments.length<=0?void 0:arguments[0],mr(...arguments))},wa=function(){return gr(arguments.length<=0?void 0:arguments[0],hr(...arguments))},xa=function(){return gr(arguments.length<=0?void 0:arguments[0],mr(...arguments))},Oa={n:pr,ne:Ta,e:hr,se:wa,s:gr,sw:xa,w:mr,nw:Ia};function Ea(e,t,n,r){const o=Oa[e];return o?o(t,{...t,...n},r):n}function Da(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Pa(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function vr(e,t){return t==="horizontal"?Lo(e):t==="vertical"?$o(e):e}function $o(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function Lo(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function Ma(e,t,n,r,o){e=e||[];const i=[];wt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=ur(e,String(c.key)),d=c.props["data-grid"];l&&d==null?i.push(Ze(l)):d?i.push(Ze({...d,i:c.key})):i.push(Ze({w:1,h:1,x:0,y:cr(i),i:String(c.key)}))});const a=Po(i,{cols:n});return o?a:Eo(a,r,n)}function Fa(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!")}}function Na(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const ja=()=>{};k.noop=ja;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.calcGridColWidth=un;je.calcGridItemPosition=$a;je.calcGridItemWHPx=kn;je.calcWH=Ua;je.calcXY=La;je.clamp=Ke;function un(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function kn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function $a(e,t,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:l}=e,d=un(e),f={};return i&&i.resizing?(f.width=Math.round(i.resizing.width),f.height=Math.round(i.resizing.height)):(f.width=kn(r,d,a[0]),f.height=kn(o,l,a[1])),i&&i.dragging?(f.top=Math.round(i.dragging.top),f.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(f.top=Math.round(i.resizing.top),f.left=Math.round(i.resizing.left)):(f.top=Math.round((l+a[1])*n+c[1]),f.left=Math.round((d+a[0])*t+c[0])),f}function La(e,t,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:l}=e,d=un(e);let f=Math.round((n-i[0])/(d+i[0])),m=Math.round((t-i[1])/(c+i[1]));return f=Ke(f,0,a-r),m=Ke(m,0,l-o),{x:f,y:m}}function Ua(e,t,n,r,o,i){const{margin:a,maxRows:c,cols:l,rowHeight:d}=e,f=un(e);let m=Math.round((t+a[0])/(f+a[0])),h=Math.round((n+a[1])/(d+a[1])),v=Ke(m,0,l-r),y=Ke(h,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=Ke(m,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(y=Ke(h,0,c)),{w:v,h:y}}function Ke(e,t,n){return Math.max(Math.min(e,n),t)}var dn={},Uo={exports:{}},Va="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",za=Va,Aa=za;function Vo(){}function zo(){}zo.resetWarningCache=Vo;var Ha=function(){function e(r,o,i,a,c,l){if(l!==Aa){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:zo,resetWarningCache:Vo};return n.PropTypes=n,n};Uo.exports=Ha();var qe=Uo.exports,fn={exports:{}},Ao={},ie={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.dontSetMe=Ga;$e.findInArray=Wa;$e.int=Ba;$e.isFunction=ka;$e.isNum=qa;function Wa(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function ka(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function qa(e){return typeof e=="number"&&!isNaN(e)}function Ba(e){return parseInt(e,10)}function Ga(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var tt={};Object.defineProperty(tt,"__esModule",{value:!0});tt.browserPrefixToKey=Wo;tt.browserPrefixToStyle=Xa;tt.default=void 0;tt.getPrefix=Ho;const En=["Moz","Webkit","O","ms"];function Ho(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<En.length;r++)if(Wo(t,En[r])in n)return En[r];return""}function Wo(e,t){return t?"".concat(t).concat(Ya(e)):e}function Xa(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Ya(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}tt.default=Ho();Object.defineProperty(ie,"__esModule",{value:!0});ie.addClassName=Bo;ie.addEvent=Ja;ie.addUserSelectStyles=cs;ie.createCSSTransform=is;ie.createSVGTransform=as;ie.getTouch=ss;ie.getTouchIdentifier=ls;ie.getTranslation=yr;ie.innerHeight=ns;ie.innerWidth=rs;ie.matchesSelector=qo;ie.matchesSelectorAndParentsTo=Za;ie.offsetXYFromParent=os;ie.outerHeight=es;ie.outerWidth=ts;ie.removeClassName=Go;ie.removeEvent=Qa;ie.removeUserSelectStyles=us;var Te=$e,Hr=Ka(tt);function ko(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ko=function(r){return r?n:t})(e)}function Ka(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ko(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let Wt="";function qo(e,t){return Wt||(Wt=(0,Te.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Te.isFunction)(e[n])})),(0,Te.isFunction)(e[Wt])?e[Wt](t):!1}function Za(e,t,n){let r=e;do{if(qo(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ja(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function Qa(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function es(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Te.int)(n.borderTopWidth),t+=(0,Te.int)(n.borderBottomWidth),t}function ts(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Te.int)(n.borderLeftWidth),t+=(0,Te.int)(n.borderRightWidth),t}function ns(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Te.int)(n.paddingTop),t-=(0,Te.int)(n.paddingBottom),t}function rs(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Te.int)(n.paddingLeft),t-=(0,Te.int)(n.paddingRight),t}function os(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-o.left)/n,a=(e.clientY+t.scrollTop-o.top)/n;return{x:i,y:a}}function is(e,t){const n=yr(e,t,"px");return{[(0,Hr.browserPrefixToKey)("transform",Hr.default)]:n}}function as(e,t){return yr(e,t,"")}function yr(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const a="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function ss(e,t){return e.targetTouches&&(0,Te.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Te.findInArray)(e.changedTouches,n=>t===n.identifier)}function ls(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function cs(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
10
10
|
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
11
|
-
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Bo(e.body,"react-draggable-transparent-selection")}function us(e){if(e)try{if(e.body&&Go(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Bo(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Go(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.canDragX=ps;Le.canDragY=hs;Le.createCoreData=gs;Le.createDraggableData=vs;Le.getBoundPosition=ds;Le.getControlPosition=ms;Le.snapToGrid=fs;var Re=$e,dt=ie;function ds(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:ys(r);const o=Cr(e);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,d=a.getComputedStyle(o),f=a.getComputedStyle(l);r={left:-o.offsetLeft+(0,Re.int)(f.paddingLeft)+(0,Re.int)(d.marginLeft),top:-o.offsetTop+(0,Re.int)(f.paddingTop)+(0,Re.int)(d.marginTop),right:(0,dt.innerWidth)(l)-(0,dt.outerWidth)(o)-o.offsetLeft+(0,Re.int)(f.paddingRight)-(0,Re.int)(d.marginRight),bottom:(0,dt.innerHeight)(l)-(0,dt.outerHeight)(o)-o.offsetTop+(0,Re.int)(f.paddingBottom)-(0,Re.int)(d.marginBottom)}}return(0,Re.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Re.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Re.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Re.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function fs(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function ps(e){return e.props.axis==="both"||e.props.axis==="x"}function hs(e){return e.props.axis==="both"||e.props.axis==="y"}function ms(e,t,n){const r=typeof t=="number"?(0,dt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=Cr(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,dt.offsetXYFromParent)(r||e,i,n.props.scale)}function gs(e,t,n){const r=!(0,Re.isNum)(e.lastX),o=Cr(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function vs(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ys(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Cr(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var pn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.default=Cs;function Cs(){}Object.defineProperty(pn,"__esModule",{value:!0});pn.default=void 0;var Dn=bs(w),Se=Sr(qe),Ss=Sr(So),ge=ie,Ae=Le,Pn=$e,bt=Sr(hn);function Sr(e){return e&&e.__esModule?e:{default:e}}function Xo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Xo=function(r){return r?n:t})(e)}function bs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Xo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ye(e,t,n){return t=Rs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rs(e){var t=_s(e,"string");return typeof t=="symbol"?t:String(t)}function _s(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ee={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let He=Ee.mouse,mn=class extends Dn.Component{constructor(){super(...arguments),ye(this,"dragging",!1),ye(this,"lastX",NaN),ye(this,"lastY",NaN),ye(this,"touchIdentifier",null),ye(this,"mounted",!1),ye(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,ge.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,ge.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,ge.getTouchIdentifier)(t);this.touchIdentifier=o;const i=(0,Ae.getControlPosition)(t,o,this);if(i==null)return;const{x:a,y:c}=i,l=(0,Ae.createCoreData)(this,a,c);(0,bt.default)("DraggableCore: handleDragStart: %j",l),(0,bt.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ge.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,ge.addEvent)(r,He.move,this.handleDrag),(0,ge.addEvent)(r,He.stop,this.handleDragStop))}),ye(this,"handleDrag",t=>{const n=(0,Ae.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,Ae.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const i=(0,Ae.createCoreData)(this,r,o);if((0,bt.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),ye(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Ae.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,d=o-this.lastY||0;[l,d]=(0,Ae.snapToGrid)(this.props.grid,l,d),r=this.lastX+l,o=this.lastY+d}const i=(0,Ae.createCoreData)(this,r,o);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,ge.removeUserSelectStyles)(c.ownerDocument),(0,bt.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,bt.default)("DraggableCore: Removing handlers"),(0,ge.removeEvent)(c.ownerDocument,He.move,this.handleDrag),(0,ge.removeEvent)(c.ownerDocument,He.stop,this.handleDragStop))}),ye(this,"onMouseDown",t=>(He=Ee.mouse,this.handleDragStart(t))),ye(this,"onMouseUp",t=>(He=Ee.mouse,this.handleDragStop(t))),ye(this,"onTouchStart",t=>(He=Ee.touch,this.handleDragStart(t))),ye(this,"onTouchEnd",t=>(He=Ee.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,ge.addEvent)(t,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,ge.removeEvent)(n,Ee.mouse.move,this.handleDrag),(0,ge.removeEvent)(n,Ee.touch.move,this.handleDrag),(0,ge.removeEvent)(n,Ee.mouse.stop,this.handleDragStop),(0,ge.removeEvent)(n,Ee.touch.stop,this.handleDragStop),(0,ge.removeEvent)(t,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ge.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:Ss.default.findDOMNode(this)}render(){return Dn.cloneElement(Dn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};pn.default=mn;ye(mn,"displayName","DraggableCore");ye(mn,"propTypes",{allowAnyClick:Se.default.bool,children:Se.default.node.isRequired,disabled:Se.default.bool,enableUserSelectHack:Se.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Se.default.arrayOf(Se.default.number),handle:Se.default.string,cancel:Se.default.string,nodeRef:Se.default.object,onStart:Se.default.func,onDrag:Se.default.func,onStop:Se.default.func,onMouseDown:Se.default.func,scale:Se.default.number,className:Pn.dontSetMe,style:Pn.dontSetMe,transform:Pn.dontSetMe});ye(mn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=h(w),n=f(qe),r=f(So),o=f(ke),i=ie,a=Le,c=$e,l=f(pn),d=f(hn);function f(T){return T&&T.__esModule?T:{default:T}}function m(T){if(typeof WeakMap!="function")return null;var _=new WeakMap,I=new WeakMap;return(m=function(g){return g?I:_})(T)}function h(T,_){if(T&&T.__esModule)return T;if(T===null||typeof T!="object"&&typeof T!="function")return{default:T};var I=m(_);if(I&&I.has(T))return I.get(T);var g={},x=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in T)if(O!=="default"&&Object.prototype.hasOwnProperty.call(T,O)){var S=x?Object.getOwnPropertyDescriptor(T,O):null;S&&(S.get||S.set)?Object.defineProperty(g,O,S):g[O]=T[O]}return g.default=T,I&&I.set(T,g),g}function v(){return v=Object.assign?Object.assign.bind():function(T){for(var _=1;_<arguments.length;_++){var I=arguments[_];for(var g in I)Object.prototype.hasOwnProperty.call(I,g)&&(T[g]=I[g])}return T},v.apply(this,arguments)}function y(T,_,I){return _=R(_),_ in T?Object.defineProperty(T,_,{value:I,enumerable:!0,configurable:!0,writable:!0}):T[_]=I,T}function R(T){var _=E(T,"string");return typeof _=="symbol"?_:String(_)}function E(T,_){if(typeof T!="object"||T===null)return T;var I=T[Symbol.toPrimitive];if(I!==void 0){var g=I.call(T,_||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(T)}class C extends t.Component{static getDerivedStateFromProps(_,I){let{position:g}=_,{prevPropsPosition:x}=I;return g&&(!x||g.x!==x.x||g.y!==x.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:g,prevPropsPosition:x}),{x:g.x,y:g.y,prevPropsPosition:{...g}}):null}constructor(_){super(_),y(this,"onDragStart",(I,g)=>{if((0,d.default)("Draggable: onDragStart: %j",g),this.props.onStart(I,(0,a.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(I,g)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",g);const x=(0,a.createDraggableData)(this,g),O={x:x.x,y:x.y,slackX:0,slackY:0};if(this.props.bounds){const{x:M,y:j}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[$,A]=(0,a.getBoundPosition)(this,O.x,O.y);O.x=$,O.y=A,O.slackX=this.state.slackX+(M-O.x),O.slackY=this.state.slackY+(j-O.y),x.x=O.x,x.y=O.y,x.deltaX=O.x-this.state.x,x.deltaY=O.y-this.state.y}if(this.props.onDrag(I,x)===!1)return!1;this.setState(O)}),y(this,"onDragStop",(I,g)=>{if(!this.state.dragging||this.props.onStop(I,(0,a.createDraggableData)(this,g))===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",g);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:M,y:j}=this.props.position;O.x=M,O.y=j}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var _,I;return(_=(I=this.props)===null||I===void 0||(I=I.nodeRef)===null||I===void 0?void 0:I.current)!==null&&_!==void 0?_:r.default.findDOMNode(this)}render(){const{axis:_,bounds:I,children:g,defaultPosition:x,defaultClassName:O,defaultClassNameDragging:S,defaultClassNameDragged:M,position:j,positionOffset:$,scale:A,...b}=this.props;let D={},Z=null;const pe=!!!j||this.state.dragging,he=j||x,xe={x:(0,a.canDragX)(this)&&pe?this.state.x:he.x,y:(0,a.canDragY)(this)&&pe?this.state.y:he.y};this.state.isElementSVG?Z=(0,i.createSVGTransform)(xe,$):D=(0,i.createCSSTransform)(xe,$);const V=(0,o.default)(g.props.className||"",O,{[S]:this.state.dragging,[M]:this.state.dragged});return t.createElement(l.default,v({},b,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:V,style:{...g.props.style,...D},transform:Z}))}}e.default=C,y(C,"displayName","Draggable"),y(C,"propTypes",{...l.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),y(C,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Ao);const{default:Yo,DraggableCore:Ts}=Ao;fn.exports=Yo;fn.exports.default=Yo;fn.exports.DraggableCore=Ts;var Ko=fn.exports,gn={exports:{}},zt={},br={};br.__esModule=!0;br.cloneElement=Ds;var Is=ws(w);function ws(e){return e&&e.__esModule?e:{default:e}}function Wr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wr(Object(n),!0).forEach(function(r){xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xs(e,t,n){return t=Os(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e){var t=Es(e,"string");return typeof t=="symbol"?t:String(t)}function Es(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ds(e,t){return t.style&&e.props.style&&(t.style=kr(kr({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),Is.default.cloneElement(e,t)}var At={};At.__esModule=!0;At.resizableProps=void 0;var H=Ps(qe);function Ps(e){return e&&e.__esModule?e:{default:e}}var Ms={axis:H.default.oneOf(["both","x","y","none"]),className:H.default.string,children:H.default.element.isRequired,draggableOpts:H.default.shape({allowAnyClick:H.default.bool,cancel:H.default.string,children:H.default.node,disabled:H.default.bool,enableUserSelectHack:H.default.bool,offsetParent:H.default.node,grid:H.default.arrayOf(H.default.number),handle:H.default.string,nodeRef:H.default.object,onStart:H.default.func,onDrag:H.default.func,onStop:H.default.func,onMouseDown:H.default.func,scale:H.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=H.default.number).isRequired.apply(i,n)}return H.default.number.apply(H.default,n)},handle:H.default.oneOfType([H.default.node,H.default.func]),handleSize:H.default.arrayOf(H.default.number),lockAspectRatio:H.default.bool,maxConstraints:H.default.arrayOf(H.default.number),minConstraints:H.default.arrayOf(H.default.number),onResizeStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,resizeHandles:H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:H.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=H.default.number).isRequired.apply(i,n)}return H.default.number.apply(H.default,n)}};At.resizableProps=Ms;zt.__esModule=!0;zt.default=void 0;var Rt=Ls(w),Fs=Ko,Ns=br,js=At,$s=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Zo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Zo=function(o){return o?n:t})(e)}function Ls(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Zo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qn.apply(this,arguments)}function Us(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qr(Object(n),!0).forEach(function(r){Vs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Vs(e,t,n){return t=zs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zs(e){var t=As(e,"string");return typeof t=="symbol"?t:String(t)}function As(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Bn(e,t)}function Bn(e,t){return Bn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Bn(e,t)}var Rr=function(e){Hs(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,l=a.maxConstraints,d=a.lockAspectRatio;if(!c&&!l&&!d)return[o,i];if(d){var f=this.props.width/this.props.height,m=o-this.props.width,h=i-this.props.height;Math.abs(m)>Math.abs(h*f)?i=o/f:o=i*f}var v=o,y=i,R=this.slack||[0,0],E=R[0],C=R[1];return o+=E,i+=C,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),l&&(o=Math.min(l[0],o),i=Math.min(l[1],i)),this.slack=[E+(v-o),C+(y-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,l){var d=l.node,f=l.deltaX,m=l.deltaY;o==="onResizeStart"&&a.resetData();var h=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!h&&!v)){var y=i[0],R=i[i.length-1],E=d.getBoundingClientRect();if(a.lastHandleRect!=null){if(R==="w"){var C=E.left-a.lastHandleRect.left;f+=C}if(y==="n"){var T=E.top-a.lastHandleRect.top;m+=T}}a.lastHandleRect=E,R==="w"&&(f=-f),y==="n"&&(m=-m);var _=a.props.width+(h?f/a.props.transformScale:0),I=a.props.height+(v?m/a.props.transformScale:0),g=a.runConstraints(_,I);_=g[0],I=g[1];var x=_!==a.props.width||I!==a.props.height,O=typeof a.props[o]=="function"?a.props[o]:null,S=o==="onResize"&&!x;O&&!S&&(c.persist==null||c.persist(),O(c,{node:d,size:{width:_,height:I},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return Rt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",l=Mn({ref:i},c?{}:{handleAxis:o});return Rt.cloneElement(a,l)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,l=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var d=i.resizeHandles;i.transformScale;var f=Us(i,$s);return(0,Ns.cloneElement)(a,Mn(Mn({},f),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,d.map(function(m){var h,v=(h=o.handleRefs[m])!=null?h:o.handleRefs[m]=Rt.createRef();return Rt.createElement(Fs.DraggableCore,qn({},l,{nodeRef:v,key:"resizableHandle-"+m,onStop:o.resizeHandler("onResizeStop",m),onStart:o.resizeHandler("onResizeStart",m),onDrag:o.resizeHandler("onResize",m)}),o.renderResizeHandle(m,v))}))}))},t}(Rt.Component);zt.default=Rr;Rr.propTypes=js.resizableProps;Rr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var vn={};vn.__esModule=!0;vn.default=void 0;var Fn=Gs(w),Ws=Jo(qe),ks=Jo(zt),qs=At,Bs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Jo(e){return e&&e.__esModule?e:{default:e}}function Qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Qo=function(o){return o?n:t})(e)}function Gs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Qo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Gn(){return Gn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gn.apply(this,arguments)}function Br(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Br(Object(n),!0).forEach(function(r){Xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Br(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xs(e,t,n){return t=Ys(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ys(e){var t=Ks(e,"string");return typeof t=="symbol"?t:String(t)}function Ks(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Js(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xn(e,t)}function Xn(e,t){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Xn(e,t)}var ei=function(e){Js(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var d=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(d,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(d)},r}t.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,d=o.draggableOpts,f=o.minConstraints,m=o.maxConstraints,h=o.lockAspectRatio,v=o.axis;o.width,o.height;var y=o.resizeHandles,R=o.style,E=o.transformScale,C=Zs(o,Bs);return Fn.createElement(ks.default,{axis:v,draggableOpts:d,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:h,maxConstraints:m,minConstraints:f,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:E,width:this.state.width},Fn.createElement("div",Gn({},C,{style:en(en({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Fn.Component);vn.default=ei;ei.propTypes=en(en({},qs.resizableProps),{},{children:Ws.default.element});gn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};gn.exports.Resizable=zt.default;gn.exports.ResizableBox=vn.default;var Qs=gn.exports,ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.resizeHandleType=ze.resizeHandleAxesType=ze.default=void 0;var W=ti(qe),el=ti(w);function ti(e){return e&&e.__esModule?e:{default:e}}const tl=ze.resizeHandleAxesType=W.default.arrayOf(W.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),nl=ze.resizeHandleType=W.default.oneOfType([W.default.node,W.default.func]);ze.default={className:W.default.string,style:W.default.object,width:W.default.number,autoSize:W.default.bool,cols:W.default.number,draggableCancel:W.default.string,draggableHandle:W.default.string,verticalCompact:function(e){e.verticalCompact},compactType:W.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&k.validateLayout(t,"layout")},margin:W.default.arrayOf(W.default.number),containerPadding:W.default.arrayOf(W.default.number),rowHeight:W.default.number,maxRows:W.default.number,isBounded:W.default.bool,isDraggable:W.default.bool,isResizable:W.default.bool,allowOverlap:W.default.bool,preventCollision:W.default.bool,useCSSTransforms:W.default.bool,transformScale:W.default.number,isDroppable:W.default.bool,resizeHandles:tl,resizeHandle:nl,onLayoutChange:W.default.func,onDragStart:W.default.func,onDrag:W.default.func,onDragStop:W.default.func,onResizeStart:W.default.func,onResize:W.default.func,onResizeStop:W.default.func,onDrop:W.default.func,droppingItem:W.default.shape({i:W.default.string.isRequired,w:W.default.number.isRequired,h:W.default.number.isRequired}),children:function(e,t){const n=e[t],r={};el.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:W.default.any};Object.defineProperty(dn,"__esModule",{value:!0});dn.default=void 0;var it=_r(w),K=_r(qe),rl=Ko,ol=Qs,at=k,de=je,Gr=ze,il=_r(ke);function _r(e){return e&&e.__esModule?e:{default:e}}function Ne(e,t,n){return t=al(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function al(e){var t=sl(e,"string");return typeof t=="symbol"?t:String(t)}function sl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Tr extends it.default.Component{constructor(){super(...arguments),Ne(this,"state",{resizing:null,dragging:null,className:""}),Ne(this,"elementRef",it.default.createRef()),Ne(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),d=r.getBoundingClientRect(),f=d.left/i,m=l.left/i,h=d.top/i,v=l.top/i;a.left=f-m+c.scrollLeft,a.top=h-v+c.scrollTop,this.setState({dragging:a});const{x:y,y:R}=(0,de.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,y,R,{e:t,node:r,newPosition:a})}),Ne(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,l=this.state.dragging.left+o;const{isBounded:d,i:f,w:m,h,containerWidth:v}=this.props,y=this.getPositionParams();if(d){const{offsetParent:_}=r;if(_){const{margin:I,rowHeight:g,containerPadding:x}=this.props,O=_.clientHeight-(0,de.calcGridItemWHPx)(h,g,I[1]);c=(0,de.clamp)(c-x[1],0,O);const S=(0,de.calcGridColWidth)(y),M=v-(0,de.calcGridItemWHPx)(m,S,I[0]);l=(0,de.clamp)(l-x[0],0,M)}}const R={top:c,left:l};this.setState({dragging:R});const{containerPadding:E}=this.props,{x:C,y:T}=(0,de.calcXY)(y,c-E[1],l-E[0],m,h);return a.call(this,f,C,T,{e:t,node:r,newPosition:R})}),Ne(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:l}=this.props,{left:d,top:f}=this.state.dragging,m={top:f,left:d};this.setState({dragging:null});const{x:h,y:v}=(0,de.calcXY)(this.getPositionParams(),f-l[1],d-l[0],i,a);return o.call(this,c,h,v,{e:t,node:r,newPosition:m})}),Ne(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),Ne(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),Ne(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,de.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,de.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,at.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,l=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,at.setTransform)(t):(i=(0,at.setTopLeft)(t),n&&(i.left=(0,at.perc)(t.left/r),i.width=(0,at.perc)(t.width/r))),i}mixinDraggable(t,n){return it.default.createElement(rl.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:l,transformScale:d,resizeHandles:f,resizeHandle:m}=this.props,h=this.getPositionParams(),v=(0,de.calcGridItemPosition)(h,0,0,o,0).width,y=(0,de.calcGridItemPosition)(h,0,0,i,a),R=(0,de.calcGridItemPosition)(h,0,0,c,l),E=[y.width,y.height],C=[Math.min(R.width,v),Math.min(R.height,1/0)];return it.default.createElement(ol.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:E,maxConstraints:C,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:d,resizeHandles:f,handle:m},t)}onResizeHandler(t,n,r,o){let{node:i,size:a,handle:c}=n;const l=this.props[o];if(!l)return;const{x:d,y:f,i:m,maxH:h,minH:v,containerWidth:y}=this.props,{minW:R,maxW:E}=this.props;let C=a;i&&(C=(0,at.resizeItemInDirection)(c,r,a,y),this.setState({resizing:o==="onResizeStop"?null:C}));let{w:T,h:_}=(0,de.calcWH)(this.getPositionParams(),C.width,C.height,d,f,c);T=(0,de.clamp)(T,Math.max(R,1),E),_=(0,de.clamp)(_,v,h),l.call(this,m,T,_,{e:t,node:i,size:C,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:l}=this.props,d=(0,de.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),f=it.default.Children.only(this.props.children);let m=it.default.cloneElement(f,{ref:this.elementRef,className:(0,il.default)("react-grid-item",f.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...f.props.style,...this.createStyle(d)}});return m=this.mixinResizable(m,d,a),m=this.mixinDraggable(m,i),m}}dn.default=Tr;Ne(Tr,"propTypes",{children:K.default.element,cols:K.default.number.isRequired,containerWidth:K.default.number.isRequired,rowHeight:K.default.number.isRequired,margin:K.default.array.isRequired,maxRows:K.default.number.isRequired,containerPadding:K.default.array.isRequired,x:K.default.number.isRequired,y:K.default.number.isRequired,w:K.default.number.isRequired,h:K.default.number.isRequired,minW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minWidth not Number");if(n>e.w||n>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxWidth not Number");if(n<e.w||n<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minHeight not Number");if(n>e.h||n>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxHeight not Number");if(n<e.h||n<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:K.default.string.isRequired,resizeHandles:Gr.resizeHandleAxesType,resizeHandle:Gr.resizeHandleType,onDragStop:K.default.func,onDragStart:K.default.func,onDrag:K.default.func,onResizeStop:K.default.func,onResizeStart:K.default.func,onResize:K.default.func,isDraggable:K.default.bool.isRequired,isResizable:K.default.bool.isRequired,isBounded:K.default.bool.isRequired,static:K.default.bool,useCSSTransforms:K.default.bool.isRequired,transformScale:K.default.number,className:K.default.string,handle:K.default.string,cancel:K.default.string,droppingPosition:K.default.shape({e:K.default.object.isRequired,left:K.default.number.isRequired,top:K.default.number.isRequired})});Ne(Tr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Vt,"__esModule",{value:!0});Vt.default=void 0;var Be=dl(w),Nn=lr,ll=Ir(ke),z=k,cl=je,Xr=Ir(dn),ul=Ir(ze);function Ir(e){return e&&e.__esModule?e:{default:e}}function ni(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ni=function(r){return r?n:t})(e)}function dl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ni(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ve(e,t,n){return t=fl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e){var t=pl(e,"string");return typeof t=="symbol"?t:String(t)}function pl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Yr="react-grid-layout";let ri=!1;try{ri=/firefox/i.test(navigator.userAgent)}catch{}class yn extends Be.Component{constructor(){super(...arguments),ve(this,"state",{activeDrag:null,layout:(0,z.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,z.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ve(this,"dragEnterCounter",0),ve(this,"onDragStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);if(!l)return;const d={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,z.cloneLayoutItem)(l),oldLayout:c,activeDrag:d}),this.props.onDragStart(c,l,l,null,i,a)}),ve(this,"onDrag",(t,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:d,allowOverlap:f,preventCollision:m}=this.props,h=(0,z.getLayoutItem)(l,t);if(!h)return;const v={w:h.w,h:h.h,x:h.x,y:h.y,placeholder:!0,i:t};l=(0,z.moveElement)(l,h,n,r,!0,m,(0,z.compactType)(this.props),d,f),this.props.onDrag(l,c,h,v,i,a),this.setState({layout:f?l:(0,z.compact)(l,(0,z.compactType)(this.props),d),activeDrag:v})}),ve(this,"onDragStop",(t,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:d,preventCollision:f,allowOverlap:m}=this.props,h=(0,z.getLayoutItem)(l,t);if(!h)return;l=(0,z.moveElement)(l,h,n,r,!0,f,(0,z.compactType)(this.props),d,m);const y=m?l:(0,z.compact)(l,(0,z.compactType)(this.props),d);this.props.onDragStop(y,c,h,null,i,a);const{oldLayout:R}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,R)}),ve(this,"onResizeStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,z.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,i,a))}),ve(this,"onResize",(t,n,r,o)=>{let{e:i,node:a,size:c,handle:l}=o;const{oldResizeItem:d}=this.state,{layout:f}=this.state,{cols:m,preventCollision:h,allowOverlap:v}=this.props;let y=!1,R,E,C;const[T,_]=(0,z.withLayoutItem)(f,t,g=>{let x;return E=g.x,C=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(E=g.x+(g.w-n),n=g.x!==E&&E<0?g.w:n,E=E<0?0:E),["ne","n","nw"].indexOf(l)!==-1&&(C=g.y+(g.h-r),r=g.y!==C&&C<0?g.h:r,C=C<0?0:C),y=!0),h&&!v&&(x=(0,z.getAllCollisions)(f,{...g,w:n,h:r,x:E,y:C}).filter(S=>S.i!==g.i).length>0,x&&(C=g.y,r=g.h,E=g.x,n=g.w,y=!1)),g.w=n,g.h=r,g});if(!_)return;R=T,y&&(R=(0,z.moveElement)(T,_,E,C,!0,this.props.preventCollision,(0,z.compactType)(this.props),m,v));const I={w:_.w,h:_.h,x:_.x,y:_.y,static:!0,i:t};this.props.onResize(R,d,_,I,i,a),this.setState({layout:v?R:(0,z.compact)(R,(0,z.compactType)(this.props),m),activeDrag:I})}),ve(this,"onResizeStop",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:d,allowOverlap:f}=this.props,m=(0,z.getLayoutItem)(c,t),h=f?c:(0,z.compact)(c,(0,z.compactType)(this.props),d);this.props.onResizeStop(h,l,m,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:h,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(h,v)}),ve(this,"onDragOver",t=>{var T;if(t.preventDefault(),t.stopPropagation(),ri&&!((T=t.nativeEvent.target)!=null&&T.classList.contains(Yr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:l,containerPadding:d,transformScale:f}=this.props,m=r==null?void 0:r(t);if(m===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const h={...n,...m},{layout:v}=this.state,y=t.currentTarget.getBoundingClientRect(),R=t.clientX-y.left,E=t.clientY-y.top,C={left:R/f,top:E/f,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:_,top:I}=this.state.droppingPosition;(_!=R||I!=E)&&this.setState({droppingPosition:C})}}else{const _={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:l,containerPadding:d||o},I=(0,cl.calcXY)(_,E,R,h.w,h.h);this.setState({droppingDOMNode:Be.createElement("div",{key:h.i}),droppingPosition:C,layout:[...v,{...h,x:I.x,y:I.y,static:!1,isDraggable:!0}]})}}),ve(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,z.compact)(r.filter(i=>i.i!==t.i),(0,z.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ve(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ve(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),ve(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,Nn.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,z.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,z.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,z.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,z.fastRGLPropsEqual)(this.props,t,Nn.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,z.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(t,n){n||(n=this.state.layout),(0,Nn.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:l,transformScale:d}=this.props;return Be.createElement(Xr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:d},Be.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,z.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:l,maxRows:d,isDraggable:f,isResizable:m,isBounded:h,useCSSTransforms:v,transformScale:y,draggableCancel:R,draggableHandle:E,resizeHandles:C,resizeHandle:T}=this.props,{mounted:_,droppingPosition:I}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&f,x=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&m,O=r.resizeHandles||C,S=g&&h&&r.isBounded!==!1;return Be.createElement(Xr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:d,rowHeight:l,cancel:R,handle:E,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:g,isResizable:x,isBounded:S,useCSSTransforms:v&&_,usePercentages:!_,transformScale:y,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?I:void 0,resizeHandles:O,resizeHandle:T},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,ll.default)(Yr,t),a={height:this.containerHeight(),...n};return Be.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:z.noop,onDragLeave:r?this.onDragLeave:z.noop,onDragEnter:r?this.onDragEnter:z.noop,onDragOver:r?this.onDragOver:z.noop},Be.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Vt.default=yn;ve(yn,"displayName","ReactGridLayout");ve(yn,"propTypes",ul.default);ve(yn,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:z.noop,onDragStart:z.noop,onDrag:z.noop,onDragStop:z.noop,onResizeStart:z.noop,onResize:z.noop,onResizeStop:z.noop,onDrop:z.noop,onDropDragOver:z.noop});var Cn={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.findOrGenerateResponsiveLayout=gl;nt.getBreakpointFromWidth=hl;nt.getColsFromBreakpoint=ml;nt.sortBreakpoints=wr;var kt=k;function hl(e,t){const n=wr(e);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];t>e[a]&&(r=a)}return r}function ml(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function gl(e,t,n,r,o,i){if(e[n])return(0,kt.cloneLayout)(e[n]);let a=e[r];const c=wr(t),l=c.slice(c.indexOf(n));for(let d=0,f=l.length;d<f;d++){const m=l[d];if(e[m]){a=e[m];break}}return a=(0,kt.cloneLayout)(a||[]),(0,kt.compact)((0,kt.correctBounds)(a,{cols:o}),i,o)}function wr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=void 0;var Kr=yl(w),be=oi(qe),jn=lr,ft=k,Ge=nt,vl=oi(Vt);function oi(e){return e&&e.__esModule?e:{default:e}}function ii(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ii=function(r){return r?n:t})(e)}function yl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ii(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Yn(){return Yn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yn.apply(this,arguments)}function tn(e,t,n){return t=Cl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cl(e){var t=Sl(e,"string");return typeof t=="symbol"?t:String(t)}function Sl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Zr=e=>Object.prototype.toString.call(e);function qt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class xr extends Kr.Component{constructor(){super(...arguments),tn(this,"state",this.generateInitialState()),tn(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Ge.getBreakpointFromWidth)(n,t),a=(0,Ge.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Ge.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(t,n){if(!(0,jn.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Ge.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,jn.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,jn.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Ge.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Ge.getColsFromBreakpoint)(a,r),d={...o};if(c!==a||t.breakpoints!==n||t.cols!==r){c in d||(d[c]=(0,ft.cloneLayout)(this.state.layout));let h=(0,Ge.findOrGenerateResponsiveLayout)(d,n,a,c,l,i);h=(0,ft.synchronizeLayoutWithChildren)(h,this.props.children,l,i,this.props.allowOverlap),d[a]=h,this.props.onLayoutChange(h,d),this.props.onBreakpointChange(a,l),this.setState({breakpoint:a,layout:h,cols:l})}const f=qt(this.props.margin,a),m=qt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,f,l,m)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:l,onWidthChange:d,...f}=this.props;return Kr.createElement(vl.default,Yn({},f,{margin:qt(i,this.state.breakpoint),containerPadding:qt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}Cn.default=xr;tn(xr,"propTypes",{breakpoint:be.default.string,breakpoints:be.default.object,allowOverlap:be.default.bool,cols:be.default.object,margin:be.default.oneOfType([be.default.array,be.default.object]),containerPadding:be.default.oneOfType([be.default.array,be.default.object]),layouts(e,t){if(Zr(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+Zr(e[t]));Object.keys(e[t]).forEach(n=>{if(!(n in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,ft.validateLayout)(e.layouts[n],"layouts."+n)})},width:be.default.number.isRequired,onBreakpointChange:be.default.func,onLayoutChange:be.default.func,onWidthChange:be.default.func});tn(xr,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:ft.noop,onLayoutChange:ft.noop,onWidthChange:ft.noop});var Or={},ai=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},t}()}(),Kn=typeof window<"u"&&typeof document<"u"&&window.document===document,nn=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),bl=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(nn):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Rl=2;function _l(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function a(){bl(i)}function c(){var l=Date.now();if(n){if(l-o<Rl)return;r=!0}else n=!0,r=!1,setTimeout(a,t);o=l}return c}var Tl=20,Il=["top","right","bottom","left","width","height","size","weight"],wl=typeof MutationObserver<"u",xl=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=_l(this.refresh.bind(this),Tl)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Kn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),wl?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Kn||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=Il.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),si=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},mt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||nn},li=Sn(0,0,0,0);function rn(e){return parseFloat(e)||0}function Jr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+rn(i)},0)}function Ol(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],a=e["padding-"+i];n[i]=rn(a)}return n}function El(e){var t=e.getBBox();return Sn(0,0,t.width,t.height)}function Dl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return li;var r=mt(e).getComputedStyle(e),o=Ol(r),i=o.left+o.right,a=o.top+o.bottom,c=rn(r.width),l=rn(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=Jr(r,"left","right")+i),Math.round(l+a)!==n&&(l-=Jr(r,"top","bottom")+a)),!Ml(e)){var d=Math.round(c+i)-t,f=Math.round(l+a)-n;Math.abs(d)!==1&&(c-=d),Math.abs(f)!==1&&(l-=f)}return Sn(o.left,o.top,c,l)}var Pl=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof mt(e).SVGGraphicsElement}:function(e){return e instanceof mt(e).SVGElement&&typeof e.getBBox=="function"}}();function Ml(e){return e===mt(e).document.documentElement}function Fl(e){return Kn?Pl(e)?El(e):Dl(e):li}function Nl(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return si(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function Sn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var jl=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Sn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Fl(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),$l=function(){function e(t,n){var r=Nl(n);si(this,{target:t,contentRect:r})}return e}(),Ll=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new ai,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof mt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new jl(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof mt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new $l(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),ci=typeof WeakMap<"u"?new WeakMap:new ai,ui=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=xl.getInstance(),r=new Ll(t,n,this);ci.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){ui.prototype[e]=function(){var t;return(t=ci.get(this))[e].apply(t,arguments)}});var Ul=function(){return typeof nn.ResizeObserver<"u"?nn.ResizeObserver:ui}();const Vl=Object.freeze(Object.defineProperty({__proto__:null,default:Ul},Symbol.toStringTag,{value:"Module"})),zl=Ui(Vl);Object.defineProperty(Or,"__esModule",{value:!0});Or.default=Xl;var Bt=kl(w),Al=Er(qe),Hl=Er(zl),Wl=Er(ke);function Er(e){return e&&e.__esModule?e:{default:e}}function di(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(di=function(r){return r?n:t})(e)}function kl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=di(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function st(e,t,n){return t=ql(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ql(e){var t=Bl(e,"string");return typeof t=="symbol"?t:String(t)}function Bl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Gl="react-grid-layout";function Xl(e){var t;return t=class extends Bt.Component{constructor(){super(...arguments),st(this,"state",{width:1280}),st(this,"elementRef",Bt.createRef()),st(this,"mounted",!1),st(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Hl.default(o=>{if(this.elementRef.current instanceof HTMLElement){const a=o[0].contentRect.width;this.setState({width:a})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?Bt.createElement("div",{className:(0,Wl.default)(this.props.className,Gl),style:this.props.style,ref:this.elementRef}):Bt.createElement(e,Zn({innerRef:this.elementRef},o,this.state))}},st(t,"defaultProps",{measureBeforeMount:!1}),st(t,"propTypes",{measureBeforeMount:Al.default.bool}),t}(function(e){e.exports=Vt.default,e.exports.utils=k,e.exports.calculateUtils=je,e.exports.Responsive=Cn.default,e.exports.Responsive.utils=nt,e.exports.WidthProvider=Or.default})(wo);var Yl=wo.exports;const Kl=sr(Yl),Nt={type:u.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,cfId:t.cfId},d=s.DeleteConditionalRuleMutationUndoFactory(e,l),f=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return f&&n.pushUndoRedo({unitID:a,undoMutations:d,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),f}},bn={type:u.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=L.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,d=s.transformSupportSymmetryAnchor(t.start,t.end,i.getSubunitRules(c,l)||[],R=>R.cfId);if(!d)return!1;const[f,m]=d,h={unitId:c,subUnitId:l,start:f,end:m},v=s.MoveConditionalRuleMutationUndoFactory(h),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,h);return y&&n.pushUndoRedo({unitID:c,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:h}],undoMutations:v}),y}},Zl="univer-cf-preview",Gt={cfPreview:Zl},vt=e=>{var o,i;const t=e.rule;if(!t)return null;const n=w.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const a=t.config.map((d,f)=>({color:new u.ColorKit(d.color),value:f})),c=a.length-1;return new Array(5).fill("").map((d,f,m)=>f*c/(m.length-1)).map(d=>s.getColorScaleFromValue(a,d))}return null},[t]),r=w.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(a=>{const c=s.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:a}=t.config,c={width:"50%",height:"100%"},l=a?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,d=a?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return p.jsxs("div",{className:Gt.cfPreview,children:[p.jsx("div",{style:{...c,background:d,border:`1px solid ${t.config.nativeColor}`}}),p.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&p.jsx("div",{className:Gt.cfPreview,children:n.map((a,c)=>p.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case s.CFRuleType.iconSet:return r&&p.jsx("div",{className:Gt.cfPreview,children:r.map((a,c)=>a?p.jsx("img",{style:{height:"100%"},src:a},c):p.jsx(Ut,{},c))});case s.CFRuleType.highlightCell:{const{ul:a,st:c,it:l,bl:d,bg:f,cl:m}=t.style,h=(a==null?void 0:a.s)===u.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===u.BooleanNumber.TRUE,y=l===u.BooleanNumber.TRUE,R=d===u.BooleanNumber.TRUE,E=(o=f==null?void 0:f.rgb)!=null?o:s.DEFAULT_BG_COLOR,C=(i=m==null?void 0:m.rgb)!=null?i:s.DEFAULT_FONT_COLOR,T={fontWeight:R?"bold":void 0,fontStyle:y?"italic":void 0,textDecoration:`${h?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:E,color:C};return p.jsx("div",{style:T,className:Gt.cfPreview,children:"123"})}}return null};var Jl=Object.defineProperty,Ql=Object.getOwnPropertyDescriptor,ec=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ql(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Jl(t,n,o),o},tc=(e,t)=>(n,r)=>t(n,r,e);let pt=class extends u.Disposable{constructor(t){super();St(this,"_initLocal",()=>{});St(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,l,d)=>{const f=d[l-1]||{startIndex:0,endIndex:-1};if(f.endIndex+1<c.startIndex){const m=i.slice(f.endIndex+1,c.startIndex);m&&a.push(m)}if(n[c.key]&&a.push(n[c.key]),l===d.length-1){const m=i.slice(c.endIndex+1);m&&a.push(m)}}),a}return[]}};pt=ec([u.OnLifecycle(u.LifecycleStages.Rendered,pt),tc(0,u.Inject(u.LocaleService))],pt);const nc="univer-cf-rule-list",rc="univer-rule-selector",oc="univer-select",ic="univer-select-selector",ac="univer-select-selection-item",sc="univer-select-selection-search-input",lc="univer-btn-list",cc="univer-gap",uc="univer-icon",dc="univer-disabled",fc="univer-rule-item",pc="univer-rule-describe",hc="univer-rule-type",mc="univer-rule-range",gc="univer-active",vc="univer-draggableHandle",yc="univer-delete-item",Cc="univer-grid-layout-wrap",Sc="univer-react-grid-item",ce={cfRuleList:nc,ruleSelector:rc,select:oc,selectSelector:ic,selectSelectionItem:ac,selectSelectionSearchInput:sc,btnList:lc,gap:cc,icon:uc,disabled:dc,ruleItem:fc,ruleDescribe:pc,ruleType:hc,ruleRange:mc,active:gc,draggableHandle:vc,deleteItem:yc,gridLayoutWrap:Cc,reactGridItem:Sc},bc=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let Qr=0;const Rc=e=>{const{onClick:t}=e,n=u.useDependency(s.ConditionalFormattingRuleModel),r=u.useDependency(u.IUniverInstanceService),o=u.useDependency(L.SheetsSelectionsService),i=u.useDependency(u.ICommandService),a=u.useDependency(u.LocaleService),c=u.useDependency(pt),l=fe.useObservable(r.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET)),d=l.getUnitId(),f=l.getActiveSheet();if(!f)throw new Error("No active sheet found");const m=f.getSheetId(),[h,v]=w.useState([]),[y,R]=w.useState("2"),[E,C]=w.useState(0),[T,_]=w.useState(-1),[I,g]=w.useState(Qr),x=w.useRef(null),O=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],S=()=>{const V=n.getSubunitRules(d,m);if(!V||!V.length)return[];if(y==="1"){const Y=o.getCurrentLastSelection();if(!Y)return[];const ee=Y.range;return V.filter(se=>se.ranges.some(ue=>u.Rectangle.intersects(ue,ee)))}else if(y==="2")return V;return[]},M=V=>{const ee=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return V.map(se=>{const ue=se.ranges;return(ue==null?void 0:ue.some(Oe=>{var B,te;const{startRow:F,startColumn:U,endRow:G,endColumn:X}=Oe;for(let oe=F;oe<=G;oe++)for(let me=U;me<=X;me++){const J=(te=(B=ee==null?void 0:ee.getCell(oe,me))==null?void 0:B.selectionProtection)==null?void 0:te[0];if((J==null?void 0:J[Ft.Edit])===!1||(J==null?void 0:J[Ft.View])===!1)return!0}return!1}))?{...se,disable:!0}:{...se}})},[j,$]=w.useState(S);le.useHighlightRange(h),w.useEffect(()=>{const V=i.onCommandExecuted(Y=>{Y.id===L.SetWorksheetActiveOperation.id&&C(Math.random())});return()=>V.dispose()}),w.useEffect(()=>{$(S)},[y,E,d,m]),w.useEffect(()=>{if(y==="2")return;const V=new De.Observable(Y=>{const ee=[L.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],re=i.onCommandExecuted(se=>{const{id:ue,params:Ie}=se,Oe=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId();ee.includes(ue)&&Ie.unitId===Oe&&Y.next(null)});return()=>re.dispose()}).pipe(De.debounceTime(16)).subscribe(()=>{$(S)});return()=>{V.unsubscribe()}},[r,y,d,m]),w.useEffect(()=>{const V=n.$ruleChange.subscribe(()=>{C(Math.random())});return()=>V.unsubscribe()},[n]),w.useEffect(()=>{const V=()=>{var se;const re=Math.max(0,(((se=x.current)==null?void 0:se.getBoundingClientRect().width)||0)-8);return Qr=re,re},ee=new De.Observable(re=>{const se=document.querySelector(".univer-sidebar");if(se){let ue=setTimeout(()=>{re.next()},150);const Ie=()=>{ue&&clearTimeout(ue),ue=null},Oe=F=>{F.propertyName==="width"&&(Ie(),re.next())};return se.addEventListener("transitionend",Oe),()=>{Ie(),se.removeEventListener("transitionend",Oe)}}}).pipe(De.debounceTime(16)).subscribe(()=>{g(V())});return()=>{ee.unsubscribe()}},[]);const A=V=>{var re;const Y=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),ee=(re=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:re.getSheetId();if(!Y||!ee)throw new Error("No active sheet found");i.executeCommand(Nt.id,{unitId:Y,subUnitId:ee,cfId:V.cfId})},b=(V,Y)=>{_(Y.y)},D=(V,Y,ee)=>{var F;_(-1);const re=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),se=(F=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:F.getSheetId();if(!re||!se)throw new Error("No active sheet found");const ue=U=>{const G=j.length;return Math.min(G-1,Math.max(0,U))},Ie=j[ue(Y.y)].cfId,Oe=j[ue(ee.y)].cfId;Ie!==Oe&&i.executeCommand(bn.id,{unitId:re,subUnitId:se,start:{id:Ie,type:"self"},end:{id:Oe,type:ee.y>Y.y?"after":"before"}})},Z=()=>{e.onCreate()},Ce=()=>{y==="2"?i.executeCommand(Lt.id):y==="1"&&j.map(Y=>({unitId:d,subUnitId:m,cfId:Y.cfId})).forEach(Y=>{i.executeCommand(Nt.id,Y)})},pe=j.map((V,Y)=>({i:V.cfId,x:0,w:12,y:Y,h:1,isResizable:!1})),he=M(j),xe=he==null?void 0:he.some(V=>V.disable);return p.jsxs("div",{className:ce.cfRuleList,children:[p.jsxs("div",{className:ce.ruleSelector,children:[p.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",p.jsx(q.Select,{className:ce.select,options:O,value:y,onChange:V=>{R(V)}})).map((V,Y)=>p.jsx("span",{children:V},Y))}),p.jsxs("div",{className:ce.btnList,children:[p.jsx(q.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:p.jsx("div",{className:`${ce.icon}`,onClick:Z,children:p.jsx(To,{})})}),j.length&&!xe?p.jsx(q.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:p.jsx("div",{className:`${ce.gap} ${ce.icon}`,onClick:Ce,children:p.jsx(Zt,{})})}):p.jsx("div",{className:`${ce.gap} ${ce.disabled}`,children:p.jsx(Zt,{})})]})]}),p.jsx("div",{ref:x,className:ce.gridLayoutWrap,children:I?p.jsx(Kl,{onDragStop:D,onDragStart:b,layout:pe,cols:12,rowHeight:60,width:I,margin:[0,10],draggableHandle:".draggableHandle",children:he==null?void 0:he.map((V,Y)=>p.jsx("div",{children:p.jsxs("div",{onMouseMove:()=>{V.ranges!==h&&v(V.ranges)},onMouseLeave:()=>v([]),onClick:()=>{V.disable||t(V)},className:`${ce.ruleItem} ${T===Y?ce.active:""}`,children:[p.jsx("div",{className:`${ce.draggableHandle} draggableHandle`,onClick:ee=>ee.stopPropagation(),children:p.jsx(Io,{})}),p.jsxs("div",{className:ce.ruleDescribe,children:[p.jsx("div",{className:ce.ruleType,children:bc(V,a)}),p.jsx("div",{className:ce.ruleRange,children:V.ranges.map(ee=>Co.serializeRange(ee)).join(",")})]}),p.jsx("div",{className:ce.preview,children:p.jsx(vt,{rule:V.rule})}),!V.disable&&p.jsx("div",{className:`${ce.deleteItem} ${T===Y?ce.active:""}`,onClick:ee=>{ee.stopPropagation(),A(V)},children:p.jsx(Zt,{})})]})},`${V.cfId}`))}):null})]})},Ht={type:u.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(u.IUndoRedoService),o=e.get(u.ICommandService),i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.IUniverInstanceService),c=L.getSheetCommandTarget(a);if(!c)return!1;const{unitId:l,subUnitId:d}=c,f=i.createCfId(l,d),m={unitId:l,subUnitId:d,rule:{...n,cfId:n.cfId||f}},h=s.AddConditionalRuleMutationUndoFactory(e,m),v=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,m);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:m}],undoMutations:[h]}),v}},Rn={type:u.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,rule:t.rule},d=s.setConditionalRuleMutationUndoFactory(e,l),f=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return f&&n.pushUndoRedo({unitID:a,undoMutations:d,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),f}},_c=u.createInterceptorKey("beforeSubmit"),Tc=u.createInterceptorKey("submit"),Ic="univer-cf-color-picker",wc="univer-cf-color-picker-icon",xc="univer-icon-dropdown",$n={cfColorPicker:Ic,cfColorPickerIcon:wc,iconDropdown:xc},Je=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=e,c=u.useDependency(fe.ComponentManager),l=w.useMemo(()=>new u.ColorKit(t),[t]),d=c.get(o);return d&&(r?p.jsx(d,{className:i,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):p.jsx(q.Dropdown,{overlay:p.jsx("div",{className:`${$n.cfColorPicker} `,children:p.jsx(q.ColorPicker,{color:t,onChange:n})}),children:p.jsxs("span",{className:`${$n.cfColorPickerIcon} ${i}`,children:[p.jsx(d,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),a&&p.jsx(ln,{className:$n.iconDropdown})]})}))},Oc="univer-cf-rule-style-editor",Ec="univer-cf-preview-wrap",Dc="univer-text",Pc="univer-position-relative",Mc="univer-btn-list",Fc="univer-util-item",Nc="univer-icon-set",jc="univer-render-config",$c="univer-flex",Lc="univer-width45",Uc="univer-icon-wrap",Vc="univer-icon",zc="univer-dropdown-icon",Ac="univer-error-input",Hc="univer-error-text",Wc="univer-icon-group-list",kc="univer-title",qc="univer-group",Bc="univer-item-content",Gc="univer-item-wrap",Xc="univer-item",Yc="univer-icon-item-list-wrap",Kc="univer-none",Zc="univer-icon-item-list",Jc="univer-width100",Qc="univer-stress",N={cfRuleStyleEditor:Oc,cfPreviewWrap:Ec,text:Dc,positionRelative:Pc,btnList:Mc,utilItem:Fc,iconSet:Nc,renderConfig:jc,flex:$c,width45:Lc,iconWrap:Uc,icon:Vc,dropdownIcon:zc,errorInput:Ac,errorText:Hc,iconGroupList:Wc,title:kc,group:qc,itemContent:Bc,itemWrap:Gc,item:Xc,iconItemListWrap:Yc,none:Kc,iconItemList:Zc,width100:Jc,stress:Qc},Xe=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Ln=e=>{var m;const{type:t,className:n,onChange:r,id:o,value:i}=e,a=u.useDependency(u.IUniverInstanceService),c=a.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(m=a.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),d=w.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),f=w.useMemo(()=>[s.CFValueType.max,s.CFValueType.min,"none"].includes(t)?{disabled:!0}:[s.CFValueType.percent,s.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]);return t===s.CFValueType.formula?p.jsx(fe.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`),value:d,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(h="")=>{r(h||"")}}):p.jsx(q.InputNumber,{className:n,value:Number(e.value)||0,onChange:h=>e.onChange(h||0),...f})},eu=e=>{var A;const{interceptorManager:t}=e,n=u.useDependency(u.LocaleService),r=((A=e.rule)==null?void 0:A.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Xe(s.CFValueType.num,n),Xe(s.CFValueType.percent,n),Xe(s.CFValueType.percentile,n),Xe(s.CFValueType.formula,n)],i=[Xe(s.CFValueType.min,n),...o],a=[Xe("none",n),...o],c=[Xe(s.CFValueType.max,n),...o],[l,d]=w.useState(()=>{var D;const b=s.CFValueType.min;return r&&((D=r.config[0])==null?void 0:D.value.type)||b}),[f,m]=w.useState(()=>{var D;const b="none";return!r||r.config.length!==3?b:((D=r.config[1])==null?void 0:D.value.type)||b}),[h,v]=w.useState(()=>{var D;const b=s.CFValueType.max;return r&&((D=r.config[r.config.length-1])==null?void 0:D.value.type)||b}),[y,R]=w.useState(()=>{if(!r)return 10;const D=r.config[0];return(D==null?void 0:D.value.value)===void 0?10:D==null?void 0:D.value.value}),[E,C]=w.useState(()=>{var Z;if(!r||r.config.length!==3)return 50;const D=(Z=r.config[1])==null?void 0:Z.value.value;return D===void 0?50:D}),[T,_]=w.useState(()=>{var Z;if(!r)return 90;const D=(Z=r.config[r.config.length-1])==null?void 0:Z.value.value;return D===void 0?90:D}),[I,g]=w.useState(()=>{var D;const b="#d0d9fb";return r&&((D=r.config[0])==null?void 0:D.color)||b}),[x,O]=w.useState(()=>{var D;const b="#7790f3";return!r||r.config.length!==3?b:((D=r.config[1])==null?void 0:D.color)||b}),[S,M]=w.useState(()=>{var D;const b="#2e55ef";return r&&((D=r.config[r.config.length-1])==null?void 0:D.color)||b}),j=w.useMemo(()=>b=>{const{minType:D,medianType:Z,maxType:Ce,minValue:pe,medianValue:he,maxValue:xe,minColor:V,medianColor:Y,maxColor:ee}=b,re=[];return re.push({color:V,value:{type:D,value:pe}}),Z!=="none"&&re.push({color:Y,value:{type:Z,value:he}}),re.push({color:ee,value:{type:Ce,value:xe}}),{config:re.map((ue,Ie)=>({...ue,index:Ie})),type:s.CFRuleType.colorScale}},[]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return j({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),[j,l,f,h,y,E,T,I,x,S,t]);const $=b=>{e.onChange(j(b))};return p.jsxs("div",{children:[p.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${N.cfPreviewWrap}`,children:p.jsx(vt,{rule:j({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})})}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:i,value:l,onChange:b=>{d(b);const D=s.createDefaultValueByValueType(b,10);R(D),$({minType:b,medianType:f,maxType:h,minValue:D,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Ln,{id:"min",className:`${P.mLXxs}`,value:y,type:l,onChange:b=>{R(b),$({minType:l,medianType:f,maxType:h,minValue:b,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Je,{className:P.mLXxs,color:I,onChange:b=>{g(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:b,medianColor:x,maxColor:S})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.medianValue")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:a,value:f,onChange:b=>{m(b);const D=s.createDefaultValueByValueType(b,50);C(D),$({minType:l,medianType:b,maxType:h,minValue:y,medianValue:D,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Ln,{id:"median",className:` ${P.mLXxs}`,value:E,type:f,onChange:b=>{C(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:b,maxValue:T,minColor:I,medianColor:x,maxColor:S})}}),f!=="none"&&p.jsx(Je,{className:P.mLXxs,color:x,onChange:b=>{O(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:b,maxColor:S})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:c,value:h,onChange:b=>{v(b);const D=s.createDefaultValueByValueType(b,90);_(D),$({minType:l,medianType:f,maxType:b,minValue:y,medianValue:E,maxValue:D,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Ln,{id:"max",className:`${P.mLXxs}`,value:T,type:h,onChange:b=>{_(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:b,minColor:I,medianColor:x,maxColor:S})}}),p.jsx(Je,{className:P.mLXxs,color:S,onChange:b=>{M(b),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:T,minColor:I,medianColor:x,maxColor:b})}})]})]})},lt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),eo=e=>{var h;const{onChange:t,className:n,value:r,type:o,id:i,disabled:a=!1}=e,c=u.useDependency(u.IUniverInstanceService),l=c.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(h=c.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:h.getSheetId(),f=w.useRef(r),m=w.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const v=String(f.current).startsWith("=")?String(f.current)||"":"=";return p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${i}`),value:v,openForSheetSubUnitId:d,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(y="")=>{t(y||"")}})}return p.jsx(q.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:v=>{t(v||0)},...m})},tu=e=>{var A;const{interceptorManager:t}=e,n=u.useDependency(u.LocaleService),r=((A=e.rule)==null?void 0:A.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,i]=w.useState(()=>{var D;const b="0";return r?(D=r.config)!=null&&D.isGradient?"1":"0":b}),[a,c]=w.useState(()=>{var D;const b="#abd91a";return r&&((D=r.config)==null?void 0:D.positiveColor)||b}),[l,d]=w.useState(()=>{var D;const b="#ffbe38";return r&&((D=r.config)==null?void 0:D.nativeColor)||b}),f=[lt(s.CFValueType.num,n),lt(s.CFValueType.percent,n),lt(s.CFValueType.percentile,n),lt(s.CFValueType.formula,n)],m=[lt(s.CFValueType.min,n),...f],h=[lt(s.CFValueType.max,n),...f],[v,y]=w.useState(()=>{var D;const b=m[0].value;return r&&((D=r.config)==null?void 0:D.min.type)||b}),[R,E]=w.useState(()=>{var D;const b=h[0].value;return r&&((D=r.config)==null?void 0:D.max.type)||b}),[C,T]=w.useState(()=>{var Z;if(!r)return 0;const D=((Z=r.config)==null?void 0:Z.min)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value||0}),[_,I]=w.useState(()=>{var Z;if(!r)return 100;const D=((Z=r.config)==null?void 0:Z.max)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value===void 0?100:D.value}),[g,x]=w.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),O=b=>({config:{min:{type:b.minValueType,value:b.minValue},max:{type:b.maxValueType,value:b.maxValue},isGradient:b.isGradient==="1",positiveColor:b.positiveColor,nativeColor:b.nativeColor},type:s.CFRuleType.dataBar,isShowValue:b.isShowValue});w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return O({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}}),[o,C,v,_,R,a,l,t,g]);const S=b=>{e.onChange(O(b))},M=b=>{c(b),S({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:b,nativeColor:l,isShowValue:g})},j=b=>{d(b),S({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:b,isShowValue:g})},$=b=>f.map(D=>D.value).includes(b);return p.jsxs("div",{children:[p.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${N.cfPreviewWrap}`,children:p.jsx(vt,{rule:O({isGradient:o,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})})}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.fillType")}),p.jsxs("div",{className:`${P.mTSm} ${P.mLXxs} ${P.labelContainer} `,children:[p.jsxs(q.RadioGroup,{value:o,onChange:b=>{i(b),S({isGradient:b,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})},children:[p.jsx(q.Radio,{value:"0",children:p.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),p.jsx(q.Radio,{value:"1",children:p.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]}),p.jsxs("div",{className:`${N.utilItem} ${P.mLXl}`,children:[p.jsx(q.Checkbox,{checked:!g,onChange:b=>{x(!b),S({isGradient:b,minValue:C,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:!b})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.colorSet")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm} ${P.mLXxs}`,children:[p.jsxs("div",{className:`${P.labelContainer}`,children:[p.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),p.jsx(Je,{color:l,onChange:j})]}),p.jsxs("div",{className:`${P.labelContainer} ${P.mLSm} `,children:[p.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),p.jsx(Je,{color:a,onChange:M})]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[p.jsx(q.Select,{options:m,value:v,onChange:b=>{y(b);const D=s.createDefaultValueByValueType(b,10);T(D),S({isGradient:o,minValue:D,minValueType:b,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}}),p.jsx(eo,{disabled:!$(v),id:"min",type:v,className:P.mLSm,value:C,onChange:b=>{T(b||0),S({isGradient:o,minValue:b||0,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[p.jsx(q.Select,{options:h,value:R,onChange:b=>{E(b);const D=s.createDefaultValueByValueType(b,90);I(D),S({isGradient:o,minValue:C,minValueType:v,maxValue:D,maxValueType:b,positiveColor:a,nativeColor:l,isShowValue:g})}}),p.jsx(eo,{disabled:!$(R),id:"max",type:R,className:P.mLSm,value:_,onChange:b=>{I(b||0),S({isGradient:o,minValue:C,minValueType:v,maxValue:b||0,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}})]})]})]})},nu="univer-cf-style-edit",ru="univer-button-item",ou="univer-isActive",Ue={cfStyleEdit:nu,buttonItem:ru,isActive:ou},Xt=e=>[u.BooleanNumber.FALSE,void 0].includes(e)?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE,Yt=e=>e!==u.BooleanNumber.FALSE,Dr=e=>{const{style:t,onChange:n,className:r}=e,o=u.useDependency(fe.ComponentManager),[i,a]=w.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=w.useState(()=>{if(t!=null&&t.it)return t.it}),[d,f]=w.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[m,h]=w.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,y]=w.useState(()=>{var x;const g="#2f56ef";return(x=t==null?void 0:t.cl)!=null&&x.rgb?t.cl.rgb:g}),[R,E]=w.useState(()=>{var x;const g="#e8ecfc";return(x=t==null?void 0:t.bg)!=null&&x.rgb?t.bg.rgb:g}),C=o.get("BoldSingle"),T=o.get("ItalicSingle"),_=o.get("UnderlineSingle"),I=o.get("StrikethroughSingle");return w.useEffect(()=>{const g={bl:i,it:c};v!==void 0&&(g.cl={rgb:v}),R!==void 0&&(g.bg={rgb:R}),m!==void 0&&(g.st={s:m}),d!==void 0&&(g.ul={s:d}),n(s.removeUndefinedAttr(g))},[i,c,d,m,v,R]),p.jsxs("div",{className:`${Ue.cfStyleEdit} ${r}`,children:[C&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(i||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>a(Xt(i)),children:p.jsx(C,{})}),T&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(c||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>l(Xt(c)),children:p.jsx(T,{})}),_&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(d||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>f(Xt(d)),children:p.jsx(_,{})}),I&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(m||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>h(Xt(m)),children:p.jsx(I,{})}),p.jsx(Je,{color:v,onChange:y,iconId:"FontColor"}),p.jsx(Je,{color:R,onChange:E,iconId:"PaintBucket"})]})},iu=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=u.useDependency(u.LocaleService),o=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=w.useState(()=>{const C=i[0].value,T=o==null?void 0:o.type;if(!o)return C;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":C;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return C}),[l,d]=w.useState(()=>{const T=o==null?void 0:o.type;if(!o)return 10;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[f,m]=w.useState(()=>{const T=o==null?void 0:o.type;if(!o)return!1;switch(T){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[h,v]=w.useState({}),y=C=>{const{type:T,isPercent:_,value:I,style:g}=C;if(T==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!1,value:I,style:g};if(T==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!0,value:I,style:g};if(T==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(T==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:a,isPercent:f,value:l,style:h})}}),[a,f,l,h,n]);const R=C=>{t(y(C))};return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(q.Select,{className:`${N.width100} ${P.mTSm}`,value:a,options:i,onChange:C=>{c(C),R({type:C,isPercent:f,value:l,style:h})}}),["isNotBottom","isBottom"].includes(a)&&p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.InputNumber,{min:1,max:1e3,value:l,onChange:C=>{const T=C||0;d(T),R({type:a,isPercent:f,value:T,style:h})}}),p.jsxs("div",{className:`${P.mLSm} ${P.labelContainer} ${N.text}`,children:[p.jsx(q.Checkbox,{checked:f,onChange:C=>{m(!!C),R({type:a,isPercent:!!C,value:l,style:h})}}),r.t("sheet.cf.valueType.percent")]})]}),p.jsx("div",{className:`${N.cfPreviewWrap} `,children:p.jsx(vt,{rule:y({type:a,isPercent:f,value:l,style:h})})}),p.jsx(Dr,{style:o==null?void 0:o.style,className:`${P.mTSm} `,onChange:C=>{v(C),R({type:a,isPercent:f,value:l,style:C})}})]})},Ot=e=>p.jsxs("div",{style:{position:"relative"},children:[p.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:e.errorText}),e.children]}),Q=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),au=e=>{const{type:t,operator:n,onChange:r,value:o,interceptorManager:i}=e,a=u.useDependency(u.LocaleService),[c,l]=w.useState(()=>typeof o=="number"?o:0),[d,f]=w.useState(""),[m,h]=w.useState(()=>typeof o=="string"?o:""),[v,y]=w.useState(""),[R,E]=w.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[C,T]=w.useState(""),[_,I]=w.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[g,x]=w.useState("");switch(w.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(m);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(c),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([R,_]);break}}},[t]),w.useEffect(()=>{const O=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(S,M,j)=>{switch(t){case s.CFSubRuleType.text:return s.CFTextOperator.beginsWith,s.CFTextOperator.containsText,s.CFTextOperator.endsWith,s.CFTextOperator.notEqual,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,m?j(S):(y(a.t("sheet.cf.errorMessage.notBlank")),!1)}return j(S)}});return()=>{O()}},[t,c,m,R,_]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const O=S=>{h(S),r(S)};return p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:v,children:p.jsx(q.Input,{className:N.width100,value:m,onChange:S=>{y(""),O(S)}})})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const O=S=>{l(S||0),r(S||0),f("")};return p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:d,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:c,onChange:O})})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const O=M=>{E(M||0),r([M||0,_]),T("")},S=M=>{I(M||0),r([R,M||0]),x("")};return p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer} `,children:[p.jsx(Ot,{errorText:C,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:R,onChange:O})}),p.jsx(Ot,{errorText:g,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${P.mLSm}`,value:_,onChange:S})})]})}}}return null},to=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[Q(s.CFTextOperator.containsText,t),Q(s.CFTextOperator.notContainsText,t),Q(s.CFTextOperator.beginsWith,t),Q(s.CFTextOperator.endsWith,t),Q(s.CFTextOperator.equal,t),Q(s.CFTextOperator.notEqual,t),Q(s.CFTextOperator.containsBlanks,t),Q(s.CFTextOperator.notContainsBlanks,t),Q(s.CFTextOperator.containsErrors,t),Q(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[Q(s.CFNumberOperator.between,t),Q(s.CFNumberOperator.notBetween,t),Q(s.CFNumberOperator.equal,t),Q(s.CFNumberOperator.notEqual,t),Q(s.CFNumberOperator.greaterThan,t),Q(s.CFNumberOperator.greaterThanOrEqual,t),Q(s.CFNumberOperator.lessThan,t),Q(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[Q(s.CFTimePeriodOperator.yesterday,t),Q(s.CFTimePeriodOperator.today,t),Q(s.CFTimePeriodOperator.tomorrow,t),Q(s.CFTimePeriodOperator.last7Days,t),Q(s.CFTimePeriodOperator.lastWeek,t),Q(s.CFTimePeriodOperator.thisWeek,t),Q(s.CFTimePeriodOperator.nextWeek,t),Q(s.CFTimePeriodOperator.lastMonth,t),Q(s.CFTimePeriodOperator.thisMonth,t),Q(s.CFTimePeriodOperator.nextMonth,t)]}},no=e=>{var I;const{interceptorManager:t,onChange:n}=e,r=u.useDependency(u.LocaleService),o=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.highlightCell?e.rule:void 0,[i,a]=w.useState(()=>{const g=s.CFSubRuleType.text;return o&&o.subType||g}),c=[{value:s.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:s.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:s.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:s.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:s.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],l=w.useMemo(()=>to(i,r),[i]),[d,f]=w.useState(()=>{const g=l?l[0].value:void 0;return o&&o.operator||g}),[m,h]=w.useState(()=>{var O;const g="";return o?(O=o.value)!=null?O:s.createDefaultValue(o.subType,o.operator):g}),[v,y]=w.useState({}),R=w.useMemo(()=>g=>{var x,O,S,M,j,$,A,b,D,Z,Ce,pe,he,xe,V;switch(g.subType||i){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(d))return{type:s.CFRuleType.highlightCell,subType:(x=g.subType)!=null?x:i,operator:(O=g.operator)!=null?O:d,style:(S=g.style)!=null?S:v,value:(M=g.value)!=null?M:m};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(d))return{type:s.CFRuleType.highlightCell,subType:(j=g.subType)!=null?j:i,operator:($=g.operator)!=null?$:d,style:(A=g.style)!=null?A:v,value:(b=g.value)!=null?b:m};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(d))return{type:s.CFRuleType.highlightCell,subType:(D=g.subType)!=null?D:i,operator:(Z=g.operator)!=null?Z:d,style:(Ce=g.style)!=null?Ce:v,value:(pe=g.value)!=null?pe:m};break}}return{type:s.CFRuleType.highlightCell,subType:(he=g.subType)!=null?he:i,operator:(xe=g.operator)!=null?xe:d,style:(V=g.style)!=null?V:v}},[i,d,m,v]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return R({})}}),[R,t]),w.useEffect(()=>{c.some(g=>g.value===i)||a(c[0].value)},[c]);const E=g=>{const x=g,O=to(x,r),S=O&&O[0].value;a(x),f(S),S&&h(s.createDefaultValue(x,S)),n(R({subType:x,operator:S}))},C=g=>{const x=g;f(x),n(R({operator:x}))},T=g=>{h(g),n(R({value:g}))},_=w.useMemo(()=>`${i}_${d}_${Math.random()}`,[i,d]);return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(q.Select,{className:`${P.mTSm} ${N.width100}`,onChange:E,value:i,options:c}),(l==null?void 0:l.length)&&p.jsx(q.Select,{className:`${P.mTSm} ${N.width100}`,onChange:C,value:d||"",options:l}),p.jsx(au,{value:m,interceptorManager:t,type:i,operator:d,rule:o,onChange:T},_),p.jsx("div",{className:`${N.cfPreviewWrap}`,children:p.jsx(vt,{rule:R({})})}),p.jsx(Dr,{style:o==null?void 0:o.style,className:`${P.mLXxs}`,onChange:g=>{y(g),n(R({style:g}))}})]})},su=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=u.useDependency(u.LocaleService),i=u.useDependency(u.IUniverInstanceService).getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,d]=w.useState({}),[f,m]=w.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),[h,v]=w.useState(""),y=C=>({style:C.style,value:f,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({style:l,formula:f})}}),[l,f,n]),w.useEffect(()=>{n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(C,T,_)=>!f||f.length===1||!h.startsWith("=")?(v(r.t("sheet.cf.errorMessage.formulaError")),!1):_(C)})},[f]);const R=C=>{t(y(C))};return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:h,children:p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:a==null?void 0:a.getSheetId(),openForSheetUnitId:i.getUnitId(),value:f,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(C="")=>{const T=C||"";m(T),R({style:l,formula:T}),v("")}})})}),p.jsx("div",{className:`${N.cfPreviewWrap} `,children:p.jsx(vt,{rule:y({style:l,formula:f})})}),p.jsx(Dr,{style:c==null?void 0:c.style,className:`${P.mTSm} `,onChange:C=>{d(C),R({style:C,formula:f})}})]})};var lu="Expected a function",fi="__lodash_hash_undefined__",pi=1/0,cu=9007199254740991,uu="[object Function]",du="[object GeneratorFunction]",fu="[object Symbol]",pu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hu=/^\w*$/,mu=/^\./,gu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vu=/[\\^$.*+?()[\]{}|]/g,yu=/\\(\\)?/g,Cu=/^\[object .+?Constructor\]$/,Su=/^(?:0|[1-9]\d*)$/,bu=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,Ru=typeof self=="object"&&self&&self.Object===Object&&self,Pr=bu||Ru||Function("return this")();function _u(e,t){return e==null?void 0:e[t]}function Tu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Iu=Array.prototype,wu=Function.prototype,hi=Object.prototype,Un=Pr["__core-js_shared__"],ro=function(){var e=/[^.]+$/.exec(Un&&Un.keys&&Un.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),mi=wu.toString,_n=hi.hasOwnProperty,gi=hi.toString,xu=RegExp("^"+mi.call(_n).replace(vu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oo=Pr.Symbol,Ou=Iu.splice,Eu=vi(Pr,"Map"),jt=vi(Object,"create"),io=oo?oo.prototype:void 0,ao=io?io.toString:void 0;function Qe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Du(){this.__data__=jt?jt(null):{}}function Pu(e){return this.has(e)&&delete this.__data__[e]}function Mu(e){var t=this.__data__;if(jt){var n=t[e];return n===fi?void 0:n}return _n.call(t,e)?t[e]:void 0}function Fu(e){var t=this.__data__;return jt?t[e]!==void 0:_n.call(t,e)}function Nu(e,t){var n=this.__data__;return n[e]=jt&&t===void 0?fi:t,this}Qe.prototype.clear=Du;Qe.prototype.delete=Pu;Qe.prototype.get=Mu;Qe.prototype.has=Fu;Qe.prototype.set=Nu;function yt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ju(){this.__data__=[]}function $u(e){var t=this.__data__,n=Tn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ou.call(t,n,1),!0}function Lu(e){var t=this.__data__,n=Tn(t,e);return n<0?void 0:t[n][1]}function Uu(e){return Tn(this.__data__,e)>-1}function Vu(e,t){var n=this.__data__,r=Tn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}yt.prototype.clear=ju;yt.prototype.delete=$u;yt.prototype.get=Lu;yt.prototype.has=Uu;yt.prototype.set=Vu;function rt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zu(){this.__data__={hash:new Qe,map:new(Eu||yt),string:new Qe}}function Au(e){return In(this,e).delete(e)}function Hu(e){return In(this,e).get(e)}function Wu(e){return In(this,e).has(e)}function ku(e,t){return In(this,e).set(e,t),this}rt.prototype.clear=zu;rt.prototype.delete=Au;rt.prototype.get=Hu;rt.prototype.has=Wu;rt.prototype.set=ku;function qu(e,t,n){var r=e[t];(!(_n.call(e,t)&&yi(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function Tn(e,t){for(var n=e.length;n--;)if(yi(e[n][0],t))return n;return-1}function Bu(e){if(!on(e)||Qu(e))return!1;var t=rd(e)||Tu(e)?xu:Cu;return t.test(nd(e))}function Gu(e,t,n,r){if(!on(e))return e;t=Zu(t,e)?[t]:Yu(t);for(var o=-1,i=t.length,a=i-1,c=e;c!=null&&++o<i;){var l=td(t[o]),d=n;if(o!=a){var f=c[l];d=void 0,d===void 0&&(d=on(f)?f:Ku(t[o+1])?[]:{})}qu(c,l,d),c=c[l]}return e}function Xu(e){if(typeof e=="string")return e;if(Fr(e))return ao?ao.call(e):"";var t=e+"";return t=="0"&&1/e==-pi?"-0":t}function Yu(e){return Ci(e)?e:ed(e)}function In(e,t){var n=e.__data__;return Ju(t)?n[typeof t=="string"?"string":"hash"]:n.map}function vi(e,t){var n=_u(e,t);return Bu(n)?n:void 0}function Ku(e,t){return t=t==null?cu:t,!!t&&(typeof e=="number"||Su.test(e))&&e>-1&&e%1==0&&e<t}function Zu(e,t){if(Ci(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Fr(e)?!0:hu.test(e)||!pu.test(e)||t!=null&&e in Object(t)}function Ju(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Qu(e){return!!ro&&ro in e}var ed=Mr(function(e){e=id(e);var t=[];return mu.test(e)&&t.push(""),e.replace(gu,function(n,r,o,i){t.push(o?i.replace(yu,"$1"):r||n)}),t});function td(e){if(typeof e=="string"||Fr(e))return e;var t=e+"";return t=="0"&&1/e==-pi?"-0":t}function nd(e){if(e!=null){try{return mi.call(e)}catch{}try{return e+""}catch{}}return""}function Mr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(lu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(Mr.Cache||rt),n}Mr.Cache=rt;function yi(e,t){return e===t||e!==e&&t!==t}var Ci=Array.isArray;function rd(e){var t=on(e)?gi.call(e):"";return t==uu||t==du}function on(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function od(e){return!!e&&typeof e=="object"}function Fr(e){return typeof e=="symbol"||od(e)&&gi.call(e)==fu}function id(e){return e==null?"":Xu(e)}function ad(e,t,n){return e==null?e:Gu(e,t,n)}var sd=ad;const ld=sr(sd);var cd="Expected a function",Si="__lodash_hash_undefined__",bi=1/0,ud="[object Function]",dd="[object GeneratorFunction]",fd="[object Symbol]",pd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hd=/^\w*$/,md=/^\./,gd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vd=/[\\^$.*+?()[\]{}|]/g,yd=/\\(\\)?/g,Cd=/^\[object .+?Constructor\]$/,Sd=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,bd=typeof self=="object"&&self&&self.Object===Object&&self,Nr=Sd||bd||Function("return this")();function Rd(e,t){return e==null?void 0:e[t]}function _d(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Td=Array.prototype,Id=Function.prototype,Ri=Object.prototype,Vn=Nr["__core-js_shared__"],so=function(){var e=/[^.]+$/.exec(Vn&&Vn.keys&&Vn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),_i=Id.toString,jr=Ri.hasOwnProperty,Ti=Ri.toString,wd=RegExp("^"+_i.call(jr).replace(vd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Nr.Symbol,xd=Td.splice,Od=Ii(Nr,"Map"),$t=Ii(Object,"create"),co=lo?lo.prototype:void 0,uo=co?co.toString:void 0;function et(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ed(){this.__data__=$t?$t(null):{}}function Dd(e){return this.has(e)&&delete this.__data__[e]}function Pd(e){var t=this.__data__;if($t){var n=t[e];return n===Si?void 0:n}return jr.call(t,e)?t[e]:void 0}function Md(e){var t=this.__data__;return $t?t[e]!==void 0:jr.call(t,e)}function Fd(e,t){var n=this.__data__;return n[e]=$t&&t===void 0?Si:t,this}et.prototype.clear=Ed;et.prototype.delete=Dd;et.prototype.get=Pd;et.prototype.has=Md;et.prototype.set=Fd;function Ct(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Nd(){this.__data__=[]}function jd(e){var t=this.__data__,n=wn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():xd.call(t,n,1),!0}function $d(e){var t=this.__data__,n=wn(t,e);return n<0?void 0:t[n][1]}function Ld(e){return wn(this.__data__,e)>-1}function Ud(e,t){var n=this.__data__,r=wn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ct.prototype.clear=Nd;Ct.prototype.delete=jd;Ct.prototype.get=$d;Ct.prototype.has=Ld;Ct.prototype.set=Ud;function ot(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vd(){this.__data__={hash:new et,map:new(Od||Ct),string:new et}}function zd(e){return xn(this,e).delete(e)}function Ad(e){return xn(this,e).get(e)}function Hd(e){return xn(this,e).has(e)}function Wd(e,t){return xn(this,e).set(e,t),this}ot.prototype.clear=Vd;ot.prototype.delete=zd;ot.prototype.get=Ad;ot.prototype.has=Hd;ot.prototype.set=Wd;function wn(e,t){for(var n=e.length;n--;)if(ef(e[n][0],t))return n;return-1}function kd(e,t){t=Xd(t,e)?[t]:Gd(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Jd(t[n++])];return n&&n==r?e:void 0}function qd(e){if(!xi(e)||Kd(e))return!1;var t=tf(e)||_d(e)?wd:Cd;return t.test(Qd(e))}function Bd(e){if(typeof e=="string")return e;if(Lr(e))return uo?uo.call(e):"";var t=e+"";return t=="0"&&1/e==-bi?"-0":t}function Gd(e){return wi(e)?e:Zd(e)}function xn(e,t){var n=e.__data__;return Yd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ii(e,t){var n=Rd(e,t);return qd(n)?n:void 0}function Xd(e,t){if(wi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Lr(e)?!0:hd.test(e)||!pd.test(e)||t!=null&&e in Object(t)}function Yd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Kd(e){return!!so&&so in e}var Zd=$r(function(e){e=rf(e);var t=[];return md.test(e)&&t.push(""),e.replace(gd,function(n,r,o,i){t.push(o?i.replace(yd,"$1"):r||n)}),t});function Jd(e){if(typeof e=="string"||Lr(e))return e;var t=e+"";return t=="0"&&1/e==-bi?"-0":t}function Qd(e){if(e!=null){try{return _i.call(e)}catch{}try{return e+""}catch{}}return""}function $r(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(cd);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new($r.Cache||ot),n}$r.Cache=ot;function ef(e,t){return e===t||e!==e&&t!==t}var wi=Array.isArray;function tf(e){var t=xi(e)?Ti.call(e):"";return t==ud||t==dd}function xi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function nf(e){return!!e&&typeof e=="object"}function Lr(e){return typeof e=="symbol"||nf(e)&&Ti.call(e)==fd}function rf(e){return e==null?"":Bd(e)}function of(e,t,n){var r=e==null?void 0:kd(e,t);return r===void 0?n:r}var af=of;const sf=sr(af),Oi=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",lf=e=>{var i;const t=u.useDependency(u.IUniverInstanceService),n=t.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(i=t.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:i.getSheetId(),o=w.useMemo(()=>e.error?N.errorInput:"",[e.error]);return p.jsx("div",{className:N.positionRelative,children:e.type!==s.CFValueType.formula?p.jsxs(p.Fragment,{children:[p.jsx(q.InputNumber,{className:o,value:Number(e.value)||0,onChange:a=>e.onChange(a!=null?a:0)}),e.error&&p.jsx("div",{className:N.errorText,children:e.error})]}):p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`),value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(a="")=>{const c=a||"";e.onChange(c)}})})},fo=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),cf=w.forwardRef((e,t)=>{const n=u.useDependency(u.LocaleService),r=o=>{e.onClick(o)};return p.jsx("div",{ref:t,className:N.iconGroupList,children:s.iconGroup.map((o,i)=>p.jsxs("div",{className:N.group,children:[p.jsx("div",{className:N.title,children:n.t(o.title)}),p.jsx("div",{className:N.itemContent,children:o.group.map(a=>p.jsx("div",{className:N.itemWrap,onClick:()=>{r(a.name)},children:p.jsx("div",{className:N.item,children:a.list.map((c,l)=>p.jsx("img",{className:N.icon,src:c},l))})},a.name))})]},i))})}),uf=e=>{const t=w.useMemo(()=>{const r=[];for(const o in s.iconMap){const i=s.iconMap[o],a=o;i.forEach((c,l)=>{r.push({iconType:a,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return p.jsxs("div",{className:N.iconItemListWrap,children:[p.jsxs("div",{className:N.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[p.jsx(Ut,{className:N.icon}),p.jsx("span",{children:"无单元格图标"})]}),p.jsx("div",{className:N.iconItemList,children:t.map(r=>p.jsx("div",{className:N.item,children:p.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},df=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=u.useDependency(u.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(m,h)=>{t([String(h),"value","value"],m)},l=(m,h)=>{t([String(h),"operator"],m);const v=s.createDefaultValue(s.CFSubRuleType.number,m);c(v,h)},d=(m,h)=>{t([String(h),"value","type"],m)};return w.useMemo(()=>n.map((m,h)=>{const v=r[h],y=Oi(m.iconType,m.iconId),R=h===n.length-1,E=h===0,C=n[h-1],T=(C==null?void 0:C.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):C==null?void 0:C.value.value,_=(I,g)=>{const x={...m,iconId:g,iconType:I};t([String(h)],x)};return p.jsxs("div",{className:`${h?P.mTXl:P.mTSm}`,children:[p.jsxs("div",{className:`${P.label} ${N.flex}`,children:[p.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),h+1]}),p.jsx("div",{className:`${N.width45}`,children:p.jsxs(p.Fragment,{children:[!E&&!R&&o.t("sheet.cf.iconSet.rule"),!E&&!R&&p.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(C.operator)}`),T,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),p.jsxs("div",{className:`${N.flex} ${P.mTSm}`,children:[p.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:p.jsx(q.Dropdown,{overlay:p.jsx(uf,{onClick:_,iconId:m.iconId,iconType:m.iconType}),children:p.jsxs("div",{className:N.dropdownIcon,children:[y?p.jsx("img",{src:y,className:N.icon}):p.jsx(Ut,{className:N.icon}),p.jsx(ln,{})]})})}),R?p.jsxs("div",{className:`${N.width45} ${P.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),p.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(C.operator)}`),T,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):p.jsx(q.Select,{className:`${P.mL0} ${N.width45} ${P.mR0}`,options:i,value:m.operator,onChange:I=>{l(I,h)}})]}),R?p.jsx("div",{}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:`${P.mTSm} ${P.label} ${N.flex}`,children:[p.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),p.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),p.jsxs("div",{className:`${P.mTSm} ${N.flex}`,children:[p.jsx(q.Select,{className:`${N.width45} ${P.mL0}`,options:a,value:m.value.type,onChange:I=>{d(I,h)}}),p.jsx("div",{className:`${P.mL0} ${N.width45}`,children:p.jsx(lf,{id:h,type:m.value.type,error:v,value:m.value.value||"",onChange:I=>c(I,h)})})]})]})]},h)}),[n,r])},ff=e=>{var I;const{interceptorManager:t}=e,n=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.iconSet?e.rule:void 0,r=u.useDependency(u.LocaleService),[o,i]=w.useState({}),[a,c]=w.useState(()=>{const g=Object.keys(s.iconMap)[0];if(n&&n.config.length){const x=n.config[0].iconType;if(!n.config.some(S=>S.iconType!==x))return x}return g}),[l,d]=w.useState(()=>{if(n&&n.config.length)return u.Tools.deepClone(n==null?void 0:n.config);const g=s.iconMap[a]||[];return new Array(g.length).fill("").map((x,O,S)=>O===S.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(O)}:fo(a,O,S))}),[f,m]=w.useState(()=>n?!!n.isShowValue:!0),h=w.useMemo(()=>{const g=l.map(x=>Oi(x.iconType,x.iconId));return p.jsx("div",{className:N.iconWrap,children:g.map((x,O)=>x?p.jsx("img",{className:N.icon,src:x},O):p.jsx(Ut,{className:N.icon},O))})},[l]),v=g=>{if(g.reduce((O,S,M)=>O.preType&&!O.result||g.length-1===M?O:S.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:O.preType?{result:O.preType===S.value.type,preType:S.value.type}:{result:!0,preType:S.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(g[0].value.type)){const O={};return g.forEach((S,M,j)=>{if(M-1<0||M===j.length-1)return;const A=g[M-1],b=s.getOppositeOperator(A.operator);s.compareWithNumber({operator:b,value:A.value.value},S.value.value)||(O[M]=`${r.t(`sheet.cf.form.${b}`,String(A.value.value))} `)}),O}return{}},y=(g,x)=>{sf(l,g)!==x&&(ld(l,g,x),d([...l]),i(v(l)))},R=g=>{c(g);const x=s.iconMap[g]||[],O=new Array(x.length).fill("").map((S,M,j)=>fo(g,M,j));d(O),i(v(O))};w.useEffect(()=>{const g=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:f,config:l}}});return()=>{g()}},[f,l,t]),w.useEffect(()=>{const g=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{g()}},[f,l,t,o]);const E=()=>{const g=l.map(x=>({...x}));l.forEach((x,O)=>{const S=l.length-1-O,M=g[S];x.iconId=M.iconId,x.iconType=M.iconType}),d([...l])},C=u.useDependency(fe.ILayoutService),[T,_]=w.useState();return fe.useScrollYOverContainer(T,C.rootContainerElement),p.jsxs("div",{className:N.iconSet,children:[p.jsx("div",{className:P.title,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(q.Dropdown,{placement:"bottomLeft",overlay:p.jsx(cf,{ref:g=>!T&&g&&_(g),iconType:a,onClick:R}),children:p.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[h,p.jsx(ln,{})]})})}),p.jsxs("div",{className:`${P.mTSm} ${N.renderConfig}`,children:[p.jsxs("div",{className:N.utilItem,children:[p.jsx(q.Checkbox,{onChange:E}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),p.jsxs("div",{className:`${N.utilItem} ${P.mLXl}`,children:[p.jsx(q.Checkbox,{checked:!f,onChange:g=>{m(!g)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),p.jsx(df,{errorMap:o,onChange:y,configList:l})]})},po=e=>e.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),ho=e=>{var t;return(t=e.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},pf=e=>{var I,g,x,O;const t=u.useDependency(u.LocaleService),n=u.useDependency(u.ICommandService),r=u.useDependency(u.IUniverInstanceService),o=u.useDependency(s.ConditionalFormattingRuleModel),i=u.useDependency(L.SheetsSelectionsService),a=po(r),c=ho(r),l=w.useRef((g=(I=e.rule)==null?void 0:I.ranges)!=null?g:[]),d=w.useMemo(()=>{var M,j,$;let S=(M=e.rule)==null?void 0:M.ranges;return S!=null&&S.length||(S=($=(j=i.getCurrentSelections())==null?void 0:j.map(A=>A.range))!=null?$:[]),l.current=S,S!=null&&S.length?S.map(A=>{const b=Co.serializeRange(A);return b==="NaN"?"":b}).filter(A=>!!A).join(","):""},[e.rule]),f=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[m,h]=w.useState(()=>{var j,$;const S=(j=e.rule)==null?void 0:j.rule.type,M=f[0].value;if(!S)return M;switch(S){case s.CFRuleType.highlightCell:{switch(($=e.rule)==null?void 0:$.rule.subType){case s.CFSubRuleType.number:case s.CFSubRuleType.text:case s.CFSubRuleType.duplicateValues:case s.CFSubRuleType.uniqueValues:case s.CFSubRuleType.timePeriod:return"1";case s.CFSubRuleType.average:case s.CFSubRuleType.rank:return"2";case s.CFSubRuleType.formula:return"5"}break}case s.CFRuleType.dataBar:return"3";case s.CFRuleType.colorScale:return"4";case s.CFRuleType.iconSet:return"6"}return M}),v=w.useRef(),y=w.useMemo(()=>new u.InterceptorManager({beforeSubmit:_c,submit:Tc}),[]),R=w.useMemo(()=>{switch(m){case"1":return no;case"2":return iu;case"3":return tu;case"4":return eu;case"5":return su;case"6":return ff;default:return no}},[m]);w.useEffect(()=>{var S;if(((S=e.rule)==null?void 0:S.cfId)!==void 0){const M=n.onCommandExecuted(j=>{if(j.id===L.RemoveSheetMutation.id){const $=j.params;$.subUnitId===c&&$.unitId===a&&e.onCancel()}j.id===L.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>M.dispose()}},[(x=e.rule)==null?void 0:x.cfId]);const E=S=>{v.current=S},C=S=>{l.current=S.map(M=>M.range)},T=()=>{const M=(()=>{const $=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!$)throw new Error("No active sheet found");return l.current.map(D=>L.setEndForRange(D,$.getRowCount(),$.getColumnCount())).filter(D=>!(Number.isNaN(D.startRow)||Number.isNaN(D.startColumn)))})();if(y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null)){const $=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null);if($){const A=po(r),b=ho(r);if(!A||!b)throw new Error("No active sheet found");let D={};e.rule&&e.rule.cfId?(D={...e.rule,ranges:M,rule:$},n.executeCommand(Rn.id,{unitId:A,subUnitId:b,rule:D}),e.onCancel()):(D={cfId:o.createCfId(A,b),ranges:M,rule:$,stopIfTrue:!1},n.executeCommand(Ht.id,{unitId:A,subUnitId:b,rule:D}),e.onCancel())}}},_=()=>{e.onCancel()};return p.jsxs("div",{className:N.cfRuleStyleEditor,children:[p.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.range")}),p.jsx("div",{className:`${P.mTBase}`,children:p.jsx(fe.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:a,value:d,id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:C})}),p.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.styleType")}),p.jsx("div",{className:P.mTBase,children:p.jsx(q.Select,{className:N.width100,value:m,options:f,onChange:S=>h(S)})}),p.jsx(R,{interceptorManager:y,rule:(O=e.rule)==null?void 0:O.rule,onChange:E}),p.jsxs("div",{className:`${P.mTBase} ${N.btnList}`,children:[p.jsx(q.Button,{size:"small",onClick:_,children:t.t("sheet.cf.panel.cancel")}),p.jsx(q.Button,{className:P.mLSm,size:"small",type:"primary",onClick:T,children:t.t("sheet.cf.panel.submit")})]})]})},hf=e=>{const[t,n]=w.useState(e.rule),[r,o]=w.useState(!!e.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return p.jsx("div",{className:P.conditionalFormattingWrap,children:r?p.jsx(pf,{onCancel:a,rule:t}):p.jsx(Rc,{onClick:c,onCreate:i})})};var mf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,vf=(e,t,n,r)=>{for(var o=r>1?void 0:r?gf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&mf(t,n,o),o},ct=(e,t)=>(n,r)=>t(n,r,e);const Ei={},mo="sheet.conditional.formatting.panel";let ht=class extends u.Disposable{constructor(t,n,r,o,i,a,c){super();St(this,"_sidebarDisposable",null);this._config=t,this._univerInstanceService=n,this._injector=r,this._componentManager=o,this._menuService=i,this._sidebarService=a,this._localeService=c,this._initMenu(),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var d;l||(d=this._sidebarDisposable)==null||d.dispose()}))}openPanel(t){const n={header:{title:this._localeService.t("sheet.cf.title")},children:{label:mo,rule:t,key:u.Tools.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initMenu(){const{menu:t={}}=this._config;this._menuService.addMenuItem(Li(this._injector),t)}_initPanel(){this._componentManager.register(mo,hf)}};ht=vf([u.OnLifecycle(u.LifecycleStages.Ready,ht),ct(1,u.IUniverInstanceService),ct(2,u.Inject(u.Injector)),ct(3,u.Inject(fe.ComponentManager)),ct(4,u.Inject(fe.IMenuService)),ct(5,u.Inject(fe.ISidebarService)),ct(6,u.Inject(u.LocaleService))],ht);var _e=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(_e||{});const On={id:"sheet.operation.open.conditional.formatting.panel",type:u.CommandType.OPERATION,handler:(e,t)=>{var c;const n=e.get(ht),r=e.get(L.SheetsSelectionsService),o=e.get(u.ICommandService),i=((c=r.getCurrentSelections())==null?void 0:c.map(l=>l.range))||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 4:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(l);break}case 5:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(l);break}case 6:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(l);break}case 7:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(l);break}case 8:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(l);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(an.id,{ranges:i});break}case 10:{o.executeCommand(Lt.id);break}}return!0}};var yf=Object.defineProperty,Cf=Object.getOwnPropertyDescriptor,Sf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Cf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&yf(t,n,o),o},ut=(e,t)=>(n,r)=>t(n,r,e);let Et=class extends u.Disposable{constructor(e,t,n,r,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=i,this._initViewModelInterceptor(),this._initSkeleton()}_initSkeleton(){const e=()=>{var n,r,o;const t=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(t))==null||n.with(le.SheetSkeletonManagerService).reCalculate(),(o=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.mainComponent)==null||o.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(L.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),a={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:a};return r.style&&Object.assign(a,r.style),c.fontRenderExtension||(c.fontRenderExtension={},r.isShowValue!==void 0&&(c.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)},priority:10}))}};Et=Sf([u.OnLifecycle(u.LifecycleStages.Rendered,Et),ut(0,u.Inject(L.SheetInterceptorService)),ut(1,u.Inject(s.ConditionalFormattingService)),ut(2,u.Inject(u.IUniverInstanceService)),ut(3,u.Inject($i.IRenderManagerService)),ut(4,u.Inject(s.ConditionalFormattingViewModel)),ut(5,u.Inject(s.ConditionalFormattingRuleModel))],Et);var bf=Object.defineProperty,Rf=Object.getOwnPropertyDescriptor,_f=(e,t,n,r)=>{for(var o=r>1?void 0:r?Rf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&bf(t,n,o),o},_t=(e,t)=>(n,r)=>t(n,r,e);let Dt=class extends u.Disposable{constructor(t,n,r,o,i){super();St(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:i=le.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new u.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(t,n);if(!a)return;const c={get:this._injector.get.bind(this._injector)},l=le.rangeToDiscreteRange(r,c,t,n);if(!l)return;const{rows:d,cols:f}=l,m=new Set;d.forEach((h,v)=>{f.forEach((y,R)=>{const E=this._conditionalFormattingViewModel.getCellCf(t,n,h,y,a);E&&(E.cfList.forEach(C=>m.add(C.cfId)),o.setValue(v,R,E.cfList.map(C=>C.cfId)))})}),m.forEach(h=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,h);v&&(i[h]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId();if(!o)return{redos:[],undos:[]};const a=o.getSheetId();if(n.copyType===le.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,le.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,l],mapFunc:d}=le.virtualizeDiscreteRanges([n.copyRange,t]),f=le.getRepeatRange(c,l,!0),m=this._conditionalFormattingViewModel.getMatrix(i,a),h={};u.Range.foreach(l,(g,x)=>{const{row:O,col:S}=d(g,x),M=this._conditionalFormattingViewModel.getCellCf(i,a,O,S,m);M&&M.cfList.forEach(j=>{if(!h[j.cfId]){const $=new u.ObjectMatrix;h[j.cfId]=$;const A=this._conditionalFormattingRuleModel.getRule(i,a,j.cfId);A==null||A.ranges.forEach(b=>{u.Range.foreach(b,(D,Z)=>{$.setValue(D,Z,1)})})}h[j.cfId].realDeleteValue(O,S)})});const{matrix:v,info:y}=this._copyInfo,R=[];let E=this._conditionalFormattingRuleModel.createCfId(i,a);const C={},T=g=>{if(C[g])return C[g];const x=y==null?void 0:y.cfMap[g],O=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...R].find(S=>u.Tools.diffValue(S.rule,x));if(O)return C[g]=O,O;{const S={rule:x,cfId:E,ranges:[],stopIfTrue:!1};return C[g]=S,R.push(S),E=`${Number(E)+1}`,S}};f.forEach(g=>{v&&v.forValue((x,O,S)=>{const M=u.Rectangle.getPositionRange({startRow:x,endRow:x,startColumn:O,endColumn:O},g.startRange),{row:j,col:$}=d(M.startRow,M.startColumn);S.forEach(A=>{if(!h[A]){const b=T(A),D=new u.ObjectMatrix;h[A]=D,b.ranges.forEach(Z=>{u.Range.foreach(Z,(Ce,pe)=>{D.setValue(Ce,pe,1)})})}h[A].setValue(j,$,1)})})});const _=[],I=[];for(const g in h){const x=h[g],O=L.findAllRectangle(L.createTopMatrixFromMatrix(x));if(!O.length){const S={unitId:i,subUnitId:a,cfId:g};_.push({id:s.DeleteConditionalRuleMutation.id,params:S}),I.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}if(R.some(S=>S.cfId===g)){const S=T(g),M={unitId:i,subUnitId:a,rule:{...S,ranges:O}};_.push({id:s.AddConditionalRuleMutation.id,params:M}),I.push(s.AddConditionalRuleMutationUndoFactory(this._injector,M))}else{const S=this._conditionalFormattingRuleModel.getRule(i,a,g);if(!S)continue;const M={unitId:i,subUnitId:a,rule:{...S,ranges:O}};_.push({id:s.SetConditionalRuleMutation.id,params:M}),I.push(...s.setConditionalRuleMutationUndoFactory(this._injector,M))}}return{redos:_,undos:I}}};Dt=_f([u.OnLifecycle(u.LifecycleStages.Rendered,Dt),_t(0,u.Inject(le.ISheetClipboardService)),_t(1,u.Inject(s.ConditionalFormattingRuleModel)),_t(2,u.Inject(u.Injector)),_t(3,u.Inject(s.ConditionalFormattingViewModel)),_t(4,u.Inject(u.IUniverInstanceService))],Dt);var Tf=Object.defineProperty,If=Object.getOwnPropertyDescriptor,wf=(e,t,n,r)=>{for(var o=r>1?void 0:r?If(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Tf(t,n,o),o},Kt=(e,t)=>(n,r)=>t(n,r,e);let Pt=class extends u.Disposable{constructor(e,t,n,r){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=l=>{const d=[...i.ranges],f=d.map(h=>L.handleDefaultRangeChangeWithEffectRefCommands(h,l)).filter(h=>!!h);if(s.isRangesEqual(f,d))return{redos:[],undos:[]};if(f.length){const h={unitId:r,subUnitId:o,rule:{...i,ranges:f}},v=[{id:s.SetConditionalRuleMutation.id,params:h}],y=s.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:y}}else{const h={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:h}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:y}}},c=[];i.ranges.forEach(l=>{const d=this._refRangeService.registerRefRange(l,a);c.push(()=>d.dispose())}),e.set(t(r,o,i.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:o,subUnitId:i,rule:a}=r,c=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!(r.unitId!==c.getUnitId()||r.subUnitId!==(l==null?void 0:l.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const d=e.get(t(o,i,a.cfId));d&&d();break}case"set":{const d=e.get(t(o,i,a.cfId));d&&d(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(u.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};Pt=wf([u.OnLifecycle(u.LifecycleStages.Rendered,Pt),Kt(0,u.Inject(s.ConditionalFormattingRuleModel)),Kt(1,u.Inject(u.IUniverInstanceService)),Kt(2,u.Inject(u.Injector)),Kt(3,u.Inject(L.RefRangeService))],Pt);var xf=Object.defineProperty,Of=Object.getOwnPropertyDescriptor,Ef=(e,t,n,r)=>{for(var o=r>1?void 0:r?Of(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&xf(t,n,o),o},zn=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends u.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===Ht.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[L.WorkbookEditablePermission],rangeTypes:[L.RangeProtectionPermissionEditPoint],worksheetTypes:[L.WorksheetEditPermission,L.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Mt=Ef([u.OnLifecycle(u.LifecycleStages.Rendered,Mt),zn(0,u.Inject(u.LocaleService)),zn(1,u.ICommandService),zn(2,u.Inject(le.SheetPermissionInterceptorBaseController))],Mt);var Di=Object.defineProperty,Df=Object.getOwnPropertyDescriptor,Pf=(e,t,n)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Df(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Di(t,n,o),o},go=(e,t)=>(n,r)=>t(n,r,e),Pi=(e,t,n)=>Pf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends u.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=u.Tools.deepMerge({},Ei,this._config),this._initCommand(),this._injector.add([Et]),this._injector.add([Pt]),this._injector.add([Dt]),this._injector.add([Mt]),this._injector.add([pt])}_initCommand(){[Jn,Qn,er,tr,nr,rr,or,ir,ar,On,Nt,Rn,bn,Ht,an,Lt].forEach(t=>{this._commandService.registerCommand(t)})}};Pi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Pi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=Mf([u.DependentOn(s.UniverSheetsConditionalFormattingPlugin),go(1,u.Inject(u.Injector)),go(2,u.Inject(u.ICommandService))],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var Ff=Object.defineProperty,Nf=Object.getOwnPropertyDescriptor,jf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ff(t,n,o),o},Tt=(e,t)=>(n,r)=>t(n,r,e);let Jt=class extends u.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,i,a,c,l)=>{var v;const d=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(v=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:v.getSheetId();if(!d||!f)return;const m={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},h={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};u.Range.foreach(a,(y,R)=>{const E=u.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},m),C=u.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},h),{row:T,col:_}=l(E.startRow,E.startColumn),I=this._conditionalFormattingViewModel.getCellCf(d,f,T,_),{row:g,col:x}=l(C.startRow,C.startColumn),O=this._conditionalFormattingViewModel.getCellCf(d,f,g,x);O&&O.cfList.forEach(S=>{let M=c.get(S.cfId);if(!c.get(S.cfId)){const j=this._conditionalFormattingRuleModel.getRule(d,f,S.cfId);if(!j)return;M=new u.ObjectMatrix,j.ranges.forEach($=>{u.Range.foreach($,(A,b)=>{M.setValue(A,b,1)})}),c.set(S.cfId,M)}M.realDeleteValue(g,x)}),I&&I.cfList.forEach(S=>{let M=c.get(S.cfId);if(!c.get(S.cfId)){const j=this._conditionalFormattingRuleModel.getRule(d,f,S.cfId);if(!j)return;M=new u.ObjectMatrix,j.ranges.forEach($=>{u.Range.foreach($,(A,b)=>{M.setValue(A,b,1)})}),c.set(S.cfId,M)}M.setValue(g,x,1)})})},n=(o,i)=>{var C,T,_;const a=(C=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:C.getUnitId(),c=(_=(T=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getActiveSheet())==null?void 0:_.getSheetId(),l=new Map,d=[],f=[];if(!a||!c)return e();const m=le.virtualizeDiscreteRanges([o,i]),[h,v]=m.ranges,{mapFunc:y}=m,R={row:h.startRow,col:h.startColumn};return le.getAutoFillRepeatRange(h,v).forEach(I=>{t(R,I.repeatStartCell,I.relativeRange,l,y)}),l.forEach((I,g)=>{const x=this._conditionalFormattingRuleModel.getRule(a,c,g);if(!x)return;const O=L.findAllRectangle(L.createTopMatrixFromMatrix(I));if(O.length){const S={unitId:a,subUnitId:c,rule:{...x,ranges:O}};d.push({id:s.SetConditionalRuleMutation.id,params:S}),f.push(...s.setConditionalRuleMutationUndoFactory(this._injector,S))}else{const S={unitId:a,subUnitId:c,cfId:x.cfId};d.push({id:s.DeleteConditionalRuleMutation.id,params:S}),f.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}}),{undos:f,redos:d}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===le.APPLY_TYPE.COPY||a===le.APPLY_TYPE.ONLY_FORMAT||a===le.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Jt=jf([u.OnLifecycle(u.LifecycleStages.Rendered,Jt),Tt(0,u.Inject(u.Injector)),Tt(1,u.Inject(u.IUniverInstanceService)),Tt(2,u.Inject(le.IAutoFillService)),Tt(3,u.Inject(s.ConditionalFormattingRuleModel)),Tt(4,u.Inject(s.ConditionalFormattingViewModel))],Jt);var $f=Object.defineProperty,Lf=Object.getOwnPropertyDescriptor,Uf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&$f(t,n,o),o},vo=(e,t)=>(n,r)=>t(n,r,e);let Qt=class extends u.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(u.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const i=s.getStringFromDataStream(e.p),a={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete a[l]});const c={...e,s:{...a},v:i};return delete c.p,n(c)}}return n(e)}})))}};Qt=Uf([u.OnLifecycle(u.LifecycleStages.Rendered,Qt),vo(0,u.Inject(le.IEditorBridgeService)),vo(1,u.Inject(s.ConditionalFormattingService))],Qt);var Vf=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Af=(e,t,n,r)=>{for(var o=r>1?void 0:r?zf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Vf(t,n,o),o},It=(e,t)=>(n,r)=>t(n,r,e);exports.ConditionalFormattingClearController=class extends u.Disposable{constructor(t,n,r,o,i){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var i;const n=[],r=[],o={redos:n,undos:r};if([L.ClearSelectionFormatCommand.id,L.ClearSelectionAllCommand.id].includes(t.id)){const a=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(f=>f.range);if(!a)return o;const c=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!l)return o;const d=this._conditionalFormattingRuleModel.getSubunitRules(c.getUnitId(),l.getSheetId());if(!d||!d.length)return o;d.filter(f=>a.some(m=>f.ranges.some(h=>u.Rectangle.getIntersects(h,m)))).forEach(f=>{const h=new L.RangeMergeUtil().add(...f.ranges).subtract(...a).merge();if(h.length){const v={id:s.SetConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),rule:{...f,ranges:h}}},y=s.setConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}else{const v={id:s.DeleteConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),cfId:f.cfId}},y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}})}return o}}))}};exports.ConditionalFormattingClearController=Af([u.OnLifecycle(u.LifecycleStages.Rendered,exports.ConditionalFormattingClearController),It(0,u.Inject(u.Injector)),It(1,u.Inject(u.IUniverInstanceService)),It(2,u.Inject(L.SheetInterceptorService)),It(3,u.Inject(L.SheetsSelectionsService)),It(4,u.Inject(s.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);var Mi=Object.defineProperty,Hf=Object.getOwnPropertyDescriptor,Wf=(e,t,n)=>t in e?Mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Hf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Mi(t,n,o),o},yo=(e,t)=>(n,r)=>t(n,r,e),Fi=(e,t,n)=>Wf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingUIPlugin=class extends u.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=u.Tools.deepMerge({},Ei,this._config),this._initCommand(),this._injector.add([Et]),this._injector.add([Pt]),this._injector.add([Dt]),this._injector.add([Jt]),this._injector.add([Mt]),this._injector.add([ht,{useFactory:()=>this._injector.createInstance(ht,this._config)}]),this._injector.add([pt]),this._injector.add([Qt]),this._injector.add([exports.ConditionalFormattingClearController])}_initCommand(){[Jn,Qn,er,tr,nr,rr,or,ir,ar,On,Nt,Rn,bn,Ht,an,Lt].forEach(t=>{this._commandService.registerCommand(t)})}};Fi(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Fi(exports.UniverSheetsConditionalFormattingUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=kf([u.DependentOn(s.UniverSheetsConditionalFormattingPlugin),yo(1,u.Inject(u.Injector)),yo(2,u.Inject(u.ICommandService))],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Jn;exports.AddCfCommand=Ht;exports.AddColorScaleConditionalRuleCommand=Qn;exports.AddDataBarConditionalRuleCommand=er;exports.AddDuplicateValuesCfCommand=tr;exports.AddNumberCfCommand=nr;exports.AddRankCfCommand=rr;exports.AddTextCfCommand=or;exports.AddTimePeriodCfCommand=ir;exports.AddUniqueValuesCfCommand=ar;exports.ClearRangeCfCommand=an;exports.ClearWorksheetCfCommand=Lt;exports.DeleteCfCommand=Nt;exports.MoveCfCommand=bn;exports.OpenConditionalFormattingOperator=On;exports.SetCfCommand=Rn;
|
|
11
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Bo(e.body,"react-draggable-transparent-selection")}function us(e){if(e)try{if(e.body&&Go(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Bo(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Go(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.canDragX=ps;Le.canDragY=hs;Le.createCoreData=gs;Le.createDraggableData=vs;Le.getBoundPosition=ds;Le.getControlPosition=ms;Le.snapToGrid=fs;var Re=$e,dt=ie;function ds(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:ys(r);const o=Cr(e);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,d=a.getComputedStyle(o),f=a.getComputedStyle(l);r={left:-o.offsetLeft+(0,Re.int)(f.paddingLeft)+(0,Re.int)(d.marginLeft),top:-o.offsetTop+(0,Re.int)(f.paddingTop)+(0,Re.int)(d.marginTop),right:(0,dt.innerWidth)(l)-(0,dt.outerWidth)(o)-o.offsetLeft+(0,Re.int)(f.paddingRight)-(0,Re.int)(d.marginRight),bottom:(0,dt.innerHeight)(l)-(0,dt.outerHeight)(o)-o.offsetTop+(0,Re.int)(f.paddingBottom)-(0,Re.int)(d.marginBottom)}}return(0,Re.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Re.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Re.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Re.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function fs(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function ps(e){return e.props.axis==="both"||e.props.axis==="x"}function hs(e){return e.props.axis==="both"||e.props.axis==="y"}function ms(e,t,n){const r=typeof t=="number"?(0,dt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=Cr(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,dt.offsetXYFromParent)(r||e,i,n.props.scale)}function gs(e,t,n){const r=!(0,Re.isNum)(e.lastX),o=Cr(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function vs(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ys(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Cr(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var pn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.default=Cs;function Cs(){}Object.defineProperty(pn,"__esModule",{value:!0});pn.default=void 0;var Dn=bs(x),Se=Sr(qe),Ss=Sr(So),ge=ie,Ae=Le,Pn=$e,bt=Sr(hn);function Sr(e){return e&&e.__esModule?e:{default:e}}function Xo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Xo=function(r){return r?n:t})(e)}function bs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Xo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ye(e,t,n){return t=Rs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rs(e){var t=_s(e,"string");return typeof t=="symbol"?t:String(t)}function _s(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ee={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let He=Ee.mouse,mn=class extends Dn.Component{constructor(){super(...arguments),ye(this,"dragging",!1),ye(this,"lastX",NaN),ye(this,"lastY",NaN),ye(this,"touchIdentifier",null),ye(this,"mounted",!1),ye(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,ge.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,ge.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,ge.getTouchIdentifier)(t);this.touchIdentifier=o;const i=(0,Ae.getControlPosition)(t,o,this);if(i==null)return;const{x:a,y:c}=i,l=(0,Ae.createCoreData)(this,a,c);(0,bt.default)("DraggableCore: handleDragStart: %j",l),(0,bt.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ge.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,ge.addEvent)(r,He.move,this.handleDrag),(0,ge.addEvent)(r,He.stop,this.handleDragStop))}),ye(this,"handleDrag",t=>{const n=(0,Ae.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,Ae.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const i=(0,Ae.createCoreData)(this,r,o);if((0,bt.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),ye(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Ae.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,d=o-this.lastY||0;[l,d]=(0,Ae.snapToGrid)(this.props.grid,l,d),r=this.lastX+l,o=this.lastY+d}const i=(0,Ae.createCoreData)(this,r,o);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,ge.removeUserSelectStyles)(c.ownerDocument),(0,bt.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,bt.default)("DraggableCore: Removing handlers"),(0,ge.removeEvent)(c.ownerDocument,He.move,this.handleDrag),(0,ge.removeEvent)(c.ownerDocument,He.stop,this.handleDragStop))}),ye(this,"onMouseDown",t=>(He=Ee.mouse,this.handleDragStart(t))),ye(this,"onMouseUp",t=>(He=Ee.mouse,this.handleDragStop(t))),ye(this,"onTouchStart",t=>(He=Ee.touch,this.handleDragStart(t))),ye(this,"onTouchEnd",t=>(He=Ee.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,ge.addEvent)(t,Ee.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,ge.removeEvent)(n,Ee.mouse.move,this.handleDrag),(0,ge.removeEvent)(n,Ee.touch.move,this.handleDrag),(0,ge.removeEvent)(n,Ee.mouse.stop,this.handleDragStop),(0,ge.removeEvent)(n,Ee.touch.stop,this.handleDragStop),(0,ge.removeEvent)(t,Ee.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ge.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:Ss.default.findDOMNode(this)}render(){return Dn.cloneElement(Dn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};pn.default=mn;ye(mn,"displayName","DraggableCore");ye(mn,"propTypes",{allowAnyClick:Se.default.bool,children:Se.default.node.isRequired,disabled:Se.default.bool,enableUserSelectHack:Se.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Se.default.arrayOf(Se.default.number),handle:Se.default.string,cancel:Se.default.string,nodeRef:Se.default.object,onStart:Se.default.func,onDrag:Se.default.func,onStop:Se.default.func,onMouseDown:Se.default.func,scale:Se.default.number,className:Pn.dontSetMe,style:Pn.dontSetMe,transform:Pn.dontSetMe});ye(mn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=h(x),n=f(qe),r=f(So),o=f(ke),i=ie,a=Le,c=$e,l=f(pn),d=f(hn);function f(I){return I&&I.__esModule?I:{default:I}}function m(I){if(typeof WeakMap!="function")return null;var _=new WeakMap,w=new WeakMap;return(m=function(g){return g?w:_})(I)}function h(I,_){if(I&&I.__esModule)return I;if(I===null||typeof I!="object"&&typeof I!="function")return{default:I};var w=m(_);if(w&&w.has(I))return w.get(I);var g={},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var T in I)if(T!=="default"&&Object.prototype.hasOwnProperty.call(I,T)){var b=O?Object.getOwnPropertyDescriptor(I,T):null;b&&(b.get||b.set)?Object.defineProperty(g,T,b):g[T]=I[T]}return g.default=I,w&&w.set(I,g),g}function v(){return v=Object.assign?Object.assign.bind():function(I){for(var _=1;_<arguments.length;_++){var w=arguments[_];for(var g in w)Object.prototype.hasOwnProperty.call(w,g)&&(I[g]=w[g])}return I},v.apply(this,arguments)}function y(I,_,w){return _=R(_),_ in I?Object.defineProperty(I,_,{value:w,enumerable:!0,configurable:!0,writable:!0}):I[_]=w,I}function R(I){var _=E(I,"string");return typeof _=="symbol"?_:String(_)}function E(I,_){if(typeof I!="object"||I===null)return I;var w=I[Symbol.toPrimitive];if(w!==void 0){var g=w.call(I,_||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(_==="string"?String:Number)(I)}class S extends t.Component{static getDerivedStateFromProps(_,w){let{position:g}=_,{prevPropsPosition:O}=w;return g&&(!O||g.x!==O.x||g.y!==O.y)?((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:g,prevPropsPosition:O}),{x:g.x,y:g.y,prevPropsPosition:{...g}}):null}constructor(_){super(_),y(this,"onDragStart",(w,g)=>{if((0,d.default)("Draggable: onDragStart: %j",g),this.props.onStart(w,(0,a.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(w,g)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",g);const O=(0,a.createDraggableData)(this,g),T={x:O.x,y:O.y,slackX:0,slackY:0};if(this.props.bounds){const{x:M,y:N}=T;T.x+=this.state.slackX,T.y+=this.state.slackY;const[$,A]=(0,a.getBoundPosition)(this,T.x,T.y);T.x=$,T.y=A,T.slackX=this.state.slackX+(M-T.x),T.slackY=this.state.slackY+(N-T.y),O.x=T.x,O.y=T.y,O.deltaX=T.x-this.state.x,O.deltaY=T.y-this.state.y}if(this.props.onDrag(w,O)===!1)return!1;this.setState(T)}),y(this,"onDragStop",(w,g)=>{if(!this.state.dragging||this.props.onStop(w,(0,a.createDraggableData)(this,g))===!1)return!1;(0,d.default)("Draggable: onDragStop: %j",g);const T={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:M,y:N}=this.props.position;T.x=M,T.y=N}this.setState(T)}),this.state={dragging:!1,dragged:!1,x:_.position?_.position.x:_.defaultPosition.x,y:_.position?_.position.y:_.defaultPosition.y,prevPropsPosition:{..._.position},slackX:0,slackY:0,isElementSVG:!1},_.position&&!(_.onDrag||_.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var _,w;return(_=(w=this.props)===null||w===void 0||(w=w.nodeRef)===null||w===void 0?void 0:w.current)!==null&&_!==void 0?_:r.default.findDOMNode(this)}render(){const{axis:_,bounds:w,children:g,defaultPosition:O,defaultClassName:T,defaultClassNameDragging:b,defaultClassNameDragged:M,position:N,positionOffset:$,scale:A,...C}=this.props;let D={},Z=null;const pe=!!!N||this.state.dragging,he=N||O,xe={x:(0,a.canDragX)(this)&&pe?this.state.x:he.x,y:(0,a.canDragY)(this)&&pe?this.state.y:he.y};this.state.isElementSVG?Z=(0,i.createSVGTransform)(xe,$):D=(0,i.createCSSTransform)(xe,$);const V=(0,o.default)(g.props.className||"",T,{[b]:this.state.dragging,[M]:this.state.dragged});return t.createElement(l.default,v({},C,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:V,style:{...g.props.style,...D},transform:Z}))}}e.default=S,y(S,"displayName","Draggable"),y(S,"propTypes",{...l.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),y(S,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Ao);const{default:Yo,DraggableCore:Ts}=Ao;fn.exports=Yo;fn.exports.default=Yo;fn.exports.DraggableCore=Ts;var Ko=fn.exports,gn={exports:{}},zt={},br={};br.__esModule=!0;br.cloneElement=Ds;var Is=ws(x);function ws(e){return e&&e.__esModule?e:{default:e}}function Wr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wr(Object(n),!0).forEach(function(r){xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xs(e,t,n){return t=Os(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e){var t=Es(e,"string");return typeof t=="symbol"?t:String(t)}function Es(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ds(e,t){return t.style&&e.props.style&&(t.style=kr(kr({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),Is.default.cloneElement(e,t)}var At={};At.__esModule=!0;At.resizableProps=void 0;var H=Ps(qe);function Ps(e){return e&&e.__esModule?e:{default:e}}var Ms={axis:H.default.oneOf(["both","x","y","none"]),className:H.default.string,children:H.default.element.isRequired,draggableOpts:H.default.shape({allowAnyClick:H.default.bool,cancel:H.default.string,children:H.default.node,disabled:H.default.bool,enableUserSelectHack:H.default.bool,offsetParent:H.default.node,grid:H.default.arrayOf(H.default.number),handle:H.default.string,nodeRef:H.default.object,onStart:H.default.func,onDrag:H.default.func,onStop:H.default.func,onMouseDown:H.default.func,scale:H.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=H.default.number).isRequired.apply(i,n)}return H.default.number.apply(H.default,n)},handle:H.default.oneOfType([H.default.node,H.default.func]),handleSize:H.default.arrayOf(H.default.number),lockAspectRatio:H.default.bool,maxConstraints:H.default.arrayOf(H.default.number),minConstraints:H.default.arrayOf(H.default.number),onResizeStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,resizeHandles:H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:H.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=H.default.number).isRequired.apply(i,n)}return H.default.number.apply(H.default,n)}};At.resizableProps=Ms;zt.__esModule=!0;zt.default=void 0;var Rt=Ls(x),Fs=Ko,Ns=br,js=At,$s=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Zo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Zo=function(o){return o?n:t})(e)}function Ls(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Zo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qn.apply(this,arguments)}function Us(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qr(Object(n),!0).forEach(function(r){Vs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Vs(e,t,n){return t=zs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zs(e){var t=As(e,"string");return typeof t=="symbol"?t:String(t)}function As(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Bn(e,t)}function Bn(e,t){return Bn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Bn(e,t)}var Rr=function(e){Hs(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,l=a.maxConstraints,d=a.lockAspectRatio;if(!c&&!l&&!d)return[o,i];if(d){var f=this.props.width/this.props.height,m=o-this.props.width,h=i-this.props.height;Math.abs(m)>Math.abs(h*f)?i=o/f:o=i*f}var v=o,y=i,R=this.slack||[0,0],E=R[0],S=R[1];return o+=E,i+=S,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),l&&(o=Math.min(l[0],o),i=Math.min(l[1],i)),this.slack=[E+(v-o),S+(y-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,l){var d=l.node,f=l.deltaX,m=l.deltaY;o==="onResizeStart"&&a.resetData();var h=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!h&&!v)){var y=i[0],R=i[i.length-1],E=d.getBoundingClientRect();if(a.lastHandleRect!=null){if(R==="w"){var S=E.left-a.lastHandleRect.left;f+=S}if(y==="n"){var I=E.top-a.lastHandleRect.top;m+=I}}a.lastHandleRect=E,R==="w"&&(f=-f),y==="n"&&(m=-m);var _=a.props.width+(h?f/a.props.transformScale:0),w=a.props.height+(v?m/a.props.transformScale:0),g=a.runConstraints(_,w);_=g[0],w=g[1];var O=_!==a.props.width||w!==a.props.height,T=typeof a.props[o]=="function"?a.props[o]:null,b=o==="onResize"&&!O;T&&!b&&(c.persist==null||c.persist(),T(c,{node:d,size:{width:_,height:w},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return Rt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",l=Mn({ref:i},c?{}:{handleAxis:o});return Rt.cloneElement(a,l)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,l=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var d=i.resizeHandles;i.transformScale;var f=Us(i,$s);return(0,Ns.cloneElement)(a,Mn(Mn({},f),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,d.map(function(m){var h,v=(h=o.handleRefs[m])!=null?h:o.handleRefs[m]=Rt.createRef();return Rt.createElement(Fs.DraggableCore,qn({},l,{nodeRef:v,key:"resizableHandle-"+m,onStop:o.resizeHandler("onResizeStop",m),onStart:o.resizeHandler("onResizeStart",m),onDrag:o.resizeHandler("onResize",m)}),o.renderResizeHandle(m,v))}))}))},t}(Rt.Component);zt.default=Rr;Rr.propTypes=js.resizableProps;Rr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var vn={};vn.__esModule=!0;vn.default=void 0;var Fn=Gs(x),Ws=Jo(qe),ks=Jo(zt),qs=At,Bs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Jo(e){return e&&e.__esModule?e:{default:e}}function Qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Qo=function(o){return o?n:t})(e)}function Gs(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Qo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Gn(){return Gn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gn.apply(this,arguments)}function Br(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Br(Object(n),!0).forEach(function(r){Xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Br(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xs(e,t,n){return t=Ys(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ys(e){var t=Ks(e,"string");return typeof t=="symbol"?t:String(t)}function Ks(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Js(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xn(e,t)}function Xn(e,t){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Xn(e,t)}var ei=function(e){Js(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var d=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(d,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(d)},r}t.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,d=o.draggableOpts,f=o.minConstraints,m=o.maxConstraints,h=o.lockAspectRatio,v=o.axis;o.width,o.height;var y=o.resizeHandles,R=o.style,E=o.transformScale,S=Zs(o,Bs);return Fn.createElement(ks.default,{axis:v,draggableOpts:d,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:h,maxConstraints:m,minConstraints:f,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:E,width:this.state.width},Fn.createElement("div",Gn({},S,{style:en(en({},R),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Fn.Component);vn.default=ei;ei.propTypes=en(en({},qs.resizableProps),{},{children:Ws.default.element});gn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};gn.exports.Resizable=zt.default;gn.exports.ResizableBox=vn.default;var Qs=gn.exports,ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.resizeHandleType=ze.resizeHandleAxesType=ze.default=void 0;var W=ti(qe),el=ti(x);function ti(e){return e&&e.__esModule?e:{default:e}}const tl=ze.resizeHandleAxesType=W.default.arrayOf(W.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),nl=ze.resizeHandleType=W.default.oneOfType([W.default.node,W.default.func]);ze.default={className:W.default.string,style:W.default.object,width:W.default.number,autoSize:W.default.bool,cols:W.default.number,draggableCancel:W.default.string,draggableHandle:W.default.string,verticalCompact:function(e){e.verticalCompact},compactType:W.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&k.validateLayout(t,"layout")},margin:W.default.arrayOf(W.default.number),containerPadding:W.default.arrayOf(W.default.number),rowHeight:W.default.number,maxRows:W.default.number,isBounded:W.default.bool,isDraggable:W.default.bool,isResizable:W.default.bool,allowOverlap:W.default.bool,preventCollision:W.default.bool,useCSSTransforms:W.default.bool,transformScale:W.default.number,isDroppable:W.default.bool,resizeHandles:tl,resizeHandle:nl,onLayoutChange:W.default.func,onDragStart:W.default.func,onDrag:W.default.func,onDragStop:W.default.func,onResizeStart:W.default.func,onResize:W.default.func,onResizeStop:W.default.func,onDrop:W.default.func,droppingItem:W.default.shape({i:W.default.string.isRequired,w:W.default.number.isRequired,h:W.default.number.isRequired}),children:function(e,t){const n=e[t],r={};el.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:W.default.any};Object.defineProperty(dn,"__esModule",{value:!0});dn.default=void 0;var it=_r(x),K=_r(qe),rl=Ko,ol=Qs,at=k,de=je,Gr=ze,il=_r(ke);function _r(e){return e&&e.__esModule?e:{default:e}}function Ne(e,t,n){return t=al(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function al(e){var t=sl(e,"string");return typeof t=="symbol"?t:String(t)}function sl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Tr extends it.default.Component{constructor(){super(...arguments),Ne(this,"state",{resizing:null,dragging:null,className:""}),Ne(this,"elementRef",it.default.createRef()),Ne(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),d=r.getBoundingClientRect(),f=d.left/i,m=l.left/i,h=d.top/i,v=l.top/i;a.left=f-m+c.scrollLeft,a.top=h-v+c.scrollTop,this.setState({dragging:a});const{x:y,y:R}=(0,de.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,y,R,{e:t,node:r,newPosition:a})}),Ne(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,l=this.state.dragging.left+o;const{isBounded:d,i:f,w:m,h,containerWidth:v}=this.props,y=this.getPositionParams();if(d){const{offsetParent:_}=r;if(_){const{margin:w,rowHeight:g,containerPadding:O}=this.props,T=_.clientHeight-(0,de.calcGridItemWHPx)(h,g,w[1]);c=(0,de.clamp)(c-O[1],0,T);const b=(0,de.calcGridColWidth)(y),M=v-(0,de.calcGridItemWHPx)(m,b,w[0]);l=(0,de.clamp)(l-O[0],0,M)}}const R={top:c,left:l};this.setState({dragging:R});const{containerPadding:E}=this.props,{x:S,y:I}=(0,de.calcXY)(y,c-E[1],l-E[0],m,h);return a.call(this,f,S,I,{e:t,node:r,newPosition:R})}),Ne(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:l}=this.props,{left:d,top:f}=this.state.dragging,m={top:f,left:d};this.setState({dragging:null});const{x:h,y:v}=(0,de.calcXY)(this.getPositionParams(),f-l[1],d-l[0],i,a);return o.call(this,c,h,v,{e:t,node:r,newPosition:m})}),Ne(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),Ne(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),Ne(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,de.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,de.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,at.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,l=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,at.setTransform)(t):(i=(0,at.setTopLeft)(t),n&&(i.left=(0,at.perc)(t.left/r),i.width=(0,at.perc)(t.width/r))),i}mixinDraggable(t,n){return it.default.createElement(rl.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:l,transformScale:d,resizeHandles:f,resizeHandle:m}=this.props,h=this.getPositionParams(),v=(0,de.calcGridItemPosition)(h,0,0,o,0).width,y=(0,de.calcGridItemPosition)(h,0,0,i,a),R=(0,de.calcGridItemPosition)(h,0,0,c,l),E=[y.width,y.height],S=[Math.min(R.width,v),Math.min(R.height,1/0)];return it.default.createElement(ol.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:E,maxConstraints:S,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:d,resizeHandles:f,handle:m},t)}onResizeHandler(t,n,r,o){let{node:i,size:a,handle:c}=n;const l=this.props[o];if(!l)return;const{x:d,y:f,i:m,maxH:h,minH:v,containerWidth:y}=this.props,{minW:R,maxW:E}=this.props;let S=a;i&&(S=(0,at.resizeItemInDirection)(c,r,a,y),this.setState({resizing:o==="onResizeStop"?null:S}));let{w:I,h:_}=(0,de.calcWH)(this.getPositionParams(),S.width,S.height,d,f,c);I=(0,de.clamp)(I,Math.max(R,1),E),_=(0,de.clamp)(_,v,h),l.call(this,m,I,_,{e:t,node:i,size:S,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:l}=this.props,d=(0,de.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),f=it.default.Children.only(this.props.children);let m=it.default.cloneElement(f,{ref:this.elementRef,className:(0,il.default)("react-grid-item",f.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...f.props.style,...this.createStyle(d)}});return m=this.mixinResizable(m,d,a),m=this.mixinDraggable(m,i),m}}dn.default=Tr;Ne(Tr,"propTypes",{children:K.default.element,cols:K.default.number.isRequired,containerWidth:K.default.number.isRequired,rowHeight:K.default.number.isRequired,margin:K.default.array.isRequired,maxRows:K.default.number.isRequired,containerPadding:K.default.array.isRequired,x:K.default.number.isRequired,y:K.default.number.isRequired,w:K.default.number.isRequired,h:K.default.number.isRequired,minW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minWidth not Number");if(n>e.w||n>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxWidth not Number");if(n<e.w||n<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minHeight not Number");if(n>e.h||n>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxHeight not Number");if(n<e.h||n<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:K.default.string.isRequired,resizeHandles:Gr.resizeHandleAxesType,resizeHandle:Gr.resizeHandleType,onDragStop:K.default.func,onDragStart:K.default.func,onDrag:K.default.func,onResizeStop:K.default.func,onResizeStart:K.default.func,onResize:K.default.func,isDraggable:K.default.bool.isRequired,isResizable:K.default.bool.isRequired,isBounded:K.default.bool.isRequired,static:K.default.bool,useCSSTransforms:K.default.bool.isRequired,transformScale:K.default.number,className:K.default.string,handle:K.default.string,cancel:K.default.string,droppingPosition:K.default.shape({e:K.default.object.isRequired,left:K.default.number.isRequired,top:K.default.number.isRequired})});Ne(Tr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Vt,"__esModule",{value:!0});Vt.default=void 0;var Be=dl(x),Nn=lr,ll=Ir(ke),z=k,cl=je,Xr=Ir(dn),ul=Ir(ze);function Ir(e){return e&&e.__esModule?e:{default:e}}function ni(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ni=function(r){return r?n:t})(e)}function dl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ni(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ve(e,t,n){return t=fl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e){var t=pl(e,"string");return typeof t=="symbol"?t:String(t)}function pl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Yr="react-grid-layout";let ri=!1;try{ri=/firefox/i.test(navigator.userAgent)}catch{}class yn extends Be.Component{constructor(){super(...arguments),ve(this,"state",{activeDrag:null,layout:(0,z.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,z.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ve(this,"dragEnterCounter",0),ve(this,"onDragStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);if(!l)return;const d={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,z.cloneLayoutItem)(l),oldLayout:c,activeDrag:d}),this.props.onDragStart(c,l,l,null,i,a)}),ve(this,"onDrag",(t,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:d,allowOverlap:f,preventCollision:m}=this.props,h=(0,z.getLayoutItem)(l,t);if(!h)return;const v={w:h.w,h:h.h,x:h.x,y:h.y,placeholder:!0,i:t};l=(0,z.moveElement)(l,h,n,r,!0,m,(0,z.compactType)(this.props),d,f),this.props.onDrag(l,c,h,v,i,a),this.setState({layout:f?l:(0,z.compact)(l,(0,z.compactType)(this.props),d),activeDrag:v})}),ve(this,"onDragStop",(t,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:d,preventCollision:f,allowOverlap:m}=this.props,h=(0,z.getLayoutItem)(l,t);if(!h)return;l=(0,z.moveElement)(l,h,n,r,!0,f,(0,z.compactType)(this.props),d,m);const y=m?l:(0,z.compact)(l,(0,z.compactType)(this.props),d);this.props.onDragStop(y,c,h,null,i,a);const{oldLayout:R}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,R)}),ve(this,"onResizeStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,z.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,i,a))}),ve(this,"onResize",(t,n,r,o)=>{let{e:i,node:a,size:c,handle:l}=o;const{oldResizeItem:d}=this.state,{layout:f}=this.state,{cols:m,preventCollision:h,allowOverlap:v}=this.props;let y=!1,R,E,S;const[I,_]=(0,z.withLayoutItem)(f,t,g=>{let O;return E=g.x,S=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(E=g.x+(g.w-n),n=g.x!==E&&E<0?g.w:n,E=E<0?0:E),["ne","n","nw"].indexOf(l)!==-1&&(S=g.y+(g.h-r),r=g.y!==S&&S<0?g.h:r,S=S<0?0:S),y=!0),h&&!v&&(O=(0,z.getAllCollisions)(f,{...g,w:n,h:r,x:E,y:S}).filter(b=>b.i!==g.i).length>0,O&&(S=g.y,r=g.h,E=g.x,n=g.w,y=!1)),g.w=n,g.h=r,g});if(!_)return;R=I,y&&(R=(0,z.moveElement)(I,_,E,S,!0,this.props.preventCollision,(0,z.compactType)(this.props),m,v));const w={w:_.w,h:_.h,x:_.x,y:_.y,static:!0,i:t};this.props.onResize(R,d,_,w,i,a),this.setState({layout:v?R:(0,z.compact)(R,(0,z.compactType)(this.props),m),activeDrag:w})}),ve(this,"onResizeStop",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:d,allowOverlap:f}=this.props,m=(0,z.getLayoutItem)(c,t),h=f?c:(0,z.compact)(c,(0,z.compactType)(this.props),d);this.props.onResizeStop(h,l,m,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:h,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(h,v)}),ve(this,"onDragOver",t=>{var I;if(t.preventDefault(),t.stopPropagation(),ri&&!((I=t.nativeEvent.target)!=null&&I.classList.contains(Yr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:l,containerPadding:d,transformScale:f}=this.props,m=r==null?void 0:r(t);if(m===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const h={...n,...m},{layout:v}=this.state,y=t.currentTarget.getBoundingClientRect(),R=t.clientX-y.left,E=t.clientY-y.top,S={left:R/f,top:E/f,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:_,top:w}=this.state.droppingPosition;(_!=R||w!=E)&&this.setState({droppingPosition:S})}}else{const _={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:l,containerPadding:d||o},w=(0,cl.calcXY)(_,E,R,h.w,h.h);this.setState({droppingDOMNode:Be.createElement("div",{key:h.i}),droppingPosition:S,layout:[...v,{...h,x:w.x,y:w.y,static:!1,isDraggable:!0}]})}}),ve(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,z.compact)(r.filter(i=>i.i!==t.i),(0,z.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ve(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ve(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),ve(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,Nn.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,z.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,z.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,z.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,z.fastRGLPropsEqual)(this.props,t,Nn.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,z.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(t,n){n||(n=this.state.layout),(0,Nn.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:l,transformScale:d}=this.props;return Be.createElement(Xr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:d},Be.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,z.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:l,maxRows:d,isDraggable:f,isResizable:m,isBounded:h,useCSSTransforms:v,transformScale:y,draggableCancel:R,draggableHandle:E,resizeHandles:S,resizeHandle:I}=this.props,{mounted:_,droppingPosition:w}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&f,O=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&m,T=r.resizeHandles||S,b=g&&h&&r.isBounded!==!1;return Be.createElement(Xr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:d,rowHeight:l,cancel:R,handle:E,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:g,isResizable:O,isBounded:b,useCSSTransforms:v&&_,usePercentages:!_,transformScale:y,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?w:void 0,resizeHandles:T,resizeHandle:I},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,ll.default)(Yr,t),a={height:this.containerHeight(),...n};return Be.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:z.noop,onDragLeave:r?this.onDragLeave:z.noop,onDragEnter:r?this.onDragEnter:z.noop,onDragOver:r?this.onDragOver:z.noop},Be.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Vt.default=yn;ve(yn,"displayName","ReactGridLayout");ve(yn,"propTypes",ul.default);ve(yn,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:z.noop,onDragStart:z.noop,onDrag:z.noop,onDragStop:z.noop,onResizeStart:z.noop,onResize:z.noop,onResizeStop:z.noop,onDrop:z.noop,onDropDragOver:z.noop});var Cn={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.findOrGenerateResponsiveLayout=gl;nt.getBreakpointFromWidth=hl;nt.getColsFromBreakpoint=ml;nt.sortBreakpoints=wr;var kt=k;function hl(e,t){const n=wr(e);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];t>e[a]&&(r=a)}return r}function ml(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function gl(e,t,n,r,o,i){if(e[n])return(0,kt.cloneLayout)(e[n]);let a=e[r];const c=wr(t),l=c.slice(c.indexOf(n));for(let d=0,f=l.length;d<f;d++){const m=l[d];if(e[m]){a=e[m];break}}return a=(0,kt.cloneLayout)(a||[]),(0,kt.compact)((0,kt.correctBounds)(a,{cols:o}),i,o)}function wr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=void 0;var Kr=yl(x),be=oi(qe),jn=lr,ft=k,Ge=nt,vl=oi(Vt);function oi(e){return e&&e.__esModule?e:{default:e}}function ii(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ii=function(r){return r?n:t})(e)}function yl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ii(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Yn(){return Yn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yn.apply(this,arguments)}function tn(e,t,n){return t=Cl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cl(e){var t=Sl(e,"string");return typeof t=="symbol"?t:String(t)}function Sl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Zr=e=>Object.prototype.toString.call(e);function qt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class xr extends Kr.Component{constructor(){super(...arguments),tn(this,"state",this.generateInitialState()),tn(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Ge.getBreakpointFromWidth)(n,t),a=(0,Ge.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Ge.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(t,n){if(!(0,jn.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Ge.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,jn.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,jn.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Ge.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Ge.getColsFromBreakpoint)(a,r),d={...o};if(c!==a||t.breakpoints!==n||t.cols!==r){c in d||(d[c]=(0,ft.cloneLayout)(this.state.layout));let h=(0,Ge.findOrGenerateResponsiveLayout)(d,n,a,c,l,i);h=(0,ft.synchronizeLayoutWithChildren)(h,this.props.children,l,i,this.props.allowOverlap),d[a]=h,this.props.onLayoutChange(h,d),this.props.onBreakpointChange(a,l),this.setState({breakpoint:a,layout:h,cols:l})}const f=qt(this.props.margin,a),m=qt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,f,l,m)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:l,onWidthChange:d,...f}=this.props;return Kr.createElement(vl.default,Yn({},f,{margin:qt(i,this.state.breakpoint),containerPadding:qt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}Cn.default=xr;tn(xr,"propTypes",{breakpoint:be.default.string,breakpoints:be.default.object,allowOverlap:be.default.bool,cols:be.default.object,margin:be.default.oneOfType([be.default.array,be.default.object]),containerPadding:be.default.oneOfType([be.default.array,be.default.object]),layouts(e,t){if(Zr(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+Zr(e[t]));Object.keys(e[t]).forEach(n=>{if(!(n in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,ft.validateLayout)(e.layouts[n],"layouts."+n)})},width:be.default.number.isRequired,onBreakpointChange:be.default.func,onLayoutChange:be.default.func,onWidthChange:be.default.func});tn(xr,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:ft.noop,onLayoutChange:ft.noop,onWidthChange:ft.noop});var Or={},ai=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},t}()}(),Kn=typeof window<"u"&&typeof document<"u"&&window.document===document,nn=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),bl=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(nn):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Rl=2;function _l(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function a(){bl(i)}function c(){var l=Date.now();if(n){if(l-o<Rl)return;r=!0}else n=!0,r=!1,setTimeout(a,t);o=l}return c}var Tl=20,Il=["top","right","bottom","left","width","height","size","weight"],wl=typeof MutationObserver<"u",xl=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=_l(this.refresh.bind(this),Tl)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Kn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),wl?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Kn||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=Il.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),si=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},mt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||nn},li=Sn(0,0,0,0);function rn(e){return parseFloat(e)||0}function Jr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+rn(i)},0)}function Ol(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],a=e["padding-"+i];n[i]=rn(a)}return n}function El(e){var t=e.getBBox();return Sn(0,0,t.width,t.height)}function Dl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return li;var r=mt(e).getComputedStyle(e),o=Ol(r),i=o.left+o.right,a=o.top+o.bottom,c=rn(r.width),l=rn(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=Jr(r,"left","right")+i),Math.round(l+a)!==n&&(l-=Jr(r,"top","bottom")+a)),!Ml(e)){var d=Math.round(c+i)-t,f=Math.round(l+a)-n;Math.abs(d)!==1&&(c-=d),Math.abs(f)!==1&&(l-=f)}return Sn(o.left,o.top,c,l)}var Pl=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof mt(e).SVGGraphicsElement}:function(e){return e instanceof mt(e).SVGElement&&typeof e.getBBox=="function"}}();function Ml(e){return e===mt(e).document.documentElement}function Fl(e){return Kn?Pl(e)?El(e):Dl(e):li}function Nl(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return si(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function Sn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var jl=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Sn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Fl(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),$l=function(){function e(t,n){var r=Nl(n);si(this,{target:t,contentRect:r})}return e}(),Ll=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new ai,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof mt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new jl(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof mt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new $l(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),ci=typeof WeakMap<"u"?new WeakMap:new ai,ui=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=xl.getInstance(),r=new Ll(t,n,this);ci.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){ui.prototype[e]=function(){var t;return(t=ci.get(this))[e].apply(t,arguments)}});var Ul=function(){return typeof nn.ResizeObserver<"u"?nn.ResizeObserver:ui}();const Vl=Object.freeze(Object.defineProperty({__proto__:null,default:Ul},Symbol.toStringTag,{value:"Module"})),zl=Ui(Vl);Object.defineProperty(Or,"__esModule",{value:!0});Or.default=Xl;var Bt=kl(x),Al=Er(qe),Hl=Er(zl),Wl=Er(ke);function Er(e){return e&&e.__esModule?e:{default:e}}function di(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(di=function(r){return r?n:t})(e)}function kl(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=di(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function st(e,t,n){return t=ql(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ql(e){var t=Bl(e,"string");return typeof t=="symbol"?t:String(t)}function Bl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Gl="react-grid-layout";function Xl(e){var t;return t=class extends Bt.Component{constructor(){super(...arguments),st(this,"state",{width:1280}),st(this,"elementRef",Bt.createRef()),st(this,"mounted",!1),st(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Hl.default(o=>{if(this.elementRef.current instanceof HTMLElement){const a=o[0].contentRect.width;this.setState({width:a})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?Bt.createElement("div",{className:(0,Wl.default)(this.props.className,Gl),style:this.props.style,ref:this.elementRef}):Bt.createElement(e,Zn({innerRef:this.elementRef},o,this.state))}},st(t,"defaultProps",{measureBeforeMount:!1}),st(t,"propTypes",{measureBeforeMount:Al.default.bool}),t}(function(e){e.exports=Vt.default,e.exports.utils=k,e.exports.calculateUtils=je,e.exports.Responsive=Cn.default,e.exports.Responsive.utils=nt,e.exports.WidthProvider=Or.default})(wo);var Yl=wo.exports;const Kl=sr(Yl),Nt={type:u.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,cfId:t.cfId},d=s.DeleteConditionalRuleMutationUndoFactory(e,l),f=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return f&&n.pushUndoRedo({unitID:a,undoMutations:d,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),f}},bn={type:u.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=L.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,d=s.transformSupportSymmetryAnchor(t.start,t.end,i.getSubunitRules(c,l)||[],R=>R.cfId);if(!d)return!1;const[f,m]=d,h={unitId:c,subUnitId:l,start:f,end:m},v=s.MoveConditionalRuleMutationUndoFactory(h),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,h);return y&&n.pushUndoRedo({unitID:c,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:h}],undoMutations:v}),y}},Zl="univer-cf-preview",Gt={cfPreview:Zl},vt=e=>{var o,i;const t=e.rule;if(!t)return null;const n=x.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const a=t.config.map((d,f)=>({color:new u.ColorKit(d.color),value:f})),c=a.length-1;return new Array(5).fill("").map((d,f,m)=>f*c/(m.length-1)).map(d=>s.getColorScaleFromValue(a,d))}return null},[t]),r=x.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(a=>{const c=s.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:a}=t.config,c={width:"50%",height:"100%"},l=a?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,d=a?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return p.jsxs("div",{className:Gt.cfPreview,children:[p.jsx("div",{style:{...c,background:d,border:`1px solid ${t.config.nativeColor}`}}),p.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&p.jsx("div",{className:Gt.cfPreview,children:n.map((a,c)=>p.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case s.CFRuleType.iconSet:return r&&p.jsx("div",{className:Gt.cfPreview,children:r.map((a,c)=>a?p.jsx("img",{style:{height:"100%"},src:a},c):p.jsx(Ut,{},c))});case s.CFRuleType.highlightCell:{const{ul:a,st:c,it:l,bl:d,bg:f,cl:m}=t.style,h=(a==null?void 0:a.s)===u.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===u.BooleanNumber.TRUE,y=l===u.BooleanNumber.TRUE,R=d===u.BooleanNumber.TRUE,E=(o=f==null?void 0:f.rgb)!=null?o:s.DEFAULT_BG_COLOR,S=(i=m==null?void 0:m.rgb)!=null?i:s.DEFAULT_FONT_COLOR,I={fontWeight:R?"bold":void 0,fontStyle:y?"italic":void 0,textDecoration:`${h?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:E,color:S};return p.jsx("div",{style:I,className:Gt.cfPreview,children:"123"})}}return null};var Jl=Object.defineProperty,Ql=Object.getOwnPropertyDescriptor,ec=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ql(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Jl(t,n,o),o},tc=(e,t)=>(n,r)=>t(n,r,e);let pt=class extends u.Disposable{constructor(t){super();St(this,"_initLocal",()=>{});St(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,l,d)=>{const f=d[l-1]||{startIndex:0,endIndex:-1};if(f.endIndex+1<c.startIndex){const m=i.slice(f.endIndex+1,c.startIndex);m&&a.push(m)}if(n[c.key]&&a.push(n[c.key]),l===d.length-1){const m=i.slice(c.endIndex+1);m&&a.push(m)}}),a}return[]}};pt=ec([u.OnLifecycle(u.LifecycleStages.Rendered,pt),tc(0,u.Inject(u.LocaleService))],pt);const nc="univer-cf-rule-list",rc="univer-rule-selector",oc="univer-select",ic="univer-select-selector",ac="univer-select-selection-item",sc="univer-select-selection-search-input",lc="univer-btn-list",cc="univer-gap",uc="univer-icon",dc="univer-disabled",fc="univer-rule-item",pc="univer-rule-describe",hc="univer-rule-type",mc="univer-rule-range",gc="univer-active",vc="univer-draggableHandle",yc="univer-delete-item",Cc="univer-grid-layout-wrap",Sc="univer-react-grid-item",ce={cfRuleList:nc,ruleSelector:rc,select:oc,selectSelector:ic,selectSelectionItem:ac,selectSelectionSearchInput:sc,btnList:lc,gap:cc,icon:uc,disabled:dc,ruleItem:fc,ruleDescribe:pc,ruleType:hc,ruleRange:mc,active:gc,draggableHandle:vc,deleteItem:yc,gridLayoutWrap:Cc,reactGridItem:Sc},bc=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let Qr=0;const Rc=e=>{const{onClick:t}=e,n=u.useDependency(s.ConditionalFormattingRuleModel),r=u.useDependency(u.IUniverInstanceService),o=u.useDependency(L.SheetsSelectionsService),i=u.useDependency(u.ICommandService),a=u.useDependency(u.LocaleService),c=u.useDependency(pt),l=fe.useObservable(()=>r.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),d=l.getUnitId(),f=l.getActiveSheet();if(!f)throw new Error("No active sheet found");const m=f.getSheetId(),[h,v]=x.useState([]),[y,R]=x.useState("2"),[E,S]=x.useState(0),[I,_]=x.useState(-1),[w,g]=x.useState(Qr),O=x.useRef(null),T=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],b=()=>{const V=n.getSubunitRules(d,m);if(!V||!V.length)return[];if(y==="1"){const Y=o.getCurrentLastSelection();if(!Y)return[];const ee=Y.range;return V.filter(se=>se.ranges.some(ue=>u.Rectangle.intersects(ue,ee)))}else if(y==="2")return V;return[]},M=V=>{const ee=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return V.map(se=>{const ue=se.ranges;return(ue==null?void 0:ue.some(Oe=>{var B,te;const{startRow:F,startColumn:U,endRow:G,endColumn:X}=Oe;for(let oe=F;oe<=G;oe++)for(let me=U;me<=X;me++){const J=(te=(B=ee==null?void 0:ee.getCell(oe,me))==null?void 0:B.selectionProtection)==null?void 0:te[0];if((J==null?void 0:J[Ft.Edit])===!1||(J==null?void 0:J[Ft.View])===!1)return!0}return!1}))?{...se,disable:!0}:{...se}})},[N,$]=x.useState(b);le.useHighlightRange(h),x.useEffect(()=>{const V=i.onCommandExecuted(Y=>{Y.id===L.SetWorksheetActiveOperation.id&&S(Math.random())});return()=>V.dispose()}),x.useEffect(()=>{$(b)},[y,E,d,m]),x.useEffect(()=>{if(y==="2")return;const V=new De.Observable(Y=>{const ee=[L.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],re=i.onCommandExecuted(se=>{const{id:ue,params:Ie}=se,Oe=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId();ee.includes(ue)&&Ie.unitId===Oe&&Y.next(null)});return()=>re.dispose()}).pipe(De.debounceTime(16)).subscribe(()=>{$(b)});return()=>{V.unsubscribe()}},[r,y,d,m]),x.useEffect(()=>{const V=n.$ruleChange.subscribe(()=>{S(Math.random())});return()=>V.unsubscribe()},[n]),x.useEffect(()=>{const V=()=>{var se;const re=Math.max(0,(((se=O.current)==null?void 0:se.getBoundingClientRect().width)||0)-8);return Qr=re,re},ee=new De.Observable(re=>{const se=document.querySelector(".univer-sidebar");if(se){let ue=setTimeout(()=>{re.next()},150);const Ie=()=>{ue&&clearTimeout(ue),ue=null},Oe=F=>{F.propertyName==="width"&&(Ie(),re.next())};return se.addEventListener("transitionend",Oe),()=>{Ie(),se.removeEventListener("transitionend",Oe)}}}).pipe(De.debounceTime(16)).subscribe(()=>{g(V())});return()=>{ee.unsubscribe()}},[]);const A=V=>{var re;const Y=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),ee=(re=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:re.getSheetId();if(!Y||!ee)throw new Error("No active sheet found");i.executeCommand(Nt.id,{unitId:Y,subUnitId:ee,cfId:V.cfId})},C=(V,Y)=>{_(Y.y)},D=(V,Y,ee)=>{var F;_(-1);const re=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),se=(F=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:F.getSheetId();if(!re||!se)throw new Error("No active sheet found");const ue=U=>{const G=N.length;return Math.min(G-1,Math.max(0,U))},Ie=N[ue(Y.y)].cfId,Oe=N[ue(ee.y)].cfId;Ie!==Oe&&i.executeCommand(bn.id,{unitId:re,subUnitId:se,start:{id:Ie,type:"self"},end:{id:Oe,type:ee.y>Y.y?"after":"before"}})},Z=()=>{e.onCreate()},Ce=()=>{y==="2"?i.executeCommand(Lt.id):y==="1"&&N.map(Y=>({unitId:d,subUnitId:m,cfId:Y.cfId})).forEach(Y=>{i.executeCommand(Nt.id,Y)})},pe=N.map((V,Y)=>({i:V.cfId,x:0,w:12,y:Y,h:1,isResizable:!1})),he=M(N),xe=he==null?void 0:he.some(V=>V.disable);return p.jsxs("div",{className:ce.cfRuleList,children:[p.jsxs("div",{className:ce.ruleSelector,children:[p.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",p.jsx(q.Select,{className:ce.select,options:T,value:y,onChange:V=>{R(V)}})).map((V,Y)=>p.jsx("span",{children:V},Y))}),p.jsxs("div",{className:ce.btnList,children:[p.jsx(q.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:p.jsx("div",{className:`${ce.icon}`,onClick:Z,children:p.jsx(To,{})})}),N.length&&!xe?p.jsx(q.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:p.jsx("div",{className:`${ce.gap} ${ce.icon}`,onClick:Ce,children:p.jsx(Zt,{})})}):p.jsx("div",{className:`${ce.gap} ${ce.disabled}`,children:p.jsx(Zt,{})})]})]}),p.jsx("div",{ref:O,className:ce.gridLayoutWrap,children:w?p.jsx(Kl,{onDragStop:D,onDragStart:C,layout:pe,cols:12,rowHeight:60,width:w,margin:[0,10],draggableHandle:".draggableHandle",children:he==null?void 0:he.map((V,Y)=>p.jsx("div",{children:p.jsxs("div",{onMouseMove:()=>{V.ranges!==h&&v(V.ranges)},onMouseLeave:()=>v([]),onClick:()=>{V.disable||t(V)},className:`${ce.ruleItem} ${I===Y?ce.active:""}`,children:[p.jsx("div",{className:`${ce.draggableHandle} draggableHandle`,onClick:ee=>ee.stopPropagation(),children:p.jsx(Io,{})}),p.jsxs("div",{className:ce.ruleDescribe,children:[p.jsx("div",{className:ce.ruleType,children:bc(V,a)}),p.jsx("div",{className:ce.ruleRange,children:V.ranges.map(ee=>Co.serializeRange(ee)).join(",")})]}),p.jsx("div",{className:ce.preview,children:p.jsx(vt,{rule:V.rule})}),!V.disable&&p.jsx("div",{className:`${ce.deleteItem} ${I===Y?ce.active:""}`,onClick:ee=>{ee.stopPropagation(),A(V)},children:p.jsx(Zt,{})})]})},`${V.cfId}`))}):null})]})},Ht={type:u.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(u.IUndoRedoService),o=e.get(u.ICommandService),i=e.get(s.ConditionalFormattingRuleModel),a=e.get(u.IUniverInstanceService),c=L.getSheetCommandTarget(a);if(!c)return!1;const{unitId:l,subUnitId:d}=c,f=i.createCfId(l,d),m={unitId:l,subUnitId:d,rule:{...n,cfId:n.cfId||f}},h=s.AddConditionalRuleMutationUndoFactory(e,m),v=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,m);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:m}],undoMutations:[h]}),v}},Rn={type:u.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(u.IUndoRedoService),r=e.get(u.ICommandService),o=e.get(u.IUniverInstanceService),i=L.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,rule:t.rule},d=s.setConditionalRuleMutationUndoFactory(e,l),f=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return f&&n.pushUndoRedo({unitID:a,undoMutations:d,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),f}},_c=u.createInterceptorKey("beforeSubmit"),Tc=u.createInterceptorKey("submit"),Ic="univer-cf-color-picker",wc="univer-cf-color-picker-icon",xc="univer-icon-dropdown",$n={cfColorPicker:Ic,cfColorPickerIcon:wc,iconDropdown:xc},Je=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=e,c=u.useDependency(fe.ComponentManager),l=x.useMemo(()=>new u.ColorKit(t),[t]),d=c.get(o);return d&&(r?p.jsx(d,{className:i,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):p.jsx(q.Dropdown,{overlay:p.jsx("div",{className:`${$n.cfColorPicker} `,children:p.jsx(q.ColorPicker,{color:t,onChange:n})}),children:p.jsxs("span",{className:`${$n.cfColorPickerIcon} ${i}`,children:[p.jsx(d,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),a&&p.jsx(ln,{className:$n.iconDropdown})]})}))},Oc="univer-cf-rule-style-editor",Ec="univer-cf-preview-wrap",Dc="univer-text",Pc="univer-position-relative",Mc="univer-btn-list",Fc="univer-util-item",Nc="univer-icon-set",jc="univer-render-config",$c="univer-flex",Lc="univer-width45",Uc="univer-icon-wrap",Vc="univer-icon",zc="univer-dropdown-icon",Ac="univer-error-input",Hc="univer-error-text",Wc="univer-icon-group-list",kc="univer-title",qc="univer-group",Bc="univer-item-content",Gc="univer-item-wrap",Xc="univer-item",Yc="univer-icon-item-list-wrap",Kc="univer-none",Zc="univer-icon-item-list",Jc="univer-width100",Qc="univer-stress",j={cfRuleStyleEditor:Oc,cfPreviewWrap:Ec,text:Dc,positionRelative:Pc,btnList:Mc,utilItem:Fc,iconSet:Nc,renderConfig:jc,flex:$c,width45:Lc,iconWrap:Uc,icon:Vc,dropdownIcon:zc,errorInput:Ac,errorText:Hc,iconGroupList:Wc,title:kc,group:qc,itemContent:Bc,itemWrap:Gc,item:Xc,iconItemListWrap:Yc,none:Kc,iconItemList:Zc,width100:Jc,stress:Qc},Xe=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Ln=e=>{var m;const{type:t,className:n,onChange:r,id:o,value:i}=e,a=u.useDependency(u.IUniverInstanceService),c=a.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(m=a.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),d=x.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),f=x.useMemo(()=>[s.CFValueType.max,s.CFValueType.min,"none"].includes(t)?{disabled:!0}:[s.CFValueType.percent,s.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]);return t===s.CFValueType.formula?p.jsx(fe.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`),value:d,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(h="")=>{r(h||"")}}):p.jsx(q.InputNumber,{className:n,value:Number(e.value)||0,onChange:h=>e.onChange(h||0),...f})},eu=e=>{var A;const{interceptorManager:t}=e,n=u.useDependency(u.LocaleService),r=((A=e.rule)==null?void 0:A.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Xe(s.CFValueType.num,n),Xe(s.CFValueType.percent,n),Xe(s.CFValueType.percentile,n),Xe(s.CFValueType.formula,n)],i=[Xe(s.CFValueType.min,n),...o],a=[Xe("none",n),...o],c=[Xe(s.CFValueType.max,n),...o],[l,d]=x.useState(()=>{var D;const C=s.CFValueType.min;return r&&((D=r.config[0])==null?void 0:D.value.type)||C}),[f,m]=x.useState(()=>{var D;const C="none";return!r||r.config.length!==3?C:((D=r.config[1])==null?void 0:D.value.type)||C}),[h,v]=x.useState(()=>{var D;const C=s.CFValueType.max;return r&&((D=r.config[r.config.length-1])==null?void 0:D.value.type)||C}),[y,R]=x.useState(()=>{if(!r)return 10;const D=r.config[0];return(D==null?void 0:D.value.value)===void 0?10:D==null?void 0:D.value.value}),[E,S]=x.useState(()=>{var Z;if(!r||r.config.length!==3)return 50;const D=(Z=r.config[1])==null?void 0:Z.value.value;return D===void 0?50:D}),[I,_]=x.useState(()=>{var Z;if(!r)return 90;const D=(Z=r.config[r.config.length-1])==null?void 0:Z.value.value;return D===void 0?90:D}),[w,g]=x.useState(()=>{var D;const C="#d0d9fb";return r&&((D=r.config[0])==null?void 0:D.color)||C}),[O,T]=x.useState(()=>{var D;const C="#7790f3";return!r||r.config.length!==3?C:((D=r.config[1])==null?void 0:D.color)||C}),[b,M]=x.useState(()=>{var D;const C="#2e55ef";return r&&((D=r.config[r.config.length-1])==null?void 0:D.color)||C}),N=x.useMemo(()=>C=>{const{minType:D,medianType:Z,maxType:Ce,minValue:pe,medianValue:he,maxValue:xe,minColor:V,medianColor:Y,maxColor:ee}=C,re=[];return re.push({color:V,value:{type:D,value:pe}}),Z!=="none"&&re.push({color:Y,value:{type:Z,value:he}}),re.push({color:ee,value:{type:Ce,value:xe}}),{config:re.map((ue,Ie)=>({...ue,index:Ie})),type:s.CFRuleType.colorScale}},[]);x.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return N({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:I,minColor:w,medianColor:O,maxColor:b})}}),[N,l,f,h,y,E,I,w,O,b,t]);const $=C=>{e.onChange(N(C))};return p.jsxs("div",{children:[p.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${j.cfPreviewWrap}`,children:p.jsx(vt,{rule:N({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:I,minColor:w,medianColor:O,maxColor:b})})}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:i,value:l,onChange:C=>{d(C);const D=s.createDefaultValueByValueType(C,10);R(D),$({minType:C,medianType:f,maxType:h,minValue:D,medianValue:E,maxValue:I,minColor:w,medianColor:O,maxColor:b})}}),p.jsx(Ln,{id:"min",className:`${P.mLXxs}`,value:y,type:l,onChange:C=>{R(C),$({minType:l,medianType:f,maxType:h,minValue:C,medianValue:E,maxValue:I,minColor:w,medianColor:O,maxColor:b})}}),p.jsx(Je,{className:P.mLXxs,color:w,onChange:C=>{g(C),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:I,minColor:C,medianColor:O,maxColor:b})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.medianValue")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:a,value:f,onChange:C=>{m(C);const D=s.createDefaultValueByValueType(C,50);S(D),$({minType:l,medianType:C,maxType:h,minValue:y,medianValue:D,maxValue:I,minColor:w,medianColor:O,maxColor:b})}}),p.jsx(Ln,{id:"median",className:` ${P.mLXxs}`,value:E,type:f,onChange:C=>{S(C),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:C,maxValue:I,minColor:w,medianColor:O,maxColor:b})}}),f!=="none"&&p.jsx(Je,{className:P.mLXxs,color:O,onChange:C=>{T(C),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:I,minColor:w,medianColor:C,maxColor:b})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.Select,{options:c,value:h,onChange:C=>{v(C);const D=s.createDefaultValueByValueType(C,90);_(D),$({minType:l,medianType:f,maxType:C,minValue:y,medianValue:E,maxValue:D,minColor:w,medianColor:O,maxColor:b})}}),p.jsx(Ln,{id:"max",className:`${P.mLXxs}`,value:I,type:h,onChange:C=>{_(C),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:C,minColor:w,medianColor:O,maxColor:b})}}),p.jsx(Je,{className:P.mLXxs,color:b,onChange:C=>{M(C),$({minType:l,medianType:f,maxType:h,minValue:y,medianValue:E,maxValue:I,minColor:w,medianColor:O,maxColor:C})}})]})]})},lt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),eo=e=>{var h;const{onChange:t,className:n,value:r,type:o,id:i,disabled:a=!1}=e,c=u.useDependency(u.IUniverInstanceService),l=c.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(h=c.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:h.getSheetId(),f=x.useRef(r),m=x.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const v=String(f.current).startsWith("=")?String(f.current)||"":"=";return p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${i}`),value:v,openForSheetSubUnitId:d,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(y="")=>{t(y||"")}})}return p.jsx(q.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:v=>{t(v||0)},...m})},tu=e=>{var A;const{interceptorManager:t}=e,n=u.useDependency(u.LocaleService),r=((A=e.rule)==null?void 0:A.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,i]=x.useState(()=>{var D;const C="0";return r?(D=r.config)!=null&&D.isGradient?"1":"0":C}),[a,c]=x.useState(()=>{var D;const C="#abd91a";return r&&((D=r.config)==null?void 0:D.positiveColor)||C}),[l,d]=x.useState(()=>{var D;const C="#ffbe38";return r&&((D=r.config)==null?void 0:D.nativeColor)||C}),f=[lt(s.CFValueType.num,n),lt(s.CFValueType.percent,n),lt(s.CFValueType.percentile,n),lt(s.CFValueType.formula,n)],m=[lt(s.CFValueType.min,n),...f],h=[lt(s.CFValueType.max,n),...f],[v,y]=x.useState(()=>{var D;const C=m[0].value;return r&&((D=r.config)==null?void 0:D.min.type)||C}),[R,E]=x.useState(()=>{var D;const C=h[0].value;return r&&((D=r.config)==null?void 0:D.max.type)||C}),[S,I]=x.useState(()=>{var Z;if(!r)return 0;const D=((Z=r.config)==null?void 0:Z.min)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value||0}),[_,w]=x.useState(()=>{var Z;if(!r)return 100;const D=((Z=r.config)==null?void 0:Z.max)||{};return D.type===s.CFValueType.formula?D.value||"=":D.value===void 0?100:D.value}),[g,O]=x.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),T=C=>({config:{min:{type:C.minValueType,value:C.minValue},max:{type:C.maxValueType,value:C.maxValue},isGradient:C.isGradient==="1",positiveColor:C.positiveColor,nativeColor:C.nativeColor},type:s.CFRuleType.dataBar,isShowValue:C.isShowValue});x.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return T({isGradient:o,minValue:S,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}}),[o,S,v,_,R,a,l,t,g]);const b=C=>{e.onChange(T(C))},M=C=>{c(C),b({isGradient:o,minValue:S,minValueType:v,maxValue:_,maxValueType:R,positiveColor:C,nativeColor:l,isShowValue:g})},N=C=>{d(C),b({isGradient:o,minValue:S,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:C,isShowValue:g})},$=C=>f.map(D=>D.value).includes(C);return p.jsxs("div",{children:[p.jsx("div",{className:P.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${j.cfPreviewWrap}`,children:p.jsx(vt,{rule:T({isGradient:o,minValue:S,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})})}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.fillType")}),p.jsxs("div",{className:`${P.mTSm} ${P.mLXxs} ${P.labelContainer} `,children:[p.jsxs(q.RadioGroup,{value:o,onChange:C=>{i(C),b({isGradient:C,minValue:S,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})},children:[p.jsx(q.Radio,{value:"0",children:p.jsx("span",{className:j.text,children:n.t("sheet.cf.panel.pureColor")})}),p.jsx(q.Radio,{value:"1",children:p.jsx("span",{className:j.text,children:n.t("sheet.cf.panel.gradient")})})]}),p.jsxs("div",{className:`${j.utilItem} ${P.mLXl}`,children:[p.jsx(q.Checkbox,{checked:!g,onChange:C=>{O(!C),b({isGradient:C,minValue:S,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:!C})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.panel.colorSet")}),p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm} ${P.mLXxs}`,children:[p.jsxs("div",{className:`${P.labelContainer}`,children:[p.jsx("div",{className:`${j.text}`,children:n.t("sheet.cf.panel.native")}),p.jsx(Je,{color:l,onChange:N})]}),p.jsxs("div",{className:`${P.labelContainer} ${P.mLSm} `,children:[p.jsx("div",{className:`${j.text} `,children:n.t("sheet.cf.panel.positive")}),p.jsx(Je,{color:a,onChange:M})]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[p.jsx(q.Select,{options:m,value:v,onChange:C=>{y(C);const D=s.createDefaultValueByValueType(C,10);I(D),b({isGradient:o,minValue:D,minValueType:C,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}}),p.jsx(eo,{disabled:!$(v),id:"min",type:v,className:P.mLSm,value:S,onChange:C=>{I(C||0),b({isGradient:o,minValue:C||0,minValueType:v,maxValue:_,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}})]}),p.jsx("div",{className:P.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer}`,children:[p.jsx(q.Select,{options:h,value:R,onChange:C=>{E(C);const D=s.createDefaultValueByValueType(C,90);w(D),b({isGradient:o,minValue:S,minValueType:v,maxValue:D,maxValueType:C,positiveColor:a,nativeColor:l,isShowValue:g})}}),p.jsx(eo,{disabled:!$(R),id:"max",type:R,className:P.mLSm,value:_,onChange:C=>{w(C||0),b({isGradient:o,minValue:S,minValueType:v,maxValue:C||0,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:g})}})]})]})]})},nu="univer-cf-style-edit",ru="univer-button-item",ou="univer-isActive",Ue={cfStyleEdit:nu,buttonItem:ru,isActive:ou},Xt=e=>[u.BooleanNumber.FALSE,void 0].includes(e)?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE,Yt=e=>e!==u.BooleanNumber.FALSE,Dr=e=>{const{style:t,onChange:n,className:r}=e,o=u.useDependency(fe.ComponentManager),[i,a]=x.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=x.useState(()=>{if(t!=null&&t.it)return t.it}),[d,f]=x.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[m,h]=x.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,y]=x.useState(()=>{var O;const g="#2f56ef";return(O=t==null?void 0:t.cl)!=null&&O.rgb?t.cl.rgb:g}),[R,E]=x.useState(()=>{var O;const g="#e8ecfc";return(O=t==null?void 0:t.bg)!=null&&O.rgb?t.bg.rgb:g}),S=o.get("BoldSingle"),I=o.get("ItalicSingle"),_=o.get("UnderlineSingle"),w=o.get("StrikethroughSingle");return x.useEffect(()=>{const g={bl:i,it:c};v!==void 0&&(g.cl={rgb:v}),R!==void 0&&(g.bg={rgb:R}),m!==void 0&&(g.st={s:m}),d!==void 0&&(g.ul={s:d}),n(s.removeUndefinedAttr(g))},[i,c,d,m,v,R]),p.jsxs("div",{className:`${Ue.cfStyleEdit} ${r}`,children:[S&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(i||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>a(Xt(i)),children:p.jsx(S,{})}),I&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(c||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>l(Xt(c)),children:p.jsx(I,{})}),_&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(d||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>f(Xt(d)),children:p.jsx(_,{})}),w&&p.jsx("div",{className:ke({[Ue.isActive]:Yt(m||u.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>h(Xt(m)),children:p.jsx(w,{})}),p.jsx(Je,{color:v,onChange:y,iconId:"FontColor"}),p.jsx(Je,{color:R,onChange:E,iconId:"PaintBucket"})]})},iu=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=u.useDependency(u.LocaleService),o=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,i=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[a,c]=x.useState(()=>{const S=i[0].value,I=o==null?void 0:o.type;if(!o)return S;switch(I){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":S;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return S}),[l,d]=x.useState(()=>{const I=o==null?void 0:o.type;if(!o)return 10;switch(I){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[f,m]=x.useState(()=>{const I=o==null?void 0:o.type;if(!o)return!1;switch(I){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[h,v]=x.useState({}),y=S=>{const{type:I,isPercent:_,value:w,style:g}=S;if(I==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!1,value:w,style:g};if(I==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:_,isBottom:!0,value:w,style:g};if(I==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(I==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};x.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:a,isPercent:f,value:l,style:h})}}),[a,f,l,h,n]);const R=S=>{t(y(S))};return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(q.Select,{className:`${j.width100} ${P.mTSm}`,value:a,options:i,onChange:S=>{c(S),R({type:S,isPercent:f,value:l,style:h})}}),["isNotBottom","isBottom"].includes(a)&&p.jsxs("div",{className:`${P.labelContainer} ${P.mTSm}`,children:[p.jsx(q.InputNumber,{min:1,max:1e3,value:l,onChange:S=>{const I=S||0;d(I),R({type:a,isPercent:f,value:I,style:h})}}),p.jsxs("div",{className:`${P.mLSm} ${P.labelContainer} ${j.text}`,children:[p.jsx(q.Checkbox,{checked:f,onChange:S=>{m(!!S),R({type:a,isPercent:!!S,value:l,style:h})}}),r.t("sheet.cf.valueType.percent")]})]}),p.jsx("div",{className:`${j.cfPreviewWrap} `,children:p.jsx(vt,{rule:y({type:a,isPercent:f,value:l,style:h})})}),p.jsx(Dr,{style:o==null?void 0:o.style,className:`${P.mTSm} `,onChange:S=>{v(S),R({type:a,isPercent:f,value:l,style:S})}})]})},Ot=e=>p.jsxs("div",{style:{position:"relative"},children:[p.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:e.errorText}),e.children]}),Q=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),au=e=>{const{type:t,operator:n,onChange:r,value:o,interceptorManager:i}=e,a=u.useDependency(u.LocaleService),[c,l]=x.useState(()=>typeof o=="number"?o:0),[d,f]=x.useState(""),[m,h]=x.useState(()=>typeof o=="string"?o:""),[v,y]=x.useState(""),[R,E]=x.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[S,I]=x.useState(""),[_,w]=x.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[g,O]=x.useState("");switch(x.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(m);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(c),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([R,_]);break}}},[t]),x.useEffect(()=>{const T=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(b,M,N)=>{switch(t){case s.CFSubRuleType.text:return s.CFTextOperator.beginsWith,s.CFTextOperator.containsText,s.CFTextOperator.endsWith,s.CFTextOperator.notEqual,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,m?N(b):(y(a.t("sheet.cf.errorMessage.notBlank")),!1)}return N(b)}});return()=>{T()}},[t,c,m,R,_]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const T=b=>{h(b),r(b)};return p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:v,children:p.jsx(q.Input,{className:j.width100,value:m,onChange:b=>{y(""),T(b)}})})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const T=b=>{l(b||0),r(b||0),f("")};return p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:d,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:j.width100,value:c,onChange:T})})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const T=M=>{E(M||0),r([M||0,_]),I("")},b=M=>{w(M||0),r([R,M||0]),O("")};return p.jsxs("div",{className:`${P.mTSm} ${P.labelContainer} `,children:[p.jsx(Ot,{errorText:S,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:R,onChange:T})}),p.jsx(Ot,{errorText:g,children:p.jsx(q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${P.mLSm}`,value:_,onChange:b})})]})}}}return null},to=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[Q(s.CFTextOperator.containsText,t),Q(s.CFTextOperator.notContainsText,t),Q(s.CFTextOperator.beginsWith,t),Q(s.CFTextOperator.endsWith,t),Q(s.CFTextOperator.equal,t),Q(s.CFTextOperator.notEqual,t),Q(s.CFTextOperator.containsBlanks,t),Q(s.CFTextOperator.notContainsBlanks,t),Q(s.CFTextOperator.containsErrors,t),Q(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[Q(s.CFNumberOperator.between,t),Q(s.CFNumberOperator.notBetween,t),Q(s.CFNumberOperator.equal,t),Q(s.CFNumberOperator.notEqual,t),Q(s.CFNumberOperator.greaterThan,t),Q(s.CFNumberOperator.greaterThanOrEqual,t),Q(s.CFNumberOperator.lessThan,t),Q(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[Q(s.CFTimePeriodOperator.yesterday,t),Q(s.CFTimePeriodOperator.today,t),Q(s.CFTimePeriodOperator.tomorrow,t),Q(s.CFTimePeriodOperator.last7Days,t),Q(s.CFTimePeriodOperator.lastWeek,t),Q(s.CFTimePeriodOperator.thisWeek,t),Q(s.CFTimePeriodOperator.nextWeek,t),Q(s.CFTimePeriodOperator.lastMonth,t),Q(s.CFTimePeriodOperator.thisMonth,t),Q(s.CFTimePeriodOperator.nextMonth,t)]}},no=e=>{var w;const{interceptorManager:t,onChange:n}=e,r=u.useDependency(u.LocaleService),o=((w=e.rule)==null?void 0:w.type)===s.CFRuleType.highlightCell?e.rule:void 0,[i,a]=x.useState(()=>{const g=s.CFSubRuleType.text;return o&&o.subType||g}),c=[{value:s.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:s.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:s.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:s.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:s.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],l=x.useMemo(()=>to(i,r),[i]),[d,f]=x.useState(()=>{const g=l?l[0].value:void 0;return o&&o.operator||g}),[m,h]=x.useState(()=>{var T;const g="";return o?(T=o.value)!=null?T:s.createDefaultValue(o.subType,o.operator):g}),[v,y]=x.useState({}),R=x.useMemo(()=>g=>{var O,T,b,M,N,$,A,C,D,Z,Ce,pe,he,xe,V;switch(g.subType||i){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(d))return{type:s.CFRuleType.highlightCell,subType:(O=g.subType)!=null?O:i,operator:(T=g.operator)!=null?T:d,style:(b=g.style)!=null?b:v,value:(M=g.value)!=null?M:m};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(d))return{type:s.CFRuleType.highlightCell,subType:(N=g.subType)!=null?N:i,operator:($=g.operator)!=null?$:d,style:(A=g.style)!=null?A:v,value:(C=g.value)!=null?C:m};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(d))return{type:s.CFRuleType.highlightCell,subType:(D=g.subType)!=null?D:i,operator:(Z=g.operator)!=null?Z:d,style:(Ce=g.style)!=null?Ce:v,value:(pe=g.value)!=null?pe:m};break}}return{type:s.CFRuleType.highlightCell,subType:(he=g.subType)!=null?he:i,operator:(xe=g.operator)!=null?xe:d,style:(V=g.style)!=null?V:v}},[i,d,m,v]);x.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return R({})}}),[R,t]),x.useEffect(()=>{c.some(g=>g.value===i)||a(c[0].value)},[c]);const E=g=>{const O=g,T=to(O,r),b=T&&T[0].value;a(O),f(b),b&&h(s.createDefaultValue(O,b)),n(R({subType:O,operator:b}))},S=g=>{const O=g;f(O),n(R({operator:O}))},I=g=>{h(g),n(R({value:g}))},_=x.useMemo(()=>`${i}_${d}_${Math.random()}`,[i,d]);return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(q.Select,{className:`${P.mTSm} ${j.width100}`,onChange:E,value:i,options:c}),(l==null?void 0:l.length)&&p.jsx(q.Select,{className:`${P.mTSm} ${j.width100}`,onChange:S,value:d||"",options:l}),p.jsx(au,{value:m,interceptorManager:t,type:i,operator:d,rule:o,onChange:I},_),p.jsx("div",{className:`${j.cfPreviewWrap}`,children:p.jsx(vt,{rule:R({})})}),p.jsx(Dr,{style:o==null?void 0:o.style,className:`${P.mLXxs}`,onChange:g=>{y(g),n(R({style:g}))}})]})},su=e=>{var E;const{onChange:t,interceptorManager:n}=e,r=u.useDependency(u.LocaleService),i=u.useDependency(u.IUniverInstanceService).getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((E=e.rule)==null?void 0:E.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,d]=x.useState({}),[f,m]=x.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),[h,v]=x.useState(""),y=S=>({style:S.style,value:f,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});x.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({style:l,formula:f})}}),[l,f,n]),x.useEffect(()=>{n.intercept(n.getInterceptPoints().beforeSubmit,{handler:(S,I,_)=>!f||f.length===1||!h.startsWith("=")?(v(r.t("sheet.cf.errorMessage.formulaError")),!1):_(S)})},[f]);const R=S=>{t(y(S))};return p.jsxs("div",{children:[p.jsx("div",{className:`${P.title} ${P.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(Ot,{errorText:h,children:p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:a==null?void 0:a.getSheetId(),openForSheetUnitId:i.getUnitId(),value:f,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(S="")=>{const I=S||"";m(I),R({style:l,formula:I}),v("")}})})}),p.jsx("div",{className:`${j.cfPreviewWrap} `,children:p.jsx(vt,{rule:y({style:l,formula:f})})}),p.jsx(Dr,{style:c==null?void 0:c.style,className:`${P.mTSm} `,onChange:S=>{d(S),R({style:S,formula:f})}})]})};var lu="Expected a function",fi="__lodash_hash_undefined__",pi=1/0,cu=9007199254740991,uu="[object Function]",du="[object GeneratorFunction]",fu="[object Symbol]",pu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hu=/^\w*$/,mu=/^\./,gu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vu=/[\\^$.*+?()[\]{}|]/g,yu=/\\(\\)?/g,Cu=/^\[object .+?Constructor\]$/,Su=/^(?:0|[1-9]\d*)$/,bu=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,Ru=typeof self=="object"&&self&&self.Object===Object&&self,Pr=bu||Ru||Function("return this")();function _u(e,t){return e==null?void 0:e[t]}function Tu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Iu=Array.prototype,wu=Function.prototype,hi=Object.prototype,Un=Pr["__core-js_shared__"],ro=function(){var e=/[^.]+$/.exec(Un&&Un.keys&&Un.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),mi=wu.toString,_n=hi.hasOwnProperty,gi=hi.toString,xu=RegExp("^"+mi.call(_n).replace(vu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oo=Pr.Symbol,Ou=Iu.splice,Eu=vi(Pr,"Map"),jt=vi(Object,"create"),io=oo?oo.prototype:void 0,ao=io?io.toString:void 0;function Qe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Du(){this.__data__=jt?jt(null):{}}function Pu(e){return this.has(e)&&delete this.__data__[e]}function Mu(e){var t=this.__data__;if(jt){var n=t[e];return n===fi?void 0:n}return _n.call(t,e)?t[e]:void 0}function Fu(e){var t=this.__data__;return jt?t[e]!==void 0:_n.call(t,e)}function Nu(e,t){var n=this.__data__;return n[e]=jt&&t===void 0?fi:t,this}Qe.prototype.clear=Du;Qe.prototype.delete=Pu;Qe.prototype.get=Mu;Qe.prototype.has=Fu;Qe.prototype.set=Nu;function yt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ju(){this.__data__=[]}function $u(e){var t=this.__data__,n=Tn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ou.call(t,n,1),!0}function Lu(e){var t=this.__data__,n=Tn(t,e);return n<0?void 0:t[n][1]}function Uu(e){return Tn(this.__data__,e)>-1}function Vu(e,t){var n=this.__data__,r=Tn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}yt.prototype.clear=ju;yt.prototype.delete=$u;yt.prototype.get=Lu;yt.prototype.has=Uu;yt.prototype.set=Vu;function rt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zu(){this.__data__={hash:new Qe,map:new(Eu||yt),string:new Qe}}function Au(e){return In(this,e).delete(e)}function Hu(e){return In(this,e).get(e)}function Wu(e){return In(this,e).has(e)}function ku(e,t){return In(this,e).set(e,t),this}rt.prototype.clear=zu;rt.prototype.delete=Au;rt.prototype.get=Hu;rt.prototype.has=Wu;rt.prototype.set=ku;function qu(e,t,n){var r=e[t];(!(_n.call(e,t)&&yi(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function Tn(e,t){for(var n=e.length;n--;)if(yi(e[n][0],t))return n;return-1}function Bu(e){if(!on(e)||Qu(e))return!1;var t=rd(e)||Tu(e)?xu:Cu;return t.test(nd(e))}function Gu(e,t,n,r){if(!on(e))return e;t=Zu(t,e)?[t]:Yu(t);for(var o=-1,i=t.length,a=i-1,c=e;c!=null&&++o<i;){var l=td(t[o]),d=n;if(o!=a){var f=c[l];d=void 0,d===void 0&&(d=on(f)?f:Ku(t[o+1])?[]:{})}qu(c,l,d),c=c[l]}return e}function Xu(e){if(typeof e=="string")return e;if(Fr(e))return ao?ao.call(e):"";var t=e+"";return t=="0"&&1/e==-pi?"-0":t}function Yu(e){return Ci(e)?e:ed(e)}function In(e,t){var n=e.__data__;return Ju(t)?n[typeof t=="string"?"string":"hash"]:n.map}function vi(e,t){var n=_u(e,t);return Bu(n)?n:void 0}function Ku(e,t){return t=t==null?cu:t,!!t&&(typeof e=="number"||Su.test(e))&&e>-1&&e%1==0&&e<t}function Zu(e,t){if(Ci(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Fr(e)?!0:hu.test(e)||!pu.test(e)||t!=null&&e in Object(t)}function Ju(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Qu(e){return!!ro&&ro in e}var ed=Mr(function(e){e=id(e);var t=[];return mu.test(e)&&t.push(""),e.replace(gu,function(n,r,o,i){t.push(o?i.replace(yu,"$1"):r||n)}),t});function td(e){if(typeof e=="string"||Fr(e))return e;var t=e+"";return t=="0"&&1/e==-pi?"-0":t}function nd(e){if(e!=null){try{return mi.call(e)}catch{}try{return e+""}catch{}}return""}function Mr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(lu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(Mr.Cache||rt),n}Mr.Cache=rt;function yi(e,t){return e===t||e!==e&&t!==t}var Ci=Array.isArray;function rd(e){var t=on(e)?gi.call(e):"";return t==uu||t==du}function on(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function od(e){return!!e&&typeof e=="object"}function Fr(e){return typeof e=="symbol"||od(e)&&gi.call(e)==fu}function id(e){return e==null?"":Xu(e)}function ad(e,t,n){return e==null?e:Gu(e,t,n)}var sd=ad;const ld=sr(sd);var cd="Expected a function",Si="__lodash_hash_undefined__",bi=1/0,ud="[object Function]",dd="[object GeneratorFunction]",fd="[object Symbol]",pd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hd=/^\w*$/,md=/^\./,gd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vd=/[\\^$.*+?()[\]{}|]/g,yd=/\\(\\)?/g,Cd=/^\[object .+?Constructor\]$/,Sd=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,bd=typeof self=="object"&&self&&self.Object===Object&&self,Nr=Sd||bd||Function("return this")();function Rd(e,t){return e==null?void 0:e[t]}function _d(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Td=Array.prototype,Id=Function.prototype,Ri=Object.prototype,Vn=Nr["__core-js_shared__"],so=function(){var e=/[^.]+$/.exec(Vn&&Vn.keys&&Vn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),_i=Id.toString,jr=Ri.hasOwnProperty,Ti=Ri.toString,wd=RegExp("^"+_i.call(jr).replace(vd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Nr.Symbol,xd=Td.splice,Od=Ii(Nr,"Map"),$t=Ii(Object,"create"),co=lo?lo.prototype:void 0,uo=co?co.toString:void 0;function et(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ed(){this.__data__=$t?$t(null):{}}function Dd(e){return this.has(e)&&delete this.__data__[e]}function Pd(e){var t=this.__data__;if($t){var n=t[e];return n===Si?void 0:n}return jr.call(t,e)?t[e]:void 0}function Md(e){var t=this.__data__;return $t?t[e]!==void 0:jr.call(t,e)}function Fd(e,t){var n=this.__data__;return n[e]=$t&&t===void 0?Si:t,this}et.prototype.clear=Ed;et.prototype.delete=Dd;et.prototype.get=Pd;et.prototype.has=Md;et.prototype.set=Fd;function Ct(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Nd(){this.__data__=[]}function jd(e){var t=this.__data__,n=wn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():xd.call(t,n,1),!0}function $d(e){var t=this.__data__,n=wn(t,e);return n<0?void 0:t[n][1]}function Ld(e){return wn(this.__data__,e)>-1}function Ud(e,t){var n=this.__data__,r=wn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ct.prototype.clear=Nd;Ct.prototype.delete=jd;Ct.prototype.get=$d;Ct.prototype.has=Ld;Ct.prototype.set=Ud;function ot(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vd(){this.__data__={hash:new et,map:new(Od||Ct),string:new et}}function zd(e){return xn(this,e).delete(e)}function Ad(e){return xn(this,e).get(e)}function Hd(e){return xn(this,e).has(e)}function Wd(e,t){return xn(this,e).set(e,t),this}ot.prototype.clear=Vd;ot.prototype.delete=zd;ot.prototype.get=Ad;ot.prototype.has=Hd;ot.prototype.set=Wd;function wn(e,t){for(var n=e.length;n--;)if(ef(e[n][0],t))return n;return-1}function kd(e,t){t=Xd(t,e)?[t]:Gd(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Jd(t[n++])];return n&&n==r?e:void 0}function qd(e){if(!xi(e)||Kd(e))return!1;var t=tf(e)||_d(e)?wd:Cd;return t.test(Qd(e))}function Bd(e){if(typeof e=="string")return e;if(Lr(e))return uo?uo.call(e):"";var t=e+"";return t=="0"&&1/e==-bi?"-0":t}function Gd(e){return wi(e)?e:Zd(e)}function xn(e,t){var n=e.__data__;return Yd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ii(e,t){var n=Rd(e,t);return qd(n)?n:void 0}function Xd(e,t){if(wi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Lr(e)?!0:hd.test(e)||!pd.test(e)||t!=null&&e in Object(t)}function Yd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Kd(e){return!!so&&so in e}var Zd=$r(function(e){e=rf(e);var t=[];return md.test(e)&&t.push(""),e.replace(gd,function(n,r,o,i){t.push(o?i.replace(yd,"$1"):r||n)}),t});function Jd(e){if(typeof e=="string"||Lr(e))return e;var t=e+"";return t=="0"&&1/e==-bi?"-0":t}function Qd(e){if(e!=null){try{return _i.call(e)}catch{}try{return e+""}catch{}}return""}function $r(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(cd);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new($r.Cache||ot),n}$r.Cache=ot;function ef(e,t){return e===t||e!==e&&t!==t}var wi=Array.isArray;function tf(e){var t=xi(e)?Ti.call(e):"";return t==ud||t==dd}function xi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function nf(e){return!!e&&typeof e=="object"}function Lr(e){return typeof e=="symbol"||nf(e)&&Ti.call(e)==fd}function rf(e){return e==null?"":Bd(e)}function of(e,t,n){var r=e==null?void 0:kd(e,t);return r===void 0?n:r}var af=of;const sf=sr(af),Oi=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",lf=e=>{var i;const t=u.useDependency(u.IUniverInstanceService),n=t.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(i=t.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:i.getSheetId(),o=x.useMemo(()=>e.error?j.errorInput:"",[e.error]);return p.jsx("div",{className:j.positionRelative,children:e.type!==s.CFValueType.formula?p.jsxs(p.Fragment,{children:[p.jsx(q.InputNumber,{className:o,value:Number(e.value)||0,onChange:a=>e.onChange(a!=null?a:0)}),e.error&&p.jsx("div",{className:j.errorText,children:e.error})]}):p.jsx(fe.TextEditor,{id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`),value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(a="")=>{const c=a||"";e.onChange(c)}})})},fo=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),cf=x.forwardRef((e,t)=>{const n=u.useDependency(u.LocaleService),r=o=>{e.onClick(o)};return p.jsx("div",{ref:t,className:j.iconGroupList,children:s.iconGroup.map((o,i)=>p.jsxs("div",{className:j.group,children:[p.jsx("div",{className:j.title,children:n.t(o.title)}),p.jsx("div",{className:j.itemContent,children:o.group.map(a=>p.jsx("div",{className:j.itemWrap,onClick:()=>{r(a.name)},children:p.jsx("div",{className:j.item,children:a.list.map((c,l)=>p.jsx("img",{className:j.icon,src:c},l))})},a.name))})]},i))})}),uf=e=>{const t=x.useMemo(()=>{const r=[];for(const o in s.iconMap){const i=s.iconMap[o],a=o;i.forEach((c,l)=>{r.push({iconType:a,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return p.jsxs("div",{className:j.iconItemListWrap,children:[p.jsxs("div",{className:j.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[p.jsx(Ut,{className:j.icon}),p.jsx("span",{children:"无单元格图标"})]}),p.jsx("div",{className:j.iconItemList,children:t.map(r=>p.jsx("div",{className:j.item,children:p.jsx("img",{onClick:()=>n(r),className:`${j.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},df=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=u.useDependency(u.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(m,h)=>{t([String(h),"value","value"],m)},l=(m,h)=>{t([String(h),"operator"],m);const v=s.createDefaultValue(s.CFSubRuleType.number,m);c(v,h)},d=(m,h)=>{t([String(h),"value","type"],m)};return x.useMemo(()=>n.map((m,h)=>{const v=r[h],y=Oi(m.iconType,m.iconId),R=h===n.length-1,E=h===0,S=n[h-1],I=(S==null?void 0:S.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):S==null?void 0:S.value.value,_=(w,g)=>{const O={...m,iconId:g,iconType:w};t([String(h)],O)};return p.jsxs("div",{className:`${h?P.mTXl:P.mTSm}`,children:[p.jsxs("div",{className:`${P.label} ${j.flex}`,children:[p.jsxs("div",{className:`${j.width45}`,children:[o.t("sheet.cf.iconSet.icon"),h+1]}),p.jsx("div",{className:`${j.width45}`,children:p.jsxs(p.Fragment,{children:[!E&&!R&&o.t("sheet.cf.iconSet.rule"),!E&&!R&&p.jsxs("span",{className:j.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(S.operator)}`),I,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),p.jsxs("div",{className:`${j.flex} ${P.mTSm}`,children:[p.jsx("div",{className:`${j.iconWrap} ${j.width45}`,children:p.jsx(q.Dropdown,{overlay:p.jsx(uf,{onClick:_,iconId:m.iconId,iconType:m.iconType}),children:p.jsxs("div",{className:j.dropdownIcon,children:[y?p.jsx("img",{src:y,className:j.icon}):p.jsx(Ut,{className:j.icon}),p.jsx(ln,{})]})})}),R?p.jsxs("div",{className:`${j.width45} ${P.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),p.jsxs("span",{className:j.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(S.operator)}`),I,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):p.jsx(q.Select,{className:`${P.mL0} ${j.width45} ${P.mR0}`,options:i,value:m.operator,onChange:w=>{l(w,h)}})]}),R?p.jsx("div",{}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:`${P.mTSm} ${P.label} ${j.flex}`,children:[p.jsx("div",{className:`${j.width45}`,children:o.t("sheet.cf.iconSet.type")}),p.jsx("div",{className:`${j.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),p.jsxs("div",{className:`${P.mTSm} ${j.flex}`,children:[p.jsx(q.Select,{className:`${j.width45} ${P.mL0}`,options:a,value:m.value.type,onChange:w=>{d(w,h)}}),p.jsx("div",{className:`${P.mL0} ${j.width45}`,children:p.jsx(lf,{id:h,type:m.value.type,error:v,value:m.value.value||"",onChange:w=>c(w,h)})})]})]})]},h)}),[n,r])},ff=e=>{var w;const{interceptorManager:t}=e,n=((w=e.rule)==null?void 0:w.type)===s.CFRuleType.iconSet?e.rule:void 0,r=u.useDependency(u.LocaleService),[o,i]=x.useState({}),[a,c]=x.useState(()=>{const g=Object.keys(s.iconMap)[0];if(n&&n.config.length){const O=n.config[0].iconType;if(!n.config.some(b=>b.iconType!==O))return O}return g}),[l,d]=x.useState(()=>{if(n&&n.config.length)return u.Tools.deepClone(n==null?void 0:n.config);const g=s.iconMap[a]||[];return new Array(g.length).fill("").map((O,T,b)=>T===b.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(T)}:fo(a,T,b))}),[f,m]=x.useState(()=>n?!!n.isShowValue:!0),h=x.useMemo(()=>{const g=l.map(O=>Oi(O.iconType,O.iconId));return p.jsx("div",{className:j.iconWrap,children:g.map((O,T)=>O?p.jsx("img",{className:j.icon,src:O},T):p.jsx(Ut,{className:j.icon},T))})},[l]),v=g=>{if(g.reduce((T,b,M)=>T.preType&&!T.result||g.length-1===M?T:b.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:T.preType?{result:T.preType===b.value.type,preType:b.value.type}:{result:!0,preType:b.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(g[0].value.type)){const T={};return g.forEach((b,M,N)=>{if(M-1<0||M===N.length-1)return;const A=g[M-1],C=s.getOppositeOperator(A.operator);s.compareWithNumber({operator:C,value:A.value.value},b.value.value)||(T[M]=`${r.t(`sheet.cf.form.${C}`,String(A.value.value))} `)}),T}return{}},y=(g,O)=>{sf(l,g)!==O&&(ld(l,g,O),d([...l]),i(v(l)))},R=g=>{c(g);const O=s.iconMap[g]||[],T=new Array(O.length).fill("").map((b,M,N)=>fo(g,M,N));d(T),i(v(T))};x.useEffect(()=>{const g=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:f,config:l}}});return()=>{g()}},[f,l,t]),x.useEffect(()=>{const g=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{g()}},[f,l,t,o]);const E=()=>{const g=l.map(O=>({...O}));l.forEach((O,T)=>{const b=l.length-1-T,M=g[b];O.iconId=M.iconId,O.iconType=M.iconType}),d([...l])},S=u.useDependency(fe.ILayoutService),[I,_]=x.useState();return fe.useScrollYOverContainer(I,S.rootContainerElement),p.jsxs("div",{className:j.iconSet,children:[p.jsx("div",{className:P.title,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.mTSm}`,children:p.jsx(q.Dropdown,{placement:"bottomLeft",overlay:p.jsx(cf,{ref:g=>!I&&g&&_(g),iconType:a,onClick:R}),children:p.jsxs("div",{className:j.dropdownIcon,style:{width:"unset"},children:[h,p.jsx(ln,{})]})})}),p.jsxs("div",{className:`${P.mTSm} ${j.renderConfig}`,children:[p.jsxs("div",{className:j.utilItem,children:[p.jsx(q.Checkbox,{onChange:E}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),p.jsxs("div",{className:`${j.utilItem} ${P.mLXl}`,children:[p.jsx(q.Checkbox,{checked:!f,onChange:g=>{m(!g)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),p.jsx(df,{errorMap:o,onChange:y,configList:l})]})},po=e=>e.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),ho=e=>{var t;return(t=e.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},pf=e=>{var w,g,O;const t=u.useDependency(u.LocaleService),n=u.useDependency(u.ICommandService),r=u.useDependency(u.IUniverInstanceService),o=u.useDependency(s.ConditionalFormattingRuleModel),i=u.useDependency(L.SheetsSelectionsService),a=po(r),c=ho(r),l=x.useRef((g=(w=e.rule)==null?void 0:w.ranges)!=null?g:[]),d=x.useMemo(()=>{var b,M,N;let T=(b=e.rule)==null?void 0:b.ranges;return T!=null&&T.length||(T=(N=(M=i.getCurrentSelections())==null?void 0:M.map($=>$.range))!=null?N:[]),l.current=T,T!=null&&T.length?T.map($=>{const A=Co.serializeRange($);return A==="NaN"?"":A}).filter($=>!!$).join(","):""},[e.rule]),f=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[m,h]=x.useState(()=>{var M,N;const T=(M=e.rule)==null?void 0:M.rule.type,b=f[0].value;if(!T)return b;switch(T){case s.CFRuleType.highlightCell:{switch((N=e.rule)==null?void 0:N.rule.subType){case s.CFSubRuleType.number:case s.CFSubRuleType.text:case s.CFSubRuleType.duplicateValues:case s.CFSubRuleType.uniqueValues:case s.CFSubRuleType.timePeriod:return"1";case s.CFSubRuleType.average:case s.CFSubRuleType.rank:return"2";case s.CFSubRuleType.formula:return"5"}break}case s.CFRuleType.dataBar:return"3";case s.CFRuleType.colorScale:return"4";case s.CFRuleType.iconSet:return"6"}return b}),v=x.useRef(),y=x.useMemo(()=>new u.InterceptorManager({beforeSubmit:_c,submit:Tc}),[]),R=x.useMemo(()=>{switch(m){case"1":return no;case"2":return iu;case"3":return tu;case"4":return eu;case"5":return su;case"6":return ff;default:return no}},[m]);x.useEffect(()=>{const T=n.onCommandExecuted(b=>{if(b.id===L.RemoveSheetMutation.id){const M=b.params;M.subUnitId===c&&M.unitId===a&&e.onCancel()}b.id===L.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>T.dispose()},[]);const E=T=>{v.current=T},S=T=>{l.current=T.map(b=>b.range)},I=()=>{const b=(()=>{const N=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!N)throw new Error("No active sheet found");return l.current.map(C=>L.setEndForRange(C,N.getRowCount(),N.getColumnCount())).filter(C=>!(Number.isNaN(C.startRow)||Number.isNaN(C.startColumn)))})();if(y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null)){const N=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null);if(N){const $=po(r),A=ho(r);if(!$||!A)throw new Error("No active sheet found");let C={};e.rule&&e.rule.cfId?(C={...e.rule,ranges:b,rule:N},n.executeCommand(Rn.id,{unitId:$,subUnitId:A,rule:C}),e.onCancel()):(C={cfId:o.createCfId($,A),ranges:b,rule:N,stopIfTrue:!1},n.executeCommand(Ht.id,{unitId:$,subUnitId:A,rule:C}),e.onCancel())}}},_=()=>{e.onCancel()};return p.jsxs("div",{className:j.cfRuleStyleEditor,children:[p.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.range")}),p.jsx("div",{className:`${P.mTBase}`,children:p.jsx(fe.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:a,value:d,id:u.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:S})}),p.jsx("div",{className:P.title,children:t.t("sheet.cf.panel.styleType")}),p.jsx("div",{className:P.mTBase,children:p.jsx(q.Select,{className:j.width100,value:m,options:f,onChange:T=>h(T)})}),p.jsx(R,{interceptorManager:y,rule:(O=e.rule)==null?void 0:O.rule,onChange:E}),p.jsxs("div",{className:`${P.mTBase} ${j.btnList}`,children:[p.jsx(q.Button,{size:"small",onClick:_,children:t.t("sheet.cf.panel.cancel")}),p.jsx(q.Button,{className:P.mLSm,size:"small",type:"primary",onClick:I,children:t.t("sheet.cf.panel.submit")})]})]})},hf=e=>{const[t,n]=x.useState(e.rule),[r,o]=x.useState(!!e.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return p.jsx("div",{className:P.conditionalFormattingWrap,children:r?p.jsx(pf,{onCancel:a,rule:t}):p.jsx(Rc,{onClick:c,onCreate:i})})};var mf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,vf=(e,t,n,r)=>{for(var o=r>1?void 0:r?gf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&mf(t,n,o),o},ct=(e,t)=>(n,r)=>t(n,r,e);const Ei={},mo="sheet.conditional.formatting.panel";let ht=class extends u.Disposable{constructor(t,n,r,o,i,a,c){super();St(this,"_sidebarDisposable",null);this._config=t,this._univerInstanceService=n,this._injector=r,this._componentManager=o,this._menuService=i,this._sidebarService=a,this._localeService=c,this._initMenu(),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(u.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var d;l||(d=this._sidebarDisposable)==null||d.dispose()}))}openPanel(t){const n={header:{title:this._localeService.t("sheet.cf.title")},children:{label:mo,rule:t,key:u.Tools.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initMenu(){const{menu:t={}}=this._config;this._menuService.addMenuItem(Li(this._injector),t)}_initPanel(){this._componentManager.register(mo,hf)}};ht=vf([u.OnLifecycle(u.LifecycleStages.Ready,ht),ct(1,u.IUniverInstanceService),ct(2,u.Inject(u.Injector)),ct(3,u.Inject(fe.ComponentManager)),ct(4,u.Inject(fe.IMenuService)),ct(5,u.Inject(fe.ISidebarService)),ct(6,u.Inject(u.LocaleService))],ht);var _e=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(_e||{});const On={id:"sheet.operation.open.conditional.formatting.panel",type:u.CommandType.OPERATION,handler:(e,t)=>{var c;const n=e.get(ht),r=e.get(L.SheetsSelectionsService),o=e.get(u.ICommandService),i=((c=r.getCurrentSelections())==null?void 0:c.map(l=>l.range))||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 4:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(l);break}case 5:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(l);break}case 6:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(l);break}case 7:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(l);break}case 8:{const l={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(l);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(an.id,{ranges:i});break}case 10:{o.executeCommand(Lt.id);break}}return!0}};var yf=Object.defineProperty,Cf=Object.getOwnPropertyDescriptor,Sf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Cf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&yf(t,n,o),o},ut=(e,t)=>(n,r)=>t(n,r,e);let Et=class extends u.Disposable{constructor(e,t,n,r,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=i,this._initViewModelInterceptor(),this._initSkeleton()}_initSkeleton(){const e=()=>{var n,r,o;const t=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(t))==null||n.with(le.SheetSkeletonManagerService).reCalculate(),(o=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.mainComponent)==null||o.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(We.bufferTime(16),We.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0:!1})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(L.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),a={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:a};return r.style&&Object.assign(a,r.style),c.fontRenderExtension||(c.fontRenderExtension={},r.isShowValue!==void 0&&(c.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)},priority:10}))}};Et=Sf([u.OnLifecycle(u.LifecycleStages.Rendered,Et),ut(0,u.Inject(L.SheetInterceptorService)),ut(1,u.Inject(s.ConditionalFormattingService)),ut(2,u.Inject(u.IUniverInstanceService)),ut(3,u.Inject($i.IRenderManagerService)),ut(4,u.Inject(s.ConditionalFormattingViewModel)),ut(5,u.Inject(s.ConditionalFormattingRuleModel))],Et);var bf=Object.defineProperty,Rf=Object.getOwnPropertyDescriptor,_f=(e,t,n,r)=>{for(var o=r>1?void 0:r?Rf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&bf(t,n,o),o},_t=(e,t)=>(n,r)=>t(n,r,e);let Dt=class extends u.Disposable{constructor(t,n,r,o,i){super();St(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:i=le.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new u.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(t,n);if(!a)return;const c={get:this._injector.get.bind(this._injector)},l=le.rangeToDiscreteRange(r,c,t,n);if(!l)return;const{rows:d,cols:f}=l,m=new Set;d.forEach((h,v)=>{f.forEach((y,R)=>{const E=this._conditionalFormattingViewModel.getCellCf(t,n,h,y,a);E&&(E.cfList.forEach(S=>m.add(S.cfId)),o.setValue(v,R,E.cfList.map(S=>S.cfId)))})}),m.forEach(h=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,h);v&&(i[h]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId();if(!o)return{redos:[],undos:[]};const a=o.getSheetId();if(n.copyType===le.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,le.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,l],mapFunc:d}=le.virtualizeDiscreteRanges([n.copyRange,t]),f=le.getRepeatRange(c,l,!0),m=this._conditionalFormattingViewModel.getMatrix(i,a),h={};u.Range.foreach(l,(g,O)=>{const{row:T,col:b}=d(g,O),M=this._conditionalFormattingViewModel.getCellCf(i,a,T,b,m);M&&M.cfList.forEach(N=>{if(!h[N.cfId]){const $=new u.ObjectMatrix;h[N.cfId]=$;const A=this._conditionalFormattingRuleModel.getRule(i,a,N.cfId);A==null||A.ranges.forEach(C=>{u.Range.foreach(C,(D,Z)=>{$.setValue(D,Z,1)})})}h[N.cfId].realDeleteValue(T,b)})});const{matrix:v,info:y}=this._copyInfo,R=[];let E=this._conditionalFormattingRuleModel.createCfId(i,a);const S={},I=g=>{if(S[g])return S[g];const O=y==null?void 0:y.cfMap[g],T=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...R].find(b=>u.Tools.diffValue(b.rule,O));if(T)return S[g]=T,T;{const b={rule:O,cfId:E,ranges:[],stopIfTrue:!1};return S[g]=b,R.push(b),E=`${Number(E)+1}`,b}};f.forEach(g=>{v&&v.forValue((O,T,b)=>{const M=u.Rectangle.getPositionRange({startRow:O,endRow:O,startColumn:T,endColumn:T},g.startRange),{row:N,col:$}=d(M.startRow,M.startColumn);b.forEach(A=>{if(!h[A]){const C=I(A),D=new u.ObjectMatrix;h[A]=D,C.ranges.forEach(Z=>{u.Range.foreach(Z,(Ce,pe)=>{D.setValue(Ce,pe,1)})})}h[A].setValue(N,$,1)})})});const _=[],w=[];for(const g in h){const O=h[g],T=L.findAllRectangle(L.createTopMatrixFromMatrix(O));if(!T.length){const b={unitId:i,subUnitId:a,cfId:g};_.push({id:s.DeleteConditionalRuleMutation.id,params:b}),w.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,b))}if(R.some(b=>b.cfId===g)){const b=I(g),M={unitId:i,subUnitId:a,rule:{...b,ranges:T}};_.push({id:s.AddConditionalRuleMutation.id,params:M}),w.push(s.AddConditionalRuleMutationUndoFactory(this._injector,M))}else{const b=this._conditionalFormattingRuleModel.getRule(i,a,g);if(!b)continue;const M={unitId:i,subUnitId:a,rule:{...b,ranges:T}};_.push({id:s.SetConditionalRuleMutation.id,params:M}),w.push(...s.setConditionalRuleMutationUndoFactory(this._injector,M))}}return{redos:_,undos:w}}};Dt=_f([u.OnLifecycle(u.LifecycleStages.Rendered,Dt),_t(0,u.Inject(le.ISheetClipboardService)),_t(1,u.Inject(s.ConditionalFormattingRuleModel)),_t(2,u.Inject(u.Injector)),_t(3,u.Inject(s.ConditionalFormattingViewModel)),_t(4,u.Inject(u.IUniverInstanceService))],Dt);var Tf=Object.defineProperty,If=Object.getOwnPropertyDescriptor,wf=(e,t,n,r)=>{for(var o=r>1?void 0:r?If(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Tf(t,n,o),o},Kt=(e,t)=>(n,r)=>t(n,r,e);let Pt=class extends u.Disposable{constructor(e,t,n,r){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=l=>{const d=[...i.ranges],f=d.map(h=>L.handleDefaultRangeChangeWithEffectRefCommands(h,l)).filter(h=>!!h);if(s.isRangesEqual(f,d))return{redos:[],undos:[]};if(f.length){const h={unitId:r,subUnitId:o,rule:{...i,ranges:f}},v=[{id:s.SetConditionalRuleMutation.id,params:h}],y=s.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:y}}else{const h={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:h}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:v,undos:y}}},c=[];i.ranges.forEach(l=>{const d=this._refRangeService.registerRefRange(l,a);c.push(()=>d.dispose())}),e.set(t(r,o,i.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:o,subUnitId:i,rule:a}=r,c=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!(r.unitId!==c.getUnitId()||r.subUnitId!==(l==null?void 0:l.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const d=e.get(t(o,i,a.cfId));d&&d();break}case"set":{const d=e.get(t(o,i,a.cfId));d&&d(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(u.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};Pt=wf([u.OnLifecycle(u.LifecycleStages.Rendered,Pt),Kt(0,u.Inject(s.ConditionalFormattingRuleModel)),Kt(1,u.Inject(u.IUniverInstanceService)),Kt(2,u.Inject(u.Injector)),Kt(3,u.Inject(L.RefRangeService))],Pt);var xf=Object.defineProperty,Of=Object.getOwnPropertyDescriptor,Ef=(e,t,n,r)=>{for(var o=r>1?void 0:r?Of(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&xf(t,n,o),o},zn=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends u.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===Ht.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[L.WorkbookEditablePermission],rangeTypes:[L.RangeProtectionPermissionEditPoint],worksheetTypes:[L.WorksheetEditPermission,L.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Mt=Ef([u.OnLifecycle(u.LifecycleStages.Rendered,Mt),zn(0,u.Inject(u.LocaleService)),zn(1,u.ICommandService),zn(2,u.Inject(le.SheetPermissionInterceptorBaseController))],Mt);var Di=Object.defineProperty,Df=Object.getOwnPropertyDescriptor,Pf=(e,t,n)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Df(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Di(t,n,o),o},go=(e,t)=>(n,r)=>t(n,r,e),Pi=(e,t,n)=>Pf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends u.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=u.Tools.deepMerge({},Ei,this._config),this._initCommand(),this._injector.add([Et]),this._injector.add([Pt]),this._injector.add([Dt]),this._injector.add([Mt]),this._injector.add([pt])}_initCommand(){[Jn,Qn,er,tr,nr,rr,or,ir,ar,On,Nt,Rn,bn,Ht,an,Lt].forEach(t=>{this._commandService.registerCommand(t)})}};Pi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Pi(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=Mf([u.DependentOn(s.UniverSheetsConditionalFormattingPlugin),go(1,u.Inject(u.Injector)),go(2,u.Inject(u.ICommandService))],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var Ff=Object.defineProperty,Nf=Object.getOwnPropertyDescriptor,jf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ff(t,n,o),o},Tt=(e,t)=>(n,r)=>t(n,r,e);let Jt=class extends u.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,i,a,c,l)=>{var v;const d=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(v=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:v.getSheetId();if(!d||!f)return;const m={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},h={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};u.Range.foreach(a,(y,R)=>{const E=u.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},m),S=u.Rectangle.getPositionRange({startRow:y,startColumn:R,endColumn:R,endRow:y},h),{row:I,col:_}=l(E.startRow,E.startColumn),w=this._conditionalFormattingViewModel.getCellCf(d,f,I,_),{row:g,col:O}=l(S.startRow,S.startColumn),T=this._conditionalFormattingViewModel.getCellCf(d,f,g,O);T&&T.cfList.forEach(b=>{let M=c.get(b.cfId);if(!c.get(b.cfId)){const N=this._conditionalFormattingRuleModel.getRule(d,f,b.cfId);if(!N)return;M=new u.ObjectMatrix,N.ranges.forEach($=>{u.Range.foreach($,(A,C)=>{M.setValue(A,C,1)})}),c.set(b.cfId,M)}M.realDeleteValue(g,O)}),w&&w.cfList.forEach(b=>{let M=c.get(b.cfId);if(!c.get(b.cfId)){const N=this._conditionalFormattingRuleModel.getRule(d,f,b.cfId);if(!N)return;M=new u.ObjectMatrix,N.ranges.forEach($=>{u.Range.foreach($,(A,C)=>{M.setValue(A,C,1)})}),c.set(b.cfId,M)}M.setValue(g,O,1)})})},n=(o,i)=>{var S,I,_;const a=(S=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId(),c=(_=(I=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getActiveSheet())==null?void 0:_.getSheetId(),l=new Map,d=[],f=[];if(!a||!c)return e();const m=le.virtualizeDiscreteRanges([o,i]),[h,v]=m.ranges,{mapFunc:y}=m,R={row:h.startRow,col:h.startColumn};return le.getAutoFillRepeatRange(h,v).forEach(w=>{t(R,w.repeatStartCell,w.relativeRange,l,y)}),l.forEach((w,g)=>{const O=this._conditionalFormattingRuleModel.getRule(a,c,g);if(!O)return;const T=L.findAllRectangle(L.createTopMatrixFromMatrix(w));if(T.length){const b={unitId:a,subUnitId:c,rule:{...O,ranges:T}};d.push({id:s.SetConditionalRuleMutation.id,params:b}),f.push(...s.setConditionalRuleMutationUndoFactory(this._injector,b))}else{const b={unitId:a,subUnitId:c,cfId:O.cfId};d.push({id:s.DeleteConditionalRuleMutation.id,params:b}),f.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,b))}}),{undos:f,redos:d}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===le.APPLY_TYPE.COPY||a===le.APPLY_TYPE.ONLY_FORMAT||a===le.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Jt=jf([u.OnLifecycle(u.LifecycleStages.Rendered,Jt),Tt(0,u.Inject(u.Injector)),Tt(1,u.Inject(u.IUniverInstanceService)),Tt(2,u.Inject(le.IAutoFillService)),Tt(3,u.Inject(s.ConditionalFormattingRuleModel)),Tt(4,u.Inject(s.ConditionalFormattingViewModel))],Jt);var $f=Object.defineProperty,Lf=Object.getOwnPropertyDescriptor,Uf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&$f(t,n,o),o},vo=(e,t)=>(n,r)=>t(n,r,e);let Qt=class extends u.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(u.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const i=s.getStringFromDataStream(e.p),a={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete a[l]});const c={...e,s:{...a},v:i};return delete c.p,n(c)}}return n(e)}})))}};Qt=Uf([u.OnLifecycle(u.LifecycleStages.Rendered,Qt),vo(0,u.Inject(le.IEditorBridgeService)),vo(1,u.Inject(s.ConditionalFormattingService))],Qt);var Vf=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Af=(e,t,n,r)=>{for(var o=r>1?void 0:r?zf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Vf(t,n,o),o},It=(e,t)=>(n,r)=>t(n,r,e);exports.ConditionalFormattingClearController=class extends u.Disposable{constructor(t,n,r,o,i){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var i;const n=[],r=[],o={redos:n,undos:r};if([L.ClearSelectionFormatCommand.id,L.ClearSelectionAllCommand.id].includes(t.id)){const a=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(f=>f.range);if(!a)return o;const c=this._univerInstanceService.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET),l=c.getActiveSheet();if(!l)return o;const d=this._conditionalFormattingRuleModel.getSubunitRules(c.getUnitId(),l.getSheetId());if(!d||!d.length)return o;d.filter(f=>a.some(m=>f.ranges.some(h=>u.Rectangle.getIntersects(h,m)))).forEach(f=>{const h=new L.RangeMergeUtil().add(...f.ranges).subtract(...a).merge();if(h.length){const v={id:s.SetConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),rule:{...f,ranges:h}}},y=s.setConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}else{const v={id:s.DeleteConditionalRuleMutation.id,params:{unitId:c.getUnitId(),subUnitId:l.getSheetId(),cfId:f.cfId}},y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,v.params);n.push(v),r.push(...y)}})}return o}}))}};exports.ConditionalFormattingClearController=Af([u.OnLifecycle(u.LifecycleStages.Rendered,exports.ConditionalFormattingClearController),It(0,u.Inject(u.Injector)),It(1,u.Inject(u.IUniverInstanceService)),It(2,u.Inject(L.SheetInterceptorService)),It(3,u.Inject(L.SheetsSelectionsService)),It(4,u.Inject(s.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);var Mi=Object.defineProperty,Hf=Object.getOwnPropertyDescriptor,Wf=(e,t,n)=>t in e?Mi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Hf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Mi(t,n,o),o},yo=(e,t)=>(n,r)=>t(n,r,e),Fi=(e,t,n)=>Wf(e,typeof t!="symbol"?t+"":t,n);exports.UniverSheetsConditionalFormattingUIPlugin=class extends u.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=u.Tools.deepMerge({},Ei,this._config),this._initCommand(),this._injector.add([Et]),this._injector.add([Pt]),this._injector.add([Dt]),this._injector.add([Jt]),this._injector.add([Mt]),this._injector.add([ht,{useFactory:()=>this._injector.createInstance(ht,this._config)}]),this._injector.add([pt]),this._injector.add([Qt]),this._injector.add([exports.ConditionalFormattingClearController])}_initCommand(){[Jn,Qn,er,tr,nr,rr,or,ir,ar,On,Nt,Rn,bn,Ht,an,Lt].forEach(t=>{this._commandService.registerCommand(t)})}};Fi(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Fi(exports.UniverSheetsConditionalFormattingUIPlugin,"type",u.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=kf([u.DependentOn(s.UniverSheetsConditionalFormattingPlugin),yo(1,u.Inject(u.Injector)),yo(2,u.Inject(u.ICommandService))],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Jn;exports.AddCfCommand=Ht;exports.AddColorScaleConditionalRuleCommand=Qn;exports.AddDataBarConditionalRuleCommand=er;exports.AddDuplicateValuesCfCommand=tr;exports.AddNumberCfCommand=nr;exports.AddRankCfCommand=rr;exports.AddTextCfCommand=or;exports.AddTimePeriodCfCommand=ir;exports.AddUniqueValuesCfCommand=ar;exports.ClearRangeCfCommand=an;exports.ClearWorksheetCfCommand=Lt;exports.DeleteCfCommand=Nt;exports.MoveCfCommand=bn;exports.OpenConditionalFormattingOperator=On;exports.SetCfCommand=Rn;
|