| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- "use strict";var $r=Object.defineProperty;var zr=(t,e,r)=>e in t?$r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var _e=(t,e,r)=>zr(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@univerjs/core"),c=require("@univerjs/sheets-conditional-formatting"),X=require("@univerjs/sheets"),me=require("@univerjs/ui"),N=require("react"),re=require("@univerjs/design"),an=require("@univerjs/engine-formula"),ce=require("@univerjs/sheets-ui"),fr=require("react-dom"),be=require("rxjs"),pt=require("@univerjs/sheets-formula-ui"),pr=require("@univerjs/engine-render"),at=require("rxjs/operators"),ln={type:C.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o,operator:i}=e,l=t.get(c.ConditionalFormattingRuleModel),y=t.get(C.ICommandService),f=t.get(C.IUniverInstanceService),S=X.getSheetCommandTarget(f);if(!S)return!1;const{unitId:m,subUnitId:T}=S,_=l.createCfId(m,T),I={ranges:r,cfId:_,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.average,operator:i,style:n}};return y.executeCommand(c.AddConditionalRuleMutation.id,{unitId:m,subUnitId:T,rule:I})}},ht={type:C.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(t,e){if(!e)return!1;const{rule:r}=e,n=t.get(C.IUndoRedoService),o=t.get(C.ICommandService),i=t.get(c.ConditionalFormattingRuleModel),l=t.get(C.IUniverInstanceService),y=X.getSheetCommandTarget(l);if(!y)return!1;const{unitId:f,subUnitId:S}=y,m=i.createCfId(f,S),T={unitId:f,subUnitId:S,rule:{...r,cfId:r.cfId||m}},_=c.AddConditionalRuleMutationUndoFactory(t,T),I=o.syncExecuteCommand(c.AddConditionalRuleMutation.id,T);return I&&n.pushUndoRedo({unitID:f,redoMutations:[{id:c.AddConditionalRuleMutation.id,params:T}],undoMutations:[_]}),I}},un={type:C.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,config:n,stopIfTrue:o}=e,i=t.get(c.ConditionalFormattingRuleModel),l=t.get(C.ICommandService),y=t.get(C.IUniverInstanceService),f=X.getSheetCommandTarget(y);if(!f)return!1;const{unitId:S,subUnitId:m}=f,T=i.createCfId(S,m),_={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:c.CFRuleType.colorScale,config:n}};return l.executeCommand(c.AddConditionalRuleMutation.id,{unitId:S,subUnitId:m,rule:_})}},cn={type:C.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,min:n,max:o,nativeColor:i,positiveColor:l,isGradient:y,stopIfTrue:f,isShowValue:S}=e,m=t.get(c.ConditionalFormattingRuleModel),T=t.get(C.IUniverInstanceService),_=X.getSheetCommandTarget(T);if(!_)return!1;const{unitId:I,subUnitId:b}=_,w=t.get(C.ICommandService),h=m.createCfId(I,b),a={ranges:r,cfId:h,stopIfTrue:!!f,rule:{type:c.CFRuleType.dataBar,isShowValue:S,config:{min:n,max:o,nativeColor:i,positiveColor:l,isGradient:y}}};return w.executeCommand(c.AddConditionalRuleMutation.id,{unitId:I,subUnitId:b,rule:a})}},dn={type:C.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o}=e,i=t.get(c.ConditionalFormattingRuleModel),l=t.get(C.ICommandService),y=t.get(C.IUniverInstanceService),f=X.getSheetCommandTarget(y);if(!f)return!1;const{unitId:S,subUnitId:m}=f,T=i.createCfId(S,m),_={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.duplicateValues,style:n}};return l.executeCommand(c.AddConditionalRuleMutation.id,{unitId:S,subUnitId:m,rule:_})}},fn={type:C.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o,operator:i,value:l}=e,y=t.get(c.ConditionalFormattingRuleModel),f=t.get(C.ICommandService),S=t.get(C.IUniverInstanceService),m=X.getSheetCommandTarget(S);if(!m)return!1;const{unitId:T,subUnitId:_}=m,I=y.createCfId(T,_);let b;if([c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(i)){const w=l;if(w.length!==2||!Array.isArray(w))return!1;b={ranges:r,cfId:I,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.number,operator:i,style:n,value:w}}}else{const w=l;if(typeof w!="number")return!1;b={ranges:r,cfId:I,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.number,operator:i,style:n,value:w}}}return f.executeCommand(c.AddConditionalRuleMutation.id,{unitId:T,subUnitId:_,rule:b})}},pn={type:C.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o,isPercent:i,isBottom:l,value:y}=e,f=t.get(c.ConditionalFormattingRuleModel),S=t.get(C.IUniverInstanceService),m=t.get(C.ICommandService),T=X.getSheetCommandTarget(S);if(!T)return!1;const{unitId:_,subUnitId:I}=T,b=f.createCfId(_,I),w={ranges:r,cfId:b,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank,isPercent:i,isBottom:l,style:n,value:y}};return m.executeCommand(c.AddConditionalRuleMutation.id,{unitId:_,subUnitId:I,rule:w})}},hn={type:C.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o,operator:i,value:l}=e,y=t.get(c.ConditionalFormattingRuleModel),f=t.get(C.IUniverInstanceService),S=X.getSheetCommandTarget(f);if(!S)return!1;const{unitId:m,subUnitId:T}=S,_=t.get(C.ICommandService),I=y.createCfId(m,T),b={ranges:r,cfId:I,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.text,operator:i,style:n,value:l}};return _.executeCommand(c.AddConditionalRuleMutation.id,{unitId:m,subUnitId:T,rule:b})}},mn={type:C.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o,operator:i}=e,l=t.get(c.ConditionalFormattingRuleModel),y=t.get(C.IUniverInstanceService),f=t.get(C.ICommandService),S=X.getSheetCommandTarget(y);if(!S)return!1;const{unitId:m,subUnitId:T}=S,_=l.createCfId(m,T),I={ranges:r,cfId:_,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.timePeriod,operator:i,style:n}};return f.executeCommand(c.AddConditionalRuleMutation.id,{unitId:m,subUnitId:T,rule:I})}},gn={type:C.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:r,style:n,stopIfTrue:o}=e,i=t.get(c.ConditionalFormattingRuleModel),l=t.get(C.IUniverInstanceService),y=t.get(C.ICommandService),f=X.getSheetCommandTarget(l);if(!f)return!1;const{unitId:S,subUnitId:m}=f,T=i.createCfId(S,m),_={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.uniqueValues,style:n}};return y.executeCommand(c.AddConditionalRuleMutation.id,{unitId:S,subUnitId:m,rule:_})}},$t={type:C.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(t,e){var w;if(!e)return!1;const r=t.get(c.ConditionalFormattingRuleModel),n=t.get(C.IUniverInstanceService),o=t.get(C.ICommandService),i=t.get(C.IUndoRedoService),l=t.get(X.SheetsSelectionsService),y=X.getSheetCommandTarget(n,e);if(!y)return!1;const{unitId:f,subUnitId:S}=y,m=((w=l.getCurrentSelections())==null?void 0:w.map(h=>h.range))||[],T=r.getSubunitRules(f,S);if(!(T!=null&&T.length)||!m.length)return!1;const _=[],I=[];T.forEach(h=>{const a=new C.ObjectMatrix;h.ranges.forEach(d=>{C.Range.foreach(d,(R,u)=>{a.setValue(R,u,1)})}),m.forEach(d=>{C.Range.foreach(d,(R,u)=>{a.realDeleteValue(R,u)})});const s=X.findAllRectangle(X.createTopMatrixFromMatrix(a));if(s.length){const d={...h,ranges:s},R={unitId:f,subUnitId:S,rule:d},u=c.setConditionalRuleMutationUndoFactory(t,R);_.push({id:c.SetConditionalRuleMutation.id,params:R}),I.push(...u)}else{const d={unitId:f,subUnitId:S,cfId:h.cfId},R=c.DeleteConditionalRuleMutationUndoFactory(t,d);_.push({id:c.DeleteConditionalRuleMutation.id,params:d}),I.push(...R)}});const b=C.sequenceExecute(_,o).result;return b&&i.pushUndoRedo({unitID:f,redoMutations:_,undoMutations:I}),b}},mt={type:C.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(t,e){const r=t.get(c.ConditionalFormattingRuleModel),n=t.get(C.IUniverInstanceService),o=t.get(C.ICommandService),i=t.get(C.IUndoRedoService),l=X.getSheetCommandTarget(n,e);if(!l)return!1;const{unitId:y,subUnitId:f}=l,S=r.getSubunitRules(y,f);if(!(S!=null&&S.length))return!1;const m=S.map(b=>({cfId:b.cfId,unitId:y,subUnitId:f})),T=m.map(b=>({id:c.DeleteConditionalRuleMutation.id,params:b})),_=m.map(b=>c.DeleteConditionalRuleMutationUndoFactory(t,b)[0]),I=C.sequenceExecute(T,o).result;return I&&i.pushUndoRedo({unitID:y,redoMutations:T,undoMutations:_}),I}},st={type:C.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(t,e){if(!e)return!1;const r=t.get(C.IUndoRedoService),n=t.get(C.ICommandService),o=t.get(C.IUniverInstanceService),i=X.getSheetCommandTarget(o,e);if(!i)return!1;const{unitId:l,subUnitId:y}=i,f={unitId:l,subUnitId:y,cfId:e.cfId},S=c.DeleteConditionalRuleMutationUndoFactory(t,f),m=n.syncExecuteCommand(c.DeleteConditionalRuleMutation.id,f);return m&&r.pushUndoRedo({unitID:l,undoMutations:S,redoMutations:[{id:c.DeleteConditionalRuleMutation.id,params:f}]}),m}},zt={type:C.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(t,e){if(!e)return!1;const r=t.get(C.IUndoRedoService),n=t.get(C.ICommandService),o=t.get(C.IUniverInstanceService),i=t.get(c.ConditionalFormattingRuleModel),l=X.getSheetCommandTarget(o,e);if(!l)return!1;const{unitId:y,subUnitId:f}=l,S=c.transformSupportSymmetryAnchor(e.start,e.end,i.getSubunitRules(y,f)||[],w=>w.cfId);if(!S)return!1;const[m,T]=S,_={unitId:y,subUnitId:f,start:m,end:T},I=c.MoveConditionalRuleMutationUndoFactory(_),b=n.syncExecuteCommand(c.MoveConditionalRuleMutation.id,_);return b&&r.pushUndoRedo({unitID:y,redoMutations:[{id:c.MoveConditionalRuleMutation.id,params:_}],undoMutations:I}),b}},At={type:C.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(t,e){if(!e)return!1;const r=t.get(C.IUndoRedoService),n=t.get(C.ICommandService),o=t.get(C.IUniverInstanceService),i=X.getSheetCommandTarget(o,e);if(!i)return!1;const{unitId:l,subUnitId:y}=i,f={unitId:l,subUnitId:y,rule:e.rule},S=c.setConditionalRuleMutationUndoFactory(t,f),m=n.syncExecuteCommand(c.SetConditionalRuleMutation.id,f);return m&&r.pushUndoRedo({unitID:l,undoMutations:S,redoMutations:[{id:c.SetConditionalRuleMutation.id,params:f}]}),m}};function Ar(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function hr(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),r}var Bt={exports:{}},He={};/**
- * @license React
- * react-jsx-runtime.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Tn;function qr(){if(Tn)return He;Tn=1;var t=N,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(y,f,S){var m,T={},_=null,I=null;S!==void 0&&(_=""+S),f.key!==void 0&&(_=""+f.key),f.ref!==void 0&&(I=f.ref);for(m in f)n.call(f,m)&&!i.hasOwnProperty(m)&&(T[m]=f[m]);if(y&&y.defaultProps)for(m in f=y.defaultProps,f)T[m]===void 0&&(T[m]=f[m]);return{$$typeof:e,type:y,key:_,ref:I,props:T,_owner:o.current}}return He.Fragment=r,He.jsx=l,He.jsxs=l,He}var In;function Wr(){return In||(In=1,Bt.exports=qr()),Bt.exports}var x=Wr();const Hr="univer-conditional-formatting-wrap",kr="univer-cf-rule-item",Br="univer-preview",Gr="univer-create-rule",Xr="univer-button",Yr="univer-title",Kr="univer-label",Zr="univer-label-container",Jr="univer-input-width",Qr="univer-m-t-base",eo="univer-m-t-sm",to="univer-m-t-xl",no="univer-m-l-sm",ro="univer-m-l-xl",oo="univer-m-l-xxs",io="univer-m-l-0",ao="univer-m-r-0",$={conditionalFormattingWrap:Hr,cfRuleItem:kr,preview:Br,createRule:Gr,button:Xr,title:Yr,label:Kr,labelContainer:Zr,inputWidth:Jr,mTBase:Qr,mTSm:eo,mTXl:to,mLSm:no,mLXl:ro,mLXxs:oo,mL0:io,mR0:ao};var Ce=function(){return Ce=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Ce.apply(this,arguments)},so=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r},Ae=N.forwardRef(function(t,e){var r=t.icon,n=t.id,o=t.className,i=t.extend,l=so(t,["icon","id","className","extend"]),y="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),f=N.useRef("_".concat(co()));return mr(r,"".concat(n),{defIds:r.defIds,idSuffix:f.current},Ce({ref:e,className:y},l),i)});function mr(t,e,r,n,o){return N.createElement(t.tag,Ce(Ce({key:e},lo(t,r,o)),n),(uo(t,r).children||[]).map(function(i,l){return mr(i,"".concat(e,"-").concat(t.tag,"-").concat(l),r,void 0,o)}))}function lo(t,e,r){var n=Ce({},t.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var o=e.defIds;return!o||o.length===0||(t.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(i){var l=i[0],y=i[1];typeof y=="string"&&(n[l]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function uo(t,e){var r,n=e.defIds;return!n||n.length===0?t:t.tag==="defs"&&(!((r=t.children)===null||r===void 0)&&r.length)?Ce(Ce({},t),{children:t.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?Ce(Ce({},o),{attrs:Ce(Ce({},o.attrs),{id:o.attrs.id+e.idSuffix})}):o})}):t}function co(){return Math.random().toString(36).substring(2,8)}Ae.displayName="UniverIcon";var fo={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Pt=N.forwardRef(function(t,e){return N.createElement(Ae,Object.assign({},t,{id:"delete-single",ref:e,icon:fo}))});Pt.displayName="DeleteSingle";var po={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},gr=N.forwardRef(function(t,e){return N.createElement(Ae,Object.assign({},t,{id:"increase-single",ref:e,icon:po}))});gr.displayName="IncreaseSingle";var ho={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},qt=N.forwardRef(function(t,e){return N.createElement(Ae,Object.assign({},t,{id:"more-down-single",ref:e,icon:ho}))});qt.displayName="MoreDownSingle";var mo={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"}}]}]},vr=N.forwardRef(function(t,e){return N.createElement(Ae,Object.assign({},t,{id:"sequence-single",ref:e,icon:mo}))});vr.displayName="SequenceSingle";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"}}]}]},gt=N.forwardRef(function(t,e){return N.createElement(Ae,Object.assign({},t,{id:"slash-single",ref:e,icon:go}))});gt.displayName="SlashSingle";var Gt={exports:{}},ke={},it={exports:{}},vo=it.exports,wn;function vn(){return wn||(wn=1,function(t,e){(function(r,n){n(e)})(vo,function(r){function n(q){return function(ae,O,P,D,V,Y,W){return q(ae,O,W)}}function o(q){return function(ae,O,P,D){if(!ae||!O||typeof ae!="object"||typeof O!="object")return q(ae,O,P,D);var V=D.get(ae),Y=D.get(O);if(V&&Y)return V===O&&Y===ae;D.set(ae,O),D.set(O,ae);var W=q(ae,O,P,D);return D.delete(ae),D.delete(O),W}}function i(q,J){var ae={};for(var O in q)ae[O]=q[O];for(var O in J)ae[O]=J[O];return ae}function l(q){return q.constructor===Object||q.constructor==null}function y(q){return typeof q.then=="function"}function f(q,J){return q===J||q!==q&&J!==J}var S="[object Arguments]",m="[object Boolean]",T="[object Date]",_="[object RegExp]",I="[object Map]",b="[object Number]",w="[object Object]",h="[object Set]",a="[object String]",s=Object.prototype.toString;function d(q){var J=q.areArraysEqual,ae=q.areDatesEqual,O=q.areMapsEqual,P=q.areObjectsEqual,D=q.areRegExpsEqual,V=q.areSetsEqual,Y=q.createIsNestedEqual,W=Y(Z);function Z(K,ee,ue){if(K===ee)return!0;if(!K||!ee||typeof K!="object"||typeof ee!="object")return K!==K&&ee!==ee;if(l(K)&&l(ee))return P(K,ee,W,ue);var Pe=Array.isArray(K),ye=Array.isArray(ee);if(Pe||ye)return Pe===ye&&J(K,ee,W,ue);var he=s.call(K);return he!==s.call(ee)?!1:he===T?ae(K,ee,W,ue):he===_?D(K,ee,W,ue):he===I?O(K,ee,W,ue):he===h?V(K,ee,W,ue):he===w||he===S?y(K)||y(ee)?!1:P(K,ee,W,ue):he===m||he===b||he===a?f(K.valueOf(),ee.valueOf()):!1}return Z}function R(q,J,ae,O){var P=q.length;if(J.length!==P)return!1;for(;P-- >0;)if(!ae(q[P],J[P],P,P,q,J,O))return!1;return!0}var u=o(R);function g(q,J){return f(q.valueOf(),J.valueOf())}function p(q,J,ae,O){var P=q.size===J.size;if(!P)return!1;if(!q.size)return!0;var D={},V=0;return q.forEach(function(Y,W){if(P){var Z=!1,K=0;J.forEach(function(ee,ue){!Z&&!D[K]&&(Z=ae(W,ue,V,K,q,J,O)&&ae(Y,ee,W,ue,q,J,O))&&(D[K]=!0),K++}),V++,P=Z}}),P}var v=o(p),M="_owner",j=Object.prototype.hasOwnProperty;function U(q,J,ae,O){var P=Object.keys(q),D=P.length;if(Object.keys(J).length!==D)return!1;for(var V;D-- >0;){if(V=P[D],V===M){var Y=!!q.$$typeof,W=!!J.$$typeof;if((Y||W)&&Y!==W)return!1}if(!j.call(J,V)||!ae(q[V],J[V],V,V,q,J,O))return!1}return!0}var L=o(U);function E(q,J){return q.source===J.source&&q.flags===J.flags}function F(q,J,ae,O){var P=q.size===J.size;if(!P)return!1;if(!q.size)return!0;var D={};return q.forEach(function(V,Y){if(P){var W=!1,Z=0;J.forEach(function(K,ee){!W&&!D[Z]&&(W=ae(V,K,Y,ee,q,J,O))&&(D[Z]=!0),Z++}),P=W}}),P}var z=o(F),B=Object.freeze({areArraysEqual:R,areDatesEqual:g,areMapsEqual:p,areObjectsEqual:U,areRegExpsEqual:E,areSetsEqual:F,createIsNestedEqual:n}),G=Object.freeze({areArraysEqual:u,areDatesEqual:g,areMapsEqual:v,areObjectsEqual:L,areRegExpsEqual:E,areSetsEqual:z,createIsNestedEqual:n}),te=d(B);function Q(q,J){return te(q,J,void 0)}var H=d(i(B,{createIsNestedEqual:function(){return f}}));function A(q,J){return H(q,J,void 0)}var ne=d(G);function oe(q,J){return ne(q,J,new WeakMap)}var se=d(i(G,{createIsNestedEqual:function(){return f}}));function fe(q,J){return se(q,J,new WeakMap)}function ge(q){return d(i(B,q(B)))}function Se(q){var J=d(i(G,q(G)));return function(ae,O,P){return P===void 0&&(P=new WeakMap),J(ae,O,P)}}r.circularDeepEqual=oe,r.circularShallowEqual=fe,r.createCustomCircularEqual=Se,r.createCustomEqual=ge,r.deepEqual=Q,r.sameValueZeroEqual=f,r.shallowEqual=A,Object.defineProperty(r,"__esModule",{value:!0})})}(it,it.exports)),it.exports}var Ct={exports:{}},_n;function yn(){if(_n)return Ct.exports;_n=1;function t(r){var n,o,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var l=r.length;for(n=0;n<l;n++)r[n]&&(o=t(r[n]))&&(i&&(i+=" "),i+=o)}else for(o in r)r[o]&&(i&&(i+=" "),i+=o);return i}function e(){for(var r,n,o=0,i="",l=arguments.length;o<l;o++)(r=arguments[o])&&(n=t(r))&&(i&&(i+=" "),i+=n);return i}return Ct.exports=e,Ct.exports.clsx=e,Ct.exports}var ie={},Xt,xn;function yo(){return xn||(xn=1,Xt=function(e,r,n){return e===r?!0:e.className===r.className&&n(e.style,r.style)&&e.width===r.width&&e.autoSize===r.autoSize&&e.cols===r.cols&&e.draggableCancel===r.draggableCancel&&e.draggableHandle===r.draggableHandle&&n(e.verticalCompact,r.verticalCompact)&&n(e.compactType,r.compactType)&&n(e.layout,r.layout)&&n(e.margin,r.margin)&&n(e.containerPadding,r.containerPadding)&&e.rowHeight===r.rowHeight&&e.maxRows===r.maxRows&&e.isBounded===r.isBounded&&e.isDraggable===r.isDraggable&&e.isResizable===r.isResizable&&e.allowOverlap===r.allowOverlap&&e.preventCollision===r.preventCollision&&e.useCSSTransforms===r.useCSSTransforms&&e.transformScale===r.transformScale&&e.isDroppable===r.isDroppable&&n(e.resizeHandles,r.resizeHandles)&&n(e.resizeHandle,r.resizeHandle)&&e.onLayoutChange===r.onLayoutChange&&e.onDragStart===r.onDragStart&&e.onDrag===r.onDrag&&e.onDragStop===r.onDragStop&&e.onResizeStart===r.onResizeStart&&e.onResize===r.onResize&&e.onResizeStop===r.onResizeStop&&e.onDrop===r.onDrop&&n(e.droppingItem,r.droppingItem)&&n(e.innerRef,r.innerRef)}),Xt}var En;function qe(){if(En)return ie;En=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.bottom=n,ie.childrenEqual=f,ie.cloneLayout=o,ie.cloneLayoutItem=y,ie.collides=m,ie.compact=T,ie.compactItem=b,ie.compactType=q,ie.correctBounds=w,ie.fastPositionEqual=S,ie.fastRGLPropsEqual=void 0,ie.getAllCollisions=s,ie.getFirstCollision=a,ie.getLayoutItem=h,ie.getStatics=d,ie.modifyLayout=i,ie.moveElement=R,ie.moveElementAwayFromCollision=u,ie.noop=void 0,ie.perc=g,ie.resizeItemInDirection=H,ie.setTopLeft=ne,ie.setTransform=A,ie.sortLayoutItems=oe,ie.sortLayoutItemsByColRow=fe,ie.sortLayoutItemsByRowCol=se,ie.synchronizeLayoutWithChildren=ge,ie.validateLayout=Se,ie.withLayoutItem=l;var t=vn(),e=r(N);function r(O){return O&&O.__esModule?O:{default:O}}function n(O){let P=0,D;for(let V=0,Y=O.length;V<Y;V++)D=O[V].y+O[V].h,D>P&&(P=D);return P}function o(O){const P=Array(O.length);for(let D=0,V=O.length;D<V;D++)P[D]=y(O[D]);return P}function i(O,P){const D=Array(O.length);for(let V=0,Y=O.length;V<Y;V++)P.i===O[V].i?D[V]=P:D[V]=O[V];return D}function l(O,P,D){let V=h(O,P);return V?(V=D(y(V)),O=i(O,V),[O,V]):[O,null]}function y(O){return{w:O.w,h:O.h,x:O.x,y:O.y,i:O.i,minW:O.minW,maxW:O.maxW,minH:O.minH,maxH:O.maxH,moved:!!O.moved,static:!!O.static,isDraggable:O.isDraggable,isResizable:O.isResizable,resizeHandles:O.resizeHandles,isBounded:O.isBounded}}function f(O,P){return(0,t.deepEqual)(e.default.Children.map(O,D=>D==null?void 0:D.key),e.default.Children.map(P,D=>D==null?void 0:D.key))&&(0,t.deepEqual)(e.default.Children.map(O,D=>D==null?void 0:D.props["data-grid"]),e.default.Children.map(P,D=>D==null?void 0:D.props["data-grid"]))}ie.fastRGLPropsEqual=yo();function S(O,P){return O.left===P.left&&O.top===P.top&&O.width===P.width&&O.height===P.height}function m(O,P){return!(O.i===P.i||O.x+O.w<=P.x||O.x>=P.x+P.w||O.y+O.h<=P.y||O.y>=P.y+P.h)}function T(O,P,D,V){const Y=d(O),W=oe(O,P),Z=Array(O.length);for(let K=0,ee=W.length;K<ee;K++){let ue=y(W[K]);ue.static||(ue=b(Y,ue,P,D,W,V),Y.push(ue)),Z[O.indexOf(W[K])]=ue,ue.moved=!1}return Z}const _={x:"w",y:"h"};function I(O,P,D,V){const Y=_[V];P[V]+=1;const W=O.map(Z=>Z.i).indexOf(P.i);for(let Z=W+1;Z<O.length;Z++){const K=O[Z];if(!K.static){if(K.y>P.y+P.h)break;m(P,K)&&I(O,K,D+P[Y],V)}}P[V]=D}function b(O,P,D,V,Y,W){const Z=D==="vertical",K=D==="horizontal";if(Z)for(P.y=Math.min(n(O),P.y);P.y>0&&!a(O,P);)P.y--;else if(K)for(;P.x>0&&!a(O,P);)P.x--;let ee;for(;(ee=a(O,P))&&!(D===null&&W);)if(K?I(Y,P,ee.x+ee.w,"x"):I(Y,P,ee.y+ee.h,"y"),K&&P.x+P.w>V)for(P.x=V-P.w,P.y++;P.x>0&&!a(O,P);)P.x--;return P.y=Math.max(P.y,0),P.x=Math.max(P.x,0),P}function w(O,P){const D=d(O);for(let V=0,Y=O.length;V<Y;V++){const W=O[V];if(W.x+W.w>P.cols&&(W.x=P.cols-W.w),W.x<0&&(W.x=0,W.w=P.cols),!W.static)D.push(W);else for(;a(D,W);)W.y++}return O}function h(O,P){for(let D=0,V=O.length;D<V;D++)if(O[D].i===P)return O[D]}function a(O,P){for(let D=0,V=O.length;D<V;D++)if(m(O[D],P))return O[D]}function s(O,P){return O.filter(D=>m(D,P))}function d(O){return O.filter(P=>P.static)}function R(O,P,D,V,Y,W,Z,K,ee){if(P.static&&P.isDraggable!==!0||P.y===V&&P.x===D)return O;`${P.i}${String(D)}${String(V)}${P.x}${P.y}`;const ue=P.x,Pe=P.y;typeof D=="number"&&(P.x=D),typeof V=="number"&&(P.y=V),P.moved=!0;let ye=oe(O,Z);(Z==="vertical"&&typeof V=="number"?Pe>=V:Z==="horizontal"&&typeof D=="number"?ue>=D:!1)&&(ye=ye.reverse());const je=s(ye,P),yt=je.length>0;if(yt&&ee)return o(O);if(yt&&W)return`${P.i}`,P.x=ue,P.y=Pe,P.moved=!1,O;for(let kt=0,Vr=je.length;kt<Vr;kt++){const Me=je[kt];`${P.i}${P.x}${P.y}${Me.i}${Me.x}${Me.y}`,!Me.moved&&(Me.static?O=u(O,Me,P,Y,Z):O=u(O,P,Me,Y,Z))}return O}function u(O,P,D,V,Y,W){const Z=Y==="horizontal",K=Y==="vertical",ee=P.static;if(V){V=!1;const ye={x:Z?Math.max(P.x-D.w,0):D.x,y:K?Math.max(P.y-D.h,0):D.y,w:D.w,h:D.h,i:"-1"},he=a(O,ye),je=he&&he.y+he.h>P.y,yt=he&&P.x+P.w>he.x;if(he){if(je&&K)return R(O,D,void 0,P.y+1,V,ee,Y);if(je&&Y==null)return P.y=D.y,D.y=D.y+D.h,O;if(yt&&Z)return R(O,P,D.x,void 0,V,ee,Y)}else return`${D.i}${ye.x}${ye.y}`,R(O,D,Z?ye.x:void 0,K?ye.y:void 0,V,ee,Y)}const ue=Z?D.x+1:void 0,Pe=K?D.y+1:void 0;return ue==null&&Pe==null?O:R(O,D,Z?D.x+1:void 0,K?D.y+1:void 0,V,ee,Y)}function g(O){return O*100+"%"}const p=(O,P,D,V)=>O+D>V?P:D,v=(O,P,D)=>O<0?P:D,M=O=>Math.max(0,O),j=O=>Math.max(0,O),U=(O,P,D)=>{let{left:V,height:Y,width:W}=P;const Z=O.top-(Y-O.height);return{left:V,width:W,height:v(Z,O.height,Y),top:j(Z)}},L=(O,P,D)=>{let{top:V,left:Y,height:W,width:Z}=P;return{top:V,height:W,width:p(O.left,O.width,Z,D),left:M(Y)}},E=(O,P,D)=>{let{top:V,height:Y,width:W}=P;const Z=O.left-(W-O.width);return{height:Y,width:Z<0?O.width:p(O.left,O.width,W,D),top:j(V),left:M(Z)}},F=(O,P,D)=>{let{top:V,left:Y,height:W,width:Z}=P;return{width:Z,left:Y,height:v(V,O.height,W),top:j(V)}},Q={n:U,ne:function(){return U(arguments.length<=0?void 0:arguments[0],L(...arguments))},e:L,se:function(){return F(arguments.length<=0?void 0:arguments[0],L(...arguments))},s:F,sw:function(){return F(arguments.length<=0?void 0:arguments[0],E(...arguments))},w:E,nw:function(){return U(arguments.length<=0?void 0:arguments[0],E(...arguments))}};function H(O,P,D,V){const Y=Q[O];return Y?Y(P,{...P,...D},V):D}function A(O){let{top:P,left:D,width:V,height:Y}=O;const W=`translate(${D}px,${P}px)`;return{transform:W,WebkitTransform:W,MozTransform:W,msTransform:W,OTransform:W,width:`${V}px`,height:`${Y}px`,position:"absolute"}}function ne(O){let{top:P,left:D,width:V,height:Y}=O;return{top:`${P}px`,left:`${D}px`,width:`${V}px`,height:`${Y}px`,position:"absolute"}}function oe(O,P){return P==="horizontal"?fe(O):P==="vertical"?se(O):O}function se(O){return O.slice(0).sort(function(P,D){return P.y>D.y||P.y===D.y&&P.x>D.x?1:P.y===D.y&&P.x===D.x?0:-1})}function fe(O){return O.slice(0).sort(function(P,D){return P.x>D.x||P.x===D.x&&P.y>D.y?1:-1})}function ge(O,P,D,V,Y){O=O||[];const W=[];e.default.Children.forEach(P,K=>{if((K==null?void 0:K.key)==null)return;const ee=h(O,String(K.key)),ue=K.props["data-grid"];ee&&ue==null?W.push(y(ee)):ue?W.push(y({...ue,i:K.key})):W.push(y({w:1,h:1,x:0,y:n(W),i:String(K.key)}))});const Z=w(W,{cols:D});return Y?Z:T(Z,V,D)}function Se(O){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const D=["x","y","w","h"];if(!Array.isArray(O))throw new Error(P+" must be an array!");for(let V=0,Y=O.length;V<Y;V++){const W=O[V];for(let Z=0;Z<D.length;Z++)if(typeof W[D[Z]]!="number")throw new Error("ReactGridLayout: "+P+"["+V+"]."+D[Z]+" must be a number!")}}function q(O){const{verticalCompact:P,compactType:D}=O||{};return P===!1?null:D}function J(){}const ae=()=>{};return ie.noop=ae,ie}var Te={},On;function Cn(){if(On)return Te;On=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.calcGridColWidth=t,Te.calcGridItemPosition=r,Te.calcGridItemWHPx=e,Te.calcWH=o,Te.calcXY=n,Te.clamp=i;function t(l){const{margin:y,containerPadding:f,containerWidth:S,cols:m}=l;return(S-y[0]*(m-1)-f[0]*2)/m}function e(l,y,f){return Number.isFinite(l)?Math.round(y*l+Math.max(0,l-1)*f):l}function r(l,y,f,S,m,T){const{margin:_,containerPadding:I,rowHeight:b}=l,w=t(l),h={};return T&&T.resizing?(h.width=Math.round(T.resizing.width),h.height=Math.round(T.resizing.height)):(h.width=e(S,w,_[0]),h.height=e(m,b,_[1])),T&&T.dragging?(h.top=Math.round(T.dragging.top),h.left=Math.round(T.dragging.left)):T&&T.resizing&&typeof T.resizing.top=="number"&&typeof T.resizing.left=="number"?(h.top=Math.round(T.resizing.top),h.left=Math.round(T.resizing.left)):(h.top=Math.round((b+_[1])*f+I[1]),h.left=Math.round((w+_[0])*y+I[0])),h}function n(l,y,f,S,m){const{margin:T,cols:_,rowHeight:I,maxRows:b}=l,w=t(l);let h=Math.round((f-T[0])/(w+T[0])),a=Math.round((y-T[1])/(I+T[1]));return h=i(h,0,_-S),a=i(a,0,b-m),{x:h,y:a}}function o(l,y,f,S,m,T){const{margin:_,maxRows:I,cols:b,rowHeight:w}=l,h=t(l);let a=Math.round((y+_[0])/(h+_[0])),s=Math.round((f+_[1])/(w+_[1])),d=i(a,0,b-S),R=i(s,0,I-m);return["sw","w","nw"].indexOf(T)!==-1&&(d=i(a,0,b)),["nw","n","ne"].indexOf(T)!==-1&&(R=i(s,0,I)),{w:d,h:R}}function i(l,y,f){return Math.max(Math.min(l,f),y)}return Te}var Be={},Yt={exports:{}},Kt,Pn;function Co(){if(Pn)return Kt;Pn=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Kt=t,Kt}var Zt,Mn;function So(){if(Mn)return Zt;Mn=1;var t=Co();function e(){}function r(){}return r.resetWarningCache=e,Zt=function(){function n(l,y,f,S,m,T){if(T!==t){var _=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 _.name="Invariant Violation",_}}n.isRequired=n;function o(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:e};return i.PropTypes=i,i},Zt}var Fn;function Oe(){return Fn||(Fn=1,Yt.exports=So()()),Yt.exports}var Ge={exports:{}},Jt={};function yr(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(r=yr(t[e]))&&(n&&(n+=" "),n+=r);else for(e in t)t[e]&&(n&&(n+=" "),n+=e);return n}function Dn(){for(var t,e,r=0,n="";r<arguments.length;)(t=arguments[r++])&&(e=yr(t))&&(n&&(n+=" "),n+=e);return n}const bo=Object.freeze(Object.defineProperty({__proto__:null,clsx:Dn,default:Dn},Symbol.toStringTag,{value:"Module"})),Ro=hr(bo);var de={},xe={},Nn;function Wt(){if(Nn)return xe;Nn=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.dontSetMe=o,xe.findInArray=t,xe.int=n,xe.isFunction=e,xe.isNum=r;function t(i,l){for(let y=0,f=i.length;y<f;y++)if(l.apply(l,[i[y],y,i]))return i[y]}function e(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function r(i){return typeof i=="number"&&!isNaN(i)}function n(i){return parseInt(i,10)}function o(i,l,y){if(i[l])return new Error("Invalid prop ".concat(l," passed to ").concat(y," - do not set this, set it on the child."))}return xe}var Ee={},jn;function To(){if(jn)return Ee;jn=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.browserPrefixToKey=r,Ee.browserPrefixToStyle=n,Ee.default=void 0,Ee.getPrefix=e;const t=["Moz","Webkit","O","ms"];function e(){var i;let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const y=(i=window.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.style;if(!y||l in y)return"";for(let f=0;f<t.length;f++)if(r(l,t[f])in y)return t[f];return""}function r(i,l){return l?"".concat(l).concat(o(i)):i}function n(i,l){return l?"-".concat(l.toLowerCase(),"-").concat(i):i}function o(i){let l="",y=!0;for(let f=0;f<i.length;f++)y?(l+=i[f].toUpperCase(),y=!1):i[f]==="-"?y=!0:l+=i[f];return l}return Ee.default=e(),Ee}var Ln;function Sn(){if(Ln)return de;Ln=1,Object.defineProperty(de,"__esModule",{value:!0}),de.addClassName=u,de.addEvent=y,de.addUserSelectStyles=d,de.createCSSTransform=b,de.createSVGTransform=w,de.getTouch=a,de.getTouchIdentifier=s,de.getTranslation=h,de.innerHeight=T,de.innerWidth=_,de.matchesSelector=i,de.matchesSelectorAndParentsTo=l,de.offsetXYFromParent=I,de.outerHeight=S,de.outerWidth=m,de.removeClassName=g,de.removeEvent=f,de.removeUserSelectStyles=R;var t=Wt(),e=n(To());function r(p){if(typeof WeakMap!="function")return null;var v=new WeakMap,M=new WeakMap;return(r=function(j){return j?M:v})(p)}function n(p,v){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var M=r(v);if(M&&M.has(p))return M.get(p);var j={},U=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var L in p)if(L!=="default"&&Object.prototype.hasOwnProperty.call(p,L)){var E=U?Object.getOwnPropertyDescriptor(p,L):null;E&&(E.get||E.set)?Object.defineProperty(j,L,E):j[L]=p[L]}return j.default=p,M&&M.set(p,j),j}let o="";function i(p,v){return o||(o=(0,t.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(M){return(0,t.isFunction)(p[M])})),(0,t.isFunction)(p[o])?p[o](v):!1}function l(p,v,M){let j=p;do{if(i(j,v))return!0;if(j===M)return!1;j=j.parentNode}while(j);return!1}function y(p,v,M,j){if(!p)return;const U={capture:!0,...j};p.addEventListener?p.addEventListener(v,M,U):p.attachEvent?p.attachEvent("on"+v,M):p["on"+v]=M}function f(p,v,M,j){if(!p)return;const U={capture:!0,...j};p.removeEventListener?p.removeEventListener(v,M,U):p.detachEvent?p.detachEvent("on"+v,M):p["on"+v]=null}function S(p){let v=p.clientHeight;const M=p.ownerDocument.defaultView.getComputedStyle(p);return v+=(0,t.int)(M.borderTopWidth),v+=(0,t.int)(M.borderBottomWidth),v}function m(p){let v=p.clientWidth;const M=p.ownerDocument.defaultView.getComputedStyle(p);return v+=(0,t.int)(M.borderLeftWidth),v+=(0,t.int)(M.borderRightWidth),v}function T(p){let v=p.clientHeight;const M=p.ownerDocument.defaultView.getComputedStyle(p);return v-=(0,t.int)(M.paddingTop),v-=(0,t.int)(M.paddingBottom),v}function _(p){let v=p.clientWidth;const M=p.ownerDocument.defaultView.getComputedStyle(p);return v-=(0,t.int)(M.paddingLeft),v-=(0,t.int)(M.paddingRight),v}function I(p,v,M){const U=v===v.ownerDocument.body?{left:0,top:0}:v.getBoundingClientRect(),L=(p.clientX+v.scrollLeft-U.left)/M,E=(p.clientY+v.scrollTop-U.top)/M;return{x:L,y:E}}function b(p,v){const M=h(p,v,"px");return{[(0,e.browserPrefixToKey)("transform",e.default)]:M}}function w(p,v){return h(p,v,"")}function h(p,v,M){let{x:j,y:U}=p,L="translate(".concat(j).concat(M,",").concat(U).concat(M,")");if(v){const E="".concat(typeof v.x=="string"?v.x:v.x+M),F="".concat(typeof v.y=="string"?v.y:v.y+M);L="translate(".concat(E,", ").concat(F,")")+L}return L}function a(p,v){return p.targetTouches&&(0,t.findInArray)(p.targetTouches,M=>v===M.identifier)||p.changedTouches&&(0,t.findInArray)(p.changedTouches,M=>v===M.identifier)}function s(p){if(p.targetTouches&&p.targetTouches[0])return p.targetTouches[0].identifier;if(p.changedTouches&&p.changedTouches[0])return p.changedTouches[0].identifier}function d(p){if(!p)return;let v=p.getElementById("react-draggable-style-el");v||(v=p.createElement("style"),v.type="text/css",v.id="react-draggable-style-el",v.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
- `,v.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
- `,p.getElementsByTagName("head")[0].appendChild(v)),p.body&&u(p.body,"react-draggable-transparent-selection")}function R(p){if(p)try{if(p.body&&g(p.body,"react-draggable-transparent-selection"),p.selection)p.selection.empty();else{const v=(p.defaultView||window).getSelection();v&&v.type!=="Caret"&&v.removeAllRanges()}}catch{}}function u(p,v){p.classList?p.classList.add(v):p.className.match(new RegExp("(?:^|\\s)".concat(v,"(?!\\S)")))||(p.className+=" ".concat(v))}function g(p,v){p.classList?p.classList.remove(v):p.className=p.className.replace(new RegExp("(?:^|\\s)".concat(v,"(?!\\S)"),"g"),"")}return de}var Re={},Un;function Cr(){if(Un)return Re;Un=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.canDragX=o,Re.canDragY=i,Re.createCoreData=y,Re.createDraggableData=f,Re.getBoundPosition=r,Re.getControlPosition=l,Re.snapToGrid=n;var t=Wt(),e=Sn();function r(T,_,I){if(!T.props.bounds)return[_,I];let{bounds:b}=T.props;b=typeof b=="string"?b:S(b);const w=m(T);if(typeof b=="string"){const{ownerDocument:h}=w,a=h.defaultView;let s;if(b==="parent"?s=w.parentNode:s=h.querySelector(b),!(s instanceof a.HTMLElement))throw new Error('Bounds selector "'+b+'" could not find an element.');const d=s,R=a.getComputedStyle(w),u=a.getComputedStyle(d);b={left:-w.offsetLeft+(0,t.int)(u.paddingLeft)+(0,t.int)(R.marginLeft),top:-w.offsetTop+(0,t.int)(u.paddingTop)+(0,t.int)(R.marginTop),right:(0,e.innerWidth)(d)-(0,e.outerWidth)(w)-w.offsetLeft+(0,t.int)(u.paddingRight)-(0,t.int)(R.marginRight),bottom:(0,e.innerHeight)(d)-(0,e.outerHeight)(w)-w.offsetTop+(0,t.int)(u.paddingBottom)-(0,t.int)(R.marginBottom)}}return(0,t.isNum)(b.right)&&(_=Math.min(_,b.right)),(0,t.isNum)(b.bottom)&&(I=Math.min(I,b.bottom)),(0,t.isNum)(b.left)&&(_=Math.max(_,b.left)),(0,t.isNum)(b.top)&&(I=Math.max(I,b.top)),[_,I]}function n(T,_,I){const b=Math.round(_/T[0])*T[0],w=Math.round(I/T[1])*T[1];return[b,w]}function o(T){return T.props.axis==="both"||T.props.axis==="x"}function i(T){return T.props.axis==="both"||T.props.axis==="y"}function l(T,_,I){const b=typeof _=="number"?(0,e.getTouch)(T,_):null;if(typeof _=="number"&&!b)return null;const w=m(I),h=I.props.offsetParent||w.offsetParent||w.ownerDocument.body;return(0,e.offsetXYFromParent)(b||T,h,I.props.scale)}function y(T,_,I){const b=!(0,t.isNum)(T.lastX),w=m(T);return b?{node:w,deltaX:0,deltaY:0,lastX:_,lastY:I,x:_,y:I}:{node:w,deltaX:_-T.lastX,deltaY:I-T.lastY,lastX:T.lastX,lastY:T.lastY,x:_,y:I}}function f(T,_){const I=T.props.scale;return{node:_.node,x:T.state.x+_.deltaX/I,y:T.state.y+_.deltaY/I,deltaX:_.deltaX/I,deltaY:_.deltaY/I,lastX:T.state.x,lastY:T.state.y}}function S(T){return{left:T.left,top:T.top,right:T.right,bottom:T.bottom}}function m(T){const _=T.findDOMNode();if(!_)throw new Error("<DraggableCore>: Unmounted during event!");return _}return Re}var Xe={},St={},Vn;function Sr(){if(Vn)return St;Vn=1,Object.defineProperty(St,"__esModule",{value:!0}),St.default=t;function t(){}return St}var $n;function Io(){if($n)return Xe;$n=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.default=void 0;var t=S(N),e=y(Oe()),r=y(fr),n=Sn(),o=Cr(),i=Wt(),l=y(Sr());function y(h){return h&&h.__esModule?h:{default:h}}function f(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(f=function(d){return d?s:a})(h)}function S(h,a){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var s=f(a);if(s&&s.has(h))return s.get(h);var d={},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in h)if(u!=="default"&&Object.prototype.hasOwnProperty.call(h,u)){var g=R?Object.getOwnPropertyDescriptor(h,u):null;g&&(g.get||g.set)?Object.defineProperty(d,u,g):d[u]=h[u]}return d.default=h,s&&s.set(h,d),d}function m(h,a,s){return a=T(a),a in h?Object.defineProperty(h,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):h[a]=s,h}function T(h){var a=_(h,"string");return typeof a=="symbol"?a:String(a)}function _(h,a){if(typeof h!="object"||h===null)return h;var s=h[Symbol.toPrimitive];if(s!==void 0){var d=s.call(h,a||"default");if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const I={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let b=I.mouse,w=class extends t.Component{constructor(){super(...arguments),m(this,"dragging",!1),m(this,"lastX",NaN),m(this,"lastY",NaN),m(this,"touchIdentifier",null),m(this,"mounted",!1),m(this,"handleDragStart",a=>{if(this.props.onMouseDown(a),!this.props.allowAnyClick&&typeof a.button=="number"&&a.button!==0)return!1;const s=this.findDOMNode();if(!s||!s.ownerDocument||!s.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:d}=s;if(this.props.disabled||!(a.target instanceof d.defaultView.Node)||this.props.handle&&!(0,n.matchesSelectorAndParentsTo)(a.target,this.props.handle,s)||this.props.cancel&&(0,n.matchesSelectorAndParentsTo)(a.target,this.props.cancel,s))return;a.type==="touchstart"&&a.preventDefault();const R=(0,n.getTouchIdentifier)(a);this.touchIdentifier=R;const u=(0,o.getControlPosition)(a,R,this);if(u==null)return;const{x:g,y:p}=u,v=(0,o.createCoreData)(this,g,p);(0,l.default)("DraggableCore: handleDragStart: %j",v),(0,l.default)("calling",this.props.onStart),!(this.props.onStart(a,v)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(d),this.dragging=!0,this.lastX=g,this.lastY=p,(0,n.addEvent)(d,b.move,this.handleDrag),(0,n.addEvent)(d,b.stop,this.handleDragStop))}),m(this,"handleDrag",a=>{const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:d,y:R}=s;if(Array.isArray(this.props.grid)){let p=d-this.lastX,v=R-this.lastY;if([p,v]=(0,o.snapToGrid)(this.props.grid,p,v),!p&&!v)return;d=this.lastX+p,R=this.lastY+v}const u=(0,o.createCoreData)(this,d,R);if((0,l.default)("DraggableCore: handleDrag: %j",u),this.props.onDrag(a,u)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const v=document.createEvent("MouseEvents");v.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(v)}return}this.lastX=d,this.lastY=R}),m(this,"handleDragStop",a=>{if(!this.dragging)return;const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:d,y:R}=s;if(Array.isArray(this.props.grid)){let v=d-this.lastX||0,M=R-this.lastY||0;[v,M]=(0,o.snapToGrid)(this.props.grid,v,M),d=this.lastX+v,R=this.lastY+M}const u=(0,o.createCoreData)(this,d,R);if(this.props.onStop(a,u)===!1||this.mounted===!1)return!1;const p=this.findDOMNode();p&&this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(p.ownerDocument),(0,l.default)("DraggableCore: handleDragStop: %j",u),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,p&&((0,l.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(p.ownerDocument,b.move,this.handleDrag),(0,n.removeEvent)(p.ownerDocument,b.stop,this.handleDragStop))}),m(this,"onMouseDown",a=>(b=I.mouse,this.handleDragStart(a))),m(this,"onMouseUp",a=>(b=I.mouse,this.handleDragStop(a))),m(this,"onTouchStart",a=>(b=I.touch,this.handleDragStart(a))),m(this,"onTouchEnd",a=>(b=I.touch,this.handleDragStop(a)))}componentDidMount(){this.mounted=!0;const a=this.findDOMNode();a&&(0,n.addEvent)(a,I.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const a=this.findDOMNode();if(a){const{ownerDocument:s}=a;(0,n.removeEvent)(s,I.mouse.move,this.handleDrag),(0,n.removeEvent)(s,I.touch.move,this.handleDrag),(0,n.removeEvent)(s,I.mouse.stop,this.handleDragStop),(0,n.removeEvent)(s,I.touch.stop,this.handleDragStop),(0,n.removeEvent)(a,I.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(s)}}findDOMNode(){var a,s;return(a=this.props)!==null&&a!==void 0&&a.nodeRef?(s=this.props)===null||s===void 0||(s=s.nodeRef)===null||s===void 0?void 0:s.current:r.default.findDOMNode(this)}render(){return t.cloneElement(t.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Xe.default=w,m(w,"displayName","DraggableCore"),m(w,"propTypes",{allowAnyClick:e.default.bool,children:e.default.node.isRequired,disabled:e.default.bool,enableUserSelectHack:e.default.bool,offsetParent:function(h,a){if(h[a]&&h[a].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:e.default.arrayOf(e.default.number),handle:e.default.string,cancel:e.default.string,nodeRef:e.default.object,onStart:e.default.func,onDrag:e.default.func,onStop:e.default.func,onMouseDown:e.default.func,scale:e.default.number,className:i.dontSetMe,style:i.dontSetMe,transform:i.dontSetMe}),m(w,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Xe}var zn;function wo(){return zn||(zn=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return f.default}}),t.default=void 0;var e=_(N),r=m(Oe()),n=m(fr),o=m(Ro),i=Sn(),l=Cr(),y=Wt(),f=m(Io()),S=m(Sr());function m(s){return s&&s.__esModule?s:{default:s}}function T(s){if(typeof WeakMap!="function")return null;var d=new WeakMap,R=new WeakMap;return(T=function(u){return u?R:d})(s)}function _(s,d){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var R=T(d);if(R&&R.has(s))return R.get(s);var u={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in s)if(p!=="default"&&Object.prototype.hasOwnProperty.call(s,p)){var v=g?Object.getOwnPropertyDescriptor(s,p):null;v&&(v.get||v.set)?Object.defineProperty(u,p,v):u[p]=s[p]}return u.default=s,R&&R.set(s,u),u}function I(){return I=Object.assign?Object.assign.bind():function(s){for(var d=1;d<arguments.length;d++){var R=arguments[d];for(var u in R)Object.prototype.hasOwnProperty.call(R,u)&&(s[u]=R[u])}return s},I.apply(this,arguments)}function b(s,d,R){return d=w(d),d in s?Object.defineProperty(s,d,{value:R,enumerable:!0,configurable:!0,writable:!0}):s[d]=R,s}function w(s){var d=h(s,"string");return typeof d=="symbol"?d:String(d)}function h(s,d){if(typeof s!="object"||s===null)return s;var R=s[Symbol.toPrimitive];if(R!==void 0){var u=R.call(s,d||"default");if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(s)}class a extends e.Component{static getDerivedStateFromProps(d,R){let{position:u}=d,{prevPropsPosition:g}=R;return u&&(!g||u.x!==g.x||u.y!==g.y)?((0,S.default)("Draggable: getDerivedStateFromProps %j",{position:u,prevPropsPosition:g}),{x:u.x,y:u.y,prevPropsPosition:{...u}}):null}constructor(d){super(d),b(this,"onDragStart",(R,u)=>{if((0,S.default)("Draggable: onDragStart: %j",u),this.props.onStart(R,(0,l.createDraggableData)(this,u))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),b(this,"onDrag",(R,u)=>{if(!this.state.dragging)return!1;(0,S.default)("Draggable: onDrag: %j",u);const g=(0,l.createDraggableData)(this,u),p={x:g.x,y:g.y,slackX:0,slackY:0};if(this.props.bounds){const{x:M,y:j}=p;p.x+=this.state.slackX,p.y+=this.state.slackY;const[U,L]=(0,l.getBoundPosition)(this,p.x,p.y);p.x=U,p.y=L,p.slackX=this.state.slackX+(M-p.x),p.slackY=this.state.slackY+(j-p.y),g.x=p.x,g.y=p.y,g.deltaX=p.x-this.state.x,g.deltaY=p.y-this.state.y}if(this.props.onDrag(R,g)===!1)return!1;this.setState(p)}),b(this,"onDragStop",(R,u)=>{if(!this.state.dragging||this.props.onStop(R,(0,l.createDraggableData)(this,u))===!1)return!1;(0,S.default)("Draggable: onDragStop: %j",u);const p={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:M,y:j}=this.props.position;p.x=M,p.y=j}this.setState(p)}),this.state={dragging:!1,dragged:!1,x:d.position?d.position.x:d.defaultPosition.x,y:d.position?d.position.y:d.defaultPosition.y,prevPropsPosition:{...d.position},slackX:0,slackY:0,isElementSVG:!1},d.position&&!(d.onDrag||d.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 d,R;return(d=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&d!==void 0?d:n.default.findDOMNode(this)}render(){const{axis:d,bounds:R,children:u,defaultPosition:g,defaultClassName:p,defaultClassNameDragging:v,defaultClassNameDragged:M,position:j,positionOffset:U,scale:L,...E}=this.props;let F={},z=null;const G=!!!j||this.state.dragging,te=j||g,Q={x:(0,l.canDragX)(this)&&G?this.state.x:te.x,y:(0,l.canDragY)(this)&&G?this.state.y:te.y};this.state.isElementSVG?z=(0,i.createSVGTransform)(Q,U):F=(0,i.createCSSTransform)(Q,U);const H=(0,o.default)(u.props.className||"",p,{[v]:this.state.dragging,[M]:this.state.dragged});return e.createElement(f.default,I({},E,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(u),{className:H,style:{...u.props.style,...F},transform:z}))}}t.default=a,b(a,"displayName","Draggable"),b(a,"propTypes",{...f.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:y.dontSetMe,style:y.dontSetMe,transform:y.dontSetMe}),b(a,"defaultProps",{...f.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(Jt)),Jt}var An;function bn(){if(An)return Ge.exports;An=1;const{default:t,DraggableCore:e}=wo();return Ge.exports=t,Ge.exports.default=t,Ge.exports.DraggableCore=e,Ge.exports}var Ye={exports:{}},Ke={},bt={},qn;function _o(){if(qn)return bt;qn=1,bt.__esModule=!0,bt.cloneElement=y;var t=e(N);function e(f){return f&&f.__esModule?f:{default:f}}function r(f,S){var m=Object.keys(f);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(f);S&&(T=T.filter(function(_){return Object.getOwnPropertyDescriptor(f,_).enumerable})),m.push.apply(m,T)}return m}function n(f){for(var S=1;S<arguments.length;S++){var m=arguments[S]!=null?arguments[S]:{};S%2?r(Object(m),!0).forEach(function(T){o(f,T,m[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(m)):r(Object(m)).forEach(function(T){Object.defineProperty(f,T,Object.getOwnPropertyDescriptor(m,T))})}return f}function o(f,S,m){return S=i(S),S in f?Object.defineProperty(f,S,{value:m,enumerable:!0,configurable:!0,writable:!0}):f[S]=m,f}function i(f){var S=l(f,"string");return typeof S=="symbol"?S:String(S)}function l(f,S){if(typeof f!="object"||f===null)return f;var m=f[Symbol.toPrimitive];if(m!==void 0){var T=m.call(f,S||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(f)}function y(f,S){return S.style&&f.props.style&&(S.style=n(n({},f.props.style),S.style)),S.className&&f.props.className&&(S.className=f.props.className+" "+S.className),t.default.cloneElement(f,S)}return bt}var Ze={},Wn;function br(){if(Wn)return Ze;Wn=1,Ze.__esModule=!0,Ze.resizableProps=void 0;var t=e(Oe());bn();function e(n){return n&&n.__esModule?n:{default:n}}var r={axis:t.default.oneOf(["both","x","y","none"]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:t.default.node,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){for(var o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];var y=i[0];if(y.axis==="both"||y.axis==="y"){var f;return(f=t.default.number).isRequired.apply(f,i)}return t.default.number.apply(t.default,i)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:t.default.number,width:function(){for(var o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];var y=i[0];if(y.axis==="both"||y.axis==="x"){var f;return(f=t.default.number).isRequired.apply(f,i)}return t.default.number.apply(t.default,i)}};return Ze.resizableProps=r,Ze}var Hn;function Rr(){if(Hn)return Ke;Hn=1,Ke.__esModule=!0,Ke.default=void 0;var t=l(N),e=bn(),r=_o(),n=br(),o=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function i(a){if(typeof WeakMap!="function")return null;var s=new WeakMap,d=new WeakMap;return(i=function(u){return u?d:s})(a)}function l(a,s){if(a&&a.__esModule)return a;if(a===null||typeof a!="object"&&typeof a!="function")return{default:a};var d=i(s);if(d&&d.has(a))return d.get(a);var R={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in a)if(g!=="default"&&Object.prototype.hasOwnProperty.call(a,g)){var p=u?Object.getOwnPropertyDescriptor(a,g):null;p&&(p.get||p.set)?Object.defineProperty(R,g,p):R[g]=a[g]}return R.default=a,d&&d.set(a,R),R}function y(){return y=Object.assign?Object.assign.bind():function(a){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var R in d)Object.prototype.hasOwnProperty.call(d,R)&&(a[R]=d[R])}return a},y.apply(this,arguments)}function f(a,s){if(a==null)return{};var d={},R=Object.keys(a),u,g;for(g=0;g<R.length;g++)u=R[g],!(s.indexOf(u)>=0)&&(d[u]=a[u]);return d}function S(a,s){var d=Object.keys(a);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(a);s&&(R=R.filter(function(u){return Object.getOwnPropertyDescriptor(a,u).enumerable})),d.push.apply(d,R)}return d}function m(a){for(var s=1;s<arguments.length;s++){var d=arguments[s]!=null?arguments[s]:{};s%2?S(Object(d),!0).forEach(function(R){T(a,R,d[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(d)):S(Object(d)).forEach(function(R){Object.defineProperty(a,R,Object.getOwnPropertyDescriptor(d,R))})}return a}function T(a,s,d){return s=_(s),s in a?Object.defineProperty(a,s,{value:d,enumerable:!0,configurable:!0,writable:!0}):a[s]=d,a}function _(a){var s=I(a,"string");return typeof s=="symbol"?s:String(s)}function I(a,s){if(typeof a!="object"||a===null)return a;var d=a[Symbol.toPrimitive];if(d!==void 0){var R=d.call(a,s||"default");if(typeof R!="object")return R;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}function b(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,w(a,s)}function w(a,s){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(R,u){return R.__proto__=u,R},w(a,s)}var h=function(a){b(s,a);function s(){for(var R,u=arguments.length,g=new Array(u),p=0;p<u;p++)g[p]=arguments[p];return R=a.call.apply(a,[this].concat(g))||this,R.handleRefs={},R.lastHandleRect=null,R.slack=null,R}var d=s.prototype;return d.componentWillUnmount=function(){this.resetData()},d.resetData=function(){this.lastHandleRect=this.slack=null},d.runConstraints=function(u,g){var p=this.props,v=p.minConstraints,M=p.maxConstraints,j=p.lockAspectRatio;if(!v&&!M&&!j)return[u,g];if(j){var U=this.props.width/this.props.height,L=u-this.props.width,E=g-this.props.height;Math.abs(L)>Math.abs(E*U)?g=u/U:u=g*U}var F=u,z=g,B=this.slack||[0,0],G=B[0],te=B[1];return u+=G,g+=te,v&&(u=Math.max(v[0],u),g=Math.max(v[1],g)),M&&(u=Math.min(M[0],u),g=Math.min(M[1],g)),this.slack=[G+(F-u),te+(z-g)],[u,g]},d.resizeHandler=function(u,g){var p=this;return function(v,M){var j=M.node,U=M.deltaX,L=M.deltaY;u==="onResizeStart"&&p.resetData();var E=(p.props.axis==="both"||p.props.axis==="x")&&g!=="n"&&g!=="s",F=(p.props.axis==="both"||p.props.axis==="y")&&g!=="e"&&g!=="w";if(!(!E&&!F)){var z=g[0],B=g[g.length-1],G=j.getBoundingClientRect();if(p.lastHandleRect!=null){if(B==="w"){var te=G.left-p.lastHandleRect.left;U+=te}if(z==="n"){var Q=G.top-p.lastHandleRect.top;L+=Q}}p.lastHandleRect=G,B==="w"&&(U=-U),z==="n"&&(L=-L);var H=p.props.width+(E?U/p.props.transformScale:0),A=p.props.height+(F?L/p.props.transformScale:0),ne=p.runConstraints(H,A);H=ne[0],A=ne[1];var oe=H!==p.props.width||A!==p.props.height,se=typeof p.props[u]=="function"?p.props[u]:null,fe=u==="onResize"&&!oe;se&&!fe&&(v.persist==null||v.persist(),se(v,{node:j,size:{width:H,height:A},handle:g})),u==="onResizeStop"&&p.resetData()}}},d.renderResizeHandle=function(u,g){var p=this.props.handle;if(!p)return t.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+u,ref:g});if(typeof p=="function")return p(u,g);var v=typeof p.type=="string",M=m({ref:g},v?{}:{handleAxis:u});return t.cloneElement(p,M)},d.render=function(){var u=this,g=this.props,p=g.children,v=g.className,M=g.draggableOpts;g.width,g.height,g.handle,g.handleSize,g.lockAspectRatio,g.axis,g.minConstraints,g.maxConstraints,g.onResize,g.onResizeStop,g.onResizeStart;var j=g.resizeHandles;g.transformScale;var U=f(g,o);return(0,r.cloneElement)(p,m(m({},U),{},{className:(v?v+" ":"")+"react-resizable",children:[].concat(p.props.children,j.map(function(L){var E,F=(E=u.handleRefs[L])!=null?E:u.handleRefs[L]=t.createRef();return t.createElement(e.DraggableCore,y({},M,{nodeRef:F,key:"resizableHandle-"+L,onStop:u.resizeHandler("onResizeStop",L),onStart:u.resizeHandler("onResizeStart",L),onDrag:u.resizeHandler("onResize",L)}),u.renderResizeHandle(L,F))}))}))},s}(t.Component);return Ke.default=h,h.propTypes=n.resizableProps,h.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},Ke}var Je={},kn;function xo(){if(kn)return Je;kn=1,Je.__esModule=!0,Je.default=void 0;var t=y(N),e=i(Oe()),r=i(Rr()),n=br(),o=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function i(s){return s&&s.__esModule?s:{default:s}}function l(s){if(typeof WeakMap!="function")return null;var d=new WeakMap,R=new WeakMap;return(l=function(g){return g?R:d})(s)}function y(s,d){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var R=l(d);if(R&&R.has(s))return R.get(s);var u={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in s)if(p!=="default"&&Object.prototype.hasOwnProperty.call(s,p)){var v=g?Object.getOwnPropertyDescriptor(s,p):null;v&&(v.get||v.set)?Object.defineProperty(u,p,v):u[p]=s[p]}return u.default=s,R&&R.set(s,u),u}function f(){return f=Object.assign?Object.assign.bind():function(s){for(var d=1;d<arguments.length;d++){var R=arguments[d];for(var u in R)Object.prototype.hasOwnProperty.call(R,u)&&(s[u]=R[u])}return s},f.apply(this,arguments)}function S(s,d){var R=Object.keys(s);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(s);d&&(u=u.filter(function(g){return Object.getOwnPropertyDescriptor(s,g).enumerable})),R.push.apply(R,u)}return R}function m(s){for(var d=1;d<arguments.length;d++){var R=arguments[d]!=null?arguments[d]:{};d%2?S(Object(R),!0).forEach(function(u){T(s,u,R[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(R)):S(Object(R)).forEach(function(u){Object.defineProperty(s,u,Object.getOwnPropertyDescriptor(R,u))})}return s}function T(s,d,R){return d=_(d),d in s?Object.defineProperty(s,d,{value:R,enumerable:!0,configurable:!0,writable:!0}):s[d]=R,s}function _(s){var d=I(s,"string");return typeof d=="symbol"?d:String(d)}function I(s,d){if(typeof s!="object"||s===null)return s;var R=s[Symbol.toPrimitive];if(R!==void 0){var u=R.call(s,d||"default");if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(s)}function b(s,d){if(s==null)return{};var R={},u=Object.keys(s),g,p;for(p=0;p<u.length;p++)g=u[p],!(d.indexOf(g)>=0)&&(R[g]=s[g]);return R}function w(s,d){s.prototype=Object.create(d.prototype),s.prototype.constructor=s,h(s,d)}function h(s,d){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(u,g){return u.__proto__=g,u},h(s,d)}var a=function(s){w(d,s);function d(){for(var u,g=arguments.length,p=new Array(g),v=0;v<g;v++)p[v]=arguments[v];return u=s.call.apply(s,[this].concat(p))||this,u.state={width:u.props.width,height:u.props.height,propsWidth:u.props.width,propsHeight:u.props.height},u.onResize=function(M,j){var U=j.size;u.props.onResize?(M.persist==null||M.persist(),u.setState(U,function(){return u.props.onResize&&u.props.onResize(M,j)})):u.setState(U)},u}d.getDerivedStateFromProps=function(g,p){return p.propsWidth!==g.width||p.propsHeight!==g.height?{width:g.width,height:g.height,propsWidth:g.width,propsHeight:g.height}:null};var R=d.prototype;return R.render=function(){var g=this.props,p=g.handle,v=g.handleSize;g.onResize;var M=g.onResizeStart,j=g.onResizeStop,U=g.draggableOpts,L=g.minConstraints,E=g.maxConstraints,F=g.lockAspectRatio,z=g.axis;g.width,g.height;var B=g.resizeHandles,G=g.style,te=g.transformScale,Q=b(g,o);return t.createElement(r.default,{axis:z,draggableOpts:U,handle:p,handleSize:v,height:this.state.height,lockAspectRatio:F,maxConstraints:E,minConstraints:L,onResizeStart:M,onResize:this.onResize,onResizeStop:j,resizeHandles:B,transformScale:te,width:this.state.width},t.createElement("div",f({},Q,{style:m(m({},G),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},d}(t.Component);return Je.default=a,a.propTypes=m(m({},n.resizableProps),{},{children:e.default.element}),Je}var Bn;function Eo(){return Bn||(Bn=1,Ye.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Ye.exports.Resizable=Rr().default,Ye.exports.ResizableBox=xo().default),Ye.exports}var Ie={},Gn;function Tr(){if(Gn)return Ie;Gn=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.resizeHandleType=Ie.resizeHandleAxesType=Ie.default=void 0;var t=r(Oe()),e=r(N);function r(i){return i&&i.__esModule?i:{default:i}}const n=Ie.resizeHandleAxesType=t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),o=Ie.resizeHandleType=t.default.oneOfType([t.default.node,t.default.func]);return Ie.default={className:t.default.string,style:t.default.object,width:t.default.number,autoSize:t.default.bool,cols:t.default.number,draggableCancel:t.default.string,draggableHandle:t.default.string,verticalCompact:function(i){i.verticalCompact},compactType:t.default.oneOf(["vertical","horizontal"]),layout:function(i){var l=i.layout;l!==void 0&&qe().validateLayout(l,"layout")},margin:t.default.arrayOf(t.default.number),containerPadding:t.default.arrayOf(t.default.number),rowHeight:t.default.number,maxRows:t.default.number,isBounded:t.default.bool,isDraggable:t.default.bool,isResizable:t.default.bool,allowOverlap:t.default.bool,preventCollision:t.default.bool,useCSSTransforms:t.default.bool,transformScale:t.default.number,isDroppable:t.default.bool,resizeHandles:n,resizeHandle:o,onLayoutChange:t.default.func,onDragStart:t.default.func,onDrag:t.default.func,onDragStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,onResizeStop:t.default.func,onDrop:t.default.func,droppingItem:t.default.shape({i:t.default.string.isRequired,w:t.default.number.isRequired,h:t.default.number.isRequired}),children:function(i,l){const y=i[l],f={};e.default.Children.forEach(y,function(S){if((S==null?void 0:S.key)!=null){if(f[S.key])throw new Error('Duplicate child key "'+S.key+'" found! This will cause problems in ReactGridLayout.');f[S.key]=!0}})},innerRef:t.default.any},Ie}var Xn;function Oo(){if(Xn)return Be;Xn=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.default=void 0;var t=f(N),e=f(Oe()),r=bn(),n=Eo(),o=qe(),i=Cn(),l=Tr(),y=f(yn());function f(I){return I&&I.__esModule?I:{default:I}}function S(I,b,w){return b=m(b),b in I?Object.defineProperty(I,b,{value:w,enumerable:!0,configurable:!0,writable:!0}):I[b]=w,I}function m(I){var b=T(I,"string");return typeof b=="symbol"?b:String(b)}function T(I,b){if(typeof I!="object"||I===null)return I;var w=I[Symbol.toPrimitive];if(w!==void 0){var h=w.call(I,b||"default");if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(I)}let _=class extends t.default.Component{constructor(){super(...arguments),S(this,"state",{resizing:null,dragging:null,className:""}),S(this,"elementRef",t.default.createRef()),S(this,"onDragStart",(b,w)=>{let{node:h}=w;const{onDragStart:a,transformScale:s}=this.props;if(!a)return;const d={top:0,left:0},{offsetParent:R}=h;if(!R)return;const u=R.getBoundingClientRect(),g=h.getBoundingClientRect(),p=g.left/s,v=u.left/s,M=g.top/s,j=u.top/s;d.left=p-v+R.scrollLeft,d.top=M-j+R.scrollTop,this.setState({dragging:d});const{x:U,y:L}=(0,i.calcXY)(this.getPositionParams(),d.top,d.left,this.props.w,this.props.h);return a.call(this,this.props.i,U,L,{e:b,node:h,newPosition:d})}),S(this,"onDrag",(b,w)=>{let{node:h,deltaX:a,deltaY:s}=w;const{onDrag:d}=this.props;if(!d)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let R=this.state.dragging.top+s,u=this.state.dragging.left+a;const{isBounded:g,i:p,w:v,h:M,containerWidth:j}=this.props,U=this.getPositionParams();if(g){const{offsetParent:B}=h;if(B){const{margin:G,rowHeight:te,containerPadding:Q}=this.props,H=B.clientHeight-(0,i.calcGridItemWHPx)(M,te,G[1]);R=(0,i.clamp)(R-Q[1],0,H);const A=(0,i.calcGridColWidth)(U),ne=j-(0,i.calcGridItemWHPx)(v,A,G[0]);u=(0,i.clamp)(u-Q[0],0,ne)}}const L={top:R,left:u};this.setState({dragging:L});const{containerPadding:E}=this.props,{x:F,y:z}=(0,i.calcXY)(U,R-E[1],u-E[0],v,M);return d.call(this,p,F,z,{e:b,node:h,newPosition:L})}),S(this,"onDragStop",(b,w)=>{let{node:h}=w;const{onDragStop:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:s,h:d,i:R,containerPadding:u}=this.props,{left:g,top:p}=this.state.dragging,v={top:p,left:g};this.setState({dragging:null});const{x:M,y:j}=(0,i.calcXY)(this.getPositionParams(),p-u[1],g-u[0],s,d);return a.call(this,R,M,j,{e:b,node:h,newPosition:v})}),S(this,"onResizeStop",(b,w,h)=>this.onResizeHandler(b,w,h,"onResizeStop")),S(this,"onResizeStart",(b,w,h)=>this.onResizeHandler(b,w,h,"onResizeStart")),S(this,"onResize",(b,w,h)=>this.onResizeHandler(b,w,h,"onResize"))}shouldComponentUpdate(b,w){if(this.props.children!==b.children||this.props.droppingPosition!==b.droppingPosition)return!0;const h=(0,i.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),a=(0,i.calcGridItemPosition)(this.getPositionParams(b),b.x,b.y,b.w,b.h,w);return!(0,o.fastPositionEqual)(h,a)||this.props.useCSSTransforms!==b.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(b){this.moveDroppingItem(b)}moveDroppingItem(b){const{droppingPosition:w}=this.props;if(!w)return;const h=this.elementRef.current;if(!h)return;const a=b.droppingPosition||{left:0,top:0},{dragging:s}=this.state,d=s&&w.left!==a.left||w.top!==a.top;if(!s)this.onDragStart(w.e,{node:h,deltaX:w.left,deltaY:w.top});else if(d){const R=w.left-s.left,u=w.top-s.top;this.onDrag(w.e,{node:h,deltaX:R,deltaY:u})}}getPositionParams(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:b.cols,containerPadding:b.containerPadding,containerWidth:b.containerWidth,margin:b.margin,maxRows:b.maxRows,rowHeight:b.rowHeight}}createStyle(b){const{usePercentages:w,containerWidth:h,useCSSTransforms:a}=this.props;let s;return a?s=(0,o.setTransform)(b):(s=(0,o.setTopLeft)(b),w&&(s.left=(0,o.perc)(b.left/h),s.width=(0,o.perc)(b.width/h))),s}mixinDraggable(b,w){return t.default.createElement(r.DraggableCore,{disabled:!w,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},b)}curryResizeHandler(b,w){return(h,a)=>w(h,a,b)}mixinResizable(b,w,h){const{cols:a,minW:s,minH:d,maxW:R,maxH:u,transformScale:g,resizeHandles:p,resizeHandle:v}=this.props,M=this.getPositionParams(),j=(0,i.calcGridItemPosition)(M,0,0,a,0).width,U=(0,i.calcGridItemPosition)(M,0,0,s,d),L=(0,i.calcGridItemPosition)(M,0,0,R,u),E=[U.width,U.height],F=[Math.min(L.width,j),Math.min(L.height,1/0)];return t.default.createElement(n.Resizable,{draggableOpts:{disabled:!h},className:h?void 0:"react-resizable-hide",width:w.width,height:w.height,minConstraints:E,maxConstraints:F,onResizeStop:this.curryResizeHandler(w,this.onResizeStop),onResizeStart:this.curryResizeHandler(w,this.onResizeStart),onResize:this.curryResizeHandler(w,this.onResize),transformScale:g,resizeHandles:p,handle:v},b)}onResizeHandler(b,w,h,a){let{node:s,size:d,handle:R}=w;const u=this.props[a];if(!u)return;const{x:g,y:p,i:v,maxH:M,minH:j,containerWidth:U}=this.props,{minW:L,maxW:E}=this.props;let F=d;s&&(F=(0,o.resizeItemInDirection)(R,h,d,U),this.setState({resizing:a==="onResizeStop"?null:F}));let{w:z,h:B}=(0,i.calcWH)(this.getPositionParams(),F.width,F.height,g,p,R);z=(0,i.clamp)(z,Math.max(L,1),E),B=(0,i.clamp)(B,j,M),u.call(this,v,z,B,{e:b,node:s,size:F,handle:R})}render(){const{x:b,y:w,w:h,h:a,isDraggable:s,isResizable:d,droppingPosition:R,useCSSTransforms:u}=this.props,g=(0,i.calcGridItemPosition)(this.getPositionParams(),b,w,h,a,this.state),p=t.default.Children.only(this.props.children);let v=t.default.cloneElement(p,{ref:this.elementRef,className:(0,y.default)("react-grid-item",p.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":s,"react-draggable-dragging":!!this.state.dragging,dropping:!!R,cssTransforms:u}),style:{...this.props.style,...p.props.style,...this.createStyle(g)}});return v=this.mixinResizable(v,g,d),v=this.mixinDraggable(v,s),v}};return Be.default=_,S(_,"propTypes",{children:e.default.element,cols:e.default.number.isRequired,containerWidth:e.default.number.isRequired,rowHeight:e.default.number.isRequired,margin:e.default.array.isRequired,maxRows:e.default.number.isRequired,containerPadding:e.default.array.isRequired,x:e.default.number.isRequired,y:e.default.number.isRequired,w:e.default.number.isRequired,h:e.default.number.isRequired,minW:function(I,b){const w=I[b];if(typeof w!="number")return new Error("minWidth not Number");if(w>I.w||w>I.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(I,b){const w=I[b];if(typeof w!="number")return new Error("maxWidth not Number");if(w<I.w||w<I.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(I,b){const w=I[b];if(typeof w!="number")return new Error("minHeight not Number");if(w>I.h||w>I.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(I,b){const w=I[b];if(typeof w!="number")return new Error("maxHeight not Number");if(w<I.h||w<I.minH)return new Error("maxHeight smaller than item height/minHeight")},i:e.default.string.isRequired,resizeHandles:l.resizeHandleAxesType,resizeHandle:l.resizeHandleType,onDragStop:e.default.func,onDragStart:e.default.func,onDrag:e.default.func,onResizeStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,isDraggable:e.default.bool.isRequired,isResizable:e.default.bool.isRequired,isBounded:e.default.bool.isRequired,static:e.default.bool,useCSSTransforms:e.default.bool.isRequired,transformScale:e.default.number,className:e.default.string,handle:e.default.string,cancel:e.default.string,droppingPosition:e.default.shape({e:e.default.object.isRequired,left:e.default.number.isRequired,top:e.default.number.isRequired})}),S(_,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Be}var Yn;function Ir(){if(Yn)return ke;Yn=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.default=void 0;var t=S(N),e=vn(),r=y(yn()),n=qe(),o=Cn(),i=y(Oo()),l=y(Tr());function y(h){return h&&h.__esModule?h:{default:h}}function f(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(f=function(d){return d?s:a})(h)}function S(h,a){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var s=f(a);if(s&&s.has(h))return s.get(h);var d={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in h)if(u!=="default"&&Object.prototype.hasOwnProperty.call(h,u)){var g=R?Object.getOwnPropertyDescriptor(h,u):null;g&&(g.get||g.set)?Object.defineProperty(d,u,g):d[u]=h[u]}return d.default=h,s&&s.set(h,d),d}function m(h,a,s){return a=T(a),a in h?Object.defineProperty(h,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):h[a]=s,h}function T(h){var a=_(h,"string");return typeof a=="symbol"?a:String(a)}function _(h,a){if(typeof h!="object"||h===null)return h;var s=h[Symbol.toPrimitive];if(s!==void 0){var d=s.call(h,a||"default");if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const I="react-grid-layout";let b=!1;try{b=/firefox/i.test(navigator.userAgent)}catch{}let w=class extends t.Component{constructor(){super(...arguments),m(this,"state",{activeDrag:null,layout:(0,n.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,n.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),m(this,"dragEnterCounter",0),m(this,"onDragStart",(a,s,d,R)=>{let{e:u,node:g}=R;const{layout:p}=this.state,v=(0,n.getLayoutItem)(p,a);if(!v)return;const M={w:v.w,h:v.h,x:v.x,y:v.y,placeholder:!0,i:a};return this.setState({oldDragItem:(0,n.cloneLayoutItem)(v),oldLayout:p,activeDrag:M}),this.props.onDragStart(p,v,v,null,u,g)}),m(this,"onDrag",(a,s,d,R)=>{let{e:u,node:g}=R;const{oldDragItem:p}=this.state;let{layout:v}=this.state;const{cols:M,allowOverlap:j,preventCollision:U}=this.props,L=(0,n.getLayoutItem)(v,a);if(!L)return;const E={w:L.w,h:L.h,x:L.x,y:L.y,placeholder:!0,i:a};v=(0,n.moveElement)(v,L,s,d,!0,U,(0,n.compactType)(this.props),M,j),this.props.onDrag(v,p,L,E,u,g),this.setState({layout:j?v:(0,n.compact)(v,(0,n.compactType)(this.props),M),activeDrag:E})}),m(this,"onDragStop",(a,s,d,R)=>{let{e:u,node:g}=R;if(!this.state.activeDrag)return;const{oldDragItem:p}=this.state;let{layout:v}=this.state;const{cols:M,preventCollision:j,allowOverlap:U}=this.props,L=(0,n.getLayoutItem)(v,a);if(!L)return;v=(0,n.moveElement)(v,L,s,d,!0,j,(0,n.compactType)(this.props),M,U);const F=U?v:(0,n.compact)(v,(0,n.compactType)(this.props),M);this.props.onDragStop(F,p,L,null,u,g);const{oldLayout:z}=this.state;this.setState({activeDrag:null,layout:F,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(F,z)}),m(this,"onResizeStart",(a,s,d,R)=>{let{e:u,node:g}=R;const{layout:p}=this.state,v=(0,n.getLayoutItem)(p,a);v&&(this.setState({oldResizeItem:(0,n.cloneLayoutItem)(v),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(p,v,v,null,u,g))}),m(this,"onResize",(a,s,d,R)=>{let{e:u,node:g,size:p,handle:v}=R;const{oldResizeItem:M}=this.state,{layout:j}=this.state,{cols:U,preventCollision:L,allowOverlap:E}=this.props;let F=!1,z,B,G;const[te,Q]=(0,n.withLayoutItem)(j,a,A=>{let ne;return B=A.x,G=A.y,["sw","w","nw","n","ne"].indexOf(v)!==-1&&(["sw","nw","w"].indexOf(v)!==-1&&(B=A.x+(A.w-s),s=A.x!==B&&B<0?A.w:s,B=B<0?0:B),["ne","n","nw"].indexOf(v)!==-1&&(G=A.y+(A.h-d),d=A.y!==G&&G<0?A.h:d,G=G<0?0:G),F=!0),L&&!E&&(ne=(0,n.getAllCollisions)(j,{...A,w:s,h:d,x:B,y:G}).filter(se=>se.i!==A.i).length>0,ne&&(G=A.y,d=A.h,B=A.x,s=A.w,F=!1)),A.w=s,A.h=d,A});if(!Q)return;z=te,F&&(z=(0,n.moveElement)(te,Q,B,G,!0,this.props.preventCollision,(0,n.compactType)(this.props),U,E));const H={w:Q.w,h:Q.h,x:Q.x,y:Q.y,static:!0,i:a};this.props.onResize(z,M,Q,H,u,g),this.setState({layout:E?z:(0,n.compact)(z,(0,n.compactType)(this.props),U),activeDrag:H})}),m(this,"onResizeStop",(a,s,d,R)=>{let{e:u,node:g}=R;const{layout:p,oldResizeItem:v}=this.state,{cols:M,allowOverlap:j}=this.props,U=(0,n.getLayoutItem)(p,a),L=j?p:(0,n.compact)(p,(0,n.compactType)(this.props),M);this.props.onResizeStop(L,v,U,null,u,g);const{oldLayout:E}=this.state;this.setState({activeDrag:null,layout:L,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(L,E)}),m(this,"onDragOver",a=>{var te;if(a.preventDefault(),a.stopPropagation(),b&&!((te=a.nativeEvent.target)!=null&&te.classList.contains(I)))return!1;const{droppingItem:s,onDropDragOver:d,margin:R,cols:u,rowHeight:g,maxRows:p,width:v,containerPadding:M,transformScale:j}=this.props,U=d==null?void 0:d(a);if(U===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const L={...s,...U},{layout:E}=this.state,F=a.currentTarget.getBoundingClientRect(),z=a.clientX-F.left,B=a.clientY-F.top,G={left:z/j,top:B/j,e:a};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:Q,top:H}=this.state.droppingPosition;(Q!=z||H!=B)&&this.setState({droppingPosition:G})}}else{const Q={cols:u,margin:R,maxRows:p,rowHeight:g,containerWidth:v,containerPadding:M||R},H=(0,o.calcXY)(Q,B,z,L.w,L.h);this.setState({droppingDOMNode:t.createElement("div",{key:L.i}),droppingPosition:G,layout:[...E,{...L,x:H.x,y:H.y,static:!1,isDraggable:!0}]})}}),m(this,"removeDroppingPlaceholder",()=>{const{droppingItem:a,cols:s}=this.props,{layout:d}=this.state,R=(0,n.compact)(d.filter(u=>u.i!==a.i),(0,n.compactType)(this.props),s,this.props.allowOverlap);this.setState({layout:R,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),m(this,"onDragLeave",a=>{a.preventDefault(),a.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),m(this,"onDragEnter",a=>{a.preventDefault(),a.stopPropagation(),this.dragEnterCounter++}),m(this,"onDrop",a=>{a.preventDefault(),a.stopPropagation();const{droppingItem:s}=this.props,{layout:d}=this.state,R=d.find(u=>u.i===s.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(d,R,a)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(a,s){let d;return s.activeDrag?null:(!(0,e.deepEqual)(a.layout,s.propsLayout)||a.compactType!==s.compactType?d=a.layout:(0,n.childrenEqual)(a.children,s.children)||(d=s.layout),d?{layout:(0,n.synchronizeLayoutWithChildren)(d,a.children,a.cols,(0,n.compactType)(a),a.allowOverlap),compactType:a.compactType,children:a.children,propsLayout:a.layout}:null)}shouldComponentUpdate(a,s){return this.props.children!==a.children||!(0,n.fastRGLPropsEqual)(this.props,a,e.deepEqual)||this.state.activeDrag!==s.activeDrag||this.state.mounted!==s.mounted||this.state.droppingPosition!==s.droppingPosition}componentDidUpdate(a,s){if(!this.state.activeDrag){const d=this.state.layout,R=s.layout;this.onLayoutMaybeChanged(d,R)}}containerHeight(){if(!this.props.autoSize)return;const a=(0,n.bottom)(this.state.layout),s=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return a*this.props.rowHeight+(a-1)*this.props.margin[1]+s*2+"px"}onLayoutMaybeChanged(a,s){s||(s=this.state.layout),(0,e.deepEqual)(s,a)||this.props.onLayoutChange(a)}placeholder(){const{activeDrag:a}=this.state;if(!a)return null;const{width:s,cols:d,margin:R,containerPadding:u,rowHeight:g,maxRows:p,useCSSTransforms:v,transformScale:M}=this.props;return t.createElement(i.default,{w:a.w,h:a.h,x:a.x,y:a.y,i:a.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:s,cols:d,margin:R,containerPadding:u||R,maxRows:p,rowHeight:g,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:v,transformScale:M},t.createElement("div",null))}processGridItem(a,s){if(!a||!a.key)return;const d=(0,n.getLayoutItem)(this.state.layout,String(a.key));if(!d)return null;const{width:R,cols:u,margin:g,containerPadding:p,rowHeight:v,maxRows:M,isDraggable:j,isResizable:U,isBounded:L,useCSSTransforms:E,transformScale:F,draggableCancel:z,draggableHandle:B,resizeHandles:G,resizeHandle:te}=this.props,{mounted:Q,droppingPosition:H}=this.state,A=typeof d.isDraggable=="boolean"?d.isDraggable:!d.static&&j,ne=typeof d.isResizable=="boolean"?d.isResizable:!d.static&&U,oe=d.resizeHandles||G,se=A&&L&&d.isBounded!==!1;return t.createElement(i.default,{containerWidth:R,cols:u,margin:g,containerPadding:p||g,maxRows:M,rowHeight:v,cancel:z,handle:B,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:A,isResizable:ne,isBounded:se,useCSSTransforms:E&&Q,usePercentages:!Q,transformScale:F,w:d.w,h:d.h,x:d.x,y:d.y,i:d.i,minH:d.minH,minW:d.minW,maxH:d.maxH,maxW:d.maxW,static:d.static,droppingPosition:s?H:void 0,resizeHandles:oe,resizeHandle:te},a)}render(){const{className:a,style:s,isDroppable:d,innerRef:R}=this.props,u=(0,r.default)(I,a),g={height:this.containerHeight(),...s};return t.createElement("div",{ref:R,className:u,style:g,onDrop:d?this.onDrop:n.noop,onDragLeave:d?this.onDragLeave:n.noop,onDragEnter:d?this.onDragEnter:n.noop,onDragOver:d?this.onDragOver:n.noop},t.Children.map(this.props.children,p=>this.processGridItem(p)),d&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return ke.default=w,m(w,"displayName","ReactGridLayout"),m(w,"propTypes",l.default),m(w,"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:n.noop,onDragStart:n.noop,onDrag:n.noop,onDragStop:n.noop,onResizeStart:n.noop,onResize:n.noop,onResizeStop:n.noop,onDrop:n.noop,onDropDragOver:n.noop}),ke}var Qe={},Fe={},Kn;function wr(){if(Kn)return Fe;Kn=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.findOrGenerateResponsiveLayout=n,Fe.getBreakpointFromWidth=e,Fe.getColsFromBreakpoint=r,Fe.sortBreakpoints=o;var t=qe();function e(i,l){const y=o(i);let f=y[0];for(let S=1,m=y.length;S<m;S++){const T=y[S];l>i[T]&&(f=T)}return f}function r(i,l){if(!l[i])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+i+" is missing!");return l[i]}function n(i,l,y,f,S,m){if(i[y])return(0,t.cloneLayout)(i[y]);let T=i[f];const _=o(l),I=_.slice(_.indexOf(y));for(let b=0,w=I.length;b<w;b++){const h=I[b];if(i[h]){T=i[h];break}}return T=(0,t.cloneLayout)(T||[]),(0,t.compact)((0,t.correctBounds)(T,{cols:S}),m,S)}function o(i){return Object.keys(i).sort(function(y,f){return i[y]-i[f]})}return Fe}var Zn;function Po(){if(Zn)return Qe;Zn=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=void 0;var t=f(N),e=l(Oe()),r=vn(),n=qe(),o=wr(),i=l(Ir());function l(h){return h&&h.__esModule?h:{default:h}}function y(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(y=function(d){return d?s:a})(h)}function f(h,a){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var s=y(a);if(s&&s.has(h))return s.get(h);var d={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in h)if(u!=="default"&&Object.prototype.hasOwnProperty.call(h,u)){var g=R?Object.getOwnPropertyDescriptor(h,u):null;g&&(g.get||g.set)?Object.defineProperty(d,u,g):d[u]=h[u]}return d.default=h,s&&s.set(h,d),d}function S(){return S=Object.assign?Object.assign.bind():function(h){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var d in s)Object.prototype.hasOwnProperty.call(s,d)&&(h[d]=s[d])}return h},S.apply(this,arguments)}function m(h,a,s){return a=T(a),a in h?Object.defineProperty(h,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):h[a]=s,h}function T(h){var a=_(h,"string");return typeof a=="symbol"?a:String(a)}function _(h,a){if(typeof h!="object"||h===null)return h;var s=h[Symbol.toPrimitive];if(s!==void 0){var d=s.call(h,a||"default");if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const I=h=>Object.prototype.toString.call(h);function b(h,a){return h==null?null:Array.isArray(h)?h:h[a]}let w=class extends t.Component{constructor(){super(...arguments),m(this,"state",this.generateInitialState()),m(this,"onLayoutChange",a=>{this.props.onLayoutChange(a,{...this.props.layouts,[this.state.breakpoint]:a})})}generateInitialState(){const{width:a,breakpoints:s,layouts:d,cols:R}=this.props,u=(0,o.getBreakpointFromWidth)(s,a),g=(0,o.getColsFromBreakpoint)(u,R),p=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,o.findOrGenerateResponsiveLayout)(d,s,u,u,g,p),breakpoint:u,cols:g}}static getDerivedStateFromProps(a,s){if(!(0,r.deepEqual)(a.layouts,s.layouts)){const{breakpoint:d,cols:R}=s;return{layout:(0,o.findOrGenerateResponsiveLayout)(a.layouts,a.breakpoints,d,d,R,a.compactType),layouts:a.layouts}}return null}componentDidUpdate(a){(this.props.width!=a.width||this.props.breakpoint!==a.breakpoint||!(0,r.deepEqual)(this.props.breakpoints,a.breakpoints)||!(0,r.deepEqual)(this.props.cols,a.cols))&&this.onWidthChange(a)}onWidthChange(a){const{breakpoints:s,cols:d,layouts:R,compactType:u}=this.props,g=this.props.breakpoint||(0,o.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),p=this.state.breakpoint,v=(0,o.getColsFromBreakpoint)(g,d),M={...R};if(p!==g||a.breakpoints!==s||a.cols!==d){p in M||(M[p]=(0,n.cloneLayout)(this.state.layout));let L=(0,o.findOrGenerateResponsiveLayout)(M,s,g,p,v,u);L=(0,n.synchronizeLayoutWithChildren)(L,this.props.children,v,u,this.props.allowOverlap),M[g]=L,this.props.onLayoutChange(L,M),this.props.onBreakpointChange(g,v),this.setState({breakpoint:g,layout:L,cols:v})}const j=b(this.props.margin,g),U=b(this.props.containerPadding,g);this.props.onWidthChange(this.props.width,j,v,U)}render(){const{breakpoint:a,breakpoints:s,cols:d,layouts:R,margin:u,containerPadding:g,onBreakpointChange:p,onLayoutChange:v,onWidthChange:M,...j}=this.props;return t.createElement(i.default,S({},j,{margin:b(u,this.state.breakpoint),containerPadding:b(g,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return Qe.default=w,m(w,"propTypes",{breakpoint:e.default.string,breakpoints:e.default.object,allowOverlap:e.default.bool,cols:e.default.object,margin:e.default.oneOfType([e.default.array,e.default.object]),containerPadding:e.default.oneOfType([e.default.array,e.default.object]),layouts(h,a){if(I(h[a])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+I(h[a]));Object.keys(h[a]).forEach(s=>{if(!(s in h.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,n.validateLayout)(h.layouts[s],"layouts."+s)})},width:e.default.number.isRequired,onBreakpointChange:e.default.func,onLayoutChange:e.default.func,onWidthChange:e.default.func}),m(w,"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:n.noop,onLayoutChange:n.noop,onWidthChange:n.noop}),Qe}var Rt={},_r=function(){if(typeof Map<"u")return Map;function t(e,r){var n=-1;return e.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(r){var n=t(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},e.prototype.set=function(r,n){var o=t(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},e.prototype.delete=function(r){var n=this.__entries__,o=t(n,r);~o&&n.splice(o,1)},e.prototype.has=function(r){return!!~t(this.__entries__,r)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o<i.length;o++){var l=i[o];r.call(n,l[1],l[0])}},e}()}(),sn=typeof window<"u"&&typeof document<"u"&&window.document===document,Mt=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")()}(),Mo=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Mt):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),Fo=2;function Do(t,e){var r=!1,n=!1,o=0;function i(){r&&(r=!1,t()),n&&y()}function l(){Mo(i)}function y(){var f=Date.now();if(r){if(f-o<Fo)return;n=!0}else r=!0,n=!1,setTimeout(l,e);o=f}return y}var No=20,jo=["top","right","bottom","left","width","height","size","weight"],Lo=typeof MutationObserver<"u",Uo=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Do(this.refresh.bind(this),No)}return t.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},t.prototype.removeObserver=function(e){var r=this.observers_,n=r.indexOf(e);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},t.prototype.updateObservers_=function(){var e=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return e.forEach(function(r){return r.broadcastActive()}),e.length>0},t.prototype.connect_=function(){!sn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Lo?(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)},t.prototype.disconnect_=function(){!sn||!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)},t.prototype.onTransitionEnd_=function(e){var r=e.propertyName,n=r===void 0?"":r,o=jo.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),xr=function(t,e){for(var r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},$e=function(t){var e=t&&t.ownerDocument&&t.ownerDocument.defaultView;return e||Mt},Er=Ht(0,0,0,0);function Ft(t){return parseFloat(t)||0}function Jn(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return e.reduce(function(n,o){var i=t["border-"+o+"-width"];return n+Ft(i)},0)}function Vo(t){for(var e=["top","right","bottom","left"],r={},n=0,o=e;n<o.length;n++){var i=o[n],l=t["padding-"+i];r[i]=Ft(l)}return r}function $o(t){var e=t.getBBox();return Ht(0,0,e.width,e.height)}function zo(t){var e=t.clientWidth,r=t.clientHeight;if(!e&&!r)return Er;var n=$e(t).getComputedStyle(t),o=Vo(n),i=o.left+o.right,l=o.top+o.bottom,y=Ft(n.width),f=Ft(n.height);if(n.boxSizing==="border-box"&&(Math.round(y+i)!==e&&(y-=Jn(n,"left","right")+i),Math.round(f+l)!==r&&(f-=Jn(n,"top","bottom")+l)),!qo(t)){var S=Math.round(y+i)-e,m=Math.round(f+l)-r;Math.abs(S)!==1&&(y-=S),Math.abs(m)!==1&&(f-=m)}return Ht(o.left,o.top,y,f)}var Ao=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof $e(t).SVGGraphicsElement}:function(t){return t instanceof $e(t).SVGElement&&typeof t.getBBox=="function"}}();function qo(t){return t===$e(t).document.documentElement}function Wo(t){return sn?Ao(t)?$o(t):zo(t):Er}function Ho(t){var e=t.x,r=t.y,n=t.width,o=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,l=Object.create(i.prototype);return xr(l,{x:e,y:r,width:n,height:o,top:r,right:e+n,bottom:o+r,left:e}),l}function Ht(t,e,r,n){return{x:t,y:e,width:r,height:n}}var ko=function(){function t(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Ht(0,0,0,0),this.target=e}return t.prototype.isActive=function(){var e=Wo(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},t}(),Bo=function(){function t(e,r){var n=Ho(r);xr(this,{target:e,contentRect:n})}return t}(),Go=function(){function t(e,r,n){if(this.activeObservations_=[],this.observations_=new _r,typeof e!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=r,this.callbackCtx_=n}return t.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof $e(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(e)||(r.set(e,new ko(e)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof $e(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(e)&&(r.delete(e),r.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&e.activeObservations_.push(r)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new Bo(n.target,n.broadcastRect())});this.callback_.call(e,r,e),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),Or=typeof WeakMap<"u"?new WeakMap:new _r,Pr=function(){function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Uo.getInstance(),n=new Go(e,r,this);Or.set(this,n)}return t}();["observe","unobserve","disconnect"].forEach(function(t){Pr.prototype[t]=function(){var e;return(e=Or.get(this))[t].apply(e,arguments)}});var Xo=function(){return typeof Mt.ResizeObserver<"u"?Mt.ResizeObserver:Pr}();const Yo=Object.freeze(Object.defineProperty({__proto__:null,default:Xo},Symbol.toStringTag,{value:"Module"})),Ko=hr(Yo);var Qn;function Zo(){if(Qn)return Rt;Qn=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.default=_;var t=l(N),e=o(Oe()),r=o(Ko),n=o(yn());function o(I){return I&&I.__esModule?I:{default:I}}function i(I){if(typeof WeakMap!="function")return null;var b=new WeakMap,w=new WeakMap;return(i=function(h){return h?w:b})(I)}function l(I,b){if(I&&I.__esModule)return I;if(I===null||typeof I!="object"&&typeof I!="function")return{default:I};var w=i(b);if(w&&w.has(I))return w.get(I);var h={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in I)if(s!=="default"&&Object.prototype.hasOwnProperty.call(I,s)){var d=a?Object.getOwnPropertyDescriptor(I,s):null;d&&(d.get||d.set)?Object.defineProperty(h,s,d):h[s]=I[s]}return h.default=I,w&&w.set(I,h),h}function y(){return y=Object.assign?Object.assign.bind():function(I){for(var b=1;b<arguments.length;b++){var w=arguments[b];for(var h in w)Object.prototype.hasOwnProperty.call(w,h)&&(I[h]=w[h])}return I},y.apply(this,arguments)}function f(I,b,w){return b=S(b),b in I?Object.defineProperty(I,b,{value:w,enumerable:!0,configurable:!0,writable:!0}):I[b]=w,I}function S(I){var b=m(I,"string");return typeof b=="symbol"?b:String(b)}function m(I,b){if(typeof I!="object"||I===null)return I;var w=I[Symbol.toPrimitive];if(w!==void 0){var h=w.call(I,b||"default");if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(I)}const T="react-grid-layout";function _(I){var b;return b=class extends t.Component{constructor(){super(...arguments),f(this,"state",{width:1280}),f(this,"elementRef",t.createRef()),f(this,"mounted",!1),f(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new r.default(a=>{if(this.elementRef.current instanceof HTMLElement){const d=a[0].contentRect.width;this.setState({width:d})}});const h=this.elementRef.current;h instanceof HTMLElement&&this.resizeObserver.observe(h)}componentWillUnmount(){this.mounted=!1;const h=this.elementRef.current;h instanceof HTMLElement&&this.resizeObserver.unobserve(h),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:h,...a}=this.props;return h&&!this.mounted?t.createElement("div",{className:(0,n.default)(this.props.className,T),style:this.props.style,ref:this.elementRef}):t.createElement(I,y({innerRef:this.elementRef},a,this.state))}},f(b,"defaultProps",{measureBeforeMount:!1}),f(b,"propTypes",{measureBeforeMount:e.default.bool}),b}return Rt}var er;function Jo(){return er||(er=1,function(t){t.exports=Ir().default,t.exports.utils=qe(),t.exports.calculateUtils=Cn(),t.exports.Responsive=Po().default,t.exports.Responsive.utils=wr(),t.exports.WidthProvider=Zo().default}(Gt)),Gt.exports}var Qo=Jo();const ei=Ar(Qo);var ti=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,ri=(t,e,r,n)=>{for(var o=n>1?void 0:n?ni(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&ti(e,r,o),o},oi=(t,e)=>(r,n)=>e(r,n,t);let ze=class extends C.Disposable{constructor(e){super();_e(this,"_initLocal",()=>{});_e(this,"_findReplaceIndex",e=>{const r=/\{([^}]+)?\}/g,n=[];let o=r.exec(e);for(;o;)n.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=r.exec(e);return n});this._localeService=e,this._initLocal()}tWithReactNode(e,...r){const n=this._localeService.getLocales(),o=e.split("."),i=n&&this._localeService.resolveKeyPath(n,o);if(typeof i=="string"){const l=[];return this._findReplaceIndex(i).forEach((y,f,S)=>{const m=S[f-1]||{startIndex:0,endIndex:-1};if(m.endIndex+1<y.startIndex){const T=i.slice(m.endIndex+1,y.startIndex);T&&l.push(T)}if(r[y.key]&&l.push(r[y.key]),f===S.length-1){const T=i.slice(y.endIndex+1);T&&l.push(T)}}),l}return[]}};ze=ri([oi(0,C.Inject(C.LocaleService))],ze);const ii="univer-cf-preview",Tt={cfPreview:ii},We=t=>{var o,i;const e=t.rule;if(!e)return null;const r=N.useMemo(()=>{if(e.type===c.CFRuleType.colorScale){const l=e.config.map((S,m)=>({color:new C.ColorKit(S.color),value:m})),y=l.length-1;return new Array(5).fill("").map((S,m,T)=>m*y/(T.length-1)).map(S=>c.getColorScaleFromValue(l,S))}return null},[e]),n=N.useMemo(()=>{if(e.type===c.CFRuleType.iconSet)return e.config.map(l=>{const y=c.iconMap[l.iconType];return y&&y[Number(l.iconId)]})},[e]);switch(e.type){case c.CFRuleType.dataBar:{const{isGradient:l}=e.config,y={width:"50%",height:"100%"},f=l?`linear-gradient(to right, ${e.config.positiveColor||c.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,S=l?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||c.defaultDataBarNativeColor})`:e.config.nativeColor;return x.jsxs("div",{className:Tt.cfPreview,children:[x.jsx("div",{style:{...y,background:S,border:`1px solid ${e.config.nativeColor||c.defaultDataBarNativeColor}`}}),x.jsx("div",{style:{...y,background:f,border:`1px solid ${e.config.positiveColor||c.defaultDataBarPositiveColor}`}})]})}case c.CFRuleType.colorScale:return r&&x.jsx("div",{className:Tt.cfPreview,children:r.map((l,y)=>x.jsx("div",{style:{width:`${100/r.length}%`,height:"100%",background:l}},y))});case c.CFRuleType.iconSet:return n&&x.jsx("div",{className:Tt.cfPreview,children:n.map((l,y)=>l?x.jsx("img",{style:{height:"100%"},src:l},y):x.jsx(gt,{},y))});case c.CFRuleType.highlightCell:{const{ul:l,st:y,it:f,bl:S,bg:m,cl:T}=e.style,_=(l==null?void 0:l.s)===C.BooleanNumber.TRUE,I=(y==null?void 0:y.s)===C.BooleanNumber.TRUE,b=f===C.BooleanNumber.TRUE,w=S===C.BooleanNumber.TRUE,h=(o=m==null?void 0:m.rgb)!=null?o:c.DEFAULT_BG_COLOR,a=(i=T==null?void 0:T.rgb)!=null?i:c.DEFAULT_FONT_COLOR,s={fontWeight:w?"bold":void 0,fontStyle:b?"italic":void 0,textDecoration:`${_?"underline":""} ${I?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:h,color:a};return x.jsx("div",{style:s,className:Tt.cfPreview,children:"123"})}}return null},ai="univer-cf-rule-list",si="univer-rule-selector",li="univer-select",ui="univer-select-selector",ci="univer-select-selection-item",di="univer-select-selection-search-input",fi="univer-btn-list",pi="univer-gap",hi="univer-icon",mi="univer-disabled",gi="univer-rule-item",vi="univer-rule-describe",yi="univer-rule-type",Ci="univer-rule-range",Si="univer-active",bi="univer-draggableHandle",Ri="univer-delete-item",Ti="univer-grid-layout-wrap",Ii="univer-react-grid-item",pe={cfRuleList:ai,ruleSelector:si,select:li,selectSelector:ui,selectSelectionItem:ci,selectSelectionSearchInput:di,btnList:fi,gap:pi,icon:hi,disabled:mi,ruleItem:gi,ruleDescribe:vi,ruleType:yi,ruleRange:Ci,active:Si,draggableHandle:bi,deleteItem:Ri,gridLayoutWrap:Ti,reactGridItem:Ii},wi=(t,e)=>{const r=t.rule;switch(r.type){case c.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case c.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case c.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case c.CFRuleType.highlightCell:switch(r.subType){case c.CFSubRuleType.average:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,e.t("sheet.cf.subRuleType.average"))}case c.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case c.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case c.CFSubRuleType.number:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,...Array.isArray(r.value)?r.value.map(o=>String(o)):[String(r.value||"")])}case c.CFSubRuleType.text:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,r.value||"")}case c.CFSubRuleType.timePeriod:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`)}case c.CFSubRuleType.rank:return r.isPercent?r.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(r.value)):e.t("sheet.cf.preview.describe.topNPercent",String(r.value)):r.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(r.value)):e.t("sheet.cf.preview.describe.topN",String(r.value));case c.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let tr=0;const _i=t=>{const{onClick:e}=t,r=C.useDependency(c.ConditionalFormattingRuleModel),n=C.useDependency(C.IUniverInstanceService),o=C.useDependency(X.SheetsSelectionsService),i=C.useDependency(C.ICommandService),l=C.useDependency(C.LocaleService),y=C.useDependency(C.Injector),f=C.useDependency(ze),S=me.useObservable(()=>n.getCurrentTypeOfUnit$(C.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),m=S.getUnitId(),T=S.getActiveSheet();if(!T)throw new Error("No active sheet found");const _=T.getSheetId(),[I,b]=N.useState([]),[w,h]=N.useState("2"),[a,s]=N.useState(0),[d,R]=N.useState(-1),[u,g]=N.useState(tr),p=N.useRef(null),v=[{label:l.t("sheet.cf.panel.workSheet"),value:"2"},{label:l.t("sheet.cf.panel.selectedRange"),value:"1"}],M=()=>{const H=r.getSubunitRules(m,_);if(!H||!H.length)return[];if(w==="1"){const A=o.getCurrentLastSelection();if(!A)return[];const ne=A.range;return H.filter(se=>se.ranges.some(fe=>C.Rectangle.intersects(fe,ne)))}else if(w==="2")return[...H];return[]},[j,U]=N.useState(M);ce.useHighlightRange(I),N.useEffect(()=>{const H=i.onCommandExecuted(A=>{A.id===X.SetWorksheetActiveOperation.id&&s(Math.random())});return()=>H.dispose()}),N.useEffect(()=>{U(M)},[w,a,m,_]),N.useEffect(()=>{if(w==="2")return;const H=new be.Observable(A=>{const ne=[X.SetSelectionsOperation.id,c.AddConditionalRuleMutation.id,c.SetConditionalRuleMutation.id,c.DeleteConditionalRuleMutation.id,c.MoveConditionalRuleMutation.id],oe=i.onCommandExecuted(se=>{const{id:fe,params:ge}=se,Se=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId();ne.includes(fe)&&ge.unitId===Se&&A.next(null)});return()=>oe.dispose()}).pipe(be.debounceTime(16)).subscribe(()=>{U(M)});return()=>{H.unsubscribe()}},[n,w,m,_]),N.useEffect(()=>{const H=r.$ruleChange.subscribe(()=>{s(Math.random())});return()=>H.unsubscribe()},[r]),N.useEffect(()=>{const H=()=>{var se;const oe=Math.max(0,(((se=p.current)==null?void 0:se.getBoundingClientRect().width)||0)-8);return tr=oe,oe},ne=new be.Observable(oe=>{const se=document.querySelector(".univer-sidebar");if(se){let fe=setTimeout(()=>{oe.next()},150);const ge=()=>{fe&&clearTimeout(fe),fe=null},Se=q=>{q.propertyName==="width"&&(ge(),oe.next())};return se.addEventListener("transitionend",Se),()=>{ge(),se.removeEventListener("transitionend",Se)}}}).pipe(be.debounceTime(16)).subscribe(()=>{g(H())});return()=>{ne.unsubscribe()}},[]);const L=H=>{var oe;const A=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),ne=(oe=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:oe.getSheetId();if(!A||!ne)throw new Error("No active sheet found");i.executeCommand(st.id,{unitId:A,subUnitId:ne,cfId:H.cfId})},E=(H,A)=>{R(A.y)},F=(H,A,ne)=>{var q;R(-1);const oe=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),se=(q=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:q.getSheetId();if(!oe||!se)throw new Error("No active sheet found");const fe=J=>{const ae=j.length;return Math.min(ae-1,Math.max(0,J))},ge=j[fe(A.y)].cfId,Se=j[fe(ne.y)].cfId;ge!==Se&&i.executeCommand(zt.id,{unitId:oe,subUnitId:se,start:{id:ge,type:"self"},end:{id:Se,type:ne.y>A.y?"after":"before"}})},z=()=>{t.onCreate()},B=()=>{w==="2"?i.executeCommand(mt.id):w==="1"&&j.map(A=>({unitId:m,subUnitId:_,cfId:A.cfId})).forEach(A=>{i.executeCommand(st.id,A)})},G=N.useMemo(()=>{const H=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),A=H.getActiveSheet();return j.filter(ne=>{const oe=ne.ranges;return X.checkRangesEditablePermission(y,H.getUnitId(),A.getSheetId(),oe)})},[j]),te=G.map((H,A)=>({i:H.cfId,x:0,w:12,y:A,h:1,isResizable:!1})),Q=N.useMemo(()=>{const H=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),A=H.getActiveSheet();return j.every(ne=>{const oe=ne.ranges;return X.checkRangesEditablePermission(y,H.getUnitId(),A.getSheetId(),oe)})},[j]);return x.jsxs("div",{className:pe.cfRuleList,children:[x.jsxs("div",{className:pe.ruleSelector,children:[x.jsx("div",{children:f.tWithReactNode("sheet.cf.panel.managerRuleSelect",x.jsx(re.Select,{className:pe.select,options:v,value:w,onChange:H=>{h(H)}})).map((H,A)=>x.jsx("span",{children:H},A))}),x.jsxs("div",{className:pe.btnList,children:[x.jsx(re.Tooltip,{title:l.t("sheet.cf.panel.createRule"),placement:"bottom",children:x.jsx("div",{className:`
- ${pe.icon}
- `,onClick:z,children:x.jsx(gr,{})})}),j.length&&Q?x.jsx(re.Tooltip,{title:l.t("sheet.cf.panel.clear"),placement:"bottom",children:x.jsx("div",{className:`
- ${pe.gap}
- ${pe.icon}
- `,onClick:B,children:x.jsx(Pt,{})})}):x.jsx("div",{className:`
- ${pe.gap}
- ${pe.disabled}
- `,children:x.jsx(Pt,{})})]})]}),x.jsx("div",{ref:p,className:pe.gridLayoutWrap,children:u?x.jsx(ei,{onDragStop:F,onDragStart:E,layout:te,cols:12,rowHeight:60,width:u,margin:[0,10],draggableHandle:".draggableHandle",children:G==null?void 0:G.map((H,A)=>x.jsx("div",{children:x.jsxs("div",{onMouseMove:()=>{H.ranges!==I&&b(H.ranges)},onMouseLeave:()=>b([]),onClick:()=>{e(H)},className:`
- ${pe.ruleItem}
- ${d===A?pe.active:""}
- `,children:[x.jsx("div",{className:`
- ${pe.draggableHandle}
- draggableHandle
- `,onClick:ne=>ne.stopPropagation(),children:x.jsx(vr,{})}),x.jsxs("div",{className:pe.ruleDescribe,children:[x.jsx("div",{className:pe.ruleType,children:wi(H,l)}),x.jsx("div",{className:pe.ruleRange,children:H.ranges.map(ne=>an.serializeRange(ne)).join(",")})]}),x.jsx("div",{className:pe.preview,children:x.jsx(We,{rule:H.rule})}),x.jsx("div",{className:`
- ${pe.deleteItem}
- ${d===A?pe.active:""}
- `,onClick:ne=>{ne.stopPropagation(),L(H),b([])},children:x.jsx(Pt,{})})]})},`${H.cfId}`))}):null})]})},xi="univer-cf-color-picker",Ei="univer-cf-color-picker-icon",Oi="univer-icon-dropdown",Qt={cfColorPicker:xi,cfColorPickerIcon:Ei,iconDropdown:Oi},Ne=t=>{const{color:e,onChange:r,disable:n=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:l=!0}=t,y=C.useDependency(me.ComponentManager),f=N.useMemo(()=>new C.ColorKit(e),[e]),S=y.get(o);return S&&(n?x.jsx(S,{className:i,extend:{colorChannel1:f.isValid?e:"rgb(var(--primary-color))"}}):x.jsx(re.DropdownLegacy,{overlay:x.jsx("div",{className:`
- ${Qt.cfColorPicker}
- `,children:x.jsx(re.ColorPicker,{value:e,onChange:r})}),children:x.jsxs("span",{className:`
- ${Qt.cfColorPickerIcon}
- ${i}
- `,children:[x.jsx(S,{extend:{colorChannel1:f.isValid?e:"rgb(var(--primary-color))"}}),l&&x.jsx(qt,{className:Qt.iconDropdown})]})}))},Pi="univer-cf-rule-style-editor",Mi="univer-cf-preview-wrap",Fi="univer-text",Di="univer-position-relative",Ni="univer-btn-list",ji="univer-util-item",Li="univer-icon-set",Ui="univer-render-config",Vi="univer-flex",$i="univer-width45",zi="univer-icon-wrap",Ai="univer-icon",qi="univer-dropdown-icon",Wi="univer-error-input",Hi="univer-error-text",ki="univer-icon-group-list",Bi="univer-title",Gi="univer-group",Xi="univer-item-content",Yi="univer-item-wrap",Ki="univer-item",Zi="univer-icon-item-list-wrap",Ji="univer-none",Qi="univer-icon-item-list",ea="univer-width100",ta="univer-stress",k={cfRuleStyleEditor:Pi,cfPreviewWrap:Mi,text:Fi,positionRelative:Di,btnList:Ni,utilItem:ji,iconSet:Li,renderConfig:Ui,flex:Vi,width45:$i,iconWrap:zi,icon:Ai,dropdownIcon:qi,errorInput:Wi,errorText:Hi,iconGroupList:ki,title:Bi,group:Gi,itemContent:Xi,itemWrap:Yi,item:Ki,iconItemListWrap:Zi,none:Ji,iconItemList:Qi,width100:ea,stress:ta},De=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),en=t=>{var b;const{type:e,className:r,onChange:n,id:o,value:i}=t,l=C.useDependency(C.IUniverInstanceService),y=l.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(b=l.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId(),S=N.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),m=N.useMemo(()=>[c.CFValueType.max,c.CFValueType.min,"none"].includes(e)?{disabled:!0}:[c.CFValueType.percent,c.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),T=N.useRef({}),[_,I]=N.useState(!1);return me.useSidebarClick(w=>{var a;const h=(a=T.current)==null?void 0:a.handleOutClick;h&&h(w,()=>I(!1))}),e===c.CFValueType.formula?x.jsx("div",{style:{width:"100%",marginLeft:4},children:x.jsx(pt.FormulaEditor,{initValue:S,unitId:y,subUnitId:f,isFocus:_,onChange:(w="")=>{n(w||"")},onFocus:()=>I(!0),actions:T.current})}):x.jsx(re.InputNumber,{className:r,value:Number(t.value)||0,onChange:w=>t.onChange(w||0),...m})},na=t=>{var L;const{interceptorManager:e}=t,r=C.useDependency(C.LocaleService),n=((L=t.rule)==null?void 0:L.type)===c.CFRuleType.colorScale?t.rule:void 0,o=[De(c.CFValueType.num,r),De(c.CFValueType.percent,r),De(c.CFValueType.percentile,r),De(c.CFValueType.formula,r)],i=[De(c.CFValueType.min,r),...o],l=[De("none",r),...o],y=[De(c.CFValueType.max,r),...o],[f,S]=N.useState(()=>{var F;const E=c.CFValueType.min;return n&&((F=n.config[0])==null?void 0:F.value.type)||E}),[m,T]=N.useState(()=>{var F;const E="none";return!n||n.config.length!==3?E:((F=n.config[1])==null?void 0:F.value.type)||E}),[_,I]=N.useState(()=>{var F;const E=c.CFValueType.max;return n&&((F=n.config[n.config.length-1])==null?void 0:F.value.type)||E}),[b,w]=N.useState(()=>{if(!n)return 10;const F=n.config[0];return(F==null?void 0:F.value.value)===void 0?10:F==null?void 0:F.value.value}),[h,a]=N.useState(()=>{var z;if(!n||n.config.length!==3)return 50;const F=(z=n.config[1])==null?void 0:z.value.value;return F===void 0?50:F}),[s,d]=N.useState(()=>{var z;if(!n)return 90;const F=(z=n.config[n.config.length-1])==null?void 0:z.value.value;return F===void 0?90:F}),[R,u]=N.useState(()=>{var F;const E="#d0d9fb";return n&&((F=n.config[0])==null?void 0:F.color)||E}),[g,p]=N.useState(()=>{var F;const E="#7790f3";return!n||n.config.length!==3?E:((F=n.config[1])==null?void 0:F.color)||E}),[v,M]=N.useState(()=>{var F;const E="#2e55ef";return n&&((F=n.config[n.config.length-1])==null?void 0:F.color)||E}),j=N.useMemo(()=>E=>{const{minType:F,medianType:z,maxType:B,minValue:G,medianValue:te,maxValue:Q,minColor:H,medianColor:A,maxColor:ne}=E,oe=[];return oe.push({color:H,value:{type:F,value:G}}),z!=="none"&&oe.push({color:A,value:{type:z,value:te}}),oe.push({color:ne,value:{type:B,value:Q}}),{config:oe.map((fe,ge)=>({...fe,index:ge})),type:c.CFRuleType.colorScale}},[]);N.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return j({minType:f,medianType:m,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:R,medianColor:g,maxColor:v})}}),[j,f,m,_,b,h,s,R,g,v,e]);const U=E=>{t.onChange(j(E))};return x.jsxs("div",{children:[x.jsx("div",{className:$.title,children:r.t("sheet.cf.panel.styleRule")}),x.jsx("div",{className:`
- ${k.cfPreviewWrap}
- `,children:x.jsx(We,{rule:j({minType:f,medianType:m,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:R,medianColor:g,maxColor:v})})}),x.jsx("div",{className:$.label,children:r.t("sheet.cf.valueType.min")}),x.jsxs("div",{className:`
- ${$.labelContainer}
- ${$.mTSm}
- `,children:[x.jsx(re.Select,{style:{flexShrink:0},options:i,value:f,onChange:E=>{S(E);const F=c.createDefaultValueByValueType(E,10);w(F),U({minType:E,medianType:m,maxType:_,minValue:F,medianValue:h,maxValue:s,minColor:R,medianColor:g,maxColor:v})}}),x.jsx(en,{id:"min",className:`
- ${$.mLXxs}
- `,value:b,type:f,onChange:E=>{w(E),U({minType:f,medianType:m,maxType:_,minValue:E,medianValue:h,maxValue:s,minColor:R,medianColor:g,maxColor:v})}}),x.jsx(Ne,{className:$.mLXxs,color:R,onChange:E=>{u(E),U({minType:f,medianType:m,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:E,medianColor:g,maxColor:v})}})]}),x.jsx("div",{className:$.label,children:r.t("sheet.cf.panel.medianValue")}),x.jsxs("div",{className:`
- ${$.labelContainer}
- ${$.mTSm}
- `,children:[x.jsx(re.Select,{style:{flexShrink:0},options:l,value:m,onChange:E=>{T(E);const F=c.createDefaultValueByValueType(E,50);a(F),U({minType:f,medianType:E,maxType:_,minValue:b,medianValue:F,maxValue:s,minColor:R,medianColor:g,maxColor:v})}}),x.jsx(en,{id:"median",className:`
- ${$.mLXxs}
- `,value:h,type:m,onChange:E=>{a(E),U({minType:f,medianType:m,maxType:_,minValue:b,medianValue:E,maxValue:s,minColor:R,medianColor:g,maxColor:v})}}),m!=="none"&&x.jsx(Ne,{className:$.mLXxs,color:g,onChange:E=>{p(E),U({minType:f,medianType:m,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:R,medianColor:E,maxColor:v})}})]}),x.jsx("div",{className:$.label,children:r.t("sheet.cf.valueType.max")}),x.jsxs("div",{className:`
- ${$.labelContainer}
- ${$.mTSm}
- `,children:[x.jsx(re.Select,{style:{flexShrink:0},options:y,value:_,onChange:E=>{I(E);const F=c.createDefaultValueByValueType(E,90);d(F),U({minType:f,medianType:m,maxType:E,minValue:b,medianValue:h,maxValue:F,minColor:R,medianColor:g,maxColor:v})}}),x.jsx(en,{id:"max",className:`
- ${$.mLXxs}
- `,value:s,type:_,onChange:E=>{d(E),U({minType:f,medianType:m,maxType:_,minValue:b,medianValue:h,maxValue:E,minColor:R,medianColor:g,maxColor:v})}}),x.jsx(Ne,{className:$.mLXxs,color:v,onChange:E=>{M(E),U({minType:f,medianType:m,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:R,medianColor:g,maxColor:E})}})]})]})},Le=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),nr=t=>{var w;const{onChange:e,className:r,value:n,type:o,id:i,disabled:l=!1}=t,y=C.useDependency(C.IUniverInstanceService),f=y.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),S=(w=y.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:w.getSheetId(),m=N.useRef({}),[T,_]=N.useState(!1);me.useSidebarClick(h=>{var s;const a=(s=m.current)==null?void 0:s.handleOutClick;a&&a(h,()=>_(!1))});const I=N.useRef(n),b=N.useMemo(()=>[c.CFValueType.percentile,c.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===c.CFValueType.formula){const h=String(I.current).startsWith("=")?String(I.current)||"":"=";return x.jsx("div",{style:{width:"100%",marginLeft:12},children:x.jsx(pt.FormulaEditor,{initValue:h,unitId:f,subUnitId:S,isFocus:T,onChange:(a="")=>{e(a||"")},onFocus:()=>_(!0),actions:m.current})})}return x.jsx(re.InputNumber,{className:r,value:Number(n)||0,disabled:l,onChange:h=>{e(h||0)},...b})},ra=t=>{var L;const{interceptorManager:e}=t,r=C.useDependency(C.LocaleService),n=((L=t.rule)==null?void 0:L.type)===c.CFRuleType.dataBar?t.rule:void 0,[o,i]=N.useState(()=>{var F;const E="0";return n?(F=n.config)!=null&&F.isGradient?"1":"0":E}),[l,y]=N.useState(()=>{var E;return n&&((E=n.config)==null?void 0:E.positiveColor)||c.defaultDataBarPositiveColor}),[f,S]=N.useState(()=>{var E;return n&&((E=n.config)==null?void 0:E.nativeColor)||c.defaultDataBarNativeColor}),m=[Le(c.CFValueType.num,r),Le(c.CFValueType.percent,r),Le(c.CFValueType.percentile,r),Le(c.CFValueType.formula,r)],T=[Le(c.CFValueType.min,r),...m],_=[Le(c.CFValueType.max,r),...m],[I,b]=N.useState(()=>{var F;const E=T[0].value;return n&&((F=n.config)==null?void 0:F.min.type)||E}),[w,h]=N.useState(()=>{var F;const E=_[0].value;return n&&((F=n.config)==null?void 0:F.max.type)||E}),[a,s]=N.useState(()=>{var z;if(!n)return 0;const F=((z=n.config)==null?void 0:z.min)||{};return F.type===c.CFValueType.formula?F.value||"=":F.value||0}),[d,R]=N.useState(()=>{var z;if(!n)return 100;const F=((z=n.config)==null?void 0:z.max)||{};return F.type===c.CFValueType.formula?F.value||"=":F.value===void 0?100:F.value}),[u,g]=N.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),p=E=>({config:{min:{type:E.minValueType,value:E.minValue},max:{type:E.maxValueType,value:E.maxValue},isGradient:E.isGradient==="1",positiveColor:E.positiveColor||c.defaultDataBarPositiveColor,nativeColor:E.nativeColor||c.defaultDataBarNativeColor},type:c.CFRuleType.dataBar,isShowValue:E.isShowValue});N.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return p({isGradient:o,minValue:a,minValueType:I,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:u})}}),[o,a,I,d,w,l,f,e,u]);const v=E=>{t.onChange(p(E))},M=E=>{y(E),v({isGradient:o,minValue:a,minValueType:I,maxValue:d,maxValueType:w,positiveColor:E,nativeColor:f,isShowValue:u})},j=E=>{S(E),v({isGradient:o,minValue:a,minValueType:I,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:E,isShowValue:u})},U=E=>m.map(F=>F.value).includes(E);return x.jsxs("div",{children:[x.jsx("div",{className:$.title,children:r.t("sheet.cf.panel.styleRule")}),x.jsx("div",{className:`
- ${k.cfPreviewWrap}
- `,children:x.jsx(We,{rule:p({isGradient:o,minValue:a,minValueType:I,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:u})})}),x.jsxs("div",{children:[x.jsx("div",{className:$.label,children:r.t("sheet.cf.panel.fillType")}),x.jsxs("div",{className:`
- ${$.mTSm}
- ${$.mLXxs}
- ${$.labelContainer}
- `,children:[x.jsxs(re.RadioGroup,{value:o,onChange:E=>{i(E),v({isGradient:E,minValue:a,minValueType:I,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:u})},children:[x.jsx(re.Radio,{value:"0",children:x.jsx("span",{className:k.text,children:r.t("sheet.cf.panel.pureColor")})}),x.jsx(re.Radio,{value:"1",children:x.jsx("span",{className:k.text,children:r.t("sheet.cf.panel.gradient")})})]}),x.jsxs("div",{className:`
- ${k.utilItem}
- ${$.mLXl}
- `,children:[x.jsx(re.Checkbox,{checked:!u,onChange:E=>{g(!E),v({isGradient:E,minValue:a,minValueType:I,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:!E})}}),r.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),x.jsxs("div",{children:[x.jsx("div",{className:$.label,children:r.t("sheet.cf.panel.colorSet")}),x.jsxs("div",{className:`
- ${$.labelContainer}
- ${$.mTSm}
- ${$.mLXxs}
- `,children:[x.jsxs("div",{className:`
- ${$.labelContainer}
- `,children:[x.jsx("div",{className:`
- ${k.text}
- `,children:r.t("sheet.cf.panel.native")}),x.jsx(Ne,{color:f,onChange:j})]}),x.jsxs("div",{className:`
- ${$.labelContainer}
- ${$.mLSm}
- `,children:[x.jsx("div",{className:`
- ${k.text}
- `,children:r.t("sheet.cf.panel.positive")}),x.jsx(Ne,{color:l,onChange:M})]})]})]}),x.jsxs("div",{children:[x.jsx("div",{className:$.label,children:r.t("sheet.cf.valueType.min")}),x.jsxs("div",{className:`
- ${$.mTSm}
- ${$.labelContainer}
- `,children:[x.jsx(re.Select,{style:{width:"50%",flexShrink:0},options:T,value:I,onChange:E=>{b(E);const F=c.createDefaultValueByValueType(E,10);s(F),v({isGradient:o,minValue:F,minValueType:E,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:u})}}),x.jsx(nr,{disabled:!U(I),id:"min",type:I,className:$.mLSm,value:a,onChange:E=>{s(E||0),v({isGradient:o,minValue:E||0,minValueType:I,maxValue:d,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:u})}})]}),x.jsx("div",{className:$.label,children:r.t("sheet.cf.valueType.max")}),x.jsxs("div",{className:`
- ${$.mTSm}
- ${$.labelContainer}
- `,children:[x.jsx(re.Select,{style:{width:"50%",flexShrink:0},options:_,value:w,onChange:E=>{h(E);const F=c.createDefaultValueByValueType(E,90);R(F),v({isGradient:o,minValue:a,minValueType:I,maxValue:F,maxValueType:E,positiveColor:l,nativeColor:f,isShowValue:u})}}),x.jsx(nr,{disabled:!U(w),id:"max",type:w,className:$.mLSm,value:d,onChange:E=>{R(E||0),v({isGradient:o,minValue:a,minValueType:I,maxValue:E||0,maxValueType:w,positiveColor:l,nativeColor:f,isShowValue:u})}})]})]})]})};function Mr(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=Mr(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function It(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=Mr(t))&&(n&&(n+=" "),n+=e);return n}const oa="univer-cf-style-edit",ia="univer-button-item",aa="univer-isActive",we={cfStyleEdit:oa,buttonItem:ia,isActive:aa},wt=t=>[C.BooleanNumber.FALSE,void 0].includes(t)?C.BooleanNumber.TRUE:C.BooleanNumber.FALSE,_t=t=>t!==C.BooleanNumber.FALSE,Rn=t=>{const{style:e,onChange:r,className:n}=t,o=C.useDependency(me.ComponentManager),[i,l]=N.useState(()=>{if(e!=null&&e.bl)return e.bl}),[y,f]=N.useState(()=>{if(e!=null&&e.it)return e.it}),[S,m]=N.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[T,_]=N.useState(()=>{if(e!=null&&e.st)return e.st.s}),[I,b]=N.useState(()=>{var g;const u="#2f56ef";return(g=e==null?void 0:e.cl)!=null&&g.rgb?e.cl.rgb:u}),[w,h]=N.useState(()=>{var g;const u="#e8ecfc";return(g=e==null?void 0:e.bg)!=null&&g.rgb?e.bg.rgb:u}),a=o.get("BoldSingle"),s=o.get("ItalicSingle"),d=o.get("UnderlineSingle"),R=o.get("StrikethroughSingle");return N.useEffect(()=>{const u={bl:i,it:y};I!==void 0&&(u.cl={rgb:I}),w!==void 0&&(u.bg={rgb:w}),T!==void 0&&(u.st={s:T}),S!==void 0&&(u.ul={s:S}),r(c.removeUndefinedAttr(u))},[i,y,S,T,I,w]),x.jsxs("div",{className:`
- ${we.cfStyleEdit}
- ${n}
- `,children:[a&&x.jsx("div",{className:It({[we.isActive]:_t(i||C.BooleanNumber.FALSE)},we.buttonItem),onClick:()=>l(wt(i)),children:x.jsx(a,{})}),s&&x.jsx("div",{className:It({[we.isActive]:_t(y||C.BooleanNumber.FALSE)},we.buttonItem),onClick:()=>f(wt(y)),children:x.jsx(s,{})}),d&&x.jsx("div",{className:It({[we.isActive]:_t(S||C.BooleanNumber.FALSE)},we.buttonItem),onClick:()=>m(wt(S)),children:x.jsx(d,{})}),R&&x.jsx("div",{className:It({[we.isActive]:_t(T||C.BooleanNumber.FALSE)},we.buttonItem),onClick:()=>_(wt(T)),children:x.jsx(R,{})}),x.jsx(Ne,{color:I,onChange:b,iconId:"FontColor"}),x.jsx(Ne,{color:w,onChange:h,iconId:"PaintBucket"})]})},sa=t=>{var R;const{onChange:e,interceptorManager:r}=t,n=C.useDependency(C.LocaleService),i=C.useDependency(C.IUniverInstanceService).getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),l=i.getActiveSheet(),y=((R=t.rule)==null?void 0:R.type)===c.CFRuleType.highlightCell?t.rule:void 0,f=N.useRef(null),[S,m]=N.useState(!1),T=N.useRef({}),[_,I]=N.useState({}),[b,w]=N.useState(()=>(y==null?void 0:y.subType)===c.CFSubRuleType.formula?y.value:"="),[h,a]=N.useState(void 0),s=u=>({style:u.style,value:b,type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.formula});N.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return s({style:_,formula:b})}}),[_,b,r]),N.useEffect(()=>r.intercept(r.getInterceptPoints().beforeSubmit,{handler:(g,p,v)=>h||b.length===1||!b.startsWith("=")?(a(n.t("sheet.cf.errorMessage.formulaError")),!1):v(g)}),[h,b]);const d=u=>{e(s(u))};return me.useSidebarClick(u=>{var p;const g=(p=T.current)==null?void 0:p.handleOutClick;g&&g(u,()=>m(!1))}),x.jsxs("div",{ref:f,children:[x.jsx("div",{className:`
- ${$.title}
- ${$.mTBase}
- `,children:n.t("sheet.cf.panel.styleRule")}),x.jsx("div",{className:`
- ${$.mTSm}
- `,children:x.jsx(pt.FormulaEditor,{onChange:u=>{w(u),d({style:_,formula:u})},onVerify:(u,g)=>{!u||g.length===1?a(n.t("sheet.cf.errorMessage.formulaError")):a(void 0)},errorText:h,onFocus:()=>{m(!0)},actions:T.current,isFocus:S,initValue:b,unitId:i.getUnitId(),subUnitId:l==null?void 0:l.getSheetId()})}),x.jsx("div",{className:`
- ${k.cfPreviewWrap}
- `,children:x.jsx(We,{rule:s({style:_,formula:b})})}),x.jsx(Rn,{style:y==null?void 0:y.style,className:`
- ${$.mTSm}
- `,onChange:u=>{I(u),d({style:u,formula:b})}})]})},xt=t=>x.jsxs("div",{style:{position:"relative"},children:[x.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:t.errorText}),t.children]}),le=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),la=t=>{const{type:e,operator:r,onChange:n,value:o,interceptorManager:i}=t,l=C.useDependency(C.LocaleService),[y,f]=N.useState(()=>typeof o=="number"?o:0),[S,m]=N.useState(""),[T,_]=N.useState(()=>typeof o=="string"?o:""),[I,b]=N.useState(""),[w,h]=N.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[a,s]=N.useState(""),[d,R]=N.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[u,g]=N.useState("");switch(N.useEffect(()=>{switch(e){case c.CFSubRuleType.text:{[c.CFTextOperator.beginsWith,c.CFTextOperator.endsWith,c.CFTextOperator.containsText,c.CFTextOperator.notContainsText,c.CFTextOperator.equal,c.CFTextOperator.notEqual].includes(r)&&n(T);break}case c.CFSubRuleType.number:{[c.CFNumberOperator.equal,c.CFNumberOperator.notEqual,c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual,c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(r)&&n(y),[c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(r)&&n([w,d]);break}}},[e]),N.useEffect(()=>{const p=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(v,M,j)=>{switch(e){case c.CFSubRuleType.text:if([c.CFTextOperator.beginsWith,c.CFTextOperator.containsText,c.CFTextOperator.endsWith,c.CFTextOperator.notEqual,c.CFTextOperator.notContainsText,c.CFTextOperator.equal].includes(r))return T?j(v):(b(l.t("sheet.cf.errorMessage.notBlank")),!1)}return j(v)}});return()=>{p()}},[e,y,T,r]),e){case c.CFSubRuleType.text:{if([c.CFTextOperator.beginsWith,c.CFTextOperator.endsWith,c.CFTextOperator.containsText,c.CFTextOperator.notContainsText,c.CFTextOperator.equal,c.CFTextOperator.notEqual].includes(r)){const p=v=>{_(v),n(v)};return x.jsx("div",{className:`
- ${$.mTSm}
- `,children:x.jsx(xt,{errorText:I,children:x.jsx(re.Input,{className:k.width100,value:T,onChange:v=>{b(""),p(v)}})})})}break}case c.CFSubRuleType.number:{if([c.CFNumberOperator.equal,c.CFNumberOperator.notEqual,c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual,c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(r)){const p=v=>{f(v||0),n(v||0),m("")};return x.jsx("div",{className:`
- ${$.mTSm}
- `,children:x.jsx(xt,{errorText:S,children:x.jsx(re.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:k.width100,value:y,onChange:p})})})}if([c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(r)){const p=M=>{h(M||0),n([M||0,d]),s("")},v=M=>{R(M||0),n([w,M||0]),g("")};return x.jsxs("div",{className:`
- ${$.mTSm}
- ${$.labelContainer}
- `,children:[x.jsx(xt,{errorText:a,children:x.jsx(re.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:w,onChange:p})}),x.jsx(xt,{errorText:u,children:x.jsx(re.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`
- ${$.mLSm}
- `,value:d,onChange:v})})]})}}}return null},rr=(t,e)=>{switch(t){case c.CFSubRuleType.text:return[le(c.CFTextOperator.containsText,e),le(c.CFTextOperator.notContainsText,e),le(c.CFTextOperator.beginsWith,e),le(c.CFTextOperator.endsWith,e),le(c.CFTextOperator.equal,e),le(c.CFTextOperator.notEqual,e),le(c.CFTextOperator.containsBlanks,e),le(c.CFTextOperator.notContainsBlanks,e),le(c.CFTextOperator.containsErrors,e),le(c.CFTextOperator.notContainsErrors,e)];case c.CFSubRuleType.number:return[le(c.CFNumberOperator.between,e),le(c.CFNumberOperator.notBetween,e),le(c.CFNumberOperator.equal,e),le(c.CFNumberOperator.notEqual,e),le(c.CFNumberOperator.greaterThan,e),le(c.CFNumberOperator.greaterThanOrEqual,e),le(c.CFNumberOperator.lessThan,e),le(c.CFNumberOperator.lessThanOrEqual,e)];case c.CFSubRuleType.timePeriod:return[le(c.CFTimePeriodOperator.yesterday,e),le(c.CFTimePeriodOperator.today,e),le(c.CFTimePeriodOperator.tomorrow,e),le(c.CFTimePeriodOperator.last7Days,e),le(c.CFTimePeriodOperator.lastWeek,e),le(c.CFTimePeriodOperator.thisWeek,e),le(c.CFTimePeriodOperator.nextWeek,e),le(c.CFTimePeriodOperator.lastMonth,e),le(c.CFTimePeriodOperator.thisMonth,e),le(c.CFTimePeriodOperator.nextMonth,e)]}},or=t=>{var R;const{interceptorManager:e,onChange:r}=t,n=C.useDependency(C.LocaleService),o=((R=t.rule)==null?void 0:R.type)===c.CFRuleType.highlightCell?t.rule:void 0,[i,l]=N.useState(()=>{const u=c.CFSubRuleType.text;return o&&o.subType||u}),y=[{value:c.CFSubRuleType.text,label:n.t("sheet.cf.subRuleType.text")},{value:c.CFSubRuleType.number,label:n.t("sheet.cf.subRuleType.number")},{value:c.CFSubRuleType.timePeriod,label:n.t("sheet.cf.subRuleType.timePeriod")},{value:c.CFSubRuleType.duplicateValues,label:n.t("sheet.cf.subRuleType.duplicateValues")},{value:c.CFSubRuleType.uniqueValues,label:n.t("sheet.cf.subRuleType.uniqueValues")}],f=N.useMemo(()=>rr(i,n),[i]),[S,m]=N.useState(()=>{const u=f?f[0].value:void 0;return o&&o.operator||u}),[T,_]=N.useState(()=>{var p;const u="";return o?(p=o.value)!=null?p:c.createDefaultValue(o.subType,o.operator):u}),[I,b]=N.useState({}),w=N.useMemo(()=>u=>{var g,p,v,M,j,U,L,E,F,z,B,G,te,Q,H;switch(u.subType||i){case c.CFSubRuleType.text:{if([c.CFTextOperator.beginsWith,c.CFTextOperator.endsWith,c.CFTextOperator.containsText,c.CFTextOperator.notContainsText,c.CFTextOperator.equal,c.CFTextOperator.notEqual].includes(S))return{type:c.CFRuleType.highlightCell,subType:(g=u.subType)!=null?g:i,operator:(p=u.operator)!=null?p:S,style:(v=u.style)!=null?v:I,value:(M=u.value)!=null?M:T};break}case c.CFSubRuleType.number:{if([c.CFNumberOperator.equal,c.CFNumberOperator.notEqual,c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual,c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(S))return{type:c.CFRuleType.highlightCell,subType:(j=u.subType)!=null?j:i,operator:(U=u.operator)!=null?U:S,style:(L=u.style)!=null?L:I,value:(E=u.value)!=null?E:T};if([c.CFNumberOperator.between,c.CFNumberOperator.notBetween].includes(S))return{type:c.CFRuleType.highlightCell,subType:(F=u.subType)!=null?F:i,operator:(z=u.operator)!=null?z:S,style:(B=u.style)!=null?B:I,value:(G=u.value)!=null?G:T};break}}return{type:c.CFRuleType.highlightCell,subType:(te=u.subType)!=null?te:i,operator:(Q=u.operator)!=null?Q:S,style:(H=u.style)!=null?H:I}},[i,S,T,I]);N.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return w({})}}),[w,e]),N.useEffect(()=>{y.some(u=>u.value===i)||l(y[0].value)},[y]);const h=u=>{const g=u,p=rr(g,n),v=p&&p[0].value;l(g),m(v),v&&_(c.createDefaultValue(g,v)),r(w({subType:g,operator:v}))},a=u=>{const g=u;m(g),r(w({operator:g}))},s=u=>{_(u),r(w({value:u}))},d=N.useMemo(()=>`${i}_${S}_${Math.random()}`,[i,S]);return x.jsxs("div",{children:[x.jsx("div",{className:`
- ${$.title}
- ${$.mTBase}
- `,children:n.t("sheet.cf.panel.styleRule")}),x.jsx(re.Select,{className:`
- ${$.mTSm}
- ${k.width100}
- `,onChange:h,value:i,options:y}),(f==null?void 0:f.length)&&x.jsx(re.Select,{className:`
- ${$.mTSm}
- ${k.width100}
- `,onChange:a,value:S||"",options:f}),x.jsx(la,{value:T,interceptorManager:e,type:i,operator:S,rule:o,onChange:s},d),x.jsx("div",{className:`
- ${k.cfPreviewWrap}
- `,children:x.jsx(We,{rule:w({})})}),x.jsx(Rn,{style:o==null?void 0:o.style,className:`
- ${$.mLXxs}
- `,onChange:u=>{b(u),r(w({style:u}))}})]})},Fr=(t,e)=>(c.iconMap[t]||[])[Number(e)]||"",ua=t=>{var f;const e=C.useDependency(C.IUniverInstanceService),r=e.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),n=(f=e.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:f.getSheetId(),o=N.useMemo(()=>t.error?k.errorInput:"",[t.error]),i=N.useRef({}),[l,y]=N.useState(!1);return me.useSidebarClick(S=>{var T;const m=(T=i.current)==null?void 0:T.handleOutClick;m&&m(S,()=>y(!1))}),x.jsx("div",{className:k.positionRelative,children:t.type!==c.CFValueType.formula?x.jsxs(x.Fragment,{children:[x.jsx(re.InputNumber,{className:o,value:Number(t.value)||0,onChange:S=>t.onChange(S!=null?S:0)}),t.error&&x.jsx("div",{className:k.errorText,children:t.error})]}):x.jsx("div",{style:{width:"100%"},children:x.jsx(pt.FormulaEditor,{initValue:String(t.value),unitId:r,subUnitId:n,isFocus:l,onChange:(S="")=>{const m=S||"";t.onChange(m)},onFocus:()=>y(!0),actions:i.current})})})},ir=(t,e,r)=>({operator:c.CFNumberOperator.greaterThan,value:{type:c.CFValueType.num,value:(r.length-1-e)*10},iconType:t,iconId:String(e)}),ca=N.forwardRef((t,e)=>{const r=C.useDependency(C.LocaleService),n=o=>{t.onClick(o)};return x.jsx("div",{ref:e,className:k.iconGroupList,children:c.iconGroup.map((o,i)=>x.jsxs("div",{className:k.group,children:[x.jsx("div",{className:k.title,children:r.t(o.title)}),x.jsx("div",{className:k.itemContent,children:o.group.map(l=>x.jsx("div",{className:k.itemWrap,onClick:()=>{n(l.name)},children:x.jsx("div",{className:k.item,children:l.list.map((y,f)=>x.jsx("img",{className:k.icon,src:y},f))})},l.name))})]},i))})}),da=t=>{const e=N.useMemo(()=>{const n=[];for(const o in c.iconMap){const i=c.iconMap[o],l=o;i.forEach((y,f)=>{n.push({iconType:l,base64:y,iconId:String(f)})})}return n},[]),r=n=>{t.onClick(n.iconType,n.iconId)};return x.jsxs("div",{className:k.iconItemListWrap,children:[x.jsxs("div",{className:k.none,onClick:()=>r({iconType:c.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[x.jsx(gt,{className:k.icon}),x.jsx("span",{children:"无单元格图标"})]}),x.jsx("div",{className:k.iconItemList,children:e.map(n=>x.jsx("div",{className:k.item,children:x.jsx("img",{onClick:()=>r(n),className:`
- ${k.icon}
- `,src:n.base64})},`${n.iconType}_${n.iconId}`))})]})},fa=t=>{const{onChange:e,configList:r,errorMap:n={}}=t,o=C.useDependency(C.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${c.CFNumberOperator.greaterThan}`),value:c.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${c.CFNumberOperator.greaterThanOrEqual}`),value:c.CFNumberOperator.greaterThanOrEqual}],l=[{label:o.t(`sheet.cf.valueType.${c.CFValueType.num}`),value:c.CFValueType.num},{label:o.t(`sheet.cf.valueType.${c.CFValueType.percent}`),value:c.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${c.CFValueType.percentile}`),value:c.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${c.CFValueType.formula}`),value:c.CFValueType.formula}],y=(T,_)=>{e([String(_),"value","value"],T)},f=(T,_)=>{e([String(_),"operator"],T);const I=c.createDefaultValue(c.CFSubRuleType.number,T);y(I,_)},S=(T,_)=>{e([String(_),"value","type"],T);const I=r[_],b=c.createDefaultValue(c.CFSubRuleType.number,I.operator);y(b,_)};return N.useMemo(()=>r.map((T,_)=>{const I=n[_],b=Fr(T.iconType,T.iconId),w=_===r.length-1,h=_===0,a=r[_-1],s=(a==null?void 0:a.value.type)===c.CFValueType.formula?o.t("sheet.cf.valueType.formula"):a==null?void 0:a.value.value,d=(R,u)=>{const g={...T,iconId:u,iconType:R};e([String(_)],g)};return x.jsxs("div",{className:`
- ${_?$.mTXl:$.mTSm}
- `,children:[x.jsxs("div",{className:`
- ${$.label}
- ${k.flex}
- `,children:[x.jsxs("div",{className:`
- ${k.width45}
- `,children:[o.t("sheet.cf.iconSet.icon"),_+1]}),x.jsx("div",{className:`
- ${k.width45}
- `,children:x.jsxs(x.Fragment,{children:[!h&&!w&&o.t("sheet.cf.iconSet.rule"),!h&&!w&&x.jsxs("span",{className:k.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${c.getOppositeOperator(a.operator)}`),s,w?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),x.jsxs("div",{className:`
- ${k.flex}
- ${$.mTSm}
- `,children:[x.jsx("div",{className:`
- ${k.iconWrap}
- ${k.width45}
- `,children:x.jsx(re.DropdownLegacy,{overlay:x.jsx(da,{onClick:d,iconId:T.iconId,iconType:T.iconType}),children:x.jsxs("div",{className:k.dropdownIcon,children:[b?x.jsx("img",{src:b,className:k.icon}):x.jsx(gt,{className:k.icon}),x.jsx(qt,{})]})})}),w?x.jsxs("div",{className:`
- ${k.width45}
- ${$.label}
- `,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),x.jsxs("span",{className:k.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${c.getOppositeOperator(a.operator)}`),s,w?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):x.jsx(re.Select,{className:`
- ${$.mL0}
- ${k.width45}
- ${$.mR0}
- `,options:i,value:T.operator,onChange:R=>{f(R,_)}})]}),w?x.jsx("div",{}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:`
- ${$.mTSm}
- ${$.label}
- ${k.flex}
- `,children:[x.jsx("div",{className:`
- ${k.width45}
- `,children:o.t("sheet.cf.iconSet.type")}),x.jsx("div",{className:`
- ${k.width45}
- `,children:o.t("sheet.cf.iconSet.value")})]}),x.jsxs("div",{className:`
- ${$.mTSm}
- ${k.flex}
- `,children:[x.jsx(re.Select,{style:{flexShrink:0},className:`
- ${k.width45}
- ${$.mL0}
- `,options:l,value:T.value.type,onChange:R=>{S(R,_)}}),x.jsx("div",{className:`
- ${$.mL0}
- ${k.width45}
- `,children:x.jsx(ua,{id:_,type:T.value.type,error:I,value:T.value.value||"",onChange:R=>y(R,_)})})]})]})]},_)}),[r,n])},pa=t=>{var R;const{interceptorManager:e}=t,r=((R=t.rule)==null?void 0:R.type)===c.CFRuleType.iconSet?t.rule:void 0,n=C.useDependency(C.LocaleService),[o,i]=N.useState({}),[l,y]=N.useState(()=>{const u=Object.keys(c.iconMap)[0];if(r&&r.config.length){const g=r.config[0].iconType;if(!r.config.some(v=>v.iconType!==g))return g}return u}),[f,S]=N.useState(()=>{if(r&&r.config.length)return C.Tools.deepClone(r==null?void 0:r.config);const u=c.iconMap[l]||[];return new Array(u.length).fill("").map((g,p,v)=>p===v.length-1?{operator:c.CFNumberOperator.lessThanOrEqual,value:{type:c.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:l,iconId:String(p)}:ir(l,p,v))}),[m,T]=N.useState(()=>r?!!r.isShowValue:!0),_=N.useMemo(()=>{const u=f.map(g=>Fr(g.iconType,g.iconId));return x.jsx("div",{className:k.iconWrap,children:u.map((g,p)=>g?x.jsx("img",{className:k.icon,src:g},p):x.jsx(gt,{className:k.icon},p))})},[f]),I=u=>{if(u.reduce((p,v,M)=>p.preType&&!p.result||u.length-1===M?p:v.value.type===c.CFValueType.formula?{preType:c.CFValueType.formula,result:!1}:p.preType?{result:p.preType===v.value.type,preType:v.value.type}:{result:!0,preType:v.value.type},{result:!0,preType:""}).result&&[c.CFValueType.num,c.CFValueType.percent,c.CFValueType.percentile].includes(u[0].value.type)){const p={};return u.forEach((v,M,j)=>{if(M-1<0||M===j.length-1)return;const L=u[M-1],E=c.getOppositeOperator(L.operator);c.compareWithNumber({operator:E,value:L.value.value},v.value.value)||(p[M]=`${n.t(`sheet.cf.form.${E}`,String(L.value.value))} `)}),p}return{}},b=(u,g)=>{C.get(f,u)!==g&&(C.set(f,u,g),S([...f]),i(I(f)))},w=u=>{y(u);const g=c.iconMap[u]||[],p=new Array(g.length).fill("").map((v,M,j)=>ir(u,M,j));S(p),i(I(p))};N.useEffect(()=>{const u=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:c.CFRuleType.iconSet,isShowValue:m,config:f}}});return()=>{u()}},[m,f,e]),N.useEffect(()=>{const u=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{u()}},[m,f,e,o]);const h=()=>{const u=f.map(g=>({...g}));f.forEach((g,p)=>{const v=f.length-1-p,M=u[v];g.iconId=M.iconId,g.iconType=M.iconType}),S([...f])},a=C.useDependency(me.ILayoutService),[s,d]=N.useState();return me.useScrollYOverContainer(s,a.rootContainerElement),x.jsxs("div",{className:k.iconSet,children:[x.jsx("div",{className:$.title,children:n.t("sheet.cf.panel.styleRule")}),x.jsx("div",{className:`
- ${$.mTSm}
- `,children:x.jsx(re.DropdownLegacy,{placement:"bottomLeft",overlay:x.jsx(ca,{ref:u=>!s&&u&&d(u),iconType:l,onClick:w}),children:x.jsxs("div",{className:k.dropdownIcon,style:{width:"unset"},children:[_,x.jsx(qt,{})]})})}),x.jsxs("div",{className:`
- ${$.mTSm}
- ${k.renderConfig}
- `,children:[x.jsxs("div",{className:k.utilItem,children:[x.jsx(re.Checkbox,{onChange:h}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),x.jsxs("div",{className:`
- ${k.utilItem}
- ${$.mLXl}
- `,children:[x.jsx(re.Checkbox,{checked:!m,onChange:u=>{T(!u)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),x.jsx(fa,{errorMap:o,onChange:b,configList:f})]})},ha=t=>{var h;const{onChange:e,interceptorManager:r}=t,n=C.useDependency(C.LocaleService),o=((h=t.rule)==null?void 0:h.type)===c.CFRuleType.highlightCell?t.rule:void 0,i=[{label:n.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:n.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:n.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:n.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[l,y]=N.useState(()=>{const a=i[0].value,s=o==null?void 0:o.type;if(!o)return a;switch(s){case c.CFRuleType.highlightCell:switch(o.subType){case c.CFSubRuleType.average:return[c.CFNumberOperator.greaterThan,c.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[c.CFNumberOperator.lessThan,c.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":a;case c.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return a}),[f,S]=N.useState(()=>{const s=o==null?void 0:o.type;if(!o)return 10;switch(s){case c.CFRuleType.highlightCell:switch(o.subType){case c.CFSubRuleType.rank:return o.value||10}}return 10}),[m,T]=N.useState(()=>{const s=o==null?void 0:o.type;if(!o)return!1;switch(s){case c.CFRuleType.highlightCell:switch(o.subType){case c.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[_,I]=N.useState({}),b=a=>{const{type:s,isPercent:d,value:R,style:u}=a;if(s==="isNotBottom")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank,isPercent:d,isBottom:!1,value:R,style:u};if(s==="isBottom")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank,isPercent:d,isBottom:!0,value:R,style:u};if(s==="greaterThanAverage")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.average,operator:c.CFNumberOperator.greaterThan,style:u};if(s==="lessThanAverage")return{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.average,operator:c.CFNumberOperator.lessThan,style:u}};N.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return b({type:l,isPercent:m,value:f,style:_})}}),[l,m,f,_,r]);const w=a=>{e(b(a))};return x.jsxs("div",{children:[x.jsx("div",{className:`
- ${$.title}
- ${$.mTBase}
- `,children:n.t("sheet.cf.panel.styleRule")}),x.jsx(re.Select,{className:`
- ${k.width100}
- ${$.mTSm}
- `,value:l,options:i,onChange:a=>{y(a),w({type:a,isPercent:m,value:f,style:_})}}),["isNotBottom","isBottom"].includes(l)&&x.jsxs("div",{className:`
- ${$.labelContainer}
- ${$.mTSm}
- `,children:[x.jsx(re.InputNumber,{min:1,max:1e3,value:f,onChange:a=>{const s=a||0;S(s),w({type:l,isPercent:m,value:s,style:_})}}),x.jsxs("div",{className:`
- ${$.mLSm}
- ${$.labelContainer}
- ${k.text}
- `,children:[x.jsx(re.Checkbox,{checked:m,onChange:a=>{T(!!a),w({type:l,isPercent:!!a,value:f,style:_})}}),n.t("sheet.cf.valueType.percent")]})]}),x.jsx("div",{className:`
- ${k.cfPreviewWrap}
- `,children:x.jsx(We,{rule:b({type:l,isPercent:m,value:f,style:_})})}),x.jsx(Rn,{style:o==null?void 0:o.style,className:`
- ${$.mTSm}
- `,onChange:a=>{I(a),w({type:l,isPercent:m,value:f,style:a})}})]})},ma=C.createInterceptorKey("beforeSubmit"),ga=C.createInterceptorKey("submit"),ar=t=>t.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),sr=t=>{var e;return(e=t.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},va=t=>{var j,U,L;const e=C.useDependency(C.LocaleService),r=C.useDependency(C.ICommandService),n=C.useDependency(C.IUniverInstanceService),o=C.useDependency(c.ConditionalFormattingRuleModel),i=C.useDependency(X.SheetsSelectionsService),l=ar(n),y=sr(n),[f,S]=N.useState(!0),m=N.useRef({}),[T,_]=N.useState(void 0),I=N.useRef((U=(j=t.rule)==null?void 0:j.ranges)!=null?U:[]),b=N.useMemo(()=>{var F,z,B;let E=(F=t.rule)==null?void 0:F.ranges;return E!=null&&E.length||(E=(B=(z=i.getCurrentSelections())==null?void 0:z.map(G=>G.range))!=null?B:[]),I.current=E,E!=null&&E.length?E.map(G=>{const te=an.serializeRange(G);return te==="NaN"?"":te}).filter(G=>!!G).join(","):""},[t.rule]),w=[{label:e.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:e.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:e.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:e.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:e.t("sheet.cf.ruleType.formula"),value:"5"},{label:e.t("sheet.cf.ruleType.iconSet"),value:"6"}],[h,a]=N.useState(()=>{var z,B;const E=(z=t.rule)==null?void 0:z.rule.type,F=w[0].value;if(!E)return F;switch(E){case c.CFRuleType.highlightCell:{switch((B=t.rule)==null?void 0:B.rule.subType){case c.CFSubRuleType.number:case c.CFSubRuleType.text:case c.CFSubRuleType.duplicateValues:case c.CFSubRuleType.uniqueValues:case c.CFSubRuleType.timePeriod:return"1";case c.CFSubRuleType.average:case c.CFSubRuleType.rank:return"2";case c.CFSubRuleType.formula:return"5"}break}case c.CFRuleType.dataBar:return"3";case c.CFRuleType.colorScale:return"4";case c.CFRuleType.iconSet:return"6"}return F}),s=N.useRef(),d=N.useMemo(()=>new C.InterceptorManager({beforeSubmit:ma,submit:ga}),[]),R=N.useMemo(()=>{switch(h){case"1":return or;case"2":return ha;case"3":return ra;case"4":return na;case"5":return sa;case"6":return pa;default:return or}},[h]);N.useEffect(()=>{const E=r.onCommandExecuted(F=>{if(F.id===X.RemoveSheetMutation.id){const z=F.params;z.subUnitId===y&&z.unitId===l&&t.onCancel()}F.id===X.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>E.dispose()},[]);const u=E=>{s.current=E},g=E=>{const F=E.split(",").filter(z=>!!z).map(an.deserializeRangeWithSheet).map(z=>z.range);I.current=F},p=()=>{if(T)return;const F=(()=>{const B=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!B)throw new Error("No active sheet found");return I.current.map(Q=>X.setEndForRange(Q,B.getRowCount(),B.getColumnCount())).filter(Q=>!(Number.isNaN(Q.startRow)||Number.isNaN(Q.startColumn)))})();if(d.fetchThroughInterceptors(d.getInterceptPoints().beforeSubmit)(!0,null)){const B=d.fetchThroughInterceptors(d.getInterceptPoints().submit)(null,null);if(B){const G=ar(n),te=sr(n);if(!G||!te)throw new Error("No active sheet found");let Q={};t.rule&&t.rule.cfId?(Q={...t.rule,ranges:F,rule:B},r.executeCommand(At.id,{unitId:G,subUnitId:te,rule:Q}),t.onCancel()):(Q={cfId:o.createCfId(G,te),ranges:F,rule:B,stopIfTrue:!1},r.executeCommand(ht.id,{unitId:G,subUnitId:te,rule:Q}),t.onCancel())}}},v=()=>{t.onCancel()},M=(E,F)=>{E?F.length<1?_(e.t("sheet.cf.errorMessage.rangeError")):_(void 0):_(e.t("sheet.cf.errorMessage.rangeError"))};return me.useSidebarClick(E=>{var z;const F=(z=m.current)==null?void 0:z.handleOutClick;F&&F(E,()=>S(!1))}),x.jsxs("div",{className:k.cfRuleStyleEditor,children:[x.jsx("div",{className:$.title,children:e.t("sheet.cf.panel.range")}),x.jsx("div",{className:`
- ${$.mTBase}
- `,children:x.jsx(pt.RangeSelector,{unitId:l,errorText:T,subUnitId:y,initValue:b,onChange:g,onVerify:M,onFocus:()=>S(!0),isFocus:f,actions:m.current})}),x.jsx("div",{className:$.title,children:e.t("sheet.cf.panel.styleType")}),x.jsx("div",{className:$.mTBase,children:x.jsx(re.Select,{className:k.width100,value:h,options:w,onChange:E=>a(E)})}),x.jsx(R,{interceptorManager:d,rule:(L=t.rule)==null?void 0:L.rule,onChange:u}),x.jsxs("div",{className:`
- ${$.mTBase}
- ${k.btnList}
- `,children:[x.jsx(re.Button,{size:"small",onClick:v,children:e.t("sheet.cf.panel.cancel")}),x.jsx(re.Button,{className:$.mLSm,size:"small",type:"primary",onClick:p,children:e.t("sheet.cf.panel.submit")})]})]})},ya=t=>{const[e,r]=N.useState(t.rule),[n,o]=N.useState(!!t.rule),i=()=>{o(!0)},l=()=>{o(!1),r(void 0)},y=f=>{r(f),o(!0)};return x.jsx("div",{className:$.conditionalFormattingWrap,children:n?x.jsx(va,{onCancel:l,rule:e}):x.jsx(_i,{onClick:y,onCreate:i})})};var Ca=Object.defineProperty,Sa=Object.getOwnPropertyDescriptor,ba=(t,e,r,n)=>{for(var o=n>1?void 0:n?Sa(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Ca(e,r,o),o},et=(t,e)=>(r,n)=>e(r,n,t);const Et="sheet.conditional.formatting.panel";let lt=class extends C.Disposable{constructor(e,r,n,o,i){super();_e(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=r,this._componentManager=n,this._sidebarService=o,this._localeService=i,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(C.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var y;l||(y=this._sidebarDisposable)==null||y.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(l=>{l.id===Et&&(l.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const r={id:Et,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Et,rule:e,key:C.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(r)}_initPanel(){this._componentManager.register(Et,ya)}};lt=ba([et(0,C.IUniverInstanceService),et(1,C.Inject(C.Injector)),et(2,C.Inject(me.ComponentManager)),et(3,C.Inject(me.ISidebarService)),et(4,C.Inject(C.LocaleService))],lt);var ve=(t=>(t[t.createRule=1]="createRule",t[t.viewRule=2]="viewRule",t[t.highlightCell=3]="highlightCell",t[t.rank=4]="rank",t[t.formula=5]="formula",t[t.colorScale=6]="colorScale",t[t.dataBar=7]="dataBar",t[t.icon=8]="icon",t[t.clearRangeRules=9]="clearRangeRules",t[t.clearWorkSheetRules=10]="clearWorkSheetRules",t))(ve||{});const vt={id:"sheet.operation.open.conditional.formatting.panel",type:C.CommandType.OPERATION,handler:(t,e)=>{var y;const r=t.get(lt),n=t.get(X.SheetsSelectionsService),o=t.get(C.ICommandService),i=((y=n.getCurrentSelections())==null?void 0:y.map(f=>f.range))||[];switch(e.value){case 3:{r.openPanel({...c.createDefaultRule(),ranges:i});break}case 4:{const f={...c.createDefaultRule,ranges:i,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.rank}};r.openPanel(f);break}case 5:{const f={...c.createDefaultRule,ranges:i,rule:{type:c.CFRuleType.highlightCell,subType:c.CFSubRuleType.formula,value:"="}};r.openPanel(f);break}case 6:{const f={...c.createDefaultRule,ranges:i,rule:{type:c.CFRuleType.colorScale,config:[]}};r.openPanel(f);break}case 7:{const f={...c.createDefaultRule,ranges:i,rule:{type:c.CFRuleType.dataBar,isShowValue:!0}};r.openPanel(f);break}case 8:{const f={...c.createDefaultRule,ranges:i,rule:{type:c.CFRuleType.iconSet,config:[],isShowValue:!0}};r.openPanel(f);break}case 2:{r.openPanel();break}case 1:{r.openPanel({...c.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand($t.id,{ranges:i});break}case 10:{o.executeCommand(mt.id);break}}return!0}};var Ra=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Ia=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ta(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Ra(e,r,o),o},tt=(t,e)=>(r,n)=>e(r,n,t);let ut=class extends C.Disposable{constructor(e,r,n,o,i){super();_e(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=r,this._injector=n,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:c.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,r,n)=>this._collectConditionalRule(e,r,n),onPasteCells:(e,r,n,o)=>{const{copyType:i=ce.COPY_TYPE.COPY,pasteType:l}=o,{range:y}=e||{},{range:f}=r;return this._generateConditionalFormattingMutations(f,{copyType:i,pasteType:l,copyRange:y})}}))}_collectConditionalRule(e,r,n){const o=new C.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:e,subUnitId:r,cfMap:i}};const l=this._injector.invoke(m=>ce.rangeToDiscreteRange(n,m,e,r));if(!l)return;const{rows:y,cols:f}=l,S=new Set;y.forEach((m,T)=>{f.forEach((_,I)=>{const b=this._conditionalFormattingViewModel.getCellCfs(e,r,m,_);b&&(b.forEach(w=>S.add(w.cfId)),o.setValue(T,I,b.map(w=>w.cfId)))})}),S.forEach(m=>{const T=this._conditionalFormattingRuleModel.getRule(e,r,m);T&&(i[m]=T.rule)})}_generateConditionalFormattingMutations(e,r){const n=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),o=n.getActiveSheet(),i=n.getUnitId();if(!o)return{redos:[],undos:[]};const l=o.getSheetId();if(r.copyType===ce.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!r.copyRange)return{redos:[],undos:[]};if(![ce.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,ce.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,ce.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(r.pasteType))return{redos:[],undos:[]};const{ranges:[f,S],mapFunc:m}=ce.virtualizeDiscreteRanges([r.copyRange,e]),T=ce.getRepeatRange(f,S,!0),_={};C.Range.foreach(S,(u,g)=>{const{row:p,col:v}=m(u,g),M=this._conditionalFormattingViewModel.getCellCfs(i,l,p,v);M&&M.forEach(j=>{if(!_[j.cfId]){const U=new C.ObjectMatrix;_[j.cfId]=U;const L=this._conditionalFormattingRuleModel.getRule(i,l,j.cfId);L==null||L.ranges.forEach(E=>{C.Range.foreach(E,(F,z)=>{U.setValue(F,z,1)})})}_[j.cfId].realDeleteValue(p,v)})});const{matrix:I,info:b}=this._copyInfo,w=[];let h=this._conditionalFormattingRuleModel.createCfId(i,l);const a={},s=u=>{if(a[u])return a[u];const g=b==null?void 0:b.cfMap[u],p=[...this._conditionalFormattingRuleModel.getSubunitRules(i,l)||[],...w].find(v=>C.Tools.diffValue(v.rule,g));if(p)return a[u]=p,p;{const v={rule:g,cfId:h,ranges:[],stopIfTrue:!1};return a[u]=v,w.push(v),h=`${Number(h)+1}`,v}};T.forEach(u=>{I&&I.forValue((g,p,v)=>{const M=C.Rectangle.getPositionRange({startRow:g,endRow:g,startColumn:p,endColumn:p},u.startRange),{row:j,col:U}=m(M.startRow,M.startColumn);v.forEach(L=>{if(!_[L]){const E=s(L),F=new C.ObjectMatrix;_[L]=F,E.ranges.forEach(z=>{C.Range.foreach(z,(B,G)=>{F.setValue(B,G,1)})})}_[L].setValue(j,U,1)})})});const d=[],R=[];for(const u in _){const g=_[u],p=X.findAllRectangle(X.createTopMatrixFromMatrix(g));if(!p.length){const v={unitId:i,subUnitId:l,cfId:u};d.push({id:c.DeleteConditionalRuleMutation.id,params:v}),R.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,v))}if(w.some(v=>v.cfId===u)){const v=s(u),M={unitId:i,subUnitId:l,rule:{...v,ranges:p}};d.push({id:c.AddConditionalRuleMutation.id,params:M}),R.push(c.AddConditionalRuleMutationUndoFactory(this._injector,M))}else{const v=this._conditionalFormattingRuleModel.getRule(i,l,u);if(!v)continue;const M={unitId:i,subUnitId:l,rule:{...v,ranges:p}};d.push({id:c.SetConditionalRuleMutation.id,params:M}),R.push(...c.setConditionalRuleMutationUndoFactory(this._injector,M))}}return{redos:d,undos:R}}};ut=Ia([tt(0,C.Inject(ce.ISheetClipboardService)),tt(1,C.Inject(c.ConditionalFormattingRuleModel)),tt(2,C.Inject(C.Injector)),tt(3,C.Inject(c.ConditionalFormattingViewModel)),tt(4,C.Inject(C.IUniverInstanceService))],ut);var wa=Object.defineProperty,_a=Object.getOwnPropertyDescriptor,xa=(t,e,r,n)=>{for(var o=n>1?void 0:n?_a(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&wa(e,r,o),o},tn=(t,e)=>(r,n)=>e(r,n,t);let ct=class extends C.Disposable{constructor(t,e,r){super(),this._localeService=t,this._commandService=e,this._sheetPermissionCheckController=r,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===ht.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[X.WorkbookEditablePermission],rangeTypes:[X.RangeProtectionPermissionEditPoint],worksheetTypes:[X.WorksheetEditPermission,X.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};ct=xa([tn(0,C.Inject(C.LocaleService)),tn(1,C.ICommandService),tn(2,C.Inject(X.SheetPermissionCheckController))],ct);var Ea=Object.defineProperty,Oa=Object.getOwnPropertyDescriptor,Pa=(t,e,r,n)=>{for(var o=n>1?void 0:n?Oa(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Ea(e,r,o),o},Ot=(t,e)=>(r,n)=>e(r,n,t);let dt=class extends C.Disposable{constructor(t,e,r,n){super(),this._conditionalFormattingRuleModel=t,this._univerInstanceService=e,this._injector=r,this._refRangeService=n,this._initRefRange()}_initRefRange(){const t=new Map,e=(n,o,i)=>`${n}_${o}_${i}`,r=(n,o,i)=>{const l=f=>{const S=[...i.ranges],m=S.map(_=>X.handleDefaultRangeChangeWithEffectRefCommands(_,f)).filter(_=>!!_);if(c.isRangesEqual(m,S))return{redos:[],undos:[]};if(m.length){const _={unitId:n,subUnitId:o,rule:{...i,ranges:m}},I=[{id:c.SetConditionalRuleMutation.id,params:_}],b=c.setConditionalRuleMutationUndoFactory(this._injector,_);return{redos:I,undos:b}}else{const _={unitId:n,subUnitId:o,cfId:i.cfId},I=[{id:c.DeleteConditionalRuleMutation.id,params:_}],b=c.DeleteConditionalRuleMutationUndoFactory(this._injector,_);return{redos:I,undos:b}}},y=[];i.ranges.forEach(f=>{const S=this._refRangeService.registerRefRange(f,l);y.push(()=>S.dispose())}),t.set(e(n,o,i.cfId),()=>y.forEach(f=>f()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:o,subUnitId:i,rule:l}=n,y=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),f=y.getActiveSheet();if(!(n.unitId!==y.getUnitId()||n.subUnitId!==(f==null?void 0:f.getSheetId())))switch(n.type){case"add":{r(n.unitId,n.subUnitId,n.rule);break}case"delete":{const S=t.get(e(o,i,l.cfId));S&&S();break}case"set":{const S=t.get(e(o,i,l.cfId));S&&S(),r(n.unitId,n.subUnitId,n.rule)}}})),this.disposeWithMe(C.toDisposable(()=>{t.forEach(n=>{n()}),t.clear()}))}};dt=Pa([Ot(0,C.Inject(c.ConditionalFormattingRuleModel)),Ot(1,C.Inject(C.IUniverInstanceService)),Ot(2,C.Inject(C.Injector)),Ot(3,C.Inject(X.RefRangeService))],dt);var Ma=Object.defineProperty,Fa=Object.getOwnPropertyDescriptor,Da=(t,e,r,n)=>{for(var o=n>1?void 0:n?Fa(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Ma(e,r,o),o},Ue=(t,e)=>(r,n)=>e(r,n,t);let ft=class extends C.Disposable{constructor(e,r,n,o,i,l){super();_e(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=r,this._univerInstanceService=n,this._renderManagerService=o,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=l,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var r,n,o;const e=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId();(r=this._renderManagerService.getRenderById(e))==null||r.with(ce.SheetSkeletonManagerService).reCalculate(),(o=(n=this._renderManagerService.getRenderById(e))==null?void 0:n.mainComponent)==null||o.makeDirty()}_initSkeleton(){this.disposeWithMe(be.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(at.bufferTime(16),at.filter(e=>!!e.length),at.filter(e=>{const r=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const n=r.getActiveSheet();return n?e.filter(o=>o.unitId===r.getUnitId()&&o.subUnitId===n.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(X.INTERCEPTOR_POINT.CELL_CONTENT,{effect:C.InterceptorEffectEnum.Style,handler:(e,r,n)=>{const o=this._conditionalFormattingService.composeStyle(r.unitId,r.subUnitId,r.row,r.col);if(!o)return n(e);const i=r.workbook.getStyles(),y={...(typeof(e==null?void 0:e.s)=="string"?i.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},f={...e,s:y};return o.style&&Object.assign(y,o.style),f.fontRenderExtension||(f.fontRenderExtension={},o.isShowValue!==void 0&&(f.fontRenderExtension.isSkip=!o.isShowValue)),o.dataBar&&(f.dataBar=o.dataBar),o.iconSet&&(f.iconSet=o.iconSet,f.fontRenderExtension.leftOffset=c.DEFAULT_PADDING+c.DEFAULT_WIDTH),n(f)},priority:10}))}};ft=Da([Ue(0,C.Inject(X.SheetInterceptorService)),Ue(1,C.Inject(c.ConditionalFormattingService)),Ue(2,C.Inject(C.IUniverInstanceService)),Ue(3,C.Inject(pr.IRenderManagerService)),Ue(4,C.Inject(c.ConditionalFormattingViewModel)),Ue(5,C.Inject(c.ConditionalFormattingRuleModel))],ft);const Dr="sheets-conditional-formatting-ui.config",Dt={};var Nr=Object.defineProperty,Na=Object.getOwnPropertyDescriptor,ja=(t,e,r)=>e in t?Nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,La=(t,e,r,n)=>{for(var o=n>1?void 0:n?Na(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Nr(e,r,o),o},nn=(t,e)=>(r,n)=>e(r,n,t),jr=(t,e,r)=>ja(t,typeof e!="symbol"?e+"":e,r);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends C.Plugin{constructor(e=Dt,r,n,o){super(),this._config=e,this._injector=r,this._commandService=n,this._configService=o;const{menu:i,...l}=C.merge({},Dt,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Dr,l),this._initCommand(),this._injector.add([ft]),this._injector.add([dt]),this._injector.add([ut]),this._injector.add([ct]),this._injector.add([ze])}_initCommand(){[ln,un,cn,dn,fn,pn,hn,mn,gn,vt,st,At,zt,ht,$t,mt].forEach(e=>{this._commandService.registerCommand(e)})}};jr(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${c.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);jr(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",C.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=La([C.DependentOn(c.UniverSheetsConditionalFormattingPlugin),nn(1,C.Inject(C.Injector)),nn(2,C.Inject(C.ICommandService)),nn(3,C.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var Ua=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,$a=(t,e,r,n)=>{for(var o=n>1?void 0:n?Va(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Ua(e,r,o),o},nt=(t,e)=>(r,n)=>e(r,n,t);let Nt=class extends C.Disposable{constructor(t,e,r,n,o){super(),this._injector=t,this._univerInstanceService=e,this._autoFillService=r,this._conditionalFormattingRuleModel=n,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(o,i,l,y,f)=>{var I;const S=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getUnitId(),m=(I=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:I.getSheetId();if(!S||!m)return;const T={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},_={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};C.Range.foreach(l,(b,w)=>{const h=C.Rectangle.getPositionRange({startRow:b,startColumn:w,endColumn:w,endRow:b},T),a=C.Rectangle.getPositionRange({startRow:b,startColumn:w,endColumn:w,endRow:b},_),{row:s,col:d}=f(h.startRow,h.startColumn),R=this._conditionalFormattingViewModel.getCellCfs(S,m,s,d),{row:u,col:g}=f(a.startRow,a.startColumn),p=this._conditionalFormattingViewModel.getCellCfs(S,m,u,g);p&&p.forEach(v=>{let M=y.get(v.cfId);if(!y.get(v.cfId)){const j=this._conditionalFormattingRuleModel.getRule(S,m,v.cfId);if(!j)return;M=new C.ObjectMatrix,j.ranges.forEach(U=>{C.Range.foreach(U,(L,E)=>{M.setValue(L,E,1)})}),y.set(v.cfId,M)}M.realDeleteValue(u,g)}),R&&R.forEach(v=>{let M=y.get(v.cfId);if(!y.get(v.cfId)){const j=this._conditionalFormattingRuleModel.getRule(S,m,v.cfId);if(!j)return;M=new C.ObjectMatrix,j.ranges.forEach(U=>{C.Range.foreach(U,(L,E)=>{M.setValue(L,E,1)})}),y.set(v.cfId,M)}M.setValue(u,g,1)})})},r=(o,i)=>{var a,s,d;const l=(a=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getUnitId(),y=(d=(s=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getActiveSheet())==null?void 0:d.getSheetId(),f=new Map,S=[],m=[];if(!l||!y)return t();const T=ce.virtualizeDiscreteRanges([o,i]),[_,I]=T.ranges,{mapFunc:b}=T,w={row:_.startRow,col:_.startColumn};return ce.getAutoFillRepeatRange(_,I).forEach(R=>{e(w,R.repeatStartCell,R.relativeRange,f,b)}),f.forEach((R,u)=>{const g=this._conditionalFormattingRuleModel.getRule(l,y,u);if(!g)return;const p=X.findAllRectangle(X.createTopMatrixFromMatrix(R));if(p.length){const v={unitId:l,subUnitId:y,rule:{...g,ranges:p}};S.push({id:c.SetConditionalRuleMutation.id,params:v}),m.push(...c.setConditionalRuleMutationUndoFactory(this._injector,v))}else{const v={unitId:l,subUnitId:y,cfId:g.cfId};S.push({id:c.DeleteConditionalRuleMutation.id,params:v}),m.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,v))}}),{undos:m,redos:S}},n={id:c.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,l)=>{if(l===ce.APPLY_TYPE.COPY||l===ce.APPLY_TYPE.ONLY_FORMAT||l===ce.APPLY_TYPE.SERIES){const{source:y,target:f}=o;return r(y,f)}return t()}};this.disposeWithMe(this._autoFillService.addHook(n))}};Nt=$a([nt(0,C.Inject(C.Injector)),nt(1,C.Inject(C.IUniverInstanceService)),nt(2,C.Inject(ce.IAutoFillService)),nt(3,C.Inject(c.ConditionalFormattingRuleModel)),nt(4,C.Inject(c.ConditionalFormattingViewModel))],Nt);var za=Object.defineProperty,Aa=Object.getOwnPropertyDescriptor,qa=(t,e,r,n)=>{for(var o=n>1?void 0:n?Aa(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&za(e,r,o),o},rt=(t,e)=>(r,n)=>e(r,n,t);exports.ConditionalFormattingClearController=class extends C.Disposable{constructor(e,r,n,o,i){super(),this._injector=e,this._univerInstanceService=r,this._sheetInterceptorService=n,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var i;const r=[],n=[],o={redos:r,undos:n};if([X.ClearSelectionFormatCommand.id,X.ClearSelectionAllCommand.id].includes(e.id)){const l=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(b=>b.range);if(!l)return o;const y=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),f=y.getActiveSheet();if(!f)return o;const S=y.getUnitId(),m=f.getSheetId(),T=this._conditionalFormattingRuleModel.getSubunitRules(S,m);if(!T||!T.length)return o;const{redos:_,undos:I}=lr(this._injector,T,l,S,m);r.push(..._),n.push(...I)}return o}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:r,ranges:n})=>{const o=[],i=[],l={redos:o,undos:i};if(!n||!n.length)return l;const y=this._conditionalFormattingRuleModel.getSubunitRules(e,r);if(!y||!y.length)return l;const{redos:f,undos:S}=lr(this._injector,y,n,e,r);return o.push(...f),i.push(...S),l}}))}};exports.ConditionalFormattingClearController=qa([rt(0,C.Inject(C.Injector)),rt(1,C.Inject(C.IUniverInstanceService)),rt(2,C.Inject(X.SheetInterceptorService)),rt(3,C.Inject(X.SheetsSelectionsService)),rt(4,C.Inject(c.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function lr(t,e,r,n,o){const i=[],l=[];return e.filter(y=>r.some(f=>y.ranges.some(S=>C.Rectangle.getIntersects(S,f)))).forEach(y=>{const S=new X.RangeMergeUtil().add(...y.ranges).subtract(...r).merge();if(S.length){const m={id:c.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:o,rule:{...y,ranges:S}}},T=c.setConditionalRuleMutationUndoFactory(t,m.params);i.push(m),l.push(...T)}else{const m={id:c.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:o,cfId:y.cfId}},T=c.DeleteConditionalRuleMutationUndoFactory(t,m.params);i.push(m),l.push(...T)}}),{redos:i,undos:l}}var Wa=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,ka=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ha(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Wa(e,r,o),o},ur=(t,e)=>(r,n)=>e(r,n,t);let jt=class extends C.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(C.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(X.AFTER_CELL_EDIT,{handler:(t,e,r)=>{var l,y,f;t||r(t);const n=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),o=(l=n==null?void 0:n.style)!=null?l:{},i=Object.keys(o);if(t!=null&&t.p)return(f=(y=t.p.body)==null?void 0:y.textRuns)==null||f.forEach(S=>{S.ts&&i.forEach(m=>{var T;(T=S.ts)==null||delete T[m]})}),r(t);{const S={...(typeof(t==null?void 0:t.s)=="string"?e.workbook.getStyles().get(t.s):t==null?void 0:t.s)||{}};i.forEach(T=>{delete S[T]});const m={...t,s:{...S}};return r(m)}}})))}};jt=ka([ur(0,C.Inject(X.SheetInterceptorService)),ur(1,C.Inject(c.ConditionalFormattingService))],jt);const cr=[X.SetWorksheetActiveOperation.id,c.AddConditionalRuleMutation.id,c.SetConditionalRuleMutation.id,c.DeleteConditionalRuleMutation.id,c.MoveConditionalRuleMutation.id],ot=[{label:"sheet.cf.ruleType.highlightCell",value:ve.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:ve.rank},{label:"sheet.cf.ruleType.formula",value:ve.formula},{label:"sheet.cf.ruleType.colorScale",value:ve.colorScale},{label:"sheet.cf.ruleType.dataBar",value:ve.dataBar},{label:"sheet.cf.ruleType.iconSet",value:ve.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:ve.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:ve.createRule},{label:"sheet.cf.menu.clearRangeRules",value:ve.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:ve.clearWorkSheetRules}],Ba=t=>{const e=t.get(X.SheetsSelectionsService),r=t.get(C.ICommandService),n=t.get(C.IUniverInstanceService),o=t.get(c.ConditionalFormattingRuleModel),i=new be.Observable(f=>be.merge(e.selectionMoveEnd$,e.selectionSet$,new be.Observable(S=>{const m=r.onCommandExecuted(T=>{var w;const{id:_,params:I}=T,b=(w=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getUnitId();cr.includes(_)&&I.unitId===b&&S.next(null)});return()=>m.dispose()})).pipe(at.debounceTime(16)).subscribe(()=>{var w;const S=((w=e.getCurrentSelections())==null?void 0:w.map(h=>h.range))||[],m=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET);if(!m)return;const T=m.getActiveSheet();if(!T)return;const b=(o.getSubunitRules(m.getUnitId(),T.getSheetId())||[]).filter(h=>h.ranges.some(a=>S.some(s=>C.Rectangle.intersects(s,a)))).map(h=>h.ranges).every(h=>X.checkRangesEditablePermission(t,m.getUnitId(),T.getSheetId(),h));f.next(b)})),l=new be.Observable(f=>new be.Observable(S=>{const m=r.onCommandExecuted(T=>{var w;const{id:_,params:I}=T,b=(w=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getUnitId();cr.includes(_)&&I.unitId===b&&S.next(null)});return()=>m.dispose()}).pipe(at.debounceTime(16)).subscribe(()=>{const S=n.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET);if(!S)return;const m=S.getActiveSheet();if(!m)return;const T=o.getSubunitRules(S.getUnitId(),m.getSheetId())||[];if(!T.length)return f.next(!1),!1;const _=T.map(I=>I.ranges).every(I=>X.checkRangesEditablePermission(t,S.getUnitId(),m.getSheetId(),I));f.next(_)})),y=new be.Observable(f=>{i.subscribe(S=>{const m=ot.find(T=>T.value===ve.clearRangeRules);m&&(m.disabled=!S,f.next(ot))}),l.subscribe(S=>{const m=ot.find(T=>T.value===ve.clearWorkSheetRules);m&&(m.disabled=!S,f.next(ot))}),f.next(ot)});return{id:vt.id,type:me.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:y,hidden$:me.getMenuHiddenObservable(t,C.UniverInstanceType.UNIVER_SHEET),disabled$:ce.getCurrentRangeDisable$(t,{workbookTypes:[X.WorkbookEditablePermission],worksheetTypes:[X.WorksheetSetCellStylePermission,X.WorksheetEditPermission],rangeTypes:[X.RangeProtectionPermissionEditPoint]})}},Ga={[me.RibbonStartGroup.FORMULAS_INSERT]:{[vt.id]:{order:0,menuItemFactory:Ba}}};var Xa=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,Ka=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ya(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Xa(e,r,o),o},dr=(t,e)=>(r,n)=>e(r,n,t);let Lt=class extends C.Disposable{constructor(e,r){super();_e(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=r,this._menuManagerService.mergeMenu(Ga)}};Lt=Ka([dr(0,C.Inject(C.Injector)),dr(1,me.IMenuManagerService)],Lt);var Za=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,Qa=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ja(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Za(e,r,o),o},Ve=(t,e)=>(r,n)=>e(r,n,t);const es=(t,e)=>{const r=m=>m.endRow-m.startRow+1,n=m=>m.endColumn-m.startColumn+1,o=r(e)%r(t),i=n(e)%n(t),l=Math.floor(r(e)/r(t)),y=Math.floor(n(e)/n(t)),f=[],S={startRow:0,endRow:r(t)-1,startColumn:0,endColumn:n(t)-1};if(r(e)===1&&n(e)===1){const m={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return f.push({repeatRelativeRange:S,startRange:m}),f}for(let m=0;m<l+(o?.1:0);m++)for(let T=0;T<y+(i?.1:0);T++){const _=r(t)*m,I=n(t)*T,b={startRow:_+e.startRow,endRow:_+e.startRow,startColumn:I+e.startColumn,endColumn:I+e.startColumn};let w=S;m===l&&o&&(w={...w},w.endRow=w.endRow-(r(t)-o)),T===y&&i&&(w={...w},w.endColumn=w.endColumn-(n(t)-i)),f.push({repeatRelativeRange:w,startRange:b})}return f};let Ut=class extends C.Disposable{constructor(e,r,n,o,i,l){super();_e(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=r,this._formatPainterService=n,this._sheetsSelectionsService=o,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=l,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),r=(i,l,y,f,S)=>{const{unitId:m,subUnitId:T}=this._painterConfig,{targetUnitId:_,targetSubUnitId:I}=S,b={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row},w={startRow:l.row,startColumn:l.col,endColumn:l.col,endRow:l.row};C.Range.foreach(y,(h,a)=>{const s=C.Rectangle.getPositionRange({startRow:h,startColumn:a,endColumn:a,endRow:h},b),d=C.Rectangle.getPositionRange({startRow:h,startColumn:a,endColumn:a,endRow:h},w),R=this._conditionalFormattingViewModel.getCellCfs(m,T,s.startRow,s.startColumn),u=this._conditionalFormattingViewModel.getCellCfs(_,I,d.startRow,d.startColumn);u&&u.forEach(g=>{let p=f.get(g.cfId);if(!f.get(g.cfId)){const v=this._conditionalFormattingRuleModel.getRule(_,I,g.cfId);if(!v)return;p=new C.ObjectMatrix,v.ranges.forEach(M=>{C.Range.foreach(M,(j,U)=>{p.setValue(j,U,1)})}),f.set(g.cfId,p)}p.realDeleteValue(d.startRow,d.startColumn)}),R&&R.forEach(g=>{const p=f.get(g.cfId);p&&p.setValue(d.startRow,d.startColumn,1)})})},n=(i,l,y)=>{var s;const{range:f,unitId:S,subUnitId:m}=this._painterConfig,T=i!==S||m!==l,_=new Map,I=[],b=[];if(!i||!l||!S||!m)return e();const w=(s=this._conditionalFormattingRuleModel.getSubunitRules(S,m))!=null?s:[];w==null||w.forEach(d=>{const{ranges:R,cfId:u}=d;if(R.some(g=>C.Rectangle.intersects(f,g))){const g=new C.ObjectMatrix;T||R.forEach(p=>{C.Range.foreach(p,(v,M)=>{g.setValue(v,M,1)})}),_.set(u,g)}});const h={row:f.startRow,col:f.startColumn};return es(f,y).forEach(d=>{r(h,{row:d.startRange.startRow,col:d.startRange.startColumn},d.repeatRelativeRange,_,{targetUnitId:i,targetSubUnitId:l})}),_.forEach((d,R)=>{if(T){const u=this._conditionalFormattingRuleModel.getRule(i,l,R),g=X.findAllRectangle(X.createTopMatrixFromMatrix(d));if(u)if(g.length){const p={unitId:i,subUnitId:l,rule:{...u,ranges:g}};I.push({id:c.SetConditionalRuleMutation.id,params:p}),b.push(...c.setConditionalRuleMutationUndoFactory(this._injector,p))}else{const p={unitId:i,subUnitId:l,cfId:u.cfId};I.push({id:c.DeleteConditionalRuleMutation.id,params:p}),b.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,p))}else if(g.length){const p=this._conditionalFormattingRuleModel.getRule(S,m,R);if(p){const v={unitId:i,subUnitId:l,rule:{...C.Tools.deepClone(p),cfId:this._conditionalFormattingRuleModel.createCfId(i,l),ranges:g}};I.push({id:c.AddConditionalRuleMutation.id,params:v}),b.push(c.AddConditionalRuleMutationUndoFactory(this._injector,v))}}}else{const u=this._conditionalFormattingRuleModel.getRule(S,m,R);if(!u)return;const g=X.findAllRectangle(X.createTopMatrixFromMatrix(d));if(g.length){const p={unitId:S,subUnitId:m,rule:{...u,ranges:g}};I.push({id:c.SetConditionalRuleMutation.id,params:p}),b.push(...c.setConditionalRuleMutationUndoFactory(this._injector,p))}else{const p={unitId:S,subUnitId:m,cfId:u.cfId};I.push({id:c.DeleteConditionalRuleMutation.id,params:p}),b.push(...c.DeleteConditionalRuleMutationUndoFactory(this._injector,p))}}}),{undos:b,redos:I}},o={id:c.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:i=>{var l,y,f;switch(i){case ce.FormatPainterStatus.INFINITE:case ce.FormatPainterStatus.ONCE:{const S=(l=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET))==null?void 0:l.getUnitId(),m=(f=(y=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getActiveSheet())==null?void 0:f.getSheetId(),T=this._sheetsSelectionsService.getCurrentLastSelection(),_=T==null?void 0:T.range;S&&m&&_&&(this._painterConfig={unitId:S,subUnitId:m,range:_});break}case ce.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(i,l,y)=>this._painterConfig?n(i,l,y):{redos:[],undos:[]}};this._formatPainterService.addHook(o)}};Ut=Qa([Ve(0,C.Inject(C.Injector)),Ve(1,C.Inject(C.IUniverInstanceService)),Ve(2,C.Inject(ce.IFormatPainterService)),Ve(3,C.Inject(X.SheetsSelectionsService)),Ve(4,C.Inject(c.ConditionalFormattingRuleModel)),Ve(5,C.Inject(c.ConditionalFormattingViewModel))],Ut);var ts=Object.defineProperty,ns=Object.getOwnPropertyDescriptor,rs=(t,e,r,n)=>{for(var o=n>1?void 0:n?ns(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&ts(e,r,o),o},rn=(t,e)=>(r,n)=>e(r,n,t);let Vt=class extends C.Disposable{constructor(t,e,r){super(),this._conditionalFormattingViewModel=t,this._univerInstanceService=e,this._renderManagerService=r,this._init()}_init(){const t=this._univerInstanceService.getCurrentUnitForType(C.UniverInstanceType.UNIVER_SHEET),e=r=>{const n=r.getUnitId(),o=this._renderManagerService.getRenderById(n);if(!o)return;const i=o.with(ce.SheetSkeletonManagerService);this.disposeWithMe(i.currentSkeleton$.subscribe(l=>{if(l){const y=l.skeleton.rowColumnSegment,f=y.endColumn-y.startColumn+1,m=(y.endRow-y.startRow+1)*f*9,T=Math.max(c.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,m);this._conditionalFormattingViewModel.setCacheLength(T)}}))};t&&e(t),this._univerInstanceService.getCurrentTypeOfUnit$(C.UniverInstanceType.UNIVER_SHEET).subscribe(r=>{r&&e(r)})}};Vt=rs([rn(0,C.Inject(c.ConditionalFormattingViewModel)),rn(1,C.IUniverInstanceService),rn(2,pr.IRenderManagerService)],Vt);var Lr=Object.defineProperty,os=Object.getOwnPropertyDescriptor,is=(t,e,r)=>e in t?Lr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,as=(t,e,r,n)=>{for(var o=n>1?void 0:n?os(e,r):e,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=(n?l(e,r,o):l(o))||o);return n&&o&&Lr(e,r,o),o},on=(t,e)=>(r,n)=>e(r,n,t),Ur=(t,e,r)=>is(t,typeof e!="symbol"?e+"":e,r);exports.UniverSheetsConditionalFormattingUIPlugin=class extends C.Plugin{constructor(e=Dt,r,n,o){super(),this._config=e,this._injector=r,this._commandService=n,this._configService=o;const{menu:i,...l}=C.merge({},Dt,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Dr,l),this._initCommand()}onStarting(){C.registerDependencies(this._injector,[[ft],[dt],[ut],[Nt],[ct],[lt],[Lt],[ze],[jt],[exports.ConditionalFormattingClearController],[Ut],[Vt]]),C.touchDependencies(this._injector,[[ft]])}onReady(){C.touchDependencies(this._injector,[[Lt],[lt]])}onRendered(){C.touchDependencies(this._injector,[[Nt],[exports.ConditionalFormattingClearController],[ut],[jt],[ze],[Ut],[ct],[dt],[Vt]])}_initCommand(){[ln,un,cn,dn,fn,pn,hn,mn,gn,vt,st,At,zt,ht,$t,mt].forEach(e=>{this._commandService.registerCommand(e)})}};Ur(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${c.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Ur(exports.UniverSheetsConditionalFormattingUIPlugin,"type",C.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=as([C.DependentOn(c.UniverSheetsConditionalFormattingPlugin),on(1,C.Inject(C.Injector)),on(2,C.Inject(C.ICommandService)),on(3,C.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=ln;exports.AddCfCommand=ht;exports.AddColorScaleConditionalRuleCommand=un;exports.AddDataBarConditionalRuleCommand=cn;exports.AddDuplicateValuesCfCommand=dn;exports.AddNumberCfCommand=fn;exports.AddRankCfCommand=pn;exports.AddTextCfCommand=hn;exports.AddTimePeriodCfCommand=mn;exports.AddUniqueValuesCfCommand=gn;exports.ClearRangeCfCommand=$t;exports.ClearWorksheetCfCommand=mt;exports.DeleteCfCommand=st;exports.MoveCfCommand=zt;exports.OpenConditionalFormattingOperator=vt;exports.SetCfCommand=At;
|