@univerjs/preset-sheets-conditional-formatting 0.13.0 → 0.14.0
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/umd/index.js +2 -2
- package/package.json +5 -5
package/lib/umd/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @univerjs/sheets-conditional-formatting/index
|
|
2
|
-
(function(C,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/engine-formula"),require("rxjs/operators"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","rxjs","@univerjs/engine-formula","rxjs/operators","@univerjs/engine-render"],u):(C=typeof globalThis<"u"?globalThis:C||self,u(C.UniverSheetsConditionalFormatting={},C.UniverCore,C.UniverSheets,C.rxjs,C.UniverEngineFormula,C.rxjs.operators,C.UniverEngineRender))})(this,(function(C,u,p,z,O,r2,G){"use strict";var _0=Object.defineProperty;var M0=(C,u,p)=>u in C?_0(C,u,{enumerable:!0,configurable:!0,writable:!0,value:p}):C[u]=p;var F=(C,u,p)=>M0(C,typeof u!="symbol"?u+"":u,p);var c2;const h2="SHEET_CONDITIONAL_FORMATTING_PLUGIN";var b=(r=>(r.beginsWith="beginsWith",r.endsWith="endsWith",r.containsText="containsText",r.notContainsText="notContainsText",r.equal="equal",r.notEqual="notEqual",r.containsBlanks="containsBlanks",r.notContainsBlanks="notContainsBlanks",r.containsErrors="containsErrors",r.notContainsErrors="notContainsErrors",r))(b||{}),L=(r=>(r.today="today",r.yesterday="yesterday",r.tomorrow="tomorrow",r.last7Days="last7Days",r.thisMonth="thisMonth",r.lastMonth="lastMonth",r.nextMonth="nextMonth",r.thisWeek="thisWeek",r.lastWeek="lastWeek",r.nextWeek="nextWeek",r))(L||{}),E=(r=>(r.greaterThan="greaterThan",r.greaterThanOrEqual="greaterThanOrEqual",r.lessThan="lessThan",r.lessThanOrEqual="lessThanOrEqual",r.notBetween="notBetween",r.between="between",r.equal="equal",r.notEqual="notEqual",r))(E||{}),I=(r=>(r.highlightCell="highlightCell",r.dataBar="dataBar",r.colorScale="colorScale",r.iconSet="iconSet",r))(I||{}),y=(r=>(r.uniqueValues="uniqueValues",r.duplicateValues="duplicateValues",r.rank="rank",r.text="text",r.timePeriod="timePeriod",r.number="number",r.average="average",r.formula="formula",r))(y||{}),R=(r=>(r.num="num",r.min="min",r.max="max",r.percent="percent",r.percentile="percentile",r.formula="formula",r))(R||{});const Y2="#fff",K2="#000000",J2=()=>({cfId:void 0,ranges:[],stopIfTrue:!1,rule:{type:"highlightCell",subType:"text",operator:"containsText"}}),z2=(r,s)=>{switch(r){case"text":{if(["beginsWith","containsText","endsWith","equal","notContainsText","notEqual"].includes(s))return"";break}case"number":return["between","notBetween"].includes(s)?[10,100]:10}return""},Q2=(r,s)=>{switch(r){case"formula":return"=";case"max":case"min":return"";case"percent":case"percentile":case"num":return s!==void 0?s:10}return""},j=(r,s,n)=>{if(!s)return null;const e=s.findIndex(t=>n(t)===r.id);if(e<0)return null;switch(r.type){case"after":return e+1;case"before":return e-1;case"self":return e}},A2=(r,s,n,e)=>{if(!n)return null;const t=j(r,n,e);let i=j(s,n,e);if(t===null||i===null||t===i)return;const a=n.splice(t,1)[0];switch(t<i&&(i=j(s,n,e)),s.type){case"before":{n.splice(i+1,0,a);break}case"self":case"after":{n.splice(i,0,a);break}}},g2=(r,s,n,e)=>{if(r.type==="after"&&["after","before"].includes(s.type))return[r,s];const t={...r},i={...s};if(t.type!=="after"){const a=j(t,n,e);if(a===null)return null;if(a-1<0){const o=n[a+1];if(o)t.id=e(o),t.type="before";else return null}else{const o=e(n[a-1]);t.id=o,t.type="after"}}if(!["after","before"].includes(i.type)){const a=j(i,n,e);if(a===null)return null;if(a===0)i.type="before";else if(a-1>=0){const o=e(n[a-1]);i.id=o,i.type="after"}else if(a+1<=n.length-1){const o=e(n[a+1]);i.id=o,i.type="before"}else return null}return t.id===i.id&&t.type===i.type?null:[t,i]},y2=(r,s)=>{if(["after","before"].includes(s.type)){if(r.type==="after")return[s,r];if(r.type==="before")return[s,{...r,type:"self"}]}return null},e0=(r,s)=>r.id===s.id&&r.type===s.type,_2=()=>`${u.generateRandomId(8)}`;class M{constructor(){F(this,"_model",new Map);F(this,"_ruleChange$",new z.Subject);F(this,"$ruleChange",this._ruleChange$.asObservable())}_ensureList(s,n){let e=this.getSubunitRules(s,n);if(!e){e=[];let t=this._model.get(s);t||(t=new Map,this._model.set(s,t)),t.set(n,e)}return e}getRule(s,n,e){const t=this.getSubunitRules(s,n);return t?t.find(i=>i.cfId===e):null}getUnitRules(s){return this._model.get(s)||null}getSubunitRules(s,n){var t;return((t=this._model.get(s))==null?void 0:t.get(n))||null}deleteRule(s,n,e){const t=this.getSubunitRules(s,n);if(t){const i=t.findIndex(o=>o.cfId===e),a=t[i];a&&(t.splice(i,1),this._ruleChange$.next({rule:a,subUnitId:n,unitId:s,type:"delete"}))}}setRule(s,n,e,t){const a=this._ensureList(s,n).find(o=>o.cfId===t);if(a){const o=u.Tools.deepClone(a);Object.assign(a,e),this._ruleChange$.next({rule:a,subUnitId:n,unitId:s,type:"set",oldRule:o})}}addRule(s,n,e){const t=this._ensureList(s,n);t.find(a=>a.cfId===e.cfId)||t.unshift(e),this._ruleChange$.next({rule:e,subUnitId:n,unitId:s,type:"add"})}moveRulePriority(s,n,e,t){const i=this._ensureList(s,n),a=j(e,i,l=>l.cfId),o=j(t,i,l=>l.cfId);if(o===null||a===null||o===a)return;const d=i[a];d&&(A2(e,t,i,l=>l.cfId),this._ruleChange$.next({rule:d,subUnitId:n,unitId:s,type:"sort"}))}createCfId(s,n){return _2()}deleteUnitId(s){this._model.delete(s)}}const H={type:u.CommandType.MUTATION,id:"sheet.mutation.move-conditional-rule",handler(r,s){if(!s)return!1;const{unitId:n,subUnitId:e,start:t,end:i}=s;return r.get(M).moveRulePriority(n,e,t,i),!0}},M2=r=>{const{unitId:s,subUnitId:n}=r,e=y2(r.start,r.end);if(!e)return[];const[t,i]=e;return[{id:H.id,params:{unitId:s,subUnitId:n,start:t,end:i}}]},Q=(r,s)=>{const n=r.get(M),{unitId:e,subUnitId:t,cfId:i}=s,a=[...n.getSubunitRules(e,t)||[]],o=a.findIndex(l=>l.cfId===i),d=a[o-1];if(o>-1){const l=a[o],c=[{id:X.id,params:{unitId:e,subUnitId:t,rule:u.Tools.deepClone(l)}}];if(a.splice(o,1),o!==0){const h=a[0];if(h){const g=g2({id:h.cfId,type:"before"},{id:d.cfId,type:"after"},a,w=>w.cfId);if(!g)return c;const[D,f]=g,v={unitId:e,subUnitId:t,start:D,end:f};c.push({id:H.id,params:v})}}return c}return[]},$={type:u.CommandType.MUTATION,id:"sheet.mutation.delete-conditional-rule",handler(r,s){if(!s)return!1;const{unitId:n,subUnitId:e,cfId:t}=s;return r.get(M).deleteRule(n,e,t),!0}},C2=(r,s)=>({id:$.id,params:{unitId:s.unitId,subUnitId:s.subUnitId,cfId:s.rule.cfId}}),X={type:u.CommandType.MUTATION,id:"sheet.mutation.add-conditional-rule",handler(r,s){if(!s)return!1;const{unitId:n,subUnitId:e,rule:t}=s;return r.get(M).addRule(n,e,t),!0}},I2={type:u.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(r,s){if(!s)return!1;const{rule:n}=s,e=r.get(u.IUndoRedoService),t=r.get(u.ICommandService),i=r.get(M),a=r.get(u.IUniverInstanceService),o=p.getSheetCommandTarget(a,s);if(!o)return!1;const{unitId:d,subUnitId:l}=o,c=i.createCfId(d,l),h={unitId:d,subUnitId:l,rule:{...n,cfId:n.cfId||c}},g=C2(r,h),D=t.syncExecuteCommand(X.id,h);return D&&e.pushUndoRedo({unitID:d,redoMutations:[{id:X.id,params:h}],undoMutations:[g]}),D}},Y={type:u.CommandType.MUTATION,id:"sheet.mutation.set-conditional-rule",handler(r,s){if(!s)return!1;const{unitId:n,subUnitId:e,rule:t}=s,i=s.cfId||s.rule.cfId;return r.get(M).setRule(n,e,t,i),!0}},D2=(r,s)=>{const n=r.get(M),{unitId:e,subUnitId:t}=s,i=s.cfId||s.rule.cfId,a=n.getRule(e,t,i);return a?[{id:Y.id,params:{unitId:e,subUnitId:t,cfId:i,rule:u.Tools.deepClone(a)}}]:[]},R2={type:u.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(r,s){var v;if(!s)return!1;const n=r.get(M),e=r.get(u.IUniverInstanceService),t=r.get(u.ICommandService),i=r.get(u.IUndoRedoService),a=r.get(p.SheetsSelectionsService),o=p.getSheetCommandTarget(e,s);if(!o)return!1;const{unitId:d,subUnitId:l}=o,c=((v=a.getCurrentSelections())==null?void 0:v.map(w=>w.range))||[],h=n.getSubunitRules(d,l);if(!(h!=null&&h.length)||!c.length)return!1;const g=[],D=[];h.forEach(w=>{const A=new u.ObjectMatrix;w.ranges.forEach(_=>{u.Range.foreach(_,(x,k)=>{A.setValue(x,k,1)})}),c.forEach(_=>{u.Range.foreach(_,(x,k)=>{A.realDeleteValue(x,k)})});const S=p.findAllRectangle(p.createTopMatrixFromMatrix(A));if(S.length){const _={...w,ranges:S},x={unitId:d,subUnitId:l,rule:_},k=D2(r,x);g.push({id:Y.id,params:x}),D.push(...k)}else{const _={unitId:d,subUnitId:l,cfId:w.cfId},x=Q(r,_);g.push({id:$.id,params:_}),D.push(...x)}});const f=u.sequenceExecute(g,t).result;return f&&i.pushUndoRedo({unitID:d,redoMutations:g,undoMutations:D}),f}},S2={type:u.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(r,s){const n=r.get(M),e=r.get(u.IUniverInstanceService),t=r.get(u.ICommandService),i=r.get(u.IUndoRedoService),a=p.getSheetCommandTarget(e,s);if(!a)return!1;const{unitId:o,subUnitId:d}=a,l=n.getSubunitRules(o,d);if(!(l!=null&&l.length))return!1;const c=l.map(f=>({cfId:f.cfId,unitId:o,subUnitId:d})),h=c.map(f=>({id:$.id,params:f})),g=c.map(f=>Q(r,f)[0]),D=u.sequenceExecute(h,t).result;return D&&i.pushUndoRedo({unitID:o,redoMutations:h,undoMutations:g}),D}},x2={type:u.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(r,s){if(!s)return!1;const n=r.get(u.IUndoRedoService),e=r.get(u.ICommandService),t=r.get(u.IUniverInstanceService),i=p.getSheetCommandTarget(t,s);if(!i)return!1;const{unitId:a,subUnitId:o}=i,d={unitId:a,subUnitId:o,cfId:s.cfId},l=Q(r,d),c=e.syncExecuteCommand($.id,d);return c&&n.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:[{id:$.id,params:d}]}),c}},b2={type:u.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(r,s){if(!s)return!1;const n=r.get(u.IUndoRedoService),e=r.get(u.ICommandService),t=r.get(u.IUniverInstanceService),i=r.get(M),a=p.getSheetCommandTarget(t,s);if(!a)return!1;const{unitId:o,subUnitId:d}=a,l=g2(s.start,s.end,i.getSubunitRules(o,d)||[],v=>v.cfId);if(!l)return!1;const[c,h]=l,g={unitId:o,subUnitId:d,start:c,end:h},D=M2(g),f=e.syncExecuteCommand(H.id,g);return f&&n.pushUndoRedo({unitID:o,redoMutations:[{id:H.id,params:g}],undoMutations:D}),f}},L2={type:u.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(r,s){if(!s)return!1;const n=r.get(u.IUndoRedoService),e=r.get(u.ICommandService),t=r.get(u.IUniverInstanceService),i=p.getSheetCommandTarget(t,s);if(!i)return!1;const{unitId:a,subUnitId:o}=i,d={unitId:a,subUnitId:o,rule:s.rule,cfId:s.cfId},l=D2(r,d),c=e.syncExecuteCommand(Y.id,d);return c&&n.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:[{id:Y.id,params:d}]}),c}},e2={type:u.CommandType.MUTATION,id:"sheet.mutation.conditional-formatting-formula-mark-dirty",handler(){return!0}};var t0=Object.getOwnPropertyDescriptor,n0=(r,s,n,e)=>{for(var t=e>1?void 0:e?t0(s,n):s,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=a(t)||t);return t},f2=(r,s)=>(n,e)=>s(n,e,r),T=(r=>(r[r.NOT_REGISTER=1]="NOT_REGISTER",r[r.SUCCESS=2]="SUCCESS",r[r.WAIT=3]="WAIT",r[r.ERROR=4]="ERROR",r))(T||{});const i0=r=>{const s=r&&r[0]&&r[0][0];return(s==null?void 0:s.t)===u.CellValueType.BOOLEAN?s.v===u.BooleanNumber.TRUE||s.v===!0:s?s.v:!1};C.ConditionalFormattingFormulaService=class extends u.Disposable{constructor(n,e,t){super();F(this,"_formulaMap",new Map);F(this,"_result$",new z.Subject);F(this,"result$",this._result$.asObservable());this._commandService=n,this._activeDirtyManagerService=e,this._conditionalFormattingRuleModel=t,this._initFormulaCalculationResultChange(),this._initRuleChange()}_initRuleChange(){const n=e=>{switch(e.type){case I.colorScale:return e.config.some(t=>t.value.type===R.formula);case I.dataBar:return[e.config.max,e.config.min].some(t=>t.type===R.formula);case I.iconSet:return e.config.some(t=>t.value.type===R.formula)}};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{const{unitId:t,subUnitId:i,rule:a,oldRule:o}=e;e.type==="delete"&&this._removeFormulaByCfId(t,i,a.cfId),e.type==="set"&&(n(a.rule)||o&&n(o.rule))&&this._removeFormulaByCfId(t,i,a.cfId)}))}_initFormulaCalculationResultChange(){this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===O.SetFormulaCalculationResultMutation.id){const e=n.params;for(const t in e.unitOtherData)for(const i in e.unitOtherData[t])for(const a in e.unitOtherData[t][i]){const o=new u.ObjectMatrix(e.unitOtherData[t][i][a]),d=this._ensureSubunitFormulaMap(t,i).getValue(a,["formulaId"]);if(!d)continue;const l=d.ranges;if(!l)continue;const c=d.result,h=l[0].startRow,g=l[0].startColumn;o.forValue((v,w,A)=>{c.setValue(h+v,g+w,i0(A))}),d.status=2;const f=this._getAllFormulaResultByCfId(t,i,d.cfId).every(v=>v.status===2);this._result$.next({...d,isAllFinished:f})}}})),this._activeDirtyManagerService.register(e2.id,{commandId:e2.id,getDirtyData(n){return{dirtyUnitOtherFormulaMap:n.params}}})}_ensureSubunitFormulaMap(n,e){let t=this._formulaMap.get(n);t||(t=new Map,this._formulaMap.set(n,t));let i=t.get(e);return i||(i=new u.RefAlias([],["formulaId","id"]),t.set(e,i)),i}getSubUnitFormulaMap(n,e){var t;return(t=this._formulaMap.get(n))==null?void 0:t.get(e)}registerFormulaWithRange(n,e,t,i,a=[{startRow:0,endRow:0,startColumn:0,endColumn:0}]){const o=this._ensureSubunitFormulaMap(n,e),d=this.createCFormulaId(t,i);if(o.getValue(d,["id"]))return;const l=this._createFormulaId(n,e);o.addValue({formulaText:i,unitId:n,subUnitId:e,cfId:t,id:d,ranges:a,formulaId:l,status:3,result:new u.ObjectMatrix});const c={unitId:n,subUnitId:e,formulaMap:{[l]:{f:i,ranges:a}}};this._commandService.executeCommand(O.SetOtherFormulaMutation.id,c,{onlyLocal:!0}).then(()=>{this._commandService.executeCommand(e2.id,{[n]:{[e]:{[l]:!0}}},{onlyLocal:!0})})}_removeFormulaByCfId(n,e,t){const a=this.deleteCache(n,e,t).map(o=>o.formulaId);this._commandService.executeCommand(O.RemoveOtherFormulaMutation.id,{unitId:n,subUnitId:e,formulaIdList:a},{onlyLocal:!0})}getFormulaResultWithCoords(n,e,t,i,a=0,o=0){const d=this.getSubUnitFormulaMap(n,e);if(!d)return{status:1};const l=d.getValue(this.createCFormulaId(t,i),["id"]);return l?l.status===2&&l.result?{result:l.result.getValue(a,o),status:2}:l.status===3?{status:3}:{status:4}:{status:1}}getFormulaMatrix(n,e,t,i){const a=this.getSubUnitFormulaMap(n,e);if(!a)return{status:1};const o=a.getValue(this.createCFormulaId(t,i),["id"]);if(!o)return{status:1};if(o.status===2&&o.result)return{result:o.result,status:2}}deleteCache(n,e,t,i){const a=this.getSubUnitFormulaMap(n,e);if(!a)return[];if(i){const o=this.createCFormulaId(t,i);return a.deleteValue(o,["id"]),[]}else{const o=a.getValues().filter(d=>d.cfId===t);return o.forEach(d=>{a.deleteValue(d.formulaId,["formulaId"])}),o}}_getAllFormulaResultByCfId(n,e,t){const i=this.getSubUnitFormulaMap(n,e);return i?i.getValues().filter(o=>o.cfId===t):[]}_createFormulaId(n,e){return`sheet.cf_${n}_${e}_${u.generateRandomId(8)}`}createCFormulaId(n,e){return`${n}_${e}`}},C.ConditionalFormattingFormulaService=n0([f2(0,u.Inject(u.ICommandService)),f2(1,u.Inject(O.IActiveDirtyManagerService)),f2(2,u.Inject(M))],C.ConditionalFormattingFormulaService);var U=(r=>(r.preComputingStart="preComputingStart",r.preComputing="preComputing",r.preComputingEnd="preComputingEnd",r.preComputingError="preComputingError",r))(U||{});class s2{constructor(s){F(this,"_cache");F(this,"_preComputingStatus$",new z.BehaviorSubject("preComputingStart"));F(this,"preComputingStatus$",this._preComputingStatus$.asObservable().pipe(r2.distinctUntilChanged()));F(this,"_preComputingCache");F(this,"_rule");this._context=s,this._cache=new u.LRUMap(s.limit),this._rule=s.rule,this._preComputingCache=null,this._initClearCacheListener()}setCacheLength(s){this._cache.limit=s}clearCache(){this._cache.clear()}resetPreComputingCache(){this._preComputingStatus$.next("preComputingStart"),this._preComputingCache=null}updateRule(s){this._rule=s,this.resetPreComputingCache()}getCell(s,n){const e=this._createKey(s,n);if(this._preComputingStatus$.getValue()==="preComputing")return this._cache.get(e);let t=this.getPreComputingResult(s,n);if(t===null&&(this._preComputingStatus$.next("preComputingStart"),this.preComputing(s,n,this._getContext()),t=this.getPreComputingResult(s,n),t===null))return this._cache.get(e);if(this._preComputingStatus$.next("preComputingEnd"),this._cache.has(e))return this._cache.get(e);const i=this.getCellResult(s,n,t,this._getContext());return i!==null&&this._setCache(s,n,i),i}setPreComputingCache(s){this._preComputingCache=s}getPreComputingResult(s,n){return this._preComputingCache}_createKey(s,n){return`${s}_${n}`}_setCache(s,n,e){const t=this._createKey(s,n);this._cache.set(t,e)}_getContext(){return{...this._context,rule:this._rule}}_initClearCacheListener(){this.preComputingStatus$.subscribe(s=>{s==="preComputingEnd"&&this.clearCache()})}}class r0 extends s2{preComputing(s,n,e){const t=e.rule,i=e.worksheet,a=new u.ObjectMatrix;!t.rule.config.every(c=>c.value.type===R.num)&&u2(t.ranges,i.getMaxRows()-1,i.getMaxColumns()-1).forEach(h=>{u.Range.foreach(h,(g,D)=>{const f=e.getCellValue(g,D),v=f&&f.v;if(!B(v)&&(f==null?void 0:f.t)===u.CellValueType.NUMBER){const w=Number(v);!Number.isNaN(w)&&a.setValue(g,D,w)}})});const d=[...t.rule.config].sort((c,h)=>c.index-h.index).map(c=>({value:n2(c.value,a,{...e,cfId:t.cfId}),color:new u.ColorKit(c.color)}));if(!d.some(c=>G.isObject(c.value)?c.value.status!==T.SUCCESS:!1)){const c=d.map(h=>h.color).reduce((h,g,D)=>(h.result.push({color:g,value:h.sortValue[D]}),h),{result:[],sortValue:d.map(h=>h.value.result).sort((h,g)=>h-g)}).result;this.setPreComputingCache(c),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(s,n,e,t){if(!e)return null;const i=t.getCellValue(s,n);if(i.t===u.CellValueType.NUMBER){const a=Number(i.v);if(!Number.isNaN(a))return O2(e,a)}}}const T2="sheet-conditional-rule-data-bar",m2="#ffbe38",v2="#abd91a",B2="#000",s0=34,a0=r=>{const{startRow:s,endRow:n,startColumn:e,endColumn:t}=r;return`${s}-${n}-${e}-${t}`};class k2 extends G.SheetExtension{constructor(){super(...arguments);F(this,"_paddingRightAndLeft",2);F(this,"_paddingTopAndBottom",2);F(this,"uKey",T2);F(this,"Z_INDEX",s0);F(this,"_radius",1)}draw(n,e,t,i){const{worksheet:a}=t;if(!a)return!1;const o=new Set;n.save(),u.Range.foreach(t.rowColumnSegment,(d,l)=>{if(!a.getRowVisible(d)||!a.getColVisible(l))return;const c=t.getCellWithCoordByIndex(d,l,!1),{isMerged:h,isMergedMainCell:g,mergeInfo:D}=c;let f=a.getCell(d,l);if(h&&(f=a.getCell(D.startRow,D.startColumn)),!(f!=null&&f.dataBar)||!this.isRenderDiffRangesByCell(D,i))return;if(h||g){const V=a0(D);if(o.has(V))return;o.add(V)}const{color:v,value:w,startPoint:A,isGradient:S}=f.dataBar,{startX:_,endX:x,startY:k,endY:E2}=h||g?D:c,d2=x-_,p2=E2+G.FIX_ONE_PIXEL_BLUR_OFFSET-k,P=d2-this._paddingRightAndLeft*2,X2=p2-this._paddingTopAndBottom*2;if(w>0){const V=Math.max(P*(1-A/100)*w/100,1),W=_+this._paddingRightAndLeft+A/100*P,q=k+this._paddingTopAndBottom;if(S){const Z=n.createLinearGradient(W,q,W+V,q);Z.addColorStop(0,v),Z.addColorStop(1,"rgb(255 255 255)"),n.fillStyle=Z,n.strokeStyle=v,n.lineWidth=1}else n.fillStyle=v;this._drawRectWithRoundedCorner(n,W,q,V,X2,!1,!0,!0,!1),S&&n.stroke()}else{const V=Math.max(P*A/100*Math.abs(w)/100,1),W=_+this._paddingRightAndLeft+A/100*P-V,q=k+this._paddingTopAndBottom;if(S){const Z=n.createLinearGradient(W,q,W+V,q);Z.addColorStop(0,"rgb(255 255 255)"),Z.addColorStop(1,v),n.fillStyle=Z,n.strokeStyle=v,n.lineWidth=1}else n.fillStyle=v;this._drawRectWithRoundedCorner(n,W,q,V,X2,!0,!1,!1,!0),S&&n.stroke()}}),n.restore()}_drawRectWithRoundedCorner(n,e,t,i,a,o,d,l,c){const h=this._radius;!a||!i||(n.beginPath(),n.moveTo(e+h,t),n.lineTo(e+i-h,t),d?n.arcTo(e+i,t,e+i,t+h,h):n.lineTo(e+i,t),n.lineTo(e+i,t+a-h),l?n.arcTo(e+i,t+a,e+i-h,t+a,h):n.lineTo(e+i,t+a),n.lineTo(e+h,t+a),c?n.arcTo(e,t+a,e,t+a-h,h):n.lineTo(e,t+a),n.lineTo(e,t+h),o?n.arcTo(e,t,e+h,t,h):n.lineTo(e,t),n.closePath(),n.fill())}}G.SpreadsheetExtensionRegistry.add(k2);const a2=r=>Math.max(Math.min(100,r),0),l0=(r,s,n)=>{const e=n(r,s);if(e&&e.t===u.CellValueType.NUMBER){const t=Number(e.v);return Number.isNaN(t)?null:t}return null};class o0 extends s2{preComputing(s,n,e){const t=e.rule,i=t.rule,a=e.worksheet,o=new u.ObjectMatrix;![t.rule.config.max,t.rule.config.min].every(D=>D.type===R.num)&&u2(t.ranges,a.getMaxRows()-1,a.getMaxColumns()-1).forEach(f=>{u.Range.foreach(f,(v,w)=>{const A=e.getCellValue(v,w),S=A&&A.v;if(!B(S)&&(A==null?void 0:A.t)===u.CellValueType.NUMBER){const _=Number(S);!Number.isNaN(_)&&o.setValue(v,w,_)}})});const l=n2(i.config.min,o,{...e,cfId:t.cfId}),c=n2(i.config.max,o,{...e,cfId:t.cfId});let h=0,g=0;if(l.status===T.SUCCESS){const D=Number(l.result);h=Number.isNaN(D)?0:D}else{this._preComputingStatus$.next(U.preComputing);return}if(c.status===T.SUCCESS){const D=Number(c.result),f=Number.isNaN(D)?0:D;g=Math.max(f,h),h=Math.min(f,h);let v=50;if(h<0&&g<=0)v=100;else if(h<0&&g>0){const w=Math.abs(g)+Math.abs(h);v=Math.abs(h)/w*100}else h>=0&&g>0&&(v=0);this.setPreComputingCache({min:h,max:g,startPoint:v}),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(s,n,e,t){const{min:i,max:a,startPoint:o}=e,l=t.rule.rule,c=l.isShowValue,h=l.config.isGradient,g=l0(s,n,t.getCellValue);if(!(g===null||g<i||i===a||a<i)){if(g===0)return{color:B2,startPoint:o,value:0,isGradient:h,isShowValue:c};if(i<0&&a<=0){const D=a-i,f=a2((a-g)/D*100);return f===0?void 0:{color:l.config.nativeColor||v2,startPoint:o,value:-f,isGradient:h,isShowValue:c}}else if(i<0&&a>0)if(g>0){const D=a2(Math.min(g/a,1)*100);return D===0?void 0:{color:l.config.positiveColor||m2,startPoint:o,value:D,isGradient:h,isShowValue:c}}else{const D=a2(Math.min(Math.abs(g)/Math.abs(i),1)*100);return D===0?void 0:{color:l.config.nativeColor||v2,startPoint:o,value:-D,isGradient:h,isShowValue:c}}else if(i>=0&&a>0){const D=a-i,f=0,v=a2((1-(a-g)/D)*100);return v===0?void 0:{color:l.config.positiveColor||m2,startPoint:f,value:v,isGradient:h,isShowValue:c}}}}}class u0 extends s2{preComputing(s,n,e){const t=e.rule.rule,i=e.rule.ranges,o=(()=>{switch(t.subType){case y.average:{let d=0,l=0;return i.forEach(c=>{u.Range.foreach(c,(h,g)=>{const D=e.getCellValue(h,g),f=N(D||void 0);D&&D.t===u.CellValueType.NUMBER&&f!==void 0&&(d+=Number(f)||0,l++)})}),{value:d/l,type:t.subType}}case y.uniqueValues:case y.duplicateValues:{const d=new Map;return i.forEach(l=>{u.Range.foreach(l,(c,h)=>{const g=e.getCellValue(c,h),D=N(g||void 0);if(D!==void 0){const f=d.get(D);f?d.set(D,f+1):d.set(D,1)}})}),{value:d,type:t.subType}}case y.rank:{let d=[];i.forEach(h=>{u.Range.foreach(h,(g,D)=>{const f=e.getCellValue(g,D),v=N(f||void 0);f&&f.t===u.CellValueType.NUMBER&&v!==void 0&&d.push(Number(v)||0)})}),d.sort((h,g)=>g-h);const l=e.rule.rule;if(l.isPercent){l.isBottom&&(d=d.toReversed());const h=u.Tools.clamp(l.value,0,100)/100,g=Math.floor(h*d.length),D=u.Tools.clamp(g-1,0,d.length-1);return{value:d[D],type:t.subType}}const c=Math.floor(u.Tools.clamp(l.isBottom?l.value-1:l.value,0,d.length));return l.isBottom?{value:d[d.length-c-1],type:t.subType}:{value:d[Math.max(c-1,0)],type:t.subType}}case y.formula:{const d=t,l=e.accessor.get(C.ConditionalFormattingFormulaService);l.registerFormulaWithRange(e.unitId,e.subUnitId,e.rule.cfId,d.value,e.rule.ranges);const c=l.getFormulaMatrix(e.unitId,e.subUnitId,e.rule.cfId,d.value);return c&&c.status===T.SUCCESS?(this._preComputingStatus$.next(U.preComputingEnd),{value:c.result,type:t.subType}):(this._preComputingStatus$.next(U.preComputing),null)}case y.timePeriod:switch(t.operator){case L.last7Days:return{value:{start:u.dayjs().subtract(7,"day").valueOf(),end:u.dayjs().valueOf()},type:t.subType};case L.lastMonth:return{value:{start:u.dayjs().startOf("month").subtract(1,"month").valueOf(),end:u.dayjs().endOf("month").subtract(1,"month").valueOf()},type:t.subType};case L.lastWeek:return{value:{start:u.dayjs().startOf("week").subtract(1,"week").valueOf(),end:u.dayjs().endOf("week").subtract(1,"week").valueOf()},type:t.subType};case L.nextMonth:return{value:{start:u.dayjs().startOf("month").add(1,"month").valueOf(),end:u.dayjs().endOf("month").add(1,"month").valueOf()},type:t.subType};case L.nextWeek:return{value:{start:u.dayjs().startOf("week").add(1,"week").valueOf(),end:u.dayjs().endOf("week").add(1,"week").valueOf()},type:t.subType};case L.thisMonth:return{value:{start:u.dayjs().startOf("month").valueOf(),end:u.dayjs().endOf("month").valueOf()},type:t.subType};case L.thisWeek:return{value:{start:u.dayjs().startOf("week").valueOf(),end:u.dayjs().endOf("week").valueOf()},type:t.subType};case L.today:return{value:{start:u.dayjs().startOf("day").valueOf(),end:u.dayjs().endOf("day").valueOf()},type:t.subType};case L.tomorrow:return{value:{start:u.dayjs().startOf("day").add(1,"day").valueOf(),end:u.dayjs().endOf("day").add(1,"day").valueOf()},type:t.subType};case L.yesterday:return{value:{start:u.dayjs().startOf("day").subtract(1,"day").valueOf(),end:u.dayjs().endOf("day").subtract(1,"day").valueOf()},type:t.subType}}}})();this.setPreComputingCache(o)}getCellResult(s,n,e,t){const i=t.getCellValue(s,n),a=t.rule.rule;return(()=>{switch(a.subType){case y.number:{const l=i&&Number(i.v),c=(i==null?void 0:i.t)===u.CellValueType.NUMBER,h=a;return c?B(l)||Number.isNaN(l)?void 0:K({operator:h.operator,value:h.value||0},l||0):!![E.notEqual,E.notBetween].includes(h.operator)}case y.text:{const l=a,c=N(i),h=c===null?"":String(c),g=l.value||"";switch(l.operator){case b.beginsWith:return h.startsWith(g);case b.containsBlanks:return/^\s*$/.test(h);case b.notContainsBlanks:return!/^\s*$/.test(h);case b.containsErrors:return O.ERROR_TYPE_SET.has(h);case b.notContainsErrors:return!O.ERROR_TYPE_SET.has(h);case b.containsText:return h.indexOf(g)>-1;case b.notContainsText:return h.indexOf(g)===-1;case b.endsWith:return h.endsWith(g);case b.equal:return h===g;case b.notEqual:return h!==g;default:return!1}}case y.timePeriod:{const l=N(i);if(B(l)||Number.isNaN(Number(l))||(i==null?void 0:i.t)!==u.CellValueType.NUMBER||!e)return;const c=N2(Number(l)),{start:h,end:g}=e.value;return c>=h&&c<=g}case y.average:{const l=i&&i.v,c=Number(l),h=(i==null?void 0:i.t)===u.CellValueType.NUMBER,g=a;if(!h)return E.notEqual===g.operator;if(B(l)||Number.isNaN(c)||!e)return!1;const D=e.value;switch(g.operator){case E.greaterThan:return c>D;case E.greaterThanOrEqual:return c>=D;case E.lessThan:return c<D;case E.lessThanOrEqual:return c<=D;case E.equal:return t2(c,D);case E.notEqual:return!t2(c,D);default:return!1}}case y.rank:{const l=N(i),c=Number(l);if(B(l)||Number.isNaN(c)||(i==null?void 0:i.t)!==u.CellValueType.NUMBER||!e)return!1;const h=e.value;return a.isBottom?c<=h:c>=h}case y.uniqueValues:{const l=N(i);return B(l)||!e?!1:e.value.get(l)===1}case y.duplicateValues:{const l=N(i);return B(l)||!e?!1:e.value.get(l)!==1}case y.formula:{const l=e==null?void 0:e.value;return l?l.getValue(s,n)===!0:!1}}})()?a.style:{}}}const c0=(r,s,n)=>{const e=n(r,s);if(e&&e.t===u.CellValueType.NUMBER){const t=Number(e.v);return Number.isNaN(t)?null:t}return null};class d0 extends s2{preComputing(s,n,e){const t=e.rule.rule,i=e.worksheet,a=new u.ObjectMatrix;!t.config.every(c=>c.value.type===R.num)&&u2(e.rule.ranges,i.getMaxRows()-1,i.getMaxColumns()-1).forEach(h=>{u.Range.foreach(h,(g,D)=>{const f=e.getCellValue(g,D),v=f&&f.v;if(!B(v)&&(f==null?void 0:f.t)===u.CellValueType.NUMBER){const w=Number(v);!Number.isNaN(w)&&a.setValue(g,D,w)}})});const d=t.config.map(c=>n2(c.value,a,{...e,cfId:e.rule.cfId}));if(!d.some(c=>c.status!==T.SUCCESS)){const c=d.map((h,g)=>({operator:t.config[g].operator,value:Number(h.result)||0})).reduce((h,g,D,f)=>{const v=t.config[D];if(!D||D===f.length-1)h.push({...g,iconId:v.iconId,iconType:v.iconType});else{const w=f[D-1];K(w,g.value)||h.push({...g,iconId:v.iconId,iconType:v.iconType})}return h},[]);this.setPreComputingCache(c),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(s,n,e,t){if(!e)return null;const i=c0(s,n,t.getCellValue);if(i===null)return;const a=t.rule.rule,o=a.isShowValue===void 0?!0:!!a.isShowValue;for(let d=0;d<e.length;d++){const l=e[d],c={...l},h={...l},{iconId:g,iconType:D}=l;if(d===0){if(K(l,i))return{iconId:g,iconType:D,isShowValue:o}}else{if(d===e.length-1)return{iconId:g,iconType:D,isShowValue:o};{const f=e[d-1];if(h.operator=V2(f.operator),h.value=f.value,K(c,i)&&K(h,i))return{iconId:g,iconType:D,isShowValue:o}}}}}}var h0=Object.getOwnPropertyDescriptor,g0=(r,s,n,e)=>{for(var t=e>1?void 0:e?h0(s,n):s,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=a(t)||t);return t},l2=(r,s)=>(n,e)=>s(n,e,r);const o2=1e3*3*3;C.ConditionalFormattingViewModel=class extends u.Disposable{constructor(n,e,t,i){super();F(this,"_calculateUnitManagers",new Map);F(this,"_rTreeManager",new u.RTree);F(this,"_cellCache",new u.LRUMap(o2));F(this,"_markDirty$",new z.Subject);F(this,"markDirty$",this._markDirty$.asObservable());F(this,"_markRuleDirtyAtOnce",(n,e,t,i=!0)=>{if(this._cellCache.clear(),i){const o=this._ensureCalculateUnitManager(n,e).get(t);o&&o.resetPreComputingCache()}this._markDirty$.next({unitId:n,subUnitId:e,cfId:t})});F(this,"markRuleDirty",(()=>{const n=new z.Subject;return this.disposeWithMe(n.pipe(r2.bufferTime(100),r2.filter(e=>!!e.length),r2.map(e=>{const t=new Set,i=[];return e.forEach(a=>{const o=`${a.unitId}_${a.subUnitId}_${a.cfId}`;if(t.has(o)){if(a.isNeedResetPreComputingCache){const d=i.find(l=>l.cfId===a.cfId);d.isNeedResetPreComputingCache=!0}return}t.add(o),i.push({...a})}),i})).subscribe(e=>{e.forEach(t=>{this._markRuleDirtyAtOnce(t.unitId,t.subUnitId,t.cfId,t.isNeedResetPreComputingCache)})})),(e,t,i,a=!0)=>{n.next({unitId:e,subUnitId:t,cfId:i,isNeedResetPreComputingCache:a})}})());this._injector=n,this._conditionalFormattingRuleModel=e,this._conditionalFormattingFormulaService=t,this._univerInstanceService=i,this._initRuleListener(),this._handleCustomFormulasSeparately(),this._initCFFormulaListener()}_initCFFormulaListener(){this.disposeWithMe(this._conditionalFormattingFormulaService.result$.subscribe(({unitId:n,subUnitId:e,cfId:t,isAllFinished:i})=>{i&&this._markRuleDirtyAtOnce(n,e,t,i)}))}getCellCfs(n,e,t,i){const a=this._createCacheKey(n,e,t,i);if(this._cellCache.has(a))return this._cellCache.get(a);const o=this._getCellCfs(n,e,t,i);return o.length&&this._cellCache.set(a,o),o}_getCellCfs(n,e,t,i){var h;const a=(h=this._conditionalFormattingRuleModel.getSubunitRules(n,e))!=null?h:[],o=this._ensureCalculateUnitManager(n,e),d=this._rTreeManager.bulkSearch([{unitId:n,sheetId:e,range:{startColumn:i,endColumn:i,startRow:t,endRow:t}}]),l=a.filter(g=>d.has(g.cfId));return l.length?l.map(g=>{const D=o.get(g.cfId);return D?{cfId:g.cfId,result:D.getCell(t,i)}:null}).filter(g=>!!g).map((g,D)=>({...g,priority:D})):[]}dispose(){this._calculateUnitManagers.clear(),this._cellCache.clear(),this._rTreeManager.clear(),super.dispose()}_handleCustomFormulasSeparately(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{if(n.type==="set"){const{unitId:e,subUnitId:t}=n,i=n.oldRule;i.rule.type===I.highlightCell&&i.rule.subType===y.formula&&this._conditionalFormattingFormulaService.deleteCache(e,t,i.cfId)}}))}_initRuleListener(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:e,subUnitId:t,rule:i}=n,{cfId:a,ranges:o}=i,d=this._ensureCalculateUnitManager(e,t);switch(this.markRuleDirty(e,t,a),n.type){case"add":{this._rTreeManager.bulkInsert(o.map(c=>({unitId:e,sheetId:t,id:a,range:c})));const l=this._createRuleCalculateUnitInstance(e,t,i);if(!l)return;d.set(i.cfId,l);break}case"delete":{this._rTreeManager.bulkRemove(o.map(l=>({unitId:e,sheetId:t,id:a,range:l}))),d.delete(i.cfId);break}case"set":{const l=n.oldRule;if(this._rTreeManager.bulkRemove(l.ranges.map(c=>({unitId:e,sheetId:t,id:l.cfId,range:c}))),this._rTreeManager.bulkInsert(o.map(c=>({unitId:e,sheetId:t,id:a,range:c}))),l.rule.type!==i.rule.type){const c=this._createRuleCalculateUnitInstance(e,t,i);if(!c)return;d.delete(l.cfId),d.set(i.cfId,c)}else{const c=d.get(l.cfId);if(!c)return;c.updateRule(i)}}}}))}_ensureCalculateUnitManager(n,e){let t=this._calculateUnitManagers.get(n);t||(t=new Map,this._calculateUnitManagers.set(n,t));let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_createRuleCalculateUnitInstance(n,e,t){const i=this._univerInstanceService.getUnit(n),a=i==null?void 0:i.getSheetBySheetId(e);if(!i||!a)return;const o={workbook:i,worksheet:a,unitId:n,subUnitId:e,accessor:this._injector,rule:t,limit:o2,getCellValue:(d,l)=>a.getCellRaw(d,l)||{}};switch(t.rule.type){case I.colorScale:return new r0(o);case I.dataBar:return new o0(o);case I.highlightCell:return new u0(o);case I.iconSet:return new d0(o)}}_createCacheKey(n,e,t,i){return`${n}_${e}_${t}_${i}`}setCacheLength(n=o2){this._cellCache.limit!==n&&(this._cellCache.limit=n,this._calculateUnitManagers.forEach(e=>{e.forEach(t=>{t.forEach(i=>{i.setCacheLength(n)})})}))}},C.ConditionalFormattingViewModel=g0([l2(0,u.Inject(u.Injector)),l2(1,u.Inject(M)),l2(2,u.Inject(C.ConditionalFormattingFormulaService)),l2(3,u.IUniverInstanceService)],C.ConditionalFormattingViewModel);function t2(r,s){return Math.abs(r-s)<Number.EPSILON}const B=r=>[void 0,null].includes(r),N=r=>{var e,t;if(!r)return null;if(r.t===u.CellValueType.BOOLEAN)return r.v===u.BooleanNumber.TRUE?O.BooleanValue.TRUE:O.BooleanValue.FALSE;const s=r.v,n=(t=(e=r.p)==null?void 0:e.body)==null?void 0:t.dataStream.replace(/\r\n$/,"");return B(s)?B(n)?null:n:s},F2=86400;function U2(r,s=!0){if(s&&r>=0){if(r===0)return[1900,1,0];if(r===60)return[1900,2,29];if(r<60)return[1900,r<32?1:2,(r-1)%31+1]}let n=r+68569+2415019;const e=Math.floor(4*n/146097);n=n-Math.floor((146097*e+3)/4);const t=Math.floor(4e3*(n+1)/1461001);n=n-Math.floor(1461*t/4)+31;const i=Math.floor(80*n/2447),a=n-Math.floor(2447*i/80);n=Math.floor(i/11);const o=i+2-12*n;return[100*(e-49)+t+n|0,o|0,a|0]}const N2=r=>{let s=r|0;const n=F2*(r-s);let e=Math.floor(n);n-e>.9999&&(e+=1,e===F2&&(e=0,s+=1));const t=e<0?F2+e:e,[i,a,o]=U2(r,!0),d=Math.floor(t/60/60)%60,l=Math.floor(t/60)%60,c=Math.floor(t)%60;return u.dayjs(`${i}/${a}/${o} ${d}:${l}:${c}`).valueOf()},n2=(r,s,n)=>{switch(r.type){case R.max:{let e=0;return s.forValue((t,i,a)=>{a>e&&(e=a)}),{status:T.SUCCESS,result:e}}case R.min:{let e;return s.forValue((t,i,a)=>{e===void 0&&(e=a),a<e&&(e=a)}),{status:T.SUCCESS,result:e}}case R.percent:{let e,t;s.forValue((o,d,l)=>{(e===void 0||t===void 0)&&(e=l,t=l),l>e&&(e=l),l<t&&(t=l)});const i=(e||0)-(t||0),a=Math.max(Math.min(Number(r.value)||0,100),0);return{status:T.SUCCESS,result:i*(a/100)+(t||0)}}case R.percentile:{const e=s.toNativeArray().sort((l,c)=>l-c),t=Math.max(Math.min(Number(r.value)||0,100),0),i=(e.length-1)*t/100,a=Math.floor(i),o=i-a,d=e[a]+(e[Math.min(a+1,e.length-1)]-e[a])*o;return{status:T.SUCCESS,result:d}}case R.formula:{const{accessor:e,unitId:t,subUnitId:i,cfId:a}=n,o=String(r.value),d=e.get(C.ConditionalFormattingFormulaService);return d.registerFormulaWithRange(t,i,a,o),d.getFormulaResultWithCoords(t,i,a,o)}case R.num:default:{const e=Number(r.value);return{status:T.SUCCESS,result:Number.isNaN(e)?0:e}}}},C0=(r,s,n,e)=>{const{accessor:t}=e,i=t.get(C.ConditionalFormattingViewModel),a=new u.ObjectMatrix;return n.ranges.forEach(o=>{u.Range.foreach(o,(d,l)=>{const c=i.getCellCfs(r,s,d,l);if(c){const h=c.find(g=>g.cfId===n.cfId);h!=null&&h.result&&a.setValue(d,l,h.result)}})}),a},K=(r,s)=>{switch(r.operator){case E.between:{if(typeof r.value!="object"||!r.value.length)return;const n=Math.min(...r.value),e=Math.max(...r.value);return s>=n&&s<=e}case E.notBetween:{if(typeof r.value!="object"||!r.value.length)return;const n=Math.min(...r.value),e=Math.max(...r.value);return!(s>=n&&s<=e)}case E.equal:{const n=r.value||0;return t2(n,s)}case E.notEqual:{const n=r.value||0;return!t2(n,s)}case E.greaterThan:{const n=r.value||0;return s>n}case E.greaterThanOrEqual:{const n=r.value||0;return s>=n}case E.lessThan:{const n=r.value||0;return s<n}case E.lessThanOrEqual:{const n=r.value||0;return s<=n}default:return!1}},V2=r=>{switch(r){case E.greaterThan:return E.lessThanOrEqual;case E.greaterThanOrEqual:return E.lessThan;case E.lessThan:return E.greaterThanOrEqual;case E.lessThanOrEqual:return E.greaterThan}return r},O2=(r,s)=>{const n=i=>i.a!==void 0?i:{...i,a:1},e=r.findIndex(i=>i.value>=s),t=e-1;if(e===0)return r[0].color.toRgbString();if(t>=0){const i=r[t],a=r[e];if(i.color.isValid&&a.color.isValid){const o=n(i.color.toRgb()),d=n(a.color.toRgb()),l=a.value-i.value,c=(s-i.value)/l,h=["r","g","b","a"].reduce((D,f)=>{const v=o[f];return D[f]=(d[f]-v)*c+v,D},{});return new u.ColorKit(h).toRgbString()}}else return r[r.length-1].color.toRgbString()},u2=(r,s,n)=>r.map(e=>{if(e.startColumn>n||e.startRow>s)return null;const t={...e};return t.endRow=Math.min(t.endRow,s),t.endColumn=Math.min(t.endColumn,n),t}).filter(e=>!!e);function D0(r){let s=0;return new u.ObjectMatrix(r).forValue((n,e,t)=>{s=Math.max(Number.isNaN(s)?0:s,Number(t))}),s}const m={feedback:{mistake:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.87359%206.87332C6.6146%207.13231%206.6146%207.55221%206.87359%207.8112L9.062%209.99961L6.87356%2012.188C6.61457%2012.447%206.61457%2012.8669%206.87356%2013.1259C7.13255%2013.3849%207.55245%2013.3849%207.81144%2013.1259L9.99987%2010.9375L12.1882%2013.1258C12.4472%2013.3848%2012.8671%2013.3848%2013.1261%2013.1258C13.3851%2012.8669%2013.3851%2012.447%2013.1261%2012.188L10.9378%209.99961L13.1261%207.81127C13.3851%207.55228%2013.3851%207.13238%2013.1261%206.87339C12.8671%206.61441%2012.4472%206.61441%2012.1882%206.87339L9.99987%209.06173L7.81147%206.87332C7.55248%206.61433%207.13257%206.61433%206.87359%206.87332Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",warn:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M9.16817%206.67735C9.16646%206.61745%209.1656%206.5875%209.16653%206.56236C9.18103%206.16817%209.49136%205.84883%209.88497%205.82306C9.91008%205.82141%209.94004%205.82141%209.99996%205.82141V5.82141C10.0599%205.82141%2010.0899%205.82141%2010.115%205.82306C10.5086%205.84883%2010.8189%206.16817%2010.8334%206.56236C10.8343%206.5875%2010.8335%206.61745%2010.8318%206.67735L10.7043%2011.131C10.6934%2011.5121%2010.3812%2011.8154%209.99995%2011.8154V11.8154C9.61866%2011.8154%209.30655%2011.5121%209.29564%2011.131L9.16817%206.67735Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Crect%20x%3D%229.31488%22%20y%3D%2212.8086%22%20width%3D%221.37006%22%20height%3D%221.37006%22%20rx%3D%220.685032%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",correct:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M17.037%2010C17.037%2013.8865%2013.8864%2017.0371%209.99999%2017.0371C6.11354%2017.0371%202.96295%2013.8865%202.96295%2010C2.96295%206.1136%206.11354%202.96301%209.99999%202.96301C13.8864%202.96301%2017.037%206.1136%2017.037%2010Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M13.9239%207.17477C13.6638%206.91472%2013.2422%206.91472%2012.9821%207.17477L8.74433%2011.4126L7.01786%209.6861C6.75781%209.42606%206.33619%209.42606%206.07614%209.6861C5.81609%209.94615%205.81609%2010.3678%206.07614%2010.6278L8.27349%2012.8252C8.53354%2013.0852%208.95516%2013.0852%209.21521%2012.8252L9.2195%2012.8209L13.9239%208.1165C14.1839%207.85645%2014.1839%207.43482%2013.9239%207.17477Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A"},star:{starEmpty:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",starIncomplete:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cmask%20id%3D%22mask1_613_177%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2210%22%20height%3D%2220%22%3E%0A%3Crect%20width%3D%2210%22%20height%3D%2220%22%20fill%3D%22%23C4C4C4%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23mask1_613_177)%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",starFull:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A"},progress:{progress0:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress25:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M16.2963%209.99991C16.2963%209.17307%2016.1335%208.35432%2015.8171%207.59042C15.5006%206.82652%2015.0369%206.13242%2014.4522%205.54776C13.8675%204.96309%2013.1734%204.49931%2012.4095%204.18289C11.6456%203.86647%2010.8269%203.70361%2010%203.70361L10%209.99991H16.2963Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress50:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M10%2016.2962C11.6699%2016.2962%2013.2714%2015.6328%2014.4522%2014.4521C15.633%2013.2713%2016.2963%2011.6698%2016.2963%209.99991C16.2963%208.33003%2015.633%206.72854%2014.4522%205.54776C13.2714%204.36697%2011.6699%203.70361%2010%203.70361L10%209.99991L10%2016.2962Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress75:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M3.70374%209.99991C3.70374%2011.2452%204.07301%2012.4625%204.76485%2013.4979C5.4567%2014.5334%206.44005%2015.3404%207.59054%2015.8169C8.74104%2016.2935%2010.007%2016.4182%2011.2284%2016.1752C12.4497%2015.9323%2013.5716%2015.3326%2014.4522%2014.4521C15.3327%2013.5715%2015.9324%2012.4496%2016.1753%2011.2283C16.4183%2010.0069%2016.2936%208.74092%2015.8171%207.59042C15.3405%206.43992%2014.5335%205.45658%2013.4981%204.76473C12.4626%204.07288%2011.2453%203.70361%2010%203.70361L10%209.99991L3.70374%209.99991Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress100:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99991%22%20r%3D%226.2963%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A"},signal:{signal0:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal25:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal50:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal75:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal100:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93933%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70447%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A"},feeling:{guffaw:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M16.887%2010C16.887%2013.8037%2013.8036%2016.8871%209.99999%2016.8871C6.19638%2016.8871%203.11295%2013.8037%203.11295%2010C3.11295%206.19644%206.19638%203.11301%209.99999%203.11301C13.8036%203.11301%2016.887%206.19644%2016.887%2010Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M12.5355%2013.5821C13.0482%2013.1841%2013.3951%2012.6107%2013.5405%2012.0327C13.5934%2011.8226%2013.5051%2011.6349%2013.3518%2011.5331C13.2036%2011.4346%2013.0031%2011.4203%2012.8265%2011.5131C11.0615%2012.4407%208.94609%2012.4427%207.1828%2011.513C7.00629%2011.4199%206.80602%2011.4343%206.65798%2011.5329C6.50518%2011.6346%206.41701%2011.8217%206.46844%2012.0312C6.61029%2012.609%206.95079%2013.1833%207.46449%2013.5821C8.14361%2014.1093%209.05608%2014.3999%2010%2014.3999C10.9439%2014.3999%2011.8564%2014.1093%2012.5355%2013.5821Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A",smile:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2011.8518C7.03705%2011.8518%207.77779%2013.7037%2010%2013.7037C12.2222%2013.7037%2012.963%2011.8518%2012.963%2011.8518%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",noninductive:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2012.5927C7.03705%2012.5927%208.14816%2012.5927%2010.3704%2012.5927C12.5926%2012.5927%2012.963%2012.5927%2012.963%2012.5927%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",dissatisfied:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2013.7037C7.03705%2013.7037%207.77779%2011.8519%2010%2011.8519C12.2222%2011.8519%2012.963%2013.7037%2012.963%2013.7037%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",impatient:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.47573%2011.731C6.96306%2012.129%206.61613%2012.7024%206.47071%2013.2804C6.41784%2013.4905%206.50617%2013.6782%206.65942%2013.78C6.80761%2013.8785%207.00813%2013.8928%207.18477%2013.8C8.9498%2012.8724%2011.0652%2012.8704%2012.8285%2013.8002C13.005%2013.8932%2013.2052%2013.8788%2013.3533%2013.7802C13.5061%2013.6785%2013.5942%2013.4914%2013.5428%2013.2819C13.401%2012.7041%2013.0605%2012.1298%2012.5468%2011.731C11.8676%2011.2038%2010.9552%2010.9132%2010.0112%2010.9132C9.06732%2010.9132%208.15485%2011.2038%207.47573%2011.731Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A"},arrow:JSON.parse('{"down-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","right-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","up-green":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndDown-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndUp-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","down-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","right-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","up-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndDown-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndUp-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A"}'),shape:{cross:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.70374%22%20y%3D%228.14795%22%20width%3D%2212.5926%22%20height%3D%223.7037%22%20rx%3D%220.740741%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",up:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M9.44533%205.81157C9.74012%205.47858%2010.2598%205.47858%2010.5546%205.81157L16.2868%2012.2867C16.71%2012.7647%2016.3706%2013.5184%2015.7322%2013.5184H4.26776C3.62933%2013.5184%203.28995%2012.7647%203.71313%2012.2867L9.44533%205.81157Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",down:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.5547%2014.1884C10.2599%2014.5214%209.74019%2014.5214%209.4454%2014.1884L3.71321%207.71335C3.29002%207.23532%203.6294%206.48161%204.26784%206.48161L15.7322%206.48161C16.3707%206.48161%2016.7101%207.23532%2016.2869%207.71335L10.5547%2014.1884Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","rhomboid-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M2.1415%2011.1984C1.8412%2010.9074%201.8412%2010.4256%202.1415%2010.1346L9.48467%203.01785C9.77196%202.73942%2010.2284%202.73942%2010.5157%203.01786L17.8586%2010.1346C18.1589%2010.4256%2018.1589%2010.9074%2017.8586%2011.1984L10.5157%2018.3151C10.2284%2018.5936%209.77196%2018.5936%209.48467%2018.3152L2.1415%2011.1984Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-greed":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-pink":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FB9D9D%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-black":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22black%22%2F%3E%0A%3C%2Fsvg%3E%0A","triangle-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_237)%22%3E%0A%3Cpath%20d%3D%22M9.32308%204.41301C9.58368%203.82623%2010.4164%203.82623%2010.677%204.413L15.9526%2016.2917C16.1701%2016.7815%2015.8115%2017.3331%2015.2756%2017.3331H4.72454C4.18858%2017.3331%203.83002%2016.7815%204.04756%2016.2917L9.32308%204.41301Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_237%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A","indicate-greed":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","indicate-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","indicate-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"},feedback2:{mistake2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.12194%206.33702C4.1805%206.47839%204.30722%206.6051%204.56066%206.85854L8.36822%2010.6661L4.56062%2014.4737C4.30718%2014.7272%204.18046%2014.8539%204.12191%2014.9952C4.04384%2015.1837%204.04384%2015.3955%204.12191%2015.584C4.18046%2015.7253%204.30718%2015.8521%204.56062%2016.1055C4.81406%2016.3589%204.94078%2016.4857%205.08214%2016.5442C5.27062%2016.6223%205.4824%2016.6223%205.67089%2016.5442C5.81225%2016.4857%205.93897%2016.3589%206.19241%2016.1055L10%2012.2979L13.8074%2016.1053C14.0609%2016.3588%2014.1876%2016.4855%2014.329%2016.544C14.5174%2016.6221%2014.7292%2016.6221%2014.9177%2016.544C15.0591%2016.4855%2015.1858%2016.3588%2015.4392%2016.1053L15.4392%2016.1053C15.6927%2015.8519%2015.8194%2015.7252%2015.8779%2015.5838C15.956%2015.3953%2015.956%2015.1835%2015.8779%2014.9951C15.8194%2014.8537%2015.6927%2014.727%2015.4392%2014.4735L15.4392%2014.4735L11.6318%2010.6661L15.4392%206.85872C15.6926%206.60528%2015.8193%206.47856%2015.8779%206.3372C15.956%206.14871%2015.956%205.93694%2015.8779%205.74845C15.8193%205.60709%2015.6926%205.48037%2015.4392%205.22693C15.1857%204.97349%2015.059%204.84677%2014.9177%204.78822C14.7292%204.71015%2014.5174%204.71015%2014.3289%204.78822C14.1876%204.84677%2014.0608%204.97349%2013.8074%205.22693L10%209.03433L6.19244%205.22676C5.939%204.97332%205.81228%204.8466%205.67092%204.78805C5.48244%204.70997%205.27066%204.70997%205.08218%204.78805C4.94082%204.8466%204.8141%204.97332%204.56066%205.22676L4.56066%205.22676C4.30722%205.4802%204.1805%205.60692%204.12194%205.74828C4.04387%205.93676%204.04387%206.14854%204.12194%206.33702Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",warn2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8.49778%205.00963C8.48513%204.56774%208.47881%204.3468%208.56086%204.17746C8.63301%204.02856%208.75124%203.90689%208.89802%203.83052C9.06494%203.74365%209.28597%203.74365%209.72805%203.74365H10.272C10.714%203.74365%2010.9351%203.74365%2011.102%203.83052C11.2488%203.9069%2011.367%204.02856%2011.4392%204.17746C11.5212%204.3468%2011.5149%204.56775%2011.5022%205.00964L11.2644%2013.3173C11.2524%2013.737%2011.2464%2013.9468%2011.1609%2014.1065C11.0857%2014.2471%2010.9687%2014.3609%2010.826%2014.432C10.6639%2014.5129%2010.454%2014.5129%2010.0342%2014.5129H9.96582C9.54601%2014.5129%209.33611%2014.5129%209.17397%2014.432C9.0313%2014.3609%208.91426%2014.2471%208.83904%2014.1065C8.75357%2013.9468%208.74756%2013.737%208.73555%2013.3173L8.49778%205.00963Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Crect%20x%3D%228.76917%22%20y%3D%2215.2817%22%20width%3D%222.46154%22%20height%3D%222.46154%22%20rx%3D%220.769231%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",correct2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_248)%22%3E%0A%3Cpath%20d%3D%22M15.689%205.69723C15.5476%205.75578%2015.4209%205.8825%2015.1675%206.13594L7.82436%2013.4791L4.83279%2010.4875C4.57935%2010.2341%204.45263%2010.1073%204.31127%2010.0488C4.12278%209.97071%203.91101%209.97071%203.72252%2010.0488C3.58116%2010.1073%203.45444%2010.2341%203.201%2010.4875C2.94756%2010.7409%202.82084%2010.8676%202.76229%2011.009C2.68422%2011.1975%202.68422%2011.4093%202.76229%2011.5978C2.82084%2011.7391%202.94756%2011.8658%203.201%2012.1193L7.0085%2015.9268C7.26194%2016.1802%207.38866%2016.3069%207.53002%2016.3655C7.7185%2016.4436%207.93028%2016.4436%208.11876%2016.3655C8.26013%2016.3069%208.38685%2016.1802%208.64028%2015.9268C8.66387%2015.9032%208.68636%2015.8807%208.7078%2015.8592L16.7993%207.76772C17.0527%207.51428%2017.1794%207.38756%2017.238%207.2462C17.3161%207.05772%2017.3161%206.84594%2017.238%206.65746C17.1794%206.5161%2017.0527%206.38938%2016.7993%206.13594C16.5458%205.8825%2016.4191%205.75578%2016.2777%205.69723C16.0893%205.61915%2015.8775%205.61915%2015.689%205.69723Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_248%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A"},flag:{"flag-green":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","flag-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","flag-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"},cell:{"cell-0":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-25":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-50":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-75":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-100":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A"}},j2=[{title:"sheet.cf.iconSet.direction",group:[{name:"3Arrows",list:[m.arrow["up-green"],m.arrow["right-gold"],m.arrow["down-red"]]},{name:"3ArrowsGray",list:[m.arrow["up-gray"],m.arrow["right-gray"],m.arrow["down-gray"]]},{name:"4Arrows",list:[m.arrow["up-green"],m.arrow["rightAndUp-gold"],m.arrow["rightAndDown-gold"],m.arrow["down-red"]]},{name:"4ArrowsGray",list:[m.arrow["up-gray"],m.arrow["rightAndUp-gray"],m.arrow["rightAndDown-gray"],m.arrow["down-gray"]]},{name:"5Arrows",list:[m.arrow["up-green"],m.arrow["rightAndUp-gold"],m.arrow["right-gold"],m.arrow["rightAndDown-gold"],m.arrow["down-red"]]},{name:"5ArrowsGray",list:[m.arrow["up-gray"],m.arrow["rightAndUp-gray"],m.arrow["right-gray"],m.arrow["rightAndDown-gray"],m.arrow["down-gray"]]},{name:"3Triangles",list:[m.shape.up,m.shape.cross,m.shape.down]}]},{title:"sheet.cf.iconSet.shape",group:[{name:"3TrafficLights1",list:[m.shape["roundness-greed"],m.shape["roundness-gold"],m.shape["roundness-red"]]},{name:"3Signs",list:[m.shape["roundness-greed"],m.shape["triangle-gold"],m.shape["rhomboid-red"]]},{name:"3TrafficLights2",list:[m.shape["indicate-greed"],m.shape["indicate-gold"],m.shape["indicate-red"]]},{name:"4RedToBlack",list:[m.shape["roundness-red"],m.shape["roundness-pink"],m.shape["roundness-gray"],m.shape["roundness-black"]]},{name:"4TrafficLights",list:[m.shape["roundness-greed"],m.shape["roundness-gold"],m.shape["roundness-red"],m.shape["roundness-black"]]}]},{title:"sheet.cf.iconSet.mark",group:[{name:"3Symbols",list:[m.feedback.correct,m.feedback.warn,m.feedback.mistake]},{name:"3Symbols2",list:[m.feedback2.correct2,m.feedback2.warn2,m.feedback2.mistake2]},{name:"3Flags",list:[m.flag["flag-green"],m.flag["flag-gold"],m.flag["flag-red"]]}]},{title:"sheet.cf.iconSet.rank",group:[{name:"4Rating",list:[m.signal.signal25,m.signal.signal50,m.signal.signal75,m.signal.signal100]},{name:"5Rating",list:[m.signal.signal0,m.signal.signal25,m.signal.signal50,m.signal.signal75,m.signal.signal100]},{name:"5Quarters",list:[m.progress.progress100,m.progress.progress75,m.progress.progress50,m.progress.progress25,m.progress.progress0]},{name:"_5Felling",list:[m.feeling.guffaw,m.feeling.smile,m.feeling.noninductive,m.feeling.dissatisfied,m.feeling.impatient]},{name:"5Boxes",list:[m.cell["cell-100"],m.cell["cell-75"],m.cell["cell-50"],m.cell["cell-25"],m.cell["cell-0"]]},{name:"3Stars",list:[m.star.starFull,m.star.starIncomplete,m.star.starEmpty]}]}],i2=j2.reduce((r,s)=>{const{group:n}=s;for(const e of n)r[e.name]=e.list;return r},{});for(const r in i2){const s=i2[r];Object.freeze(s)}const $2="EMPTY_ICON_TYPE",f0="ssheets-conditional-formatting.config",P2={};var m0=Object.getOwnPropertyDescriptor,v0=(r,s,n,e)=>{for(var t=e>1?void 0:e?m0(s,n):s,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=a(t)||t);return t},J=(r,s)=>(n,e)=>s(n,e,r);C.ConditionalFormattingService=class extends u.Disposable{constructor(s,n,e,t,i,a){super(),this._conditionalFormattingRuleModel=s,this._injector=n,this._univerInstanceService=e,this._resourceManagerService=t,this._sheetInterceptorService=i,this._commandService=a,this._initCellChange(),this._initSnapshot(),this._initSheetChange()}get _conditionalFormattingViewModelV2(){return this._injector.get(C.ConditionalFormattingViewModel)}composeStyle(s,n,e,t){const i=this._conditionalFormattingViewModelV2.getCellCfs(s,n,e,t);if(i&&(i!=null&&i.length)){const a=i.map(l=>this._conditionalFormattingRuleModel.getRule(s,n,l.cfId)).filter(l=>!!l).reverse(),o=a.findIndex(l=>l==null?void 0:l.stopIfTrue);return o>-1&&a.splice(o+1),a.reduce((l,c)=>{var D;const h=c.rule.type,g=i.find(f=>f.cfId===c.cfId);if(h===I.highlightCell)g.result&&u.merge(l,{style:g.result});else if(h===I.colorScale){const f=g==null?void 0:g.result;f&&typeof f=="string"&&(l.style={...(D=l.style)!=null?D:{},bg:{rgb:f}})}else if(h===I.dataBar){const f=g==null?void 0:g.result;f&&(l.dataBar=f,l.isShowValue=f.isShowValue)}else if(h===I.iconSet){const f=g==null?void 0:g.result;f&&(l.iconSet=f,l.isShowValue=f.isShowValue)}return l},{})}return null}_initSnapshot(){const s=e=>{const t=this._conditionalFormattingRuleModel.getUnitRules(e),i={};return t?(t.forEach((a,o)=>{i[o]=a}),JSON.stringify(i)):""},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:h2,businesses:[u.UniverInstanceType.UNIVER_SHEET],toJson:e=>s(e),parseJson:e=>n(e),onUnLoad:e=>{this._conditionalFormattingRuleModel.deleteUnitId(e),!u.isInternalEditorID(e)&&this._conditionalFormattingViewModelV2.dispose()},onLoad:(e,t)=>{Object.keys(t).forEach(i=>{[...t[i]].reverse().forEach(o=>{this._conditionalFormattingRuleModel.addRule(e,i,o)})})}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:s=>{if(s.id===p.RemoveSheetCommand.id){const n=s.params,e=n.unitId||F0(this._univerInstanceService),t=n.subUnitId||w0(this._univerInstanceService);if(!t)return{redos:[],undos:[]};const i=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!i)return{redos:[],undos:[]};const a=[],o=[];return i.forEach(d=>{const l={unitId:e,subUnitId:t,cfId:d.cfId};a.push({id:$.id,params:l}),o.push(...Q(this._injector,l))}),{redos:a,undos:o}}else if(s.id===p.CopySheetCommand.id){const n=s.params,{unitId:e,subUnitId:t,targetSubUnitId:i}=n;if(!e||!t||!i)return{redos:[],undos:[]};const a=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!a)return{redos:[],undos:[]};const o=[],d=[];return a.forEach(l=>{const c={unitId:e,subUnitId:i,rule:{...l,cfId:this._conditionalFormattingRuleModel.createCfId(e,i)}};o.push({id:X.id,params:c}),d.push(C2(this._injector,c))}),{redos:o,undos:d}}return{redos:[],undos:[]}}}))}_initCellChange(){this.disposeWithMe(this._commandService.onCommandExecuted(s=>{const n=(e,t,i)=>{const a=new Set;return i.forEach(([o,d])=>{const l=this._conditionalFormattingViewModelV2.getCellCfs(e,t,o,d);l==null||l.forEach(c=>a.add(c.cfId))}),[...a].map(o=>this._conditionalFormattingRuleModel.getRule(e,t,o)).filter(o=>!!o)};switch(s.id){case p.SetRangeValuesMutation.id:{const e=s.params,{subUnitId:t,unitId:i,cellValue:a}=e,o=[];new u.ObjectMatrix(a).forValue((l,c,h)=>{h&&Object.keys(h).some(D=>["p","v"].includes(D))&&o.push([l,c])}),n(i,t,o).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,t,l.cfId)});break}case p.InsertColMutation.id:case p.RemoveColMutation.id:{const{range:e,unitId:t,subUnitId:i}=s.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i),o={...e,endColumn:Number.MAX_SAFE_INTEGER};a&&a.filter(l=>l.ranges.some(c=>u.Rectangle.intersects(c,o))).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,l.cfId)});break}case p.RemoveRowMutation.id:case p.InsertRowMutation.id:{const{range:e,unitId:t,subUnitId:i}=s.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i),o={...e,endRow:Number.MAX_SAFE_INTEGER};a&&a.filter(l=>l.ranges.some(c=>u.Rectangle.intersects(c,o))).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,l.cfId)});break}case p.MoveRowsMutation.id:{const{sourceRange:e,targetRange:t,unitId:i,subUnitId:a}=s.params,o=this._conditionalFormattingRuleModel.getSubunitRules(i,a),d={startRow:Math.min(e.startRow,t.startRow),endRow:Number.MAX_SAFE_INTEGER,startColumn:0,endColumn:Number.MAX_SAFE_INTEGER};o&&o.filter(c=>c.ranges.some(h=>u.Rectangle.intersects(h,d))).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,a,c.cfId)});break}case p.MoveColsMutation.id:{const{sourceRange:e,targetRange:t,unitId:i,subUnitId:a}=s.params,o=this._conditionalFormattingRuleModel.getSubunitRules(i,a),d={startRow:0,endRow:Number.MAX_SAFE_INTEGER,startColumn:Math.min(e.startColumn,t.startColumn),endColumn:Number.MAX_SAFE_INTEGER};o&&o.filter(c=>c.ranges.some(h=>u.Rectangle.intersects(h,d))).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,a,c.cfId)});break}case p.MoveRangeMutation.id:{const{unitId:e,to:t,from:i}=s.params,a=o=>{const d=[];new u.ObjectMatrix(o.value).forValue((c,h)=>{d.push([c,h])}),n(e,o.subUnitId,d).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(e,o.subUnitId,c.cfId)})};a(t),a(i);break}case p.ReorderRangeMutation.id:{const{range:e,unitId:t,subUnitId:i}=s.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i);a&&a.filter(d=>d.ranges.some(l=>u.Rectangle.intersects(l,e))).forEach(d=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,d.cfId)});break}}}))}},C.ConditionalFormattingService=v0([J(0,u.Inject(M)),J(1,u.Inject(u.Injector)),J(2,u.Inject(u.IUniverInstanceService)),J(3,u.Inject(u.IResourceManagerService)),J(4,u.Inject(p.SheetInterceptorService)),J(5,u.Inject(u.ICommandService))],C.ConditionalFormattingService);const F0=r=>r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),w0=r=>{var s;return(s=r.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:s.getSheetId()};var E0=Object.getOwnPropertyDescriptor,p0=(r,s,n,e)=>{for(var t=e>1?void 0:e?E0(s,n):s,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=a(t)||t);return t},w2=(r,s)=>(n,e)=>s(n,e,r);C.UniverSheetsConditionalFormattingPlugin=(c2=class extends u.Plugin{constructor(s=P2,n,e,t){super(),this._config=s,this._injector=n,this._commandService=e,this._configService=t;const{...i}=u.merge({},P2,this._config);this._configService.setConfig(f0,i),[[C.ConditionalFormattingService],[C.ConditionalFormattingFormulaService],[M],[C.ConditionalFormattingViewModel]].forEach(a=>{this._injector.add(a)}),[I2,R2,S2,x2,b2,L2,X,$,Y,H,e2].forEach(a=>{this._commandService.registerCommand(a)})}onStarting(){this._injector.get(C.ConditionalFormattingService),u.touchDependencies(this._injector,[[C.ConditionalFormattingService],[C.ConditionalFormattingViewModel]])}},F(c2,"pluginName",h2),F(c2,"type",u.UniverInstanceType.UNIVER_SHEET),c2),C.UniverSheetsConditionalFormattingPlugin=p0([w2(1,u.Inject(u.Injector)),w2(2,u.Inject(u.ICommandService)),w2(3,u.IConfigService)],C.UniverSheetsConditionalFormattingPlugin);const W2="sheet-conditional-rule-icon",A0=35,q2=15,Z2=2,y0=r=>{const{startRow:s,endRow:n,startColumn:e,endColumn:t}=r;return`${s}-${n}-${e}-${t}`};class G2 extends G.SheetExtension{constructor(){super();F(this,"_paddingRightAndLeft",Z2);F(this,"_width",q2);F(this,"_imageMap",new Map);F(this,"uKey",W2);F(this,"Z_INDEX",A0);F(this,"_radius",1);this._init()}draw(n,e,t,i){const{worksheet:a}=t;if(!a)return!1;const o=new Set;n.save(),u.Range.foreach(t.rowColumnSegment,(d,l)=>{if(!a.getRowVisible(d)||!a.getColVisible(l))return;const c=t.getCellWithCoordByIndex(d,l,!1),{isMerged:h,isMergedMainCell:g,mergeInfo:D}=c;let f=a.getCell(d,l);if(h&&(f=a.getCell(D.startRow,D.startColumn)),!(f!=null&&f.iconSet))return;const{iconType:v,iconId:w}=f.iconSet;if(v===$2)return;const A=this._imageMap.get(this._createKey(v,w));if(!A||!this.isRenderDiffRangesByCell(D,i))return;if(h||g){const P=y0(D);if(o.has(P))return;o.add(P)}const{startX:S,endX:_,startY:x,endY:k}=h||g?D:c,E2=_-S,d2=k-x;if(this._width>d2||this._width>E2+this._paddingRightAndLeft*2)return;const p2=(d2-this._width)/2+x;n.drawImage(A,S+this._paddingRightAndLeft,p2,this._width,this._width)}),n.restore()}_init(){for(const n in i2)i2[n].forEach((t,i)=>{const a=this._createKey(n,String(i)),o=new Image;o.onload=()=>{this._imageMap.set(a,o)},o.src=t})}_createKey(n,e){return`${n}_${e}`}}G.SpreadsheetExtensionRegistry.add(G2);function H2(r){if(typeof r!="object"||r===null)return r;const s={};for(const n in r)if(r.hasOwnProperty(n)){const e=H2(r[n]);e!==void 0&&(s[n]=e)}return s}Object.defineProperty(C,"isRangesEqual",{enumerable:!0,get:()=>u.isRangesEqual}),C.AddCfCommand=I2,C.AddConditionalRuleMutation=X,C.AddConditionalRuleMutationUndoFactory=C2,C.CFNumberOperator=E,C.CFRuleType=I,C.CFSubRuleType=y,C.CFTextOperator=b,C.CFTimePeriodOperator=L,C.CFValueType=R,C.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH=o2,C.ClearRangeCfCommand=R2,C.ClearWorksheetCfCommand=S2,C.ConditionalFormattingFormulaMarkDirty=e2,C.ConditionalFormattingIcon=G2,C.ConditionalFormattingRuleModel=M,C.DEFAULT_BG_COLOR=Y2,C.DEFAULT_FONT_COLOR=K2,C.DEFAULT_PADDING=Z2,C.DEFAULT_WIDTH=q2,C.DataBar=k2,C.DeleteCfCommand=x2,C.DeleteConditionalRuleMutation=$,C.DeleteConditionalRuleMutationUndoFactory=Q,C.EMPTY_ICON_TYPE=$2,C.FormulaResultStatus=T,C.IconUKey=W2,C.MoveCfCommand=b2,C.MoveConditionalRuleMutation=H,C.MoveConditionalRuleMutationUndoFactory=M2,C.SHEET_CONDITIONAL_FORMATTING_PLUGIN=h2,C.SetCfCommand=L2,C.SetConditionalRuleMutation=Y,C.anchorUndoFactory=y2,C.compareWithNumber=K,C.createCfId=_2,C.createDefaultRule=J2,C.createDefaultValue=z2,C.createDefaultValueByValueType=Q2,C.dataBarUKey=T2,C.defaultDataBarNativeColor=v2,C.defaultDataBarPositiveColor=m2,C.defaultPlaceholderColor=B2,C.filterRange=u2,C.findIndexByAnchor=j,C.getCacheStyleMatrix=C0,C.getCellValue=N,C.getColorScaleFromValue=O2,C.getMaxInFormulaResult=D0,C.getOppositeOperator=V2,C.getValueByType=n2,C.iconGroup=j2,C.iconMap=i2,C.isAnchorEqual=e0,C.isFloatsEqual=t2,C.isNullable=B,C.moveByAnchor=A2,C.removeUndefinedAttr=H2,C.serialTimeToTimestamp=N2,C.setConditionalRuleMutationUndoFactory=D2,C.toYMD_1900=U2,C.transformSupportSymmetryAnchor=g2,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
(function(C,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/engine-formula"),require("rxjs/operators"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","rxjs","@univerjs/engine-formula","rxjs/operators","@univerjs/engine-render"],u):(C=typeof globalThis<"u"?globalThis:C||self,u(C.UniverSheetsConditionalFormatting={},C.UniverCore,C.UniverSheets,C.rxjs,C.UniverEngineFormula,C.rxjs.operators,C.UniverEngineRender))})(this,(function(C,u,p,J,w,n2,G){"use strict";var y0=Object.defineProperty;var _0=(C,u,p)=>u in C?y0(C,u,{enumerable:!0,configurable:!0,writable:!0,value:p}):C[u]=p;var v=(C,u,p)=>_0(C,typeof u!="symbol"?u+"":u,p);const u2="SHEET_CONDITIONAL_FORMATTING_PLUGIN";var L=(s=>(s.beginsWith="beginsWith",s.endsWith="endsWith",s.containsText="containsText",s.notContainsText="notContainsText",s.equal="equal",s.notEqual="notEqual",s.containsBlanks="containsBlanks",s.notContainsBlanks="notContainsBlanks",s.containsErrors="containsErrors",s.notContainsErrors="notContainsErrors",s))(L||{}),T=(s=>(s.today="today",s.yesterday="yesterday",s.tomorrow="tomorrow",s.last7Days="last7Days",s.thisMonth="thisMonth",s.lastMonth="lastMonth",s.nextMonth="nextMonth",s.thisWeek="thisWeek",s.lastWeek="lastWeek",s.nextWeek="nextWeek",s))(T||{}),E=(s=>(s.greaterThan="greaterThan",s.greaterThanOrEqual="greaterThanOrEqual",s.lessThan="lessThan",s.lessThanOrEqual="lessThanOrEqual",s.notBetween="notBetween",s.between="between",s.equal="equal",s.notEqual="notEqual",s))(E||{}),R=(s=>(s.highlightCell="highlightCell",s.dataBar="dataBar",s.colorScale="colorScale",s.iconSet="iconSet",s))(R||{}),y=(s=>(s.uniqueValues="uniqueValues",s.duplicateValues="duplicateValues",s.rank="rank",s.text="text",s.timePeriod="timePeriod",s.number="number",s.average="average",s.formula="formula",s))(y||{}),I=(s=>(s.num="num",s.min="min",s.max="max",s.percent="percent",s.percentile="percentile",s.formula="formula",s))(I||{});const H2="#fff",X2="#000000",Y2=()=>({cfId:void 0,ranges:[],stopIfTrue:!1,rule:{type:"highlightCell",subType:"text",operator:"containsText"}}),K2=(s,r)=>{switch(s){case"text":{if(["beginsWith","containsText","endsWith","equal","notContainsText","notEqual"].includes(r))return"";break}case"number":return["between","notBetween"].includes(r)?[10,100]:10}return""},J2=(s,r)=>{switch(s){case"formula":return"=";case"max":case"min":return"";case"percent":case"percentile":case"num":return r!==void 0?r:10}return""},O=(s,r,n)=>{if(!r)return null;const e=r.findIndex(t=>n(t)===s.id);if(e<0)return null;switch(s.type){case"after":return e+1;case"before":return e-1;case"self":return e}},v2=(s,r,n,e)=>{if(!n)return null;const t=O(s,n,e);let i=O(r,n,e);if(t===null||i===null||t===i)return;const a=n.splice(t,1)[0];switch(t<i&&(i=O(r,n,e)),r.type){case"before":{n.splice(i+1,0,a);break}case"self":case"after":{n.splice(i,0,a);break}}},c2=(s,r,n,e)=>{if(s.type==="after"&&["after","before"].includes(r.type))return[s,r];const t={...s},i={...r};if(t.type!=="after"){const a=O(t,n,e);if(a===null)return null;if(a-1<0){const o=n[a+1];if(o)t.id=e(o),t.type="before";else return null}else{const o=e(n[a-1]);t.id=o,t.type="after"}}if(!["after","before"].includes(i.type)){const a=O(i,n,e);if(a===null)return null;if(a===0)i.type="before";else if(a-1>=0){const o=e(n[a-1]);i.id=o,i.type="after"}else if(a+1<=n.length-1){const o=e(n[a+1]);i.id=o,i.type="before"}else return null}return t.id===i.id&&t.type===i.type?null:[t,i]},w2=(s,r)=>{if(["after","before"].includes(r.type)){if(s.type==="after")return[r,s];if(s.type==="before")return[r,{...s,type:"self"}]}return null},z2=(s,r)=>s.id===r.id&&s.type===r.type,E2=()=>`${u.generateRandomId(8)}`;class S{constructor(){v(this,"_model",new Map);v(this,"_ruleChange$",new J.Subject);v(this,"$ruleChange",this._ruleChange$.asObservable())}_ensureList(r,n){let e=this.getSubunitRules(r,n);if(!e){e=[];let t=this._model.get(r);t||(t=new Map,this._model.set(r,t)),t.set(n,e)}return e}getRule(r,n,e){const t=this.getSubunitRules(r,n);return t?t.find(i=>i.cfId===e):null}getUnitRules(r){return this._model.get(r)||null}getSubunitRules(r,n){var t;return((t=this._model.get(r))==null?void 0:t.get(n))||null}getAll(){return this._model}deleteRule(r,n,e){const t=this.getSubunitRules(r,n);if(t){const i=t.findIndex(o=>o.cfId===e),a=t[i];a&&(t.splice(i,1),this._ruleChange$.next({rule:a,subUnitId:n,unitId:r,type:"delete"}))}}setRule(r,n,e,t){const a=this._ensureList(r,n).find(o=>o.cfId===t);if(a){const o=u.Tools.deepClone(a);Object.assign(a,e),this._ruleChange$.next({rule:a,subUnitId:n,unitId:r,type:"set",oldRule:o})}}addRule(r,n,e){const t=this._ensureList(r,n);t.find(a=>a.cfId===e.cfId)||t.unshift(e),this._ruleChange$.next({rule:e,subUnitId:n,unitId:r,type:"add"})}moveRulePriority(r,n,e,t){const i=this._ensureList(r,n),a=O(e,i,l=>l.cfId),o=O(t,i,l=>l.cfId);if(o===null||a===null||o===a)return;const h=i[a];h&&(v2(e,t,i,l=>l.cfId),this._ruleChange$.next({rule:h,subUnitId:n,unitId:r,type:"sort"}))}createCfId(r,n){return E2()}deleteUnitId(r){this._model.delete(r)}}const Z={type:u.CommandType.MUTATION,id:"sheet.mutation.move-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,start:t,end:i}=r;return s.get(S).moveRulePriority(n,e,t,i),!0}},p2=s=>{const{unitId:r,subUnitId:n}=s,e=w2(s.start,s.end);if(!e)return[];const[t,i]=e;return[{id:Z.id,params:{unitId:r,subUnitId:n,start:t,end:i}}]},z=(s,r)=>{const n=s.get(S),{unitId:e,subUnitId:t,cfId:i}=r,a=[...n.getSubunitRules(e,t)||[]],o=a.findIndex(l=>l.cfId===i),h=a[o-1];if(o>-1){const l=a[o],c=[{id:H.id,params:{unitId:e,subUnitId:t,rule:u.Tools.deepClone(l)}}];if(a.splice(o,1),o!==0){const d=a[0];if(d){const g=c2({id:d.cfId,type:"before"},{id:h.cfId,type:"after"},a,A=>A.cfId);if(!g)return c;const[f,D]=g,F={unitId:e,subUnitId:t,start:f,end:D};c.push({id:Z.id,params:F})}}return c}return[]},j={type:u.CommandType.MUTATION,id:"sheet.mutation.delete-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,cfId:t}=r;return s.get(S).deleteRule(n,e,t),!0}},d2=(s,r)=>({id:j.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,cfId:r.rule.cfId}}),H={type:u.CommandType.MUTATION,id:"sheet.mutation.add-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,rule:t}=r;return s.get(S).addRule(n,e,t),!0}},A2={type:u.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(s,r){if(!r)return!1;const{rule:n}=r,e=s.get(u.IUndoRedoService),t=s.get(u.ICommandService),i=s.get(S),a=s.get(u.IUniverInstanceService),o=p.getSheetCommandTarget(a,r);if(!o)return!1;const{unitId:h,subUnitId:l}=o,c=i.createCfId(h,l),d={unitId:h,subUnitId:l,rule:{...n,cfId:n.cfId||c}},g=d2(s,d),f=t.syncExecuteCommand(H.id,d);return f&&e.pushUndoRedo({unitID:h,redoMutations:[{id:H.id,params:d}],undoMutations:[g]}),f}},X={type:u.CommandType.MUTATION,id:"sheet.mutation.set-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,rule:t}=r,i=r.cfId||r.rule.cfId;return s.get(S).setRule(n,e,t,i),!0}},h2=(s,r)=>{const n=s.get(S),{unitId:e,subUnitId:t}=r,i=r.cfId||r.rule.cfId,a=n.getRule(e,t,i);return a?[{id:X.id,params:{unitId:e,subUnitId:t,cfId:i,rule:u.Tools.deepClone(a)}}]:[]},y2={type:u.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(s,r){var F;if(!r)return!1;const n=s.get(S),e=s.get(u.IUniverInstanceService),t=s.get(u.ICommandService),i=s.get(u.IUndoRedoService),a=s.get(p.SheetsSelectionsService),o=p.getSheetCommandTarget(e,r);if(!o)return!1;const{unitId:h,subUnitId:l}=o,c=((F=a.getCurrentSelections())==null?void 0:F.map(A=>A.range))||[],d=n.getSubunitRules(h,l);if(!(d!=null&&d.length)||!c.length)return!1;const g=[],f=[];d.forEach(A=>{const _=new u.ObjectMatrix;A.ranges.forEach(M=>{u.Range.foreach(M,(b,N)=>{_.setValue(b,N,1)})}),c.forEach(M=>{u.Range.foreach(M,(b,N)=>{_.realDeleteValue(b,N)})});const x=p.findAllRectangle(p.createTopMatrixFromMatrix(_));if(x.length){const M={...A,ranges:x},b={unitId:h,subUnitId:l,rule:M},N=h2(s,b);g.push({id:X.id,params:b}),f.push(...N)}else{const M={unitId:h,subUnitId:l,cfId:A.cfId},b=z(s,M);g.push({id:j.id,params:M}),f.push(...b)}});const D=u.sequenceExecute(g,t).result;return D&&i.pushUndoRedo({unitID:h,redoMutations:g,undoMutations:f}),D}},_2={type:u.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(s,r){const n=s.get(S),e=s.get(u.IUniverInstanceService),t=s.get(u.ICommandService),i=s.get(u.IUndoRedoService),a=p.getSheetCommandTarget(e,r);if(!a)return!1;const{unitId:o,subUnitId:h}=a,l=n.getSubunitRules(o,h);if(!(l!=null&&l.length))return!1;const c=l.map(D=>({cfId:D.cfId,unitId:o,subUnitId:h})),d=c.map(D=>({id:j.id,params:D})),g=c.map(D=>z(s,D)[0]),f=u.sequenceExecute(d,t).result;return f&&i.pushUndoRedo({unitID:o,redoMutations:d,undoMutations:g}),f}},M2={type:u.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(s,r){if(!r)return!1;const n=s.get(u.IUndoRedoService),e=s.get(u.ICommandService),t=s.get(u.IUniverInstanceService),i=p.getSheetCommandTarget(t,r);if(!i)return!1;const{unitId:a,subUnitId:o}=i,h={unitId:a,subUnitId:o,cfId:r.cfId},l=z(s,h),c=e.syncExecuteCommand(j.id,h);return c&&n.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:[{id:j.id,params:h}]}),c}},R2={type:u.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(s,r){if(!r)return!1;const n=s.get(u.IUndoRedoService),e=s.get(u.ICommandService),t=s.get(u.IUniverInstanceService),i=s.get(S),a=p.getSheetCommandTarget(t,r);if(!a)return!1;const{unitId:o,subUnitId:h}=a,l=c2(r.start,r.end,i.getSubunitRules(o,h)||[],F=>F.cfId);if(!l)return!1;const[c,d]=l,g={unitId:o,subUnitId:h,start:c,end:d},f=p2(g),D=e.syncExecuteCommand(Z.id,g);return D&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Z.id,params:g}],undoMutations:f}),D}},S2={type:u.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(s,r){if(!r)return!1;const n=s.get(u.IUndoRedoService),e=s.get(u.ICommandService),t=s.get(u.IUniverInstanceService),i=p.getSheetCommandTarget(t,r);if(!i)return!1;const{unitId:a,subUnitId:o}=i,h={unitId:a,subUnitId:o,rule:r.rule,cfId:r.cfId},l=h2(s,h),c=e.syncExecuteCommand(X.id,h);return c&&n.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:[{id:X.id,params:h}]}),c}};var Q2=Object.getOwnPropertyDescriptor,e0=(s,r,n,e)=>{for(var t=e>1?void 0:e?Q2(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},I2=(s,r)=>(n,e)=>r(n,e,s);C.ConditionalFormattingFormulaService=class extends u.Disposable{constructor(n,e){super();v(this,"_formulaMap",new Map);v(this,"_result$",new J.Subject);v(this,"result$",this._result$.asObservable());this._registerOtherFormulaService=n,this._conditionalFormattingRuleModel=e,this._initFormulaResultChange(),this._initRuleChange()}_initRuleChange(){const n=e=>{switch(e.type){case R.colorScale:return e.config.some(t=>t.value.type===I.formula);case R.dataBar:return[e.config.max,e.config.min].some(t=>t.type===I.formula);case R.iconSet:return e.config.some(t=>t.value.type===I.formula)}};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{const{unitId:t,subUnitId:i,rule:a,oldRule:o}=e;e.type==="delete"&&this._removeFormulaByCfId(t,i,a.cfId),e.type==="set"&&(n(a.rule)||o&&n(o.rule))&&this._removeFormulaByCfId(t,i,a.cfId),e.type==="add"&&this._registerRuleFormulas(t,i,a)}))}_registerRuleFormulas(n,e,t){switch(t.rule.type){case R.highlightCell:{if(t.rule.subType===y.formula){const i=t.rule.value;i&&this.registerFormulaWithRange(n,e,t.cfId,i,t.ranges)}break}}}_initFormulaResultChange(){this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe(n=>{for(const e in n)for(const t in n[e]){const i=n[e][t];for(const a of i){const o=this._ensureSubunitFormulaMap(e,t).getValue(a.formulaId,["formulaId"]);if(!o)continue;const l=this._getAllFormulaResultByCfId(e,t,o.cfId).every(c=>{const d=this._registerOtherFormulaService.getFormulaValueSync(e,t,c.formulaId);return(d==null?void 0:d.status)===w.FormulaResultStatus.SUCCESS});this._result$.next({...o,isAllFinished:l})}}}))}_ensureSubunitFormulaMap(n,e){let t=this._formulaMap.get(n);t||(t=new Map,this._formulaMap.set(n,t));let i=t.get(e);return i||(i=new u.RefAlias([],["formulaId","id"]),t.set(e,i)),i}getSubUnitFormulaMap(n,e){var t;return(t=this._formulaMap.get(n))==null?void 0:t.get(e)}registerFormulaWithRange(n,e,t,i,a=[{startRow:0,endRow:0,startColumn:0,endColumn:0}]){const o=this._ensureSubunitFormulaMap(n,e),h=this.createCFormulaId(t,i);if(o.getValue(h,["id"]))return;const l=this._registerOtherFormulaService.registerFormulaWithRange(n,e,i,a,void 0,w.OtherFormulaBizType.CONDITIONAL_FORMATTING,t);o.addValue({formulaText:i,unitId:n,subUnitId:e,cfId:t,id:h,formulaId:l})}_removeFormulaByCfId(n,e,t){const a=this.deleteCache(n,e,t).map(o=>o.formulaId);this._registerOtherFormulaService.deleteFormula(n,e,a)}getFormulaResultWithCoords(n,e,t,i,a=0,o=0){var d;const h=this.getSubUnitFormulaMap(n,e);if(!h)return{status:w.FormulaResultStatus.NOT_REGISTER};const l=h.getValue(this.createCFormulaId(t,i),["id"]);if(!l)return{status:w.FormulaResultStatus.NOT_REGISTER};const c=this._registerOtherFormulaService.getFormulaValueSync(n,e,l.formulaId);if(!c)return{status:w.FormulaResultStatus.NOT_REGISTER};if(c.status===w.FormulaResultStatus.SUCCESS&&c.result){const g=(d=c.result[a])==null?void 0:d[o];return{result:this._getCellValue(g),status:w.FormulaResultStatus.SUCCESS}}return{status:c.status}}getFormulaMatrix(n,e,t,i){const a=this.getSubUnitFormulaMap(n,e);if(!a)return{status:w.FormulaResultStatus.NOT_REGISTER};const o=a.getValue(this.createCFormulaId(t,i),["id"]);if(!o)return{status:w.FormulaResultStatus.NOT_REGISTER};const h=this._registerOtherFormulaService.getFormulaValueSync(n,e,o.formulaId);if(!h)return{status:w.FormulaResultStatus.NOT_REGISTER};if(h.status===w.FormulaResultStatus.SUCCESS&&h.result){const l=new u.ObjectMatrix;return new u.ObjectMatrix(h.result).forValue((d,g,f)=>{l.setValue(d,g,this._getCellValue(f))}),{result:l,status:w.FormulaResultStatus.SUCCESS}}return{status:h.status}}_getCellValue(n){if(!n||!n[0]||!n[0][0])return!1;const e=n[0][0];return(e==null?void 0:e.t)===u.CellValueType.BOOLEAN?e.v===u.BooleanNumber.TRUE||e.v===!0:e==null?void 0:e.v}deleteCache(n,e,t,i){const a=this.getSubUnitFormulaMap(n,e);if(!a)return[];if(i){const o=this.createCFormulaId(t,i);return a.deleteValue(o,["id"]),[]}else{const o=a.getValues().filter(h=>h.cfId===t);return o.forEach(h=>{a.deleteValue(h.formulaId,["formulaId"])}),o}}_getAllFormulaResultByCfId(n,e,t){const i=this.getSubUnitFormulaMap(n,e);return i?i.getValues().filter(o=>o.cfId===t):[]}createCFormulaId(n,e){return`${n}_${e}`}},C.ConditionalFormattingFormulaService=e0([I2(0,u.Inject(w.RegisterOtherFormulaService)),I2(1,u.Inject(S))],C.ConditionalFormattingFormulaService);var U=(s=>(s.preComputingStart="preComputingStart",s.preComputing="preComputing",s.preComputingEnd="preComputingEnd",s.preComputingError="preComputingError",s))(U||{});class i2{constructor(r){v(this,"_cache");v(this,"_preComputingStatus$",new J.BehaviorSubject("preComputingStart"));v(this,"preComputingStatus$",this._preComputingStatus$.asObservable().pipe(n2.distinctUntilChanged()));v(this,"_preComputingCache");v(this,"_rule");this._context=r,this._cache=new u.LRUMap(r.limit),this._rule=r.rule,this._preComputingCache=null,this._initClearCacheListener()}setCacheLength(r){this._cache.limit=r}clearCache(){this._cache.clear()}resetPreComputingCache(){this._preComputingStatus$.next("preComputingStart"),this._preComputingCache=null}updateRule(r){this._rule=r,this.resetPreComputingCache()}getCell(r,n){const e=this._createKey(r,n);if(this._preComputingStatus$.getValue()==="preComputing")return this._cache.get(e);let t=this.getPreComputingResult(r,n);if(t===null&&(this._preComputingStatus$.next("preComputingStart"),this.preComputing(r,n,this._getContext()),t=this.getPreComputingResult(r,n),t===null))return this._cache.get(e);if(this._preComputingStatus$.next("preComputingEnd"),this._cache.has(e))return this._cache.get(e);const i=this.getCellResult(r,n,t,this._getContext());return i!==null&&this._setCache(r,n,i),i}setPreComputingCache(r){this._preComputingCache=r}getPreComputingResult(r,n){return this._preComputingCache}_createKey(r,n){return`${r}_${n}`}_setCache(r,n,e){const t=this._createKey(r,n);this._cache.set(t,e)}_getContext(){return{...this._context,rule:this._rule}}_initClearCacheListener(){this.preComputingStatus$.subscribe(r=>{r==="preComputingEnd"&&this.clearCache()})}}class t0 extends i2{preComputing(r,n,e){const t=e.rule,i=e.worksheet,a=new u.ObjectMatrix;!t.rule.config.every(c=>c.value.type===I.num)&&l2(t.ranges,i.getMaxRows()-1,i.getMaxColumns()-1).forEach(d=>{u.Range.foreach(d,(g,f)=>{const D=e.getCellValue(g,f),F=D&&D.v;if(!B(F)&&(D==null?void 0:D.t)===u.CellValueType.NUMBER){const A=Number(F);!Number.isNaN(A)&&a.setValue(g,f,A)}})});const h=[...t.rule.config].sort((c,d)=>c.index-d.index).map(c=>({value:e2(c.value,a,{...e,cfId:t.cfId}),color:new u.ColorKit(c.color)}));if(!h.some(c=>G.isObject(c.value)?c.value.status!==w.FormulaResultStatus.SUCCESS:!1)){const c=h.map(d=>d.color).reduce((d,g,f)=>(d.result.push({color:g,value:d.sortValue[f]}),d),{result:[],sortValue:h.map(d=>d.value.result).sort((d,g)=>d-g)}).result;this.setPreComputingCache(c),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(r,n,e,t){if(!e)return null;const i=t.getCellValue(r,n);if(i.t===u.CellValueType.NUMBER){const a=Number(i.v);if(!Number.isNaN(a))return U2(e,a)}}}const x2="sheet-conditional-rule-data-bar",g2="#ffbe38",C2="#abd91a",b2="#000",n0=34,i0=s=>{const{startRow:r,endRow:n,startColumn:e,endColumn:t}=s;return`${r}-${n}-${e}-${t}`};class L2 extends G.SheetExtension{constructor(){super(...arguments);v(this,"_paddingRightAndLeft",2);v(this,"_paddingTopAndBottom",2);v(this,"uKey",x2);v(this,"Z_INDEX",n0);v(this,"_radius",1)}draw(n,e,t,i){const{worksheet:a}=t;if(!a)return!1;const o=new Set;n.save(),u.Range.foreach(t.rowColumnSegment,(h,l)=>{if(!a.getRowVisible(h)||!a.getColVisible(l))return;const c=t.getCellWithCoordByIndex(h,l,!1),{isMerged:d,isMergedMainCell:g,mergeInfo:f}=c;let D=a.getCell(h,l);if(d&&(D=a.getCell(f.startRow,f.startColumn)),!(D!=null&&D.dataBar)||!this.isRenderDiffRangesByCell(f,i))return;if(d||g){const V=i0(f);if(o.has(V))return;o.add(V)}const{color:F,value:A,startPoint:_,isGradient:x}=D.dataBar,{startX:M,endX:b,startY:N,endY:m2}=d||g?f:c,o2=b-M,F2=m2+G.FIX_ONE_PIXEL_BLUR_OFFSET-N,$=o2-this._paddingRightAndLeft*2,Z2=F2-this._paddingTopAndBottom*2;if(A>0){const V=Math.max($*(1-_/100)*A/100,1),P=M+this._paddingRightAndLeft+_/100*$,W=N+this._paddingTopAndBottom;if(x){const q=n.createLinearGradient(P,W,P+V,W);q.addColorStop(0,F),q.addColorStop(1,"rgb(255 255 255)"),n.fillStyle=q,n.strokeStyle=F,n.lineWidth=1}else n.fillStyle=F;this._drawRectWithRoundedCorner(n,P,W,V,Z2,!1,!0,!0,!1),x&&n.stroke()}else{const V=Math.max($*_/100*Math.abs(A)/100,1),P=M+this._paddingRightAndLeft+_/100*$-V,W=N+this._paddingTopAndBottom;if(x){const q=n.createLinearGradient(P,W,P+V,W);q.addColorStop(0,"rgb(255 255 255)"),q.addColorStop(1,F),n.fillStyle=q,n.strokeStyle=F,n.lineWidth=1}else n.fillStyle=F;this._drawRectWithRoundedCorner(n,P,W,V,Z2,!0,!1,!1,!0),x&&n.stroke()}}),n.restore()}_drawRectWithRoundedCorner(n,e,t,i,a,o,h,l,c){const d=this._radius;!a||!i||(n.beginPath(),n.moveTo(e+d,t),n.lineTo(e+i-d,t),h?n.arcTo(e+i,t,e+i,t+d,d):n.lineTo(e+i,t),n.lineTo(e+i,t+a-d),l?n.arcTo(e+i,t+a,e+i-d,t+a,d):n.lineTo(e+i,t+a),n.lineTo(e+d,t+a),c?n.arcTo(e,t+a,e,t+a-d,d):n.lineTo(e,t+a),n.lineTo(e,t+d),o?n.arcTo(e,t,e+d,t,d):n.lineTo(e,t),n.closePath(),n.fill())}}G.SpreadsheetExtensionRegistry.add(L2);const s2=s=>Math.max(Math.min(100,s),0),s0=(s,r,n)=>{const e=n(s,r);if(e&&e.t===u.CellValueType.NUMBER){const t=Number(e.v);return Number.isNaN(t)?null:t}return null};class r0 extends i2{preComputing(r,n,e){const t=e.rule,i=t.rule,a=e.worksheet,o=new u.ObjectMatrix;![t.rule.config.max,t.rule.config.min].every(f=>f.type===I.num)&&l2(t.ranges,a.getMaxRows()-1,a.getMaxColumns()-1).forEach(D=>{u.Range.foreach(D,(F,A)=>{const _=e.getCellValue(F,A),x=_&&_.v;if(!B(x)&&(_==null?void 0:_.t)===u.CellValueType.NUMBER){const M=Number(x);!Number.isNaN(M)&&o.setValue(F,A,M)}})});const l=e2(i.config.min,o,{...e,cfId:t.cfId}),c=e2(i.config.max,o,{...e,cfId:t.cfId});let d=0,g=0;if(l.status===w.FormulaResultStatus.SUCCESS){const f=Number(l.result);d=Number.isNaN(f)?0:f}else{this._preComputingStatus$.next(U.preComputing);return}if(c.status===w.FormulaResultStatus.SUCCESS){const f=Number(c.result),D=Number.isNaN(f)?0:f;g=Math.max(D,d),d=Math.min(D,d);let F=50;if(d<0&&g<=0)F=100;else if(d<0&&g>0){const A=Math.abs(g)+Math.abs(d);F=Math.abs(d)/A*100}else d>=0&&g>0&&(F=0);this.setPreComputingCache({min:d,max:g,startPoint:F}),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(r,n,e,t){const{min:i,max:a,startPoint:o}=e,l=t.rule.rule,c=l.isShowValue,d=l.config.isGradient,g=s0(r,n,t.getCellValue);if(!(g===null||g<i||i===a||a<i)){if(g===0)return{color:b2,startPoint:o,value:0,isGradient:d,isShowValue:c};if(i<0&&a<=0){const f=a-i,D=s2((a-g)/f*100);return D===0?void 0:{color:l.config.nativeColor||C2,startPoint:o,value:-D,isGradient:d,isShowValue:c}}else if(i<0&&a>0)if(g>0){const f=s2(Math.min(g/a,1)*100);return f===0?void 0:{color:l.config.positiveColor||g2,startPoint:o,value:f,isGradient:d,isShowValue:c}}else{const f=s2(Math.min(Math.abs(g)/Math.abs(i),1)*100);return f===0?void 0:{color:l.config.nativeColor||C2,startPoint:o,value:-f,isGradient:d,isShowValue:c}}else if(i>=0&&a>0){const f=a-i,D=0,F=s2((1-(a-g)/f)*100);return F===0?void 0:{color:l.config.positiveColor||g2,startPoint:D,value:F,isGradient:d,isShowValue:c}}}}}class a0 extends i2{preComputing(r,n,e){const t=e.rule.rule,i=e.rule.ranges,o=(()=>{switch(t.subType){case y.average:{let h=0,l=0;return i.forEach(c=>{u.Range.foreach(c,(d,g)=>{const f=e.getCellValue(d,g),D=k(f||void 0);f&&f.t===u.CellValueType.NUMBER&&D!==void 0&&(h+=Number(D)||0,l++)})}),{value:h/l,type:t.subType}}case y.uniqueValues:case y.duplicateValues:{const h=new Map;return i.forEach(l=>{u.Range.foreach(l,(c,d)=>{const g=e.getCellValue(c,d),f=k(g||void 0);if(f!==void 0){const D=h.get(f);D?h.set(f,D+1):h.set(f,1)}})}),{value:h,type:t.subType}}case y.rank:{let h=[];i.forEach(d=>{u.Range.foreach(d,(g,f)=>{const D=e.getCellValue(g,f),F=k(D||void 0);D&&D.t===u.CellValueType.NUMBER&&F!==void 0&&h.push(Number(F)||0)})}),h.sort((d,g)=>g-d);const l=e.rule.rule;if(l.isPercent){l.isBottom&&(h=h.toReversed());const d=u.Tools.clamp(l.value,0,100)/100,g=Math.floor(d*h.length),f=u.Tools.clamp(g-1,0,h.length-1);return{value:h[f],type:t.subType}}const c=Math.floor(u.Tools.clamp(l.isBottom?l.value-1:l.value,0,h.length));return l.isBottom?{value:h[h.length-c-1],type:t.subType}:{value:h[Math.max(c-1,0)],type:t.subType}}case y.formula:{const h=t,l=e.accessor.get(C.ConditionalFormattingFormulaService);l.registerFormulaWithRange(e.unitId,e.subUnitId,e.rule.cfId,h.value,e.rule.ranges);const c=l.getFormulaMatrix(e.unitId,e.subUnitId,e.rule.cfId,h.value);return c&&c.status===w.FormulaResultStatus.SUCCESS?(this._preComputingStatus$.next(U.preComputingEnd),{value:c.result,type:t.subType}):(this._preComputingStatus$.next(U.preComputing),null)}case y.timePeriod:switch(t.operator){case T.last7Days:return{value:{start:u.dayjs().subtract(7,"day").valueOf(),end:u.dayjs().valueOf()},type:t.subType};case T.lastMonth:return{value:{start:u.dayjs().startOf("month").subtract(1,"month").valueOf(),end:u.dayjs().endOf("month").subtract(1,"month").valueOf()},type:t.subType};case T.lastWeek:return{value:{start:u.dayjs().startOf("week").subtract(1,"week").valueOf(),end:u.dayjs().endOf("week").subtract(1,"week").valueOf()},type:t.subType};case T.nextMonth:return{value:{start:u.dayjs().startOf("month").add(1,"month").valueOf(),end:u.dayjs().endOf("month").add(1,"month").valueOf()},type:t.subType};case T.nextWeek:return{value:{start:u.dayjs().startOf("week").add(1,"week").valueOf(),end:u.dayjs().endOf("week").add(1,"week").valueOf()},type:t.subType};case T.thisMonth:return{value:{start:u.dayjs().startOf("month").valueOf(),end:u.dayjs().endOf("month").valueOf()},type:t.subType};case T.thisWeek:return{value:{start:u.dayjs().startOf("week").valueOf(),end:u.dayjs().endOf("week").valueOf()},type:t.subType};case T.today:return{value:{start:u.dayjs().startOf("day").valueOf(),end:u.dayjs().endOf("day").valueOf()},type:t.subType};case T.tomorrow:return{value:{start:u.dayjs().startOf("day").add(1,"day").valueOf(),end:u.dayjs().endOf("day").add(1,"day").valueOf()},type:t.subType};case T.yesterday:return{value:{start:u.dayjs().startOf("day").subtract(1,"day").valueOf(),end:u.dayjs().endOf("day").subtract(1,"day").valueOf()},type:t.subType}}}})();this.setPreComputingCache(o)}getCellResult(r,n,e,t){const i=t.getCellValue(r,n),a=t.rule.rule;return(()=>{switch(a.subType){case y.number:{const l=i&&Number(i.v),c=(i==null?void 0:i.t)===u.CellValueType.NUMBER,d=a;return c?B(l)||Number.isNaN(l)?void 0:Y({operator:d.operator,value:d.value||0},l||0):!![E.notEqual,E.notBetween].includes(d.operator)}case y.text:{const l=a,c=k(i),d=c===null?"":String(c),g=l.value||"";switch(l.operator){case L.beginsWith:return d.startsWith(g);case L.containsBlanks:return/^\s*$/.test(d);case L.notContainsBlanks:return!/^\s*$/.test(d);case L.containsErrors:return w.ERROR_TYPE_SET.has(d);case L.notContainsErrors:return!w.ERROR_TYPE_SET.has(d);case L.containsText:return d.indexOf(g)>-1;case L.notContainsText:return d.indexOf(g)===-1;case L.endsWith:return d.endsWith(g);case L.equal:return d===g;case L.notEqual:return d!==g;default:return!1}}case y.timePeriod:{const l=k(i);if(B(l)||Number.isNaN(Number(l))||(i==null?void 0:i.t)!==u.CellValueType.NUMBER||!e)return;const c=B2(Number(l)),{start:d,end:g}=e.value;return c>=d&&c<=g}case y.average:{const l=i&&i.v,c=Number(l),d=(i==null?void 0:i.t)===u.CellValueType.NUMBER,g=a;if(!d)return E.notEqual===g.operator;if(B(l)||Number.isNaN(c)||!e)return!1;const f=e.value;switch(g.operator){case E.greaterThan:return c>f;case E.greaterThanOrEqual:return c>=f;case E.lessThan:return c<f;case E.lessThanOrEqual:return c<=f;case E.equal:return Q(c,f);case E.notEqual:return!Q(c,f);default:return!1}}case y.rank:{const l=k(i),c=Number(l);if(B(l)||Number.isNaN(c)||(i==null?void 0:i.t)!==u.CellValueType.NUMBER||!e)return!1;const d=e.value;return a.isBottom?c<=d:c>=d}case y.uniqueValues:{const l=k(i);return B(l)||!e?!1:e.value.get(l)===1}case y.duplicateValues:{const l=k(i);return B(l)||!e?!1:e.value.get(l)!==1}case y.formula:{const l=e==null?void 0:e.value;if(l){const c=t.rule.ranges[0],d=r-c.startRow,g=n-c.startColumn;return l.getValue(d,g)===!0}return!1}}})()?a.style:{}}}const l0=(s,r,n)=>{const e=n(s,r);if(e&&e.t===u.CellValueType.NUMBER){const t=Number(e.v);return Number.isNaN(t)?null:t}return null};class o0 extends i2{preComputing(r,n,e){const t=e.rule.rule,i=e.worksheet,a=new u.ObjectMatrix;!t.config.every(c=>c.value.type===I.num)&&l2(e.rule.ranges,i.getMaxRows()-1,i.getMaxColumns()-1).forEach(d=>{u.Range.foreach(d,(g,f)=>{const D=e.getCellValue(g,f),F=D&&D.v;if(!B(F)&&(D==null?void 0:D.t)===u.CellValueType.NUMBER){const A=Number(F);!Number.isNaN(A)&&a.setValue(g,f,A)}})});const h=t.config.map(c=>e2(c.value,a,{...e,cfId:e.rule.cfId}));if(!h.some(c=>c.status!==w.FormulaResultStatus.SUCCESS)){const c=h.map((d,g)=>({operator:t.config[g].operator,value:Number(d.result)||0})).reduce((d,g,f,D)=>{const F=t.config[f];if(!f||f===D.length-1)d.push({...g,iconId:F.iconId,iconType:F.iconType});else{const A=D[f-1];Y(A,g.value)||d.push({...g,iconId:F.iconId,iconType:F.iconType})}return d},[]);this.setPreComputingCache(c),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(r,n,e,t){if(!e)return null;const i=l0(r,n,t.getCellValue);if(i===null)return;const a=t.rule.rule,o=a.isShowValue===void 0?!0:!!a.isShowValue;for(let h=0;h<e.length;h++){const l=e[h],c={...l},d={...l},{iconId:g,iconType:f}=l;if(h===0){if(Y(l,i))return{iconId:g,iconType:f,isShowValue:o}}else{if(h===e.length-1)return{iconId:g,iconType:f,isShowValue:o};{const D=e[h-1];if(d.operator=N2(D.operator),d.value=D.value,Y(c,i)&&Y(d,i))return{iconId:g,iconType:f,isShowValue:o}}}}}}var u0=Object.getOwnPropertyDescriptor,c0=(s,r,n,e)=>{for(var t=e>1?void 0:e?u0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},r2=(s,r)=>(n,e)=>r(n,e,s);const a2=1e3*3*3;C.ConditionalFormattingViewModel=class extends u.Disposable{constructor(n,e,t,i){super();v(this,"_calculateUnitManagers",new Map);v(this,"_rTreeManager",new u.RTree);v(this,"_cellCache",new u.LRUMap(a2));v(this,"_markDirty$",new J.Subject);v(this,"markDirty$",this._markDirty$.asObservable());v(this,"_markRuleDirtyAtOnce",(n,e,t,i=!0)=>{if(this._cellCache.clear(),i){const o=this._ensureCalculateUnitManager(n,e).get(t);o&&o.resetPreComputingCache()}this._markDirty$.next({unitId:n,subUnitId:e,cfId:t})});v(this,"markRuleDirty",(()=>{const n=new J.Subject;return this.disposeWithMe(n.pipe(n2.bufferTime(100),n2.filter(e=>!!e.length),n2.map(e=>{const t=new Set,i=[];return e.forEach(a=>{const o=`${a.unitId}_${a.subUnitId}_${a.cfId}`;if(t.has(o)){if(a.isNeedResetPreComputingCache){const h=i.find(l=>l.cfId===a.cfId);h.isNeedResetPreComputingCache=!0}return}t.add(o),i.push({...a})}),i})).subscribe(e=>{e.forEach(t=>{this._markRuleDirtyAtOnce(t.unitId,t.subUnitId,t.cfId,t.isNeedResetPreComputingCache)})})),(e,t,i,a=!0)=>{n.next({unitId:e,subUnitId:t,cfId:i,isNeedResetPreComputingCache:a})}})());this._injector=n,this._conditionalFormattingRuleModel=e,this._conditionalFormattingFormulaService=t,this._univerInstanceService=i,this._initRuleListener(),this._handleCustomFormulasSeparately(),this._initCFFormulaListener()}_initCFFormulaListener(){this.disposeWithMe(this._conditionalFormattingFormulaService.result$.subscribe(({unitId:n,subUnitId:e,cfId:t,isAllFinished:i})=>{i&&this._markRuleDirtyAtOnce(n,e,t,i)}))}getCellCfs(n,e,t,i){const a=this._createCacheKey(n,e,t,i);if(this._cellCache.has(a))return this._cellCache.get(a);const o=this._getCellCfs(n,e,t,i);return o.length&&this._cellCache.set(a,o),o}_getCellCfs(n,e,t,i){var d;const a=(d=this._conditionalFormattingRuleModel.getSubunitRules(n,e))!=null?d:[],o=this._ensureCalculateUnitManager(n,e),h=this._rTreeManager.bulkSearch([{unitId:n,sheetId:e,range:{startColumn:i,endColumn:i,startRow:t,endRow:t}}]),l=a.filter(g=>h.has(g.cfId));return l.length?l.map(g=>{const f=o.get(g.cfId);return f?{cfId:g.cfId,result:f.getCell(t,i)}:null}).filter(g=>!!g).map((g,f)=>({...g,priority:f})):[]}dispose(){this._calculateUnitManagers.clear(),this._cellCache.clear(),this._rTreeManager.clear(),super.dispose()}_handleCustomFormulasSeparately(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{if(n.type==="set"){const{unitId:e,subUnitId:t}=n,i=n.oldRule;i.rule.type===R.highlightCell&&i.rule.subType===y.formula&&this._conditionalFormattingFormulaService.deleteCache(e,t,i.cfId)}}))}_initRuleListener(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:e,subUnitId:t,rule:i}=n,{cfId:a,ranges:o}=i,h=this._ensureCalculateUnitManager(e,t);switch(this.markRuleDirty(e,t,a),n.type){case"add":{this._rTreeManager.bulkInsert(o.map(c=>({unitId:e,sheetId:t,id:a,range:c})));const l=this._createRuleCalculateUnitInstance(e,t,i);if(!l)return;h.set(i.cfId,l);break}case"delete":{this._rTreeManager.bulkRemove(o.map(l=>({unitId:e,sheetId:t,id:a,range:l}))),h.delete(i.cfId);break}case"set":{const l=n.oldRule;if(this._rTreeManager.bulkRemove(l.ranges.map(c=>({unitId:e,sheetId:t,id:l.cfId,range:c}))),this._rTreeManager.bulkInsert(o.map(c=>({unitId:e,sheetId:t,id:a,range:c}))),l.rule.type!==i.rule.type){const c=this._createRuleCalculateUnitInstance(e,t,i);if(!c)return;h.delete(l.cfId),h.set(i.cfId,c)}else{const c=h.get(l.cfId);if(!c)return;c.updateRule(i)}}}}))}_ensureCalculateUnitManager(n,e){let t=this._calculateUnitManagers.get(n);t||(t=new Map,this._calculateUnitManagers.set(n,t));let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_createRuleCalculateUnitInstance(n,e,t){const i=this._univerInstanceService.getUnit(n),a=i==null?void 0:i.getSheetBySheetId(e);if(!i||!a)return;const o={workbook:i,worksheet:a,unitId:n,subUnitId:e,accessor:this._injector,rule:t,limit:a2,getCellValue:(h,l)=>a.getCellRaw(h,l)||{}};switch(t.rule.type){case R.colorScale:return new t0(o);case R.dataBar:return new r0(o);case R.highlightCell:return new a0(o);case R.iconSet:return new o0(o)}}_createCacheKey(n,e,t,i){return`${n}_${e}_${t}_${i}`}setCacheLength(n=a2){this._cellCache.limit!==n&&(this._cellCache.limit=n,this._calculateUnitManagers.forEach(e=>{e.forEach(t=>{t.forEach(i=>{i.setCacheLength(n)})})}))}},C.ConditionalFormattingViewModel=c0([r2(0,u.Inject(u.Injector)),r2(1,u.Inject(S)),r2(2,u.Inject(C.ConditionalFormattingFormulaService)),r2(3,u.IUniverInstanceService)],C.ConditionalFormattingViewModel);function Q(s,r){return Math.abs(s-r)<Number.EPSILON}const B=s=>[void 0,null].includes(s),k=s=>{var e,t;if(!s)return null;if(s.t===u.CellValueType.BOOLEAN)return s.v===u.BooleanNumber.TRUE?w.BooleanValue.TRUE:w.BooleanValue.FALSE;const r=s.v,n=(t=(e=s.p)==null?void 0:e.body)==null?void 0:t.dataStream.replace(/\r\n$/,"");return B(r)?B(n)?null:n:r},f2=86400;function T2(s,r=!0){if(r&&s>=0){if(s===0)return[1900,1,0];if(s===60)return[1900,2,29];if(s<60)return[1900,s<32?1:2,(s-1)%31+1]}let n=s+68569+2415019;const e=Math.floor(4*n/146097);n=n-Math.floor((146097*e+3)/4);const t=Math.floor(4e3*(n+1)/1461001);n=n-Math.floor(1461*t/4)+31;const i=Math.floor(80*n/2447),a=n-Math.floor(2447*i/80);n=Math.floor(i/11);const o=i+2-12*n;return[100*(e-49)+t+n|0,o|0,a|0]}const B2=s=>{let r=s|0;const n=f2*(s-r);let e=Math.floor(n);n-e>.9999&&(e+=1,e===f2&&(e=0,r+=1));const t=e<0?f2+e:e,[i,a,o]=T2(s,!0),h=Math.floor(t/60/60)%60,l=Math.floor(t/60)%60,c=Math.floor(t)%60;return u.dayjs(`${i}/${a}/${o} ${h}:${l}:${c}`).valueOf()},e2=(s,r,n)=>{switch(s.type){case I.max:{let e=0;return r.forValue((t,i,a)=>{a>e&&(e=a)}),{status:w.FormulaResultStatus.SUCCESS,result:e}}case I.min:{let e;return r.forValue((t,i,a)=>{e===void 0&&(e=a),a<e&&(e=a)}),{status:w.FormulaResultStatus.SUCCESS,result:e}}case I.percent:{let e,t;r.forValue((o,h,l)=>{(e===void 0||t===void 0)&&(e=l,t=l),l>e&&(e=l),l<t&&(t=l)});const i=(e||0)-(t||0),a=Math.max(Math.min(Number(s.value)||0,100),0);return{status:w.FormulaResultStatus.SUCCESS,result:i*(a/100)+(t||0)}}case I.percentile:{const e=r.toNativeArray().sort((l,c)=>l-c),t=Math.max(Math.min(Number(s.value)||0,100),0),i=(e.length-1)*t/100,a=Math.floor(i),o=i-a,h=e[a]+(e[Math.min(a+1,e.length-1)]-e[a])*o;return{status:w.FormulaResultStatus.SUCCESS,result:h}}case I.formula:{const{accessor:e,unitId:t,subUnitId:i,cfId:a}=n,o=String(s.value),h=e.get(C.ConditionalFormattingFormulaService);return h.registerFormulaWithRange(t,i,a,o),h.getFormulaResultWithCoords(t,i,a,o)}case I.num:default:{const e=Number(s.value);return{status:w.FormulaResultStatus.SUCCESS,result:Number.isNaN(e)?0:e}}}},d0=(s,r,n,e)=>{const{accessor:t}=e,i=t.get(C.ConditionalFormattingViewModel),a=new u.ObjectMatrix;return n.ranges.forEach(o=>{u.Range.foreach(o,(h,l)=>{const c=i.getCellCfs(s,r,h,l);if(c){const d=c.find(g=>g.cfId===n.cfId);d!=null&&d.result&&a.setValue(h,l,d.result)}})}),a},Y=(s,r)=>{switch(s.operator){case E.between:{if(typeof s.value!="object"||!s.value.length)return;const n=Math.min(...s.value),e=Math.max(...s.value);return r>=n&&r<=e}case E.notBetween:{if(typeof s.value!="object"||!s.value.length)return;const n=Math.min(...s.value),e=Math.max(...s.value);return!(r>=n&&r<=e)}case E.equal:{const n=s.value||0;return Q(n,r)}case E.notEqual:{const n=s.value||0;return!Q(n,r)}case E.greaterThan:{const n=s.value||0;return r>n}case E.greaterThanOrEqual:{const n=s.value||0;return r>=n}case E.lessThan:{const n=s.value||0;return r<n}case E.lessThanOrEqual:{const n=s.value||0;return r<=n}default:return!1}},N2=s=>{switch(s){case E.greaterThan:return E.lessThanOrEqual;case E.greaterThanOrEqual:return E.lessThan;case E.lessThan:return E.greaterThanOrEqual;case E.lessThanOrEqual:return E.greaterThan}return s},U2=(s,r)=>{const n=i=>i.a!==void 0?i:{...i,a:1},e=s.findIndex(i=>i.value>=r),t=e-1;if(e===0)return s[0].color.toRgbString();if(t>=0){const i=s[t],a=s[e];if(i.color.isValid&&a.color.isValid){const o=n(i.color.toRgb()),h=n(a.color.toRgb()),l=a.value-i.value,c=(r-i.value)/l,d=["r","g","b","a"].reduce((f,D)=>{const F=o[D];return f[D]=(h[D]-F)*c+F,f},{});return new u.ColorKit(d).toRgbString()}}else return s[s.length-1].color.toRgbString()},l2=(s,r,n)=>s.map(e=>{if(e.startColumn>n||e.startRow>r)return null;const t={...e};return t.endRow=Math.min(t.endRow,r),t.endColumn=Math.min(t.endColumn,n),t}).filter(e=>!!e);function h0(s){let r=0;return new u.ObjectMatrix(s).forValue((n,e,t)=>{r=Math.max(Number.isNaN(r)?0:r,Number(t))}),r}const m={feedback:{mistake:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.87359%206.87332C6.6146%207.13231%206.6146%207.55221%206.87359%207.8112L9.062%209.99961L6.87356%2012.188C6.61457%2012.447%206.61457%2012.8669%206.87356%2013.1259C7.13255%2013.3849%207.55245%2013.3849%207.81144%2013.1259L9.99987%2010.9375L12.1882%2013.1258C12.4472%2013.3848%2012.8671%2013.3848%2013.1261%2013.1258C13.3851%2012.8669%2013.3851%2012.447%2013.1261%2012.188L10.9378%209.99961L13.1261%207.81127C13.3851%207.55228%2013.3851%207.13238%2013.1261%206.87339C12.8671%206.61441%2012.4472%206.61441%2012.1882%206.87339L9.99987%209.06173L7.81147%206.87332C7.55248%206.61433%207.13257%206.61433%206.87359%206.87332Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",warn:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M9.16817%206.67735C9.16646%206.61745%209.1656%206.5875%209.16653%206.56236C9.18103%206.16817%209.49136%205.84883%209.88497%205.82306C9.91008%205.82141%209.94004%205.82141%209.99996%205.82141V5.82141C10.0599%205.82141%2010.0899%205.82141%2010.115%205.82306C10.5086%205.84883%2010.8189%206.16817%2010.8334%206.56236C10.8343%206.5875%2010.8335%206.61745%2010.8318%206.67735L10.7043%2011.131C10.6934%2011.5121%2010.3812%2011.8154%209.99995%2011.8154V11.8154C9.61866%2011.8154%209.30655%2011.5121%209.29564%2011.131L9.16817%206.67735Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Crect%20x%3D%229.31488%22%20y%3D%2212.8086%22%20width%3D%221.37006%22%20height%3D%221.37006%22%20rx%3D%220.685032%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",correct:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M17.037%2010C17.037%2013.8865%2013.8864%2017.0371%209.99999%2017.0371C6.11354%2017.0371%202.96295%2013.8865%202.96295%2010C2.96295%206.1136%206.11354%202.96301%209.99999%202.96301C13.8864%202.96301%2017.037%206.1136%2017.037%2010Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M13.9239%207.17477C13.6638%206.91472%2013.2422%206.91472%2012.9821%207.17477L8.74433%2011.4126L7.01786%209.6861C6.75781%209.42606%206.33619%209.42606%206.07614%209.6861C5.81609%209.94615%205.81609%2010.3678%206.07614%2010.6278L8.27349%2012.8252C8.53354%2013.0852%208.95516%2013.0852%209.21521%2012.8252L9.2195%2012.8209L13.9239%208.1165C14.1839%207.85645%2014.1839%207.43482%2013.9239%207.17477Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A"},star:{starEmpty:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",starIncomplete:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cmask%20id%3D%22mask1_613_177%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2210%22%20height%3D%2220%22%3E%0A%3Crect%20width%3D%2210%22%20height%3D%2220%22%20fill%3D%22%23C4C4C4%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23mask1_613_177)%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",starFull:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A"},progress:{progress0:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress25:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M16.2963%209.99991C16.2963%209.17307%2016.1335%208.35432%2015.8171%207.59042C15.5006%206.82652%2015.0369%206.13242%2014.4522%205.54776C13.8675%204.96309%2013.1734%204.49931%2012.4095%204.18289C11.6456%203.86647%2010.8269%203.70361%2010%203.70361L10%209.99991H16.2963Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress50:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M10%2016.2962C11.6699%2016.2962%2013.2714%2015.6328%2014.4522%2014.4521C15.633%2013.2713%2016.2963%2011.6698%2016.2963%209.99991C16.2963%208.33003%2015.633%206.72854%2014.4522%205.54776C13.2714%204.36697%2011.6699%203.70361%2010%203.70361L10%209.99991L10%2016.2962Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress75:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M3.70374%209.99991C3.70374%2011.2452%204.07301%2012.4625%204.76485%2013.4979C5.4567%2014.5334%206.44005%2015.3404%207.59054%2015.8169C8.74104%2016.2935%2010.007%2016.4182%2011.2284%2016.1752C12.4497%2015.9323%2013.5716%2015.3326%2014.4522%2014.4521C15.3327%2013.5715%2015.9324%2012.4496%2016.1753%2011.2283C16.4183%2010.0069%2016.2936%208.74092%2015.8171%207.59042C15.3405%206.43992%2014.5335%205.45658%2013.4981%204.76473C12.4626%204.07288%2011.2453%203.70361%2010%203.70361L10%209.99991L3.70374%209.99991Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress100:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99991%22%20r%3D%226.2963%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A"},signal:{signal0:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal25:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal50:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal75:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal100:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93933%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70447%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A"},feeling:{guffaw:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M16.887%2010C16.887%2013.8037%2013.8036%2016.8871%209.99999%2016.8871C6.19638%2016.8871%203.11295%2013.8037%203.11295%2010C3.11295%206.19644%206.19638%203.11301%209.99999%203.11301C13.8036%203.11301%2016.887%206.19644%2016.887%2010Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M12.5355%2013.5821C13.0482%2013.1841%2013.3951%2012.6107%2013.5405%2012.0327C13.5934%2011.8226%2013.5051%2011.6349%2013.3518%2011.5331C13.2036%2011.4346%2013.0031%2011.4203%2012.8265%2011.5131C11.0615%2012.4407%208.94609%2012.4427%207.1828%2011.513C7.00629%2011.4199%206.80602%2011.4343%206.65798%2011.5329C6.50518%2011.6346%206.41701%2011.8217%206.46844%2012.0312C6.61029%2012.609%206.95079%2013.1833%207.46449%2013.5821C8.14361%2014.1093%209.05608%2014.3999%2010%2014.3999C10.9439%2014.3999%2011.8564%2014.1093%2012.5355%2013.5821Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A",smile:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2011.8518C7.03705%2011.8518%207.77779%2013.7037%2010%2013.7037C12.2222%2013.7037%2012.963%2011.8518%2012.963%2011.8518%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",noninductive:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2012.5927C7.03705%2012.5927%208.14816%2012.5927%2010.3704%2012.5927C12.5926%2012.5927%2012.963%2012.5927%2012.963%2012.5927%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",dissatisfied:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2013.7037C7.03705%2013.7037%207.77779%2011.8519%2010%2011.8519C12.2222%2011.8519%2012.963%2013.7037%2012.963%2013.7037%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",impatient:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.47573%2011.731C6.96306%2012.129%206.61613%2012.7024%206.47071%2013.2804C6.41784%2013.4905%206.50617%2013.6782%206.65942%2013.78C6.80761%2013.8785%207.00813%2013.8928%207.18477%2013.8C8.9498%2012.8724%2011.0652%2012.8704%2012.8285%2013.8002C13.005%2013.8932%2013.2052%2013.8788%2013.3533%2013.7802C13.5061%2013.6785%2013.5942%2013.4914%2013.5428%2013.2819C13.401%2012.7041%2013.0605%2012.1298%2012.5468%2011.731C11.8676%2011.2038%2010.9552%2010.9132%2010.0112%2010.9132C9.06732%2010.9132%208.15485%2011.2038%207.47573%2011.731Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A"},arrow:JSON.parse('{"down-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","right-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","up-green":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndDown-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndUp-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","down-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","right-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","up-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndDown-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndUp-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A"}'),shape:{cross:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.70374%22%20y%3D%228.14795%22%20width%3D%2212.5926%22%20height%3D%223.7037%22%20rx%3D%220.740741%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",up:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M9.44533%205.81157C9.74012%205.47858%2010.2598%205.47858%2010.5546%205.81157L16.2868%2012.2867C16.71%2012.7647%2016.3706%2013.5184%2015.7322%2013.5184H4.26776C3.62933%2013.5184%203.28995%2012.7647%203.71313%2012.2867L9.44533%205.81157Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",down:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.5547%2014.1884C10.2599%2014.5214%209.74019%2014.5214%209.4454%2014.1884L3.71321%207.71335C3.29002%207.23532%203.6294%206.48161%204.26784%206.48161L15.7322%206.48161C16.3707%206.48161%2016.7101%207.23532%2016.2869%207.71335L10.5547%2014.1884Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","rhomboid-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M2.1415%2011.1984C1.8412%2010.9074%201.8412%2010.4256%202.1415%2010.1346L9.48467%203.01785C9.77196%202.73942%2010.2284%202.73942%2010.5157%203.01786L17.8586%2010.1346C18.1589%2010.4256%2018.1589%2010.9074%2017.8586%2011.1984L10.5157%2018.3151C10.2284%2018.5936%209.77196%2018.5936%209.48467%2018.3152L2.1415%2011.1984Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-greed":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-pink":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FB9D9D%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-black":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22black%22%2F%3E%0A%3C%2Fsvg%3E%0A","triangle-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_237)%22%3E%0A%3Cpath%20d%3D%22M9.32308%204.41301C9.58368%203.82623%2010.4164%203.82623%2010.677%204.413L15.9526%2016.2917C16.1701%2016.7815%2015.8115%2017.3331%2015.2756%2017.3331H4.72454C4.18858%2017.3331%203.83002%2016.7815%204.04756%2016.2917L9.32308%204.41301Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_237%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A","indicate-greed":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","indicate-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","indicate-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"},feedback2:{mistake2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.12194%206.33702C4.1805%206.47839%204.30722%206.6051%204.56066%206.85854L8.36822%2010.6661L4.56062%2014.4737C4.30718%2014.7272%204.18046%2014.8539%204.12191%2014.9952C4.04384%2015.1837%204.04384%2015.3955%204.12191%2015.584C4.18046%2015.7253%204.30718%2015.8521%204.56062%2016.1055C4.81406%2016.3589%204.94078%2016.4857%205.08214%2016.5442C5.27062%2016.6223%205.4824%2016.6223%205.67089%2016.5442C5.81225%2016.4857%205.93897%2016.3589%206.19241%2016.1055L10%2012.2979L13.8074%2016.1053C14.0609%2016.3588%2014.1876%2016.4855%2014.329%2016.544C14.5174%2016.6221%2014.7292%2016.6221%2014.9177%2016.544C15.0591%2016.4855%2015.1858%2016.3588%2015.4392%2016.1053L15.4392%2016.1053C15.6927%2015.8519%2015.8194%2015.7252%2015.8779%2015.5838C15.956%2015.3953%2015.956%2015.1835%2015.8779%2014.9951C15.8194%2014.8537%2015.6927%2014.727%2015.4392%2014.4735L15.4392%2014.4735L11.6318%2010.6661L15.4392%206.85872C15.6926%206.60528%2015.8193%206.47856%2015.8779%206.3372C15.956%206.14871%2015.956%205.93694%2015.8779%205.74845C15.8193%205.60709%2015.6926%205.48037%2015.4392%205.22693C15.1857%204.97349%2015.059%204.84677%2014.9177%204.78822C14.7292%204.71015%2014.5174%204.71015%2014.3289%204.78822C14.1876%204.84677%2014.0608%204.97349%2013.8074%205.22693L10%209.03433L6.19244%205.22676C5.939%204.97332%205.81228%204.8466%205.67092%204.78805C5.48244%204.70997%205.27066%204.70997%205.08218%204.78805C4.94082%204.8466%204.8141%204.97332%204.56066%205.22676L4.56066%205.22676C4.30722%205.4802%204.1805%205.60692%204.12194%205.74828C4.04387%205.93676%204.04387%206.14854%204.12194%206.33702Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",warn2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8.49778%205.00963C8.48513%204.56774%208.47881%204.3468%208.56086%204.17746C8.63301%204.02856%208.75124%203.90689%208.89802%203.83052C9.06494%203.74365%209.28597%203.74365%209.72805%203.74365H10.272C10.714%203.74365%2010.9351%203.74365%2011.102%203.83052C11.2488%203.9069%2011.367%204.02856%2011.4392%204.17746C11.5212%204.3468%2011.5149%204.56775%2011.5022%205.00964L11.2644%2013.3173C11.2524%2013.737%2011.2464%2013.9468%2011.1609%2014.1065C11.0857%2014.2471%2010.9687%2014.3609%2010.826%2014.432C10.6639%2014.5129%2010.454%2014.5129%2010.0342%2014.5129H9.96582C9.54601%2014.5129%209.33611%2014.5129%209.17397%2014.432C9.0313%2014.3609%208.91426%2014.2471%208.83904%2014.1065C8.75357%2013.9468%208.74756%2013.737%208.73555%2013.3173L8.49778%205.00963Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Crect%20x%3D%228.76917%22%20y%3D%2215.2817%22%20width%3D%222.46154%22%20height%3D%222.46154%22%20rx%3D%220.769231%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",correct2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_248)%22%3E%0A%3Cpath%20d%3D%22M15.689%205.69723C15.5476%205.75578%2015.4209%205.8825%2015.1675%206.13594L7.82436%2013.4791L4.83279%2010.4875C4.57935%2010.2341%204.45263%2010.1073%204.31127%2010.0488C4.12278%209.97071%203.91101%209.97071%203.72252%2010.0488C3.58116%2010.1073%203.45444%2010.2341%203.201%2010.4875C2.94756%2010.7409%202.82084%2010.8676%202.76229%2011.009C2.68422%2011.1975%202.68422%2011.4093%202.76229%2011.5978C2.82084%2011.7391%202.94756%2011.8658%203.201%2012.1193L7.0085%2015.9268C7.26194%2016.1802%207.38866%2016.3069%207.53002%2016.3655C7.7185%2016.4436%207.93028%2016.4436%208.11876%2016.3655C8.26013%2016.3069%208.38685%2016.1802%208.64028%2015.9268C8.66387%2015.9032%208.68636%2015.8807%208.7078%2015.8592L16.7993%207.76772C17.0527%207.51428%2017.1794%207.38756%2017.238%207.2462C17.3161%207.05772%2017.3161%206.84594%2017.238%206.65746C17.1794%206.5161%2017.0527%206.38938%2016.7993%206.13594C16.5458%205.8825%2016.4191%205.75578%2016.2777%205.69723C16.0893%205.61915%2015.8775%205.61915%2015.689%205.69723Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_248%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A"},flag:{"flag-green":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","flag-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","flag-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"},cell:{"cell-0":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-25":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-50":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-75":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-100":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A"}},k2=[{title:"sheet.cf.iconSet.direction",group:[{name:"3Arrows",list:[m.arrow["up-green"],m.arrow["right-gold"],m.arrow["down-red"]]},{name:"3ArrowsGray",list:[m.arrow["up-gray"],m.arrow["right-gray"],m.arrow["down-gray"]]},{name:"4Arrows",list:[m.arrow["up-green"],m.arrow["rightAndUp-gold"],m.arrow["rightAndDown-gold"],m.arrow["down-red"]]},{name:"4ArrowsGray",list:[m.arrow["up-gray"],m.arrow["rightAndUp-gray"],m.arrow["rightAndDown-gray"],m.arrow["down-gray"]]},{name:"5Arrows",list:[m.arrow["up-green"],m.arrow["rightAndUp-gold"],m.arrow["right-gold"],m.arrow["rightAndDown-gold"],m.arrow["down-red"]]},{name:"5ArrowsGray",list:[m.arrow["up-gray"],m.arrow["rightAndUp-gray"],m.arrow["right-gray"],m.arrow["rightAndDown-gray"],m.arrow["down-gray"]]},{name:"3Triangles",list:[m.shape.up,m.shape.cross,m.shape.down]}]},{title:"sheet.cf.iconSet.shape",group:[{name:"3TrafficLights1",list:[m.shape["roundness-greed"],m.shape["roundness-gold"],m.shape["roundness-red"]]},{name:"3Signs",list:[m.shape["roundness-greed"],m.shape["triangle-gold"],m.shape["rhomboid-red"]]},{name:"3TrafficLights2",list:[m.shape["indicate-greed"],m.shape["indicate-gold"],m.shape["indicate-red"]]},{name:"4RedToBlack",list:[m.shape["roundness-red"],m.shape["roundness-pink"],m.shape["roundness-gray"],m.shape["roundness-black"]]},{name:"4TrafficLights",list:[m.shape["roundness-greed"],m.shape["roundness-gold"],m.shape["roundness-red"],m.shape["roundness-black"]]}]},{title:"sheet.cf.iconSet.mark",group:[{name:"3Symbols",list:[m.feedback.correct,m.feedback.warn,m.feedback.mistake]},{name:"3Symbols2",list:[m.feedback2.correct2,m.feedback2.warn2,m.feedback2.mistake2]},{name:"3Flags",list:[m.flag["flag-green"],m.flag["flag-gold"],m.flag["flag-red"]]}]},{title:"sheet.cf.iconSet.rank",group:[{name:"4Rating",list:[m.signal.signal25,m.signal.signal50,m.signal.signal75,m.signal.signal100]},{name:"5Rating",list:[m.signal.signal0,m.signal.signal25,m.signal.signal50,m.signal.signal75,m.signal.signal100]},{name:"5Quarters",list:[m.progress.progress100,m.progress.progress75,m.progress.progress50,m.progress.progress25,m.progress.progress0]},{name:"_5Felling",list:[m.feeling.guffaw,m.feeling.smile,m.feeling.noninductive,m.feeling.dissatisfied,m.feeling.impatient]},{name:"5Boxes",list:[m.cell["cell-100"],m.cell["cell-75"],m.cell["cell-50"],m.cell["cell-25"],m.cell["cell-0"]]},{name:"3Stars",list:[m.star.starFull,m.star.starIncomplete,m.star.starEmpty]}]}],t2=k2.reduce((s,r)=>{const{group:n}=r;for(const e of n)s[e.name]=e.list;return s},{});for(const s in t2){const r=t2[s];Object.freeze(r)}const V2="EMPTY_ICON_TYPE",g0="ssheets-conditional-formatting.config",O2={};var C0=Object.getOwnPropertyDescriptor,f0=(s,r,n,e)=>{for(var t=e>1?void 0:e?C0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},K=(s,r)=>(n,e)=>r(n,e,s);C.ConditionalFormattingService=class extends u.Disposable{constructor(r,n,e,t,i,a){super(),this._conditionalFormattingRuleModel=r,this._injector=n,this._univerInstanceService=e,this._resourceManagerService=t,this._sheetInterceptorService=i,this._commandService=a,this._initCellChange(),this._initSnapshot(),this._initSheetChange()}get _conditionalFormattingViewModelV2(){return this._injector.get(C.ConditionalFormattingViewModel)}composeStyle(r,n,e,t){const i=this._conditionalFormattingViewModelV2.getCellCfs(r,n,e,t);if(i&&(i!=null&&i.length)){const a=i.map(l=>this._conditionalFormattingRuleModel.getRule(r,n,l.cfId)).filter(l=>!!l).reverse(),o=a.findIndex(l=>l==null?void 0:l.stopIfTrue);return o>-1&&a.splice(o+1),a.reduce((l,c)=>{var f;const d=c.rule.type,g=i.find(D=>D.cfId===c.cfId);if(d===R.highlightCell)g.result&&u.merge(l,{style:g.result});else if(d===R.colorScale){const D=g==null?void 0:g.result;D&&typeof D=="string"&&(l.style={...(f=l.style)!=null?f:{},bg:{rgb:D}})}else if(d===R.dataBar){const D=g==null?void 0:g.result;D&&(l.dataBar=D,l.isShowValue=D.isShowValue)}else if(d===R.iconSet){const D=g==null?void 0:g.result;D&&(l.iconSet=D,l.isShowValue=D.isShowValue)}return l},{})}return null}_initSnapshot(){const r=e=>{const t=this._conditionalFormattingRuleModel.getUnitRules(e),i={};return t?(t.forEach((a,o)=>{i[o]=a}),JSON.stringify(i)):""},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:u2,businesses:[u.UniverInstanceType.UNIVER_SHEET],toJson:e=>r(e),parseJson:e=>n(e),onUnLoad:e=>{this._conditionalFormattingRuleModel.deleteUnitId(e),!u.isInternalEditorID(e)&&this._conditionalFormattingViewModelV2.dispose()},onLoad:(e,t)=>{Object.keys(t).forEach(i=>{[...t[i]].reverse().forEach(o=>{this._conditionalFormattingRuleModel.addRule(e,i,o)})})}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:r=>{if(r.id===p.RemoveSheetCommand.id){const n=r.params,e=n.unitId||D0(this._univerInstanceService),t=n.subUnitId||m0(this._univerInstanceService);if(!t)return{redos:[],undos:[]};const i=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!i)return{redos:[],undos:[]};const a=[],o=[];return i.forEach(h=>{const l={unitId:e,subUnitId:t,cfId:h.cfId};a.push({id:j.id,params:l}),o.push(...z(this._injector,l))}),{redos:a,undos:o}}else if(r.id===p.CopySheetCommand.id){const n=r.params,{unitId:e,subUnitId:t,targetSubUnitId:i}=n;if(!e||!t||!i)return{redos:[],undos:[]};const a=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!a)return{redos:[],undos:[]};const o=[],h=[];return a.forEach(l=>{const c={unitId:e,subUnitId:i,rule:{...l,cfId:this._conditionalFormattingRuleModel.createCfId(e,i)}};o.push({id:H.id,params:c}),h.push(d2(this._injector,c))}),{redos:o,undos:h}}return{redos:[],undos:[]}}}))}_initCellChange(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{const n=(e,t,i)=>{const a=new Set;return i.forEach(([o,h])=>{const l=this._conditionalFormattingViewModelV2.getCellCfs(e,t,o,h);l==null||l.forEach(c=>a.add(c.cfId))}),[...a].map(o=>this._conditionalFormattingRuleModel.getRule(e,t,o)).filter(o=>!!o)};switch(r.id){case p.SetRangeValuesMutation.id:{const e=r.params,{subUnitId:t,unitId:i,cellValue:a}=e,o=[];new u.ObjectMatrix(a).forValue((l,c,d)=>{d&&Object.keys(d).some(f=>["p","v"].includes(f))&&o.push([l,c])}),n(i,t,o).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,t,l.cfId)});break}case p.InsertColMutation.id:case p.RemoveColMutation.id:{const{range:e,unitId:t,subUnitId:i}=r.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i),o={...e,endColumn:Number.MAX_SAFE_INTEGER};a&&a.filter(l=>l.ranges.some(c=>u.Rectangle.intersects(c,o))).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,l.cfId)});break}case p.RemoveRowMutation.id:case p.InsertRowMutation.id:{const{range:e,unitId:t,subUnitId:i}=r.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i),o={...e,endRow:Number.MAX_SAFE_INTEGER};a&&a.filter(l=>l.ranges.some(c=>u.Rectangle.intersects(c,o))).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,l.cfId)});break}case p.MoveRowsMutation.id:{const{sourceRange:e,targetRange:t,unitId:i,subUnitId:a}=r.params,o=this._conditionalFormattingRuleModel.getSubunitRules(i,a),h={startRow:Math.min(e.startRow,t.startRow),endRow:Number.MAX_SAFE_INTEGER,startColumn:0,endColumn:Number.MAX_SAFE_INTEGER};o&&o.filter(c=>c.ranges.some(d=>u.Rectangle.intersects(d,h))).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,a,c.cfId)});break}case p.MoveColsMutation.id:{const{sourceRange:e,targetRange:t,unitId:i,subUnitId:a}=r.params,o=this._conditionalFormattingRuleModel.getSubunitRules(i,a),h={startRow:0,endRow:Number.MAX_SAFE_INTEGER,startColumn:Math.min(e.startColumn,t.startColumn),endColumn:Number.MAX_SAFE_INTEGER};o&&o.filter(c=>c.ranges.some(d=>u.Rectangle.intersects(d,h))).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,a,c.cfId)});break}case p.MoveRangeMutation.id:{const{unitId:e,to:t,from:i}=r.params,a=o=>{const h=[];new u.ObjectMatrix(o.value).forValue((c,d)=>{h.push([c,d])}),n(e,o.subUnitId,h).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(e,o.subUnitId,c.cfId)})};a(t),a(i);break}case p.ReorderRangeMutation.id:{const{range:e,unitId:t,subUnitId:i}=r.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i);a&&a.filter(h=>h.ranges.some(l=>u.Rectangle.intersects(l,e))).forEach(h=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,h.cfId)});break}}}))}},C.ConditionalFormattingService=f0([K(0,u.Inject(S)),K(1,u.Inject(u.Injector)),K(2,u.Inject(u.IUniverInstanceService)),K(3,u.Inject(u.IResourceManagerService)),K(4,u.Inject(p.SheetInterceptorService)),K(5,u.Inject(u.ICommandService))],C.ConditionalFormattingService);const D0=s=>s.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getUnitId(),m0=s=>{var r;return(r=s.getCurrentUnitForType(u.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:r.getSheetId()};var F0=Object.defineProperty,v0=Object.getOwnPropertyDescriptor,w0=(s,r,n)=>r in s?F0(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n,E0=(s,r,n,e)=>{for(var t=e>1?void 0:e?v0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},D2=(s,r)=>(n,e)=>r(n,e,s),j2=(s,r,n)=>w0(s,typeof r!="symbol"?r+"":r,n);C.UniverSheetsConditionalFormattingPlugin=class extends u.Plugin{constructor(r=O2,n,e,t){super(),this._config=r,this._injector=n,this._commandService=e,this._configService=t;const{...i}=u.merge({},O2,this._config);this._configService.setConfig(g0,i),[[C.ConditionalFormattingService],[C.ConditionalFormattingFormulaService],[S],[C.ConditionalFormattingViewModel]].forEach(a=>{this._injector.add(a)}),[A2,y2,_2,M2,R2,S2,H,j,X,Z].forEach(a=>{this._commandService.registerCommand(a)})}onStarting(){this._injector.get(C.ConditionalFormattingService),u.touchDependencies(this._injector,[[C.ConditionalFormattingService],[C.ConditionalFormattingViewModel]])}},j2(C.UniverSheetsConditionalFormattingPlugin,"pluginName",u2),j2(C.UniverSheetsConditionalFormattingPlugin,"type",u.UniverInstanceType.UNIVER_SHEET),C.UniverSheetsConditionalFormattingPlugin=E0([u.DependentOn(w.UniverFormulaEnginePlugin),D2(1,u.Inject(u.Injector)),D2(2,u.Inject(u.ICommandService)),D2(3,u.IConfigService)],C.UniverSheetsConditionalFormattingPlugin);const $2="sheet-conditional-rule-icon",p0=35,P2=15,W2=2,A0=s=>{const{startRow:r,endRow:n,startColumn:e,endColumn:t}=s;return`${r}-${n}-${e}-${t}`};class q2 extends G.SheetExtension{constructor(){super();v(this,"_paddingRightAndLeft",W2);v(this,"_width",P2);v(this,"_imageMap",new Map);v(this,"uKey",$2);v(this,"Z_INDEX",p0);v(this,"_radius",1);this._init()}draw(n,e,t,i){const{worksheet:a}=t;if(!a)return!1;const o=new Set;n.save(),u.Range.foreach(t.rowColumnSegment,(h,l)=>{if(!a.getRowVisible(h)||!a.getColVisible(l))return;const c=t.getCellWithCoordByIndex(h,l,!1),{isMerged:d,isMergedMainCell:g,mergeInfo:f}=c;let D=a.getCell(h,l);if(d&&(D=a.getCell(f.startRow,f.startColumn)),!(D!=null&&D.iconSet))return;const{iconType:F,iconId:A}=D.iconSet;if(F===V2)return;const _=this._imageMap.get(this._createKey(F,A));if(!_||!this.isRenderDiffRangesByCell(f,i))return;if(d||g){const $=A0(f);if(o.has($))return;o.add($)}const{startX:x,endX:M,startY:b,endY:N}=d||g?f:c,m2=M-x,o2=N-b;if(this._width>o2||this._width>m2+this._paddingRightAndLeft*2)return;const F2=(o2-this._width)/2+b;n.drawImage(_,x+this._paddingRightAndLeft,F2,this._width,this._width)}),n.restore()}_init(){for(const n in t2)t2[n].forEach((t,i)=>{const a=this._createKey(n,String(i)),o=new Image;o.onload=()=>{this._imageMap.set(a,o)},o.src=t})}_createKey(n,e){return`${n}_${e}`}}G.SpreadsheetExtensionRegistry.add(q2);function G2(s){if(typeof s!="object"||s===null)return s;const r={};for(const n in s)if(s.hasOwnProperty(n)){const e=G2(s[n]);e!==void 0&&(r[n]=e)}return r}Object.defineProperty(C,"isRangesEqual",{enumerable:!0,get:()=>u.isRangesEqual}),C.AddCfCommand=A2,C.AddConditionalRuleMutation=H,C.AddConditionalRuleMutationUndoFactory=d2,C.CFNumberOperator=E,C.CFRuleType=R,C.CFSubRuleType=y,C.CFTextOperator=L,C.CFTimePeriodOperator=T,C.CFValueType=I,C.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH=a2,C.ClearRangeCfCommand=y2,C.ClearWorksheetCfCommand=_2,C.ConditionalFormattingIcon=q2,C.ConditionalFormattingRuleModel=S,C.DEFAULT_BG_COLOR=H2,C.DEFAULT_FONT_COLOR=X2,C.DEFAULT_PADDING=W2,C.DEFAULT_WIDTH=P2,C.DataBar=L2,C.DeleteCfCommand=M2,C.DeleteConditionalRuleMutation=j,C.DeleteConditionalRuleMutationUndoFactory=z,C.EMPTY_ICON_TYPE=V2,C.IconUKey=$2,C.MoveCfCommand=R2,C.MoveConditionalRuleMutation=Z,C.MoveConditionalRuleMutationUndoFactory=p2,C.SHEET_CONDITIONAL_FORMATTING_PLUGIN=u2,C.SetCfCommand=S2,C.SetConditionalRuleMutation=X,C.anchorUndoFactory=w2,C.compareWithNumber=Y,C.createCfId=E2,C.createDefaultRule=Y2,C.createDefaultValue=K2,C.createDefaultValueByValueType=J2,C.dataBarUKey=x2,C.defaultDataBarNativeColor=C2,C.defaultDataBarPositiveColor=g2,C.defaultPlaceholderColor=b2,C.filterRange=l2,C.findIndexByAnchor=O,C.getCacheStyleMatrix=d0,C.getCellValue=k,C.getColorScaleFromValue=U2,C.getMaxInFormulaResult=h0,C.getOppositeOperator=N2,C.getValueByType=e2,C.iconGroup=k2,C.iconMap=t2,C.isAnchorEqual=z2,C.isFloatsEqual=Q,C.isNullable=B,C.moveByAnchor=v2,C.removeUndefinedAttr=G2,C.serialTimeToTimestamp=B2,C.setConditionalRuleMutationUndoFactory=h2,C.toYMD_1900=T2,C.transformSupportSymmetryAnchor=c2,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// @univerjs/sheets-conditional-formatting/facade
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets-conditional-formatting-ui/index
|
|
10
|
-
(function(D,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-conditional-formatting"),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","@univerjs/sheets-conditional-formatting","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-formula-ui","@univerjs/sheets-ui","rxjs","@univerjs/engine-render","rxjs/operators"],s):(D=typeof globalThis<"u"?globalThis:D||self,s(D.UniverSheetsConditionalFormattingUi={},D.UniverCore,D.UniverSheets,D.UniverSheetsConditionalFormatting,D.UniverUi,D.React,D.React,D.UniverDesign,D.UniverEngineFormula,D.UniverSheetsFormulaUi,D.UniverSheetsUi,D.rxjs,D.UniverEngineRender,D.rxjs.operators))})(this,(function(D,s,U,r,j,c,C,O,$e,ve,W,X,nr,pe){"use strict";var Bt=Object.defineProperty;var Ht=(D,s,U)=>s in D?Bt(D,s,{enumerable:!0,configurable:!0,writable:!0,value:U}):D[s]=U;var ee=(D,s,U)=>Ht(D,typeof s!="symbol"?s+"":s,U);const Fe={type:s.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a,operator:u}=e,i=n.get(r.ConditionalFormattingRuleModel),p=n.get(s.ICommandService),o=n.get(s.IUniverInstanceService),f=U.getSheetCommandTarget(o);if(!f)return!1;const{unitId:d,subUnitId:v}=f,h=i.createCfId(d,v),b={ranges:t,cfId:h,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:u,style:l}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:v,rule:b})}},Be={type:s.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,config:l,stopIfTrue:a}=e,u=n.get(r.ConditionalFormattingRuleModel),i=n.get(s.ICommandService),p=n.get(s.IUniverInstanceService),o=U.getSheetCommandTarget(p);if(!o)return!1;const{unitId:f,subUnitId:d}=o,v=u.createCfId(f,d),h={ranges:t,cfId:v,stopIfTrue:!!a,rule:{type:r.CFRuleType.colorScale,config:l}};return i.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:d,rule:h})}},He={type:s.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,min:l,max:a,nativeColor:u,positiveColor:i,isGradient:p,stopIfTrue:o,isShowValue:f}=e,d=n.get(r.ConditionalFormattingRuleModel),v=n.get(s.IUniverInstanceService),h=U.getSheetCommandTarget(v);if(!h)return!1;const{unitId:b,subUnitId:S}=h,m=n.get(s.ICommandService),E=d.createCfId(b,S),_={ranges:t,cfId:E,stopIfTrue:!!o,rule:{type:r.CFRuleType.dataBar,isShowValue:f,config:{min:l,max:a,nativeColor:u,positiveColor:i,isGradient:p}}};return m.executeCommand(r.AddConditionalRuleMutation.id,{unitId:b,subUnitId:S,rule:_})}},We={type:s.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a}=e,u=n.get(r.ConditionalFormattingRuleModel),i=n.get(s.ICommandService),p=n.get(s.IUniverInstanceService),o=U.getSheetCommandTarget(p);if(!o)return!1;const{unitId:f,subUnitId:d}=o,v=u.createCfId(f,d),h={ranges:t,cfId:v,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:l}};return i.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:d,rule:h})}},qe={type:s.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a,operator:u,value:i}=e,p=n.get(r.ConditionalFormattingRuleModel),o=n.get(s.ICommandService),f=n.get(s.IUniverInstanceService),d=U.getSheetCommandTarget(f);if(!d)return!1;const{unitId:v,subUnitId:h}=d,b=p.createCfId(v,h);let S;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(u)){const m=i;if(m.length!==2||!Array.isArray(m))return!1;S={ranges:t,cfId:b,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:u,style:l,value:m}}}else{const m=i;if(typeof m!="number")return!1;S={ranges:t,cfId:b,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:u,style:l,value:m}}}return o.executeCommand(r.AddConditionalRuleMutation.id,{unitId:v,subUnitId:h,rule:S})}},Ge={type:s.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a,isPercent:u,isBottom:i,value:p}=e,o=n.get(r.ConditionalFormattingRuleModel),f=n.get(s.IUniverInstanceService),d=n.get(s.ICommandService),v=U.getSheetCommandTarget(f);if(!v)return!1;const{unitId:h,subUnitId:b}=v,S=o.createCfId(h,b),m={ranges:t,cfId:S,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:u,isBottom:i,style:l,value:p}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:b,rule:m})}},Ze={type:s.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a,operator:u,value:i}=e,p=n.get(r.ConditionalFormattingRuleModel),o=n.get(s.IUniverInstanceService),f=U.getSheetCommandTarget(o);if(!f)return!1;const{unitId:d,subUnitId:v}=f,h=n.get(s.ICommandService),b=p.createCfId(d,v),S={ranges:t,cfId:b,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:u,style:l,value:i}};return h.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:v,rule:S})}},ze={type:s.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a,operator:u}=e,i=n.get(r.ConditionalFormattingRuleModel),p=n.get(s.IUniverInstanceService),o=n.get(s.ICommandService),f=U.getSheetCommandTarget(p);if(!f)return!1;const{unitId:d,subUnitId:v}=f,h=i.createCfId(d,v),b={ranges:t,cfId:h,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:u,style:l}};return o.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:v,rule:b})}},Ye={type:s.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(n,e){if(!e)return!1;const{ranges:t,style:l,stopIfTrue:a}=e,u=n.get(r.ConditionalFormattingRuleModel),i=n.get(s.IUniverInstanceService),p=n.get(s.ICommandService),o=U.getSheetCommandTarget(i);if(!o)return!1;const{unitId:f,subUnitId:d}=o,v=u.createCfId(f,d),h={ranges:t,cfId:v,stopIfTrue:!!a,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:l}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:d,rule:h})}};function K({ref:n,...e}){const{icon:t,id:l,className:a,extend:u,...i}=e,p=`univerjs-icon univerjs-icon-${l} ${a||""}`.trim(),o=C.useRef(`_${Mr()}`);return lr(t,`${l}`,{defIds:t.defIds,idSuffix:o.current},{ref:n,className:p,...i},u)}function lr(n,e,t,l,a){return C.createElement(n.tag,{key:e,...Nr(n,t,a),...l},(Rr(n,t).children||[]).map((u,i)=>lr(u,`${e}-${n.tag}-${i}`,t,void 0,a)))}function Nr(n,e,t){const l={...n.attrs};t!=null&&t.colorChannel1&&l.fill==="colorChannel1"&&(l.fill=t.colorChannel1),n.tag==="mask"&&l.id&&(l.id=l.id+e.idSuffix),Object.entries(l).forEach(([u,i])=>{u==="mask"&&typeof i=="string"&&(l[u]=i.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:a}=e;return!a||a.length===0||(n.tag==="use"&&l["xlink:href"]&&(l["xlink:href"]=l["xlink:href"]+e.idSuffix),Object.entries(l).forEach(([u,i])=>{typeof i=="string"&&(l[u]=i.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),l}function Rr(n,e){var l;const{defIds:t}=e;return!t||t.length===0?n:n.tag==="defs"&&((l=n.children)!=null&&l.length)?{...n,children:n.children.map(a=>typeof a.attrs.id=="string"&&t&&t.includes(a.attrs.id)?{...a,attrs:{...a.attrs,id:a.attrs.id+e.idSuffix}}:a)}:n}function Mr(){return Math.random().toString(36).substring(2,8)}K.displayName="UniverIcon";const Vr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ar=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"bold-icon",ref:t,icon:Vr}))});ar.displayName="BoldIcon";const Or={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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"}}]},Ee=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"delete-icon",ref:t,icon:Or}))});Ee.displayName="DeleteIcon";const Ur={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},ur=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"increase-icon",ref:t,icon:Ur}))});ur.displayName="IncreaseIcon";const kr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"}}]},sr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"italic-icon",ref:t,icon:kr}))});sr.displayName="ItalicIcon";const Pr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},Ke=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"more-down-icon",ref:t,icon:Pr}))});Ke.displayName="MoreDownIcon";const Dr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]},ir=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"sequence-icon",ref:t,icon:Dr}))});ir.displayName="SequenceIcon";const Lr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z"}}]},cr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"strikethrough-icon",ref:t,icon:Lr}))});cr.displayName="StrikethroughIcon";const jr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z"}}]},or=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"underline-icon",ref:t,icon:jr}))});or.displayName="UnderlineIcon";const Ar={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z",fillRule:"evenodd",clipRule:"evenodd"}}]},dr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"font-color-double-icon",ref:t,icon:Ar}))});dr.displayName="FontColorDoubleIcon";const $r={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},vr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"paint-bucket-double-icon",ref:t,icon:$r}))});vr.displayName="PaintBucketDoubleIcon";const Fr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"colorChannel1",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",fillRule:"evenodd",clipRule:"evenodd"}}]},fe=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"slash-double-icon",ref:t,icon:Fr}))});fe.displayName="SlashDoubleIcon";const re=n=>{const{color:e,onChange:t,disable:l=!1,Icon:a=vr,className:u}=n,i=C.useMemo(()=>new s.ColorKit(e),[e]),p=()=>{const o={className:O.clsx("univer-fill-primary-600",l&&u),extend:{colorChannel1:i.isValid?e:""}};return c.jsx(a,{...o})};return l?p():c.jsx(O.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(O.ColorPicker,{value:e,onChange:t})}),children:c.jsx("span",{className:O.clsx("univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",u),children:p()})})},ae=n=>{var u,i,p,o,f;const e=n.rule;if(!e)return null;const t=C.useMemo(()=>{if(e.type===r.CFRuleType.colorScale){const d=e.config.map((b,S)=>({color:new s.ColorKit(b.color),value:S})),v=d.length-1;return new Array(5).fill("").map((b,S,m)=>S*v/(m.length-1)).map(b=>r.getColorScaleFromValue(d,b))}return null},[e]),l=C.useMemo(()=>{if(e.type===r.CFRuleType.iconSet)return e.config.map(d=>{const v=r.iconMap[d.iconType];return v&&v[Number(d.iconId)]})},[e]),a="univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";switch(e.type){case r.CFRuleType.dataBar:{const{isGradient:d}=e.config,v=d?`linear-gradient(to right, ${e.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,h=d?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||r.defaultDataBarNativeColor})`:e.config.nativeColor;return c.jsxs("div",{className:a,children:[c.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:h,borderColor:(u=e.config.nativeColor)!=null?u:r.defaultDataBarNativeColor}}),c.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:v,borderColor:(i=e.config.positiveColor)!=null?i:r.defaultDataBarPositiveColor}})]})}case r.CFRuleType.colorScale:return t&&c.jsx("div",{className:a,children:t.map((d,v)=>c.jsx("div",{className:"univer-h-full",style:{width:`${100/t.length}%`,background:d}},v))});case r.CFRuleType.iconSet:return l&&c.jsx("div",{className:a,children:l.map((d,v)=>d?c.jsx("img",{className:"univer-h-full",src:d,draggable:!1},v):c.jsx(fe,{},v))});case r.CFRuleType.highlightCell:{const{ul:d,st:v,it:h,bl:b,bg:S,cl:m}=e.style,E=(d==null?void 0:d.s)===s.BooleanNumber.TRUE,_=(v==null?void 0:v.s)===s.BooleanNumber.TRUE,N=h===s.BooleanNumber.TRUE,M=b===s.BooleanNumber.TRUE,R=(p=S==null?void 0:S.rgb)!=null?p:r.DEFAULT_BG_COLOR,g=(o=m==null?void 0:m.rgb)!=null?o:r.DEFAULT_FONT_COLOR,T={textDecoration:(f=`${E?"underline":""} ${_?"line-through":""}`.replace(/^ /,""))!=null?f:void 0,backgroundColor:R,color:g};return c.jsx("div",{className:O.clsx(a,{"univer-font-bold":M,"univer-italic":N}),style:T,children:"123"})}}},he=O.clsx("univer-mt-5 univer-px-1 univer-py-2 univer-rounded",O.borderClassName),te=(n,e)=>({label:e.t(`sheet.cf.valueType.${n}`),value:n}),Xe=n=>{var S;const{type:e,className:t,onChange:l,id:a,value:u}=n,i=j.useDependency(s.IUniverInstanceService),p=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=(S=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),f=C.useMemo(()=>String(u).startsWith("=")?String(u):"=",[u]),d=C.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]),v=C.useRef(null),[h,b]=C.useState(!1);return j.useSidebarClick(m=>{var _;((_=v.current)==null?void 0:_.isClickOutSide(m))&&b(!1)}),e===r.CFValueType.formula?c.jsx("div",{className:"univer-ml-1 univer-w-full",children:c.jsx(ve.FormulaEditor,{ref:v,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),initValue:f,unitId:p,subUnitId:o,isFocus:h,onChange:(m="")=>{l(m||"")},onFocus:()=>b(!0)})}):c.jsx(O.InputNumber,{className:t,value:Number(n.value)||0,onChange:m=>n.onChange(m||0),...d})},Br=n=>{var L;const{interceptorManager:e}=n,t=j.useDependency(s.LocaleService),l=((L=n.rule)==null?void 0:L.type)===r.CFRuleType.colorScale?n.rule:void 0,a=[te(r.CFValueType.num,t),te(r.CFValueType.percent,t),te(r.CFValueType.percentile,t),te(r.CFValueType.formula,t)],u=[te(r.CFValueType.min,t),...a],i=[te("none",t),...a],p=[te(r.CFValueType.max,t),...a],[o,f]=C.useState(()=>{var x;const y=r.CFValueType.min;return l&&((x=l.config[0])==null?void 0:x.value.type)||y}),[d,v]=C.useState(()=>{var x;const y="none";return!l||l.config.length!==3?y:((x=l.config[1])==null?void 0:x.value.type)||y}),[h,b]=C.useState(()=>{var x;const y=r.CFValueType.max;return l&&((x=l.config[l.config.length-1])==null?void 0:x.value.type)||y}),[S,m]=C.useState(()=>{if(!l)return 10;const x=l.config[0];return(x==null?void 0:x.value.value)===void 0?10:x==null?void 0:x.value.value}),[E,_]=C.useState(()=>{var $;if(!l||l.config.length!==3)return 50;const x=($=l.config[1])==null?void 0:$.value.value;return x===void 0?50:x}),[N,M]=C.useState(()=>{var $;if(!l)return 90;const x=($=l.config[l.config.length-1])==null?void 0:$.value.value;return x===void 0?90:x}),[R,g]=C.useState(()=>{var x;const y="#d0d9fb";return l&&((x=l.config[0])==null?void 0:x.color)||y}),[T,w]=C.useState(()=>{var x;const y="#7790f3";return!l||l.config.length!==3?y:((x=l.config[1])==null?void 0:x.color)||y}),[I,k]=C.useState(()=>{var x;const y="#2e55ef";return l&&((x=l.config[l.config.length-1])==null?void 0:x.color)||y}),V=C.useMemo(()=>y=>{const{minType:x,medianType:$,maxType:G,minValue:J,medianValue:Q,maxValue:oe,minColor:de,medianColor:A,maxColor:F}=y,H=[];return H.push({color:de,value:{type:x,value:J}}),$!=="none"&&H.push({color:A,value:{type:$,value:Q}}),H.push({color:F,value:{type:G,value:oe}}),{config:H.map((Z,z)=>({...Z,index:z})),type:r.CFRuleType.colorScale}},[]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return V({minType:o,medianType:d,maxType:h,minValue:S,medianValue:E,maxValue:N,minColor:R,medianColor:T,maxColor:I})}}),[V,o,d,h,S,E,N,R,T,I,e]);const P=y=>{n.onChange(V(y))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:V({minType:o,medianType:d,maxType:h,minValue:S,medianValue:E,maxValue:N,minColor:R,medianColor:T,maxColor:I})})}),c.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.min")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(O.Select,{className:"univer-flex-shrink-0",options:u,value:o,onChange:y=>{f(y);const x=r.createDefaultValueByValueType(y,10);m(x),P({minType:y,medianType:d,maxType:h,minValue:x,medianValue:E,maxValue:N,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(Xe,{id:"min",className:"univer-ml-1",value:S,type:o,onChange:y=>{m(y),P({minType:o,medianType:d,maxType:h,minValue:y,medianValue:E,maxValue:N,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(re,{className:"univer-ml-1",color:R,onChange:y=>{g(y),P({minType:o,medianType:d,maxType:h,minValue:S,medianValue:E,maxValue:N,minColor:y,medianColor:T,maxColor:I})}})]}),c.jsx("div",{className:"univer-text-gray-600dark:!univer-text-gray-200 univer-mt-3 univer-text-xs",children:t.t("sheet.cf.panel.medianValue")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(O.Select,{className:"univer-flex-shrink-0",options:i,value:d,onChange:y=>{v(y);const x=r.createDefaultValueByValueType(y,50);_(x),P({minType:o,medianType:y,maxType:h,minValue:S,medianValue:x,maxValue:N,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(Xe,{id:"median",className:"univer-ml-1",value:E,type:d,onChange:y=>{_(y),P({minType:o,medianType:d,maxType:h,minValue:S,medianValue:y,maxValue:N,minColor:R,medianColor:T,maxColor:I})}}),d!=="none"&&c.jsx(re,{className:"univer-ml-1",color:T,onChange:y=>{w(y),P({minType:o,medianType:d,maxType:h,minValue:S,medianValue:E,maxValue:N,minColor:R,medianColor:y,maxColor:I})}})]}),c.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.max")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(O.Select,{className:"univer-flex-shrink-0",options:p,value:h,onChange:y=>{b(y);const x=r.createDefaultValueByValueType(y,90);M(x),P({minType:o,medianType:d,maxType:y,minValue:S,medianValue:E,maxValue:x,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(Xe,{id:"max",className:"univer-ml-1",value:N,type:h,onChange:y=>{M(y),P({minType:o,medianType:d,maxType:h,minValue:S,medianValue:E,maxValue:y,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(re,{className:"univer-ml-1",color:I,onChange:y=>{k(y),P({minType:o,medianType:d,maxType:h,minValue:S,medianValue:E,maxValue:N,minColor:R,medianColor:T,maxColor:y})}})]})]})},ue=(n,e)=>({label:e.t(`sheet.cf.valueType.${n}`),value:n}),pr=n=>{var m;const{onChange:e,className:t,value:l,type:a,id:u,disabled:i=!1}=n,p=j.useDependency(s.IUniverInstanceService),o=p.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(m=p.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),d=C.useRef(null),[v,h]=C.useState(!1);j.useSidebarClick(E=>{var N;((N=d.current)==null?void 0:N.isClickOutSide(E))&&h(!1)});const b=C.useRef(l),S=C.useMemo(()=>[r.CFValueType.percentile,r.CFValueType.percent].includes(a)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[a]);if(a===r.CFValueType.formula){const E=String(b.current).startsWith("=")?String(b.current)||"":"=";return c.jsx("div",{className:"univer-ml-3 univer-w-full",children:c.jsx(ve.FormulaEditor,{ref:d,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),initValue:E,unitId:o,subUnitId:f,isFocus:v,onChange:(_="")=>{e(_||"")},onFocus:()=>h(!0)})})}return c.jsx(O.InputNumber,{className:t,value:Number(l)||0,disabled:i,onChange:E=>{e(E||0)},...S})},Hr=n=>{var L;const{interceptorManager:e}=n,t=j.useDependency(s.LocaleService),l=((L=n.rule)==null?void 0:L.type)===r.CFRuleType.dataBar?n.rule:void 0,[a,u]=C.useState(()=>{var x;return l&&(x=l.config)!=null&&x.isGradient?"1":"0"}),[i,p]=C.useState(()=>{var y;return l&&((y=l.config)==null?void 0:y.positiveColor)||r.defaultDataBarPositiveColor}),[o,f]=C.useState(()=>{var y;return l&&((y=l.config)==null?void 0:y.nativeColor)||r.defaultDataBarNativeColor}),d=[ue(r.CFValueType.num,t),ue(r.CFValueType.percent,t),ue(r.CFValueType.percentile,t),ue(r.CFValueType.formula,t)],v=[ue(r.CFValueType.min,t),...d],h=[ue(r.CFValueType.max,t),...d],[b,S]=C.useState(()=>{var x;const y=v[0].value;return l&&((x=l.config)==null?void 0:x.min.type)||y}),[m,E]=C.useState(()=>{var x;const y=h[0].value;return l&&((x=l.config)==null?void 0:x.max.type)||y}),[_,N]=C.useState(()=>{var $;if(!l)return 0;const x=(($=l.config)==null?void 0:$.min)||{};return x.type===r.CFValueType.formula?x.value||"=":x.value||0}),[M,R]=C.useState(()=>{var $;if(!l)return 100;const x=(($=l.config)==null?void 0:$.max)||{};return x.type===r.CFValueType.formula?x.value||"=":x.value===void 0?100:x.value}),[g,T]=C.useState(()=>l?l.isShowValue===void 0?!0:!!l.isShowValue:!0),w=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});C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return w({isGradient:a,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:g})}}),[a,_,b,M,m,i,o,e,g]);const I=y=>{n.onChange(w(y))},k=y=>{p(y),I({isGradient:a,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:y,nativeColor:o,isShowValue:g})},V=y=>{f(y),I({isGradient:a,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:y,isShowValue:g})},P=y=>d.map(x=>x.value).includes(y);return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:w({isGradient:a,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:g})})}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.fillType")}),c.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[c.jsxs(O.RadioGroup,{value:a,onChange:y=>{u(y),I({isGradient:y,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:g})},children:[c.jsx(O.Radio,{value:"0",children:c.jsx("span",{className:"univer-text-xs",children:t.t("sheet.cf.panel.pureColor")})}),c.jsx(O.Radio,{value:"1",children:c.jsx("span",{className:"univer-text-xs",children:t.t("sheet.cf.panel.gradient")})})]}),c.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{checked:!g,onChange:y=>{T(!y),I({isGradient:y,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:!y})}}),t.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.colorSet")}),c.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[c.jsxs("div",{className:"univer-flex univer-items-center",children:[c.jsx("div",{className:"univer-text-xs",children:t.t("sheet.cf.panel.native")}),c.jsx(re,{color:o,onChange:V})]}),c.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[c.jsx("div",{className:"univer-text-xs",children:t.t("sheet.cf.panel.positive")}),c.jsx(re,{color:i,onChange:k})]})]})]}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.min")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(O.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:v,value:b,onChange:y=>{S(y);const x=r.createDefaultValueByValueType(y,10);N(x),I({isGradient:a,minValue:x,minValueType:y,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:g})}}),c.jsx(pr,{id:"min",className:"univer-ml-3",disabled:!P(b),type:b,value:_,onChange:y=>{N(y||0),I({isGradient:a,minValue:y||0,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:g})}})]}),c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.max")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(O.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:h,value:m,onChange:y=>{E(y);const x=r.createDefaultValueByValueType(y,90);R(x),I({isGradient:a,minValue:_,minValueType:b,maxValue:x,maxValueType:y,positiveColor:i,nativeColor:o,isShowValue:g})}}),c.jsx(pr,{className:"univer-ml-3",disabled:!P(m),id:"max",type:m,value:M,onChange:y=>{R(y||0),I({isGradient:a,minValue:_,minValueType:b,maxValue:y||0,maxValueType:m,positiveColor:i,nativeColor:o,isShowValue:g})}})]})]})]})},Ne=n=>[s.BooleanNumber.FALSE,void 0].includes(n)?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE,Re=n=>n!==s.BooleanNumber.FALSE,Je=n=>{const{style:e,onChange:t,className:l}=n,[a,u]=C.useState(()=>{if(e!=null&&e.bl)return e.bl}),[i,p]=C.useState(()=>{if(e!=null&&e.it)return e.it}),[o,f]=C.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[d,v]=C.useState(()=>{if(e!=null&&e.st)return e.st.s}),[h,b]=C.useState(()=>{var N;const _="#2f56ef";return(N=e==null?void 0:e.cl)!=null&&N.rgb?e.cl.rgb:_}),[S,m]=C.useState(()=>{var N;const _="#e8ecfc";return(N=e==null?void 0:e.bg)!=null&&N.rgb?e.bg.rgb:_});C.useEffect(()=>{const _={bl:a,it:i};h!==void 0&&(_.cl={rgb:h}),S!==void 0&&(_.bg={rgb:S}),d!==void 0&&(_.st={s:d}),o!==void 0&&(_.ul={s:o}),t(r.removeUndefinedAttr(_))},[a,i,o,d,h,S]);const E="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return c.jsxs("div",{className:O.clsx("univer-my-2.5 univer-flex univer-justify-between",l),children:[c.jsx("div",{className:O.clsx(E,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(a||s.BooleanNumber.FALSE)}),onClick:()=>u(Ne(a)),children:c.jsx(ar,{})}),c.jsx("div",{className:O.clsx(E,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(i||s.BooleanNumber.FALSE)}),onClick:()=>p(Ne(i)),children:c.jsx(sr,{})}),c.jsx("div",{className:O.clsx(E,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(o||s.BooleanNumber.FALSE)}),onClick:()=>f(Ne(o)),children:c.jsx(or,{})}),c.jsx("div",{className:O.clsx(E,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(d||s.BooleanNumber.FALSE)}),onClick:()=>v(Ne(d)),children:c.jsx(cr,{})}),c.jsx(re,{color:h,onChange:b,Icon:dr}),c.jsx(re,{color:S,onChange:m})]})},Wr=n=>{var R;const{onChange:e,interceptorManager:t}=n,l=j.useDependency(s.LocaleService),u=j.useDependency(s.IUniverInstanceService).getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),i=u.getActiveSheet(),p=((R=n.rule)==null?void 0:R.type)===r.CFRuleType.highlightCell?n.rule:void 0,o=C.useRef(null),[f,d]=C.useState(!1),v=C.useRef(null),[h,b]=C.useState({}),[S,m]=C.useState(()=>(p==null?void 0:p.subType)===r.CFSubRuleType.formula?p.value:"="),[E,_]=C.useState(void 0),N=g=>({style:g.style,value:S,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});C.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return N({style:h})}}),[h,S,t]),C.useEffect(()=>t.intercept(t.getInterceptPoints().beforeSubmit,{handler:(T,w,I)=>E||S.length===1||!S.startsWith("=")?(_(l.t("sheet.cf.errorMessage.formulaError")),!1):I(T)}),[E,S]);const M=g=>{e(N(g))};return j.useSidebarClick(g=>{var w;((w=v.current)==null?void 0:w.isClickOutSide(g))&&d(!1)}),c.jsxs("div",{ref:o,children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:l.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:"univer-mt-3",children:c.jsx(ve.FormulaEditor,{ref:v,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),errorText:E,isFocus:f,initValue:S,unitId:u.getUnitId(),subUnitId:i==null?void 0:i.getSheetId(),onFocus:()=>{d(!0)},onChange:g=>{m(g),M({style:h})},onVerify:(g,T)=>{!g||T.length===1?_(l.t("sheet.cf.errorMessage.formulaError")):_(void 0)}})}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:N({style:h})})}),c.jsx(Je,{style:p==null?void 0:p.style,className:"univer-mt-3",onChange:g=>{b(g),M({style:g})}})]})},Me=n=>c.jsxs("div",{className:"univer-relative",children:[c.jsx("div",{className:"univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",children:n.errorText}),n.children]}),B=(n,e)=>({label:e.t(`sheet.cf.operator.${n}`),value:n}),qr=n=>{const{type:e,operator:t,onChange:l,value:a,interceptorManager:u}=n,i=j.useDependency(s.LocaleService),[p,o]=C.useState(()=>typeof a=="number"?a:0),[f,d]=C.useState(""),[v,h]=C.useState(()=>typeof a=="string"?a:""),[b,S]=C.useState(""),[m,E]=C.useState(()=>Array.isArray(a)?a[0]===void 0?0:a[0]:0),[_,N]=C.useState(""),[M,R]=C.useState(()=>Array.isArray(a)?a[1]===void 0?100:a[1]:100),[g,T]=C.useState("");switch(C.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(t)&&l(v);break}case r.CFSubRuleType.number:{[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(t)&&l(p),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(t)&&l([m,M]);break}}},[e]),C.useEffect(()=>{const w=u.intercept(u.getInterceptPoints().beforeSubmit,{handler:(I,k,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(t))return v?V(I):(S(i.t("sheet.cf.errorMessage.notBlank")),!1)}return V(I)}});return()=>{w()}},[e,p,v,t]),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(t)){const w=I=>{h(I),l(I)};return c.jsx("div",{className:"univer-mt-3",children:c.jsx(Me,{errorText:b,children:c.jsx(O.Input,{value:v,onChange:I=>{S(""),w(I)}})})})}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(t)){const w=I=>{o(I||0),l(I||0),d("")};return c.jsx("div",{className:"univer-mt-3",children:c.jsx(Me,{errorText:f,children:c.jsx(O.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:p,onChange:w})})})}if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(t)){const w=k=>{E(k||0),l([k||0,M]),N("")},I=k=>{R(k||0),l([m,k||0]),T("")};return c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(Me,{errorText:_,children:c.jsx(O.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:m,onChange:w})}),c.jsx(Me,{errorText:g,children:c.jsx(O.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:M,onChange:I})})]})}}}return null},fr=(n,e)=>{switch(n){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)]}},hr=n=>{var R;const{interceptorManager:e,onChange:t}=n,l=j.useDependency(s.LocaleService),a=((R=n.rule)==null?void 0:R.type)===r.CFRuleType.highlightCell?n.rule:void 0,[u,i]=C.useState(()=>{const g=r.CFSubRuleType.text;return a&&a.subType||g}),p=[{value:r.CFSubRuleType.text,label:l.t("sheet.cf.subRuleType.text")},{value:r.CFSubRuleType.number,label:l.t("sheet.cf.subRuleType.number")},{value:r.CFSubRuleType.timePeriod,label:l.t("sheet.cf.subRuleType.timePeriod")},{value:r.CFSubRuleType.duplicateValues,label:l.t("sheet.cf.subRuleType.duplicateValues")},{value:r.CFSubRuleType.uniqueValues,label:l.t("sheet.cf.subRuleType.uniqueValues")}],o=C.useMemo(()=>fr(u,l),[u]),[f,d]=C.useState(()=>{const g=o?o[0].value:void 0;return a&&a.operator||g}),[v,h]=C.useState(()=>{var w;return a?(w=a.value)!=null?w:r.createDefaultValue(a.subType,a.operator):""}),[b,S]=C.useState({}),m=C.useMemo(()=>g=>{var T,w,I,k,V,P,L,y,x,$,G,J,Q,oe,de;switch(g.subType||u){case r.CFSubRuleType.text:{if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(f))return{type:r.CFRuleType.highlightCell,subType:(T=g.subType)!=null?T:u,operator:(w=g.operator)!=null?w:f,style:(I=g.style)!=null?I:b,value:(k=g.value)!=null?k:v};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(f))return{type:r.CFRuleType.highlightCell,subType:(V=g.subType)!=null?V:u,operator:(P=g.operator)!=null?P:f,style:(L=g.style)!=null?L:b,value:(y=g.value)!=null?y:v};if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(f))return{type:r.CFRuleType.highlightCell,subType:(x=g.subType)!=null?x:u,operator:($=g.operator)!=null?$:f,style:(G=g.style)!=null?G:b,value:(J=g.value)!=null?J:v};break}}return{type:r.CFRuleType.highlightCell,subType:(Q=g.subType)!=null?Q:u,operator:(oe=g.operator)!=null?oe:f,style:(de=g.style)!=null?de:b}},[u,f,v,b]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return m({})}}),[m,e]),C.useEffect(()=>{p.some(g=>g.value===u)||i(p[0].value)},[p]);const E=g=>{const T=g,w=fr(T,l),I=w&&w[0].value;i(T),d(I),I&&h(r.createDefaultValue(T,I)),t(m({subType:T,operator:I}))},_=g=>{const T=g;d(T),t(m({operator:T}))},N=g=>{h(g),t(m({value:g}))},M=C.useMemo(()=>`${u}_${f}_${Math.random()}`,[u,f]);return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:l.t("sheet.cf.panel.styleRule")}),c.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[c.jsx(O.Select,{className:"univer-mt-3 univer-w-full",onChange:E,value:u,options:p}),(o==null?void 0:o.length)&&c.jsx(O.Select,{className:"univer-mt-3 univer-w-full",onChange:_,value:f||"",options:o})]}),c.jsx(qr,{value:v,interceptorManager:e,type:u,operator:f,rule:a,onChange:N},M),c.jsx("div",{className:he,children:c.jsx(ae,{rule:m({})})}),c.jsx(Je,{style:a==null?void 0:a.style,className:"univer-ml-1",onChange:g=>{S(g),t(m({style:g}))}})]})},gr=(n,e)=>(r.iconMap[n]||[])[Number(e)]||"",Gr=n=>{var d;const{error:e,type:t,onChange:l}=n,a=j.useDependency(s.IUniverInstanceService),u=a.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),i=(d=a.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:d.getSheetId(),p=C.useRef(null),[o,f]=C.useState(!1);return j.useSidebarClick(v=>{var b;((b=p.current)==null?void 0:b.isClickOutSide(v))&&f(!1)}),c.jsx("div",{className:"univer-relative",children:t!==r.CFValueType.formula?c.jsxs(c.Fragment,{children:[c.jsx(O.InputNumber,{className:O.clsx({"univer-border-red-500":e}),value:Number(n.value)||0,onChange:v=>l(v!=null?v:0)}),e&&c.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:e})]}):c.jsx("div",{className:"univer-w-full",children:c.jsx(ve.FormulaEditor,{ref:p,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),initValue:String(n.value),unitId:u,subUnitId:i,isFocus:o,onChange:(v="")=>{l(v||"")},onFocus:()=>f(!0)})})})},yr=(n,e,t)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(t.length-1-e)*10},iconType:n,iconId:String(e)}),Zr=C.forwardRef((n,e)=>{const{onClick:t}=n,l=j.useDependency(s.LocaleService),a=u=>{t(u)};return c.jsx("div",{ref:e,className:"univer-w-80",children:r.iconGroup.map((u,i)=>c.jsxs("div",{className:"univer-mb-3",children:[c.jsx("div",{className:"univer-mb-1 univer-text-sm",children:l.t(u.title)}),c.jsx("div",{className:"univer-flex univer-flex-wrap",children:u.group.map(p=>c.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{a(p.name)},children:c.jsx("a",{className:"univer-cursor-pointer univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:p.list.map((o,f)=>c.jsx("img",{className:"univer-size-5",src:o,draggable:!1},f))})},p.name))})]},i))})}),zr=n=>{const{onClick:e}=n,t=C.useMemo(()=>{const a=[];for(const u in r.iconMap){const i=r.iconMap[u],p=u;i.forEach((o,f)=>{a.push({iconType:p,base64:o,iconId:String(f)})})}return a},[]),l=a=>{e(a.iconType,a.iconId)};return c.jsxs("div",{children:[c.jsxs("div",{className:"univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",onClick:()=>l({iconType:r.EMPTY_ICON_TYPE,iconId:""}),children:[c.jsx(fe,{className:"univer-size-5"}),c.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),c.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:t.map(a=>c.jsx("div",{className:"univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:c.jsx("img",{className:"univer-size-5",src:a.base64,draggable:!1,onClick:()=>l(a)})},`${a.iconType}_${a.iconId}`))})]})},Yr=n=>{const{onChange:e,configList:t,errorMap:l={}}=n,a=j.useDependency(s.LocaleService),u=[{label:a.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThan}`),value:r.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThanOrEqual}`),value:r.CFNumberOperator.greaterThanOrEqual}],i=[{label:a.t(`sheet.cf.valueType.${r.CFValueType.num}`),value:r.CFValueType.num},{label:a.t(`sheet.cf.valueType.${r.CFValueType.percent}`),value:r.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${r.CFValueType.percentile}`),value:r.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${r.CFValueType.formula}`),value:r.CFValueType.formula}],p=(v,h)=>{e([String(h),"value","value"],v)},o=(v,h)=>{e([String(h),"operator"],v);const b=r.createDefaultValue(r.CFSubRuleType.number,v);p(b,h)},f=(v,h)=>{e([String(h),"value","type"],v);const b=t[h],S=r.createDefaultValue(r.CFSubRuleType.number,b.operator);p(S,h)};return C.useMemo(()=>t.map((v,h)=>{const b=l[h],S=gr(v.iconType,v.iconId),m=h===t.length-1,E=h===0,_=t[h-1],N=(_==null?void 0:_.value.type)===r.CFValueType.formula?a.t("sheet.cf.valueType.formula"):_==null?void 0:_.value.value,M=(R,g)=>{const T={...v,iconId:g,iconType:R};e([String(h)],T)};return c.jsxs("div",{className:h?"univer-mt-6":"univer-mt-3",children:[c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[c.jsxs("div",{className:"univer-w-[45%]",children:[a.t("sheet.cf.iconSet.icon"),h+1]}),c.jsx("div",{className:"univer-w-[45%]",children:c.jsxs(c.Fragment,{children:[!E&&!m&&a.t("sheet.cf.iconSet.rule"),!E&&!m&&c.jsxs("span",{className:"univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",children:[a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${r.getOppositeOperator(_.operator)}`),N,m?"":` ${a.t("sheet.cf.iconSet.and")} `]})]})})]}),c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[c.jsx("div",{className:"univer-flex univer-items-center",children:c.jsx(O.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(zr,{onClick:M,iconId:v.iconId,iconType:v.iconType})}),children:c.jsxs("div",{className:O.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200",O.borderClassName),children:[S?c.jsx("img",{src:S,className:"univer-size-4",draggable:!1}):c.jsx(fe,{className:"univer-size-4"}),c.jsx(Ke,{})]})})}),m?c.jsxs("div",{className:"univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[a.t("sheet.cf.iconSet.rule"),c.jsxs("span",{className:"univer-font-medium",children:[a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${r.getOppositeOperator(_.operator)}`),N,m?"":` ${a.t("sheet.cf.iconSet.and")} `]})]}):c.jsx(O.Select,{options:u,value:v.operator,onChange:R=>{o(R,h)}})]}),m?c.jsx("div",{}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[c.jsx("div",{children:a.t("sheet.cf.iconSet.type")}),c.jsx("div",{children:a.t("sheet.cf.iconSet.value")})]}),c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[c.jsx(O.Select,{options:i,value:v.value.type,onChange:R=>{f(R,h)}}),c.jsx(Gr,{id:h,type:v.value.type,error:b,value:v.value.value||"",onChange:R=>{p(R,h)}})]})]})]},h)}),[t,l])},Kr=n=>{var R;const{interceptorManager:e}=n,t=((R=n.rule)==null?void 0:R.type)===r.CFRuleType.iconSet?n.rule:void 0,l=j.useDependency(s.LocaleService),[a,u]=C.useState({}),[i,p]=C.useState(()=>{const g=Object.keys(r.iconMap)[0];if(t&&t.config.length){const T=t.config[0].iconType;if(!t.config.some(I=>I.iconType!==T))return T}return g}),[o,f]=C.useState(()=>{if(t&&t.config.length)return s.Tools.deepClone(t==null?void 0:t.config);const g=r.iconMap[i]||[];return new Array(g.length).fill("").map((T,w,I)=>w===I.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:i,iconId:String(w)}:yr(i,w,I))}),[d,v]=C.useState(()=>t?!!t.isShowValue:!0),h=C.useMemo(()=>{const g=o.map(T=>gr(T.iconType,T.iconId));return c.jsx("div",{className:"univer-flex univer-items-center",children:g.map((T,w)=>T?c.jsx("img",{className:"univer-size-5",src:T},w):c.jsx(fe,{className:"univer-size-5"},w))})},[o]),b=g=>{if(g.reduce((w,I,k)=>w.preType&&!w.result||g.length-1===k?w:I.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:w.preType?{result:w.preType===I.value.type,preType:I.value.type}:{result:!0,preType:I.value.type},{result:!0,preType:""}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(g[0].value.type)){const w={};return g.forEach((I,k,V)=>{if(k-1<0||k===V.length-1)return;const L=g[k-1],y=r.getOppositeOperator(L.operator);r.compareWithNumber({operator:y,value:L.value.value},I.value.value)||(w[k]=`${l.t(`sheet.cf.form.${y}`,String(L.value.value))} `)}),w}return{}},S=(g,T)=>{s.get(o,g)!==T&&(s.set(o,g,T),f([...o]),u(b(o)))},m=g=>{p(g);const T=r.iconMap[g]||[],w=new Array(T.length).fill("").map((I,k,V)=>yr(g,k,V));f(w),u(b(w))};C.useEffect(()=>{const g=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:d,config:o}}});return()=>{g()}},[d,o,e]),C.useEffect(()=>{const g=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{g()}},[d,o,e,a]);const E=()=>{const g=o.map(T=>({...T}));o.forEach((T,w)=>{const I=o.length-1-w,k=g[I];T.iconId=k.iconId,T.iconType=k.iconType}),f([...o])},_=j.useDependency(j.ILayoutService),[N,M]=C.useState();return j.useScrollYOverContainer(N,_.rootContainerElement),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:l.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:"univer-mt-3",children:c.jsx(O.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(Zr,{ref:g=>{!N&&g&&M(g)},iconType:i,onClick:m})}),children:c.jsxs("div",{className:O.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600",O.borderClassName),children:[h,c.jsx(Ke,{})]})})}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{onChange:E}),l.t("sheet.cf.iconSet.reverseIconOrder")]}),c.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{checked:!d,onChange:g=>{v(!g)}}),l.t("sheet.cf.iconSet.onlyShowIcon")]})]}),c.jsx(Yr,{errorMap:a,onChange:S,configList:o})]})},Xr=n=>{var E;const{onChange:e,interceptorManager:t}=n,l=j.useDependency(s.LocaleService),a=((E=n.rule)==null?void 0:E.type)===r.CFRuleType.highlightCell?n.rule:void 0,u=[{label:l.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:l.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:l.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:l.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[i,p]=C.useState(()=>{const _=u[0].value,N=a==null?void 0:a.type;if(!a)return _;switch(N){case r.CFRuleType.highlightCell:switch(a.subType){case r.CFSubRuleType.average:return[r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":_;case r.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return _}),[o,f]=C.useState(()=>{const N=a==null?void 0:a.type;if(!a)return 10;switch(N){case r.CFRuleType.highlightCell:switch(a.subType){case r.CFSubRuleType.rank:return a.value||10}}return 10}),[d,v]=C.useState(()=>{const N=a==null?void 0:a.type;if(!a)return!1;switch(N){case r.CFRuleType.highlightCell:switch(a.subType){case r.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[h,b]=C.useState({}),S=_=>{const{type:N,isPercent:M,value:R,style:g}=_;if(N==="isNotBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:M,isBottom:!1,value:R,style:g};if(N==="isBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:M,isBottom:!0,value:R,style:g};if(N==="greaterThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:g};if(N==="lessThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:g}};C.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return S({type:i,isPercent:d,value:o,style:h})}}),[i,d,o,h,t]);const m=_=>{e(S(_))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:l.t("sheet.cf.panel.styleRule")}),c.jsx(O.Select,{className:"univer-mt-3 univer-w-full",value:i,options:u,onChange:_=>{p(_),m({type:_,isPercent:d,value:o,style:h})}}),["isNotBottom","isBottom"].includes(i)&&c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(O.InputNumber,{min:1,max:1e3,value:o,onChange:_=>{const N=_||0;f(N),m({type:i,isPercent:d,value:N,style:h})}}),c.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{checked:d,onChange:_=>{v(!!_),m({type:i,isPercent:!!_,value:o,style:h})}}),l.t("sheet.cf.valueType.percent")]})]}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:S({type:i,isPercent:d,value:o,style:h})})}),c.jsx(Je,{style:a==null?void 0:a.style,className:"univer-mt-3",onChange:_=>{b(_),m({type:i,isPercent:d,value:o,style:_})}})]})},Jr=s.createInterceptorKey("beforeSubmit"),Qr=s.createInterceptorKey("submit"),Cr=n=>n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),mr=n=>{var e;return(e=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},et=n=>{var w,I,k;const e=j.useDependency(s.LocaleService),t=j.useDependency(s.ICommandService),l=j.useDependency(s.IUniverInstanceService),a=j.useDependency(r.ConditionalFormattingRuleModel),u=j.useDependency(U.SheetsSelectionsService),i=Cr(l),p=mr(l),[o,f]=C.useState(void 0),d=C.useRef((I=(w=n.rule)==null?void 0:w.ranges)!=null?I:[]),v=C.useMemo(()=>{var P,L,y;let V=(P=n.rule)==null?void 0:P.ranges;return V!=null&&V.length||(V=(y=(L=u.getCurrentSelections())==null?void 0:L.map(x=>x.range))!=null?y:[]),d.current=V,V!=null&&V.length?V.map(x=>{const $=$e.serializeRange(x);return $==="NaN"?"":$}).filter(x=>!!x).join(","):""},[n.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"}],[b,S]=C.useState(()=>{var L,y;const V=(L=n.rule)==null?void 0:L.rule.type,P=h[0].value;if(!V)return P;switch(V){case r.CFRuleType.highlightCell:{switch((y=n.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 P}),m=C.useRef(void 0),E=C.useMemo(()=>new s.InterceptorManager({beforeSubmit:Jr,submit:Qr}),[]),_=C.useMemo(()=>{switch(b){case"1":return hr;case"2":return Xr;case"3":return Hr;case"4":return Br;case"5":return Wr;case"6":return Kr;default:return hr}},[b]);C.useEffect(()=>{const V=t.onCommandExecuted(P=>{if(P.id===U.RemoveSheetMutation.id){const L=P.params;L.subUnitId===p&&L.unitId===i&&n.onCancel()}P.id===U.SetWorksheetActiveOperation.id&&n.onCancel()});return()=>V.dispose()},[]);const N=V=>{m.current=V},M=V=>{const P=V.split(",").filter(L=>!!L).map($e.deserializeRangeWithSheet).map(L=>L.range);d.current=P},R=()=>{if(o)return;const P=(()=>{const y=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!y)throw new Error("No active sheet found");return d.current.map(G=>U.setEndForRange(G,y.getRowCount(),y.getColumnCount())).filter(G=>!(Number.isNaN(G.startRow)||Number.isNaN(G.startColumn)))})();if(E.fetchThroughInterceptors(E.getInterceptPoints().beforeSubmit)(!0,null)){const y=E.fetchThroughInterceptors(E.getInterceptPoints().submit)(null,null);if(y){const x=Cr(l),$=mr(l);if(!x||!$)throw new Error("No active sheet found");let G={};n.rule&&n.rule.cfId?(G={...n.rule,ranges:P,rule:y},t.executeCommand(r.SetCfCommand.id,{unitId:x,subUnitId:$,rule:G}),n.onCancel()):(G={cfId:a.createCfId(x,$),ranges:P,rule:y,stopIfTrue:!1},t.executeCommand(r.AddCfCommand.id,{unitId:x,subUnitId:$,rule:G}),n.onCancel())}}},g=()=>{n.onCancel()},T=(V,P)=>{V?P.length<1?f(e.t("sheet.cf.errorMessage.rangeError")):f(void 0):f(e.t("sheet.cf.errorMessage.rangeError"))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.range")}),c.jsxs("div",{className:"univer-mt-4",children:[c.jsx(ve.RangeSelector,{unitId:i,subUnitId:p,initialValue:v,onChange:(V,P)=>M(P),onVerify:T}),o&&c.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:o})]}),c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.styleType")}),c.jsx(O.Select,{className:"univer-mt-4 univer-w-full",value:b,options:h,onChange:V=>S(V)}),c.jsx(_,{interceptorManager:E,rule:(k=n.rule)==null?void 0:k.rule,onChange:N}),c.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[c.jsx(O.Button,{onClick:g,children:e.t("sheet.cf.panel.cancel")}),c.jsx(O.Button,{className:"univer-ml-3",variant:"primary",onClick:R,children:e.t("sheet.cf.panel.submit")})]})]})};var rt=Object.getOwnPropertyDescriptor,tt=(n,e,t,l)=>{for(var a=l>1?void 0:l?rt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},nt=(n,e)=>(t,l)=>e(t,l,n);let se=class extends s.Disposable{constructor(e){super();ee(this,"_initLocal",()=>{});ee(this,"_findReplaceIndex",e=>{const t=/\{([^}]+)?\}/g,l=[];let a=t.exec(e);for(;a;)l.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=t.exec(e);return l});this._localeService=e,this._initLocal()}tWithReactNode(e,...t){const l=this._localeService.getLocales(),a=e.split("."),u=l&&this._localeService.resolveKeyPath(l,a);if(typeof u=="string"){const i=[];return this._findReplaceIndex(u).forEach((p,o,f)=>{const d=f[o-1]||{endIndex:-1};if(d.endIndex+1<p.startIndex){const v=u.slice(d.endIndex+1,p.startIndex);v&&i.push(v)}if(t[p.key]&&i.push(t[p.key]),o===f.length-1){const v=u.slice(p.endIndex+1);v&&i.push(v)}}),i}return[]}};se=tt([nt(0,s.Inject(s.LocaleService))],se);const lt=(n,e)=>{const t=n.rule;switch(t.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(t.subType){case r.CFSubRuleType.average:{const l=t.operator;return e.t(`sheet.cf.preview.describe.${l}`,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 l=t.operator;return e.t(`sheet.cf.preview.describe.${l}`,...Array.isArray(t.value)?t.value.map(a=>String(a)):[String(t.value||"")])}case r.CFSubRuleType.text:{const l=t.operator;return e.t(`sheet.cf.preview.describe.${l}`,t.value||"")}case r.CFSubRuleType.timePeriod:{const l=t.operator;return e.t(`sheet.cf.preview.describe.${l}`)}case r.CFSubRuleType.rank:return t.isPercent?t.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(t.value)):e.t("sheet.cf.preview.describe.topNPercent",String(t.value)):t.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(t.value)):e.t("sheet.cf.preview.describe.topN",String(t.value));case r.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let br=0;const at=n=>{const{onClick:e}=n,t=j.useDependency(r.ConditionalFormattingRuleModel),l=j.useDependency(s.IUniverInstanceService),a=j.useDependency(U.SheetsSelectionsService),u=j.useDependency(s.ICommandService),i=j.useDependency(s.LocaleService),p=j.useDependency(s.Injector),o=j.useDependency(j.ISidebarService),f=j.useDependency(se),d=j.useObservable(()=>l.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),v=d.getUnitId(),h=d.getActiveSheet();if(!h)throw new Error("No active sheet found");const b=h.getSheetId(),[S,m]=C.useState([]),[E,_]=C.useState("2"),[N,M]=C.useState(0),[R,g]=C.useState(-1),[T,w]=C.useState(br),I=C.useRef(null),k=[{label:i.t("sheet.cf.panel.workSheet"),value:"2"},{label:i.t("sheet.cf.panel.selectedRange"),value:"1"}],V=()=>{const A=t.getSubunitRules(v,b);if(!A||!A.length)return[];if(E==="1"){const F=a.getCurrentLastSelection();if(!F)return[];const H=F.range;return A.filter(Z=>Z.ranges.some(z=>s.Rectangle.intersects(z,H)))}else if(E==="2")return[...A];return[]},[P,L]=C.useState(V);W.useHighlightRange(S),C.useEffect(()=>{const A=u.onCommandExecuted(F=>{F.id===U.SetWorksheetActiveOperation.id&&M(Math.random())});return()=>A.dispose()}),C.useEffect(()=>{L(V)},[E,N,v,b]),C.useEffect(()=>{if(E==="2")return;const A=new X.Observable(F=>{const H=[U.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],q=u.onCommandExecuted(Z=>{const{id:z,params:ne}=Z,le=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId();H.includes(z)&&ne.unitId===le&&F.next(null)});return()=>q.dispose()}).pipe(X.debounceTime(16)).subscribe(()=>{L(V)});return()=>{A.unsubscribe()}},[l,E,v,b]),C.useEffect(()=>{const A=t.$ruleChange.subscribe(()=>{M(Math.random())});return()=>A.unsubscribe()},[t]),C.useEffect(()=>{const A=()=>{var Z,z;const q=Math.max(0,((z=(Z=I.current)==null?void 0:Z.getBoundingClientRect().width)!=null?z:0)-8);return br=q,q},H=new X.Observable(q=>{const Z=o.getContainer();if(Z){let z=setTimeout(()=>{q.next(void 0)},150);const ne=()=>{z&&clearTimeout(z),z=null},le=Ae=>{Ae.propertyName==="width"&&(ne(),q.next(void 0))};return Z.addEventListener("transitionend",le),()=>{ne(),Z.removeEventListener("transitionend",le)}}}).pipe(X.debounceTime(16)).subscribe(()=>{w(A())});return()=>{H.unsubscribe()}},[]);const y=A=>{var q;const F=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),H=(q=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:q.getSheetId();if(!F||!H)throw new Error("No active sheet found");u.executeCommand(r.DeleteCfCommand.id,{unitId:F,subUnitId:H,cfId:A.cfId})},x=(A,F)=>{g(F.y)},$=(A,F,H)=>{var Ae;g(-1);const q=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),Z=(Ae=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:Ae.getSheetId();if(!q||!Z)throw new Error("No active sheet found");const z=$t=>{const Ft=P.length;return Math.min(Ft-1,Math.max(0,$t))},ne=P[z(F.y)].cfId,le=P[z(H.y)].cfId;ne!==le&&u.executeCommand(r.MoveCfCommand.id,{unitId:q,subUnitId:Z,start:{id:ne,type:"self"},end:{id:le,type:H.y>F.y?"after":"before"}})},G=()=>{n.onCreate()},J=()=>{E==="2"?u.executeCommand(r.ClearWorksheetCfCommand.id):E==="1"&&P.map(F=>({unitId:v,subUnitId:b,cfId:F.cfId})).forEach(F=>{u.executeCommand(r.DeleteCfCommand.id,F)})},Q=C.useMemo(()=>{const A=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET),F=A.getActiveSheet();return P.filter(H=>{const q=H.ranges;return U.checkRangesEditablePermission(p,A.getUnitId(),F.getSheetId(),q)})},[P]),oe=Q.map((A,F)=>({i:A.cfId,x:0,w:12,y:F,h:1,isResizable:!1})),de=C.useMemo(()=>{const A=l.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET),F=A.getActiveSheet();return P.every(H=>{const q=H.ranges;return U.checkRangesEditablePermission(p,A.getUnitId(),F.getSheetId(),q)})},[P]);return c.jsxs("div",{children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm",children:[c.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:f.tWithReactNode("sheet.cf.panel.managerRuleSelect",c.jsx(O.Select,{className:"univer-w-36",options:k,value:E,onChange:A=>{_(A)}})).map((A,F)=>c.jsx("span",{children:A},F))}),c.jsxs("div",{className:"univer-flex univer-justify-end",children:[c.jsx(O.Tooltip,{title:i.t("sheet.cf.panel.createRule"),placement:"bottom",children:c.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:G,children:c.jsx(ur,{})})}),P.length&&de?c.jsx(O.Tooltip,{title:i.t("sheet.cf.panel.clear"),placement:"bottom",children:c.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:J,children:c.jsx(Ee,{className:"univer-text-red-500"})})}):c.jsx("div",{children:c.jsx(Ee,{className:"univer-text-gray-300"})})]})]}),c.jsx("div",{ref:I,children:T>0&&c.jsx(O.ReactGridLayout,{className:"[&_.react-grid-item]:univer-transition-none [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200",draggableHandle:".draggableHandle",layout:oe,cols:12,rowHeight:60,width:T,margin:[0,10],onDragStop:$,onDragStart:x,children:Q==null?void 0:Q.map((A,F)=>c.jsx("div",{children:c.jsxs("div",{className:O.clsx("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-bg-gray-100 dark:!univer-bg-gray-700":R===F}),onMouseMove:()=>{A.ranges!==S&&m(A.ranges)},onMouseLeave:()=>m([]),onClick:()=>{e(A)},children:[c.jsx("div",{className:O.clsx("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex","draggableHandle"),onClick:H=>H.stopPropagation(),children:c.jsx(ir,{})}),c.jsxs("div",{className:"univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",children:[c.jsx("div",{className:"univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:lt(A,i)}),c.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:A.ranges.map(H=>$e.serializeRange(H)).join(",")})]}),c.jsx("div",{children:c.jsx(ae,{rule:A.rule})}),c.jsx("div",{className:O.clsx("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded group-hover:univer-flex hover:univer-bg-gray-200",{"univer-flex univer-items-center univer-justify-center":R===F}),onClick:H=>{H.stopPropagation(),y(A),m([])},children:c.jsx(Ee,{})})]})},`${A.cfId}`))})})]})},ut=n=>{const[e,t]=C.useState(n.rule),[l,a]=C.useState(!!n.rule),u=()=>{a(!0)},i=()=>{a(!1),t(void 0)},p=o=>{t(o),a(!0)};return c.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",children:l?c.jsx(et,{onCancel:i,rule:e}):c.jsx(at,{onClick:p,onCreate:u})})};var st=Object.getOwnPropertyDescriptor,it=(n,e,t,l)=>{for(var a=l>1?void 0:l?st(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},ge=(n,e)=>(t,l)=>e(t,l,n);const Ve="sheet.conditional.formatting.panel";let ye=class extends s.Disposable{constructor(e,t,l,a,u){super();ee(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=t,this._componentManager=l,this._sidebarService=a,this._localeService=u,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).subscribe(i=>{var p;i||(p=this._sidebarDisposable)==null||p.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(i=>{i.id===Ve&&(i.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const t={id:Ve,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Ve,rule:e,key:s.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(t)}_initPanel(){this.disposeWithMe(this._componentManager.register(Ve,ut))}};ye=it([ge(0,s.IUniverInstanceService),ge(1,s.Inject(s.Injector)),ge(2,s.Inject(j.ComponentManager)),ge(3,s.Inject(j.ISidebarService)),ge(4,s.Inject(s.LocaleService))],ye);var Y=(n=>(n[n.createRule=1]="createRule",n[n.viewRule=2]="viewRule",n[n.highlightCell=3]="highlightCell",n[n.rank=4]="rank",n[n.formula=5]="formula",n[n.colorScale=6]="colorScale",n[n.dataBar=7]="dataBar",n[n.icon=8]="icon",n[n.clearRangeRules=9]="clearRangeRules",n[n.clearWorkSheetRules=10]="clearWorkSheetRules",n))(Y||{});const Ce={id:"sheet.operation.open.conditional.formatting.panel",type:s.CommandType.OPERATION,handler:(n,e)=>{var p;const t=n.get(ye),l=n.get(U.SheetsSelectionsService),a=n.get(s.ICommandService),u=((p=l.getCurrentSelections())==null?void 0:p.map(o=>o.range))||[];switch(e.value){case 3:{t.openPanel({...r.createDefaultRule(),ranges:u});break}case 4:{const o={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};t.openPanel(o);break}case 5:{const o={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:"="}};t.openPanel(o);break}case 6:{const o={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.colorScale,config:[]}};t.openPanel(o);break}case 7:{const o={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};t.openPanel(o);break}case 8:{const o={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};t.openPanel(o);break}case 2:{t.openPanel();break}case 1:{t.openPanel({...r.createDefaultRule(),ranges:u});break}case 9:{a.executeCommand(r.ClearRangeCfCommand.id,{ranges:u});break}case 10:{a.executeCommand(r.ClearWorksheetCfCommand.id);break}}return!0}};var ct=Object.getOwnPropertyDescriptor,ot=(n,e,t,l)=>{for(var a=l>1?void 0:l?ct(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},me=(n,e)=>(t,l)=>e(t,l,n);D.ConditionalFormattingClearController=class extends s.Disposable{constructor(e,t,l,a,u){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=l,this._selectionManagerService=a,this._conditionalFormattingRuleModel=u,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var u;const t=[],l=[],a={redos:t,undos:l};if([U.ClearSelectionFormatCommand.id,U.ClearSelectionAllCommand.id].includes(e.id)){const i=(u=this._selectionManagerService.getCurrentSelections())==null?void 0:u.map(S=>S.range);if(!i)return a;const p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),o=p.getActiveSheet();if(!o)return a;const f=p.getUnitId(),d=o.getSheetId(),v=this._conditionalFormattingRuleModel.getSubunitRules(f,d);if(!v||!v.length)return a;const{redos:h,undos:b}=Ir(this._injector,v,i,f,d);t.push(...h),l.push(...b)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:l})=>{const a=[],u=[],i={redos:a,undos:u};if(!l||!l.length)return i;const p=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!p||!p.length)return i;const{redos:o,undos:f}=Ir(this._injector,p,l,e,t);return a.push(...o),u.push(...f),i}}))}},D.ConditionalFormattingClearController=ot([me(0,s.Inject(s.Injector)),me(1,s.Inject(s.IUniverInstanceService)),me(2,s.Inject(U.SheetInterceptorService)),me(3,s.Inject(U.SheetsSelectionsService)),me(4,s.Inject(r.ConditionalFormattingRuleModel))],D.ConditionalFormattingClearController);function Ir(n,e,t,l,a){const u=[],i=[];return e.filter(p=>t.some(o=>p.ranges.some(f=>s.Rectangle.getIntersects(f,o)))).forEach(p=>{const f=new U.RangeMergeUtil().add(...p.ranges).subtract(...t).merge();if(f.length){const d={id:r.SetConditionalRuleMutation.id,params:{unitId:l,subUnitId:a,rule:{...p,ranges:f}}},v=r.setConditionalRuleMutationUndoFactory(n,d.params);u.push(d),i.push(...v)}else{const d={id:r.DeleteConditionalRuleMutation.id,params:{unitId:l,subUnitId:a,cfId:p.cfId}},v=r.DeleteConditionalRuleMutationUndoFactory(n,d.params);u.push(d),i.push(...v)}}),{redos:u,undos:i}}var dt=Object.getOwnPropertyDescriptor,vt=(n,e,t,l)=>{for(var a=l>1?void 0:l?dt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},be=(n,e)=>(t,l)=>e(t,l,n);let Ie=class extends s.Disposable{constructor(e,t,l,a,u){super();ee(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=l,this._conditionalFormattingViewModel=a,this._univerInstanceService=u,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,t,l)=>this._collectConditionalRule(e,t,l),onPasteCells:(e,t,l,a)=>{const{copyType:u=W.COPY_TYPE.COPY,pasteType:i}=a,{range:p}=e||{},{range:o}=t;return this._generateConditionalFormattingMutations(o,{copyType:u,pasteType:i,copyRange:p})}}))}_collectConditionalRule(e,t,l){const a=new s.ObjectMatrix,u={};this._copyInfo={matrix:a,info:{unitId:e,subUnitId:t,cfMap:u}};const i=this._injector.invoke(d=>U.rangeToDiscreteRange(l,d,e,t));if(!i)return;const{rows:p,cols:o}=i,f=new Set;p.forEach((d,v)=>{o.forEach((h,b)=>{const S=this._conditionalFormattingViewModel.getCellCfs(e,t,d,h);S&&(S.forEach(m=>f.add(m.cfId)),a.setValue(v,b,S.map(m=>m.cfId)))})}),f.forEach(d=>{const v=this._conditionalFormattingRuleModel.getRule(e,t,d);v&&(u[d]=v.rule)})}_generateConditionalFormattingMutations(e,t){const l=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),a=l.getActiveSheet(),u=l.getUnitId();if(!a)return{redos:[],undos:[]};const i=a.getSheetId();if(t.copyType===W.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!t.copyRange)return{redos:[],undos:[]};if(![W.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,W.PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE,W.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER].includes(t.pasteType))return{redos:[],undos:[]};const{ranges:[o,f],mapFunc:d}=W.virtualizeDiscreteRanges([t.copyRange,e]),v=W.getRepeatRange(o,f,!0),h={};s.Range.foreach(f,(g,T)=>{const{row:w,col:I}=d(g,T),k=this._conditionalFormattingViewModel.getCellCfs(u,i,w,I);k&&k.forEach(V=>{if(!h[V.cfId]){const P=new s.ObjectMatrix;h[V.cfId]=P;const L=this._conditionalFormattingRuleModel.getRule(u,i,V.cfId);L==null||L.ranges.forEach(y=>{s.Range.foreach(y,(x,$)=>{P.setValue(x,$,1)})})}h[V.cfId].realDeleteValue(w,I)})});const{matrix:b,info:S}=this._copyInfo,m=[];let E=this._conditionalFormattingRuleModel.createCfId(u,i);const _={},N=g=>{if(_[g])return _[g];const T=S==null?void 0:S.cfMap[g],w=[...this._conditionalFormattingRuleModel.getSubunitRules(u,i)||[],...m].find(I=>s.Tools.diffValue(I.rule,T));if(w)return _[g]=w,w;{const I={rule:T,cfId:E,ranges:[],stopIfTrue:!1};return _[g]=I,m.push(I),E=`${Number(E)+1}`,I}};v.forEach(g=>{b&&b.forValue((T,w,I)=>{const k=s.Rectangle.getPositionRange({startRow:T,endRow:T,startColumn:w,endColumn:w},g.startRange),{row:V,col:P}=d(k.startRow,k.startColumn);I.forEach(L=>{if(!h[L]){const y=N(L),x=new s.ObjectMatrix;h[L]=x,y.ranges.forEach($=>{s.Range.foreach($,(G,J)=>{x.setValue(G,J,1)})})}h[L].setValue(V,P,1)})})});const M=[],R=[];for(const g in h){const T=h[g],w=U.findAllRectangle(U.createTopMatrixFromMatrix(T));if(!w.length){const I={unitId:u,subUnitId:i,cfId:g};M.push({id:r.DeleteConditionalRuleMutation.id,params:I}),R.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}if(m.some(I=>I.cfId===g)){const I=N(g),k={unitId:u,subUnitId:i,rule:{...I,ranges:w}};M.push({id:r.AddConditionalRuleMutation.id,params:k}),R.push(r.AddConditionalRuleMutationUndoFactory(this._injector,k))}else{const I=this._conditionalFormattingRuleModel.getRule(u,i,g);if(!I)continue;const k={unitId:u,subUnitId:i,rule:{...I,ranges:w}};M.push({id:r.SetConditionalRuleMutation.id,params:k}),R.push(...r.setConditionalRuleMutationUndoFactory(this._injector,k))}}return{redos:M,undos:R}}};Ie=vt([be(0,s.Inject(W.ISheetClipboardService)),be(1,s.Inject(r.ConditionalFormattingRuleModel)),be(2,s.Inject(s.Injector)),be(3,s.Inject(r.ConditionalFormattingViewModel)),be(4,s.Inject(s.IUniverInstanceService))],Ie);var pt=Object.getOwnPropertyDescriptor,ft=(n,e,t,l)=>{for(var a=l>1?void 0:l?pt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},Qe=(n,e)=>(t,l)=>e(t,l,n);let Se=class extends s.Disposable{constructor(n,e,t){super(),this._localeService=n,this._commandService=e,this._sheetPermissionCheckController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(n=>{if(n.id===r.AddCfCommand.id){const{unitId:e,subUnitId:t,rule:{ranges:l}}=n.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[U.WorkbookEditablePermission],rangeTypes:[U.RangeProtectionPermissionEditPoint],worksheetTypes:[U.WorksheetEditPermission,U.WorksheetSetCellStylePermission]},l,e,t)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))}}))}};Se=ft([Qe(0,s.Inject(s.LocaleService)),Qe(1,s.ICommandService),Qe(2,s.Inject(U.SheetPermissionCheckController))],Se);var ht=Object.getOwnPropertyDescriptor,gt=(n,e,t,l)=>{for(var a=l>1?void 0:l?ht(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},Oe=(n,e)=>(t,l)=>e(t,l,n);let Te=class extends s.Disposable{constructor(n,e,t,l){super(),this._conditionalFormattingRuleModel=n,this._univerInstanceService=e,this._injector=t,this._refRangeService=l,this._initRefRange()}_initRefRange(){const n=new Map,e=(l,a,u)=>`${l}_${a}_${u}`,t=(l,a,u)=>{const i=o=>{const f=[...u.ranges],d=f.map(h=>U.handleDefaultRangeChangeWithEffectRefCommands(h,o)).filter(h=>!!h);if(r.isRangesEqual(d,f))return{redos:[],undos:[]};if(d.length){const h={unitId:l,subUnitId:a,rule:{...u,ranges:d}},b=[{id:r.SetConditionalRuleMutation.id,params:h}],S=r.setConditionalRuleMutationUndoFactory(this._injector,h);return{redos:b,undos:S}}else{const h={unitId:l,subUnitId:a,cfId:u.cfId},b=[{id:r.DeleteConditionalRuleMutation.id,params:h}],S=r.DeleteConditionalRuleMutationUndoFactory(this._injector,h);return{redos:b,undos:S}}},p=[];u.ranges.forEach(o=>{const f=this._refRangeService.registerRefRange(o,i);p.push(()=>f.dispose())}),n.set(e(l,a,u.cfId),()=>p.forEach(o=>o()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(l=>{const{unitId:a,subUnitId:u,rule:i}=l,p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),o=p.getActiveSheet();if(!(l.unitId!==p.getUnitId()||l.subUnitId!==(o==null?void 0:o.getSheetId())))switch(l.type){case"add":{t(l.unitId,l.subUnitId,l.rule);break}case"delete":{const f=n.get(e(a,u,i.cfId));f&&f();break}case"set":{const f=n.get(e(a,u,i.cfId));f&&f(),t(l.unitId,l.subUnitId,l.rule)}}})),this.disposeWithMe(s.toDisposable(()=>{n.forEach(l=>{l()}),n.clear()}))}};Te=gt([Oe(0,s.Inject(r.ConditionalFormattingRuleModel)),Oe(1,s.Inject(s.IUniverInstanceService)),Oe(2,s.Inject(s.Injector)),Oe(3,s.Inject(U.RefRangeService))],Te);var yt=Object.getOwnPropertyDescriptor,Ct=(n,e,t,l)=>{for(var a=l>1?void 0:l?yt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},ie=(n,e)=>(t,l)=>e(t,l,n);let _e=class extends s.Disposable{constructor(e,t,l,a,u,i){super();ee(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=l,this._renderManagerService=a,this._conditionalFormattingViewModel=u,this._conditionalFormattingRuleModel=i,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var t,l,a;const e=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId();(t=this._renderManagerService.getRenderById(e))==null||t.with(W.SheetSkeletonManagerService).reCalculate(),(a=(l=this._renderManagerService.getRenderById(e))==null?void 0:l.mainComponent)==null||a.makeDirty()}_initSkeleton(){this.disposeWithMe(X.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(pe.bufferTime(16),pe.filter(e=>!!e.length),pe.filter(e=>{const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const l=t.getActiveSheet();return l?e.filter(a=>a.unitId===t.getUnitId()&&a.subUnitId===l.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(U.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(e,t,l)=>{const a=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!a)return l(e);const u=t.workbook.getStyles(),i=(typeof(e==null?void 0:e.s)=="string"?u.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},p=e===t.rawData?{...t.rawData}:e;if(a.style){const o={...i,...a.style};Object.assign(p,{s:o})}return p.fontRenderExtension||(p.fontRenderExtension={},a.isShowValue!==void 0&&(p.fontRenderExtension.isSkip=!a.isShowValue)),a.dataBar&&(p.dataBar=a.dataBar),a.iconSet&&(p.iconSet=a.iconSet,p.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),l(p)},priority:10}))}};_e=Ct([ie(0,s.Inject(U.SheetInterceptorService)),ie(1,s.Inject(r.ConditionalFormattingService)),ie(2,s.Inject(s.IUniverInstanceService)),ie(3,s.Inject(nr.IRenderManagerService)),ie(4,s.Inject(r.ConditionalFormattingViewModel)),ie(5,s.Inject(r.ConditionalFormattingRuleModel))],_e);const Sr="sheets-conditional-formatting-ui.config",Ue={};var mt=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,It=(n,e,t)=>e in n?mt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,St=(n,e,t,l)=>{for(var a=l>1?void 0:l?bt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},er=(n,e)=>(t,l)=>e(t,l,n),Tr=(n,e,t)=>It(n,typeof e!="symbol"?e+"":e,t);D.UniverSheetsConditionalFormattingMobileUIPlugin=class extends s.Plugin{constructor(e=Ue,t,l,a){super(),this._config=e,this._injector=t,this._commandService=l,this._configService=a;const{menu:u,...i}=s.merge({},Ue,this._config);u&&this._configService.setConfig("menu",u,{merge:!0}),this._configService.setConfig(Sr,i),this._initCommand(),this._injector.add([_e]),this._injector.add([Te]),this._injector.add([Ie]),this._injector.add([Se]),this._injector.add([se])}_initCommand(){[Fe,Be,He,We,qe,Ge,Ze,ze,Ye,Ce].forEach(e=>{this._commandService.registerCommand(e)})}},Tr(D.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),Tr(D.UniverSheetsConditionalFormattingMobileUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),D.UniverSheetsConditionalFormattingMobileUIPlugin=St([s.DependentOn(r.UniverSheetsConditionalFormattingPlugin),er(1,s.Inject(s.Injector)),er(2,s.Inject(s.ICommandService)),er(3,s.IConfigService)],D.UniverSheetsConditionalFormattingMobileUIPlugin);var Tt=Object.getOwnPropertyDescriptor,_t=(n,e,t,l)=>{for(var a=l>1?void 0:l?Tt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},we=(n,e)=>(t,l)=>e(t,l,n);let ke=class extends s.Disposable{constructor(n,e,t,l,a){super(),this._injector=n,this._univerInstanceService=e,this._autoFillService=t,this._conditionalFormattingRuleModel=l,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const n=()=>({redos:[],undos:[]}),e=(a,u,i,p,o)=>{var b;const f=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(b=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId();if(!f||!d)return;const v={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},h={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row};s.Range.foreach(i,(S,m)=>{const E=s.Rectangle.getPositionRange({startRow:S,startColumn:m,endColumn:m,endRow:S},v),_=s.Rectangle.getPositionRange({startRow:S,startColumn:m,endColumn:m,endRow:S},h),{row:N,col:M}=o(E.startRow,E.startColumn),R=this._conditionalFormattingViewModel.getCellCfs(f,d,N,M),{row:g,col:T}=o(_.startRow,_.startColumn),w=this._conditionalFormattingViewModel.getCellCfs(f,d,g,T);w&&w.forEach(I=>{let k=p.get(I.cfId);if(!p.get(I.cfId)){const V=this._conditionalFormattingRuleModel.getRule(f,d,I.cfId);if(!V)return;k=new s.ObjectMatrix,V.ranges.forEach(P=>{s.Range.foreach(P,(L,y)=>{k.setValue(L,y,1)})}),p.set(I.cfId,k)}k.realDeleteValue(g,T)}),R&&R.forEach(I=>{let k=p.get(I.cfId);if(!p.get(I.cfId)){const V=this._conditionalFormattingRuleModel.getRule(f,d,I.cfId);if(!V)return;k=new s.ObjectMatrix,V.ranges.forEach(P=>{s.Range.foreach(P,(L,y)=>{k.setValue(L,y,1)})}),p.set(I.cfId,k)}k.setValue(g,T,1)})})},t=(a,u)=>{var _,N,M;const i=(_=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:_.getUnitId(),p=(M=(N=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:N.getActiveSheet())==null?void 0:M.getSheetId(),o=new Map,f=[],d=[];if(!i||!p)return n();const v=W.virtualizeDiscreteRanges([a,u]),[h,b]=v.ranges,{mapFunc:S}=v,m={row:h.startRow,col:h.startColumn};return W.getAutoFillRepeatRange(h,b).forEach(R=>{e(m,R.repeatStartCell,R.relativeRange,o,S)}),o.forEach((R,g)=>{const T=this._conditionalFormattingRuleModel.getRule(i,p,g);if(!T)return;const w=U.findAllRectangle(U.createTopMatrixFromMatrix(R));if(w.length){const I={unitId:i,subUnitId:p,rule:{...T,ranges:w}};f.push({id:r.SetConditionalRuleMutation.id,params:I}),d.push(...r.setConditionalRuleMutationUndoFactory(this._injector,I))}else{const I={unitId:i,subUnitId:p,cfId:T.cfId};f.push({id:r.DeleteConditionalRuleMutation.id,params:I}),d.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}}),{undos:d,redos:f}},l={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,u,i)=>{if(i===W.APPLY_TYPE.COPY||i===W.APPLY_TYPE.ONLY_FORMAT||i===W.APPLY_TYPE.SERIES){const{source:p,target:o}=a;return t(p,o)}return n()}};this.disposeWithMe(this._autoFillService.addHook(l))}};ke=_t([we(0,s.Inject(s.Injector)),we(1,s.Inject(s.IUniverInstanceService)),we(2,s.Inject(W.IAutoFillService)),we(3,s.Inject(r.ConditionalFormattingRuleModel)),we(4,s.Inject(r.ConditionalFormattingViewModel))],ke);var wt=Object.getOwnPropertyDescriptor,xt=(n,e,t,l)=>{for(var a=l>1?void 0:l?wt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},_r=(n,e)=>(t,l)=>e(t,l,n);let Pe=class extends s.Disposable{constructor(n,e){super(),this._sheetInterceptorService=n,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(s.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(U.AFTER_CELL_EDIT,{handler:(n,e,t)=>{var i,p,o;n||t(n);const l=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),a=(i=l==null?void 0:l.style)!=null?i:{},u=Object.keys(a);if(n!=null&&n.p)return(o=(p=n.p.body)==null?void 0:p.textRuns)==null||o.forEach(f=>{f.ts&&u.forEach(d=>{var v;(v=f.ts)==null||delete v[d]})}),t(n);{const f={...(typeof(n==null?void 0:n.s)=="string"?e.workbook.getStyles().get(n.s):n==null?void 0:n.s)||{}};u.forEach(v=>{delete f[v]});const d={...n,s:{...f}};return t(d)}}})))}};Pe=xt([_r(0,s.Inject(U.SheetInterceptorService)),_r(1,s.Inject(r.ConditionalFormattingService))],Pe);const wr=[U.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],xe=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:Y.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:Y.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:Y.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:Y.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:Y.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:Y.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:Y.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:Y.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:Y.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:Y.clearWorkSheetRules}],Et=n=>{const e=n.get(U.SheetsSelectionsService),t=n.get(s.ICommandService),l=n.get(s.IUniverInstanceService),a=n.get(r.ConditionalFormattingRuleModel),u=new X.Observable(o=>X.merge(e.selectionMoveEnd$,e.selectionSet$,new X.Observable(f=>{const d=t.onCommandExecuted(v=>{var m;const{id:h,params:b}=v,S=(m=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:m.getUnitId();wr.includes(h)&&b.unitId===S&&f.next(null)});return()=>d.dispose()})).pipe(pe.debounceTime(16)).subscribe(()=>{var m;const f=((m=e.getCurrentSelections())==null?void 0:m.map(E=>E.range))||[],d=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!d)return;const v=d.getActiveSheet();if(!v)return;const S=(a.getSubunitRules(d.getUnitId(),v.getSheetId())||[]).filter(E=>E.ranges.some(_=>f.some(N=>s.Rectangle.intersects(N,_)))).map(E=>E.ranges).every(E=>U.checkRangesEditablePermission(n,d.getUnitId(),v.getSheetId(),E));o.next(S)})),i=new X.Observable(o=>new X.Observable(f=>{const d=t.onCommandExecuted(v=>{var m;const{id:h,params:b}=v,S=(m=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:m.getUnitId();wr.includes(h)&&b.unitId===S&&f.next(null)});return()=>d.dispose()}).pipe(pe.debounceTime(16)).subscribe(()=>{const f=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!f)return;const d=f.getActiveSheet();if(!d)return;const v=a.getSubunitRules(f.getUnitId(),d.getSheetId())||[];if(!v.length)return o.next(!1),!1;const h=v.map(b=>b.ranges).every(b=>U.checkRangesEditablePermission(n,f.getUnitId(),d.getSheetId(),b));o.next(h)})),p=new X.Observable(o=>{u.subscribe(f=>{const d=xe.find(v=>v.value===Y.clearRangeRules);d&&(d.disabled=!f,o.next(xe))}),i.subscribe(f=>{const d=xe.find(v=>v.value===Y.clearWorkSheetRules);d&&(d.disabled=!f,o.next(xe))}),o.next(xe)});return{id:Ce.id,type:j.MenuItemType.SELECTOR,icon:"ConditionsDoubleIcon",tooltip:"sheet.cf.title",selections:p,hidden$:j.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET),disabled$:W.getCurrentRangeDisable$(n,{workbookTypes:[U.WorkbookEditablePermission],worksheetTypes:[U.WorksheetSetCellStylePermission,U.WorksheetEditPermission],rangeTypes:[U.RangeProtectionPermissionEditPoint]})}},Nt={[j.RibbonDataGroup.RULES]:{[Ce.id]:{order:1,menuItemFactory:Et}}};var Rt=Object.getOwnPropertyDescriptor,Mt=(n,e,t,l)=>{for(var a=l>1?void 0:l?Rt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},xr=(n,e)=>(t,l)=>e(t,l,n);let De=class extends s.Disposable{constructor(e,t){super();ee(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=t,this._menuManagerService.mergeMenu(Nt)}};De=Mt([xr(0,s.Inject(s.Injector)),xr(1,j.IMenuManagerService)],De);var Vt=Object.getOwnPropertyDescriptor,Ot=(n,e,t,l)=>{for(var a=l>1?void 0:l?Vt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},ce=(n,e)=>(t,l)=>e(t,l,n);const Ut=(n,e)=>{const t=d=>d.endRow-d.startRow+1,l=d=>d.endColumn-d.startColumn+1,a=t(e)%t(n),u=l(e)%l(n),i=Math.floor(t(e)/t(n)),p=Math.floor(l(e)/l(n)),o=[],f={startRow:0,endRow:t(n)-1,startColumn:0,endColumn:l(n)-1};if(t(e)===1&&l(e)===1){const d={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return o.push({repeatRelativeRange:f,startRange:d}),o}for(let d=0;d<i+(a?.1:0);d++)for(let v=0;v<p+(u?.1:0);v++){const h=t(n)*d,b=l(n)*v,S={startRow:h+e.startRow,endRow:h+e.startRow,startColumn:b+e.startColumn,endColumn:b+e.startColumn};let m=f;d===i&&a&&(m={...m},m.endRow=m.endRow-(t(n)-a)),v===p&&u&&(m={...m},m.endColumn=m.endColumn-(l(n)-u)),o.push({repeatRelativeRange:m,startRange:S})}return o};let Le=class extends s.Disposable{constructor(e,t,l,a,u,i){super();ee(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=t,this._formatPainterService=l,this._sheetsSelectionsService=a,this._conditionalFormattingRuleModel=u,this._conditionalFormattingViewModel=i,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),t=(u,i,p,o,f)=>{const{unitId:d,subUnitId:v}=this._painterConfig,{targetUnitId:h,targetSubUnitId:b}=f,S={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row},m={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};s.Range.foreach(p,(E,_)=>{const N=s.Rectangle.getPositionRange({startRow:E,startColumn:_,endColumn:_,endRow:E},S),M=s.Rectangle.getPositionRange({startRow:E,startColumn:_,endColumn:_,endRow:E},m),R=this._conditionalFormattingViewModel.getCellCfs(d,v,N.startRow,N.startColumn),g=this._conditionalFormattingViewModel.getCellCfs(h,b,M.startRow,M.startColumn);g&&g.forEach(T=>{let w=o.get(T.cfId);if(!o.get(T.cfId)){const I=this._conditionalFormattingRuleModel.getRule(h,b,T.cfId);if(!I)return;w=new s.ObjectMatrix,I.ranges.forEach(k=>{s.Range.foreach(k,(V,P)=>{w.setValue(V,P,1)})}),o.set(T.cfId,w)}w.realDeleteValue(M.startRow,M.startColumn)}),R&&R.forEach(T=>{const w=o.get(T.cfId);w&&w.setValue(M.startRow,M.startColumn,1)})})},l=(u,i,p)=>{var N;const{range:o,unitId:f,subUnitId:d}=this._painterConfig,v=u!==f||d!==i,h=new Map,b=[],S=[];if(!u||!i||!f||!d)return e();const m=(N=this._conditionalFormattingRuleModel.getSubunitRules(f,d))!=null?N:[];m==null||m.forEach(M=>{const{ranges:R,cfId:g}=M;if(R.some(T=>s.Rectangle.intersects(o,T))){const T=new s.ObjectMatrix;v||R.forEach(w=>{s.Range.foreach(w,(I,k)=>{T.setValue(I,k,1)})}),h.set(g,T)}});const E={row:o.startRow,col:o.startColumn};return Ut(o,p).forEach(M=>{t(E,{row:M.startRange.startRow,col:M.startRange.startColumn},M.repeatRelativeRange,h,{targetUnitId:u,targetSubUnitId:i})}),h.forEach((M,R)=>{if(v){const g=this._conditionalFormattingRuleModel.getRule(u,i,R),T=U.findAllRectangle(U.createTopMatrixFromMatrix(M));if(g)if(T.length){const w={unitId:u,subUnitId:i,rule:{...g,ranges:T}};b.push({id:r.SetConditionalRuleMutation.id,params:w}),S.push(...r.setConditionalRuleMutationUndoFactory(this._injector,w))}else{const w={unitId:u,subUnitId:i,cfId:g.cfId};b.push({id:r.DeleteConditionalRuleMutation.id,params:w}),S.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}else if(T.length){const w=this._conditionalFormattingRuleModel.getRule(f,d,R);if(w){const I={unitId:u,subUnitId:i,rule:{...s.Tools.deepClone(w),cfId:this._conditionalFormattingRuleModel.createCfId(u,i),ranges:T}};b.push({id:r.AddConditionalRuleMutation.id,params:I}),S.push(r.AddConditionalRuleMutationUndoFactory(this._injector,I))}}}else{const g=this._conditionalFormattingRuleModel.getRule(f,d,R);if(!g)return;const T=U.findAllRectangle(U.createTopMatrixFromMatrix(M));if(T.length){const w={unitId:f,subUnitId:d,rule:{...g,ranges:T}};b.push({id:r.SetConditionalRuleMutation.id,params:w}),S.push(...r.setConditionalRuleMutationUndoFactory(this._injector,w))}else{const w={unitId:f,subUnitId:d,cfId:g.cfId};b.push({id:r.DeleteConditionalRuleMutation.id,params:w}),S.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}}}),{undos:S,redos:b}},a={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:u=>{var i,p,o;switch(u){case W.FormatPainterStatus.INFINITE:case W.FormatPainterStatus.ONCE:{const f=(i=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:i.getUnitId(),d=(o=(p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getActiveSheet())==null?void 0:o.getSheetId(),v=this._sheetsSelectionsService.getCurrentLastSelection(),h=v==null?void 0:v.range;f&&d&&h&&(this._painterConfig={unitId:f,subUnitId:d,range:h});break}case W.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(u,i,p)=>this._painterConfig?l(u,i,p):{redos:[],undos:[]}};this._formatPainterService.addHook(a)}};Le=Ot([ce(0,s.Inject(s.Injector)),ce(1,s.Inject(s.IUniverInstanceService)),ce(2,s.Inject(W.IFormatPainterService)),ce(3,s.Inject(U.SheetsSelectionsService)),ce(4,s.Inject(r.ConditionalFormattingRuleModel)),ce(5,s.Inject(r.ConditionalFormattingViewModel))],Le);var kt=Object.getOwnPropertyDescriptor,Pt=(n,e,t,l)=>{for(var a=l>1?void 0:l?kt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},rr=(n,e)=>(t,l)=>e(t,l,n);let je=class extends s.Disposable{constructor(n,e,t){super(),this._conditionalFormattingViewModel=n,this._univerInstanceService=e,this._renderManagerService=t,this._init()}_init(){const n=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),e=t=>{const l=t.getUnitId(),a=this._renderManagerService.getRenderById(l);if(!a)return;const u=a.with(W.SheetSkeletonManagerService);this.disposeWithMe(u.currentSkeleton$.subscribe(i=>{if(i){const p=i.skeleton.rowColumnSegment,o=p.endColumn-p.startColumn+1,d=(p.endRow-p.startRow+1)*o*9,v=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,d);this._conditionalFormattingViewModel.setCacheLength(v)}}))};n&&e(n),this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{t&&e(t)})}};je=Pt([rr(0,s.Inject(r.ConditionalFormattingViewModel)),rr(1,s.IUniverInstanceService),rr(2,nr.IRenderManagerService)],je);var Dt=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,jt=(n,e,t)=>e in n?Dt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,At=(n,e,t,l)=>{for(var a=l>1?void 0:l?Lt(e,t):e,u=n.length-1,i;u>=0;u--)(i=n[u])&&(a=i(a)||a);return a},tr=(n,e)=>(t,l)=>e(t,l,n),Er=(n,e,t)=>jt(n,typeof e!="symbol"?e+"":e,t);D.UniverSheetsConditionalFormattingUIPlugin=class extends s.Plugin{constructor(e=Ue,t,l,a){super(),this._config=e,this._injector=t,this._commandService=l,this._configService=a;const{menu:u,...i}=s.merge({},Ue,this._config);u&&this._configService.setConfig("menu",u,{merge:!0}),this._configService.setConfig(Sr,i),this._initCommand()}onStarting(){s.registerDependencies(this._injector,[[_e],[Te],[Ie],[ke],[Se],[ye],[De],[se],[Pe],[D.ConditionalFormattingClearController],[Le],[je]]),s.touchDependencies(this._injector,[[_e]])}onReady(){s.touchDependencies(this._injector,[[De],[ye]])}onRendered(){s.touchDependencies(this._injector,[[ke],[D.ConditionalFormattingClearController],[Ie],[Pe],[se],[Le],[Se],[Te],[je]])}_initCommand(){[Fe,Be,He,We,qe,Ge,Ze,ze,Ye,Ce].forEach(e=>{this._commandService.registerCommand(e)})}},Er(D.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),Er(D.UniverSheetsConditionalFormattingUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),D.UniverSheetsConditionalFormattingUIPlugin=At([s.DependentOn(r.UniverSheetsConditionalFormattingPlugin),tr(1,s.Inject(s.Injector)),tr(2,s.Inject(s.ICommandService)),tr(3,s.IConfigService)],D.UniverSheetsConditionalFormattingUIPlugin),D.AddAverageCfCommand=Fe,D.AddColorScaleConditionalRuleCommand=Be,D.AddDataBarConditionalRuleCommand=He,D.AddDuplicateValuesCfCommand=We,D.AddNumberCfCommand=qe,D.AddRankCfCommand=Ge,D.AddTextCfCommand=Ze,D.AddTimePeriodCfCommand=ze,D.AddUniqueValuesCfCommand=Ye,D.OpenConditionalFormattingOperator=Ce,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
|
|
10
|
+
(function(D,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-conditional-formatting"),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/sheets-formula"),require("@univerjs/engine-render"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-conditional-formatting","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-formula-ui","@univerjs/sheets-ui","rxjs","@univerjs/sheets-formula","@univerjs/engine-render","rxjs/operators"],i):(D=typeof globalThis<"u"?globalThis:D||self,i(D.UniverSheetsConditionalFormattingUi={},D.UniverCore,D.UniverSheets,D.UniverSheetsConditionalFormatting,D.UniverUi,D.React,D.React,D.UniverDesign,D.UniverEngineFormula,D.UniverSheetsFormulaUi,D.UniverSheetsUi,D.rxjs,D.UniverSheetsFormula,D.UniverEngineRender,D.rxjs.operators))})(this,(function(D,i,U,r,j,c,C,O,Ae,ve,W,X,nr,lr,pe){"use strict";var Ht=Object.defineProperty;var Wt=(D,i,U)=>i in D?Ht(D,i,{enumerable:!0,configurable:!0,writable:!0,value:U}):D[i]=U;var ee=(D,i,U)=>Wt(D,typeof i!="symbol"?i+"":i,U);const $e={type:i.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u}=e,s=a.get(r.ConditionalFormattingRuleModel),v=a.get(i.ICommandService),d=a.get(i.IUniverInstanceService),h=U.getSheetCommandTarget(d);if(!h)return!1;const{unitId:o,subUnitId:p}=h,g=s.createCfId(o,p),b={ranges:t,cfId:g,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:u,style:n}};return v.executeCommand(r.AddConditionalRuleMutation.id,{unitId:o,subUnitId:p,rule:b})}},Fe={type:i.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,config:n,stopIfTrue:l}=e,u=a.get(r.ConditionalFormattingRuleModel),s=a.get(i.ICommandService),v=a.get(i.IUniverInstanceService),d=U.getSheetCommandTarget(v);if(!d)return!1;const{unitId:h,subUnitId:o}=d,p=u.createCfId(h,o),g={ranges:t,cfId:p,stopIfTrue:!!l,rule:{type:r.CFRuleType.colorScale,config:n}};return s.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:o,rule:g})}},Be={type:i.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,min:n,max:l,nativeColor:u,positiveColor:s,isGradient:v,stopIfTrue:d,isShowValue:h}=e,o=a.get(r.ConditionalFormattingRuleModel),p=a.get(i.IUniverInstanceService),g=U.getSheetCommandTarget(p);if(!g)return!1;const{unitId:b,subUnitId:I}=g,m=a.get(i.ICommandService),N=o.createCfId(b,I),_={ranges:t,cfId:N,stopIfTrue:!!d,rule:{type:r.CFRuleType.dataBar,isShowValue:h,config:{min:n,max:l,nativeColor:u,positiveColor:s,isGradient:v}}};return m.executeCommand(r.AddConditionalRuleMutation.id,{unitId:b,subUnitId:I,rule:_})}},He={type:i.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l}=e,u=a.get(r.ConditionalFormattingRuleModel),s=a.get(i.ICommandService),v=a.get(i.IUniverInstanceService),d=U.getSheetCommandTarget(v);if(!d)return!1;const{unitId:h,subUnitId:o}=d,p=u.createCfId(h,o),g={ranges:t,cfId:p,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:n}};return s.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:o,rule:g})}},We={type:i.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u,value:s}=e,v=a.get(r.ConditionalFormattingRuleModel),d=a.get(i.ICommandService),h=a.get(i.IUniverInstanceService),o=U.getSheetCommandTarget(h);if(!o)return!1;const{unitId:p,subUnitId:g}=o,b=v.createCfId(p,g);let I;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(u)){const m=s;if(m.length!==2||!Array.isArray(m))return!1;I={ranges:t,cfId:b,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:u,style:n,value:m}}}else{const m=s;if(typeof m!="number")return!1;I={ranges:t,cfId:b,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:u,style:n,value:m}}}return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:g,rule:I})}},qe={type:i.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,isPercent:u,isBottom:s,value:v}=e,d=a.get(r.ConditionalFormattingRuleModel),h=a.get(i.IUniverInstanceService),o=a.get(i.ICommandService),p=U.getSheetCommandTarget(h);if(!p)return!1;const{unitId:g,subUnitId:b}=p,I=d.createCfId(g,b),m={ranges:t,cfId:I,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:u,isBottom:s,style:n,value:v}};return o.executeCommand(r.AddConditionalRuleMutation.id,{unitId:g,subUnitId:b,rule:m})}},Ge={type:i.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u,value:s}=e,v=a.get(r.ConditionalFormattingRuleModel),d=a.get(i.IUniverInstanceService),h=U.getSheetCommandTarget(d);if(!h)return!1;const{unitId:o,subUnitId:p}=h,g=a.get(i.ICommandService),b=v.createCfId(o,p),I={ranges:t,cfId:b,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:u,style:n,value:s}};return g.executeCommand(r.AddConditionalRuleMutation.id,{unitId:o,subUnitId:p,rule:I})}},Ze={type:i.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u}=e,s=a.get(r.ConditionalFormattingRuleModel),v=a.get(i.IUniverInstanceService),d=a.get(i.ICommandService),h=U.getSheetCommandTarget(v);if(!h)return!1;const{unitId:o,subUnitId:p}=h,g=s.createCfId(o,p),b={ranges:t,cfId:g,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:u,style:n}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:o,subUnitId:p,rule:b})}},ze={type:i.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l}=e,u=a.get(r.ConditionalFormattingRuleModel),s=a.get(i.IUniverInstanceService),v=a.get(i.ICommandService),d=U.getSheetCommandTarget(s);if(!d)return!1;const{unitId:h,subUnitId:o}=d,p=u.createCfId(h,o),g={ranges:t,cfId:p,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:n}};return v.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:o,rule:g})}};function K({ref:a,...e}){const{icon:t,id:n,className:l,extend:u,...s}=e,v=`univerjs-icon univerjs-icon-${n} ${l||""}`.trim(),d=C.useRef(`_${Vr()}`);return ar(t,`${n}`,{defIds:t.defIds,idSuffix:d.current},{ref:a,className:v,...s},u)}function ar(a,e,t,n,l){return C.createElement(a.tag,{key:e,...Rr(a,t,l),...n},(Mr(a,t).children||[]).map((u,s)=>ar(u,`${e}-${a.tag}-${s}`,t,void 0,l)))}function Rr(a,e,t){const n={...a.attrs};t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),a.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(([u,s])=>{u==="mask"&&typeof s=="string"&&(n[u]=s.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:l}=e;return!l||l.length===0||(a.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(([u,s])=>{typeof s=="string"&&(n[u]=s.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),n}function Mr(a,e){var n;const{defIds:t}=e;return!t||t.length===0?a:a.tag==="defs"&&((n=a.children)!=null&&n.length)?{...a,children:a.children.map(l=>typeof l.attrs.id=="string"&&t&&t.includes(l.attrs.id)?{...l,attrs:{...l.attrs,id:l.attrs.id+e.idSuffix}}:l)}:a}function Vr(){return Math.random().toString(36).substring(2,8)}K.displayName="UniverIcon";const Or={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ur=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"bold-icon",ref:t,icon:Or}))});ur.displayName="BoldIcon";const Ur={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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"}}]},Ne=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"delete-icon",ref:t,icon:Ur}))});Ne.displayName="DeleteIcon";const kr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},sr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"increase-icon",ref:t,icon:kr}))});sr.displayName="IncreaseIcon";const Pr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"}}]},ir=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"italic-icon",ref:t,icon:Pr}))});ir.displayName="ItalicIcon";const Dr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",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"}}]},Ye=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"more-down-icon",ref:t,icon:Dr}))});Ye.displayName="MoreDownIcon";const Lr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]},cr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"sequence-icon",ref:t,icon:Lr}))});cr.displayName="SequenceIcon";const jr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z"}}]},or=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"strikethrough-icon",ref:t,icon:jr}))});or.displayName="StrikethroughIcon";const Ar={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z"}}]},dr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"underline-icon",ref:t,icon:Ar}))});dr.displayName="UnderlineIcon";const $r={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z",fillRule:"evenodd",clipRule:"evenodd"}}]},vr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"font-color-double-icon",ref:t,icon:$r}))});vr.displayName="FontColorDoubleIcon";const Fr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},pr=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"paint-bucket-double-icon",ref:t,icon:Fr}))});pr.displayName="PaintBucketDoubleIcon";const Br={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"colorChannel1",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",fillRule:"evenodd",clipRule:"evenodd"}}]},fe=C.forwardRef(function(e,t){return C.createElement(K,Object.assign({},e,{id:"slash-double-icon",ref:t,icon:Br}))});fe.displayName="SlashDoubleIcon";const re=a=>{const{color:e,onChange:t,disable:n=!1,Icon:l=pr,className:u}=a,s=C.useMemo(()=>new i.ColorKit(e),[e]),v=()=>{const d={className:O.clsx("univer-fill-primary-600",n&&u),extend:{colorChannel1:s.isValid?e:""}};return c.jsx(l,{...d})};return n?v():c.jsx(O.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(O.ColorPicker,{value:e,onChange:t})}),children:c.jsx("span",{className:O.clsx("univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",u),children:v()})})},ae=a=>{var u,s,v,d,h;const e=a.rule;if(!e)return null;const t=C.useMemo(()=>{if(e.type===r.CFRuleType.colorScale){const o=e.config.map((b,I)=>({color:new i.ColorKit(b.color),value:I})),p=o.length-1;return new Array(5).fill("").map((b,I,m)=>I*p/(m.length-1)).map(b=>r.getColorScaleFromValue(o,b))}return null},[e]),n=C.useMemo(()=>{if(e.type===r.CFRuleType.iconSet)return e.config.map(o=>{const p=r.iconMap[o.iconType];return p&&p[Number(o.iconId)]})},[e]),l="univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";switch(e.type){case r.CFRuleType.dataBar:{const{isGradient:o}=e.config,p=o?`linear-gradient(to right, ${e.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,g=o?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||r.defaultDataBarNativeColor})`:e.config.nativeColor;return c.jsxs("div",{className:l,children:[c.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:g,borderColor:(u=e.config.nativeColor)!=null?u:r.defaultDataBarNativeColor}}),c.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:p,borderColor:(s=e.config.positiveColor)!=null?s:r.defaultDataBarPositiveColor}})]})}case r.CFRuleType.colorScale:return t&&c.jsx("div",{className:l,children:t.map((o,p)=>c.jsx("div",{className:"univer-h-full",style:{width:`${100/t.length}%`,background:o}},p))});case r.CFRuleType.iconSet:return n&&c.jsx("div",{className:l,children:n.map((o,p)=>o?c.jsx("img",{className:"univer-h-full",src:o,draggable:!1},p):c.jsx(fe,{},p))});case r.CFRuleType.highlightCell:{const{ul:o,st:p,it:g,bl:b,bg:I,cl:m}=e.style,N=(o==null?void 0:o.s)===i.BooleanNumber.TRUE,_=(p==null?void 0:p.s)===i.BooleanNumber.TRUE,E=g===i.BooleanNumber.TRUE,M=b===i.BooleanNumber.TRUE,R=(v=I==null?void 0:I.rgb)!=null?v:r.DEFAULT_BG_COLOR,f=(d=m==null?void 0:m.rgb)!=null?d:r.DEFAULT_FONT_COLOR,T={textDecoration:(h=`${N?"underline":""} ${_?"line-through":""}`.replace(/^ /,""))!=null?h:void 0,backgroundColor:R,color:f};return c.jsx("div",{className:O.clsx(l,{"univer-font-bold":M,"univer-italic":E}),style:T,children:"123"})}}},he=O.clsx("univer-mt-5 univer-px-1 univer-py-2 univer-rounded",O.borderClassName),te=(a,e)=>({label:e.t(`sheet.cf.valueType.${a}`),value:a}),Ke=a=>{var I;const{type:e,className:t,onChange:n,id:l,value:u}=a,s=j.useDependency(i.IUniverInstanceService),v=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(I=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:I.getSheetId(),h=C.useMemo(()=>String(u).startsWith("=")?String(u):"=",[u]),o=C.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]),p=C.useRef(null),[g,b]=C.useState(!1);return j.useSidebarClick(m=>{var _;((_=p.current)==null?void 0:_.isClickOutSide(m))&&b(!1)}),e===r.CFValueType.formula?c.jsx("div",{className:"univer-ml-1 univer-w-full",children:c.jsx(ve.FormulaEditor,{ref:p,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),initValue:h,unitId:v,subUnitId:d,isFocus:g,onChange:(m="")=>{n(m||"")},onFocus:()=>b(!0)})}):c.jsx(O.InputNumber,{className:t,value:Number(a.value)||0,onChange:m=>a.onChange(m||0),...o})},Hr=a=>{var L;const{interceptorManager:e}=a,t=j.useDependency(i.LocaleService),n=((L=a.rule)==null?void 0:L.type)===r.CFRuleType.colorScale?a.rule:void 0,l=[te(r.CFValueType.num,t),te(r.CFValueType.percent,t),te(r.CFValueType.percentile,t),te(r.CFValueType.formula,t)],u=[te(r.CFValueType.min,t),...l],s=[te("none",t),...l],v=[te(r.CFValueType.max,t),...l],[d,h]=C.useState(()=>{var x;const y=r.CFValueType.min;return n&&((x=n.config[0])==null?void 0:x.value.type)||y}),[o,p]=C.useState(()=>{var x;const y="none";return!n||n.config.length!==3?y:((x=n.config[1])==null?void 0:x.value.type)||y}),[g,b]=C.useState(()=>{var x;const y=r.CFValueType.max;return n&&((x=n.config[n.config.length-1])==null?void 0:x.value.type)||y}),[I,m]=C.useState(()=>{if(!n)return 10;const x=n.config[0];return(x==null?void 0:x.value.value)===void 0?10:x==null?void 0:x.value.value}),[N,_]=C.useState(()=>{var $;if(!n||n.config.length!==3)return 50;const x=($=n.config[1])==null?void 0:$.value.value;return x===void 0?50:x}),[E,M]=C.useState(()=>{var $;if(!n)return 90;const x=($=n.config[n.config.length-1])==null?void 0:$.value.value;return x===void 0?90:x}),[R,f]=C.useState(()=>{var x;const y="#d0d9fb";return n&&((x=n.config[0])==null?void 0:x.color)||y}),[T,w]=C.useState(()=>{var x;const y="#7790f3";return!n||n.config.length!==3?y:((x=n.config[1])==null?void 0:x.color)||y}),[S,k]=C.useState(()=>{var x;const y="#2e55ef";return n&&((x=n.config[n.config.length-1])==null?void 0:x.color)||y}),V=C.useMemo(()=>y=>{const{minType:x,medianType:$,maxType:G,minValue:J,medianValue:Q,maxValue:oe,minColor:de,medianColor:A,maxColor:F}=y,H=[];return H.push({color:de,value:{type:x,value:J}}),$!=="none"&&H.push({color:A,value:{type:$,value:Q}}),H.push({color:F,value:{type:G,value:oe}}),{config:H.map((Z,z)=>({...Z,index:z})),type:r.CFRuleType.colorScale}},[]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return V({minType:d,medianType:o,maxType:g,minValue:I,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:S})}}),[V,d,o,g,I,N,E,R,T,S,e]);const P=y=>{a.onChange(V(y))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:V({minType:d,medianType:o,maxType:g,minValue:I,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:S})})}),c.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.min")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(O.Select,{className:"univer-flex-shrink-0",options:u,value:d,onChange:y=>{h(y);const x=r.createDefaultValueByValueType(y,10);m(x),P({minType:y,medianType:o,maxType:g,minValue:x,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:S})}}),c.jsx(Ke,{id:"min",className:"univer-ml-1",value:I,type:d,onChange:y=>{m(y),P({minType:d,medianType:o,maxType:g,minValue:y,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:S})}}),c.jsx(re,{className:"univer-ml-1",color:R,onChange:y=>{f(y),P({minType:d,medianType:o,maxType:g,minValue:I,medianValue:N,maxValue:E,minColor:y,medianColor:T,maxColor:S})}})]}),c.jsx("div",{className:"univer-text-gray-600dark:!univer-text-gray-200 univer-mt-3 univer-text-xs",children:t.t("sheet.cf.panel.medianValue")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(O.Select,{className:"univer-flex-shrink-0",options:s,value:o,onChange:y=>{p(y);const x=r.createDefaultValueByValueType(y,50);_(x),P({minType:d,medianType:y,maxType:g,minValue:I,medianValue:x,maxValue:E,minColor:R,medianColor:T,maxColor:S})}}),c.jsx(Ke,{id:"median",className:"univer-ml-1",value:N,type:o,onChange:y=>{_(y),P({minType:d,medianType:o,maxType:g,minValue:I,medianValue:y,maxValue:E,minColor:R,medianColor:T,maxColor:S})}}),o!=="none"&&c.jsx(re,{className:"univer-ml-1",color:T,onChange:y=>{w(y),P({minType:d,medianType:o,maxType:g,minValue:I,medianValue:N,maxValue:E,minColor:R,medianColor:y,maxColor:S})}})]}),c.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.max")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(O.Select,{className:"univer-flex-shrink-0",options:v,value:g,onChange:y=>{b(y);const x=r.createDefaultValueByValueType(y,90);M(x),P({minType:d,medianType:o,maxType:y,minValue:I,medianValue:N,maxValue:x,minColor:R,medianColor:T,maxColor:S})}}),c.jsx(Ke,{id:"max",className:"univer-ml-1",value:E,type:g,onChange:y=>{M(y),P({minType:d,medianType:o,maxType:g,minValue:I,medianValue:N,maxValue:y,minColor:R,medianColor:T,maxColor:S})}}),c.jsx(re,{className:"univer-ml-1",color:S,onChange:y=>{k(y),P({minType:d,medianType:o,maxType:g,minValue:I,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:y})}})]})]})},ue=(a,e)=>({label:e.t(`sheet.cf.valueType.${a}`),value:a}),fr=a=>{var m;const{onChange:e,className:t,value:n,type:l,id:u,disabled:s=!1}=a,v=j.useDependency(i.IUniverInstanceService),d=v.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(m=v.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),o=C.useRef(null),[p,g]=C.useState(!1);j.useSidebarClick(N=>{var E;((E=o.current)==null?void 0:E.isClickOutSide(N))&&g(!1)});const b=C.useRef(n),I=C.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 N=String(b.current).startsWith("=")?String(b.current)||"":"=";return c.jsx("div",{className:"univer-ml-3 univer-w-full",children:c.jsx(ve.FormulaEditor,{ref:o,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),initValue:N,unitId:d,subUnitId:h,isFocus:p,onChange:(_="")=>{e(_||"")},onFocus:()=>g(!0)})})}return c.jsx(O.InputNumber,{className:t,value:Number(n)||0,disabled:s,onChange:N=>{e(N||0)},...I})},Wr=a=>{var L;const{interceptorManager:e}=a,t=j.useDependency(i.LocaleService),n=((L=a.rule)==null?void 0:L.type)===r.CFRuleType.dataBar?a.rule:void 0,[l,u]=C.useState(()=>{var x;return n&&(x=n.config)!=null&&x.isGradient?"1":"0"}),[s,v]=C.useState(()=>{var y;return n&&((y=n.config)==null?void 0:y.positiveColor)||r.defaultDataBarPositiveColor}),[d,h]=C.useState(()=>{var y;return n&&((y=n.config)==null?void 0:y.nativeColor)||r.defaultDataBarNativeColor}),o=[ue(r.CFValueType.num,t),ue(r.CFValueType.percent,t),ue(r.CFValueType.percentile,t),ue(r.CFValueType.formula,t)],p=[ue(r.CFValueType.min,t),...o],g=[ue(r.CFValueType.max,t),...o],[b,I]=C.useState(()=>{var x;const y=p[0].value;return n&&((x=n.config)==null?void 0:x.min.type)||y}),[m,N]=C.useState(()=>{var x;const y=g[0].value;return n&&((x=n.config)==null?void 0:x.max.type)||y}),[_,E]=C.useState(()=>{var $;if(!n)return 0;const x=(($=n.config)==null?void 0:$.min)||{};return x.type===r.CFValueType.formula?x.value||"=":x.value||0}),[M,R]=C.useState(()=>{var $;if(!n)return 100;const x=(($=n.config)==null?void 0:$.max)||{};return x.type===r.CFValueType.formula?x.value||"=":x.value===void 0?100:x.value}),[f,T]=C.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),w=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});C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return w({isGradient:l,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:f})}}),[l,_,b,M,m,s,d,e,f]);const S=y=>{a.onChange(w(y))},k=y=>{v(y),S({isGradient:l,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:y,nativeColor:d,isShowValue:f})},V=y=>{h(y),S({isGradient:l,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:y,isShowValue:f})},P=y=>o.map(x=>x.value).includes(y);return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:w({isGradient:l,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:f})})}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.fillType")}),c.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[c.jsxs(O.RadioGroup,{value:l,onChange:y=>{u(y),S({isGradient:y,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:f})},children:[c.jsx(O.Radio,{value:"0",children:c.jsx("span",{className:"univer-text-xs",children:t.t("sheet.cf.panel.pureColor")})}),c.jsx(O.Radio,{value:"1",children:c.jsx("span",{className:"univer-text-xs",children:t.t("sheet.cf.panel.gradient")})})]}),c.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{checked:!f,onChange:y=>{T(!y),S({isGradient:y,minValue:_,minValueType:b,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:!y})}}),t.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.colorSet")}),c.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[c.jsxs("div",{className:"univer-flex univer-items-center",children:[c.jsx("div",{className:"univer-text-xs",children:t.t("sheet.cf.panel.native")}),c.jsx(re,{color:d,onChange:V})]}),c.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[c.jsx("div",{className:"univer-text-xs",children:t.t("sheet.cf.panel.positive")}),c.jsx(re,{color:s,onChange:k})]})]})]}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.min")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(O.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:p,value:b,onChange:y=>{I(y);const x=r.createDefaultValueByValueType(y,10);E(x),S({isGradient:l,minValue:x,minValueType:y,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:f})}}),c.jsx(fr,{id:"min",className:"univer-ml-3",disabled:!P(b),type:b,value:_,onChange:y=>{E(y||0),S({isGradient:l,minValue:y||0,minValueType:b,maxValue:M,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:f})}})]}),c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.max")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(O.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:g,value:m,onChange:y=>{N(y);const x=r.createDefaultValueByValueType(y,90);R(x),S({isGradient:l,minValue:_,minValueType:b,maxValue:x,maxValueType:y,positiveColor:s,nativeColor:d,isShowValue:f})}}),c.jsx(fr,{className:"univer-ml-3",disabled:!P(m),id:"max",type:m,value:M,onChange:y=>{R(y||0),S({isGradient:l,minValue:_,minValueType:b,maxValue:y||0,maxValueType:m,positiveColor:s,nativeColor:d,isShowValue:f})}})]})]})]})},Ee=a=>[i.BooleanNumber.FALSE,void 0].includes(a)?i.BooleanNumber.TRUE:i.BooleanNumber.FALSE,Re=a=>a!==i.BooleanNumber.FALSE,Xe=a=>{const{style:e,onChange:t,className:n}=a,[l,u]=C.useState(()=>{if(e!=null&&e.bl)return e.bl}),[s,v]=C.useState(()=>{if(e!=null&&e.it)return e.it}),[d,h]=C.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[o,p]=C.useState(()=>{if(e!=null&&e.st)return e.st.s}),[g,b]=C.useState(()=>{var E;const _="#2f56ef";return(E=e==null?void 0:e.cl)!=null&&E.rgb?e.cl.rgb:_}),[I,m]=C.useState(()=>{var E;const _="#e8ecfc";return(E=e==null?void 0:e.bg)!=null&&E.rgb?e.bg.rgb:_});C.useEffect(()=>{const _={bl:l,it:s};g!==void 0&&(_.cl={rgb:g}),I!==void 0&&(_.bg={rgb:I}),o!==void 0&&(_.st={s:o}),d!==void 0&&(_.ul={s:d}),t(r.removeUndefinedAttr(_))},[l,s,d,o,g,I]);const N="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return c.jsxs("div",{className:O.clsx("univer-my-2.5 univer-flex univer-justify-between",n),children:[c.jsx("div",{className:O.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(l||i.BooleanNumber.FALSE)}),onClick:()=>u(Ee(l)),children:c.jsx(ur,{})}),c.jsx("div",{className:O.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(s||i.BooleanNumber.FALSE)}),onClick:()=>v(Ee(s)),children:c.jsx(ir,{})}),c.jsx("div",{className:O.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(d||i.BooleanNumber.FALSE)}),onClick:()=>h(Ee(d)),children:c.jsx(dr,{})}),c.jsx("div",{className:O.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Re(o||i.BooleanNumber.FALSE)}),onClick:()=>p(Ee(o)),children:c.jsx(or,{})}),c.jsx(re,{color:g,onChange:b,Icon:vr}),c.jsx(re,{color:I,onChange:m})]})},qr=a=>{var R;const{onChange:e,interceptorManager:t}=a,n=j.useDependency(i.LocaleService),u=j.useDependency(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),s=u.getActiveSheet(),v=((R=a.rule)==null?void 0:R.type)===r.CFRuleType.highlightCell?a.rule:void 0,d=C.useRef(null),[h,o]=C.useState(!1),p=C.useRef(null),[g,b]=C.useState({}),[I,m]=C.useState(()=>(v==null?void 0:v.subType)===r.CFSubRuleType.formula?v.value:"="),[N,_]=C.useState(void 0),E=f=>({style:f.style,value:I,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});C.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return E({style:g})}}),[g,I,t]),C.useEffect(()=>t.intercept(t.getInterceptPoints().beforeSubmit,{handler:(T,w,S)=>N||I.length===1||!I.startsWith("=")?(_(n.t("sheet.cf.errorMessage.formulaError")),!1):S(T)}),[N,I]);const M=f=>{e(E(f))};return j.useSidebarClick(f=>{var w;((w=p.current)==null?void 0:w.isClickOutSide(f))&&o(!1)}),c.jsxs("div",{ref:d,children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:n.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:"univer-mt-3",children:c.jsx(ve.FormulaEditor,{ref:p,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),errorText:N,isFocus:h,initValue:I,unitId:u.getUnitId(),subUnitId:s==null?void 0:s.getSheetId(),onFocus:()=>{o(!0)},onChange:f=>{m(f),M({style:g})},onVerify:(f,T)=>{!f||T.length===1?_(n.t("sheet.cf.errorMessage.formulaError")):_(void 0)}})}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:E({style:g})})}),c.jsx(Xe,{style:v==null?void 0:v.style,className:"univer-mt-3",onChange:f=>{b(f),M({style:f})}})]})},Me=a=>c.jsxs("div",{className:"univer-relative",children:[c.jsx("div",{className:"univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",children:a.errorText}),a.children]}),B=(a,e)=>({label:e.t(`sheet.cf.operator.${a}`),value:a}),Gr=a=>{const{type:e,operator:t,onChange:n,value:l,interceptorManager:u}=a,s=j.useDependency(i.LocaleService),[v,d]=C.useState(()=>typeof l=="number"?l:0),[h,o]=C.useState(""),[p,g]=C.useState(()=>typeof l=="string"?l:""),[b,I]=C.useState(""),[m,N]=C.useState(()=>Array.isArray(l)?l[0]===void 0?0:l[0]:0),[_,E]=C.useState(""),[M,R]=C.useState(()=>Array.isArray(l)?l[1]===void 0?100:l[1]:100),[f,T]=C.useState("");switch(C.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(t)&&n(p);break}case r.CFSubRuleType.number:{[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(t)&&n(v),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(t)&&n([m,M]);break}}},[e]),C.useEffect(()=>{const w=u.intercept(u.getInterceptPoints().beforeSubmit,{handler:(S,k,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(t))return p?V(S):(I(s.t("sheet.cf.errorMessage.notBlank")),!1)}return V(S)}});return()=>{w()}},[e,v,p,t]),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(t)){const w=S=>{g(S),n(S)};return c.jsx("div",{className:"univer-mt-3",children:c.jsx(Me,{errorText:b,children:c.jsx(O.Input,{value:p,onChange:S=>{I(""),w(S)}})})})}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(t)){const w=S=>{d(S||0),n(S||0),o("")};return c.jsx("div",{className:"univer-mt-3",children:c.jsx(Me,{errorText:h,children:c.jsx(O.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:v,onChange:w})})})}if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(t)){const w=k=>{N(k||0),n([k||0,M]),E("")},S=k=>{R(k||0),n([m,k||0]),T("")};return c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(Me,{errorText:_,children:c.jsx(O.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:m,onChange:w})}),c.jsx(Me,{errorText:f,children:c.jsx(O.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:M,onChange:S})})]})}}}return null},hr=(a,e)=>{switch(a){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)]}},gr=a=>{var R;const{interceptorManager:e,onChange:t}=a,n=j.useDependency(i.LocaleService),l=((R=a.rule)==null?void 0:R.type)===r.CFRuleType.highlightCell?a.rule:void 0,[u,s]=C.useState(()=>{const f=r.CFSubRuleType.text;return l&&l.subType||f}),v=[{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")}],d=C.useMemo(()=>hr(u,n),[u]),[h,o]=C.useState(()=>{const f=d?d[0].value:void 0;return l&&l.operator||f}),[p,g]=C.useState(()=>{var w;return l?(w=l.value)!=null?w:r.createDefaultValue(l.subType,l.operator):""}),[b,I]=C.useState({}),m=C.useMemo(()=>f=>{var T,w,S,k,V,P,L,y,x,$,G,J,Q,oe,de;switch(f.subType||u){case r.CFSubRuleType.text:{if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(h))return{type:r.CFRuleType.highlightCell,subType:(T=f.subType)!=null?T:u,operator:(w=f.operator)!=null?w:h,style:(S=f.style)!=null?S:b,value:(k=f.value)!=null?k:p};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(h))return{type:r.CFRuleType.highlightCell,subType:(V=f.subType)!=null?V:u,operator:(P=f.operator)!=null?P:h,style:(L=f.style)!=null?L:b,value:(y=f.value)!=null?y:p};if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(h))return{type:r.CFRuleType.highlightCell,subType:(x=f.subType)!=null?x:u,operator:($=f.operator)!=null?$:h,style:(G=f.style)!=null?G:b,value:(J=f.value)!=null?J:p};break}}return{type:r.CFRuleType.highlightCell,subType:(Q=f.subType)!=null?Q:u,operator:(oe=f.operator)!=null?oe:h,style:(de=f.style)!=null?de:b}},[u,h,p,b]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return m({})}}),[m,e]),C.useEffect(()=>{v.some(f=>f.value===u)||s(v[0].value)},[v]);const N=f=>{const T=f,w=hr(T,n),S=w&&w[0].value;s(T),o(S),S&&g(r.createDefaultValue(T,S)),t(m({subType:T,operator:S}))},_=f=>{const T=f;o(T),t(m({operator:T}))},E=f=>{g(f),t(m({value:f}))},M=C.useMemo(()=>`${u}_${h}_${Math.random()}`,[u,h]);return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:n.t("sheet.cf.panel.styleRule")}),c.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[c.jsx(O.Select,{className:"univer-mt-3 univer-w-full",onChange:N,value:u,options:v}),(d==null?void 0:d.length)&&c.jsx(O.Select,{className:"univer-mt-3 univer-w-full",onChange:_,value:h||"",options:d})]}),c.jsx(Gr,{value:p,interceptorManager:e,type:u,operator:h,rule:l,onChange:E},M),c.jsx("div",{className:he,children:c.jsx(ae,{rule:m({})})}),c.jsx(Xe,{style:l==null?void 0:l.style,className:"univer-ml-1",onChange:f=>{I(f),t(m({style:f}))}})]})},yr=(a,e)=>(r.iconMap[a]||[])[Number(e)]||"",Zr=a=>{var o;const{error:e,type:t,onChange:n}=a,l=j.useDependency(i.IUniverInstanceService),u=l.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),s=(o=l.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:o.getSheetId(),v=C.useRef(null),[d,h]=C.useState(!1);return j.useSidebarClick(p=>{var b;((b=v.current)==null?void 0:b.isClickOutSide(p))&&h(!1)}),c.jsx("div",{className:"univer-relative",children:t!==r.CFValueType.formula?c.jsxs(c.Fragment,{children:[c.jsx(O.InputNumber,{className:O.clsx({"univer-border-red-500":e}),value:Number(a.value)||0,onChange:p=>n(p!=null?p:0)}),e&&c.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:e})]}):c.jsx("div",{className:"univer-w-full",children:c.jsx(ve.FormulaEditor,{ref:v,className:O.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",O.borderClassName),initValue:String(a.value),unitId:u,subUnitId:s,isFocus:d,onChange:(p="")=>{n(p||"")},onFocus:()=>h(!0)})})})},Cr=(a,e,t)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(t.length-1-e)*10},iconType:a,iconId:String(e)}),zr=C.forwardRef((a,e)=>{const{onClick:t}=a,n=j.useDependency(i.LocaleService),l=u=>{t(u)};return c.jsx("div",{ref:e,className:"univer-w-80",children:r.iconGroup.map((u,s)=>c.jsxs("div",{className:"univer-mb-3",children:[c.jsx("div",{className:"univer-mb-1 univer-text-sm",children:n.t(u.title)}),c.jsx("div",{className:"univer-flex univer-flex-wrap",children:u.group.map(v=>c.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{l(v.name)},children:c.jsx("a",{className:"univer-cursor-pointer univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:v.list.map((d,h)=>c.jsx("img",{className:"univer-size-5",src:d,draggable:!1},h))})},v.name))})]},s))})}),Yr=a=>{const{onClick:e}=a,t=C.useMemo(()=>{const l=[];for(const u in r.iconMap){const s=r.iconMap[u],v=u;s.forEach((d,h)=>{l.push({iconType:v,base64:d,iconId:String(h)})})}return l},[]),n=l=>{e(l.iconType,l.iconId)};return c.jsxs("div",{children:[c.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:[c.jsx(fe,{className:"univer-size-5"}),c.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),c.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:t.map(l=>c.jsx("div",{className:"univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:c.jsx("img",{className:"univer-size-5",src:l.base64,draggable:!1,onClick:()=>n(l)})},`${l.iconType}_${l.iconId}`))})]})},Kr=a=>{const{onChange:e,configList:t,errorMap:n={}}=a,l=j.useDependency(i.LocaleService),u=[{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}],s=[{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}],v=(p,g)=>{e([String(g),"value","value"],p)},d=(p,g)=>{e([String(g),"operator"],p);const b=r.createDefaultValue(r.CFSubRuleType.number,p);v(b,g)},h=(p,g)=>{e([String(g),"value","type"],p);const b=t[g],I=r.createDefaultValue(r.CFSubRuleType.number,b.operator);v(I,g)};return C.useMemo(()=>t.map((p,g)=>{const b=n[g],I=yr(p.iconType,p.iconId),m=g===t.length-1,N=g===0,_=t[g-1],E=(_==null?void 0:_.value.type)===r.CFValueType.formula?l.t("sheet.cf.valueType.formula"):_==null?void 0:_.value.value,M=(R,f)=>{const T={...p,iconId:f,iconType:R};e([String(g)],T)};return c.jsxs("div",{className:g?"univer-mt-6":"univer-mt-3",children:[c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[c.jsxs("div",{className:"univer-w-[45%]",children:[l.t("sheet.cf.iconSet.icon"),g+1]}),c.jsx("div",{className:"univer-w-[45%]",children:c.jsxs(c.Fragment,{children:[!N&&!m&&l.t("sheet.cf.iconSet.rule"),!N&&!m&&c.jsxs("span",{className:"univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",children:[l.t("sheet.cf.iconSet.when"),l.t(`sheet.cf.symbol.${r.getOppositeOperator(_.operator)}`),E,m?"":` ${l.t("sheet.cf.iconSet.and")} `]})]})})]}),c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[c.jsx("div",{className:"univer-flex univer-items-center",children:c.jsx(O.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(Yr,{onClick:M,iconId:p.iconId,iconType:p.iconType})}),children:c.jsxs("div",{className:O.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200",O.borderClassName),children:[I?c.jsx("img",{src:I,className:"univer-size-4",draggable:!1}):c.jsx(fe,{className:"univer-size-4"}),c.jsx(Ye,{})]})})}),m?c.jsxs("div",{className:"univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[l.t("sheet.cf.iconSet.rule"),c.jsxs("span",{className:"univer-font-medium",children:[l.t("sheet.cf.iconSet.when"),l.t(`sheet.cf.symbol.${r.getOppositeOperator(_.operator)}`),E,m?"":` ${l.t("sheet.cf.iconSet.and")} `]})]}):c.jsx(O.Select,{options:u,value:p.operator,onChange:R=>{d(R,g)}})]}),m?c.jsx("div",{}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[c.jsx("div",{children:l.t("sheet.cf.iconSet.type")}),c.jsx("div",{children:l.t("sheet.cf.iconSet.value")})]}),c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[c.jsx(O.Select,{options:s,value:p.value.type,onChange:R=>{h(R,g)}}),c.jsx(Zr,{id:g,type:p.value.type,error:b,value:p.value.value||"",onChange:R=>{v(R,g)}})]})]})]},g)}),[t,n])},Xr=a=>{var R;const{interceptorManager:e}=a,t=((R=a.rule)==null?void 0:R.type)===r.CFRuleType.iconSet?a.rule:void 0,n=j.useDependency(i.LocaleService),[l,u]=C.useState({}),[s,v]=C.useState(()=>{const f=Object.keys(r.iconMap)[0];if(t&&t.config.length){const T=t.config[0].iconType;if(!t.config.some(S=>S.iconType!==T))return T}return f}),[d,h]=C.useState(()=>{if(t&&t.config.length)return i.Tools.deepClone(t==null?void 0:t.config);const f=r.iconMap[s]||[];return new Array(f.length).fill("").map((T,w,S)=>w===S.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:s,iconId:String(w)}:Cr(s,w,S))}),[o,p]=C.useState(()=>t?!!t.isShowValue:!0),g=C.useMemo(()=>{const f=d.map(T=>yr(T.iconType,T.iconId));return c.jsx("div",{className:"univer-flex univer-items-center",children:f.map((T,w)=>T?c.jsx("img",{className:"univer-size-5",src:T},w):c.jsx(fe,{className:"univer-size-5"},w))})},[d]),b=f=>{if(f.reduce((w,S,k)=>w.preType&&!w.result||f.length-1===k?w:S.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:w.preType?{result:w.preType===S.value.type,preType:S.value.type}:{result:!0,preType:S.value.type},{result:!0,preType:""}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(f[0].value.type)){const w={};return f.forEach((S,k,V)=>{if(k-1<0||k===V.length-1)return;const L=f[k-1],y=r.getOppositeOperator(L.operator);r.compareWithNumber({operator:y,value:L.value.value},S.value.value)||(w[k]=`${n.t(`sheet.cf.form.${y}`,String(L.value.value))} `)}),w}return{}},I=(f,T)=>{i.get(d,f)!==T&&(i.set(d,f,T),h([...d]),u(b(d)))},m=f=>{v(f);const T=r.iconMap[f]||[],w=new Array(T.length).fill("").map((S,k,V)=>Cr(f,k,V));h(w),u(b(w))};C.useEffect(()=>{const f=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:o,config:d}}});return()=>{f()}},[o,d,e]),C.useEffect(()=>{const f=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(l).length===0}});return()=>{f()}},[o,d,e,l]);const N=()=>{const f=d.map(T=>({...T}));d.forEach((T,w)=>{const S=d.length-1-w,k=f[S];T.iconId=k.iconId,T.iconType=k.iconType}),h([...d])},_=j.useDependency(j.ILayoutService),[E,M]=C.useState();return j.useScrollYOverContainer(E,_.rootContainerElement),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:"univer-mt-3",children:c.jsx(O.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(zr,{ref:f=>{!E&&f&&M(f)},iconType:s,onClick:m})}),children:c.jsxs("div",{className:O.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600",O.borderClassName),children:[g,c.jsx(Ye,{})]})})}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{onChange:N}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),c.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{checked:!o,onChange:f=>{p(!f)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),c.jsx(Kr,{errorMap:l,onChange:I,configList:d})]})},Jr=a=>{var N;const{onChange:e,interceptorManager:t}=a,n=j.useDependency(i.LocaleService),l=((N=a.rule)==null?void 0:N.type)===r.CFRuleType.highlightCell?a.rule:void 0,u=[{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"}],[s,v]=C.useState(()=>{const _=u[0].value,E=l==null?void 0:l.type;if(!l)return _;switch(E){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":_;case r.CFSubRuleType.rank:return l.isBottom?"isBottom":"isNotBottom"}}return _}),[d,h]=C.useState(()=>{const E=l==null?void 0:l.type;if(!l)return 10;switch(E){case r.CFRuleType.highlightCell:switch(l.subType){case r.CFSubRuleType.rank:return l.value||10}}return 10}),[o,p]=C.useState(()=>{const E=l==null?void 0:l.type;if(!l)return!1;switch(E){case r.CFRuleType.highlightCell:switch(l.subType){case r.CFSubRuleType.rank:return l.isPercent||!1}}return!1}),[g,b]=C.useState({}),I=_=>{const{type:E,isPercent:M,value:R,style:f}=_;if(E==="isNotBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:M,isBottom:!1,value:R,style:f};if(E==="isBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:M,isBottom:!0,value:R,style:f};if(E==="greaterThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:f};if(E==="lessThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:f}};C.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return I({type:s,isPercent:o,value:d,style:g})}}),[s,o,d,g,t]);const m=_=>{e(I(_))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:n.t("sheet.cf.panel.styleRule")}),c.jsx(O.Select,{className:"univer-mt-3 univer-w-full",value:s,options:u,onChange:_=>{v(_),m({type:_,isPercent:o,value:d,style:g})}}),["isNotBottom","isBottom"].includes(s)&&c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(O.InputNumber,{min:1,max:1e3,value:d,onChange:_=>{const E=_||0;h(E),m({type:s,isPercent:o,value:E,style:g})}}),c.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[c.jsx(O.Checkbox,{checked:o,onChange:_=>{p(!!_),m({type:s,isPercent:!!_,value:d,style:g})}}),n.t("sheet.cf.valueType.percent")]})]}),c.jsx("div",{className:he,children:c.jsx(ae,{rule:I({type:s,isPercent:o,value:d,style:g})})}),c.jsx(Xe,{style:l==null?void 0:l.style,className:"univer-mt-3",onChange:_=>{b(_),m({type:s,isPercent:o,value:d,style:_})}})]})},Qr=i.createInterceptorKey("beforeSubmit"),et=i.createInterceptorKey("submit"),mr=a=>a.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),br=a=>{var e;return(e=a.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},rt=a=>{var w,S,k;const e=j.useDependency(i.LocaleService),t=j.useDependency(i.ICommandService),n=j.useDependency(i.IUniverInstanceService),l=j.useDependency(r.ConditionalFormattingRuleModel),u=j.useDependency(U.SheetsSelectionsService),s=mr(n),v=br(n),[d,h]=C.useState(void 0),o=C.useRef((S=(w=a.rule)==null?void 0:w.ranges)!=null?S:[]),p=C.useMemo(()=>{var P,L,y;let V=(P=a.rule)==null?void 0:P.ranges;return V!=null&&V.length||(V=(y=(L=u.getCurrentSelections())==null?void 0:L.map(x=>x.range))!=null?y:[]),o.current=V,V!=null&&V.length?V.map(x=>{const $=Ae.serializeRange(x);return $==="NaN"?"":$}).filter(x=>!!x).join(","):""},[a.rule]),g=[{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"}],[b,I]=C.useState(()=>{var L,y;const V=(L=a.rule)==null?void 0:L.rule.type,P=g[0].value;if(!V)return P;switch(V){case r.CFRuleType.highlightCell:{switch((y=a.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 P}),m=C.useRef(void 0),N=C.useMemo(()=>new i.InterceptorManager({beforeSubmit:Qr,submit:et}),[]),_=C.useMemo(()=>{switch(b){case"1":return gr;case"2":return Jr;case"3":return Wr;case"4":return Hr;case"5":return qr;case"6":return Xr;default:return gr}},[b]);C.useEffect(()=>{const V=t.onCommandExecuted(P=>{if(P.id===U.RemoveSheetMutation.id){const L=P.params;L.subUnitId===v&&L.unitId===s&&a.onCancel()}P.id===U.SetWorksheetActiveOperation.id&&a.onCancel()});return()=>V.dispose()},[]);const E=V=>{m.current=V},M=V=>{const P=V.split(",").filter(L=>!!L).map(Ae.deserializeRangeWithSheet).map(L=>L.range);o.current=P},R=()=>{if(d)return;const P=(()=>{const y=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!y)throw new Error("No active sheet found");return o.current.map(G=>U.setEndForRange(G,y.getRowCount(),y.getColumnCount())).filter(G=>!(Number.isNaN(G.startRow)||Number.isNaN(G.startColumn)))})();if(N.fetchThroughInterceptors(N.getInterceptPoints().beforeSubmit)(!0,null)){const y=N.fetchThroughInterceptors(N.getInterceptPoints().submit)(null,null);if(y){const x=mr(n),$=br(n);if(!x||!$)throw new Error("No active sheet found");let G={};a.rule&&a.rule.cfId?(G={...a.rule,ranges:P,rule:y},t.executeCommand(r.SetCfCommand.id,{unitId:x,subUnitId:$,rule:G}),a.onCancel()):(G={cfId:l.createCfId(x,$),ranges:P,rule:y,stopIfTrue:!1},t.executeCommand(r.AddCfCommand.id,{unitId:x,subUnitId:$,rule:G}),a.onCancel())}}},f=()=>{a.onCancel()},T=(V,P)=>{V?P.length<1?h(e.t("sheet.cf.errorMessage.rangeError")):h(void 0):h(e.t("sheet.cf.errorMessage.rangeError"))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.range")}),c.jsxs("div",{className:"univer-mt-4",children:[c.jsx(ve.RangeSelector,{unitId:s,subUnitId:v,initialValue:p,onChange:(V,P)=>M(P),onVerify:T}),d&&c.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:d})]}),c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.styleType")}),c.jsx(O.Select,{className:"univer-mt-4 univer-w-full",value:b,options:g,onChange:V=>I(V)}),c.jsx(_,{interceptorManager:N,rule:(k=a.rule)==null?void 0:k.rule,onChange:E}),c.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[c.jsx(O.Button,{onClick:f,children:e.t("sheet.cf.panel.cancel")}),c.jsx(O.Button,{className:"univer-ml-3",variant:"primary",onClick:R,children:e.t("sheet.cf.panel.submit")})]})]})};var tt=Object.getOwnPropertyDescriptor,nt=(a,e,t,n)=>{for(var l=n>1?void 0:n?tt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},lt=(a,e)=>(t,n)=>e(t,n,a);let se=class extends i.Disposable{constructor(e){super();ee(this,"_initLocal",()=>{});ee(this,"_findReplaceIndex",e=>{const t=/\{([^}]+)?\}/g,n=[];let l=t.exec(e);for(;l;)n.push({startIndex:l.index,key:Number(l[1]),endIndex:l.index+l[0].length-1}),l=t.exec(e);return n});this._localeService=e,this._initLocal()}tWithReactNode(e,...t){const n=this._localeService.getLocales(),l=e.split("."),u=n&&this._localeService.resolveKeyPath(n,l);if(typeof u=="string"){const s=[];return this._findReplaceIndex(u).forEach((v,d,h)=>{const o=h[d-1]||{endIndex:-1};if(o.endIndex+1<v.startIndex){const p=u.slice(o.endIndex+1,v.startIndex);p&&s.push(p)}if(t[v.key]&&s.push(t[v.key]),d===h.length-1){const p=u.slice(v.endIndex+1);p&&s.push(p)}}),s}return[]}};se=nt([lt(0,i.Inject(i.LocaleService))],se);const at=(a,e)=>{const t=a.rule;switch(t.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(t.subType){case r.CFSubRuleType.average:{const n=t.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=t.operator;return e.t(`sheet.cf.preview.describe.${n}`,...Array.isArray(t.value)?t.value.map(l=>String(l)):[String(t.value||"")])}case r.CFSubRuleType.text:{const n=t.operator;return e.t(`sheet.cf.preview.describe.${n}`,t.value||"")}case r.CFSubRuleType.timePeriod:{const n=t.operator;return e.t(`sheet.cf.preview.describe.${n}`)}case r.CFSubRuleType.rank:return t.isPercent?t.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(t.value)):e.t("sheet.cf.preview.describe.topNPercent",String(t.value)):t.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(t.value)):e.t("sheet.cf.preview.describe.topN",String(t.value));case r.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let Sr=0;const ut=a=>{const{onClick:e}=a,t=j.useDependency(r.ConditionalFormattingRuleModel),n=j.useDependency(i.IUniverInstanceService),l=j.useDependency(U.SheetsSelectionsService),u=j.useDependency(i.ICommandService),s=j.useDependency(i.LocaleService),v=j.useDependency(i.Injector),d=j.useDependency(j.ISidebarService),h=j.useDependency(se),o=j.useObservable(()=>n.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),p=o.getUnitId(),g=o.getActiveSheet();if(!g)throw new Error("No active sheet found");const b=g.getSheetId(),[I,m]=C.useState([]),[N,_]=C.useState("2"),[E,M]=C.useState(0),[R,f]=C.useState(-1),[T,w]=C.useState(Sr),S=C.useRef(null),k=[{label:s.t("sheet.cf.panel.workSheet"),value:"2"},{label:s.t("sheet.cf.panel.selectedRange"),value:"1"}],V=()=>{const A=t.getSubunitRules(p,b);if(!A||!A.length)return[];if(N==="1"){const F=l.getCurrentLastSelection();if(!F)return[];const H=F.range;return A.filter(Z=>Z.ranges.some(z=>i.Rectangle.intersects(z,H)))}else if(N==="2")return[...A];return[]},[P,L]=C.useState(V);W.useHighlightRange(I),C.useEffect(()=>{const A=u.onCommandExecuted(F=>{F.id===U.SetWorksheetActiveOperation.id&&M(Math.random())});return()=>A.dispose()}),C.useEffect(()=>{L(V)},[N,E,p,b]),C.useEffect(()=>{if(N==="2")return;const A=new X.Observable(F=>{const H=[U.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],q=u.onCommandExecuted(Z=>{const{id:z,params:ne}=Z,le=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId();H.includes(z)&&ne.unitId===le&&F.next(null)});return()=>q.dispose()}).pipe(X.debounceTime(16)).subscribe(()=>{L(V)});return()=>{A.unsubscribe()}},[n,N,p,b]),C.useEffect(()=>{const A=t.$ruleChange.subscribe(()=>{M(Math.random())});return()=>A.unsubscribe()},[t]),C.useEffect(()=>{const A=()=>{var Z,z;const q=Math.max(0,((z=(Z=S.current)==null?void 0:Z.getBoundingClientRect().width)!=null?z:0)-8);return Sr=q,q},H=new X.Observable(q=>{const Z=d.getContainer();if(Z){let z=setTimeout(()=>{q.next(void 0)},150);const ne=()=>{z&&clearTimeout(z),z=null},le=je=>{je.propertyName==="width"&&(ne(),q.next(void 0))};return Z.addEventListener("transitionend",le),()=>{ne(),Z.removeEventListener("transitionend",le)}}}).pipe(X.debounceTime(16)).subscribe(()=>{w(A())});return()=>{H.unsubscribe()}},[]);const y=A=>{var q;const F=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),H=(q=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:q.getSheetId();if(!F||!H)throw new Error("No active sheet found");u.executeCommand(r.DeleteCfCommand.id,{unitId:F,subUnitId:H,cfId:A.cfId})},x=(A,F)=>{f(F.y)},$=(A,F,H)=>{var je;f(-1);const q=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),Z=(je=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:je.getSheetId();if(!q||!Z)throw new Error("No active sheet found");const z=Ft=>{const Bt=P.length;return Math.min(Bt-1,Math.max(0,Ft))},ne=P[z(F.y)].cfId,le=P[z(H.y)].cfId;ne!==le&&u.executeCommand(r.MoveCfCommand.id,{unitId:q,subUnitId:Z,start:{id:ne,type:"self"},end:{id:le,type:H.y>F.y?"after":"before"}})},G=()=>{a.onCreate()},J=()=>{N==="2"?u.executeCommand(r.ClearWorksheetCfCommand.id):N==="1"&&P.map(F=>({unitId:p,subUnitId:b,cfId:F.cfId})).forEach(F=>{u.executeCommand(r.DeleteCfCommand.id,F)})},Q=C.useMemo(()=>{const A=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET),F=A.getActiveSheet();return P.filter(H=>{const q=H.ranges;return U.checkRangesEditablePermission(v,A.getUnitId(),F.getSheetId(),q)})},[P]),oe=Q.map((A,F)=>({i:A.cfId,x:0,w:12,y:F,h:1,isResizable:!1})),de=C.useMemo(()=>{const A=n.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET),F=A.getActiveSheet();return P.every(H=>{const q=H.ranges;return U.checkRangesEditablePermission(v,A.getUnitId(),F.getSheetId(),q)})},[P]);return c.jsxs("div",{children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm",children:[c.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:h.tWithReactNode("sheet.cf.panel.managerRuleSelect",c.jsx(O.Select,{className:"univer-w-36",options:k,value:N,onChange:A=>{_(A)}})).map((A,F)=>c.jsx("span",{children:A},F))}),c.jsxs("div",{className:"univer-flex univer-justify-end",children:[c.jsx(O.Tooltip,{title:s.t("sheet.cf.panel.createRule"),placement:"bottom",children:c.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:G,children:c.jsx(sr,{})})}),P.length&&de?c.jsx(O.Tooltip,{title:s.t("sheet.cf.panel.clear"),placement:"bottom",children:c.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:J,children:c.jsx(Ne,{className:"univer-text-red-500"})})}):c.jsx("div",{children:c.jsx(Ne,{className:"univer-text-gray-300"})})]})]}),c.jsx("div",{ref:S,children:T>0&&c.jsx(O.ReactGridLayout,{className:"[&_.react-grid-item]:univer-transition-none [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200",draggableHandle:".draggableHandle",layout:oe,cols:12,rowHeight:60,width:T,margin:[0,10],onDragStop:$,onDragStart:x,children:Q==null?void 0:Q.map((A,F)=>c.jsx("div",{children:c.jsxs("div",{className:O.clsx("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-bg-gray-100 dark:!univer-bg-gray-700":R===F}),onMouseMove:()=>{A.ranges!==I&&m(A.ranges)},onMouseLeave:()=>m([]),onClick:()=>{e(A)},children:[c.jsx("div",{className:O.clsx("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex","draggableHandle"),onClick:H=>H.stopPropagation(),children:c.jsx(cr,{})}),c.jsxs("div",{className:"univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",children:[c.jsx("div",{className:"univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:at(A,s)}),c.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:A.ranges.map(H=>Ae.serializeRange(H)).join(",")})]}),c.jsx("div",{children:c.jsx(ae,{rule:A.rule})}),c.jsx("div",{className:O.clsx("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded group-hover:univer-flex hover:univer-bg-gray-200",{"univer-flex univer-items-center univer-justify-center":R===F}),onClick:H=>{H.stopPropagation(),y(A),m([])},children:c.jsx(Ne,{})})]})},`${A.cfId}`))})})]})},st=a=>{const[e,t]=C.useState(a.rule),[n,l]=C.useState(!!a.rule),u=()=>{l(!0)},s=()=>{l(!1),t(void 0)},v=d=>{t(d),l(!0)};return c.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",children:n?c.jsx(rt,{onCancel:s,rule:e}):c.jsx(ut,{onClick:v,onCreate:u})})};var it=Object.getOwnPropertyDescriptor,ct=(a,e,t,n)=>{for(var l=n>1?void 0:n?it(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},ge=(a,e)=>(t,n)=>e(t,n,a);const Ve="sheet.conditional.formatting.panel";let ye=class extends i.Disposable{constructor(e,t,n,l,u){super();ee(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=t,this._componentManager=n,this._sidebarService=l,this._localeService=u,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).subscribe(s=>{var v;s||(v=this._sidebarDisposable)==null||v.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(s=>{s.id===Ve&&(s.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const t={id:Ve,header:{title:this._localeService.t("sheet.cf.title")},children:{label:Ve,rule:e,key:i.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(t)}_initPanel(){this.disposeWithMe(this._componentManager.register(Ve,st))}};ye=ct([ge(0,i.IUniverInstanceService),ge(1,i.Inject(i.Injector)),ge(2,i.Inject(j.ComponentManager)),ge(3,i.Inject(j.ISidebarService)),ge(4,i.Inject(i.LocaleService))],ye);var Y=(a=>(a[a.createRule=1]="createRule",a[a.viewRule=2]="viewRule",a[a.highlightCell=3]="highlightCell",a[a.rank=4]="rank",a[a.formula=5]="formula",a[a.colorScale=6]="colorScale",a[a.dataBar=7]="dataBar",a[a.icon=8]="icon",a[a.clearRangeRules=9]="clearRangeRules",a[a.clearWorkSheetRules=10]="clearWorkSheetRules",a))(Y||{});const Ce={id:"sheet.operation.open.conditional.formatting.panel",type:i.CommandType.OPERATION,handler:(a,e)=>{var v;const t=a.get(ye),n=a.get(U.SheetsSelectionsService),l=a.get(i.ICommandService),u=((v=n.getCurrentSelections())==null?void 0:v.map(d=>d.range))||[];switch(e.value){case 3:{t.openPanel({...r.createDefaultRule(),ranges:u});break}case 4:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};t.openPanel(d);break}case 5:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:"="}};t.openPanel(d);break}case 6:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.colorScale,config:[]}};t.openPanel(d);break}case 7:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};t.openPanel(d);break}case 8:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};t.openPanel(d);break}case 2:{t.openPanel();break}case 1:{t.openPanel({...r.createDefaultRule(),ranges:u});break}case 9:{l.executeCommand(r.ClearRangeCfCommand.id,{ranges:u});break}case 10:{l.executeCommand(r.ClearWorksheetCfCommand.id);break}}return!0}};var ot=Object.getOwnPropertyDescriptor,dt=(a,e,t,n)=>{for(var l=n>1?void 0:n?ot(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},me=(a,e)=>(t,n)=>e(t,n,a);D.ConditionalFormattingClearController=class extends i.Disposable{constructor(e,t,n,l,u){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=l,this._conditionalFormattingRuleModel=u,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var u;const t=[],n=[],l={redos:t,undos:n};if([U.ClearSelectionFormatCommand.id,U.ClearSelectionAllCommand.id].includes(e.id)){const s=(u=this._selectionManagerService.getCurrentSelections())==null?void 0:u.map(I=>I.range);if(!s)return l;const v=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),d=v.getActiveSheet();if(!d)return l;const h=v.getUnitId(),o=d.getSheetId(),p=this._conditionalFormattingRuleModel.getSubunitRules(h,o);if(!p||!p.length)return l;const{redos:g,undos:b}=Ir(this._injector,p,s,h,o);t.push(...g),n.push(...b)}return l}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{const l=[],u=[],s={redos:l,undos:u};if(!n||!n.length)return s;const v=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!v||!v.length)return s;const{redos:d,undos:h}=Ir(this._injector,v,n,e,t);return l.push(...d),u.push(...h),s}}))}},D.ConditionalFormattingClearController=dt([me(0,i.Inject(i.Injector)),me(1,i.Inject(i.IUniverInstanceService)),me(2,i.Inject(U.SheetInterceptorService)),me(3,i.Inject(U.SheetsSelectionsService)),me(4,i.Inject(r.ConditionalFormattingRuleModel))],D.ConditionalFormattingClearController);function Ir(a,e,t,n,l){const u=[],s=[];return e.filter(v=>t.some(d=>v.ranges.some(h=>i.Rectangle.getIntersects(h,d)))).forEach(v=>{const h=new U.RangeMergeUtil().add(...v.ranges).subtract(...t).merge();if(h.length){const o={id:r.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:l,rule:{...v,ranges:h}}},p=r.setConditionalRuleMutationUndoFactory(a,o.params);u.push(o),s.push(...p)}else{const o={id:r.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:l,cfId:v.cfId}},p=r.DeleteConditionalRuleMutationUndoFactory(a,o.params);u.push(o),s.push(...p)}}),{redos:u,undos:s}}var vt=Object.getOwnPropertyDescriptor,pt=(a,e,t,n)=>{for(var l=n>1?void 0:n?vt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},Je=(a,e)=>(t,n)=>e(t,n,a);let be=class extends i.Disposable{constructor(e,t,n){super();ee(this,"_disposableMap",new Map);this._conditionalFormattingRuleModel=e,this._formulaRefRangeService=t,this._injector=n,this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}_${t}_${n}`}_getRuleFormulas(e){const t=[],n=e.rule;switch(n.type){case r.CFRuleType.highlightCell:n.subType===r.CFSubRuleType.formula&&t.push(n.value);break;case r.CFRuleType.dataBar:{const l=n;l.config.min.type===r.CFValueType.formula&&t.push(l.config.min.value),l.config.max.type===r.CFValueType.formula&&t.push(l.config.max.value);break}case r.CFRuleType.colorScale:{n.config.forEach(u=>{u.value.type===r.CFValueType.formula&&t.push(u.value.value)});break}case r.CFRuleType.iconSet:{n.config.forEach(u=>{u.value.type===r.CFValueType.formula&&t.push(u.value.value)});break}}return t}_updateRuleFormulas(e,t){const n=i.Tools.deepClone(e),l=n.rule;let u=0;switch(l.type){case r.CFRuleType.highlightCell:l.subType===r.CFSubRuleType.formula&&(l.value=t[u++]);break;case r.CFRuleType.dataBar:{const s=l;s.config.min.type===r.CFValueType.formula&&(s.config.min.value=t[u++]),s.config.max.type===r.CFValueType.formula&&(s.config.max.value=t[u++]);break}case r.CFRuleType.colorScale:{l.config.forEach(v=>{v.value.type===r.CFValueType.formula&&(v.value.value=t[u++])});break}case r.CFRuleType.iconSet:{l.config.forEach(v=>{v.value.type===r.CFValueType.formula&&(v.value.value=t[u++])});break}}return n}register(e,t,n){const l=n.ranges,u=this._getRuleFormulas(n),s=this._formulaRefRangeService.registerRangeFormula(e,t,l,u,d=>{if(d.length===0)return{undos:[{id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:n}}],redos:[{id:r.DeleteConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId}}]};const h=[],o=[],p=d[0],g=this._updateRuleFormulas(n,p.formulas);g.ranges=p.ranges,h.push({id:r.SetConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId,rule:g}}),o.push(...r.setConditionalRuleMutationUndoFactory(this._injector,{unitId:e,subUnitId:t,cfId:n.cfId,rule:g}));for(let b=1;b<d.length;b++){const I=d[b],m=r.createCfId(),N=this._updateRuleFormulas(n,I.formulas);N.cfId=m,N.ranges=I.ranges,h.push({id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:N}}),o.push(r.AddConditionalRuleMutationUndoFactory(this._injector,{unitId:e,subUnitId:t,rule:N}))}return{undos:o,redos:h}}),v=this._getIdWithUnitId(e,t,n.cfId);this._disposableMap.set(v,s)}_initRefRange(){const e=this._conditionalFormattingRuleModel.getAll();for(const[t,n]of e)for(const[l,u]of n)for(const s of u)this.register(t,l,s);this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(t=>{const{unitId:n,subUnitId:l,rule:u}=t;switch(t.type){case"add":{this.register(n,l,u);break}case"delete":{const s=this._getIdWithUnitId(n,l,u.cfId),v=this._disposableMap.get(s);v&&(v.dispose(),this._disposableMap.delete(s));break}case"set":{const s=this._getIdWithUnitId(n,l,u.cfId),v=this._disposableMap.get(s);v&&(v.dispose(),this._disposableMap.delete(s)),this.register(n,l,u);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(t=>{t.dispose()}),this._disposableMap.clear()}))}};be=pt([Je(0,i.Inject(r.ConditionalFormattingRuleModel)),Je(1,i.Inject(nr.FormulaRefRangeService)),Je(2,i.Inject(i.Injector))],be);var ft=Object.getOwnPropertyDescriptor,ht=(a,e,t,n)=>{for(var l=n>1?void 0:n?ft(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},Se=(a,e)=>(t,n)=>e(t,n,a);let Ie=class extends i.Disposable{constructor(e,t,n,l,u){super();ee(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=n,this._conditionalFormattingViewModel=l,this._univerInstanceService=u,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,t,n)=>this._collectConditionalRule(e,t,n),onPasteCells:(e,t,n,l)=>{const{copyType:u=W.COPY_TYPE.COPY,pasteType:s}=l,{range:v}=e||{},{range:d}=t;return this._generateConditionalFormattingMutations(d,{copyType:u,pasteType:s,copyRange:v})}}))}_collectConditionalRule(e,t,n){const l=new i.ObjectMatrix,u={};this._copyInfo={matrix:l,info:{unitId:e,subUnitId:t,cfMap:u}};const s=this._injector.invoke(o=>U.rangeToDiscreteRange(n,o,e,t));if(!s)return;const{rows:v,cols:d}=s,h=new Set;v.forEach((o,p)=>{d.forEach((g,b)=>{const I=this._conditionalFormattingViewModel.getCellCfs(e,t,o,g);I&&(I.forEach(m=>h.add(m.cfId)),l.setValue(p,b,I.map(m=>m.cfId)))})}),h.forEach(o=>{const p=this._conditionalFormattingRuleModel.getRule(e,t,o);p&&(u[o]=p.rule)})}_generateConditionalFormattingMutations(e,t){const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),l=n.getActiveSheet(),u=n.getUnitId();if(!l)return{redos:[],undos:[]};const s=l.getSheetId();if(t.copyType===W.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!t.copyRange)return{redos:[],undos:[]};if(![W.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,W.PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE,W.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER].includes(t.pasteType))return{redos:[],undos:[]};const{ranges:[d,h],mapFunc:o}=W.virtualizeDiscreteRanges([t.copyRange,e]),p=W.getRepeatRange(d,h,!0),g={};i.Range.foreach(h,(f,T)=>{const{row:w,col:S}=o(f,T),k=this._conditionalFormattingViewModel.getCellCfs(u,s,w,S);k&&k.forEach(V=>{if(!g[V.cfId]){const P=new i.ObjectMatrix;g[V.cfId]=P;const L=this._conditionalFormattingRuleModel.getRule(u,s,V.cfId);L==null||L.ranges.forEach(y=>{i.Range.foreach(y,(x,$)=>{P.setValue(x,$,1)})})}g[V.cfId].realDeleteValue(w,S)})});const{matrix:b,info:I}=this._copyInfo,m=[];let N=this._conditionalFormattingRuleModel.createCfId(u,s);const _={},E=f=>{if(_[f])return _[f];const T=I==null?void 0:I.cfMap[f],w=[...this._conditionalFormattingRuleModel.getSubunitRules(u,s)||[],...m].find(S=>i.Tools.diffValue(S.rule,T));if(w)return _[f]=w,w;{const S={rule:T,cfId:N,ranges:[],stopIfTrue:!1};return _[f]=S,m.push(S),N=`${Number(N)+1}`,S}};p.forEach(f=>{b&&b.forValue((T,w,S)=>{const k=i.Rectangle.getPositionRange({startRow:T,endRow:T,startColumn:w,endColumn:w},f.startRange),{row:V,col:P}=o(k.startRow,k.startColumn);S.forEach(L=>{if(!g[L]){const y=E(L),x=new i.ObjectMatrix;g[L]=x,y.ranges.forEach($=>{i.Range.foreach($,(G,J)=>{x.setValue(G,J,1)})})}g[L].setValue(V,P,1)})})});const M=[],R=[];for(const f in g){const T=g[f],w=U.findAllRectangle(U.createTopMatrixFromMatrix(T));if(!w.length){const S={unitId:u,subUnitId:s,cfId:f};M.push({id:r.DeleteConditionalRuleMutation.id,params:S}),R.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}if(m.some(S=>S.cfId===f)){const S=E(f),k={unitId:u,subUnitId:s,rule:{...S,ranges:w}};M.push({id:r.AddConditionalRuleMutation.id,params:k}),R.push(r.AddConditionalRuleMutationUndoFactory(this._injector,k))}else{const S=this._conditionalFormattingRuleModel.getRule(u,s,f);if(!S)continue;const k={unitId:u,subUnitId:s,rule:{...S,ranges:w}};M.push({id:r.SetConditionalRuleMutation.id,params:k}),R.push(...r.setConditionalRuleMutationUndoFactory(this._injector,k))}}return{redos:M,undos:R}}};Ie=ht([Se(0,i.Inject(W.ISheetClipboardService)),Se(1,i.Inject(r.ConditionalFormattingRuleModel)),Se(2,i.Inject(i.Injector)),Se(3,i.Inject(r.ConditionalFormattingViewModel)),Se(4,i.Inject(i.IUniverInstanceService))],Ie);var gt=Object.getOwnPropertyDescriptor,yt=(a,e,t,n)=>{for(var l=n>1?void 0:n?gt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},Qe=(a,e)=>(t,n)=>e(t,n,a);let Te=class extends i.Disposable{constructor(a,e,t){super(),this._localeService=a,this._commandService=e,this._sheetPermissionCheckController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(a=>{if(a.id===r.AddCfCommand.id){const{unitId:e,subUnitId:t,rule:{ranges:n}}=a.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[U.WorkbookEditablePermission],rangeTypes:[U.RangeProtectionPermissionEditPoint],worksheetTypes:[U.WorksheetEditPermission,U.WorksheetSetCellStylePermission]},n,e,t)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))}}))}};Te=yt([Qe(0,i.Inject(i.LocaleService)),Qe(1,i.ICommandService),Qe(2,i.Inject(U.SheetPermissionCheckController))],Te);var Ct=Object.getOwnPropertyDescriptor,mt=(a,e,t,n)=>{for(var l=n>1?void 0:n?Ct(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},ie=(a,e)=>(t,n)=>e(t,n,a);let _e=class extends i.Disposable{constructor(e,t,n,l,u,s){super();ee(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=l,this._conditionalFormattingViewModel=u,this._conditionalFormattingRuleModel=s,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var t,n,l;const e=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId();(t=this._renderManagerService.getRenderById(e))==null||t.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(pe.bufferTime(16),pe.filter(e=>!!e.length),pe.filter(e=>{const t=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const n=t.getActiveSheet();return n?e.filter(l=>l.unitId===t.getUnitId()&&l.subUnitId===n.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(U.INTERCEPTOR_POINT.CELL_CONTENT,{effect:i.InterceptorEffectEnum.Style,handler:(e,t,n)=>{const l=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!l)return n(e);const u=t.workbook.getStyles(),s=(typeof(e==null?void 0:e.s)=="string"?u.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},v=e===t.rawData?{...t.rawData}:e;if(l.style){const d={...s,...l.style};Object.assign(v,{s:d})}return v.fontRenderExtension||(v.fontRenderExtension={},l.isShowValue!==void 0&&(v.fontRenderExtension.isSkip=!l.isShowValue)),l.dataBar&&(v.dataBar=l.dataBar),l.iconSet&&(v.iconSet=l.iconSet,v.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),n(v)},priority:10}))}};_e=mt([ie(0,i.Inject(U.SheetInterceptorService)),ie(1,i.Inject(r.ConditionalFormattingService)),ie(2,i.Inject(i.IUniverInstanceService)),ie(3,i.Inject(lr.IRenderManagerService)),ie(4,i.Inject(r.ConditionalFormattingViewModel)),ie(5,i.Inject(r.ConditionalFormattingRuleModel))],_e);const Tr="sheets-conditional-formatting-ui.config",Oe={};var bt=Object.defineProperty,St=Object.getOwnPropertyDescriptor,It=(a,e,t)=>e in a?bt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Tt=(a,e,t,n)=>{for(var l=n>1?void 0:n?St(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},er=(a,e)=>(t,n)=>e(t,n,a),_r=(a,e,t)=>It(a,typeof e!="symbol"?e+"":e,t);D.UniverSheetsConditionalFormattingMobileUIPlugin=class extends i.Plugin{constructor(e=Oe,t,n,l){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=l;const{menu:u,...s}=i.merge({},Oe,this._config);u&&this._configService.setConfig("menu",u,{merge:!0}),this._configService.setConfig(Tr,s),this._initCommand(),this._injector.add([_e]),this._injector.add([Ie]),this._injector.add([Te]),this._injector.add([se]),this._injector.add([be])}_initCommand(){[$e,Fe,Be,He,We,qe,Ge,Ze,ze,Ce].forEach(e=>{this._commandService.registerCommand(e)})}},_r(D.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),_r(D.UniverSheetsConditionalFormattingMobileUIPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),D.UniverSheetsConditionalFormattingMobileUIPlugin=Tt([i.DependentOn(r.UniverSheetsConditionalFormattingPlugin),er(1,i.Inject(i.Injector)),er(2,i.Inject(i.ICommandService)),er(3,i.IConfigService)],D.UniverSheetsConditionalFormattingMobileUIPlugin);var _t=Object.getOwnPropertyDescriptor,wt=(a,e,t,n)=>{for(var l=n>1?void 0:n?_t(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},we=(a,e)=>(t,n)=>e(t,n,a);let Ue=class extends i.Disposable{constructor(a,e,t,n,l){super(),this._injector=a,this._univerInstanceService=e,this._autoFillService=t,this._conditionalFormattingRuleModel=n,this._conditionalFormattingViewModel=l,this._initAutoFill()}_initAutoFill(){const a=()=>({redos:[],undos:[]}),e=(l,u,s,v,d)=>{var b;const h=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=(b=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId();if(!h||!o)return;const p={startRow:l.row,startColumn:l.col,endColumn:l.col,endRow:l.row},g={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row};i.Range.foreach(s,(I,m)=>{const N=i.Rectangle.getPositionRange({startRow:I,startColumn:m,endColumn:m,endRow:I},p),_=i.Rectangle.getPositionRange({startRow:I,startColumn:m,endColumn:m,endRow:I},g),{row:E,col:M}=d(N.startRow,N.startColumn),R=this._conditionalFormattingViewModel.getCellCfs(h,o,E,M),{row:f,col:T}=d(_.startRow,_.startColumn),w=this._conditionalFormattingViewModel.getCellCfs(h,o,f,T);w&&w.forEach(S=>{let k=v.get(S.cfId);if(!v.get(S.cfId)){const V=this._conditionalFormattingRuleModel.getRule(h,o,S.cfId);if(!V)return;k=new i.ObjectMatrix,V.ranges.forEach(P=>{i.Range.foreach(P,(L,y)=>{k.setValue(L,y,1)})}),v.set(S.cfId,k)}k.realDeleteValue(f,T)}),R&&R.forEach(S=>{let k=v.get(S.cfId);if(!v.get(S.cfId)){const V=this._conditionalFormattingRuleModel.getRule(h,o,S.cfId);if(!V)return;k=new i.ObjectMatrix,V.ranges.forEach(P=>{i.Range.foreach(P,(L,y)=>{k.setValue(L,y,1)})}),v.set(S.cfId,k)}k.setValue(f,T,1)})})},t=(l,u)=>{var _,E,M;const s=(_=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:_.getUnitId(),v=(M=(E=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getActiveSheet())==null?void 0:M.getSheetId(),d=new Map,h=[],o=[];if(!s||!v)return a();const p=W.virtualizeDiscreteRanges([l,u]),[g,b]=p.ranges,{mapFunc:I}=p,m={row:g.startRow,col:g.startColumn};return W.getAutoFillRepeatRange(g,b).forEach(R=>{e(m,R.repeatStartCell,R.relativeRange,d,I)}),d.forEach((R,f)=>{const T=this._conditionalFormattingRuleModel.getRule(s,v,f);if(!T)return;const w=U.findAllRectangle(U.createTopMatrixFromMatrix(R));if(w.length){const S={unitId:s,subUnitId:v,rule:{...T,ranges:w}};h.push({id:r.SetConditionalRuleMutation.id,params:S}),o.push(...r.setConditionalRuleMutationUndoFactory(this._injector,S))}else{const S={unitId:s,subUnitId:v,cfId:T.cfId};h.push({id:r.DeleteConditionalRuleMutation.id,params:S}),o.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,S))}}),{undos:o,redos:h}},n={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(l,u,s)=>{if(s===W.APPLY_TYPE.COPY||s===W.APPLY_TYPE.ONLY_FORMAT||s===W.APPLY_TYPE.SERIES){const{source:v,target:d}=l;return t(v,d)}return a()}};this.disposeWithMe(this._autoFillService.addHook(n))}};Ue=wt([we(0,i.Inject(i.Injector)),we(1,i.Inject(i.IUniverInstanceService)),we(2,i.Inject(W.IAutoFillService)),we(3,i.Inject(r.ConditionalFormattingRuleModel)),we(4,i.Inject(r.ConditionalFormattingViewModel))],Ue);var xt=Object.getOwnPropertyDescriptor,Nt=(a,e,t,n)=>{for(var l=n>1?void 0:n?xt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},wr=(a,e)=>(t,n)=>e(t,n,a);let ke=class extends i.Disposable{constructor(a,e){super(),this._sheetInterceptorService=a,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(i.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(U.AFTER_CELL_EDIT,{handler:(a,e,t)=>{var s,v,d;a||t(a);const n=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),l=(s=n==null?void 0:n.style)!=null?s:{},u=Object.keys(l);if(a!=null&&a.p)return(d=(v=a.p.body)==null?void 0:v.textRuns)==null||d.forEach(h=>{h.ts&&u.forEach(o=>{var p;(p=h.ts)==null||delete p[o]})}),t(a);{const h={...(typeof(a==null?void 0:a.s)=="string"?e.workbook.getStyles().get(a.s):a==null?void 0:a.s)||{}};u.forEach(p=>{delete h[p]});const o={...a,s:{...h}};return t(o)}}})))}};ke=Nt([wr(0,i.Inject(U.SheetInterceptorService)),wr(1,i.Inject(r.ConditionalFormattingService))],ke);const xr=[U.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],xe=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:Y.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:Y.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:Y.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:Y.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:Y.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:Y.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:Y.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:Y.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:Y.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:Y.clearWorkSheetRules}],Et=a=>{const e=a.get(U.SheetsSelectionsService),t=a.get(i.ICommandService),n=a.get(i.IUniverInstanceService),l=a.get(r.ConditionalFormattingRuleModel),u=new X.Observable(d=>X.merge(e.selectionMoveEnd$,e.selectionSet$,new X.Observable(h=>{const o=t.onCommandExecuted(p=>{var m;const{id:g,params:b}=p,I=(m=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:m.getUnitId();xr.includes(g)&&b.unitId===I&&h.next(null)});return()=>o.dispose()})).pipe(pe.debounceTime(16)).subscribe(()=>{var m;const h=((m=e.getCurrentSelections())==null?void 0:m.map(N=>N.range))||[],o=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!o)return;const p=o.getActiveSheet();if(!p)return;const I=(l.getSubunitRules(o.getUnitId(),p.getSheetId())||[]).filter(N=>N.ranges.some(_=>h.some(E=>i.Rectangle.intersects(E,_)))).map(N=>N.ranges).every(N=>U.checkRangesEditablePermission(a,o.getUnitId(),p.getSheetId(),N));d.next(I)})),s=new X.Observable(d=>new X.Observable(h=>{const o=t.onCommandExecuted(p=>{var m;const{id:g,params:b}=p,I=(m=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:m.getUnitId();xr.includes(g)&&b.unitId===I&&h.next(null)});return()=>o.dispose()}).pipe(pe.debounceTime(16)).subscribe(()=>{const h=n.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!h)return;const o=h.getActiveSheet();if(!o)return;const p=l.getSubunitRules(h.getUnitId(),o.getSheetId())||[];if(!p.length)return d.next(!1),!1;const g=p.map(b=>b.ranges).every(b=>U.checkRangesEditablePermission(a,h.getUnitId(),o.getSheetId(),b));d.next(g)})),v=new X.Observable(d=>{u.subscribe(h=>{const o=xe.find(p=>p.value===Y.clearRangeRules);o&&(o.disabled=!h,d.next(xe))}),s.subscribe(h=>{const o=xe.find(p=>p.value===Y.clearWorkSheetRules);o&&(o.disabled=!h,d.next(xe))}),d.next(xe)});return{id:Ce.id,type:j.MenuItemType.SELECTOR,icon:"ConditionsDoubleIcon",tooltip:"sheet.cf.title",selections:v,hidden$:j.getMenuHiddenObservable(a,i.UniverInstanceType.UNIVER_SHEET),disabled$:W.getCurrentRangeDisable$(a,{workbookTypes:[U.WorkbookEditablePermission],worksheetTypes:[U.WorksheetSetCellStylePermission,U.WorksheetEditPermission],rangeTypes:[U.RangeProtectionPermissionEditPoint]})}},Rt={[j.RibbonDataGroup.RULES]:{[Ce.id]:{order:1,menuItemFactory:Et}}};var Mt=Object.getOwnPropertyDescriptor,Vt=(a,e,t,n)=>{for(var l=n>1?void 0:n?Mt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},Nr=(a,e)=>(t,n)=>e(t,n,a);let Pe=class extends i.Disposable{constructor(e,t){super();ee(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=t,this._menuManagerService.mergeMenu(Rt)}};Pe=Vt([Nr(0,i.Inject(i.Injector)),Nr(1,j.IMenuManagerService)],Pe);var Ot=Object.getOwnPropertyDescriptor,Ut=(a,e,t,n)=>{for(var l=n>1?void 0:n?Ot(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},ce=(a,e)=>(t,n)=>e(t,n,a);const kt=(a,e)=>{const t=o=>o.endRow-o.startRow+1,n=o=>o.endColumn-o.startColumn+1,l=t(e)%t(a),u=n(e)%n(a),s=Math.floor(t(e)/t(a)),v=Math.floor(n(e)/n(a)),d=[],h={startRow:0,endRow:t(a)-1,startColumn:0,endColumn:n(a)-1};if(t(e)===1&&n(e)===1){const o={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return d.push({repeatRelativeRange:h,startRange:o}),d}for(let o=0;o<s+(l?.1:0);o++)for(let p=0;p<v+(u?.1:0);p++){const g=t(a)*o,b=n(a)*p,I={startRow:g+e.startRow,endRow:g+e.startRow,startColumn:b+e.startColumn,endColumn:b+e.startColumn};let m=h;o===s&&l&&(m={...m},m.endRow=m.endRow-(t(a)-l)),p===v&&u&&(m={...m},m.endColumn=m.endColumn-(n(a)-u)),d.push({repeatRelativeRange:m,startRange:I})}return d};let De=class extends i.Disposable{constructor(e,t,n,l,u,s){super();ee(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=t,this._formatPainterService=n,this._sheetsSelectionsService=l,this._conditionalFormattingRuleModel=u,this._conditionalFormattingViewModel=s,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),t=(u,s,v,d,h)=>{const{unitId:o,subUnitId:p}=this._painterConfig,{targetUnitId:g,targetSubUnitId:b}=h,I={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row},m={startRow:s.row,startColumn:s.col,endColumn:s.col,endRow:s.row};i.Range.foreach(v,(N,_)=>{const E=i.Rectangle.getPositionRange({startRow:N,startColumn:_,endColumn:_,endRow:N},I),M=i.Rectangle.getPositionRange({startRow:N,startColumn:_,endColumn:_,endRow:N},m),R=this._conditionalFormattingViewModel.getCellCfs(o,p,E.startRow,E.startColumn),f=this._conditionalFormattingViewModel.getCellCfs(g,b,M.startRow,M.startColumn);f&&f.forEach(T=>{let w=d.get(T.cfId);if(!d.get(T.cfId)){const S=this._conditionalFormattingRuleModel.getRule(g,b,T.cfId);if(!S)return;w=new i.ObjectMatrix,S.ranges.forEach(k=>{i.Range.foreach(k,(V,P)=>{w.setValue(V,P,1)})}),d.set(T.cfId,w)}w.realDeleteValue(M.startRow,M.startColumn)}),R&&R.forEach(T=>{const w=d.get(T.cfId);w&&w.setValue(M.startRow,M.startColumn,1)})})},n=(u,s,v)=>{var E;const{range:d,unitId:h,subUnitId:o}=this._painterConfig,p=u!==h||o!==s,g=new Map,b=[],I=[];if(!u||!s||!h||!o)return e();const m=(E=this._conditionalFormattingRuleModel.getSubunitRules(h,o))!=null?E:[];m==null||m.forEach(M=>{const{ranges:R,cfId:f}=M;if(R.some(T=>i.Rectangle.intersects(d,T))){const T=new i.ObjectMatrix;p||R.forEach(w=>{i.Range.foreach(w,(S,k)=>{T.setValue(S,k,1)})}),g.set(f,T)}});const N={row:d.startRow,col:d.startColumn};return kt(d,v).forEach(M=>{t(N,{row:M.startRange.startRow,col:M.startRange.startColumn},M.repeatRelativeRange,g,{targetUnitId:u,targetSubUnitId:s})}),g.forEach((M,R)=>{if(p){const f=this._conditionalFormattingRuleModel.getRule(u,s,R),T=U.findAllRectangle(U.createTopMatrixFromMatrix(M));if(f)if(T.length){const w={unitId:u,subUnitId:s,rule:{...f,ranges:T}};b.push({id:r.SetConditionalRuleMutation.id,params:w}),I.push(...r.setConditionalRuleMutationUndoFactory(this._injector,w))}else{const w={unitId:u,subUnitId:s,cfId:f.cfId};b.push({id:r.DeleteConditionalRuleMutation.id,params:w}),I.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}else if(T.length){const w=this._conditionalFormattingRuleModel.getRule(h,o,R);if(w){const S={unitId:u,subUnitId:s,rule:{...i.Tools.deepClone(w),cfId:this._conditionalFormattingRuleModel.createCfId(u,s),ranges:T}};b.push({id:r.AddConditionalRuleMutation.id,params:S}),I.push(r.AddConditionalRuleMutationUndoFactory(this._injector,S))}}}else{const f=this._conditionalFormattingRuleModel.getRule(h,o,R);if(!f)return;const T=U.findAllRectangle(U.createTopMatrixFromMatrix(M));if(T.length){const w={unitId:h,subUnitId:o,rule:{...f,ranges:T}};b.push({id:r.SetConditionalRuleMutation.id,params:w}),I.push(...r.setConditionalRuleMutationUndoFactory(this._injector,w))}else{const w={unitId:h,subUnitId:o,cfId:f.cfId};b.push({id:r.DeleteConditionalRuleMutation.id,params:w}),I.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}}}),{undos:I,redos:b}},l={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:u=>{var s,v,d;switch(u){case W.FormatPainterStatus.INFINITE:case W.FormatPainterStatus.ONCE:{const h=(s=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getUnitId(),o=(d=(v=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getActiveSheet())==null?void 0:d.getSheetId(),p=this._sheetsSelectionsService.getCurrentLastSelection(),g=p==null?void 0:p.range;h&&o&&g&&(this._painterConfig={unitId:h,subUnitId:o,range:g});break}case W.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(u,s,v)=>this._painterConfig?n(u,s,v):{redos:[],undos:[]}};this._formatPainterService.addHook(l)}};De=Ut([ce(0,i.Inject(i.Injector)),ce(1,i.Inject(i.IUniverInstanceService)),ce(2,i.Inject(W.IFormatPainterService)),ce(3,i.Inject(U.SheetsSelectionsService)),ce(4,i.Inject(r.ConditionalFormattingRuleModel)),ce(5,i.Inject(r.ConditionalFormattingViewModel))],De);var Pt=Object.getOwnPropertyDescriptor,Dt=(a,e,t,n)=>{for(var l=n>1?void 0:n?Pt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},rr=(a,e)=>(t,n)=>e(t,n,a);let Le=class extends i.Disposable{constructor(a,e,t){super(),this._conditionalFormattingViewModel=a,this._univerInstanceService=e,this._renderManagerService=t,this._init()}_init(){const a=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),e=t=>{const n=t.getUnitId(),l=this._renderManagerService.getRenderById(n);if(!l)return;const u=l.with(W.SheetSkeletonManagerService);this.disposeWithMe(u.currentSkeleton$.subscribe(s=>{if(s){const v=s.skeleton.rowColumnSegment,d=v.endColumn-v.startColumn+1,o=(v.endRow-v.startRow+1)*d*9,p=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,o);this._conditionalFormattingViewModel.setCacheLength(p)}}))};a&&e(a),this._univerInstanceService.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{t&&e(t)})}};Le=Dt([rr(0,i.Inject(r.ConditionalFormattingViewModel)),rr(1,i.IUniverInstanceService),rr(2,lr.IRenderManagerService)],Le);var Lt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,At=(a,e,t)=>e in a?Lt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,$t=(a,e,t,n)=>{for(var l=n>1?void 0:n?jt(e,t):e,u=a.length-1,s;u>=0;u--)(s=a[u])&&(l=s(l)||l);return l},tr=(a,e)=>(t,n)=>e(t,n,a),Er=(a,e,t)=>At(a,typeof e!="symbol"?e+"":e,t);D.UniverSheetsConditionalFormattingUIPlugin=class extends i.Plugin{constructor(e=Oe,t,n,l){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=l;const{menu:u,...s}=i.merge({},Oe,this._config);u&&this._configService.setConfig("menu",u,{merge:!0}),this._configService.setConfig(Tr,s),this._initCommand()}onStarting(){i.registerDependencies(this._injector,[[_e],[Ie],[Ue],[Te],[ye],[Pe],[se],[ke],[D.ConditionalFormattingClearController],[De],[Le],[be]]),i.touchDependencies(this._injector,[[_e],[be]])}onReady(){i.touchDependencies(this._injector,[[Pe],[ye]])}onRendered(){i.touchDependencies(this._injector,[[Ue],[D.ConditionalFormattingClearController],[Ie],[ke],[se],[De],[Te],[Le]])}_initCommand(){[$e,Fe,Be,He,We,qe,Ge,Ze,ze,Ce].forEach(e=>{this._commandService.registerCommand(e)})}},Er(D.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),Er(D.UniverSheetsConditionalFormattingUIPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),D.UniverSheetsConditionalFormattingUIPlugin=$t([i.DependentOn(r.UniverSheetsConditionalFormattingPlugin,nr.UniverSheetsFormulaPlugin),tr(1,i.Inject(i.Injector)),tr(2,i.Inject(i.ICommandService)),tr(3,i.IConfigService)],D.UniverSheetsConditionalFormattingUIPlugin),D.AddAverageCfCommand=$e,D.AddColorScaleConditionalRuleCommand=Fe,D.AddDataBarConditionalRuleCommand=Be,D.AddDuplicateValuesCfCommand=He,D.AddNumberCfCommand=We,D.AddRankCfCommand=qe,D.AddTextCfCommand=Ge,D.AddTimePeriodCfCommand=Ze,D.AddUniqueValuesCfCommand=ze,D.OpenConditionalFormattingOperator=Ce,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
// 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.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/sheets-conditional-formatting": "0.
|
|
62
|
-
"@univerjs/sheets-conditional-formatting-ui": "0.
|
|
61
|
+
"@univerjs/sheets-conditional-formatting": "0.14.0",
|
|
62
|
+
"@univerjs/sheets-conditional-formatting-ui": "0.14.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@univerjs/core": "0.
|
|
65
|
+
"@univerjs/core": "0.14.0",
|
|
66
66
|
"react": "18.3.1",
|
|
67
67
|
"react-dom": "18.3.1",
|
|
68
68
|
"rxjs": "7.8.2",
|
|
69
69
|
"typescript": "^5.9.3",
|
|
70
|
-
"@univerjs-infra/shared": "0.
|
|
70
|
+
"@univerjs-infra/shared": "0.14.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"prebuild:preset": "tsx prepare.ts",
|