@univerjs/sheets-conditional-formatting-ui 0.1.6
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/LICENSE +176 -0
- package/README.md +30 -0
- package/lib/cjs/index.js +11 -0
- package/lib/es/index.js +7516 -0
- package/lib/index.css +1 -0
- package/lib/types/commands/commands/add-average-cf.command.d.ts +11 -0
- package/lib/types/commands/commands/add-cf.command.d.ts +9 -0
- package/lib/types/commands/commands/add-color-scale-cf.command.d.ts +10 -0
- package/lib/types/commands/commands/add-data-bar-cf.command.d.ts +14 -0
- package/lib/types/commands/commands/add-duplicate-values-cf.command.d.ts +10 -0
- package/lib/types/commands/commands/add-number-cf.command.d.ts +12 -0
- package/lib/types/commands/commands/add-rank-cf.command.d.ts +13 -0
- package/lib/types/commands/commands/add-text-cf.command.d.ts +12 -0
- package/lib/types/commands/commands/add-time-period-cf.command.d.ts +11 -0
- package/lib/types/commands/commands/add-unique-values-cf.command.d.ts +10 -0
- package/lib/types/commands/commands/clear-range-cf.command.d.ts +8 -0
- package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +7 -0
- package/lib/types/commands/commands/delete-cf.command.d.ts +8 -0
- package/lib/types/commands/commands/move-cf.command.d.ts +10 -0
- package/lib/types/commands/commands/set-cf.command.d.ts +9 -0
- package/lib/types/commands/operations/open-conditional-formatting-panel.d.ts +15 -0
- package/lib/types/components/color-picker/index.d.ts +12 -0
- package/lib/types/components/conditional-style-editor/index.d.ts +10 -0
- package/lib/types/components/panel/index.d.ts +8 -0
- package/lib/types/components/panel/rule-edit/colorScale.d.ts +4 -0
- package/lib/types/components/panel/rule-edit/dataBar.d.ts +4 -0
- package/lib/types/components/panel/rule-edit/formula.d.ts +4 -0
- package/lib/types/components/panel/rule-edit/highlightCell.d.ts +5 -0
- package/lib/types/components/panel/rule-edit/iconSet.d.ts +5 -0
- package/lib/types/components/panel/rule-edit/index.d.ts +9 -0
- package/lib/types/components/panel/rule-edit/rank.d.ts +4 -0
- package/lib/types/components/panel/rule-edit/type.d.ts +13 -0
- package/lib/types/components/panel/rule-list/index.d.ts +9 -0
- package/lib/types/components/preview/index.d.ts +6 -0
- package/lib/types/controllers/cf.auto-fill.controller.d.ts +14 -0
- package/lib/types/controllers/cf.clear.controller.d.ts +14 -0
- package/lib/types/controllers/cf.copy-paste.controller.d.ts +17 -0
- package/lib/types/controllers/cf.editor.controller.d.ts +15 -0
- package/lib/types/controllers/cf.i18n.controller.d.ts +10 -0
- package/lib/types/controllers/cf.menu.controller.d.ts +16 -0
- package/lib/types/controllers/cf.ref-range.controller.d.ts +15 -0
- package/lib/types/controllers/cf.render.controller.d.ts +19 -0
- package/lib/types/index.d.ts +17 -0
- package/lib/types/locale/en-US.d.ts +4 -0
- package/lib/types/locale/index.d.ts +17 -0
- package/lib/types/locale/zh-CN.d.ts +169 -0
- package/lib/types/menu/manage-rule.d.ts +4 -0
- package/lib/types/plugin.d.ts +11 -0
- package/lib/umd/index.js +11 -0
- package/package.json +107 -0
package/lib/umd/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
(function(q,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("rxjs"),require("rxjs/operators"),require("react"),require("@univerjs/design"),require("@wendellhu/redi/react-bindings"),require("@univerjs/engine-formula"),require("clsx"),require("react-dom"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","rxjs","rxjs/operators","react","@univerjs/design","@wendellhu/redi/react-bindings","@univerjs/engine-formula","clsx","react-dom","@univerjs/sheets-ui","@univerjs/engine-render"],v):(q=typeof globalThis<"u"?globalThis:q||self,v(q.UniverSheetsConditionalFormattingUi={},q.UniverCore,q["@wendellhu/redi"],q.UniverSheetsConditionalFormatting,q.UniverSheets,q.UniverUi,q.rxjs,q.rxjs.operators,q.React,q.UniverDesign,q["@wendellhu/redi/react-bindings"],q.UniverEngineFormula,q.clsx,q.ReactDOM,q.UniverSheetsUi,q.UniverEngineRender))})(this,function(q,v,k,s,ee,ve,ye,_e,_,F,te,wr,We,Tr,ge,Io){"use strict";var bd=Object.defineProperty;var Cd=(q,v,k)=>v in q?bd(q,v,{enumerable:!0,configurable:!0,writable:!0,value:k}):q[v]=k;var mt=(q,v,k)=>(Cd(q,typeof v!="symbol"?v+"":v,k),k);var vn;const wo={type:v.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,i=e.get(s.ConditionalFormattingRuleModel),c=e.get(v.ICommandService),u=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),d=u.getActiveSheet(),h=u.getUnitId(),p=d.getSheetId(),y=i.createCfId(h,p),C={ranges:n,cfId:y,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:o,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:p,rule:C})}},To={type:v.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(v.ICommandService),l=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),h=u.getSheetId(),p=o.createCfId(d,h),y={ranges:n,cfId:p,stopIfTrue:!!a,rule:{type:s.CFRuleType.colorScale,config:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:y})}},_o={type:v.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:a,nativeColor:o,positiveColor:i,isGradient:c,stopIfTrue:l}=t,u=e.get(s.ConditionalFormattingRuleModel),d=e.get(v.IUniverInstanceService),h=e.get(v.ICommandService),p=d.getCurrentUniverSheetInstance(),y=p.getActiveSheet(),C=p.getUnitId(),b=y.getSheetId(),T=u.createCfId(C,b),I={ranges:n,cfId:T,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,config:{min:r,max:a,nativeColor:o,positiveColor:i,isGradient:c}}};return h.executeCommand(s.AddConditionalRuleMutation.id,{unitId:C,subUnitId:b,rule:I})}},xo={type:v.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(v.ICommandService),l=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),h=u.getSheetId(),p=o.createCfId(d,h),y={ranges:n,cfId:p,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:y})}},Oo={type:v.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:i}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(v.ICommandService),d=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),h=d.getActiveSheet(),p=d.getUnitId(),y=h.getSheetId(),C=c.createCfId(p,y);let b;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(o)){const T=i;if(T.length!==2||!Array.isArray(T))return!1;b={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:o,style:r,value:T}}}else{const T=i;if(typeof T!="number")return!1;b={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:o,style:r,value:T}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:y,rule:b})}},Mo={type:v.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,isPercent:o,isBottom:i,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),u=e.get(v.IUniverInstanceService),d=e.get(v.ICommandService),h=u.getCurrentUniverSheetInstance(),p=h.getActiveSheet(),y=h.getUnitId(),C=p.getSheetId(),b=l.createCfId(y,C),T={ranges:n,cfId:b,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:o,isBottom:i,style:r,value:c}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:y,subUnitId:C,rule:T})}},Do={type:v.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:i}=t,c=e.get(s.ConditionalFormattingRuleModel),u=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),d=e.get(v.ICommandService),h=u.getActiveSheet(),p=u.getUnitId(),y=h.getSheetId(),C=c.createCfId(p,y),b={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:o,style:r,value:i}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:y,rule:b})}},Eo={type:v.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,i=e.get(s.ConditionalFormattingRuleModel),c=e.get(v.IUniverInstanceService),l=e.get(v.ICommandService),u=c.getCurrentUniverSheetInstance(),d=u.getActiveSheet(),h=u.getUnitId(),p=d.getSheetId(),y=i.createCfId(h,p),C={ranges:n,cfId:y,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:o,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:p,rule:C})}},Po={type:v.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(v.IUniverInstanceService),c=e.get(v.ICommandService),l=i.getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),h=u.getSheetId(),p=o.createCfId(d,h),y={ranges:n,cfId:p,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:y})}},_r={type:v.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var T,I,m;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(v.IUniverInstanceService),a=e.get(v.ICommandService),o=r.getCurrentUniverSheetInstance(),i=e.get(v.IUndoRedoService),c=e.get(ee.SelectionManagerService),l=o.getActiveSheet(),u=(T=t.unitId)!=null?T:o.getUnitId(),d=(I=t.subUnitId)!=null?I:l.getSheetId(),h=((m=c.getSelections())==null?void 0:m.map(S=>S.range))||[],p=n.getSubunitRules(u,d);if(!(p!=null&&p.length)||!h.length)return!1;const y=[],C=[];p.forEach(S=>{const R=new v.ObjectMatrix;S.ranges.forEach(w=>{v.Range.foreach(w,(x,E)=>{R.setValue(x,E,1)})}),h.forEach(w=>{v.Range.foreach(w,(x,E)=>{R.realDeleteValue(x,E)})});const g=ee.findAllRectangle(ee.createTopMatrixFromMatrix(R));if(g.length){const w={...S,ranges:g},x={unitId:u,subUnitId:d,rule:w},E=s.setConditionalRuleMutationUndoFactory(e,x);y.push({id:s.SetConditionalRuleMutation.id,params:x}),C.push(...E)}else{const w={unitId:u,subUnitId:d,cfId:S.cfId},x=s.DeleteConditionalRuleMutationUndoFactory(e,w);y.push({id:s.DeleteConditionalRuleMutation.id,params:w}),C.push(...x)}});const b=v.sequenceExecute(y,a).result;return b&&i.pushUndoRedo({unitID:u,redoMutations:y,undoMutations:C}),b}},Sn={type:v.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){var b,T;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(v.IUniverInstanceService),a=e.get(v.ICommandService),o=r.getCurrentUniverSheetInstance(),i=e.get(v.IUndoRedoService),c=o.getActiveSheet(),l=(b=t==null?void 0:t.unitId)!=null?b:o.getUnitId(),u=(T=t==null?void 0:t.subUnitId)!=null?T:c.getSheetId(),d=n.getSubunitRules(l,u);if(!(d!=null&&d.length))return!1;const h=d.map(I=>({cfId:I.cfId,unitId:l,subUnitId:u})),p=h.map(I=>({id:s.DeleteConditionalRuleMutation.id,params:I})),y=h.map(I=>s.DeleteConditionalRuleMutationUndoFactory(e,I)[0]),C=v.sequenceExecute(p,a).result;return C&&i.pushUndoRedo({unitID:l,redoMutations:p,undoMutations:y}),C}};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 a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},we.apply(this,arguments)},No=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 a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},Ge=_.forwardRef(function(e,t){var n=e.icon,r=e.id,a=e.className,o=e.extend,i=No(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(a||"").trim(),l=_.useRef("_".concat(ko()));return xr(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},we({ref:t,className:c},i),o)});function xr(e,t,n,r,a){return _.createElement(e.tag,we(we({key:t},jo(e,n,a)),r),(Lo(e,n).children||[]).map(function(o,i){return xr(o,"".concat(t,"-").concat(e.tag,"-").concat(i),n,void 0,a)}))}function jo(e,t,n){var r=we({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var a=t.defIds;return!a||a.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(o){var i=o[0],c=o[1];typeof c=="string"&&(r[i]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Lo(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(a){return typeof a.attrs.id=="string"&&r&&r.indexOf(a.attrs.id)>-1?we(we({},a),{attrs:we(we({},a.attrs),{id:a.attrs.id+t.idSuffix})}):a})}):e}function ko(){return Math.random().toString(36).substring(2,8)}Ge.displayName="UniverIcon";var Ao={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M5.59 1.51H10.46V14.459999999999999H5.59z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.34863 2.53325C1.34863 1.87051 1.88589 1.33325 2.54863 1.33325H13.482C14.1447 1.33325 14.682 1.87051 14.682 2.53325V13.4666C14.682 14.1294 14.1447 14.6666 13.482 14.6666H2.54863C1.88589 14.6666 1.34863 14.1294 1.34863 13.4666V2.53325ZM13.082 2.63325C13.2477 2.63325 13.382 2.76757 13.382 2.93325V5.09946C13.382 5.26515 13.2477 5.39946 13.082 5.39946H10.9708C10.8052 5.39946 10.6708 5.26515 10.6708 5.09946V2.93325C10.6708 2.76757 10.8052 2.63325 10.9708 2.63325H13.082ZM9.37085 2.93325C9.37085 2.76757 9.23653 2.63325 9.07085 2.63325H6.95974C6.79406 2.63325 6.65974 2.76757 6.65974 2.93325V5.09946C6.65974 5.26515 6.79406 5.39946 6.95974 5.39946L9.07085 5.39946C9.23654 5.39946 9.37085 5.26515 9.37085 5.09946V2.93325ZM5.35974 2.93325C5.35974 2.76757 5.22543 2.63325 5.05974 2.63325H2.94863C2.78295 2.63325 2.64863 2.76757 2.64863 2.93325V5.09946C2.64863 5.26515 2.78295 5.39946 2.94863 5.39946H5.05974C5.22543 5.39946 5.35974 5.26515 5.35974 5.09946V2.93325ZM2.94863 6.69946C2.78295 6.69946 2.64863 6.83378 2.64863 6.99946V9.11045C2.64863 9.27613 2.78295 9.41045 2.94863 9.41045H5.05974C5.22543 9.41045 5.35974 9.27613 5.35974 9.11045V6.99946C5.35974 6.83378 5.22543 6.69946 5.05974 6.69946H2.94863ZM2.94863 10.7104C2.78295 10.7104 2.64863 10.8448 2.64863 11.0104V13.0666C2.64863 13.2323 2.78295 13.3666 2.94863 13.3666H5.05974C5.22543 13.3666 5.35974 13.2323 5.35974 13.0666V11.0104C5.35974 10.8448 5.22543 10.7104 5.05974 10.7104H2.94863ZM6.65974 13.0666C6.65974 13.2323 6.79406 13.3666 6.95974 13.3666H9.07085C9.23653 13.3666 9.37085 13.2323 9.37085 13.0666V11.0104C9.37085 10.8448 9.23653 10.7104 9.07085 10.7104L6.95974 10.7104C6.79406 10.7104 6.65974 10.8448 6.65974 11.0104V13.0666ZM10.6708 13.0666C10.6708 13.2323 10.8052 13.3666 10.9708 13.3666H13.082C13.2477 13.3666 13.382 13.2323 13.382 13.0666V11.0104C13.382 10.8448 13.2477 10.7104 13.082 10.7104H10.9708C10.8052 10.7104 10.6708 10.8448 10.6708 11.0104V13.0666ZM13.082 9.41045C13.2477 9.41045 13.382 9.27613 13.382 9.11045V6.99946C13.382 6.83378 13.2477 6.69946 13.082 6.69946H10.9708C10.8052 6.69946 10.6708 6.83378 10.6708 6.99946V9.11045C10.6708 9.27613 10.8052 9.41045 10.9708 9.41045H13.082ZM6.95974 9.41045C6.79406 9.41045 6.65974 9.27613 6.65974 9.11045V6.99946C6.65974 6.83378 6.79406 6.69946 6.95974 6.69946L9.07085 6.69946C9.23653 6.69946 9.37085 6.83378 9.37085 6.99946V9.11045C9.37085 9.27613 9.23653 9.41045 9.07085 9.41045H6.95974Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Or=_.forwardRef(function(e,t){return _.createElement(Ge,Object.assign({},e,{id:"conditions",ref:t,icon:Ao}))});Or.displayName="Conditions";const zo=Or;var Vo={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6.78662 6.17993C7.12169 6.17993 7.39331 6.45156 7.39331 6.78662V10.7301C7.39331 11.0652 7.12169 11.3368 6.78662 11.3368 6.45156 11.3368 6.17993 11.0652 6.17993 10.7301V6.78662C6.17993 6.45156 6.45156 6.17993 6.78662 6.17993zM9.82007 6.78662C9.82007 6.45156 9.54844 6.17993 9.21338 6.17993 8.87831 6.17993 8.60669 6.45156 8.60669 6.78662V10.7301C8.60669 11.0652 8.87831 11.3368 9.21338 11.3368 9.54844 11.3368 9.82007 11.0652 9.82007 10.7301V6.78662z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.57094 1.32642C6.34938 1.32642 6.14544 1.44719 6.03894 1.64148L5.21395 3.14648H1.93311C1.59804 3.14648 1.32642 3.41811 1.32642 3.75317C1.32642 4.08824 1.59804 4.35986 1.93311 4.35986H2.84314V14.0669C2.84314 14.402 3.11476 14.6736 3.44983 14.6736H12.5502C12.8852 14.6736 13.1569 14.402 13.1569 14.0669V4.35986H14.0669C14.402 4.35986 14.6736 4.08824 14.6736 3.75317C14.6736 3.41811 14.402 3.14648 14.0669 3.14648H10.7895L9.98357 1.64602C9.87785 1.4492 9.67252 1.32642 9.44911 1.32642H6.57094ZM9.4122 3.14648L9.08632 2.53979H6.93024L6.59767 3.14648H9.4122ZM4.05652 4.35986V13.4602H11.9435V4.35986H4.05652Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Mr=_.forwardRef(function(e,t){return _.createElement(Ge,Object.assign({},e,{id:"delete-single",ref:t,icon:Vo}))});Mr.displayName="DeleteSingle";const bn=Mr;var Uo={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_102_249",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:{mask:"url(#mask0_102_249)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.74717 2.0944C8.74717 1.68671 8.41279 1.3562 8.00032 1.3562C7.58785 1.3562 7.25347 1.68671 7.25347 2.0944V7.26186H2.02541C1.61294 7.26186 1.27856 7.59237 1.27856 8.00007C1.27856 8.40777 1.61294 8.73827 2.02541 8.73827H7.25347V13.9057C7.25347 14.3134 7.58785 14.6439 8.00032 14.6439C8.41279 14.6439 8.74717 14.3134 8.74717 13.9057V8.73827H13.975C14.3874 8.73827 14.7218 8.40777 14.7218 8.00007C14.7218 7.59237 14.3874 7.26186 13.975 7.26186H8.74717V2.0944Z"}}]}]},Dr=_.forwardRef(function(e,t){return _.createElement(Ge,Object.assign({},e,{id:"increase-single",ref:t,icon:Uo}))});Dr.displayName="IncreaseSingle";const Wo=Dr;var Ho={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_102_556",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:{mask:"url(#mask0_102_556)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M0.629584 3.99986C1.13729 3.4922 1.9604 3.49224 2.46806 3.99995L7.57569 9.10806C7.81 9.3424 8.18992 9.3424 8.42424 9.10808L13.5323 3.99998C14.04 3.4923 14.8631 3.4923 15.3708 3.99998C15.8785 4.50766 15.8785 5.33078 15.3708 5.83846L9.41415 11.7951C8.63307 12.5762 7.36669 12.5762 6.58565 11.7951L0.629497 5.83834C0.121839 5.33063 0.121879 4.50752 0.629584 3.99986Z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},Er=_.forwardRef(function(e,t){return _.createElement(Ge,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ho}))});Er.displayName="MoreDownSingle";const Cn=Er;var $o={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"}}]}]},Pr=_.forwardRef(function(e,t){return _.createElement(Ge,Object.assign({},e,{id:"sequence-single",ref:t,icon:$o}))});Pr.displayName="SequenceSingle";const Bo=Pr;var Go={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"}}]}]},Nr=_.forwardRef(function(e,t){return _.createElement(Ge,Object.assign({},e,{id:"slash-single",ref:t,icon:Go}))});Nr.displayName="SlashSingle";const Nt=Nr,Fo=e=>{const t="conditional-formatting-menu-icon";return e.register(t,zo),n=>{const r=n.get(v.LocaleService),a=n.get(ee.SelectionManagerService),o=n.get(v.ICommandService),i=n.get(v.IUniverInstanceService),c=n.get(s.ConditionalFormattingRuleModel),l=n.get(ve.IZenZoneService),u=[ee.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],d=new ye.Observable(C=>ye.merge(a.selectionMoveEnd$,new ye.Observable(b=>{const T=o.onCommandExecuted(I=>{const{id:m,params:S}=I,R=i.getCurrentUniverSheetInstance().getUnitId();u.includes(m)&&S.unitId===R&&b.next(null)});return()=>T.dispose()})).pipe(_e.debounceTime(16)).subscribe(()=>{var R;const b=((R=a.getSelections())==null?void 0:R.map(g=>g.range))||[],T=i.getCurrentUniverSheetInstance().getUnitId(),I=i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),S=(c.getSubunitRules(T,I)||[]).filter(g=>g.ranges.some(w=>b.some(x=>v.Rectangle.intersects(x,w))));C.next(!!S.length)})),h=new ye.Observable(C=>ye.merge(a.selectionMoveEnd$,new ye.Observable(b=>{const T=o.onCommandExecuted(I=>{const{id:m,params:S}=I,R=i.getCurrentUniverSheetInstance().getUnitId();u.includes(m)&&S.unitId===R&&b.next(null)});return()=>T.dispose()})).pipe(_e.debounceTime(16)).subscribe(()=>{const b=i.getCurrentUniverSheetInstance().getUnitId(),T=i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),I=c.getSubunitRules(b,T)||[];C.next(!!I.length)})),p=new ye.Observable(C=>{const b=[{label:r.t("sheet.cf.ruleType.highlightCell"),value:Ie.highlightCell},{label:r.t("sheet.cf.panel.rankAndAverage"),value:Ie.rank},{label:r.t("sheet.cf.ruleType.formula"),value:Ie.formula},{label:r.t("sheet.cf.ruleType.colorScale"),value:Ie.colorScale},{label:r.t("sheet.cf.ruleType.dataBar"),value:Ie.dataBar},{label:r.t("sheet.cf.ruleType.iconSet"),value:Ie.icon},{label:r.t("sheet.cf.menu.manageConditionalFormatting"),value:Ie.viewRule},{label:r.t("sheet.cf.menu.createConditionalFormatting"),value:Ie.createRule},{label:r.t("sheet.cf.menu.clearRangeRules"),value:Ie.clearRangeRules,disabled:!d},{label:r.t("sheet.cf.menu.clearWorkSheetRules"),value:Ie.clearWorkSheetRules}];d.subscribe(T=>{const I=b.find(m=>m.value===Ie.clearRangeRules);I&&(I.disabled=!T,C.next(b))}),h.subscribe(T=>{const I=b.find(m=>m.value===Ie.clearWorkSheetRules);I&&(I.disabled=!T,C.next(b))}),C.next(b)}),y=new ye.Observable(C=>{const b=l.visible$.subscribe(T=>{C.next(T)});return()=>{b.unsubscribe()}});return{id:yo.id,type:ve.MenuItemType.SELECTOR,group:ve.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[ve.MenuPosition.TOOLBAR_START],icon:t,tooltip:r.t("sheet.cf.title"),selections:p,hidden$:y}}};var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qo(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 a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var jr={exports:{}},jt={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Xo=_,Yo=Symbol.for("react.element"),Ko=Symbol.for("react.fragment"),Zo=Object.prototype.hasOwnProperty,Jo=Xo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qo={key:!0,ref:!0,__self:!0,__source:!0};function Lr(e,t,n){var r,a={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)Zo.call(t,r)&&!Qo.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:Yo,type:e,key:o,ref:i,props:a,_owner:Jo.current}}jt.Fragment=Ko,jt.jsx=Lr,jt.jsxs=Lr,jr.exports=jt;var f=jr.exports;const M={conditionalFormattingWrap:"univer-conditional-formatting-wrap",cfRuleItem:"univer-cf-rule-item",preview:"univer-preview",createRule:"univer-create-rule",button:"univer-button",title:"univer-title",label:"univer-label",labelContainer:"univer-label-container",inputWidth:"univer-input-width",mTBase:"univer-m-t-base",mTSm:"univer-m-t-sm",mTXl:"univer-m-t-xl",mLSm:"univer-m-l-sm",mLXl:"univer-m-l-xl",mLXxs:"univer-m-l-xxs",mL0:"univer-m-l-0",mR0:"univer-m-r-0"};var kr={exports:{}},vt={},In={exports:{}};(function(e,t){(function(n,r){r(t)})(ze,function(n){function r(N){return function(J,Y,K,oe,de,Te,ie){return N(J,Y,ie)}}function a(N){return function(J,Y,K,oe){if(!J||!Y||typeof J!="object"||typeof Y!="object")return N(J,Y,K,oe);var de=oe.get(J),Te=oe.get(Y);if(de&&Te)return de===Y&&Te===J;oe.set(J,Y),oe.set(Y,J);var ie=N(J,Y,K,oe);return oe.delete(J),oe.delete(Y),ie}}function o(N,U){var J={};for(var Y in N)J[Y]=N[Y];for(var Y in U)J[Y]=U[Y];return J}function i(N){return N.constructor===Object||N.constructor==null}function c(N){return typeof N.then=="function"}function l(N,U){return N===U||N!==N&&U!==U}var u="[object Arguments]",d="[object Boolean]",h="[object Date]",p="[object RegExp]",y="[object Map]",C="[object Number]",b="[object Object]",T="[object Set]",I="[object String]",m=Object.prototype.toString;function S(N){var U=N.areArraysEqual,J=N.areDatesEqual,Y=N.areMapsEqual,K=N.areObjectsEqual,oe=N.areRegExpsEqual,de=N.areSetsEqual,Te=N.createIsNestedEqual,ie=Te(Le);function Le(ne,se,ke){if(ne===se)return!0;if(!ne||!se||typeof ne!="object"||typeof se!="object")return ne!==ne&&se!==se;if(i(ne)&&i(se))return K(ne,se,ie,ke);var Co=Array.isArray(ne),Ro=Array.isArray(se);if(Co||Ro)return Co===Ro&&U(ne,se,ie,ke);var Ae=m.call(ne);return Ae!==m.call(se)?!1:Ae===h?J(ne,se,ie,ke):Ae===p?oe(ne,se,ie,ke):Ae===y?Y(ne,se,ie,ke):Ae===T?de(ne,se,ie,ke):Ae===b||Ae===u?c(ne)||c(se)?!1:K(ne,se,ie,ke):Ae===d||Ae===C||Ae===I?l(ne.valueOf(),se.valueOf()):!1}return Le}function R(N,U,J,Y){var K=N.length;if(U.length!==K)return!1;for(;K-- >0;)if(!J(N[K],U[K],K,K,N,U,Y))return!1;return!0}var g=a(R);function w(N,U){return l(N.valueOf(),U.valueOf())}function x(N,U,J,Y){var K=N.size===U.size;if(!K)return!1;if(!N.size)return!0;var oe={},de=0;return N.forEach(function(Te,ie){if(K){var Le=!1,ne=0;U.forEach(function(se,ke){!Le&&!oe[ne]&&(Le=J(ie,ke,de,ne,N,U,Y)&&J(Te,se,ie,ke,N,U,Y))&&(oe[ne]=!0),ne++}),de++,K=Le}}),K}var E=a(x),V="_owner",$=Object.prototype.hasOwnProperty;function O(N,U,J,Y){var K=Object.keys(N),oe=K.length;if(Object.keys(U).length!==oe)return!1;for(var de;oe-- >0;){if(de=K[oe],de===V){var Te=!!N.$$typeof,ie=!!U.$$typeof;if((Te||ie)&&Te!==ie)return!1}if(!$.call(U,de)||!J(N[de],U[de],de,de,N,U,Y))return!1}return!0}var L=a(O);function D(N,U){return N.source===U.source&&N.flags===U.flags}function j(N,U,J,Y){var K=N.size===U.size;if(!K)return!1;if(!N.size)return!0;var oe={};return N.forEach(function(de,Te){if(K){var ie=!1,Le=0;U.forEach(function(ne,se){!ie&&!oe[Le]&&(ie=J(de,ne,Te,se,N,U,Y))&&(oe[Le]=!0),Le++}),K=ie}}),K}var A=a(j),G=Object.freeze({areArraysEqual:R,areDatesEqual:w,areMapsEqual:x,areObjectsEqual:O,areRegExpsEqual:D,areSetsEqual:j,createIsNestedEqual:r}),Z=Object.freeze({areArraysEqual:g,areDatesEqual:w,areMapsEqual:E,areObjectsEqual:L,areRegExpsEqual:D,areSetsEqual:A,createIsNestedEqual:r}),le=S(G);function ae(N,U){return le(N,U,void 0)}var ue=S(o(G,{createIsNestedEqual:function(){return l}}));function Oe(N,U){return ue(N,U,void 0)}var Me=S(Z);function je(N,U){return Me(N,U,new WeakMap)}var yn=S(o(Z,{createIsNestedEqual:function(){return l}}));function Rr(N,U){return yn(N,U,new WeakMap)}function Ir(N){return S(o(G,N(G)))}function Sd(N){var U=S(o(Z,N(Z)));return function(J,Y,K){return K===void 0&&(K=new WeakMap),U(J,Y,K)}}n.circularDeepEqual=je,n.circularShallowEqual=Rr,n.createCustomCircularEqual=Sd,n.createCustomEqual=Ir,n.deepEqual=ae,n.sameValueZeroEqual=l,n.shallowEqual=Oe,Object.defineProperty(n,"__esModule",{value:!0})})})(In,In.exports);var wn=In.exports,B={},ei=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(B,"__esModule",{value:!0}),B.bottom=Tn,B.childrenEqual=ri,B.cloneLayout=zr,B.cloneLayoutItem=Fe,B.collides=Lt,B.compact=Ur,B.compactItem=Wr,B.compactType=pi,B.correctBounds=Hr,B.fastPositionEqual=ai,B.fastRGLPropsEqual=void 0,B.getAllCollisions=$r,B.getFirstCollision=qe,B.getLayoutItem=xn,B.getStatics=On,B.modifyLayout=Vr,B.moveElement=St,B.moveElementAwayFromCollision=Mn,B.noop=void 0,B.perc=ii,B.resizeItemInDirection=li,B.setTopLeft=ui,B.setTransform=ci,B.sortLayoutItems=Ln,B.sortLayoutItemsByColRow=Xr,B.sortLayoutItemsByRowCol=qr,B.synchronizeLayoutWithChildren=di,B.validateLayout=fi,B.withLayoutItem=ni;var Ar=wn,yt=ti(_);function ti(e){return e&&e.__esModule?e:{default:e}}function Tn(e){let t=0,n;for(let r=0,a=e.length;r<a;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function zr(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Fe(e[n]);return t}function Vr(e,t){const n=Array(e.length);for(let r=0,a=e.length;r<a;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function ni(e,t,n){let r=xn(e,t);return r?(r=n(Fe(r)),e=Vr(e,r),[e,r]):[e,null]}function Fe(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 ri(e,t){return(0,Ar.deepEqual)(yt.default.Children.map(e,n=>n==null?void 0:n.key),yt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Ar.deepEqual)(yt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),yt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}B.fastRGLPropsEqual=ei;function ai(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Lt(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 Ur(e,t,n,r){const a=On(e),o=Ln(e,t),i=Array(e.length);for(let c=0,l=o.length;c<l;c++){let u=Fe(o[c]);u.static||(u=Wr(a,u,t,n,o,r),a.push(u)),i[e.indexOf(o[c])]=u,u.moved=!1}return i}const oi={x:"w",y:"h"};function _n(e,t,n,r){const a=oi[r];t[r]+=1;const o=e.map(i=>i.i).indexOf(t.i);for(let i=o+1;i<e.length;i++){const c=e[i];if(!c.static){if(c.y>t.y+t.h)break;Lt(t,c)&&_n(e,c,n+t[a],r)}}t[r]=n}function Wr(e,t,n,r,a,o){const i=n==="vertical",c=n==="horizontal";if(i)for(t.y=Math.min(Tn(e),t.y);t.y>0&&!qe(e,t);)t.y--;else if(c)for(;t.x>0&&!qe(e,t);)t.x--;let l;for(;(l=qe(e,t))&&!(n===null&&o);)if(c?_n(a,t,l.x+l.w,"x"):_n(a,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qe(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Hr(e,t){const n=On(e);for(let r=0,a=e.length;r<a;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;qe(n,o);)o.y++}return e}function xn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qe(e,t){for(let n=0,r=e.length;n<r;n++)if(Lt(e[n],t))return e[n]}function $r(e,t){return e.filter(n=>Lt(n,t))}function On(e){return e.filter(t=>t.static)}function St(e,t,n,r,a,o,i,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 u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=Ln(e,i);(i==="vertical"&&typeof r=="number"?d>=r:i==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const y=$r(h,t),C=y.length>0;if(C&&l)return zr(e);if(C&&o)return`${t.i}`,t.x=u,t.y=d,t.moved=!1,e;for(let b=0,T=y.length;b<T;b++){const I=y[b];`${t.i}${t.x}${t.y}${I.i}${I.x}${I.y}`,!I.moved&&(I.static?e=Mn(e,I,t,a,i):e=Mn(e,t,I,a,i))}return e}function Mn(e,t,n,r,a,o){const i=a==="horizontal",c=a==="vertical",l=t.static;if(r){r=!1;const h={x:i?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"},p=qe(e,h),y=p&&p.y+p.h>t.y,C=p&&t.x+t.w>p.x;if(p){if(y&&c)return St(e,n,void 0,t.y+1,r,l,a);if(y&&a==null)return t.y=n.y,n.y=n.y+n.h,e;if(C&&i)return St(e,t,n.x,void 0,r,l,a)}else return`${n.i}${h.x}${h.y}`,St(e,n,i?h.x:void 0,c?h.y:void 0,r,l,a)}const u=i?n.x+1:void 0,d=c?n.y+1:void 0;return u==null&&d==null?e:St(e,n,i?n.x+1:void 0,c?n.y+1:void 0,r,l,a)}function ii(e){return e*100+"%"}const Br=(e,t,n,r)=>e+n>r?t:n,Gr=(e,t,n)=>e<0?t:n,Fr=e=>Math.max(0,e),Dn=e=>Math.max(0,e),En=(e,t,n)=>{let{left:r,height:a,width:o}=t;const i=e.top-(a-e.height);return{left:r,width:o,height:Gr(i,e.height,a),top:Dn(i)}},Pn=(e,t,n)=>{let{top:r,left:a,height:o,width:i}=t;return{top:r,height:o,width:Br(e.left,e.width,i,n),left:Fr(a)}},Nn=(e,t,n)=>{let{top:r,height:a,width:o}=t;const i=e.left-(o-e.width);return{height:a,width:i<0?e.width:Br(e.left,e.width,o,n),top:Dn(r),left:Fr(i)}},jn=(e,t,n)=>{let{top:r,left:a,height:o,width:i}=t;return{width:i,left:a,height:Gr(r,e.height,o),top:Dn(r)}},si={n:En,ne:function(){return En(arguments.length<=0?void 0:arguments[0],Pn(...arguments))},e:Pn,se:function(){return jn(arguments.length<=0?void 0:arguments[0],Pn(...arguments))},s:jn,sw:function(){return jn(arguments.length<=0?void 0:arguments[0],Nn(...arguments))},w:Nn,nw:function(){return En(arguments.length<=0?void 0:arguments[0],Nn(...arguments))}};function li(e,t,n,r){const a=si[e];return a?a(t,{...t,...n},r):n}function ci(e){let{top:t,left:n,width:r,height:a}=e;const o=`translate(${n}px,${t}px)`;return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:`${r}px`,height:`${a}px`,position:"absolute"}}function ui(e){let{top:t,left:n,width:r,height:a}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${a}px`,position:"absolute"}}function Ln(e,t){return t==="horizontal"?Xr(e):t==="vertical"?qr(e):e}function qr(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 Xr(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 di(e,t,n,r,a){e=e||[];const o=[];yt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=xn(e,String(c.key)),u=c.props["data-grid"];l&&u==null?o.push(Fe(l)):u?o.push(Fe({...u,i:c.key})):o.push(Fe({w:1,h:1,x:0,y:Tn(o),i:String(c.key)}))});const i=Hr(o,{cols:n});return a?i:Ur(i,r,n)}function fi(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,a=e.length;r<a;r++){const o=e[r];for(let i=0;i<n.length;i++)if(typeof o[n[i]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[i]+" must be a number!")}}function pi(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}function $d(){}const hi=()=>{};B.noop=hi;var De={};Object.defineProperty(De,"__esModule",{value:!0}),De.calcGridColWidth=kt,De.calcGridItemPosition=gi,De.calcGridItemWHPx=kn,De.calcWH=vi,De.calcXY=mi,De.clamp=Xe;function kt(e){const{margin:t,containerPadding:n,containerWidth:r,cols:a}=e;return(r-t[0]*(a-1)-n[0]*2)/a}function kn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function gi(e,t,n,r,a,o){const{margin:i,containerPadding:c,rowHeight:l}=e,u=kt(e),d={};return o&&o.resizing?(d.width=Math.round(o.resizing.width),d.height=Math.round(o.resizing.height)):(d.width=kn(r,u,i[0]),d.height=kn(a,l,i[1])),o&&o.dragging?(d.top=Math.round(o.dragging.top),d.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(d.top=Math.round(o.resizing.top),d.left=Math.round(o.resizing.left)):(d.top=Math.round((l+i[1])*n+c[1]),d.left=Math.round((u+i[0])*t+c[0])),d}function mi(e,t,n,r,a){const{margin:o,cols:i,rowHeight:c,maxRows:l}=e,u=kt(e);let d=Math.round((n-o[0])/(u+o[0])),h=Math.round((t-o[1])/(c+o[1]));return d=Xe(d,0,i-r),h=Xe(h,0,l-a),{x:d,y:h}}function vi(e,t,n,r,a,o){const{margin:i,maxRows:c,cols:l,rowHeight:u}=e,d=kt(e);let h=Math.round((t+i[0])/(d+i[0])),p=Math.round((n+i[1])/(u+i[1])),y=Xe(h,0,l-r),C=Xe(p,0,c-a);return["sw","w","nw"].indexOf(o)!==-1&&(y=Xe(h,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(C=Xe(p,0,c)),{w:y,h:C}}function Xe(e,t,n){return Math.max(Math.min(e,n),t)}var At={},Yr={exports:{}},yi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Si=yi,bi=Si;function Kr(){}function Zr(){}Zr.resetWarningCache=Kr;var Ci=function(){function e(r,a,o,i,c,l){if(l!==bi){var u=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 u.name="Invariant Violation",u}}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:Zr,resetWarningCache:Kr};return n.PropTypes=n,n};Yr.exports=Ci();var He=Yr.exports,zt={exports:{}},Jr={},re={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.dontSetMe=_i,Ee.findInArray=Ri,Ee.int=Ti,Ee.isFunction=Ii,Ee.isNum=wi;function Ri(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Ii(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function wi(e){return typeof e=="number"&&!isNaN(e)}function Ti(e){return parseInt(e,10)}function _i(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 Ye={};Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.browserPrefixToKey=ea,Ye.browserPrefixToStyle=xi,Ye.default=void 0,Ye.getPrefix=Qr;const An=["Moz","Webkit","O","ms"];function Qr(){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<An.length;r++)if(ea(t,An[r])in n)return An[r];return""}function ea(e,t){return t?"".concat(t).concat(Oi(e)):e}function xi(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Oi(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}Ye.default=Qr(),Object.defineProperty(re,"__esModule",{value:!0}),re.addClassName=aa,re.addEvent=Ei,re.addUserSelectStyles=Hi,re.createCSSTransform=zi,re.createSVGTransform=Vi,re.getTouch=Ui,re.getTouchIdentifier=Wi,re.getTranslation=zn,re.innerHeight=Li,re.innerWidth=ki,re.matchesSelector=ra,re.matchesSelectorAndParentsTo=Di,re.offsetXYFromParent=Ai,re.outerHeight=Ni,re.outerWidth=ji,re.removeClassName=oa,re.removeEvent=Pi,re.removeUserSelectStyles=$i;var Ce=Ee,ta=Mi(Ye);function na(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(na=function(r){return r?n:t})(e)}function Mi(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=na(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}let Vt="";function ra(e,t){return Vt||(Vt=(0,Ce.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Ce.isFunction)(e[n])})),(0,Ce.isFunction)(e[Vt])?e[Vt](t):!1}function Di(e,t,n){let r=e;do{if(ra(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ei(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,a):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function Pi(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,a):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function Ni(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Ce.int)(n.borderTopWidth),t+=(0,Ce.int)(n.borderBottomWidth),t}function ji(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Ce.int)(n.borderLeftWidth),t+=(0,Ce.int)(n.borderRightWidth),t}function Li(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Ce.int)(n.paddingTop),t-=(0,Ce.int)(n.paddingBottom),t}function ki(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Ce.int)(n.paddingLeft),t-=(0,Ce.int)(n.paddingRight),t}function Ai(e,t,n){const a=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-a.left)/n,i=(e.clientY+t.scrollTop-a.top)/n;return{x:o,y:i}}function zi(e,t){const n=zn(e,t,"px");return{[(0,ta.browserPrefixToKey)("transform",ta.default)]:n}}function Vi(e,t){return zn(e,t,"")}function zn(e,t,n){let{x:r,y:a}=e,o="translate(".concat(r).concat(n,",").concat(a).concat(n,")");if(t){const i="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);o="translate(".concat(i,", ").concat(c,")")+o}return o}function Ui(e,t){return e.targetTouches&&(0,Ce.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Ce.findInArray)(e.changedTouches,n=>t===n.identifier)}function Wi(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Hi(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
|
+
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
11
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&aa(e.body,"react-draggable-transparent-selection")}function $i(e){if(e)try{if(e.body&&oa(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 aa(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function oa(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Pe={};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.canDragX=Fi,Pe.canDragY=qi,Pe.createCoreData=Yi,Pe.createDraggableData=Ki,Pe.getBoundPosition=Bi,Pe.getControlPosition=Xi,Pe.snapToGrid=Gi;var Re=Ee,it=re;function Bi(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Zi(r);const a=Vn(e);if(typeof r=="string"){const{ownerDocument:o}=a,i=o.defaultView;let c;if(r==="parent"?c=a.parentNode:c=o.querySelector(r),!(c instanceof i.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,u=i.getComputedStyle(a),d=i.getComputedStyle(l);r={left:-a.offsetLeft+(0,Re.int)(d.paddingLeft)+(0,Re.int)(u.marginLeft),top:-a.offsetTop+(0,Re.int)(d.paddingTop)+(0,Re.int)(u.marginTop),right:(0,it.innerWidth)(l)-(0,it.outerWidth)(a)-a.offsetLeft+(0,Re.int)(d.paddingRight)-(0,Re.int)(u.marginRight),bottom:(0,it.innerHeight)(l)-(0,it.outerHeight)(a)-a.offsetTop+(0,Re.int)(d.paddingBottom)-(0,Re.int)(u.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 Gi(e,t,n){const r=Math.round(t/e[0])*e[0],a=Math.round(n/e[1])*e[1];return[r,a]}function Fi(e){return e.props.axis==="both"||e.props.axis==="x"}function qi(e){return e.props.axis==="both"||e.props.axis==="y"}function Xi(e,t,n){const r=typeof t=="number"?(0,it.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const a=Vn(n),o=n.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,it.offsetXYFromParent)(r||e,o,n.props.scale)}function Yi(e,t,n){const r=!(0,Re.isNum)(e.lastX),a=Vn(e);return r?{node:a,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:a,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Ki(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 Zi(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Vn(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var Ut={},Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.default=Ji;function Ji(){}Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.default=void 0;var Un=es(_),Se=Hn(He),Qi=Hn(Tr),pe=re,$e=Pe,Wn=Ee,bt=Hn(Wt);function Hn(e){return e&&e.__esModule?e:{default:e}}function ia(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ia=function(r){return r?n:t})(e)}function es(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ia(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function me(e,t,n){return t=ts(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ts(e){var t=ns(e,"string");return typeof t=="symbol"?t:String(t)}function ns(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 xe={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Be=xe.mouse,Ht=class extends Un.Component{constructor(){super(...arguments),me(this,"dragging",!1),me(this,"lastX",NaN),me(this,"lastY",NaN),me(this,"touchIdentifier",null),me(this,"mounted",!1),me(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,pe.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,pe.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const a=(0,pe.getTouchIdentifier)(t);this.touchIdentifier=a;const o=(0,$e.getControlPosition)(t,a,this);if(o==null)return;const{x:i,y:c}=o,l=(0,$e.createCoreData)(this,i,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,pe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=i,this.lastY=c,(0,pe.addEvent)(r,Be.move,this.handleDrag),(0,pe.addEvent)(r,Be.stop,this.handleDragStop))}),me(this,"handleDrag",t=>{const n=(0,$e.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:a}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=a-this.lastY;if([c,l]=(0,$e.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,a=this.lastY+l}const o=(0,$e.createCoreData)(this,r,a);if((0,bt.default)("DraggableCore: handleDrag: %j",o),this.props.onDrag(t,o)===!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=a}),me(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,$e.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:a}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,u=a-this.lastY||0;[l,u]=(0,$e.snapToGrid)(this.props.grid,l,u),r=this.lastX+l,a=this.lastY+u}const o=(0,$e.createCoreData)(this,r,a);if(this.props.onStop(t,o)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,pe.removeUserSelectStyles)(c.ownerDocument),(0,bt.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,bt.default)("DraggableCore: Removing handlers"),(0,pe.removeEvent)(c.ownerDocument,Be.move,this.handleDrag),(0,pe.removeEvent)(c.ownerDocument,Be.stop,this.handleDragStop))}),me(this,"onMouseDown",t=>(Be=xe.mouse,this.handleDragStart(t))),me(this,"onMouseUp",t=>(Be=xe.mouse,this.handleDragStop(t))),me(this,"onTouchStart",t=>(Be=xe.touch,this.handleDragStart(t))),me(this,"onTouchEnd",t=>(Be=xe.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,pe.addEvent)(t,xe.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,pe.removeEvent)(n,xe.mouse.move,this.handleDrag),(0,pe.removeEvent)(n,xe.touch.move,this.handleDrag),(0,pe.removeEvent)(n,xe.mouse.stop,this.handleDragStop),(0,pe.removeEvent)(n,xe.touch.stop,this.handleDragStop),(0,pe.removeEvent)(t,xe.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,pe.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:Qi.default.findDOMNode(this)}render(){return Un.cloneElement(Un.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Ut.default=Ht,me(Ht,"displayName","DraggableCore"),me(Ht,"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:Wn.dontSetMe,style:Wn.dontSetMe,transform:Wn.dontSetMe}),me(Ht,"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=p(_),n=d(He),r=d(Tr),a=d(We),o=re,i=Pe,c=Ee,l=d(Ut),u=d(Wt);function d(m){return m&&m.__esModule?m:{default:m}}function h(m){if(typeof WeakMap!="function")return null;var S=new WeakMap,R=new WeakMap;return(h=function(g){return g?R:S})(m)}function p(m,S){if(!S&&m&&m.__esModule)return m;if(m===null||typeof m!="object"&&typeof m!="function")return{default:m};var R=h(S);if(R&&R.has(m))return R.get(m);var g={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in m)if(x!=="default"&&Object.prototype.hasOwnProperty.call(m,x)){var E=w?Object.getOwnPropertyDescriptor(m,x):null;E&&(E.get||E.set)?Object.defineProperty(g,x,E):g[x]=m[x]}return g.default=m,R&&R.set(m,g),g}function y(){return y=Object.assign?Object.assign.bind():function(m){for(var S=1;S<arguments.length;S++){var R=arguments[S];for(var g in R)Object.prototype.hasOwnProperty.call(R,g)&&(m[g]=R[g])}return m},y.apply(this,arguments)}function C(m,S,R){return S=b(S),S in m?Object.defineProperty(m,S,{value:R,enumerable:!0,configurable:!0,writable:!0}):m[S]=R,m}function b(m){var S=T(m,"string");return typeof S=="symbol"?S:String(S)}function T(m,S){if(typeof m!="object"||m===null)return m;var R=m[Symbol.toPrimitive];if(R!==void 0){var g=R.call(m,S||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(m)}class I extends t.Component{static getDerivedStateFromProps(S,R){let{position:g}=S,{prevPropsPosition:w}=R;return g&&(!w||g.x!==w.x||g.y!==w.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:g,prevPropsPosition:w}),{x:g.x,y:g.y,prevPropsPosition:{...g}}):null}constructor(S){super(S),C(this,"onDragStart",(R,g)=>{if((0,u.default)("Draggable: onDragStart: %j",g),this.props.onStart(R,(0,i.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),C(this,"onDrag",(R,g)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",g);const w=(0,i.createDraggableData)(this,g),x={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:V,y:$}=x;x.x+=this.state.slackX,x.y+=this.state.slackY;const[O,L]=(0,i.getBoundPosition)(this,x.x,x.y);x.x=O,x.y=L,x.slackX=this.state.slackX+(V-x.x),x.slackY=this.state.slackY+($-x.y),w.x=x.x,w.y=x.y,w.deltaX=x.x-this.state.x,w.deltaY=x.y-this.state.y}if(this.props.onDrag(R,w)===!1)return!1;this.setState(x)}),C(this,"onDragStop",(R,g)=>{if(!this.state.dragging||this.props.onStop(R,(0,i.createDraggableData)(this,g))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",g);const x={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:V,y:$}=this.props.position;x.x=V,x.y=$}this.setState(x)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},S.position&&!(S.onDrag||S.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 S,R;return(S=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&S!==void 0?S:r.default.findDOMNode(this)}render(){const{axis:S,bounds:R,children:g,defaultPosition:w,defaultClassName:x,defaultClassNameDragging:E,defaultClassNameDragged:V,position:$,positionOffset:O,scale:L,...D}=this.props;let j={},A=null;const Z=!!!$||this.state.dragging,le=$||w,ae={x:(0,i.canDragX)(this)&&Z?this.state.x:le.x,y:(0,i.canDragY)(this)&&Z?this.state.y:le.y};this.state.isElementSVG?A=(0,o.createSVGTransform)(ae,O):j=(0,o.createCSSTransform)(ae,O);const ue=(0,a.default)(g.props.className||"",x,{[E]:this.state.dragging,[V]:this.state.dragged});return t.createElement(l.default,y({},D,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:ue,style:{...g.props.style,...j},transform:A}))}}e.default=I,C(I,"displayName","Draggable"),C(I,"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}),C(I,"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})}(Jr);const{default:sa,DraggableCore:rs}=Jr;zt.exports=sa,zt.exports.default=sa,zt.exports.DraggableCore=rs;var la=zt.exports,$t={exports:{}},Ct={},$n={};$n.__esModule=!0,$n.cloneElement=cs;var as=os(_);function os(e){return e&&e.__esModule?e:{default:e}}function ca(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ca(Object(n),!0).forEach(function(r){is(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ca(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function is(e,t,n){return t=ss(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ss(e){var t=ls(e,"string");return typeof t=="symbol"?t:String(t)}function ls(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 cs(e,t){return t.style&&e.props.style&&(t.style=ua(ua({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),as.default.cloneElement(e,t)}var Rt={};Rt.__esModule=!0,Rt.resizableProps=void 0;var W=us(He);function us(e){return e&&e.__esModule?e:{default:e}}var ds={axis:W.default.oneOf(["both","x","y","none"]),className:W.default.string,children:W.default.element.isRequired,draggableOpts:W.default.shape({allowAnyClick:W.default.bool,cancel:W.default.string,children:W.default.node,disabled:W.default.bool,enableUserSelectHack:W.default.bool,offsetParent:W.default.node,grid:W.default.arrayOf(W.default.number),handle:W.default.string,nodeRef:W.default.object,onStart:W.default.func,onDrag:W.default.func,onStop:W.default.func,onMouseDown:W.default.func,scale:W.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n[0];if(a.axis==="both"||a.axis==="y"){var o;return(o=W.default.number).isRequired.apply(o,n)}return W.default.number.apply(W.default,n)},handle:W.default.oneOfType([W.default.node,W.default.func]),handleSize:W.default.arrayOf(W.default.number),lockAspectRatio:W.default.bool,maxConstraints:W.default.arrayOf(W.default.number),minConstraints:W.default.arrayOf(W.default.number),onResizeStop:W.default.func,onResizeStart:W.default.func,onResize:W.default.func,resizeHandles:W.default.arrayOf(W.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:W.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n[0];if(a.axis==="both"||a.axis==="x"){var o;return(o=W.default.number).isRequired.apply(o,n)}return W.default.number.apply(W.default,n)}};Rt.resizableProps=ds,Ct.__esModule=!0,Ct.default=void 0;var It=ms(_),fs=la,ps=$n,hs=Rt,gs=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function da(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(da=function(a){return a?n:t})(e)}function ms(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=da(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function Bn(){return Bn=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},Bn.apply(this,arguments)}function vs(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function fa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Gn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fa(Object(n),!0).forEach(function(r){ys(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fa(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ys(e,t,n){return t=Ss(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ss(e){var t=bs(e,"string");return typeof t=="symbol"?t:String(t)}function bs(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 Cs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Fn(e,t)}function Fn(e,t){return Fn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Fn(e,t)}var qn=function(e){Cs(t,e);function t(){for(var r,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=e.call.apply(e,[this].concat(o))||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(a,o){var i=this.props,c=i.minConstraints,l=i.maxConstraints,u=i.lockAspectRatio;if(!c&&!l&&!u)return[a,o];if(u){var d=this.props.width/this.props.height,h=a-this.props.width,p=o-this.props.height;Math.abs(h)>Math.abs(p*d)?o=a/d:a=o*d}var y=a,C=o,b=this.slack||[0,0],T=b[0],I=b[1];return a+=T,o+=I,c&&(a=Math.max(c[0],a),o=Math.max(c[1],o)),l&&(a=Math.min(l[0],a),o=Math.min(l[1],o)),this.slack=[T+(y-a),I+(C-o)],[a,o]},n.resizeHandler=function(a,o){var i=this;return function(c,l){var u=l.node,d=l.deltaX,h=l.deltaY;a==="onResizeStart"&&i.resetData();var p=(i.props.axis==="both"||i.props.axis==="x")&&o!=="n"&&o!=="s",y=(i.props.axis==="both"||i.props.axis==="y")&&o!=="e"&&o!=="w";if(!(!p&&!y)){var C=o[0],b=o[o.length-1],T=u.getBoundingClientRect();if(i.lastHandleRect!=null){if(b==="w"){var I=T.left-i.lastHandleRect.left;d+=I}if(C==="n"){var m=T.top-i.lastHandleRect.top;h+=m}}i.lastHandleRect=T,b==="w"&&(d=-d),C==="n"&&(h=-h);var S=i.props.width+(p?d/i.props.transformScale:0),R=i.props.height+(y?h/i.props.transformScale:0),g=i.runConstraints(S,R);S=g[0],R=g[1];var w=S!==i.props.width||R!==i.props.height,x=typeof i.props[a]=="function"?i.props[a]:null,E=a==="onResize"&&!w;x&&!E&&(c.persist==null||c.persist(),x(c,{node:u,size:{width:S,height:R},handle:o})),a==="onResizeStop"&&i.resetData()}}},n.renderResizeHandle=function(a,o){var i=this.props.handle;if(!i)return It.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+a,ref:o});if(typeof i=="function")return i(a,o);var c=typeof i.type=="string",l=Gn({ref:o},c?{}:{handleAxis:a});return It.cloneElement(i,l)},n.render=function(){var a=this,o=this.props,i=o.children,c=o.className,l=o.draggableOpts;o.width,o.height,o.handle,o.handleSize,o.lockAspectRatio,o.axis,o.minConstraints,o.maxConstraints,o.onResize,o.onResizeStop,o.onResizeStart;var u=o.resizeHandles;o.transformScale;var d=vs(o,gs);return(0,ps.cloneElement)(i,Gn(Gn({},d),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(i.props.children,u.map(function(h){var p,y=(p=a.handleRefs[h])!=null?p:a.handleRefs[h]=It.createRef();return It.createElement(fs.DraggableCore,Bn({},l,{nodeRef:y,key:"resizableHandle-"+h,onStop:a.resizeHandler("onResizeStop",h),onStart:a.resizeHandler("onResizeStart",h),onDrag:a.resizeHandler("onResize",h)}),a.renderResizeHandle(h,y))}))}))},t}(It.Component);Ct.default=qn,qn.propTypes=hs.resizableProps,qn.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var Bt={};Bt.__esModule=!0,Bt.default=void 0;var Xn=_s(_),Rs=pa(He),Is=pa(Ct),ws=Rt,Ts=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function pa(e){return e&&e.__esModule?e:{default:e}}function ha(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ha=function(a){return a?n:t})(e)}function _s(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ha(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}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 ga(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Gt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ga(Object(n),!0).forEach(function(r){xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ga(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=Ms(e,"string");return typeof t=="symbol"?t:String(t)}function Ms(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){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Es(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Kn(e,t)}function Kn(e,t){return Kn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Kn(e,t)}var ma=function(e){Es(t,e);function t(){for(var r,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=e.call.apply(e,[this].concat(o))||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 u=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(u)},r}t.getDerivedStateFromProps=function(a,o){return o.propsWidth!==a.width||o.propsHeight!==a.height?{width:a.width,height:a.height,propsWidth:a.width,propsHeight:a.height}:null};var n=t.prototype;return n.render=function(){var a=this.props,o=a.handle,i=a.handleSize;a.onResize;var c=a.onResizeStart,l=a.onResizeStop,u=a.draggableOpts,d=a.minConstraints,h=a.maxConstraints,p=a.lockAspectRatio,y=a.axis;a.width,a.height;var C=a.resizeHandles,b=a.style,T=a.transformScale,I=Ds(a,Ts);return Xn.createElement(Is.default,{axis:y,draggableOpts:u,handle:o,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:h,minConstraints:d,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:C,transformScale:T,width:this.state.width},Xn.createElement("div",Yn({},I,{style:Gt(Gt({},b),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Xn.Component);Bt.default=ma,ma.propTypes=Gt(Gt({},ws.resizableProps),{},{children:Rs.default.element}),$t.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},$t.exports.Resizable=Ct.default,$t.exports.ResizableBox=Bt.default;var Ps=$t.exports,Ve={};Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.resizeHandleType=Ve.resizeHandleAxesType=Ve.default=void 0;var H=va(He),Ns=va(_);function va(e){return e&&e.__esModule?e:{default:e}}const js=Ve.resizeHandleAxesType=H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),Ls=Ve.resizeHandleType=H.default.oneOfType([H.default.node,H.default.func]);Ve.default={className:H.default.string,style:H.default.object,width:H.default.number,autoSize:H.default.bool,cols:H.default.number,draggableCancel:H.default.string,draggableHandle:H.default.string,verticalCompact:function(e){e.verticalCompact},compactType:H.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&B.validateLayout(t,"layout")},margin:H.default.arrayOf(H.default.number),containerPadding:H.default.arrayOf(H.default.number),rowHeight:H.default.number,maxRows:H.default.number,isBounded:H.default.bool,isDraggable:H.default.bool,isResizable:H.default.bool,allowOverlap:H.default.bool,preventCollision:H.default.bool,useCSSTransforms:H.default.bool,transformScale:H.default.number,isDroppable:H.default.bool,resizeHandles:js,resizeHandle:Ls,onLayoutChange:H.default.func,onDragStart:H.default.func,onDrag:H.default.func,onDragStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,onResizeStop:H.default.func,onDrop:H.default.func,droppingItem:H.default.shape({i:H.default.string.isRequired,w:H.default.number.isRequired,h:H.default.number.isRequired}),children:function(e,t){const n=e[t],r={};Ns.default.Children.forEach(n,function(a){if((a==null?void 0:a.key)!=null){if(r[a.key])throw new Error('Duplicate child key "'+a.key+'" found! This will cause problems in ReactGridLayout.');r[a.key]=!0}})},innerRef:H.default.any},Object.defineProperty(At,"__esModule",{value:!0}),At.default=void 0;var st=Zn(_),X=Zn(He),ks=la,As=Ps,lt=B,fe=De,ya=Ve,zs=Zn(We);function Zn(e){return e&&e.__esModule?e:{default:e}}function Ne(e,t,n){return t=Vs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vs(e){var t=Us(e,"string");return typeof t=="symbol"?t:String(t)}function Us(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 Jn extends st.default.Component{constructor(){super(...arguments),Ne(this,"state",{resizing:null,dragging:null,className:""}),Ne(this,"elementRef",st.default.createRef()),Ne(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:a,transformScale:o}=this.props;if(!a)return;const i={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.left/o,h=l.left/o,p=u.top/o,y=l.top/o;i.left=d-h+c.scrollLeft,i.top=p-y+c.scrollTop,this.setState({dragging:i});const{x:C,y:b}=(0,fe.calcXY)(this.getPositionParams(),i.top,i.left,this.props.w,this.props.h);return a.call(this,this.props.i,C,b,{e:t,node:r,newPosition:i})}),Ne(this,"onDrag",(t,n)=>{let{node:r,deltaX:a,deltaY:o}=n;const{onDrag:i}=this.props;if(!i)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+o,l=this.state.dragging.left+a;const{isBounded:u,i:d,w:h,h:p,containerWidth:y}=this.props,C=this.getPositionParams();if(u){const{offsetParent:S}=r;if(S){const{margin:R,rowHeight:g,containerPadding:w}=this.props,x=S.clientHeight-(0,fe.calcGridItemWHPx)(p,g,R[1]);c=(0,fe.clamp)(c-w[1],0,x);const E=(0,fe.calcGridColWidth)(C),V=y-(0,fe.calcGridItemWHPx)(h,E,R[0]);l=(0,fe.clamp)(l-w[0],0,V)}}const b={top:c,left:l};this.setState({dragging:b});const{containerPadding:T}=this.props,{x:I,y:m}=(0,fe.calcXY)(C,c-T[1],l-T[0],h,p);return i.call(this,d,I,m,{e:t,node:r,newPosition:b})}),Ne(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:o,h:i,i:c,containerPadding:l}=this.props,{left:u,top:d}=this.state.dragging,h={top:d,left:u};this.setState({dragging:null});const{x:p,y}=(0,fe.calcXY)(this.getPositionParams(),d-l[1],u-l[0],o,i);return a.call(this,c,p,y,{e:t,node:r,newPosition:h})}),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,fe.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),a=(0,fe.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,lt.fastPositionEqual)(r,a)||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 a=t.droppingPosition||{left:0,top:0},{dragging:o}=this.state,i=o&&n.left!==a.left||n.top!==a.top;if(!o)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(i){const c=n.left-o.left,l=n.top-o.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:a}=this.props;let o;return a?o=(0,lt.setTransform)(t):(o=(0,lt.setTopLeft)(t),n&&(o.left=(0,lt.perc)(t.left/r),o.width=(0,lt.perc)(t.width/r))),o}mixinDraggable(t,n){return st.default.createElement(ks.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,a)=>n(r,a,t)}mixinResizable(t,n,r){const{cols:a,minW:o,minH:i,maxW:c,maxH:l,transformScale:u,resizeHandles:d,resizeHandle:h}=this.props,p=this.getPositionParams(),y=(0,fe.calcGridItemPosition)(p,0,0,a,0).width,C=(0,fe.calcGridItemPosition)(p,0,0,o,i),b=(0,fe.calcGridItemPosition)(p,0,0,c,l),T=[C.width,C.height],I=[Math.min(b.width,y),Math.min(b.height,1/0)];return st.default.createElement(As.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:T,maxConstraints:I,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:u,resizeHandles:d,handle:h},t)}onResizeHandler(t,n,r,a){let{node:o,size:i,handle:c}=n;const l=this.props[a];if(!l)return;const{x:u,y:d,i:h,maxH:p,minH:y,containerWidth:C}=this.props,{minW:b,maxW:T}=this.props;let I=i;o&&(I=(0,lt.resizeItemInDirection)(c,r,i,C),this.setState({resizing:a==="onResizeStop"?null:I}));let{w:m,h:S}=(0,fe.calcWH)(this.getPositionParams(),I.width,I.height,u,d,c);m=(0,fe.clamp)(m,Math.max(b,1),T),S=(0,fe.clamp)(S,y,p),l.call(this,h,m,S,{e:t,node:o,size:I,handle:c})}render(){const{x:t,y:n,w:r,h:a,isDraggable:o,isResizable:i,droppingPosition:c,useCSSTransforms:l}=this.props,u=(0,fe.calcGridItemPosition)(this.getPositionParams(),t,n,r,a,this.state),d=st.default.Children.only(this.props.children);let h=st.default.cloneElement(d,{ref:this.elementRef,className:(0,zs.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":o,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(u)}});return h=this.mixinResizable(h,u,i),h=this.mixinDraggable(h,o),h}}At.default=Jn,Ne(Jn,"propTypes",{children:X.default.element,cols:X.default.number.isRequired,containerWidth:X.default.number.isRequired,rowHeight:X.default.number.isRequired,margin:X.default.array.isRequired,maxRows:X.default.number.isRequired,containerPadding:X.default.array.isRequired,x:X.default.number.isRequired,y:X.default.number.isRequired,w:X.default.number.isRequired,h:X.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:X.default.string.isRequired,resizeHandles:ya.resizeHandleAxesType,resizeHandle:ya.resizeHandleType,onDragStop:X.default.func,onDragStart:X.default.func,onDrag:X.default.func,onResizeStop:X.default.func,onResizeStart:X.default.func,onResize:X.default.func,isDraggable:X.default.bool.isRequired,isResizable:X.default.bool.isRequired,isBounded:X.default.bool.isRequired,static:X.default.bool,useCSSTransforms:X.default.bool.isRequired,transformScale:X.default.number,className:X.default.string,handle:X.default.string,cancel:X.default.string,droppingPosition:X.default.shape({e:X.default.object.isRequired,left:X.default.number.isRequired,top:X.default.number.isRequired})}),Ne(Jn,"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 Ke=Bs(_),Qn=wn,Ws=er(We),z=B,Hs=De,Sa=er(At),$s=er(Ve);function er(e){return e&&e.__esModule?e:{default:e}}function ba(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ba=function(r){return r?n:t})(e)}function Bs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ba(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function he(e,t,n){return t=Gs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gs(e){var t=Fs(e,"string");return typeof t=="symbol"?t:String(t)}function Fs(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 Ca="react-grid-layout";let Ra=!1;try{Ra=/firefox/i.test(navigator.userAgent)}catch{}class Ft extends Ke.Component{constructor(){super(...arguments),he(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:[]}),he(this,"dragEnterCounter",0),he(this,"onDragStart",(t,n,r,a)=>{let{e:o,node:i}=a;const{layout:c}=this.state,l=(0,z.getLayoutItem)(c,t);if(!l)return;const u={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:u}),this.props.onDragStart(c,l,l,null,o,i)}),he(this,"onDrag",(t,n,r,a)=>{let{e:o,node:i}=a;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,allowOverlap:d,preventCollision:h}=this.props,p=(0,z.getLayoutItem)(l,t);if(!p)return;const y={w:p.w,h:p.h,x:p.x,y:p.y,placeholder:!0,i:t};l=(0,z.moveElement)(l,p,n,r,!0,h,(0,z.compactType)(this.props),u,d),this.props.onDrag(l,c,p,y,o,i),this.setState({layout:d?l:(0,z.compact)(l,(0,z.compactType)(this.props),u),activeDrag:y})}),he(this,"onDragStop",(t,n,r,a)=>{let{e:o,node:i}=a;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,preventCollision:d,allowOverlap:h}=this.props,p=(0,z.getLayoutItem)(l,t);if(!p)return;l=(0,z.moveElement)(l,p,n,r,!0,d,(0,z.compactType)(this.props),u,h);const C=h?l:(0,z.compact)(l,(0,z.compactType)(this.props),u);this.props.onDragStop(C,c,p,null,o,i);const{oldLayout:b}=this.state;this.setState({activeDrag:null,layout:C,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(C,b)}),he(this,"onResizeStart",(t,n,r,a)=>{let{e:o,node:i}=a;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,o,i))}),he(this,"onResize",(t,n,r,a)=>{let{e:o,node:i,size:c,handle:l}=a;const{oldResizeItem:u}=this.state,{layout:d}=this.state,{cols:h,preventCollision:p,allowOverlap:y}=this.props;let C=!1,b,T,I;const[m,S]=(0,z.withLayoutItem)(d,t,g=>{let w;return T=g.x,I=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(T=g.x+(g.w-n),n=g.x!==T&&T<0?g.w:n,T=T<0?0:T),["ne","n","nw"].indexOf(l)!==-1&&(I=g.y+(g.h-r),r=g.y!==I&&I<0?g.h:r,I=I<0?0:I),C=!0),p&&!y&&(w=(0,z.getAllCollisions)(d,{...g,w:n,h:r,x:T,y:I}).filter(E=>E.i!==g.i).length>0,w&&(I=g.y,r=g.h,T=g.x,n=g.w,C=!1)),g.w=n,g.h=r,g});if(!S)return;b=m,C&&(b=(0,z.moveElement)(m,S,T,I,!0,this.props.preventCollision,(0,z.compactType)(this.props),h,y));const R={w:S.w,h:S.h,x:S.x,y:S.y,static:!0,i:t};this.props.onResize(b,u,S,R,o,i),this.setState({layout:y?b:(0,z.compact)(b,(0,z.compactType)(this.props),h),activeDrag:R})}),he(this,"onResizeStop",(t,n,r,a)=>{let{e:o,node:i}=a;const{layout:c,oldResizeItem:l}=this.state,{cols:u,allowOverlap:d}=this.props,h=(0,z.getLayoutItem)(c,t),p=d?c:(0,z.compact)(c,(0,z.compactType)(this.props),u);this.props.onResizeStop(p,l,h,null,o,i);const{oldLayout:y}=this.state;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(p,y)}),he(this,"onDragOver",t=>{var m;if(t.preventDefault(),t.stopPropagation(),Ra&&!((m=t.nativeEvent.target)!=null&&m.classList.contains(Ca)))return!1;const{droppingItem:n,onDropDragOver:r,margin:a,cols:o,rowHeight:i,maxRows:c,width:l,containerPadding:u,transformScale:d}=this.props,h=r==null?void 0:r(t);if(h===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const p={...n,...h},{layout:y}=this.state,C=t.currentTarget.getBoundingClientRect(),b=t.clientX-C.left,T=t.clientY-C.top,I={left:b/d,top:T/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:S,top:R}=this.state.droppingPosition;(S!=b||R!=T)&&this.setState({droppingPosition:I})}}else{const S={cols:o,margin:a,maxRows:c,rowHeight:i,containerWidth:l,containerPadding:u||a},R=(0,Hs.calcXY)(S,T,b,p.w,p.h);this.setState({droppingDOMNode:Ke.createElement("div",{key:p.i}),droppingPosition:I,layout:[...y,{...p,x:R.x,y:R.y,static:!1,isDraggable:!0}]})}}),he(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,a=(0,z.compact)(r.filter(o=>o.i!==t.i),(0,z.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:a,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),he(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),he(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),he(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,a=r.find(o=>o.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,a,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,Qn.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,Qn.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,a=n.layout;this.onLayoutMaybeChanged(r,a)}}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,Qn.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:a,containerPadding:o,rowHeight:i,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return Ke.createElement(Sa.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:a,containerPadding:o||a,maxRows:c,rowHeight:i,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:u},Ke.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:a,cols:o,margin:i,containerPadding:c,rowHeight:l,maxRows:u,isDraggable:d,isResizable:h,isBounded:p,useCSSTransforms:y,transformScale:C,draggableCancel:b,draggableHandle:T,resizeHandles:I,resizeHandle:m}=this.props,{mounted:S,droppingPosition:R}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,w=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&h,x=r.resizeHandles||I,E=g&&p&&r.isBounded!==!1;return Ke.createElement(Sa.default,{containerWidth:a,cols:o,margin:i,containerPadding:c||i,maxRows:u,rowHeight:l,cancel:b,handle:T,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:g,isResizable:w,isBounded:E,useCSSTransforms:y&&S,usePercentages:!S,transformScale:C,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?R:void 0,resizeHandles:x,resizeHandle:m},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:a}=this.props,o=(0,Ws.default)(Ca,t),i={height:this.containerHeight(),...n};return Ke.createElement("div",{ref:a,className:o,style:i,onDrop:r?this.onDrop:z.noop,onDragLeave:r?this.onDragLeave:z.noop,onDragEnter:r?this.onDragEnter:z.noop,onDragOver:r?this.onDragOver:z.noop},Ke.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}vt.default=Ft,he(Ft,"displayName","ReactGridLayout"),he(Ft,"propTypes",$s.default),he(Ft,"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 qt={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.findOrGenerateResponsiveLayout=Ys,Ze.getBreakpointFromWidth=qs,Ze.getColsFromBreakpoint=Xs,Ze.sortBreakpoints=tr;var Xt=B;function qs(e,t){const n=tr(e);let r=n[0];for(let a=1,o=n.length;a<o;a++){const i=n[a];t>e[i]&&(r=i)}return r}function Xs(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function Ys(e,t,n,r,a,o){if(e[n])return(0,Xt.cloneLayout)(e[n]);let i=e[r];const c=tr(t),l=c.slice(c.indexOf(n));for(let u=0,d=l.length;u<d;u++){const h=l[u];if(e[h]){i=e[h];break}}return i=(0,Xt.cloneLayout)(i||[]),(0,Xt.compact)((0,Xt.correctBounds)(i,{cols:a}),o,a)}function tr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=void 0;var Ia=Zs(_),be=wa(He),nr=wn,ct=B,Je=Ze,Ks=wa(vt);function wa(e){return e&&e.__esModule?e:{default:e}}function Ta(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ta=function(r){return r?n:t})(e)}function Zs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ta(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function rr(){return rr=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},rr.apply(this,arguments)}function Yt(e,t,n){return t=Js(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Js(e){var t=Qs(e,"string");return typeof t=="symbol"?t:String(t)}function Qs(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 _a=e=>Object.prototype.toString.call(e);function Kt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class ar extends Ia.Component{constructor(){super(...arguments),Yt(this,"state",this.generateInitialState()),Yt(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:a}=this.props,o=(0,Je.getBreakpointFromWidth)(n,t),i=(0,Je.getColsFromBreakpoint)(o,a),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Je.findOrGenerateResponsiveLayout)(r,n,o,o,i,c),breakpoint:o,cols:i}}static getDerivedStateFromProps(t,n){if(!(0,nr.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:a}=n;return{layout:(0,Je.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,a,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,nr.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,nr.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:a,compactType:o}=this.props,i=this.props.breakpoint||(0,Je.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Je.getColsFromBreakpoint)(i,r),u={...a};if(c!==i||t.breakpoints!==n||t.cols!==r){c in u||(u[c]=(0,ct.cloneLayout)(this.state.layout));let p=(0,Je.findOrGenerateResponsiveLayout)(u,n,i,c,l,o);p=(0,ct.synchronizeLayoutWithChildren)(p,this.props.children,l,o,this.props.allowOverlap),u[i]=p,this.props.onLayoutChange(p,u),this.props.onBreakpointChange(i,l),this.setState({breakpoint:i,layout:p,cols:l})}const d=Kt(this.props.margin,i),h=Kt(this.props.containerPadding,i);this.props.onWidthChange(this.props.width,d,l,h)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:a,margin:o,containerPadding:i,onBreakpointChange:c,onLayoutChange:l,onWidthChange:u,...d}=this.props;return Ia.createElement(Ks.default,rr({},d,{margin:Kt(o,this.state.breakpoint),containerPadding:Kt(i,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}qt.default=ar,Yt(ar,"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(_a(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+_a(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,ct.validateLayout)(e.layouts[n],"layouts."+n)})},width:be.default.number.isRequired,onBreakpointChange:be.default.func,onLayoutChange:be.default.func,onWidthChange:be.default.func}),Yt(ar,"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:ct.noop,onLayoutChange:ct.noop,onWidthChange:ct.noop});var or={},xa=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(a,o){return a[0]===n?(r=o,!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),a=this.__entries__[r];return a&&a[1]},t.prototype.set=function(n,r){var a=e(this.__entries__,n);~a?this.__entries__[a][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,a=e(r,n);~a&&r.splice(a,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 a=0,o=this.__entries__;a<o.length;a++){var i=o[a];n.call(r,i[1],i[0])}},t}()}(),ir=typeof window<"u"&&typeof document<"u"&&window.document===document,Zt=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")()}(),el=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Zt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),tl=2;function nl(e,t){var n=!1,r=!1,a=0;function o(){n&&(n=!1,e()),r&&c()}function i(){el(o)}function c(){var l=Date.now();if(n){if(l-a<tl)return;r=!0}else n=!0,r=!1,setTimeout(i,t);a=l}return c}var rl=20,al=["top","right","bottom","left","width","height","size","weight"],ol=typeof MutationObserver<"u",il=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=nl(this.refresh.bind(this),rl)}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(){!ir||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ol?(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(){!ir||!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,a=al.some(function(o){return!!~r.indexOf(o)});a&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Oa=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var a=r[n];Object.defineProperty(e,a,{value:t[a],enumerable:!1,writable:!1,configurable:!0})}return e},ut=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Zt},Ma=Qt(0,0,0,0);function Jt(e){return parseFloat(e)||0}function Da(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,a){var o=e["border-"+a+"-width"];return r+Jt(o)},0)}function sl(e){for(var t=["top","right","bottom","left"],n={},r=0,a=t;r<a.length;r++){var o=a[r],i=e["padding-"+o];n[o]=Jt(i)}return n}function ll(e){var t=e.getBBox();return Qt(0,0,t.width,t.height)}function cl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Ma;var r=ut(e).getComputedStyle(e),a=sl(r),o=a.left+a.right,i=a.top+a.bottom,c=Jt(r.width),l=Jt(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==t&&(c-=Da(r,"left","right")+o),Math.round(l+i)!==n&&(l-=Da(r,"top","bottom")+i)),!dl(e)){var u=Math.round(c+o)-t,d=Math.round(l+i)-n;Math.abs(u)!==1&&(c-=u),Math.abs(d)!==1&&(l-=d)}return Qt(a.left,a.top,c,l)}var ul=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof ut(e).SVGGraphicsElement}:function(e){return e instanceof ut(e).SVGElement&&typeof e.getBBox=="function"}}();function dl(e){return e===ut(e).document.documentElement}function fl(e){return ir?ul(e)?ll(e):cl(e):Ma}function pl(e){var t=e.x,n=e.y,r=e.width,a=e.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(o.prototype);return Oa(i,{x:t,y:n,width:r,height:a,top:n,right:t+r,bottom:a+n,left:t}),i}function Qt(e,t,n,r){return{x:e,y:t,width:n,height:r}}var hl=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Qt(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}(),gl=function(){function e(t,n){var r=pl(n);Oa(this,{target:t,contentRect:r})}return e}(),ml=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new xa,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 ut(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new hl(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 ut(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 gl(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}(),Ea=typeof WeakMap<"u"?new WeakMap:new xa,Pa=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=il.getInstance(),r=new ml(t,n,this);Ea.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Pa.prototype[e]=function(){var t;return(t=Ea.get(this))[e].apply(t,arguments)}});var vl=function(){return typeof Zt.ResizeObserver<"u"?Zt.ResizeObserver:Pa}();const yl=qo(Object.freeze(Object.defineProperty({__proto__:null,default:vl},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(or,"__esModule",{value:!0}),or.default=_l;var en=Rl(_),Sl=sr(He),bl=sr(yl),Cl=sr(We);function sr(e){return e&&e.__esModule?e:{default:e}}function Na(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Na=function(r){return r?n:t})(e)}function Rl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Na(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function lr(){return lr=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},lr.apply(this,arguments)}function dt(e,t,n){return t=Il(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Il(e){var t=wl(e,"string");return typeof t=="symbol"?t:String(t)}function wl(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 Tl="react-grid-layout";function _l(e){var t;return t=class extends en.Component{constructor(){super(...arguments),dt(this,"state",{width:1280}),dt(this,"elementRef",en.createRef()),dt(this,"mounted",!1),dt(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new bl.default(a=>{if(this.elementRef.current instanceof HTMLElement){const i=a[0].contentRect.width;this.setState({width:i})}});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,...a}=this.props;return r&&!this.mounted?en.createElement("div",{className:(0,Cl.default)(this.props.className,Tl),style:this.props.style,ref:this.elementRef}):en.createElement(e,lr({innerRef:this.elementRef},a,this.state))}},dt(t,"defaultProps",{measureBeforeMount:!1}),dt(t,"propTypes",{measureBeforeMount:Sl.default.bool}),t}(function(e){e.exports=vt.default,e.exports.utils=B,e.exports.calculateUtils=De,e.exports.Responsive=qt.default,e.exports.Responsive.utils=Ze,e.exports.WidthProvider=or.default})(kr);var xl=kr.exports;const Ol=Rn(xl),cr={type:v.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){var p,y;if(!t)return!1;const n=e.get(v.IUndoRedoService),r=e.get(v.ICommandService),o=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=(p=t.unitId)!=null?p:o.getUnitId(),l=(y=t.subUnitId)!=null?y:i.getSheetId(),u={unitId:c,subUnitId:l,cfId:t.cfId},d=s.DeleteConditionalRuleMutationUndoFactory(e,u),h=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,u);return h&&n.pushUndoRedo({unitID:c,undoMutations:d,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:u}]}),h}},ja={type:v.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){var T,I;if(!t)return!1;const n=e.get(v.IUndoRedoService),r=e.get(v.ICommandService),a=e.get(v.IUniverInstanceService),o=e.get(s.ConditionalFormattingRuleModel),i=a.getCurrentUniverSheetInstance(),c=i.getActiveSheet(),l=(T=t.unitId)!=null?T:i.getUnitId(),u=(I=t.subUnitId)!=null?I:c.getSheetId(),d=s.transformSupportSymmetryAnchor(t.start,t.end,o.getSubunitRules(l,u)||[],m=>m.cfId);if(!d)return!1;const[h,p]=d,y={unitId:l,subUnitId:u,start:h,end:p},C=s.MoveConditionalRuleMutationUndoFactory(y),b=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,y);return b&&n.pushUndoRedo({unitID:l,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:y}],undoMutations:C}),b}},tn={cfPreview:"univer-cf-preview"},ft=e=>{var a,o;const t=e.rule;if(!t)return null;const n=_.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const i=t.config.map((u,d)=>({color:new v.ColorKit(u.color),value:d})),c=i.length-1;return new Array(5).fill("").map((u,d,h)=>d*c/(h.length-1)).map(u=>s.getColorScaleFromValue(i,u))}return null},[t]),r=_.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(i=>{const c=s.iconMap[i.iconType];return c&&c[Number(i.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:i}=t.config,c={width:"50%",height:"100%"},l=i?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,u=i?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return f.jsxs("div",{className:tn.cfPreview,children:[f.jsx("div",{style:{...c,background:u,border:`1px solid ${t.config.nativeColor}`}}),f.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&f.jsx("div",{className:tn.cfPreview,children:n.map((i,c)=>f.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:i}},c))});case s.CFRuleType.iconSet:return r&&f.jsx("div",{className:tn.cfPreview,children:r.map((i,c)=>i?f.jsx("img",{style:{height:"100%"},src:i},c):f.jsx(Nt,{},c))});case s.CFRuleType.highlightCell:{const{ul:i,st:c,it:l,bl:u,bg:d,cl:h}=t.style,p=(i==null?void 0:i.s)===v.BooleanNumber.TRUE,y=(c==null?void 0:c.s)===v.BooleanNumber.TRUE,C=l===v.BooleanNumber.TRUE,b=u===v.BooleanNumber.TRUE,T=(a=d==null?void 0:d.rgb)!=null?a:s.DEFAULT_BG_COLOR,I=(o=h==null?void 0:h.rgb)!=null?o:s.DEFAULT_FONT_COLOR,m={fontWeight:b?"bold":void 0,fontStyle:C?"italic":void 0,textDecoration:`${p?"underline":""} ${y?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:T,color:I};return f.jsx("div",{style:m,className:tn.cfPreview,children:"123"})}}return null},Ml={sheet:{cf:{title:"Conditional Formatting",menu:{manageConditionalFormatting:"Manage Conditional Formatting",createConditionalFormatting:"Create Conditional Formatting",clearRangeRules:"Clear Rules for Selected Range",clearWorkSheetRules:"Clear Rules for Entire Sheet"},form:{lessThan:"The value must be less than {0}",lessThanOrEqual:"The value must be less than or equal to {0}",greaterThan:"The value must be greater than {0}",greaterThanOrEqual:"The value must be greater than or equal to {0}",rangeSelector:"Select Range or Enter Value"},iconSet:{direction:"Direction",shape:"Shape",mark:"Mark",rank:"Rank",rule:"Rule",icon:"Icon",type:"Type",value:"Value",reverseIconOrder:"Reverse Icon Order",and:"And",when:"When",onlyShowIcon:"Only Show Icon"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"Create Rule",clear:"Clear All Rules",range:"Apply Range",styleType:"Style Type",submit:"Submit",cancel:"Cancel",rankAndAverage:"Top/Bottom/Average",styleRule:"Style Rule",isNotBottom:"Top",isBottom:"Bottom",greaterThanAverage:"Greater Than Average",lessThanAverage:"Less Than Average",medianValue:"Median Value",fillType:"Fill Type",pureColor:"Solid Color",gradient:"Gradient",colorSet:"Color Set",positive:"Positive",native:"Negative",workSheet:"Entire Sheet",selectedRange:"Selected Range",managerRuleSelect:"Manage {0} Rules"},preview:{describe:{beginsWith:"Begins with {0}",endsWith:"Ends with {0}",containsText:"Text contains {0}",notContainsText:"Text does not contain {0}",equal:"Equal to {0}",notEqual:"Not equal to {0}",containsBlanks:"Contains Blanks",notContainsBlanks:"Does not contain Blanks",containsErrors:"Contains Errors",notContainsErrors:"Does not contain Errors",greaterThan:"Greater than {0}",greaterThanOrEqual:"Greater than or equal to {0}",lessThan:"Less than {0}",lessThanOrEqual:"Less than or equal to {0}",notBetween:"Not between {0} and {1}",between:"Between {0} and {1}",yesterday:"Yesterday",tomorrow:"Tomorrow",last7Days:"Last 7 Days",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",today:"Today",topN:"Top {0}",bottomN:"Bottom {0}",topNPercent:"Top {0}%",bottomNPercent:"Bottom {0}%"}},operator:{beginsWith:"Begins with",endsWith:"Ends with",containsText:"Text contains",notContainsText:"Text does not contain",equal:"Equal to",notEqual:"Not equal to",containsBlanks:"Contains Blanks",notContainsBlanks:"Does not contain Blanks",containsErrors:"Contains Errors",notContainsErrors:"Does not contain Errors",greaterThan:"Greater than",greaterThanOrEqual:"Greater than or equal to",lessThan:"Less than",lessThanOrEqual:"Less than or equal to",notBetween:"Not between",between:"Between",yesterday:"Yesterday",tomorrow:"Tomorrow",last7Days:"Last 7 Days",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",today:"Today"},ruleType:{highlightCell:"Highlight Cell",dataBar:"Data Bar",colorScale:"Color Scale",formula:"Custom Formula",iconSet:"Icon Set",duplicateValues:"Duplicate Values",uniqueValues:"Unique Values"},subRuleType:{uniqueValues:"Unique Values",duplicateValues:"Duplicate Values",rank:"Rank",text:"Text",timePeriod:"Time Period",number:"Number",average:"Average"},valueType:{num:"Number",min:"Minimum",max:"Maximum",percent:"Percentage",percentile:"Percentile",formula:"Formula",none:"None"}}}},La={sheet:{cf:{title:"条件格式",menu:{manageConditionalFormatting:"管理条件格式",createConditionalFormatting:"新建条件格式",clearRangeRules:"清除所选区域的规则",clearWorkSheetRules:"清除整个工作表的规则"},form:{lessThan:"该值必须小于 {0}",lessThanOrEqual:"该值必须小于等于 {0}",greaterThan:"该值必大于 {0}",greaterThanOrEqual:"该值必大于等于 {0}",rangeSelector:"选择范围或者输入值"},iconSet:{direction:"方向",shape:"形状",mark:"标记",rank:"等级",rule:"规则",icon:"图标",type:"类型",value:"值",reverseIconOrder:"反转图标次序",and:"且",when:"当值",onlyShowIcon:"仅显示图标"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"新增规则",clear:"清空所有规则",range:"应用范围",styleType:"样式类型",submit:"确认",cancel:"取消",rankAndAverage:"最前/最后/平均值",styleRule:"样式规则",isNotBottom:"最前",isBottom:"最后",greaterThanAverage:"大于平均值",lessThanAverage:"小于平均值",medianValue:"中间值",fillType:"填充方式",pureColor:"纯色",gradient:"渐变",colorSet:"颜色设置",positive:"正值",native:"负值",workSheet:"整张工作表",selectedRange:"所选单元格",managerRuleSelect:"管理 {0} 的规则"},preview:{describe:{beginsWith:"开头为{0}",endsWith:"结尾为{0}",containsText:"文本包含{0}",notContainsText:"文本不包含{0}",equal:"等于{0}",notEqual:"不等于{0}",containsBlanks:"为空",notContainsBlanks:"不为空",containsErrors:"错误",notContainsErrors:"非错误",greaterThan:"大于{0}",greaterThanOrEqual:"大于等于{0}",lessThan:"小于{0}",lessThanOrEqual:"小于等于{0}",notBetween:"不介于{0}和{1}之间",between:"介于{0}和{1}之间",yesterday:"昨日",tomorrow:"明日",last7Days:"最近7天",thisMonth:"本月",lastMonth:"上个月",nextMonth:"下个月",thisWeek:"本周",lastWeek:"上周",nextWeek:"下周",today:"今日",topN:"前{0}项",bottomN:"后{0}项",topNPercent:"前{0}%",bottomNPercent:"后{0}%"}},operator:{beginsWith:"开头为",endsWith:"结尾为",containsText:"文本包含",notContainsText:"文本不包含",equal:"等于",notEqual:"不等于",containsBlanks:"为空",notContainsBlanks:"不为空",containsErrors:"错误",notContainsErrors:"非错误",greaterThan:"大于",greaterThanOrEqual:"大于等于",lessThan:"小于",lessThanOrEqual:"小于等于",notBetween:"不介于",between:"介于",yesterday:"昨日",tomorrow:"明日",last7Days:"最近 7 天",thisMonth:"本月",lastMonth:"上个月",nextMonth:"下个月",thisWeek:"本周",lastWeek:"上周",nextWeek:"下周",today:"今日"},ruleType:{highlightCell:"突出显示单元格",dataBar:"数据条",colorScale:"色阶",formula:"自定义公式",iconSet:"图标集",duplicateValues:"重复值",uniqueValues:"唯一值"},subRuleType:{uniqueValues:"唯一值",duplicateValues:"重复值",rank:"最前最后",text:"文本",timePeriod:"时间日期",number:"数值",average:"平均值"},valueType:{num:"数值",min:"最小值",max:"最大值",percent:"百分比",percentile:"百分点",formula:"公式",none:"无"}}}};var Dl=Object.defineProperty,El=Object.getOwnPropertyDescriptor,Pl=(e,t,n,r)=>{for(var a=r>1?void 0:r?El(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Dl(t,n,a),a},Nl=(e,t)=>(n,r)=>t(n,r,e);let wt=class extends v.Disposable{constructor(t){super();mt(this,"_initLocal",()=>{this._localeService.load({zhCN:La})});mt(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let a=n.exec(t);for(;a;)r.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),a=t.split("."),o=r&&this._localeService.resolveKeyPath(r,a);if(typeof o=="string"){const i=[];return this._findReplaceIndex(o).forEach((c,l,u)=>{const d=u[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<c.startIndex){const h=o.slice(d.endIndex+1,c.startIndex);h&&i.push(h)}if(n[c.key]&&i.push(n[c.key]),l===u.length-1){const h=o.slice(c.endIndex+1);h&&i.push(h)}}),i}return[]}};wt=Pl([v.OnLifecycle(v.LifecycleStages.Rendered,wt),Nl(0,k.Inject(v.LocaleService))],wt);const ce={cfRuleList:"univer-cf-rule-list",ruleSelector:"univer-rule-selector",select:"univer-select",selectSelector:"univer-select-selector",selectSelectionItem:"univer-select-selection-item",selectSelectionSearchInput:"univer-select-selection-search-input",btnList:"univer-btn-list",gap:"univer-gap",icon:"univer-icon",disabled:"univer-disabled",ruleItem:"univer-rule-item",ruleDescribe:"univer-rule-describe",ruleType:"univer-rule-type",ruleRange:"univer-rule-range",active:"univer-active",draggableHandle:"univer-draggableHandle",deleteItem:"univer-delete-item",gridLayoutWrap:"univer-grid-layout-wrap",reactGridItem:"univer-react-grid-item"},jl=(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(a=>String(a)):[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 ka=0;const Ll=e=>{const{onClick:t}=e,n=te.useDependency(s.ConditionalFormattingRuleModel),r=te.useDependency(v.IUniverInstanceService),a=te.useDependency(ee.SelectionManagerService),o=te.useDependency(v.ICommandService),i=te.useDependency(v.LocaleService),c=te.useDependency(wt),l=r.getCurrentUniverSheetInstance(),u=l.getUnitId(),h=l.getActiveSheet().getSheetId(),[p,y]=_.useState("2"),[C,b]=_.useState(0),[T,I]=_.useState(-1),[m,S]=_.useState(ka),R=_.useRef(null),g=[{label:i.t("sheet.cf.panel.workSheet"),value:"2"},{label:i.t("sheet.cf.panel.selectedRange"),value:"1"}],w=()=>{const A=n.getSubunitRules(u,h);if(!A||!A.length)return[];if(p==="1"){const G=a.getLast();if(!G)return[];const Z=G.range;return A.filter(ae=>ae.ranges.some(ue=>v.Rectangle.intersects(ue,Z)))}else if(p==="2")return A;return[]},[x,E]=_.useState(w);_.useEffect(()=>{const A=o.onCommandExecuted(G=>{G.id===ee.SetWorksheetActiveOperation.id&&b(Math.random())});return()=>A.dispose()}),_.useEffect(()=>{E(w)},[p,C,u,h]),_.useEffect(()=>{if(p==="2")return;const A=new ye.Observable(G=>{const Z=[ee.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],le=o.onCommandExecuted(ae=>{const{id:ue,params:Oe}=ae,Me=r.getCurrentUniverSheetInstance().getUnitId();Z.includes(ue)&&Oe.unitId===Me&&G.next(null)});return()=>le.dispose()}).pipe(ye.debounceTime(16)).subscribe(()=>{E(w)});return()=>{A.unsubscribe()}},[r,p,u,h]),_.useEffect(()=>{const A=n.$ruleChange.subscribe(()=>{b(Math.random())});return()=>A.unsubscribe()},[n]),_.useEffect(()=>{const A=()=>{var ae;const le=Math.max(0,(((ae=R.current)==null?void 0:ae.getBoundingClientRect().width)||0)-8);return ka=le,le},Z=new ye.Observable(le=>{const ae=document.querySelector(".univer-sidebar");if(ae){let ue=setTimeout(()=>{le.next()},150);const Oe=()=>{ue&&clearTimeout(ue),ue=null},Me=je=>{je.propertyName==="width"&&(Oe(),le.next())};return ae.addEventListener("transitionend",Me),()=>{Oe(),ae.removeEventListener("transitionend",Me)}}}).pipe(ye.debounceTime(16)).subscribe(()=>{S(A())});return()=>{Z.unsubscribe()}},[]);const V=A=>{const G=r.getCurrentUniverSheetInstance().getUnitId(),Z=r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();o.executeCommand(cr.id,{unitId:G,subUnitId:Z,cfId:A.cfId})},$=(A,G)=>{I(G.y)},O=(A,G,Z)=>{I(-1);const le=r.getCurrentUniverSheetInstance().getUnitId(),ae=r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),ue=je=>{const yn=x.length;return Math.min(yn-1,Math.max(0,je))},Oe=x[ue(G.y)].cfId,Me=x[ue(Z.y)].cfId;Oe!==Me&&o.executeCommand(ja.id,{unitId:le,subUnitId:ae,start:{id:Oe,type:"self"},end:{id:Me,type:Z.y>G.y?"after":"before"}})},L=()=>{e.onCreate()},D=()=>{p==="2"?o.executeCommand(Sn.id):p==="1"&&x.map(G=>({unitId:u,subUnitId:h,cfId:G.cfId})).forEach(G=>{o.executeCommand(cr.id,G)})},j=x.map((A,G)=>({i:A.cfId,x:0,w:12,y:G,h:1,isResizable:!1}));return f.jsxs("div",{className:ce.cfRuleList,children:[f.jsxs("div",{className:ce.ruleSelector,children:[f.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",f.jsx(F.Select,{className:ce.select,options:g,value:p,onChange:A=>{y(A)}})).map((A,G)=>f.jsx("span",{children:A},G))}),f.jsxs("div",{className:ce.btnList,children:[f.jsx(F.Tooltip,{title:i.t("sheet.cf.panel.createRule"),placement:"bottom",children:f.jsx("div",{className:`${ce.icon}`,onClick:L,children:f.jsx(Wo,{})})}),x.length?f.jsx(F.Tooltip,{title:i.t("sheet.cf.panel.clear"),placement:"bottom",children:f.jsx("div",{className:`${ce.gap} ${ce.icon}`,onClick:D,children:f.jsx(bn,{})})}):f.jsx("div",{className:`${ce.gap} ${ce.disabled}`,children:f.jsx(bn,{})})]})]}),f.jsx("div",{ref:R,className:ce.gridLayoutWrap,children:m?f.jsx(Ol,{onDragStop:O,onDragStart:$,layout:j,cols:12,rowHeight:60,width:m,margin:[0,10],draggableHandle:".draggableHandle",children:x.map((A,G)=>f.jsx("div",{children:f.jsxs("div",{className:`${ce.ruleItem} ${T===G?ce.active:""}`,onClick:()=>t(A),children:[f.jsx("div",{className:`${ce.draggableHandle} draggableHandle`,onClick:Z=>Z.stopPropagation(),children:f.jsx(Bo,{})}),f.jsxs("div",{className:ce.ruleDescribe,children:[f.jsx("div",{className:ce.ruleType,children:jl(A,i)}),f.jsx("div",{className:ce.ruleRange,children:A.ranges.map(Z=>wr.serializeRange(Z)).join(",")})]}),f.jsx("div",{className:ce.preview,children:f.jsx(ft,{rule:A.rule})}),f.jsx("div",{className:`${ce.deleteItem} ${T===G?ce.active:""}`,onClick:Z=>{Z.stopPropagation(),V(A)},children:f.jsx(bn,{})})]})},`${A.cfId}`))}):null})]})},Aa={type:v.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){var b,T;if(!t)return!1;const{rule:n}=t,r=e.get(v.IUndoRedoService),a=e.get(v.ICommandService),o=e.get(s.ConditionalFormattingRuleModel),c=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),l=c.getActiveSheet(),u=(b=t.unitId)!=null?b:c.getUnitId(),d=(T=t.subUnitId)!=null?T:l.getSheetId(),h=o.createCfId(u,d),p={unitId:u,subUnitId:d,rule:{...n,cfId:n.cfId||h}},y=s.AddConditionalRuleMutationUndoFactory(e,p),C=a.syncExecuteCommand(s.AddConditionalRuleMutation.id,p);return C&&r.pushUndoRedo({unitID:u,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:p}],undoMutations:[y]}),C}},za={type:v.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){var p,y;if(!t)return!1;const n=e.get(v.IUndoRedoService),r=e.get(v.ICommandService),o=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=(p=t.unitId)!=null?p:o.getUnitId(),l=(y=t.subUnitId)!=null?y:i.getSheetId(),u={unitId:c,subUnitId:l,rule:t.rule},d=s.setConditionalRuleMutationUndoFactory(e,u),h=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,u);return h&&n.pushUndoRedo({unitID:c,undoMutations:d,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:u}]}),h}},kl=v.createInterceptorKey("beforeSubmit"),Al=v.createInterceptorKey("submit"),ur={cfColorPicker:"univer-cf-color-picker",cfColorPickerIcon:"univer-cf-color-picker-icon",iconDropdown:"univer-icon-dropdown"},Qe=e=>{const{color:t,onChange:n,disable:r=!1,iconId:a="PaintBucket",className:o,isNeedDropdownIcon:i=!0}=e,c=te.useDependency(ve.ComponentManager),l=_.useMemo(()=>new v.ColorKit(t),[t]),u=c.get(a);return u&&(r?f.jsx(u,{className:o,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):f.jsx(F.Dropdown,{overlay:f.jsx("div",{className:`${ur.cfColorPicker} `,children:f.jsx(F.ColorPicker,{color:t,onChange:n})}),children:f.jsxs("span",{className:`${ur.cfColorPickerIcon} ${o}`,children:[f.jsx(u,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),i&&f.jsx(Cn,{className:ur.iconDropdown})]})}))},P={cfRuleStyleEditor:"univer-cf-rule-style-editor",cfPreviewWrap:"univer-cf-preview-wrap",text:"univer-text",positionRelative:"univer-position-relative",btnList:"univer-btn-list",iconSet:"univer-icon-set",renderConfig:"univer-render-config",utilItem:"univer-util-item",flex:"univer-flex",width45:"univer-width45",iconWrap:"univer-icon-wrap",icon:"univer-icon",dropdownIcon:"univer-dropdown-icon",errorInput:"univer-error-input",errorText:"univer-error-text",iconGroupList:"univer-icon-group-list",title:"univer-title",group:"univer-group",itemContent:"univer-item-content",itemWrap:"univer-item-wrap",item:"univer-item",iconItemListWrap:"univer-icon-item-list-wrap",none:"univer-none",iconItemList:"univer-icon-item-list",width100:"univer-width100",stress:"univer-stress"},et=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),dr=e=>{const{type:t,className:n,onChange:r,id:a,value:o}=e,i=te.useDependency(v.IUniverInstanceService),c=i.getCurrentUniverSheetInstance().getUnitId(),l=i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),u=_.useMemo(()=>String(o).startsWith("=")?String(o):"=",[o]),d=_.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?f.jsx(ve.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${a}`,value:u,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(h="")=>{r(h||"")}}):f.jsx(F.InputNumber,{className:n,value:Number(e.value)||0,onChange:h=>e.onChange(h||0),...d})},zl=e=>{var L;const{interceptorManager:t}=e,n=te.useDependency(v.LocaleService),r=((L=e.rule)==null?void 0:L.type)===s.CFRuleType.colorScale?e.rule:void 0,a=[et(s.CFValueType.num,n),et(s.CFValueType.percent,n),et(s.CFValueType.percentile,n),et(s.CFValueType.formula,n)],o=[et(s.CFValueType.min,n),...a],i=[et("none",n),...a],c=[et(s.CFValueType.max,n),...a],[l,u]=_.useState(()=>{var j;const D=s.CFValueType.min;return r&&((j=r.config[0])==null?void 0:j.value.type)||D}),[d,h]=_.useState(()=>{var j;const D="none";return!r||r.config.length!==3?D:((j=r.config[1])==null?void 0:j.value.type)||D}),[p,y]=_.useState(()=>{var j;const D=s.CFValueType.max;return r&&((j=r.config[r.config.length-1])==null?void 0:j.value.type)||D}),[C,b]=_.useState(()=>{if(!r)return 10;const j=r.config[0];return(j==null?void 0:j.value.value)===void 0?10:j==null?void 0:j.value.value}),[T,I]=_.useState(()=>{var A;if(!r||r.config.length!==3)return 50;const j=(A=r.config[1])==null?void 0:A.value.value;return j===void 0?50:j}),[m,S]=_.useState(()=>{var A;if(!r)return 90;const j=(A=r.config[r.config.length-1])==null?void 0:A.value.value;return j===void 0?90:j}),[R,g]=_.useState(()=>{var j;const D="#d0d9fb";return r&&((j=r.config[0])==null?void 0:j.color)||D}),[w,x]=_.useState(()=>{var j;const D="#7790f3";return!r||r.config.length!==3?D:((j=r.config[1])==null?void 0:j.color)||D}),[E,V]=_.useState(()=>{var j;const D="#2e55ef";return r&&((j=r.config[r.config.length-1])==null?void 0:j.color)||D}),$=_.useMemo(()=>D=>{const{minType:j,medianType:A,maxType:G,minValue:Z,medianValue:le,maxValue:ae,minColor:ue,medianColor:Oe,maxColor:Me}=D,je=[];return je.push({color:ue,value:{type:j,value:Z}}),A!=="none"&&je.push({color:Oe,value:{type:A,value:le}}),je.push({color:Me,value:{type:G,value:ae}}),{config:je.map((Rr,Ir)=>({...Rr,index:Ir})),type:s.CFRuleType.colorScale}},[]);_.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return $({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),[$,l,d,p,C,T,m,R,w,E,t]);const O=D=>{e.onChange($(D))};return f.jsxs("div",{children:[f.jsx("div",{className:M.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${P.cfPreviewWrap}`,children:f.jsx(ft,{rule:$({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})})}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(F.Select,{options:o,value:l,onChange:D=>{u(D);const j=s.createDefaultValueByValueType(D,10);b(j),O({minType:D,medianType:d,maxType:p,minValue:j,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(dr,{id:"min",className:`${M.mLXxs}`,value:C,type:l,onChange:D=>{b(D),O({minType:l,medianType:d,maxType:p,minValue:D,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Qe,{className:M.mLXxs,color:R,onChange:D=>{g(D),O({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:m,minColor:D,medianColor:w,maxColor:E})}})]}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.panel.medianValue")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(F.Select,{options:i,value:d,onChange:D=>{h(D);const j=s.createDefaultValueByValueType(D,50);I(j),O({minType:l,medianType:D,maxType:p,minValue:C,medianValue:j,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(dr,{id:"median",className:` ${M.mLXxs}`,value:T,type:d,onChange:D=>{I(D),O({minType:l,medianType:d,maxType:p,minValue:C,medianValue:D,maxValue:m,minColor:R,medianColor:w,maxColor:E})}}),d!=="none"&&f.jsx(Qe,{className:M.mLXxs,color:w,onChange:D=>{x(D),O({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:m,minColor:R,medianColor:D,maxColor:E})}})]}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(F.Select,{options:c,value:p,onChange:D=>{y(D);const j=s.createDefaultValueByValueType(D,90);S(j),O({minType:l,medianType:d,maxType:D,minValue:C,medianValue:T,maxValue:j,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(dr,{id:"max",className:`${M.mLXxs}`,value:m,type:p,onChange:D=>{S(D),O({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:D,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(Qe,{className:M.mLXxs,color:E,onChange:D=>{V(D),O({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:m,minColor:R,medianColor:w,maxColor:D})}})]})]})},pt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Va=e=>{const{onChange:t,className:n,value:r,type:a,id:o,disabled:i=!1}=e,c=te.useDependency(v.IUniverInstanceService),l=c.getCurrentUniverSheetInstance().getUnitId(),u=c.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),d=_.useRef(r),h=_.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(a)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[a]);if(a===s.CFValueType.formula){const p=String(d.current).startsWith("=")?String(d.current)||"":"=";return f.jsx(ve.TextEditor,{id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${o}`,value:p,openForSheetSubUnitId:u,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(y="")=>{t(y||"")}})}return f.jsx(F.InputNumber,{className:n,value:Number(r)||0,disabled:i,onChange:p=>{t(p||0)},...h})},Vl=e=>{var $;const{interceptorManager:t}=e,n=te.useDependency(v.LocaleService),r=(($=e.rule)==null?void 0:$.type)===s.CFRuleType.dataBar?e.rule:void 0,[a,o]=_.useState(()=>{var L;const O="0";return r?(L=r.config)!=null&&L.isGradient?"1":"0":O}),[i,c]=_.useState(()=>{var L;const O="#abd91a";return r&&((L=r.config)==null?void 0:L.positiveColor)||O}),[l,u]=_.useState(()=>{var L;const O="#ffbe38";return r&&((L=r.config)==null?void 0:L.nativeColor)||O}),d=[pt(s.CFValueType.num,n),pt(s.CFValueType.percent,n),pt(s.CFValueType.percentile,n),pt(s.CFValueType.formula,n)],h=[pt(s.CFValueType.min,n),...d],p=[pt(s.CFValueType.max,n),...d],[y,C]=_.useState(()=>{var L;const O=h[0].value;return r&&((L=r.config)==null?void 0:L.min.type)||O}),[b,T]=_.useState(()=>{var L;const O=p[0].value;return r&&((L=r.config)==null?void 0:L.max.type)||O}),[I,m]=_.useState(()=>{var D;if(!r)return 0;const L=((D=r.config)==null?void 0:D.min)||{};return L.type===s.CFValueType.formula?L.value||"=":L.value||0}),[S,R]=_.useState(()=>{var D;if(!r)return 100;const L=((D=r.config)==null?void 0:D.max)||{};return L.type===s.CFValueType.formula?L.value||"=":L.value===void 0?100:L.value}),g=O=>({config:{min:{type:O.minValueType,value:O.minValue},max:{type:O.maxValueType,value:O.maxValue},isGradient:O.isGradient==="1",positiveColor:O.positiveColor,nativeColor:O.nativeColor},type:s.CFRuleType.dataBar});_.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return g({isGradient:a,minValue:I,minValueType:y,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l})}}),[a,I,y,S,b,i,l,t]);const w=O=>{e.onChange(g(O))},x=O=>{c(O),w({isGradient:a,minValue:I,minValueType:y,maxValue:S,maxValueType:b,positiveColor:O,nativeColor:l})},E=O=>{u(O),w({isGradient:a,minValue:I,minValueType:y,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:O})},V=O=>d.map(L=>L.value).includes(O);return f.jsxs("div",{children:[f.jsx("div",{className:M.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${P.cfPreviewWrap}`,children:f.jsx(ft,{rule:g({isGradient:a,minValue:I,minValueType:y,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l})})}),f.jsxs("div",{children:[f.jsx("div",{className:M.label,children:n.t("sheet.cf.panel.fillType")}),f.jsx("div",{className:`${M.mTSm} ${M.mLXxs} `,children:f.jsxs(F.RadioGroup,{value:a,onChange:O=>{o(O),w({isGradient:O,minValue:I,minValueType:y,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l})},children:[f.jsx(F.Radio,{value:"0",children:f.jsx("span",{className:P.text,children:n.t("sheet.cf.panel.pureColor")})}),f.jsx(F.Radio,{value:"1",children:f.jsx("span",{className:P.text,children:n.t("sheet.cf.panel.gradient")})})]})})]}),f.jsxs("div",{children:[f.jsx("div",{className:M.label,children:n.t("sheet.cf.panel.colorSet")}),f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm} ${M.mLXxs}`,children:[f.jsxs("div",{className:`${M.labelContainer}`,children:[f.jsx("div",{className:`${P.text}`,children:n.t("sheet.cf.panel.native")}),f.jsx(Qe,{color:l,onChange:E})]}),f.jsxs("div",{className:`${M.labelContainer} ${M.mLSm} `,children:[f.jsx("div",{className:`${P.text} `,children:n.t("sheet.cf.panel.positive")}),f.jsx(Qe,{color:i,onChange:x})]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${M.mTSm} ${M.labelContainer}`,children:[f.jsx(F.Select,{options:h,value:y,onChange:O=>{C(O);const L=s.createDefaultValueByValueType(O,10);m(L),w({isGradient:a,minValue:L,minValueType:O,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l})}}),f.jsx(Va,{disabled:!V(y),id:"min",type:y,className:M.mLSm,value:I,onChange:O=>{m(O||0),w({isGradient:a,minValue:O||0,minValueType:y,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l})}})]}),f.jsx("div",{className:M.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${M.mTSm} ${M.labelContainer}`,children:[f.jsx(F.Select,{options:p,value:b,onChange:O=>{T(O);const L=s.createDefaultValueByValueType(O,90);R(L),w({isGradient:a,minValue:I,minValueType:y,maxValue:L,maxValueType:O,positiveColor:i,nativeColor:l})}}),f.jsx(Va,{disabled:!V(b),id:"max",type:b,className:M.mLSm,value:S,onChange:O=>{R(O||0),w({isGradient:a,minValue:I,minValueType:y,maxValue:O||0,maxValueType:b,positiveColor:i,nativeColor:l})}})]})]})]})},Ue={cfStyleEdit:"univer-cf-style-edit",buttonItem:"univer-button-item",isActive:"univer-isActive"},nn=e=>[v.BooleanNumber.FALSE,void 0].includes(e)?v.BooleanNumber.TRUE:v.BooleanNumber.FALSE,rn=e=>e!==v.BooleanNumber.FALSE,fr=e=>{const{style:t,onChange:n,className:r}=e,a=te.useDependency(ve.ComponentManager),[o,i]=_.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=_.useState(()=>{if(t!=null&&t.it)return t.it}),[u,d]=_.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[h,p]=_.useState(()=>{if(t!=null&&t.st)return t.st.s}),[y,C]=_.useState(()=>{var w;const g="#2f56ef";return(w=t==null?void 0:t.cl)!=null&&w.rgb?t.cl.rgb:g}),[b,T]=_.useState(()=>{var w;const g="#e8ecfc";return(w=t==null?void 0:t.bg)!=null&&w.rgb?t.bg.rgb:g}),I=a.get("BoldSingle"),m=a.get("ItalicSingle"),S=a.get("UnderlineSingle"),R=a.get("StrikethroughSingle");return _.useEffect(()=>{const g={bl:o,it:c};y!==void 0&&(g.cl={rgb:y}),b!==void 0&&(g.bg={rgb:b}),h!==void 0&&(g.st={s:h}),u!==void 0&&(g.ul={s:u}),n(s.removeUndefinedAttr(g))},[o,c,u,h,y,b]),f.jsxs("div",{className:`${Ue.cfStyleEdit} ${r}`,children:[I&&f.jsx("div",{className:We({[Ue.isActive]:rn(o||v.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>i(nn(o)),children:f.jsx(I,{})}),m&&f.jsx("div",{className:We({[Ue.isActive]:rn(c||v.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>l(nn(c)),children:f.jsx(m,{})}),S&&f.jsx("div",{className:We({[Ue.isActive]:rn(u||v.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>d(nn(u)),children:f.jsx(S,{})}),R&&f.jsx("div",{className:We({[Ue.isActive]:rn(h||v.BooleanNumber.FALSE)},Ue.buttonItem),onClick:()=>p(nn(h)),children:f.jsx(R,{})}),f.jsx(Qe,{color:y,onChange:C,iconId:"FontColor"}),f.jsx(Qe,{color:b,onChange:T,iconId:"PaintBucket"})]})},Ul=e=>{var T;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(v.LocaleService),a=((T=e.rule)==null?void 0:T.type)===s.CFRuleType.highlightCell?e.rule:void 0,o=[{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"}],[i,c]=_.useState(()=>{const I=o[0].value,m=a==null?void 0:a.type;if(!a)return I;switch(m){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":I;case s.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return I}),[l,u]=_.useState(()=>{const m=a==null?void 0:a.type;if(!a)return 10;switch(m){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.rank:return a.value||10}}return 10}),[d,h]=_.useState(()=>{const m=a==null?void 0:a.type;if(!a)return!1;switch(m){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[p,y]=_.useState({}),C=I=>{const{type:m,isPercent:S,value:R,style:g}=I;if(m==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:S,isBottom:!1,value:R,style:g};if(m==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:S,isBottom:!0,value:R,style:g};if(m==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(m==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return C({type:i,isPercent:d,value:l,style:p})}}),[i,d,l,p,n]);const b=I=>{t(C(I))};return f.jsxs("div",{children:[f.jsx("div",{className:`${M.title} ${M.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(F.Select,{className:`${P.width100} ${M.mTSm}`,value:i,options:o,onChange:I=>{c(I),b({type:I,isPercent:d,value:l,style:p})}}),["isNotBottom","isBottom"].includes(i)&&f.jsxs("div",{className:`${M.labelContainer} ${M.mTSm}`,children:[f.jsx(F.InputNumber,{min:1,max:1e3,value:l,onChange:I=>{const m=I||0;u(m),b({type:i,isPercent:d,value:m,style:p})}}),f.jsxs("div",{className:`${M.mLSm} ${M.labelContainer} ${P.text}`,children:[f.jsx(F.Checkbox,{checked:d,onChange:I=>{h(!!I),b({type:i,isPercent:!!I,value:l,style:p})}}),r.t("sheet.cf.valueType.percent")]})]}),f.jsx("div",{className:`${P.cfPreviewWrap} `,children:f.jsx(ft,{rule:C({type:i,isPercent:d,value:l,style:p})})}),f.jsx(fr,{style:a==null?void 0:a.style,className:`${M.mTSm} `,onChange:I=>{y(I),b({type:i,isPercent:d,value:l,style:I})}})]})},Q=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),Wl=e=>{const{type:t,operator:n,onChange:r,value:a}=e,[o,i]=_.useState(()=>typeof a=="number"?a:0),[c,l]=_.useState(()=>typeof a=="string"?a:""),[u,d]=_.useState(()=>Array.isArray(a)?a[0]===void 0?0:a[0]:0),[h,p]=_.useState(()=>Array.isArray(a)?a[1]===void 0?100:a[1]:100);switch(_.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(c);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(o),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([u,h]);break}}},[t]),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 y=C=>{l(C),r(C)};return f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(F.Input,{className:P.width100,value:c,onChange:y})})}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 y=C=>{i(C||0),r(C||0)};return f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(F.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:P.width100,value:o,onChange:y})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const y=b=>{d(b||0),r([b||0,h])},C=b=>{p(b||0),r([u,b||0])};return f.jsxs("div",{className:`${M.mTSm} ${M.labelContainer} `,children:[f.jsx(F.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:u,onChange:y}),f.jsx(F.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${M.mLSm}`,value:h,onChange:C})]})}}}return null},Ua=(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)];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)]}},Wa=e=>{var R;const{interceptorManager:t,onChange:n}=e,r=te.useDependency(v.LocaleService),a=((R=e.rule)==null?void 0:R.type)===s.CFRuleType.highlightCell?e.rule:void 0,[o,i]=_.useState(()=>{const g=s.CFSubRuleType.text;return a&&a.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=_.useMemo(()=>Ua(o,r),[o]),[u,d]=_.useState(()=>{const g=l?l[0].value:void 0;return a&&a.operator||g}),[h,p]=_.useState(()=>{var x;const g="";return a?(x=a.value)!=null?x:s.createDefaultValue(a.subType,a.operator):g}),[y,C]=_.useState({}),b=_.useMemo(()=>g=>{var w,x,E,V,$,O,L,D,j,A,G,Z,le,ae,ue;switch(g.subType||o){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(w=g.subType)!=null?w:o,operator:(x=g.operator)!=null?x:u,style:(E=g.style)!=null?E:y,value:(V=g.value)!=null?V:h};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(u))return{type:s.CFRuleType.highlightCell,subType:($=g.subType)!=null?$:o,operator:(O=g.operator)!=null?O:u,style:(L=g.style)!=null?L:y,value:(D=g.value)!=null?D:h};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(u))return{type:s.CFRuleType.highlightCell,subType:(j=g.subType)!=null?j:o,operator:(A=g.operator)!=null?A:u,style:(G=g.style)!=null?G:y,value:(Z=g.value)!=null?Z:h};break}}return{type:s.CFRuleType.highlightCell,subType:(le=g.subType)!=null?le:o,operator:(ae=g.operator)!=null?ae:u,style:(ue=g.style)!=null?ue:y}},[o,u,h,y]);_.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return b({})}}),[b,t]),_.useEffect(()=>{c.some(g=>g.value===o)||i(c[0].value)},[c]);const T=g=>{const w=g,x=Ua(w,r),E=x&&x[0].value;i(w),d(E),E&&p(s.createDefaultValue(w,E)),n(b({subType:w,operator:E}))},I=g=>{const w=g;d(w),n(b({operator:w}))},m=g=>{p(g),n(b({value:g}))},S=_.useMemo(()=>`${o}_${u}_${Math.random()}`,[o,u]);return f.jsxs("div",{children:[f.jsx("div",{className:`${M.title} ${M.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(F.Select,{className:`${M.mTSm} ${P.width100}`,onChange:T,value:o,options:c}),(l==null?void 0:l.length)&&f.jsx(F.Select,{className:`${M.mTSm} ${P.width100}`,onChange:I,value:u||"",options:l}),f.jsx(Wl,{value:h,interceptorManager:t,type:o,operator:u,rule:a,onChange:m},S),f.jsx("div",{className:`${P.cfPreviewWrap}`,children:f.jsx(ft,{rule:b({})})}),f.jsx(fr,{style:a==null?void 0:a.style,className:`${M.mLXxs}`,onChange:g=>{C(g),n(b({style:g}))}})]})},Hl=e=>{var C;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(v.LocaleService),o=te.useDependency(v.IUniverInstanceService).getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=((C=e.rule)==null?void 0:C.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,u]=_.useState({}),[d,h]=_.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),p=b=>({style:b.style,value:d,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});_.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return p({style:l,formula:d})}}),[l,d,n]);const y=b=>{t(p(b))};return f.jsxs("div",{children:[f.jsx("div",{className:`${M.title} ${M.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(ve.TextEditor,{id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`,openForSheetSubUnitId:i.getSheetId(),openForSheetUnitId:o.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(b="")=>{const T=b||"";h(T),y({style:l,formula:T})}})}),f.jsx("div",{className:`${P.cfPreviewWrap} `,children:f.jsx(ft,{rule:p({style:l,formula:d})})}),f.jsx(fr,{style:c==null?void 0:c.style,className:`${M.mTSm} `,onChange:b=>{u(b),y({style:b,formula:d})}})]})};var $l="Expected a function",Ha="__lodash_hash_undefined__",$a=1/0,Bl=9007199254740991,Gl="[object Function]",Fl="[object GeneratorFunction]",ql="[object Symbol]",Xl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Yl=/^\w*$/,Kl=/^\./,Zl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jl=/[\\^$.*+?()[\]{}|]/g,Ql=/\\(\\)?/g,ec=/^\[object .+?Constructor\]$/,tc=/^(?:0|[1-9]\d*)$/,nc=typeof ze=="object"&&ze&&ze.Object===Object&&ze,rc=typeof self=="object"&&self&&self.Object===Object&&self,pr=nc||rc||Function("return this")();function ac(e,t){return e==null?void 0:e[t]}function oc(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var ic=Array.prototype,sc=Function.prototype,Ba=Object.prototype,hr=pr["__core-js_shared__"],Ga=function(){var e=/[^.]+$/.exec(hr&&hr.keys&&hr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Fa=sc.toString,an=Ba.hasOwnProperty,qa=Ba.toString,lc=RegExp("^"+Fa.call(an).replace(Jl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xa=pr.Symbol,cc=ic.splice,uc=Za(pr,"Map"),Tt=Za(Object,"create"),Ya=Xa?Xa.prototype:void 0,Ka=Ya?Ya.toString:void 0;function tt(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 dc(){this.__data__=Tt?Tt(null):{}}function fc(e){return this.has(e)&&delete this.__data__[e]}function pc(e){var t=this.__data__;if(Tt){var n=t[e];return n===Ha?void 0:n}return an.call(t,e)?t[e]:void 0}function hc(e){var t=this.__data__;return Tt?t[e]!==void 0:an.call(t,e)}function gc(e,t){var n=this.__data__;return n[e]=Tt&&t===void 0?Ha:t,this}tt.prototype.clear=dc,tt.prototype.delete=fc,tt.prototype.get=pc,tt.prototype.has=hc,tt.prototype.set=gc;function ht(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 mc(){this.__data__=[]}function vc(e){var t=this.__data__,n=on(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():cc.call(t,n,1),!0}function yc(e){var t=this.__data__,n=on(t,e);return n<0?void 0:t[n][1]}function Sc(e){return on(this.__data__,e)>-1}function bc(e,t){var n=this.__data__,r=on(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}ht.prototype.clear=mc,ht.prototype.delete=vc,ht.prototype.get=yc,ht.prototype.has=Sc,ht.prototype.set=bc;function nt(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 Cc(){this.__data__={hash:new tt,map:new(uc||ht),string:new tt}}function Rc(e){return sn(this,e).delete(e)}function Ic(e){return sn(this,e).get(e)}function wc(e){return sn(this,e).has(e)}function Tc(e,t){return sn(this,e).set(e,t),this}nt.prototype.clear=Cc,nt.prototype.delete=Rc,nt.prototype.get=Ic,nt.prototype.has=wc,nt.prototype.set=Tc;function _c(e,t,n){var r=e[t];(!(an.call(e,t)&&Ja(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function on(e,t){for(var n=e.length;n--;)if(Ja(e[n][0],t))return n;return-1}function xc(e){if(!ln(e)||jc(e))return!1;var t=zc(e)||oc(e)?lc:ec;return t.test(Ac(e))}function Oc(e,t,n,r){if(!ln(e))return e;t=Pc(t,e)?[t]:Dc(t);for(var a=-1,o=t.length,i=o-1,c=e;c!=null&&++a<o;){var l=kc(t[a]),u=n;if(a!=i){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=ln(d)?d:Ec(t[a+1])?[]:{})}_c(c,l,u),c=c[l]}return e}function Mc(e){if(typeof e=="string")return e;if(mr(e))return Ka?Ka.call(e):"";var t=e+"";return t=="0"&&1/e==-$a?"-0":t}function Dc(e){return Qa(e)?e:Lc(e)}function sn(e,t){var n=e.__data__;return Nc(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Za(e,t){var n=ac(e,t);return xc(n)?n:void 0}function Ec(e,t){return t=t==null?Bl:t,!!t&&(typeof e=="number"||tc.test(e))&&e>-1&&e%1==0&&e<t}function Pc(e,t){if(Qa(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||mr(e)?!0:Yl.test(e)||!Xl.test(e)||t!=null&&e in Object(t)}function Nc(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function jc(e){return!!Ga&&Ga in e}var Lc=gr(function(e){e=Uc(e);var t=[];return Kl.test(e)&&t.push(""),e.replace(Zl,function(n,r,a,o){t.push(a?o.replace(Ql,"$1"):r||n)}),t});function kc(e){if(typeof e=="string"||mr(e))return e;var t=e+"";return t=="0"&&1/e==-$a?"-0":t}function Ac(e){if(e!=null){try{return Fa.call(e)}catch{}try{return e+""}catch{}}return""}function gr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError($l);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i),i};return n.cache=new(gr.Cache||nt),n}gr.Cache=nt;function Ja(e,t){return e===t||e!==e&&t!==t}var Qa=Array.isArray;function zc(e){var t=ln(e)?qa.call(e):"";return t==Gl||t==Fl}function ln(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Vc(e){return!!e&&typeof e=="object"}function mr(e){return typeof e=="symbol"||Vc(e)&&qa.call(e)==ql}function Uc(e){return e==null?"":Mc(e)}function Wc(e,t,n){return e==null?e:Oc(e,t,n)}var Hc=Wc;const $c=Rn(Hc);var Bc="Expected a function",eo="__lodash_hash_undefined__",to=1/0,Gc="[object Function]",Fc="[object GeneratorFunction]",qc="[object Symbol]",Xc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Yc=/^\w*$/,Kc=/^\./,Zc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jc=/[\\^$.*+?()[\]{}|]/g,Qc=/\\(\\)?/g,eu=/^\[object .+?Constructor\]$/,tu=typeof ze=="object"&&ze&&ze.Object===Object&&ze,nu=typeof self=="object"&&self&&self.Object===Object&&self,vr=tu||nu||Function("return this")();function ru(e,t){return e==null?void 0:e[t]}function au(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var ou=Array.prototype,iu=Function.prototype,no=Object.prototype,yr=vr["__core-js_shared__"],ro=function(){var e=/[^.]+$/.exec(yr&&yr.keys&&yr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ao=iu.toString,Sr=no.hasOwnProperty,oo=no.toString,su=RegExp("^"+ao.call(Sr).replace(Jc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),io=vr.Symbol,lu=ou.splice,cu=co(vr,"Map"),_t=co(Object,"create"),so=io?io.prototype:void 0,lo=so?so.toString:void 0;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 uu(){this.__data__=_t?_t(null):{}}function du(e){return this.has(e)&&delete this.__data__[e]}function fu(e){var t=this.__data__;if(_t){var n=t[e];return n===eo?void 0:n}return Sr.call(t,e)?t[e]:void 0}function pu(e){var t=this.__data__;return _t?t[e]!==void 0:Sr.call(t,e)}function hu(e,t){var n=this.__data__;return n[e]=_t&&t===void 0?eo:t,this}rt.prototype.clear=uu,rt.prototype.delete=du,rt.prototype.get=fu,rt.prototype.has=pu,rt.prototype.set=hu;function gt(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 gu(){this.__data__=[]}function mu(e){var t=this.__data__,n=cn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():lu.call(t,n,1),!0}function vu(e){var t=this.__data__,n=cn(t,e);return n<0?void 0:t[n][1]}function yu(e){return cn(this.__data__,e)>-1}function Su(e,t){var n=this.__data__,r=cn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}gt.prototype.clear=gu,gt.prototype.delete=mu,gt.prototype.get=vu,gt.prototype.has=yu,gt.prototype.set=Su;function at(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 bu(){this.__data__={hash:new rt,map:new(cu||gt),string:new rt}}function Cu(e){return un(this,e).delete(e)}function Ru(e){return un(this,e).get(e)}function Iu(e){return un(this,e).has(e)}function wu(e,t){return un(this,e).set(e,t),this}at.prototype.clear=bu,at.prototype.delete=Cu,at.prototype.get=Ru,at.prototype.has=Iu,at.prototype.set=wu;function cn(e,t){for(var n=e.length;n--;)if(Lu(e[n][0],t))return n;return-1}function Tu(e,t){t=Mu(t,e)?[t]:Ou(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Nu(t[n++])];return n&&n==r?e:void 0}function _u(e){if(!fo(e)||Eu(e))return!1;var t=ku(e)||au(e)?su:eu;return t.test(ju(e))}function xu(e){if(typeof e=="string")return e;if(Cr(e))return lo?lo.call(e):"";var t=e+"";return t=="0"&&1/e==-to?"-0":t}function Ou(e){return uo(e)?e:Pu(e)}function un(e,t){var n=e.__data__;return Du(t)?n[typeof t=="string"?"string":"hash"]:n.map}function co(e,t){var n=ru(e,t);return _u(n)?n:void 0}function Mu(e,t){if(uo(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Cr(e)?!0:Yc.test(e)||!Xc.test(e)||t!=null&&e in Object(t)}function Du(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Eu(e){return!!ro&&ro in e}var Pu=br(function(e){e=zu(e);var t=[];return Kc.test(e)&&t.push(""),e.replace(Zc,function(n,r,a,o){t.push(a?o.replace(Qc,"$1"):r||n)}),t});function Nu(e){if(typeof e=="string"||Cr(e))return e;var t=e+"";return t=="0"&&1/e==-to?"-0":t}function ju(e){if(e!=null){try{return ao.call(e)}catch{}try{return e+""}catch{}}return""}function br(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(Bc);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i),i};return n.cache=new(br.Cache||at),n}br.Cache=at;function Lu(e,t){return e===t||e!==e&&t!==t}var uo=Array.isArray;function ku(e){var t=fo(e)?oo.call(e):"";return t==Gc||t==Fc}function fo(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Au(e){return!!e&&typeof e=="object"}function Cr(e){return typeof e=="symbol"||Au(e)&&oo.call(e)==qc}function zu(e){return e==null?"":xu(e)}function Vu(e,t,n){var r=e==null?void 0:Tu(e,t);return r===void 0?n:r}var Uu=Vu;const Wu=Rn(Uu),po=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",Hu=e=>{const t=te.useDependency(v.IUniverInstanceService),n=t.getCurrentUniverSheetInstance().getUnitId(),r=t.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),a=_.useMemo(()=>e.error?P.errorInput:"",[e.error]);return f.jsx("div",{className:P.positionRelative,children:e.type!==s.CFValueType.formula?f.jsxs(f.Fragment,{children:[f.jsx(F.InputNumber,{className:a,value:Number(e.value)||0,onChange:o=>e.onChange(o!=null?o:0)}),e.error&&f.jsx("div",{className:P.errorText,children:e.error})]}):f.jsx(ve.TextEditor,{id:`${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:(o="")=>{const i=o||"";e.onChange(i)}})})},ho=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),$u=e=>{const t=te.useDependency(v.LocaleService),n=r=>{e.onClick(r)};return f.jsx("div",{className:P.iconGroupList,children:s.iconGroup.map((r,a)=>f.jsxs("div",{className:P.group,children:[f.jsx("div",{className:P.title,children:t.t(r.title)}),f.jsx("div",{className:P.itemContent,children:r.group.map(o=>f.jsx("div",{className:P.itemWrap,onClick:()=>{n(o.name)},children:f.jsx("div",{className:P.item,children:o.list.map((i,c)=>f.jsx("img",{className:P.icon,src:i},c))})},o.name))})]},a))})},Bu=e=>{const t=_.useMemo(()=>{const r=[];for(const a in s.iconMap){const o=s.iconMap[a],i=a;o.forEach((c,l)=>{r.push({iconType:i,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return f.jsxs("div",{className:P.iconItemListWrap,children:[f.jsxs("div",{className:P.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[f.jsx(Nt,{className:P.icon}),f.jsx("span",{children:"无单元格图标"})]}),f.jsx("div",{className:P.iconItemList,children:t.map(r=>f.jsx("div",{className:P.item,children:f.jsx("img",{onClick:()=>n(r),className:`${P.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},Gu=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,a=te.useDependency(v.LocaleService),o=[{label:a.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],i=[{label:a.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:a.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(h,p)=>{t([String(p),"value","value"],h)},l=(h,p)=>{t([String(p),"operator"],h);const y=s.createDefaultValue(s.CFSubRuleType.number,h);c(y,p)},u=(h,p)=>{t([String(p),"value","type"],h)};return _.useMemo(()=>n.map((h,p)=>{const y=r[p],C=po(h.iconType,h.iconId),b=p===n.length-1,T=p===0,I=n[p-1],m=(I==null?void 0:I.value.type)===s.CFValueType.formula?a.t("sheet.cf.valueType.formula"):I==null?void 0:I.value.value,S=(R,g)=>{const w={...h,iconId:g,iconType:R};t([String(p)],w)};return f.jsxs("div",{className:`${p?M.mTXl:M.mTSm}`,children:[f.jsxs("div",{className:`${M.label} ${P.flex}`,children:[f.jsxs("div",{className:`${P.width45}`,children:[a.t("sheet.cf.iconSet.icon"),p+1]}),f.jsx("div",{className:`${P.width45}`,children:f.jsxs(f.Fragment,{children:[!T&&!b&&a.t("sheet.cf.iconSet.rule"),!T&&!b&&f.jsxs("span",{className:P.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${s.getOppositeOperator(I.operator)}`),m,b?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),f.jsxs("div",{className:`${P.flex} ${M.mTSm}`,children:[f.jsx("div",{className:`${P.iconWrap} ${P.width45}`,children:f.jsx(F.Dropdown,{overlay:f.jsx(Bu,{onClick:S,iconId:h.iconId,iconType:h.iconType}),children:f.jsxs("div",{className:P.dropdownIcon,children:[C?f.jsx("img",{src:C,className:P.icon}):f.jsx(Nt,{className:P.icon}),f.jsx(Cn,{})]})})}),b?f.jsxs("div",{className:`${P.width45} ${M.label}`,style:{marginTop:0},children:[a.t("sheet.cf.iconSet.rule"),f.jsxs("span",{className:P.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${s.getOppositeOperator(I.operator)}`),m,b?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]}):f.jsx(F.Select,{className:`${M.mL0} ${P.width45} ${M.mR0}`,options:o,value:h.operator,onChange:R=>{l(R,p)}})]}),b?f.jsx("div",{}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:`${M.mTSm} ${M.label} ${P.flex}`,children:[f.jsx("div",{className:`${P.width45}`,children:a.t("sheet.cf.iconSet.type")}),f.jsx("div",{className:`${P.width45}`,children:a.t("sheet.cf.iconSet.value")})]}),f.jsxs("div",{className:`${M.mTSm} ${P.flex}`,children:[f.jsx(F.Select,{className:`${P.width45} ${M.mL0}`,options:i,value:h.value.type,onChange:R=>{u(R,p)}}),f.jsx("div",{className:`${M.mL0} ${P.width45}`,children:f.jsx(Hu,{id:p,type:h.value.type,error:y,value:h.value.value||"",onChange:R=>c(R,p)})})]})]})]},p)}),[n,r])},Fu=e=>{var I;const{interceptorManager:t}=e,n=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.iconSet?e.rule:void 0,r=te.useDependency(v.LocaleService),[a,o]=_.useState({}),[i,c]=_.useState(()=>{const m=Object.keys(s.iconMap)[0];if(n&&n.config.length){const S=n.config[0].iconType;if(!n.config.some(g=>g.iconType!==S))return S}return m}),[l,u]=_.useState(()=>{if(n&&n.config.length)return v.Tools.deepClone(n==null?void 0:n.config);const m=s.iconMap[i]||[];return new Array(m.length).fill("").map((S,R,g)=>R===g.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:i,iconId:String(R)}:ho(i,R,g))}),[d,h]=_.useState(()=>n?!!n.isShowValue:!0),p=_.useMemo(()=>{const m=l.map(S=>po(S.iconType,S.iconId));return f.jsx("div",{className:P.iconWrap,children:m.map((S,R)=>S?f.jsx("img",{className:P.icon,src:S},R):f.jsx(Nt,{className:P.icon},R))})},[l]),y=m=>{if(m.reduce((R,g,w)=>R.preType&&!R.result||m.length-1===w?R:g.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:R.preType?{result:R.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(m[0].value.type)){const R={};return m.forEach((g,w,x)=>{if(w-1<0||w===x.length-1)return;const V=m[w-1],$=s.getOppositeOperator(V.operator);s.compareWithNumber({operator:$,value:V.value.value},g.value.value)||(R[w]=`${r.t(`sheet.cf.form.${$}`,String(V.value.value))} `)}),R}return{}},C=(m,S)=>{Wu(l,m)!==S&&($c(l,m,S),u([...l]),o(y(l)))},b=m=>{c(m);const S=s.iconMap[m]||[],R=new Array(S.length).fill("").map((g,w,x)=>ho(m,w,x));u(R),o(y(R))};_.useEffect(()=>{const m=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{m()}},[d,l,t]),_.useEffect(()=>{const m=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{m()}},[d,l,t,a]);const T=()=>{const m=l.map(S=>({...S}));l.forEach((S,R)=>{const g=l.length-1-R,w=m[g];S.iconId=w.iconId,S.iconType=w.iconType}),u([...l])};return f.jsxs("div",{className:P.iconSet,children:[f.jsx("div",{className:M.title,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${M.mTSm}`,children:f.jsx(F.Dropdown,{overlay:f.jsx($u,{iconType:i,onClick:b}),children:f.jsxs("div",{className:P.dropdownIcon,style:{width:"unset"},children:[p,f.jsx(Cn,{})]})})}),f.jsxs("div",{className:`${M.mTSm} ${P.renderConfig}`,children:[f.jsxs("div",{className:P.utilItem,children:[f.jsx(F.Checkbox,{onChange:T}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),f.jsxs("div",{className:`${P.utilItem} ${M.mLXl}`,children:[f.jsx(F.Checkbox,{checked:!d,onChange:m=>{h(!m)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),f.jsx(Gu,{errorMap:a,onChange:C,configList:l})]})},go=e=>e.getCurrentUniverSheetInstance().getUnitId(),mo=e=>e.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),qu=e=>{var R,g;const t=te.useDependency(v.LocaleService),n=te.useDependency(v.ICommandService),r=te.useDependency(v.IUniverInstanceService),a=te.useDependency(s.ConditionalFormattingRuleModel),o=te.useDependency(ee.SelectionManagerService),i=go(r),c=mo(r),l=_.useRef([]),u=_.useMemo(()=>{var x,E;let w=(x=e.rule)==null?void 0:x.ranges;return w!=null&&w.length||(w=(E=o.getSelectionRanges())!=null?E:[]),w!=null&&w.length?w.map(V=>{const $=wr.serializeRange(V);return $==="NaN"?"":$}).filter(V=>!!V).join(","):""},[e.rule]),d=[{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"}],[h,p]=_.useState(()=>{var E,V;const w=(E=e.rule)==null?void 0:E.rule.type,x=d[0].value;if(!w)return x;switch(w){case s.CFRuleType.highlightCell:{switch((V=e.rule)==null?void 0:V.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 x}),y=_.useRef(),C=_.useMemo(()=>new v.InterceptorManager({beforeSubmit:kl,submit:Al}),[]),b=_.useMemo(()=>{switch(h){case"1":return Wa;case"2":return Ul;case"3":return Vl;case"4":return zl;case"5":return Hl;case"6":return Fu;default:return Wa}},[h]);_.useEffect(()=>{var w;if(((w=e.rule)==null?void 0:w.cfId)!==void 0){const x=n.onCommandExecuted(E=>{if(E.id===ee.RemoveSheetMutation.id){const V=E.params;V.subUnitId===c&&V.unitId===i&&e.onCancel()}E.id===ee.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>x.dispose()}},[(R=e.rule)==null?void 0:R.cfId]);const T=w=>{y.current=w},I=w=>{l.current=w.map(x=>x.range)},m=()=>{const w=C.fetchThroughInterceptors(C.getInterceptPoints().beforeSubmit)(!0,null),x=()=>{const E=l.current;return E.some($=>Number.isNaN($.startRow)||Number.isNaN($.startColumn))?[]:E};if(w){const E=C.fetchThroughInterceptors(C.getInterceptPoints().submit)(null,null),V=x();if(E&&V.length){const $=go(r),O=mo(r);let L={};e.rule&&e.rule.cfId?(L={...e.rule,ranges:V,rule:E},n.executeCommand(za.id,{unitId:$,subUnitId:O,rule:L}),e.onCancel()):(L={cfId:a.createCfId($,O),ranges:V,rule:E,stopIfTrue:!1},n.executeCommand(Aa.id,{unitId:$,subUnitId:O,rule:L}),e.onCancel())}}},S=()=>{e.onCancel()};return f.jsxs("div",{className:P.cfRuleStyleEditor,children:[f.jsx("div",{className:M.title,children:t.t("sheet.cf.panel.range")}),f.jsx("div",{className:`${M.mTBase}`,children:f.jsx(ve.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:i,value:u,id:`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`,onChange:I})}),f.jsx("div",{className:M.title,children:t.t("sheet.cf.panel.styleType")}),f.jsx("div",{className:M.mTBase,children:f.jsx(F.Select,{className:P.width100,value:h,options:d,onChange:w=>p(w)})}),f.jsx(b,{interceptorManager:C,rule:(g=e.rule)==null?void 0:g.rule,onChange:T}),f.jsxs("div",{className:`${M.mTBase} ${P.btnList}`,children:[f.jsx(F.Button,{size:"small",onClick:S,children:t.t("sheet.cf.panel.cancel")}),f.jsx(F.Button,{className:M.mLSm,size:"small",type:"primary",onClick:m,children:t.t("sheet.cf.panel.submit")})]})]})},Xu=e=>{const[t,n]=_.useState(e.rule),[r,a]=_.useState(!!e.rule),o=()=>{a(!0)},i=()=>{a(!1),n(void 0)},c=l=>{n(l),a(!0)};return f.jsx("div",{className:M.conditionalFormattingWrap,children:r?f.jsx(qu,{onCancel:i,rule:t}):f.jsx(Ll,{onClick:c,onCreate:o})})};var Yu=Object.defineProperty,Ku=Object.getOwnPropertyDescriptor,Zu=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ku(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Yu(t,n,a),a},xt=(e,t)=>(n,r)=>t(n,r,e);const vo="sheet.conditional.formatting.panel";let Ot=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._componentManager=t,this._menuService=n,this._sidebarService=r,this._localeService=a,this._initMenu(),this._initPanel()}openPanel(e){const t={header:{title:this._localeService.t("sheet.cf.title")},children:{label:vo,rule:e}};this._sidebarService.open(t)}_initMenu(){this._menuService.addMenuItem(Fo(this._componentManager)(this._injector))}_initPanel(){this._componentManager.register(vo,Xu)}};Ot=Zu([v.OnLifecycle(v.LifecycleStages.Ready,Ot),xt(0,k.Inject(k.Injector)),xt(1,k.Inject(ve.ComponentManager)),xt(2,k.Inject(ve.IMenuService)),xt(3,k.Inject(ve.ISidebarService)),xt(4,k.Inject(v.LocaleService))],Ot);var Ie=(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))(Ie||{});const yo={id:"sheet.operation.open.conditional.formatting.panel",type:v.CommandType.OPERATION,handler:(e,t)=>{const n=e.get(Ot),r=e.get(ee.SelectionManagerService),a=e.get(v.ICommandService),o=r.getSelectionRanges()||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:o});break}case 4:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(c);break}case 5:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(c);break}case 6:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(c);break}case 7:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.dataBar}};n.openPanel(c);break}case 8:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(c);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:o});break}case 9:{a.executeCommand(_r.id,{ranges:o});break}case 10:{a.executeCommand(Sn.id);break}}return!0}};var Ju=Object.defineProperty,Qu=Object.getOwnPropertyDescriptor,ed=(e,t,n,r)=>{for(var a=r>1?void 0:r?Qu(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Ju(t,n,a),a},ot=(e,t)=>(n,r)=>t(n,r,e);let dn=class extends v.Disposable{constructor(e,t,n,r,a,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=a,this._conditionalFormattingRuleModel=o,this._sheetSkeletonManagerService=i,this._initViewModelInterceptor(),this._initSkeleton(),this._initRender()}_initRender(){const e=[[s.dataBarUKey,s.DataBar],[s.IconUKey,s.ConditionalFormattingIcon]],t=r=>{const a=r&&this._renderManagerService.getRenderById(r),o=a&&a.mainComponent;o&&e.forEach(([i,c])=>{o.getExtensionByKey(i)||o.register(new c)})};this.disposeWithMe(this._renderManagerService.currentRender$.subscribe(r=>{r&&t(r)}));const n=this._univerInstanceService.getCurrentUniverSheetInstance();n&&t(n.getUnitId())}_initSkeleton(){const e=()=>{var n,r;this._sheetSkeletonManagerService.reCalculate();const t=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId();(r=(n=this._renderManagerService.getRenderById(t))==null?void 0:n.mainComponent)==null||r.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(_e.bufferTime(16),_e.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(_e.bufferTime(16),_e.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(a=>["sort","delete"].includes(a.type)&&a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(_e.bufferTime(16),_e.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(ee.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 a=t.workbook.getStyles(),i={...(typeof(e==null?void 0:e.s)=="string"?a.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:i};return r.style&&Object.assign(i,r.style),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension||(c.fontRenderExtension={}),c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH,r.iconSet.isShowValue||(c.fontRenderExtension.isSkip=!0)),n(c)}}))}};dn=ed([v.OnLifecycle(v.LifecycleStages.Rendered,dn),ot(0,k.Inject(ee.SheetInterceptorService)),ot(1,k.Inject(s.ConditionalFormattingService)),ot(2,k.Inject(v.IUniverInstanceService)),ot(3,k.Inject(Io.IRenderManagerService)),ot(4,k.Inject(s.ConditionalFormattingViewModel)),ot(5,k.Inject(s.ConditionalFormattingRuleModel)),ot(6,k.Inject(ge.SheetSkeletonManagerService))],dn);var td=Object.defineProperty,nd=Object.getOwnPropertyDescriptor,rd=(e,t,n,r)=>{for(var a=r>1?void 0:r?nd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&td(t,n,a),a},Mt=(e,t)=>(n,r)=>t(n,r,e);let fn=class extends v.Disposable{constructor(t,n,r,a,o){super();mt(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=a,this._univerInstanceService=o,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,a)=>{const{copyType:o=ge.COPY_TYPE.COPY,pasteType:i}=a,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:o,pasteType:i,copyRange:c})}}))}_collectConditionalRule(t,n,r){const a=new v.ObjectMatrix,o={};this._copyInfo={matrix:a,info:{unitId:t,subUnitId:n,cfMap:o}};const i=this._conditionalFormattingViewModel.getMatrix(t,n);if(!i)return;const c=new Set;v.Range.foreach(r,(l,u)=>{const d=this._conditionalFormattingViewModel.getCellCf(t,n,l,u,i);if(!d)return;const h=v.Rectangle.getRelativeRange({startRow:l,endRow:l,startColumn:u,endColumn:u},r);d.cfList.forEach(p=>c.add(p.cfId)),a.setValue(h.startRow,h.startColumn,d.cfList.map(p=>p.cfId))}),c.forEach(l=>{const u=this._conditionalFormattingRuleModel.getRule(t,n,l);u&&(o[l]=u.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUniverSheetInstance(),a=r.getActiveSheet(),o=r.getUnitId(),i=a.getSheetId();if(n.copyType===ge.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![ge.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,ge.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,ge.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const c=ge.getRepeatRange(n.copyRange,t,!0),l=this._conditionalFormattingViewModel.getMatrix(o,i),u={};v.Range.foreach(t,(m,S)=>{const R=this._conditionalFormattingViewModel.getCellCf(o,i,m,S,l);R&&R.cfList.forEach(g=>{if(!u[g.cfId]){const w=new v.ObjectMatrix;u[g.cfId]=w;const x=this._conditionalFormattingRuleModel.getRule(o,i,g.cfId);x==null||x.ranges.forEach(E=>{v.Range.foreach(E,(V,$)=>{w.setValue(V,$,1)})})}u[g.cfId].realDeleteValue(m,S)})});const{matrix:d,info:h}=this._copyInfo,p=[];let y=this._conditionalFormattingRuleModel.createCfId(o,i);const C={},b=m=>{if(C[m])return C[m];const S=h==null?void 0:h.cfMap[m],R=[...this._conditionalFormattingRuleModel.getSubunitRules(o,i)||[],...p].find(g=>v.Tools.diffValue(g.rule,S));if(R)return C[m]=R,R;{const g={rule:S,cfId:y,ranges:[],stopIfTrue:!1};return C[m]=g,p.push(g),y=`${Number(y)+1}`,g}};c.forEach(m=>{d&&d.forValue((S,R,g)=>{const w=v.Rectangle.getPositionRange({startRow:S,endRow:S,startColumn:R,endColumn:R},m.startRange),x=w.startRow,E=w.startColumn;g.forEach(V=>{if(!u[V]){const $=b(V),O=new v.ObjectMatrix;u[V]=O,$.ranges.forEach(L=>{v.Range.foreach(L,(D,j)=>{O.setValue(D,j,1)})})}u[V].setValue(x,E,1)})})});const T=[],I=[];for(const m in u){const S=u[m],R=ee.findAllRectangle(ee.createTopMatrixFromMatrix(S));if(!R.length){const g={unitId:o,subUnitId:i,cfId:m};T.push({id:s.DeleteConditionalRuleMutation.id,params:g}),I.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(p.some(g=>g.cfId===m)){const g=b(m),w={unitId:o,subUnitId:i,rule:{...g,ranges:R}};T.push({id:s.AddConditionalRuleMutation.id,params:w}),I.push(s.AddConditionalRuleMutationUndoFactory(this._injector,w))}else{const g=this._conditionalFormattingRuleModel.getRule(o,i,m);if(!g)continue;const w={unitId:o,subUnitId:i,rule:{...g,ranges:R}};T.push({id:s.SetConditionalRuleMutation.id,params:w}),I.push(...s.setConditionalRuleMutationUndoFactory(this._injector,w))}}return{redos:T,undos:I}}};fn=rd([v.OnLifecycle(v.LifecycleStages.Rendered,fn),Mt(0,k.Inject(ge.ISheetClipboardService)),Mt(1,k.Inject(s.ConditionalFormattingRuleModel)),Mt(2,k.Inject(k.Injector)),Mt(3,k.Inject(s.ConditionalFormattingViewModel)),Mt(4,k.Inject(v.IUniverInstanceService))],fn);var ad=Object.defineProperty,od=Object.getOwnPropertyDescriptor,id=(e,t,n,r)=>{for(var a=r>1?void 0:r?od(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&ad(t,n,a),a},Dt=(e,t)=>(n,r)=>t(n,r,e);let pn=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(a,o,i,c)=>{const l=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),u=this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),d={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},h={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};v.Range.foreach(i,(p,y)=>{const C=v.Rectangle.getPositionRange({startRow:p,startColumn:y,endColumn:y,endRow:p},d),b=v.Rectangle.getPositionRange({startRow:p,startColumn:y,endColumn:y,endRow:p},h),T=this._conditionalFormattingViewModel.getCellCf(l,u,C.startRow,C.startColumn),I=this._conditionalFormattingViewModel.getCellCf(l,u,b.startRow,b.startColumn);I&&I.cfList.forEach(m=>{let S=c.get(m.cfId);if(!c.get(m.cfId)){const R=this._conditionalFormattingRuleModel.getRule(l,u,m.cfId);if(!R)return;S=new v.ObjectMatrix,R.ranges.forEach(g=>{v.Range.foreach(g,(w,x)=>{S.setValue(w,x,1)})}),c.set(m.cfId,S)}S.realDeleteValue(b.startRow,b.startColumn)}),T&&T.cfList.forEach(m=>{let S=c.get(m.cfId);if(!c.get(m.cfId)){const R=this._conditionalFormattingRuleModel.getRule(l,u,m.cfId);if(!R)return;S=new v.ObjectMatrix,R.ranges.forEach(g=>{v.Range.foreach(g,(w,x)=>{S.setValue(w,x,1)})}),c.set(m.cfId,S)}S.setValue(b.startRow,b.startColumn,1)})})},n=(a,o)=>{const i=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),c=this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),l=new Map,u=[],d=[],h={row:a.startRow,col:a.startColumn};return ge.getAutoFillRepeatRange(a,o).forEach(y=>{t(h,y.repeatStartCell,y.relativeRange,l)}),l.forEach((y,C)=>{const b=this._conditionalFormattingRuleModel.getRule(i,c,C);if(!b)return;const T=ee.findAllRectangle(ee.createTopMatrixFromMatrix(y)),I={unitId:i,subUnitId:c,rule:{...b,ranges:T}};u.push({id:s.SetConditionalRuleMutation.id,params:I}),d.push(...s.setConditionalRuleMutationUndoFactory(this._injector,I))}),{undos:d,redos:u}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,o,i)=>{if(i===ge.APPLY_TYPE.COPY||i===ge.APPLY_TYPE.ONLY_FORMAT||i===ge.APPLY_TYPE.SERIES){const{source:c,target:l}=a;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};pn=id([v.OnLifecycle(v.LifecycleStages.Rendered,pn),Dt(0,k.Inject(k.Injector)),Dt(1,k.Inject(v.IUniverInstanceService)),Dt(2,k.Inject(ge.IAutoFillService)),Dt(3,k.Inject(s.ConditionalFormattingRuleModel)),Dt(4,k.Inject(s.ConditionalFormattingViewModel))],pn);var sd=Object.defineProperty,ld=Object.getOwnPropertyDescriptor,cd=(e,t,n,r)=>{for(var a=r>1?void 0:r?ld(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&sd(t,n,a),a},Et=(e,t)=>(n,r)=>t(n,r,e);let hn=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._sheetSkeletonManagerService=r,this._refRangeService=a,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,a,o)=>`${r}_${a}_${o}`,n=(r,a,o)=>{const i=l=>{const u=[...o.ranges],d=u.map(p=>ee.handleDefaultRangeChangeWithEffectRefCommands(p,l)).filter(p=>!!p);if(s.isRangesEqual(d,u))return{redos:[],undos:[]};if(d.length){const p={unitId:r,subUnitId:a,rule:{...o,ranges:d}},y=[{id:s.SetConditionalRuleMutation.id,params:p}],C=s.setConditionalRuleMutationUndoFactory(this._injector,p);return{redos:y,undos:C}}else{const p={unitId:r,subUnitId:a,cfId:o.cfId},y=[{id:s.DeleteConditionalRuleMutation.id,params:p}],C=s.DeleteConditionalRuleMutationUndoFactory(this._injector,p);return{redos:y,undos:C}}},c=[];o.ranges.forEach(l=>{const u=this._refRangeService.registerRefRange(l,i);c.push(()=>u.dispose())}),e.set(t(r,a,o.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(ye.merge(this._sheetSkeletonManagerService.currentSkeleton$.pipe(_e.map(r=>r==null?void 0:r.sheetId),_e.distinctUntilChanged())).pipe(_e.switchMap(()=>new ye.Observable(r=>{const a=new v.DisposableCollection;return r.next(a),()=>{a.dispose()}}))).subscribe(r=>{r.add(v.toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe(a=>{const{unitId:o,subUnitId:i,rule:c}=a,l=this._univerInstanceService.getCurrentUniverSheetInstance(),u=l.getActiveSheet();if(!(a.unitId!==l.getUnitId()||a.subUnitId!==u.getSheetId()))switch(a.type){case"add":{n(a.unitId,a.subUnitId,a.rule);break}case"delete":{const d=e.get(t(o,i,c.cfId));d&&d();break}case"set":{const d=e.get(t(o,i,c.cfId));d&&d(),n(a.unitId,a.subUnitId,a.rule)}}})))})),this.disposeWithMe(v.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};hn=cd([v.OnLifecycle(v.LifecycleStages.Rendered,hn),Et(0,k.Inject(s.ConditionalFormattingRuleModel)),Et(1,k.Inject(v.IUniverInstanceService)),Et(2,k.Inject(k.Injector)),Et(3,k.Inject(ge.SheetSkeletonManagerService)),Et(4,k.Inject(ee.RefRangeService))],hn);var ud=Object.defineProperty,dd=Object.getOwnPropertyDescriptor,fd=(e,t,n,r)=>{for(var a=r>1?void 0:r?dd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&ud(t,n,a),a},So=(e,t)=>(n,r)=>t(n,r,e);let gn=class extends v.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(v.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 a=Object.keys(r==null?void 0:r.style);if(a.length>0){const o=s.getStringFromDataStream(e.p),i={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};a.forEach(l=>{delete i[l]});const c={...e,s:{...i},v:o};return delete c.p,n(c)}}return n(e)}})))}};gn=fd([v.OnLifecycle(v.LifecycleStages.Rendered,gn),So(0,k.Inject(ge.IEditorBridgeService)),So(1,k.Inject(s.ConditionalFormattingService))],gn);var pd=Object.defineProperty,hd=Object.getOwnPropertyDescriptor,gd=(e,t,n,r)=>{for(var a=r>1?void 0:r?hd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&pd(t,n,a),a},Pt=(e,t)=>(n,r)=>t(n,r,e);let mn=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=a,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{const t=[],n=[],r={redos:t,undos:n};if([ee.ClearSelectionFormatCommand.id,ee.ClearSelectionAllCommand.id].includes(e.id)){const a=this._selectionManagerService.getSelectionRanges();if(!a)return r;const o=this._univerInstanceService.getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=this._conditionalFormattingRuleModel.getSubunitRules(o.getUnitId(),i.getSheetId());if(!c||!c.length)return r;c.filter(l=>a.some(u=>l.ranges.some(d=>v.Rectangle.getIntersects(d,u)))).forEach(l=>{const d=new ee.RangeMergeUtil().add(...l.ranges).subtract(...a).merge();if(d.length){const h={id:s.SetConditionalRuleMutation.id,params:{unitId:o.getUnitId(),subUnitId:i.getSheetId(),rule:{...l,ranges:d}}},p=s.setConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...p)}else{const h={id:s.DeleteConditionalRuleMutation.id,params:{unitId:o.getUnitId(),subUnitId:i.getSheetId(),cfId:l.cfId}},p=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...p)}})}return r}}))}};mn=gd([v.OnLifecycle(v.LifecycleStages.Rendered,mn),Pt(0,k.Inject(k.Injector)),Pt(1,k.Inject(v.IUniverInstanceService)),Pt(2,k.Inject(ee.SheetInterceptorService)),Pt(3,k.Inject(ee.SelectionManagerService)),Pt(4,k.Inject(s.ConditionalFormattingRuleModel))],mn);var md=Object.defineProperty,vd=Object.getOwnPropertyDescriptor,yd=(e,t,n,r)=>{for(var a=r>1?void 0:r?vd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&md(t,n,a),a},bo=(e,t)=>(n,r)=>t(n,r,e);q.SheetsConditionalFormattingUiPlugin=(vn=class extends v.Plugin{constructor(t,n,r){super(s.SHEET_CONDITIONAL_FORMATTING_PLUGIN),this._injector=n,this._commandService=r,this._initCommand(),s.SheetsConditionalFormattingPlugin.dependencyList.forEach(a=>{this._injector.add(a)}),this._injector.add([dn]),this._injector.add([hn]),this._injector.add([fn]),this._injector.add([pn]),this._injector.add([Ot]),this._injector.add([wt]),this._injector.add([gn]),this._injector.add([mn])}_initCommand(){[...s.SheetsConditionalFormattingPlugin.mutationList,...q.SheetsConditionalFormattingUiPlugin.commandList].forEach(t=>{this._commandService.registerCommand(t)})}},mt(vn,"type",v.PluginType.Sheet),mt(vn,"commandList",[wo,To,_o,xo,Oo,Mo,Do,Eo,Po,yo,cr,za,ja,Aa,_r,Sn]),vn),q.SheetsConditionalFormattingUiPlugin=yd([bo(1,k.Inject(k.Injector)),bo(2,k.Inject(v.ICommandService))],q.SheetsConditionalFormattingUiPlugin),q.enUS=Ml,q.zhCN=La,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univerjs/sheets-conditional-formatting-ui",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Conditional formatting plugin for Univer Sheets",
|
|
6
|
+
"author": "DreamNum <developer@univer.ai>",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"funding": {
|
|
9
|
+
"type": "opencollective",
|
|
10
|
+
"url": "https://opencollective.com/univer"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://univer.ai",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/dream-num/univer.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/dream-num/univer/issues"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"univer"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"**/*.css"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./lib/es/index.js",
|
|
29
|
+
"require": "./lib/cjs/index.js",
|
|
30
|
+
"types": "./lib/types/index.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./*": {
|
|
33
|
+
"import": "./lib/es/*",
|
|
34
|
+
"require": "./lib/cjs/*",
|
|
35
|
+
"types": "./lib/types/index.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./lib/*": "./lib/*"
|
|
38
|
+
},
|
|
39
|
+
"main": "./lib/cjs/index.js",
|
|
40
|
+
"module": "./lib/es/index.js",
|
|
41
|
+
"types": "./lib/types/index.d.ts",
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"directories": {
|
|
46
|
+
"lib": "lib"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"lib"
|
|
50
|
+
],
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=16.0.0",
|
|
53
|
+
"npm": ">=8.0.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@wendellhu/redi": "0.13.0",
|
|
57
|
+
"clsx": ">=2.0.0",
|
|
58
|
+
"react": ">=16.9.0",
|
|
59
|
+
"react-dom": ">=16.9.0",
|
|
60
|
+
"rxjs": ">=7.0.0",
|
|
61
|
+
"@univerjs/core": "0.1.6",
|
|
62
|
+
"@univerjs/design": "0.1.6",
|
|
63
|
+
"@univerjs/engine-render": "0.1.6",
|
|
64
|
+
"@univerjs/engine-formula": "0.1.6",
|
|
65
|
+
"@univerjs/sheets": "0.1.6",
|
|
66
|
+
"@univerjs/sheets-conditional-formatting": "0.1.6",
|
|
67
|
+
"@univerjs/ui": "0.1.6",
|
|
68
|
+
"@univerjs/sheets-ui": "0.1.6"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@univerjs/icons": "^0.1.43",
|
|
72
|
+
"lodash.get": "^4.4.2",
|
|
73
|
+
"lodash.set": "^4.3.2",
|
|
74
|
+
"react-grid-layout": "^1.4.4",
|
|
75
|
+
"react-resizable": "^3.0.5",
|
|
76
|
+
"@univerjs/sheets-conditional-formatting": "0.1.6"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@types/lodash.get": "^4.4.9",
|
|
80
|
+
"@types/lodash.set": "^4.3.9",
|
|
81
|
+
"@types/react-grid-layout": "^1.3.5",
|
|
82
|
+
"@univerjs/icons-svg": "^0.1.43",
|
|
83
|
+
"@wendellhu/redi": "^0.13.0",
|
|
84
|
+
"clsx": "^2.1.0",
|
|
85
|
+
"less": "^4.2.0",
|
|
86
|
+
"react": "^18.2.0",
|
|
87
|
+
"rxjs": "^7.8.1",
|
|
88
|
+
"typescript": "^5.4.3",
|
|
89
|
+
"vite": "^5.2.7",
|
|
90
|
+
"vitest": "^1.4.0",
|
|
91
|
+
"@univerjs/engine-formula": "0.1.6",
|
|
92
|
+
"@univerjs/core": "0.1.6",
|
|
93
|
+
"@univerjs/engine-render": "0.1.6",
|
|
94
|
+
"@univerjs/shared": "0.1.6",
|
|
95
|
+
"@univerjs/design": "0.1.6",
|
|
96
|
+
"@univerjs/sheets": "0.1.6",
|
|
97
|
+
"@univerjs/sheets-ui": "0.1.6",
|
|
98
|
+
"@univerjs/ui": "0.1.6"
|
|
99
|
+
},
|
|
100
|
+
"scripts": {
|
|
101
|
+
"test": "vitest run",
|
|
102
|
+
"test:watch": "vitest",
|
|
103
|
+
"coverage": "vitest run --coverage",
|
|
104
|
+
"lint:types": "tsc --noEmit",
|
|
105
|
+
"build": "tsc && vite build"
|
|
106
|
+
}
|
|
107
|
+
}
|