@univerjs/preset-sheets-conditional-formatting 0.6.10 → 0.7.0-beta.1
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/index.css +1 -1
- package/lib/umd/index.js +76 -153
- package/package.json +7 -6
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-box-border{box-sizing:border-box}.univer-h-7{height:1.75rem}.univer-w-auto{width:auto}.univer-rounded-lg{border-radius:.5rem}.univer-p-4{padding:1rem}.univer-conditional-formatting-wrap{height:100%;display:flex;flex-direction:column;justify-content:space-between}.univer-conditional-formatting-wrap .univer-cf-rule-item{display:flex;justify-content:space-between;align-items:center}.univer-conditional-formatting-wrap .univer-cf-rule-item .univer-preview{flex-shrink:0}.univer-conditional-formatting-wrap .univer-create-rule{margin-bottom:20px}.univer-conditional-formatting-wrap .univer-create-rule .univer-button{border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);display:flex;align-items:center;justify-content:center;padding:var(--padding-base);cursor:pointer;font-size:var(--font-size-sm)}.univer-conditional-formatting-wrap .univer-title{margin-top:var(--margin-base);font-size:15px;color:rgb(var(--text-color-secondary))}.univer-conditional-formatting-wrap .univer-label{font-size:12px;margin-top:var(--margin-sm);color:rgb(var(--text-color-secondary))}.univer-conditional-formatting-wrap .univer-label-container{display:flex;align-items:center}.univer-conditional-formatting-wrap .univer-label-container .univer-input-width{width:100px}.univer-conditional-formatting-wrap .univer-m-t-base{margin-top:var(--margin-base)}.univer-conditional-formatting-wrap .univer-m-t-sm{margin-top:var(--margin-sm)}.univer-conditional-formatting-wrap .univer-m-t-xl{margin-top:var(--margin-xl)}.univer-conditional-formatting-wrap .univer-m-l-sm{margin-left:var(--margin-sm)}.univer-conditional-formatting-wrap .univer-m-l-xl{margin-left:var(--margin-xl)}.univer-conditional-formatting-wrap .univer-m-l-xxs{margin-left:var(--margin-xxs)}.univer-conditional-formatting-wrap .univer-m-l-0{margin-left:0}.univer-conditional-formatting-wrap .univer-m-r-0{margin-right:0}.univer-cf-preview{display:flex;align-items:center;justify-content:center;pointer-events:none;min-width:72px;height:20px;font-size:12px}.univer-cf-rule-list .univer-rule-selector{color:rgb(var(--text-color-secondary));font-size:12px;display:flex;justify-content:space-between;align-items:center}.univer-cf-rule-list .univer-rule-selector .univer-select{color:rgb(var(--text-color));width:138px}.univer-cf-rule-list .univer-rule-selector .univer-select .univer-select-selector{border:none;padding:0}.univer-cf-rule-list .univer-rule-selector .univer-select .univer-select-selection-item{top:-2px;left:4px}.univer-cf-rule-list .univer-rule-selector .univer-select .univer-select-selection-search-input{cursor:pointer}.univer-cf-rule-list .univer-rule-selector .univer-btn-list{font-size:16px;color:#000;display:flex;justify-content:space-between;align-items:center}.univer-cf-rule-list .univer-rule-selector .univer-btn-list .univer-gap{margin-left:8px}.univer-cf-rule-list .univer-rule-selector .univer-btn-list .univer-icon{cursor:pointer;display:flex;justify-content:space-between;align-items:center;border-radius:4px;padding:4px}.univer-cf-rule-list .univer-rule-selector .univer-btn-list .univer-icon:hover{background:rgb(var(--grey-300))}.univer-cf-rule-list .univer-rule-selector .univer-btn-list .univer-disabled{color:rgb(var(--grey-500));display:flex;align-items:center;border-radius:4px;padding:4px}.univer-cf-rule-list .univer-rule-item{padding:8px 32px 8px 20px;display:flex;justify-content:space-between;position:relative;align-items:center;border-radius:var(--border-radius-base)}.univer-cf-rule-list .univer-rule-item .univer-rule-describe{max-width:100%;min-width:0px;overflow:hidden;flex-shrink:1;font-size:var(--font-size-sm);line-height:21px}.univer-cf-rule-list .univer-rule-item .univer-rule-describe .univer-rule-type{font-size:14px;line-height:22px;color:#1e222b}.univer-cf-rule-list .univer-rule-item .univer-rule-describe .univer-rule-range{font-size:12px;line-height:22px;color:#7a7a7a}.univer-cf-rule-list .univer-rule-item:hover,.univer-cf-rule-list .univer-rule-item.univer-active{background-color:rgb(var(--grey-100))}.univer-cf-rule-list .univer-rule-item .univer-draggableHandle{display:none;position:absolute;left:0;width:20px;height:20px;border-radius:var(--border-radius-base);cursor:grab}.univer-cf-rule-list .univer-rule-item:hover .univer-delete-item,.univer-cf-rule-list .univer-rule-item:hover .univer-draggableHandle{display:flex;align-items:center;justify-content:center}.univer-cf-rule-list .univer-rule-item .univer-delete-item{display:none;cursor:pointer;border-radius:var(--border-radius-base);position:absolute;right:4px;width:24px;height:24px}.univer-cf-rule-list .univer-rule-item .univer-delete-item:hover{background-color:rgb(var(--grey-300))}.univer-cf-rule-list .univer-rule-item .univer-active{display:flex;align-items:center;justify-content:center}.univer-cf-rule-list .univer-grid-layout-wrap{width:calc(100% - 2 * var(--padding-sm) + 2 * var(--padding-xl));margin-left:calc(-1 * var(--padding-xl));padding-left:var(--padding-sm)}.univer-cf-rule-list .univer-grid-layout-wrap .univer-react-grid-item{transition:none}.react-grid-item.react-grid-placeholder{background:rgb(var(--grey-300))!important}.react-grid-layout{position:relative;transition:height .2s ease}.react-grid-item{transition:all .2s ease;transition-property:left,top,width,height}.react-grid-item img{pointer-events:none;-webkit-user-select:none;user-select:none}.react-grid-item.cssTransforms{transition-property:transform,width,height}.react-grid-item.resizing{transition:none;z-index:1;will-change:width,height}.react-grid-item.react-draggable-dragging{transition:none;z-index:3;will-change:transform}.react-grid-item.dropping{visibility:hidden}.react-grid-item.react-grid-placeholder{background:red;opacity:.2;transition-duration:.1s;z-index:2;-webkit-user-select:none;-o-user-select:none;user-select:none}.react-grid-item.react-grid-placeholder.placeholder-resizing{transition:none}.react-grid-item>.react-resizable-handle{position:absolute;width:20px;height:20px}.react-grid-item>.react-resizable-handle:after{content:"";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-right:2px solid rgba(0,0,0,.4);border-bottom:2px solid rgba(0,0,0,.4)}.react-resizable-hide>.react-resizable-handle{display:none}.react-grid-item>.react-resizable-handle.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-w,.react-grid-item>.react-resizable-handle.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-n,.react-grid-item>.react-resizable-handle.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+);background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-resizable-handle-w,.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-resizable-handle-n,.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}.univer-cf-color-picker{padding:var(--padding-base);font-size:var(--font-size-xs);list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-cf-color-picker-icon{cursor:pointer;padding:4px;display:flex;align-items:center}.univer-cf-color-picker-icon:hover{background:rgb(var(--bg-color-hover));border-radius:var(--border-radius-base)}.univer-cf-color-picker-icon .univer-icon-dropdown{font-size:8px;color:rgb(var(--text-color-secondary));margin-left:6px}.univer-cf-rule-style-editor .univer-cf-error-text{color:rgb(var(--red-500));font-size:var(--font-size-xxs);margin-top:var(--margin-xxs)}.univer-cf-rule-style-editor .univer-cf-preview-wrap{margin-top:var(--margin-lg);padding:var(--padding-xs) var(--padding-sm);border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base)}.univer-cf-rule-style-editor .univer-text{font-size:var(--font-size-xxs)}.univer-cf-rule-style-editor .univer-position-relative{position:relative}.univer-cf-rule-style-editor .univer-btn-list{display:flex;justify-content:flex-end;margin-bottom:var(--margin-base)}.univer-cf-rule-style-editor .univer-util-item{display:flex;justify-content:flex-start;align-items:center;font-size:var(--font-size-xxs)}.univer-cf-rule-style-editor .univer-icon-set .univer-render-config{display:flex;align-items:center;font-size:var(--font-size-xxs);justify-content:flex-start}.univer-cf-rule-style-editor .univer-icon-set .univer-flex{display:flex;justify-content:space-between;align-items:center}.univer-cf-rule-style-editor .univer-icon-set .univer-width45{width:45%}.univer-cf-rule-style-editor .univer-icon-set .univer-icon-wrap{display:flex;align-items:center}.univer-cf-rule-style-editor .univer-icon-set .univer-icon{width:20px;height:20px}.univer-cf-rule-style-editor .univer-icon-set .univer-dropdown-icon{background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);display:flex;justify-content:space-between;width:100%;align-items:center;padding:var(--padding-sm) var(--padding-lg);font-size:var(--font-size-xxs);color:rgb(var(--text-color-secondary));transition:all .15s}.univer-cf-rule-style-editor .univer-icon-set .univer-dropdown-icon:hover{border-color:rgb(var(--primary-color))!important}.univer-cf-rule-style-editor .univer-icon-set .univer-dropdown-icon .univer-icon{width:16px;height:16px}.univer-cf-rule-style-editor .univer-icon-set .univer-error-input{border:1px solid rgb(var(--red-400))}.univer-cf-rule-style-editor .univer-icon-set .univer-error-text{color:rgb(var(--red-400));font-size:12px;position:absolute}.univer-icon-group-list{padding:var(--padding-base);font-size:var(--font-size-xs);box-sizing:border-box;width:328px;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-icon-group-list .univer-title{font-size:13px;margin-bottom:var(--margin-xxs)}.univer-icon-group-list .univer-group{margin-bottom:var(--margin-sm)}.univer-icon-group-list .univer-item-content{display:flex;flex-wrap:wrap}.univer-icon-group-list .univer-item-content .univer-item-wrap{display:flex;align-items:center;justify-content:flex-start;width:50%;margin-bottom:4px}.univer-icon-group-list .univer-item-content .univer-item-wrap .univer-item{border-radius:var(--border-radius-base);cursor:pointer}.univer-icon-group-list .univer-item-content .univer-item-wrap .univer-item :not(:first-child).univer-icon{margin-left:8px}.univer-icon-group-list .univer-item-content .univer-item-wrap .univer-item:hover{background-color:rgb(var(--bg-color-hover))}.univer-icon-group-list .univer-item-content .univer-item-wrap :not(:first-child).univer-icon{margin-left:8px}.univer-icon-group-list .univer-icon{width:20px;height:20px}.univer-icon-item-list-wrap{padding:var(--padding-base) 4px var(--padding-base) var(--padding-base);font-size:var(--font-size-xs);background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-icon-item-list-wrap .univer-none{display:flex;align-items:center;margin-bottom:10px;cursor:pointer;padding-left:4px}.univer-icon-item-list-wrap .univer-none span{margin-left:8px}.univer-icon-item-list-wrap .univer-icon-item-list{display:flex;width:252px;flex-wrap:wrap}.univer-icon-item-list-wrap .univer-icon-item-list .univer-item{display:flex;align-items:center;justify-content:center;border-radius:var(--border-radius-base);margin-right:8px;margin-bottom:8px;cursor:pointer}.univer-icon-item-list-wrap .univer-icon-item-list .univer-item:hover{background-color:rgb(var(--bg-color-hover))}.univer-icon-item-list-wrap .univer-icon-item-list .univer-icon{width:20px;height:20px}.univer-width100{width:100%}.univer-stress{color:rgb(var(--text-color));font-weight:500}.univer-cf-style-edit{display:flex;justify-content:space-between;margin:10px 0}.univer-cf-style-edit .univer-button-item{cursor:pointer;border-radius:var(--border-radius-base);display:flex;align-items:center;padding:0 3px}.univer-cf-style-edit .univer-button-item:hover,.univer-cf-style-edit .univer-isActive{background-color:rgb(var(--grey-100))}
|
|
1
|
+
.univer-pointer-events-none{pointer-events:none}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-1{right:4px}.univer-my-2\.5{margin-top:10px;margin-bottom:10px}.univer-mb-1{margin-bottom:4px}.univer-mb-2{margin-bottom:8px}.univer-mb-2\.5{margin-bottom:10px}.univer-mb-3{margin-bottom:12px}.univer-ml-1{margin-left:4px}.univer-ml-1\.5{margin-left:6px}.univer-ml-2{margin-left:8px}.univer-ml-3{margin-left:12px}.univer-ml-6{margin-left:24px}.univer-mr-2{margin-right:8px}.univer-mt-0{margin-top:0}.univer-mt-1{margin-top:4px}.univer-mt-3{margin-top:12px}.univer-mt-4{margin-top:16px}.univer-mt-5{margin-top:20px}.univer-mt-6{margin-top:24px}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-hidden{display:none}.univer-size-4{width:16px;height:16px}.univer-size-5{width:20px;height:20px}.univer-size-6{width:24px;height:24px}.univer-h-5{height:20px}.univer-h-8{height:32px}.univer-h-full{height:100%}.univer-w-1\/2{width:50%}.univer-w-36{width:144px}.univer-w-64{width:256px}.univer-w-80{width:320px}.univer-w-\[45\%\]{width:45%}.univer-w-full{width:100%}.univer-min-w-0{min-width:0px}.univer-min-w-\[72px\]{min-width:72px}.univer-max-w-full{max-width:100%}.univer-flex-shrink{flex-shrink:1}.univer-flex-shrink-0{flex-shrink:0}.univer-cursor-grab{cursor:grab}.univer-cursor-pointer{cursor:pointer}.univer-flex-col{flex-direction:column}.univer-flex-wrap{flex-wrap:wrap}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-2{gap:8px}.univer-gap-4{gap:16px}.univer-overflow-hidden{overflow:hidden}.univer-rounded{border-radius:4px}.univer-rounded-lg{border-radius:8px}.univer-rounded-md{border-radius:6px}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{border-color:var(--univer-gray-200)}.univer-border-red-500{border-color:var(--univer-red-500)}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-white{background-color:var(--univer-white)}.univer-fill-primary-600{fill:var(--univer-primary-600)}.univer-p-1{padding:4px}.univer-p-4{padding:16px}.univer-px-1{padding-left:4px;padding-right:4px}.univer-px-4{padding-left:16px;padding-right:16px}.univer-py-2{padding-top:8px;padding-bottom:8px}.univer-pl-1{padding-left:4px}.univer-pl-5{padding-left:20px}.univer-pr-8{padding-right:32px}.univer-pt-2{padding-top:8px}.univer-text-\[10px\]{font-size:10px}.univer-text-sm{font-size:14px;line-height:20px}.univer-text-xs{font-size:12px;line-height:16px}.univer-font-bold{font-weight:700}.univer-font-medium{font-weight:500}.univer-italic{font-style:italic}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-red-500{color:var(--univer-red-500)}.univer-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:univer-border-primary-600:hover{border-color:var(--univer-primary-600)}.hover\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.univer-group:hover .group-hover\:univer-flex{display:flex}.dark\:univer-border-gray-600:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)}.dark\:univer-bg-gray-700:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)}.dark\:univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)}.\[\&\>div\:first-child\]\:univer-px-2\.5>div:first-child{padding-left:10px;padding-right:10px}.\[\&\>div\]\:univer-h-5>div{height:20px}.\[\&\>div\]\:univer-ring-transparent>div{--tw-ring-color: transparent }.\[\&_\.react-grid-item\]\:univer-transition-none .react-grid-item{transition-property:none}.\[\&_\.react-grid-placeholder\]\:univer-rounded .react-grid-placeholder{border-radius:4px}.\[\&_\.react-grid-placeholder\]\:\!univer-bg-gray-200 .react-grid-placeholder{background-color:var(--univer-gray-200)!important}
|
package/lib/umd/index.js
CHANGED
|
@@ -7,159 +7,82 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets-conditional-formatting-ui/index
|
|
10
|
-
(function(K,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("react/jsx-runtime"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui"),require("react-dom"),require("rxjs"),require("@univerjs/sheets-formula-ui"),require("@univerjs/engine-render"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-ui","react-dom","rxjs","@univerjs/sheets-formula-ui","@univerjs/engine-render","rxjs/operators"],w):(K=typeof globalThis<"u"?globalThis:K||self,w(K.UniverSheetsConditionalFormattingUi={},K.UniverCore,K.UniverSheetsConditionalFormatting,K.UniverSheets,K.UniverUi,K.React,K.React,K.UniverDesign,K.UniverEngineFormula,K.UniverSheetsUi,K.ReactDOM,K.rxjs,K.UniverSheetsFormulaUi,K.UniverEngineRender,K.rxjs.operators))})(this,function(K,w,u,Y,te,_,V,Z,kt,pe,At,Ce,Ge,hr,qe){"use strict";var mo=Object.defineProperty;var yo=(K,w,u)=>w in K?mo(K,w,{enumerable:!0,configurable:!0,writable:!0,value:u}):K[w]=u;var xe=(K,w,u)=>yo(K,typeof w!="symbol"?w+"":w,u);const Wt={type:w.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,c=e.get(u.ConditionalFormattingRuleModel),y=e.get(w.ICommandService),h=e.get(w.IUniverInstanceService),T=Y.getSheetCommandTarget(h);if(!T)return!1;const{unitId:m,subUnitId:C}=T,E=c.createCfId(m,C),R={ranges:n,cfId:E,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.average,operator:o,style:r}};return y.executeCommand(u.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:R})}},jt={type:w.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:a}=t,o=e.get(u.ConditionalFormattingRuleModel),c=e.get(w.ICommandService),y=e.get(w.IUniverInstanceService),h=Y.getSheetCommandTarget(y);if(!h)return!1;const{unitId:T,subUnitId:m}=h,C=o.createCfId(T,m),E={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:u.CFRuleType.colorScale,config:r}};return c.executeCommand(u.AddConditionalRuleMutation.id,{unitId:T,subUnitId:m,rule:E})}},Ht={type:w.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:a,nativeColor:o,positiveColor:c,isGradient:y,stopIfTrue:h,isShowValue:T}=t,m=e.get(u.ConditionalFormattingRuleModel),C=e.get(w.IUniverInstanceService),E=Y.getSheetCommandTarget(C);if(!E)return!1;const{unitId:R,subUnitId:I}=E,S=e.get(w.ICommandService),p=m.createCfId(R,I),i={ranges:n,cfId:p,stopIfTrue:!!h,rule:{type:u.CFRuleType.dataBar,isShowValue:T,config:{min:r,max:a,nativeColor:o,positiveColor:c,isGradient:y}}};return S.executeCommand(u.AddConditionalRuleMutation.id,{unitId:R,subUnitId:I,rule:i})}},Bt={type:w.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(u.ConditionalFormattingRuleModel),c=e.get(w.ICommandService),y=e.get(w.IUniverInstanceService),h=Y.getSheetCommandTarget(y);if(!h)return!1;const{unitId:T,subUnitId:m}=h,C=o.createCfId(T,m),E={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.duplicateValues,style:r}};return c.executeCommand(u.AddConditionalRuleMutation.id,{unitId:T,subUnitId:m,rule:E})}},Ft={type:w.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:c}=t,y=e.get(u.ConditionalFormattingRuleModel),h=e.get(w.ICommandService),T=e.get(w.IUniverInstanceService),m=Y.getSheetCommandTarget(T);if(!m)return!1;const{unitId:C,subUnitId:E}=m,R=y.createCfId(C,E);let I;if([u.CFNumberOperator.between,u.CFNumberOperator.notBetween].includes(o)){const S=c;if(S.length!==2||!Array.isArray(S))return!1;I={ranges:n,cfId:R,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:o,style:r,value:S}}}else{const S=c;if(typeof S!="number")return!1;I={ranges:n,cfId:R,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.number,operator:o,style:r,value:S}}}return h.executeCommand(u.AddConditionalRuleMutation.id,{unitId:C,subUnitId:E,rule:I})}},Gt={type:w.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,isPercent:o,isBottom:c,value:y}=t,h=e.get(u.ConditionalFormattingRuleModel),T=e.get(w.IUniverInstanceService),m=e.get(w.ICommandService),C=Y.getSheetCommandTarget(T);if(!C)return!1;const{unitId:E,subUnitId:R}=C,I=h.createCfId(E,R),S={ranges:n,cfId:I,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:o,isBottom:c,style:r,value:y}};return m.executeCommand(u.AddConditionalRuleMutation.id,{unitId:E,subUnitId:R,rule:S})}},qt={type:w.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:c}=t,y=e.get(u.ConditionalFormattingRuleModel),h=e.get(w.IUniverInstanceService),T=Y.getSheetCommandTarget(h);if(!T)return!1;const{unitId:m,subUnitId:C}=T,E=e.get(w.ICommandService),R=y.createCfId(m,C),I={ranges:n,cfId:R,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.text,operator:o,style:r,value:c}};return E.executeCommand(u.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:I})}},Xt={type:w.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,c=e.get(u.ConditionalFormattingRuleModel),y=e.get(w.IUniverInstanceService),h=e.get(w.ICommandService),T=Y.getSheetCommandTarget(y);if(!T)return!1;const{unitId:m,subUnitId:C}=T,E=c.createCfId(m,C),R={ranges:n,cfId:E,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.timePeriod,operator:o,style:r}};return h.executeCommand(u.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:R})}},Yt={type:w.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(u.ConditionalFormattingRuleModel),c=e.get(w.IUniverInstanceService),y=e.get(w.ICommandService),h=Y.getSheetCommandTarget(c);if(!h)return!1;const{unitId:T,subUnitId:m}=h,C=o.createCfId(T,m),E={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.uniqueValues,style:r}};return y.executeCommand(u.AddConditionalRuleMutation.id,{unitId:T,subUnitId:m,rule:E})}},A={conditionalFormattingWrap:"univer-conditional-formatting-wrap",title:"univer-title",label:"univer-label",labelContainer:"univer-label-container",mTBase:"univer-m-t-base",mTSm:"univer-m-t-sm",mTXl:"univer-m-t-xl",mLSm:"univer-m-l-sm",mLXl:"univer-m-l-xl",mLXxs:"univer-m-l-xxs",mL0:"univer-m-l-0",mR0:"univer-m-r-0"};var be=function(){return be=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},be.apply(this,arguments)},_n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},Ue=V.forwardRef(function(e,t){var n=e.icon,r=e.id,a=e.className,o=e.extend,c=_n(e,["icon","id","className","extend"]),y="univerjs-icon univerjs-icon-".concat(r," ").concat(a||"").trim(),h=V.useRef("_".concat(On()));return gr(n,"".concat(r),{defIds:n.defIds,idSuffix:h.current},be({ref:t,className:y},c),o)});function gr(e,t,n,r,a){return V.createElement(e.tag,be(be({key:t},Rn(e,n,a)),r),(En(e,n).children||[]).map(function(o,c){return gr(o,"".concat(t,"-").concat(e.tag,"-").concat(c),n,void 0,a)}))}function Rn(e,t,n){var r=be({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),e.tag==="mask"&&r.id&&(r.id=r.id+t.idSuffix),Object.entries(r).forEach(function(o){var c=o[0],y=o[1];c==="mask"&&typeof y=="string"&&(r[c]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var a=t.defIds;return!a||a.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(o){var c=o[0],y=o[1];typeof y=="string"&&(r[c]=y.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function En(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?be(be({},e),{children:e.children.map(function(a){return typeof a.attrs.id=="string"&&r&&r.indexOf(a.attrs.id)>-1?be(be({},a),{attrs:be(be({},a.attrs),{id:a.attrs.id+t.idSuffix})}):a})}):e}function On(){return Math.random().toString(36).substring(2,8)}Ue.displayName="UniverIcon";var Pn={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"}}]},gt=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"delete-single",ref:t,icon:Pn}))});gt.displayName="DeleteSingle";var xn={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"}}]},vr=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"increase-single",ref:t,icon:xn}))});vr.displayName="IncreaseSingle";var Dn={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"}}]},vt=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"more-down-single",ref:t,icon:Dn}))});vt.displayName="MoreDownSingle";var Mn={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"}}]}]},mr=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"sequence-single",ref:t,icon:Mn}))});mr.displayName="SequenceSingle";var Nn={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"}}]}]},Xe=V.forwardRef(function(e,t){return V.createElement(Ue,Object.assign({},e,{id:"slash-single",ref:t,icon:Nn}))});Xe.displayName="SlashSingle";function Ln(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yr(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Kt={exports:{}},Ye={},Ke={exports:{}},Vn=Ke.exports,br;function Zt(){return br||(br=1,function(e,t){(function(n,r){r(t)})(Vn,function(n){function r(H){return function(se,P,x,N,k,G,j){return H(se,P,j)}}function a(H){return function(se,P,x,N){if(!se||!P||typeof se!="object"||typeof P!="object")return H(se,P,x,N);var k=N.get(se),G=N.get(P);if(k&&G)return k===P&&G===se;N.set(se,P),N.set(P,se);var j=H(se,P,x,N);return N.delete(se),N.delete(P),j}}function o(H,J){var se={};for(var P in H)se[P]=H[P];for(var P in J)se[P]=J[P];return se}function c(H){return H.constructor===Object||H.constructor==null}function y(H){return typeof H.then=="function"}function h(H,J){return H===J||H!==H&&J!==J}var T="[object Arguments]",m="[object Boolean]",C="[object Date]",E="[object RegExp]",R="[object Map]",I="[object Number]",S="[object Object]",p="[object Set]",i="[object String]",s=Object.prototype.toString;function f(H){var J=H.areArraysEqual,se=H.areDatesEqual,P=H.areMapsEqual,x=H.areObjectsEqual,N=H.areRegExpsEqual,k=H.areSetsEqual,G=H.createIsNestedEqual,j=G(Q);function Q(X,re,de){if(X===re)return!0;if(!X||!re||typeof X!="object"||typeof re!="object")return X!==X&&re!==re;if(c(X)&&c(re))return x(X,re,j,de);var Le=Array.isArray(X),Se=Array.isArray(re);if(Le||Se)return Le===Se&&J(X,re,j,de);var me=s.call(X);return me!==s.call(re)?!1:me===C?se(X,re,j,de):me===E?N(X,re,j,de):me===R?P(X,re,j,de):me===p?k(X,re,j,de):me===S||me===T?y(X)||y(re)?!1:x(X,re,j,de):me===m||me===I||me===i?h(X.valueOf(),re.valueOf()):!1}return Q}function b(H,J,se,P){var x=H.length;if(J.length!==x)return!1;for(;x-- >0;)if(!se(H[x],J[x],x,x,H,J,P))return!1;return!0}var l=a(b);function g(H,J){return h(H.valueOf(),J.valueOf())}function d(H,J,se,P){var x=H.size===J.size;if(!x)return!1;if(!H.size)return!0;var N={},k=0;return H.forEach(function(G,j){if(x){var Q=!1,X=0;J.forEach(function(re,de){!Q&&!N[X]&&(Q=se(j,de,k,X,H,J,P)&&se(G,re,j,de,H,J,P))&&(N[X]=!0),X++}),k++,x=Q}}),x}var v=a(d),D="_owner",M=Object.prototype.hasOwnProperty;function U(H,J,se,P){var x=Object.keys(H),N=x.length;if(Object.keys(J).length!==N)return!1;for(var k;N-- >0;){if(k=x[N],k===D){var G=!!H.$$typeof,j=!!J.$$typeof;if((G||j)&&G!==j)return!1}if(!M.call(J,k)||!se(H[k],J[k],k,k,H,J,P))return!1}return!0}var z=a(U);function O(H,J){return H.source===J.source&&H.flags===J.flags}function L(H,J,se,P){var x=H.size===J.size;if(!x)return!1;if(!H.size)return!0;var N={};return H.forEach(function(k,G){if(x){var j=!1,Q=0;J.forEach(function(X,re){!j&&!N[Q]&&(j=se(k,X,G,re,H,J,P))&&(N[Q]=!0),Q++}),x=j}}),x}var B=a(L),q=Object.freeze({areArraysEqual:b,areDatesEqual:g,areMapsEqual:d,areObjectsEqual:U,areRegExpsEqual:O,areSetsEqual:L,createIsNestedEqual:r}),$=Object.freeze({areArraysEqual:l,areDatesEqual:g,areMapsEqual:v,areObjectsEqual:z,areRegExpsEqual:O,areSetsEqual:B,createIsNestedEqual:r}),ie=f(q);function oe(H,J){return ie(H,J,void 0)}var ce=f(o(q,{createIsNestedEqual:function(){return h}}));function W(H,J){return ce(H,J,void 0)}var ee=f($);function ne(H,J){return ee(H,J,new WeakMap)}var le=f(o($,{createIsNestedEqual:function(){return h}}));function fe(H,J){return le(H,J,new WeakMap)}function ve(H){return f(o(q,H(q)))}function Te(H){var J=f(o($,H($)));return function(se,P,x){return x===void 0&&(x=new WeakMap),J(se,P,x)}}n.circularDeepEqual=ne,n.circularShallowEqual=fe,n.createCustomCircularEqual=Te,n.createCustomEqual=ve,n.deepEqual=oe,n.sameValueZeroEqual=h,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})}(Ke,Ke.exports)),Ke.exports}var mt={exports:{}},Sr;function $t(){if(Sr)return mt.exports;Sr=1;function e(n){var r,a,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r<c;r++)n[r]&&(a=e(n[r]))&&(o&&(o+=" "),o+=a)}else for(a in n)n[a]&&(o&&(o+=" "),o+=a);return o}function t(){for(var n,r,a=0,o="",c=arguments.length;a<c;a++)(n=arguments[a])&&(r=e(n))&&(o&&(o+=" "),o+=r);return o}return mt.exports=t,mt.exports.clsx=t,mt.exports}var ae={},Jt,Cr;function Un(){return Cr||(Cr=1,Jt=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)}),Jt}var Tr;function ze(){if(Tr)return ae;Tr=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.bottom=r,ae.childrenEqual=h,ae.cloneLayout=a,ae.cloneLayoutItem=y,ae.collides=m,ae.compact=C,ae.compactItem=I,ae.compactType=H,ae.correctBounds=S,ae.fastPositionEqual=T,ae.fastRGLPropsEqual=void 0,ae.getAllCollisions=s,ae.getFirstCollision=i,ae.getLayoutItem=p,ae.getStatics=f,ae.modifyLayout=o,ae.moveElement=b,ae.moveElementAwayFromCollision=l,ae.noop=void 0,ae.perc=g,ae.resizeItemInDirection=ce,ae.setTopLeft=ee,ae.setTransform=W,ae.sortLayoutItems=ne,ae.sortLayoutItemsByColRow=fe,ae.sortLayoutItemsByRowCol=le,ae.synchronizeLayoutWithChildren=ve,ae.validateLayout=Te,ae.withLayoutItem=c;var e=Zt(),t=n(V);function n(P){return P&&P.__esModule?P:{default:P}}function r(P){let x=0,N;for(let k=0,G=P.length;k<G;k++)N=P[k].y+P[k].h,N>x&&(x=N);return x}function a(P){const x=Array(P.length);for(let N=0,k=P.length;N<k;N++)x[N]=y(P[N]);return x}function o(P,x){const N=Array(P.length);for(let k=0,G=P.length;k<G;k++)x.i===P[k].i?N[k]=x:N[k]=P[k];return N}function c(P,x,N){let k=p(P,x);return k?(k=N(y(k)),P=o(P,k),[P,k]):[P,null]}function y(P){return{w:P.w,h:P.h,x:P.x,y:P.y,i:P.i,minW:P.minW,maxW:P.maxW,minH:P.minH,maxH:P.maxH,moved:!!P.moved,static:!!P.static,isDraggable:P.isDraggable,isResizable:P.isResizable,resizeHandles:P.resizeHandles,isBounded:P.isBounded}}function h(P,x){return(0,e.deepEqual)(t.default.Children.map(P,N=>N==null?void 0:N.key),t.default.Children.map(x,N=>N==null?void 0:N.key))&&(0,e.deepEqual)(t.default.Children.map(P,N=>N==null?void 0:N.props["data-grid"]),t.default.Children.map(x,N=>N==null?void 0:N.props["data-grid"]))}ae.fastRGLPropsEqual=Un();function T(P,x){return P.left===x.left&&P.top===x.top&&P.width===x.width&&P.height===x.height}function m(P,x){return!(P.i===x.i||P.x+P.w<=x.x||P.x>=x.x+x.w||P.y+P.h<=x.y||P.y>=x.y+x.h)}function C(P,x,N,k){const G=f(P),j=ne(P,x),Q=Array(P.length);for(let X=0,re=j.length;X<re;X++){let de=y(j[X]);de.static||(de=I(G,de,x,N,j,k),G.push(de)),Q[P.indexOf(j[X])]=de,de.moved=!1}return Q}const E={x:"w",y:"h"};function R(P,x,N,k){const G=E[k];x[k]+=1;const j=P.map(Q=>Q.i).indexOf(x.i);for(let Q=j+1;Q<P.length;Q++){const X=P[Q];if(!X.static){if(X.y>x.y+x.h)break;m(x,X)&&R(P,X,N+x[G],k)}}x[k]=N}function I(P,x,N,k,G,j){const Q=N==="vertical",X=N==="horizontal";if(Q)for(x.y=Math.min(r(P),x.y);x.y>0&&!i(P,x);)x.y--;else if(X)for(;x.x>0&&!i(P,x);)x.x--;let re;for(;(re=i(P,x))&&!(N===null&&j);)if(X?R(G,x,re.x+re.w,"x"):R(G,x,re.y+re.h,"y"),X&&x.x+x.w>k)for(x.x=k-x.w,x.y++;x.x>0&&!i(P,x);)x.x--;return x.y=Math.max(x.y,0),x.x=Math.max(x.x,0),x}function S(P,x){const N=f(P);for(let k=0,G=P.length;k<G;k++){const j=P[k];if(j.x+j.w>x.cols&&(j.x=x.cols-j.w),j.x<0&&(j.x=0,j.w=x.cols),!j.static)N.push(j);else for(;i(N,j);)j.y++}return P}function p(P,x){for(let N=0,k=P.length;N<k;N++)if(P[N].i===x)return P[N]}function i(P,x){for(let N=0,k=P.length;N<k;N++)if(m(P[N],x))return P[N]}function s(P,x){return P.filter(N=>m(N,x))}function f(P){return P.filter(x=>x.static)}function b(P,x,N,k,G,j,Q,X,re){if(x.static&&x.isDraggable!==!0||x.y===k&&x.x===N)return P;`${x.i}${String(N)}${String(k)}${x.x}${x.y}`;const de=x.x,Le=x.y;typeof N=="number"&&(x.x=N),typeof k=="number"&&(x.y=k),x.moved=!0;let Se=ne(P,Q);(Q==="vertical"&&typeof k=="number"?Le>=k:Q==="horizontal"&&typeof N=="number"?de>=N:!1)&&(Se=Se.reverse());const Fe=s(Se,x),zt=Fe.length>0;if(zt&&re)return a(P);if(zt&&j)return`${x.i}`,x.x=de,x.y=Le,x.moved=!1,P;for(let pr=0,vo=Fe.length;pr<vo;pr++){const Ve=Fe[pr];`${x.i}${x.x}${x.y}${Ve.i}${Ve.x}${Ve.y}`,!Ve.moved&&(Ve.static?P=l(P,Ve,x,G,Q):P=l(P,x,Ve,G,Q))}return P}function l(P,x,N,k,G,j){const Q=G==="horizontal",X=G==="vertical",re=x.static;if(k){k=!1;const Se={x:Q?Math.max(x.x-N.w,0):N.x,y:X?Math.max(x.y-N.h,0):N.y,w:N.w,h:N.h,i:"-1"},me=i(P,Se),Fe=me&&me.y+me.h>x.y,zt=me&&x.x+x.w>me.x;if(me){if(Fe&&X)return b(P,N,void 0,x.y+1,k,re,G);if(Fe&&G==null)return x.y=N.y,N.y=N.y+N.h,P;if(zt&&Q)return b(P,x,N.x,void 0,k,re,G)}else return`${N.i}${Se.x}${Se.y}`,b(P,N,Q?Se.x:void 0,X?Se.y:void 0,k,re,G)}const de=Q?N.x+1:void 0,Le=X?N.y+1:void 0;return de==null&&Le==null?P:b(P,N,Q?N.x+1:void 0,X?N.y+1:void 0,k,re,G)}function g(P){return P*100+"%"}const d=(P,x,N,k)=>P+N>k?x:N,v=(P,x,N)=>P<0?x:N,D=P=>Math.max(0,P),M=P=>Math.max(0,P),U=(P,x,N)=>{let{left:k,height:G,width:j}=x;const Q=P.top-(G-P.height);return{left:k,width:j,height:v(Q,P.height,G),top:M(Q)}},z=(P,x,N)=>{let{top:k,left:G,height:j,width:Q}=x;return{top:k,height:j,width:d(P.left,P.width,Q,N),left:D(G)}},O=(P,x,N)=>{let{top:k,height:G,width:j}=x;const Q=P.left-(j-P.width);return{height:G,width:Q<0?P.width:d(P.left,P.width,j,N),top:M(k),left:D(Q)}},L=(P,x,N)=>{let{top:k,left:G,height:j,width:Q}=x;return{width:Q,left:G,height:v(k,P.height,j),top:M(k)}},oe={n:U,ne:function(){return U(arguments.length<=0?void 0:arguments[0],z(...arguments))},e:z,se:function(){return L(arguments.length<=0?void 0:arguments[0],z(...arguments))},s:L,sw:function(){return L(arguments.length<=0?void 0:arguments[0],O(...arguments))},w:O,nw:function(){return U(arguments.length<=0?void 0:arguments[0],O(...arguments))}};function ce(P,x,N,k){const G=oe[P];return G?G(x,{...x,...N},k):N}function W(P){let{top:x,left:N,width:k,height:G}=P;const j=`translate(${N}px,${x}px)`;return{transform:j,WebkitTransform:j,MozTransform:j,msTransform:j,OTransform:j,width:`${k}px`,height:`${G}px`,position:"absolute"}}function ee(P){let{top:x,left:N,width:k,height:G}=P;return{top:`${x}px`,left:`${N}px`,width:`${k}px`,height:`${G}px`,position:"absolute"}}function ne(P,x){return x==="horizontal"?fe(P):x==="vertical"?le(P):P}function le(P){return P.slice(0).sort(function(x,N){return x.y>N.y||x.y===N.y&&x.x>N.x?1:x.y===N.y&&x.x===N.x?0:-1})}function fe(P){return P.slice(0).sort(function(x,N){return x.x>N.x||x.x===N.x&&x.y>N.y?1:-1})}function ve(P,x,N,k,G){P=P||[];const j=[];t.default.Children.forEach(x,X=>{if((X==null?void 0:X.key)==null)return;const re=p(P,String(X.key)),de=X.props["data-grid"];re&&de==null?j.push(y(re)):de?j.push(y({...de,i:X.key})):j.push(y({w:1,h:1,x:0,y:r(j),i:String(X.key)}))});const Q=S(j,{cols:N});return G?Q:C(Q,k,N)}function Te(P){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const N=["x","y","w","h"];if(!Array.isArray(P))throw new Error(x+" must be an array!");for(let k=0,G=P.length;k<G;k++){const j=P[k];for(let Q=0;Q<N.length;Q++){const X=N[Q],re=j[X];if(typeof re!="number"||Number.isNaN(re))throw new Error(`ReactGridLayout: ${x}[${k}].${X} must be a number! Received: ${re} (${typeof re})`)}if(typeof j.i<"u"&&typeof j.i!="string")throw new Error(`ReactGridLayout: ${x}[${k}].i must be a string! Received: ${j.i} (${typeof j.i})`)}}function H(P){const{verticalCompact:x,compactType:N}=P||{};return x===!1?null:N}function J(){}const se=()=>{};return ae.noop=se,ae}var Ie={},wr;function Qt(){if(wr)return Ie;wr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.calcGridColWidth=e,Ie.calcGridItemPosition=n,Ie.calcGridItemWHPx=t,Ie.calcWH=a,Ie.calcXY=r,Ie.clamp=o;function e(c){const{margin:y,containerPadding:h,containerWidth:T,cols:m}=c;return(T-y[0]*(m-1)-h[0]*2)/m}function t(c,y,h){return Number.isFinite(c)?Math.round(y*c+Math.max(0,c-1)*h):c}function n(c,y,h,T,m,C){const{margin:E,containerPadding:R,rowHeight:I}=c,S=e(c),p={};return C&&C.resizing?(p.width=Math.round(C.resizing.width),p.height=Math.round(C.resizing.height)):(p.width=t(T,S,E[0]),p.height=t(m,I,E[1])),C&&C.dragging?(p.top=Math.round(C.dragging.top),p.left=Math.round(C.dragging.left)):C&&C.resizing&&typeof C.resizing.top=="number"&&typeof C.resizing.left=="number"?(p.top=Math.round(C.resizing.top),p.left=Math.round(C.resizing.left)):(p.top=Math.round((I+E[1])*h+R[1]),p.left=Math.round((S+E[0])*y+R[0])),p}function r(c,y,h,T,m){const{margin:C,containerPadding:E,cols:R,rowHeight:I,maxRows:S}=c,p=e(c);let i=Math.round((h-E[0])/(p+C[0])),s=Math.round((y-E[1])/(I+C[1]));return i=o(i,0,R-T),s=o(s,0,S-m),{x:i,y:s}}function a(c,y,h,T,m,C){const{margin:E,maxRows:R,cols:I,rowHeight:S}=c,p=e(c);let i=Math.round((y+E[0])/(p+E[0])),s=Math.round((h+E[1])/(S+E[1])),f=o(i,0,I-T),b=o(s,0,R-m);return["sw","w","nw"].indexOf(C)!==-1&&(f=o(i,0,I)),["nw","n","ne"].indexOf(C)!==-1&&(b=o(s,0,R)),{w:f,h:b}}function o(c,y,h){return Math.max(Math.min(c,h),y)}return Ie}var Ze={},er={exports:{}},tr,Ir;function zn(){if(Ir)return tr;Ir=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return tr=e,tr}var rr,_r;function kn(){if(_r)return rr;_r=1;var e=zn();function t(){}function n(){}return n.resetWarningCache=t,rr=function(){function r(c,y,h,T,m,C){if(C!==e){var E=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 E.name="Invariant Violation",E}}r.isRequired=r;function a(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},rr}var Rr;function Ee(){return Rr||(Rr=1,er.exports=kn()()),er.exports}var $e={exports:{}},nr={};function Er(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Er(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Or(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Er(e))&&(r&&(r+=" "),r+=t);return r}const An=yr(Object.freeze(Object.defineProperty({__proto__:null,clsx:Or,default:Or},Symbol.toStringTag,{value:"Module"})));var he={},Oe={},Pr;function yt(){if(Pr)return Oe;Pr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.dontSetMe=a,Oe.findInArray=e,Oe.int=r,Oe.isFunction=t,Oe.isNum=n;function e(o,c){for(let y=0,h=o.length;y<h;y++)if(c.apply(c,[o[y],y,o]))return o[y]}function t(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Function]"}function n(o){return typeof o=="number"&&!isNaN(o)}function r(o){return parseInt(o,10)}function a(o,c,y){if(o[c])return new Error("Invalid prop ".concat(c," passed to ").concat(y," - do not set this, set it on the child."))}return Oe}var Pe={},xr;function Wn(){if(xr)return Pe;xr=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.browserPrefixToKey=n,Pe.browserPrefixToStyle=r,Pe.default=void 0,Pe.getPrefix=t;const e=["Moz","Webkit","O","ms"];function t(){var o;let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const y=(o=window.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.style;if(!y||c in y)return"";for(let h=0;h<e.length;h++)if(n(c,e[h])in y)return e[h];return""}function n(o,c){return c?"".concat(c).concat(a(o)):o}function r(o,c){return c?"-".concat(c.toLowerCase(),"-").concat(o):o}function a(o){let c="",y=!0;for(let h=0;h<o.length;h++)y?(c+=o[h].toUpperCase(),y=!1):o[h]==="-"?y=!0:c+=o[h];return c}return Pe.default=t(),Pe}var Dr;function ar(){if(Dr)return he;Dr=1,Object.defineProperty(he,"__esModule",{value:!0}),he.addClassName=l,he.addEvent=y,he.addUserSelectStyles=f,he.createCSSTransform=I,he.createSVGTransform=S,he.getTouch=i,he.getTouchIdentifier=s,he.getTranslation=p,he.innerHeight=C,he.innerWidth=E,he.matchesSelector=o,he.matchesSelectorAndParentsTo=c,he.offsetXYFromParent=R,he.outerHeight=T,he.outerWidth=m,he.removeClassName=g,he.removeEvent=h,he.removeUserSelectStyles=b;var e=yt(),t=r(Wn());function n(d){if(typeof WeakMap!="function")return null;var v=new WeakMap,D=new WeakMap;return(n=function(M){return M?D:v})(d)}function r(d,v){if(d&&d.__esModule)return d;if(d===null||typeof d!="object"&&typeof d!="function")return{default:d};var D=n(v);if(D&&D.has(d))return D.get(d);var M={},U=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var z in d)if(z!=="default"&&Object.prototype.hasOwnProperty.call(d,z)){var O=U?Object.getOwnPropertyDescriptor(d,z):null;O&&(O.get||O.set)?Object.defineProperty(M,z,O):M[z]=d[z]}return M.default=d,D&&D.set(d,M),M}let a="";function o(d,v){return a||(a=(0,e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(D){return(0,e.isFunction)(d[D])})),(0,e.isFunction)(d[a])?d[a](v):!1}function c(d,v,D){let M=d;do{if(o(M,v))return!0;if(M===D)return!1;M=M.parentNode}while(M);return!1}function y(d,v,D,M){if(!d)return;const U={capture:!0,...M};d.addEventListener?d.addEventListener(v,D,U):d.attachEvent?d.attachEvent("on"+v,D):d["on"+v]=D}function h(d,v,D,M){if(!d)return;const U={capture:!0,...M};d.removeEventListener?d.removeEventListener(v,D,U):d.detachEvent?d.detachEvent("on"+v,D):d["on"+v]=null}function T(d){let v=d.clientHeight;const D=d.ownerDocument.defaultView.getComputedStyle(d);return v+=(0,e.int)(D.borderTopWidth),v+=(0,e.int)(D.borderBottomWidth),v}function m(d){let v=d.clientWidth;const D=d.ownerDocument.defaultView.getComputedStyle(d);return v+=(0,e.int)(D.borderLeftWidth),v+=(0,e.int)(D.borderRightWidth),v}function C(d){let v=d.clientHeight;const D=d.ownerDocument.defaultView.getComputedStyle(d);return v-=(0,e.int)(D.paddingTop),v-=(0,e.int)(D.paddingBottom),v}function E(d){let v=d.clientWidth;const D=d.ownerDocument.defaultView.getComputedStyle(d);return v-=(0,e.int)(D.paddingLeft),v-=(0,e.int)(D.paddingRight),v}function R(d,v,D){const U=v===v.ownerDocument.body?{left:0,top:0}:v.getBoundingClientRect(),z=(d.clientX+v.scrollLeft-U.left)/D,O=(d.clientY+v.scrollTop-U.top)/D;return{x:z,y:O}}function I(d,v){const D=p(d,v,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:D}}function S(d,v){return p(d,v,"")}function p(d,v,D){let{x:M,y:U}=d,z="translate(".concat(M).concat(D,",").concat(U).concat(D,")");if(v){const O="".concat(typeof v.x=="string"?v.x:v.x+D),L="".concat(typeof v.y=="string"?v.y:v.y+D);z="translate(".concat(O,", ").concat(L,")")+z}return z}function i(d,v){return d.targetTouches&&(0,e.findInArray)(d.targetTouches,D=>v===D.identifier)||d.changedTouches&&(0,e.findInArray)(d.changedTouches,D=>v===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 v=d.getElementById("react-draggable-style-el");v||(v=d.createElement("style"),v.type="text/css",v.id="react-draggable-style-el",v.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
11
|
-
|
|
12
|
-
`,d.getElementsByTagName("head")[0].appendChild(v)),d.body&&l(d.body,"react-draggable-transparent-selection")}function b(d){if(d)try{if(d.body&&g(d.body,"react-draggable-transparent-selection"),d.selection)d.selection.empty();else{const v=(d.defaultView||window).getSelection();v&&v.type!=="Caret"&&v.removeAllRanges()}}catch{}}function l(d,v){d.classList?d.classList.add(v):d.className.match(new RegExp("(?:^|\\s)".concat(v,"(?!\\S)")))||(d.className+=" ".concat(v))}function g(d,v){d.classList?d.classList.remove(v):d.className=d.className.replace(new RegExp("(?:^|\\s)".concat(v,"(?!\\S)"),"g"),"")}return he}var we={},Mr;function Nr(){if(Mr)return we;Mr=1,Object.defineProperty(we,"__esModule",{value:!0}),we.canDragX=a,we.canDragY=o,we.createCoreData=y,we.createDraggableData=h,we.getBoundPosition=n,we.getControlPosition=c,we.snapToGrid=r;var e=yt(),t=ar();function n(C,E,R){if(!C.props.bounds)return[E,R];let{bounds:I}=C.props;I=typeof I=="string"?I:T(I);const S=m(C);if(typeof I=="string"){const{ownerDocument:p}=S,i=p.defaultView;let s;if(I==="parent"?s=S.parentNode:s=p.querySelector(I),!(s instanceof i.HTMLElement))throw new Error('Bounds selector "'+I+'" could not find an element.');const f=s,b=i.getComputedStyle(S),l=i.getComputedStyle(f);I={left:-S.offsetLeft+(0,e.int)(l.paddingLeft)+(0,e.int)(b.marginLeft),top:-S.offsetTop+(0,e.int)(l.paddingTop)+(0,e.int)(b.marginTop),right:(0,t.innerWidth)(f)-(0,t.outerWidth)(S)-S.offsetLeft+(0,e.int)(l.paddingRight)-(0,e.int)(b.marginRight),bottom:(0,t.innerHeight)(f)-(0,t.outerHeight)(S)-S.offsetTop+(0,e.int)(l.paddingBottom)-(0,e.int)(b.marginBottom)}}return(0,e.isNum)(I.right)&&(E=Math.min(E,I.right)),(0,e.isNum)(I.bottom)&&(R=Math.min(R,I.bottom)),(0,e.isNum)(I.left)&&(E=Math.max(E,I.left)),(0,e.isNum)(I.top)&&(R=Math.max(R,I.top)),[E,R]}function r(C,E,R){const I=Math.round(E/C[0])*C[0],S=Math.round(R/C[1])*C[1];return[I,S]}function a(C){return C.props.axis==="both"||C.props.axis==="x"}function o(C){return C.props.axis==="both"||C.props.axis==="y"}function c(C,E,R){const I=typeof E=="number"?(0,t.getTouch)(C,E):null;if(typeof E=="number"&&!I)return null;const S=m(R),p=R.props.offsetParent||S.offsetParent||S.ownerDocument.body;return(0,t.offsetXYFromParent)(I||C,p,R.props.scale)}function y(C,E,R){const I=!(0,e.isNum)(C.lastX),S=m(C);return I?{node:S,deltaX:0,deltaY:0,lastX:E,lastY:R,x:E,y:R}:{node:S,deltaX:E-C.lastX,deltaY:R-C.lastY,lastX:C.lastX,lastY:C.lastY,x:E,y:R}}function h(C,E){const R=C.props.scale;return{node:E.node,x:C.state.x+E.deltaX/R,y:C.state.y+E.deltaY/R,deltaX:E.deltaX/R,deltaY:E.deltaY/R,lastX:C.state.x,lastY:C.state.y}}function T(C){return{left:C.left,top:C.top,right:C.right,bottom:C.bottom}}function m(C){const E=C.findDOMNode();if(!E)throw new Error("<DraggableCore>: Unmounted during event!");return E}return we}var Je={},bt={},Lr;function Vr(){if(Lr)return bt;Lr=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.default=e;function e(){}return bt}var Ur;function jn(){if(Ur)return Je;Ur=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var e=T(V),t=y(Ee()),n=y(At),r=ar(),a=Nr(),o=yt(),c=y(Vr());function y(p){return p&&p.__esModule?p:{default:p}}function h(p){if(typeof WeakMap!="function")return null;var i=new WeakMap,s=new WeakMap;return(h=function(f){return f?s:i})(p)}function T(p,i){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=h(i);if(s&&s.has(p))return s.get(p);var f={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var g=b?Object.getOwnPropertyDescriptor(p,l):null;g&&(g.get||g.set)?Object.defineProperty(f,l,g):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function m(p,i,s){return i=C(i),i in p?Object.defineProperty(p,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[i]=s,p}function C(p){var i=E(p,"string");return typeof i=="symbol"?i:String(i)}function E(p,i){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,i);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(p)}const R={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let I=R.mouse,S=class extends e.Component{constructor(){super(...arguments),m(this,"dragging",!1),m(this,"lastX",NaN),m(this,"lastY",NaN),m(this,"touchIdentifier",null),m(this,"mounted",!1),m(this,"handleDragStart",i=>{if(this.props.onMouseDown(i),!this.props.allowAnyClick&&typeof i.button=="number"&&i.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||!(i.target instanceof f.defaultView.Node)||this.props.handle&&!(0,r.matchesSelectorAndParentsTo)(i.target,this.props.handle,s)||this.props.cancel&&(0,r.matchesSelectorAndParentsTo)(i.target,this.props.cancel,s))return;i.type==="touchstart"&&i.preventDefault();const b=(0,r.getTouchIdentifier)(i);this.touchIdentifier=b;const l=(0,a.getControlPosition)(i,b,this);if(l==null)return;const{x:g,y:d}=l,v=(0,a.createCoreData)(this,g,d);(0,c.default)("DraggableCore: handleDragStart: %j",v),(0,c.default)("calling",this.props.onStart),!(this.props.onStart(i,v)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,r.addUserSelectStyles)(f),this.dragging=!0,this.lastX=g,this.lastY=d,(0,r.addEvent)(f,I.move,this.handleDrag),(0,r.addEvent)(f,I.stop,this.handleDragStop))}),m(this,"handleDrag",i=>{const s=(0,a.getControlPosition)(i,this.touchIdentifier,this);if(s==null)return;let{x:f,y:b}=s;if(Array.isArray(this.props.grid)){let d=f-this.lastX,v=b-this.lastY;if([d,v]=(0,a.snapToGrid)(this.props.grid,d,v),!d&&!v)return;f=this.lastX+d,b=this.lastY+v}const l=(0,a.createCoreData)(this,f,b);if((0,c.default)("DraggableCore: handleDrag: %j",l),this.props.onDrag(i,l)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const v=document.createEvent("MouseEvents");v.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(v)}return}this.lastX=f,this.lastY=b}),m(this,"handleDragStop",i=>{if(!this.dragging)return;const s=(0,a.getControlPosition)(i,this.touchIdentifier,this);if(s==null)return;let{x:f,y:b}=s;if(Array.isArray(this.props.grid)){let v=f-this.lastX||0,D=b-this.lastY||0;[v,D]=(0,a.snapToGrid)(this.props.grid,v,D),f=this.lastX+v,b=this.lastY+D}const l=(0,a.createCoreData)(this,f,b);if(this.props.onStop(i,l)===!1||this.mounted===!1)return!1;const d=this.findDOMNode();d&&this.props.enableUserSelectHack&&(0,r.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,r.removeEvent)(d.ownerDocument,I.move,this.handleDrag),(0,r.removeEvent)(d.ownerDocument,I.stop,this.handleDragStop))}),m(this,"onMouseDown",i=>(I=R.mouse,this.handleDragStart(i))),m(this,"onMouseUp",i=>(I=R.mouse,this.handleDragStop(i))),m(this,"onTouchStart",i=>(I=R.touch,this.handleDragStart(i))),m(this,"onTouchEnd",i=>(I=R.touch,this.handleDragStop(i)))}componentDidMount(){this.mounted=!0;const i=this.findDOMNode();i&&(0,r.addEvent)(i,R.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const i=this.findDOMNode();if(i){const{ownerDocument:s}=i;(0,r.removeEvent)(s,R.mouse.move,this.handleDrag),(0,r.removeEvent)(s,R.touch.move,this.handleDrag),(0,r.removeEvent)(s,R.mouse.stop,this.handleDragStop),(0,r.removeEvent)(s,R.touch.stop,this.handleDragStop),(0,r.removeEvent)(i,R.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,r.removeUserSelectStyles)(s)}}findDOMNode(){var i,s;return(i=this.props)!==null&&i!==void 0&&i.nodeRef?(s=this.props)===null||s===void 0||(s=s.nodeRef)===null||s===void 0?void 0:s.current:n.default.findDOMNode(this)}render(){return e.cloneElement(e.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return Je.default=S,m(S,"displayName","DraggableCore"),m(S,"propTypes",{allowAnyClick:t.default.bool,children:t.default.node.isRequired,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:function(p,i){if(p[i]&&p[i].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:t.default.arrayOf(t.default.number),handle:t.default.string,cancel: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,className:o.dontSetMe,style:o.dontSetMe,transform:o.dontSetMe}),m(S,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),Je}var zr;function Hn(){return zr||(zr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return h.default}}),e.default=void 0;var t=E(V),n=m(Ee()),r=m(At),a=m(An),o=ar(),c=Nr(),y=yt(),h=m(jn()),T=m(Vr());function m(s){return s&&s.__esModule?s:{default:s}}function C(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,b=new WeakMap;return(C=function(l){return l?b:f})(s)}function E(s,f){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var b=C(f);if(b&&b.has(s))return b.get(s);var l={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var v=g?Object.getOwnPropertyDescriptor(s,d):null;v&&(v.get||v.set)?Object.defineProperty(l,d,v):l[d]=s[d]}return l.default=s,b&&b.set(s,l),l}function R(){return R=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var b=arguments[f];for(var l in b)Object.prototype.hasOwnProperty.call(b,l)&&(s[l]=b[l])}return s},R.apply(this,arguments)}function I(s,f,b){return f=S(f),f in s?Object.defineProperty(s,f,{value:b,enumerable:!0,configurable:!0,writable:!0}):s[f]=b,s}function S(s){var f=p(s,"string");return typeof f=="symbol"?f:String(f)}function p(s,f){if(typeof s!="object"||s===null)return s;var b=s[Symbol.toPrimitive];if(b!==void 0){var l=b.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 i extends t.Component{static getDerivedStateFromProps(f,b){let{position:l}=f,{prevPropsPosition:g}=b;return l&&(!g||l.x!==g.x||l.y!==g.y)?((0,T.default)("Draggable: getDerivedStateFromProps %j",{position:l,prevPropsPosition:g}),{x:l.x,y:l.y,prevPropsPosition:{...l}}):null}constructor(f){super(f),I(this,"onDragStart",(b,l)=>{if((0,T.default)("Draggable: onDragStart: %j",l),this.props.onStart(b,(0,c.createDraggableData)(this,l))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),I(this,"onDrag",(b,l)=>{if(!this.state.dragging)return!1;(0,T.default)("Draggable: onDrag: %j",l);const g=(0,c.createDraggableData)(this,l),d={x:g.x,y:g.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[U,z]=(0,c.getBoundPosition)(this,d.x,d.y);d.x=U,d.y=z,d.slackX=this.state.slackX+(D-d.x),d.slackY=this.state.slackY+(M-d.y),g.x=d.x,g.y=d.y,g.deltaX=d.x-this.state.x,g.deltaY=d.y-this.state.y}if(this.props.onDrag(b,g)===!1)return!1;this.setState(d)}),I(this,"onDragStop",(b,l)=>{if(!this.state.dragging||this.props.onStop(b,(0,c.createDraggableData)(this,l))===!1)return!1;(0,T.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,b;return(f=(b=this.props)===null||b===void 0||(b=b.nodeRef)===null||b===void 0?void 0:b.current)!==null&&f!==void 0?f:r.default.findDOMNode(this)}render(){const{axis:f,bounds:b,children:l,defaultPosition:g,defaultClassName:d,defaultClassNameDragging:v,defaultClassNameDragged:D,position:M,positionOffset:U,scale:z,...O}=this.props;let L={},B=null;const $=!!!M||this.state.dragging,ie=M||g,oe={x:(0,c.canDragX)(this)&&$?this.state.x:ie.x,y:(0,c.canDragY)(this)&&$?this.state.y:ie.y};this.state.isElementSVG?B=(0,o.createSVGTransform)(oe,U):L=(0,o.createCSSTransform)(oe,U);const ce=(0,a.default)(l.props.className||"",d,{[v]:this.state.dragging,[D]:this.state.dragged});return t.createElement(h.default,R({},O,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(l),{className:ce,style:{...l.props.style,...L},transform:B}))}}e.default=i,I(i,"displayName","Draggable"),I(i,"propTypes",{...h.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:y.dontSetMe,style:y.dontSetMe,transform:y.dontSetMe}),I(i,"defaultProps",{...h.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(nr)),nr}var kr;function or(){if(kr)return $e.exports;kr=1;const{default:e,DraggableCore:t}=Hn();return $e.exports=e,$e.exports.default=e,$e.exports.DraggableCore=t,$e.exports}var Qe={exports:{}},et={},St={},Ar;function Bn(){if(Ar)return St;Ar=1,St.__esModule=!0,St.cloneElement=y;var e=t(V);function t(h){return h&&h.__esModule?h:{default:h}}function n(h,T){var m=Object.keys(h);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(h);T&&(C=C.filter(function(E){return Object.getOwnPropertyDescriptor(h,E).enumerable})),m.push.apply(m,C)}return m}function r(h){for(var T=1;T<arguments.length;T++){var m=arguments[T]!=null?arguments[T]:{};T%2?n(Object(m),!0).forEach(function(C){a(h,C,m[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(m)):n(Object(m)).forEach(function(C){Object.defineProperty(h,C,Object.getOwnPropertyDescriptor(m,C))})}return h}function a(h,T,m){return T=o(T),T in h?Object.defineProperty(h,T,{value:m,enumerable:!0,configurable:!0,writable:!0}):h[T]=m,h}function o(h){var T=c(h,"string");return typeof T=="symbol"?T:String(T)}function c(h,T){if(typeof h!="object"||h===null)return h;var m=h[Symbol.toPrimitive];if(m!==void 0){var C=m.call(h,T);if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(T==="string"?String:Number)(h)}function y(h,T){return T.style&&h.props.style&&(T.style=r(r({},h.props.style),T.style)),T.className&&h.props.className&&(T.className=h.props.className+" "+T.className),e.default.cloneElement(h,T)}return St}var tt={},Wr;function jr(){if(Wr)return tt;Wr=1,tt.__esModule=!0,tt.resizableProps=void 0;var e=t(Ee());or();function t(r){return r&&r.__esModule?r:{default:r}}var n={axis:e.default.oneOf(["both","x","y","none"]),className:e.default.string,children:e.default.element.isRequired,draggableOpts:e.default.shape({allowAnyClick:e.default.bool,cancel:e.default.string,children:e.default.node,disabled:e.default.bool,enableUserSelectHack:e.default.bool,offsetParent:e.default.node,grid:e.default.arrayOf(e.default.number),handle: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}),height:function(){for(var a=arguments.length,o=new Array(a),c=0;c<a;c++)o[c]=arguments[c];var y=o[0];if(y.axis==="both"||y.axis==="y"){var h;return(h=e.default.number).isRequired.apply(h,o)}return e.default.number.apply(e.default,o)},handle:e.default.oneOfType([e.default.node,e.default.func]),handleSize:e.default.arrayOf(e.default.number),lockAspectRatio:e.default.bool,maxConstraints:e.default.arrayOf(e.default.number),minConstraints:e.default.arrayOf(e.default.number),onResizeStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,resizeHandles:e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:e.default.number,width:function(){for(var a=arguments.length,o=new Array(a),c=0;c<a;c++)o[c]=arguments[c];var y=o[0];if(y.axis==="both"||y.axis==="x"){var h;return(h=e.default.number).isRequired.apply(h,o)}return e.default.number.apply(e.default,o)}};return tt.resizableProps=n,tt}var Hr;function Br(){if(Hr)return et;Hr=1,et.__esModule=!0,et.default=void 0;var e=c(V),t=or(),n=Bn(),r=jr(),a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function o(i){if(typeof WeakMap!="function")return null;var s=new WeakMap,f=new WeakMap;return(o=function(l){return l?f:s})(i)}function c(i,s){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var f=o(s);if(f&&f.has(i))return f.get(i);var b={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in i)if(g!=="default"&&Object.prototype.hasOwnProperty.call(i,g)){var d=l?Object.getOwnPropertyDescriptor(i,g):null;d&&(d.get||d.set)?Object.defineProperty(b,g,d):b[g]=i[g]}return b.default=i,f&&f.set(i,b),b}function y(){return y=Object.assign?Object.assign.bind():function(i){for(var s=1;s<arguments.length;s++){var f=arguments[s];for(var b in f)Object.prototype.hasOwnProperty.call(f,b)&&(i[b]=f[b])}return i},y.apply(this,arguments)}function h(i,s){if(i==null)return{};var f={},b=Object.keys(i),l,g;for(g=0;g<b.length;g++)l=b[g],!(s.indexOf(l)>=0)&&(f[l]=i[l]);return f}function T(i,s){var f=Object.keys(i);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(i);s&&(b=b.filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable})),f.push.apply(f,b)}return f}function m(i){for(var s=1;s<arguments.length;s++){var f=arguments[s]!=null?arguments[s]:{};s%2?T(Object(f),!0).forEach(function(b){C(i,b,f[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(f)):T(Object(f)).forEach(function(b){Object.defineProperty(i,b,Object.getOwnPropertyDescriptor(f,b))})}return i}function C(i,s,f){return s=E(s),s in i?Object.defineProperty(i,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):i[s]=f,i}function E(i){var s=R(i,"string");return typeof s=="symbol"?s:String(s)}function R(i,s){if(typeof i!="object"||i===null)return i;var f=i[Symbol.toPrimitive];if(f!==void 0){var b=f.call(i,s);if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}function I(i,s){i.prototype=Object.create(s.prototype),i.prototype.constructor=i,S(i,s)}function S(i,s){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(b,l){return b.__proto__=l,b},S(i,s)}var p=function(i){I(s,i);function s(){for(var b,l=arguments.length,g=new Array(l),d=0;d<l;d++)g[d]=arguments[d];return b=i.call.apply(i,[this].concat(g))||this,b.handleRefs={},b.lastHandleRect=null,b.slack=null,b}var f=s.prototype;return f.componentWillUnmount=function(){this.resetData()},f.resetData=function(){this.lastHandleRect=this.slack=null},f.runConstraints=function(l,g){var d=this.props,v=d.minConstraints,D=d.maxConstraints,M=d.lockAspectRatio;if(!v&&!D&&!M)return[l,g];if(M){var U=this.props.width/this.props.height,z=l-this.props.width,O=g-this.props.height;Math.abs(z)>Math.abs(O*U)?g=l/U:l=g*U}var L=l,B=g,q=this.slack||[0,0],$=q[0],ie=q[1];return l+=$,g+=ie,v&&(l=Math.max(v[0],l),g=Math.max(v[1],g)),D&&(l=Math.min(D[0],l),g=Math.min(D[1],g)),this.slack=[$+(L-l),ie+(B-g)],[l,g]},f.resizeHandler=function(l,g){var d=this;return function(v,D){var M=D.node,U=D.deltaX,z=D.deltaY;l==="onResizeStart"&&d.resetData();var O=(d.props.axis==="both"||d.props.axis==="x")&&g!=="n"&&g!=="s",L=(d.props.axis==="both"||d.props.axis==="y")&&g!=="e"&&g!=="w";if(!(!O&&!L)){var B=g[0],q=g[g.length-1],$=M.getBoundingClientRect();if(d.lastHandleRect!=null){if(q==="w"){var ie=$.left-d.lastHandleRect.left;U+=ie}if(B==="n"){var oe=$.top-d.lastHandleRect.top;z+=oe}}d.lastHandleRect=$,q==="w"&&(U=-U),B==="n"&&(z=-z);var ce=d.props.width+(O?U/d.props.transformScale:0),W=d.props.height+(L?z/d.props.transformScale:0),ee=d.runConstraints(ce,W);ce=ee[0],W=ee[1];var ne=ce!==d.props.width||W!==d.props.height,le=typeof d.props[l]=="function"?d.props[l]:null,fe=l==="onResize"&&!ne;le&&!fe&&(v.persist==null||v.persist(),le(v,{node:M,size:{width:ce,height:W},handle:g})),l==="onResizeStop"&&d.resetData()}}},f.renderResizeHandle=function(l,g){var d=this.props.handle;if(!d)return e.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+l,ref:g});if(typeof d=="function")return d(l,g);var v=typeof d.type=="string",D=m({ref:g},v?{}:{handleAxis:l});return e.cloneElement(d,D)},f.render=function(){var l=this,g=this.props,d=g.children,v=g.className,D=g.draggableOpts;g.width,g.height,g.handle,g.handleSize,g.lockAspectRatio,g.axis,g.minConstraints,g.maxConstraints,g.onResize,g.onResizeStop,g.onResizeStart;var M=g.resizeHandles;g.transformScale;var U=h(g,a);return(0,n.cloneElement)(d,m(m({},U),{},{className:(v?v+" ":"")+"react-resizable",children:[].concat(d.props.children,M.map(function(z){var O,L=(O=l.handleRefs[z])!=null?O:l.handleRefs[z]=e.createRef();return e.createElement(t.DraggableCore,y({},D,{nodeRef:L,key:"resizableHandle-"+z,onStop:l.resizeHandler("onResizeStop",z),onStart:l.resizeHandler("onResizeStart",z),onDrag:l.resizeHandler("onResize",z)}),l.renderResizeHandle(z,L))}))}))},s}(e.Component);return et.default=p,p.propTypes=r.resizableProps,p.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},et}var rt={},Fr;function Fn(){if(Fr)return rt;Fr=1,rt.__esModule=!0,rt.default=void 0;var e=y(V),t=o(Ee()),n=o(Br()),r=jr(),a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function o(s){return s&&s.__esModule?s:{default:s}}function c(s){if(typeof WeakMap!="function")return null;var f=new WeakMap,b=new WeakMap;return(c=function(g){return g?b: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 b=c(f);if(b&&b.has(s))return b.get(s);var l={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var v=g?Object.getOwnPropertyDescriptor(s,d):null;v&&(v.get||v.set)?Object.defineProperty(l,d,v):l[d]=s[d]}return l.default=s,b&&b.set(s,l),l}function h(){return h=Object.assign?Object.assign.bind():function(s){for(var f=1;f<arguments.length;f++){var b=arguments[f];for(var l in b)Object.prototype.hasOwnProperty.call(b,l)&&(s[l]=b[l])}return s},h.apply(this,arguments)}function T(s,f){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);f&&(l=l.filter(function(g){return Object.getOwnPropertyDescriptor(s,g).enumerable})),b.push.apply(b,l)}return b}function m(s){for(var f=1;f<arguments.length;f++){var b=arguments[f]!=null?arguments[f]:{};f%2?T(Object(b),!0).forEach(function(l){C(s,l,b[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(b)):T(Object(b)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(b,l))})}return s}function C(s,f,b){return f=E(f),f in s?Object.defineProperty(s,f,{value:b,enumerable:!0,configurable:!0,writable:!0}):s[f]=b,s}function E(s){var f=R(s,"string");return typeof f=="symbol"?f:String(f)}function R(s,f){if(typeof s!="object"||s===null)return s;var b=s[Symbol.toPrimitive];if(b!==void 0){var l=b.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 I(s,f){if(s==null)return{};var b={},l=Object.keys(s),g,d;for(d=0;d<l.length;d++)g=l[d],!(f.indexOf(g)>=0)&&(b[g]=s[g]);return b}function S(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,p(s,f)}function p(s,f){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,g){return l.__proto__=g,l},p(s,f)}var i=function(s){S(f,s);function f(){for(var l,g=arguments.length,d=new Array(g),v=0;v<g;v++)d[v]=arguments[v];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 U=M.size;l.props.onResize?(D.persist==null||D.persist(),l.setState(U,function(){return l.props.onResize&&l.props.onResize(D,M)})):l.setState(U)},l}f.getDerivedStateFromProps=function(g,d){return d.propsWidth!==g.width||d.propsHeight!==g.height?{width:g.width,height:g.height,propsWidth:g.width,propsHeight:g.height}:null};var b=f.prototype;return b.render=function(){var g=this.props,d=g.handle,v=g.handleSize;g.onResize;var D=g.onResizeStart,M=g.onResizeStop,U=g.draggableOpts,z=g.minConstraints,O=g.maxConstraints,L=g.lockAspectRatio,B=g.axis;g.width,g.height;var q=g.resizeHandles,$=g.style,ie=g.transformScale,oe=I(g,a);return e.createElement(n.default,{axis:B,draggableOpts:U,handle:d,handleSize:v,height:this.state.height,lockAspectRatio:L,maxConstraints:O,minConstraints:z,onResizeStart:D,onResize:this.onResize,onResizeStop:M,resizeHandles:q,transformScale:ie,width:this.state.width},e.createElement("div",h({},oe,{style:m(m({},$),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},f}(e.Component);return rt.default=i,i.propTypes=m(m({},r.resizableProps),{},{children:t.default.element}),rt}var Gr;function Gn(){return Gr||(Gr=1,Qe.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Qe.exports.Resizable=Br().default,Qe.exports.ResizableBox=Fn().default),Qe.exports}var _e={},qr;function Xr(){if(qr)return _e;qr=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.resizeHandleType=_e.resizeHandleAxesType=_e.default=void 0;var e=n(Ee()),t=n(V);function n(o){return o&&o.__esModule?o:{default:o}}const r=_e.resizeHandleAxesType=e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),a=_e.resizeHandleType=e.default.oneOfType([e.default.node,e.default.func]);return _e.default={className:e.default.string,style:e.default.object,width:e.default.number,autoSize:e.default.bool,cols:e.default.number,draggableCancel:e.default.string,draggableHandle:e.default.string,verticalCompact:function(o){o.verticalCompact},compactType:e.default.oneOf(["vertical","horizontal"]),layout:function(o){var c=o.layout;c!==void 0&&ze().validateLayout(c,"layout")},margin:e.default.arrayOf(e.default.number),containerPadding:e.default.arrayOf(e.default.number),rowHeight:e.default.number,maxRows:e.default.number,isBounded:e.default.bool,isDraggable:e.default.bool,isResizable:e.default.bool,allowOverlap:e.default.bool,preventCollision:e.default.bool,useCSSTransforms:e.default.bool,transformScale:e.default.number,isDroppable:e.default.bool,resizeHandles:r,resizeHandle:a,onLayoutChange:e.default.func,onDragStart:e.default.func,onDrag:e.default.func,onDragStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,onResizeStop:e.default.func,onDrop:e.default.func,droppingItem:e.default.shape({i:e.default.string.isRequired,w:e.default.number.isRequired,h:e.default.number.isRequired}),children:function(o,c){const y=o[c],h={};t.default.Children.forEach(y,function(T){if((T==null?void 0:T.key)!=null){if(h[T.key])throw new Error('Duplicate child key "'+T.key+'" found! This will cause problems in ReactGridLayout.');h[T.key]=!0}})},innerRef:e.default.any},_e}var Yr;function qn(){if(Yr)return Ze;Yr=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.default=void 0;var e=T(V),t=At,n=T(Ee()),r=or(),a=Gn(),o=ze(),c=Qt(),y=Xr(),h=T($t());function T(I){return I&&I.__esModule?I:{default:I}}function m(I,S,p){return S=C(S),S in I?Object.defineProperty(I,S,{value:p,enumerable:!0,configurable:!0,writable:!0}):I[S]=p,I}function C(I){var S=E(I,"string");return typeof S=="symbol"?S:String(S)}function E(I,S){if(typeof I!="object"||I===null)return I;var p=I[Symbol.toPrimitive];if(p!==void 0){var i=p.call(I,S);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(I)}let R=class extends e.default.Component{constructor(){super(...arguments),m(this,"state",{resizing:null,dragging:null,className:""}),m(this,"elementRef",e.default.createRef()),m(this,"onDragStart",(S,p)=>{let{node:i}=p;const{onDragStart:s,transformScale:f}=this.props;if(!s)return;const b={top:0,left:0},{offsetParent:l}=i;if(!l)return;const g=l.getBoundingClientRect(),d=i.getBoundingClientRect(),v=d.left/f,D=g.left/f,M=d.top/f,U=g.top/f;b.left=v-D+l.scrollLeft,b.top=M-U+l.scrollTop,this.setState({dragging:b});const{x:z,y:O}=(0,c.calcXY)(this.getPositionParams(),b.top,b.left,this.props.w,this.props.h);return s.call(this,this.props.i,z,O,{e:S,node:i,newPosition:b})}),m(this,"onDrag",(S,p,i)=>{let{node:s,deltaX:f,deltaY:b}=p;const{onDrag:l}=this.props;if(!l)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let g=this.state.dragging.top+b,d=this.state.dragging.left+f;const{isBounded:v,i:D,w:M,h:U,containerWidth:z}=this.props,O=this.getPositionParams();if(v){const{offsetParent:$}=s;if($){const{margin:ie,rowHeight:oe,containerPadding:ce}=this.props,W=$.clientHeight-(0,c.calcGridItemWHPx)(U,oe,ie[1]);g=(0,c.clamp)(g-ce[1],0,W);const ee=(0,c.calcGridColWidth)(O),ne=z-(0,c.calcGridItemWHPx)(M,ee,ie[0]);d=(0,c.clamp)(d-ce[0],0,ne)}}const L={top:g,left:d};i?this.setState({dragging:L}):(0,t.flushSync)(()=>{this.setState({dragging:L})});const{x:B,y:q}=(0,c.calcXY)(O,g,d,M,U);return l.call(this,D,B,q,{e:S,node:s,newPosition:L})}),m(this,"onDragStop",(S,p)=>{let{node:i}=p;const{onDragStop:s}=this.props;if(!s)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:f,h:b,i:l}=this.props,{left:g,top:d}=this.state.dragging,v={top:d,left:g};this.setState({dragging:null});const{x:D,y:M}=(0,c.calcXY)(this.getPositionParams(),d,g,f,b);return s.call(this,l,D,M,{e:S,node:i,newPosition:v})}),m(this,"onResizeStop",(S,p,i)=>this.onResizeHandler(S,p,i,"onResizeStop")),m(this,"onResizeStart",(S,p,i)=>this.onResizeHandler(S,p,i,"onResizeStart")),m(this,"onResize",(S,p,i)=>this.onResizeHandler(S,p,i,"onResize"))}shouldComponentUpdate(S,p){if(this.props.children!==S.children||this.props.droppingPosition!==S.droppingPosition)return!0;const i=(0,c.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),s=(0,c.calcGridItemPosition)(this.getPositionParams(S),S.x,S.y,S.w,S.h,p);return!(0,o.fastPositionEqual)(i,s)||this.props.useCSSTransforms!==S.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(S){this.moveDroppingItem(S)}moveDroppingItem(S){const{droppingPosition:p}=this.props;if(!p)return;const i=this.elementRef.current;if(!i)return;const s=S.droppingPosition||{left:0,top:0},{dragging:f}=this.state,b=f&&p.left!==s.left||p.top!==s.top;if(!f)this.onDragStart(p.e,{node:i,deltaX:p.left,deltaY:p.top});else if(b){const l=p.left-f.left,g=p.top-f.top;this.onDrag(p.e,{node:i,deltaX:l,deltaY:g},!0)}}getPositionParams(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:S.cols,containerPadding:S.containerPadding,containerWidth:S.containerWidth,margin:S.margin,maxRows:S.maxRows,rowHeight:S.rowHeight}}createStyle(S){const{usePercentages:p,containerWidth:i,useCSSTransforms:s}=this.props;let f;return s?f=(0,o.setTransform)(S):(f=(0,o.setTopLeft)(S),p&&(f.left=(0,o.perc)(S.left/i),f.width=(0,o.perc)(S.width/i))),f}mixinDraggable(S,p){return e.default.createElement(r.DraggableCore,{disabled:!p,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},S)}curryResizeHandler(S,p){return(i,s)=>p(i,s,S)}mixinResizable(S,p,i){const{cols:s,minW:f,minH:b,maxW:l,maxH:g,transformScale:d,resizeHandles:v,resizeHandle:D}=this.props,M=this.getPositionParams(),U=(0,c.calcGridItemPosition)(M,0,0,s,0).width,z=(0,c.calcGridItemPosition)(M,0,0,f,b),O=(0,c.calcGridItemPosition)(M,0,0,l,g),L=[z.width,z.height],B=[Math.min(O.width,U),Math.min(O.height,1/0)];return e.default.createElement(a.Resizable,{draggableOpts:{disabled:!i},className:i?void 0:"react-resizable-hide",width:p.width,height:p.height,minConstraints:L,maxConstraints:B,onResizeStop:this.curryResizeHandler(p,this.onResizeStop),onResizeStart:this.curryResizeHandler(p,this.onResizeStart),onResize:this.curryResizeHandler(p,this.onResize),transformScale:d,resizeHandles:v,handle:D},S)}onResizeHandler(S,p,i,s){let{node:f,size:b,handle:l}=p;const g=this.props[s];if(!g)return;const{x:d,y:v,i:D,maxH:M,minH:U,containerWidth:z}=this.props,{minW:O,maxW:L}=this.props;let B=b;f&&(B=(0,o.resizeItemInDirection)(l,i,b,z),(0,t.flushSync)(()=>{this.setState({resizing:s==="onResizeStop"?null:B})}));let{w:q,h:$}=(0,c.calcWH)(this.getPositionParams(),B.width,B.height,d,v,l);q=(0,c.clamp)(q,Math.max(O,1),L),$=(0,c.clamp)($,U,M),g.call(this,D,q,$,{e:S,node:f,size:B,handle:l})}render(){const{x:S,y:p,w:i,h:s,isDraggable:f,isResizable:b,droppingPosition:l,useCSSTransforms:g}=this.props,d=(0,c.calcGridItemPosition)(this.getPositionParams(),S,p,i,s,this.state),v=e.default.Children.only(this.props.children);let D=e.default.cloneElement(v,{ref:this.elementRef,className:(0,h.default)("react-grid-item",v.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":f,"react-draggable-dragging":!!this.state.dragging,dropping:!!l,cssTransforms:g}),style:{...this.props.style,...v.props.style,...this.createStyle(d)}});return D=this.mixinResizable(D,d,b),D=this.mixinDraggable(D,f),D}};return Ze.default=R,m(R,"propTypes",{children:n.default.element,cols:n.default.number.isRequired,containerWidth:n.default.number.isRequired,rowHeight:n.default.number.isRequired,margin:n.default.array.isRequired,maxRows:n.default.number.isRequired,containerPadding:n.default.array.isRequired,x:n.default.number.isRequired,y:n.default.number.isRequired,w:n.default.number.isRequired,h:n.default.number.isRequired,minW:function(I,S){const p=I[S];if(typeof p!="number")return new Error("minWidth not Number");if(p>I.w||p>I.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(I,S){const p=I[S];if(typeof p!="number")return new Error("maxWidth not Number");if(p<I.w||p<I.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(I,S){const p=I[S];if(typeof p!="number")return new Error("minHeight not Number");if(p>I.h||p>I.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(I,S){const p=I[S];if(typeof p!="number")return new Error("maxHeight not Number");if(p<I.h||p<I.minH)return new Error("maxHeight smaller than item height/minHeight")},i:n.default.string.isRequired,resizeHandles:y.resizeHandleAxesType,resizeHandle:y.resizeHandleType,onDragStop:n.default.func,onDragStart:n.default.func,onDrag:n.default.func,onResizeStop:n.default.func,onResizeStart:n.default.func,onResize:n.default.func,isDraggable:n.default.bool.isRequired,isResizable:n.default.bool.isRequired,isBounded:n.default.bool.isRequired,static:n.default.bool,useCSSTransforms:n.default.bool.isRequired,transformScale:n.default.number,className:n.default.string,handle:n.default.string,cancel:n.default.string,droppingPosition:n.default.shape({e:n.default.object.isRequired,left:n.default.number.isRequired,top:n.default.number.isRequired})}),m(R,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Ze}var Kr;function Zr(){if(Kr)return Ye;Kr=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.default=void 0;var e=T(V),t=Zt(),n=y($t()),r=ze(),a=Qt(),o=y(qn()),c=y(Xr());function y(p){return p&&p.__esModule?p:{default:p}}function h(p){if(typeof WeakMap!="function")return null;var i=new WeakMap,s=new WeakMap;return(h=function(f){return f?s:i})(p)}function T(p,i){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=h(i);if(s&&s.has(p))return s.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var g=b?Object.getOwnPropertyDescriptor(p,l):null;g&&(g.get||g.set)?Object.defineProperty(f,l,g):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function m(p,i,s){return i=C(i),i in p?Object.defineProperty(p,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[i]=s,p}function C(p){var i=E(p,"string");return typeof i=="symbol"?i:String(i)}function E(p,i){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,i);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(p)}const R="react-grid-layout";let I=!1;try{I=/firefox/i.test(navigator.userAgent)}catch{}let S=class extends e.Component{constructor(){super(...arguments),m(this,"state",{activeDrag:null,layout:(0,r.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,r.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),m(this,"dragEnterCounter",0),m(this,"onDragStart",(i,s,f,b)=>{let{e:l,node:g}=b;const{layout:d}=this.state,v=(0,r.getLayoutItem)(d,i);if(!v)return;const D={w:v.w,h:v.h,x:v.x,y:v.y,placeholder:!0,i};return this.setState({oldDragItem:(0,r.cloneLayoutItem)(v),oldLayout:d,activeDrag:D}),this.props.onDragStart(d,v,v,null,l,g)}),m(this,"onDrag",(i,s,f,b)=>{let{e:l,node:g}=b;const{oldDragItem:d}=this.state;let{layout:v}=this.state;const{cols:D,allowOverlap:M,preventCollision:U}=this.props,z=(0,r.getLayoutItem)(v,i);if(!z)return;const O={w:z.w,h:z.h,x:z.x,y:z.y,placeholder:!0,i};v=(0,r.moveElement)(v,z,s,f,!0,U,(0,r.compactType)(this.props),D,M),this.props.onDrag(v,d,z,O,l,g),this.setState({layout:M?v:(0,r.compact)(v,(0,r.compactType)(this.props),D),activeDrag:O})}),m(this,"onDragStop",(i,s,f,b)=>{let{e:l,node:g}=b;if(!this.state.activeDrag)return;const{oldDragItem:d}=this.state;let{layout:v}=this.state;const{cols:D,preventCollision:M,allowOverlap:U}=this.props,z=(0,r.getLayoutItem)(v,i);if(!z)return;v=(0,r.moveElement)(v,z,s,f,!0,M,(0,r.compactType)(this.props),D,U);const L=U?v:(0,r.compact)(v,(0,r.compactType)(this.props),D);this.props.onDragStop(L,d,z,null,l,g);const{oldLayout:B}=this.state;this.setState({activeDrag:null,layout:L,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(L,B)}),m(this,"onResizeStart",(i,s,f,b)=>{let{e:l,node:g}=b;const{layout:d}=this.state,v=(0,r.getLayoutItem)(d,i);v&&(this.setState({oldResizeItem:(0,r.cloneLayoutItem)(v),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(d,v,v,null,l,g))}),m(this,"onResize",(i,s,f,b)=>{let{e:l,node:g,size:d,handle:v}=b;const{oldResizeItem:D}=this.state,{layout:M}=this.state,{cols:U,preventCollision:z,allowOverlap:O}=this.props;let L=!1,B,q,$;const[ie,oe]=(0,r.withLayoutItem)(M,i,W=>{let ee;return q=W.x,$=W.y,["sw","w","nw","n","ne"].indexOf(v)!==-1&&(["sw","nw","w"].indexOf(v)!==-1&&(q=W.x+(W.w-s),s=W.x!==q&&q<0?W.w:s,q=q<0?0:q),["ne","n","nw"].indexOf(v)!==-1&&($=W.y+(W.h-f),f=W.y!==$&&$<0?W.h:f,$=$<0?0:$),L=!0),z&&!O&&(ee=(0,r.getAllCollisions)(M,{...W,w:s,h:f,x:q,y:$}).filter(le=>le.i!==W.i).length>0,ee&&($=W.y,f=W.h,q=W.x,s=W.w,L=!1)),W.w=s,W.h=f,W});if(!oe)return;B=ie,L&&(B=(0,r.moveElement)(ie,oe,q,$,!0,this.props.preventCollision,(0,r.compactType)(this.props),U,O));const ce={w:oe.w,h:oe.h,x:oe.x,y:oe.y,static:!0,i};this.props.onResize(B,D,oe,ce,l,g),this.setState({layout:O?B:(0,r.compact)(B,(0,r.compactType)(this.props),U),activeDrag:ce})}),m(this,"onResizeStop",(i,s,f,b)=>{let{e:l,node:g}=b;const{layout:d,oldResizeItem:v}=this.state,{cols:D,allowOverlap:M}=this.props,U=(0,r.getLayoutItem)(d,i),z=M?d:(0,r.compact)(d,(0,r.compactType)(this.props),D);this.props.onResizeStop(z,v,U,null,l,g);const{oldLayout:O}=this.state;this.setState({activeDrag:null,layout:z,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(z,O)}),m(this,"onDragOver",i=>{var ie;if(i.preventDefault(),i.stopPropagation(),I&&!((ie=i.nativeEvent.target)!=null&&ie.classList.contains(R)))return!1;const{droppingItem:s,onDropDragOver:f,margin:b,cols:l,rowHeight:g,maxRows:d,width:v,containerPadding:D,transformScale:M}=this.props,U=f==null?void 0:f(i);if(U===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const z={...s,...U},{layout:O}=this.state,L=i.currentTarget.getBoundingClientRect(),B=i.clientX-L.left,q=i.clientY-L.top,$={left:B/M,top:q/M,e:i};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:oe,top:ce}=this.state.droppingPosition;(oe!=B||ce!=q)&&this.setState({droppingPosition:$})}}else{const oe={cols:l,margin:b,maxRows:d,rowHeight:g,containerWidth:v,containerPadding:D||b},ce=(0,a.calcXY)(oe,q,B,z.w,z.h);this.setState({droppingDOMNode:e.createElement("div",{key:z.i}),droppingPosition:$,layout:[...O,{...z,x:ce.x,y:ce.y,static:!1,isDraggable:!0}]})}}),m(this,"removeDroppingPlaceholder",()=>{const{droppingItem:i,cols:s}=this.props,{layout:f}=this.state,b=(0,r.compact)(f.filter(l=>l.i!==i.i),(0,r.compactType)(this.props),s,this.props.allowOverlap);this.setState({layout:b,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),m(this,"onDragLeave",i=>{i.preventDefault(),i.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),m(this,"onDragEnter",i=>{i.preventDefault(),i.stopPropagation(),this.dragEnterCounter++}),m(this,"onDrop",i=>{i.preventDefault(),i.stopPropagation();const{droppingItem:s}=this.props,{layout:f}=this.state,b=f.find(l=>l.i===s.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(f,b,i)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(i,s){let f;return s.activeDrag?null:(!(0,t.deepEqual)(i.layout,s.propsLayout)||i.compactType!==s.compactType?f=i.layout:(0,r.childrenEqual)(i.children,s.children)||(f=s.layout),f?{layout:(0,r.synchronizeLayoutWithChildren)(f,i.children,i.cols,(0,r.compactType)(i),i.allowOverlap),compactType:i.compactType,children:i.children,propsLayout:i.layout}:null)}shouldComponentUpdate(i,s){return this.props.children!==i.children||!(0,r.fastRGLPropsEqual)(this.props,i,t.deepEqual)||this.state.activeDrag!==s.activeDrag||this.state.mounted!==s.mounted||this.state.droppingPosition!==s.droppingPosition}componentDidUpdate(i,s){if(!this.state.activeDrag){const f=this.state.layout,b=s.layout;this.onLayoutMaybeChanged(f,b)}}containerHeight(){if(!this.props.autoSize)return;const i=(0,r.bottom)(this.state.layout),s=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return i*this.props.rowHeight+(i-1)*this.props.margin[1]+s*2+"px"}onLayoutMaybeChanged(i,s){s||(s=this.state.layout),(0,t.deepEqual)(s,i)||this.props.onLayoutChange(i)}placeholder(){const{activeDrag:i}=this.state;if(!i)return null;const{width:s,cols:f,margin:b,containerPadding:l,rowHeight:g,maxRows:d,useCSSTransforms:v,transformScale:D}=this.props;return e.createElement(o.default,{w:i.w,h:i.h,x:i.x,y:i.y,i:i.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:s,cols:f,margin:b,containerPadding:l||b,maxRows:d,rowHeight:g,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:v,transformScale:D},e.createElement("div",null))}processGridItem(i,s){if(!i||!i.key)return;const f=(0,r.getLayoutItem)(this.state.layout,String(i.key));if(!f)return null;const{width:b,cols:l,margin:g,containerPadding:d,rowHeight:v,maxRows:D,isDraggable:M,isResizable:U,isBounded:z,useCSSTransforms:O,transformScale:L,draggableCancel:B,draggableHandle:q,resizeHandles:$,resizeHandle:ie}=this.props,{mounted:oe,droppingPosition:ce}=this.state,W=typeof f.isDraggable=="boolean"?f.isDraggable:!f.static&&M,ee=typeof f.isResizable=="boolean"?f.isResizable:!f.static&&U,ne=f.resizeHandles||$,le=W&&z&&f.isBounded!==!1;return e.createElement(o.default,{containerWidth:b,cols:l,margin:g,containerPadding:d||g,maxRows:D,rowHeight:v,cancel:B,handle:q,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:W,isResizable:ee,isBounded:le,useCSSTransforms:O&&oe,usePercentages:!oe,transformScale:L,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?ce:void 0,resizeHandles:ne,resizeHandle:ie},i)}render(){const{className:i,style:s,isDroppable:f,innerRef:b}=this.props,l=(0,n.default)(R,i),g={height:this.containerHeight(),...s};return e.createElement("div",{ref:b,className:l,style:g,onDrop:f?this.onDrop:r.noop,onDragLeave:f?this.onDragLeave:r.noop,onDragEnter:f?this.onDragEnter:r.noop,onDragOver:f?this.onDragOver:r.noop},e.Children.map(this.props.children,d=>this.processGridItem(d)),f&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return Ye.default=S,m(S,"displayName","ReactGridLayout"),m(S,"propTypes",c.default),m(S,"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:r.noop,onDragStart:r.noop,onDrag:r.noop,onDragStop:r.noop,onResizeStart:r.noop,onResize:r.noop,onResizeStop:r.noop,onDrop:r.noop,onDropDragOver:r.noop}),Ye}var nt={},De={},$r;function Jr(){if($r)return De;$r=1,Object.defineProperty(De,"__esModule",{value:!0}),De.findOrGenerateResponsiveLayout=r,De.getBreakpointFromWidth=t,De.getColsFromBreakpoint=n,De.sortBreakpoints=a;var e=ze();function t(o,c){const y=a(o);let h=y[0];for(let T=1,m=y.length;T<m;T++){const C=y[T];c>o[C]&&(h=C)}return h}function n(o,c){if(!c[o])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+o+" is missing!");return c[o]}function r(o,c,y,h,T,m){if(o[y])return(0,e.cloneLayout)(o[y]);let C=o[h];const E=a(c),R=E.slice(E.indexOf(y));for(let I=0,S=R.length;I<S;I++){const p=R[I];if(o[p]){C=o[p];break}}return C=(0,e.cloneLayout)(C||[]),(0,e.compact)((0,e.correctBounds)(C,{cols:T}),m,T)}function a(o){return Object.keys(o).sort(function(y,h){return o[y]-o[h]})}return De}var Qr;function Xn(){if(Qr)return nt;Qr=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=void 0;var e=h(V),t=c(Ee()),n=Zt(),r=ze(),a=Jr(),o=c(Zr());function c(p){return p&&p.__esModule?p:{default:p}}function y(p){if(typeof WeakMap!="function")return null;var i=new WeakMap,s=new WeakMap;return(y=function(f){return f?s:i})(p)}function h(p,i){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var s=y(i);if(s&&s.has(p))return s.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in p)if(l!=="default"&&Object.prototype.hasOwnProperty.call(p,l)){var g=b?Object.getOwnPropertyDescriptor(p,l):null;g&&(g.get||g.set)?Object.defineProperty(f,l,g):f[l]=p[l]}return f.default=p,s&&s.set(p,f),f}function T(){return T=Object.assign?Object.assign.bind():function(p){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(p[f]=s[f])}return p},T.apply(this,arguments)}function m(p,i,s){return i=C(i),i in p?Object.defineProperty(p,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):p[i]=s,p}function C(p){var i=E(p,"string");return typeof i=="symbol"?i:String(i)}function E(p,i){if(typeof p!="object"||p===null)return p;var s=p[Symbol.toPrimitive];if(s!==void 0){var f=s.call(p,i);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(p)}const R=p=>Object.prototype.toString.call(p);function I(p,i){return p==null?null:Array.isArray(p)?p:p[i]}let S=class extends e.Component{constructor(){super(...arguments),m(this,"state",this.generateInitialState()),m(this,"onLayoutChange",i=>{this.props.onLayoutChange(i,{...this.props.layouts,[this.state.breakpoint]:i})})}generateInitialState(){const{width:i,breakpoints:s,layouts:f,cols:b}=this.props,l=(0,a.getBreakpointFromWidth)(s,i),g=(0,a.getColsFromBreakpoint)(l,b),d=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,a.findOrGenerateResponsiveLayout)(f,s,l,l,g,d),breakpoint:l,cols:g}}static getDerivedStateFromProps(i,s){if(!(0,n.deepEqual)(i.layouts,s.layouts)){const{breakpoint:f,cols:b}=s;return{layout:(0,a.findOrGenerateResponsiveLayout)(i.layouts,i.breakpoints,f,f,b,i.compactType),layouts:i.layouts}}return null}componentDidUpdate(i){(this.props.width!=i.width||this.props.breakpoint!==i.breakpoint||!(0,n.deepEqual)(this.props.breakpoints,i.breakpoints)||!(0,n.deepEqual)(this.props.cols,i.cols))&&this.onWidthChange(i)}onWidthChange(i){const{breakpoints:s,cols:f,layouts:b,compactType:l}=this.props,g=this.props.breakpoint||(0,a.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),d=this.state.breakpoint,v=(0,a.getColsFromBreakpoint)(g,f),D={...b};if(d!==g||i.breakpoints!==s||i.cols!==f){d in D||(D[d]=(0,r.cloneLayout)(this.state.layout));let z=(0,a.findOrGenerateResponsiveLayout)(D,s,g,d,v,l);z=(0,r.synchronizeLayoutWithChildren)(z,this.props.children,v,l,this.props.allowOverlap),D[g]=z,this.props.onBreakpointChange(g,v),this.props.onLayoutChange(z,D),this.setState({breakpoint:g,layout:z,cols:v})}const M=I(this.props.margin,g),U=I(this.props.containerPadding,g);this.props.onWidthChange(this.props.width,M,v,U)}render(){const{breakpoint:i,breakpoints:s,cols:f,layouts:b,margin:l,containerPadding:g,onBreakpointChange:d,onLayoutChange:v,onWidthChange:D,...M}=this.props;return e.createElement(o.default,T({},M,{margin:I(l,this.state.breakpoint),containerPadding:I(g,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return nt.default=S,m(S,"propTypes",{breakpoint:t.default.string,breakpoints:t.default.object,allowOverlap:t.default.bool,cols:t.default.object,margin:t.default.oneOfType([t.default.array,t.default.object]),containerPadding:t.default.oneOfType([t.default.array,t.default.object]),layouts(p,i){if(R(p[i])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+R(p[i]));Object.keys(p[i]).forEach(s=>{if(!(s in p.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,r.validateLayout)(p.layouts[s],"layouts."+s)})},width:t.default.number.isRequired,onBreakpointChange:t.default.func,onLayoutChange:t.default.func,onWidthChange:t.default.func}),m(S,"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:r.noop,onLayoutChange:r.noop,onWidthChange:r.noop}),nt}var Ct={},en=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(a,o){return a[0]===n?(r=o,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),a=this.__entries__[r];return a&&a[1]},t.prototype.set=function(n,r){var a=e(this.__entries__,n);~a?this.__entries__[a][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,a=e(r,n);~a&&r.splice(a,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var a=0,o=this.__entries__;a<o.length;a++){var c=o[a];n.call(r,c[1],c[0])}},t}()}(),ir=typeof window<"u"&&typeof document<"u"&&window.document===document,Tt=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")()}(),Yn=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Tt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Kn=2;function Zn(e,t){var n=!1,r=!1,a=0;function o(){n&&(n=!1,e()),r&&y()}function c(){Yn(o)}function y(){var h=Date.now();if(n){if(h-a<Kn)return;r=!0}else n=!0,r=!1,setTimeout(c,t);a=h}return y}var $n=20,Jn=["top","right","bottom","left","width","height","size","weight"],Qn=typeof MutationObserver<"u",ea=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Zn(this.refresh.bind(this),$n)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!ir||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Qn?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!ir||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,a=Jn.some(function(o){return!!~r.indexOf(o)});a&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),tn=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var a=r[n];Object.defineProperty(e,a,{value:t[a],enumerable:!1,writable:!1,configurable:!0})}return e},ke=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Tt},rn=It(0,0,0,0);function wt(e){return parseFloat(e)||0}function nn(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,a){var o=e["border-"+a+"-width"];return r+wt(o)},0)}function ta(e){for(var t=["top","right","bottom","left"],n={},r=0,a=t;r<a.length;r++){var o=a[r],c=e["padding-"+o];n[o]=wt(c)}return n}function ra(e){var t=e.getBBox();return It(0,0,t.width,t.height)}function na(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return rn;var r=ke(e).getComputedStyle(e),a=ta(r),o=a.left+a.right,c=a.top+a.bottom,y=wt(r.width),h=wt(r.height);if(r.boxSizing==="border-box"&&(Math.round(y+o)!==t&&(y-=nn(r,"left","right")+o),Math.round(h+c)!==n&&(h-=nn(r,"top","bottom")+c)),!oa(e)){var T=Math.round(y+o)-t,m=Math.round(h+c)-n;Math.abs(T)!==1&&(y-=T),Math.abs(m)!==1&&(h-=m)}return It(a.left,a.top,y,h)}var aa=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof ke(e).SVGGraphicsElement}:function(e){return e instanceof ke(e).SVGElement&&typeof e.getBBox=="function"}}();function oa(e){return e===ke(e).document.documentElement}function ia(e){return ir?aa(e)?ra(e):na(e):rn}function sa(e){var t=e.x,n=e.y,r=e.width,a=e.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(o.prototype);return tn(c,{x:t,y:n,width:r,height:a,top:n,right:t+r,bottom:a+n,left:t}),c}function It(e,t,n,r){return{x:e,y:t,width:n,height:r}}var la=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=It(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=ia(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),ca=function(){function e(t,n){var r=sa(n);tn(this,{target:t,contentRect:r})}return e}(),ua=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new en,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof ke(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new la(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof ke(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new ca(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),an=typeof WeakMap<"u"?new WeakMap:new en,on=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ea.getInstance(),r=new ua(t,n,this);an.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){on.prototype[e]=function(){var t;return(t=an.get(this))[e].apply(t,arguments)}});var da=function(){return typeof Tt.ResizeObserver<"u"?Tt.ResizeObserver:on}();const fa=yr(Object.freeze(Object.defineProperty({__proto__:null,default:da},Symbol.toStringTag,{value:"Module"})));var sn;function pa(){if(sn)return Ct;sn=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.default=E;var e=c(V),t=a(Ee()),n=a(fa),r=a($t());function a(R){return R&&R.__esModule?R:{default:R}}function o(R){if(typeof WeakMap!="function")return null;var I=new WeakMap,S=new WeakMap;return(o=function(p){return p?S:I})(R)}function c(R,I){if(R&&R.__esModule)return R;if(R===null||typeof R!="object"&&typeof R!="function")return{default:R};var S=o(I);if(S&&S.has(R))return S.get(R);var p={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in R)if(s!=="default"&&Object.prototype.hasOwnProperty.call(R,s)){var f=i?Object.getOwnPropertyDescriptor(R,s):null;f&&(f.get||f.set)?Object.defineProperty(p,s,f):p[s]=R[s]}return p.default=R,S&&S.set(R,p),p}function y(){return y=Object.assign?Object.assign.bind():function(R){for(var I=1;I<arguments.length;I++){var S=arguments[I];for(var p in S)Object.prototype.hasOwnProperty.call(S,p)&&(R[p]=S[p])}return R},y.apply(this,arguments)}function h(R,I,S){return I=T(I),I in R?Object.defineProperty(R,I,{value:S,enumerable:!0,configurable:!0,writable:!0}):R[I]=S,R}function T(R){var I=m(R,"string");return typeof I=="symbol"?I:String(I)}function m(R,I){if(typeof R!="object"||R===null)return R;var S=R[Symbol.toPrimitive];if(S!==void 0){var p=S.call(R,I);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(R)}const C="react-grid-layout";function E(R){var I;return I=class extends e.Component{constructor(){super(...arguments),h(this,"state",{width:1280}),h(this,"elementRef",e.createRef()),h(this,"mounted",!1),h(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new n.default(i=>{if(this.elementRef.current instanceof HTMLElement){const f=i[0].contentRect.width;this.setState({width:f})}});const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.observe(p)}componentWillUnmount(){this.mounted=!1;const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.unobserve(p),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:p,...i}=this.props;return p&&!this.mounted?e.createElement("div",{className:(0,r.default)(this.props.className,C),style:this.props.style,ref:this.elementRef}):e.createElement(R,y({innerRef:this.elementRef},i,this.state))}},h(I,"defaultProps",{measureBeforeMount:!1}),h(I,"propTypes",{measureBeforeMount:t.default.bool}),I}return Ct}var ln;function ha(){return ln||(ln=1,function(e){e.exports=Zr().default,e.exports.utils=ze(),e.exports.calculateUtils=Qt(),e.exports.Responsive=Xn().default,e.exports.Responsive.utils=Jr(),e.exports.WidthProvider=pa().default}(Kt)),Kt.exports}var ga=ha();const va=Ln(ga);var ma=Object.getOwnPropertyDescriptor,ya=(e,t,n,r)=>{for(var a=r>1?void 0:r?ma(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},ba=(e,t)=>(n,r)=>t(n,r,e);let Ae=class extends w.Disposable{constructor(t){super();xe(this,"_initLocal",()=>{});xe(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let a=n.exec(t);for(;a;)r.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),a=t.split("."),o=r&&this._localeService.resolveKeyPath(r,a);if(typeof o=="string"){const c=[];return this._findReplaceIndex(o).forEach((y,h,T)=>{const m=T[h-1]||{endIndex:-1};if(m.endIndex+1<y.startIndex){const C=o.slice(m.endIndex+1,y.startIndex);C&&c.push(C)}if(n[y.key]&&c.push(n[y.key]),h===T.length-1){const C=o.slice(y.endIndex+1);C&&c.push(C)}}),c}return[]}};Ae=ya([ba(0,w.Inject(w.LocaleService))],Ae);const _t={cfPreview:"univer-cf-preview"},We=e=>{var a,o;const t=e.rule;if(!t)return null;const n=V.useMemo(()=>{if(t.type===u.CFRuleType.colorScale){const c=t.config.map((T,m)=>({color:new w.ColorKit(T.color),value:m})),y=c.length-1;return new Array(5).fill("").map((T,m,C)=>m*y/(C.length-1)).map(T=>u.getColorScaleFromValue(c,T))}return null},[t]),r=V.useMemo(()=>{if(t.type===u.CFRuleType.iconSet)return t.config.map(c=>{const y=u.iconMap[c.iconType];return y&&y[Number(c.iconId)]})},[t]);switch(t.type){case u.CFRuleType.dataBar:{const{isGradient:c}=t.config,y={width:"50%",height:"100%"},h=c?`linear-gradient(to right, ${t.config.positiveColor||u.defaultDataBarPositiveColor}, rgb(255 255 255))`:t.config.positiveColor,T=c?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor||u.defaultDataBarNativeColor})`:t.config.nativeColor;return _.jsxs("div",{className:_t.cfPreview,children:[_.jsx("div",{style:{...y,background:T,border:`1px solid ${t.config.nativeColor||u.defaultDataBarNativeColor}`}}),_.jsx("div",{style:{...y,background:h,border:`1px solid ${t.config.positiveColor||u.defaultDataBarPositiveColor}`}})]})}case u.CFRuleType.colorScale:return n&&_.jsx("div",{className:_t.cfPreview,children:n.map((c,y)=>_.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:c}},y))});case u.CFRuleType.iconSet:return r&&_.jsx("div",{className:_t.cfPreview,children:r.map((c,y)=>c?_.jsx("img",{style:{height:"100%"},src:c},y):_.jsx(Xe,{},y))});case u.CFRuleType.highlightCell:{const{ul:c,st:y,it:h,bl:T,bg:m,cl:C}=t.style,E=(c==null?void 0:c.s)===w.BooleanNumber.TRUE,R=(y==null?void 0:y.s)===w.BooleanNumber.TRUE,I=h===w.BooleanNumber.TRUE,S=T===w.BooleanNumber.TRUE,p=(a=m==null?void 0:m.rgb)!=null?a:u.DEFAULT_BG_COLOR,i=(o=C==null?void 0:C.rgb)!=null?o:u.DEFAULT_FONT_COLOR,s={fontWeight:S?"bold":void 0,fontStyle:I?"italic":void 0,textDecoration:`${E?"underline":""} ${R?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:p,color:i};return _.jsx("div",{style:s,className:_t.cfPreview,children:"123"})}}return null},ge={cfRuleList:"univer-cf-rule-list",ruleSelector:"univer-rule-selector",select:"univer-select",btnList:"univer-btn-list",gap:"univer-gap",icon:"univer-icon",disabled:"univer-disabled",ruleItem:"univer-rule-item",ruleDescribe:"univer-rule-describe",ruleType:"univer-rule-type",ruleRange:"univer-rule-range",active:"univer-active",draggableHandle:"univer-draggableHandle",deleteItem:"univer-delete-item",gridLayoutWrap:"univer-grid-layout-wrap"},Sa=(e,t)=>{const n=e.rule;switch(n.type){case u.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case u.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case u.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case u.CFRuleType.highlightCell:switch(n.subType){case u.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case u.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case u.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case u.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(a=>String(a)):[String(n.value||"")])}case u.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case u.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case u.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case u.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let cn=0;const Ca=e=>{const{onClick:t}=e,n=te.useDependency(u.ConditionalFormattingRuleModel),r=te.useDependency(w.IUniverInstanceService),a=te.useDependency(Y.SheetsSelectionsService),o=te.useDependency(w.ICommandService),c=te.useDependency(w.LocaleService),y=te.useDependency(w.Injector),h=te.useDependency(te.ISidebarService),T=te.useDependency(Ae),m=te.useObservable(()=>r.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),C=m.getUnitId(),E=m.getActiveSheet();if(!E)throw new Error("No active sheet found");const R=E.getSheetId(),[I,S]=V.useState([]),[p,i]=V.useState("2"),[s,f]=V.useState(0),[b,l]=V.useState(-1),[g,d]=V.useState(cn),v=V.useRef(null),D=[{label:c.t("sheet.cf.panel.workSheet"),value:"2"},{label:c.t("sheet.cf.panel.selectedRange"),value:"1"}],M=()=>{const W=n.getSubunitRules(C,R);if(!W||!W.length)return[];if(p==="1"){const ee=a.getCurrentLastSelection();if(!ee)return[];const ne=ee.range;return W.filter(fe=>fe.ranges.some(ve=>w.Rectangle.intersects(ve,ne)))}else if(p==="2")return[...W];return[]},[U,z]=V.useState(M);pe.useHighlightRange(I),V.useEffect(()=>{const W=o.onCommandExecuted(ee=>{ee.id===Y.SetWorksheetActiveOperation.id&&f(Math.random())});return()=>W.dispose()}),V.useEffect(()=>{z(M)},[p,s,C,R]),V.useEffect(()=>{if(p==="2")return;const W=new Ce.Observable(ee=>{const ne=[Y.SetSelectionsOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],le=o.onCommandExecuted(fe=>{const{id:ve,params:Te}=fe,H=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId();ne.includes(ve)&&Te.unitId===H&&ee.next(null)});return()=>le.dispose()}).pipe(Ce.debounceTime(16)).subscribe(()=>{z(M)});return()=>{W.unsubscribe()}},[r,p,C,R]),V.useEffect(()=>{const W=n.$ruleChange.subscribe(()=>{f(Math.random())});return()=>W.unsubscribe()},[n]),V.useEffect(()=>{const W=()=>{var fe,ve;const le=Math.max(0,((ve=(fe=v.current)==null?void 0:fe.getBoundingClientRect().width)!=null?ve:0)-8);return cn=le,le},ne=new Ce.Observable(le=>{const fe=h.getContainer();if(fe){let ve=setTimeout(()=>{le.next()},150);const Te=()=>{ve&&clearTimeout(ve),ve=null},H=J=>{J.propertyName==="width"&&(Te(),le.next())};return fe.addEventListener("transitionend",H),()=>{Te(),fe.removeEventListener("transitionend",H)}}}).pipe(Ce.debounceTime(16)).subscribe(()=>{d(W())});return()=>{ne.unsubscribe()}},[]);const O=W=>{var le;const ee=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),ne=(le=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:le.getSheetId();if(!ee||!ne)throw new Error("No active sheet found");o.executeCommand(u.DeleteCfCommand.id,{unitId:ee,subUnitId:ne,cfId:W.cfId})},L=(W,ee)=>{l(ee.y)},B=(W,ee,ne)=>{var J;l(-1);const le=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),fe=(J=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:J.getSheetId();if(!le||!fe)throw new Error("No active sheet found");const ve=se=>{const P=U.length;return Math.min(P-1,Math.max(0,se))},Te=U[ve(ee.y)].cfId,H=U[ve(ne.y)].cfId;Te!==H&&o.executeCommand(u.MoveCfCommand.id,{unitId:le,subUnitId:fe,start:{id:Te,type:"self"},end:{id:H,type:ne.y>ee.y?"after":"before"}})},q=()=>{e.onCreate()},$=()=>{p==="2"?o.executeCommand(u.ClearWorksheetCfCommand.id):p==="1"&&U.map(ee=>({unitId:C,subUnitId:R,cfId:ee.cfId})).forEach(ee=>{o.executeCommand(u.DeleteCfCommand.id,ee)})},ie=V.useMemo(()=>{const W=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET),ee=W.getActiveSheet();return U.filter(ne=>{const le=ne.ranges;return Y.checkRangesEditablePermission(y,W.getUnitId(),ee.getSheetId(),le)})},[U]),oe=ie.map((W,ee)=>({i:W.cfId,x:0,w:12,y:ee,h:1,isResizable:!1})),ce=V.useMemo(()=>{const W=r.getCurrentUnitOfType(w.UniverInstanceType.UNIVER_SHEET),ee=W.getActiveSheet();return U.every(ne=>{const le=ne.ranges;return Y.checkRangesEditablePermission(y,W.getUnitId(),ee.getSheetId(),le)})},[U]);return _.jsxs("div",{className:ge.cfRuleList,children:[_.jsxs("div",{className:ge.ruleSelector,children:[_.jsx("div",{children:T.tWithReactNode("sheet.cf.panel.managerRuleSelect",_.jsx(Z.Select,{className:ge.select,options:D,value:p,onChange:W=>{i(W)}})).map((W,ee)=>_.jsx("span",{children:W},ee))}),_.jsxs("div",{className:ge.btnList,children:[_.jsx(Z.Tooltip,{title:c.t("sheet.cf.panel.createRule"),placement:"bottom",children:_.jsx("div",{className:ge.icon,onClick:q,children:_.jsx(vr,{})})}),U.length&&ce?_.jsx(Z.Tooltip,{title:c.t("sheet.cf.panel.clear"),placement:"bottom",children:_.jsx("div",{className:Z.clsx(ge.gap,ge.icon),onClick:$,children:_.jsx(gt,{})})}):_.jsx("div",{className:Z.clsx(ge.gap,ge.disabled),children:_.jsx(gt,{})})]})]}),_.jsx("div",{ref:v,className:ge.gridLayoutWrap,children:g?_.jsx(va,{draggableHandle:".draggableHandle",layout:oe,cols:12,rowHeight:60,width:g,margin:[0,10],onDragStop:B,onDragStart:L,children:ie==null?void 0:ie.map((W,ee)=>_.jsx("div",{children:_.jsxs("div",{className:Z.clsx(ge.ruleItem,{[ge.active]:b===ee}),onMouseMove:()=>{W.ranges!==I&&S(W.ranges)},onMouseLeave:()=>S([]),onClick:()=>{t(W)},children:[_.jsx("div",{className:Z.clsx(ge.draggableHandle,"draggableHandle"),onClick:ne=>ne.stopPropagation(),children:_.jsx(mr,{})}),_.jsxs("div",{className:ge.ruleDescribe,children:[_.jsx("div",{className:ge.ruleType,children:Sa(W,c)}),_.jsx("div",{className:ge.ruleRange,children:W.ranges.map(ne=>kt.serializeRange(ne)).join(",")})]}),_.jsx("div",{className:ge.preview,children:_.jsx(We,{rule:W.rule})}),_.jsx("div",{className:Z.clsx(ge.deleteItem,{[ge.active]:b===ee}),onClick:ne=>{ne.stopPropagation(),O(W),S([])},children:_.jsx(gt,{})})]})},`${W.cfId}`))}):null})]})},un={cfColorPickerIcon:"univer-cf-color-picker-icon",iconDropdown:"univer-icon-dropdown"},Me=e=>{const{color:t,onChange:n,disable:r=!1,iconId:a="PaintBucket",className:o,isNeedDropdownIcon:c=!0}=e,y=te.useDependency(te.ComponentManager),h=V.useMemo(()=>new w.ColorKit(t),[t]),T=y.get(a);return T&&(r?_.jsx(T,{className:o,extend:{colorChannel1:h.isValid?t:"rgb(var(--primary-color))"}}):_.jsx(Z.Dropdown,{overlay:_.jsx("div",{className:"univer-rounded-lg univer-p-4",children:_.jsx(Z.ColorPicker,{value:t,onChange:n})}),children:_.jsxs("span",{className:`
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
`,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`,children:_.jsx(Ge.FormulaEditor,{onChange:l=>{S(l),f({style:E})},onVerify:(l,g)=>{!l||g.length===1?i(r.t("sheet.cf.errorMessage.formulaError")):i(void 0)},errorText:p,onFocus:()=>{m(!0)},isFocus:T,initValue:I,unitId:o.getUnitId(),subUnitId:c==null?void 0:c.getSheetId(),ref:C})}),_.jsx("div",{className:`
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
${A.mTSm}
|
|
86
|
-
${F.width100}
|
|
87
|
-
`,onChange:i,value:T||"",options:h}),_.jsx(_a,{value:C,interceptorManager:t,type:o,operator:T,rule:a,onChange:s},f),_.jsx("div",{className:`
|
|
88
|
-
${F.cfPreviewWrap}
|
|
89
|
-
`,children:_.jsx(We,{rule:S({})})}),_.jsx(lr,{style:a==null?void 0:a.style,className:`
|
|
90
|
-
${A.mLXxs}
|
|
91
|
-
`,onChange:l=>{I(l),n(S({style:l}))}})]})},hn=(e,t)=>(u.iconMap[e]||[])[Number(t)]||"",Ra=e=>{var h;const t=te.useDependency(w.IUniverInstanceService),n=t.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=(h=t.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:h.getSheetId(),a=V.useMemo(()=>e.error?F.errorInput:"",[e.error]),o=V.useRef(null),[c,y]=V.useState(!1);return te.useSidebarClick(T=>{var C;((C=o.current)==null?void 0:C.isClickOutSide(T))&&y(!1)}),_.jsx("div",{className:F.positionRelative,children:e.type!==u.CFValueType.formula?_.jsxs(_.Fragment,{children:[_.jsx(Z.InputNumber,{className:a,value:Number(e.value)||0,onChange:T=>e.onChange(T!=null?T:0)}),e.error&&_.jsx("div",{className:F.errorText,children:e.error})]}):_.jsx("div",{style:{width:"100%"},children:_.jsx(Ge.FormulaEditor,{initValue:String(e.value),unitId:n,subUnitId:r,isFocus:c,onChange:(T="")=>{const m=T||"";e.onChange(m)},onFocus:()=>y(!0),ref:o})})})},gn=(e,t,n)=>({operator:u.CFNumberOperator.greaterThan,value:{type:u.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Ea=V.forwardRef((e,t)=>{const n=te.useDependency(w.LocaleService),r=a=>{e.onClick(a)};return _.jsx("div",{ref:t,className:F.iconGroupList,children:u.iconGroup.map((a,o)=>_.jsxs("div",{className:F.group,children:[_.jsx("div",{className:F.title,children:n.t(a.title)}),_.jsx("div",{className:F.itemContent,children:a.group.map(c=>_.jsx("div",{className:F.itemWrap,onClick:()=>{r(c.name)},children:_.jsx("div",{className:F.item,children:c.list.map((y,h)=>_.jsx("img",{className:F.icon,src:y},h))})},c.name))})]},o))})}),Oa=e=>{const t=V.useMemo(()=>{const r=[];for(const a in u.iconMap){const o=u.iconMap[a],c=a;o.forEach((y,h)=>{r.push({iconType:c,base64:y,iconId:String(h)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return _.jsxs("div",{className:F.iconItemListWrap,children:[_.jsxs("div",{className:F.none,onClick:()=>n({iconType:u.EMPTY_ICON_TYPE,iconId:""}),children:[_.jsx(Xe,{className:F.icon}),_.jsx("span",{children:"无单元格图标"})]}),_.jsx("div",{className:F.iconItemList,children:t.map(r=>_.jsx("div",{className:F.item,children:_.jsx("img",{onClick:()=>n(r),className:`
|
|
92
|
-
${F.icon}
|
|
93
|
-
`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},Pa=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,a=te.useDependency(w.LocaleService),o=[{label:a.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThan}`),value:u.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${u.CFNumberOperator.greaterThanOrEqual}`),value:u.CFNumberOperator.greaterThanOrEqual}],c=[{label:a.t(`sheet.cf.valueType.${u.CFValueType.num}`),value:u.CFValueType.num},{label:a.t(`sheet.cf.valueType.${u.CFValueType.percent}`),value:u.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${u.CFValueType.percentile}`),value:u.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${u.CFValueType.formula}`),value:u.CFValueType.formula}],y=(C,E)=>{t([String(E),"value","value"],C)},h=(C,E)=>{t([String(E),"operator"],C);const R=u.createDefaultValue(u.CFSubRuleType.number,C);y(R,E)},T=(C,E)=>{t([String(E),"value","type"],C);const R=n[E],I=u.createDefaultValue(u.CFSubRuleType.number,R.operator);y(I,E)};return V.useMemo(()=>n.map((C,E)=>{const R=r[E],I=hn(C.iconType,C.iconId),S=E===n.length-1,p=E===0,i=n[E-1],s=(i==null?void 0:i.value.type)===u.CFValueType.formula?a.t("sheet.cf.valueType.formula"):i==null?void 0:i.value.value,f=(b,l)=>{const g={...C,iconId:l,iconType:b};t([String(E)],g)};return _.jsxs("div",{className:`
|
|
94
|
-
${E?A.mTXl:A.mTSm}
|
|
95
|
-
`,children:[_.jsxs("div",{className:`
|
|
96
|
-
${A.label}
|
|
97
|
-
${F.flex}
|
|
98
|
-
`,children:[_.jsxs("div",{className:`
|
|
99
|
-
${F.width45}
|
|
100
|
-
`,children:[a.t("sheet.cf.iconSet.icon"),E+1]}),_.jsx("div",{className:`
|
|
101
|
-
${F.width45}
|
|
102
|
-
`,children:_.jsxs(_.Fragment,{children:[!p&&!S&&a.t("sheet.cf.iconSet.rule"),!p&&!S&&_.jsxs("span",{className:F.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${u.getOppositeOperator(i.operator)}`),s,S?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),_.jsxs("div",{className:`
|
|
103
|
-
${F.flex}
|
|
104
|
-
${A.mTSm}
|
|
105
|
-
`,children:[_.jsx("div",{className:`
|
|
106
|
-
${F.iconWrap}
|
|
107
|
-
${F.width45}
|
|
108
|
-
`,children:_.jsx(Z.Dropdown,{overlay:_.jsx("div",{className:"univer-rounded-lg univer-p-4",children:_.jsx(Oa,{onClick:f,iconId:C.iconId,iconType:C.iconType})}),children:_.jsxs("div",{className:Z.clsx(F.dropdownIcon,"univer-box-border univer-h-7"),children:[I?_.jsx("img",{src:I,className:F.icon}):_.jsx(Xe,{className:F.icon}),_.jsx(vt,{})]})})}),S?_.jsxs("div",{className:`
|
|
109
|
-
${F.width45}
|
|
110
|
-
${A.label}
|
|
111
|
-
`,style:{marginTop:0},children:[a.t("sheet.cf.iconSet.rule"),_.jsxs("span",{className:F.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${u.getOppositeOperator(i.operator)}`),s,S?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]}):_.jsx(Z.Select,{className:`
|
|
112
|
-
${A.mL0}
|
|
113
|
-
${F.width45}
|
|
114
|
-
${A.mR0}
|
|
115
|
-
`,options:o,value:C.operator,onChange:b=>{h(b,E)}})]}),S?_.jsx("div",{}):_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:`
|
|
116
|
-
${A.mTSm}
|
|
117
|
-
${A.label}
|
|
118
|
-
${F.flex}
|
|
119
|
-
`,children:[_.jsx("div",{className:`
|
|
120
|
-
${F.width45}
|
|
121
|
-
`,children:a.t("sheet.cf.iconSet.type")}),_.jsx("div",{className:`
|
|
122
|
-
${F.width45}
|
|
123
|
-
`,children:a.t("sheet.cf.iconSet.value")})]}),_.jsxs("div",{className:`
|
|
124
|
-
${A.mTSm}
|
|
125
|
-
${F.flex}
|
|
126
|
-
`,children:[_.jsx(Z.Select,{style:{flexShrink:0},className:`
|
|
127
|
-
${F.width45}
|
|
128
|
-
${A.mL0}
|
|
129
|
-
`,options:c,value:C.value.type,onChange:b=>{T(b,E)}}),_.jsx("div",{className:`
|
|
130
|
-
${A.mL0}
|
|
131
|
-
${F.width45}
|
|
132
|
-
`,children:_.jsx(Ra,{id:E,type:C.value.type,error:R,value:C.value.value||"",onChange:b=>y(b,E)})})]})]})]},E)}),[n,r])},xa=e=>{var b;const{interceptorManager:t}=e,n=((b=e.rule)==null?void 0:b.type)===u.CFRuleType.iconSet?e.rule:void 0,r=te.useDependency(w.LocaleService),[a,o]=V.useState({}),[c,y]=V.useState(()=>{const l=Object.keys(u.iconMap)[0];if(n&&n.config.length){const g=n.config[0].iconType;if(!n.config.some(v=>v.iconType!==g))return g}return l}),[h,T]=V.useState(()=>{if(n&&n.config.length)return w.Tools.deepClone(n==null?void 0:n.config);const l=u.iconMap[c]||[];return new Array(l.length).fill("").map((g,d,v)=>d===v.length-1?{operator:u.CFNumberOperator.lessThanOrEqual,value:{type:u.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:c,iconId:String(d)}:gn(c,d,v))}),[m,C]=V.useState(()=>n?!!n.isShowValue:!0),E=V.useMemo(()=>{const l=h.map(g=>hn(g.iconType,g.iconId));return _.jsx("div",{className:F.iconWrap,children:l.map((g,d)=>g?_.jsx("img",{className:F.icon,src:g},d):_.jsx(Xe,{className:F.icon},d))})},[h]),R=l=>{if(l.reduce((d,v,D)=>d.preType&&!d.result||l.length-1===D?d:v.value.type===u.CFValueType.formula?{preType:u.CFValueType.formula,result:!1}:d.preType?{result:d.preType===v.value.type,preType:v.value.type}:{result:!0,preType:v.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((v,D,M)=>{if(D-1<0||D===M.length-1)return;const z=l[D-1],O=u.getOppositeOperator(z.operator);u.compareWithNumber({operator:O,value:z.value.value},v.value.value)||(d[D]=`${r.t(`sheet.cf.form.${O}`,String(z.value.value))} `)}),d}return{}},I=(l,g)=>{w.get(h,l)!==g&&(w.set(h,l,g),T([...h]),o(R(h)))},S=l=>{y(l);const g=u.iconMap[l]||[],d=new Array(g.length).fill("").map((v,D,M)=>gn(l,D,M));T(d),o(R(d))};V.useEffect(()=>{const l=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:u.CFRuleType.iconSet,isShowValue:m,config:h}}});return()=>{l()}},[m,h,t]),V.useEffect(()=>{const l=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{l()}},[m,h,t,a]);const p=()=>{const l=h.map(g=>({...g}));h.forEach((g,d)=>{const v=h.length-1-d,D=l[v];g.iconId=D.iconId,g.iconType=D.iconType}),T([...h])},i=te.useDependency(te.ILayoutService),[s,f]=V.useState();return te.useScrollYOverContainer(s,i.rootContainerElement),_.jsxs("div",{className:F.iconSet,children:[_.jsx("div",{className:A.title,children:r.t("sheet.cf.panel.styleRule")}),_.jsx("div",{className:`
|
|
133
|
-
${A.mTSm}
|
|
134
|
-
`,children:_.jsx(Z.Dropdown,{overlay:_.jsx("div",{className:"univer-rounded-lg univer-p-4",children:_.jsx(Ea,{ref:l=>{!s&&l&&f(l)},iconType:c,onClick:S})}),children:_.jsxs("div",{className:Z.clsx(F.dropdownIcon,"univer-box-border univer-h-7 univer-w-auto"),children:[E,_.jsx(vt,{})]})})}),_.jsxs("div",{className:`
|
|
135
|
-
${A.mTSm}
|
|
136
|
-
${F.renderConfig}
|
|
137
|
-
`,children:[_.jsxs("div",{className:F.utilItem,children:[_.jsx(Z.Checkbox,{onChange:p}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),_.jsxs("div",{className:`
|
|
138
|
-
${F.utilItem}
|
|
139
|
-
${A.mLXl}
|
|
140
|
-
`,children:[_.jsx(Z.Checkbox,{checked:!m,onChange:l=>{C(!l)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),_.jsx(Pa,{errorMap:a,onChange:I,configList:h})]})},Da=e=>{var p;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(w.LocaleService),a=((p=e.rule)==null?void 0:p.type)===u.CFRuleType.highlightCell?e.rule:void 0,o=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[c,y]=V.useState(()=>{const i=o[0].value,s=a==null?void 0:a.type;if(!a)return i;switch(s){case u.CFRuleType.highlightCell:switch(a.subType){case u.CFSubRuleType.average:return[u.CFNumberOperator.greaterThan,u.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[u.CFNumberOperator.lessThan,u.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":i;case u.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return i}),[h,T]=V.useState(()=>{const s=a==null?void 0:a.type;if(!a)return 10;switch(s){case u.CFRuleType.highlightCell:switch(a.subType){case u.CFSubRuleType.rank:return a.value||10}}return 10}),[m,C]=V.useState(()=>{const s=a==null?void 0:a.type;if(!a)return!1;switch(s){case u.CFRuleType.highlightCell:switch(a.subType){case u.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[E,R]=V.useState({}),I=i=>{const{type:s,isPercent:f,value:b,style:l}=i;if(s==="isNotBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!1,value:b,style:l};if(s==="isBottom")return{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank,isPercent:f,isBottom:!0,value:b,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}};V.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return I({type:c,isPercent:m,value:h,style:E})}}),[c,m,h,E,n]);const S=i=>{t(I(i))};return _.jsxs("div",{children:[_.jsx("div",{className:`
|
|
141
|
-
${A.title}
|
|
142
|
-
${A.mTBase}
|
|
143
|
-
`,children:r.t("sheet.cf.panel.styleRule")}),_.jsx(Z.Select,{className:`
|
|
144
|
-
${F.width100}
|
|
145
|
-
${A.mTSm}
|
|
146
|
-
`,value:c,options:o,onChange:i=>{y(i),S({type:i,isPercent:m,value:h,style:E})}}),["isNotBottom","isBottom"].includes(c)&&_.jsxs("div",{className:`
|
|
147
|
-
${A.labelContainer}
|
|
148
|
-
${A.mTSm}
|
|
149
|
-
`,children:[_.jsx(Z.InputNumber,{min:1,max:1e3,value:h,onChange:i=>{const s=i||0;T(s),S({type:c,isPercent:m,value:s,style:E})}}),_.jsxs("div",{className:`
|
|
150
|
-
${A.mLSm}
|
|
151
|
-
${A.labelContainer}
|
|
152
|
-
${F.text}
|
|
153
|
-
`,children:[_.jsx(Z.Checkbox,{checked:m,onChange:i=>{C(!!i),S({type:c,isPercent:!!i,value:h,style:E})}}),r.t("sheet.cf.valueType.percent")]})]}),_.jsx("div",{className:`
|
|
154
|
-
${F.cfPreviewWrap}
|
|
155
|
-
`,children:_.jsx(We,{rule:I({type:c,isPercent:m,value:h,style:E})})}),_.jsx(lr,{style:a==null?void 0:a.style,className:`
|
|
156
|
-
${A.mTSm}
|
|
157
|
-
`,onChange:i=>{R(i),S({type:c,isPercent:m,value:h,style:i})}})]})},Ma=w.createInterceptorKey("beforeSubmit"),Na=w.createInterceptorKey("submit"),vn=e=>e.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),mn=e=>{var t;return(t=e.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:t.getSheetId()},La=e=>{var d,v,D;const t=te.useDependency(w.LocaleService),n=te.useDependency(w.ICommandService),r=te.useDependency(w.IUniverInstanceService),a=te.useDependency(u.ConditionalFormattingRuleModel),o=te.useDependency(Y.SheetsSelectionsService),c=vn(r),y=mn(r),[h,T]=V.useState(void 0),m=V.useRef((v=(d=e.rule)==null?void 0:d.ranges)!=null?v:[]),C=V.useMemo(()=>{var U,z,O;let M=(U=e.rule)==null?void 0:U.ranges;return M!=null&&M.length||(M=(O=(z=o.getCurrentSelections())==null?void 0:z.map(L=>L.range))!=null?O:[]),m.current=M,M!=null&&M.length?M.map(L=>{const B=kt.serializeRange(L);return B==="NaN"?"":B}).filter(L=>!!L).join(","):""},[e.rule]),E=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[R,I]=V.useState(()=>{var z,O;const M=(z=e.rule)==null?void 0:z.rule.type,U=E[0].value;if(!M)return U;switch(M){case u.CFRuleType.highlightCell:{switch((O=e.rule)==null?void 0:O.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}),S=V.useRef(void 0),p=V.useMemo(()=>new w.InterceptorManager({beforeSubmit:Ma,submit:Na}),[]),i=V.useMemo(()=>{switch(R){case"1":return pn;case"2":return Da;case"3":return wa;case"4":return Ta;case"5":return Ia;case"6":return xa;default:return pn}},[R]);V.useEffect(()=>{const M=n.onCommandExecuted(U=>{if(U.id===Y.RemoveSheetMutation.id){const z=U.params;z.subUnitId===y&&z.unitId===c&&e.onCancel()}U.id===Y.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>M.dispose()},[]);const s=M=>{S.current=M},f=M=>{const U=M.split(",").filter(z=>!!z).map(kt.deserializeRangeWithSheet).map(z=>z.range);m.current=U},b=()=>{if(h)return;const U=(()=>{const O=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!O)throw new Error("No active sheet found");return m.current.map(q=>Y.setEndForRange(q,O.getRowCount(),O.getColumnCount())).filter(q=>!(Number.isNaN(q.startRow)||Number.isNaN(q.startColumn)))})();if(p.fetchThroughInterceptors(p.getInterceptPoints().beforeSubmit)(!0,null)){const O=p.fetchThroughInterceptors(p.getInterceptPoints().submit)(null,null);if(O){const L=vn(r),B=mn(r);if(!L||!B)throw new Error("No active sheet found");let q={};e.rule&&e.rule.cfId?(q={...e.rule,ranges:U,rule:O},n.executeCommand(u.SetCfCommand.id,{unitId:L,subUnitId:B,rule:q}),e.onCancel()):(q={cfId:a.createCfId(L,B),ranges:U,rule:O,stopIfTrue:!1},n.executeCommand(u.AddCfCommand.id,{unitId:L,subUnitId:B,rule:q}),e.onCancel())}}},l=()=>{e.onCancel()},g=(M,U)=>{M?U.length<1?T(t.t("sheet.cf.errorMessage.rangeError")):T(void 0):T(t.t("sheet.cf.errorMessage.rangeError"))};return _.jsxs("div",{className:F.cfRuleStyleEditor,children:[_.jsx("div",{className:A.title,children:t.t("sheet.cf.panel.range")}),_.jsxs("div",{className:`
|
|
158
|
-
${A.mTBase}
|
|
159
|
-
`,children:[_.jsx(Ge.RangeSelector,{unitId:c,subUnitId:y,initialValue:C,onChange:(M,U)=>f(U),onVerify:g}),h&&_.jsx("div",{className:F.cfErrorText,children:h})]}),_.jsx("div",{className:A.title,children:t.t("sheet.cf.panel.styleType")}),_.jsx("div",{className:A.mTBase,children:_.jsx(Z.Select,{className:F.width100,value:R,options:E,onChange:M=>I(M)})}),_.jsx(i,{interceptorManager:p,rule:(D=e.rule)==null?void 0:D.rule,onChange:s}),_.jsxs("div",{className:`
|
|
160
|
-
${A.mTBase}
|
|
161
|
-
${F.btnList}
|
|
162
|
-
`,children:[_.jsx(Z.Button,{onClick:l,children:t.t("sheet.cf.panel.cancel")}),_.jsx(Z.Button,{className:A.mLSm,variant:"primary",onClick:b,children:t.t("sheet.cf.panel.submit")})]})]})},Va=e=>{const[t,n]=V.useState(e.rule),[r,a]=V.useState(!!e.rule),o=()=>{a(!0)},c=()=>{a(!1),n(void 0)},y=h=>{n(h),a(!0)};return _.jsx("div",{className:A.conditionalFormattingWrap,children:r?_.jsx(La,{onCancel:c,rule:t}):_.jsx(Ca,{onClick:y,onCreate:o})})};var Ua=Object.getOwnPropertyDescriptor,za=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ua(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},at=(e,t)=>(n,r)=>t(n,r,e);const Pt="sheet.conditional.formatting.panel";let ot=class extends w.Disposable{constructor(t,n,r,a,o){super();xe(this,"_sidebarDisposable",null);this._univerInstanceService=t,this._injector=n,this._componentManager=r,this._sidebarService=a,this._localeService=o,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET).subscribe(c=>{var y;c||(y=this._sidebarDisposable)==null||y.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(c=>{c.id===Pt&&(c.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(t){const n={id:Pt,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Pt,rule:t,key:w.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initPanel(){this._componentManager.register(Pt,Va)}};ot=za([at(0,w.IUniverInstanceService),at(1,w.Inject(w.Injector)),at(2,w.Inject(te.ComponentManager)),at(3,w.Inject(te.ISidebarService)),at(4,w.Inject(w.LocaleService))],ot);var ye=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(ye||{});const it={id:"sheet.operation.open.conditional.formatting.panel",type:w.CommandType.OPERATION,handler:(e,t)=>{var y;const n=e.get(ot),r=e.get(Y.SheetsSelectionsService),a=e.get(w.ICommandService),o=((y=r.getCurrentSelections())==null?void 0:y.map(h=>h.range))||[];switch(t.value){case 3:{n.openPanel({...u.createDefaultRule(),ranges:o});break}case 4:{const h={...u.createDefaultRule,ranges:o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.rank}};n.openPanel(h);break}case 5:{const h={...u.createDefaultRule,ranges:o,rule:{type:u.CFRuleType.highlightCell,subType:u.CFSubRuleType.formula,value:"="}};n.openPanel(h);break}case 6:{const h={...u.createDefaultRule,ranges:o,rule:{type:u.CFRuleType.colorScale,config:[]}};n.openPanel(h);break}case 7:{const h={...u.createDefaultRule,ranges:o,rule:{type:u.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(h);break}case 8:{const h={...u.createDefaultRule,ranges:o,rule:{type:u.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(h);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...u.createDefaultRule(),ranges:o});break}case 9:{a.executeCommand(u.ClearRangeCfCommand.id,{ranges:o});break}case 10:{a.executeCommand(u.ClearWorksheetCfCommand.id);break}}return!0}};var ka=Object.getOwnPropertyDescriptor,Aa=(e,t,n,r)=>{for(var a=r>1?void 0:r?ka(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},st=(e,t)=>(n,r)=>t(n,r,e);let lt=class extends w.Disposable{constructor(t,n,r,a,o){super();xe(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=a,this._univerInstanceService=o,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,a)=>{const{copyType:o=pe.COPY_TYPE.COPY,pasteType:c}=a,{range:y}=t||{},{range:h}=n;return this._generateConditionalFormattingMutations(h,{copyType:o,pasteType:c,copyRange:y})}}))}_collectConditionalRule(t,n,r){const a=new w.ObjectMatrix,o={};this._copyInfo={matrix:a,info:{unitId:t,subUnitId:n,cfMap:o}};const c=this._injector.invoke(m=>Y.rangeToDiscreteRange(r,m,t,n));if(!c)return;const{rows:y,cols:h}=c,T=new Set;y.forEach((m,C)=>{h.forEach((E,R)=>{const I=this._conditionalFormattingViewModel.getCellCfs(t,n,m,E);I&&(I.forEach(S=>T.add(S.cfId)),a.setValue(C,R,I.map(S=>S.cfId)))})}),T.forEach(m=>{const C=this._conditionalFormattingRuleModel.getRule(t,n,m);C&&(o[m]=C.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),a=r.getActiveSheet(),o=r.getUnitId();if(!a)return{redos:[],undos:[]};const c=a.getSheetId();if(n.copyType===pe.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![pe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,pe.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,pe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[h,T],mapFunc:m}=pe.virtualizeDiscreteRanges([n.copyRange,t]),C=pe.getRepeatRange(h,T,!0),E={};w.Range.foreach(T,(l,g)=>{const{row:d,col:v}=m(l,g),D=this._conditionalFormattingViewModel.getCellCfs(o,c,d,v);D&&D.forEach(M=>{if(!E[M.cfId]){const U=new w.ObjectMatrix;E[M.cfId]=U;const z=this._conditionalFormattingRuleModel.getRule(o,c,M.cfId);z==null||z.ranges.forEach(O=>{w.Range.foreach(O,(L,B)=>{U.setValue(L,B,1)})})}E[M.cfId].realDeleteValue(d,v)})});const{matrix:R,info:I}=this._copyInfo,S=[];let p=this._conditionalFormattingRuleModel.createCfId(o,c);const i={},s=l=>{if(i[l])return i[l];const g=I==null?void 0:I.cfMap[l],d=[...this._conditionalFormattingRuleModel.getSubunitRules(o,c)||[],...S].find(v=>w.Tools.diffValue(v.rule,g));if(d)return i[l]=d,d;{const v={rule:g,cfId:p,ranges:[],stopIfTrue:!1};return i[l]=v,S.push(v),p=`${Number(p)+1}`,v}};C.forEach(l=>{R&&R.forValue((g,d,v)=>{const D=w.Rectangle.getPositionRange({startRow:g,endRow:g,startColumn:d,endColumn:d},l.startRange),{row:M,col:U}=m(D.startRow,D.startColumn);v.forEach(z=>{if(!E[z]){const O=s(z),L=new w.ObjectMatrix;E[z]=L,O.ranges.forEach(B=>{w.Range.foreach(B,(q,$)=>{L.setValue(q,$,1)})})}E[z].setValue(M,U,1)})})});const f=[],b=[];for(const l in E){const g=E[l],d=Y.findAllRectangle(Y.createTopMatrixFromMatrix(g));if(!d.length){const v={unitId:o,subUnitId:c,cfId:l};f.push({id:u.DeleteConditionalRuleMutation.id,params:v}),b.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,v))}if(S.some(v=>v.cfId===l)){const v=s(l),D={unitId:o,subUnitId:c,rule:{...v,ranges:d}};f.push({id:u.AddConditionalRuleMutation.id,params:D}),b.push(u.AddConditionalRuleMutationUndoFactory(this._injector,D))}else{const v=this._conditionalFormattingRuleModel.getRule(o,c,l);if(!v)continue;const D={unitId:o,subUnitId:c,rule:{...v,ranges:d}};f.push({id:u.SetConditionalRuleMutation.id,params:D}),b.push(...u.setConditionalRuleMutationUndoFactory(this._injector,D))}}return{redos:f,undos:b}}};lt=Aa([st(0,w.Inject(pe.ISheetClipboardService)),st(1,w.Inject(u.ConditionalFormattingRuleModel)),st(2,w.Inject(w.Injector)),st(3,w.Inject(u.ConditionalFormattingViewModel)),st(4,w.Inject(w.IUniverInstanceService))],lt);var Wa=Object.getOwnPropertyDescriptor,ja=(e,t,n,r)=>{for(var a=r>1?void 0:r?Wa(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},cr=(e,t)=>(n,r)=>t(n,r,e);let ct=class extends w.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===u.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[Y.WorkbookEditablePermission],rangeTypes:[Y.RangeProtectionPermissionEditPoint],worksheetTypes:[Y.WorksheetEditPermission,Y.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};ct=ja([cr(0,w.Inject(w.LocaleService)),cr(1,w.ICommandService),cr(2,w.Inject(Y.SheetPermissionCheckController))],ct);var Ha=Object.getOwnPropertyDescriptor,Ba=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ha(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},xt=(e,t)=>(n,r)=>t(n,r,e);let ut=class extends w.Disposable{constructor(e,t,n,r){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._refRangeService=r,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,a,o)=>`${r}_${a}_${o}`,n=(r,a,o)=>{const c=h=>{const T=[...o.ranges],m=T.map(E=>Y.handleDefaultRangeChangeWithEffectRefCommands(E,h)).filter(E=>!!E);if(u.isRangesEqual(m,T))return{redos:[],undos:[]};if(m.length){const E={unitId:r,subUnitId:a,rule:{...o,ranges:m}},R=[{id:u.SetConditionalRuleMutation.id,params:E}],I=u.setConditionalRuleMutationUndoFactory(this._injector,E);return{redos:R,undos:I}}else{const E={unitId:r,subUnitId:a,cfId:o.cfId},R=[{id:u.DeleteConditionalRuleMutation.id,params:E}],I=u.DeleteConditionalRuleMutationUndoFactory(this._injector,E);return{redos:R,undos:I}}},y=[];o.ranges.forEach(h=>{const T=this._refRangeService.registerRefRange(h,c);y.push(()=>T.dispose())}),e.set(t(r,a,o.cfId),()=>y.forEach(h=>h()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:a,subUnitId:o,rule:c}=r,y=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),h=y.getActiveSheet();if(!(r.unitId!==y.getUnitId()||r.subUnitId!==(h==null?void 0:h.getSheetId())))switch(r.type){case"add":{n(r.unitId,r.subUnitId,r.rule);break}case"delete":{const T=e.get(t(a,o,c.cfId));T&&T();break}case"set":{const T=e.get(t(a,o,c.cfId));T&&T(),n(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(w.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};ut=Ba([xt(0,w.Inject(u.ConditionalFormattingRuleModel)),xt(1,w.Inject(w.IUniverInstanceService)),xt(2,w.Inject(w.Injector)),xt(3,w.Inject(Y.RefRangeService))],ut);var Fa=Object.getOwnPropertyDescriptor,Ga=(e,t,n,r)=>{for(var a=r>1?void 0:r?Fa(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},He=(e,t)=>(n,r)=>t(n,r,e);let dt=class extends w.Disposable{constructor(t,n,r,a,o,c){super();xe(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=t,this._conditionalFormattingService=n,this._univerInstanceService=r,this._renderManagerService=a,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=c,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var n,r,a;const t=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId();(n=this._renderManagerService.getRenderById(t))==null||n.with(pe.SheetSkeletonManagerService).reCalculate(),(a=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.mainComponent)==null||a.makeDirty()}_initSkeleton(){this.disposeWithMe(Ce.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(qe.bufferTime(16),qe.filter(t=>!!t.length),qe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return r?t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Y.INTERCEPTOR_POINT.CELL_CONTENT,{effect:w.InterceptorEffectEnum.Style,handler:(t,n,r)=>{const a=this._conditionalFormattingService.composeStyle(n.unitId,n.subUnitId,n.row,n.col);if(!a)return r(t);const o=n.workbook.getStyles(),y={...(typeof(t==null?void 0:t.s)=="string"?o.get(t==null?void 0:t.s):t==null?void 0:t.s)||{}},h={...t,s:y};return a.style&&Object.assign(y,a.style),h.fontRenderExtension||(h.fontRenderExtension={},a.isShowValue!==void 0&&(h.fontRenderExtension.isSkip=!a.isShowValue)),a.dataBar&&(h.dataBar=a.dataBar),a.iconSet&&(h.iconSet=a.iconSet,h.fontRenderExtension.leftOffset=u.DEFAULT_PADDING+u.DEFAULT_WIDTH),r(h)},priority:10}))}};dt=Ga([He(0,w.Inject(Y.SheetInterceptorService)),He(1,w.Inject(u.ConditionalFormattingService)),He(2,w.Inject(w.IUniverInstanceService)),He(3,w.Inject(hr.IRenderManagerService)),He(4,w.Inject(u.ConditionalFormattingViewModel)),He(5,w.Inject(u.ConditionalFormattingRuleModel))],dt);const yn="sheets-conditional-formatting-ui.config",Dt={};var qa=Object.defineProperty,Xa=Object.getOwnPropertyDescriptor,Ya=(e,t,n)=>t in e?qa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ka=(e,t,n,r)=>{for(var a=r>1?void 0:r?Xa(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},ur=(e,t)=>(n,r)=>t(n,r,e),bn=(e,t,n)=>Ya(e,typeof t!="symbol"?t+"":t,n);K.UniverSheetsConditionalFormattingMobileUIPlugin=class extends w.Plugin{constructor(t=Dt,n,r,a){super(),this._config=t,this._injector=n,this._commandService=r,this._configService=a;const{menu:o,...c}=w.merge({},Dt,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(yn,c),this._initCommand(),this._injector.add([dt]),this._injector.add([ut]),this._injector.add([lt]),this._injector.add([ct]),this._injector.add([Ae])}_initCommand(){[Wt,jt,Ht,Bt,Ft,Gt,qt,Xt,Yt,it].forEach(t=>{this._commandService.registerCommand(t)})}},bn(K.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),bn(K.UniverSheetsConditionalFormattingMobileUIPlugin,"type",w.UniverInstanceType.UNIVER_SHEET),K.UniverSheetsConditionalFormattingMobileUIPlugin=Ka([w.DependentOn(u.UniverSheetsConditionalFormattingPlugin),ur(1,w.Inject(w.Injector)),ur(2,w.Inject(w.ICommandService)),ur(3,w.IConfigService)],K.UniverSheetsConditionalFormattingMobileUIPlugin);var Za=Object.getOwnPropertyDescriptor,$a=(e,t,n,r)=>{for(var a=r>1?void 0:r?Za(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},ft=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends w.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(a,o,c,y,h)=>{var R;const T=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getUnitId(),m=(R=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:R.getSheetId();if(!T||!m)return;const C={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},E={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};w.Range.foreach(c,(I,S)=>{const p=w.Rectangle.getPositionRange({startRow:I,startColumn:S,endColumn:S,endRow:I},C),i=w.Rectangle.getPositionRange({startRow:I,startColumn:S,endColumn:S,endRow:I},E),{row:s,col:f}=h(p.startRow,p.startColumn),b=this._conditionalFormattingViewModel.getCellCfs(T,m,s,f),{row:l,col:g}=h(i.startRow,i.startColumn),d=this._conditionalFormattingViewModel.getCellCfs(T,m,l,g);d&&d.forEach(v=>{let D=y.get(v.cfId);if(!y.get(v.cfId)){const M=this._conditionalFormattingRuleModel.getRule(T,m,v.cfId);if(!M)return;D=new w.ObjectMatrix,M.ranges.forEach(U=>{w.Range.foreach(U,(z,O)=>{D.setValue(z,O,1)})}),y.set(v.cfId,D)}D.realDeleteValue(l,g)}),b&&b.forEach(v=>{let D=y.get(v.cfId);if(!y.get(v.cfId)){const M=this._conditionalFormattingRuleModel.getRule(T,m,v.cfId);if(!M)return;D=new w.ObjectMatrix,M.ranges.forEach(U=>{w.Range.foreach(U,(z,O)=>{D.setValue(z,O,1)})}),y.set(v.cfId,D)}D.setValue(l,g,1)})})},n=(a,o)=>{var i,s,f;const c=(i=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:i.getUnitId(),y=(f=(s=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getActiveSheet())==null?void 0:f.getSheetId(),h=new Map,T=[],m=[];if(!c||!y)return e();const C=pe.virtualizeDiscreteRanges([a,o]),[E,R]=C.ranges,{mapFunc:I}=C,S={row:E.startRow,col:E.startColumn};return pe.getAutoFillRepeatRange(E,R).forEach(b=>{t(S,b.repeatStartCell,b.relativeRange,h,I)}),h.forEach((b,l)=>{const g=this._conditionalFormattingRuleModel.getRule(c,y,l);if(!g)return;const d=Y.findAllRectangle(Y.createTopMatrixFromMatrix(b));if(d.length){const v={unitId:c,subUnitId:y,rule:{...g,ranges:d}};T.push({id:u.SetConditionalRuleMutation.id,params:v}),m.push(...u.setConditionalRuleMutationUndoFactory(this._injector,v))}else{const v={unitId:c,subUnitId:y,cfId:g.cfId};T.push({id:u.DeleteConditionalRuleMutation.id,params:v}),m.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,v))}}),{undos:m,redos:T}},r={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,o,c)=>{if(c===pe.APPLY_TYPE.COPY||c===pe.APPLY_TYPE.ONLY_FORMAT||c===pe.APPLY_TYPE.SERIES){const{source:y,target:h}=a;return n(y,h)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Mt=$a([ft(0,w.Inject(w.Injector)),ft(1,w.Inject(w.IUniverInstanceService)),ft(2,w.Inject(pe.IAutoFillService)),ft(3,w.Inject(u.ConditionalFormattingRuleModel)),ft(4,w.Inject(u.ConditionalFormattingViewModel))],Mt);var Ja=Object.getOwnPropertyDescriptor,Qa=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ja(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},pt=(e,t)=>(n,r)=>t(n,r,e);K.ConditionalFormattingClearController=class extends w.Disposable{constructor(t,n,r,a,o){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=a,this._conditionalFormattingRuleModel=o,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{var o;const n=[],r=[],a={redos:n,undos:r};if([Y.ClearSelectionFormatCommand.id,Y.ClearSelectionAllCommand.id].includes(t.id)){const c=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(I=>I.range);if(!c)return a;const y=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),h=y.getActiveSheet();if(!h)return a;const T=y.getUnitId(),m=h.getSheetId(),C=this._conditionalFormattingRuleModel.getSubunitRules(T,m);if(!C||!C.length)return a;const{redos:E,undos:R}=Sn(this._injector,C,c,T,m);n.push(...E),r.push(...R)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:t,subUnitId:n,ranges:r})=>{const a=[],o=[],c={redos:a,undos:o};if(!r||!r.length)return c;const y=this._conditionalFormattingRuleModel.getSubunitRules(t,n);if(!y||!y.length)return c;const{redos:h,undos:T}=Sn(this._injector,y,r,t,n);return a.push(...h),o.push(...T),c}}))}},K.ConditionalFormattingClearController=Qa([pt(0,w.Inject(w.Injector)),pt(1,w.Inject(w.IUniverInstanceService)),pt(2,w.Inject(Y.SheetInterceptorService)),pt(3,w.Inject(Y.SheetsSelectionsService)),pt(4,w.Inject(u.ConditionalFormattingRuleModel))],K.ConditionalFormattingClearController);function Sn(e,t,n,r,a){const o=[],c=[];return t.filter(y=>n.some(h=>y.ranges.some(T=>w.Rectangle.getIntersects(T,h)))).forEach(y=>{const T=new Y.RangeMergeUtil().add(...y.ranges).subtract(...n).merge();if(T.length){const m={id:u.SetConditionalRuleMutation.id,params:{unitId:r,subUnitId:a,rule:{...y,ranges:T}}},C=u.setConditionalRuleMutationUndoFactory(e,m.params);o.push(m),c.push(...C)}else{const m={id:u.DeleteConditionalRuleMutation.id,params:{unitId:r,subUnitId:a,cfId:y.cfId}},C=u.DeleteConditionalRuleMutationUndoFactory(e,m.params);o.push(m),c.push(...C)}}),{redos:o,undos:c}}var eo=Object.getOwnPropertyDescriptor,to=(e,t,n,r)=>{for(var a=r>1?void 0:r?eo(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},Cn=(e,t)=>(n,r)=>t(n,r,e);let Nt=class extends w.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(w.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(Y.AFTER_CELL_EDIT,{handler:(e,t,n)=>{var c,y,h;e||n(e);const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),a=(c=r==null?void 0:r.style)!=null?c:{},o=Object.keys(a);if(e!=null&&e.p)return(h=(y=e.p.body)==null?void 0:y.textRuns)==null||h.forEach(T=>{T.ts&&o.forEach(m=>{var C;(C=T.ts)==null||delete C[m]})}),n(e);{const T={...(typeof(e==null?void 0:e.s)=="string"?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};o.forEach(C=>{delete T[C]});const m={...e,s:{...T}};return n(m)}}})))}};Nt=to([Cn(0,w.Inject(Y.SheetInterceptorService)),Cn(1,w.Inject(u.ConditionalFormattingService))],Nt);const Tn=[Y.SetWorksheetActiveOperation.id,u.AddConditionalRuleMutation.id,u.SetConditionalRuleMutation.id,u.DeleteConditionalRuleMutation.id,u.MoveConditionalRuleMutation.id],ht=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:ye.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:ye.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:ye.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:ye.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:ye.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:ye.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:ye.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:ye.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:ye.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:ye.clearWorkSheetRules}],ro=e=>{const t=e.get(Y.SheetsSelectionsService),n=e.get(w.ICommandService),r=e.get(w.IUniverInstanceService),a=e.get(u.ConditionalFormattingRuleModel),o=new Ce.Observable(h=>Ce.merge(t.selectionMoveEnd$,t.selectionSet$,new Ce.Observable(T=>{const m=n.onCommandExecuted(C=>{var S;const{id:E,params:R}=C,I=(S=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId();Tn.includes(E)&&R.unitId===I&&T.next(null)});return()=>m.dispose()})).pipe(qe.debounceTime(16)).subscribe(()=>{var S;const T=((S=t.getCurrentSelections())==null?void 0:S.map(p=>p.range))||[],m=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!m)return;const C=m.getActiveSheet();if(!C)return;const I=(a.getSubunitRules(m.getUnitId(),C.getSheetId())||[]).filter(p=>p.ranges.some(i=>T.some(s=>w.Rectangle.intersects(s,i)))).map(p=>p.ranges).every(p=>Y.checkRangesEditablePermission(e,m.getUnitId(),C.getSheetId(),p));h.next(I)})),c=new Ce.Observable(h=>new Ce.Observable(T=>{const m=n.onCommandExecuted(C=>{var S;const{id:E,params:R}=C,I=(S=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId();Tn.includes(E)&&R.unitId===I&&T.next(null)});return()=>m.dispose()}).pipe(qe.debounceTime(16)).subscribe(()=>{const T=r.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET);if(!T)return;const m=T.getActiveSheet();if(!m)return;const C=a.getSubunitRules(T.getUnitId(),m.getSheetId())||[];if(!C.length)return h.next(!1),!1;const E=C.map(R=>R.ranges).every(R=>Y.checkRangesEditablePermission(e,T.getUnitId(),m.getSheetId(),R));h.next(E)})),y=new Ce.Observable(h=>{o.subscribe(T=>{const m=ht.find(C=>C.value===ye.clearRangeRules);m&&(m.disabled=!T,h.next(ht))}),c.subscribe(T=>{const m=ht.find(C=>C.value===ye.clearWorkSheetRules);m&&(m.disabled=!T,h.next(ht))}),h.next(ht)});return{id:it.id,type:te.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:y,hidden$:te.getMenuHiddenObservable(e,w.UniverInstanceType.UNIVER_SHEET),disabled$:pe.getCurrentRangeDisable$(e,{workbookTypes:[Y.WorkbookEditablePermission],worksheetTypes:[Y.WorksheetSetCellStylePermission,Y.WorksheetEditPermission],rangeTypes:[Y.RangeProtectionPermissionEditPoint]})}},no={[te.RibbonStartGroup.FORMULAS_INSERT]:{[it.id]:{order:0,menuItemFactory:ro}}};var ao=Object.getOwnPropertyDescriptor,oo=(e,t,n,r)=>{for(var a=r>1?void 0:r?ao(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},wn=(e,t)=>(n,r)=>t(n,r,e);let Lt=class extends w.Disposable{constructor(t,n){super();xe(this,"_sidebarDisposable",null);this._injector=t,this._menuManagerService=n,this._menuManagerService.mergeMenu(no)}};Lt=oo([wn(0,w.Inject(w.Injector)),wn(1,te.IMenuManagerService)],Lt);var io=Object.getOwnPropertyDescriptor,so=(e,t,n,r)=>{for(var a=r>1?void 0:r?io(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},Be=(e,t)=>(n,r)=>t(n,r,e);const lo=(e,t)=>{const n=m=>m.endRow-m.startRow+1,r=m=>m.endColumn-m.startColumn+1,a=n(t)%n(e),o=r(t)%r(e),c=Math.floor(n(t)/n(e)),y=Math.floor(r(t)/r(e)),h=[],T={startRow:0,endRow:n(e)-1,startColumn:0,endColumn:r(e)-1};if(n(t)===1&&r(t)===1){const m={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return h.push({repeatRelativeRange:T,startRange:m}),h}for(let m=0;m<c+(a?.1:0);m++)for(let C=0;C<y+(o?.1:0);C++){const E=n(e)*m,R=r(e)*C,I={startRow:E+t.startRow,endRow:E+t.startRow,startColumn:R+t.startColumn,endColumn:R+t.startColumn};let S=T;m===c&&a&&(S={...S},S.endRow=S.endRow-(n(e)-a)),C===y&&o&&(S={...S},S.endColumn=S.endColumn-(r(e)-o)),h.push({repeatRelativeRange:S,startRange:I})}return h};let Vt=class extends w.Disposable{constructor(t,n,r,a,o,c){super();xe(this,"_painterConfig",null);this._injector=t,this._univerInstanceService=n,this._formatPainterService=r,this._sheetsSelectionsService=a,this._conditionalFormattingRuleModel=o,this._conditionalFormattingViewModel=c,this._initFormattingPainter()}_initFormattingPainter(){const t=()=>({redos:[],undos:[]}),n=(o,c,y,h,T)=>{const{unitId:m,subUnitId:C}=this._painterConfig,{targetUnitId:E,targetSubUnitId:R}=T,I={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},S={startRow:c.row,startColumn:c.col,endColumn:c.col,endRow:c.row};w.Range.foreach(y,(p,i)=>{const s=w.Rectangle.getPositionRange({startRow:p,startColumn:i,endColumn:i,endRow:p},I),f=w.Rectangle.getPositionRange({startRow:p,startColumn:i,endColumn:i,endRow:p},S),b=this._conditionalFormattingViewModel.getCellCfs(m,C,s.startRow,s.startColumn),l=this._conditionalFormattingViewModel.getCellCfs(E,R,f.startRow,f.startColumn);l&&l.forEach(g=>{let d=h.get(g.cfId);if(!h.get(g.cfId)){const v=this._conditionalFormattingRuleModel.getRule(E,R,g.cfId);if(!v)return;d=new w.ObjectMatrix,v.ranges.forEach(D=>{w.Range.foreach(D,(M,U)=>{d.setValue(M,U,1)})}),h.set(g.cfId,d)}d.realDeleteValue(f.startRow,f.startColumn)}),b&&b.forEach(g=>{const d=h.get(g.cfId);d&&d.setValue(f.startRow,f.startColumn,1)})})},r=(o,c,y)=>{var s;const{range:h,unitId:T,subUnitId:m}=this._painterConfig,C=o!==T||m!==c,E=new Map,R=[],I=[];if(!o||!c||!T||!m)return t();const S=(s=this._conditionalFormattingRuleModel.getSubunitRules(T,m))!=null?s:[];S==null||S.forEach(f=>{const{ranges:b,cfId:l}=f;if(b.some(g=>w.Rectangle.intersects(h,g))){const g=new w.ObjectMatrix;C||b.forEach(d=>{w.Range.foreach(d,(v,D)=>{g.setValue(v,D,1)})}),E.set(l,g)}});const p={row:h.startRow,col:h.startColumn};return lo(h,y).forEach(f=>{n(p,{row:f.startRange.startRow,col:f.startRange.startColumn},f.repeatRelativeRange,E,{targetUnitId:o,targetSubUnitId:c})}),E.forEach((f,b)=>{if(C){const l=this._conditionalFormattingRuleModel.getRule(o,c,b),g=Y.findAllRectangle(Y.createTopMatrixFromMatrix(f));if(l)if(g.length){const d={unitId:o,subUnitId:c,rule:{...l,ranges:g}};R.push({id:u.SetConditionalRuleMutation.id,params:d}),I.push(...u.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:o,subUnitId:c,cfId:l.cfId};R.push({id:u.DeleteConditionalRuleMutation.id,params:d}),I.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}else if(g.length){const d=this._conditionalFormattingRuleModel.getRule(T,m,b);if(d){const v={unitId:o,subUnitId:c,rule:{...w.Tools.deepClone(d),cfId:this._conditionalFormattingRuleModel.createCfId(o,c),ranges:g}};R.push({id:u.AddConditionalRuleMutation.id,params:v}),I.push(u.AddConditionalRuleMutationUndoFactory(this._injector,v))}}}else{const l=this._conditionalFormattingRuleModel.getRule(T,m,b);if(!l)return;const g=Y.findAllRectangle(Y.createTopMatrixFromMatrix(f));if(g.length){const d={unitId:T,subUnitId:m,rule:{...l,ranges:g}};R.push({id:u.SetConditionalRuleMutation.id,params:d}),I.push(...u.setConditionalRuleMutationUndoFactory(this._injector,d))}else{const d={unitId:T,subUnitId:m,cfId:l.cfId};R.push({id:u.DeleteConditionalRuleMutation.id,params:d}),I.push(...u.DeleteConditionalRuleMutationUndoFactory(this._injector,d))}}}),{undos:I,redos:R}},a={id:u.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:o=>{var c,y,h;switch(o){case pe.FormatPainterStatus.INFINITE:case pe.FormatPainterStatus.ONCE:{const T=(c=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:c.getUnitId(),m=(h=(y=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getActiveSheet())==null?void 0:h.getSheetId(),C=this._sheetsSelectionsService.getCurrentLastSelection(),E=C==null?void 0:C.range;T&&m&&E&&(this._painterConfig={unitId:T,subUnitId:m,range:E});break}case pe.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(o,c,y)=>this._painterConfig?r(o,c,y):{redos:[],undos:[]}};this._formatPainterService.addHook(a)}};Vt=so([Be(0,w.Inject(w.Injector)),Be(1,w.Inject(w.IUniverInstanceService)),Be(2,w.Inject(pe.IFormatPainterService)),Be(3,w.Inject(Y.SheetsSelectionsService)),Be(4,w.Inject(u.ConditionalFormattingRuleModel)),Be(5,w.Inject(u.ConditionalFormattingViewModel))],Vt);var co=Object.getOwnPropertyDescriptor,uo=(e,t,n,r)=>{for(var a=r>1?void 0:r?co(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},dr=(e,t)=>(n,r)=>t(n,r,e);let Ut=class extends w.Disposable{constructor(e,t,n){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=t,this._renderManagerService=n,this._init()}_init(){const e=this._univerInstanceService.getCurrentUnitForType(w.UniverInstanceType.UNIVER_SHEET),t=n=>{const r=n.getUnitId(),a=this._renderManagerService.getRenderById(r);if(!a)return;const o=a.with(pe.SheetSkeletonManagerService);this.disposeWithMe(o.currentSkeleton$.subscribe(c=>{if(c){const y=c.skeleton.rowColumnSegment,h=y.endColumn-y.startColumn+1,m=(y.endRow-y.startRow+1)*h*9,C=Math.max(u.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,m);this._conditionalFormattingViewModel.setCacheLength(C)}}))};e&&t(e),this._univerInstanceService.getCurrentTypeOfUnit$(w.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{n&&t(n)})}};Ut=uo([dr(0,w.Inject(u.ConditionalFormattingViewModel)),dr(1,w.IUniverInstanceService),dr(2,hr.IRenderManagerService)],Ut);var fo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,ho=(e,t,n)=>t in e?fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,go=(e,t,n,r)=>{for(var a=r>1?void 0:r?po(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=c(a)||a);return a},fr=(e,t)=>(n,r)=>t(n,r,e),In=(e,t,n)=>ho(e,typeof t!="symbol"?t+"":t,n);K.UniverSheetsConditionalFormattingUIPlugin=class extends w.Plugin{constructor(t=Dt,n,r,a){super(),this._config=t,this._injector=n,this._commandService=r,this._configService=a;const{menu:o,...c}=w.merge({},Dt,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(yn,c),this._initCommand()}onStarting(){w.registerDependencies(this._injector,[[dt],[ut],[lt],[Mt],[ct],[ot],[Lt],[Ae],[Nt],[K.ConditionalFormattingClearController],[Vt],[Ut]]),w.touchDependencies(this._injector,[[dt]])}onReady(){w.touchDependencies(this._injector,[[Lt],[ot]])}onRendered(){w.touchDependencies(this._injector,[[Mt],[K.ConditionalFormattingClearController],[lt],[Nt],[Ae],[Vt],[ct],[ut],[Ut]])}_initCommand(){[Wt,jt,Ht,Bt,Ft,Gt,qt,Xt,Yt,it].forEach(t=>{this._commandService.registerCommand(t)})}},In(K.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${u.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),In(K.UniverSheetsConditionalFormattingUIPlugin,"type",w.UniverInstanceType.UNIVER_SHEET),K.UniverSheetsConditionalFormattingUIPlugin=go([w.DependentOn(u.UniverSheetsConditionalFormattingPlugin),fr(1,w.Inject(w.Injector)),fr(2,w.Inject(w.ICommandService)),fr(3,w.IConfigService)],K.UniverSheetsConditionalFormattingUIPlugin),K.AddAverageCfCommand=Wt,K.AddColorScaleConditionalRuleCommand=jt,K.AddDataBarConditionalRuleCommand=Ht,K.AddDuplicateValuesCfCommand=Bt,K.AddNumberCfCommand=Ft,K.AddRankCfCommand=Gt,K.AddTextCfCommand=qt,K.AddTimePeriodCfCommand=Xt,K.AddUniqueValuesCfCommand=Yt,K.OpenConditionalFormattingOperator=it,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
|
|
10
|
+
(function(P,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("react/jsx-runtime"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula-ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("@univerjs/engine-render"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-formula-ui","@univerjs/sheets-ui","rxjs","@univerjs/engine-render","rxjs/operators"],i):(P=typeof globalThis<"u"?globalThis:P||self,i(P.UniverSheetsConditionalFormattingUi={},P.UniverCore,P.UniverSheetsConditionalFormatting,P.UniverSheets,P.UniverUi,P.React,P.React,P.UniverDesign,P.UniverEngineFormula,P.UniverSheetsFormulaUi,P.UniverSheetsUi,P.rxjs,P.UniverEngineRender,P.rxjs.operators))})(this,function(P,i,r,k,j,s,m,D,Be,pe,W,X,lr,fe){"use strict";var Ot=Object.defineProperty;var Ut=(P,i,r)=>i in P?Ot(P,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):P[i]=r;var ee=(P,i,r)=>Ut(P,typeof i!="symbol"?i+"":i,r);const He={type:i.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l,operator:a}=e,c=t.get(r.ConditionalFormattingRuleModel),p=t.get(i.ICommandService),o=t.get(i.IUniverInstanceService),v=k.getSheetCommandTarget(o);if(!v)return!1;const{unitId:d,subUnitId:f}=v,h=c.createCfId(d,f),S={ranges:u,cfId:h,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:a,style:n}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:S})}},We={type:i.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,config:n,stopIfTrue:l}=e,a=t.get(r.ConditionalFormattingRuleModel),c=t.get(i.ICommandService),p=t.get(i.IUniverInstanceService),o=k.getSheetCommandTarget(p);if(!o)return!1;const{unitId:v,subUnitId:d}=o,f=a.createCfId(v,d),h={ranges:u,cfId:f,stopIfTrue:!!l,rule:{type:r.CFRuleType.colorScale,config:n}};return c.executeCommand(r.AddConditionalRuleMutation.id,{unitId:v,subUnitId:d,rule:h})}},qe={type:i.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,min:n,max:l,nativeColor:a,positiveColor:c,isGradient:p,stopIfTrue:o,isShowValue:v}=e,d=t.get(r.ConditionalFormattingRuleModel),f=t.get(i.IUniverInstanceService),h=k.getSheetCommandTarget(f);if(!h)return!1;const{unitId:S,subUnitId:_}=h,b=t.get(i.ICommandService),x=d.createCfId(S,_),N={ranges:u,cfId:x,stopIfTrue:!!o,rule:{type:r.CFRuleType.dataBar,isShowValue:v,config:{min:n,max:l,nativeColor:a,positiveColor:c,isGradient:p}}};return b.executeCommand(r.AddConditionalRuleMutation.id,{unitId:S,subUnitId:_,rule:N})}},Ge={type:i.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l}=e,a=t.get(r.ConditionalFormattingRuleModel),c=t.get(i.ICommandService),p=t.get(i.IUniverInstanceService),o=k.getSheetCommandTarget(p);if(!o)return!1;const{unitId:v,subUnitId:d}=o,f=a.createCfId(v,d),h={ranges:u,cfId:f,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:n}};return c.executeCommand(r.AddConditionalRuleMutation.id,{unitId:v,subUnitId:d,rule:h})}},ze={type:i.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l,operator:a,value:c}=e,p=t.get(r.ConditionalFormattingRuleModel),o=t.get(i.ICommandService),v=t.get(i.IUniverInstanceService),d=k.getSheetCommandTarget(v);if(!d)return!1;const{unitId:f,subUnitId:h}=d,S=p.createCfId(f,h);let _;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(a)){const b=c;if(b.length!==2||!Array.isArray(b))return!1;_={ranges:u,cfId:S,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:a,style:n,value:b}}}else{const b=c;if(typeof b!="number")return!1;_={ranges:u,cfId:S,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:a,style:n,value:b}}}return o.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:h,rule:_})}},Ye={type:i.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l,isPercent:a,isBottom:c,value:p}=e,o=t.get(r.ConditionalFormattingRuleModel),v=t.get(i.IUniverInstanceService),d=t.get(i.ICommandService),f=k.getSheetCommandTarget(v);if(!f)return!1;const{unitId:h,subUnitId:S}=f,_=o.createCfId(h,S),b={ranges:u,cfId:_,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:a,isBottom:c,style:n,value:p}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:S,rule:b})}},Ze={type:i.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l,operator:a,value:c}=e,p=t.get(r.ConditionalFormattingRuleModel),o=t.get(i.IUniverInstanceService),v=k.getSheetCommandTarget(o);if(!v)return!1;const{unitId:d,subUnitId:f}=v,h=t.get(i.ICommandService),S=p.createCfId(d,f),_={ranges:u,cfId:S,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:a,style:n,value:c}};return h.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:_})}},Ke={type:i.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l,operator:a}=e,c=t.get(r.ConditionalFormattingRuleModel),p=t.get(i.IUniverInstanceService),o=t.get(i.ICommandService),v=k.getSheetCommandTarget(p);if(!v)return!1;const{unitId:d,subUnitId:f}=v,h=c.createCfId(d,f),S={ranges:u,cfId:h,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:a,style:n}};return o.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:S})}},Xe={type:i.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:u,style:n,stopIfTrue:l}=e,a=t.get(r.ConditionalFormattingRuleModel),c=t.get(i.IUniverInstanceService),p=t.get(i.ICommandService),o=k.getSheetCommandTarget(c);if(!o)return!1;const{unitId:v,subUnitId:d}=o,f=a.createCfId(v,d),h={ranges:u,cfId:f,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:n}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:v,subUnitId:d,rule:h})}};var K=function(){return K=Object.assign||function(t){for(var e,u=1,n=arguments.length;u<n;u++){e=arguments[u];for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&(t[l]=e[l])}return t},K.apply(this,arguments)},Tr=function(t,e){var u={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(u[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,n=Object.getOwnPropertySymbols(t);l<n.length;l++)e.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(t,n[l])&&(u[n[l]]=t[n[l]]);return u},ue=m.forwardRef(function(t,e){var u=t.icon,n=t.id,l=t.className,a=t.extend,c=Tr(t,["icon","id","className","extend"]),p="univerjs-icon univerjs-icon-".concat(n," ").concat(l||"").trim(),o=m.useRef("_".concat(Nr()));return ur(u,"".concat(n),{defIds:u.defIds,idSuffix:o.current},K({ref:e,className:p},c),a)});function ur(t,e,u,n,l){return m.createElement(t.tag,K(K({key:e},_r(t,u,l)),n),(Er(t,u).children||[]).map(function(a,c){return ur(a,"".concat(e,"-").concat(t.tag,"-").concat(c),u,void 0,l)}))}function _r(t,e,u){var n=K({},t.attrs);u!=null&&u.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=u.colorChannel1),t.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(function(a){var c=a[0],p=a[1];c==="mask"&&typeof p=="string"&&(n[c]=p.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var l=e.defIds;return!l||l.length===0||(t.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(a){var c=a[0],p=a[1];typeof p=="string"&&(n[c]=p.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Er(t,e){var u,n=e.defIds;return!n||n.length===0?t:t.tag==="defs"&&(!((u=t.children)===null||u===void 0)&&u.length)?K(K({},t),{children:t.children.map(function(l){return typeof l.attrs.id=="string"&&n&&n.indexOf(l.attrs.id)>-1?K(K({},l),{attrs:K(K({},l.attrs),{id:l.attrs.id+e.idSuffix})}):l})}):t}function Nr(){return Math.random().toString(36).substring(2,8)}ue.displayName="UniverIcon";var xr={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"}}]},Re=m.forwardRef(function(t,e){return m.createElement(ue,Object.assign({},t,{id:"delete-single",ref:e,icon:xr}))});Re.displayName="DeleteSingle";var Rr={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"}}]},ar=m.forwardRef(function(t,e){return m.createElement(ue,Object.assign({},t,{id:"increase-single",ref:e,icon:Rr}))});ar.displayName="IncreaseSingle";var Mr={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"}}]},Me=m.forwardRef(function(t,e){return m.createElement(ue,Object.assign({},t,{id:"more-down-single",ref:e,icon:Mr}))});Me.displayName="MoreDownSingle";var wr={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=m.forwardRef(function(t,e){return m.createElement(ue,Object.assign({},t,{id:"sequence-single",ref:e,icon:wr}))});ir.displayName="SequenceSingle";var Vr={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"}}]}]},he=m.forwardRef(function(t,e){return m.createElement(ue,Object.assign({},t,{id:"slash-single",ref:e,icon:Vr}))});he.displayName="SlashSingle";const re=t=>{const{color:e,onChange:u,disable:n=!1,iconId:l="PaintBucket",className:a,isNeedDropdownIcon:c=!0}=t,p=j.useDependency(j.ComponentManager),o=m.useMemo(()=>new i.ColorKit(e),[e]),v=p.get(l);return v?n?s.jsx(v,{className:D.clsx("univer-fill-primary-600",a),extend:{colorChannel1:o.isValid?e:""}}):s.jsx(D.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg univer-p-4",children:s.jsx(D.ColorPicker,{value:e,onChange:u})}),children:s.jsxs("span",{className:D.clsx(`
|
|
11
|
+
univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1
|
|
12
|
+
hover:univer-bg-gray-100
|
|
13
|
+
`,a),children:[s.jsx(v,{className:"univer-fill-primary-600",extend:{colorChannel1:o.isValid?e:""}}),c&&s.jsx(Me,{className:"univer-ml-1.5 univer-text-[10px] univer-text-gray-400"})]})}):null},ae=t=>{var a,c,p;const e=t.rule;if(!e)return null;const u=m.useMemo(()=>{if(e.type===r.CFRuleType.colorScale){const o=e.config.map((f,h)=>({color:new i.ColorKit(f.color),value:h})),v=o.length-1;return new Array(5).fill("").map((f,h,S)=>h*v/(S.length-1)).map(f=>r.getColorScaleFromValue(o,f))}return null},[e]),n=m.useMemo(()=>{if(e.type===r.CFRuleType.iconSet)return e.config.map(o=>{const v=r.iconMap[o.iconType];return v&&v[Number(o.iconId)]})},[e]),l=`univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center
|
|
14
|
+
univer-justify-center univer-text-xs`;switch(e.type){case r.CFRuleType.dataBar:{const{isGradient:o}=e.config,v=o?`linear-gradient(to right, ${e.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,d=o?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||r.defaultDataBarNativeColor})`:e.config.nativeColor;return s.jsxs("div",{className:l,children:[s.jsx("div",{className:"univer-h-full univer-w-1/2",style:{background:d,border:`1px solid ${e.config.nativeColor||r.defaultDataBarNativeColor}`}}),s.jsx("div",{className:"univer-h-full univer-w-1/2",style:{background:v,border:`1px solid ${e.config.positiveColor||r.defaultDataBarPositiveColor}`}})]})}case r.CFRuleType.colorScale:return u&&s.jsx("div",{className:l,children:u.map((o,v)=>s.jsx("div",{className:"univer-h-full",style:{width:`${100/u.length}%`,background:o}},v))});case r.CFRuleType.iconSet:return n&&s.jsx("div",{className:l,children:n.map((o,v)=>o?s.jsx("img",{className:"univer-h-full",src:o,draggable:!1},v):s.jsx(he,{},v))});case r.CFRuleType.highlightCell:{const{ul:o,st:v,it:d,bl:f,bg:h,cl:S}=e.style,_=(o==null?void 0:o.s)===i.BooleanNumber.TRUE,b=(v==null?void 0:v.s)===i.BooleanNumber.TRUE,x=d===i.BooleanNumber.TRUE,N=f===i.BooleanNumber.TRUE,R=(a=h==null?void 0:h.rgb)!=null?a:r.DEFAULT_BG_COLOR,w=(c=S==null?void 0:S.rgb)!=null?c:r.DEFAULT_FONT_COLOR,M={textDecoration:(p=`${_?"underline":""} ${b?"line-through":""}`.replace(/^ /,""))!=null?p:void 0,backgroundColor:R,color:w};return s.jsx("div",{className:D.clsx(l,{"univer-font-bold":N,"univer-italic":x}),style:M,children:"123"})}}},ge="univer-mt-5 univer-px-1 univer-py-2 univer-border univer-border-solid univer-border-gray-200 univer-rounded",te=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Je=t=>{var _;const{type:e,className:u,onChange:n,id:l,value:a}=t,c=j.useDependency(i.IUniverInstanceService),p=c.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=(_=c.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:_.getSheetId(),v=m.useMemo(()=>String(a).startsWith("=")?String(a):"=",[a]),d=m.useMemo(()=>[r.CFValueType.max,r.CFValueType.min,"none"].includes(e)?{disabled:!0}:[r.CFValueType.percent,r.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),f=m.useRef(null),[h,S]=m.useState(!1);return j.useSidebarClick(b=>{var N;((N=f.current)==null?void 0:N.isClickOutSide(b))&&S(!1)}),e===r.CFValueType.formula?s.jsx("div",{className:"univer-ml-1 univer-w-full",children:s.jsx(pe.FormulaEditor,{ref:f,className:`
|
|
15
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
16
|
+
univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white
|
|
17
|
+
univer-pt-2 univer-transition-colors
|
|
18
|
+
[&>div:first-child]:univer-px-2.5
|
|
19
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
20
|
+
dark:univer-border-gray-600 dark:univer-bg-gray-700 dark:univer-text-white
|
|
21
|
+
hover:univer-border-primary-600
|
|
22
|
+
`,initValue:v,unitId:p,subUnitId:o,isFocus:h,onChange:(b="")=>{n(b||"")},onFocus:()=>S(!0)})}):s.jsx(D.InputNumber,{className:u,value:Number(t.value)||0,onChange:b=>t.onChange(b||0),...d})},Or=t=>{var A;const{interceptorManager:e}=t,u=j.useDependency(i.LocaleService),n=((A=t.rule)==null?void 0:A.type)===r.CFRuleType.colorScale?t.rule:void 0,l=[te(r.CFValueType.num,u),te(r.CFValueType.percent,u),te(r.CFValueType.percentile,u),te(r.CFValueType.formula,u)],a=[te(r.CFValueType.min,u),...l],c=[te("none",u),...l],p=[te(r.CFValueType.max,u),...l],[o,v]=m.useState(()=>{var E;const y=r.CFValueType.min;return n&&((E=n.config[0])==null?void 0:E.value.type)||y}),[d,f]=m.useState(()=>{var E;const y="none";return!n||n.config.length!==3?y:((E=n.config[1])==null?void 0:E.value.type)||y}),[h,S]=m.useState(()=>{var E;const y=r.CFValueType.max;return n&&((E=n.config[n.config.length-1])==null?void 0:E.value.type)||y}),[_,b]=m.useState(()=>{if(!n)return 10;const E=n.config[0];return(E==null?void 0:E.value.value)===void 0?10:E==null?void 0:E.value.value}),[x,N]=m.useState(()=>{var F;if(!n||n.config.length!==3)return 50;const E=(F=n.config[1])==null?void 0:F.value.value;return E===void 0?50:E}),[R,w]=m.useState(()=>{var F;if(!n)return 90;const E=(F=n.config[n.config.length-1])==null?void 0:F.value.value;return E===void 0?90:E}),[M,g]=m.useState(()=>{var E;const y="#d0d9fb";return n&&((E=n.config[0])==null?void 0:E.color)||y}),[I,T]=m.useState(()=>{var E;const y="#7790f3";return!n||n.config.length!==3?y:((E=n.config[1])==null?void 0:E.color)||y}),[C,O]=m.useState(()=>{var E;const y="#2e55ef";return n&&((E=n.config[n.config.length-1])==null?void 0:E.color)||y}),V=m.useMemo(()=>y=>{const{minType:E,medianType:F,maxType:G,minValue:J,medianValue:Q,maxValue:de,minColor:ve,medianColor:L,maxColor:$}=y,H=[];return H.push({color:ve,value:{type:E,value:J}}),F!=="none"&&H.push({color:L,value:{type:F,value:Q}}),H.push({color:$,value:{type:G,value:de}}),{config:H.map((z,Y)=>({...z,index:Y})),type:r.CFRuleType.colorScale}},[]);m.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return V({minType:o,medianType:d,maxType:h,minValue:_,medianValue:x,maxValue:R,minColor:M,medianColor:I,maxColor:C})}}),[V,o,d,h,_,x,R,M,I,C,e]);const U=y=>{t.onChange(V(y))};return s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:u.t("sheet.cf.panel.styleRule")}),s.jsx("div",{className:ge,children:s.jsx(ae,{rule:V({minType:o,medianType:d,maxType:h,minValue:_,medianValue:x,maxValue:R,minColor:M,medianColor:I,maxColor:C})})}),s.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600",children:u.t("sheet.cf.valueType.min")}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[s.jsx(D.Select,{className:"univer-flex-shrink-0",options:a,value:o,onChange:y=>{v(y);const E=r.createDefaultValueByValueType(y,10);b(E),U({minType:y,medianType:d,maxType:h,minValue:E,medianValue:x,maxValue:R,minColor:M,medianColor:I,maxColor:C})}}),s.jsx(Je,{id:"min",className:"univer-ml-1",value:_,type:o,onChange:y=>{b(y),U({minType:o,medianType:d,maxType:h,minValue:y,medianValue:x,maxValue:R,minColor:M,medianColor:I,maxColor:C})}}),s.jsx(re,{className:"univer-ml-1",color:M,onChange:y=>{g(y),U({minType:o,medianType:d,maxType:h,minValue:_,medianValue:x,maxValue:R,minColor:y,medianColor:I,maxColor:C})}})]}),s.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600",children:u.t("sheet.cf.panel.medianValue")}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[s.jsx(D.Select,{className:"univer-flex-shrink-0",options:c,value:d,onChange:y=>{f(y);const E=r.createDefaultValueByValueType(y,50);N(E),U({minType:o,medianType:y,maxType:h,minValue:_,medianValue:E,maxValue:R,minColor:M,medianColor:I,maxColor:C})}}),s.jsx(Je,{id:"median",className:"univer-ml-1",value:x,type:d,onChange:y=>{N(y),U({minType:o,medianType:d,maxType:h,minValue:_,medianValue:y,maxValue:R,minColor:M,medianColor:I,maxColor:C})}}),d!=="none"&&s.jsx(re,{className:"univer-ml-1",color:I,onChange:y=>{T(y),U({minType:o,medianType:d,maxType:h,minValue:_,medianValue:x,maxValue:R,minColor:M,medianColor:y,maxColor:C})}})]}),s.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600",children:u.t("sheet.cf.valueType.max")}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[s.jsx(D.Select,{className:"univer-flex-shrink-0",options:p,value:h,onChange:y=>{S(y);const E=r.createDefaultValueByValueType(y,90);w(E),U({minType:o,medianType:d,maxType:y,minValue:_,medianValue:x,maxValue:E,minColor:M,medianColor:I,maxColor:C})}}),s.jsx(Je,{id:"max",className:"univer-ml-1",value:R,type:h,onChange:y=>{w(y),U({minType:o,medianType:d,maxType:h,minValue:_,medianValue:x,maxValue:y,minColor:M,medianColor:I,maxColor:C})}}),s.jsx(re,{className:"univer-ml-1",color:C,onChange:y=>{O(y),U({minType:o,medianType:d,maxType:h,minValue:_,medianValue:x,maxValue:R,minColor:M,medianColor:I,maxColor:y})}})]})]})},ie=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),sr=t=>{var b;const{onChange:e,className:u,value:n,type:l,id:a,disabled:c=!1}=t,p=j.useDependency(i.IUniverInstanceService),o=p.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),v=(b=p.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId(),d=m.useRef(null),[f,h]=m.useState(!1);j.useSidebarClick(x=>{var R;((R=d.current)==null?void 0:R.isClickOutSide(x))&&h(!1)});const S=m.useRef(n),_=m.useMemo(()=>[r.CFValueType.percentile,r.CFValueType.percent].includes(l)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[l]);if(l===r.CFValueType.formula){const x=String(S.current).startsWith("=")?String(S.current)||"":"=";return s.jsx("div",{className:"univer-ml-3 univer-w-full",children:s.jsx(pe.FormulaEditor,{ref:d,className:`
|
|
23
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
24
|
+
univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white
|
|
25
|
+
univer-pt-2 univer-transition-colors
|
|
26
|
+
[&>div:first-child]:univer-px-2.5
|
|
27
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
28
|
+
dark:univer-border-gray-600 dark:univer-bg-gray-700 dark:univer-text-white
|
|
29
|
+
hover:univer-border-primary-600
|
|
30
|
+
`,initValue:x,unitId:o,subUnitId:v,isFocus:f,onChange:(N="")=>{e(N||"")},onFocus:()=>h(!0)})})}return s.jsx(D.InputNumber,{className:u,value:Number(n)||0,disabled:c,onChange:x=>{e(x||0)},..._})},Ur=t=>{var A;const{interceptorManager:e}=t,u=j.useDependency(i.LocaleService),n=((A=t.rule)==null?void 0:A.type)===r.CFRuleType.dataBar?t.rule:void 0,[l,a]=m.useState(()=>{var E;const y="0";return n?(E=n.config)!=null&&E.isGradient?"1":"0":y}),[c,p]=m.useState(()=>{var y;return n&&((y=n.config)==null?void 0:y.positiveColor)||r.defaultDataBarPositiveColor}),[o,v]=m.useState(()=>{var y;return n&&((y=n.config)==null?void 0:y.nativeColor)||r.defaultDataBarNativeColor}),d=[ie(r.CFValueType.num,u),ie(r.CFValueType.percent,u),ie(r.CFValueType.percentile,u),ie(r.CFValueType.formula,u)],f=[ie(r.CFValueType.min,u),...d],h=[ie(r.CFValueType.max,u),...d],[S,_]=m.useState(()=>{var E;const y=f[0].value;return n&&((E=n.config)==null?void 0:E.min.type)||y}),[b,x]=m.useState(()=>{var E;const y=h[0].value;return n&&((E=n.config)==null?void 0:E.max.type)||y}),[N,R]=m.useState(()=>{var F;if(!n)return 0;const E=((F=n.config)==null?void 0:F.min)||{};return E.type===r.CFValueType.formula?E.value||"=":E.value||0}),[w,M]=m.useState(()=>{var F;if(!n)return 100;const E=((F=n.config)==null?void 0:F.max)||{};return E.type===r.CFValueType.formula?E.value||"=":E.value===void 0?100:E.value}),[g,I]=m.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),T=y=>({config:{min:{type:y.minValueType,value:y.minValue},max:{type:y.maxValueType,value:y.maxValue},isGradient:y.isGradient==="1",positiveColor:y.positiveColor||r.defaultDataBarPositiveColor,nativeColor:y.nativeColor||r.defaultDataBarNativeColor},type:r.CFRuleType.dataBar,isShowValue:y.isShowValue});m.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return T({isGradient:l,minValue:N,minValueType:S,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:g})}}),[l,N,S,w,b,c,o,e,g]);const C=y=>{t.onChange(T(y))},O=y=>{p(y),C({isGradient:l,minValue:N,minValueType:S,maxValue:w,maxValueType:b,positiveColor:y,nativeColor:o,isShowValue:g})},V=y=>{v(y),C({isGradient:l,minValue:N,minValueType:S,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:y,isShowValue:g})},U=y=>d.map(E=>E.value).includes(y);return s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:u.t("sheet.cf.panel.styleRule")}),s.jsx("div",{className:ge,children:s.jsx(ae,{rule:T({isGradient:l,minValue:N,minValueType:S,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:g})})}),s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:u.t("sheet.cf.panel.fillType")}),s.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[s.jsxs(D.RadioGroup,{value:l,onChange:y=>{a(y),C({isGradient:y,minValue:N,minValueType:S,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:g})},children:[s.jsx(D.Radio,{value:"0",children:s.jsx("span",{className:"univer-text-xs",children:u.t("sheet.cf.panel.pureColor")})}),s.jsx(D.Radio,{value:"1",children:s.jsx("span",{className:"univer-text-xs",children:u.t("sheet.cf.panel.gradient")})})]}),s.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[s.jsx(D.Checkbox,{checked:!g,onChange:y=>{I(!y),C({isGradient:y,minValue:N,minValueType:S,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:!y})}}),u.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:u.t("sheet.cf.panel.colorSet")}),s.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[s.jsxs("div",{className:"univer-flex univer-items-center",children:[s.jsx("div",{className:"univer-text-xs",children:u.t("sheet.cf.panel.native")}),s.jsx(re,{color:o,onChange:V})]}),s.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[s.jsx("div",{className:"univer-text-xs",children:u.t("sheet.cf.panel.positive")}),s.jsx(re,{color:c,onChange:O})]})]})]}),s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:u.t("sheet.cf.valueType.min")}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[s.jsx(D.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:f,value:S,onChange:y=>{_(y);const E=r.createDefaultValueByValueType(y,10);R(E),C({isGradient:l,minValue:E,minValueType:y,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:g})}}),s.jsx(sr,{id:"min",className:"univer-ml-3",disabled:!U(S),type:S,value:N,onChange:y=>{R(y||0),C({isGradient:l,minValue:y||0,minValueType:S,maxValue:w,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:g})}})]}),s.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600",children:u.t("sheet.cf.valueType.max")}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[s.jsx(D.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:h,value:b,onChange:y=>{x(y);const E=r.createDefaultValueByValueType(y,90);M(E),C({isGradient:l,minValue:N,minValueType:S,maxValue:E,maxValueType:y,positiveColor:c,nativeColor:o,isShowValue:g})}}),s.jsx(sr,{className:"univer-ml-3",disabled:!U(b),id:"max",type:b,value:w,onChange:y=>{M(y||0),C({isGradient:l,minValue:N,minValueType:S,maxValue:y||0,maxValueType:b,positiveColor:c,nativeColor:o,isShowValue:g})}})]})]})]})},we=t=>[i.BooleanNumber.FALSE,void 0].includes(t)?i.BooleanNumber.TRUE:i.BooleanNumber.FALSE,Ve=t=>t!==i.BooleanNumber.FALSE,Qe=t=>{const{style:e,onChange:u,className:n}=t,l=j.useDependency(j.ComponentManager),[a,c]=m.useState(()=>{if(e!=null&&e.bl)return e.bl}),[p,o]=m.useState(()=>{if(e!=null&&e.it)return e.it}),[v,d]=m.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[f,h]=m.useState(()=>{if(e!=null&&e.st)return e.st.s}),[S,_]=m.useState(()=>{var T;const I="#2f56ef";return(T=e==null?void 0:e.cl)!=null&&T.rgb?e.cl.rgb:I}),[b,x]=m.useState(()=>{var T;const I="#e8ecfc";return(T=e==null?void 0:e.bg)!=null&&T.rgb?e.bg.rgb:I}),N=l.get("BoldSingle"),R=l.get("ItalicSingle"),w=l.get("UnderlineSingle"),M=l.get("StrikethroughSingle");m.useEffect(()=>{const I={bl:a,it:p};S!==void 0&&(I.cl={rgb:S}),b!==void 0&&(I.bg={rgb:b}),f!==void 0&&(I.st={s:f}),v!==void 0&&(I.ul={s:v}),u(r.removeUndefinedAttr(I))},[a,p,v,f,S,b]);const g="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return s.jsxs("div",{className:D.clsx("univer-my-2.5 univer-flex univer-justify-between",n),children:[N&&s.jsx("div",{className:D.clsx(g,{"univer-bg-gray-100":Ve(a||i.BooleanNumber.FALSE)}),onClick:()=>c(we(a)),children:s.jsx(N,{})}),R&&s.jsx("div",{className:D.clsx(g,{"univer-bg-gray-100":Ve(p||i.BooleanNumber.FALSE)}),onClick:()=>o(we(p)),children:s.jsx(R,{})}),w&&s.jsx("div",{className:D.clsx(g,{"univer-bg-gray-100":Ve(v||i.BooleanNumber.FALSE)}),onClick:()=>d(we(v)),children:s.jsx(w,{})}),M&&s.jsx("div",{className:D.clsx(g,{"univer-bg-gray-100":Ve(f||i.BooleanNumber.FALSE)}),onClick:()=>h(we(f)),children:s.jsx(M,{})}),s.jsx(re,{color:S,onChange:_,iconId:"FontColor"}),s.jsx(re,{color:b,onChange:x,iconId:"PaintBucket"})]})},kr=t=>{var M;const{onChange:e,interceptorManager:u}=t,n=j.useDependency(i.LocaleService),a=j.useDependency(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),c=a.getActiveSheet(),p=((M=t.rule)==null?void 0:M.type)===r.CFRuleType.highlightCell?t.rule:void 0,o=m.useRef(null),[v,d]=m.useState(!1),f=m.useRef(null),[h,S]=m.useState({}),[_,b]=m.useState(()=>(p==null?void 0:p.subType)===r.CFSubRuleType.formula?p.value:"="),[x,N]=m.useState(void 0),R=g=>({style:g.style,value:_,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});m.useEffect(()=>u.intercept(u.getInterceptPoints().submit,{handler(){return R({style:h})}}),[h,_,u]),m.useEffect(()=>u.intercept(u.getInterceptPoints().beforeSubmit,{handler:(I,T,C)=>x||_.length===1||!_.startsWith("=")?(N(n.t("sheet.cf.errorMessage.formulaError")),!1):C(I)}),[x,_]);const w=g=>{e(R(g))};return j.useSidebarClick(g=>{var T;((T=f.current)==null?void 0:T.isClickOutSide(g))&&d(!1)}),s.jsxs("div",{ref:o,children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),s.jsx("div",{className:"univer-mt-3",children:s.jsx(pe.FormulaEditor,{ref:f,className:`
|
|
31
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
32
|
+
univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white
|
|
33
|
+
univer-pt-2 univer-transition-colors
|
|
34
|
+
[&>div:first-child]:univer-px-2.5
|
|
35
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
36
|
+
dark:univer-border-gray-600 dark:univer-bg-gray-700 dark:univer-text-white
|
|
37
|
+
hover:univer-border-primary-600
|
|
38
|
+
`,errorText:x,isFocus:v,initValue:_,unitId:a.getUnitId(),subUnitId:c==null?void 0:c.getSheetId(),onFocus:()=>{d(!0)},onChange:g=>{b(g),w({style:h})},onVerify:(g,I)=>{!g||I.length===1?N(n.t("sheet.cf.errorMessage.formulaError")):N(void 0)}})}),s.jsx("div",{className:ge,children:s.jsx(ae,{rule:R({style:h})})}),s.jsx(Qe,{style:p==null?void 0:p.style,className:"univer-mt-3",onChange:g=>{S(g),w({style:g})}})]})},Oe=t=>s.jsxs("div",{style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",zIndex:999,bottom:"-13px",fontSize:"10px",color:"red"},children:t.errorText}),t.children]}),B=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),Pr=t=>{const{type:e,operator:u,onChange:n,value:l,interceptorManager:a}=t,c=j.useDependency(i.LocaleService),[p,o]=m.useState(()=>typeof l=="number"?l:0),[v,d]=m.useState(""),[f,h]=m.useState(()=>typeof l=="string"?l:""),[S,_]=m.useState(""),[b,x]=m.useState(()=>Array.isArray(l)?l[0]===void 0?0:l[0]:0),[N,R]=m.useState(""),[w,M]=m.useState(()=>Array.isArray(l)?l[1]===void 0?100:l[1]:100),[g,I]=m.useState("");switch(m.useEffect(()=>{switch(e){case r.CFSubRuleType.text:{[r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(u)&&n(f);break}case r.CFSubRuleType.number:{[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(u)&&n(p),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(u)&&n([b,w]);break}}},[e]),m.useEffect(()=>{const T=a.intercept(a.getInterceptPoints().beforeSubmit,{handler:(C,O,V)=>{switch(e){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.containsText,r.CFTextOperator.endsWith,r.CFTextOperator.notEqual,r.CFTextOperator.notContainsText,r.CFTextOperator.equal].includes(u))return f?V(C):(_(c.t("sheet.cf.errorMessage.notBlank")),!1)}return V(C)}});return()=>{T()}},[e,p,f,u]),e){case r.CFSubRuleType.text:{if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(u)){const T=C=>{h(C),n(C)};return s.jsx("div",{className:"univer-mt-3",children:s.jsx(Oe,{errorText:S,children:s.jsx(D.Input,{value:f,onChange:C=>{_(""),T(C)}})})})}break}case r.CFSubRuleType.number:{if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(u)){const T=C=>{o(C||0),n(C||0),d("")};return s.jsx("div",{className:"univer-mt-3",children:s.jsx(Oe,{errorText:v,children:s.jsx(D.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:p,onChange:T})})})}if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(u)){const T=O=>{x(O||0),n([O||0,w]),R("")},C=O=>{M(O||0),n([b,O||0]),I("")};return s.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[s.jsx(Oe,{errorText:N,children:s.jsx(D.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:b,onChange:T})}),s.jsx(Oe,{errorText:g,children:s.jsx(D.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:w,onChange:C})})]})}}}return null},cr=(t,e)=>{switch(t){case r.CFSubRuleType.text:return[B(r.CFTextOperator.containsText,e),B(r.CFTextOperator.notContainsText,e),B(r.CFTextOperator.beginsWith,e),B(r.CFTextOperator.endsWith,e),B(r.CFTextOperator.equal,e),B(r.CFTextOperator.notEqual,e),B(r.CFTextOperator.containsBlanks,e),B(r.CFTextOperator.notContainsBlanks,e),B(r.CFTextOperator.containsErrors,e),B(r.CFTextOperator.notContainsErrors,e)];case r.CFSubRuleType.number:return[B(r.CFNumberOperator.between,e),B(r.CFNumberOperator.notBetween,e),B(r.CFNumberOperator.equal,e),B(r.CFNumberOperator.notEqual,e),B(r.CFNumberOperator.greaterThan,e),B(r.CFNumberOperator.greaterThanOrEqual,e),B(r.CFNumberOperator.lessThan,e),B(r.CFNumberOperator.lessThanOrEqual,e)];case r.CFSubRuleType.timePeriod:return[B(r.CFTimePeriodOperator.yesterday,e),B(r.CFTimePeriodOperator.today,e),B(r.CFTimePeriodOperator.tomorrow,e),B(r.CFTimePeriodOperator.last7Days,e),B(r.CFTimePeriodOperator.lastWeek,e),B(r.CFTimePeriodOperator.thisWeek,e),B(r.CFTimePeriodOperator.nextWeek,e),B(r.CFTimePeriodOperator.lastMonth,e),B(r.CFTimePeriodOperator.thisMonth,e),B(r.CFTimePeriodOperator.nextMonth,e)]}},or=t=>{var M;const{interceptorManager:e,onChange:u}=t,n=j.useDependency(i.LocaleService),l=((M=t.rule)==null?void 0:M.type)===r.CFRuleType.highlightCell?t.rule:void 0,[a,c]=m.useState(()=>{const g=r.CFSubRuleType.text;return l&&l.subType||g}),p=[{value:r.CFSubRuleType.text,label:n.t("sheet.cf.subRuleType.text")},{value:r.CFSubRuleType.number,label:n.t("sheet.cf.subRuleType.number")},{value:r.CFSubRuleType.timePeriod,label:n.t("sheet.cf.subRuleType.timePeriod")},{value:r.CFSubRuleType.duplicateValues,label:n.t("sheet.cf.subRuleType.duplicateValues")},{value:r.CFSubRuleType.uniqueValues,label:n.t("sheet.cf.subRuleType.uniqueValues")}],o=m.useMemo(()=>cr(a,n),[a]),[v,d]=m.useState(()=>{const g=o?o[0].value:void 0;return l&&l.operator||g}),[f,h]=m.useState(()=>{var T;const g="";return l?(T=l.value)!=null?T:r.createDefaultValue(l.subType,l.operator):g}),[S,_]=m.useState({}),b=m.useMemo(()=>g=>{var I,T,C,O,V,U,A,y,E,F,G,J,Q,de,ve;switch(g.subType||a){case r.CFSubRuleType.text:{if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(v))return{type:r.CFRuleType.highlightCell,subType:(I=g.subType)!=null?I:a,operator:(T=g.operator)!=null?T:v,style:(C=g.style)!=null?C:S,value:(O=g.value)!=null?O:f};break}case r.CFSubRuleType.number:{if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(v))return{type:r.CFRuleType.highlightCell,subType:(V=g.subType)!=null?V:a,operator:(U=g.operator)!=null?U:v,style:(A=g.style)!=null?A:S,value:(y=g.value)!=null?y:f};if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(v))return{type:r.CFRuleType.highlightCell,subType:(E=g.subType)!=null?E:a,operator:(F=g.operator)!=null?F:v,style:(G=g.style)!=null?G:S,value:(J=g.value)!=null?J:f};break}}return{type:r.CFRuleType.highlightCell,subType:(Q=g.subType)!=null?Q:a,operator:(de=g.operator)!=null?de:v,style:(ve=g.style)!=null?ve:S}},[a,v,f,S]);m.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return b({})}}),[b,e]),m.useEffect(()=>{p.some(g=>g.value===a)||c(p[0].value)},[p]);const x=g=>{const I=g,T=cr(I,n),C=T&&T[0].value;c(I),d(C),C&&h(r.createDefaultValue(I,C)),u(b({subType:I,operator:C}))},N=g=>{const I=g;d(I),u(b({operator:I}))},R=g=>{h(g),u(b({value:g}))},w=m.useMemo(()=>`${a}_${v}_${Math.random()}`,[a,v]);return s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),s.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[s.jsx(D.Select,{className:"univer-mt-3 univer-w-full",onChange:x,value:a,options:p}),(o==null?void 0:o.length)&&s.jsx(D.Select,{className:"univer-mt-3 univer-w-full",onChange:N,value:v||"",options:o})]}),s.jsx(Pr,{value:f,interceptorManager:e,type:a,operator:v,rule:l,onChange:R},w),s.jsx("div",{className:ge,children:s.jsx(ae,{rule:b({})})}),s.jsx(Qe,{style:l==null?void 0:l.style,className:"univer-ml-1",onChange:g=>{_(g),u(b({style:g}))}})]})},dr=(t,e)=>(r.iconMap[t]||[])[Number(e)]||"",Dr=t=>{var d;const{error:e,type:u,onChange:n}=t,l=j.useDependency(i.IUniverInstanceService),a=l.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),c=(d=l.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:d.getSheetId(),p=m.useRef(null),[o,v]=m.useState(!1);return j.useSidebarClick(f=>{var S;((S=p.current)==null?void 0:S.isClickOutSide(f))&&v(!1)}),s.jsx("div",{className:"univer-relative",children:u!==r.CFValueType.formula?s.jsxs(s.Fragment,{children:[s.jsx(D.InputNumber,{className:D.clsx({"univer-border-red-500":e}),value:Number(t.value)||0,onChange:f=>n(f!=null?f:0)}),e&&s.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:e})]}):s.jsx("div",{className:"univer-w-full",children:s.jsx(pe.FormulaEditor,{ref:p,initValue:String(t.value),unitId:a,subUnitId:c,isFocus:o,onChange:(f="")=>{n(f||"")},onFocus:()=>v(!0)})})})},vr=(t,e,u)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(u.length-1-e)*10},iconType:t,iconId:String(e)}),jr=m.forwardRef((t,e)=>{const{onClick:u}=t,n=j.useDependency(i.LocaleService),l=a=>{u(a)};return s.jsx("div",{ref:e,className:"univer-w-80",children:r.iconGroup.map((a,c)=>s.jsxs("div",{className:"univer-mb-3",children:[s.jsx("div",{className:"univer-mb-1 univer-text-sm",children:n.t(a.title)}),s.jsx("div",{className:"univer-flex univer-flex-wrap",children:a.group.map(p=>s.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{l(p.name)},children:s.jsx("a",{className:`
|
|
39
|
+
univer-cursor-pointer univer-rounded
|
|
40
|
+
hover:univer-bg-gray-100
|
|
41
|
+
`,children:p.list.map((o,v)=>s.jsx("img",{className:"univer-size-5",src:o,draggable:!1},v))})},p.name))})]},c))})}),Ar=t=>{const{onClick:e}=t,u=m.useMemo(()=>{const l=[];for(const a in r.iconMap){const c=r.iconMap[a],p=a;c.forEach((o,v)=>{l.push({iconType:p,base64:o,iconId:String(v)})})}return l},[]),n=l=>{e(l.iconType,l.iconId)};return s.jsxs("div",{children:[s.jsxs("div",{className:"univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",onClick:()=>n({iconType:r.EMPTY_ICON_TYPE,iconId:""}),children:[s.jsx(he,{className:"univer-size-5"}),s.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),s.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:u.map(l=>s.jsx("div",{className:`
|
|
42
|
+
univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center
|
|
43
|
+
univer-justify-center univer-rounded
|
|
44
|
+
hover:univer-bg-gray-100
|
|
45
|
+
`,children:s.jsx("img",{className:"univer-size-5",src:l.base64,draggable:!1,onClick:()=>n(l)})},`${l.iconType}_${l.iconId}`))})]})},Lr=t=>{const{onChange:e,configList:u,errorMap:n={}}=t,l=j.useDependency(i.LocaleService),a=[{label:l.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThan}`),value:r.CFNumberOperator.greaterThan},{label:l.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThanOrEqual}`),value:r.CFNumberOperator.greaterThanOrEqual}],c=[{label:l.t(`sheet.cf.valueType.${r.CFValueType.num}`),value:r.CFValueType.num},{label:l.t(`sheet.cf.valueType.${r.CFValueType.percent}`),value:r.CFValueType.percent},{label:l.t(`sheet.cf.valueType.${r.CFValueType.percentile}`),value:r.CFValueType.percentile},{label:l.t(`sheet.cf.valueType.${r.CFValueType.formula}`),value:r.CFValueType.formula}],p=(f,h)=>{e([String(h),"value","value"],f)},o=(f,h)=>{e([String(h),"operator"],f);const S=r.createDefaultValue(r.CFSubRuleType.number,f);p(S,h)},v=(f,h)=>{e([String(h),"value","type"],f);const S=u[h],_=r.createDefaultValue(r.CFSubRuleType.number,S.operator);p(_,h)};return m.useMemo(()=>u.map((f,h)=>{const S=n[h],_=dr(f.iconType,f.iconId),b=h===u.length-1,x=h===0,N=u[h-1],R=(N==null?void 0:N.value.type)===r.CFValueType.formula?l.t("sheet.cf.valueType.formula"):N==null?void 0:N.value.value,w=(M,g)=>{const I={...f,iconId:g,iconType:M};e([String(h)],I)};return s.jsxs("div",{className:h?"univer-mt-6":"univer-mt-3",children:[s.jsxs("div",{className:`
|
|
46
|
+
univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm
|
|
47
|
+
univer-text-gray-600
|
|
48
|
+
`,children:[s.jsxs("div",{className:"univer-w-[45%]",children:[l.t("sheet.cf.iconSet.icon"),h+1]}),s.jsx("div",{className:"univer-w-[45%]",children:s.jsxs(s.Fragment,{children:[!x&&!b&&l.t("sheet.cf.iconSet.rule"),!x&&!b&&s.jsxs("span",{className:"univer-font-medium univer-text-gray-600",children:["(",l.t("sheet.cf.iconSet.when"),l.t(`sheet.cf.symbol.${r.getOppositeOperator(N.operator)}`),R,b?"":` ${l.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4",children:[s.jsx("div",{className:"univer-flex univer-items-center",children:s.jsx(D.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg univer-p-4",children:s.jsx(Ar,{onClick:w,iconId:f.iconId,iconType:f.iconType})}),children:s.jsxs("div",{className:`
|
|
49
|
+
univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
|
|
50
|
+
univer-justify-between univer-rounded-md univer-border univer-border-solid
|
|
51
|
+
univer-border-gray-200 univer-bg-white univer-px-4 univer-py-2 univer-text-xs
|
|
52
|
+
univer-text-gray-600 univer-transition-all
|
|
53
|
+
hover:univer-border-primary-600
|
|
54
|
+
`,children:[_?s.jsx("img",{src:_,className:"univer-size-4",draggable:!1}):s.jsx(he,{className:"univer-size-4"}),s.jsx(Me,{})]})})}),b?s.jsxs("div",{className:"univer-mt-0 univer-w-[45%] univer-text-sm univer-text-gray-600",children:[l.t("sheet.cf.iconSet.rule"),s.jsxs("span",{className:"univer-font-medium univer-text-gray-600",children:[l.t("sheet.cf.iconSet.when"),l.t(`sheet.cf.symbol.${r.getOppositeOperator(N.operator)}`),R,b?"":` ${l.t("sheet.cf.iconSet.and")} `]})]}):s.jsx(D.Select,{options:a,value:f.operator,onChange:M=>{o(M,h)}})]}),b?s.jsx("div",{}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`
|
|
55
|
+
univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4
|
|
56
|
+
univer-text-sm univer-text-gray-600
|
|
57
|
+
`,children:[s.jsx("div",{children:l.t("sheet.cf.iconSet.type")}),s.jsx("div",{children:l.t("sheet.cf.iconSet.value")})]}),s.jsxs("div",{className:`
|
|
58
|
+
univer-mt-3 univer-flex univer-items-center univer-justify-between univer-gap-4
|
|
59
|
+
`,children:[s.jsx(D.Select,{className:"univer-flex-shrink-0",options:c,value:f.value.type,onChange:M=>{v(M,h)}}),s.jsx("div",{children:s.jsx(Dr,{id:h,type:f.value.type,error:S,value:f.value.value||"",onChange:M=>{p(M,h)}})})]})]})]},h)}),[u,n])},Fr=t=>{var M;const{interceptorManager:e}=t,u=((M=t.rule)==null?void 0:M.type)===r.CFRuleType.iconSet?t.rule:void 0,n=j.useDependency(i.LocaleService),[l,a]=m.useState({}),[c,p]=m.useState(()=>{const g=Object.keys(r.iconMap)[0];if(u&&u.config.length){const I=u.config[0].iconType;if(!u.config.some(C=>C.iconType!==I))return I}return g}),[o,v]=m.useState(()=>{if(u&&u.config.length)return i.Tools.deepClone(u==null?void 0:u.config);const g=r.iconMap[c]||[];return new Array(g.length).fill("").map((I,T,C)=>T===C.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:c,iconId:String(T)}:vr(c,T,C))}),[d,f]=m.useState(()=>u?!!u.isShowValue:!0),h=m.useMemo(()=>{const g=o.map(I=>dr(I.iconType,I.iconId));return s.jsx("div",{className:"univer-flex univer-items-center",children:g.map((I,T)=>I?s.jsx("img",{className:"univer-size-5",src:I},T):s.jsx(he,{className:"univer-size-5"},T))})},[o]),S=g=>{if(g.reduce((T,C,O)=>T.preType&&!T.result||g.length-1===O?T:C.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:T.preType?{result:T.preType===C.value.type,preType:C.value.type}:{result:!0,preType:C.value.type},{result:!0,preType:""}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(g[0].value.type)){const T={};return g.forEach((C,O,V)=>{if(O-1<0||O===V.length-1)return;const A=g[O-1],y=r.getOppositeOperator(A.operator);r.compareWithNumber({operator:y,value:A.value.value},C.value.value)||(T[O]=`${n.t(`sheet.cf.form.${y}`,String(A.value.value))} `)}),T}return{}},_=(g,I)=>{i.get(o,g)!==I&&(i.set(o,g,I),v([...o]),a(S(o)))},b=g=>{p(g);const I=r.iconMap[g]||[],T=new Array(I.length).fill("").map((C,O,V)=>vr(g,O,V));v(T),a(S(T))};m.useEffect(()=>{const g=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:d,config:o}}});return()=>{g()}},[d,o,e]),m.useEffect(()=>{const g=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(l).length===0}});return()=>{g()}},[d,o,e,l]);const x=()=>{const g=o.map(I=>({...I}));o.forEach((I,T)=>{const C=o.length-1-T,O=g[C];I.iconId=O.iconId,I.iconType=O.iconType}),v([...o])},N=j.useDependency(j.ILayoutService),[R,w]=m.useState();return j.useScrollYOverContainer(R,N.rootContainerElement),s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),s.jsx("div",{className:"univer-mt-3",children:s.jsx(D.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg univer-p-4",children:s.jsx(jr,{ref:g=>{!R&&g&&w(g)},iconType:c,onClick:b})}),children:s.jsxs("div",{className:D.clsx(`
|
|
60
|
+
univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
|
|
61
|
+
univer-justify-between univer-rounded-md univer-border univer-border-solid
|
|
62
|
+
univer-border-gray-200 univer-bg-white univer-px-4 univer-py-2 univer-text-xs
|
|
63
|
+
univer-text-gray-600 univer-transition-all
|
|
64
|
+
hover:univer-border-primary-600
|
|
65
|
+
`),children:[h,s.jsx(Me,{})]})})}),s.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[s.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[s.jsx(D.Checkbox,{onChange:x}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),s.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[s.jsx(D.Checkbox,{checked:!d,onChange:g=>{f(!g)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),s.jsx(Lr,{errorMap:l,onChange:_,configList:o})]})},$r=t=>{var x;const{onChange:e,interceptorManager:u}=t,n=j.useDependency(i.LocaleService),l=((x=t.rule)==null?void 0:x.type)===r.CFRuleType.highlightCell?t.rule:void 0,a=[{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,p]=m.useState(()=>{const N=a[0].value,R=l==null?void 0:l.type;if(!l)return N;switch(R){case r.CFRuleType.highlightCell:switch(l.subType){case r.CFSubRuleType.average:return[r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual].includes(l.operator)?"greaterThanAverage":[r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(l.operator)?"lessThanAverage":N;case r.CFSubRuleType.rank:return l.isBottom?"isBottom":"isNotBottom"}}return N}),[o,v]=m.useState(()=>{const R=l==null?void 0:l.type;if(!l)return 10;switch(R){case r.CFRuleType.highlightCell:switch(l.subType){case r.CFSubRuleType.rank:return l.value||10}}return 10}),[d,f]=m.useState(()=>{const R=l==null?void 0:l.type;if(!l)return!1;switch(R){case r.CFRuleType.highlightCell:switch(l.subType){case r.CFSubRuleType.rank:return l.isPercent||!1}}return!1}),[h,S]=m.useState({}),_=N=>{const{type:R,isPercent:w,value:M,style:g}=N;if(R==="isNotBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:w,isBottom:!1,value:M,style:g};if(R==="isBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:w,isBottom:!0,value:M,style:g};if(R==="greaterThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:g};if(R==="lessThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:g}};m.useEffect(()=>u.intercept(u.getInterceptPoints().submit,{handler(){return _({type:c,isPercent:d,value:o,style:h})}}),[c,d,o,h,u]);const b=N=>{e(_(N))};return s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),s.jsx(D.Select,{className:"univer-mt-3 univer-w-full",value:c,options:a,onChange:N=>{p(N),b({type:N,isPercent:d,value:o,style:h})}}),["isNotBottom","isBottom"].includes(c)&&s.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[s.jsx(D.InputNumber,{min:1,max:1e3,value:o,onChange:N=>{const R=N||0;v(R),b({type:c,isPercent:d,value:R,style:h})}}),s.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[s.jsx(D.Checkbox,{checked:d,onChange:N=>{f(!!N),b({type:c,isPercent:!!N,value:o,style:h})}}),n.t("sheet.cf.valueType.percent")]})]}),s.jsx("div",{className:ge,children:s.jsx(ae,{rule:_({type:c,isPercent:d,value:o,style:h})})}),s.jsx(Qe,{style:l==null?void 0:l.style,className:"univer-mt-3",onChange:N=>{S(N),b({type:c,isPercent:d,value:o,style:N})}})]})},Br=i.createInterceptorKey("beforeSubmit"),Hr=i.createInterceptorKey("submit"),pr=t=>t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),fr=t=>{var e;return(e=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},Wr=t=>{var T,C,O;const e=j.useDependency(i.LocaleService),u=j.useDependency(i.ICommandService),n=j.useDependency(i.IUniverInstanceService),l=j.useDependency(r.ConditionalFormattingRuleModel),a=j.useDependency(k.SheetsSelectionsService),c=pr(n),p=fr(n),[o,v]=m.useState(void 0),d=m.useRef((C=(T=t.rule)==null?void 0:T.ranges)!=null?C:[]),f=m.useMemo(()=>{var U,A,y;let V=(U=t.rule)==null?void 0:U.ranges;return V!=null&&V.length||(V=(y=(A=a.getCurrentSelections())==null?void 0:A.map(E=>E.range))!=null?y:[]),d.current=V,V!=null&&V.length?V.map(E=>{const F=Be.serializeRange(E);return F==="NaN"?"":F}).filter(E=>!!E).join(","):""},[t.rule]),h=[{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"}],[S,_]=m.useState(()=>{var A,y;const V=(A=t.rule)==null?void 0:A.rule.type,U=h[0].value;if(!V)return U;switch(V){case r.CFRuleType.highlightCell:{switch((y=t.rule)==null?void 0:y.rule.subType){case r.CFSubRuleType.number:case r.CFSubRuleType.text:case r.CFSubRuleType.duplicateValues:case r.CFSubRuleType.uniqueValues:case r.CFSubRuleType.timePeriod:return"1";case r.CFSubRuleType.average:case r.CFSubRuleType.rank:return"2";case r.CFSubRuleType.formula:return"5"}break}case r.CFRuleType.dataBar:return"3";case r.CFRuleType.colorScale:return"4";case r.CFRuleType.iconSet:return"6"}return U}),b=m.useRef(void 0),x=m.useMemo(()=>new i.InterceptorManager({beforeSubmit:Br,submit:Hr}),[]),N=m.useMemo(()=>{switch(S){case"1":return or;case"2":return $r;case"3":return Ur;case"4":return Or;case"5":return kr;case"6":return Fr;default:return or}},[S]);m.useEffect(()=>{const V=u.onCommandExecuted(U=>{if(U.id===k.RemoveSheetMutation.id){const A=U.params;A.subUnitId===p&&A.unitId===c&&t.onCancel()}U.id===k.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>V.dispose()},[]);const R=V=>{b.current=V},w=V=>{const U=V.split(",").filter(A=>!!A).map(Be.deserializeRangeWithSheet).map(A=>A.range);d.current=U},M=()=>{if(o)return;const U=(()=>{const y=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!y)throw new Error("No active sheet found");return d.current.map(G=>k.setEndForRange(G,y.getRowCount(),y.getColumnCount())).filter(G=>!(Number.isNaN(G.startRow)||Number.isNaN(G.startColumn)))})();if(x.fetchThroughInterceptors(x.getInterceptPoints().beforeSubmit)(!0,null)){const y=x.fetchThroughInterceptors(x.getInterceptPoints().submit)(null,null);if(y){const E=pr(n),F=fr(n);if(!E||!F)throw new Error("No active sheet found");let G={};t.rule&&t.rule.cfId?(G={...t.rule,ranges:U,rule:y},u.executeCommand(r.SetCfCommand.id,{unitId:E,subUnitId:F,rule:G}),t.onCancel()):(G={cfId:l.createCfId(E,F),ranges:U,rule:y,stopIfTrue:!1},u.executeCommand(r.AddCfCommand.id,{unitId:E,subUnitId:F,rule:G}),t.onCancel())}}},g=()=>{t.onCancel()},I=(V,U)=>{V?U.length<1?v(e.t("sheet.cf.errorMessage.rangeError")):v(void 0):v(e.t("sheet.cf.errorMessage.rangeError"))};return s.jsxs("div",{children:[s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:e.t("sheet.cf.panel.range")}),s.jsxs("div",{className:"univer-mt-4",children:[s.jsx(pe.RangeSelector,{unitId:c,subUnitId:p,initialValue:f,onChange:(V,U)=>w(U),onVerify:I}),o&&s.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:o})]}),s.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:e.t("sheet.cf.panel.styleType")}),s.jsx(D.Select,{className:"univer-mt-4 univer-w-full",value:S,options:h,onChange:V=>_(V)}),s.jsx(N,{interceptorManager:x,rule:(O=t.rule)==null?void 0:O.rule,onChange:R}),s.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[s.jsx(D.Button,{onClick:g,children:e.t("sheet.cf.panel.cancel")}),s.jsx(D.Button,{className:"univer-ml-3",variant:"primary",onClick:M,children:e.t("sheet.cf.panel.submit")})]})]})};var qr=Object.getOwnPropertyDescriptor,Gr=(t,e,u,n)=>{for(var l=n>1?void 0:n?qr(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},zr=(t,e)=>(u,n)=>e(u,n,t);let se=class extends i.Disposable{constructor(e){super();ee(this,"_initLocal",()=>{});ee(this,"_findReplaceIndex",e=>{const u=/\{([^}]+)?\}/g,n=[];let l=u.exec(e);for(;l;)n.push({startIndex:l.index,key:Number(l[1]),endIndex:l.index+l[0].length-1}),l=u.exec(e);return n});this._localeService=e,this._initLocal()}tWithReactNode(e,...u){const n=this._localeService.getLocales(),l=e.split("."),a=n&&this._localeService.resolveKeyPath(n,l);if(typeof a=="string"){const c=[];return this._findReplaceIndex(a).forEach((p,o,v)=>{const d=v[o-1]||{endIndex:-1};if(d.endIndex+1<p.startIndex){const f=a.slice(d.endIndex+1,p.startIndex);f&&c.push(f)}if(u[p.key]&&c.push(u[p.key]),o===v.length-1){const f=a.slice(p.endIndex+1);f&&c.push(f)}}),c}return[]}};se=Gr([zr(0,i.Inject(i.LocaleService))],se);const Yr=(t,e)=>{const u=t.rule;switch(u.type){case r.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case r.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case r.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case r.CFRuleType.highlightCell:switch(u.subType){case r.CFSubRuleType.average:{const n=u.operator;return e.t(`sheet.cf.preview.describe.${n}`,e.t("sheet.cf.subRuleType.average"))}case r.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case r.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case r.CFSubRuleType.number:{const n=u.operator;return e.t(`sheet.cf.preview.describe.${n}`,...Array.isArray(u.value)?u.value.map(l=>String(l)):[String(u.value||"")])}case r.CFSubRuleType.text:{const n=u.operator;return e.t(`sheet.cf.preview.describe.${n}`,u.value||"")}case r.CFSubRuleType.timePeriod:{const n=u.operator;return e.t(`sheet.cf.preview.describe.${n}`)}case r.CFSubRuleType.rank:return u.isPercent?u.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(u.value)):e.t("sheet.cf.preview.describe.topNPercent",String(u.value)):u.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(u.value)):e.t("sheet.cf.preview.describe.topN",String(u.value));case r.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let hr=0;const Zr=t=>{const{onClick:e}=t,u=j.useDependency(r.ConditionalFormattingRuleModel),n=j.useDependency(i.IUniverInstanceService),l=j.useDependency(k.SheetsSelectionsService),a=j.useDependency(i.ICommandService),c=j.useDependency(i.LocaleService),p=j.useDependency(i.Injector),o=j.useDependency(j.ISidebarService),v=j.useDependency(se),d=j.useObservable(()=>n.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),f=d.getUnitId(),h=d.getActiveSheet();if(!h)throw new Error("No active sheet found");const S=h.getSheetId(),[_,b]=m.useState([]),[x,N]=m.useState("2"),[R,w]=m.useState(0),[M,g]=m.useState(-1),[I,T]=m.useState(hr),C=m.useRef(null),O=[{label:c.t("sheet.cf.panel.workSheet"),value:"2"},{label:c.t("sheet.cf.panel.selectedRange"),value:"1"}],V=()=>{const L=u.getSubunitRules(f,S);if(!L||!L.length)return[];if(x==="1"){const $=l.getCurrentLastSelection();if(!$)return[];const H=$.range;return L.filter(z=>z.ranges.some(Y=>i.Rectangle.intersects(Y,H)))}else if(x==="2")return[...L];return[]},[U,A]=m.useState(V);W.useHighlightRange(_),m.useEffect(()=>{const L=a.onCommandExecuted($=>{$.id===k.SetWorksheetActiveOperation.id&&w(Math.random())});return()=>L.dispose()}),m.useEffect(()=>{A(V)},[x,R,f,S]),m.useEffect(()=>{if(x==="2")return;const L=new X.Observable($=>{const H=[k.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],q=a.onCommandExecuted(z=>{const{id:Y,params:ne}=z,le=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId();H.includes(Y)&&ne.unitId===le&&$.next(null)});return()=>q.dispose()}).pipe(X.debounceTime(16)).subscribe(()=>{A(V)});return()=>{L.unsubscribe()}},[n,x,f,S]),m.useEffect(()=>{const L=u.$ruleChange.subscribe(()=>{w(Math.random())});return()=>L.unsubscribe()},[u]),m.useEffect(()=>{const L=()=>{var z,Y;const q=Math.max(0,((Y=(z=C.current)==null?void 0:z.getBoundingClientRect().width)!=null?Y:0)-8);return hr=q,q},H=new X.Observable(q=>{const z=o.getContainer();if(z){let Y=setTimeout(()=>{q.next()},150);const ne=()=>{Y&&clearTimeout(Y),Y=null},le=$e=>{$e.propertyName==="width"&&(ne(),q.next())};return z.addEventListener("transitionend",le),()=>{ne(),z.removeEventListener("transitionend",le)}}}).pipe(X.debounceTime(16)).subscribe(()=>{T(L())});return()=>{H.unsubscribe()}},[]);const y=L=>{var q;const $=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),H=(q=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:q.getSheetId();if(!$||!H)throw new Error("No active sheet found");a.executeCommand(r.DeleteCfCommand.id,{unitId:$,subUnitId:H,cfId:L.cfId})},E=(L,$)=>{g($.y)},F=(L,$,H)=>{var $e;g(-1);const q=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),z=($e=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:$e.getSheetId();if(!q||!z)throw new Error("No active sheet found");const Y=wt=>{const Vt=U.length;return Math.min(Vt-1,Math.max(0,wt))},ne=U[Y($.y)].cfId,le=U[Y(H.y)].cfId;ne!==le&&a.executeCommand(r.MoveCfCommand.id,{unitId:q,subUnitId:z,start:{id:ne,type:"self"},end:{id:le,type:H.y>$.y?"after":"before"}})},G=()=>{t.onCreate()},J=()=>{x==="2"?a.executeCommand(r.ClearWorksheetCfCommand.id):x==="1"&&U.map($=>({unitId:f,subUnitId:S,cfId:$.cfId})).forEach($=>{a.executeCommand(r.DeleteCfCommand.id,$)})},Q=m.useMemo(()=>{const L=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET),$=L.getActiveSheet();return U.filter(H=>{const q=H.ranges;return k.checkRangesEditablePermission(p,L.getUnitId(),$.getSheetId(),q)})},[U]),de=Q.map((L,$)=>({i:L.cfId,x:0,w:12,y:$,h:1,isResizable:!1})),ve=m.useMemo(()=>{const L=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET),$=L.getActiveSheet();return U.every(H=>{const q=H.ranges;return k.checkRangesEditablePermission(p,L.getUnitId(),$.getSheetId(),q)})},[U]);return s.jsxs("div",{children:[s.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm",children:[s.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:v.tWithReactNode("sheet.cf.panel.managerRuleSelect",s.jsx(D.Select,{className:"univer-w-36",options:O,value:x,onChange:L=>{N(L)}})).map((L,$)=>s.jsx("span",{children:L},$))}),s.jsxs("div",{className:"univer-flex univer-justify-end",children:[s.jsx(D.Tooltip,{title:c.t("sheet.cf.panel.createRule"),placement:"bottom",children:s.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:G,children:s.jsx(ar,{})})}),U.length&&ve?s.jsx(D.Tooltip,{title:c.t("sheet.cf.panel.clear"),placement:"bottom",children:s.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:J,children:s.jsx(Re,{className:"univer-text-red-500"})})}):s.jsx("div",{children:s.jsx(Re,{className:"univer-text-gray-300"})})]})]}),s.jsx("div",{ref:C,children:I>0&&s.jsx(D.ReactGridLayout,{className:`
|
|
66
|
+
[&_.react-grid-item]:univer-transition-none
|
|
67
|
+
[&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200
|
|
68
|
+
`,draggableHandle:".draggableHandle",layout:de,cols:12,rowHeight:60,width:I,margin:[0,10],onDragStop:F,onDragStart:E,children:Q==null?void 0:Q.map((L,$)=>s.jsx("div",{children:s.jsxs("div",{className:D.clsx(`
|
|
69
|
+
univer-group univer-relative univer-flex univer-items-center
|
|
70
|
+
univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8
|
|
71
|
+
hover:univer-bg-gray-100
|
|
72
|
+
`,{"univer-bg-gray-100":M===$}),onMouseMove:()=>{L.ranges!==_&&b(L.ranges)},onMouseLeave:()=>b([]),onClick:()=>{e(L)},children:[s.jsx("div",{className:D.clsx(`
|
|
73
|
+
univer-absolute univer-left-0 univer-hidden univer-size-5
|
|
74
|
+
univer-cursor-grab univer-items-center univer-justify-center
|
|
75
|
+
univer-rounded
|
|
76
|
+
group-hover:univer-flex
|
|
77
|
+
`,"draggableHandle"),onClick:H=>H.stopPropagation(),children:s.jsx(ir,{})}),s.jsxs("div",{className:`
|
|
78
|
+
univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden
|
|
79
|
+
`,children:[s.jsx("div",{className:"univer-text-sm univer-text-gray-900",children:Yr(L,c)}),s.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:L.ranges.map(H=>Be.serializeRange(H)).join(",")})]}),s.jsx("div",{children:s.jsx(ae,{rule:L.rule})}),s.jsx("div",{className:D.clsx(`
|
|
80
|
+
univer-absolute univer-right-1 univer-hidden univer-size-6
|
|
81
|
+
univer-cursor-pointer univer-items-center univer-justify-center
|
|
82
|
+
univer-rounded
|
|
83
|
+
group-hover:univer-flex
|
|
84
|
+
hover:univer-bg-gray-200
|
|
85
|
+
`,{"univer-flex univer-items-center univer-justify-center":M===$}),onClick:H=>{H.stopPropagation(),y(L),b([])},children:s.jsx(Re,{})})]})},`${L.cfId}`))})})]})},Kr=t=>{const[e,u]=m.useState(t.rule),[n,l]=m.useState(!!t.rule),a=()=>{l(!0)},c=()=>{l(!1),u(void 0)},p=o=>{u(o),l(!0)};return s.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between",children:n?s.jsx(Wr,{onCancel:c,rule:e}):s.jsx(Zr,{onClick:p,onCreate:a})})};var Xr=Object.getOwnPropertyDescriptor,Jr=(t,e,u,n)=>{for(var l=n>1?void 0:n?Xr(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},ye=(t,e)=>(u,n)=>e(u,n,t);const Ue="sheet.conditional.formatting.panel";let me=class extends i.Disposable{constructor(e,u,n,l,a){super();ee(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=u,this._componentManager=n,this._sidebarService=l,this._localeService=a,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).subscribe(c=>{var p;c||(p=this._sidebarDisposable)==null||p.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(c=>{c.id===Ue&&(c.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const u={id:Ue,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Ue,rule:e,key:i.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(u)}_initPanel(){this._componentManager.register(Ue,Kr)}};me=Jr([ye(0,i.IUniverInstanceService),ye(1,i.Inject(i.Injector)),ye(2,i.Inject(j.ComponentManager)),ye(3,i.Inject(j.ISidebarService)),ye(4,i.Inject(i.LocaleService))],me);var Z=(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))(Z||{});const Se={id:"sheet.operation.open.conditional.formatting.panel",type:i.CommandType.OPERATION,handler:(t,e)=>{var p;const u=t.get(me),n=t.get(k.SheetsSelectionsService),l=t.get(i.ICommandService),a=((p=n.getCurrentSelections())==null?void 0:p.map(o=>o.range))||[];switch(e.value){case 3:{u.openPanel({...r.createDefaultRule(),ranges:a});break}case 4:{const o={...r.createDefaultRule,ranges:a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};u.openPanel(o);break}case 5:{const o={...r.createDefaultRule,ranges:a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:"="}};u.openPanel(o);break}case 6:{const o={...r.createDefaultRule,ranges:a,rule:{type:r.CFRuleType.colorScale,config:[]}};u.openPanel(o);break}case 7:{const o={...r.createDefaultRule,ranges:a,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};u.openPanel(o);break}case 8:{const o={...r.createDefaultRule,ranges:a,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};u.openPanel(o);break}case 2:{u.openPanel();break}case 1:{u.openPanel({...r.createDefaultRule(),ranges:a});break}case 9:{l.executeCommand(r.ClearRangeCfCommand.id,{ranges:a});break}case 10:{l.executeCommand(r.ClearWorksheetCfCommand.id);break}}return!0}};var Qr=Object.getOwnPropertyDescriptor,et=(t,e,u,n)=>{for(var l=n>1?void 0:n?Qr(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},be=(t,e)=>(u,n)=>e(u,n,t);let Ie=class extends i.Disposable{constructor(e,u,n,l,a){super();ee(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=u,this._injector=n,this._conditionalFormattingViewModel=l,this._univerInstanceService=a,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,u,n)=>this._collectConditionalRule(e,u,n),onPasteCells:(e,u,n,l)=>{const{copyType:a=W.COPY_TYPE.COPY,pasteType:c}=l,{range:p}=e||{},{range:o}=u;return this._generateConditionalFormattingMutations(o,{copyType:a,pasteType:c,copyRange:p})}}))}_collectConditionalRule(e,u,n){const l=new i.ObjectMatrix,a={};this._copyInfo={matrix:l,info:{unitId:e,subUnitId:u,cfMap:a}};const c=this._injector.invoke(d=>k.rangeToDiscreteRange(n,d,e,u));if(!c)return;const{rows:p,cols:o}=c,v=new Set;p.forEach((d,f)=>{o.forEach((h,S)=>{const _=this._conditionalFormattingViewModel.getCellCfs(e,u,d,h);_&&(_.forEach(b=>v.add(b.cfId)),l.setValue(f,S,_.map(b=>b.cfId)))})}),v.forEach(d=>{const f=this._conditionalFormattingRuleModel.getRule(e,u,d);f&&(a[d]=f.rule)})}_generateConditionalFormattingMutations(e,u){const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),l=n.getActiveSheet(),a=n.getUnitId();if(!l)return{redos:[],undos:[]};const c=l.getSheetId();if(u.copyType===W.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!u.copyRange)return{redos:[],undos:[]};if(![W.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,W.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,W.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(u.pasteType))return{redos:[],undos:[]};const{ranges:[o,v],mapFunc:d}=W.virtualizeDiscreteRanges([u.copyRange,e]),f=W.getRepeatRange(o,v,!0),h={};i.Range.foreach(v,(g,I)=>{const{row:T,col:C}=d(g,I),O=this._conditionalFormattingViewModel.getCellCfs(a,c,T,C);O&&O.forEach(V=>{if(!h[V.cfId]){const U=new i.ObjectMatrix;h[V.cfId]=U;const A=this._conditionalFormattingRuleModel.getRule(a,c,V.cfId);A==null||A.ranges.forEach(y=>{i.Range.foreach(y,(E,F)=>{U.setValue(E,F,1)})})}h[V.cfId].realDeleteValue(T,C)})});const{matrix:S,info:_}=this._copyInfo,b=[];let x=this._conditionalFormattingRuleModel.createCfId(a,c);const N={},R=g=>{if(N[g])return N[g];const I=_==null?void 0:_.cfMap[g],T=[...this._conditionalFormattingRuleModel.getSubunitRules(a,c)||[],...b].find(C=>i.Tools.diffValue(C.rule,I));if(T)return N[g]=T,T;{const C={rule:I,cfId:x,ranges:[],stopIfTrue:!1};return N[g]=C,b.push(C),x=`${Number(x)+1}`,C}};f.forEach(g=>{S&&S.forValue((I,T,C)=>{const O=i.Rectangle.getPositionRange({startRow:I,endRow:I,startColumn:T,endColumn:T},g.startRange),{row:V,col:U}=d(O.startRow,O.startColumn);C.forEach(A=>{if(!h[A]){const y=R(A),E=new i.ObjectMatrix;h[A]=E,y.ranges.forEach(F=>{i.Range.foreach(F,(G,J)=>{E.setValue(G,J,1)})})}h[A].setValue(V,U,1)})})});const w=[],M=[];for(const g in h){const I=h[g],T=k.findAllRectangle(k.createTopMatrixFromMatrix(I));if(!T.length){const C={unitId:a,subUnitId:c,cfId:g};w.push({id:r.DeleteConditionalRuleMutation.id,params:C}),M.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,C))}if(b.some(C=>C.cfId===g)){const C=R(g),O={unitId:a,subUnitId:c,rule:{...C,ranges:T}};w.push({id:r.AddConditionalRuleMutation.id,params:O}),M.push(r.AddConditionalRuleMutationUndoFactory(this._injector,O))}else{const C=this._conditionalFormattingRuleModel.getRule(a,c,g);if(!C)continue;const O={unitId:a,subUnitId:c,rule:{...C,ranges:T}};w.push({id:r.SetConditionalRuleMutation.id,params:O}),M.push(...r.setConditionalRuleMutationUndoFactory(this._injector,O))}}return{redos:w,undos:M}}};Ie=et([be(0,i.Inject(W.ISheetClipboardService)),be(1,i.Inject(r.ConditionalFormattingRuleModel)),be(2,i.Inject(i.Injector)),be(3,i.Inject(r.ConditionalFormattingViewModel)),be(4,i.Inject(i.IUniverInstanceService))],Ie);var rt=Object.getOwnPropertyDescriptor,tt=(t,e,u,n)=>{for(var l=n>1?void 0:n?rt(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},er=(t,e)=>(u,n)=>e(u,n,t);let Ce=class extends i.Disposable{constructor(t,e,u){super(),this._localeService=t,this._commandService=e,this._sheetPermissionCheckController=u,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===r.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[k.WorkbookEditablePermission],rangeTypes:[k.RangeProtectionPermissionEditPoint],worksheetTypes:[k.WorksheetEditPermission,k.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};Ce=tt([er(0,i.Inject(i.LocaleService)),er(1,i.ICommandService),er(2,i.Inject(k.SheetPermissionCheckController))],Ce);var nt=Object.getOwnPropertyDescriptor,lt=(t,e,u,n)=>{for(var l=n>1?void 0:n?nt(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},ke=(t,e)=>(u,n)=>e(u,n,t);let Te=class extends i.Disposable{constructor(t,e,u,n){super(),this._conditionalFormattingRuleModel=t,this._univerInstanceService=e,this._injector=u,this._refRangeService=n,this._initRefRange()}_initRefRange(){const t=new Map,e=(n,l,a)=>`${n}_${l}_${a}`,u=(n,l,a)=>{const c=o=>{const v=[...a.ranges],d=v.map(h=>k.handleDefaultRangeChangeWithEffectRefCommands(h,o)).filter(h=>!!h);if(r.isRangesEqual(d,v))return{redos:[],undos:[]};if(d.length){const h={unitId:n,subUnitId:l,rule:{...a,ranges:d}},S=[{id:r.SetConditionalRuleMutation.id,params:h}],_=r.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:S,undos:_}}else{const h={unitId:n,subUnitId:l,cfId:a.cfId},S=[{id:r.DeleteConditionalRuleMutation.id,params:h}],_=r.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:S,undos:_}}},p=[];a.ranges.forEach(o=>{const v=this._refRangeService.registerRefRange(o,c);p.push(()=>v.dispose())}),t.set(e(n,l,a.cfId),()=>p.forEach(o=>o()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:l,subUnitId:a,rule:c}=n,p=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),o=p.getActiveSheet();if(!(n.unitId!==p.getUnitId()||n.subUnitId!==(o==null?void 0:o.getSheetId())))switch(n.type){case"add":{u(n.unitId,n.subUnitId,n.rule);break}case"delete":{const v=t.get(e(l,a,c.cfId));v&&v();break}case"set":{const v=t.get(e(l,a,c.cfId));v&&v(),u(n.unitId,n.subUnitId,n.rule)}}})),this.disposeWithMe(i.toDisposable(()=>{t.forEach(n=>{n()}),t.clear()}))}};Te=lt([ke(0,i.Inject(r.ConditionalFormattingRuleModel)),ke(1,i.Inject(i.IUniverInstanceService)),ke(2,i.Inject(i.Injector)),ke(3,i.Inject(k.RefRangeService))],Te);var ut=Object.getOwnPropertyDescriptor,at=(t,e,u,n)=>{for(var l=n>1?void 0:n?ut(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},ce=(t,e)=>(u,n)=>e(u,n,t);let _e=class extends i.Disposable{constructor(e,u,n,l,a,c){super();ee(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=u,this._univerInstanceService=n,this._renderManagerService=l,this._conditionalFormattingViewModel=a,this._conditionalFormattingRuleModel=c,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var u,n,l;const e=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId();(u=this._renderManagerService.getRenderById(e))==null||u.with(W.SheetSkeletonManagerService).reCalculate(),(l=(n=this._renderManagerService.getRenderById(e))==null?void 0:n.mainComponent)==null||l.makeDirty()}_initSkeleton(){this.disposeWithMe(X.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(fe.bufferTime(16),fe.filter(e=>!!e.length),fe.filter(e=>{const u=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const n=u.getActiveSheet();return n?e.filter(l=>l.unitId===u.getUnitId()&&l.subUnitId===n.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(k.INTERCEPTOR_POINT.CELL_CONTENT,{effect:i.InterceptorEffectEnum.Style,handler:(e,u,n)=>{const l=this._conditionalFormattingService.composeStyle(u.unitId,u.subUnitId,u.row,u.col);if(!l)return n(e);const a=u.workbook.getStyles(),p={...(typeof(e==null?void 0:e.s)=="string"?a.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},o={...e,s:p};return l.style&&Object.assign(p,l.style),o.fontRenderExtension||(o.fontRenderExtension={},l.isShowValue!==void 0&&(o.fontRenderExtension.isSkip=!l.isShowValue)),l.dataBar&&(o.dataBar=l.dataBar),l.iconSet&&(o.iconSet=l.iconSet,o.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),n(o)},priority:10}))}};_e=at([ce(0,i.Inject(k.SheetInterceptorService)),ce(1,i.Inject(r.ConditionalFormattingService)),ce(2,i.Inject(i.IUniverInstanceService)),ce(3,i.Inject(lr.IRenderManagerService)),ce(4,i.Inject(r.ConditionalFormattingViewModel)),ce(5,i.Inject(r.ConditionalFormattingRuleModel))],_e);const gr="sheets-conditional-formatting-ui.config",Pe={};var it=Object.defineProperty,st=Object.getOwnPropertyDescriptor,ct=(t,e,u)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,ot=(t,e,u,n)=>{for(var l=n>1?void 0:n?st(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},rr=(t,e)=>(u,n)=>e(u,n,t),yr=(t,e,u)=>ct(t,typeof e!="symbol"?e+"":e,u);P.UniverSheetsConditionalFormattingMobileUIPlugin=class extends i.Plugin{constructor(e=Pe,u,n,l){super(),this._config=e,this._injector=u,this._commandService=n,this._configService=l;const{menu:a,...c}=i.merge({},Pe,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(gr,c),this._initCommand(),this._injector.add([_e]),this._injector.add([Te]),this._injector.add([Ie]),this._injector.add([Ce]),this._injector.add([se])}_initCommand(){[He,We,qe,Ge,ze,Ye,Ze,Ke,Xe,Se].forEach(e=>{this._commandService.registerCommand(e)})}},yr(P.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),yr(P.UniverSheetsConditionalFormattingMobileUIPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsConditionalFormattingMobileUIPlugin=ot([i.DependentOn(r.UniverSheetsConditionalFormattingPlugin),rr(1,i.Inject(i.Injector)),rr(2,i.Inject(i.ICommandService)),rr(3,i.IConfigService)],P.UniverSheetsConditionalFormattingMobileUIPlugin);var dt=Object.getOwnPropertyDescriptor,vt=(t,e,u,n)=>{for(var l=n>1?void 0:n?dt(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},Ee=(t,e)=>(u,n)=>e(u,n,t);let De=class extends i.Disposable{constructor(t,e,u,n,l){super(),this._injector=t,this._univerInstanceService=e,this._autoFillService=u,this._conditionalFormattingRuleModel=n,this._conditionalFormattingViewModel=l,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(l,a,c,p,o)=>{var S;const v=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(S=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId();if(!v||!d)return;const f={startRow:l.row,startColumn:l.col,endColumn:l.col,endRow:l.row},h={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row};i.Range.foreach(c,(_,b)=>{const x=i.Rectangle.getPositionRange({startRow:_,startColumn:b,endColumn:b,endRow:_},f),N=i.Rectangle.getPositionRange({startRow:_,startColumn:b,endColumn:b,endRow:_},h),{row:R,col:w}=o(x.startRow,x.startColumn),M=this._conditionalFormattingViewModel.getCellCfs(v,d,R,w),{row:g,col:I}=o(N.startRow,N.startColumn),T=this._conditionalFormattingViewModel.getCellCfs(v,d,g,I);T&&T.forEach(C=>{let O=p.get(C.cfId);if(!p.get(C.cfId)){const V=this._conditionalFormattingRuleModel.getRule(v,d,C.cfId);if(!V)return;O=new i.ObjectMatrix,V.ranges.forEach(U=>{i.Range.foreach(U,(A,y)=>{O.setValue(A,y,1)})}),p.set(C.cfId,O)}O.realDeleteValue(g,I)}),M&&M.forEach(C=>{let O=p.get(C.cfId);if(!p.get(C.cfId)){const V=this._conditionalFormattingRuleModel.getRule(v,d,C.cfId);if(!V)return;O=new i.ObjectMatrix,V.ranges.forEach(U=>{i.Range.foreach(U,(A,y)=>{O.setValue(A,y,1)})}),p.set(C.cfId,O)}O.setValue(g,I,1)})})},u=(l,a)=>{var N,R,w;const c=(N=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:N.getUnitId(),p=(w=(R=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:R.getActiveSheet())==null?void 0:w.getSheetId(),o=new Map,v=[],d=[];if(!c||!p)return t();const f=W.virtualizeDiscreteRanges([l,a]),[h,S]=f.ranges,{mapFunc:_}=f,b={row:h.startRow,col:h.startColumn};return W.getAutoFillRepeatRange(h,S).forEach(M=>{e(b,M.repeatStartCell,M.relativeRange,o,_)}),o.forEach((M,g)=>{const I=this._conditionalFormattingRuleModel.getRule(c,p,g);if(!I)return;const T=k.findAllRectangle(k.createTopMatrixFromMatrix(M));if(T.length){const C={unitId:c,subUnitId:p,rule:{...I,ranges:T}};v.push({id:r.SetConditionalRuleMutation.id,params:C}),d.push(...r.setConditionalRuleMutationUndoFactory(this._injector,C))}else{const C={unitId:c,subUnitId:p,cfId:I.cfId};v.push({id:r.DeleteConditionalRuleMutation.id,params:C}),d.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,C))}}),{undos:d,redos:v}},n={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(l,a,c)=>{if(c===W.APPLY_TYPE.COPY||c===W.APPLY_TYPE.ONLY_FORMAT||c===W.APPLY_TYPE.SERIES){const{source:p,target:o}=l;return u(p,o)}return t()}};this.disposeWithMe(this._autoFillService.addHook(n))}};De=vt([Ee(0,i.Inject(i.Injector)),Ee(1,i.Inject(i.IUniverInstanceService)),Ee(2,i.Inject(W.IAutoFillService)),Ee(3,i.Inject(r.ConditionalFormattingRuleModel)),Ee(4,i.Inject(r.ConditionalFormattingViewModel))],De);var pt=Object.getOwnPropertyDescriptor,ft=(t,e,u,n)=>{for(var l=n>1?void 0:n?pt(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},Ne=(t,e)=>(u,n)=>e(u,n,t);P.ConditionalFormattingClearController=class extends i.Disposable{constructor(e,u,n,l,a){super(),this._injector=e,this._univerInstanceService=u,this._sheetInterceptorService=n,this._selectionManagerService=l,this._conditionalFormattingRuleModel=a,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var a;const u=[],n=[],l={redos:u,undos:n};if([k.ClearSelectionFormatCommand.id,k.ClearSelectionAllCommand.id].includes(e.id)){const c=(a=this._selectionManagerService.getCurrentSelections())==null?void 0:a.map(_=>_.range);if(!c)return l;const p=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),o=p.getActiveSheet();if(!o)return l;const v=p.getUnitId(),d=o.getSheetId(),f=this._conditionalFormattingRuleModel.getSubunitRules(v,d);if(!f||!f.length)return l;const{redos:h,undos:S}=mr(this._injector,f,c,v,d);u.push(...h),n.push(...S)}return l}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:u,ranges:n})=>{const l=[],a=[],c={redos:l,undos:a};if(!n||!n.length)return c;const p=this._conditionalFormattingRuleModel.getSubunitRules(e,u);if(!p||!p.length)return c;const{redos:o,undos:v}=mr(this._injector,p,n,e,u);return l.push(...o),a.push(...v),c}}))}},P.ConditionalFormattingClearController=ft([Ne(0,i.Inject(i.Injector)),Ne(1,i.Inject(i.IUniverInstanceService)),Ne(2,i.Inject(k.SheetInterceptorService)),Ne(3,i.Inject(k.SheetsSelectionsService)),Ne(4,i.Inject(r.ConditionalFormattingRuleModel))],P.ConditionalFormattingClearController);function mr(t,e,u,n,l){const a=[],c=[];return e.filter(p=>u.some(o=>p.ranges.some(v=>i.Rectangle.getIntersects(v,o)))).forEach(p=>{const v=new k.RangeMergeUtil().add(...p.ranges).subtract(...u).merge();if(v.length){const d={id:r.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:l,rule:{...p,ranges:v}}},f=r.setConditionalRuleMutationUndoFactory(t,d.params);a.push(d),c.push(...f)}else{const d={id:r.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:l,cfId:p.cfId}},f=r.DeleteConditionalRuleMutationUndoFactory(t,d.params);a.push(d),c.push(...f)}}),{redos:a,undos:c}}var ht=Object.getOwnPropertyDescriptor,gt=(t,e,u,n)=>{for(var l=n>1?void 0:n?ht(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},Sr=(t,e)=>(u,n)=>e(u,n,t);let je=class extends i.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(i.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(k.AFTER_CELL_EDIT,{handler:(t,e,u)=>{var c,p,o;t||u(t);const n=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),l=(c=n==null?void 0:n.style)!=null?c:{},a=Object.keys(l);if(t!=null&&t.p)return(o=(p=t.p.body)==null?void 0:p.textRuns)==null||o.forEach(v=>{v.ts&&a.forEach(d=>{var f;(f=v.ts)==null||delete f[d]})}),u(t);{const v={...(typeof(t==null?void 0:t.s)=="string"?e.workbook.getStyles().get(t.s):t==null?void 0:t.s)||{}};a.forEach(f=>{delete v[f]});const d={...t,s:{...v}};return u(d)}}})))}};je=gt([Sr(0,i.Inject(k.SheetInterceptorService)),Sr(1,i.Inject(r.ConditionalFormattingService))],je);const br=[k.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],xe=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:Z.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:Z.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:Z.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:Z.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:Z.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:Z.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:Z.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:Z.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:Z.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:Z.clearWorkSheetRules}],yt=t=>{const e=t.get(k.SheetsSelectionsService),u=t.get(i.ICommandService),n=t.get(i.IUniverInstanceService),l=t.get(r.ConditionalFormattingRuleModel),a=new X.Observable(o=>X.merge(e.selectionMoveEnd$,e.selectionSet$,new X.Observable(v=>{const d=u.onCommandExecuted(f=>{var b;const{id:h,params:S}=f,_=(b=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:b.getUnitId();br.includes(h)&&S.unitId===_&&v.next(null)});return()=>d.dispose()})).pipe(fe.debounceTime(16)).subscribe(()=>{var b;const v=((b=e.getCurrentSelections())==null?void 0:b.map(x=>x.range))||[],d=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!d)return;const f=d.getActiveSheet();if(!f)return;const _=(l.getSubunitRules(d.getUnitId(),f.getSheetId())||[]).filter(x=>x.ranges.some(N=>v.some(R=>i.Rectangle.intersects(R,N)))).map(x=>x.ranges).every(x=>k.checkRangesEditablePermission(t,d.getUnitId(),f.getSheetId(),x));o.next(_)})),c=new X.Observable(o=>new X.Observable(v=>{const d=u.onCommandExecuted(f=>{var b;const{id:h,params:S}=f,_=(b=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:b.getUnitId();br.includes(h)&&S.unitId===_&&v.next(null)});return()=>d.dispose()}).pipe(fe.debounceTime(16)).subscribe(()=>{const v=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!v)return;const d=v.getActiveSheet();if(!d)return;const f=l.getSubunitRules(v.getUnitId(),d.getSheetId())||[];if(!f.length)return o.next(!1),!1;const h=f.map(S=>S.ranges).every(S=>k.checkRangesEditablePermission(t,v.getUnitId(),d.getSheetId(),S));o.next(h)})),p=new X.Observable(o=>{a.subscribe(v=>{const d=xe.find(f=>f.value===Z.clearRangeRules);d&&(d.disabled=!v,o.next(xe))}),c.subscribe(v=>{const d=xe.find(f=>f.value===Z.clearWorkSheetRules);d&&(d.disabled=!v,o.next(xe))}),o.next(xe)});return{id:Se.id,type:j.MenuItemType.SELECTOR,icon:"Conditions",tooltip:"sheet.cf.title",selections:p,hidden$:j.getMenuHiddenObservable(t,i.UniverInstanceType.UNIVER_SHEET),disabled$:W.getCurrentRangeDisable$(t,{workbookTypes:[k.WorkbookEditablePermission],worksheetTypes:[k.WorksheetSetCellStylePermission,k.WorksheetEditPermission],rangeTypes:[k.RangeProtectionPermissionEditPoint]})}},mt={[j.RibbonStartGroup.FORMULAS_INSERT]:{[Se.id]:{order:0,menuItemFactory:yt}}};var St=Object.getOwnPropertyDescriptor,bt=(t,e,u,n)=>{for(var l=n>1?void 0:n?St(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},Ir=(t,e)=>(u,n)=>e(u,n,t);let Ae=class extends i.Disposable{constructor(e,u){super();ee(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=u,this._menuManagerService.mergeMenu(mt)}};Ae=bt([Ir(0,i.Inject(i.Injector)),Ir(1,j.IMenuManagerService)],Ae);var It=Object.getOwnPropertyDescriptor,Ct=(t,e,u,n)=>{for(var l=n>1?void 0:n?It(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},oe=(t,e)=>(u,n)=>e(u,n,t);const Tt=(t,e)=>{const u=d=>d.endRow-d.startRow+1,n=d=>d.endColumn-d.startColumn+1,l=u(e)%u(t),a=n(e)%n(t),c=Math.floor(u(e)/u(t)),p=Math.floor(n(e)/n(t)),o=[],v={startRow:0,endRow:u(t)-1,startColumn:0,endColumn:n(t)-1};if(u(e)===1&&n(e)===1){const d={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return o.push({repeatRelativeRange:v,startRange:d}),o}for(let d=0;d<c+(l?.1:0);d++)for(let f=0;f<p+(a?.1:0);f++){const h=u(t)*d,S=n(t)*f,_={startRow:h+e.startRow,endRow:h+e.startRow,startColumn:S+e.startColumn,endColumn:S+e.startColumn};let b=v;d===c&&l&&(b={...b},b.endRow=b.endRow-(u(t)-l)),f===p&&a&&(b={...b},b.endColumn=b.endColumn-(n(t)-a)),o.push({repeatRelativeRange:b,startRange:_})}return o};let Le=class extends i.Disposable{constructor(e,u,n,l,a,c){super();ee(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=u,this._formatPainterService=n,this._sheetsSelectionsService=l,this._conditionalFormattingRuleModel=a,this._conditionalFormattingViewModel=c,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),u=(a,c,p,o,v)=>{const{unitId:d,subUnitId:f}=this._painterConfig,{targetUnitId:h,targetSubUnitId:S}=v,_={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},b={startRow:c.row,startColumn:c.col,endColumn:c.col,endRow:c.row};i.Range.foreach(p,(x,N)=>{const R=i.Rectangle.getPositionRange({startRow:x,startColumn:N,endColumn:N,endRow:x},_),w=i.Rectangle.getPositionRange({startRow:x,startColumn:N,endColumn:N,endRow:x},b),M=this._conditionalFormattingViewModel.getCellCfs(d,f,R.startRow,R.startColumn),g=this._conditionalFormattingViewModel.getCellCfs(h,S,w.startRow,w.startColumn);g&&g.forEach(I=>{let T=o.get(I.cfId);if(!o.get(I.cfId)){const C=this._conditionalFormattingRuleModel.getRule(h,S,I.cfId);if(!C)return;T=new i.ObjectMatrix,C.ranges.forEach(O=>{i.Range.foreach(O,(V,U)=>{T.setValue(V,U,1)})}),o.set(I.cfId,T)}T.realDeleteValue(w.startRow,w.startColumn)}),M&&M.forEach(I=>{const T=o.get(I.cfId);T&&T.setValue(w.startRow,w.startColumn,1)})})},n=(a,c,p)=>{var R;const{range:o,unitId:v,subUnitId:d}=this._painterConfig,f=a!==v||d!==c,h=new Map,S=[],_=[];if(!a||!c||!v||!d)return e();const b=(R=this._conditionalFormattingRuleModel.getSubunitRules(v,d))!=null?R:[];b==null||b.forEach(w=>{const{ranges:M,cfId:g}=w;if(M.some(I=>i.Rectangle.intersects(o,I))){const I=new i.ObjectMatrix;f||M.forEach(T=>{i.Range.foreach(T,(C,O)=>{I.setValue(C,O,1)})}),h.set(g,I)}});const x={row:o.startRow,col:o.startColumn};return Tt(o,p).forEach(w=>{u(x,{row:w.startRange.startRow,col:w.startRange.startColumn},w.repeatRelativeRange,h,{targetUnitId:a,targetSubUnitId:c})}),h.forEach((w,M)=>{if(f){const g=this._conditionalFormattingRuleModel.getRule(a,c,M),I=k.findAllRectangle(k.createTopMatrixFromMatrix(w));if(g)if(I.length){const T={unitId:a,subUnitId:c,rule:{...g,ranges:I}};S.push({id:r.SetConditionalRuleMutation.id,params:T}),_.push(...r.setConditionalRuleMutationUndoFactory(this._injector,T))}else{const T={unitId:a,subUnitId:c,cfId:g.cfId};S.push({id:r.DeleteConditionalRuleMutation.id,params:T}),_.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,T))}else if(I.length){const T=this._conditionalFormattingRuleModel.getRule(v,d,M);if(T){const C={unitId:a,subUnitId:c,rule:{...i.Tools.deepClone(T),cfId:this._conditionalFormattingRuleModel.createCfId(a,c),ranges:I}};S.push({id:r.AddConditionalRuleMutation.id,params:C}),_.push(r.AddConditionalRuleMutationUndoFactory(this._injector,C))}}}else{const g=this._conditionalFormattingRuleModel.getRule(v,d,M);if(!g)return;const I=k.findAllRectangle(k.createTopMatrixFromMatrix(w));if(I.length){const T={unitId:v,subUnitId:d,rule:{...g,ranges:I}};S.push({id:r.SetConditionalRuleMutation.id,params:T}),_.push(...r.setConditionalRuleMutationUndoFactory(this._injector,T))}else{const T={unitId:v,subUnitId:d,cfId:g.cfId};S.push({id:r.DeleteConditionalRuleMutation.id,params:T}),_.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,T))}}}),{undos:_,redos:S}},l={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:a=>{var c,p,o;switch(a){case W.FormatPainterStatus.INFINITE:case W.FormatPainterStatus.ONCE:{const v=(c=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:c.getUnitId(),d=(o=(p=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getActiveSheet())==null?void 0:o.getSheetId(),f=this._sheetsSelectionsService.getCurrentLastSelection(),h=f==null?void 0:f.range;v&&d&&h&&(this._painterConfig={unitId:v,subUnitId:d,range:h});break}case W.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(a,c,p)=>this._painterConfig?n(a,c,p):{redos:[],undos:[]}};this._formatPainterService.addHook(l)}};Le=Ct([oe(0,i.Inject(i.Injector)),oe(1,i.Inject(i.IUniverInstanceService)),oe(2,i.Inject(W.IFormatPainterService)),oe(3,i.Inject(k.SheetsSelectionsService)),oe(4,i.Inject(r.ConditionalFormattingRuleModel)),oe(5,i.Inject(r.ConditionalFormattingViewModel))],Le);var _t=Object.getOwnPropertyDescriptor,Et=(t,e,u,n)=>{for(var l=n>1?void 0:n?_t(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},tr=(t,e)=>(u,n)=>e(u,n,t);let Fe=class extends i.Disposable{constructor(t,e,u){super(),this._conditionalFormattingViewModel=t,this._univerInstanceService=e,this._renderManagerService=u,this._init()}_init(){const t=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),e=u=>{const n=u.getUnitId(),l=this._renderManagerService.getRenderById(n);if(!l)return;const a=l.with(W.SheetSkeletonManagerService);this.disposeWithMe(a.currentSkeleton$.subscribe(c=>{if(c){const p=c.skeleton.rowColumnSegment,o=p.endColumn-p.startColumn+1,d=(p.endRow-p.startRow+1)*o*9,f=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,d);this._conditionalFormattingViewModel.setCacheLength(f)}}))};t&&e(t),this._univerInstanceService.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).subscribe(u=>{u&&e(u)})}};Fe=Et([tr(0,i.Inject(r.ConditionalFormattingViewModel)),tr(1,i.IUniverInstanceService),tr(2,lr.IRenderManagerService)],Fe);var Nt=Object.defineProperty,xt=Object.getOwnPropertyDescriptor,Rt=(t,e,u)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,Mt=(t,e,u,n)=>{for(var l=n>1?void 0:n?xt(e,u):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(l=c(l)||l);return l},nr=(t,e)=>(u,n)=>e(u,n,t),Cr=(t,e,u)=>Rt(t,typeof e!="symbol"?e+"":e,u);P.UniverSheetsConditionalFormattingUIPlugin=class extends i.Plugin{constructor(e=Pe,u,n,l){super(),this._config=e,this._injector=u,this._commandService=n,this._configService=l;const{menu:a,...c}=i.merge({},Pe,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(gr,c),this._initCommand()}onStarting(){i.registerDependencies(this._injector,[[_e],[Te],[Ie],[De],[Ce],[me],[Ae],[se],[je],[P.ConditionalFormattingClearController],[Le],[Fe]]),i.touchDependencies(this._injector,[[_e]])}onReady(){i.touchDependencies(this._injector,[[Ae],[me]])}onRendered(){i.touchDependencies(this._injector,[[De],[P.ConditionalFormattingClearController],[Ie],[je],[se],[Le],[Ce],[Te],[Fe]])}_initCommand(){[He,We,qe,Ge,ze,Ye,Ze,Ke,Xe,Se].forEach(e=>{this._commandService.registerCommand(e)})}},Cr(P.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),Cr(P.UniverSheetsConditionalFormattingUIPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsConditionalFormattingUIPlugin=Mt([i.DependentOn(r.UniverSheetsConditionalFormattingPlugin),nr(1,i.Inject(i.Injector)),nr(2,i.Inject(i.ICommandService)),nr(3,i.IConfigService)],P.UniverSheetsConditionalFormattingUIPlugin),P.AddAverageCfCommand=He,P.AddColorScaleConditionalRuleCommand=We,P.AddDataBarConditionalRuleCommand=qe,P.AddDuplicateValuesCfCommand=Ge,P.AddNumberCfCommand=ze,P.AddRankCfCommand=Ye,P.AddTextCfCommand=Ze,P.AddTimePeriodCfCommand=Ke,P.AddUniqueValuesCfCommand=Xe,P.OpenConditionalFormattingOperator=Se,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|
|
163
86
|
|
|
164
87
|
|
|
165
88
|
// index
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-conditional-formatting",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -57,15 +57,16 @@
|
|
|
57
57
|
"rxjs": ">=7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@univerjs/sheets-conditional-formatting": "0.
|
|
61
|
-
"@univerjs/sheets-conditional-formatting-ui": "0.
|
|
60
|
+
"@univerjs/sheets-conditional-formatting": "0.7.0-beta.1",
|
|
61
|
+
"@univerjs/sheets-conditional-formatting-ui": "0.7.0-beta.1",
|
|
62
|
+
"rxjs": ">=7.0.0"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@univerjs/core": "0.
|
|
65
|
+
"@univerjs/core": "0.7.0-beta.1",
|
|
65
66
|
"react": "18.3.1",
|
|
66
67
|
"react-dom": "18.3.1",
|
|
67
|
-
"typescript": "^5.8.
|
|
68
|
-
"@univerjs-infra/shared": "0.
|
|
68
|
+
"typescript": "^5.8.3",
|
|
69
|
+
"@univerjs-infra/shared": "0.7.0-beta.1"
|
|
69
70
|
},
|
|
70
71
|
"scripts": {
|
|
71
72
|
"prebuild:preset": "tsx prepare.ts",
|