@univerjs/sheets-conditional-formatting-ui 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,170 +1,153 @@
1
- "use strict";var xr=Object.defineProperty;var Ir=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ie=(t,e,r)=>Ir(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("@univerjs/core"),u=require("@univerjs/sheets-conditional-formatting"),Y=require("@univerjs/sheets"),ee=require("@univerjs/ui"),I=require("react/jsx-runtime"),j=require("react"),Q=require("@univerjs/design"),Yt=require("@univerjs/engine-formula"),de=require("@univerjs/sheets-ui"),tr=require("react-dom"),Se=require("rxjs"),dt=require("@univerjs/sheets-formula-ui"),nr=require("@univerjs/engine-render"),it=require("rxjs/operators"),Zt={type:x.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,c=t.get(u.ConditionalFormattingRuleModel),y=t.get(x.ICommandService),p=t.get(x.IUniverInstanceService),S=Y.getSheetCommandTarget(p);if(!S)return!1;const{unitId:v,subUnitId:T}=S,_=c.createCfId(v,T),w={ranges:r,cfId:_,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:i,style:n}};return y.executeCommand(u.AddConditionalRuleMutation.id,{unitId:v,subUnitId:T,rule:w})}},Jt={type:x.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(u.ConditionalFormattingRuleModel),c=t.get(x.ICommandService),y=t.get(x.IUniverInstanceService),p=Y.getSheetCommandTarget(y);if(!p)return!1;const{unitId:S,subUnitId:v}=p,T=i.createCfId(S,v),_={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:u.CFRuleType.colorScale,config:n}};return c.executeCommand(u.AddConditionalRuleMutation.id,{unitId:S,subUnitId:v,rule:_})}},Qt={type:x.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:c,isGradient:y,stopIfTrue:p,isShowValue:S}=e,v=t.get(u.ConditionalFormattingRuleModel),T=t.get(x.IUniverInstanceService),_=Y.getSheetCommandTarget(T);if(!_)return!1;const{unitId:w,subUnitId:b}=_,R=t.get(x.ICommandService),h=v.createCfId(w,b),a={ranges:r,cfId:h,stopIfTrue:!!p,rule:{type:u.CFRuleType.dataBar,isShowValue:S,config:{min:n,max:o,nativeColor:i,positiveColor:c,isGradient:y}}};return R.executeCommand(u.AddConditionalRuleMutation.id,{unitId:w,subUnitId:b,rule:a})}},en={type:x.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(u.ConditionalFormattingRuleModel),c=t.get(x.ICommandService),y=t.get(x.IUniverInstanceService),p=Y.getSheetCommandTarget(y);if(!p)return!1;const{unitId:S,subUnitId:v}=p,T=i.createCfId(S,v),_={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.duplicateValues,style:n}};return c.executeCommand(u.AddConditionalRuleMutation.id,{unitId:S,subUnitId:v,rule:_})}},tn={type:x.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:c}=e,y=t.get(u.ConditionalFormattingRuleModel),p=t.get(x.ICommandService),S=t.get(x.IUniverInstanceService),v=Y.getSheetCommandTarget(S);if(!v)return!1;const{unitId:T,subUnitId:_}=v,w=y.createCfId(T,_);let b;if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(i)){const R=c;if(R.length!==2||!Array.isArray(R))return!1;b={ranges:r,cfId:w,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:i,style:n,value:R}}}else{const R=c;if(typeof R!="number")return!1;b={ranges:r,cfId:w,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:i,style:n,value:R}}}return p.executeCommand(u.AddConditionalRuleMutation.id,{unitId:T,subUnitId:_,rule:b})}},nn={type:x.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:c,value:y}=e,p=t.get(u.ConditionalFormattingRuleModel),S=t.get(x.IUniverInstanceService),v=t.get(x.ICommandService),T=Y.getSheetCommandTarget(S);if(!T)return!1;const{unitId:_,subUnitId:w}=T,b=p.createCfId(_,w),R={ranges:r,cfId:b,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:i,isBottom:c,style:n,value:y}};return v.executeCommand(u.AddConditionalRuleMutation.id,{unitId:_,subUnitId:w,rule:R})}},rn={type:x.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:c}=e,y=t.get(u.ConditionalFormattingRuleModel),p=t.get(x.IUniverInstanceService),S=Y.getSheetCommandTarget(p);if(!S)return!1;const{unitId:v,subUnitId:T}=S,_=t.get(x.ICommandService),w=y.createCfId(v,T),b={ranges:r,cfId:w,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.text,operator:i,style:n,value:c}};return _.executeCommand(u.AddConditionalRuleMutation.id,{unitId:v,subUnitId:T,rule:b})}},on={type:x.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,c=t.get(u.ConditionalFormattingRuleModel),y=t.get(x.IUniverInstanceService),p=t.get(x.ICommandService),S=Y.getSheetCommandTarget(y);if(!S)return!1;const{unitId:v,subUnitId:T}=S,_=c.createCfId(v,T),w={ranges:r,cfId:_,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.timePeriod,operator:i,style:n}};return p.executeCommand(u.AddConditionalRuleMutation.id,{unitId:v,subUnitId:T,rule:w})}},an={type:x.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(u.ConditionalFormattingRuleModel),c=t.get(x.IUniverInstanceService),y=t.get(x.ICommandService),p=Y.getSheetCommandTarget(c);if(!p)return!1;const{unitId:S,subUnitId:v}=p,T=i.createCfId(S,v),_={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.uniqueValues,style:n}};return y.executeCommand(u.AddConditionalRuleMutation.id,{unitId:S,subUnitId:v,rule:_})}},_r="univer-conditional-formatting-wrap",Er="univer-title",Or="univer-label",Pr="univer-label-container",Fr="univer-m-t-base",Dr="univer-m-t-sm",Mr="univer-m-t-xl",Nr="univer-m-l-sm",jr="univer-m-l-xl",Lr="univer-m-l-xxs",Ur="univer-m-l-0",Vr="univer-m-r-0",z={conditionalFormattingWrap:_r,title:Er,label:Or,labelContainer:Pr,mTBase:Fr,mTSm:Dr,mTXl:Mr,mLSm:Nr,mLXl:jr,mLXxs:Lr,mL0:Ur,mR0:Vr};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)},zr=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},$e=j.forwardRef(function(t,e){var r=t.icon,n=t.id,o=t.className,i=t.extend,c=zr(t,["icon","id","className","extend"]),y="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),p=j.useRef("_".concat(Ar()));return rr(r,"".concat(n),{defIds:r.defIds,idSuffix:p.current},Ce({ref:e,className:y},c),i)});function rr(t,e,r,n,o){return j.createElement(t.tag,Ce(Ce({key:e},kr(t,r,o)),n),($r(t,r).children||[]).map(function(i,c){return rr(i,"".concat(e,"-").concat(t.tag,"-").concat(c),r,void 0,o)}))}function kr(t,e,r){var n=Ce({},t.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),t.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(i){var c=i[0],y=i[1];c==="mask"&&typeof y=="string"&&(n[c]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});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 c=i[0],y=i[1];typeof y=="string"&&(n[c]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function $r(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 Ar(){return Math.random().toString(36).substring(2,8)}$e.displayName="UniverIcon";var qr={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"}}]},xt=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"delete-single",ref:e,icon:qr}))});xt.displayName="DeleteSingle";var Wr={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"}}]},or=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"increase-single",ref:e,icon:Wr}))});or.displayName="IncreaseSingle";var Hr={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"}}]},Nt=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"more-down-single",ref:e,icon:Hr}))});Nt.displayName="MoreDownSingle";var Br={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"}}]}]},ir=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"sequence-single",ref:e,icon:Br}))});ir.displayName="SequenceSingle";var Gr={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"}}]}]},ft=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"slash-single",ref:e,icon:Gr}))});ft.displayName="SlashSingle";function Xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ar(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 Vt={exports:{}},We={},ot={exports:{}},Yr=ot.exports,pn;function sn(){return pn||(pn=1,function(t,e){(function(r,n){n(e)})(Yr,function(r){function n($){return function(ae,O,P,M,V,G,A){return $(ae,O,A)}}function o($){return function(ae,O,P,M){if(!ae||!O||typeof ae!="object"||typeof O!="object")return $(ae,O,P,M);var V=M.get(ae),G=M.get(O);if(V&&G)return V===O&&G===ae;M.set(ae,O),M.set(O,ae);var A=$(ae,O,P,M);return M.delete(ae),M.delete(O),A}}function i($,J){var ae={};for(var O in $)ae[O]=$[O];for(var O in J)ae[O]=J[O];return ae}function c($){return $.constructor===Object||$.constructor==null}function y($){return typeof $.then=="function"}function p($,J){return $===J||$!==$&&J!==J}var S="[object Arguments]",v="[object Boolean]",T="[object Date]",_="[object RegExp]",w="[object Map]",b="[object Number]",R="[object Object]",h="[object Set]",a="[object String]",s=Object.prototype.toString;function f($){var J=$.areArraysEqual,ae=$.areDatesEqual,O=$.areMapsEqual,P=$.areObjectsEqual,M=$.areRegExpsEqual,V=$.areSetsEqual,G=$.createIsNestedEqual,A=G(K);function K(X,te,ce){if(X===te)return!0;if(!X||!te||typeof X!="object"||typeof te!="object")return X!==X&&te!==te;if(c(X)&&c(te))return P(X,te,A,ce);var Pe=Array.isArray(X),ye=Array.isArray(te);if(Pe||ye)return Pe===ye&&J(X,te,A,ce);var me=s.call(X);return me!==s.call(te)?!1:me===T?ae(X,te,A,ce):me===_?M(X,te,A,ce):me===w?O(X,te,A,ce):me===h?V(X,te,A,ce):me===R||me===S?y(X)||y(te)?!1:P(X,te,A,ce):me===v||me===b||me===a?p(X.valueOf(),te.valueOf()):!1}return K}function C($,J,ae,O){var P=$.length;if(J.length!==P)return!1;for(;P-- >0;)if(!ae($[P],J[P],P,P,$,J,O))return!1;return!0}var l=o(C);function m($,J){return p($.valueOf(),J.valueOf())}function d($,J,ae,O){var P=$.size===J.size;if(!P)return!1;if(!$.size)return!0;var M={},V=0;return $.forEach(function(G,A){if(P){var K=!1,X=0;J.forEach(function(te,ce){!K&&!M[X]&&(K=ae(A,ce,V,X,$,J,O)&&ae(G,te,A,ce,$,J,O))&&(M[X]=!0),X++}),V++,P=K}}),P}var g=o(d),F="_owner",D=Object.prototype.hasOwnProperty;function U($,J,ae,O){var P=Object.keys($),M=P.length;if(Object.keys(J).length!==M)return!1;for(var V;M-- >0;){if(V=P[M],V===F){var G=!!$.$$typeof,A=!!J.$$typeof;if((G||A)&&G!==A)return!1}if(!D.call(J,V)||!ae($[V],J[V],V,V,$,J,O))return!1}return!0}var L=o(U);function E($,J){return $.source===J.source&&$.flags===J.flags}function N($,J,ae,O){var P=$.size===J.size;if(!P)return!1;if(!$.size)return!0;var M={};return $.forEach(function(V,G){if(P){var A=!1,K=0;J.forEach(function(X,te){!A&&!M[K]&&(A=ae(V,X,G,te,$,J,O))&&(M[K]=!0),K++}),P=A}}),P}var W=o(N),B=Object.freeze({areArraysEqual:C,areDatesEqual:m,areMapsEqual:d,areObjectsEqual:U,areRegExpsEqual:E,areSetsEqual:N,createIsNestedEqual:n}),Z=Object.freeze({areArraysEqual:l,areDatesEqual:m,areMapsEqual:g,areObjectsEqual:L,areRegExpsEqual:E,areSetsEqual:W,createIsNestedEqual:n}),se=f(B);function re($,J){return se($,J,void 0)}var q=f(i(B,{createIsNestedEqual:function(){return p}}));function k($,J){return q($,J,void 0)}var ne=f(Z);function oe($,J){return ne($,J,new WeakMap)}var le=f(i(Z,{createIsNestedEqual:function(){return p}}));function pe($,J){return le($,J,new WeakMap)}function ge($){return f(i(B,$(B)))}function be($){var J=f(i(Z,$(Z)));return function(ae,O,P){return P===void 0&&(P=new WeakMap),J(ae,O,P)}}r.circularDeepEqual=oe,r.circularShallowEqual=pe,r.createCustomCircularEqual=be,r.createCustomEqual=ge,r.deepEqual=re,r.sameValueZeroEqual=p,r.shallowEqual=k,Object.defineProperty(r,"__esModule",{value:!0})})}(ot,ot.exports)),ot.exports}var mt={exports:{}},hn;function ln(){if(hn)return mt.exports;hn=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 c=r.length;for(n=0;n<c;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="",c=arguments.length;o<c;o++)(r=arguments[o])&&(n=t(r))&&(i&&(i+=" "),i+=n);return i}return mt.exports=e,mt.exports.clsx=e,mt.exports}var ie={},zt,mn;function Kr(){return mn||(mn=1,zt=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)}),zt}var gn;function Ae(){if(gn)return ie;gn=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.bottom=n,ie.childrenEqual=p,ie.cloneLayout=o,ie.cloneLayoutItem=y,ie.collides=v,ie.compact=T,ie.compactItem=b,ie.compactType=$,ie.correctBounds=R,ie.fastPositionEqual=S,ie.fastRGLPropsEqual=void 0,ie.getAllCollisions=s,ie.getFirstCollision=a,ie.getLayoutItem=h,ie.getStatics=f,ie.modifyLayout=i,ie.moveElement=C,ie.moveElementAwayFromCollision=l,ie.noop=void 0,ie.perc=m,ie.resizeItemInDirection=q,ie.setTopLeft=ne,ie.setTransform=k,ie.sortLayoutItems=oe,ie.sortLayoutItemsByColRow=pe,ie.sortLayoutItemsByRowCol=le,ie.synchronizeLayoutWithChildren=ge,ie.validateLayout=be,ie.withLayoutItem=c;var t=sn(),e=r(j);function r(O){return O&&O.__esModule?O:{default:O}}function n(O){let P=0,M;for(let V=0,G=O.length;V<G;V++)M=O[V].y+O[V].h,M>P&&(P=M);return P}function o(O){const P=Array(O.length);for(let M=0,V=O.length;M<V;M++)P[M]=y(O[M]);return P}function i(O,P){const M=Array(O.length);for(let V=0,G=O.length;V<G;V++)P.i===O[V].i?M[V]=P:M[V]=O[V];return M}function c(O,P,M){let V=h(O,P);return V?(V=M(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 p(O,P){return(0,t.deepEqual)(e.default.Children.map(O,M=>M==null?void 0:M.key),e.default.Children.map(P,M=>M==null?void 0:M.key))&&(0,t.deepEqual)(e.default.Children.map(O,M=>M==null?void 0:M.props["data-grid"]),e.default.Children.map(P,M=>M==null?void 0:M.props["data-grid"]))}ie.fastRGLPropsEqual=Kr();function S(O,P){return O.left===P.left&&O.top===P.top&&O.width===P.width&&O.height===P.height}function v(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,M,V){const G=f(O),A=oe(O,P),K=Array(O.length);for(let X=0,te=A.length;X<te;X++){let ce=y(A[X]);ce.static||(ce=b(G,ce,P,M,A,V),G.push(ce)),K[O.indexOf(A[X])]=ce,ce.moved=!1}return K}const _={x:"w",y:"h"};function w(O,P,M,V){const G=_[V];P[V]+=1;const A=O.map(K=>K.i).indexOf(P.i);for(let K=A+1;K<O.length;K++){const X=O[K];if(!X.static){if(X.y>P.y+P.h)break;v(P,X)&&w(O,X,M+P[G],V)}}P[V]=M}function b(O,P,M,V,G,A){const K=M==="vertical",X=M==="horizontal";if(K)for(P.y=Math.min(n(O),P.y);P.y>0&&!a(O,P);)P.y--;else if(X)for(;P.x>0&&!a(O,P);)P.x--;let te;for(;(te=a(O,P))&&!(M===null&&A);)if(X?w(G,P,te.x+te.w,"x"):w(G,P,te.y+te.h,"y"),X&&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 R(O,P){const M=f(O);for(let V=0,G=O.length;V<G;V++){const A=O[V];if(A.x+A.w>P.cols&&(A.x=P.cols-A.w),A.x<0&&(A.x=0,A.w=P.cols),!A.static)M.push(A);else for(;a(M,A);)A.y++}return O}function h(O,P){for(let M=0,V=O.length;M<V;M++)if(O[M].i===P)return O[M]}function a(O,P){for(let M=0,V=O.length;M<V;M++)if(v(O[M],P))return O[M]}function s(O,P){return O.filter(M=>v(M,P))}function f(O){return O.filter(P=>P.static)}function C(O,P,M,V,G,A,K,X,te){if(P.static&&P.isDraggable!==!0||P.y===V&&P.x===M)return O;`${P.i}${String(M)}${String(V)}${P.x}${P.y}`;const ce=P.x,Pe=P.y;typeof M=="number"&&(P.x=M),typeof V=="number"&&(P.y=V),P.moved=!0;let ye=oe(O,K);(K==="vertical"&&typeof V=="number"?Pe>=V:K==="horizontal"&&typeof M=="number"?ce>=M:!1)&&(ye=ye.reverse());const je=s(ye,P),ht=je.length>0;if(ht&&te)return o(O);if(ht&&A)return`${P.i}`,P.x=ce,P.y=Pe,P.moved=!1,O;for(let Ut=0,wr=je.length;Ut<wr;Ut++){const Fe=je[Ut];`${P.i}${P.x}${P.y}${Fe.i}${Fe.x}${Fe.y}`,!Fe.moved&&(Fe.static?O=l(O,Fe,P,G,K):O=l(O,P,Fe,G,K))}return O}function l(O,P,M,V,G,A){const K=G==="horizontal",X=G==="vertical",te=P.static;if(V){V=!1;const ye={x:K?Math.max(P.x-M.w,0):M.x,y:X?Math.max(P.y-M.h,0):M.y,w:M.w,h:M.h,i:"-1"},me=a(O,ye),je=me&&me.y+me.h>P.y,ht=me&&P.x+P.w>me.x;if(me){if(je&&X)return C(O,M,void 0,P.y+1,V,te,G);if(je&&G==null)return P.y=M.y,M.y=M.y+M.h,O;if(ht&&K)return C(O,P,M.x,void 0,V,te,G)}else return`${M.i}${ye.x}${ye.y}`,C(O,M,K?ye.x:void 0,X?ye.y:void 0,V,te,G)}const ce=K?M.x+1:void 0,Pe=X?M.y+1:void 0;return ce==null&&Pe==null?O:C(O,M,K?M.x+1:void 0,X?M.y+1:void 0,V,te,G)}function m(O){return O*100+"%"}const d=(O,P,M,V)=>O+M>V?P:M,g=(O,P,M)=>O<0?P:M,F=O=>Math.max(0,O),D=O=>Math.max(0,O),U=(O,P,M)=>{let{left:V,height:G,width:A}=P;const K=O.top-(G-O.height);return{left:V,width:A,height:g(K,O.height,G),top:D(K)}},L=(O,P,M)=>{let{top:V,left:G,height:A,width:K}=P;return{top:V,height:A,width:d(O.left,O.width,K,M),left:F(G)}},E=(O,P,M)=>{let{top:V,height:G,width:A}=P;const K=O.left-(A-O.width);return{height:G,width:K<0?O.width:d(O.left,O.width,A,M),top:D(V),left:F(K)}},N=(O,P,M)=>{let{top:V,left:G,height:A,width:K}=P;return{width:K,left:G,height:g(V,O.height,A),top:D(V)}},re={n:U,ne:function(){return U(arguments.length<=0?void 0:arguments[0],L(...arguments))},e:L,se:function(){return N(arguments.length<=0?void 0:arguments[0],L(...arguments))},s:N,sw:function(){return N(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 q(O,P,M,V){const G=re[O];return G?G(P,{...P,...M},V):M}function k(O){let{top:P,left:M,width:V,height:G}=O;const A=`translate(${M}px,${P}px)`;return{transform:A,WebkitTransform:A,MozTransform:A,msTransform:A,OTransform:A,width:`${V}px`,height:`${G}px`,position:"absolute"}}function ne(O){let{top:P,left:M,width:V,height:G}=O;return{top:`${P}px`,left:`${M}px`,width:`${V}px`,height:`${G}px`,position:"absolute"}}function oe(O,P){return P==="horizontal"?pe(O):P==="vertical"?le(O):O}function le(O){return O.slice(0).sort(function(P,M){return P.y>M.y||P.y===M.y&&P.x>M.x?1:P.y===M.y&&P.x===M.x?0:-1})}function pe(O){return O.slice(0).sort(function(P,M){return P.x>M.x||P.x===M.x&&P.y>M.y?1:-1})}function ge(O,P,M,V,G){O=O||[];const A=[];e.default.Children.forEach(P,X=>{if((X==null?void 0:X.key)==null)return;const te=h(O,String(X.key)),ce=X.props["data-grid"];te&&ce==null?A.push(y(te)):ce?A.push(y({...ce,i:X.key})):A.push(y({w:1,h:1,x:0,y:n(A),i:String(X.key)}))});const K=R(A,{cols:M});return G?K:T(K,V,M)}function be(O){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const M=["x","y","w","h"];if(!Array.isArray(O))throw new Error(P+" must be an array!");for(let V=0,G=O.length;V<G;V++){const A=O[V];for(let K=0;K<M.length;K++)if(typeof A[M[K]]!="number")throw new Error("ReactGridLayout: "+P+"["+V+"]."+M[K]+" must be a number!")}}function $(O){const{verticalCompact:P,compactType:M}=O||{};return P===!1?null:M}function J(){}const ae=()=>{};return ie.noop=ae,ie}var Te={},vn;function un(){if(vn)return Te;vn=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(c){const{margin:y,containerPadding:p,containerWidth:S,cols:v}=c;return(S-y[0]*(v-1)-p[0]*2)/v}function e(c,y,p){return Number.isFinite(c)?Math.round(y*c+Math.max(0,c-1)*p):c}function r(c,y,p,S,v,T){const{margin:_,containerPadding:w,rowHeight:b}=c,R=t(c),h={};return T&&T.resizing?(h.width=Math.round(T.resizing.width),h.height=Math.round(T.resizing.height)):(h.width=e(S,R,_[0]),h.height=e(v,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])*p+w[1]),h.left=Math.round((R+_[0])*y+w[0])),h}function n(c,y,p,S,v){const{margin:T,cols:_,rowHeight:w,maxRows:b}=c,R=t(c);let h=Math.round((p-T[0])/(R+T[0])),a=Math.round((y-T[1])/(w+T[1]));return h=i(h,0,_-S),a=i(a,0,b-v),{x:h,y:a}}function o(c,y,p,S,v,T){const{margin:_,maxRows:w,cols:b,rowHeight:R}=c,h=t(c);let a=Math.round((y+_[0])/(h+_[0])),s=Math.round((p+_[1])/(R+_[1])),f=i(a,0,b-S),C=i(s,0,w-v);return["sw","w","nw"].indexOf(T)!==-1&&(f=i(a,0,b)),["nw","n","ne"].indexOf(T)!==-1&&(C=i(s,0,w)),{w:f,h:C}}function i(c,y,p){return Math.max(Math.min(c,p),y)}return Te}var He={},kt={exports:{}},$t,yn;function Zr(){if(yn)return $t;yn=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $t=t,$t}var At,Cn;function Jr(){if(Cn)return At;Cn=1;var t=Zr();function e(){}function r(){}return r.resetWarningCache=e,At=function(){function n(c,y,p,S,v,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},At}var bn;function Oe(){return bn||(bn=1,kt.exports=Jr()()),kt.exports}var Be={exports:{}},qt={};function sr(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=sr(t[e]))&&(n&&(n+=" "),n+=r);else for(e in t)t[e]&&(n&&(n+=" "),n+=e);return n}function Sn(){for(var t,e,r=0,n="";r<arguments.length;)(t=arguments[r++])&&(e=sr(t))&&(n&&(n+=" "),n+=e);return n}const Qr=Object.freeze(Object.defineProperty({__proto__:null,clsx:Sn,default:Sn},Symbol.toStringTag,{value:"Module"})),eo=ar(Qr);var fe={},_e={},Rn;function jt(){if(Rn)return _e;Rn=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.dontSetMe=o,_e.findInArray=t,_e.int=n,_e.isFunction=e,_e.isNum=r;function t(i,c){for(let y=0,p=i.length;y<p;y++)if(c.apply(c,[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,c,y){if(i[c])return new Error("Invalid prop ".concat(c," passed to ").concat(y," - do not set this, set it on the child."))}return _e}var Ee={},Tn;function to(){if(Tn)return Ee;Tn=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 c=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||c in y)return"";for(let p=0;p<t.length;p++)if(r(c,t[p])in y)return t[p];return""}function r(i,c){return c?"".concat(c).concat(o(i)):i}function n(i,c){return c?"-".concat(c.toLowerCase(),"-").concat(i):i}function o(i){let c="",y=!0;for(let p=0;p<i.length;p++)y?(c+=i[p].toUpperCase(),y=!1):i[p]==="-"?y=!0:c+=i[p];return c}return Ee.default=e(),Ee}var wn;function cn(){if(wn)return fe;wn=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.addClassName=l,fe.addEvent=y,fe.addUserSelectStyles=f,fe.createCSSTransform=b,fe.createSVGTransform=R,fe.getTouch=a,fe.getTouchIdentifier=s,fe.getTranslation=h,fe.innerHeight=T,fe.innerWidth=_,fe.matchesSelector=i,fe.matchesSelectorAndParentsTo=c,fe.offsetXYFromParent=w,fe.outerHeight=S,fe.outerWidth=v,fe.removeClassName=m,fe.removeEvent=p,fe.removeUserSelectStyles=C;var t=jt(),e=n(to());function r(d){if(typeof WeakMap!="function")return null;var g=new WeakMap,F=new WeakMap;return(r=function(D){return D?F:g})(d)}function n(d,g){if(d&&d.__esModule)return d;if(d===null||typeof d!="object"&&typeof d!="function")return{default:d};var F=r(g);if(F&&F.has(d))return F.get(d);var D={},U=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var L in d)if(L!=="default"&&Object.prototype.hasOwnProperty.call(d,L)){var E=U?Object.getOwnPropertyDescriptor(d,L):null;E&&(E.get||E.set)?Object.defineProperty(D,L,E):D[L]=d[L]}return D.default=d,F&&F.set(d,D),D}let o="";function i(d,g){return o||(o=(0,t.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(F){return(0,t.isFunction)(d[F])})),(0,t.isFunction)(d[o])?d[o](g):!1}function c(d,g,F){let D=d;do{if(i(D,g))return!0;if(D===F)return!1;D=D.parentNode}while(D);return!1}function y(d,g,F,D){if(!d)return;const U={capture:!0,...D};d.addEventListener?d.addEventListener(g,F,U):d.attachEvent?d.attachEvent("on"+g,F):d["on"+g]=F}function p(d,g,F,D){if(!d)return;const U={capture:!0,...D};d.removeEventListener?d.removeEventListener(g,F,U):d.detachEvent?d.detachEvent("on"+g,F):d["on"+g]=null}function S(d){let g=d.clientHeight;const F=d.ownerDocument.defaultView.getComputedStyle(d);return g+=(0,t.int)(F.borderTopWidth),g+=(0,t.int)(F.borderBottomWidth),g}function v(d){let g=d.clientWidth;const F=d.ownerDocument.defaultView.getComputedStyle(d);return g+=(0,t.int)(F.borderLeftWidth),g+=(0,t.int)(F.borderRightWidth),g}function T(d){let g=d.clientHeight;const F=d.ownerDocument.defaultView.getComputedStyle(d);return g-=(0,t.int)(F.paddingTop),g-=(0,t.int)(F.paddingBottom),g}function _(d){let g=d.clientWidth;const F=d.ownerDocument.defaultView.getComputedStyle(d);return g-=(0,t.int)(F.paddingLeft),g-=(0,t.int)(F.paddingRight),g}function w(d,g,F){const U=g===g.ownerDocument.body?{left:0,top:0}:g.getBoundingClientRect(),L=(d.clientX+g.scrollLeft-U.left)/F,E=(d.clientY+g.scrollTop-U.top)/F;return{x:L,y:E}}function b(d,g){const F=h(d,g,"px");return{[(0,e.browserPrefixToKey)("transform",e.default)]:F}}function R(d,g){return h(d,g,"")}function h(d,g,F){let{x:D,y:U}=d,L="translate(".concat(D).concat(F,",").concat(U).concat(F,")");if(g){const E="".concat(typeof g.x=="string"?g.x:g.x+F),N="".concat(typeof g.y=="string"?g.y:g.y+F);L="translate(".concat(E,", ").concat(N,")")+L}return L}function a(d,g){return d.targetTouches&&(0,t.findInArray)(d.targetTouches,F=>g===F.identifier)||d.changedTouches&&(0,t.findInArray)(d.changedTouches,F=>g===F.identifier)}function s(d){if(d.targetTouches&&d.targetTouches[0])return d.targetTouches[0].identifier;if(d.changedTouches&&d.changedTouches[0])return d.changedTouches[0].identifier}function f(d){if(!d)return;let g=d.getElementById("react-draggable-style-el");g||(g=d.createElement("style"),g.type="text/css",g.id="react-draggable-style-el",g.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
1
+ "use strict";var xr=Object.defineProperty;var Ir=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ie=(t,e,r)=>Ir(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("@univerjs/core"),u=require("@univerjs/sheets-conditional-formatting"),X=require("@univerjs/sheets"),ee=require("@univerjs/ui"),I=require("react/jsx-runtime"),j=require("react"),Z=require("@univerjs/design"),Yt=require("@univerjs/engine-formula"),fe=require("@univerjs/sheets-ui"),tr=require("react-dom"),Se=require("rxjs"),dt=require("@univerjs/sheets-formula-ui"),nr=require("@univerjs/engine-render"),it=require("rxjs/operators"),Zt={type:x.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,c=t.get(u.ConditionalFormattingRuleModel),y=t.get(x.ICommandService),p=t.get(x.IUniverInstanceService),S=X.getSheetCommandTarget(p);if(!S)return!1;const{unitId:v,subUnitId:R}=S,_=c.createCfId(v,R),T={ranges:r,cfId:_,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:i,style:n}};return y.executeCommand(u.AddConditionalRuleMutation.id,{unitId:v,subUnitId:R,rule:T})}},Jt={type:x.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(u.ConditionalFormattingRuleModel),c=t.get(x.ICommandService),y=t.get(x.IUniverInstanceService),p=X.getSheetCommandTarget(y);if(!p)return!1;const{unitId:S,subUnitId:v}=p,R=i.createCfId(S,v),_={ranges:r,cfId:R,stopIfTrue:!!o,rule:{type:u.CFRuleType.colorScale,config:n}};return c.executeCommand(u.AddConditionalRuleMutation.id,{unitId:S,subUnitId:v,rule:_})}},Qt={type:x.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:c,isGradient:y,stopIfTrue:p,isShowValue:S}=e,v=t.get(u.ConditionalFormattingRuleModel),R=t.get(x.IUniverInstanceService),_=X.getSheetCommandTarget(R);if(!_)return!1;const{unitId:T,subUnitId:b}=_,w=t.get(x.ICommandService),h=v.createCfId(T,b),a={ranges:r,cfId:h,stopIfTrue:!!p,rule:{type:u.CFRuleType.dataBar,isShowValue:S,config:{min:n,max:o,nativeColor:i,positiveColor:c,isGradient:y}}};return w.executeCommand(u.AddConditionalRuleMutation.id,{unitId:T,subUnitId:b,rule:a})}},en={type:x.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(u.ConditionalFormattingRuleModel),c=t.get(x.ICommandService),y=t.get(x.IUniverInstanceService),p=X.getSheetCommandTarget(y);if(!p)return!1;const{unitId:S,subUnitId:v}=p,R=i.createCfId(S,v),_={ranges:r,cfId:R,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.duplicateValues,style:n}};return c.executeCommand(u.AddConditionalRuleMutation.id,{unitId:S,subUnitId:v,rule:_})}},tn={type:x.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:c}=e,y=t.get(u.ConditionalFormattingRuleModel),p=t.get(x.ICommandService),S=t.get(x.IUniverInstanceService),v=X.getSheetCommandTarget(S);if(!v)return!1;const{unitId:R,subUnitId:_}=v,T=y.createCfId(R,_);let b;if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(i)){const w=c;if(w.length!==2||!Array.isArray(w))return!1;b={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:i,style:n,value:w}}}else{const w=c;if(typeof w!="number")return!1;b={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:i,style:n,value:w}}}return p.executeCommand(u.AddConditionalRuleMutation.id,{unitId:R,subUnitId:_,rule:b})}},nn={type:x.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:c,value:y}=e,p=t.get(u.ConditionalFormattingRuleModel),S=t.get(x.IUniverInstanceService),v=t.get(x.ICommandService),R=X.getSheetCommandTarget(S);if(!R)return!1;const{unitId:_,subUnitId:T}=R,b=p.createCfId(_,T),w={ranges:r,cfId:b,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:i,isBottom:c,style:n,value:y}};return v.executeCommand(u.AddConditionalRuleMutation.id,{unitId:_,subUnitId:T,rule:w})}},rn={type:x.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:c}=e,y=t.get(u.ConditionalFormattingRuleModel),p=t.get(x.IUniverInstanceService),S=X.getSheetCommandTarget(p);if(!S)return!1;const{unitId:v,subUnitId:R}=S,_=t.get(x.ICommandService),T=y.createCfId(v,R),b={ranges:r,cfId:T,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.text,operator:i,style:n,value:c}};return _.executeCommand(u.AddConditionalRuleMutation.id,{unitId:v,subUnitId:R,rule:b})}},on={type:x.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,c=t.get(u.ConditionalFormattingRuleModel),y=t.get(x.IUniverInstanceService),p=t.get(x.ICommandService),S=X.getSheetCommandTarget(y);if(!S)return!1;const{unitId:v,subUnitId:R}=S,_=c.createCfId(v,R),T={ranges:r,cfId:_,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.timePeriod,operator:i,style:n}};return p.executeCommand(u.AddConditionalRuleMutation.id,{unitId:v,subUnitId:R,rule:T})}},an={type:x.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(u.ConditionalFormattingRuleModel),c=t.get(x.IUniverInstanceService),y=t.get(x.ICommandService),p=X.getSheetCommandTarget(c);if(!p)return!1;const{unitId:S,subUnitId:v}=p,R=i.createCfId(S,v),_={ranges:r,cfId:R,stopIfTrue:!!o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.uniqueValues,style:n}};return y.executeCommand(u.AddConditionalRuleMutation.id,{unitId:S,subUnitId:v,rule:_})}},_r="univer-conditional-formatting-wrap",Er="univer-title",Or="univer-label",Pr="univer-label-container",Dr="univer-m-t-base",Fr="univer-m-t-sm",Mr="univer-m-t-xl",Nr="univer-m-l-sm",jr="univer-m-l-xl",Lr="univer-m-l-xxs",Ur="univer-m-l-0",Vr="univer-m-r-0",z={conditionalFormattingWrap:_r,title:Er,label:Or,labelContainer:Pr,mTBase:Dr,mTSm:Fr,mTXl:Mr,mLSm:Nr,mLXl:jr,mLXxs:Lr,mL0:Ur,mR0:Vr};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)},zr=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},$e=j.forwardRef(function(t,e){var r=t.icon,n=t.id,o=t.className,i=t.extend,c=zr(t,["icon","id","className","extend"]),y="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),p=j.useRef("_".concat(Ar()));return rr(r,"".concat(n),{defIds:r.defIds,idSuffix:p.current},Ce({ref:e,className:y},c),i)});function rr(t,e,r,n,o){return j.createElement(t.tag,Ce(Ce({key:e},kr(t,r,o)),n),($r(t,r).children||[]).map(function(i,c){return rr(i,"".concat(e,"-").concat(t.tag,"-").concat(c),r,void 0,o)}))}function kr(t,e,r){var n=Ce({},t.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),t.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(i){var c=i[0],y=i[1];c==="mask"&&typeof y=="string"&&(n[c]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});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 c=i[0],y=i[1];typeof y=="string"&&(n[c]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function $r(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 Ar(){return Math.random().toString(36).substring(2,8)}$e.displayName="UniverIcon";var qr={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"}}]},xt=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"delete-single",ref:e,icon:qr}))});xt.displayName="DeleteSingle";var Wr={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"}}]},or=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"increase-single",ref:e,icon:Wr}))});or.displayName="IncreaseSingle";var Hr={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"}}]},Nt=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"more-down-single",ref:e,icon:Hr}))});Nt.displayName="MoreDownSingle";var Br={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"}}]}]},ir=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"sequence-single",ref:e,icon:Br}))});ir.displayName="SequenceSingle";var Gr={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"}}]}]},ft=j.forwardRef(function(t,e){return j.createElement($e,Object.assign({},t,{id:"slash-single",ref:e,icon:Gr}))});ft.displayName="SlashSingle";function Xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ar(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 Vt={exports:{}},We={},ot={exports:{}},Yr=ot.exports,pn;function sn(){return pn||(pn=1,function(t,e){(function(r,n){n(e)})(Yr,function(r){function n($){return function(ae,O,P,F,V,B,A){return $(ae,O,A)}}function o($){return function(ae,O,P,F){if(!ae||!O||typeof ae!="object"||typeof O!="object")return $(ae,O,P,F);var V=F.get(ae),B=F.get(O);if(V&&B)return V===O&&B===ae;F.set(ae,O),F.set(O,ae);var A=$(ae,O,P,F);return F.delete(ae),F.delete(O),A}}function i($,K){var ae={};for(var O in $)ae[O]=$[O];for(var O in K)ae[O]=K[O];return ae}function c($){return $.constructor===Object||$.constructor==null}function y($){return typeof $.then=="function"}function p($,K){return $===K||$!==$&&K!==K}var S="[object Arguments]",v="[object Boolean]",R="[object Date]",_="[object RegExp]",T="[object Map]",b="[object Number]",w="[object Object]",h="[object Set]",a="[object String]",s=Object.prototype.toString;function f($){var K=$.areArraysEqual,ae=$.areDatesEqual,O=$.areMapsEqual,P=$.areObjectsEqual,F=$.areRegExpsEqual,V=$.areSetsEqual,B=$.createIsNestedEqual,A=B(Y);function Y(G,te,ce){if(G===te)return!0;if(!G||!te||typeof G!="object"||typeof te!="object")return G!==G&&te!==te;if(c(G)&&c(te))return P(G,te,A,ce);var Pe=Array.isArray(G),ye=Array.isArray(te);if(Pe||ye)return Pe===ye&&K(G,te,A,ce);var ge=s.call(G);return ge!==s.call(te)?!1:ge===R?ae(G,te,A,ce):ge===_?F(G,te,A,ce):ge===T?O(G,te,A,ce):ge===h?V(G,te,A,ce):ge===w||ge===S?y(G)||y(te)?!1:P(G,te,A,ce):ge===v||ge===b||ge===a?p(G.valueOf(),te.valueOf()):!1}return Y}function C($,K,ae,O){var P=$.length;if(K.length!==P)return!1;for(;P-- >0;)if(!ae($[P],K[P],P,P,$,K,O))return!1;return!0}var l=o(C);function m($,K){return p($.valueOf(),K.valueOf())}function d($,K,ae,O){var P=$.size===K.size;if(!P)return!1;if(!$.size)return!0;var F={},V=0;return $.forEach(function(B,A){if(P){var Y=!1,G=0;K.forEach(function(te,ce){!Y&&!F[G]&&(Y=ae(A,ce,V,G,$,K,O)&&ae(B,te,A,ce,$,K,O))&&(F[G]=!0),G++}),V++,P=Y}}),P}var g=o(d),D="_owner",M=Object.prototype.hasOwnProperty;function L($,K,ae,O){var P=Object.keys($),F=P.length;if(Object.keys(K).length!==F)return!1;for(var V;F-- >0;){if(V=P[F],V===D){var B=!!$.$$typeof,A=!!K.$$typeof;if((B||A)&&B!==A)return!1}if(!M.call(K,V)||!ae($[V],K[V],V,V,$,K,O))return!1}return!0}var U=o(L);function E($,K){return $.source===K.source&&$.flags===K.flags}function N($,K,ae,O){var P=$.size===K.size;if(!P)return!1;if(!$.size)return!0;var F={};return $.forEach(function(V,B){if(P){var A=!1,Y=0;K.forEach(function(G,te){!A&&!F[Y]&&(A=ae(V,G,B,te,$,K,O))&&(F[Y]=!0),Y++}),P=A}}),P}var q=o(N),H=Object.freeze({areArraysEqual:C,areDatesEqual:m,areMapsEqual:d,areObjectsEqual:L,areRegExpsEqual:E,areSetsEqual:N,createIsNestedEqual:n}),J=Object.freeze({areArraysEqual:l,areDatesEqual:m,areMapsEqual:g,areObjectsEqual:U,areRegExpsEqual:E,areSetsEqual:q,createIsNestedEqual:n}),ie=f(H);function re($,K){return ie($,K,void 0)}var le=f(i(H,{createIsNestedEqual:function(){return p}}));function k($,K){return le($,K,void 0)}var Q=f(J);function ne($,K){return Q($,K,new WeakMap)}var se=f(i(J,{createIsNestedEqual:function(){return p}}));function de($,K){return se($,K,new WeakMap)}function he($){return f(i(H,$(H)))}function be($){var K=f(i(J,$(J)));return function(ae,O,P){return P===void 0&&(P=new WeakMap),K(ae,O,P)}}r.circularDeepEqual=ne,r.circularShallowEqual=de,r.createCustomCircularEqual=be,r.createCustomEqual=he,r.deepEqual=re,r.sameValueZeroEqual=p,r.shallowEqual=k,Object.defineProperty(r,"__esModule",{value:!0})})}(ot,ot.exports)),ot.exports}var mt={exports:{}},hn;function ln(){if(hn)return mt.exports;hn=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 c=r.length;for(n=0;n<c;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="",c=arguments.length;o<c;o++)(r=arguments[o])&&(n=t(r))&&(i&&(i+=" "),i+=n);return i}return mt.exports=e,mt.exports.clsx=e,mt.exports}var oe={},zt,mn;function Kr(){return mn||(mn=1,zt=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)}),zt}var gn;function Ae(){if(gn)return oe;gn=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.bottom=n,oe.childrenEqual=p,oe.cloneLayout=o,oe.cloneLayoutItem=y,oe.collides=v,oe.compact=R,oe.compactItem=b,oe.compactType=$,oe.correctBounds=w,oe.fastPositionEqual=S,oe.fastRGLPropsEqual=void 0,oe.getAllCollisions=s,oe.getFirstCollision=a,oe.getLayoutItem=h,oe.getStatics=f,oe.modifyLayout=i,oe.moveElement=C,oe.moveElementAwayFromCollision=l,oe.noop=void 0,oe.perc=m,oe.resizeItemInDirection=le,oe.setTopLeft=Q,oe.setTransform=k,oe.sortLayoutItems=ne,oe.sortLayoutItemsByColRow=de,oe.sortLayoutItemsByRowCol=se,oe.synchronizeLayoutWithChildren=he,oe.validateLayout=be,oe.withLayoutItem=c;var t=sn(),e=r(j);function r(O){return O&&O.__esModule?O:{default:O}}function n(O){let P=0,F;for(let V=0,B=O.length;V<B;V++)F=O[V].y+O[V].h,F>P&&(P=F);return P}function o(O){const P=Array(O.length);for(let F=0,V=O.length;F<V;F++)P[F]=y(O[F]);return P}function i(O,P){const F=Array(O.length);for(let V=0,B=O.length;V<B;V++)P.i===O[V].i?F[V]=P:F[V]=O[V];return F}function c(O,P,F){let V=h(O,P);return V?(V=F(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 p(O,P){return(0,t.deepEqual)(e.default.Children.map(O,F=>F==null?void 0:F.key),e.default.Children.map(P,F=>F==null?void 0:F.key))&&(0,t.deepEqual)(e.default.Children.map(O,F=>F==null?void 0:F.props["data-grid"]),e.default.Children.map(P,F=>F==null?void 0:F.props["data-grid"]))}oe.fastRGLPropsEqual=Kr();function S(O,P){return O.left===P.left&&O.top===P.top&&O.width===P.width&&O.height===P.height}function v(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 R(O,P,F,V){const B=f(O),A=ne(O,P),Y=Array(O.length);for(let G=0,te=A.length;G<te;G++){let ce=y(A[G]);ce.static||(ce=b(B,ce,P,F,A,V),B.push(ce)),Y[O.indexOf(A[G])]=ce,ce.moved=!1}return Y}const _={x:"w",y:"h"};function T(O,P,F,V){const B=_[V];P[V]+=1;const A=O.map(Y=>Y.i).indexOf(P.i);for(let Y=A+1;Y<O.length;Y++){const G=O[Y];if(!G.static){if(G.y>P.y+P.h)break;v(P,G)&&T(O,G,F+P[B],V)}}P[V]=F}function b(O,P,F,V,B,A){const Y=F==="vertical",G=F==="horizontal";if(Y)for(P.y=Math.min(n(O),P.y);P.y>0&&!a(O,P);)P.y--;else if(G)for(;P.x>0&&!a(O,P);)P.x--;let te;for(;(te=a(O,P))&&!(F===null&&A);)if(G?T(B,P,te.x+te.w,"x"):T(B,P,te.y+te.h,"y"),G&&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 F=f(O);for(let V=0,B=O.length;V<B;V++){const A=O[V];if(A.x+A.w>P.cols&&(A.x=P.cols-A.w),A.x<0&&(A.x=0,A.w=P.cols),!A.static)F.push(A);else for(;a(F,A);)A.y++}return O}function h(O,P){for(let F=0,V=O.length;F<V;F++)if(O[F].i===P)return O[F]}function a(O,P){for(let F=0,V=O.length;F<V;F++)if(v(O[F],P))return O[F]}function s(O,P){return O.filter(F=>v(F,P))}function f(O){return O.filter(P=>P.static)}function C(O,P,F,V,B,A,Y,G,te){if(P.static&&P.isDraggable!==!0||P.y===V&&P.x===F)return O;`${P.i}${String(F)}${String(V)}${P.x}${P.y}`;const ce=P.x,Pe=P.y;typeof F=="number"&&(P.x=F),typeof V=="number"&&(P.y=V),P.moved=!0;let ye=ne(O,Y);(Y==="vertical"&&typeof V=="number"?Pe>=V:Y==="horizontal"&&typeof F=="number"?ce>=F:!1)&&(ye=ye.reverse());const je=s(ye,P),ht=je.length>0;if(ht&&te)return o(O);if(ht&&A)return`${P.i}`,P.x=ce,P.y=Pe,P.moved=!1,O;for(let Ut=0,wr=je.length;Ut<wr;Ut++){const De=je[Ut];`${P.i}${P.x}${P.y}${De.i}${De.x}${De.y}`,!De.moved&&(De.static?O=l(O,De,P,B,Y):O=l(O,P,De,B,Y))}return O}function l(O,P,F,V,B,A){const Y=B==="horizontal",G=B==="vertical",te=P.static;if(V){V=!1;const ye={x:Y?Math.max(P.x-F.w,0):F.x,y:G?Math.max(P.y-F.h,0):F.y,w:F.w,h:F.h,i:"-1"},ge=a(O,ye),je=ge&&ge.y+ge.h>P.y,ht=ge&&P.x+P.w>ge.x;if(ge){if(je&&G)return C(O,F,void 0,P.y+1,V,te,B);if(je&&B==null)return P.y=F.y,F.y=F.y+F.h,O;if(ht&&Y)return C(O,P,F.x,void 0,V,te,B)}else return`${F.i}${ye.x}${ye.y}`,C(O,F,Y?ye.x:void 0,G?ye.y:void 0,V,te,B)}const ce=Y?F.x+1:void 0,Pe=G?F.y+1:void 0;return ce==null&&Pe==null?O:C(O,F,Y?F.x+1:void 0,G?F.y+1:void 0,V,te,B)}function m(O){return O*100+"%"}const d=(O,P,F,V)=>O+F>V?P:F,g=(O,P,F)=>O<0?P:F,D=O=>Math.max(0,O),M=O=>Math.max(0,O),L=(O,P,F)=>{let{left:V,height:B,width:A}=P;const Y=O.top-(B-O.height);return{left:V,width:A,height:g(Y,O.height,B),top:M(Y)}},U=(O,P,F)=>{let{top:V,left:B,height:A,width:Y}=P;return{top:V,height:A,width:d(O.left,O.width,Y,F),left:D(B)}},E=(O,P,F)=>{let{top:V,height:B,width:A}=P;const Y=O.left-(A-O.width);return{height:B,width:Y<0?O.width:d(O.left,O.width,A,F),top:M(V),left:D(Y)}},N=(O,P,F)=>{let{top:V,left:B,height:A,width:Y}=P;return{width:Y,left:B,height:g(V,O.height,A),top:M(V)}},re={n:L,ne:function(){return L(arguments.length<=0?void 0:arguments[0],U(...arguments))},e:U,se:function(){return N(arguments.length<=0?void 0:arguments[0],U(...arguments))},s:N,sw:function(){return N(arguments.length<=0?void 0:arguments[0],E(...arguments))},w:E,nw:function(){return L(arguments.length<=0?void 0:arguments[0],E(...arguments))}};function le(O,P,F,V){const B=re[O];return B?B(P,{...P,...F},V):F}function k(O){let{top:P,left:F,width:V,height:B}=O;const A=`translate(${F}px,${P}px)`;return{transform:A,WebkitTransform:A,MozTransform:A,msTransform:A,OTransform:A,width:`${V}px`,height:`${B}px`,position:"absolute"}}function Q(O){let{top:P,left:F,width:V,height:B}=O;return{top:`${P}px`,left:`${F}px`,width:`${V}px`,height:`${B}px`,position:"absolute"}}function ne(O,P){return P==="horizontal"?de(O):P==="vertical"?se(O):O}function se(O){return O.slice(0).sort(function(P,F){return P.y>F.y||P.y===F.y&&P.x>F.x?1:P.y===F.y&&P.x===F.x?0:-1})}function de(O){return O.slice(0).sort(function(P,F){return P.x>F.x||P.x===F.x&&P.y>F.y?1:-1})}function he(O,P,F,V,B){O=O||[];const A=[];e.default.Children.forEach(P,G=>{if((G==null?void 0:G.key)==null)return;const te=h(O,String(G.key)),ce=G.props["data-grid"];te&&ce==null?A.push(y(te)):ce?A.push(y({...ce,i:G.key})):A.push(y({w:1,h:1,x:0,y:n(A),i:String(G.key)}))});const Y=w(A,{cols:F});return B?Y:R(Y,V,F)}function be(O){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const F=["x","y","w","h"];if(!Array.isArray(O))throw new Error(P+" must be an array!");for(let V=0,B=O.length;V<B;V++){const A=O[V];for(let Y=0;Y<F.length;Y++)if(typeof A[F[Y]]!="number")throw new Error("ReactGridLayout: "+P+"["+V+"]."+F[Y]+" must be a number!")}}function $(O){const{verticalCompact:P,compactType:F}=O||{};return P===!1?null:F}function K(){}const ae=()=>{};return oe.noop=ae,oe}var Te={},vn;function un(){if(vn)return Te;vn=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(c){const{margin:y,containerPadding:p,containerWidth:S,cols:v}=c;return(S-y[0]*(v-1)-p[0]*2)/v}function e(c,y,p){return Number.isFinite(c)?Math.round(y*c+Math.max(0,c-1)*p):c}function r(c,y,p,S,v,R){const{margin:_,containerPadding:T,rowHeight:b}=c,w=t(c),h={};return R&&R.resizing?(h.width=Math.round(R.resizing.width),h.height=Math.round(R.resizing.height)):(h.width=e(S,w,_[0]),h.height=e(v,b,_[1])),R&&R.dragging?(h.top=Math.round(R.dragging.top),h.left=Math.round(R.dragging.left)):R&&R.resizing&&typeof R.resizing.top=="number"&&typeof R.resizing.left=="number"?(h.top=Math.round(R.resizing.top),h.left=Math.round(R.resizing.left)):(h.top=Math.round((b+_[1])*p+T[1]),h.left=Math.round((w+_[0])*y+T[0])),h}function n(c,y,p,S,v){const{margin:R,cols:_,rowHeight:T,maxRows:b}=c,w=t(c);let h=Math.round((p-R[0])/(w+R[0])),a=Math.round((y-R[1])/(T+R[1]));return h=i(h,0,_-S),a=i(a,0,b-v),{x:h,y:a}}function o(c,y,p,S,v,R){const{margin:_,maxRows:T,cols:b,rowHeight:w}=c,h=t(c);let a=Math.round((y+_[0])/(h+_[0])),s=Math.round((p+_[1])/(w+_[1])),f=i(a,0,b-S),C=i(s,0,T-v);return["sw","w","nw"].indexOf(R)!==-1&&(f=i(a,0,b)),["nw","n","ne"].indexOf(R)!==-1&&(C=i(s,0,T)),{w:f,h:C}}function i(c,y,p){return Math.max(Math.min(c,p),y)}return Te}var He={},kt={exports:{}},$t,yn;function Zr(){if(yn)return $t;yn=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $t=t,$t}var At,Cn;function Jr(){if(Cn)return At;Cn=1;var t=Zr();function e(){}function r(){}return r.resetWarningCache=e,At=function(){function n(c,y,p,S,v,R){if(R!==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},At}var bn;function Oe(){return bn||(bn=1,kt.exports=Jr()()),kt.exports}var Be={exports:{}},qt={};function sr(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=sr(t[e]))&&(n&&(n+=" "),n+=r);else for(e in t)t[e]&&(n&&(n+=" "),n+=e);return n}function Sn(){for(var t,e,r=0,n="";r<arguments.length;)(t=arguments[r++])&&(e=sr(t))&&(n&&(n+=" "),n+=e);return n}const Qr=Object.freeze(Object.defineProperty({__proto__:null,clsx:Sn,default:Sn},Symbol.toStringTag,{value:"Module"})),eo=ar(Qr);var pe={},_e={},Rn;function jt(){if(Rn)return _e;Rn=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.dontSetMe=o,_e.findInArray=t,_e.int=n,_e.isFunction=e,_e.isNum=r;function t(i,c){for(let y=0,p=i.length;y<p;y++)if(c.apply(c,[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,c,y){if(i[c])return new Error("Invalid prop ".concat(c," passed to ").concat(y," - do not set this, set it on the child."))}return _e}var Ee={},Tn;function to(){if(Tn)return Ee;Tn=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 c=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||c in y)return"";for(let p=0;p<t.length;p++)if(r(c,t[p])in y)return t[p];return""}function r(i,c){return c?"".concat(c).concat(o(i)):i}function n(i,c){return c?"-".concat(c.toLowerCase(),"-").concat(i):i}function o(i){let c="",y=!0;for(let p=0;p<i.length;p++)y?(c+=i[p].toUpperCase(),y=!1):i[p]==="-"?y=!0:c+=i[p];return c}return Ee.default=e(),Ee}var wn;function cn(){if(wn)return pe;wn=1,Object.defineProperty(pe,"__esModule",{value:!0}),pe.addClassName=l,pe.addEvent=y,pe.addUserSelectStyles=f,pe.createCSSTransform=b,pe.createSVGTransform=w,pe.getTouch=a,pe.getTouchIdentifier=s,pe.getTranslation=h,pe.innerHeight=R,pe.innerWidth=_,pe.matchesSelector=i,pe.matchesSelectorAndParentsTo=c,pe.offsetXYFromParent=T,pe.outerHeight=S,pe.outerWidth=v,pe.removeClassName=m,pe.removeEvent=p,pe.removeUserSelectStyles=C;var t=jt(),e=n(to());function r(d){if(typeof WeakMap!="function")return null;var g=new WeakMap,D=new WeakMap;return(r=function(M){return M?D:g})(d)}function n(d,g){if(d&&d.__esModule)return d;if(d===null||typeof d!="object"&&typeof d!="function")return{default:d};var D=r(g);if(D&&D.has(d))return D.get(d);var M={},L=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var U in d)if(U!=="default"&&Object.prototype.hasOwnProperty.call(d,U)){var E=L?Object.getOwnPropertyDescriptor(d,U):null;E&&(E.get||E.set)?Object.defineProperty(M,U,E):M[U]=d[U]}return M.default=d,D&&D.set(d,M),M}let o="";function i(d,g){return o||(o=(0,t.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(D){return(0,t.isFunction)(d[D])})),(0,t.isFunction)(d[o])?d[o](g):!1}function c(d,g,D){let M=d;do{if(i(M,g))return!0;if(M===D)return!1;M=M.parentNode}while(M);return!1}function y(d,g,D,M){if(!d)return;const L={capture:!0,...M};d.addEventListener?d.addEventListener(g,D,L):d.attachEvent?d.attachEvent("on"+g,D):d["on"+g]=D}function p(d,g,D,M){if(!d)return;const L={capture:!0,...M};d.removeEventListener?d.removeEventListener(g,D,L):d.detachEvent?d.detachEvent("on"+g,D):d["on"+g]=null}function S(d){let g=d.clientHeight;const D=d.ownerDocument.defaultView.getComputedStyle(d);return g+=(0,t.int)(D.borderTopWidth),g+=(0,t.int)(D.borderBottomWidth),g}function v(d){let g=d.clientWidth;const D=d.ownerDocument.defaultView.getComputedStyle(d);return g+=(0,t.int)(D.borderLeftWidth),g+=(0,t.int)(D.borderRightWidth),g}function R(d){let g=d.clientHeight;const D=d.ownerDocument.defaultView.getComputedStyle(d);return g-=(0,t.int)(D.paddingTop),g-=(0,t.int)(D.paddingBottom),g}function _(d){let g=d.clientWidth;const D=d.ownerDocument.defaultView.getComputedStyle(d);return g-=(0,t.int)(D.paddingLeft),g-=(0,t.int)(D.paddingRight),g}function T(d,g,D){const L=g===g.ownerDocument.body?{left:0,top:0}:g.getBoundingClientRect(),U=(d.clientX+g.scrollLeft-L.left)/D,E=(d.clientY+g.scrollTop-L.top)/D;return{x:U,y:E}}function b(d,g){const D=h(d,g,"px");return{[(0,e.browserPrefixToKey)("transform",e.default)]:D}}function w(d,g){return h(d,g,"")}function h(d,g,D){let{x:M,y:L}=d,U="translate(".concat(M).concat(D,",").concat(L).concat(D,")");if(g){const E="".concat(typeof g.x=="string"?g.x:g.x+D),N="".concat(typeof g.y=="string"?g.y:g.y+D);U="translate(".concat(E,", ").concat(N,")")+U}return U}function a(d,g){return d.targetTouches&&(0,t.findInArray)(d.targetTouches,D=>g===D.identifier)||d.changedTouches&&(0,t.findInArray)(d.changedTouches,D=>g===D.identifier)}function s(d){if(d.targetTouches&&d.targetTouches[0])return d.targetTouches[0].identifier;if(d.changedTouches&&d.changedTouches[0])return d.changedTouches[0].identifier}function f(d){if(!d)return;let g=d.getElementById("react-draggable-style-el");g||(g=d.createElement("style"),g.type="text/css",g.id="react-draggable-style-el",g.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
2
2
  `,g.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
3
- `,d.getElementsByTagName("head")[0].appendChild(g)),d.body&&l(d.body,"react-draggable-transparent-selection")}function C(d){if(d)try{if(d.body&&m(d.body,"react-draggable-transparent-selection"),d.selection)d.selection.empty();else{const g=(d.defaultView||window).getSelection();g&&g.type!=="Caret"&&g.removeAllRanges()}}catch{}}function l(d,g){d.classList?d.classList.add(g):d.className.match(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)")))||(d.className+=" ".concat(g))}function m(d,g){d.classList?d.classList.remove(g):d.className=d.className.replace(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)"),"g"),"")}return fe}var Re={},xn;function lr(){if(xn)return Re;xn=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.canDragX=o,Re.canDragY=i,Re.createCoreData=y,Re.createDraggableData=p,Re.getBoundPosition=r,Re.getControlPosition=c,Re.snapToGrid=n;var t=jt(),e=cn();function r(T,_,w){if(!T.props.bounds)return[_,w];let{bounds:b}=T.props;b=typeof b=="string"?b:S(b);const R=v(T);if(typeof b=="string"){const{ownerDocument:h}=R,a=h.defaultView;let s;if(b==="parent"?s=R.parentNode:s=h.querySelector(b),!(s instanceof a.HTMLElement))throw new Error('Bounds selector "'+b+'" could not find an element.');const f=s,C=a.getComputedStyle(R),l=a.getComputedStyle(f);b={left:-R.offsetLeft+(0,t.int)(l.paddingLeft)+(0,t.int)(C.marginLeft),top:-R.offsetTop+(0,t.int)(l.paddingTop)+(0,t.int)(C.marginTop),right:(0,e.innerWidth)(f)-(0,e.outerWidth)(R)-R.offsetLeft+(0,t.int)(l.paddingRight)-(0,t.int)(C.marginRight),bottom:(0,e.innerHeight)(f)-(0,e.outerHeight)(R)-R.offsetTop+(0,t.int)(l.paddingBottom)-(0,t.int)(C.marginBottom)}}return(0,t.isNum)(b.right)&&(_=Math.min(_,b.right)),(0,t.isNum)(b.bottom)&&(w=Math.min(w,b.bottom)),(0,t.isNum)(b.left)&&(_=Math.max(_,b.left)),(0,t.isNum)(b.top)&&(w=Math.max(w,b.top)),[_,w]}function n(T,_,w){const b=Math.round(_/T[0])*T[0],R=Math.round(w/T[1])*T[1];return[b,R]}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 c(T,_,w){const b=typeof _=="number"?(0,e.getTouch)(T,_):null;if(typeof _=="number"&&!b)return null;const R=v(w),h=w.props.offsetParent||R.offsetParent||R.ownerDocument.body;return(0,e.offsetXYFromParent)(b||T,h,w.props.scale)}function y(T,_,w){const b=!(0,t.isNum)(T.lastX),R=v(T);return b?{node:R,deltaX:0,deltaY:0,lastX:_,lastY:w,x:_,y:w}:{node:R,deltaX:_-T.lastX,deltaY:w-T.lastY,lastX:T.lastX,lastY:T.lastY,x:_,y:w}}function p(T,_){const w=T.props.scale;return{node:_.node,x:T.state.x+_.deltaX/w,y:T.state.y+_.deltaY/w,deltaX:_.deltaX/w,deltaY:_.deltaY/w,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 v(T){const _=T.findDOMNode();if(!_)throw new Error("<DraggableCore>: Unmounted during event!");return _}return Re}var Ge={},gt={},In;function ur(){if(In)return gt;In=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.default=t;function t(){}return gt}var _n;function no(){if(_n)return Ge;_n=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.default=void 0;var t=S(j),e=y(Oe()),r=y(tr),n=cn(),o=lr(),i=jt(),c=y(ur());function y(h){return h&&h.__esModule?h:{default:h}}function p(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(p=function(f){return f?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=p(a);if(s&&s.has(h))return s.get(h);var f={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in h)if(l!=="default"&&Object.prototype.hasOwnProperty.call(h,l)){var m=C?Object.getOwnPropertyDescriptor(h,l):null;m&&(m.get||m.set)?Object.defineProperty(f,l,m):f[l]=h[l]}return f.default=h,s&&s.set(h,f),f}function v(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 f=s.call(h,a);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const w={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let b=w.mouse,R=class extends t.Component{constructor(){super(...arguments),v(this,"dragging",!1),v(this,"lastX",NaN),v(this,"lastY",NaN),v(this,"touchIdentifier",null),v(this,"mounted",!1),v(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:f}=s;if(this.props.disabled||!(a.target instanceof f.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 C=(0,n.getTouchIdentifier)(a);this.touchIdentifier=C;const l=(0,o.getControlPosition)(a,C,this);if(l==null)return;const{x:m,y:d}=l,g=(0,o.createCoreData)(this,m,d);(0,c.default)("DraggableCore: handleDragStart: %j",g),(0,c.default)("calling",this.props.onStart),!(this.props.onStart(a,g)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(f),this.dragging=!0,this.lastX=m,this.lastY=d,(0,n.addEvent)(f,b.move,this.handleDrag),(0,n.addEvent)(f,b.stop,this.handleDragStop))}),v(this,"handleDrag",a=>{const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:f,y:C}=s;if(Array.isArray(this.props.grid)){let d=f-this.lastX,g=C-this.lastY;if([d,g]=(0,o.snapToGrid)(this.props.grid,d,g),!d&&!g)return;f=this.lastX+d,C=this.lastY+g}const l=(0,o.createCoreData)(this,f,C);if((0,c.default)("DraggableCore: handleDrag: %j",l),this.props.onDrag(a,l)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const g=document.createEvent("MouseEvents");g.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(g)}return}this.lastX=f,this.lastY=C}),v(this,"handleDragStop",a=>{if(!this.dragging)return;const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:f,y:C}=s;if(Array.isArray(this.props.grid)){let g=f-this.lastX||0,F=C-this.lastY||0;[g,F]=(0,o.snapToGrid)(this.props.grid,g,F),f=this.lastX+g,C=this.lastY+F}const l=(0,o.createCoreData)(this,f,C);if(this.props.onStop(a,l)===!1||this.mounted===!1)return!1;const d=this.findDOMNode();d&&this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(d.ownerDocument),(0,c.default)("DraggableCore: handleDragStop: %j",l),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,d&&((0,c.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(d.ownerDocument,b.move,this.handleDrag),(0,n.removeEvent)(d.ownerDocument,b.stop,this.handleDragStop))}),v(this,"onMouseDown",a=>(b=w.mouse,this.handleDragStart(a))),v(this,"onMouseUp",a=>(b=w.mouse,this.handleDragStop(a))),v(this,"onTouchStart",a=>(b=w.touch,this.handleDragStart(a))),v(this,"onTouchEnd",a=>(b=w.touch,this.handleDragStop(a)))}componentDidMount(){this.mounted=!0;const a=this.findDOMNode();a&&(0,n.addEvent)(a,w.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const a=this.findDOMNode();if(a){const{ownerDocument:s}=a;(0,n.removeEvent)(s,w.mouse.move,this.handleDrag),(0,n.removeEvent)(s,w.touch.move,this.handleDrag),(0,n.removeEvent)(s,w.mouse.stop,this.handleDragStop),(0,n.removeEvent)(s,w.touch.stop,this.handleDragStop),(0,n.removeEvent)(a,w.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 Ge.default=R,v(R,"displayName","DraggableCore"),v(R,"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}),v(R,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Ge}var En;function ro(){return En||(En=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return p.default}}),t.default=void 0;var e=_(j),r=v(Oe()),n=v(tr),o=v(eo),i=cn(),c=lr(),y=jt(),p=v(no()),S=v(ur());function v(s){return s&&s.__esModule?s:{default:s}}function T(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,C=new WeakMap;return(T=function(l){return l?C:f})(s)}function _(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var C=T(f);if(C&&C.has(s))return C.get(s);var l={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var g=m?Object.getOwnPropertyDescriptor(s,d):null;g&&(g.get||g.set)?Object.defineProperty(l,d,g):l[d]=s[d]}return l.default=s,C&&C.set(s,l),l}function w(){return w=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var C=arguments[f];for(var l in C)Object.prototype.hasOwnProperty.call(C,l)&&(s[l]=C[l])}return s},w.apply(this,arguments)}function b(s,f,C){return f=R(f),f in s?Object.defineProperty(s,f,{value:C,enumerable:!0,configurable:!0,writable:!0}):s[f]=C,s}function R(s){var f=h(s,"string");return typeof f=="symbol"?f:String(f)}function h(s,f){if(typeof s!="object"||s===null)return s;var C=s[Symbol.toPrimitive];if(C!==void 0){var l=C.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}class a extends e.Component{static getDerivedStateFromProps(f,C){let{position:l}=f,{prevPropsPosition:m}=C;return l&&(!m||l.x!==m.x||l.y!==m.y)?((0,S.default)("Draggable: getDerivedStateFromProps %j",{position:l,prevPropsPosition:m}),{x:l.x,y:l.y,prevPropsPosition:{...l}}):null}constructor(f){super(f),b(this,"onDragStart",(C,l)=>{if((0,S.default)("Draggable: onDragStart: %j",l),this.props.onStart(C,(0,c.createDraggableData)(this,l))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),b(this,"onDrag",(C,l)=>{if(!this.state.dragging)return!1;(0,S.default)("Draggable: onDrag: %j",l);const m=(0,c.createDraggableData)(this,l),d={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:F,y:D}=d;d.x+=this.state.slackX,d.y+=this.state.slackY;const[U,L]=(0,c.getBoundPosition)(this,d.x,d.y);d.x=U,d.y=L,d.slackX=this.state.slackX+(F-d.x),d.slackY=this.state.slackY+(D-d.y),m.x=d.x,m.y=d.y,m.deltaX=d.x-this.state.x,m.deltaY=d.y-this.state.y}if(this.props.onDrag(C,m)===!1)return!1;this.setState(d)}),b(this,"onDragStop",(C,l)=>{if(!this.state.dragging||this.props.onStop(C,(0,c.createDraggableData)(this,l))===!1)return!1;(0,S.default)("Draggable: onDragStop: %j",l);const d={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:F,y:D}=this.props.position;d.x=F,d.y=D}this.setState(d)}),this.state={dragging:!1,dragged:!1,x:f.position?f.position.x:f.defaultPosition.x,y:f.position?f.position.y:f.defaultPosition.y,prevPropsPosition:{...f.position},slackX:0,slackY:0,isElementSVG:!1},f.position&&!(f.onDrag||f.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 f,C;return(f=(C=this.props)===null||C===void 0||(C=C.nodeRef)===null||C===void 0?void 0:C.current)!==null&&f!==void 0?f:n.default.findDOMNode(this)}render(){const{axis:f,bounds:C,children:l,defaultPosition:m,defaultClassName:d,defaultClassNameDragging:g,defaultClassNameDragged:F,position:D,positionOffset:U,scale:L,...E}=this.props;let N={},W=null;const Z=!!!D||this.state.dragging,se=D||m,re={x:(0,c.canDragX)(this)&&Z?this.state.x:se.x,y:(0,c.canDragY)(this)&&Z?this.state.y:se.y};this.state.isElementSVG?W=(0,i.createSVGTransform)(re,U):N=(0,i.createCSSTransform)(re,U);const q=(0,o.default)(l.props.className||"",d,{[g]:this.state.dragging,[F]:this.state.dragged});return e.createElement(p.default,w({},E,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(l),{className:q,style:{...l.props.style,...N},transform:W}))}}t.default=a,b(a,"displayName","Draggable"),b(a,"propTypes",{...p.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",{...p.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(qt)),qt}var On;function dn(){if(On)return Be.exports;On=1;const{default:t,DraggableCore:e}=ro();return Be.exports=t,Be.exports.default=t,Be.exports.DraggableCore=e,Be.exports}var Xe={exports:{}},Ye={},vt={},Pn;function oo(){if(Pn)return vt;Pn=1,vt.__esModule=!0,vt.cloneElement=y;var t=e(j);function e(p){return p&&p.__esModule?p:{default:p}}function r(p,S){var v=Object.keys(p);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(p);S&&(T=T.filter(function(_){return Object.getOwnPropertyDescriptor(p,_).enumerable})),v.push.apply(v,T)}return v}function n(p){for(var S=1;S<arguments.length;S++){var v=arguments[S]!=null?arguments[S]:{};S%2?r(Object(v),!0).forEach(function(T){o(p,T,v[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(v)):r(Object(v)).forEach(function(T){Object.defineProperty(p,T,Object.getOwnPropertyDescriptor(v,T))})}return p}function o(p,S,v){return S=i(S),S in p?Object.defineProperty(p,S,{value:v,enumerable:!0,configurable:!0,writable:!0}):p[S]=v,p}function i(p){var S=c(p,"string");return typeof S=="symbol"?S:String(S)}function c(p,S){if(typeof p!="object"||p===null)return p;var v=p[Symbol.toPrimitive];if(v!==void 0){var T=v.call(p,S);if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(p)}function y(p,S){return S.style&&p.props.style&&(S.style=n(n({},p.props.style),S.style)),S.className&&p.props.className&&(S.className=p.props.className+" "+S.className),t.default.cloneElement(p,S)}return vt}var Ke={},Fn;function cr(){if(Fn)return Ke;Fn=1,Ke.__esModule=!0,Ke.resizableProps=void 0;var t=e(Oe());dn();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),c=0;c<o;c++)i[c]=arguments[c];var y=i[0];if(y.axis==="both"||y.axis==="y"){var p;return(p=t.default.number).isRequired.apply(p,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),c=0;c<o;c++)i[c]=arguments[c];var y=i[0];if(y.axis==="both"||y.axis==="x"){var p;return(p=t.default.number).isRequired.apply(p,i)}return t.default.number.apply(t.default,i)}};return Ke.resizableProps=r,Ke}var Dn;function dr(){if(Dn)return Ye;Dn=1,Ye.__esModule=!0,Ye.default=void 0;var t=c(j),e=dn(),r=oo(),n=cr(),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,f=new WeakMap;return(i=function(l){return l?f:s})(a)}function c(a,s){if(a&&a.__esModule)return a;if(a===null||typeof a!="object"&&typeof a!="function")return{default:a};var f=i(s);if(f&&f.has(a))return f.get(a);var C={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in a)if(m!=="default"&&Object.prototype.hasOwnProperty.call(a,m)){var d=l?Object.getOwnPropertyDescriptor(a,m):null;d&&(d.get||d.set)?Object.defineProperty(C,m,d):C[m]=a[m]}return C.default=a,f&&f.set(a,C),C}function y(){return y=Object.assign?Object.assign.bind():function(a){for(var s=1;s<arguments.length;s++){var f=arguments[s];for(var C in f)Object.prototype.hasOwnProperty.call(f,C)&&(a[C]=f[C])}return a},y.apply(this,arguments)}function p(a,s){if(a==null)return{};var f={},C=Object.keys(a),l,m;for(m=0;m<C.length;m++)l=C[m],!(s.indexOf(l)>=0)&&(f[l]=a[l]);return f}function S(a,s){var f=Object.keys(a);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(a);s&&(C=C.filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable})),f.push.apply(f,C)}return f}function v(a){for(var s=1;s<arguments.length;s++){var f=arguments[s]!=null?arguments[s]:{};s%2?S(Object(f),!0).forEach(function(C){T(a,C,f[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(f)):S(Object(f)).forEach(function(C){Object.defineProperty(a,C,Object.getOwnPropertyDescriptor(f,C))})}return a}function T(a,s,f){return s=_(s),s in a?Object.defineProperty(a,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):a[s]=f,a}function _(a){var s=w(a,"string");return typeof s=="symbol"?s:String(s)}function w(a,s){if(typeof a!="object"||a===null)return a;var f=a[Symbol.toPrimitive];if(f!==void 0){var C=f.call(a,s);if(typeof C!="object")return C;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,R(a,s)}function R(a,s){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(C,l){return C.__proto__=l,C},R(a,s)}var h=function(a){b(s,a);function s(){for(var C,l=arguments.length,m=new Array(l),d=0;d<l;d++)m[d]=arguments[d];return C=a.call.apply(a,[this].concat(m))||this,C.handleRefs={},C.lastHandleRect=null,C.slack=null,C}var f=s.prototype;return f.componentWillUnmount=function(){this.resetData()},f.resetData=function(){this.lastHandleRect=this.slack=null},f.runConstraints=function(l,m){var d=this.props,g=d.minConstraints,F=d.maxConstraints,D=d.lockAspectRatio;if(!g&&!F&&!D)return[l,m];if(D){var U=this.props.width/this.props.height,L=l-this.props.width,E=m-this.props.height;Math.abs(L)>Math.abs(E*U)?m=l/U:l=m*U}var N=l,W=m,B=this.slack||[0,0],Z=B[0],se=B[1];return l+=Z,m+=se,g&&(l=Math.max(g[0],l),m=Math.max(g[1],m)),F&&(l=Math.min(F[0],l),m=Math.min(F[1],m)),this.slack=[Z+(N-l),se+(W-m)],[l,m]},f.resizeHandler=function(l,m){var d=this;return function(g,F){var D=F.node,U=F.deltaX,L=F.deltaY;l==="onResizeStart"&&d.resetData();var E=(d.props.axis==="both"||d.props.axis==="x")&&m!=="n"&&m!=="s",N=(d.props.axis==="both"||d.props.axis==="y")&&m!=="e"&&m!=="w";if(!(!E&&!N)){var W=m[0],B=m[m.length-1],Z=D.getBoundingClientRect();if(d.lastHandleRect!=null){if(B==="w"){var se=Z.left-d.lastHandleRect.left;U+=se}if(W==="n"){var re=Z.top-d.lastHandleRect.top;L+=re}}d.lastHandleRect=Z,B==="w"&&(U=-U),W==="n"&&(L=-L);var q=d.props.width+(E?U/d.props.transformScale:0),k=d.props.height+(N?L/d.props.transformScale:0),ne=d.runConstraints(q,k);q=ne[0],k=ne[1];var oe=q!==d.props.width||k!==d.props.height,le=typeof d.props[l]=="function"?d.props[l]:null,pe=l==="onResize"&&!oe;le&&!pe&&(g.persist==null||g.persist(),le(g,{node:D,size:{width:q,height:k},handle:m})),l==="onResizeStop"&&d.resetData()}}},f.renderResizeHandle=function(l,m){var d=this.props.handle;if(!d)return t.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+l,ref:m});if(typeof d=="function")return d(l,m);var g=typeof d.type=="string",F=v({ref:m},g?{}:{handleAxis:l});return t.cloneElement(d,F)},f.render=function(){var l=this,m=this.props,d=m.children,g=m.className,F=m.draggableOpts;m.width,m.height,m.handle,m.handleSize,m.lockAspectRatio,m.axis,m.minConstraints,m.maxConstraints,m.onResize,m.onResizeStop,m.onResizeStart;var D=m.resizeHandles;m.transformScale;var U=p(m,o);return(0,r.cloneElement)(d,v(v({},U),{},{className:(g?g+" ":"")+"react-resizable",children:[].concat(d.props.children,D.map(function(L){var E,N=(E=l.handleRefs[L])!=null?E:l.handleRefs[L]=t.createRef();return t.createElement(e.DraggableCore,y({},F,{nodeRef:N,key:"resizableHandle-"+L,onStop:l.resizeHandler("onResizeStop",L),onStart:l.resizeHandler("onResizeStart",L),onDrag:l.resizeHandler("onResize",L)}),l.renderResizeHandle(L,N))}))}))},s}(t.Component);return Ye.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},Ye}var Ze={},Mn;function io(){if(Mn)return Ze;Mn=1,Ze.__esModule=!0,Ze.default=void 0;var t=y(j),e=i(Oe()),r=i(dr()),n=cr(),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 c(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,C=new WeakMap;return(c=function(m){return m?C:f})(s)}function y(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var C=c(f);if(C&&C.has(s))return C.get(s);var l={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var g=m?Object.getOwnPropertyDescriptor(s,d):null;g&&(g.get||g.set)?Object.defineProperty(l,d,g):l[d]=s[d]}return l.default=s,C&&C.set(s,l),l}function p(){return p=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var C=arguments[f];for(var l in C)Object.prototype.hasOwnProperty.call(C,l)&&(s[l]=C[l])}return s},p.apply(this,arguments)}function S(s,f){var C=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);f&&(l=l.filter(function(m){return Object.getOwnPropertyDescriptor(s,m).enumerable})),C.push.apply(C,l)}return C}function v(s){for(var f=1;f<arguments.length;f++){var C=arguments[f]!=null?arguments[f]:{};f%2?S(Object(C),!0).forEach(function(l){T(s,l,C[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(C)):S(Object(C)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(C,l))})}return s}function T(s,f,C){return f=_(f),f in s?Object.defineProperty(s,f,{value:C,enumerable:!0,configurable:!0,writable:!0}):s[f]=C,s}function _(s){var f=w(s,"string");return typeof f=="symbol"?f:String(f)}function w(s,f){if(typeof s!="object"||s===null)return s;var C=s[Symbol.toPrimitive];if(C!==void 0){var l=C.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}function b(s,f){if(s==null)return{};var C={},l=Object.keys(s),m,d;for(d=0;d<l.length;d++)m=l[d],!(f.indexOf(m)>=0)&&(C[m]=s[m]);return C}function R(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,h(s,f)}function h(s,f){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,m){return l.__proto__=m,l},h(s,f)}var a=function(s){R(f,s);function f(){for(var l,m=arguments.length,d=new Array(m),g=0;g<m;g++)d[g]=arguments[g];return l=s.call.apply(s,[this].concat(d))||this,l.state={width:l.props.width,height:l.props.height,propsWidth:l.props.width,propsHeight:l.props.height},l.onResize=function(F,D){var U=D.size;l.props.onResize?(F.persist==null||F.persist(),l.setState(U,function(){return l.props.onResize&&l.props.onResize(F,D)})):l.setState(U)},l}f.getDerivedStateFromProps=function(m,d){return d.propsWidth!==m.width||d.propsHeight!==m.height?{width:m.width,height:m.height,propsWidth:m.width,propsHeight:m.height}:null};var C=f.prototype;return C.render=function(){var m=this.props,d=m.handle,g=m.handleSize;m.onResize;var F=m.onResizeStart,D=m.onResizeStop,U=m.draggableOpts,L=m.minConstraints,E=m.maxConstraints,N=m.lockAspectRatio,W=m.axis;m.width,m.height;var B=m.resizeHandles,Z=m.style,se=m.transformScale,re=b(m,o);return t.createElement(r.default,{axis:W,draggableOpts:U,handle:d,handleSize:g,height:this.state.height,lockAspectRatio:N,maxConstraints:E,minConstraints:L,onResizeStart:F,onResize:this.onResize,onResizeStop:D,resizeHandles:B,transformScale:se,width:this.state.width},t.createElement("div",p({},re,{style:v(v({},Z),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},f}(t.Component);return Ze.default=a,a.propTypes=v(v({},n.resizableProps),{},{children:e.default.element}),Ze}var Nn;function ao(){return Nn||(Nn=1,Xe.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Xe.exports.Resizable=dr().default,Xe.exports.ResizableBox=io().default),Xe.exports}var we={},jn;function fr(){if(jn)return we;jn=1,Object.defineProperty(we,"__esModule",{value:!0}),we.resizeHandleType=we.resizeHandleAxesType=we.default=void 0;var t=r(Oe()),e=r(j);function r(i){return i&&i.__esModule?i:{default:i}}const n=we.resizeHandleAxesType=t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),o=we.resizeHandleType=t.default.oneOfType([t.default.node,t.default.func]);return we.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 c=i.layout;c!==void 0&&Ae().validateLayout(c,"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,c){const y=i[c],p={};e.default.Children.forEach(y,function(S){if((S==null?void 0:S.key)!=null){if(p[S.key])throw new Error('Duplicate child key "'+S.key+'" found! This will cause problems in ReactGridLayout.');p[S.key]=!0}})},innerRef:t.default.any},we}var Ln;function so(){if(Ln)return He;Ln=1,Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0;var t=p(j),e=p(Oe()),r=dn(),n=ao(),o=Ae(),i=un(),c=fr(),y=p(ln());function p(w){return w&&w.__esModule?w:{default:w}}function S(w,b,R){return b=v(b),b in w?Object.defineProperty(w,b,{value:R,enumerable:!0,configurable:!0,writable:!0}):w[b]=R,w}function v(w){var b=T(w,"string");return typeof b=="symbol"?b:String(b)}function T(w,b){if(typeof w!="object"||w===null)return w;var R=w[Symbol.toPrimitive];if(R!==void 0){var h=R.call(w,b);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(w)}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,R)=>{let{node:h}=R;const{onDragStart:a,transformScale:s}=this.props;if(!a)return;const f={top:0,left:0},{offsetParent:C}=h;if(!C)return;const l=C.getBoundingClientRect(),m=h.getBoundingClientRect(),d=m.left/s,g=l.left/s,F=m.top/s,D=l.top/s;f.left=d-g+C.scrollLeft,f.top=F-D+C.scrollTop,this.setState({dragging:f});const{x:U,y:L}=(0,i.calcXY)(this.getPositionParams(),f.top,f.left,this.props.w,this.props.h);return a.call(this,this.props.i,U,L,{e:b,node:h,newPosition:f})}),S(this,"onDrag",(b,R)=>{let{node:h,deltaX:a,deltaY:s}=R;const{onDrag:f}=this.props;if(!f)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let C=this.state.dragging.top+s,l=this.state.dragging.left+a;const{isBounded:m,i:d,w:g,h:F,containerWidth:D}=this.props,U=this.getPositionParams();if(m){const{offsetParent:B}=h;if(B){const{margin:Z,rowHeight:se,containerPadding:re}=this.props,q=B.clientHeight-(0,i.calcGridItemWHPx)(F,se,Z[1]);C=(0,i.clamp)(C-re[1],0,q);const k=(0,i.calcGridColWidth)(U),ne=D-(0,i.calcGridItemWHPx)(g,k,Z[0]);l=(0,i.clamp)(l-re[0],0,ne)}}const L={top:C,left:l};this.setState({dragging:L});const{containerPadding:E}=this.props,{x:N,y:W}=(0,i.calcXY)(U,C-E[1],l-E[0],g,F);return f.call(this,d,N,W,{e:b,node:h,newPosition:L})}),S(this,"onDragStop",(b,R)=>{let{node:h}=R;const{onDragStop:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:s,h:f,i:C,containerPadding:l}=this.props,{left:m,top:d}=this.state.dragging,g={top:d,left:m};this.setState({dragging:null});const{x:F,y:D}=(0,i.calcXY)(this.getPositionParams(),d-l[1],m-l[0],s,f);return a.call(this,C,F,D,{e:b,node:h,newPosition:g})}),S(this,"onResizeStop",(b,R,h)=>this.onResizeHandler(b,R,h,"onResizeStop")),S(this,"onResizeStart",(b,R,h)=>this.onResizeHandler(b,R,h,"onResizeStart")),S(this,"onResize",(b,R,h)=>this.onResizeHandler(b,R,h,"onResize"))}shouldComponentUpdate(b,R){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,R);return!(0,o.fastPositionEqual)(h,a)||this.props.useCSSTransforms!==b.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(b){this.moveDroppingItem(b)}moveDroppingItem(b){const{droppingPosition:R}=this.props;if(!R)return;const h=this.elementRef.current;if(!h)return;const a=b.droppingPosition||{left:0,top:0},{dragging:s}=this.state,f=s&&R.left!==a.left||R.top!==a.top;if(!s)this.onDragStart(R.e,{node:h,deltaX:R.left,deltaY:R.top});else if(f){const C=R.left-s.left,l=R.top-s.top;this.onDrag(R.e,{node:h,deltaX:C,deltaY:l})}}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:R,containerWidth:h,useCSSTransforms:a}=this.props;let s;return a?s=(0,o.setTransform)(b):(s=(0,o.setTopLeft)(b),R&&(s.left=(0,o.perc)(b.left/h),s.width=(0,o.perc)(b.width/h))),s}mixinDraggable(b,R){return t.default.createElement(r.DraggableCore,{disabled:!R,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,R){return(h,a)=>R(h,a,b)}mixinResizable(b,R,h){const{cols:a,minW:s,minH:f,maxW:C,maxH:l,transformScale:m,resizeHandles:d,resizeHandle:g}=this.props,F=this.getPositionParams(),D=(0,i.calcGridItemPosition)(F,0,0,a,0).width,U=(0,i.calcGridItemPosition)(F,0,0,s,f),L=(0,i.calcGridItemPosition)(F,0,0,C,l),E=[U.width,U.height],N=[Math.min(L.width,D),Math.min(L.height,1/0)];return t.default.createElement(n.Resizable,{draggableOpts:{disabled:!h},className:h?void 0:"react-resizable-hide",width:R.width,height:R.height,minConstraints:E,maxConstraints:N,onResizeStop:this.curryResizeHandler(R,this.onResizeStop),onResizeStart:this.curryResizeHandler(R,this.onResizeStart),onResize:this.curryResizeHandler(R,this.onResize),transformScale:m,resizeHandles:d,handle:g},b)}onResizeHandler(b,R,h,a){let{node:s,size:f,handle:C}=R;const l=this.props[a];if(!l)return;const{x:m,y:d,i:g,maxH:F,minH:D,containerWidth:U}=this.props,{minW:L,maxW:E}=this.props;let N=f;s&&(N=(0,o.resizeItemInDirection)(C,h,f,U),this.setState({resizing:a==="onResizeStop"?null:N}));let{w:W,h:B}=(0,i.calcWH)(this.getPositionParams(),N.width,N.height,m,d,C);W=(0,i.clamp)(W,Math.max(L,1),E),B=(0,i.clamp)(B,D,F),l.call(this,g,W,B,{e:b,node:s,size:N,handle:C})}render(){const{x:b,y:R,w:h,h:a,isDraggable:s,isResizable:f,droppingPosition:C,useCSSTransforms:l}=this.props,m=(0,i.calcGridItemPosition)(this.getPositionParams(),b,R,h,a,this.state),d=t.default.Children.only(this.props.children);let g=t.default.cloneElement(d,{ref:this.elementRef,className:(0,y.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":s,"react-draggable-dragging":!!this.state.dragging,dropping:!!C,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(m)}});return g=this.mixinResizable(g,m,f),g=this.mixinDraggable(g,s),g}};return He.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(w,b){const R=w[b];if(typeof R!="number")return new Error("minWidth not Number");if(R>w.w||R>w.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(w,b){const R=w[b];if(typeof R!="number")return new Error("maxWidth not Number");if(R<w.w||R<w.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(w,b){const R=w[b];if(typeof R!="number")return new Error("minHeight not Number");if(R>w.h||R>w.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(w,b){const R=w[b];if(typeof R!="number")return new Error("maxHeight not Number");if(R<w.h||R<w.minH)return new Error("maxHeight smaller than item height/minHeight")},i:e.default.string.isRequired,resizeHandles:c.resizeHandleAxesType,resizeHandle:c.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}),He}var Un;function pr(){if(Un)return We;Un=1,Object.defineProperty(We,"__esModule",{value:!0}),We.default=void 0;var t=S(j),e=sn(),r=y(ln()),n=Ae(),o=un(),i=y(so()),c=y(fr());function y(h){return h&&h.__esModule?h:{default:h}}function p(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(p=function(f){return f?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=p(a);if(s&&s.has(h))return s.get(h);var f={__proto__:null},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in h)if(l!=="default"&&Object.prototype.hasOwnProperty.call(h,l)){var m=C?Object.getOwnPropertyDescriptor(h,l):null;m&&(m.get||m.set)?Object.defineProperty(f,l,m):f[l]=h[l]}return f.default=h,s&&s.set(h,f),f}function v(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 f=s.call(h,a);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const w="react-grid-layout";let b=!1;try{b=/firefox/i.test(navigator.userAgent)}catch{}let R=class extends t.Component{constructor(){super(...arguments),v(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:[]}),v(this,"dragEnterCounter",0),v(this,"onDragStart",(a,s,f,C)=>{let{e:l,node:m}=C;const{layout:d}=this.state,g=(0,n.getLayoutItem)(d,a);if(!g)return;const F={w:g.w,h:g.h,x:g.x,y:g.y,placeholder:!0,i:a};return this.setState({oldDragItem:(0,n.cloneLayoutItem)(g),oldLayout:d,activeDrag:F}),this.props.onDragStart(d,g,g,null,l,m)}),v(this,"onDrag",(a,s,f,C)=>{let{e:l,node:m}=C;const{oldDragItem:d}=this.state;let{layout:g}=this.state;const{cols:F,allowOverlap:D,preventCollision:U}=this.props,L=(0,n.getLayoutItem)(g,a);if(!L)return;const E={w:L.w,h:L.h,x:L.x,y:L.y,placeholder:!0,i:a};g=(0,n.moveElement)(g,L,s,f,!0,U,(0,n.compactType)(this.props),F,D),this.props.onDrag(g,d,L,E,l,m),this.setState({layout:D?g:(0,n.compact)(g,(0,n.compactType)(this.props),F),activeDrag:E})}),v(this,"onDragStop",(a,s,f,C)=>{let{e:l,node:m}=C;if(!this.state.activeDrag)return;const{oldDragItem:d}=this.state;let{layout:g}=this.state;const{cols:F,preventCollision:D,allowOverlap:U}=this.props,L=(0,n.getLayoutItem)(g,a);if(!L)return;g=(0,n.moveElement)(g,L,s,f,!0,D,(0,n.compactType)(this.props),F,U);const N=U?g:(0,n.compact)(g,(0,n.compactType)(this.props),F);this.props.onDragStop(N,d,L,null,l,m);const{oldLayout:W}=this.state;this.setState({activeDrag:null,layout:N,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(N,W)}),v(this,"onResizeStart",(a,s,f,C)=>{let{e:l,node:m}=C;const{layout:d}=this.state,g=(0,n.getLayoutItem)(d,a);g&&(this.setState({oldResizeItem:(0,n.cloneLayoutItem)(g),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(d,g,g,null,l,m))}),v(this,"onResize",(a,s,f,C)=>{let{e:l,node:m,size:d,handle:g}=C;const{oldResizeItem:F}=this.state,{layout:D}=this.state,{cols:U,preventCollision:L,allowOverlap:E}=this.props;let N=!1,W,B,Z;const[se,re]=(0,n.withLayoutItem)(D,a,k=>{let ne;return B=k.x,Z=k.y,["sw","w","nw","n","ne"].indexOf(g)!==-1&&(["sw","nw","w"].indexOf(g)!==-1&&(B=k.x+(k.w-s),s=k.x!==B&&B<0?k.w:s,B=B<0?0:B),["ne","n","nw"].indexOf(g)!==-1&&(Z=k.y+(k.h-f),f=k.y!==Z&&Z<0?k.h:f,Z=Z<0?0:Z),N=!0),L&&!E&&(ne=(0,n.getAllCollisions)(D,{...k,w:s,h:f,x:B,y:Z}).filter(le=>le.i!==k.i).length>0,ne&&(Z=k.y,f=k.h,B=k.x,s=k.w,N=!1)),k.w=s,k.h=f,k});if(!re)return;W=se,N&&(W=(0,n.moveElement)(se,re,B,Z,!0,this.props.preventCollision,(0,n.compactType)(this.props),U,E));const q={w:re.w,h:re.h,x:re.x,y:re.y,static:!0,i:a};this.props.onResize(W,F,re,q,l,m),this.setState({layout:E?W:(0,n.compact)(W,(0,n.compactType)(this.props),U),activeDrag:q})}),v(this,"onResizeStop",(a,s,f,C)=>{let{e:l,node:m}=C;const{layout:d,oldResizeItem:g}=this.state,{cols:F,allowOverlap:D}=this.props,U=(0,n.getLayoutItem)(d,a),L=D?d:(0,n.compact)(d,(0,n.compactType)(this.props),F);this.props.onResizeStop(L,g,U,null,l,m);const{oldLayout:E}=this.state;this.setState({activeDrag:null,layout:L,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(L,E)}),v(this,"onDragOver",a=>{var se;if(a.preventDefault(),a.stopPropagation(),b&&!((se=a.nativeEvent.target)!=null&&se.classList.contains(w)))return!1;const{droppingItem:s,onDropDragOver:f,margin:C,cols:l,rowHeight:m,maxRows:d,width:g,containerPadding:F,transformScale:D}=this.props,U=f==null?void 0:f(a);if(U===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const L={...s,...U},{layout:E}=this.state,N=a.currentTarget.getBoundingClientRect(),W=a.clientX-N.left,B=a.clientY-N.top,Z={left:W/D,top:B/D,e:a};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:re,top:q}=this.state.droppingPosition;(re!=W||q!=B)&&this.setState({droppingPosition:Z})}}else{const re={cols:l,margin:C,maxRows:d,rowHeight:m,containerWidth:g,containerPadding:F||C},q=(0,o.calcXY)(re,B,W,L.w,L.h);this.setState({droppingDOMNode:t.createElement("div",{key:L.i}),droppingPosition:Z,layout:[...E,{...L,x:q.x,y:q.y,static:!1,isDraggable:!0}]})}}),v(this,"removeDroppingPlaceholder",()=>{const{droppingItem:a,cols:s}=this.props,{layout:f}=this.state,C=(0,n.compact)(f.filter(l=>l.i!==a.i),(0,n.compactType)(this.props),s,this.props.allowOverlap);this.setState({layout:C,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),v(this,"onDragLeave",a=>{a.preventDefault(),a.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),v(this,"onDragEnter",a=>{a.preventDefault(),a.stopPropagation(),this.dragEnterCounter++}),v(this,"onDrop",a=>{a.preventDefault(),a.stopPropagation();const{droppingItem:s}=this.props,{layout:f}=this.state,C=f.find(l=>l.i===s.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(f,C,a)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(a,s){let f;return s.activeDrag?null:(!(0,e.deepEqual)(a.layout,s.propsLayout)||a.compactType!==s.compactType?f=a.layout:(0,n.childrenEqual)(a.children,s.children)||(f=s.layout),f?{layout:(0,n.synchronizeLayoutWithChildren)(f,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 f=this.state.layout,C=s.layout;this.onLayoutMaybeChanged(f,C)}}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:f,margin:C,containerPadding:l,rowHeight:m,maxRows:d,useCSSTransforms:g,transformScale:F}=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:f,margin:C,containerPadding:l||C,maxRows:d,rowHeight:m,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:g,transformScale:F},t.createElement("div",null))}processGridItem(a,s){if(!a||!a.key)return;const f=(0,n.getLayoutItem)(this.state.layout,String(a.key));if(!f)return null;const{width:C,cols:l,margin:m,containerPadding:d,rowHeight:g,maxRows:F,isDraggable:D,isResizable:U,isBounded:L,useCSSTransforms:E,transformScale:N,draggableCancel:W,draggableHandle:B,resizeHandles:Z,resizeHandle:se}=this.props,{mounted:re,droppingPosition:q}=this.state,k=typeof f.isDraggable=="boolean"?f.isDraggable:!f.static&&D,ne=typeof f.isResizable=="boolean"?f.isResizable:!f.static&&U,oe=f.resizeHandles||Z,le=k&&L&&f.isBounded!==!1;return t.createElement(i.default,{containerWidth:C,cols:l,margin:m,containerPadding:d||m,maxRows:F,rowHeight:g,cancel:W,handle:B,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:k,isResizable:ne,isBounded:le,useCSSTransforms:E&&re,usePercentages:!re,transformScale:N,w:f.w,h:f.h,x:f.x,y:f.y,i:f.i,minH:f.minH,minW:f.minW,maxH:f.maxH,maxW:f.maxW,static:f.static,droppingPosition:s?q:void 0,resizeHandles:oe,resizeHandle:se},a)}render(){const{className:a,style:s,isDroppable:f,innerRef:C}=this.props,l=(0,r.default)(w,a),m={height:this.containerHeight(),...s};return t.createElement("div",{ref:C,className:l,style:m,onDrop:f?this.onDrop:n.noop,onDragLeave:f?this.onDragLeave:n.noop,onDragEnter:f?this.onDragEnter:n.noop,onDragOver:f?this.onDragOver:n.noop},t.Children.map(this.props.children,d=>this.processGridItem(d)),f&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return We.default=R,v(R,"displayName","ReactGridLayout"),v(R,"propTypes",c.default),v(R,"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}),We}var Je={},De={},Vn;function hr(){if(Vn)return De;Vn=1,Object.defineProperty(De,"__esModule",{value:!0}),De.findOrGenerateResponsiveLayout=n,De.getBreakpointFromWidth=e,De.getColsFromBreakpoint=r,De.sortBreakpoints=o;var t=Ae();function e(i,c){const y=o(i);let p=y[0];for(let S=1,v=y.length;S<v;S++){const T=y[S];c>i[T]&&(p=T)}return p}function r(i,c){if(!c[i])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+i+" is missing!");return c[i]}function n(i,c,y,p,S,v){if(i[y])return(0,t.cloneLayout)(i[y]);let T=i[p];const _=o(c),w=_.slice(_.indexOf(y));for(let b=0,R=w.length;b<R;b++){const h=w[b];if(i[h]){T=i[h];break}}return T=(0,t.cloneLayout)(T||[]),(0,t.compact)((0,t.correctBounds)(T,{cols:S}),v,S)}function o(i){return Object.keys(i).sort(function(y,p){return i[y]-i[p]})}return De}var zn;function lo(){if(zn)return Je;zn=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var t=p(j),e=c(Oe()),r=sn(),n=Ae(),o=hr(),i=c(pr());function c(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(f){return f?s:a})(h)}function p(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 f={__proto__:null},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in h)if(l!=="default"&&Object.prototype.hasOwnProperty.call(h,l)){var m=C?Object.getOwnPropertyDescriptor(h,l):null;m&&(m.get||m.set)?Object.defineProperty(f,l,m):f[l]=h[l]}return f.default=h,s&&s.set(h,f),f}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 f in s)Object.prototype.hasOwnProperty.call(s,f)&&(h[f]=s[f])}return h},S.apply(this,arguments)}function v(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 f=s.call(h,a);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const w=h=>Object.prototype.toString.call(h);function b(h,a){return h==null?null:Array.isArray(h)?h:h[a]}let R=class extends t.Component{constructor(){super(...arguments),v(this,"state",this.generateInitialState()),v(this,"onLayoutChange",a=>{this.props.onLayoutChange(a,{...this.props.layouts,[this.state.breakpoint]:a})})}generateInitialState(){const{width:a,breakpoints:s,layouts:f,cols:C}=this.props,l=(0,o.getBreakpointFromWidth)(s,a),m=(0,o.getColsFromBreakpoint)(l,C),d=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,o.findOrGenerateResponsiveLayout)(f,s,l,l,m,d),breakpoint:l,cols:m}}static getDerivedStateFromProps(a,s){if(!(0,r.deepEqual)(a.layouts,s.layouts)){const{breakpoint:f,cols:C}=s;return{layout:(0,o.findOrGenerateResponsiveLayout)(a.layouts,a.breakpoints,f,f,C,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:f,layouts:C,compactType:l}=this.props,m=this.props.breakpoint||(0,o.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),d=this.state.breakpoint,g=(0,o.getColsFromBreakpoint)(m,f),F={...C};if(d!==m||a.breakpoints!==s||a.cols!==f){d in F||(F[d]=(0,n.cloneLayout)(this.state.layout));let L=(0,o.findOrGenerateResponsiveLayout)(F,s,m,d,g,l);L=(0,n.synchronizeLayoutWithChildren)(L,this.props.children,g,l,this.props.allowOverlap),F[m]=L,this.props.onLayoutChange(L,F),this.props.onBreakpointChange(m,g),this.setState({breakpoint:m,layout:L,cols:g})}const D=b(this.props.margin,m),U=b(this.props.containerPadding,m);this.props.onWidthChange(this.props.width,D,g,U)}render(){const{breakpoint:a,breakpoints:s,cols:f,layouts:C,margin:l,containerPadding:m,onBreakpointChange:d,onLayoutChange:g,onWidthChange:F,...D}=this.props;return t.createElement(i.default,S({},D,{margin:b(l,this.state.breakpoint),containerPadding:b(m,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return Je.default=R,v(R,"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(w(h[a])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+w(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}),v(R,"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}),Je}var yt={},mr=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 c=i[o];r.call(n,c[1],c[0])}},e}()}(),Kt=typeof window<"u"&&typeof document<"u"&&window.document===document,It=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")()}(),uo=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(It):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),co=2;function fo(t,e){var r=!1,n=!1,o=0;function i(){r&&(r=!1,t()),n&&y()}function c(){uo(i)}function y(){var p=Date.now();if(r){if(p-o<co)return;n=!0}else r=!0,n=!1,setTimeout(c,e);o=p}return y}var po=20,ho=["top","right","bottom","left","width","height","size","weight"],mo=typeof MutationObserver<"u",go=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=fo(this.refresh.bind(this),po)}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(){!Kt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mo?(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(){!Kt||!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=ho.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}(),gr=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},ze=function(t){var e=t&&t.ownerDocument&&t.ownerDocument.defaultView;return e||It},vr=Lt(0,0,0,0);function _t(t){return parseFloat(t)||0}function kn(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+_t(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],c=t["padding-"+i];r[i]=_t(c)}return r}function yo(t){var e=t.getBBox();return Lt(0,0,e.width,e.height)}function Co(t){var e=t.clientWidth,r=t.clientHeight;if(!e&&!r)return vr;var n=ze(t).getComputedStyle(t),o=vo(n),i=o.left+o.right,c=o.top+o.bottom,y=_t(n.width),p=_t(n.height);if(n.boxSizing==="border-box"&&(Math.round(y+i)!==e&&(y-=kn(n,"left","right")+i),Math.round(p+c)!==r&&(p-=kn(n,"top","bottom")+c)),!So(t)){var S=Math.round(y+i)-e,v=Math.round(p+c)-r;Math.abs(S)!==1&&(y-=S),Math.abs(v)!==1&&(p-=v)}return Lt(o.left,o.top,y,p)}var bo=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof ze(t).SVGGraphicsElement}:function(t){return t instanceof ze(t).SVGElement&&typeof t.getBBox=="function"}}();function So(t){return t===ze(t).document.documentElement}function Ro(t){return Kt?bo(t)?yo(t):Co(t):vr}function To(t){var e=t.x,r=t.y,n=t.width,o=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(i.prototype);return gr(c,{x:e,y:r,width:n,height:o,top:r,right:e+n,bottom:o+r,left:e}),c}function Lt(t,e,r,n){return{x:t,y:e,width:r,height:n}}var wo=function(){function t(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Lt(0,0,0,0),this.target=e}return t.prototype.isActive=function(){var e=Ro(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}(),xo=function(){function t(e,r){var n=To(r);gr(this,{target:e,contentRect:n})}return t}(),Io=function(){function t(e,r,n){if(this.activeObservations_=[],this.observations_=new mr,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 ze(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(e)||(r.set(e,new wo(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 ze(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 xo(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}(),yr=typeof WeakMap<"u"?new WeakMap:new mr,Cr=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=go.getInstance(),n=new Io(e,r,this);yr.set(this,n)}return t}();["observe","unobserve","disconnect"].forEach(function(t){Cr.prototype[t]=function(){var e;return(e=yr.get(this))[t].apply(e,arguments)}});var _o=function(){return typeof It.ResizeObserver<"u"?It.ResizeObserver:Cr}();const Eo=Object.freeze(Object.defineProperty({__proto__:null,default:_o},Symbol.toStringTag,{value:"Module"})),Oo=ar(Eo);var $n;function Po(){if($n)return yt;$n=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=_;var t=c(j),e=o(Oe()),r=o(Oo),n=o(ln());function o(w){return w&&w.__esModule?w:{default:w}}function i(w){if(typeof WeakMap!="function")return null;var b=new WeakMap,R=new WeakMap;return(i=function(h){return h?R:b})(w)}function c(w,b){if(w&&w.__esModule)return w;if(w===null||typeof w!="object"&&typeof w!="function")return{default:w};var R=i(b);if(R&&R.has(w))return R.get(w);var h={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in w)if(s!=="default"&&Object.prototype.hasOwnProperty.call(w,s)){var f=a?Object.getOwnPropertyDescriptor(w,s):null;f&&(f.get||f.set)?Object.defineProperty(h,s,f):h[s]=w[s]}return h.default=w,R&&R.set(w,h),h}function y(){return y=Object.assign?Object.assign.bind():function(w){for(var b=1;b<arguments.length;b++){var R=arguments[b];for(var h in R)Object.prototype.hasOwnProperty.call(R,h)&&(w[h]=R[h])}return w},y.apply(this,arguments)}function p(w,b,R){return b=S(b),b in w?Object.defineProperty(w,b,{value:R,enumerable:!0,configurable:!0,writable:!0}):w[b]=R,w}function S(w){var b=v(w,"string");return typeof b=="symbol"?b:String(b)}function v(w,b){if(typeof w!="object"||w===null)return w;var R=w[Symbol.toPrimitive];if(R!==void 0){var h=R.call(w,b);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(w)}const T="react-grid-layout";function _(w){var b;return b=class extends t.Component{constructor(){super(...arguments),p(this,"state",{width:1280}),p(this,"elementRef",t.createRef()),p(this,"mounted",!1),p(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new r.default(a=>{if(this.elementRef.current instanceof HTMLElement){const f=a[0].contentRect.width;this.setState({width:f})}});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(w,y({innerRef:this.elementRef},a,this.state))}},p(b,"defaultProps",{measureBeforeMount:!1}),p(b,"propTypes",{measureBeforeMount:e.default.bool}),b}return yt}var An;function Fo(){return An||(An=1,function(t){t.exports=pr().default,t.exports.utils=Ae(),t.exports.calculateUtils=un(),t.exports.Responsive=lo().default,t.exports.Responsive.utils=hr(),t.exports.WidthProvider=Po().default}(Vt)),Vt.exports}var Do=Fo();const Mo=Xr(Do);var No=Object.getOwnPropertyDescriptor,jo=(t,e,r,n)=>{for(var o=n>1?void 0:n?No(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Lo=(t,e)=>(r,n)=>e(r,n,t);let ke=class extends x.Disposable{constructor(e){super();Ie(this,"_initLocal",()=>{});Ie(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 c=[];return this._findReplaceIndex(i).forEach((y,p,S)=>{const v=S[p-1]||{endIndex:-1};if(v.endIndex+1<y.startIndex){const T=i.slice(v.endIndex+1,y.startIndex);T&&c.push(T)}if(r[y.key]&&c.push(r[y.key]),p===S.length-1){const T=i.slice(y.endIndex+1);T&&c.push(T)}}),c}return[]}};ke=jo([Lo(0,x.Inject(x.LocaleService))],ke);const Uo="univer-cf-preview",Ct={cfPreview:Uo},qe=t=>{var o,i;const e=t.rule;if(!e)return null;const r=j.useMemo(()=>{if(e.type===u.CFRuleType.colorScale){const c=e.config.map((S,v)=>({color:new x.ColorKit(S.color),value:v})),y=c.length-1;return new Array(5).fill("").map((S,v,T)=>v*y/(T.length-1)).map(S=>u.getColorScaleFromValue(c,S))}return null},[e]),n=j.useMemo(()=>{if(e.type===u.CFRuleType.iconSet)return e.config.map(c=>{const y=u.iconMap[c.iconType];return y&&y[Number(c.iconId)]})},[e]);switch(e.type){case u.CFRuleType.dataBar:{const{isGradient:c}=e.config,y={width:"50%",height:"100%"},p=c?`linear-gradient(to right, ${e.config.positiveColor||u.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,S=c?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||u.defaultDataBarNativeColor})`:e.config.nativeColor;return I.jsxs("div",{className:Ct.cfPreview,children:[I.jsx("div",{style:{...y,background:S,border:`1px solid ${e.config.nativeColor||u.defaultDataBarNativeColor}`}}),I.jsx("div",{style:{...y,background:p,border:`1px solid ${e.config.positiveColor||u.defaultDataBarPositiveColor}`}})]})}case u.CFRuleType.colorScale:return r&&I.jsx("div",{className:Ct.cfPreview,children:r.map((c,y)=>I.jsx("div",{style:{width:`${100/r.length}%`,height:"100%",background:c}},y))});case u.CFRuleType.iconSet:return n&&I.jsx("div",{className:Ct.cfPreview,children:n.map((c,y)=>c?I.jsx("img",{style:{height:"100%"},src:c},y):I.jsx(ft,{},y))});case u.CFRuleType.highlightCell:{const{ul:c,st:y,it:p,bl:S,bg:v,cl:T}=e.style,_=(c==null?void 0:c.s)===x.BooleanNumber.TRUE,w=(y==null?void 0:y.s)===x.BooleanNumber.TRUE,b=p===x.BooleanNumber.TRUE,R=S===x.BooleanNumber.TRUE,h=(o=v==null?void 0:v.rgb)!=null?o:u.DEFAULT_BG_COLOR,a=(i=T==null?void 0:T.rgb)!=null?i:u.DEFAULT_FONT_COLOR,s={fontWeight:R?"bold":void 0,fontStyle:b?"italic":void 0,textDecoration:`${_?"underline":""} ${w?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:h,color:a};return I.jsx("div",{style:s,className:Ct.cfPreview,children:"123"})}}return null},Vo="univer-cf-rule-list",zo="univer-rule-selector",ko="univer-select",$o="univer-btn-list",Ao="univer-gap",qo="univer-icon",Wo="univer-disabled",Ho="univer-rule-item",Bo="univer-rule-describe",Go="univer-rule-type",Xo="univer-rule-range",Yo="univer-active",Ko="univer-draggableHandle",Zo="univer-delete-item",Jo="univer-grid-layout-wrap",he={cfRuleList:Vo,ruleSelector:zo,select:ko,btnList:$o,gap:Ao,icon:qo,disabled:Wo,ruleItem:Ho,ruleDescribe:Bo,ruleType:Go,ruleRange:Xo,active:Yo,draggableHandle:Ko,deleteItem:Zo,gridLayoutWrap:Jo},Qo=(t,e)=>{const r=t.rule;switch(r.type){case u.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case u.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case u.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case u.CFRuleType.highlightCell:switch(r.subType){case u.CFSubRuleType.average:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,e.t("sheet.cf.subRuleType.average"))}case u.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case u.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case u.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 u.CFSubRuleType.text:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,r.value||"")}case u.CFSubRuleType.timePeriod:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`)}case u.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 u.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let qn=0;const ei=t=>{const{onClick:e}=t,r=ee.useDependency(u.ConditionalFormattingRuleModel),n=ee.useDependency(x.IUniverInstanceService),o=ee.useDependency(Y.SheetsSelectionsService),i=ee.useDependency(x.ICommandService),c=ee.useDependency(x.LocaleService),y=ee.useDependency(x.Injector),p=ee.useDependency(ke),S=ee.useObservable(()=>n.getCurrentTypeOfUnit$(x.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),v=S.getUnitId(),T=S.getActiveSheet();if(!T)throw new Error("No active sheet found");const _=T.getSheetId(),[w,b]=j.useState([]),[R,h]=j.useState("2"),[a,s]=j.useState(0),[f,C]=j.useState(-1),[l,m]=j.useState(qn),d=j.useRef(null),g=[{label:c.t("sheet.cf.panel.workSheet"),value:"2"},{label:c.t("sheet.cf.panel.selectedRange"),value:"1"}],F=()=>{const q=r.getSubunitRules(v,_);if(!q||!q.length)return[];if(R==="1"){const k=o.getCurrentLastSelection();if(!k)return[];const ne=k.range;return q.filter(le=>le.ranges.some(pe=>x.Rectangle.intersects(pe,ne)))}else if(R==="2")return[...q];return[]},[D,U]=j.useState(F);de.useHighlightRange(w),j.useEffect(()=>{const q=i.onCommandExecuted(k=>{k.id===Y.SetWorksheetActiveOperation.id&&s(Math.random())});return()=>q.dispose()}),j.useEffect(()=>{U(F)},[R,a,v,_]),j.useEffect(()=>{if(R==="2")return;const q=new Se.Observable(k=>{const ne=[Y.SetSelectionsOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],oe=i.onCommandExecuted(le=>{const{id:pe,params:ge}=le,be=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId();ne.includes(pe)&&ge.unitId===be&&k.next(null)});return()=>oe.dispose()}).pipe(Se.debounceTime(16)).subscribe(()=>{U(F)});return()=>{q.unsubscribe()}},[n,R,v,_]),j.useEffect(()=>{const q=r.$ruleChange.subscribe(()=>{s(Math.random())});return()=>q.unsubscribe()},[r]),j.useEffect(()=>{const q=()=>{var le;const oe=Math.max(0,(((le=d.current)==null?void 0:le.getBoundingClientRect().width)||0)-8);return qn=oe,oe},ne=new Se.Observable(oe=>{const le=document.querySelector(".univer-sidebar");if(le){let pe=setTimeout(()=>{oe.next()},150);const ge=()=>{pe&&clearTimeout(pe),pe=null},be=$=>{$.propertyName==="width"&&(ge(),oe.next())};return le.addEventListener("transitionend",be),()=>{ge(),le.removeEventListener("transitionend",be)}}}).pipe(Se.debounceTime(16)).subscribe(()=>{m(q())});return()=>{ne.unsubscribe()}},[]);const L=q=>{var oe;const k=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),ne=(oe=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:oe.getSheetId();if(!k||!ne)throw new Error("No active sheet found");i.executeCommand(u.DeleteCfCommand.id,{unitId:k,subUnitId:ne,cfId:q.cfId})},E=(q,k)=>{C(k.y)},N=(q,k,ne)=>{var $;C(-1);const oe=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),le=($=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:$.getSheetId();if(!oe||!le)throw new Error("No active sheet found");const pe=J=>{const ae=D.length;return Math.min(ae-1,Math.max(0,J))},ge=D[pe(k.y)].cfId,be=D[pe(ne.y)].cfId;ge!==be&&i.executeCommand(u.MoveCfCommand.id,{unitId:oe,subUnitId:le,start:{id:ge,type:"self"},end:{id:be,type:ne.y>k.y?"after":"before"}})},W=()=>{t.onCreate()},B=()=>{R==="2"?i.executeCommand(u.ClearWorksheetCfCommand.id):R==="1"&&D.map(k=>({unitId:v,subUnitId:_,cfId:k.cfId})).forEach(k=>{i.executeCommand(u.DeleteCfCommand.id,k)})},Z=j.useMemo(()=>{const q=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),k=q.getActiveSheet();return D.filter(ne=>{const oe=ne.ranges;return Y.checkRangesEditablePermission(y,q.getUnitId(),k.getSheetId(),oe)})},[D]),se=Z.map((q,k)=>({i:q.cfId,x:0,w:12,y:k,h:1,isResizable:!1})),re=j.useMemo(()=>{const q=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),k=q.getActiveSheet();return D.every(ne=>{const oe=ne.ranges;return Y.checkRangesEditablePermission(y,q.getUnitId(),k.getSheetId(),oe)})},[D]);return I.jsxs("div",{className:he.cfRuleList,children:[I.jsxs("div",{className:he.ruleSelector,children:[I.jsx("div",{children:p.tWithReactNode("sheet.cf.panel.managerRuleSelect",I.jsx(Q.Select,{className:he.select,options:g,value:R,onChange:q=>{h(q)}})).map((q,k)=>I.jsx("span",{children:q},k))}),I.jsxs("div",{className:he.btnList,children:[I.jsx(Q.Tooltip,{title:c.t("sheet.cf.panel.createRule"),placement:"bottom",children:I.jsx("div",{className:`
4
- ${he.icon}
5
- `,onClick:W,children:I.jsx(or,{})})}),D.length&&re?I.jsx(Q.Tooltip,{title:c.t("sheet.cf.panel.clear"),placement:"bottom",children:I.jsx("div",{className:`
6
- ${he.gap}
7
- ${he.icon}
8
- `,onClick:B,children:I.jsx(xt,{})})}):I.jsx("div",{className:`
9
- ${he.gap}
10
- ${he.disabled}
11
- `,children:I.jsx(xt,{})})]})]}),I.jsx("div",{ref:d,className:he.gridLayoutWrap,children:l?I.jsx(Mo,{onDragStop:N,onDragStart:E,layout:se,cols:12,rowHeight:60,width:l,margin:[0,10],draggableHandle:".draggableHandle",children:Z==null?void 0:Z.map((q,k)=>I.jsx("div",{children:I.jsxs("div",{onMouseMove:()=>{q.ranges!==w&&b(q.ranges)},onMouseLeave:()=>b([]),onClick:()=>{e(q)},className:`
12
- ${he.ruleItem}
13
- ${f===k?he.active:""}
14
- `,children:[I.jsx("div",{className:`
15
- ${he.draggableHandle}
16
- draggableHandle
17
- `,onClick:ne=>ne.stopPropagation(),children:I.jsx(ir,{})}),I.jsxs("div",{className:he.ruleDescribe,children:[I.jsx("div",{className:he.ruleType,children:Qo(q,c)}),I.jsx("div",{className:he.ruleRange,children:q.ranges.map(ne=>Yt.serializeRange(ne)).join(",")})]}),I.jsx("div",{className:he.preview,children:I.jsx(qe,{rule:q.rule})}),I.jsx("div",{className:`
18
- ${he.deleteItem}
19
- ${f===k?he.active:""}
20
- `,onClick:ne=>{ne.stopPropagation(),L(q),b([])},children:I.jsx(xt,{})})]})},`${q.cfId}`))}):null})]})},ti="univer-cf-color-picker-icon",ni="univer-icon-dropdown",Wn={cfColorPickerIcon:ti,iconDropdown:ni},Ne=t=>{const{color:e,onChange:r,disable:n=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:c=!0}=t,y=ee.useDependency(ee.ComponentManager),p=j.useMemo(()=>new x.ColorKit(e),[e]),S=y.get(o);return S&&(n?I.jsx(S,{className:i,extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}):I.jsx(Q.Dropdown,{overlay:I.jsx("div",{className:"univer-rounded-lg univer-p-4",children:I.jsx(Q.ColorPicker,{value:e,onChange:r})}),children:I.jsxs("span",{className:`
3
+ `,d.getElementsByTagName("head")[0].appendChild(g)),d.body&&l(d.body,"react-draggable-transparent-selection")}function C(d){if(d)try{if(d.body&&m(d.body,"react-draggable-transparent-selection"),d.selection)d.selection.empty();else{const g=(d.defaultView||window).getSelection();g&&g.type!=="Caret"&&g.removeAllRanges()}}catch{}}function l(d,g){d.classList?d.classList.add(g):d.className.match(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)")))||(d.className+=" ".concat(g))}function m(d,g){d.classList?d.classList.remove(g):d.className=d.className.replace(new RegExp("(?:^|\\s)".concat(g,"(?!\\S)"),"g"),"")}return pe}var Re={},xn;function lr(){if(xn)return Re;xn=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.canDragX=o,Re.canDragY=i,Re.createCoreData=y,Re.createDraggableData=p,Re.getBoundPosition=r,Re.getControlPosition=c,Re.snapToGrid=n;var t=jt(),e=cn();function r(R,_,T){if(!R.props.bounds)return[_,T];let{bounds:b}=R.props;b=typeof b=="string"?b:S(b);const w=v(R);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 f=s,C=a.getComputedStyle(w),l=a.getComputedStyle(f);b={left:-w.offsetLeft+(0,t.int)(l.paddingLeft)+(0,t.int)(C.marginLeft),top:-w.offsetTop+(0,t.int)(l.paddingTop)+(0,t.int)(C.marginTop),right:(0,e.innerWidth)(f)-(0,e.outerWidth)(w)-w.offsetLeft+(0,t.int)(l.paddingRight)-(0,t.int)(C.marginRight),bottom:(0,e.innerHeight)(f)-(0,e.outerHeight)(w)-w.offsetTop+(0,t.int)(l.paddingBottom)-(0,t.int)(C.marginBottom)}}return(0,t.isNum)(b.right)&&(_=Math.min(_,b.right)),(0,t.isNum)(b.bottom)&&(T=Math.min(T,b.bottom)),(0,t.isNum)(b.left)&&(_=Math.max(_,b.left)),(0,t.isNum)(b.top)&&(T=Math.max(T,b.top)),[_,T]}function n(R,_,T){const b=Math.round(_/R[0])*R[0],w=Math.round(T/R[1])*R[1];return[b,w]}function o(R){return R.props.axis==="both"||R.props.axis==="x"}function i(R){return R.props.axis==="both"||R.props.axis==="y"}function c(R,_,T){const b=typeof _=="number"?(0,e.getTouch)(R,_):null;if(typeof _=="number"&&!b)return null;const w=v(T),h=T.props.offsetParent||w.offsetParent||w.ownerDocument.body;return(0,e.offsetXYFromParent)(b||R,h,T.props.scale)}function y(R,_,T){const b=!(0,t.isNum)(R.lastX),w=v(R);return b?{node:w,deltaX:0,deltaY:0,lastX:_,lastY:T,x:_,y:T}:{node:w,deltaX:_-R.lastX,deltaY:T-R.lastY,lastX:R.lastX,lastY:R.lastY,x:_,y:T}}function p(R,_){const T=R.props.scale;return{node:_.node,x:R.state.x+_.deltaX/T,y:R.state.y+_.deltaY/T,deltaX:_.deltaX/T,deltaY:_.deltaY/T,lastX:R.state.x,lastY:R.state.y}}function S(R){return{left:R.left,top:R.top,right:R.right,bottom:R.bottom}}function v(R){const _=R.findDOMNode();if(!_)throw new Error("<DraggableCore>: Unmounted during event!");return _}return Re}var Ge={},gt={},In;function ur(){if(In)return gt;In=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.default=t;function t(){}return gt}var _n;function no(){if(_n)return Ge;_n=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.default=void 0;var t=S(j),e=y(Oe()),r=y(tr),n=cn(),o=lr(),i=jt(),c=y(ur());function y(h){return h&&h.__esModule?h:{default:h}}function p(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(p=function(f){return f?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=p(a);if(s&&s.has(h))return s.get(h);var f={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in h)if(l!=="default"&&Object.prototype.hasOwnProperty.call(h,l)){var m=C?Object.getOwnPropertyDescriptor(h,l):null;m&&(m.get||m.set)?Object.defineProperty(f,l,m):f[l]=h[l]}return f.default=h,s&&s.set(h,f),f}function v(h,a,s){return a=R(a),a in h?Object.defineProperty(h,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):h[a]=s,h}function R(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 f=s.call(h,a);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const T={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let b=T.mouse,w=class extends t.Component{constructor(){super(...arguments),v(this,"dragging",!1),v(this,"lastX",NaN),v(this,"lastY",NaN),v(this,"touchIdentifier",null),v(this,"mounted",!1),v(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:f}=s;if(this.props.disabled||!(a.target instanceof f.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 C=(0,n.getTouchIdentifier)(a);this.touchIdentifier=C;const l=(0,o.getControlPosition)(a,C,this);if(l==null)return;const{x:m,y:d}=l,g=(0,o.createCoreData)(this,m,d);(0,c.default)("DraggableCore: handleDragStart: %j",g),(0,c.default)("calling",this.props.onStart),!(this.props.onStart(a,g)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(f),this.dragging=!0,this.lastX=m,this.lastY=d,(0,n.addEvent)(f,b.move,this.handleDrag),(0,n.addEvent)(f,b.stop,this.handleDragStop))}),v(this,"handleDrag",a=>{const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:f,y:C}=s;if(Array.isArray(this.props.grid)){let d=f-this.lastX,g=C-this.lastY;if([d,g]=(0,o.snapToGrid)(this.props.grid,d,g),!d&&!g)return;f=this.lastX+d,C=this.lastY+g}const l=(0,o.createCoreData)(this,f,C);if((0,c.default)("DraggableCore: handleDrag: %j",l),this.props.onDrag(a,l)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const g=document.createEvent("MouseEvents");g.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(g)}return}this.lastX=f,this.lastY=C}),v(this,"handleDragStop",a=>{if(!this.dragging)return;const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:f,y:C}=s;if(Array.isArray(this.props.grid)){let g=f-this.lastX||0,D=C-this.lastY||0;[g,D]=(0,o.snapToGrid)(this.props.grid,g,D),f=this.lastX+g,C=this.lastY+D}const l=(0,o.createCoreData)(this,f,C);if(this.props.onStop(a,l)===!1||this.mounted===!1)return!1;const d=this.findDOMNode();d&&this.props.enableUserSelectHack&&(0,n.removeUserSelectStyles)(d.ownerDocument),(0,c.default)("DraggableCore: handleDragStop: %j",l),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,d&&((0,c.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(d.ownerDocument,b.move,this.handleDrag),(0,n.removeEvent)(d.ownerDocument,b.stop,this.handleDragStop))}),v(this,"onMouseDown",a=>(b=T.mouse,this.handleDragStart(a))),v(this,"onMouseUp",a=>(b=T.mouse,this.handleDragStop(a))),v(this,"onTouchStart",a=>(b=T.touch,this.handleDragStart(a))),v(this,"onTouchEnd",a=>(b=T.touch,this.handleDragStop(a)))}componentDidMount(){this.mounted=!0;const a=this.findDOMNode();a&&(0,n.addEvent)(a,T.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const a=this.findDOMNode();if(a){const{ownerDocument:s}=a;(0,n.removeEvent)(s,T.mouse.move,this.handleDrag),(0,n.removeEvent)(s,T.touch.move,this.handleDrag),(0,n.removeEvent)(s,T.mouse.stop,this.handleDragStop),(0,n.removeEvent)(s,T.touch.stop,this.handleDragStop),(0,n.removeEvent)(a,T.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 Ge.default=w,v(w,"displayName","DraggableCore"),v(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}),v(w,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Ge}var En;function ro(){return En||(En=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return p.default}}),t.default=void 0;var e=_(j),r=v(Oe()),n=v(tr),o=v(eo),i=cn(),c=lr(),y=jt(),p=v(no()),S=v(ur());function v(s){return s&&s.__esModule?s:{default:s}}function R(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,C=new WeakMap;return(R=function(l){return l?C:f})(s)}function _(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var C=R(f);if(C&&C.has(s))return C.get(s);var l={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var g=m?Object.getOwnPropertyDescriptor(s,d):null;g&&(g.get||g.set)?Object.defineProperty(l,d,g):l[d]=s[d]}return l.default=s,C&&C.set(s,l),l}function T(){return T=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var C=arguments[f];for(var l in C)Object.prototype.hasOwnProperty.call(C,l)&&(s[l]=C[l])}return s},T.apply(this,arguments)}function b(s,f,C){return f=w(f),f in s?Object.defineProperty(s,f,{value:C,enumerable:!0,configurable:!0,writable:!0}):s[f]=C,s}function w(s){var f=h(s,"string");return typeof f=="symbol"?f:String(f)}function h(s,f){if(typeof s!="object"||s===null)return s;var C=s[Symbol.toPrimitive];if(C!==void 0){var l=C.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}class a extends e.Component{static getDerivedStateFromProps(f,C){let{position:l}=f,{prevPropsPosition:m}=C;return l&&(!m||l.x!==m.x||l.y!==m.y)?((0,S.default)("Draggable: getDerivedStateFromProps %j",{position:l,prevPropsPosition:m}),{x:l.x,y:l.y,prevPropsPosition:{...l}}):null}constructor(f){super(f),b(this,"onDragStart",(C,l)=>{if((0,S.default)("Draggable: onDragStart: %j",l),this.props.onStart(C,(0,c.createDraggableData)(this,l))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),b(this,"onDrag",(C,l)=>{if(!this.state.dragging)return!1;(0,S.default)("Draggable: onDrag: %j",l);const m=(0,c.createDraggableData)(this,l),d={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:D,y:M}=d;d.x+=this.state.slackX,d.y+=this.state.slackY;const[L,U]=(0,c.getBoundPosition)(this,d.x,d.y);d.x=L,d.y=U,d.slackX=this.state.slackX+(D-d.x),d.slackY=this.state.slackY+(M-d.y),m.x=d.x,m.y=d.y,m.deltaX=d.x-this.state.x,m.deltaY=d.y-this.state.y}if(this.props.onDrag(C,m)===!1)return!1;this.setState(d)}),b(this,"onDragStop",(C,l)=>{if(!this.state.dragging||this.props.onStop(C,(0,c.createDraggableData)(this,l))===!1)return!1;(0,S.default)("Draggable: onDragStop: %j",l);const d={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:D,y:M}=this.props.position;d.x=D,d.y=M}this.setState(d)}),this.state={dragging:!1,dragged:!1,x:f.position?f.position.x:f.defaultPosition.x,y:f.position?f.position.y:f.defaultPosition.y,prevPropsPosition:{...f.position},slackX:0,slackY:0,isElementSVG:!1},f.position&&!(f.onDrag||f.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 f,C;return(f=(C=this.props)===null||C===void 0||(C=C.nodeRef)===null||C===void 0?void 0:C.current)!==null&&f!==void 0?f:n.default.findDOMNode(this)}render(){const{axis:f,bounds:C,children:l,defaultPosition:m,defaultClassName:d,defaultClassNameDragging:g,defaultClassNameDragged:D,position:M,positionOffset:L,scale:U,...E}=this.props;let N={},q=null;const J=!!!M||this.state.dragging,ie=M||m,re={x:(0,c.canDragX)(this)&&J?this.state.x:ie.x,y:(0,c.canDragY)(this)&&J?this.state.y:ie.y};this.state.isElementSVG?q=(0,i.createSVGTransform)(re,L):N=(0,i.createCSSTransform)(re,L);const le=(0,o.default)(l.props.className||"",d,{[g]:this.state.dragging,[D]:this.state.dragged});return e.createElement(p.default,T({},E,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(l),{className:le,style:{...l.props.style,...N},transform:q}))}}t.default=a,b(a,"displayName","Draggable"),b(a,"propTypes",{...p.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",{...p.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(qt)),qt}var On;function dn(){if(On)return Be.exports;On=1;const{default:t,DraggableCore:e}=ro();return Be.exports=t,Be.exports.default=t,Be.exports.DraggableCore=e,Be.exports}var Xe={exports:{}},Ye={},vt={},Pn;function oo(){if(Pn)return vt;Pn=1,vt.__esModule=!0,vt.cloneElement=y;var t=e(j);function e(p){return p&&p.__esModule?p:{default:p}}function r(p,S){var v=Object.keys(p);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(p);S&&(R=R.filter(function(_){return Object.getOwnPropertyDescriptor(p,_).enumerable})),v.push.apply(v,R)}return v}function n(p){for(var S=1;S<arguments.length;S++){var v=arguments[S]!=null?arguments[S]:{};S%2?r(Object(v),!0).forEach(function(R){o(p,R,v[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(v)):r(Object(v)).forEach(function(R){Object.defineProperty(p,R,Object.getOwnPropertyDescriptor(v,R))})}return p}function o(p,S,v){return S=i(S),S in p?Object.defineProperty(p,S,{value:v,enumerable:!0,configurable:!0,writable:!0}):p[S]=v,p}function i(p){var S=c(p,"string");return typeof S=="symbol"?S:String(S)}function c(p,S){if(typeof p!="object"||p===null)return p;var v=p[Symbol.toPrimitive];if(v!==void 0){var R=v.call(p,S);if(typeof R!="object")return R;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(p)}function y(p,S){return S.style&&p.props.style&&(S.style=n(n({},p.props.style),S.style)),S.className&&p.props.className&&(S.className=p.props.className+" "+S.className),t.default.cloneElement(p,S)}return vt}var Ke={},Dn;function cr(){if(Dn)return Ke;Dn=1,Ke.__esModule=!0,Ke.resizableProps=void 0;var t=e(Oe());dn();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),c=0;c<o;c++)i[c]=arguments[c];var y=i[0];if(y.axis==="both"||y.axis==="y"){var p;return(p=t.default.number).isRequired.apply(p,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),c=0;c<o;c++)i[c]=arguments[c];var y=i[0];if(y.axis==="both"||y.axis==="x"){var p;return(p=t.default.number).isRequired.apply(p,i)}return t.default.number.apply(t.default,i)}};return Ke.resizableProps=r,Ke}var Fn;function dr(){if(Fn)return Ye;Fn=1,Ye.__esModule=!0,Ye.default=void 0;var t=c(j),e=dn(),r=oo(),n=cr(),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,f=new WeakMap;return(i=function(l){return l?f:s})(a)}function c(a,s){if(a&&a.__esModule)return a;if(a===null||typeof a!="object"&&typeof a!="function")return{default:a};var f=i(s);if(f&&f.has(a))return f.get(a);var C={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in a)if(m!=="default"&&Object.prototype.hasOwnProperty.call(a,m)){var d=l?Object.getOwnPropertyDescriptor(a,m):null;d&&(d.get||d.set)?Object.defineProperty(C,m,d):C[m]=a[m]}return C.default=a,f&&f.set(a,C),C}function y(){return y=Object.assign?Object.assign.bind():function(a){for(var s=1;s<arguments.length;s++){var f=arguments[s];for(var C in f)Object.prototype.hasOwnProperty.call(f,C)&&(a[C]=f[C])}return a},y.apply(this,arguments)}function p(a,s){if(a==null)return{};var f={},C=Object.keys(a),l,m;for(m=0;m<C.length;m++)l=C[m],!(s.indexOf(l)>=0)&&(f[l]=a[l]);return f}function S(a,s){var f=Object.keys(a);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(a);s&&(C=C.filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable})),f.push.apply(f,C)}return f}function v(a){for(var s=1;s<arguments.length;s++){var f=arguments[s]!=null?arguments[s]:{};s%2?S(Object(f),!0).forEach(function(C){R(a,C,f[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(f)):S(Object(f)).forEach(function(C){Object.defineProperty(a,C,Object.getOwnPropertyDescriptor(f,C))})}return a}function R(a,s,f){return s=_(s),s in a?Object.defineProperty(a,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):a[s]=f,a}function _(a){var s=T(a,"string");return typeof s=="symbol"?s:String(s)}function T(a,s){if(typeof a!="object"||a===null)return a;var f=a[Symbol.toPrimitive];if(f!==void 0){var C=f.call(a,s);if(typeof C!="object")return C;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(C,l){return C.__proto__=l,C},w(a,s)}var h=function(a){b(s,a);function s(){for(var C,l=arguments.length,m=new Array(l),d=0;d<l;d++)m[d]=arguments[d];return C=a.call.apply(a,[this].concat(m))||this,C.handleRefs={},C.lastHandleRect=null,C.slack=null,C}var f=s.prototype;return f.componentWillUnmount=function(){this.resetData()},f.resetData=function(){this.lastHandleRect=this.slack=null},f.runConstraints=function(l,m){var d=this.props,g=d.minConstraints,D=d.maxConstraints,M=d.lockAspectRatio;if(!g&&!D&&!M)return[l,m];if(M){var L=this.props.width/this.props.height,U=l-this.props.width,E=m-this.props.height;Math.abs(U)>Math.abs(E*L)?m=l/L:l=m*L}var N=l,q=m,H=this.slack||[0,0],J=H[0],ie=H[1];return l+=J,m+=ie,g&&(l=Math.max(g[0],l),m=Math.max(g[1],m)),D&&(l=Math.min(D[0],l),m=Math.min(D[1],m)),this.slack=[J+(N-l),ie+(q-m)],[l,m]},f.resizeHandler=function(l,m){var d=this;return function(g,D){var M=D.node,L=D.deltaX,U=D.deltaY;l==="onResizeStart"&&d.resetData();var E=(d.props.axis==="both"||d.props.axis==="x")&&m!=="n"&&m!=="s",N=(d.props.axis==="both"||d.props.axis==="y")&&m!=="e"&&m!=="w";if(!(!E&&!N)){var q=m[0],H=m[m.length-1],J=M.getBoundingClientRect();if(d.lastHandleRect!=null){if(H==="w"){var ie=J.left-d.lastHandleRect.left;L+=ie}if(q==="n"){var re=J.top-d.lastHandleRect.top;U+=re}}d.lastHandleRect=J,H==="w"&&(L=-L),q==="n"&&(U=-U);var le=d.props.width+(E?L/d.props.transformScale:0),k=d.props.height+(N?U/d.props.transformScale:0),Q=d.runConstraints(le,k);le=Q[0],k=Q[1];var ne=le!==d.props.width||k!==d.props.height,se=typeof d.props[l]=="function"?d.props[l]:null,de=l==="onResize"&&!ne;se&&!de&&(g.persist==null||g.persist(),se(g,{node:M,size:{width:le,height:k},handle:m})),l==="onResizeStop"&&d.resetData()}}},f.renderResizeHandle=function(l,m){var d=this.props.handle;if(!d)return t.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+l,ref:m});if(typeof d=="function")return d(l,m);var g=typeof d.type=="string",D=v({ref:m},g?{}:{handleAxis:l});return t.cloneElement(d,D)},f.render=function(){var l=this,m=this.props,d=m.children,g=m.className,D=m.draggableOpts;m.width,m.height,m.handle,m.handleSize,m.lockAspectRatio,m.axis,m.minConstraints,m.maxConstraints,m.onResize,m.onResizeStop,m.onResizeStart;var M=m.resizeHandles;m.transformScale;var L=p(m,o);return(0,r.cloneElement)(d,v(v({},L),{},{className:(g?g+" ":"")+"react-resizable",children:[].concat(d.props.children,M.map(function(U){var E,N=(E=l.handleRefs[U])!=null?E:l.handleRefs[U]=t.createRef();return t.createElement(e.DraggableCore,y({},D,{nodeRef:N,key:"resizableHandle-"+U,onStop:l.resizeHandler("onResizeStop",U),onStart:l.resizeHandler("onResizeStart",U),onDrag:l.resizeHandler("onResize",U)}),l.renderResizeHandle(U,N))}))}))},s}(t.Component);return Ye.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},Ye}var Ze={},Mn;function io(){if(Mn)return Ze;Mn=1,Ze.__esModule=!0,Ze.default=void 0;var t=y(j),e=i(Oe()),r=i(dr()),n=cr(),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 c(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,C=new WeakMap;return(c=function(m){return m?C:f})(s)}function y(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var C=c(f);if(C&&C.has(s))return C.get(s);var l={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var g=m?Object.getOwnPropertyDescriptor(s,d):null;g&&(g.get||g.set)?Object.defineProperty(l,d,g):l[d]=s[d]}return l.default=s,C&&C.set(s,l),l}function p(){return p=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var C=arguments[f];for(var l in C)Object.prototype.hasOwnProperty.call(C,l)&&(s[l]=C[l])}return s},p.apply(this,arguments)}function S(s,f){var C=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);f&&(l=l.filter(function(m){return Object.getOwnPropertyDescriptor(s,m).enumerable})),C.push.apply(C,l)}return C}function v(s){for(var f=1;f<arguments.length;f++){var C=arguments[f]!=null?arguments[f]:{};f%2?S(Object(C),!0).forEach(function(l){R(s,l,C[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(C)):S(Object(C)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(C,l))})}return s}function R(s,f,C){return f=_(f),f in s?Object.defineProperty(s,f,{value:C,enumerable:!0,configurable:!0,writable:!0}):s[f]=C,s}function _(s){var f=T(s,"string");return typeof f=="symbol"?f:String(f)}function T(s,f){if(typeof s!="object"||s===null)return s;var C=s[Symbol.toPrimitive];if(C!==void 0){var l=C.call(s,f);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(s)}function b(s,f){if(s==null)return{};var C={},l=Object.keys(s),m,d;for(d=0;d<l.length;d++)m=l[d],!(f.indexOf(m)>=0)&&(C[m]=s[m]);return C}function w(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,h(s,f)}function h(s,f){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,m){return l.__proto__=m,l},h(s,f)}var a=function(s){w(f,s);function f(){for(var l,m=arguments.length,d=new Array(m),g=0;g<m;g++)d[g]=arguments[g];return l=s.call.apply(s,[this].concat(d))||this,l.state={width:l.props.width,height:l.props.height,propsWidth:l.props.width,propsHeight:l.props.height},l.onResize=function(D,M){var L=M.size;l.props.onResize?(D.persist==null||D.persist(),l.setState(L,function(){return l.props.onResize&&l.props.onResize(D,M)})):l.setState(L)},l}f.getDerivedStateFromProps=function(m,d){return d.propsWidth!==m.width||d.propsHeight!==m.height?{width:m.width,height:m.height,propsWidth:m.width,propsHeight:m.height}:null};var C=f.prototype;return C.render=function(){var m=this.props,d=m.handle,g=m.handleSize;m.onResize;var D=m.onResizeStart,M=m.onResizeStop,L=m.draggableOpts,U=m.minConstraints,E=m.maxConstraints,N=m.lockAspectRatio,q=m.axis;m.width,m.height;var H=m.resizeHandles,J=m.style,ie=m.transformScale,re=b(m,o);return t.createElement(r.default,{axis:q,draggableOpts:L,handle:d,handleSize:g,height:this.state.height,lockAspectRatio:N,maxConstraints:E,minConstraints:U,onResizeStart:D,onResize:this.onResize,onResizeStop:M,resizeHandles:H,transformScale:ie,width:this.state.width},t.createElement("div",p({},re,{style:v(v({},J),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},f}(t.Component);return Ze.default=a,a.propTypes=v(v({},n.resizableProps),{},{children:e.default.element}),Ze}var Nn;function ao(){return Nn||(Nn=1,Xe.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Xe.exports.Resizable=dr().default,Xe.exports.ResizableBox=io().default),Xe.exports}var we={},jn;function fr(){if(jn)return we;jn=1,Object.defineProperty(we,"__esModule",{value:!0}),we.resizeHandleType=we.resizeHandleAxesType=we.default=void 0;var t=r(Oe()),e=r(j);function r(i){return i&&i.__esModule?i:{default:i}}const n=we.resizeHandleAxesType=t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),o=we.resizeHandleType=t.default.oneOfType([t.default.node,t.default.func]);return we.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 c=i.layout;c!==void 0&&Ae().validateLayout(c,"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,c){const y=i[c],p={};e.default.Children.forEach(y,function(S){if((S==null?void 0:S.key)!=null){if(p[S.key])throw new Error('Duplicate child key "'+S.key+'" found! This will cause problems in ReactGridLayout.');p[S.key]=!0}})},innerRef:t.default.any},we}var Ln;function so(){if(Ln)return He;Ln=1,Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0;var t=p(j),e=p(Oe()),r=dn(),n=ao(),o=Ae(),i=un(),c=fr(),y=p(ln());function p(T){return T&&T.__esModule?T:{default:T}}function S(T,b,w){return b=v(b),b in T?Object.defineProperty(T,b,{value:w,enumerable:!0,configurable:!0,writable:!0}):T[b]=w,T}function v(T){var b=R(T,"string");return typeof b=="symbol"?b:String(b)}function R(T,b){if(typeof T!="object"||T===null)return T;var w=T[Symbol.toPrimitive];if(w!==void 0){var h=w.call(T,b);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(T)}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 f={top:0,left:0},{offsetParent:C}=h;if(!C)return;const l=C.getBoundingClientRect(),m=h.getBoundingClientRect(),d=m.left/s,g=l.left/s,D=m.top/s,M=l.top/s;f.left=d-g+C.scrollLeft,f.top=D-M+C.scrollTop,this.setState({dragging:f});const{x:L,y:U}=(0,i.calcXY)(this.getPositionParams(),f.top,f.left,this.props.w,this.props.h);return a.call(this,this.props.i,L,U,{e:b,node:h,newPosition:f})}),S(this,"onDrag",(b,w)=>{let{node:h,deltaX:a,deltaY:s}=w;const{onDrag:f}=this.props;if(!f)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let C=this.state.dragging.top+s,l=this.state.dragging.left+a;const{isBounded:m,i:d,w:g,h:D,containerWidth:M}=this.props,L=this.getPositionParams();if(m){const{offsetParent:H}=h;if(H){const{margin:J,rowHeight:ie,containerPadding:re}=this.props,le=H.clientHeight-(0,i.calcGridItemWHPx)(D,ie,J[1]);C=(0,i.clamp)(C-re[1],0,le);const k=(0,i.calcGridColWidth)(L),Q=M-(0,i.calcGridItemWHPx)(g,k,J[0]);l=(0,i.clamp)(l-re[0],0,Q)}}const U={top:C,left:l};this.setState({dragging:U});const{containerPadding:E}=this.props,{x:N,y:q}=(0,i.calcXY)(L,C-E[1],l-E[0],g,D);return f.call(this,d,N,q,{e:b,node:h,newPosition:U})}),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:f,i:C,containerPadding:l}=this.props,{left:m,top:d}=this.state.dragging,g={top:d,left:m};this.setState({dragging:null});const{x:D,y:M}=(0,i.calcXY)(this.getPositionParams(),d-l[1],m-l[0],s,f);return a.call(this,C,D,M,{e:b,node:h,newPosition:g})}),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,f=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(f){const C=w.left-s.left,l=w.top-s.top;this.onDrag(w.e,{node:h,deltaX:C,deltaY:l})}}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:f,maxW:C,maxH:l,transformScale:m,resizeHandles:d,resizeHandle:g}=this.props,D=this.getPositionParams(),M=(0,i.calcGridItemPosition)(D,0,0,a,0).width,L=(0,i.calcGridItemPosition)(D,0,0,s,f),U=(0,i.calcGridItemPosition)(D,0,0,C,l),E=[L.width,L.height],N=[Math.min(U.width,M),Math.min(U.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:N,onResizeStop:this.curryResizeHandler(w,this.onResizeStop),onResizeStart:this.curryResizeHandler(w,this.onResizeStart),onResize:this.curryResizeHandler(w,this.onResize),transformScale:m,resizeHandles:d,handle:g},b)}onResizeHandler(b,w,h,a){let{node:s,size:f,handle:C}=w;const l=this.props[a];if(!l)return;const{x:m,y:d,i:g,maxH:D,minH:M,containerWidth:L}=this.props,{minW:U,maxW:E}=this.props;let N=f;s&&(N=(0,o.resizeItemInDirection)(C,h,f,L),this.setState({resizing:a==="onResizeStop"?null:N}));let{w:q,h:H}=(0,i.calcWH)(this.getPositionParams(),N.width,N.height,m,d,C);q=(0,i.clamp)(q,Math.max(U,1),E),H=(0,i.clamp)(H,M,D),l.call(this,g,q,H,{e:b,node:s,size:N,handle:C})}render(){const{x:b,y:w,w:h,h:a,isDraggable:s,isResizable:f,droppingPosition:C,useCSSTransforms:l}=this.props,m=(0,i.calcGridItemPosition)(this.getPositionParams(),b,w,h,a,this.state),d=t.default.Children.only(this.props.children);let g=t.default.cloneElement(d,{ref:this.elementRef,className:(0,y.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":s,"react-draggable-dragging":!!this.state.dragging,dropping:!!C,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(m)}});return g=this.mixinResizable(g,m,f),g=this.mixinDraggable(g,s),g}};return He.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(T,b){const w=T[b];if(typeof w!="number")return new Error("minWidth not Number");if(w>T.w||w>T.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(T,b){const w=T[b];if(typeof w!="number")return new Error("maxWidth not Number");if(w<T.w||w<T.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(T,b){const w=T[b];if(typeof w!="number")return new Error("minHeight not Number");if(w>T.h||w>T.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(T,b){const w=T[b];if(typeof w!="number")return new Error("maxHeight not Number");if(w<T.h||w<T.minH)return new Error("maxHeight smaller than item height/minHeight")},i:e.default.string.isRequired,resizeHandles:c.resizeHandleAxesType,resizeHandle:c.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}),He}var Un;function pr(){if(Un)return We;Un=1,Object.defineProperty(We,"__esModule",{value:!0}),We.default=void 0;var t=S(j),e=sn(),r=y(ln()),n=Ae(),o=un(),i=y(so()),c=y(fr());function y(h){return h&&h.__esModule?h:{default:h}}function p(h){if(typeof WeakMap!="function")return null;var a=new WeakMap,s=new WeakMap;return(p=function(f){return f?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=p(a);if(s&&s.has(h))return s.get(h);var f={__proto__:null},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in h)if(l!=="default"&&Object.prototype.hasOwnProperty.call(h,l)){var m=C?Object.getOwnPropertyDescriptor(h,l):null;m&&(m.get||m.set)?Object.defineProperty(f,l,m):f[l]=h[l]}return f.default=h,s&&s.set(h,f),f}function v(h,a,s){return a=R(a),a in h?Object.defineProperty(h,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):h[a]=s,h}function R(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 f=s.call(h,a);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const T="react-grid-layout";let b=!1;try{b=/firefox/i.test(navigator.userAgent)}catch{}let w=class extends t.Component{constructor(){super(...arguments),v(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:[]}),v(this,"dragEnterCounter",0),v(this,"onDragStart",(a,s,f,C)=>{let{e:l,node:m}=C;const{layout:d}=this.state,g=(0,n.getLayoutItem)(d,a);if(!g)return;const D={w:g.w,h:g.h,x:g.x,y:g.y,placeholder:!0,i:a};return this.setState({oldDragItem:(0,n.cloneLayoutItem)(g),oldLayout:d,activeDrag:D}),this.props.onDragStart(d,g,g,null,l,m)}),v(this,"onDrag",(a,s,f,C)=>{let{e:l,node:m}=C;const{oldDragItem:d}=this.state;let{layout:g}=this.state;const{cols:D,allowOverlap:M,preventCollision:L}=this.props,U=(0,n.getLayoutItem)(g,a);if(!U)return;const E={w:U.w,h:U.h,x:U.x,y:U.y,placeholder:!0,i:a};g=(0,n.moveElement)(g,U,s,f,!0,L,(0,n.compactType)(this.props),D,M),this.props.onDrag(g,d,U,E,l,m),this.setState({layout:M?g:(0,n.compact)(g,(0,n.compactType)(this.props),D),activeDrag:E})}),v(this,"onDragStop",(a,s,f,C)=>{let{e:l,node:m}=C;if(!this.state.activeDrag)return;const{oldDragItem:d}=this.state;let{layout:g}=this.state;const{cols:D,preventCollision:M,allowOverlap:L}=this.props,U=(0,n.getLayoutItem)(g,a);if(!U)return;g=(0,n.moveElement)(g,U,s,f,!0,M,(0,n.compactType)(this.props),D,L);const N=L?g:(0,n.compact)(g,(0,n.compactType)(this.props),D);this.props.onDragStop(N,d,U,null,l,m);const{oldLayout:q}=this.state;this.setState({activeDrag:null,layout:N,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(N,q)}),v(this,"onResizeStart",(a,s,f,C)=>{let{e:l,node:m}=C;const{layout:d}=this.state,g=(0,n.getLayoutItem)(d,a);g&&(this.setState({oldResizeItem:(0,n.cloneLayoutItem)(g),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(d,g,g,null,l,m))}),v(this,"onResize",(a,s,f,C)=>{let{e:l,node:m,size:d,handle:g}=C;const{oldResizeItem:D}=this.state,{layout:M}=this.state,{cols:L,preventCollision:U,allowOverlap:E}=this.props;let N=!1,q,H,J;const[ie,re]=(0,n.withLayoutItem)(M,a,k=>{let Q;return H=k.x,J=k.y,["sw","w","nw","n","ne"].indexOf(g)!==-1&&(["sw","nw","w"].indexOf(g)!==-1&&(H=k.x+(k.w-s),s=k.x!==H&&H<0?k.w:s,H=H<0?0:H),["ne","n","nw"].indexOf(g)!==-1&&(J=k.y+(k.h-f),f=k.y!==J&&J<0?k.h:f,J=J<0?0:J),N=!0),U&&!E&&(Q=(0,n.getAllCollisions)(M,{...k,w:s,h:f,x:H,y:J}).filter(se=>se.i!==k.i).length>0,Q&&(J=k.y,f=k.h,H=k.x,s=k.w,N=!1)),k.w=s,k.h=f,k});if(!re)return;q=ie,N&&(q=(0,n.moveElement)(ie,re,H,J,!0,this.props.preventCollision,(0,n.compactType)(this.props),L,E));const le={w:re.w,h:re.h,x:re.x,y:re.y,static:!0,i:a};this.props.onResize(q,D,re,le,l,m),this.setState({layout:E?q:(0,n.compact)(q,(0,n.compactType)(this.props),L),activeDrag:le})}),v(this,"onResizeStop",(a,s,f,C)=>{let{e:l,node:m}=C;const{layout:d,oldResizeItem:g}=this.state,{cols:D,allowOverlap:M}=this.props,L=(0,n.getLayoutItem)(d,a),U=M?d:(0,n.compact)(d,(0,n.compactType)(this.props),D);this.props.onResizeStop(U,g,L,null,l,m);const{oldLayout:E}=this.state;this.setState({activeDrag:null,layout:U,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(U,E)}),v(this,"onDragOver",a=>{var ie;if(a.preventDefault(),a.stopPropagation(),b&&!((ie=a.nativeEvent.target)!=null&&ie.classList.contains(T)))return!1;const{droppingItem:s,onDropDragOver:f,margin:C,cols:l,rowHeight:m,maxRows:d,width:g,containerPadding:D,transformScale:M}=this.props,L=f==null?void 0:f(a);if(L===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const U={...s,...L},{layout:E}=this.state,N=a.currentTarget.getBoundingClientRect(),q=a.clientX-N.left,H=a.clientY-N.top,J={left:q/M,top:H/M,e:a};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:re,top:le}=this.state.droppingPosition;(re!=q||le!=H)&&this.setState({droppingPosition:J})}}else{const re={cols:l,margin:C,maxRows:d,rowHeight:m,containerWidth:g,containerPadding:D||C},le=(0,o.calcXY)(re,H,q,U.w,U.h);this.setState({droppingDOMNode:t.createElement("div",{key:U.i}),droppingPosition:J,layout:[...E,{...U,x:le.x,y:le.y,static:!1,isDraggable:!0}]})}}),v(this,"removeDroppingPlaceholder",()=>{const{droppingItem:a,cols:s}=this.props,{layout:f}=this.state,C=(0,n.compact)(f.filter(l=>l.i!==a.i),(0,n.compactType)(this.props),s,this.props.allowOverlap);this.setState({layout:C,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),v(this,"onDragLeave",a=>{a.preventDefault(),a.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),v(this,"onDragEnter",a=>{a.preventDefault(),a.stopPropagation(),this.dragEnterCounter++}),v(this,"onDrop",a=>{a.preventDefault(),a.stopPropagation();const{droppingItem:s}=this.props,{layout:f}=this.state,C=f.find(l=>l.i===s.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(f,C,a)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(a,s){let f;return s.activeDrag?null:(!(0,e.deepEqual)(a.layout,s.propsLayout)||a.compactType!==s.compactType?f=a.layout:(0,n.childrenEqual)(a.children,s.children)||(f=s.layout),f?{layout:(0,n.synchronizeLayoutWithChildren)(f,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 f=this.state.layout,C=s.layout;this.onLayoutMaybeChanged(f,C)}}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:f,margin:C,containerPadding:l,rowHeight:m,maxRows:d,useCSSTransforms:g,transformScale:D}=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:f,margin:C,containerPadding:l||C,maxRows:d,rowHeight:m,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:g,transformScale:D},t.createElement("div",null))}processGridItem(a,s){if(!a||!a.key)return;const f=(0,n.getLayoutItem)(this.state.layout,String(a.key));if(!f)return null;const{width:C,cols:l,margin:m,containerPadding:d,rowHeight:g,maxRows:D,isDraggable:M,isResizable:L,isBounded:U,useCSSTransforms:E,transformScale:N,draggableCancel:q,draggableHandle:H,resizeHandles:J,resizeHandle:ie}=this.props,{mounted:re,droppingPosition:le}=this.state,k=typeof f.isDraggable=="boolean"?f.isDraggable:!f.static&&M,Q=typeof f.isResizable=="boolean"?f.isResizable:!f.static&&L,ne=f.resizeHandles||J,se=k&&U&&f.isBounded!==!1;return t.createElement(i.default,{containerWidth:C,cols:l,margin:m,containerPadding:d||m,maxRows:D,rowHeight:g,cancel:q,handle:H,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:k,isResizable:Q,isBounded:se,useCSSTransforms:E&&re,usePercentages:!re,transformScale:N,w:f.w,h:f.h,x:f.x,y:f.y,i:f.i,minH:f.minH,minW:f.minW,maxH:f.maxH,maxW:f.maxW,static:f.static,droppingPosition:s?le:void 0,resizeHandles:ne,resizeHandle:ie},a)}render(){const{className:a,style:s,isDroppable:f,innerRef:C}=this.props,l=(0,r.default)(T,a),m={height:this.containerHeight(),...s};return t.createElement("div",{ref:C,className:l,style:m,onDrop:f?this.onDrop:n.noop,onDragLeave:f?this.onDragLeave:n.noop,onDragEnter:f?this.onDragEnter:n.noop,onDragOver:f?this.onDragOver:n.noop},t.Children.map(this.props.children,d=>this.processGridItem(d)),f&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return We.default=w,v(w,"displayName","ReactGridLayout"),v(w,"propTypes",c.default),v(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}),We}var Je={},Fe={},Vn;function hr(){if(Vn)return Fe;Vn=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.findOrGenerateResponsiveLayout=n,Fe.getBreakpointFromWidth=e,Fe.getColsFromBreakpoint=r,Fe.sortBreakpoints=o;var t=Ae();function e(i,c){const y=o(i);let p=y[0];for(let S=1,v=y.length;S<v;S++){const R=y[S];c>i[R]&&(p=R)}return p}function r(i,c){if(!c[i])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+i+" is missing!");return c[i]}function n(i,c,y,p,S,v){if(i[y])return(0,t.cloneLayout)(i[y]);let R=i[p];const _=o(c),T=_.slice(_.indexOf(y));for(let b=0,w=T.length;b<w;b++){const h=T[b];if(i[h]){R=i[h];break}}return R=(0,t.cloneLayout)(R||[]),(0,t.compact)((0,t.correctBounds)(R,{cols:S}),v,S)}function o(i){return Object.keys(i).sort(function(y,p){return i[y]-i[p]})}return Fe}var zn;function lo(){if(zn)return Je;zn=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var t=p(j),e=c(Oe()),r=sn(),n=Ae(),o=hr(),i=c(pr());function c(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(f){return f?s:a})(h)}function p(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 f={__proto__:null},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in h)if(l!=="default"&&Object.prototype.hasOwnProperty.call(h,l)){var m=C?Object.getOwnPropertyDescriptor(h,l):null;m&&(m.get||m.set)?Object.defineProperty(f,l,m):f[l]=h[l]}return f.default=h,s&&s.set(h,f),f}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 f in s)Object.prototype.hasOwnProperty.call(s,f)&&(h[f]=s[f])}return h},S.apply(this,arguments)}function v(h,a,s){return a=R(a),a in h?Object.defineProperty(h,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):h[a]=s,h}function R(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 f=s.call(h,a);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(h)}const T=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),v(this,"state",this.generateInitialState()),v(this,"onLayoutChange",a=>{this.props.onLayoutChange(a,{...this.props.layouts,[this.state.breakpoint]:a})})}generateInitialState(){const{width:a,breakpoints:s,layouts:f,cols:C}=this.props,l=(0,o.getBreakpointFromWidth)(s,a),m=(0,o.getColsFromBreakpoint)(l,C),d=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,o.findOrGenerateResponsiveLayout)(f,s,l,l,m,d),breakpoint:l,cols:m}}static getDerivedStateFromProps(a,s){if(!(0,r.deepEqual)(a.layouts,s.layouts)){const{breakpoint:f,cols:C}=s;return{layout:(0,o.findOrGenerateResponsiveLayout)(a.layouts,a.breakpoints,f,f,C,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:f,layouts:C,compactType:l}=this.props,m=this.props.breakpoint||(0,o.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),d=this.state.breakpoint,g=(0,o.getColsFromBreakpoint)(m,f),D={...C};if(d!==m||a.breakpoints!==s||a.cols!==f){d in D||(D[d]=(0,n.cloneLayout)(this.state.layout));let U=(0,o.findOrGenerateResponsiveLayout)(D,s,m,d,g,l);U=(0,n.synchronizeLayoutWithChildren)(U,this.props.children,g,l,this.props.allowOverlap),D[m]=U,this.props.onLayoutChange(U,D),this.props.onBreakpointChange(m,g),this.setState({breakpoint:m,layout:U,cols:g})}const M=b(this.props.margin,m),L=b(this.props.containerPadding,m);this.props.onWidthChange(this.props.width,M,g,L)}render(){const{breakpoint:a,breakpoints:s,cols:f,layouts:C,margin:l,containerPadding:m,onBreakpointChange:d,onLayoutChange:g,onWidthChange:D,...M}=this.props;return t.createElement(i.default,S({},M,{margin:b(l,this.state.breakpoint),containerPadding:b(m,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return Je.default=w,v(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(T(h[a])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+T(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}),v(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}),Je}var yt={},mr=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 c=i[o];r.call(n,c[1],c[0])}},e}()}(),Kt=typeof window<"u"&&typeof document<"u"&&window.document===document,It=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")()}(),uo=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(It):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),co=2;function fo(t,e){var r=!1,n=!1,o=0;function i(){r&&(r=!1,t()),n&&y()}function c(){uo(i)}function y(){var p=Date.now();if(r){if(p-o<co)return;n=!0}else r=!0,n=!1,setTimeout(c,e);o=p}return y}var po=20,ho=["top","right","bottom","left","width","height","size","weight"],mo=typeof MutationObserver<"u",go=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=fo(this.refresh.bind(this),po)}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(){!Kt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mo?(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(){!Kt||!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=ho.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}(),gr=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},ze=function(t){var e=t&&t.ownerDocument&&t.ownerDocument.defaultView;return e||It},vr=Lt(0,0,0,0);function _t(t){return parseFloat(t)||0}function kn(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+_t(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],c=t["padding-"+i];r[i]=_t(c)}return r}function yo(t){var e=t.getBBox();return Lt(0,0,e.width,e.height)}function Co(t){var e=t.clientWidth,r=t.clientHeight;if(!e&&!r)return vr;var n=ze(t).getComputedStyle(t),o=vo(n),i=o.left+o.right,c=o.top+o.bottom,y=_t(n.width),p=_t(n.height);if(n.boxSizing==="border-box"&&(Math.round(y+i)!==e&&(y-=kn(n,"left","right")+i),Math.round(p+c)!==r&&(p-=kn(n,"top","bottom")+c)),!So(t)){var S=Math.round(y+i)-e,v=Math.round(p+c)-r;Math.abs(S)!==1&&(y-=S),Math.abs(v)!==1&&(p-=v)}return Lt(o.left,o.top,y,p)}var bo=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof ze(t).SVGGraphicsElement}:function(t){return t instanceof ze(t).SVGElement&&typeof t.getBBox=="function"}}();function So(t){return t===ze(t).document.documentElement}function Ro(t){return Kt?bo(t)?yo(t):Co(t):vr}function To(t){var e=t.x,r=t.y,n=t.width,o=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(i.prototype);return gr(c,{x:e,y:r,width:n,height:o,top:r,right:e+n,bottom:o+r,left:e}),c}function Lt(t,e,r,n){return{x:t,y:e,width:r,height:n}}var wo=function(){function t(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Lt(0,0,0,0),this.target=e}return t.prototype.isActive=function(){var e=Ro(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}(),xo=function(){function t(e,r){var n=To(r);gr(this,{target:e,contentRect:n})}return t}(),Io=function(){function t(e,r,n){if(this.activeObservations_=[],this.observations_=new mr,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 ze(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(e)||(r.set(e,new wo(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 ze(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 xo(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}(),yr=typeof WeakMap<"u"?new WeakMap:new mr,Cr=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=go.getInstance(),n=new Io(e,r,this);yr.set(this,n)}return t}();["observe","unobserve","disconnect"].forEach(function(t){Cr.prototype[t]=function(){var e;return(e=yr.get(this))[t].apply(e,arguments)}});var _o=function(){return typeof It.ResizeObserver<"u"?It.ResizeObserver:Cr}();const Eo=Object.freeze(Object.defineProperty({__proto__:null,default:_o},Symbol.toStringTag,{value:"Module"})),Oo=ar(Eo);var $n;function Po(){if($n)return yt;$n=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=_;var t=c(j),e=o(Oe()),r=o(Oo),n=o(ln());function o(T){return T&&T.__esModule?T:{default:T}}function i(T){if(typeof WeakMap!="function")return null;var b=new WeakMap,w=new WeakMap;return(i=function(h){return h?w:b})(T)}function c(T,b){if(T&&T.__esModule)return T;if(T===null||typeof T!="object"&&typeof T!="function")return{default:T};var w=i(b);if(w&&w.has(T))return w.get(T);var h={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in T)if(s!=="default"&&Object.prototype.hasOwnProperty.call(T,s)){var f=a?Object.getOwnPropertyDescriptor(T,s):null;f&&(f.get||f.set)?Object.defineProperty(h,s,f):h[s]=T[s]}return h.default=T,w&&w.set(T,h),h}function y(){return y=Object.assign?Object.assign.bind():function(T){for(var b=1;b<arguments.length;b++){var w=arguments[b];for(var h in w)Object.prototype.hasOwnProperty.call(w,h)&&(T[h]=w[h])}return T},y.apply(this,arguments)}function p(T,b,w){return b=S(b),b in T?Object.defineProperty(T,b,{value:w,enumerable:!0,configurable:!0,writable:!0}):T[b]=w,T}function S(T){var b=v(T,"string");return typeof b=="symbol"?b:String(b)}function v(T,b){if(typeof T!="object"||T===null)return T;var w=T[Symbol.toPrimitive];if(w!==void 0){var h=w.call(T,b);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(T)}const R="react-grid-layout";function _(T){var b;return b=class extends t.Component{constructor(){super(...arguments),p(this,"state",{width:1280}),p(this,"elementRef",t.createRef()),p(this,"mounted",!1),p(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new r.default(a=>{if(this.elementRef.current instanceof HTMLElement){const f=a[0].contentRect.width;this.setState({width:f})}});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,R),style:this.props.style,ref:this.elementRef}):t.createElement(T,y({innerRef:this.elementRef},a,this.state))}},p(b,"defaultProps",{measureBeforeMount:!1}),p(b,"propTypes",{measureBeforeMount:e.default.bool}),b}return yt}var An;function Do(){return An||(An=1,function(t){t.exports=pr().default,t.exports.utils=Ae(),t.exports.calculateUtils=un(),t.exports.Responsive=lo().default,t.exports.Responsive.utils=hr(),t.exports.WidthProvider=Po().default}(Vt)),Vt.exports}var Fo=Do();const Mo=Xr(Fo);var No=Object.getOwnPropertyDescriptor,jo=(t,e,r,n)=>{for(var o=n>1?void 0:n?No(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Lo=(t,e)=>(r,n)=>e(r,n,t);let ke=class extends x.Disposable{constructor(e){super();Ie(this,"_initLocal",()=>{});Ie(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 c=[];return this._findReplaceIndex(i).forEach((y,p,S)=>{const v=S[p-1]||{endIndex:-1};if(v.endIndex+1<y.startIndex){const R=i.slice(v.endIndex+1,y.startIndex);R&&c.push(R)}if(r[y.key]&&c.push(r[y.key]),p===S.length-1){const R=i.slice(y.endIndex+1);R&&c.push(R)}}),c}return[]}};ke=jo([Lo(0,x.Inject(x.LocaleService))],ke);const Uo="univer-cf-preview",Ct={cfPreview:Uo},qe=t=>{var o,i;const e=t.rule;if(!e)return null;const r=j.useMemo(()=>{if(e.type===u.CFRuleType.colorScale){const c=e.config.map((S,v)=>({color:new x.ColorKit(S.color),value:v})),y=c.length-1;return new Array(5).fill("").map((S,v,R)=>v*y/(R.length-1)).map(S=>u.getColorScaleFromValue(c,S))}return null},[e]),n=j.useMemo(()=>{if(e.type===u.CFRuleType.iconSet)return e.config.map(c=>{const y=u.iconMap[c.iconType];return y&&y[Number(c.iconId)]})},[e]);switch(e.type){case u.CFRuleType.dataBar:{const{isGradient:c}=e.config,y={width:"50%",height:"100%"},p=c?`linear-gradient(to right, ${e.config.positiveColor||u.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,S=c?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||u.defaultDataBarNativeColor})`:e.config.nativeColor;return I.jsxs("div",{className:Ct.cfPreview,children:[I.jsx("div",{style:{...y,background:S,border:`1px solid ${e.config.nativeColor||u.defaultDataBarNativeColor}`}}),I.jsx("div",{style:{...y,background:p,border:`1px solid ${e.config.positiveColor||u.defaultDataBarPositiveColor}`}})]})}case u.CFRuleType.colorScale:return r&&I.jsx("div",{className:Ct.cfPreview,children:r.map((c,y)=>I.jsx("div",{style:{width:`${100/r.length}%`,height:"100%",background:c}},y))});case u.CFRuleType.iconSet:return n&&I.jsx("div",{className:Ct.cfPreview,children:n.map((c,y)=>c?I.jsx("img",{style:{height:"100%"},src:c},y):I.jsx(ft,{},y))});case u.CFRuleType.highlightCell:{const{ul:c,st:y,it:p,bl:S,bg:v,cl:R}=e.style,_=(c==null?void 0:c.s)===x.BooleanNumber.TRUE,T=(y==null?void 0:y.s)===x.BooleanNumber.TRUE,b=p===x.BooleanNumber.TRUE,w=S===x.BooleanNumber.TRUE,h=(o=v==null?void 0:v.rgb)!=null?o:u.DEFAULT_BG_COLOR,a=(i=R==null?void 0:R.rgb)!=null?i:u.DEFAULT_FONT_COLOR,s={fontWeight:w?"bold":void 0,fontStyle:b?"italic":void 0,textDecoration:`${_?"underline":""} ${T?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:h,color:a};return I.jsx("div",{style:s,className:Ct.cfPreview,children:"123"})}}return null},Vo="univer-cf-rule-list",zo="univer-rule-selector",ko="univer-select",$o="univer-btn-list",Ao="univer-gap",qo="univer-icon",Wo="univer-disabled",Ho="univer-rule-item",Bo="univer-rule-describe",Go="univer-rule-type",Xo="univer-rule-range",Yo="univer-active",Ko="univer-draggableHandle",Zo="univer-delete-item",Jo="univer-grid-layout-wrap",me={cfRuleList:Vo,ruleSelector:zo,select:ko,btnList:$o,gap:Ao,icon:qo,disabled:Wo,ruleItem:Ho,ruleDescribe:Bo,ruleType:Go,ruleRange:Xo,active:Yo,draggableHandle:Ko,deleteItem:Zo,gridLayoutWrap:Jo},Qo=(t,e)=>{const r=t.rule;switch(r.type){case u.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case u.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case u.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case u.CFRuleType.highlightCell:switch(r.subType){case u.CFSubRuleType.average:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,e.t("sheet.cf.subRuleType.average"))}case u.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case u.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case u.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 u.CFSubRuleType.text:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`,r.value||"")}case u.CFSubRuleType.timePeriod:{const n=r.operator;return e.t(`sheet.cf.preview.describe.${n}`)}case u.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 u.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let qn=0;const ei=t=>{const{onClick:e}=t,r=ee.useDependency(u.ConditionalFormattingRuleModel),n=ee.useDependency(x.IUniverInstanceService),o=ee.useDependency(X.SheetsSelectionsService),i=ee.useDependency(x.ICommandService),c=ee.useDependency(x.LocaleService),y=ee.useDependency(x.Injector),p=ee.useDependency(ee.ISidebarService),S=ee.useDependency(ke),v=ee.useObservable(()=>n.getCurrentTypeOfUnit$(x.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),R=v.getUnitId(),_=v.getActiveSheet();if(!_)throw new Error("No active sheet found");const T=_.getSheetId(),[b,w]=j.useState([]),[h,a]=j.useState("2"),[s,f]=j.useState(0),[C,l]=j.useState(-1),[m,d]=j.useState(qn),g=j.useRef(null),D=[{label:c.t("sheet.cf.panel.workSheet"),value:"2"},{label:c.t("sheet.cf.panel.selectedRange"),value:"1"}],M=()=>{const k=r.getSubunitRules(R,T);if(!k||!k.length)return[];if(h==="1"){const Q=o.getCurrentLastSelection();if(!Q)return[];const ne=Q.range;return k.filter(de=>de.ranges.some(he=>x.Rectangle.intersects(he,ne)))}else if(h==="2")return[...k];return[]},[L,U]=j.useState(M);fe.useHighlightRange(b),j.useEffect(()=>{const k=i.onCommandExecuted(Q=>{Q.id===X.SetWorksheetActiveOperation.id&&f(Math.random())});return()=>k.dispose()}),j.useEffect(()=>{U(M)},[h,s,R,T]),j.useEffect(()=>{if(h==="2")return;const k=new Se.Observable(Q=>{const ne=[X.SetSelectionsOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],se=i.onCommandExecuted(de=>{const{id:he,params:be}=de,$=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET).getUnitId();ne.includes(he)&&be.unitId===$&&Q.next(null)});return()=>se.dispose()}).pipe(Se.debounceTime(16)).subscribe(()=>{U(M)});return()=>{k.unsubscribe()}},[n,h,R,T]),j.useEffect(()=>{const k=r.$ruleChange.subscribe(()=>{f(Math.random())});return()=>k.unsubscribe()},[r]),j.useEffect(()=>{const k=()=>{var de,he;const se=Math.max(0,((he=(de=g.current)==null?void 0:de.getBoundingClientRect().width)!=null?he:0)-8);return qn=se,se},ne=new Se.Observable(se=>{const de=p.getContainer();if(de){let he=setTimeout(()=>{se.next()},150);const be=()=>{he&&clearTimeout(he),he=null},$=K=>{K.propertyName==="width"&&(be(),se.next())};return de.addEventListener("transitionend",$),()=>{be(),de.removeEventListener("transitionend",$)}}}).pipe(Se.debounceTime(16)).subscribe(()=>{d(k())});return()=>{ne.unsubscribe()}},[]);const E=k=>{var se;const Q=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),ne=(se=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:se.getSheetId();if(!Q||!ne)throw new Error("No active sheet found");i.executeCommand(u.DeleteCfCommand.id,{unitId:Q,subUnitId:ne,cfId:k.cfId})},N=(k,Q)=>{l(Q.y)},q=(k,Q,ne)=>{var K;l(-1);const se=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),de=(K=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:K.getSheetId();if(!se||!de)throw new Error("No active sheet found");const he=ae=>{const O=L.length;return Math.min(O-1,Math.max(0,ae))},be=L[he(Q.y)].cfId,$=L[he(ne.y)].cfId;be!==$&&i.executeCommand(u.MoveCfCommand.id,{unitId:se,subUnitId:de,start:{id:be,type:"self"},end:{id:$,type:ne.y>Q.y?"after":"before"}})},H=()=>{t.onCreate()},J=()=>{h==="2"?i.executeCommand(u.ClearWorksheetCfCommand.id):h==="1"&&L.map(Q=>({unitId:R,subUnitId:T,cfId:Q.cfId})).forEach(Q=>{i.executeCommand(u.DeleteCfCommand.id,Q)})},ie=j.useMemo(()=>{const k=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET),Q=k.getActiveSheet();return L.filter(ne=>{const se=ne.ranges;return X.checkRangesEditablePermission(y,k.getUnitId(),Q.getSheetId(),se)})},[L]),re=ie.map((k,Q)=>({i:k.cfId,x:0,w:12,y:Q,h:1,isResizable:!1})),le=j.useMemo(()=>{const k=n.getCurrentUnitOfType(x.UniverInstanceType.UNIVER_SHEET),Q=k.getActiveSheet();return L.every(ne=>{const se=ne.ranges;return X.checkRangesEditablePermission(y,k.getUnitId(),Q.getSheetId(),se)})},[L]);return I.jsxs("div",{className:me.cfRuleList,children:[I.jsxs("div",{className:me.ruleSelector,children:[I.jsx("div",{children:S.tWithReactNode("sheet.cf.panel.managerRuleSelect",I.jsx(Z.Select,{className:me.select,options:D,value:h,onChange:k=>{a(k)}})).map((k,Q)=>I.jsx("span",{children:k},Q))}),I.jsxs("div",{className:me.btnList,children:[I.jsx(Z.Tooltip,{title:c.t("sheet.cf.panel.createRule"),placement:"bottom",children:I.jsx("div",{className:me.icon,onClick:H,children:I.jsx(or,{})})}),L.length&&le?I.jsx(Z.Tooltip,{title:c.t("sheet.cf.panel.clear"),placement:"bottom",children:I.jsx("div",{className:Z.clsx(me.gap,me.icon),onClick:J,children:I.jsx(xt,{})})}):I.jsx("div",{className:Z.clsx(me.gap,me.disabled),children:I.jsx(xt,{})})]})]}),I.jsx("div",{ref:g,className:me.gridLayoutWrap,children:m?I.jsx(Mo,{draggableHandle:".draggableHandle",layout:re,cols:12,rowHeight:60,width:m,margin:[0,10],onDragStop:q,onDragStart:N,children:ie==null?void 0:ie.map((k,Q)=>I.jsx("div",{children:I.jsxs("div",{className:Z.clsx(me.ruleItem,{[me.active]:C===Q}),onMouseMove:()=>{k.ranges!==b&&w(k.ranges)},onMouseLeave:()=>w([]),onClick:()=>{e(k)},children:[I.jsx("div",{className:Z.clsx(me.draggableHandle,"draggableHandle"),onClick:ne=>ne.stopPropagation(),children:I.jsx(ir,{})}),I.jsxs("div",{className:me.ruleDescribe,children:[I.jsx("div",{className:me.ruleType,children:Qo(k,c)}),I.jsx("div",{className:me.ruleRange,children:k.ranges.map(ne=>Yt.serializeRange(ne)).join(",")})]}),I.jsx("div",{className:me.preview,children:I.jsx(qe,{rule:k.rule})}),I.jsx("div",{className:Z.clsx(me.deleteItem,{[me.active]:C===Q}),onClick:ne=>{ne.stopPropagation(),E(k),w([])},children:I.jsx(xt,{})})]})},`${k.cfId}`))}):null})]})},ti="univer-cf-color-picker-icon",ni="univer-icon-dropdown",Wn={cfColorPickerIcon:ti,iconDropdown:ni},Ne=t=>{const{color:e,onChange:r,disable:n=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:c=!0}=t,y=ee.useDependency(ee.ComponentManager),p=j.useMemo(()=>new x.ColorKit(e),[e]),S=y.get(o);return S&&(n?I.jsx(S,{className:i,extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}):I.jsx(Z.Dropdown,{overlay:I.jsx("div",{className:"univer-rounded-lg univer-p-4",children:I.jsx(Z.ColorPicker,{value:e,onChange:r})}),children:I.jsxs("span",{className:`
21
4
  ${Wn.cfColorPickerIcon}
22
5
  ${i}
23
- `,children:[I.jsx(S,{extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}),c&&I.jsx(Nt,{className:Wn.iconDropdown})]})}))},ri="univer-cf-rule-style-editor",oi="univer-cf-error-text",ii="univer-cf-preview-wrap",ai="univer-text",si="univer-position-relative",li="univer-btn-list",ui="univer-util-item",ci="univer-icon-set",di="univer-render-config",fi="univer-flex",pi="univer-width45",hi="univer-icon-wrap",mi="univer-icon",gi="univer-dropdown-icon",vi="univer-error-input",yi="univer-error-text",Ci="univer-icon-group-list",bi="univer-title",Si="univer-group",Ri="univer-item-content",Ti="univer-item-wrap",wi="univer-item",xi="univer-icon-item-list-wrap",Ii="univer-none",_i="univer-icon-item-list",Ei="univer-width100",Oi="univer-stress",H={cfRuleStyleEditor:ri,cfErrorText:oi,cfPreviewWrap:ii,text:ai,positionRelative:si,btnList:li,utilItem:ui,iconSet:ci,renderConfig:di,flex:fi,width45:pi,iconWrap:hi,icon:mi,dropdownIcon:gi,errorInput:vi,errorText:yi,iconGroupList:Ci,title:bi,group:Si,itemContent:Ri,itemWrap:Ti,item:wi,iconItemListWrap:xi,none:Ii,iconItemList:_i,width100:Ei,stress:Oi},Me=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Wt=t=>{var b;const{type:e,className:r,onChange:n,id:o,value:i}=t,c=ee.useDependency(x.IUniverInstanceService),y=c.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),p=(b=c.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId(),S=j.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),v=j.useMemo(()=>[u.CFValueType.max,u.CFValueType.min,"none"].includes(e)?{disabled:!0}:[u.CFValueType.percent,u.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),T=j.useRef({}),[_,w]=j.useState(!1);return ee.useSidebarClick(R=>{var a;const h=(a=T.current)==null?void 0:a.handleOutClick;h&&h(R,()=>w(!1))}),e===u.CFValueType.formula?I.jsx("div",{style:{width:"100%",marginLeft:4},children:I.jsx(dt.FormulaEditor,{initValue:S,unitId:y,subUnitId:p,isFocus:_,onChange:(R="")=>{n(R||"")},onFocus:()=>w(!0),actions:T.current})}):I.jsx(Q.InputNumber,{className:r,value:Number(t.value)||0,onChange:R=>t.onChange(R||0),...v})},Pi=t=>{var L;const{interceptorManager:e}=t,r=ee.useDependency(x.LocaleService),n=((L=t.rule)==null?void 0:L.type)===u.CFRuleType.colorScale?t.rule:void 0,o=[Me(u.CFValueType.num,r),Me(u.CFValueType.percent,r),Me(u.CFValueType.percentile,r),Me(u.CFValueType.formula,r)],i=[Me(u.CFValueType.min,r),...o],c=[Me("none",r),...o],y=[Me(u.CFValueType.max,r),...o],[p,S]=j.useState(()=>{var N;const E=u.CFValueType.min;return n&&((N=n.config[0])==null?void 0:N.value.type)||E}),[v,T]=j.useState(()=>{var N;const E="none";return!n||n.config.length!==3?E:((N=n.config[1])==null?void 0:N.value.type)||E}),[_,w]=j.useState(()=>{var N;const E=u.CFValueType.max;return n&&((N=n.config[n.config.length-1])==null?void 0:N.value.type)||E}),[b,R]=j.useState(()=>{if(!n)return 10;const N=n.config[0];return(N==null?void 0:N.value.value)===void 0?10:N==null?void 0:N.value.value}),[h,a]=j.useState(()=>{var W;if(!n||n.config.length!==3)return 50;const N=(W=n.config[1])==null?void 0:W.value.value;return N===void 0?50:N}),[s,f]=j.useState(()=>{var W;if(!n)return 90;const N=(W=n.config[n.config.length-1])==null?void 0:W.value.value;return N===void 0?90:N}),[C,l]=j.useState(()=>{var N;const E="#d0d9fb";return n&&((N=n.config[0])==null?void 0:N.color)||E}),[m,d]=j.useState(()=>{var N;const E="#7790f3";return!n||n.config.length!==3?E:((N=n.config[1])==null?void 0:N.color)||E}),[g,F]=j.useState(()=>{var N;const E="#2e55ef";return n&&((N=n.config[n.config.length-1])==null?void 0:N.color)||E}),D=j.useMemo(()=>E=>{const{minType:N,medianType:W,maxType:B,minValue:Z,medianValue:se,maxValue:re,minColor:q,medianColor:k,maxColor:ne}=E,oe=[];return oe.push({color:q,value:{type:N,value:Z}}),W!=="none"&&oe.push({color:k,value:{type:W,value:se}}),oe.push({color:ne,value:{type:B,value:re}}),{config:oe.map((pe,ge)=>({...pe,index:ge})),type:u.CFRuleType.colorScale}},[]);j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return D({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),[D,p,v,_,b,h,s,C,m,g,e]);const U=E=>{t.onChange(D(E))};return I.jsxs("div",{children:[I.jsx("div",{className:z.title,children:r.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
24
- ${H.cfPreviewWrap}
25
- `,children:I.jsx(qe,{rule:D({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})})}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.min")}),I.jsxs("div",{className:Q.clsx(`
6
+ `,children:[I.jsx(S,{extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}),c&&I.jsx(Nt,{className:Wn.iconDropdown})]})}))},ri="univer-cf-rule-style-editor",oi="univer-cf-error-text",ii="univer-cf-preview-wrap",ai="univer-text",si="univer-position-relative",li="univer-btn-list",ui="univer-util-item",ci="univer-icon-set",di="univer-render-config",fi="univer-flex",pi="univer-width45",hi="univer-icon-wrap",mi="univer-icon",gi="univer-dropdown-icon",vi="univer-error-input",yi="univer-error-text",Ci="univer-icon-group-list",bi="univer-title",Si="univer-group",Ri="univer-item-content",Ti="univer-item-wrap",wi="univer-item",xi="univer-icon-item-list-wrap",Ii="univer-none",_i="univer-icon-item-list",Ei="univer-width100",Oi="univer-stress",W={cfRuleStyleEditor:ri,cfErrorText:oi,cfPreviewWrap:ii,text:ai,positionRelative:si,btnList:li,utilItem:ui,iconSet:ci,renderConfig:di,flex:fi,width45:pi,iconWrap:hi,icon:mi,dropdownIcon:gi,errorInput:vi,errorText:yi,iconGroupList:Ci,title:bi,group:Si,itemContent:Ri,itemWrap:Ti,item:wi,iconItemListWrap:xi,none:Ii,iconItemList:_i,width100:Ei,stress:Oi},Me=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Wt=t=>{var b;const{type:e,className:r,onChange:n,id:o,value:i}=t,c=ee.useDependency(x.IUniverInstanceService),y=c.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),p=(b=c.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId(),S=j.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),v=j.useMemo(()=>[u.CFValueType.max,u.CFValueType.min,"none"].includes(e)?{disabled:!0}:[u.CFValueType.percent,u.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),R=j.useRef({}),[_,T]=j.useState(!1);return ee.useSidebarClick(w=>{var a;const h=(a=R.current)==null?void 0:a.handleOutClick;h&&h(w,()=>T(!1))}),e===u.CFValueType.formula?I.jsx("div",{style:{width:"100%",marginLeft:4},children:I.jsx(dt.FormulaEditor,{initValue:S,unitId:y,subUnitId:p,isFocus:_,onChange:(w="")=>{n(w||"")},onFocus:()=>T(!0),actions:R.current})}):I.jsx(Z.InputNumber,{className:r,value:Number(t.value)||0,onChange:w=>t.onChange(w||0),...v})},Pi=t=>{var U;const{interceptorManager:e}=t,r=ee.useDependency(x.LocaleService),n=((U=t.rule)==null?void 0:U.type)===u.CFRuleType.colorScale?t.rule:void 0,o=[Me(u.CFValueType.num,r),Me(u.CFValueType.percent,r),Me(u.CFValueType.percentile,r),Me(u.CFValueType.formula,r)],i=[Me(u.CFValueType.min,r),...o],c=[Me("none",r),...o],y=[Me(u.CFValueType.max,r),...o],[p,S]=j.useState(()=>{var N;const E=u.CFValueType.min;return n&&((N=n.config[0])==null?void 0:N.value.type)||E}),[v,R]=j.useState(()=>{var N;const E="none";return!n||n.config.length!==3?E:((N=n.config[1])==null?void 0:N.value.type)||E}),[_,T]=j.useState(()=>{var N;const E=u.CFValueType.max;return n&&((N=n.config[n.config.length-1])==null?void 0:N.value.type)||E}),[b,w]=j.useState(()=>{if(!n)return 10;const N=n.config[0];return(N==null?void 0:N.value.value)===void 0?10:N==null?void 0:N.value.value}),[h,a]=j.useState(()=>{var q;if(!n||n.config.length!==3)return 50;const N=(q=n.config[1])==null?void 0:q.value.value;return N===void 0?50:N}),[s,f]=j.useState(()=>{var q;if(!n)return 90;const N=(q=n.config[n.config.length-1])==null?void 0:q.value.value;return N===void 0?90:N}),[C,l]=j.useState(()=>{var N;const E="#d0d9fb";return n&&((N=n.config[0])==null?void 0:N.color)||E}),[m,d]=j.useState(()=>{var N;const E="#7790f3";return!n||n.config.length!==3?E:((N=n.config[1])==null?void 0:N.color)||E}),[g,D]=j.useState(()=>{var N;const E="#2e55ef";return n&&((N=n.config[n.config.length-1])==null?void 0:N.color)||E}),M=j.useMemo(()=>E=>{const{minType:N,medianType:q,maxType:H,minValue:J,medianValue:ie,maxValue:re,minColor:le,medianColor:k,maxColor:Q}=E,ne=[];return ne.push({color:le,value:{type:N,value:J}}),q!=="none"&&ne.push({color:k,value:{type:q,value:ie}}),ne.push({color:Q,value:{type:H,value:re}}),{config:ne.map((de,he)=>({...de,index:he})),type:u.CFRuleType.colorScale}},[]);j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return M({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),[M,p,v,_,b,h,s,C,m,g,e]);const L=E=>{t.onChange(M(E))};return I.jsxs("div",{children:[I.jsx("div",{className:z.title,children:r.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
7
+ ${W.cfPreviewWrap}
8
+ `,children:I.jsx(qe,{rule:M({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})})}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.min")}),I.jsxs("div",{className:Z.clsx(`
26
9
  ${z.labelContainer}
27
10
  ${z.mTSm}
28
- `,"univer-box-border univer-h-7"),children:[I.jsx(Q.Select,{style:{flexShrink:0},options:i,value:p,onChange:E=>{S(E);const N=u.createDefaultValueByValueType(E,10);R(N),U({minType:E,medianType:v,maxType:_,minValue:N,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Wt,{id:"min",className:`
11
+ `,"univer-box-border univer-h-7"),children:[I.jsx(Z.Select,{style:{flexShrink:0},options:i,value:p,onChange:E=>{S(E);const N=u.createDefaultValueByValueType(E,10);w(N),L({minType:E,medianType:v,maxType:_,minValue:N,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Wt,{id:"min",className:`
29
12
  ${z.mLXxs}
30
- `,value:b,type:p,onChange:E=>{R(E),U({minType:p,medianType:v,maxType:_,minValue:E,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Ne,{className:z.mLXxs,color:C,onChange:E=>{l(E),U({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:E,medianColor:m,maxColor:g})}})]}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.panel.medianValue")}),I.jsxs("div",{className:Q.clsx(`
13
+ `,value:b,type:p,onChange:E=>{w(E),L({minType:p,medianType:v,maxType:_,minValue:E,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Ne,{className:z.mLXxs,color:C,onChange:E=>{l(E),L({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:E,medianColor:m,maxColor:g})}})]}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.panel.medianValue")}),I.jsxs("div",{className:Z.clsx(`
31
14
  ${z.labelContainer}
32
15
  ${z.mTSm}
33
- `,"univer-box-border univer-h-7"),children:[I.jsx(Q.Select,{style:{flexShrink:0},options:c,value:v,onChange:E=>{T(E);const N=u.createDefaultValueByValueType(E,50);a(N),U({minType:p,medianType:E,maxType:_,minValue:b,medianValue:N,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Wt,{id:"median",className:`
16
+ `,"univer-box-border univer-h-7"),children:[I.jsx(Z.Select,{style:{flexShrink:0},options:c,value:v,onChange:E=>{R(E);const N=u.createDefaultValueByValueType(E,50);a(N),L({minType:p,medianType:E,maxType:_,minValue:b,medianValue:N,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Wt,{id:"median",className:`
34
17
  ${z.mLXxs}
35
- `,value:h,type:v,onChange:E=>{a(E),U({minType:p,medianType:v,maxType:_,minValue:b,medianValue:E,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),v!=="none"&&I.jsx(Ne,{className:z.mLXxs,color:m,onChange:E=>{d(E),U({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:E,maxColor:g})}})]}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.max")}),I.jsxs("div",{className:Q.clsx(`
18
+ `,value:h,type:v,onChange:E=>{a(E),L({minType:p,medianType:v,maxType:_,minValue:b,medianValue:E,maxValue:s,minColor:C,medianColor:m,maxColor:g})}}),v!=="none"&&I.jsx(Ne,{className:z.mLXxs,color:m,onChange:E=>{d(E),L({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:E,maxColor:g})}})]}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.max")}),I.jsxs("div",{className:Z.clsx(`
36
19
  ${z.labelContainer}
37
20
  ${z.mTSm}
38
- `,"univer-box-border univer-h-7"),children:[I.jsx(Q.Select,{style:{flexShrink:0},options:y,value:_,onChange:E=>{w(E);const N=u.createDefaultValueByValueType(E,90);f(N),U({minType:p,medianType:v,maxType:E,minValue:b,medianValue:h,maxValue:N,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Wt,{id:"max",className:`
21
+ `,"univer-box-border univer-h-7"),children:[I.jsx(Z.Select,{style:{flexShrink:0},options:y,value:_,onChange:E=>{T(E);const N=u.createDefaultValueByValueType(E,90);f(N),L({minType:p,medianType:v,maxType:E,minValue:b,medianValue:h,maxValue:N,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Wt,{id:"max",className:`
39
22
  ${z.mLXxs}
40
- `,value:s,type:_,onChange:E=>{f(E),U({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:E,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Ne,{className:z.mLXxs,color:g,onChange:E=>{F(E),U({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:E})}})]})]})},Le=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Hn=t=>{var R;const{onChange:e,className:r,value:n,type:o,id:i,disabled:c=!1}=t,y=ee.useDependency(x.IUniverInstanceService),p=y.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),S=(R=y.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:R.getSheetId(),v=j.useRef({}),[T,_]=j.useState(!1);ee.useSidebarClick(h=>{var s;const a=(s=v.current)==null?void 0:s.handleOutClick;a&&a(h,()=>_(!1))});const w=j.useRef(n),b=j.useMemo(()=>[u.CFValueType.percentile,u.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===u.CFValueType.formula){const h=String(w.current).startsWith("=")?String(w.current)||"":"=";return I.jsx("div",{style:{width:"100%",marginLeft:12},children:I.jsx(dt.FormulaEditor,{initValue:h,unitId:p,subUnitId:S,isFocus:T,onChange:(a="")=>{e(a||"")},onFocus:()=>_(!0),actions:v.current})})}return I.jsx(Q.InputNumber,{className:r,value:Number(n)||0,disabled:c,onChange:h=>{e(h||0)},...b})},Fi=t=>{var L;const{interceptorManager:e}=t,r=ee.useDependency(x.LocaleService),n=((L=t.rule)==null?void 0:L.type)===u.CFRuleType.dataBar?t.rule:void 0,[o,i]=j.useState(()=>{var N;const E="0";return n?(N=n.config)!=null&&N.isGradient?"1":"0":E}),[c,y]=j.useState(()=>{var E;return n&&((E=n.config)==null?void 0:E.positiveColor)||u.defaultDataBarPositiveColor}),[p,S]=j.useState(()=>{var E;return n&&((E=n.config)==null?void 0:E.nativeColor)||u.defaultDataBarNativeColor}),v=[Le(u.CFValueType.num,r),Le(u.CFValueType.percent,r),Le(u.CFValueType.percentile,r),Le(u.CFValueType.formula,r)],T=[Le(u.CFValueType.min,r),...v],_=[Le(u.CFValueType.max,r),...v],[w,b]=j.useState(()=>{var N;const E=T[0].value;return n&&((N=n.config)==null?void 0:N.min.type)||E}),[R,h]=j.useState(()=>{var N;const E=_[0].value;return n&&((N=n.config)==null?void 0:N.max.type)||E}),[a,s]=j.useState(()=>{var W;if(!n)return 0;const N=((W=n.config)==null?void 0:W.min)||{};return N.type===u.CFValueType.formula?N.value||"=":N.value||0}),[f,C]=j.useState(()=>{var W;if(!n)return 100;const N=((W=n.config)==null?void 0:W.max)||{};return N.type===u.CFValueType.formula?N.value||"=":N.value===void 0?100:N.value}),[l,m]=j.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),d=E=>({config:{min:{type:E.minValueType,value:E.minValue},max:{type:E.maxValueType,value:E.maxValue},isGradient:E.isGradient==="1",positiveColor:E.positiveColor||u.defaultDataBarPositiveColor,nativeColor:E.nativeColor||u.defaultDataBarNativeColor},type:u.CFRuleType.dataBar,isShowValue:E.isShowValue});j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return d({isGradient:o,minValue:a,minValueType:w,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:l})}}),[o,a,w,f,R,c,p,e,l]);const g=E=>{t.onChange(d(E))},F=E=>{y(E),g({isGradient:o,minValue:a,minValueType:w,maxValue:f,maxValueType:R,positiveColor:E,nativeColor:p,isShowValue:l})},D=E=>{S(E),g({isGradient:o,minValue:a,minValueType:w,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:E,isShowValue:l})},U=E=>v.map(N=>N.value).includes(E);return I.jsxs("div",{children:[I.jsx("div",{className:z.title,children:r.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
41
- ${H.cfPreviewWrap}
42
- `,children:I.jsx(qe,{rule:d({isGradient:o,minValue:a,minValueType:w,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:l})})}),I.jsxs("div",{children:[I.jsx("div",{className:z.label,children:r.t("sheet.cf.panel.fillType")}),I.jsxs("div",{className:`
23
+ `,value:s,type:_,onChange:E=>{f(E),L({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:E,minColor:C,medianColor:m,maxColor:g})}}),I.jsx(Ne,{className:z.mLXxs,color:g,onChange:E=>{D(E),L({minType:p,medianType:v,maxType:_,minValue:b,medianValue:h,maxValue:s,minColor:C,medianColor:m,maxColor:E})}})]})]})},Le=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Hn=t=>{var w;const{onChange:e,className:r,value:n,type:o,id:i,disabled:c=!1}=t,y=ee.useDependency(x.IUniverInstanceService),p=y.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),S=(w=y.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:w.getSheetId(),v=j.useRef({}),[R,_]=j.useState(!1);ee.useSidebarClick(h=>{var s;const a=(s=v.current)==null?void 0:s.handleOutClick;a&&a(h,()=>_(!1))});const T=j.useRef(n),b=j.useMemo(()=>[u.CFValueType.percentile,u.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===u.CFValueType.formula){const h=String(T.current).startsWith("=")?String(T.current)||"":"=";return I.jsx("div",{style:{width:"100%",marginLeft:12},children:I.jsx(dt.FormulaEditor,{initValue:h,unitId:p,subUnitId:S,isFocus:R,onChange:(a="")=>{e(a||"")},onFocus:()=>_(!0),actions:v.current})})}return I.jsx(Z.InputNumber,{className:r,value:Number(n)||0,disabled:c,onChange:h=>{e(h||0)},...b})},Di=t=>{var U;const{interceptorManager:e}=t,r=ee.useDependency(x.LocaleService),n=((U=t.rule)==null?void 0:U.type)===u.CFRuleType.dataBar?t.rule:void 0,[o,i]=j.useState(()=>{var N;const E="0";return n?(N=n.config)!=null&&N.isGradient?"1":"0":E}),[c,y]=j.useState(()=>{var E;return n&&((E=n.config)==null?void 0:E.positiveColor)||u.defaultDataBarPositiveColor}),[p,S]=j.useState(()=>{var E;return n&&((E=n.config)==null?void 0:E.nativeColor)||u.defaultDataBarNativeColor}),v=[Le(u.CFValueType.num,r),Le(u.CFValueType.percent,r),Le(u.CFValueType.percentile,r),Le(u.CFValueType.formula,r)],R=[Le(u.CFValueType.min,r),...v],_=[Le(u.CFValueType.max,r),...v],[T,b]=j.useState(()=>{var N;const E=R[0].value;return n&&((N=n.config)==null?void 0:N.min.type)||E}),[w,h]=j.useState(()=>{var N;const E=_[0].value;return n&&((N=n.config)==null?void 0:N.max.type)||E}),[a,s]=j.useState(()=>{var q;if(!n)return 0;const N=((q=n.config)==null?void 0:q.min)||{};return N.type===u.CFValueType.formula?N.value||"=":N.value||0}),[f,C]=j.useState(()=>{var q;if(!n)return 100;const N=((q=n.config)==null?void 0:q.max)||{};return N.type===u.CFValueType.formula?N.value||"=":N.value===void 0?100:N.value}),[l,m]=j.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),d=E=>({config:{min:{type:E.minValueType,value:E.minValue},max:{type:E.maxValueType,value:E.maxValue},isGradient:E.isGradient==="1",positiveColor:E.positiveColor||u.defaultDataBarPositiveColor,nativeColor:E.nativeColor||u.defaultDataBarNativeColor},type:u.CFRuleType.dataBar,isShowValue:E.isShowValue});j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return d({isGradient:o,minValue:a,minValueType:T,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:l})}}),[o,a,T,f,w,c,p,e,l]);const g=E=>{t.onChange(d(E))},D=E=>{y(E),g({isGradient:o,minValue:a,minValueType:T,maxValue:f,maxValueType:w,positiveColor:E,nativeColor:p,isShowValue:l})},M=E=>{S(E),g({isGradient:o,minValue:a,minValueType:T,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:E,isShowValue:l})},L=E=>v.map(N=>N.value).includes(E);return I.jsxs("div",{children:[I.jsx("div",{className:z.title,children:r.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
24
+ ${W.cfPreviewWrap}
25
+ `,children:I.jsx(qe,{rule:d({isGradient:o,minValue:a,minValueType:T,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:l})})}),I.jsxs("div",{children:[I.jsx("div",{className:z.label,children:r.t("sheet.cf.panel.fillType")}),I.jsxs("div",{className:`
43
26
  ${z.mTSm}
44
27
  ${z.mLXxs}
45
28
  ${z.labelContainer}
46
- `,children:[I.jsxs(Q.RadioGroup,{value:o,onChange:E=>{i(E),g({isGradient:E,minValue:a,minValueType:w,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:l})},children:[I.jsx(Q.Radio,{value:"0",children:I.jsx("span",{className:H.text,children:r.t("sheet.cf.panel.pureColor")})}),I.jsx(Q.Radio,{value:"1",children:I.jsx("span",{className:H.text,children:r.t("sheet.cf.panel.gradient")})})]}),I.jsxs("div",{className:`
47
- ${H.utilItem}
29
+ `,children:[I.jsxs(Z.RadioGroup,{value:o,onChange:E=>{i(E),g({isGradient:E,minValue:a,minValueType:T,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:l})},children:[I.jsx(Z.Radio,{value:"0",children:I.jsx("span",{className:W.text,children:r.t("sheet.cf.panel.pureColor")})}),I.jsx(Z.Radio,{value:"1",children:I.jsx("span",{className:W.text,children:r.t("sheet.cf.panel.gradient")})})]}),I.jsxs("div",{className:`
30
+ ${W.utilItem}
48
31
  ${z.mLXl}
49
- `,children:[I.jsx(Q.Checkbox,{checked:!l,onChange:E=>{m(!E),g({isGradient:E,minValue:a,minValueType:w,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:!E})}}),r.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),I.jsxs("div",{children:[I.jsx("div",{className:z.label,children:r.t("sheet.cf.panel.colorSet")}),I.jsxs("div",{className:`
32
+ `,children:[I.jsx(Z.Checkbox,{checked:!l,onChange:E=>{m(!E),g({isGradient:E,minValue:a,minValueType:T,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:!E})}}),r.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),I.jsxs("div",{children:[I.jsx("div",{className:z.label,children:r.t("sheet.cf.panel.colorSet")}),I.jsxs("div",{className:`
50
33
  ${z.labelContainer}
51
34
  ${z.mTSm}
52
35
  ${z.mLXxs}
53
36
  `,children:[I.jsxs("div",{className:`
54
37
  ${z.labelContainer}
55
38
  `,children:[I.jsx("div",{className:`
56
- ${H.text}
57
- `,children:r.t("sheet.cf.panel.native")}),I.jsx(Ne,{color:p,onChange:D})]}),I.jsxs("div",{className:`
39
+ ${W.text}
40
+ `,children:r.t("sheet.cf.panel.native")}),I.jsx(Ne,{color:p,onChange:M})]}),I.jsxs("div",{className:`
58
41
  ${z.labelContainer}
59
42
  ${z.mLSm}
60
43
  `,children:[I.jsx("div",{className:`
61
- ${H.text}
62
- `,children:r.t("sheet.cf.panel.positive")}),I.jsx(Ne,{color:c,onChange:F})]})]})]}),I.jsxs("div",{children:[I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.min")}),I.jsxs("div",{className:`
44
+ ${W.text}
45
+ `,children:r.t("sheet.cf.panel.positive")}),I.jsx(Ne,{color:c,onChange:D})]})]})]}),I.jsxs("div",{children:[I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.min")}),I.jsxs("div",{className:`
63
46
  ${z.mTSm}
64
47
  ${z.labelContainer}
65
- `,children:[I.jsx(Q.Select,{style:{width:"50%",flexShrink:0},options:T,value:w,onChange:E=>{b(E);const N=u.createDefaultValueByValueType(E,10);s(N),g({isGradient:o,minValue:N,minValueType:E,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:l})}}),I.jsx(Hn,{disabled:!U(w),id:"min",type:w,className:z.mLSm,value:a,onChange:E=>{s(E||0),g({isGradient:o,minValue:E||0,minValueType:w,maxValue:f,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:l})}})]}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.max")}),I.jsxs("div",{className:`
48
+ `,children:[I.jsx(Z.Select,{style:{width:"50%",flexShrink:0},options:R,value:T,onChange:E=>{b(E);const N=u.createDefaultValueByValueType(E,10);s(N),g({isGradient:o,minValue:N,minValueType:E,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:l})}}),I.jsx(Hn,{disabled:!L(T),id:"min",type:T,className:z.mLSm,value:a,onChange:E=>{s(E||0),g({isGradient:o,minValue:E||0,minValueType:T,maxValue:f,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:l})}})]}),I.jsx("div",{className:z.label,children:r.t("sheet.cf.valueType.max")}),I.jsxs("div",{className:`
66
49
  ${z.mTSm}
67
50
  ${z.labelContainer}
68
- `,children:[I.jsx(Q.Select,{style:{width:"50%",flexShrink:0},options:_,value:R,onChange:E=>{h(E);const N=u.createDefaultValueByValueType(E,90);C(N),g({isGradient:o,minValue:a,minValueType:w,maxValue:N,maxValueType:E,positiveColor:c,nativeColor:p,isShowValue:l})}}),I.jsx(Hn,{disabled:!U(R),id:"max",type:R,className:z.mLSm,value:f,onChange:E=>{C(E||0),g({isGradient:o,minValue:a,minValueType:w,maxValue:E||0,maxValueType:R,positiveColor:c,nativeColor:p,isShowValue:l})}})]})]})]})},Di="univer-cf-style-edit",Mi="univer-button-item",Ni="univer-isActive",xe={cfStyleEdit:Di,buttonItem:Mi,isActive:Ni},bt=t=>[x.BooleanNumber.FALSE,void 0].includes(t)?x.BooleanNumber.TRUE:x.BooleanNumber.FALSE,St=t=>t!==x.BooleanNumber.FALSE,fn=t=>{const{style:e,onChange:r,className:n}=t,o=ee.useDependency(ee.ComponentManager),[i,c]=j.useState(()=>{if(e!=null&&e.bl)return e.bl}),[y,p]=j.useState(()=>{if(e!=null&&e.it)return e.it}),[S,v]=j.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[T,_]=j.useState(()=>{if(e!=null&&e.st)return e.st.s}),[w,b]=j.useState(()=>{var m;const l="#2f56ef";return(m=e==null?void 0:e.cl)!=null&&m.rgb?e.cl.rgb:l}),[R,h]=j.useState(()=>{var m;const l="#e8ecfc";return(m=e==null?void 0:e.bg)!=null&&m.rgb?e.bg.rgb:l}),a=o.get("BoldSingle"),s=o.get("ItalicSingle"),f=o.get("UnderlineSingle"),C=o.get("StrikethroughSingle");return j.useEffect(()=>{const l={bl:i,it:y};w!==void 0&&(l.cl={rgb:w}),R!==void 0&&(l.bg={rgb:R}),T!==void 0&&(l.st={s:T}),S!==void 0&&(l.ul={s:S}),r(u.removeUndefinedAttr(l))},[i,y,S,T,w,R]),I.jsxs("div",{className:Q.clsx(xe.cfStyleEdit,n),children:[a&&I.jsx("div",{className:Q.clsx({[xe.isActive]:St(i||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>c(bt(i)),children:I.jsx(a,{})}),s&&I.jsx("div",{className:Q.clsx({[xe.isActive]:St(y||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>p(bt(y)),children:I.jsx(s,{})}),f&&I.jsx("div",{className:Q.clsx({[xe.isActive]:St(S||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>v(bt(S)),children:I.jsx(f,{})}),C&&I.jsx("div",{className:Q.clsx({[xe.isActive]:St(T||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>_(bt(T)),children:I.jsx(C,{})}),I.jsx(Ne,{color:w,onChange:b,iconId:"FontColor"}),I.jsx(Ne,{color:R,onChange:h,iconId:"PaintBucket"})]})},ji=t=>{var C;const{onChange:e,interceptorManager:r}=t,n=ee.useDependency(x.LocaleService),i=ee.useDependency(x.IUniverInstanceService).getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),c=i.getActiveSheet(),y=((C=t.rule)==null?void 0:C.type)===u.CFRuleType.highlightCell?t.rule:void 0,p=j.useRef(null),[S,v]=j.useState(!1),T=j.useRef({}),[_,w]=j.useState({}),[b,R]=j.useState(()=>(y==null?void 0:y.subType)===u.CFSubRuleType.formula?y.value:"="),[h,a]=j.useState(void 0),s=l=>({style:l.style,value:b,type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula});j.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return s({style:_})}}),[_,b,r]),j.useEffect(()=>r.intercept(r.getInterceptPoints().beforeSubmit,{handler:(m,d,g)=>h||b.length===1||!b.startsWith("=")?(a(n.t("sheet.cf.errorMessage.formulaError")),!1):g(m)}),[h,b]);const f=l=>{e(s(l))};return ee.useSidebarClick(l=>{var d;const m=(d=T.current)==null?void 0:d.handleOutClick;m&&m(l,()=>v(!1))}),I.jsxs("div",{ref:p,children:[I.jsx("div",{className:`
51
+ `,children:[I.jsx(Z.Select,{style:{width:"50%",flexShrink:0},options:_,value:w,onChange:E=>{h(E);const N=u.createDefaultValueByValueType(E,90);C(N),g({isGradient:o,minValue:a,minValueType:T,maxValue:N,maxValueType:E,positiveColor:c,nativeColor:p,isShowValue:l})}}),I.jsx(Hn,{disabled:!L(w),id:"max",type:w,className:z.mLSm,value:f,onChange:E=>{C(E||0),g({isGradient:o,minValue:a,minValueType:T,maxValue:E||0,maxValueType:w,positiveColor:c,nativeColor:p,isShowValue:l})}})]})]})]})},Fi="univer-cf-style-edit",Mi="univer-button-item",Ni="univer-isActive",xe={cfStyleEdit:Fi,buttonItem:Mi,isActive:Ni},bt=t=>[x.BooleanNumber.FALSE,void 0].includes(t)?x.BooleanNumber.TRUE:x.BooleanNumber.FALSE,St=t=>t!==x.BooleanNumber.FALSE,fn=t=>{const{style:e,onChange:r,className:n}=t,o=ee.useDependency(ee.ComponentManager),[i,c]=j.useState(()=>{if(e!=null&&e.bl)return e.bl}),[y,p]=j.useState(()=>{if(e!=null&&e.it)return e.it}),[S,v]=j.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[R,_]=j.useState(()=>{if(e!=null&&e.st)return e.st.s}),[T,b]=j.useState(()=>{var m;const l="#2f56ef";return(m=e==null?void 0:e.cl)!=null&&m.rgb?e.cl.rgb:l}),[w,h]=j.useState(()=>{var m;const l="#e8ecfc";return(m=e==null?void 0:e.bg)!=null&&m.rgb?e.bg.rgb:l}),a=o.get("BoldSingle"),s=o.get("ItalicSingle"),f=o.get("UnderlineSingle"),C=o.get("StrikethroughSingle");return j.useEffect(()=>{const l={bl:i,it:y};T!==void 0&&(l.cl={rgb:T}),w!==void 0&&(l.bg={rgb:w}),R!==void 0&&(l.st={s:R}),S!==void 0&&(l.ul={s:S}),r(u.removeUndefinedAttr(l))},[i,y,S,R,T,w]),I.jsxs("div",{className:Z.clsx(xe.cfStyleEdit,n),children:[a&&I.jsx("div",{className:Z.clsx({[xe.isActive]:St(i||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>c(bt(i)),children:I.jsx(a,{})}),s&&I.jsx("div",{className:Z.clsx({[xe.isActive]:St(y||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>p(bt(y)),children:I.jsx(s,{})}),f&&I.jsx("div",{className:Z.clsx({[xe.isActive]:St(S||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>v(bt(S)),children:I.jsx(f,{})}),C&&I.jsx("div",{className:Z.clsx({[xe.isActive]:St(R||x.BooleanNumber.FALSE)},xe.buttonItem),onClick:()=>_(bt(R)),children:I.jsx(C,{})}),I.jsx(Ne,{color:T,onChange:b,iconId:"FontColor"}),I.jsx(Ne,{color:w,onChange:h,iconId:"PaintBucket"})]})},ji=t=>{var C;const{onChange:e,interceptorManager:r}=t,n=ee.useDependency(x.LocaleService),i=ee.useDependency(x.IUniverInstanceService).getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),c=i.getActiveSheet(),y=((C=t.rule)==null?void 0:C.type)===u.CFRuleType.highlightCell?t.rule:void 0,p=j.useRef(null),[S,v]=j.useState(!1),R=j.useRef({}),[_,T]=j.useState({}),[b,w]=j.useState(()=>(y==null?void 0:y.subType)===u.CFSubRuleType.formula?y.value:"="),[h,a]=j.useState(void 0),s=l=>({style:l.style,value:b,type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula});j.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return s({style:_})}}),[_,b,r]),j.useEffect(()=>r.intercept(r.getInterceptPoints().beforeSubmit,{handler:(m,d,g)=>h||b.length===1||!b.startsWith("=")?(a(n.t("sheet.cf.errorMessage.formulaError")),!1):g(m)}),[h,b]);const f=l=>{e(s(l))};return ee.useSidebarClick(l=>{var d;const m=(d=R.current)==null?void 0:d.handleOutClick;m&&m(l,()=>v(!1))}),I.jsxs("div",{ref:p,children:[I.jsx("div",{className:`
69
52
  ${z.title}
70
53
  ${z.mTBase}
71
54
  `,children:n.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
72
55
  ${z.mTSm}
73
- `,children:I.jsx(dt.FormulaEditor,{onChange:l=>{R(l),f({style:_})},onVerify:(l,m)=>{!l||m.length===1?a(n.t("sheet.cf.errorMessage.formulaError")):a(void 0)},errorText:h,onFocus:()=>{v(!0)},actions:T.current,isFocus:S,initValue:b,unitId:i.getUnitId(),subUnitId:c==null?void 0:c.getSheetId()})}),I.jsx("div",{className:`
74
- ${H.cfPreviewWrap}
56
+ `,children:I.jsx(dt.FormulaEditor,{onChange:l=>{w(l),f({style:_})},onVerify:(l,m)=>{!l||m.length===1?a(n.t("sheet.cf.errorMessage.formulaError")):a(void 0)},errorText:h,onFocus:()=>{v(!0)},actions:R.current,isFocus:S,initValue:b,unitId:i.getUnitId(),subUnitId:c==null?void 0:c.getSheetId()})}),I.jsx("div",{className:`
57
+ ${W.cfPreviewWrap}
75
58
  `,children:I.jsx(qe,{rule:s({style:_})})}),I.jsx(fn,{style:y==null?void 0:y.style,className:`
76
59
  ${z.mTSm}
77
- `,onChange:l=>{w(l),f({style:l})}})]})},Rt=t=>I.jsxs("div",{style:{position:"relative"},children:[I.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:t.errorText}),t.children]}),ue=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),Li=t=>{const{type:e,operator:r,onChange:n,value:o,interceptorManager:i}=t,c=ee.useDependency(x.LocaleService),[y,p]=j.useState(()=>typeof o=="number"?o:0),[S,v]=j.useState(""),[T,_]=j.useState(()=>typeof o=="string"?o:""),[w,b]=j.useState(""),[R,h]=j.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[a,s]=j.useState(""),[f,C]=j.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[l,m]=j.useState("");switch(j.useEffect(()=>{switch(e){case u.CFSubRuleType.text:{[u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(r)&&n(T);break}case u.CFSubRuleType.number:{[u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(r)&&n(y),[u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(r)&&n([R,f]);break}}},[e]),j.useEffect(()=>{const d=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(g,F,D)=>{switch(e){case u.CFSubRuleType.text:if([u.CFTextOperator.beginsWith,u.CFTextOperator.containsText,u.CFTextOperator.endsWith,u.CFTextOperator.notEqual,u.CFTextOperator.notContainsText,u.CFTextOperator.equal].includes(r))return T?D(g):(b(c.t("sheet.cf.errorMessage.notBlank")),!1)}return D(g)}});return()=>{d()}},[e,y,T,r]),e){case u.CFSubRuleType.text:{if([u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(r)){const d=g=>{_(g),n(g)};return I.jsx("div",{className:`
60
+ `,onChange:l=>{T(l),f({style:l})}})]})},Rt=t=>I.jsxs("div",{style:{position:"relative"},children:[I.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:t.errorText}),t.children]}),ue=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),Li=t=>{const{type:e,operator:r,onChange:n,value:o,interceptorManager:i}=t,c=ee.useDependency(x.LocaleService),[y,p]=j.useState(()=>typeof o=="number"?o:0),[S,v]=j.useState(""),[R,_]=j.useState(()=>typeof o=="string"?o:""),[T,b]=j.useState(""),[w,h]=j.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[a,s]=j.useState(""),[f,C]=j.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100),[l,m]=j.useState("");switch(j.useEffect(()=>{switch(e){case u.CFSubRuleType.text:{[u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(r)&&n(R);break}case u.CFSubRuleType.number:{[u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(r)&&n(y),[u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(r)&&n([w,f]);break}}},[e]),j.useEffect(()=>{const d=i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(g,D,M)=>{switch(e){case u.CFSubRuleType.text:if([u.CFTextOperator.beginsWith,u.CFTextOperator.containsText,u.CFTextOperator.endsWith,u.CFTextOperator.notEqual,u.CFTextOperator.notContainsText,u.CFTextOperator.equal].includes(r))return R?M(g):(b(c.t("sheet.cf.errorMessage.notBlank")),!1)}return M(g)}});return()=>{d()}},[e,y,R,r]),e){case u.CFSubRuleType.text:{if([u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(r)){const d=g=>{_(g),n(g)};return I.jsx("div",{className:`
78
61
  ${z.mTSm}
79
- `,children:I.jsx(Rt,{errorText:w,children:I.jsx(Q.Input,{className:H.width100,value:T,onChange:g=>{b(""),d(g)}})})})}break}case u.CFSubRuleType.number:{if([u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(r)){const d=g=>{p(g||0),n(g||0),v("")};return I.jsx("div",{className:`
62
+ `,children:I.jsx(Rt,{errorText:T,children:I.jsx(Z.Input,{className:W.width100,value:R,onChange:g=>{b(""),d(g)}})})})}break}case u.CFSubRuleType.number:{if([u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(r)){const d=g=>{p(g||0),n(g||0),v("")};return I.jsx("div",{className:`
80
63
  ${z.mTSm}
81
- `,children:I.jsx(Rt,{errorText:S,children:I.jsx(Q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:H.width100,value:y,onChange:d})})})}if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(r)){const d=F=>{h(F||0),n([F||0,f]),s("")},g=F=>{C(F||0),n([R,F||0]),m("")};return I.jsxs("div",{className:`
64
+ `,children:I.jsx(Rt,{errorText:S,children:I.jsx(Z.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:W.width100,value:y,onChange:d})})})}if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(r)){const d=D=>{h(D||0),n([D||0,f]),s("")},g=D=>{C(D||0),n([w,D||0]),m("")};return I.jsxs("div",{className:`
82
65
  ${z.mTSm}
83
66
  ${z.labelContainer}
84
- `,children:[I.jsx(Rt,{errorText:a,children:I.jsx(Q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:R,onChange:d})}),I.jsx(Rt,{errorText:l,children:I.jsx(Q.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`
67
+ `,children:[I.jsx(Rt,{errorText:a,children:I.jsx(Z.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:w,onChange:d})}),I.jsx(Rt,{errorText:l,children:I.jsx(Z.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`
85
68
  ${z.mLSm}
86
- `,value:f,onChange:g})})]})}}}return null},Bn=(t,e)=>{switch(t){case u.CFSubRuleType.text:return[ue(u.CFTextOperator.containsText,e),ue(u.CFTextOperator.notContainsText,e),ue(u.CFTextOperator.beginsWith,e),ue(u.CFTextOperator.endsWith,e),ue(u.CFTextOperator.equal,e),ue(u.CFTextOperator.notEqual,e),ue(u.CFTextOperator.containsBlanks,e),ue(u.CFTextOperator.notContainsBlanks,e),ue(u.CFTextOperator.containsErrors,e),ue(u.CFTextOperator.notContainsErrors,e)];case u.CFSubRuleType.number:return[ue(u.CFNumberOperator.between,e),ue(u.CFNumberOperator.notBetween,e),ue(u.CFNumberOperator.equal,e),ue(u.CFNumberOperator.notEqual,e),ue(u.CFNumberOperator.greaterThan,e),ue(u.CFNumberOperator.greaterThanOrEqual,e),ue(u.CFNumberOperator.lessThan,e),ue(u.CFNumberOperator.lessThanOrEqual,e)];case u.CFSubRuleType.timePeriod:return[ue(u.CFTimePeriodOperator.yesterday,e),ue(u.CFTimePeriodOperator.today,e),ue(u.CFTimePeriodOperator.tomorrow,e),ue(u.CFTimePeriodOperator.last7Days,e),ue(u.CFTimePeriodOperator.lastWeek,e),ue(u.CFTimePeriodOperator.thisWeek,e),ue(u.CFTimePeriodOperator.nextWeek,e),ue(u.CFTimePeriodOperator.lastMonth,e),ue(u.CFTimePeriodOperator.thisMonth,e),ue(u.CFTimePeriodOperator.nextMonth,e)]}},Gn=t=>{var C;const{interceptorManager:e,onChange:r}=t,n=ee.useDependency(x.LocaleService),o=((C=t.rule)==null?void 0:C.type)===u.CFRuleType.highlightCell?t.rule:void 0,[i,c]=j.useState(()=>{const l=u.CFSubRuleType.text;return o&&o.subType||l}),y=[{value:u.CFSubRuleType.text,label:n.t("sheet.cf.subRuleType.text")},{value:u.CFSubRuleType.number,label:n.t("sheet.cf.subRuleType.number")},{value:u.CFSubRuleType.timePeriod,label:n.t("sheet.cf.subRuleType.timePeriod")},{value:u.CFSubRuleType.duplicateValues,label:n.t("sheet.cf.subRuleType.duplicateValues")},{value:u.CFSubRuleType.uniqueValues,label:n.t("sheet.cf.subRuleType.uniqueValues")}],p=j.useMemo(()=>Bn(i,n),[i]),[S,v]=j.useState(()=>{const l=p?p[0].value:void 0;return o&&o.operator||l}),[T,_]=j.useState(()=>{var d;const l="";return o?(d=o.value)!=null?d:u.createDefaultValue(o.subType,o.operator):l}),[w,b]=j.useState({}),R=j.useMemo(()=>l=>{var m,d,g,F,D,U,L,E,N,W,B,Z,se,re,q;switch(l.subType||i){case u.CFSubRuleType.text:{if([u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(S))return{type:u.CFRuleType.highlightCell,subType:(m=l.subType)!=null?m:i,operator:(d=l.operator)!=null?d:S,style:(g=l.style)!=null?g:w,value:(F=l.value)!=null?F:T};break}case u.CFSubRuleType.number:{if([u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(S))return{type:u.CFRuleType.highlightCell,subType:(D=l.subType)!=null?D:i,operator:(U=l.operator)!=null?U:S,style:(L=l.style)!=null?L:w,value:(E=l.value)!=null?E:T};if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(S))return{type:u.CFRuleType.highlightCell,subType:(N=l.subType)!=null?N:i,operator:(W=l.operator)!=null?W:S,style:(B=l.style)!=null?B:w,value:(Z=l.value)!=null?Z:T};break}}return{type:u.CFRuleType.highlightCell,subType:(se=l.subType)!=null?se:i,operator:(re=l.operator)!=null?re:S,style:(q=l.style)!=null?q:w}},[i,S,T,w]);j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return R({})}}),[R,e]),j.useEffect(()=>{y.some(l=>l.value===i)||c(y[0].value)},[y]);const h=l=>{const m=l,d=Bn(m,n),g=d&&d[0].value;c(m),v(g),g&&_(u.createDefaultValue(m,g)),r(R({subType:m,operator:g}))},a=l=>{const m=l;v(m),r(R({operator:m}))},s=l=>{_(l),r(R({value:l}))},f=j.useMemo(()=>`${i}_${S}_${Math.random()}`,[i,S]);return I.jsxs("div",{children:[I.jsx("div",{className:`
69
+ `,value:f,onChange:g})})]})}}}return null},Bn=(t,e)=>{switch(t){case u.CFSubRuleType.text:return[ue(u.CFTextOperator.containsText,e),ue(u.CFTextOperator.notContainsText,e),ue(u.CFTextOperator.beginsWith,e),ue(u.CFTextOperator.endsWith,e),ue(u.CFTextOperator.equal,e),ue(u.CFTextOperator.notEqual,e),ue(u.CFTextOperator.containsBlanks,e),ue(u.CFTextOperator.notContainsBlanks,e),ue(u.CFTextOperator.containsErrors,e),ue(u.CFTextOperator.notContainsErrors,e)];case u.CFSubRuleType.number:return[ue(u.CFNumberOperator.between,e),ue(u.CFNumberOperator.notBetween,e),ue(u.CFNumberOperator.equal,e),ue(u.CFNumberOperator.notEqual,e),ue(u.CFNumberOperator.greaterThan,e),ue(u.CFNumberOperator.greaterThanOrEqual,e),ue(u.CFNumberOperator.lessThan,e),ue(u.CFNumberOperator.lessThanOrEqual,e)];case u.CFSubRuleType.timePeriod:return[ue(u.CFTimePeriodOperator.yesterday,e),ue(u.CFTimePeriodOperator.today,e),ue(u.CFTimePeriodOperator.tomorrow,e),ue(u.CFTimePeriodOperator.last7Days,e),ue(u.CFTimePeriodOperator.lastWeek,e),ue(u.CFTimePeriodOperator.thisWeek,e),ue(u.CFTimePeriodOperator.nextWeek,e),ue(u.CFTimePeriodOperator.lastMonth,e),ue(u.CFTimePeriodOperator.thisMonth,e),ue(u.CFTimePeriodOperator.nextMonth,e)]}},Gn=t=>{var C;const{interceptorManager:e,onChange:r}=t,n=ee.useDependency(x.LocaleService),o=((C=t.rule)==null?void 0:C.type)===u.CFRuleType.highlightCell?t.rule:void 0,[i,c]=j.useState(()=>{const l=u.CFSubRuleType.text;return o&&o.subType||l}),y=[{value:u.CFSubRuleType.text,label:n.t("sheet.cf.subRuleType.text")},{value:u.CFSubRuleType.number,label:n.t("sheet.cf.subRuleType.number")},{value:u.CFSubRuleType.timePeriod,label:n.t("sheet.cf.subRuleType.timePeriod")},{value:u.CFSubRuleType.duplicateValues,label:n.t("sheet.cf.subRuleType.duplicateValues")},{value:u.CFSubRuleType.uniqueValues,label:n.t("sheet.cf.subRuleType.uniqueValues")}],p=j.useMemo(()=>Bn(i,n),[i]),[S,v]=j.useState(()=>{const l=p?p[0].value:void 0;return o&&o.operator||l}),[R,_]=j.useState(()=>{var d;const l="";return o?(d=o.value)!=null?d:u.createDefaultValue(o.subType,o.operator):l}),[T,b]=j.useState({}),w=j.useMemo(()=>l=>{var m,d,g,D,M,L,U,E,N,q,H,J,ie,re,le;switch(l.subType||i){case u.CFSubRuleType.text:{if([u.CFTextOperator.beginsWith,u.CFTextOperator.endsWith,u.CFTextOperator.containsText,u.CFTextOperator.notContainsText,u.CFTextOperator.equal,u.CFTextOperator.notEqual].includes(S))return{type:u.CFRuleType.highlightCell,subType:(m=l.subType)!=null?m:i,operator:(d=l.operator)!=null?d:S,style:(g=l.style)!=null?g:T,value:(D=l.value)!=null?D:R};break}case u.CFSubRuleType.number:{if([u.CFNumberOperator.equal,u.CFNumberOperator.notEqual,u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual,u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(S))return{type:u.CFRuleType.highlightCell,subType:(M=l.subType)!=null?M:i,operator:(L=l.operator)!=null?L:S,style:(U=l.style)!=null?U:T,value:(E=l.value)!=null?E:R};if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(S))return{type:u.CFRuleType.highlightCell,subType:(N=l.subType)!=null?N:i,operator:(q=l.operator)!=null?q:S,style:(H=l.style)!=null?H:T,value:(J=l.value)!=null?J:R};break}}return{type:u.CFRuleType.highlightCell,subType:(ie=l.subType)!=null?ie:i,operator:(re=l.operator)!=null?re:S,style:(le=l.style)!=null?le:T}},[i,S,R,T]);j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return w({})}}),[w,e]),j.useEffect(()=>{y.some(l=>l.value===i)||c(y[0].value)},[y]);const h=l=>{const m=l,d=Bn(m,n),g=d&&d[0].value;c(m),v(g),g&&_(u.createDefaultValue(m,g)),r(w({subType:m,operator:g}))},a=l=>{const m=l;v(m),r(w({operator:m}))},s=l=>{_(l),r(w({value:l}))},f=j.useMemo(()=>`${i}_${S}_${Math.random()}`,[i,S]);return I.jsxs("div",{children:[I.jsx("div",{className:`
87
70
  ${z.title}
88
71
  ${z.mTBase}
89
- `,children:n.t("sheet.cf.panel.styleRule")}),I.jsx(Q.Select,{className:`
72
+ `,children:n.t("sheet.cf.panel.styleRule")}),I.jsx(Z.Select,{className:`
90
73
  ${z.mTSm}
91
- ${H.width100}
92
- `,onChange:h,value:i,options:y}),(p==null?void 0:p.length)&&I.jsx(Q.Select,{className:`
74
+ ${W.width100}
75
+ `,onChange:h,value:i,options:y}),(p==null?void 0:p.length)&&I.jsx(Z.Select,{className:`
93
76
  ${z.mTSm}
94
- ${H.width100}
95
- `,onChange:a,value:S||"",options:p}),I.jsx(Li,{value:T,interceptorManager:e,type:i,operator:S,rule:o,onChange:s},f),I.jsx("div",{className:`
96
- ${H.cfPreviewWrap}
97
- `,children:I.jsx(qe,{rule:R({})})}),I.jsx(fn,{style:o==null?void 0:o.style,className:`
77
+ ${W.width100}
78
+ `,onChange:a,value:S||"",options:p}),I.jsx(Li,{value:R,interceptorManager:e,type:i,operator:S,rule:o,onChange:s},f),I.jsx("div",{className:`
79
+ ${W.cfPreviewWrap}
80
+ `,children:I.jsx(qe,{rule:w({})})}),I.jsx(fn,{style:o==null?void 0:o.style,className:`
98
81
  ${z.mLXxs}
99
- `,onChange:l=>{b(l),r(R({style:l}))}})]})},br=(t,e)=>(u.iconMap[t]||[])[Number(e)]||"",Ui=t=>{var p;const e=ee.useDependency(x.IUniverInstanceService),r=e.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),n=(p=e.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:p.getSheetId(),o=j.useMemo(()=>t.error?H.errorInput:"",[t.error]),i=j.useRef({}),[c,y]=j.useState(!1);return ee.useSidebarClick(S=>{var T;const v=(T=i.current)==null?void 0:T.handleOutClick;v&&v(S,()=>y(!1))}),I.jsx("div",{className:H.positionRelative,children:t.type!==u.CFValueType.formula?I.jsxs(I.Fragment,{children:[I.jsx(Q.InputNumber,{className:o,value:Number(t.value)||0,onChange:S=>t.onChange(S!=null?S:0)}),t.error&&I.jsx("div",{className:H.errorText,children:t.error})]}):I.jsx("div",{style:{width:"100%"},children:I.jsx(dt.FormulaEditor,{initValue:String(t.value),unitId:r,subUnitId:n,isFocus:c,onChange:(S="")=>{const v=S||"";t.onChange(v)},onFocus:()=>y(!0),actions:i.current})})})},Xn=(t,e,r)=>({operator:u.CFNumberOperator.greaterThan,value:{type:u.CFValueType.num,value:(r.length-1-e)*10},iconType:t,iconId:String(e)}),Vi=j.forwardRef((t,e)=>{const r=ee.useDependency(x.LocaleService),n=o=>{t.onClick(o)};return I.jsx("div",{ref:e,className:H.iconGroupList,children:u.iconGroup.map((o,i)=>I.jsxs("div",{className:H.group,children:[I.jsx("div",{className:H.title,children:r.t(o.title)}),I.jsx("div",{className:H.itemContent,children:o.group.map(c=>I.jsx("div",{className:H.itemWrap,onClick:()=>{n(c.name)},children:I.jsx("div",{className:H.item,children:c.list.map((y,p)=>I.jsx("img",{className:H.icon,src:y},p))})},c.name))})]},i))})}),zi=t=>{const e=j.useMemo(()=>{const n=[];for(const o in u.iconMap){const i=u.iconMap[o],c=o;i.forEach((y,p)=>{n.push({iconType:c,base64:y,iconId:String(p)})})}return n},[]),r=n=>{t.onClick(n.iconType,n.iconId)};return I.jsxs("div",{className:H.iconItemListWrap,children:[I.jsxs("div",{className:H.none,onClick:()=>r({iconType:u.EMPTY_ICON_TYPE,iconId:""}),children:[I.jsx(ft,{className:H.icon}),I.jsx("span",{children:"无单元格图标"})]}),I.jsx("div",{className:H.iconItemList,children:e.map(n=>I.jsx("div",{className:H.item,children:I.jsx("img",{onClick:()=>r(n),className:`
100
- ${H.icon}
101
- `,src:n.base64})},`${n.iconType}_${n.iconId}`))})]})},ki=t=>{const{onChange:e,configList:r,errorMap:n={}}=t,o=ee.useDependency(x.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThan}`),value:u.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThanOrEqual}`),value:u.CFNumberOperator.greaterThanOrEqual}],c=[{label:o.t(`sheet.cf.valueType.${u.CFValueType.num}`),value:u.CFValueType.num},{label:o.t(`sheet.cf.valueType.${u.CFValueType.percent}`),value:u.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${u.CFValueType.percentile}`),value:u.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${u.CFValueType.formula}`),value:u.CFValueType.formula}],y=(T,_)=>{e([String(_),"value","value"],T)},p=(T,_)=>{e([String(_),"operator"],T);const w=u.createDefaultValue(u.CFSubRuleType.number,T);y(w,_)},S=(T,_)=>{e([String(_),"value","type"],T);const w=r[_],b=u.createDefaultValue(u.CFSubRuleType.number,w.operator);y(b,_)};return j.useMemo(()=>r.map((T,_)=>{const w=n[_],b=br(T.iconType,T.iconId),R=_===r.length-1,h=_===0,a=r[_-1],s=(a==null?void 0:a.value.type)===u.CFValueType.formula?o.t("sheet.cf.valueType.formula"):a==null?void 0:a.value.value,f=(C,l)=>{const m={...T,iconId:l,iconType:C};e([String(_)],m)};return I.jsxs("div",{className:`
82
+ `,onChange:l=>{b(l),r(w({style:l}))}})]})},br=(t,e)=>(u.iconMap[t]||[])[Number(e)]||"",Ui=t=>{var p;const e=ee.useDependency(x.IUniverInstanceService),r=e.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),n=(p=e.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:p.getSheetId(),o=j.useMemo(()=>t.error?W.errorInput:"",[t.error]),i=j.useRef({}),[c,y]=j.useState(!1);return ee.useSidebarClick(S=>{var R;const v=(R=i.current)==null?void 0:R.handleOutClick;v&&v(S,()=>y(!1))}),I.jsx("div",{className:W.positionRelative,children:t.type!==u.CFValueType.formula?I.jsxs(I.Fragment,{children:[I.jsx(Z.InputNumber,{className:o,value:Number(t.value)||0,onChange:S=>t.onChange(S!=null?S:0)}),t.error&&I.jsx("div",{className:W.errorText,children:t.error})]}):I.jsx("div",{style:{width:"100%"},children:I.jsx(dt.FormulaEditor,{initValue:String(t.value),unitId:r,subUnitId:n,isFocus:c,onChange:(S="")=>{const v=S||"";t.onChange(v)},onFocus:()=>y(!0),actions:i.current})})})},Xn=(t,e,r)=>({operator:u.CFNumberOperator.greaterThan,value:{type:u.CFValueType.num,value:(r.length-1-e)*10},iconType:t,iconId:String(e)}),Vi=j.forwardRef((t,e)=>{const r=ee.useDependency(x.LocaleService),n=o=>{t.onClick(o)};return I.jsx("div",{ref:e,className:W.iconGroupList,children:u.iconGroup.map((o,i)=>I.jsxs("div",{className:W.group,children:[I.jsx("div",{className:W.title,children:r.t(o.title)}),I.jsx("div",{className:W.itemContent,children:o.group.map(c=>I.jsx("div",{className:W.itemWrap,onClick:()=>{n(c.name)},children:I.jsx("div",{className:W.item,children:c.list.map((y,p)=>I.jsx("img",{className:W.icon,src:y},p))})},c.name))})]},i))})}),zi=t=>{const e=j.useMemo(()=>{const n=[];for(const o in u.iconMap){const i=u.iconMap[o],c=o;i.forEach((y,p)=>{n.push({iconType:c,base64:y,iconId:String(p)})})}return n},[]),r=n=>{t.onClick(n.iconType,n.iconId)};return I.jsxs("div",{className:W.iconItemListWrap,children:[I.jsxs("div",{className:W.none,onClick:()=>r({iconType:u.EMPTY_ICON_TYPE,iconId:""}),children:[I.jsx(ft,{className:W.icon}),I.jsx("span",{children:"无单元格图标"})]}),I.jsx("div",{className:W.iconItemList,children:e.map(n=>I.jsx("div",{className:W.item,children:I.jsx("img",{onClick:()=>r(n),className:`
83
+ ${W.icon}
84
+ `,src:n.base64})},`${n.iconType}_${n.iconId}`))})]})},ki=t=>{const{onChange:e,configList:r,errorMap:n={}}=t,o=ee.useDependency(x.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThan}`),value:u.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThanOrEqual}`),value:u.CFNumberOperator.greaterThanOrEqual}],c=[{label:o.t(`sheet.cf.valueType.${u.CFValueType.num}`),value:u.CFValueType.num},{label:o.t(`sheet.cf.valueType.${u.CFValueType.percent}`),value:u.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${u.CFValueType.percentile}`),value:u.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${u.CFValueType.formula}`),value:u.CFValueType.formula}],y=(R,_)=>{e([String(_),"value","value"],R)},p=(R,_)=>{e([String(_),"operator"],R);const T=u.createDefaultValue(u.CFSubRuleType.number,R);y(T,_)},S=(R,_)=>{e([String(_),"value","type"],R);const T=r[_],b=u.createDefaultValue(u.CFSubRuleType.number,T.operator);y(b,_)};return j.useMemo(()=>r.map((R,_)=>{const T=n[_],b=br(R.iconType,R.iconId),w=_===r.length-1,h=_===0,a=r[_-1],s=(a==null?void 0:a.value.type)===u.CFValueType.formula?o.t("sheet.cf.valueType.formula"):a==null?void 0:a.value.value,f=(C,l)=>{const m={...R,iconId:l,iconType:C};e([String(_)],m)};return I.jsxs("div",{className:`
102
85
  ${_?z.mTXl:z.mTSm}
103
86
  `,children:[I.jsxs("div",{className:`
104
87
  ${z.label}
105
- ${H.flex}
88
+ ${W.flex}
106
89
  `,children:[I.jsxs("div",{className:`
107
- ${H.width45}
90
+ ${W.width45}
108
91
  `,children:[o.t("sheet.cf.iconSet.icon"),_+1]}),I.jsx("div",{className:`
109
- ${H.width45}
110
- `,children:I.jsxs(I.Fragment,{children:[!h&&!R&&o.t("sheet.cf.iconSet.rule"),!h&&!R&&I.jsxs("span",{className:H.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${u.getOppositeOperator(a.operator)}`),s,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),I.jsxs("div",{className:`
111
- ${H.flex}
92
+ ${W.width45}
93
+ `,children:I.jsxs(I.Fragment,{children:[!h&&!w&&o.t("sheet.cf.iconSet.rule"),!h&&!w&&I.jsxs("span",{className:W.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${u.getOppositeOperator(a.operator)}`),s,w?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),I.jsxs("div",{className:`
94
+ ${W.flex}
112
95
  ${z.mTSm}
113
96
  `,children:[I.jsx("div",{className:`
114
- ${H.iconWrap}
115
- ${H.width45}
116
- `,children:I.jsx(Q.Dropdown,{overlay:I.jsx("div",{className:"univer-rounded-lg univer-p-4",children:I.jsx(zi,{onClick:f,iconId:T.iconId,iconType:T.iconType})}),children:I.jsxs("div",{className:Q.clsx(H.dropdownIcon,"univer-box-border univer-h-7"),children:[b?I.jsx("img",{src:b,className:H.icon}):I.jsx(ft,{className:H.icon}),I.jsx(Nt,{})]})})}),R?I.jsxs("div",{className:`
117
- ${H.width45}
97
+ ${W.iconWrap}
98
+ ${W.width45}
99
+ `,children:I.jsx(Z.Dropdown,{overlay:I.jsx("div",{className:"univer-rounded-lg univer-p-4",children:I.jsx(zi,{onClick:f,iconId:R.iconId,iconType:R.iconType})}),children:I.jsxs("div",{className:Z.clsx(W.dropdownIcon,"univer-box-border univer-h-7"),children:[b?I.jsx("img",{src:b,className:W.icon}):I.jsx(ft,{className:W.icon}),I.jsx(Nt,{})]})})}),w?I.jsxs("div",{className:`
100
+ ${W.width45}
118
101
  ${z.label}
119
- `,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),I.jsxs("span",{className:H.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${u.getOppositeOperator(a.operator)}`),s,R?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):I.jsx(Q.Select,{className:`
102
+ `,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),I.jsxs("span",{className:W.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${u.getOppositeOperator(a.operator)}`),s,w?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):I.jsx(Z.Select,{className:`
120
103
  ${z.mL0}
121
- ${H.width45}
104
+ ${W.width45}
122
105
  ${z.mR0}
123
- `,options:i,value:T.operator,onChange:C=>{p(C,_)}})]}),R?I.jsx("div",{}):I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:`
106
+ `,options:i,value:R.operator,onChange:C=>{p(C,_)}})]}),w?I.jsx("div",{}):I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:`
124
107
  ${z.mTSm}
125
108
  ${z.label}
126
- ${H.flex}
109
+ ${W.flex}
127
110
  `,children:[I.jsx("div",{className:`
128
- ${H.width45}
111
+ ${W.width45}
129
112
  `,children:o.t("sheet.cf.iconSet.type")}),I.jsx("div",{className:`
130
- ${H.width45}
113
+ ${W.width45}
131
114
  `,children:o.t("sheet.cf.iconSet.value")})]}),I.jsxs("div",{className:`
132
115
  ${z.mTSm}
133
- ${H.flex}
134
- `,children:[I.jsx(Q.Select,{style:{flexShrink:0},className:`
135
- ${H.width45}
116
+ ${W.flex}
117
+ `,children:[I.jsx(Z.Select,{style:{flexShrink:0},className:`
118
+ ${W.width45}
136
119
  ${z.mL0}
137
- `,options:c,value:T.value.type,onChange:C=>{S(C,_)}}),I.jsx("div",{className:`
120
+ `,options:c,value:R.value.type,onChange:C=>{S(C,_)}}),I.jsx("div",{className:`
138
121
  ${z.mL0}
139
- ${H.width45}
140
- `,children:I.jsx(Ui,{id:_,type:T.value.type,error:w,value:T.value.value||"",onChange:C=>y(C,_)})})]})]})]},_)}),[r,n])},$i=t=>{var C;const{interceptorManager:e}=t,r=((C=t.rule)==null?void 0:C.type)===u.CFRuleType.iconSet?t.rule:void 0,n=ee.useDependency(x.LocaleService),[o,i]=j.useState({}),[c,y]=j.useState(()=>{const l=Object.keys(u.iconMap)[0];if(r&&r.config.length){const m=r.config[0].iconType;if(!r.config.some(g=>g.iconType!==m))return m}return l}),[p,S]=j.useState(()=>{if(r&&r.config.length)return x.Tools.deepClone(r==null?void 0:r.config);const l=u.iconMap[c]||[];return new Array(l.length).fill("").map((m,d,g)=>d===g.length-1?{operator:u.CFNumberOperator.lessThanOrEqual,value:{type:u.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:c,iconId:String(d)}:Xn(c,d,g))}),[v,T]=j.useState(()=>r?!!r.isShowValue:!0),_=j.useMemo(()=>{const l=p.map(m=>br(m.iconType,m.iconId));return I.jsx("div",{className:H.iconWrap,children:l.map((m,d)=>m?I.jsx("img",{className:H.icon,src:m},d):I.jsx(ft,{className:H.icon},d))})},[p]),w=l=>{if(l.reduce((d,g,F)=>d.preType&&!d.result||l.length-1===F?d:g.value.type===u.CFValueType.formula?{preType:u.CFValueType.formula,result:!1}:d.preType?{result:d.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[u.CFValueType.num,u.CFValueType.percent,u.CFValueType.percentile].includes(l[0].value.type)){const d={};return l.forEach((g,F,D)=>{if(F-1<0||F===D.length-1)return;const L=l[F-1],E=u.getOppositeOperator(L.operator);u.compareWithNumber({operator:E,value:L.value.value},g.value.value)||(d[F]=`${n.t(`sheet.cf.form.${E}`,String(L.value.value))} `)}),d}return{}},b=(l,m)=>{x.get(p,l)!==m&&(x.set(p,l,m),S([...p]),i(w(p)))},R=l=>{y(l);const m=u.iconMap[l]||[],d=new Array(m.length).fill("").map((g,F,D)=>Xn(l,F,D));S(d),i(w(d))};j.useEffect(()=>{const l=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:u.CFRuleType.iconSet,isShowValue:v,config:p}}});return()=>{l()}},[v,p,e]),j.useEffect(()=>{const l=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{l()}},[v,p,e,o]);const h=()=>{const l=p.map(m=>({...m}));p.forEach((m,d)=>{const g=p.length-1-d,F=l[g];m.iconId=F.iconId,m.iconType=F.iconType}),S([...p])},a=ee.useDependency(ee.ILayoutService),[s,f]=j.useState();return ee.useScrollYOverContainer(s,a.rootContainerElement),I.jsxs("div",{className:H.iconSet,children:[I.jsx("div",{className:z.title,children:n.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
122
+ ${W.width45}
123
+ `,children:I.jsx(Ui,{id:_,type:R.value.type,error:T,value:R.value.value||"",onChange:C=>y(C,_)})})]})]})]},_)}),[r,n])},$i=t=>{var C;const{interceptorManager:e}=t,r=((C=t.rule)==null?void 0:C.type)===u.CFRuleType.iconSet?t.rule:void 0,n=ee.useDependency(x.LocaleService),[o,i]=j.useState({}),[c,y]=j.useState(()=>{const l=Object.keys(u.iconMap)[0];if(r&&r.config.length){const m=r.config[0].iconType;if(!r.config.some(g=>g.iconType!==m))return m}return l}),[p,S]=j.useState(()=>{if(r&&r.config.length)return x.Tools.deepClone(r==null?void 0:r.config);const l=u.iconMap[c]||[];return new Array(l.length).fill("").map((m,d,g)=>d===g.length-1?{operator:u.CFNumberOperator.lessThanOrEqual,value:{type:u.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:c,iconId:String(d)}:Xn(c,d,g))}),[v,R]=j.useState(()=>r?!!r.isShowValue:!0),_=j.useMemo(()=>{const l=p.map(m=>br(m.iconType,m.iconId));return I.jsx("div",{className:W.iconWrap,children:l.map((m,d)=>m?I.jsx("img",{className:W.icon,src:m},d):I.jsx(ft,{className:W.icon},d))})},[p]),T=l=>{if(l.reduce((d,g,D)=>d.preType&&!d.result||l.length-1===D?d:g.value.type===u.CFValueType.formula?{preType:u.CFValueType.formula,result:!1}:d.preType?{result:d.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[u.CFValueType.num,u.CFValueType.percent,u.CFValueType.percentile].includes(l[0].value.type)){const d={};return l.forEach((g,D,M)=>{if(D-1<0||D===M.length-1)return;const U=l[D-1],E=u.getOppositeOperator(U.operator);u.compareWithNumber({operator:E,value:U.value.value},g.value.value)||(d[D]=`${n.t(`sheet.cf.form.${E}`,String(U.value.value))} `)}),d}return{}},b=(l,m)=>{x.get(p,l)!==m&&(x.set(p,l,m),S([...p]),i(T(p)))},w=l=>{y(l);const m=u.iconMap[l]||[],d=new Array(m.length).fill("").map((g,D,M)=>Xn(l,D,M));S(d),i(T(d))};j.useEffect(()=>{const l=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:u.CFRuleType.iconSet,isShowValue:v,config:p}}});return()=>{l()}},[v,p,e]),j.useEffect(()=>{const l=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{l()}},[v,p,e,o]);const h=()=>{const l=p.map(m=>({...m}));p.forEach((m,d)=>{const g=p.length-1-d,D=l[g];m.iconId=D.iconId,m.iconType=D.iconType}),S([...p])},a=ee.useDependency(ee.ILayoutService),[s,f]=j.useState();return ee.useScrollYOverContainer(s,a.rootContainerElement),I.jsxs("div",{className:W.iconSet,children:[I.jsx("div",{className:z.title,children:n.t("sheet.cf.panel.styleRule")}),I.jsx("div",{className:`
141
124
  ${z.mTSm}
142
- `,children:I.jsx(Q.Dropdown,{overlay:I.jsx("div",{className:"univer-rounded-lg univer-p-4",children:I.jsx(Vi,{ref:l=>{!s&&l&&f(l)},iconType:c,onClick:R})}),children:I.jsxs("div",{className:Q.clsx(H.dropdownIcon,"univer-box-border univer-h-7 univer-w-auto"),children:[_,I.jsx(Nt,{})]})})}),I.jsxs("div",{className:`
125
+ `,children:I.jsx(Z.Dropdown,{overlay:I.jsx("div",{className:"univer-rounded-lg univer-p-4",children:I.jsx(Vi,{ref:l=>{!s&&l&&f(l)},iconType:c,onClick:w})}),children:I.jsxs("div",{className:Z.clsx(W.dropdownIcon,"univer-box-border univer-h-7 univer-w-auto"),children:[_,I.jsx(Nt,{})]})})}),I.jsxs("div",{className:`
143
126
  ${z.mTSm}
144
- ${H.renderConfig}
145
- `,children:[I.jsxs("div",{className:H.utilItem,children:[I.jsx(Q.Checkbox,{onChange:h}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),I.jsxs("div",{className:`
146
- ${H.utilItem}
127
+ ${W.renderConfig}
128
+ `,children:[I.jsxs("div",{className:W.utilItem,children:[I.jsx(Z.Checkbox,{onChange:h}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),I.jsxs("div",{className:`
129
+ ${W.utilItem}
147
130
  ${z.mLXl}
148
- `,children:[I.jsx(Q.Checkbox,{checked:!v,onChange:l=>{T(!l)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),I.jsx(ki,{errorMap:o,onChange:b,configList:p})]})},Ai=t=>{var h;const{onChange:e,interceptorManager:r}=t,n=ee.useDependency(x.LocaleService),o=((h=t.rule)==null?void 0:h.type)===u.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"}],[c,y]=j.useState(()=>{const a=i[0].value,s=o==null?void 0:o.type;if(!o)return a;switch(s){case u.CFRuleType.highlightCell:switch(o.subType){case u.CFSubRuleType.average:return[u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":a;case u.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return a}),[p,S]=j.useState(()=>{const s=o==null?void 0:o.type;if(!o)return 10;switch(s){case u.CFRuleType.highlightCell:switch(o.subType){case u.CFSubRuleType.rank:return o.value||10}}return 10}),[v,T]=j.useState(()=>{const s=o==null?void 0:o.type;if(!o)return!1;switch(s){case u.CFRuleType.highlightCell:switch(o.subType){case u.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[_,w]=j.useState({}),b=a=>{const{type:s,isPercent:f,value:C,style:l}=a;if(s==="isNotBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!1,value:C,style:l};if(s==="isBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!0,value:C,style:l};if(s==="greaterThanAverage")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:u.CFNumberOperator.greaterThan,style:l};if(s==="lessThanAverage")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:u.CFNumberOperator.lessThan,style:l}};j.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return b({type:c,isPercent:v,value:p,style:_})}}),[c,v,p,_,r]);const R=a=>{e(b(a))};return I.jsxs("div",{children:[I.jsx("div",{className:`
131
+ `,children:[I.jsx(Z.Checkbox,{checked:!v,onChange:l=>{R(!l)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),I.jsx(ki,{errorMap:o,onChange:b,configList:p})]})},Ai=t=>{var h;const{onChange:e,interceptorManager:r}=t,n=ee.useDependency(x.LocaleService),o=((h=t.rule)==null?void 0:h.type)===u.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"}],[c,y]=j.useState(()=>{const a=i[0].value,s=o==null?void 0:o.type;if(!o)return a;switch(s){case u.CFRuleType.highlightCell:switch(o.subType){case u.CFSubRuleType.average:return[u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":a;case u.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return a}),[p,S]=j.useState(()=>{const s=o==null?void 0:o.type;if(!o)return 10;switch(s){case u.CFRuleType.highlightCell:switch(o.subType){case u.CFSubRuleType.rank:return o.value||10}}return 10}),[v,R]=j.useState(()=>{const s=o==null?void 0:o.type;if(!o)return!1;switch(s){case u.CFRuleType.highlightCell:switch(o.subType){case u.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[_,T]=j.useState({}),b=a=>{const{type:s,isPercent:f,value:C,style:l}=a;if(s==="isNotBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!1,value:C,style:l};if(s==="isBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!0,value:C,style:l};if(s==="greaterThanAverage")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:u.CFNumberOperator.greaterThan,style:l};if(s==="lessThanAverage")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:u.CFNumberOperator.lessThan,style:l}};j.useEffect(()=>r.intercept(r.getInterceptPoints().submit,{handler(){return b({type:c,isPercent:v,value:p,style:_})}}),[c,v,p,_,r]);const w=a=>{e(b(a))};return I.jsxs("div",{children:[I.jsx("div",{className:`
149
132
  ${z.title}
150
133
  ${z.mTBase}
151
- `,children:n.t("sheet.cf.panel.styleRule")}),I.jsx(Q.Select,{className:`
152
- ${H.width100}
134
+ `,children:n.t("sheet.cf.panel.styleRule")}),I.jsx(Z.Select,{className:`
135
+ ${W.width100}
153
136
  ${z.mTSm}
154
- `,value:c,options:i,onChange:a=>{y(a),R({type:a,isPercent:v,value:p,style:_})}}),["isNotBottom","isBottom"].includes(c)&&I.jsxs("div",{className:`
137
+ `,value:c,options:i,onChange:a=>{y(a),w({type:a,isPercent:v,value:p,style:_})}}),["isNotBottom","isBottom"].includes(c)&&I.jsxs("div",{className:`
155
138
  ${z.labelContainer}
156
139
  ${z.mTSm}
157
- `,children:[I.jsx(Q.InputNumber,{min:1,max:1e3,value:p,onChange:a=>{const s=a||0;S(s),R({type:c,isPercent:v,value:s,style:_})}}),I.jsxs("div",{className:`
140
+ `,children:[I.jsx(Z.InputNumber,{min:1,max:1e3,value:p,onChange:a=>{const s=a||0;S(s),w({type:c,isPercent:v,value:s,style:_})}}),I.jsxs("div",{className:`
158
141
  ${z.mLSm}
159
142
  ${z.labelContainer}
160
- ${H.text}
161
- `,children:[I.jsx(Q.Checkbox,{checked:v,onChange:a=>{T(!!a),R({type:c,isPercent:!!a,value:p,style:_})}}),n.t("sheet.cf.valueType.percent")]})]}),I.jsx("div",{className:`
162
- ${H.cfPreviewWrap}
143
+ ${W.text}
144
+ `,children:[I.jsx(Z.Checkbox,{checked:v,onChange:a=>{R(!!a),w({type:c,isPercent:!!a,value:p,style:_})}}),n.t("sheet.cf.valueType.percent")]})]}),I.jsx("div",{className:`
145
+ ${W.cfPreviewWrap}
163
146
  `,children:I.jsx(qe,{rule:b({type:c,isPercent:v,value:p,style:_})})}),I.jsx(fn,{style:o==null?void 0:o.style,className:`
164
147
  ${z.mTSm}
165
- `,onChange:a=>{w(a),R({type:c,isPercent:v,value:p,style:a})}})]})},qi=x.createInterceptorKey("beforeSubmit"),Wi=x.createInterceptorKey("submit"),Yn=t=>t.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),Kn=t=>{var e;return(e=t.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},Hi=t=>{var d,g,F;const e=ee.useDependency(x.LocaleService),r=ee.useDependency(x.ICommandService),n=ee.useDependency(x.IUniverInstanceService),o=ee.useDependency(u.ConditionalFormattingRuleModel),i=ee.useDependency(Y.SheetsSelectionsService),c=Yn(n),y=Kn(n),[p,S]=j.useState(void 0),v=j.useRef((g=(d=t.rule)==null?void 0:d.ranges)!=null?g:[]),T=j.useMemo(()=>{var U,L,E;let D=(U=t.rule)==null?void 0:U.ranges;return D!=null&&D.length||(D=(E=(L=i.getCurrentSelections())==null?void 0:L.map(N=>N.range))!=null?E:[]),v.current=D,D!=null&&D.length?D.map(N=>{const W=Yt.serializeRange(N);return W==="NaN"?"":W}).filter(N=>!!N).join(","):""},[t.rule]),_=[{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"}],[w,b]=j.useState(()=>{var L,E;const D=(L=t.rule)==null?void 0:L.rule.type,U=_[0].value;if(!D)return U;switch(D){case u.CFRuleType.highlightCell:{switch((E=t.rule)==null?void 0:E.rule.subType){case u.CFSubRuleType.number:case u.CFSubRuleType.text:case u.CFSubRuleType.duplicateValues:case u.CFSubRuleType.uniqueValues:case u.CFSubRuleType.timePeriod:return"1";case u.CFSubRuleType.average:case u.CFSubRuleType.rank:return"2";case u.CFSubRuleType.formula:return"5"}break}case u.CFRuleType.dataBar:return"3";case u.CFRuleType.colorScale:return"4";case u.CFRuleType.iconSet:return"6"}return U}),R=j.useRef(void 0),h=j.useMemo(()=>new x.InterceptorManager({beforeSubmit:qi,submit:Wi}),[]),a=j.useMemo(()=>{switch(w){case"1":return Gn;case"2":return Ai;case"3":return Fi;case"4":return Pi;case"5":return ji;case"6":return $i;default:return Gn}},[w]);j.useEffect(()=>{const D=r.onCommandExecuted(U=>{if(U.id===Y.RemoveSheetMutation.id){const L=U.params;L.subUnitId===y&&L.unitId===c&&t.onCancel()}U.id===Y.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>D.dispose()},[]);const s=D=>{R.current=D},f=D=>{const U=D.split(",").filter(L=>!!L).map(Yt.deserializeRangeWithSheet).map(L=>L.range);v.current=U},C=()=>{if(p)return;const U=(()=>{const E=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!E)throw new Error("No active sheet found");return v.current.map(B=>Y.setEndForRange(B,E.getRowCount(),E.getColumnCount())).filter(B=>!(Number.isNaN(B.startRow)||Number.isNaN(B.startColumn)))})();if(h.fetchThroughInterceptors(h.getInterceptPoints().beforeSubmit)(!0,null)){const E=h.fetchThroughInterceptors(h.getInterceptPoints().submit)(null,null);if(E){const N=Yn(n),W=Kn(n);if(!N||!W)throw new Error("No active sheet found");let B={};t.rule&&t.rule.cfId?(B={...t.rule,ranges:U,rule:E},r.executeCommand(u.SetCfCommand.id,{unitId:N,subUnitId:W,rule:B}),t.onCancel()):(B={cfId:o.createCfId(N,W),ranges:U,rule:E,stopIfTrue:!1},r.executeCommand(u.AddCfCommand.id,{unitId:N,subUnitId:W,rule:B}),t.onCancel())}}},l=()=>{t.onCancel()},m=(D,U)=>{D?U.length<1?S(e.t("sheet.cf.errorMessage.rangeError")):S(void 0):S(e.t("sheet.cf.errorMessage.rangeError"))};return I.jsxs("div",{className:H.cfRuleStyleEditor,children:[I.jsx("div",{className:z.title,children:e.t("sheet.cf.panel.range")}),I.jsxs("div",{className:`
148
+ `,onChange:a=>{T(a),w({type:c,isPercent:v,value:p,style:a})}})]})},qi=x.createInterceptorKey("beforeSubmit"),Wi=x.createInterceptorKey("submit"),Yn=t=>t.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),Kn=t=>{var e;return(e=t.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},Hi=t=>{var d,g,D;const e=ee.useDependency(x.LocaleService),r=ee.useDependency(x.ICommandService),n=ee.useDependency(x.IUniverInstanceService),o=ee.useDependency(u.ConditionalFormattingRuleModel),i=ee.useDependency(X.SheetsSelectionsService),c=Yn(n),y=Kn(n),[p,S]=j.useState(void 0),v=j.useRef((g=(d=t.rule)==null?void 0:d.ranges)!=null?g:[]),R=j.useMemo(()=>{var L,U,E;let M=(L=t.rule)==null?void 0:L.ranges;return M!=null&&M.length||(M=(E=(U=i.getCurrentSelections())==null?void 0:U.map(N=>N.range))!=null?E:[]),v.current=M,M!=null&&M.length?M.map(N=>{const q=Yt.serializeRange(N);return q==="NaN"?"":q}).filter(N=>!!N).join(","):""},[t.rule]),_=[{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"}],[T,b]=j.useState(()=>{var U,E;const M=(U=t.rule)==null?void 0:U.rule.type,L=_[0].value;if(!M)return L;switch(M){case u.CFRuleType.highlightCell:{switch((E=t.rule)==null?void 0:E.rule.subType){case u.CFSubRuleType.number:case u.CFSubRuleType.text:case u.CFSubRuleType.duplicateValues:case u.CFSubRuleType.uniqueValues:case u.CFSubRuleType.timePeriod:return"1";case u.CFSubRuleType.average:case u.CFSubRuleType.rank:return"2";case u.CFSubRuleType.formula:return"5"}break}case u.CFRuleType.dataBar:return"3";case u.CFRuleType.colorScale:return"4";case u.CFRuleType.iconSet:return"6"}return L}),w=j.useRef(void 0),h=j.useMemo(()=>new x.InterceptorManager({beforeSubmit:qi,submit:Wi}),[]),a=j.useMemo(()=>{switch(T){case"1":return Gn;case"2":return Ai;case"3":return Di;case"4":return Pi;case"5":return ji;case"6":return $i;default:return Gn}},[T]);j.useEffect(()=>{const M=r.onCommandExecuted(L=>{if(L.id===X.RemoveSheetMutation.id){const U=L.params;U.subUnitId===y&&U.unitId===c&&t.onCancel()}L.id===X.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>M.dispose()},[]);const s=M=>{w.current=M},f=M=>{const L=M.split(",").filter(U=>!!U).map(Yt.deserializeRangeWithSheet).map(U=>U.range);v.current=L},C=()=>{if(p)return;const L=(()=>{const E=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!E)throw new Error("No active sheet found");return v.current.map(H=>X.setEndForRange(H,E.getRowCount(),E.getColumnCount())).filter(H=>!(Number.isNaN(H.startRow)||Number.isNaN(H.startColumn)))})();if(h.fetchThroughInterceptors(h.getInterceptPoints().beforeSubmit)(!0,null)){const E=h.fetchThroughInterceptors(h.getInterceptPoints().submit)(null,null);if(E){const N=Yn(n),q=Kn(n);if(!N||!q)throw new Error("No active sheet found");let H={};t.rule&&t.rule.cfId?(H={...t.rule,ranges:L,rule:E},r.executeCommand(u.SetCfCommand.id,{unitId:N,subUnitId:q,rule:H}),t.onCancel()):(H={cfId:o.createCfId(N,q),ranges:L,rule:E,stopIfTrue:!1},r.executeCommand(u.AddCfCommand.id,{unitId:N,subUnitId:q,rule:H}),t.onCancel())}}},l=()=>{t.onCancel()},m=(M,L)=>{M?L.length<1?S(e.t("sheet.cf.errorMessage.rangeError")):S(void 0):S(e.t("sheet.cf.errorMessage.rangeError"))};return I.jsxs("div",{className:W.cfRuleStyleEditor,children:[I.jsx("div",{className:z.title,children:e.t("sheet.cf.panel.range")}),I.jsxs("div",{className:`
166
149
  ${z.mTBase}
167
- `,children:[I.jsx(dt.RangeSelector,{unitId:c,subUnitId:y,initialValue:T,onChange:(D,U)=>f(U),onVerify:m}),p&&I.jsx("div",{className:H.cfErrorText,children:p})]}),I.jsx("div",{className:z.title,children:e.t("sheet.cf.panel.styleType")}),I.jsx("div",{className:z.mTBase,children:I.jsx(Q.Select,{className:H.width100,value:w,options:_,onChange:D=>b(D)})}),I.jsx(a,{interceptorManager:h,rule:(F=t.rule)==null?void 0:F.rule,onChange:s}),I.jsxs("div",{className:`
150
+ `,children:[I.jsx(dt.RangeSelector,{unitId:c,subUnitId:y,initialValue:R,onChange:(M,L)=>f(L),onVerify:m}),p&&I.jsx("div",{className:W.cfErrorText,children:p})]}),I.jsx("div",{className:z.title,children:e.t("sheet.cf.panel.styleType")}),I.jsx("div",{className:z.mTBase,children:I.jsx(Z.Select,{className:W.width100,value:T,options:_,onChange:M=>b(M)})}),I.jsx(a,{interceptorManager:h,rule:(D=t.rule)==null?void 0:D.rule,onChange:s}),I.jsxs("div",{className:`
168
151
  ${z.mTBase}
169
- ${H.btnList}
170
- `,children:[I.jsx(Q.Button,{size:"small",onClick:l,children:e.t("sheet.cf.panel.cancel")}),I.jsx(Q.Button,{className:z.mLSm,size:"small",type:"primary",onClick:C,children:e.t("sheet.cf.panel.submit")})]})]})},Bi=t=>{const[e,r]=j.useState(t.rule),[n,o]=j.useState(!!t.rule),i=()=>{o(!0)},c=()=>{o(!1),r(void 0)},y=p=>{r(p),o(!0)};return I.jsx("div",{className:z.conditionalFormattingWrap,children:n?I.jsx(Hi,{onCancel:c,rule:e}):I.jsx(ei,{onClick:y,onCreate:i})})};var Gi=Object.getOwnPropertyDescriptor,Xi=(t,e,r,n)=>{for(var o=n>1?void 0:n?Gi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Qe=(t,e)=>(r,n)=>e(r,n,t);const Tt="sheet.conditional.formatting.panel";let at=class extends x.Disposable{constructor(e,r,n,o,i){super();Ie(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$(x.UniverInstanceType.UNIVER_SHEET).subscribe(c=>{var y;c||(y=this._sidebarDisposable)==null||y.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(c=>{c.id===Tt&&(c.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const r={id:Tt,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Tt,rule:e,key:x.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(r)}_initPanel(){this._componentManager.register(Tt,Bi)}};at=Xi([Qe(0,x.IUniverInstanceService),Qe(1,x.Inject(x.Injector)),Qe(2,x.Inject(ee.ComponentManager)),Qe(3,x.Inject(ee.ISidebarService)),Qe(4,x.Inject(x.LocaleService))],at);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 pt={id:"sheet.operation.open.conditional.formatting.panel",type:x.CommandType.OPERATION,handler:(t,e)=>{var y;const r=t.get(at),n=t.get(Y.SheetsSelectionsService),o=t.get(x.ICommandService),i=((y=n.getCurrentSelections())==null?void 0:y.map(p=>p.range))||[];switch(e.value){case 3:{r.openPanel({...u.createDefaultRule(),ranges:i});break}case 4:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank}};r.openPanel(p);break}case 5:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula,value:"="}};r.openPanel(p);break}case 6:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.colorScale,config:[]}};r.openPanel(p);break}case 7:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.dataBar,isShowValue:!0}};r.openPanel(p);break}case 8:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.iconSet,config:[],isShowValue:!0}};r.openPanel(p);break}case 2:{r.openPanel();break}case 1:{r.openPanel({...u.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(u.ClearRangeCfCommand.id,{ranges:i});break}case 10:{o.executeCommand(u.ClearWorksheetCfCommand.id);break}}return!0}};var Yi=Object.getOwnPropertyDescriptor,Ki=(t,e,r,n)=>{for(var o=n>1?void 0:n?Yi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},et=(t,e)=>(r,n)=>e(r,n,t);let st=class extends x.Disposable{constructor(e,r,n,o,i){super();Ie(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:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,r,n)=>this._collectConditionalRule(e,r,n),onPasteCells:(e,r,n,o)=>{const{copyType:i=de.COPY_TYPE.COPY,pasteType:c}=o,{range:y}=e||{},{range:p}=r;return this._generateConditionalFormattingMutations(p,{copyType:i,pasteType:c,copyRange:y})}}))}_collectConditionalRule(e,r,n){const o=new x.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:e,subUnitId:r,cfMap:i}};const c=this._injector.invoke(v=>Y.rangeToDiscreteRange(n,v,e,r));if(!c)return;const{rows:y,cols:p}=c,S=new Set;y.forEach((v,T)=>{p.forEach((_,w)=>{const b=this._conditionalFormattingViewModel.getCellCfs(e,r,v,_);b&&(b.forEach(R=>S.add(R.cfId)),o.setValue(T,w,b.map(R=>R.cfId)))})}),S.forEach(v=>{const T=this._conditionalFormattingRuleModel.getRule(e,r,v);T&&(i[v]=T.rule)})}_generateConditionalFormattingMutations(e,r){const n=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),o=n.getActiveSheet(),i=n.getUnitId();if(!o)return{redos:[],undos:[]};const c=o.getSheetId();if(r.copyType===de.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!r.copyRange)return{redos:[],undos:[]};if(![de.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,de.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,de.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(r.pasteType))return{redos:[],undos:[]};const{ranges:[p,S],mapFunc:v}=de.virtualizeDiscreteRanges([r.copyRange,e]),T=de.getRepeatRange(p,S,!0),_={};x.Range.foreach(S,(l,m)=>{const{row:d,col:g}=v(l,m),F=this._conditionalFormattingViewModel.getCellCfs(i,c,d,g);F&&F.forEach(D=>{if(!_[D.cfId]){const U=new x.ObjectMatrix;_[D.cfId]=U;const L=this._conditionalFormattingRuleModel.getRule(i,c,D.cfId);L==null||L.ranges.forEach(E=>{x.Range.foreach(E,(N,W)=>{U.setValue(N,W,1)})})}_[D.cfId].realDeleteValue(d,g)})});const{matrix:w,info:b}=this._copyInfo,R=[];let h=this._conditionalFormattingRuleModel.createCfId(i,c);const a={},s=l=>{if(a[l])return a[l];const m=b==null?void 0:b.cfMap[l],d=[...this._conditionalFormattingRuleModel.getSubunitRules(i,c)||[],...R].find(g=>x.Tools.diffValue(g.rule,m));if(d)return a[l]=d,d;{const g={rule:m,cfId:h,ranges:[],stopIfTrue:!1};return a[l]=g,R.push(g),h=`${Number(h)+1}`,g}};T.forEach(l=>{w&&w.forValue((m,d,g)=>{const F=x.Rectangle.getPositionRange({startRow:m,endRow:m,startColumn:d,endColumn:d},l.startRange),{row:D,col:U}=v(F.startRow,F.startColumn);g.forEach(L=>{if(!_[L]){const E=s(L),N=new x.ObjectMatrix;_[L]=N,E.ranges.forEach(W=>{x.Range.foreach(W,(B,Z)=>{N.setValue(B,Z,1)})})}_[L].setValue(D,U,1)})})});const f=[],C=[];for(const l in _){const m=_[l],d=Y.findAllRectangle(Y.createTopMatrixFromMatrix(m));if(!d.length){const g={unitId:i,subUnitId:c,cfId:l};f.push({id:u.DeleteConditionalRuleMutation.id,params:g}),C.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(R.some(g=>g.cfId===l)){const g=s(l),F={unitId:i,subUnitId:c,rule:{...g,ranges:d}};f.push({id:u.AddConditionalRuleMutation.id,params:F}),C.push(u.AddConditionalRuleMutationUndoFactory(this._injector,F))}else{const g=this._conditionalFormattingRuleModel.getRule(i,c,l);if(!g)continue;const F={unitId:i,subUnitId:c,rule:{...g,ranges:d}};f.push({id:u.SetConditionalRuleMutation.id,params:F}),C.push(...u.setConditionalRuleMutationUndoFactory(this._injector,F))}}return{redos:f,undos:C}}};st=Ki([et(0,x.Inject(de.ISheetClipboardService)),et(1,x.Inject(u.ConditionalFormattingRuleModel)),et(2,x.Inject(x.Injector)),et(3,x.Inject(u.ConditionalFormattingViewModel)),et(4,x.Inject(x.IUniverInstanceService))],st);var Zi=Object.getOwnPropertyDescriptor,Ji=(t,e,r,n)=>{for(var o=n>1?void 0:n?Zi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Ht=(t,e)=>(r,n)=>e(r,n,t);let lt=class extends x.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===u.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[Y.WorkbookEditablePermission],rangeTypes:[Y.RangeProtectionPermissionEditPoint],worksheetTypes:[Y.WorksheetEditPermission,Y.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};lt=Ji([Ht(0,x.Inject(x.LocaleService)),Ht(1,x.ICommandService),Ht(2,x.Inject(Y.SheetPermissionCheckController))],lt);var Qi=Object.getOwnPropertyDescriptor,ea=(t,e,r,n)=>{for(var o=n>1?void 0:n?Qi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},wt=(t,e)=>(r,n)=>e(r,n,t);let ut=class extends x.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 c=p=>{const S=[...i.ranges],v=S.map(_=>Y.handleDefaultRangeChangeWithEffectRefCommands(_,p)).filter(_=>!!_);if(u.isRangesEqual(v,S))return{redos:[],undos:[]};if(v.length){const _={unitId:n,subUnitId:o,rule:{...i,ranges:v}},w=[{id:u.SetConditionalRuleMutation.id,params:_}],b=u.setConditionalRuleMutationUndoFactory(this._injector,_);return{redos:w,undos:b}}else{const _={unitId:n,subUnitId:o,cfId:i.cfId},w=[{id:u.DeleteConditionalRuleMutation.id,params:_}],b=u.DeleteConditionalRuleMutationUndoFactory(this._injector,_);return{redos:w,undos:b}}},y=[];i.ranges.forEach(p=>{const S=this._refRangeService.registerRefRange(p,c);y.push(()=>S.dispose())}),t.set(e(n,o,i.cfId),()=>y.forEach(p=>p()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:o,subUnitId:i,rule:c}=n,y=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),p=y.getActiveSheet();if(!(n.unitId!==y.getUnitId()||n.subUnitId!==(p==null?void 0:p.getSheetId())))switch(n.type){case"add":{r(n.unitId,n.subUnitId,n.rule);break}case"delete":{const S=t.get(e(o,i,c.cfId));S&&S();break}case"set":{const S=t.get(e(o,i,c.cfId));S&&S(),r(n.unitId,n.subUnitId,n.rule)}}})),this.disposeWithMe(x.toDisposable(()=>{t.forEach(n=>{n()}),t.clear()}))}};ut=ea([wt(0,x.Inject(u.ConditionalFormattingRuleModel)),wt(1,x.Inject(x.IUniverInstanceService)),wt(2,x.Inject(x.Injector)),wt(3,x.Inject(Y.RefRangeService))],ut);var ta=Object.getOwnPropertyDescriptor,na=(t,e,r,n)=>{for(var o=n>1?void 0:n?ta(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Ue=(t,e)=>(r,n)=>e(r,n,t);let ct=class extends x.Disposable{constructor(e,r,n,o,i,c){super();Ie(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=r,this._univerInstanceService=n,this._renderManagerService=o,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=c,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var r,n,o;const e=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId();(r=this._renderManagerService.getRenderById(e))==null||r.with(de.SheetSkeletonManagerService).reCalculate(),(o=(n=this._renderManagerService.getRenderById(e))==null?void 0:n.mainComponent)==null||o.makeDirty()}_initSkeleton(){this.disposeWithMe(Se.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(it.bufferTime(16),it.filter(e=>!!e.length),it.filter(e=>{const r=this._univerInstanceService.getCurrentUnitForType(x.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(Y.INTERCEPTOR_POINT.CELL_CONTENT,{effect:x.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)||{}},p={...e,s:y};return o.style&&Object.assign(y,o.style),p.fontRenderExtension||(p.fontRenderExtension={},o.isShowValue!==void 0&&(p.fontRenderExtension.isSkip=!o.isShowValue)),o.dataBar&&(p.dataBar=o.dataBar),o.iconSet&&(p.iconSet=o.iconSet,p.fontRenderExtension.leftOffset=u.DEFAULT_PADDING+u.DEFAULT_WIDTH),n(p)},priority:10}))}};ct=na([Ue(0,x.Inject(Y.SheetInterceptorService)),Ue(1,x.Inject(u.ConditionalFormattingService)),Ue(2,x.Inject(x.IUniverInstanceService)),Ue(3,x.Inject(nr.IRenderManagerService)),Ue(4,x.Inject(u.ConditionalFormattingViewModel)),Ue(5,x.Inject(u.ConditionalFormattingRuleModel))],ct);const Sr="sheets-conditional-formatting-ui.config",Et={};var ra=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,ia=(t,e,r)=>e in t?ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aa=(t,e,r,n)=>{for(var o=n>1?void 0:n?oa(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Bt=(t,e)=>(r,n)=>e(r,n,t),Rr=(t,e,r)=>ia(t,typeof e!="symbol"?e+"":e,r);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends x.Plugin{constructor(e=Et,r,n,o){super(),this._config=e,this._injector=r,this._commandService=n,this._configService=o;const{menu:i,...c}=x.merge({},Et,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Sr,c),this._initCommand(),this._injector.add([ct]),this._injector.add([ut]),this._injector.add([st]),this._injector.add([lt]),this._injector.add([ke])}_initCommand(){[Zt,Jt,Qt,en,tn,nn,rn,on,an,pt].forEach(e=>{this._commandService.registerCommand(e)})}};Rr(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Rr(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",x.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=aa([x.DependentOn(u.UniverSheetsConditionalFormattingPlugin),Bt(1,x.Inject(x.Injector)),Bt(2,x.Inject(x.ICommandService)),Bt(3,x.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var sa=Object.getOwnPropertyDescriptor,la=(t,e,r,n)=>{for(var o=n>1?void 0:n?sa(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},tt=(t,e)=>(r,n)=>e(r,n,t);let Ot=class extends x.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,c,y,p)=>{var w;const S=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),v=(w=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:w.getSheetId();if(!S||!v)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};x.Range.foreach(c,(b,R)=>{const h=x.Rectangle.getPositionRange({startRow:b,startColumn:R,endColumn:R,endRow:b},T),a=x.Rectangle.getPositionRange({startRow:b,startColumn:R,endColumn:R,endRow:b},_),{row:s,col:f}=p(h.startRow,h.startColumn),C=this._conditionalFormattingViewModel.getCellCfs(S,v,s,f),{row:l,col:m}=p(a.startRow,a.startColumn),d=this._conditionalFormattingViewModel.getCellCfs(S,v,l,m);d&&d.forEach(g=>{let F=y.get(g.cfId);if(!y.get(g.cfId)){const D=this._conditionalFormattingRuleModel.getRule(S,v,g.cfId);if(!D)return;F=new x.ObjectMatrix,D.ranges.forEach(U=>{x.Range.foreach(U,(L,E)=>{F.setValue(L,E,1)})}),y.set(g.cfId,F)}F.realDeleteValue(l,m)}),C&&C.forEach(g=>{let F=y.get(g.cfId);if(!y.get(g.cfId)){const D=this._conditionalFormattingRuleModel.getRule(S,v,g.cfId);if(!D)return;F=new x.ObjectMatrix,D.ranges.forEach(U=>{x.Range.foreach(U,(L,E)=>{F.setValue(L,E,1)})}),y.set(g.cfId,F)}F.setValue(l,m,1)})})},r=(o,i)=>{var a,s,f;const c=(a=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getUnitId(),y=(f=(s=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getActiveSheet())==null?void 0:f.getSheetId(),p=new Map,S=[],v=[];if(!c||!y)return t();const T=de.virtualizeDiscreteRanges([o,i]),[_,w]=T.ranges,{mapFunc:b}=T,R={row:_.startRow,col:_.startColumn};return de.getAutoFillRepeatRange(_,w).forEach(C=>{e(R,C.repeatStartCell,C.relativeRange,p,b)}),p.forEach((C,l)=>{const m=this._conditionalFormattingRuleModel.getRule(c,y,l);if(!m)return;const d=Y.findAllRectangle(Y.createTopMatrixFromMatrix(C));if(d.length){const g={unitId:c,subUnitId:y,rule:{...m,ranges:d}};S.push({id:u.SetConditionalRuleMutation.id,params:g}),v.push(...u.setConditionalRuleMutationUndoFactory(this._injector,g))}else{const g={unitId:c,subUnitId:y,cfId:m.cfId};S.push({id:u.DeleteConditionalRuleMutation.id,params:g}),v.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}}),{undos:v,redos:S}},n={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,c)=>{if(c===de.APPLY_TYPE.COPY||c===de.APPLY_TYPE.ONLY_FORMAT||c===de.APPLY_TYPE.SERIES){const{source:y,target:p}=o;return r(y,p)}return t()}};this.disposeWithMe(this._autoFillService.addHook(n))}};Ot=la([tt(0,x.Inject(x.Injector)),tt(1,x.Inject(x.IUniverInstanceService)),tt(2,x.Inject(de.IAutoFillService)),tt(3,x.Inject(u.ConditionalFormattingRuleModel)),tt(4,x.Inject(u.ConditionalFormattingViewModel))],Ot);var ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var o=n>1?void 0:n?ua(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},nt=(t,e)=>(r,n)=>e(r,n,t);exports.ConditionalFormattingClearController=class extends x.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([Y.ClearSelectionFormatCommand.id,Y.ClearSelectionAllCommand.id].includes(e.id)){const c=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(b=>b.range);if(!c)return o;const y=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),p=y.getActiveSheet();if(!p)return o;const S=y.getUnitId(),v=p.getSheetId(),T=this._conditionalFormattingRuleModel.getSubunitRules(S,v);if(!T||!T.length)return o;const{redos:_,undos:w}=Zn(this._injector,T,c,S,v);r.push(..._),n.push(...w)}return o}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:r,ranges:n})=>{const o=[],i=[],c={redos:o,undos:i};if(!n||!n.length)return c;const y=this._conditionalFormattingRuleModel.getSubunitRules(e,r);if(!y||!y.length)return c;const{redos:p,undos:S}=Zn(this._injector,y,n,e,r);return o.push(...p),i.push(...S),c}}))}};exports.ConditionalFormattingClearController=ca([nt(0,x.Inject(x.Injector)),nt(1,x.Inject(x.IUniverInstanceService)),nt(2,x.Inject(Y.SheetInterceptorService)),nt(3,x.Inject(Y.SheetsSelectionsService)),nt(4,x.Inject(u.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function Zn(t,e,r,n,o){const i=[],c=[];return e.filter(y=>r.some(p=>y.ranges.some(S=>x.Rectangle.getIntersects(S,p)))).forEach(y=>{const S=new Y.RangeMergeUtil().add(...y.ranges).subtract(...r).merge();if(S.length){const v={id:u.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:o,rule:{...y,ranges:S}}},T=u.setConditionalRuleMutationUndoFactory(t,v.params);i.push(v),c.push(...T)}else{const v={id:u.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:o,cfId:y.cfId}},T=u.DeleteConditionalRuleMutationUndoFactory(t,v.params);i.push(v),c.push(...T)}}),{redos:i,undos:c}}var da=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var o=n>1?void 0:n?da(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Jn=(t,e)=>(r,n)=>e(r,n,t);let Pt=class extends x.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(x.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(Y.AFTER_CELL_EDIT,{handler:(t,e,r)=>{var c,y,p;t||r(t);const n=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),o=(c=n==null?void 0:n.style)!=null?c:{},i=Object.keys(o);if(t!=null&&t.p)return(p=(y=t.p.body)==null?void 0:y.textRuns)==null||p.forEach(S=>{S.ts&&i.forEach(v=>{var T;(T=S.ts)==null||delete T[v]})}),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 v={...t,s:{...S}};return r(v)}}})))}};Pt=fa([Jn(0,x.Inject(Y.SheetInterceptorService)),Jn(1,x.Inject(u.ConditionalFormattingService))],Pt);const Qn=[Y.SetWorksheetActiveOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],rt=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:ve.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:ve.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:ve.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:ve.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:ve.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:ve.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:ve.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:ve.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:ve.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:ve.clearWorkSheetRules}],pa=t=>{const e=t.get(Y.SheetsSelectionsService),r=t.get(x.ICommandService),n=t.get(x.IUniverInstanceService),o=t.get(u.ConditionalFormattingRuleModel),i=new Se.Observable(p=>Se.merge(e.selectionMoveEnd$,e.selectionSet$,new Se.Observable(S=>{const v=r.onCommandExecuted(T=>{var R;const{id:_,params:w}=T,b=(R=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:R.getUnitId();Qn.includes(_)&&w.unitId===b&&S.next(null)});return()=>v.dispose()})).pipe(it.debounceTime(16)).subscribe(()=>{var R;const S=((R=e.getCurrentSelections())==null?void 0:R.map(h=>h.range))||[],v=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET);if(!v)return;const T=v.getActiveSheet();if(!T)return;const b=(o.getSubunitRules(v.getUnitId(),T.getSheetId())||[]).filter(h=>h.ranges.some(a=>S.some(s=>x.Rectangle.intersects(s,a)))).map(h=>h.ranges).every(h=>Y.checkRangesEditablePermission(t,v.getUnitId(),T.getSheetId(),h));p.next(b)})),c=new Se.Observable(p=>new Se.Observable(S=>{const v=r.onCommandExecuted(T=>{var R;const{id:_,params:w}=T,b=(R=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:R.getUnitId();Qn.includes(_)&&w.unitId===b&&S.next(null)});return()=>v.dispose()}).pipe(it.debounceTime(16)).subscribe(()=>{const S=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET);if(!S)return;const v=S.getActiveSheet();if(!v)return;const T=o.getSubunitRules(S.getUnitId(),v.getSheetId())||[];if(!T.length)return p.next(!1),!1;const _=T.map(w=>w.ranges).every(w=>Y.checkRangesEditablePermission(t,S.getUnitId(),v.getSheetId(),w));p.next(_)})),y=new Se.Observable(p=>{i.subscribe(S=>{const v=rt.find(T=>T.value===ve.clearRangeRules);v&&(v.disabled=!S,p.next(rt))}),c.subscribe(S=>{const v=rt.find(T=>T.value===ve.clearWorkSheetRules);v&&(v.disabled=!S,p.next(rt))}),p.next(rt)});return{id:pt.id,type:ee.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:y,hidden$:ee.getMenuHiddenObservable(t,x.UniverInstanceType.UNIVER_SHEET),disabled$:de.getCurrentRangeDisable$(t,{workbookTypes:[Y.WorkbookEditablePermission],worksheetTypes:[Y.WorksheetSetCellStylePermission,Y.WorksheetEditPermission],rangeTypes:[Y.RangeProtectionPermissionEditPoint]})}},ha={[ee.RibbonStartGroup.FORMULAS_INSERT]:{[pt.id]:{order:0,menuItemFactory:pa}}};var ma=Object.getOwnPropertyDescriptor,ga=(t,e,r,n)=>{for(var o=n>1?void 0:n?ma(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},er=(t,e)=>(r,n)=>e(r,n,t);let Ft=class extends x.Disposable{constructor(e,r){super();Ie(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=r,this._menuManagerService.mergeMenu(ha)}};Ft=ga([er(0,x.Inject(x.Injector)),er(1,ee.IMenuManagerService)],Ft);var va=Object.getOwnPropertyDescriptor,ya=(t,e,r,n)=>{for(var o=n>1?void 0:n?va(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Ve=(t,e)=>(r,n)=>e(r,n,t);const Ca=(t,e)=>{const r=v=>v.endRow-v.startRow+1,n=v=>v.endColumn-v.startColumn+1,o=r(e)%r(t),i=n(e)%n(t),c=Math.floor(r(e)/r(t)),y=Math.floor(n(e)/n(t)),p=[],S={startRow:0,endRow:r(t)-1,startColumn:0,endColumn:n(t)-1};if(r(e)===1&&n(e)===1){const v={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return p.push({repeatRelativeRange:S,startRange:v}),p}for(let v=0;v<c+(o?.1:0);v++)for(let T=0;T<y+(i?.1:0);T++){const _=r(t)*v,w=n(t)*T,b={startRow:_+e.startRow,endRow:_+e.startRow,startColumn:w+e.startColumn,endColumn:w+e.startColumn};let R=S;v===c&&o&&(R={...R},R.endRow=R.endRow-(r(t)-o)),T===y&&i&&(R={...R},R.endColumn=R.endColumn-(n(t)-i)),p.push({repeatRelativeRange:R,startRange:b})}return p};let Dt=class extends x.Disposable{constructor(e,r,n,o,i,c){super();Ie(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=r,this._formatPainterService=n,this._sheetsSelectionsService=o,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=c,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),r=(i,c,y,p,S)=>{const{unitId:v,subUnitId:T}=this._painterConfig,{targetUnitId:_,targetSubUnitId:w}=S,b={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row},R={startRow:c.row,startColumn:c.col,endColumn:c.col,endRow:c.row};x.Range.foreach(y,(h,a)=>{const s=x.Rectangle.getPositionRange({startRow:h,startColumn:a,endColumn:a,endRow:h},b),f=x.Rectangle.getPositionRange({startRow:h,startColumn:a,endColumn:a,endRow:h},R),C=this._conditionalFormattingViewModel.getCellCfs(v,T,s.startRow,s.startColumn),l=this._conditionalFormattingViewModel.getCellCfs(_,w,f.startRow,f.startColumn);l&&l.forEach(m=>{let d=p.get(m.cfId);if(!p.get(m.cfId)){const g=this._conditionalFormattingRuleModel.getRule(_,w,m.cfId);if(!g)return;d=new x.ObjectMatrix,g.ranges.forEach(F=>{x.Range.foreach(F,(D,U)=>{d.setValue(D,U,1)})}),p.set(m.cfId,d)}d.realDeleteValue(f.startRow,f.startColumn)}),C&&C.forEach(m=>{const d=p.get(m.cfId);d&&d.setValue(f.startRow,f.startColumn,1)})})},n=(i,c,y)=>{var s;const{range:p,unitId:S,subUnitId:v}=this._painterConfig,T=i!==S||v!==c,_=new Map,w=[],b=[];if(!i||!c||!S||!v)return e();const R=(s=this._conditionalFormattingRuleModel.getSubunitRules(S,v))!=null?s:[];R==null||R.forEach(f=>{const{ranges:C,cfId:l}=f;if(C.some(m=>x.Rectangle.intersects(p,m))){const m=new x.ObjectMatrix;T||C.forEach(d=>{x.Range.foreach(d,(g,F)=>{m.setValue(g,F,1)})}),_.set(l,m)}});const h={row:p.startRow,col:p.startColumn};return Ca(p,y).forEach(f=>{r(h,{row:f.startRange.startRow,col:f.startRange.startColumn},f.repeatRelativeRange,_,{targetUnitId:i,targetSubUnitId:c})}),_.forEach((f,C)=>{if(T){const l=this._conditionalFormattingRuleModel.getRule(i,c,C),m=Y.findAllRectangle(Y.createTopMatrixFromMatrix(f));if(l)if(m.length){const d={unitId:i,subUnitId:c,rule:{...l,ranges:m}};w.push({id:u.SetConditionalRuleMutation.id,params:d}),b.push(...u.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:i,subUnitId:c,cfId:l.cfId};w.push({id:u.DeleteConditionalRuleMutation.id,params:d}),b.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}else if(m.length){const d=this._conditionalFormattingRuleModel.getRule(S,v,C);if(d){const g={unitId:i,subUnitId:c,rule:{...x.Tools.deepClone(d),cfId:this._conditionalFormattingRuleModel.createCfId(i,c),ranges:m}};w.push({id:u.AddConditionalRuleMutation.id,params:g}),b.push(u.AddConditionalRuleMutationUndoFactory(this._injector,g))}}}else{const l=this._conditionalFormattingRuleModel.getRule(S,v,C);if(!l)return;const m=Y.findAllRectangle(Y.createTopMatrixFromMatrix(f));if(m.length){const d={unitId:S,subUnitId:v,rule:{...l,ranges:m}};w.push({id:u.SetConditionalRuleMutation.id,params:d}),b.push(...u.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:S,subUnitId:v,cfId:l.cfId};w.push({id:u.DeleteConditionalRuleMutation.id,params:d}),b.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}}}),{undos:b,redos:w}},o={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:i=>{var c,y,p;switch(i){case de.FormatPainterStatus.INFINITE:case de.FormatPainterStatus.ONCE:{const S=(c=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:c.getUnitId(),v=(p=(y=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getActiveSheet())==null?void 0:p.getSheetId(),T=this._sheetsSelectionsService.getCurrentLastSelection(),_=T==null?void 0:T.range;S&&v&&_&&(this._painterConfig={unitId:S,subUnitId:v,range:_});break}case de.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(i,c,y)=>this._painterConfig?n(i,c,y):{redos:[],undos:[]}};this._formatPainterService.addHook(o)}};Dt=ya([Ve(0,x.Inject(x.Injector)),Ve(1,x.Inject(x.IUniverInstanceService)),Ve(2,x.Inject(de.IFormatPainterService)),Ve(3,x.Inject(Y.SheetsSelectionsService)),Ve(4,x.Inject(u.ConditionalFormattingRuleModel)),Ve(5,x.Inject(u.ConditionalFormattingViewModel))],Dt);var ba=Object.getOwnPropertyDescriptor,Sa=(t,e,r,n)=>{for(var o=n>1?void 0:n?ba(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Gt=(t,e)=>(r,n)=>e(r,n,t);let Mt=class extends x.Disposable{constructor(t,e,r){super(),this._conditionalFormattingViewModel=t,this._univerInstanceService=e,this._renderManagerService=r,this._init()}_init(){const t=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),e=r=>{const n=r.getUnitId(),o=this._renderManagerService.getRenderById(n);if(!o)return;const i=o.with(de.SheetSkeletonManagerService);this.disposeWithMe(i.currentSkeleton$.subscribe(c=>{if(c){const y=c.skeleton.rowColumnSegment,p=y.endColumn-y.startColumn+1,v=(y.endRow-y.startRow+1)*p*9,T=Math.max(u.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,v);this._conditionalFormattingViewModel.setCacheLength(T)}}))};t&&e(t),this._univerInstanceService.getCurrentTypeOfUnit$(x.UniverInstanceType.UNIVER_SHEET).subscribe(r=>{r&&e(r)})}};Mt=Sa([Gt(0,x.Inject(u.ConditionalFormattingViewModel)),Gt(1,x.IUniverInstanceService),Gt(2,nr.IRenderManagerService)],Mt);var Ra=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,wa=(t,e,r)=>e in t?Ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xa=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ta(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Xt=(t,e)=>(r,n)=>e(r,n,t),Tr=(t,e,r)=>wa(t,typeof e!="symbol"?e+"":e,r);exports.UniverSheetsConditionalFormattingUIPlugin=class extends x.Plugin{constructor(e=Et,r,n,o){super(),this._config=e,this._injector=r,this._commandService=n,this._configService=o;const{menu:i,...c}=x.merge({},Et,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Sr,c),this._initCommand()}onStarting(){x.registerDependencies(this._injector,[[ct],[ut],[st],[Ot],[lt],[at],[Ft],[ke],[Pt],[exports.ConditionalFormattingClearController],[Dt],[Mt]]),x.touchDependencies(this._injector,[[ct]])}onReady(){x.touchDependencies(this._injector,[[Ft],[at]])}onRendered(){x.touchDependencies(this._injector,[[Ot],[exports.ConditionalFormattingClearController],[st],[Pt],[ke],[Dt],[lt],[ut],[Mt]])}_initCommand(){[Zt,Jt,Qt,en,tn,nn,rn,on,an,pt].forEach(e=>{this._commandService.registerCommand(e)})}};Tr(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Tr(exports.UniverSheetsConditionalFormattingUIPlugin,"type",x.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=xa([x.DependentOn(u.UniverSheetsConditionalFormattingPlugin),Xt(1,x.Inject(x.Injector)),Xt(2,x.Inject(x.ICommandService)),Xt(3,x.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Zt;exports.AddColorScaleConditionalRuleCommand=Jt;exports.AddDataBarConditionalRuleCommand=Qt;exports.AddDuplicateValuesCfCommand=en;exports.AddNumberCfCommand=tn;exports.AddRankCfCommand=nn;exports.AddTextCfCommand=rn;exports.AddTimePeriodCfCommand=on;exports.AddUniqueValuesCfCommand=an;exports.OpenConditionalFormattingOperator=pt;
152
+ ${W.btnList}
153
+ `,children:[I.jsx(Z.Button,{size:"small",onClick:l,children:e.t("sheet.cf.panel.cancel")}),I.jsx(Z.Button,{className:z.mLSm,size:"small",type:"primary",onClick:C,children:e.t("sheet.cf.panel.submit")})]})]})},Bi=t=>{const[e,r]=j.useState(t.rule),[n,o]=j.useState(!!t.rule),i=()=>{o(!0)},c=()=>{o(!1),r(void 0)},y=p=>{r(p),o(!0)};return I.jsx("div",{className:z.conditionalFormattingWrap,children:n?I.jsx(Hi,{onCancel:c,rule:e}):I.jsx(ei,{onClick:y,onCreate:i})})};var Gi=Object.getOwnPropertyDescriptor,Xi=(t,e,r,n)=>{for(var o=n>1?void 0:n?Gi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Qe=(t,e)=>(r,n)=>e(r,n,t);const Tt="sheet.conditional.formatting.panel";let at=class extends x.Disposable{constructor(e,r,n,o,i){super();Ie(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$(x.UniverInstanceType.UNIVER_SHEET).subscribe(c=>{var y;c||(y=this._sidebarDisposable)==null||y.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(c=>{c.id===Tt&&(c.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const r={id:Tt,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Tt,rule:e,key:x.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(r)}_initPanel(){this._componentManager.register(Tt,Bi)}};at=Xi([Qe(0,x.IUniverInstanceService),Qe(1,x.Inject(x.Injector)),Qe(2,x.Inject(ee.ComponentManager)),Qe(3,x.Inject(ee.ISidebarService)),Qe(4,x.Inject(x.LocaleService))],at);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 pt={id:"sheet.operation.open.conditional.formatting.panel",type:x.CommandType.OPERATION,handler:(t,e)=>{var y;const r=t.get(at),n=t.get(X.SheetsSelectionsService),o=t.get(x.ICommandService),i=((y=n.getCurrentSelections())==null?void 0:y.map(p=>p.range))||[];switch(e.value){case 3:{r.openPanel({...u.createDefaultRule(),ranges:i});break}case 4:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank}};r.openPanel(p);break}case 5:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula,value:"="}};r.openPanel(p);break}case 6:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.colorScale,config:[]}};r.openPanel(p);break}case 7:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.dataBar,isShowValue:!0}};r.openPanel(p);break}case 8:{const p={...u.createDefaultRule,ranges:i,rule:{type:u.CFRuleType.iconSet,config:[],isShowValue:!0}};r.openPanel(p);break}case 2:{r.openPanel();break}case 1:{r.openPanel({...u.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(u.ClearRangeCfCommand.id,{ranges:i});break}case 10:{o.executeCommand(u.ClearWorksheetCfCommand.id);break}}return!0}};var Yi=Object.getOwnPropertyDescriptor,Ki=(t,e,r,n)=>{for(var o=n>1?void 0:n?Yi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},et=(t,e)=>(r,n)=>e(r,n,t);let st=class extends x.Disposable{constructor(e,r,n,o,i){super();Ie(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:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,r,n)=>this._collectConditionalRule(e,r,n),onPasteCells:(e,r,n,o)=>{const{copyType:i=fe.COPY_TYPE.COPY,pasteType:c}=o,{range:y}=e||{},{range:p}=r;return this._generateConditionalFormattingMutations(p,{copyType:i,pasteType:c,copyRange:y})}}))}_collectConditionalRule(e,r,n){const o=new x.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:e,subUnitId:r,cfMap:i}};const c=this._injector.invoke(v=>X.rangeToDiscreteRange(n,v,e,r));if(!c)return;const{rows:y,cols:p}=c,S=new Set;y.forEach((v,R)=>{p.forEach((_,T)=>{const b=this._conditionalFormattingViewModel.getCellCfs(e,r,v,_);b&&(b.forEach(w=>S.add(w.cfId)),o.setValue(R,T,b.map(w=>w.cfId)))})}),S.forEach(v=>{const R=this._conditionalFormattingRuleModel.getRule(e,r,v);R&&(i[v]=R.rule)})}_generateConditionalFormattingMutations(e,r){const n=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),o=n.getActiveSheet(),i=n.getUnitId();if(!o)return{redos:[],undos:[]};const c=o.getSheetId();if(r.copyType===fe.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!r.copyRange)return{redos:[],undos:[]};if(![fe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,fe.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,fe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(r.pasteType))return{redos:[],undos:[]};const{ranges:[p,S],mapFunc:v}=fe.virtualizeDiscreteRanges([r.copyRange,e]),R=fe.getRepeatRange(p,S,!0),_={};x.Range.foreach(S,(l,m)=>{const{row:d,col:g}=v(l,m),D=this._conditionalFormattingViewModel.getCellCfs(i,c,d,g);D&&D.forEach(M=>{if(!_[M.cfId]){const L=new x.ObjectMatrix;_[M.cfId]=L;const U=this._conditionalFormattingRuleModel.getRule(i,c,M.cfId);U==null||U.ranges.forEach(E=>{x.Range.foreach(E,(N,q)=>{L.setValue(N,q,1)})})}_[M.cfId].realDeleteValue(d,g)})});const{matrix:T,info:b}=this._copyInfo,w=[];let h=this._conditionalFormattingRuleModel.createCfId(i,c);const a={},s=l=>{if(a[l])return a[l];const m=b==null?void 0:b.cfMap[l],d=[...this._conditionalFormattingRuleModel.getSubunitRules(i,c)||[],...w].find(g=>x.Tools.diffValue(g.rule,m));if(d)return a[l]=d,d;{const g={rule:m,cfId:h,ranges:[],stopIfTrue:!1};return a[l]=g,w.push(g),h=`${Number(h)+1}`,g}};R.forEach(l=>{T&&T.forValue((m,d,g)=>{const D=x.Rectangle.getPositionRange({startRow:m,endRow:m,startColumn:d,endColumn:d},l.startRange),{row:M,col:L}=v(D.startRow,D.startColumn);g.forEach(U=>{if(!_[U]){const E=s(U),N=new x.ObjectMatrix;_[U]=N,E.ranges.forEach(q=>{x.Range.foreach(q,(H,J)=>{N.setValue(H,J,1)})})}_[U].setValue(M,L,1)})})});const f=[],C=[];for(const l in _){const m=_[l],d=X.findAllRectangle(X.createTopMatrixFromMatrix(m));if(!d.length){const g={unitId:i,subUnitId:c,cfId:l};f.push({id:u.DeleteConditionalRuleMutation.id,params:g}),C.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(w.some(g=>g.cfId===l)){const g=s(l),D={unitId:i,subUnitId:c,rule:{...g,ranges:d}};f.push({id:u.AddConditionalRuleMutation.id,params:D}),C.push(u.AddConditionalRuleMutationUndoFactory(this._injector,D))}else{const g=this._conditionalFormattingRuleModel.getRule(i,c,l);if(!g)continue;const D={unitId:i,subUnitId:c,rule:{...g,ranges:d}};f.push({id:u.SetConditionalRuleMutation.id,params:D}),C.push(...u.setConditionalRuleMutationUndoFactory(this._injector,D))}}return{redos:f,undos:C}}};st=Ki([et(0,x.Inject(fe.ISheetClipboardService)),et(1,x.Inject(u.ConditionalFormattingRuleModel)),et(2,x.Inject(x.Injector)),et(3,x.Inject(u.ConditionalFormattingViewModel)),et(4,x.Inject(x.IUniverInstanceService))],st);var Zi=Object.getOwnPropertyDescriptor,Ji=(t,e,r,n)=>{for(var o=n>1?void 0:n?Zi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Ht=(t,e)=>(r,n)=>e(r,n,t);let lt=class extends x.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===u.AddCfCommand.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")))}))}};lt=Ji([Ht(0,x.Inject(x.LocaleService)),Ht(1,x.ICommandService),Ht(2,x.Inject(X.SheetPermissionCheckController))],lt);var Qi=Object.getOwnPropertyDescriptor,ea=(t,e,r,n)=>{for(var o=n>1?void 0:n?Qi(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},wt=(t,e)=>(r,n)=>e(r,n,t);let ut=class extends x.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 c=p=>{const S=[...i.ranges],v=S.map(_=>X.handleDefaultRangeChangeWithEffectRefCommands(_,p)).filter(_=>!!_);if(u.isRangesEqual(v,S))return{redos:[],undos:[]};if(v.length){const _={unitId:n,subUnitId:o,rule:{...i,ranges:v}},T=[{id:u.SetConditionalRuleMutation.id,params:_}],b=u.setConditionalRuleMutationUndoFactory(this._injector,_);return{redos:T,undos:b}}else{const _={unitId:n,subUnitId:o,cfId:i.cfId},T=[{id:u.DeleteConditionalRuleMutation.id,params:_}],b=u.DeleteConditionalRuleMutationUndoFactory(this._injector,_);return{redos:T,undos:b}}},y=[];i.ranges.forEach(p=>{const S=this._refRangeService.registerRefRange(p,c);y.push(()=>S.dispose())}),t.set(e(n,o,i.cfId),()=>y.forEach(p=>p()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:o,subUnitId:i,rule:c}=n,y=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),p=y.getActiveSheet();if(!(n.unitId!==y.getUnitId()||n.subUnitId!==(p==null?void 0:p.getSheetId())))switch(n.type){case"add":{r(n.unitId,n.subUnitId,n.rule);break}case"delete":{const S=t.get(e(o,i,c.cfId));S&&S();break}case"set":{const S=t.get(e(o,i,c.cfId));S&&S(),r(n.unitId,n.subUnitId,n.rule)}}})),this.disposeWithMe(x.toDisposable(()=>{t.forEach(n=>{n()}),t.clear()}))}};ut=ea([wt(0,x.Inject(u.ConditionalFormattingRuleModel)),wt(1,x.Inject(x.IUniverInstanceService)),wt(2,x.Inject(x.Injector)),wt(3,x.Inject(X.RefRangeService))],ut);var ta=Object.getOwnPropertyDescriptor,na=(t,e,r,n)=>{for(var o=n>1?void 0:n?ta(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Ue=(t,e)=>(r,n)=>e(r,n,t);let ct=class extends x.Disposable{constructor(e,r,n,o,i,c){super();Ie(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=r,this._univerInstanceService=n,this._renderManagerService=o,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=c,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var r,n,o;const e=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId();(r=this._renderManagerService.getRenderById(e))==null||r.with(fe.SheetSkeletonManagerService).reCalculate(),(o=(n=this._renderManagerService.getRenderById(e))==null?void 0:n.mainComponent)==null||o.makeDirty()}_initSkeleton(){this.disposeWithMe(Se.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(it.bufferTime(16),it.filter(e=>!!e.length),it.filter(e=>{const r=this._univerInstanceService.getCurrentUnitForType(x.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:x.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)||{}},p={...e,s:y};return o.style&&Object.assign(y,o.style),p.fontRenderExtension||(p.fontRenderExtension={},o.isShowValue!==void 0&&(p.fontRenderExtension.isSkip=!o.isShowValue)),o.dataBar&&(p.dataBar=o.dataBar),o.iconSet&&(p.iconSet=o.iconSet,p.fontRenderExtension.leftOffset=u.DEFAULT_PADDING+u.DEFAULT_WIDTH),n(p)},priority:10}))}};ct=na([Ue(0,x.Inject(X.SheetInterceptorService)),Ue(1,x.Inject(u.ConditionalFormattingService)),Ue(2,x.Inject(x.IUniverInstanceService)),Ue(3,x.Inject(nr.IRenderManagerService)),Ue(4,x.Inject(u.ConditionalFormattingViewModel)),Ue(5,x.Inject(u.ConditionalFormattingRuleModel))],ct);const Sr="sheets-conditional-formatting-ui.config",Et={};var ra=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,ia=(t,e,r)=>e in t?ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aa=(t,e,r,n)=>{for(var o=n>1?void 0:n?oa(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Bt=(t,e)=>(r,n)=>e(r,n,t),Rr=(t,e,r)=>ia(t,typeof e!="symbol"?e+"":e,r);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends x.Plugin{constructor(e=Et,r,n,o){super(),this._config=e,this._injector=r,this._commandService=n,this._configService=o;const{menu:i,...c}=x.merge({},Et,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Sr,c),this._initCommand(),this._injector.add([ct]),this._injector.add([ut]),this._injector.add([st]),this._injector.add([lt]),this._injector.add([ke])}_initCommand(){[Zt,Jt,Qt,en,tn,nn,rn,on,an,pt].forEach(e=>{this._commandService.registerCommand(e)})}};Rr(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Rr(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",x.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=aa([x.DependentOn(u.UniverSheetsConditionalFormattingPlugin),Bt(1,x.Inject(x.Injector)),Bt(2,x.Inject(x.ICommandService)),Bt(3,x.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var sa=Object.getOwnPropertyDescriptor,la=(t,e,r,n)=>{for(var o=n>1?void 0:n?sa(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},tt=(t,e)=>(r,n)=>e(r,n,t);let Ot=class extends x.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,c,y,p)=>{var T;const S=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getUnitId(),v=(T=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:T.getSheetId();if(!S||!v)return;const R={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},_={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};x.Range.foreach(c,(b,w)=>{const h=x.Rectangle.getPositionRange({startRow:b,startColumn:w,endColumn:w,endRow:b},R),a=x.Rectangle.getPositionRange({startRow:b,startColumn:w,endColumn:w,endRow:b},_),{row:s,col:f}=p(h.startRow,h.startColumn),C=this._conditionalFormattingViewModel.getCellCfs(S,v,s,f),{row:l,col:m}=p(a.startRow,a.startColumn),d=this._conditionalFormattingViewModel.getCellCfs(S,v,l,m);d&&d.forEach(g=>{let D=y.get(g.cfId);if(!y.get(g.cfId)){const M=this._conditionalFormattingRuleModel.getRule(S,v,g.cfId);if(!M)return;D=new x.ObjectMatrix,M.ranges.forEach(L=>{x.Range.foreach(L,(U,E)=>{D.setValue(U,E,1)})}),y.set(g.cfId,D)}D.realDeleteValue(l,m)}),C&&C.forEach(g=>{let D=y.get(g.cfId);if(!y.get(g.cfId)){const M=this._conditionalFormattingRuleModel.getRule(S,v,g.cfId);if(!M)return;D=new x.ObjectMatrix,M.ranges.forEach(L=>{x.Range.foreach(L,(U,E)=>{D.setValue(U,E,1)})}),y.set(g.cfId,D)}D.setValue(l,m,1)})})},r=(o,i)=>{var a,s,f;const c=(a=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getUnitId(),y=(f=(s=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getActiveSheet())==null?void 0:f.getSheetId(),p=new Map,S=[],v=[];if(!c||!y)return t();const R=fe.virtualizeDiscreteRanges([o,i]),[_,T]=R.ranges,{mapFunc:b}=R,w={row:_.startRow,col:_.startColumn};return fe.getAutoFillRepeatRange(_,T).forEach(C=>{e(w,C.repeatStartCell,C.relativeRange,p,b)}),p.forEach((C,l)=>{const m=this._conditionalFormattingRuleModel.getRule(c,y,l);if(!m)return;const d=X.findAllRectangle(X.createTopMatrixFromMatrix(C));if(d.length){const g={unitId:c,subUnitId:y,rule:{...m,ranges:d}};S.push({id:u.SetConditionalRuleMutation.id,params:g}),v.push(...u.setConditionalRuleMutationUndoFactory(this._injector,g))}else{const g={unitId:c,subUnitId:y,cfId:m.cfId};S.push({id:u.DeleteConditionalRuleMutation.id,params:g}),v.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}}),{undos:v,redos:S}},n={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,c)=>{if(c===fe.APPLY_TYPE.COPY||c===fe.APPLY_TYPE.ONLY_FORMAT||c===fe.APPLY_TYPE.SERIES){const{source:y,target:p}=o;return r(y,p)}return t()}};this.disposeWithMe(this._autoFillService.addHook(n))}};Ot=la([tt(0,x.Inject(x.Injector)),tt(1,x.Inject(x.IUniverInstanceService)),tt(2,x.Inject(fe.IAutoFillService)),tt(3,x.Inject(u.ConditionalFormattingRuleModel)),tt(4,x.Inject(u.ConditionalFormattingViewModel))],Ot);var ua=Object.getOwnPropertyDescriptor,ca=(t,e,r,n)=>{for(var o=n>1?void 0:n?ua(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},nt=(t,e)=>(r,n)=>e(r,n,t);exports.ConditionalFormattingClearController=class extends x.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 c=(i=this._selectionManagerService.getCurrentSelections())==null?void 0:i.map(b=>b.range);if(!c)return o;const y=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),p=y.getActiveSheet();if(!p)return o;const S=y.getUnitId(),v=p.getSheetId(),R=this._conditionalFormattingRuleModel.getSubunitRules(S,v);if(!R||!R.length)return o;const{redos:_,undos:T}=Zn(this._injector,R,c,S,v);r.push(..._),n.push(...T)}return o}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:r,ranges:n})=>{const o=[],i=[],c={redos:o,undos:i};if(!n||!n.length)return c;const y=this._conditionalFormattingRuleModel.getSubunitRules(e,r);if(!y||!y.length)return c;const{redos:p,undos:S}=Zn(this._injector,y,n,e,r);return o.push(...p),i.push(...S),c}}))}};exports.ConditionalFormattingClearController=ca([nt(0,x.Inject(x.Injector)),nt(1,x.Inject(x.IUniverInstanceService)),nt(2,x.Inject(X.SheetInterceptorService)),nt(3,x.Inject(X.SheetsSelectionsService)),nt(4,x.Inject(u.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function Zn(t,e,r,n,o){const i=[],c=[];return e.filter(y=>r.some(p=>y.ranges.some(S=>x.Rectangle.getIntersects(S,p)))).forEach(y=>{const S=new X.RangeMergeUtil().add(...y.ranges).subtract(...r).merge();if(S.length){const v={id:u.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:o,rule:{...y,ranges:S}}},R=u.setConditionalRuleMutationUndoFactory(t,v.params);i.push(v),c.push(...R)}else{const v={id:u.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:o,cfId:y.cfId}},R=u.DeleteConditionalRuleMutationUndoFactory(t,v.params);i.push(v),c.push(...R)}}),{redos:i,undos:c}}var da=Object.getOwnPropertyDescriptor,fa=(t,e,r,n)=>{for(var o=n>1?void 0:n?da(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Jn=(t,e)=>(r,n)=>e(r,n,t);let Pt=class extends x.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(x.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(X.AFTER_CELL_EDIT,{handler:(t,e,r)=>{var c,y,p;t||r(t);const n=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),o=(c=n==null?void 0:n.style)!=null?c:{},i=Object.keys(o);if(t!=null&&t.p)return(p=(y=t.p.body)==null?void 0:y.textRuns)==null||p.forEach(S=>{S.ts&&i.forEach(v=>{var R;(R=S.ts)==null||delete R[v]})}),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(R=>{delete S[R]});const v={...t,s:{...S}};return r(v)}}})))}};Pt=fa([Jn(0,x.Inject(X.SheetInterceptorService)),Jn(1,x.Inject(u.ConditionalFormattingService))],Pt);const Qn=[X.SetWorksheetActiveOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],rt=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:ve.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:ve.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:ve.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:ve.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:ve.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:ve.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:ve.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:ve.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:ve.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:ve.clearWorkSheetRules}],pa=t=>{const e=t.get(X.SheetsSelectionsService),r=t.get(x.ICommandService),n=t.get(x.IUniverInstanceService),o=t.get(u.ConditionalFormattingRuleModel),i=new Se.Observable(p=>Se.merge(e.selectionMoveEnd$,e.selectionSet$,new Se.Observable(S=>{const v=r.onCommandExecuted(R=>{var w;const{id:_,params:T}=R,b=(w=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getUnitId();Qn.includes(_)&&T.unitId===b&&S.next(null)});return()=>v.dispose()})).pipe(it.debounceTime(16)).subscribe(()=>{var w;const S=((w=e.getCurrentSelections())==null?void 0:w.map(h=>h.range))||[],v=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET);if(!v)return;const R=v.getActiveSheet();if(!R)return;const b=(o.getSubunitRules(v.getUnitId(),R.getSheetId())||[]).filter(h=>h.ranges.some(a=>S.some(s=>x.Rectangle.intersects(s,a)))).map(h=>h.ranges).every(h=>X.checkRangesEditablePermission(t,v.getUnitId(),R.getSheetId(),h));p.next(b)})),c=new Se.Observable(p=>new Se.Observable(S=>{const v=r.onCommandExecuted(R=>{var w;const{id:_,params:T}=R,b=(w=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getUnitId();Qn.includes(_)&&T.unitId===b&&S.next(null)});return()=>v.dispose()}).pipe(it.debounceTime(16)).subscribe(()=>{const S=n.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET);if(!S)return;const v=S.getActiveSheet();if(!v)return;const R=o.getSubunitRules(S.getUnitId(),v.getSheetId())||[];if(!R.length)return p.next(!1),!1;const _=R.map(T=>T.ranges).every(T=>X.checkRangesEditablePermission(t,S.getUnitId(),v.getSheetId(),T));p.next(_)})),y=new Se.Observable(p=>{i.subscribe(S=>{const v=rt.find(R=>R.value===ve.clearRangeRules);v&&(v.disabled=!S,p.next(rt))}),c.subscribe(S=>{const v=rt.find(R=>R.value===ve.clearWorkSheetRules);v&&(v.disabled=!S,p.next(rt))}),p.next(rt)});return{id:pt.id,type:ee.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:y,hidden$:ee.getMenuHiddenObservable(t,x.UniverInstanceType.UNIVER_SHEET),disabled$:fe.getCurrentRangeDisable$(t,{workbookTypes:[X.WorkbookEditablePermission],worksheetTypes:[X.WorksheetSetCellStylePermission,X.WorksheetEditPermission],rangeTypes:[X.RangeProtectionPermissionEditPoint]})}},ha={[ee.RibbonStartGroup.FORMULAS_INSERT]:{[pt.id]:{order:0,menuItemFactory:pa}}};var ma=Object.getOwnPropertyDescriptor,ga=(t,e,r,n)=>{for(var o=n>1?void 0:n?ma(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},er=(t,e)=>(r,n)=>e(r,n,t);let Dt=class extends x.Disposable{constructor(e,r){super();Ie(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=r,this._menuManagerService.mergeMenu(ha)}};Dt=ga([er(0,x.Inject(x.Injector)),er(1,ee.IMenuManagerService)],Dt);var va=Object.getOwnPropertyDescriptor,ya=(t,e,r,n)=>{for(var o=n>1?void 0:n?va(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Ve=(t,e)=>(r,n)=>e(r,n,t);const Ca=(t,e)=>{const r=v=>v.endRow-v.startRow+1,n=v=>v.endColumn-v.startColumn+1,o=r(e)%r(t),i=n(e)%n(t),c=Math.floor(r(e)/r(t)),y=Math.floor(n(e)/n(t)),p=[],S={startRow:0,endRow:r(t)-1,startColumn:0,endColumn:n(t)-1};if(r(e)===1&&n(e)===1){const v={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return p.push({repeatRelativeRange:S,startRange:v}),p}for(let v=0;v<c+(o?.1:0);v++)for(let R=0;R<y+(i?.1:0);R++){const _=r(t)*v,T=n(t)*R,b={startRow:_+e.startRow,endRow:_+e.startRow,startColumn:T+e.startColumn,endColumn:T+e.startColumn};let w=S;v===c&&o&&(w={...w},w.endRow=w.endRow-(r(t)-o)),R===y&&i&&(w={...w},w.endColumn=w.endColumn-(n(t)-i)),p.push({repeatRelativeRange:w,startRange:b})}return p};let Ft=class extends x.Disposable{constructor(e,r,n,o,i,c){super();Ie(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=r,this._formatPainterService=n,this._sheetsSelectionsService=o,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=c,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),r=(i,c,y,p,S)=>{const{unitId:v,subUnitId:R}=this._painterConfig,{targetUnitId:_,targetSubUnitId:T}=S,b={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row},w={startRow:c.row,startColumn:c.col,endColumn:c.col,endRow:c.row};x.Range.foreach(y,(h,a)=>{const s=x.Rectangle.getPositionRange({startRow:h,startColumn:a,endColumn:a,endRow:h},b),f=x.Rectangle.getPositionRange({startRow:h,startColumn:a,endColumn:a,endRow:h},w),C=this._conditionalFormattingViewModel.getCellCfs(v,R,s.startRow,s.startColumn),l=this._conditionalFormattingViewModel.getCellCfs(_,T,f.startRow,f.startColumn);l&&l.forEach(m=>{let d=p.get(m.cfId);if(!p.get(m.cfId)){const g=this._conditionalFormattingRuleModel.getRule(_,T,m.cfId);if(!g)return;d=new x.ObjectMatrix,g.ranges.forEach(D=>{x.Range.foreach(D,(M,L)=>{d.setValue(M,L,1)})}),p.set(m.cfId,d)}d.realDeleteValue(f.startRow,f.startColumn)}),C&&C.forEach(m=>{const d=p.get(m.cfId);d&&d.setValue(f.startRow,f.startColumn,1)})})},n=(i,c,y)=>{var s;const{range:p,unitId:S,subUnitId:v}=this._painterConfig,R=i!==S||v!==c,_=new Map,T=[],b=[];if(!i||!c||!S||!v)return e();const w=(s=this._conditionalFormattingRuleModel.getSubunitRules(S,v))!=null?s:[];w==null||w.forEach(f=>{const{ranges:C,cfId:l}=f;if(C.some(m=>x.Rectangle.intersects(p,m))){const m=new x.ObjectMatrix;R||C.forEach(d=>{x.Range.foreach(d,(g,D)=>{m.setValue(g,D,1)})}),_.set(l,m)}});const h={row:p.startRow,col:p.startColumn};return Ca(p,y).forEach(f=>{r(h,{row:f.startRange.startRow,col:f.startRange.startColumn},f.repeatRelativeRange,_,{targetUnitId:i,targetSubUnitId:c})}),_.forEach((f,C)=>{if(R){const l=this._conditionalFormattingRuleModel.getRule(i,c,C),m=X.findAllRectangle(X.createTopMatrixFromMatrix(f));if(l)if(m.length){const d={unitId:i,subUnitId:c,rule:{...l,ranges:m}};T.push({id:u.SetConditionalRuleMutation.id,params:d}),b.push(...u.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:i,subUnitId:c,cfId:l.cfId};T.push({id:u.DeleteConditionalRuleMutation.id,params:d}),b.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}else if(m.length){const d=this._conditionalFormattingRuleModel.getRule(S,v,C);if(d){const g={unitId:i,subUnitId:c,rule:{...x.Tools.deepClone(d),cfId:this._conditionalFormattingRuleModel.createCfId(i,c),ranges:m}};T.push({id:u.AddConditionalRuleMutation.id,params:g}),b.push(u.AddConditionalRuleMutationUndoFactory(this._injector,g))}}}else{const l=this._conditionalFormattingRuleModel.getRule(S,v,C);if(!l)return;const m=X.findAllRectangle(X.createTopMatrixFromMatrix(f));if(m.length){const d={unitId:S,subUnitId:v,rule:{...l,ranges:m}};T.push({id:u.SetConditionalRuleMutation.id,params:d}),b.push(...u.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:S,subUnitId:v,cfId:l.cfId};T.push({id:u.DeleteConditionalRuleMutation.id,params:d}),b.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}}}),{undos:b,redos:T}},o={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:i=>{var c,y,p;switch(i){case fe.FormatPainterStatus.INFINITE:case fe.FormatPainterStatus.ONCE:{const S=(c=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:c.getUnitId(),v=(p=(y=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getActiveSheet())==null?void 0:p.getSheetId(),R=this._sheetsSelectionsService.getCurrentLastSelection(),_=R==null?void 0:R.range;S&&v&&_&&(this._painterConfig={unitId:S,subUnitId:v,range:_});break}case fe.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(i,c,y)=>this._painterConfig?n(i,c,y):{redos:[],undos:[]}};this._formatPainterService.addHook(o)}};Ft=ya([Ve(0,x.Inject(x.Injector)),Ve(1,x.Inject(x.IUniverInstanceService)),Ve(2,x.Inject(fe.IFormatPainterService)),Ve(3,x.Inject(X.SheetsSelectionsService)),Ve(4,x.Inject(u.ConditionalFormattingRuleModel)),Ve(5,x.Inject(u.ConditionalFormattingViewModel))],Ft);var ba=Object.getOwnPropertyDescriptor,Sa=(t,e,r,n)=>{for(var o=n>1?void 0:n?ba(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Gt=(t,e)=>(r,n)=>e(r,n,t);let Mt=class extends x.Disposable{constructor(t,e,r){super(),this._conditionalFormattingViewModel=t,this._univerInstanceService=e,this._renderManagerService=r,this._init()}_init(){const t=this._univerInstanceService.getCurrentUnitForType(x.UniverInstanceType.UNIVER_SHEET),e=r=>{const n=r.getUnitId(),o=this._renderManagerService.getRenderById(n);if(!o)return;const i=o.with(fe.SheetSkeletonManagerService);this.disposeWithMe(i.currentSkeleton$.subscribe(c=>{if(c){const y=c.skeleton.rowColumnSegment,p=y.endColumn-y.startColumn+1,v=(y.endRow-y.startRow+1)*p*9,R=Math.max(u.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,v);this._conditionalFormattingViewModel.setCacheLength(R)}}))};t&&e(t),this._univerInstanceService.getCurrentTypeOfUnit$(x.UniverInstanceType.UNIVER_SHEET).subscribe(r=>{r&&e(r)})}};Mt=Sa([Gt(0,x.Inject(u.ConditionalFormattingViewModel)),Gt(1,x.IUniverInstanceService),Gt(2,nr.IRenderManagerService)],Mt);var Ra=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,wa=(t,e,r)=>e in t?Ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xa=(t,e,r,n)=>{for(var o=n>1?void 0:n?Ta(e,r):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(o=c(o)||o);return o},Xt=(t,e)=>(r,n)=>e(r,n,t),Tr=(t,e,r)=>wa(t,typeof e!="symbol"?e+"":e,r);exports.UniverSheetsConditionalFormattingUIPlugin=class extends x.Plugin{constructor(e=Et,r,n,o){super(),this._config=e,this._injector=r,this._commandService=n,this._configService=o;const{menu:i,...c}=x.merge({},Et,this._config);i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Sr,c),this._initCommand()}onStarting(){x.registerDependencies(this._injector,[[ct],[ut],[st],[Ot],[lt],[at],[Dt],[ke],[Pt],[exports.ConditionalFormattingClearController],[Ft],[Mt]]),x.touchDependencies(this._injector,[[ct]])}onReady(){x.touchDependencies(this._injector,[[Dt],[at]])}onRendered(){x.touchDependencies(this._injector,[[Ot],[exports.ConditionalFormattingClearController],[st],[Pt],[ke],[Ft],[lt],[ut],[Mt]])}_initCommand(){[Zt,Jt,Qt,en,tn,nn,rn,on,an,pt].forEach(e=>{this._commandService.registerCommand(e)})}};Tr(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);Tr(exports.UniverSheetsConditionalFormattingUIPlugin,"type",x.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=xa([x.DependentOn(u.UniverSheetsConditionalFormattingPlugin),Xt(1,x.Inject(x.Injector)),Xt(2,x.Inject(x.ICommandService)),Xt(3,x.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Zt;exports.AddColorScaleConditionalRuleCommand=Jt;exports.AddDataBarConditionalRuleCommand=Qt;exports.AddDuplicateValuesCfCommand=en;exports.AddNumberCfCommand=tn;exports.AddRankCfCommand=nn;exports.AddTextCfCommand=rn;exports.AddTimePeriodCfCommand=on;exports.AddUniqueValuesCfCommand=an;exports.OpenConditionalFormattingOperator=pt;