@univerjs/sheets-filter-ui 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +4 -4
- package/lib/es/index.js +1261 -1233
- package/lib/types/controllers/sheets-filter-render.controller.d.ts +5 -5
- package/lib/umd/index.js +4 -4
- package/package.json +40 -25
package/lib/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var pn=Object.defineProperty;var vn=(e,t,r)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var I=(e,t,r)=>(vn(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@univerjs/core"),L=require("@wendellhu/redi"),D=require("@univerjs/ui"),N=require("rxjs"),de=require("@univerjs/sheets-ui"),Ke=require("@univerjs/engine-render"),c=require("@univerjs/sheets-filter"),q=require("@univerjs/design"),G=require("@univerjs/sheets"),h=require("react"),Ge=require("@wendellhu/redi/react-bindings"),Bt=require("react-dom");function gn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const v=gn(h);var se=function(){return se=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},se.apply(this,arguments)},_n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},Tr=h.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=_n(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=h.useRef("_".concat(bn()));return Cr(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},se({ref:t,className:s},i),a)});function Cr(e,t,r,n,o){return h.createElement(e.tag,se(se({key:t},Sn(e,r,o)),n),(En(e,r).children||[]).map(function(a,i){return Cr(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function Sn(e,t,r){var n=se({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var i=a[0],s=a[1];typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function En(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?se(se({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?se(se({},o),{attrs:se(se({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function bn(){return Math.random().toString(36).substring(2,8)}Tr.displayName="UniverIcon";var yn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ir=h.forwardRef(function(e,t){return h.createElement(Tr,Object.assign({},e,{id:"filter-single",ref:t,icon:yn}))});Ir.displayName="FilterSingle";const Ie={id:"sheet.command.smart-toggle-filter",type:_.CommandType.COMMAND,handler:async e=>{const t=e.get(_.IUniverInstanceService),r=e.get(c.SheetsFilterService),n=e.get(_.ICommandService),o=e.get(_.IUndoRedoService),a=t.getCurrentUnitForType(_.UniverInstanceType.UNIVER_SHEET),i=a==null?void 0:a.getActiveSheet();if(!i||!a)return!1;const s=a.getUnitId(),l=i.getSheetId(),u=r.getFilterModel(s,l);if(u){const g=u==null?void 0:u.serialize(),b=On(s,l,g),R=n.syncExecuteCommand(c.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return R&&o.pushUndoRedo({unitID:s,undoMutations:b,redoMutations:[{id:c.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),R}const d=e.get(G.SelectionManagerService).getLast();if(!d)return!1;const p=d.range,m=G.isSingleCellSelection(d)?de.expandToContinuousRange(p,{left:!0,right:!0,up:!0,down:!0},i):p;if(m.endRow===m.startRow){const g=e.get(D.IMessageService,L.Quantity.OPTIONAL),b=e.get(_.LocaleService);return g==null||g.show({type:q.MessageType.Warning,content:b.t("sheets-filter.command.not-valid-filter-range")}),!1}const S={id:c.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:m}},E=n.syncExecuteCommand(S.id,S.params);return E&&o.pushUndoRedo({unitID:s,undoMutations:[{id:c.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[S]}),E}},De={id:"sheet.command.set-filter-criteria",type:_.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(c.SheetsFilterService),n=e.get(_.ICommandService),o=e.get(_.IUndoRedoService),{unitId:a,subUnitId:i,col:s,criteria:l}=t,u=r.getFilterModel(a,i);if(!u)return!1;const f=u.getRange();if(!f||s<f.startColumn||s>f.endColumn)return!1;const d=u.getFilterColumn(s),p=Rn(a,i,s,d),m={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:a,subUnitId:i,col:s,criteria:l}},S=n.syncExecuteCommand(m.id,m.params);return S&&o.pushUndoRedo({unitID:a,undoMutations:[p],redoMutations:[m]}),S}},Pr={id:"sheet.command.clear-filter-criteria",type:_.CommandType.COMMAND,handler:e=>{const t=e.get(c.SheetsFilterService),r=e.get(_.IUndoRedoService),n=e.get(_.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=Mr(a,i,s),u=Fn(a,i,s);return _.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},Nr={id:"sheet.command.re-calc-filter",type:_.CommandType.COMMAND,handler:e=>{const t=e.get(c.SheetsFilterService),r=e.get(_.ICommandService),n=t.activeFilterModel;if(!n)return!1;const{unitId:o,subUnitId:a}=n;return r.executeCommand(c.ReCalcSheetsFilterMutation.id,{unitId:o,subUnitId:a})}};function On(e,t,r){const n=[],o={id:c.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),Mr(e,t,r).forEach(i=>n.push(i)),n}function Mr(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:a}};n.push(i)}),n}function Fn(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:null}};n.push(i)}),n}function Rn(e,t,r,n){if(!n)return{id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:null}};const o=n.serialize();return{id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:o}}}var V=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(V||{}),P=(e=>(e.NONE="none",e.STARTS_WITH="startsWith",e.DOES_NOT_START_WITH="doesNotStartWith",e.ENDS_WITH="endsWith",e.DOES_NOT_END_WITH="doesNotEndWith",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="doesNotContain",e.EQUALS="equals",e.NOT_EQUALS="notEquals",e.EMPTY="empty",e.NOT_EMPTY="notEmpty",e.BETWEEN="between",e.NOT_BETWEEN="notBetween",e.CUSTOM="custom",e))(P||{}),F;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:P.NONE,order:V.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===P.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:P.EMPTY,order:V.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:P.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:P.NOT_EMPTY,order:V.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:" ",operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===c.CustomFilterOperator.NOT_EQUALS?{operator1:P.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:P.CONTAINS,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===P.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&l.endsWith("*")?{operator1:P.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:P.DOES_NOT_CONTAIN,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=fe(i);return s===P.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return s.operator===c.CustomFilterOperator.NOT_EQUALS&&l.startsWith("*")&&l.endsWith("*")?{operator1:P.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:P.STARTS_WITH,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=fe(i);return s===P.STARTS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.endsWith("*")&&!l.startsWith("*")?{operator1:P.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:P.ENDS_WITH,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=fe(i);return s===P.ENDS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&!l.endsWith("*")?{operator1:P.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:P.EQUALS,order:V.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.EQUALS,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===P.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,l,u;return((l=(s=i.filters)==null?void 0:s.filters)==null?void 0:l.length)===1?{operator1:P.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:P.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},e.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:c.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=fe(i);return s===c.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.GREATER_THAN?!1:{operator1:c.CustomFilterOperator.GREATER_THAN,val1:s.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString()}}},e.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:c.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===c.CustomFilterOperator.LESS_THAN},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.LESS_THAN?!1:{operator1:c.CustomFilterOperator.LESS_THAN,val1:s.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===c.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:s.val.toString()}}},e.EQUAL={label:"sheets-filter.conditions.equal",operator:c.CustomFilterOperator.EQUAL,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===c.CustomFilterOperator.EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.EQUAL?!1:{operator1:c.CustomFilterOperator.EQUAL,val1:s.val.toString()}}},e.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:c.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:V.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=fe(i);return s===c.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.NOT_EQUALS?!1:{operator1:c.CustomFilterOperator.NOT_EQUALS,val1:s.val.toString()}}},e.BETWEEN={label:"sheets-filter.conditions.between",operator:P.BETWEEN,order:V.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(!s)return!1;const f=[l,u];return f.includes(c.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&f.includes(c.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,f=u===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:_.BooleanNumber.TRUE,customFilters:[{val:f?s:l,operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:f?l:s,operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&l.operator===c.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:l.val.toString()}:l.operator===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&s.operator===c.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:l.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:s.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:P.NOT_BETWEEN,order:V.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN,val1:"",operator2:c.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(s)return!1;const f=[l,u];return f.includes(c.CustomFilterOperator.GREATER_THAN)&&f.includes(c.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,f=u===c.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:f?s:l,operator:c.CustomFilterOperator.GREATER_THAN},{val:f?l:s,operator:c.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===c.CustomFilterOperator.LESS_THAN&&l.operator===c.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:c.CustomFilterOperator.LESS_THAN,val1:s.val.toString(),operator2:c.CustomFilterOperator.GREATER_THAN,val2:l.val.toString()}:l.operator===c.CustomFilterOperator.LESS_THAN&&s.operator===c.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:c.CustomFilterOperator.GREATER_THAN,val1:l.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN,val2:s.val.toLocaleString()}:!1}},e.CUSTOM={label:"sheets-filter.conditions.custom",operator:P.CUSTOM,order:V.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:P.NONE,val1:"",operator2:P.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:f,operator2:d}=i;function p(R,w){for(const C of e.ALL_CONDITIONS)if(C.operator===R)return C.mapToFilterColumn({val1:w,operator1:R})}const m=!f||f===e.NONE.operator,S=!d||d===e.NONE.operator;if(m&&S)return e.NONE.mapToFilterColumn({});if(m)return p(d,u);if(S)return p(f,l);const E=p(f,l),g=p(d,u),b={customFilters:[E.customFilters.customFilters[0],g.customFilters.customFilters[0]]};return s&&(b.and=_.BooleanNumber.TRUE),{customFilters:b}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(f=>a({customFilters:{customFilters:[f]}})),l={operator1:s[0][0].operator,val1:s[0][1].val1,operator2:s[1][0].operator,val2:s[1][1].val1};return i.customFilters.and&&(l.and=!0),l}},e.ALL_CONDITIONS=[e.NONE,e.EMPTY,e.NOT_EMPTY,e.TEXT_CONTAINS,e.DOES_NOT_CONTAIN,e.STARTS_WITH,e.ENDS_WITH,e.EQUALS,e.GREATER_THAN,e.GREATER_THAN_OR_EQUAL,e.LESS_THAN,e.LESS_THAN_OR_EQUAL,e.EQUAL,e.NOT_EQUAL,e.BETWEEN,e.NOT_BETWEEN,e.CUSTOM];function t(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}e.getItemByOperator=t;function r(i,s){for(const l of e.ALL_CONDITIONS.filter(u=>u.numOfParameters===s))if(l.numOfParameters!==0&&l.testMappingParams(i))return l;for(const l of e.ALL_CONDITIONS)if(l.testMappingParams(i))return l;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}e.testMappingParams=r;function n(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}e.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}e.mapToFilterColumn=o;function a(i){if(!i)return[e.NONE,{}];for(const s of e.ALL_CONDITIONS){const l=s.testMappingFilterColumn(i);if(l)return[s,l]}return[e.NONE,{}]}e.testMappingFilterColumn=a})(F||(F={}));function fe(e){const{operator1:t,operator2:r,val1:n,val2:o}=e;if(t&&r)throw new Error("Both operator1 and operator2 are set!");if(!t&&!r)throw new Error("Neither operator1 and operator2 and both not set!");return t?[t,n]:[r,o]}function jt(e){const t=[],r=[];for(const n of e)n.checked?t.push(n):r.push(n);return{checkedItems:t,uncheckedItems:r,checked:t.length,unchecked:r.length}}var Tn=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,qt=(e,t,r,n)=>{for(var o=n>1?void 0:n?Cn(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Tn(t,r,o),o},Le=(e,t)=>(r,n)=>t(r,n,e),ct=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(ct||{});L.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let Oe=class extends _.Disposable{constructor(t,r,n,o){super();I(this,"_filterBy$",new N.BehaviorSubject(0));I(this,"filterBy$",this._filterBy$.asObservable());I(this,"_filterByModel$",new N.ReplaySubject(1));I(this,"filterByModel$",this._filterByModel$.asObservable());I(this,"_filterByModel",null);I(this,"_hasCriteria$",new N.BehaviorSubject(!1));I(this,"hasCriteria$",this._hasCriteria$.asObservable());I(this,"_filterModel",null);I(this,"_col$",new N.BehaviorSubject(-1));I(this,"col$",this._col$.asObservable());I(this,"_filterHeaderListener",null);this._injector=t,this._sheetsFilterService=r,this._univerInstanceService=n,this._refRangeService=o}get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(t){this._filterByModel=t,this._filterByModel$.next(t)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(t,r){this.terminate(),this._filterModel=t,this._col$.next(r);const n=t.getFilterColumn(r);if(n){const o=n.getColumnData();return o.customFilters?(this._hasCriteria$.next(!0),this._setupByConditions(t,r)):o.filters?(this._hasCriteria$.next(!0),this._setupByValues(t,r)):(this._hasCriteria$.next(!1),this._setupByValues(t,r))}return this._hasCriteria$.next(!1),this._setupByValues(t,r)}changeFilterBy(t){return!this._filterModel||this.col===-1?!1:(t===0?this._setupByValues(this._filterModel,this.col):this._setupByConditions(this._filterModel,this.col),!0)}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var t;(t=this._filterHeaderListener)==null||t.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(t,r){this._disposeFilterHeaderChangeListener();const n=t.unitId,o=t.subUnitId,a=t.getRange(),i={startColumn:r,startRow:a.startRow,endRow:a.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,l)=>{if(!l)this.terminate();else{const u=l.startColumn-s.startColumn;u!==0&&this._filterByModel.deltaCol(u)}})}_setupByValues(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=ht.fromFilterColumn(this._injector,t,r);return this.filterByModel=o,this._filterBy$.next(0),this._listenToFilterHeaderChange(t,r),!0}_setupByConditions(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=ft.fromFilterColumn(this._injector,t,r,t.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(t,r),!0}_disposePreviousModel(){var t;(t=this._filterByModel)==null||t.dispose(),this.filterByModel=null}};Oe=qt([Le(0,L.Inject(L.Injector)),Le(1,L.Inject(c.SheetsFilterService)),Le(2,_.IUniverInstanceService),Le(3,L.Inject(G.RefRangeService))],Oe);let ft=class extends _.Disposable{constructor(t,r,n,o,a){super();I(this,"canApply$",N.of(!0));I(this,"_conditionItem$");I(this,"conditionItem$");I(this,"_filterConditionFormParams$");I(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new N.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new N.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=F.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(ft,r,n,a,i)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(t){this.col+=t}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(De.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=F.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(De.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=F.ALL_CONDITIONS.find(n=>n.operator===t);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${t}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(F.getInitialFormParams(t))}onConditionFormChange(t){const r={...this.filterConditionFormParams,...t};if(r.and!==!0&&delete r.and,typeof t.and<"u"||typeof t.operator1<"u"||typeof t.operator2<"u"){const n=F.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};ft=qt([Le(4,_.ICommandService)],ft);let ht=class extends _.Disposable{constructor(t,r,n,o){super();I(this,"_rawFilterItems$");I(this,"rawFilterItems$");I(this,"filterItems$");I(this,"_filterItems",[]);I(this,"canApply$");I(this,"_manuallyUpdateFilterItems$");I(this,"_searchString$");I(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new N.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new N.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new N.Subject,this.filterItems$=N.merge(N.combineLatest([this._searchString$.pipe(N.throttleTime(500,void 0,{leading:!0,trailing:!0}),N.startWith(void 0)),this._rawFilterItems$]).pipe(N.map(([a,i])=>{if(!a)return i;const l=a.toLowerCase().split(/\s+/).filter(u=>!!u);return i.filter(u=>{const f=u.value.toLowerCase();return l.some(d=>f.includes(d))})})),this._manuallyUpdateFilterItems$).pipe(N.shareReplay(1)),this.canApply$=this.filterItems$.pipe(N.map(a=>jt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var $;const o=t.get(_.IUniverInstanceService),a=t.get(_.LocaleService),{unitId:i,subUnitId:s}=r,l=o.getUniverSheetInstance(i);if(!l)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${i}!`);const u=l==null?void 0:l.getSheetBySheetId(s);if(!u)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${i} and subUnitId: ${s}!`);const f=r.getRange(),d=n,p=($=r.getFilterColumn(n))==null?void 0:$.getColumnData().filters,m=!!(p&&p.blank),S={...f,startRow:f.startRow+1,startColumn:d,endColumn:d},E=[],g={},b=new Set(p==null?void 0:p.filters),R=r.getFilteredOutRowsExceptCol(n);let w=0,C=0;for(const T of u.iterateByColumn(S,!1,!1)){const{row:H,rowSpan:j=1}=T;let k=0;for(;k<j;){const ee=H+k;if(R.has(ee)){k++;continue}const Y=T!=null&&T.value?_.extractPureTextFromCell(T.value):"";if(!Y){C+=1,k+=j;continue}if(g[Y])g[Y].count++;else{const ne={value:Y,checked:b.size?b.has(Y):!m,count:1,index:w,isEmpty:!1};g[Y]=ne,E.push(ne)}k++}w++}const x=p?m:!0;if(C>0){const T={value:a.t("sheets-filter.panel.empty"),checked:x,count:C,index:w,isEmpty:!0};E.push(T)}return t.createInstance(ht,r,n,E)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(t){this.col+=t}setSearchString(t){this._searchString$.next(t)}onFilterCheckToggled(t,r){const n=this._filterItems.slice(),o=n.find(a=>a.index===t.index);o.checked=r,this._manuallyUpdateFilterItems(n)}onFilterOnly(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=n.index===t.index),this._manuallyUpdateFilterItems(r)}onCheckAllToggled(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=t),this._manuallyUpdateFilterItems(r)}_manuallyUpdateFilterItems(t){this._manuallyUpdateFilterItems$.next(t)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(De.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=jt(this._filterItems),{checked:r,checkedItems:n}=t,o=this.rawFilterItems,a=r===0,i=t.checked===o.length,s={colId:this.col};if(a)throw new Error("[ByValuesModel]: no checked items!");if(i)return this._commandService.executeCommand(De.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{s.filters={};const l=n.filter(f=>!f.isEmpty);l.length>0&&(s.filters={filters:l.map(f=>f.value)}),l.length!==n.length&&(s.filters.blank=!0)}return this._commandService.executeCommand(De.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};ht=qt([Le(3,_.ICommandService)],ht);const $e="FILTER_PANEL_OPENED",gt={id:"sheet.operation.open-filter-panel",type:_.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(_.IContextService),n=e.get(c.SheetsFilterService),o=e.get(Oe);e.get(_.ICommandService).syncExecuteCommand(de.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:i,subUnitId:s,col:l}=t,u=n.getFilterModel(i,s);return!u||!o.setupCol(u,l)?!1:(r.getContextValue($e)||r.setContextValue($e,!0),!0)}},qe={id:"sheet.operation.close-filter-panel",type:_.CommandType.OPERATION,handler:e=>{const t=e.get(_.IContextService),r=e.get(Oe),n=e.get(D.ILayoutService,L.Quantity.OPTIONAL);return t.getContextValue($e)?(t.setContextValue($e,!1),n==null||n.focus(),r.terminate()):!1}},wr={id:"sheet.operation.apply-filter",type:_.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(Oe).changeFilterBy(r)}},In="univer-sheets-filter-panel",Pn="univer-sheets-filter-panel-header",Nn="univer-sheets-filter-panel-content",Mn="univer-sheets-filter-panel-select-all",wn="univer-sheets-filter-panel-select-all-count",An="univer-sheets-filter-panel-values-container",Ln="univer-input-affix-wrapper",Dn="univer-select",$n="univer-radio-group",Hn="univer-sheets-filter-panel-values-find",Un="univer-sheets-filter-panel-values-list",xn="univer-sheets-filter-panel-values-list-inner-container",Bn="univer-sheets-filter-panel-values-virtual",jn="univer-sheets-filter-panel-values-item",Wn="univer-sheets-filter-panel-values-item-inner",kn="univer-sheets-filter-panel-values-item-count",Vn="univer-sheets-filter-panel-values-item-exclude-button",zn="univer-sheets-filter-panel-values-item-text",Qn="univer-sheets-filter-panel-conditions-container",Gn="univer-sheets-filter-panel-conditions-container-inner",qn="univer-sheets-filter-panel-conditions-desc",Yn="univer-sheets-filter-panel-footer",Xn="univer-sheets-filter-panel-footer-primary-buttons",Kn="univer-button",Zn="univer-input",Jn="univer-form-dual-column-layout",B={sheetsFilterPanel:In,sheetsFilterPanelHeader:Pn,sheetsFilterPanelContent:Nn,sheetsFilterPanelSelectAll:Mn,sheetsFilterPanelSelectAllCount:wn,sheetsFilterPanelValuesContainer:An,inputAffixWrapper:Ln,select:Dn,radioGroup:$n,sheetsFilterPanelValuesFind:Hn,sheetsFilterPanelValuesList:Un,sheetsFilterPanelValuesListInnerContainer:xn,sheetsFilterPanelValuesVirtual:Bn,sheetsFilterPanelValuesItem:jn,sheetsFilterPanelValuesItemInner:Wn,sheetsFilterPanelValuesItemCount:kn,sheetsFilterPanelValuesItemExcludeButton:Vn,sheetsFilterPanelValuesItemText:zn,sheetsFilterPanelConditionsContainer:Qn,sheetsFilterPanelConditionsContainerInner:Gn,sheetsFilterPanelConditionsDesc:qn,sheetsFilterPanelFooter:Yn,sheetsFilterPanelFooterPrimaryButtons:Xn,button:Kn,input:Zn,formDualColumnLayout:Jn};function ei(e){const{model:t}=e,r=Ge.useDependency(_.LocaleService),n=D.useObservable(t.conditionItem$,void 0,!0),o=D.useObservable(t.filterConditionFormParams$,void 0,!0),{operator:a,numOfParameters:i}=n,{operator1:s,operator2:l,val1:u,val2:f,and:d}=o,p=d?"AND":"OR",m=h.useCallback(C=>{t.onConditionFormChange({and:C==="AND"})},[t]),S=ti(r),E=h.useCallback(C=>{t.onPrimaryConditionChange(C)},[t]),g=ri(r),b=h.useCallback(C=>{t.onConditionFormChange(C)},[t]),R=r.t("sheets-filter.panel.input-values-placeholder");function w(C,x,$){const T=F.getItemByOperator(C).numOfParameters===1;return h.createElement(h.Fragment,null,$==="operator2"&&h.createElement(q.RadioGroup,{value:p,onChange:m},h.createElement(q.Radio,{value:"AND"},r.t("sheets-filter.panel.and")),h.createElement(q.Radio,{value:"OR"},r.t("sheets-filter.panel.or"))),h.createElement(q.Select,{value:C,options:g,onChange:H=>b({[$]:H})}),T&&h.createElement(q.Input,{value:x,placeholder:R,onChange:H=>b({[$==="operator1"?"val1":"val2"]:H})}))}return h.createElement("div",{className:B.sheetsFilterPanelConditionsContainer},h.createElement(q.Select,{value:a,options:S,onChange:E}),F.getItemByOperator(a).numOfParameters!==0?h.createElement("div",{className:B.sheetsFilterPanelConditionsContainerInner},i>=1&&w(s,u!=null?u:"","operator1"),i>=2&&w(l,f!=null?f:"","operator2"),h.createElement("div",{className:B.sheetsFilterPanelConditionsDesc},r.t("sheets-filter.panel.?"),h.createElement("br",null),r.t("sheets-filter.panel.*"))):null)}function ti(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{options:[{label:e.t(F.NONE.label),value:F.NONE.operator}]},{options:[{label:e.t(F.EMPTY.label),value:F.EMPTY.operator},{label:e.t(F.NOT_EMPTY.label),value:F.NOT_EMPTY.operator}]},{options:[{label:e.t(F.TEXT_CONTAINS.label),value:F.TEXT_CONTAINS.operator},{label:e.t(F.DOES_NOT_CONTAIN.label),value:F.DOES_NOT_CONTAIN.operator},{label:e.t(F.STARTS_WITH.label),value:F.STARTS_WITH.operator},{label:e.t(F.ENDS_WITH.label),value:F.ENDS_WITH.operator},{label:e.t(F.EQUALS.label),value:F.EQUALS.operator}]},{options:[{label:e.t(F.GREATER_THAN.label),value:F.GREATER_THAN.operator},{label:e.t(F.GREATER_THAN_OR_EQUAL.label),value:F.GREATER_THAN_OR_EQUAL.operator},{label:e.t(F.LESS_THAN.label),value:F.LESS_THAN.operator},{label:e.t(F.LESS_THAN_OR_EQUAL.label),value:F.LESS_THAN_OR_EQUAL.operator},{label:e.t(F.EQUAL.label),value:F.EQUAL.operator},{label:e.t(F.NOT_EQUAL.label),value:F.NOT_EQUAL.operator},{label:e.t(F.BETWEEN.label),value:F.BETWEEN.operator},{label:e.t(F.NOT_BETWEEN.label),value:F.NOT_BETWEEN.operator}]},{options:[{label:e.t(F.CUSTOM.label),value:F.CUSTOM.operator}]}],[t,e])}function ri(e){const t=e.getCurrentLocale();return h.useMemo(()=>F.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:e.t(r.label),value:r.operator})),[t,e])}function Ze(){return Ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ze.apply(this,arguments)}function me(e){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}function ni(e,t){if(me(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(me(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ar(e){var t=ni(e,"string");return me(t)=="symbol"?t:t+""}function J(e,t,r){return t=Ar(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hr(Object(r),!0).forEach(function(n){J(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ii(e){if(Array.isArray(e))return e}function oi(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(f){u=!0,o=f}finally{try{if(!l&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return s}}function dr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function si(e,t){if(e){if(typeof e=="string")return dr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dr(e,t)}}function ai(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
1
|
+
"use strict";var bn=Object.defineProperty;var yn=(e,t,r)=>t in e?bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var M=(e,t,r)=>(yn(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@univerjs/core"),L=require("@wendellhu/redi"),c=require("@univerjs/sheets-filter"),D=require("@univerjs/ui"),N=require("rxjs"),me=require("@univerjs/sheets-ui"),Xe=require("@univerjs/engine-render"),G=require("@univerjs/design"),Q=require("@univerjs/sheets"),h=require("react"),ze=require("@wendellhu/redi/react-bindings"),ft=require("react-dom");function Fn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const p=Fn(h);var le=function(){return le=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},le.apply(this,arguments)},On=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},Pr=h.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,a=e.extend,i=On(e,["icon","id","className","extend"]),s="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=h.useRef("_".concat(Tn()));return Nr(r,"".concat(n),{defIds:r.defIds,idSuffix:l.current},le({ref:t,className:s},i),a)});function Nr(e,t,r,n,o){return h.createElement(e.tag,le(le({key:t},Rn(e,r,o)),n),(Cn(e,r).children||[]).map(function(a,i){return Nr(a,"".concat(t,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function Rn(e,t,r){var n=le({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var i=a[0],s=a[1];typeof s=="string"&&(n[i]=s.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Cn(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?le(le({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?le(le({},o),{attrs:le(le({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Tn(){return Math.random().toString(36).substring(2,8)}Pr.displayName="UniverIcon";var In={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Mr=h.forwardRef(function(e,t){return h.createElement(Pr,Object.assign({},e,{id:"filter-single",ref:t,icon:In}))});Mr.displayName="FilterSingle";const Te={id:"sheet.command.smart-toggle-filter",type:g.CommandType.COMMAND,handler:async e=>{const t=e.get(g.IUniverInstanceService),r=e.get(c.SheetsFilterService),n=e.get(g.ICommandService),o=e.get(g.IUndoRedoService),a=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),i=a==null?void 0:a.getActiveSheet();if(!i||!a)return!1;const s=a.getUnitId(),l=i.getSheetId(),u=r.getFilterModel(s,l);if(u){const S=u==null?void 0:u.serialize(),F=Pn(s,l,S),b=n.syncExecuteCommand(c.RemoveSheetsFilterMutation.id,{unitId:s,subUnitId:l});return b&&o.pushUndoRedo({unitID:s,undoMutations:F,redoMutations:[{id:c.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}]}),b}const m=e.get(Q.SelectionManagerService).getLast();if(!m)return!1;const v=m.range,d=Q.isSingleCellSelection(m)?me.expandToContinuousRange(v,{left:!0,right:!0,up:!0,down:!0},i):v;if(d.endRow===d.startRow){const S=e.get(D.IMessageService,L.Quantity.OPTIONAL),F=e.get(g.LocaleService);return S==null||S.show({type:G.MessageType.Warning,content:F.t("sheets-filter.command.not-valid-filter-range")}),!1}const E={id:c.SetSheetsFilterRangeMutation.id,params:{unitId:s,subUnitId:l,range:d}},_=n.syncExecuteCommand(E.id,E.params);return _&&o.pushUndoRedo({unitID:s,undoMutations:[{id:c.RemoveSheetsFilterMutation.id,params:{unitId:s,subUnitId:l}}],redoMutations:[E]}),_}},Le={id:"sheet.command.set-filter-criteria",type:g.CommandType.COMMAND,handler:async(e,t)=>{const r=e.get(c.SheetsFilterService),n=e.get(g.ICommandService),o=e.get(g.IUndoRedoService),{unitId:a,subUnitId:i,col:s,criteria:l}=t,u=r.getFilterModel(a,i);if(!u)return!1;const f=u.getRange();if(!f||s<f.startColumn||s>f.endColumn)return!1;const m=u.getFilterColumn(s),v=Mn(a,i,s,m),d={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:a,subUnitId:i,col:s,criteria:l}},E=n.syncExecuteCommand(d.id,d.params);return E&&o.pushUndoRedo({unitID:a,undoMutations:[v],redoMutations:[d]}),E}},wr={id:"sheet.command.clear-filter-criteria",type:g.CommandType.COMMAND,handler:e=>{const t=e.get(c.SheetsFilterService),r=e.get(g.IUndoRedoService),n=e.get(g.ICommandService),o=t.activeFilterModel;if(!o)return!1;const{unitId:a,subUnitId:i}=o,s=o.serialize(),l=Lr(a,i,s),u=Nn(a,i,s);return g.sequenceExecute(u,n)&&r.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:u}),!0}},Ar={id:"sheet.command.re-calc-filter",type:g.CommandType.COMMAND,handler:e=>{const t=e.get(c.SheetsFilterService),r=e.get(g.ICommandService),n=t.activeFilterModel;if(!n)return!1;const{unitId:o,subUnitId:a}=n;return r.executeCommand(c.ReCalcSheetsFilterMutation.id,{unitId:o,subUnitId:a})}};function Pn(e,t,r){const n=[],o={id:c.SetSheetsFilterRangeMutation.id,params:{unitId:e,subUnitId:t,range:r.ref}};return n.push(o),Lr(e,t,r).forEach(i=>n.push(i)),n}function Lr(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:a}};n.push(i)}),n}function Nn(e,t,r){var o;const n=[];return(o=r.filterColumns)==null||o.forEach(a=>{const i={id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:a.colId,criteria:null}};n.push(i)}),n}function Mn(e,t,r,n){if(!n)return{id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:null}};const o=n.serialize();return{id:c.SetSheetsFilterCriteriaMutation.id,params:{unitId:e,subUnitId:t,col:r,criteria:o}}}var z=(e=>(e[e.FIRST=0]="FIRST",e[e.SECOND=1]="SECOND",e))(z||{}),P=(e=>(e.NONE="none",e.STARTS_WITH="startsWith",e.DOES_NOT_START_WITH="doesNotStartWith",e.ENDS_WITH="endsWith",e.DOES_NOT_END_WITH="doesNotEndWith",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="doesNotContain",e.EQUALS="equals",e.NOT_EQUALS="notEquals",e.EMPTY="empty",e.NOT_EMPTY="notEmpty",e.BETWEEN="between",e.NOT_BETWEEN="notBetween",e.CUSTOM="custom",e))(P||{}),R;(e=>{e.NONE={label:"sheets-filter.conditions.none",operator:P.NONE,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NONE]: should not have initial form params!")},testMappingParams:i=>i.operator1===P.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:i=>!i.customFilters&&!i.filters?{}:!1},e.EMPTY={label:"sheets-filter.conditions.empty",operator:P.EMPTY,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:""}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===""&&s.operator===void 0?{operator1:P.EMPTY}:!1}},e.NOT_EMPTY={label:"sheets-filter.conditions.not-empty",operator:P.NOT_EMPTY,order:z.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!")},testMappingParams:({operator1:i})=>i===P.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:" ",operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.val===" "&&s.operator===c.CustomFilterOperator.NOT_EQUALS?{operator1:P.NOT_EMPTY}:!1}},e.TEXT_CONTAINS={label:"sheets-filter.conditions.text-contains",operator:P.CONTAINS,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.CONTAINS,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===P.CONTAINS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:`*${s}*`}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&l.endsWith("*")?{operator1:P.CONTAINS,val1:l.slice(1,-1)}:!1}},e.DOES_NOT_CONTAIN={label:"sheets-filter.conditions.does-not-contain",operator:P.DOES_NOT_CONTAIN,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.DOES_NOT_CONTAIN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}*`,operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingParams:i=>{const[s]=he(i);return s===P.DOES_NOT_CONTAIN},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return s.operator===c.CustomFilterOperator.NOT_EQUALS&&l.startsWith("*")&&l.endsWith("*")?{operator1:P.DOES_NOT_CONTAIN,val1:l.slice(1,-1)}:!1}},e.STARTS_WITH={label:"sheets-filter.conditions.starts-with",operator:P.STARTS_WITH,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.STARTS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`${i.val1}*`}]}}),testMappingParams:i=>{const[s]=he(i);return s===P.STARTS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.endsWith("*")&&!l.startsWith("*")?{operator1:P.STARTS_WITH,val1:l.slice(0,-1)}:!1}},e.ENDS_WITH={label:"sheets-filter.conditions.ends-with",operator:P.ENDS_WITH,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.ENDS_WITH,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:`*${i.val1}`}]}}),testMappingParams:i=>{const[s]=he(i);return s===P.ENDS_WITH},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0],l=s.val.toString();return!s.operator&&l.startsWith("*")&&!l.endsWith("*")?{operator1:P.ENDS_WITH,val1:l.slice(1)}:!1}},e.EQUALS={label:"sheets-filter.conditions.equals",operator:P.EQUALS,order:z.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:P.EQUALS,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===P.EQUALS},mapToFilterColumn:i=>{const{val1:s}=i;return s===""?null:{customFilters:{customFilters:[{val:s}]}}},testMappingFilterColumn:i=>{var s,l,u;return((l=(s=i.filters)==null?void 0:s.filters)==null?void 0:l.length)===1?{operator1:P.EQUALS,val1:""}:((u=i.customFilters)==null?void 0:u.customFilters.length)===1&&!i.customFilters.customFilters[0].operator?{operator1:P.EQUALS,val1:i.customFilters.customFilters[0].val.toString()}:!1}},e.GREATER_THAN={label:"sheets-filter.conditions.greater-than",operator:c.CustomFilterOperator.GREATER_THAN,numOfParameters:1,order:z.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.GREATER_THAN,val1:""}),mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.GREATER_THAN}]}}),testMappingParams:i=>{const[s]=he(i);return s===c.CustomFilterOperator.GREATER_THAN},testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.GREATER_THAN?!1:{operator1:c.CustomFilterOperator.GREATER_THAN,val1:s.val.toString()}}},e.GREATER_THAN_OR_EQUAL={label:"sheets-filter.conditions.greater-than-or-equal",operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:z.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.GREATER_THAN_OR_EQUAL?!1:{operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString()}}},e.LESS_THAN={label:"sheets-filter.conditions.less-than",operator:c.CustomFilterOperator.LESS_THAN,numOfParameters:1,order:z.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===c.CustomFilterOperator.LESS_THAN},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.LESS_THAN}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.LESS_THAN?!1:{operator1:c.CustomFilterOperator.LESS_THAN,val1:s.val.toString()}}},e.LESS_THAN_OR_EQUAL={label:"sheets-filter.conditions.less-than-or-equal",operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,numOfParameters:1,order:z.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===c.CustomFilterOperator.LESS_THAN_OR_EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.LESS_THAN_OR_EQUAL?!1:{operator1:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val1:s.val.toString()}}},e.EQUAL={label:"sheets-filter.conditions.equal",operator:c.CustomFilterOperator.EQUAL,numOfParameters:1,order:z.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.EQUAL,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===c.CustomFilterOperator.EQUAL},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.EQUAL}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.EQUAL?!1:{operator1:c.CustomFilterOperator.EQUAL,val1:s.val.toString()}}},e.NOT_EQUAL={label:"sheets-filter.conditions.not-equal",operator:c.CustomFilterOperator.NOT_EQUALS,numOfParameters:1,order:z.FIRST,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.NOT_EQUALS,val1:""}),testMappingParams:i=>{const[s]=he(i);return s===c.CustomFilterOperator.NOT_EQUALS},mapToFilterColumn:i=>({customFilters:{customFilters:[{val:i.val1,operator:c.CustomFilterOperator.NOT_EQUALS}]}}),testMappingFilterColumn:i=>{var l;if(((l=i.customFilters)==null?void 0:l.customFilters.length)!==1)return!1;const s=i.customFilters.customFilters[0];return s.operator!==c.CustomFilterOperator.NOT_EQUALS?!1:{operator1:c.CustomFilterOperator.NOT_EQUALS,val1:s.val.toString()}}},e.BETWEEN={label:"sheets-filter.conditions.between",operator:P.BETWEEN,order:z.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:"",operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(!s)return!1;const f=[l,u];return f.includes(c.CustomFilterOperator.GREATER_THAN_OR_EQUAL)&&f.includes(c.CustomFilterOperator.LESS_THAN_OR_EQUAL)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,f=u===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL;return{customFilters:{and:g.BooleanNumber.TRUE,customFilters:[{val:f?s:l,operator:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL},{val:f?l:s,operator:c.CustomFilterOperator.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&l.operator===c.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:s.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:l.val.toString()}:l.operator===c.CustomFilterOperator.GREATER_THAN_OR_EQUAL&&s.operator===c.CustomFilterOperator.LESS_THAN_OR_EQUAL&&i.customFilters.and?{and:!0,operator1:c.CustomFilterOperator.GREATER_THAN_OR_EQUAL,val1:l.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN_OR_EQUAL,val2:s.val.toLocaleString()}:!1}},e.NOT_BETWEEN={label:"sheets-filter.conditions.not-between",operator:P.NOT_BETWEEN,order:z.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:c.CustomFilterOperator.LESS_THAN,val1:"",operator2:c.CustomFilterOperator.GREATER_THAN,val2:""}),testMappingParams:i=>{const{and:s,operator1:l,operator2:u}=i;if(s)return!1;const f=[l,u];return f.includes(c.CustomFilterOperator.GREATER_THAN)&&f.includes(c.CustomFilterOperator.LESS_THAN)},mapToFilterColumn:i=>{const{val1:s,val2:l,operator1:u}=i,f=u===c.CustomFilterOperator.GREATER_THAN;return{customFilters:{customFilters:[{val:f?s:l,operator:c.CustomFilterOperator.GREATER_THAN},{val:f?l:s,operator:c.CustomFilterOperator.LESS_THAN}]}}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const[s,l]=i.customFilters.customFilters;return s.operator===c.CustomFilterOperator.LESS_THAN&&l.operator===c.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:c.CustomFilterOperator.LESS_THAN,val1:s.val.toString(),operator2:c.CustomFilterOperator.GREATER_THAN,val2:l.val.toString()}:l.operator===c.CustomFilterOperator.LESS_THAN&&s.operator===c.CustomFilterOperator.GREATER_THAN&&!i.customFilters.and?{operator1:c.CustomFilterOperator.GREATER_THAN,val1:l.val.toString(),operator2:c.CustomFilterOperator.LESS_THAN,val2:s.val.toLocaleString()}:!1}},e.CUSTOM={label:"sheets-filter.conditions.custom",operator:P.CUSTOM,order:z.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:P.NONE,val1:"",operator2:P.NONE,val2:""}),testMappingParams:()=>!0,mapToFilterColumn:i=>{const{and:s,val1:l,val2:u,operator1:f,operator2:m}=i;function v(b,I){for(const T of e.ALL_CONDITIONS)if(T.operator===b)return T.mapToFilterColumn({val1:I,operator1:b})}const d=!f||f===e.NONE.operator,E=!m||m===e.NONE.operator;if(d&&E)return e.NONE.mapToFilterColumn({});if(d)return v(m,u);if(E)return v(f,l);const _=v(f,l),S=v(m,u),F={customFilters:[_.customFilters.customFilters[0],S.customFilters.customFilters[0]]};return s&&(F.and=g.BooleanNumber.TRUE),{customFilters:F}},testMappingFilterColumn:i=>{var u;if(((u=i.customFilters)==null?void 0:u.customFilters.length)!==2)return!1;const s=i.customFilters.customFilters.map(f=>a({customFilters:{customFilters:[f]}})),l={operator1:s[0][0].operator,val1:s[0][1].val1,operator2:s[1][0].operator,val2:s[1][1].val1};return i.customFilters.and&&(l.and=!0),l}},e.ALL_CONDITIONS=[e.NONE,e.EMPTY,e.NOT_EMPTY,e.TEXT_CONTAINS,e.DOES_NOT_CONTAIN,e.STARTS_WITH,e.ENDS_WITH,e.EQUALS,e.GREATER_THAN,e.GREATER_THAN_OR_EQUAL,e.LESS_THAN,e.LESS_THAN_OR_EQUAL,e.EQUAL,e.NOT_EQUAL,e.BETWEEN,e.NOT_BETWEEN,e.CUSTOM];function t(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);if(!s)throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);return s}e.getItemByOperator=t;function r(i,s){for(const l of e.ALL_CONDITIONS.filter(u=>u.numOfParameters===s))if(l.numOfParameters!==0&&l.testMappingParams(i))return l;for(const l of e.ALL_CONDITIONS)if(l.testMappingParams(i))return l;throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!")}e.testMappingParams=r;function n(i){const s=e.ALL_CONDITIONS.find(l=>l.operator===i);return(s==null?void 0:s.numOfParameters)===0?{operator1:s.operator}:s.getDefaultFormParams()}e.getInitialFormParams=n;function o(i,s){return i.mapToFilterColumn(s)}e.mapToFilterColumn=o;function a(i){if(!i)return[e.NONE,{}];for(const s of e.ALL_CONDITIONS){const l=s.testMappingFilterColumn(i);if(l)return[s,l]}return[e.NONE,{}]}e.testMappingFilterColumn=a})(R||(R={}));function he(e){const{operator1:t,operator2:r,val1:n,val2:o}=e;if(t&&r)throw new Error("Both operator1 and operator2 are set!");if(!t&&!r)throw new Error("Neither operator1 and operator2 and both not set!");return t?[t,n]:[r,o]}function Bt(e){const t=[],r=[];for(const n of e)n.checked?t.push(n):r.push(n);return{checkedItems:t,uncheckedItems:r,checked:t.length,unchecked:r.length}}var wn=Object.defineProperty,An=Object.getOwnPropertyDescriptor,Gt=(e,t,r,n)=>{for(var o=n>1?void 0:n?An(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&wn(t,r,o),o},Ae=(e,t)=>(r,n)=>t(r,n,e),ht=(e=>(e[e.VALUES=0]="VALUES",e[e.CONDITIONS=1]="CONDITIONS",e))(ht||{});L.createIdentifier("sheets-filter-ui.sheets-filter-panel.service");let Fe=class extends g.Disposable{constructor(t,r,n,o){super();M(this,"_filterBy$",new N.BehaviorSubject(0));M(this,"filterBy$",this._filterBy$.asObservable());M(this,"_filterByModel$",new N.ReplaySubject(1));M(this,"filterByModel$",this._filterByModel$.asObservable());M(this,"_filterByModel",null);M(this,"_hasCriteria$",new N.BehaviorSubject(!1));M(this,"hasCriteria$",this._hasCriteria$.asObservable());M(this,"_filterModel",null);M(this,"_col$",new N.BehaviorSubject(-1));M(this,"col$",this._col$.asObservable());M(this,"_filterHeaderListener",null);this._injector=t,this._sheetsFilterService=r,this._univerInstanceService=n,this._refRangeService=o}get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(t){this._filterByModel=t,this._filterByModel$.next(t)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(t,r){this.terminate(),this._filterModel=t,this._col$.next(r);const n=t.getFilterColumn(r);if(n){const o=n.getColumnData();return o.customFilters?(this._hasCriteria$.next(!0),this._setupByConditions(t,r)):o.filters?(this._hasCriteria$.next(!0),this._setupByValues(t,r)):(this._hasCriteria$.next(!1),this._setupByValues(t,r))}return this._hasCriteria$.next(!1),this._setupByValues(t,r)}changeFilterBy(t){return!this._filterModel||this.col===-1?!1:(t===0?this._setupByValues(this._filterModel,this.col):this._setupByConditions(this._filterModel,this.col),!0)}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var t;(t=this._filterHeaderListener)==null||t.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(t,r){this._disposeFilterHeaderChangeListener();const n=t.unitId,o=t.subUnitId,a=t.getRange(),i={startColumn:r,startRow:a.startRow,endRow:a.startRow,endColumn:r};this._filterHeaderListener=this._refRangeService.watchRange(n,o,i,(s,l)=>{if(!l)this.terminate();else{const u=l.startColumn-s.startColumn;u!==0&&this._filterByModel.deltaCol(u)}})}_setupByValues(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=mt.fromFilterColumn(this._injector,t,r);return this.filterByModel=o,this._filterBy$.next(0),this._listenToFilterHeaderChange(t,r),!0}_setupByConditions(t,r){this._disposePreviousModel();const n=t.getRange();if(n.startRow===n.endRow)return!1;const o=dt.fromFilterColumn(this._injector,t,r,t.getFilterColumn(r));return this.filterByModel=o,this._filterBy$.next(1),this._listenToFilterHeaderChange(t,r),!0}_disposePreviousModel(){var t;(t=this._filterByModel)==null||t.dispose(),this.filterByModel=null}};Fe=Gt([Ae(0,L.Inject(L.Injector)),Ae(1,L.Inject(c.SheetsFilterService)),Ae(2,g.IUniverInstanceService),Ae(3,L.Inject(Q.RefRangeService))],Fe);let dt=class extends g.Disposable{constructor(t,r,n,o,a){super();M(this,"canApply$",N.of(!0));M(this,"_conditionItem$");M(this,"conditionItem$");M(this,"_filterConditionFormParams$");M(this,"filterConditionFormParams$");this._filterModel=t,this.col=r,this._commandService=a,this._conditionItem$=new N.BehaviorSubject(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new N.BehaviorSubject(o),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}static fromFilterColumn(t,r,n,o){const[a,i]=R.testMappingFilterColumn(o==null?void 0:o.getColumnData());return t.createInstance(dt,r,n,a,i)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(t){this.col+=t}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(Le.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=R.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(Le.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:t})}onPrimaryConditionChange(t){const r=R.ALL_CONDITIONS.find(n=>n.operator===t);if(!r)throw new Error(`[ByConditionsModel]: condition item not found for operator: ${t}!`);this._conditionItem$.next(r),this._filterConditionFormParams$.next(R.getInitialFormParams(t))}onConditionFormChange(t){const r={...this.filterConditionFormParams,...t};if(r.and!==!0&&delete r.and,typeof t.and<"u"||typeof t.operator1<"u"||typeof t.operator2<"u"){const n=R.testMappingParams(r,this.conditionItem.numOfParameters);this._conditionItem$.next(n)}this._filterConditionFormParams$.next(r)}};dt=Gt([Ae(4,g.ICommandService)],dt);let mt=class extends g.Disposable{constructor(t,r,n,o){super();M(this,"_rawFilterItems$");M(this,"rawFilterItems$");M(this,"filterItems$");M(this,"_filterItems",[]);M(this,"canApply$");M(this,"_manuallyUpdateFilterItems$");M(this,"_searchString$");M(this,"searchString$");this._filterModel=t,this.col=r,this._commandService=o,this._searchString$=new N.BehaviorSubject(""),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new N.BehaviorSubject(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new N.Subject,this.filterItems$=N.merge(N.combineLatest([this._searchString$.pipe(N.throttleTime(500,void 0,{leading:!0,trailing:!0}),N.startWith(void 0)),this._rawFilterItems$]).pipe(N.map(([a,i])=>{if(!a)return i;const l=a.toLowerCase().split(/\s+/).filter(u=>!!u);return i.filter(u=>{const f=u.value.toLowerCase();return l.some(m=>f.includes(m))})})),this._manuallyUpdateFilterItems$).pipe(N.shareReplay(1)),this.canApply$=this.filterItems$.pipe(N.map(a=>Bt(a).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(a=>this._filterItems=a))}static fromFilterColumn(t,r,n){var $;const o=t.get(g.IUniverInstanceService),a=t.get(g.LocaleService),{unitId:i,subUnitId:s}=r,l=o.getUniverSheetInstance(i);if(!l)throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${i}!`);const u=l==null?void 0:l.getSheetBySheetId(s);if(!u)throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${i} and subUnitId: ${s}!`);const f=r.getRange(),m=n,v=($=r.getFilterColumn(n))==null?void 0:$.getColumnData().filters,d=!!(v&&v.blank),E={...f,startRow:f.startRow+1,startColumn:m,endColumn:m},_=[],S={},F=new Set(v==null?void 0:v.filters),b=r.getFilteredOutRowsExceptCol(n);let I=0,T=0;for(const C of u.iterateByColumn(E,!1,!1)){const{row:U,rowSpan:x=1}=C;let k=0;for(;k<x;){const te=U+k;if(b.has(te)){k++;continue}const q=C!=null&&C.value?g.extractPureTextFromCell(C.value):"";if(!q){T+=1,k+=x;continue}if(S[q])S[q].count++;else{const ie={value:q,checked:F.size?F.has(q):!d,count:1,index:I,isEmpty:!1};S[q]=ie,_.push(ie)}k++}I++}const W=v?d:!0;if(T>0){const C={value:a.t("sheets-filter.panel.empty"),checked:W,count:T,index:I,isEmpty:!0};_.push(C)}return t.createInstance(mt,r,n,_)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(t){this.col+=t}setSearchString(t){this._searchString$.next(t)}onFilterCheckToggled(t,r){const n=this._filterItems.slice(),o=n.find(a=>a.index===t.index);o.checked=r,this._manuallyUpdateFilterItems(n)}onFilterOnly(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=n.index===t.index),this._manuallyUpdateFilterItems(r)}onCheckAllToggled(t){const r=this._filterItems.slice();r.forEach(n=>n.checked=t),this._manuallyUpdateFilterItems(r)}_manuallyUpdateFilterItems(t){this._manuallyUpdateFilterItems$.next(t)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(Le.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;const t=Bt(this._filterItems),{checked:r,checkedItems:n}=t,o=this.rawFilterItems,a=r===0,i=t.checked===o.length,s={colId:this.col};if(a)throw new Error("[ByValuesModel]: no checked items!");if(i)return this._commandService.executeCommand(Le.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{s.filters={};const l=n.filter(f=>!f.isEmpty);l.length>0&&(s.filters={filters:l.map(f=>f.value)}),l.length!==n.length&&(s.filters.blank=!0)}return this._commandService.executeCommand(Le.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};mt=Gt([Ae(3,g.ICommandService)],mt);const De="FILTER_PANEL_OPENED",St={id:"sheet.operation.open-filter-panel",type:g.CommandType.OPERATION,handler:(e,t)=>{const r=e.get(g.IContextService),n=e.get(c.SheetsFilterService),o=e.get(Fe);e.get(g.ICommandService).syncExecuteCommand(me.SetCellEditVisibleOperation.id,{visible:!1});const{unitId:i,subUnitId:s,col:l}=t,u=n.getFilterModel(i,s);return!u||!o.setupCol(u,l)?!1:(r.getContextValue(De)||r.setContextValue(De,!0),!0)}},Qe={id:"sheet.operation.close-filter-panel",type:g.CommandType.OPERATION,handler:e=>{const t=e.get(g.IContextService),r=e.get(Fe),n=e.get(D.ILayoutService,L.Quantity.OPTIONAL);return t.getContextValue(De)?(t.setContextValue(De,!1),n==null||n.focus(),r.terminate()):!1}},Dr={id:"sheet.operation.apply-filter",type:g.CommandType.OPERATION,handler:(e,t)=>{const{filterBy:r}=t;return e.get(Fe).changeFilterBy(r)}},Ln="univer-sheets-filter-panel",Dn="univer-sheets-filter-panel-header",$n="univer-sheets-filter-panel-content",Un="univer-sheets-filter-panel-select-all",Hn="univer-sheets-filter-panel-select-all-count",xn="univer-sheets-filter-panel-values-container",Bn="univer-input-affix-wrapper",jn="univer-select",Wn="univer-radio-group",kn="univer-sheets-filter-panel-values-find",Vn="univer-sheets-filter-panel-values-list",zn="univer-sheets-filter-panel-values-list-inner-container",Qn="univer-sheets-filter-panel-values-virtual",Gn="univer-sheets-filter-panel-values-item",qn="univer-sheets-filter-panel-values-item-inner",Yn="univer-sheets-filter-panel-values-item-count",Xn="univer-sheets-filter-panel-values-item-exclude-button",Kn="univer-sheets-filter-panel-values-item-text",Zn="univer-sheets-filter-panel-conditions-container",Jn="univer-sheets-filter-panel-conditions-container-inner",ei="univer-sheets-filter-panel-conditions-desc",ti="univer-sheets-filter-panel-footer",ri="univer-sheets-filter-panel-footer-primary-buttons",ni="univer-button",ii="univer-input",oi="univer-form-dual-column-layout",j={sheetsFilterPanel:Ln,sheetsFilterPanelHeader:Dn,sheetsFilterPanelContent:$n,sheetsFilterPanelSelectAll:Un,sheetsFilterPanelSelectAllCount:Hn,sheetsFilterPanelValuesContainer:xn,inputAffixWrapper:Bn,select:jn,radioGroup:Wn,sheetsFilterPanelValuesFind:kn,sheetsFilterPanelValuesList:Vn,sheetsFilterPanelValuesListInnerContainer:zn,sheetsFilterPanelValuesVirtual:Qn,sheetsFilterPanelValuesItem:Gn,sheetsFilterPanelValuesItemInner:qn,sheetsFilterPanelValuesItemCount:Yn,sheetsFilterPanelValuesItemExcludeButton:Xn,sheetsFilterPanelValuesItemText:Kn,sheetsFilterPanelConditionsContainer:Zn,sheetsFilterPanelConditionsContainerInner:Jn,sheetsFilterPanelConditionsDesc:ei,sheetsFilterPanelFooter:ti,sheetsFilterPanelFooterPrimaryButtons:ri,button:ni,input:ii,formDualColumnLayout:oi};function si(e){const{model:t}=e,r=ze.useDependency(g.LocaleService),n=D.useObservable(t.conditionItem$,void 0,!0),o=D.useObservable(t.filterConditionFormParams$,void 0,!0),{operator:a,numOfParameters:i}=n,{operator1:s,operator2:l,val1:u,val2:f,and:m}=o,v=m?"AND":"OR",d=h.useCallback(T=>{t.onConditionFormChange({and:T==="AND"})},[t]),E=ai(r),_=h.useCallback(T=>{t.onPrimaryConditionChange(T)},[t]),S=li(r),F=h.useCallback(T=>{t.onConditionFormChange(T)},[t]),b=r.t("sheets-filter.panel.input-values-placeholder");function I(T,W,$){const C=R.getItemByOperator(T).numOfParameters===1;return h.createElement(h.Fragment,null,$==="operator2"&&h.createElement(G.RadioGroup,{value:v,onChange:d},h.createElement(G.Radio,{value:"AND"},r.t("sheets-filter.panel.and")),h.createElement(G.Radio,{value:"OR"},r.t("sheets-filter.panel.or"))),h.createElement(G.Select,{value:T,options:S,onChange:U=>F({[$]:U})}),C&&h.createElement(G.Input,{value:W,placeholder:b,onChange:U=>F({[$==="operator1"?"val1":"val2"]:U})}))}return h.createElement("div",{className:j.sheetsFilterPanelConditionsContainer},h.createElement(G.Select,{value:a,options:E,onChange:_}),R.getItemByOperator(a).numOfParameters!==0?h.createElement("div",{className:j.sheetsFilterPanelConditionsContainerInner},i>=1&&I(s,u!=null?u:"","operator1"),i>=2&&I(l,f!=null?f:"","operator2"),h.createElement("div",{className:j.sheetsFilterPanelConditionsDesc},r.t("sheets-filter.panel.?"),h.createElement("br",null),r.t("sheets-filter.panel.*"))):null)}function ai(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{options:[{label:e.t(R.NONE.label),value:R.NONE.operator}]},{options:[{label:e.t(R.EMPTY.label),value:R.EMPTY.operator},{label:e.t(R.NOT_EMPTY.label),value:R.NOT_EMPTY.operator}]},{options:[{label:e.t(R.TEXT_CONTAINS.label),value:R.TEXT_CONTAINS.operator},{label:e.t(R.DOES_NOT_CONTAIN.label),value:R.DOES_NOT_CONTAIN.operator},{label:e.t(R.STARTS_WITH.label),value:R.STARTS_WITH.operator},{label:e.t(R.ENDS_WITH.label),value:R.ENDS_WITH.operator},{label:e.t(R.EQUALS.label),value:R.EQUALS.operator}]},{options:[{label:e.t(R.GREATER_THAN.label),value:R.GREATER_THAN.operator},{label:e.t(R.GREATER_THAN_OR_EQUAL.label),value:R.GREATER_THAN_OR_EQUAL.operator},{label:e.t(R.LESS_THAN.label),value:R.LESS_THAN.operator},{label:e.t(R.LESS_THAN_OR_EQUAL.label),value:R.LESS_THAN_OR_EQUAL.operator},{label:e.t(R.EQUAL.label),value:R.EQUAL.operator},{label:e.t(R.NOT_EQUAL.label),value:R.NOT_EQUAL.operator},{label:e.t(R.BETWEEN.label),value:R.BETWEEN.operator},{label:e.t(R.NOT_BETWEEN.label),value:R.NOT_BETWEEN.operator}]},{options:[{label:e.t(R.CUSTOM.label),value:R.CUSTOM.operator}]}],[t,e])}function li(e){const t=e.getCurrentLocale();return h.useMemo(()=>R.ALL_CONDITIONS.filter(r=>r.numOfParameters!==2).map(r=>({label:e.t(r.label),value:r.operator})),[t,e])}function Ke(){return Ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ke.apply(null,arguments)}function ue(e){"@babel/helpers - typeof";return ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ue(e)}function ui(e,t){if(ue(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ue(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $r(e){var t=ui(e,"string");return ue(t)=="symbol"?t:t+""}function ee(e,t,r){return(t=$r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dr(Object(r),!0).forEach(function(n){ee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ci(e){if(Array.isArray(e))return e}function fi(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(f){u=!0,o=f}finally{try{if(!l&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return s}}function mr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function hi(e,t){if(e){if(typeof e=="string")return mr(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mr(e,t):void 0}}function di(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X(e,t){return ci(e)||fi(e,t)||hi(e,t)||di()}function mi(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function pi(e,t){if(e==null)return{};var r,n,o=mi(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function vi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ur={exports:{}};/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,n(s)))}return a}function n(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return r.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)t.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(
|
|
6
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,n(s)))}return a}function n(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return r.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)t.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(Ur);var gi=Ur.exports;const pt=vi(gi);var Hr={exports:{}},A={};/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-is.production.min.js
|
|
9
9
|
*
|
|
@@ -11,4 +11,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/var Yt=Symbol.for("react.element"),Xt=Symbol.for("react.portal"),_t=Symbol.for("react.fragment"),St=Symbol.for("react.strict_mode"),Et=Symbol.for("react.profiler"),bt=Symbol.for("react.provider"),yt=Symbol.for("react.context"),hi=Symbol.for("react.server_context"),Ot=Symbol.for("react.forward_ref"),Ft=Symbol.for("react.suspense"),Rt=Symbol.for("react.suspense_list"),Tt=Symbol.for("react.memo"),Ct=Symbol.for("react.lazy"),di=Symbol.for("react.offscreen"),$r;$r=Symbol.for("react.module.reference");function ae(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Yt:switch(e=e.type,e){case _t:case Et:case St:case Ft:case Rt:return e;default:switch(e=e&&e.$$typeof,e){case hi:case yt:case Ot:case Ct:case Tt:case bt:return e;default:return t}}case Xt:return t}}}A.ContextConsumer=yt;A.ContextProvider=bt;A.Element=Yt;A.ForwardRef=Ot;A.Fragment=_t;A.Lazy=Ct;A.Memo=Tt;A.Portal=Xt;A.Profiler=Et;A.StrictMode=St;A.Suspense=Ft;A.SuspenseList=Rt;A.isAsyncMode=function(){return!1};A.isConcurrentMode=function(){return!1};A.isContextConsumer=function(e){return ae(e)===yt};A.isContextProvider=function(e){return ae(e)===bt};A.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Yt};A.isForwardRef=function(e){return ae(e)===Ot};A.isFragment=function(e){return ae(e)===_t};A.isLazy=function(e){return ae(e)===Ct};A.isMemo=function(e){return ae(e)===Tt};A.isPortal=function(e){return ae(e)===Xt};A.isProfiler=function(e){return ae(e)===Et};A.isStrictMode=function(e){return ae(e)===St};A.isSuspense=function(e){return ae(e)===Ft};A.isSuspenseList=function(e){return ae(e)===Rt};A.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===_t||e===Et||e===St||e===Ft||e===Rt||e===di||typeof e=="object"&&e!==null&&(e.$$typeof===Ct||e.$$typeof===Tt||e.$$typeof===bt||e.$$typeof===yt||e.$$typeof===Ot||e.$$typeof===$r||e.getModuleId!==void 0)};A.typeOf=ae;Dr.exports=A;var at=Dr.exports;function Wt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=[];return h.Children.forEach(e,function(n){n==null&&!t.keepEmpty||(Array.isArray(n)?r=r.concat(Wt(n)):at.isFragment(n)&&n.props?r=r.concat(Wt(n.props.children,t)):r.push(n))}),r}function mi(e){return e instanceof HTMLElement||e instanceof SVGElement}function lt(e){return mi(e)?e:e instanceof h.Component?Bt.findDOMNode(e):null}function pi(e,t,r){var n=v.useRef({});return(!("value"in n.current)||r(n.current.condition,t))&&(n.current.value=e(),n.current.condition=t),n.current.value}var vi=function(t,r){typeof t=="function"?t(r):me(t)==="object"&&t&&"current"in t&&(t.current=r)},gi=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r.filter(Boolean);return o.length<=1?o[0]:function(a){r.forEach(function(i){vi(i,a)})}},_i=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return pi(function(){return gi.apply(void 0,r)},r,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},Si=function(t){var r,n,o=at.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((r=o.prototype)!==null&&r!==void 0&&r.render)&&o.$$typeof!==at.ForwardRef||typeof t=="function"&&!((n=t.prototype)!==null&&n!==void 0&&n.render)&&t.$$typeof!==at.ForwardRef)},kt=v.createContext(null);function Ei(e){var t=e.children,r=e.onBatchResize,n=v.useRef(0),o=v.useRef([]),a=v.useContext(kt),i=v.useCallback(function(s,l,u){n.current+=1;var f=n.current;o.current.push({size:s,element:l,data:u}),Promise.resolve().then(function(){f===n.current&&(r==null||r(o.current),o.current=[])}),a==null||a(s,l,u)},[r,a]);return v.createElement(kt.Provider,{value:i},t)}var Hr=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(o,a){return o[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];r.call(n,i[1],i[0])}},t}()}(),Vt=typeof window<"u"&&typeof document<"u"&&window.document===document,mt=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),bi=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(mt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),yi=2;function Oi(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){bi(a)}function s(){var l=Date.now();if(r){if(l-o<yi)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var Fi=20,Ri=["top","right","bottom","left","width","height","size","weight"],Ti=typeof MutationObserver<"u",Ci=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Oi(this.refresh.bind(this),Fi)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!Vt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Ti?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Vt||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=Ri.some(function(a){return!!~n.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Ur=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},He=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||mt},xr=It(0,0,0,0);function pt(e){return parseFloat(e)||0}function mr(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,o){var a=e["border-"+o+"-width"];return n+pt(a)},0)}function Ii(e){for(var t=["top","right","bottom","left"],r={},n=0,o=t;n<o.length;n++){var a=o[n],i=e["padding-"+a];r[a]=pt(i)}return r}function Pi(e){var t=e.getBBox();return It(0,0,t.width,t.height)}function Ni(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return xr;var n=He(e).getComputedStyle(e),o=Ii(n),a=o.left+o.right,i=o.top+o.bottom,s=pt(n.width),l=pt(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=mr(n,"left","right")+a),Math.round(l+i)!==r&&(l-=mr(n,"top","bottom")+i)),!wi(e)){var u=Math.round(s+a)-t,f=Math.round(l+i)-r;Math.abs(u)!==1&&(s-=u),Math.abs(f)!==1&&(l-=f)}return It(o.left,o.top,s,l)}var Mi=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof He(e).SVGGraphicsElement}:function(e){return e instanceof He(e).SVGElement&&typeof e.getBBox=="function"}}();function wi(e){return e===He(e).document.documentElement}function Ai(e){return Vt?Mi(e)?Pi(e):Ni(e):xr}function Li(e){var t=e.x,r=e.y,n=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return Ur(i,{x:t,y:r,width:n,height:o,top:r,right:t+n,bottom:o+r,left:t}),i}function It(e,t,r,n){return{x:e,y:t,width:r,height:n}}var Di=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=It(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Ai(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),$i=function(){function e(t,r){var n=Li(r);Ur(this,{target:t,contentRect:n})}return e}(),Hi=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new Hr,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof He(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new Di(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof He(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new $i(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Br=typeof WeakMap<"u"?new WeakMap:new Hr,jr=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Ci.getInstance(),n=new Hi(t,r,this);Br.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){jr.prototype[e]=function(){var t;return(t=Br.get(this))[e].apply(t,arguments)}});var Ui=function(){return typeof mt.ResizeObserver<"u"?mt.ResizeObserver:jr}(),ye=new Map;function xi(e){e.forEach(function(t){var r,n=t.target;(r=ye.get(n))===null||r===void 0||r.forEach(function(o){return o(n)})})}var Wr=new Ui(xi);function Bi(e,t){ye.has(e)||(ye.set(e,new Set),Wr.observe(e)),ye.get(e).add(t)}function ji(e,t){ye.has(e)&&(ye.get(e).delete(t),ye.get(e).size||(Wr.unobserve(e),ye.delete(e)))}function kr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ar(n.key),n)}}function Vr(e,t,r){return t&&pr(e.prototype,t),r&&pr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zt(e,t){return zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},zt(e,t)}function Wi(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zt(e,t)}function vt(e){return vt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vt(e)}function zr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zr=function(){return!!e})()}function ki(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vi(e,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ki(e)}function zi(e){var t=zr();return function(){var n=vt(e),o;if(t){var a=vt(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return Vi(this,o)}}var Qi=function(e){Wi(r,e);var t=zi(r);function r(){return kr(this,r),t.apply(this,arguments)}return Vr(r,[{key:"render",value:function(){return this.props.children}}]),r}(v.Component);function Gi(e,t){var r=e.children,n=e.disabled,o=v.useRef(null),a=v.useRef(null),i=v.useContext(kt),s=typeof r=="function",l=s?r(o):r,u=v.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),f=!s&&v.isValidElement(l)&&Si(l),d=f?l.ref:null,p=_i(d,o),m=function(){var b;return lt(o.current)||(o.current&&me(o.current)==="object"?lt((b=o.current)===null||b===void 0?void 0:b.nativeElement):null)||lt(a.current)};v.useImperativeHandle(t,function(){return m()});var S=v.useRef(e);S.current=e;var E=v.useCallback(function(g){var b=S.current,R=b.onResize,w=b.data,C=g.getBoundingClientRect(),x=C.width,$=C.height,T=g.offsetWidth,H=g.offsetHeight,j=Math.floor(x),k=Math.floor($);if(u.current.width!==j||u.current.height!==k||u.current.offsetWidth!==T||u.current.offsetHeight!==H){var ee={width:j,height:k,offsetWidth:T,offsetHeight:H};u.current=ee;var Y=T===Math.round(x)?x:T,ne=H===Math.round($)?$:H,X=re(re({},ee),{},{offsetWidth:Y,offsetHeight:ne});i==null||i(X,g,w),R&&Promise.resolve().then(function(){R(X,g)})}},[]);return v.useEffect(function(){var g=m();return g&&!n&&Bi(g,E),function(){return ji(g,E)}},[o.current,n]),v.createElement(Qi,{ref:a},f?v.cloneElement(l,{ref:p}):l)}var qi=v.forwardRef(Gi),Yi="rc-observer-key";function Xi(e,t){var r=e.children,n=typeof r=="function"?[r]:Wt(r);return n.map(function(o,a){var i=(o==null?void 0:o.key)||"".concat(Yi,"-").concat(a);return v.createElement(qi,Ze({},e,{key:i,ref:a===0?t:void 0}),o)})}var Kt=v.forwardRef(Xi);Kt.Collection=Ei;var Qr=v.forwardRef(function(e,t){var r=e.height,n=e.offsetY,o=e.offsetX,a=e.children,i=e.prefixCls,s=e.onInnerResize,l=e.innerProps,u=e.rtl,f=e.extra,d={},p={display:"flex",flexDirection:"column"};return n!==void 0&&(d={height:r,position:"relative",overflow:"hidden"},p=re(re({},p),{},J(J(J(J(J({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),v.createElement("div",{style:d},v.createElement(Kt,{onResize:function(S){var E=S.offsetHeight;E&&s&&s()}},v.createElement("div",Ze({style:p,className:dt(J({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,f)))});Qr.displayName="Filler";var Gr=function(t){return+setTimeout(t,16)},qr=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Gr=function(t){return window.requestAnimationFrame(t)},qr=function(t){return window.cancelAnimationFrame(t)});var vr=0,Zt=new Map;function Yr(e){Zt.delete(e)}var he=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;vr+=1;var n=vr;function o(a){if(a===0)Yr(n),t();else{var i=Gr(function(){o(a-1)});Zt.set(n,i)}}return o(r),n};he.cancel=function(e){var t=Zt.get(e);return Yr(e),qr(t)};function gr(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var _r=v.forwardRef(function(e,t){var r=e.prefixCls,n=e.rtl,o=e.scrollOffset,a=e.scrollRange,i=e.onStartMove,s=e.onStopMove,l=e.onScroll,u=e.horizontal,f=e.spinSize,d=e.containerSize,p=e.style,m=e.thumbStyle,S=v.useState(!1),E=K(S,2),g=E[0],b=E[1],R=v.useState(null),w=K(R,2),C=w[0],x=w[1],$=v.useState(null),T=K($,2),H=T[0],j=T[1],k=!n,ee=v.useRef(),Y=v.useRef(),ne=v.useState(!1),X=K(ne,2),Pe=X[0],te=X[1],Fe=v.useRef(),le=function(){clearTimeout(Fe.current),te(!0),Fe.current=setTimeout(function(){te(!1)},3e3)},Z=a-d||0,Ue=d-f||0,U=v.useMemo(function(){if(o===0||Z===0)return 0;var z=o/Z;return z*Ue},[o,Z,Ue]),Re=function(W){W.stopPropagation(),W.preventDefault()},Ne=v.useRef({top:U,dragging:g,pageY:C,startTop:H});Ne.current={top:U,dragging:g,pageY:C,startTop:H};var xe=function(W){b(!0),x(gr(W,u)),j(Ne.current.top),i(),W.stopPropagation(),W.preventDefault()};v.useEffect(function(){var z=function(We){We.preventDefault()},W=ee.current,pe=Y.current;return W.addEventListener("touchstart",z),pe.addEventListener("touchstart",xe),function(){W.removeEventListener("touchstart",z),pe.removeEventListener("touchstart",xe)}},[]);var Be=v.useRef();Be.current=Z;var ue=v.useRef();ue.current=Ue,v.useEffect(function(){if(g){var z,W=function(We){var Me=Ne.current,Je=Me.dragging,et=Me.pageY,Pt=Me.startTop;if(he.cancel(z),Je){var Te=gr(We,u)-et,we=Pt;!k&&u?we-=Te:we+=Te;var tt=Be.current,rt=ue.current,Nt=rt?we/rt:0,Ce=Math.ceil(Nt*tt);Ce=Math.max(Ce,0),Ce=Math.min(Ce,tt),z=he(function(){l(Ce,u)})}},pe=function(){b(!1),s()};return window.addEventListener("mousemove",W),window.addEventListener("touchmove",W),window.addEventListener("mouseup",pe),window.addEventListener("touchend",pe),function(){window.removeEventListener("mousemove",W),window.removeEventListener("touchmove",W),window.removeEventListener("mouseup",pe),window.removeEventListener("touchend",pe),he.cancel(z)}}},[g]),v.useEffect(function(){le()},[o]),v.useImperativeHandle(t,function(){return{delayHidden:le}});var Se="".concat(r,"-scrollbar"),ie={position:"absolute",visibility:Pe?null:"hidden"},ce={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(ie.height=8,ie.left=0,ie.right=0,ie.bottom=0,ce.height="100%",ce.width=f,k?ce.left=U:ce.right=U):(ie.width=8,ie.top=0,ie.bottom=0,k?ie.right=0:ie.left=0,ce.width="100%",ce.height=f,ce.top=U),v.createElement("div",{ref:ee,className:dt(Se,J(J(J({},"".concat(Se,"-horizontal"),u),"".concat(Se,"-vertical"),!u),"".concat(Se,"-visible"),Pe)),style:re(re({},ie),p),onMouseDown:Re,onMouseMove:le},v.createElement("div",{ref:Y,className:dt("".concat(Se,"-thumb"),J({},"".concat(Se,"-thumb-moving"),g)),style:re(re({},ce),m),onMouseDown:xe}))});function Ki(e){var t=e.children,r=e.setRef,n=v.useCallback(function(o){r(o)},[]);return v.cloneElement(t,{ref:n})}function Zi(e,t,r,n,o,a,i){var s=i.getKey;return e.slice(t,r+1).map(function(l,u){var f=t+u,d=a(l,f,{style:{width:n}}),p=s(l);return v.createElement(Ki,{key:p,setRef:function(S){return o(l,S)}},d)})}var Ji=function(){function e(){kr(this,e),J(this,"maps",void 0),J(this,"id",0),this.maps=Object.create(null)}return Vr(e,[{key:"set",value:function(r,n){this.maps[r]=n,this.id+=1}},{key:"get",value:function(r){return this.maps[r]}}]),e}();function eo(e,t,r){var n=v.useState(0),o=K(n,2),a=o[0],i=o[1],s=h.useRef(new Map),l=h.useRef(new Ji),u=h.useRef();function f(){he.cancel(u.current)}function d(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;f();var S=function(){s.current.forEach(function(g,b){if(g&&g.offsetParent){var R=lt(g),w=R.offsetHeight;l.current.get(b)!==w&&l.current.set(b,R.offsetHeight)}}),i(function(g){return g+1})};m?S():u.current=he(S)}function p(m,S){var E=e(m),g=s.current.get(E);S?(s.current.set(E,S),d()):s.current.delete(E),!g!=!S&&(S?t==null||t(m):r==null||r(m))}return h.useEffect(function(){return f},[]),[p,d,l.current,a]}function to(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Sr=to()?v.useLayoutEffect:v.useEffect,Ye=function(t,r){var n=v.useRef(!0);Sr(function(){return t(n.current)},r),Sr(function(){return n.current=!1,function(){n.current=!0}},[])};function Er(e){var t=v.useRef();t.current=e;var r=v.useCallback(function(){for(var n,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return(n=t.current)===null||n===void 0?void 0:n.call.apply(n,[t].concat(a))},[]);return r}var ro=10;function no(e,t,r,n,o,a,i,s){var l=v.useRef(),u=v.useState(null),f=K(u,2),d=f[0],p=f[1];return Ye(function(){if(d&&d.times<ro){if(!e.current){p(function(Z){return re({},Z)});return}a();var m=d.targetAlign,S=d.originAlign,E=d.index,g=d.offset,b=e.current.clientHeight,R=!1,w=m,C=null;if(b){for(var x=m||S,$=0,T=0,H=0,j=Math.min(t.length-1,E),k=0;k<=j;k+=1){var ee=o(t[k]);T=$;var Y=r.get(ee);H=T+(Y===void 0?n:Y),$=H}for(var ne=x==="top"?g:b-g,X=j;X>=0;X-=1){var Pe=o(t[X]),te=r.get(Pe);if(te===void 0){R=!0;break}if(ne-=te,ne<=0)break}switch(x){case"top":C=T-g;break;case"bottom":C=H-b+g;break;default:{var Fe=e.current.scrollTop,le=Fe+b;T<Fe?w="top":H>le&&(w="bottom")}}C!==null&&i(C),C!==d.lastTop&&(R=!0)}R&&p(re(re({},d),{},{times:d.times+1,targetAlign:w,lastTop:C}))}},[d,e.current]),function(m){if(m==null){s();return}if(he.cancel(l.current),typeof m=="number")i(m);else if(m&&me(m)==="object"){var S,E=m.align;"index"in m?S=m.index:S=t.findIndex(function(R){return o(R)===m.key});var g=m.offset,b=g===void 0?0:g;p({times:0,index:S,offset:b,originAlign:E})}}}function io(e,t,r){var n=e.length,o=t.length,a,i;if(n===0&&o===0)return null;n<o?(a=e,i=t):(a=t,i=e);var s={__EMPTY_ITEM__:!0};function l(S){return S!==void 0?r(S):s}for(var u=null,f=Math.abs(n-o)!==1,d=0;d<i.length;d+=1){var p=l(a[d]),m=l(i[d]);if(p!==m){u=d,f=f||p!==l(i[d+1]);break}}return u===null?null:{index:u,multiple:f}}function oo(e,t,r){var n=v.useState(e),o=K(n,2),a=o[0],i=o[1],s=v.useState(null),l=K(s,2),u=l[0],f=l[1];return v.useEffect(function(){var d=io(a||[],e||[],t);(d==null?void 0:d.index)!==void 0&&(r==null||r(d.index),f(e[d.index])),i(e)},[e]),[u]}var br=(typeof navigator>"u"?"undefined":me(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const Xr=function(e,t){var r=h.useRef(!1),n=h.useRef(null);function o(){clearTimeout(n.current),r.current=!0,n.current=setTimeout(function(){r.current=!1},50)}var a=h.useRef({top:e,bottom:t});return a.current.top=e,a.current.bottom=t,function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,l=i<0&&a.current.top||i>0&&a.current.bottom;return s&&l?(clearTimeout(n.current),r.current=!1):(!l||r.current)&&o(),!r.current&&l}};function so(e,t,r,n,o){var a=h.useRef(0),i=h.useRef(null),s=h.useRef(null),l=h.useRef(!1),u=Xr(t,r);function f(g,b){he.cancel(i.current),a.current+=b,s.current=b,!u(b)&&(br||g.preventDefault(),i.current=he(function(){var R=l.current?10:1;o(a.current*R),a.current=0}))}function d(g,b){o(b,!0),br||g.preventDefault()}var p=h.useRef(null),m=h.useRef(null);function S(g){if(e){he.cancel(m.current),m.current=he(function(){p.current=null},2);var b=g.deltaX,R=g.deltaY,w=g.shiftKey,C=b,x=R;(p.current==="sx"||!p.current&&w&&R&&!b)&&(C=R,x=0,p.current="sx");var $=Math.abs(C),T=Math.abs(x);p.current===null&&(p.current=n&&$>T?"x":"y"),p.current==="y"?f(g,x):d(g,C)}}function E(g){e&&(l.current=g.detail===s.current)}return[S,E]}var ao=14/15;function lo(e,t,r){var n=h.useRef(!1),o=h.useRef(0),a=h.useRef(null),i=h.useRef(null),s,l=function(p){if(n.current){var m=Math.ceil(p.touches[0].pageY),S=o.current-m;o.current=m,r(S)&&p.preventDefault(),clearInterval(i.current),i.current=setInterval(function(){S*=ao,(!r(S,!0)||Math.abs(S)<=.1)&&clearInterval(i.current)},16)}},u=function(){n.current=!1,s()},f=function(p){s(),p.touches.length===1&&!n.current&&(n.current=!0,o.current=Math.ceil(p.touches[0].pageY),a.current=p.target,a.current.addEventListener("touchmove",l),a.current.addEventListener("touchend",u))};s=function(){a.current&&(a.current.removeEventListener("touchmove",l),a.current.removeEventListener("touchend",u))},Ye(function(){return e&&t.current.addEventListener("touchstart",f),function(){var d;(d=t.current)===null||d===void 0||d.removeEventListener("touchstart",f),s(),clearInterval(i.current)}},[e])}var uo=20;function yr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=e/t*e;return isNaN(r)&&(r=0),r=Math.max(r,uo),Math.floor(r)}function co(e,t,r,n){var o=v.useMemo(function(){return[new Map,[]]},[e,r.id,n]),a=K(o,2),i=a[0],s=a[1],l=function(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f,p=i.get(f),m=i.get(d);if(p===void 0||m===void 0)for(var S=e.length,E=s.length;E<S;E+=1){var g,b=e[E],R=t(b);i.set(R,E);var w=(g=r.get(R))!==null&&g!==void 0?g:n;if(s[E]=(s[E-1]||0)+w,R===f&&(p=E),R===d&&(m=E),p!==void 0&&m!==void 0)break}return{top:s[p-1]||0,bottom:s[m]}};return l}var fo=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],ho=[],mo={overflowY:"auto",overflowAnchor:"none"};function po(e,t){var r=e.prefixCls,n=r===void 0?"rc-virtual-list":r,o=e.className,a=e.height,i=e.itemHeight,s=e.fullHeight,l=s===void 0?!0:s,u=e.style,f=e.data,d=e.children,p=e.itemKey,m=e.virtual,S=e.direction,E=e.scrollWidth,g=e.component,b=g===void 0?"div":g,R=e.onScroll,w=e.onVirtualScroll,C=e.onVisibleChange,x=e.innerProps,$=e.extraRender,T=e.styles,H=ui(e,fo),j=v.useCallback(function(y){return typeof p=="function"?p(y):y==null?void 0:y[p]},[p]),k=eo(j,null,null),ee=K(k,4),Y=ee[0],ne=ee[1],X=ee[2],Pe=ee[3],te=!!(m!==!1&&a&&i),Fe=v.useMemo(function(){return Object.values(X.maps).reduce(function(y,O){return y+O},0)},[X.id,X.maps]),le=te&&f&&(Math.max(i*f.length,Fe)>a||!!E),Z=S==="rtl",Ue=dt(n,J({},"".concat(n,"-rtl"),Z),o),U=f||ho,Re=h.useRef(),Ne=h.useRef(),xe=h.useState(0),Be=K(xe,2),ue=Be[0],Se=Be[1],ie=h.useState(0),ce=K(ie,2),z=ce[0],W=ce[1],pe=h.useState(!1),je=K(pe,2),We=je[0],Me=je[1],Je=function(){Me(!0)},et=function(){Me(!1)},Pt={getKey:j};function Te(y){Se(function(O){var M;typeof y=="function"?M=y(O):M=y;var Q=nn(M);return Re.current.scrollTop=Q,Q})}var we=h.useRef({start:0,end:U.length}),tt=h.useRef(),rt=oo(U,j),Nt=K(rt,1),Ce=Nt[0];tt.current=Ce;var nt=v.useMemo(function(){if(!te)return{scrollHeight:void 0,start:0,end:U.length-1,offset:void 0};if(!le){var y;return{scrollHeight:((y=Ne.current)===null||y===void 0?void 0:y.offsetHeight)||0,start:0,end:U.length-1,offset:void 0}}for(var O=0,M,Q,Ee,hn=U.length,Qe=0;Qe<hn;Qe+=1){var dn=U[Qe],mn=j(dn),fr=X.get(mn),Ut=O+(fr===void 0?i:fr);Ut>=ue&&M===void 0&&(M=Qe,Q=O),Ut>ue+a&&Ee===void 0&&(Ee=Qe),O=Ut}return M===void 0&&(M=0,Q=0,Ee=Math.ceil(a/i)),Ee===void 0&&(Ee=U.length-1),Ee=Math.min(Ee+1,U.length-1),{scrollHeight:O,start:M,end:Ee,offset:Q}},[le,te,ue,U,Pe,a]),Ae=nt.scrollHeight,ke=nt.start,Ve=nt.end,Jt=nt.offset;we.current.start=ke,we.current.end=Ve;var Zr=v.useState({width:0,height:a}),er=K(Zr,2),ve=er[0],Jr=er[1],en=function(O){Jr({width:O.width||O.offsetWidth,height:O.height||O.offsetHeight})},tr=h.useRef(),rr=h.useRef(),tn=v.useMemo(function(){return yr(ve.width,E)},[ve.width,E]),rn=v.useMemo(function(){return yr(ve.height,Ae)},[ve.height,Ae]),Mt=Ae-a,wt=h.useRef(Mt);wt.current=Mt;function nn(y){var O=y;return Number.isNaN(wt.current)||(O=Math.min(O,wt.current)),O=Math.max(O,0),O}var nr=ue<=0,ir=ue>=Mt,on=Xr(nr,ir),At=function(){return{x:Z?-z:z,y:ue}},Lt=h.useRef(At()),Dt=Er(function(){if(w){var y=At();(Lt.current.x!==y.x||Lt.current.y!==y.y)&&(w(y),Lt.current=y)}});function or(y,O){var M=y;O?(Bt.flushSync(function(){W(M)}),Dt()):Te(M)}function sn(y){var O=y.currentTarget.scrollTop;O!==ue&&Te(O),R==null||R(y),Dt()}var $t=function(O){var M=O,Q=E?E-ve.width:0;return M=Math.max(M,0),M=Math.min(M,Q),M},an=Er(function(y,O){O?(Bt.flushSync(function(){W(function(M){var Q=M+(Z?-y:y);return $t(Q)})}),Dt()):Te(function(M){var Q=M+y;return Q})}),ln=so(te,nr,ir,!!E,an),sr=K(ln,2),Ht=sr[0],ar=sr[1];lo(te,Re,function(y,O){return on(y,O)?!1:(Ht({preventDefault:function(){},deltaY:y}),!0)}),Ye(function(){function y(M){te&&M.preventDefault()}var O=Re.current;return O.addEventListener("wheel",Ht),O.addEventListener("DOMMouseScroll",ar),O.addEventListener("MozMousePixelScroll",y),function(){O.removeEventListener("wheel",Ht),O.removeEventListener("DOMMouseScroll",ar),O.removeEventListener("MozMousePixelScroll",y)}},[te]),Ye(function(){E&&W(function(y){return $t(y)})},[ve.width,E]);var lr=function(){var O,M;(O=tr.current)===null||O===void 0||O.delayHidden(),(M=rr.current)===null||M===void 0||M.delayHidden()},ur=no(Re,U,X,i,j,function(){return ne(!0)},Te,lr);v.useImperativeHandle(t,function(){return{getScrollInfo:At,scrollTo:function(O){function M(Q){return Q&&me(Q)==="object"&&("left"in Q||"top"in Q)}M(O)?(O.left!==void 0&&W($t(O.left)),ur(O.top)):ur(O)}}}),Ye(function(){if(C){var y=U.slice(ke,Ve+1);C(y,U)}},[ke,Ve,U]);var un=co(U,j,X,i),cn=$==null?void 0:$({start:ke,end:Ve,virtual:le,offsetX:z,offsetY:Jt,rtl:Z,getSize:un}),fn=Zi(U,ke,Ve,E,Y,d,Pt),ze=null;a&&(ze=re(J({},l?"height":"maxHeight",a),mo),te&&(ze.overflowY="hidden",E&&(ze.overflowX="hidden"),We&&(ze.pointerEvents="none")));var cr={};return Z&&(cr.dir="rtl"),v.createElement("div",Ze({style:re(re({},u),{},{position:"relative"}),className:Ue},cr,H),v.createElement(Kt,{onResize:en},v.createElement(b,{className:"".concat(n,"-holder"),style:ze,ref:Re,onScroll:sn,onMouseEnter:lr},v.createElement(Qr,{prefixCls:n,height:Ae,offsetX:z,offsetY:Jt,scrollWidth:E,onInnerResize:ne,ref:Ne,innerProps:x,rtl:Z,extra:cn},fn))),le&&Ae>a&&v.createElement(_r,{ref:tr,prefixCls:n,scrollOffset:ue,scrollRange:Ae,rtl:Z,onScroll:or,onStartMove:Je,onStopMove:et,spinSize:rn,containerSize:ve.height,style:T==null?void 0:T.verticalScrollBar,thumbStyle:T==null?void 0:T.verticalScrollBarThumb}),le&&E>ve.width&&v.createElement(_r,{ref:rr,prefixCls:n,scrollOffset:z,scrollRange:E,rtl:Z,onScroll:or,onStartMove:Je,onStopMove:et,spinSize:tn,containerSize:ve.width,horizontal:!0,style:T==null?void 0:T.horizontalScrollBar,thumbStyle:T==null?void 0:T.horizontalScrollBarThumb}))}var Kr=v.forwardRef(po);Kr.displayName="List";function vo(e){const{model:t}=e,r=Ge.useDependency(_.LocaleService),n=D.useObservable(t.searchString$,"",!0),o=D.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=jt(o),s=i.checked>0&&i.unchecked===0,l=i.checked>0&&i.unchecked>0,u=h.useCallback((m,S)=>{t.onFilterCheckToggled(m,S)},[t]),f=h.useCallback(m=>{t.onFilterOnly(m)},[t]),d=h.useCallback(()=>{t.onCheckAllToggled(!s)},[t,s]),p=h.useCallback(m=>{t.setSearchString(m)},[t]);return h.createElement("div",{className:B.sheetsFilterPanelValuesContainer},h.createElement(q.Input,{value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:p}),h.createElement("div",{className:B.sheetsFilterPanelValuesList},h.createElement("div",{className:B.sheetsFilterPanelValuesItem},h.createElement("div",{className:B.sheetsFilterPanelValuesItemInner},h.createElement(q.Checkbox,{indeterminate:l,disabled:o.length===0,checked:s,onChange:d}),h.createElement("span",{className:B.sheetsFilterPanelValuesItemText},`${r.t("sheets-filter.panel.select-all")}`),h.createElement("span",{className:B.sheetsFilterPanelValuesItemCount},`(${i.checked}/${i.checked+i.unchecked})`))),h.createElement("div",{className:B.sheetsFilterPanelValuesVirtual},h.createElement(Kr,{style:{paddingRight:8},data:o,height:190,itemHeight:32,itemKey:m=>`${m.value}----${m.checked}`},m=>h.createElement("div",{className:B.sheetsFilterPanelValuesItem},h.createElement("div",{className:B.sheetsFilterPanelValuesItemInner},h.createElement(q.Checkbox,{checked:m.checked,onChange:()=>u(m,!m.checked)}),h.createElement(q.Tooltip,{showIfEllipsis:!0,placement:"top",title:m.value},h.createElement("span",{className:B.sheetsFilterPanelValuesItemText},m.value)),h.createElement("span",{className:B.sheetsFilterPanelValuesItemCount},`(${m.count})`),h.createElement(q.Button,{className:B.sheetsFilterPanelValuesItemExcludeButton,size:"small",type:"link",onClick:()=>f(m)},a)))))))}function go(){const e=Ge.useDependency(Oe),t=Ge.useDependency(_.LocaleService),r=Ge.useDependency(_.ICommandService),n=D.useObservable(e.filterBy$,void 0,!0),o=D.useObservable(e.filterByModel$,void 0,!1),a=D.useObservable(()=>(o==null?void 0:o.canApply$)||N.of(!1),void 0,!1,[o]),i=_o(t),s=!D.useObservable(e.hasCriteria$),l=h.useCallback(p=>{r.executeCommand(wr.id,{filterBy:p})},[r]),u=h.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(qe.id)},[o,r]),f=h.useCallback(()=>{r.executeCommand(qe.id)},[r]),d=h.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(qe.id)},[o,r]);return h.createElement("div",{className:B.sheetsFilterPanel},h.createElement("div",{className:B.sheetsFilterPanelHeader},h.createElement(q.Segmented,{value:n,options:i,onChange:p=>l(p)})),o?h.createElement("div",{className:B.sheetsFilterPanelContent},n===ct.VALUES?h.createElement(vo,{model:o}):h.createElement(ei,{model:o})):null,h.createElement("div",{className:B.sheetsFilterPanelFooter},h.createElement(q.Button,{type:"link",onClick:u,disabled:s},t.t("sheets-filter.panel.clear-filter")),h.createElement("span",{className:B.sheetsFilterPanelFooterPrimaryButtons},h.createElement(q.Button,{type:"default",onClick:f},t.t("sheets-filter.panel.cancel")),h.createElement(q.Button,{disabled:!a,type:"primary",onClick:d},t.t("sheets-filter.panel.confirm")))))}function _o(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:ct.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:ct.CONDITIONS}],[t,e])}const So={id:Ie.id,binding:D.KeyCode.L|D.MetaKeys.CTRL_COMMAND|D.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:de.whenSheetEditorFocused,group:"4_sheet-edit"};function Eo(e){const t=e.get(c.SheetsFilterService);return{id:Ie.id,group:D.MenuGroup.TOOLBAR_FORMULAS_INSERT,type:D.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",positions:[D.MenuPosition.TOOLBAR_START],hidden$:D.getMenuHiddenObservable(e,_.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(N.map(r=>!!r)),disabled$:de.getCurrentRangeDisable$(e,{workbookTypes:[G.WorkbookEditablePermission],worksheetTypes:[G.WorksheetFilterPermission,G.WorksheetEditPermission],rangeTypes:[G.RangeProtectionPermissionEditPoint]})}}function bo(e){const t=e.get(c.SheetsFilterService);return{id:Pr.id,group:D.MenuGroup.TOOLBAR_OTHERS,type:D.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Ie.id],hidden$:D.getMenuHiddenObservable(e,_.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}function yo(e){const t=e.get(c.SheetsFilterService);return{id:Nr.id,group:D.MenuGroup.TOOLBAR_OTHERS,type:D.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",positions:[Ie.id],hidden$:D.getMenuHiddenObservable(e,_.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}const be=16,Oo=new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");class Or{static drawNoCriteria(t,r,n,o){t.save(),Ke.Rect.drawWith(t,{radius:2,width:be,height:be,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/be,r/be),t.beginPath(),t.lineWidth=1,t.lineCap="round",t.moveTo(3,4),t.lineTo(13,4),t.moveTo(4.5,8),t.lineTo(11.5,8),t.moveTo(6,12),t.lineTo(10,12),t.stroke(),t.restore()}static drawHasCriteria(t,r,n,o){t.save(),Ke.Rect.drawWith(t,{radius:2,width:be,height:be,fill:o}),t.scale(r/be,r/be),t.fillStyle=n,t.fill(Oo),t.restore()}}var Fo=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,To=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ro(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Fo(t,r,o),o},xt=(e,t)=>(r,n)=>t(r,n,e);const _e=16,it=1;let Qt=class extends Ke.Shape{constructor(t,r,n,o,a){super(t,r);I(this,"_cellWidth",0);I(this,"_cellHeight",0);I(this,"_filterParams");I(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=a,this.setShapeProps(r),this.onPointerDownObserver.add(i=>this.onPointerDown(i)),this.onPointerEnterObserver.add(()=>this.onPointerEnter()),this.onPointerLeaveObserver.add(()=>this.onPointerLeave())}setShapeProps(t){typeof t.cellHeight<"u"&&(this._cellHeight=t.cellHeight),typeof t.cellWidth<"u"&&(this._cellWidth=t.cellWidth),typeof t.filterParams<"u"&&(this._filterParams=t.filterParams),this.transformByState({width:t.width,height:t.height})}_draw(t){const r=this._cellHeight,n=this._cellWidth,o=_e-n,a=_e-r;t.save();const i=new Path2D;i.rect(o,a,n,r),t.clip(i);const{hasCriteria:s}=this._filterParams,l=this._themeService.getCurrentTheme().primaryColor,u=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";s?Or.drawHasCriteria(t,_e,l,u):Or.drawNoCriteria(t,_e,l,u),t.restore()}onPointerDown(t){if(t.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue($e)||setTimeout(()=>{this._commandService.executeCommand(gt.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};Qt=To([xt(2,_.IContextService),xt(3,_.ICommandService),xt(4,L.Inject(_.ThemeService))],Qt);var Co=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,Po=(e,t,r,n)=>{for(var o=n>1?void 0:n?Io(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Co(t,r,o),o},ge=(e,t)=>(r,n)=>t(r,n,e);const No=1e3,Mo=5e3;let Gt=class extends _.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,f){super();I(this,"_filterRangeShape",null);I(this,"_buttonRenderDisposable",null);I(this,"_filterButtonShapes",[]);this._context=t,this._injector=r,this._sheetSkeletonManagerService=n,this._sheetsFilterService=o,this._themeService=a,this._sheetInterceptorService=i,this._sheetRenderController=s,this._commandService=l,this._renderManagerService=u,this._selectionRenderService=f,[c.SetSheetsFilterRangeMutation,c.SetSheetsFilterCriteriaMutation,c.RemoveSheetsFilterMutation,c.ReCalcSheetsFilterMutation].forEach(d=>this.disposeWithMe(this._sheetRenderController.registerSkeletonChangingMutations(d.id))),this._initRenderer()}_initRenderer(){N.combineLatest([this._selectionRenderService.usable$,this._sheetSkeletonManagerService.currentSkeleton$]).pipe(N.filter(([t])=>t),N.switchMap(([t,r])=>{var l;if(!r)return N.of(null);const{unitId:n}=r,o=this._context.unit,a=o.getActiveSheet().getSheetId(),i=(l=this._sheetsFilterService.getFilterModel(n,a))!=null?l:void 0,s=()=>({unitId:n,worksheetId:a,filterModel:i,range:i==null?void 0:i.getRange(),skeleton:r.skeleton});return _.fromCallback(this._commandService.onCommandExecuted).pipe(N.filter(([u])=>u.type===_.CommandType.MUTATION&&u.params.unitId===o.getUnitId()&&c.FILTER_MUTATIONS.has(u.id)),N.throttleTime(20,void 0,{leading:!1,trailing:!0}),N.map(s),N.startWith(s()))}),N.takeUntil(this.dispose$)).subscribe(t=>{this._disposeRendering(),!(!t||!t.range)&&(this._renderRange(t.unitId,t.range,t.skeleton),this._renderButtons(t))})}_renderRange(t,r,n){const o=this._renderManagerService.getRenderById(t);if(!o)return;const{scene:a}=o,{rangeWithCoord:i,style:s}=this._selectionRenderService.attachSelectionWithCoord({range:r,primary:null,style:null}),{rowHeaderWidth:l,columnHeaderHeight:u}=n,f=this._filterRangeShape=new de.SelectionShape(a,No,!0,this._themeService);f.update(i,l,u,{hasAutoFill:!1,fill:"rgba(0, 0, 0, 0.0)",...s}),f.setEvent(!1),a.makeDirty(!0)}_renderButtons(t){const{range:r,filterModel:n,unitId:o,skeleton:a,worksheetId:i}=t,s=this._renderManagerService.getRenderById(o);if(!s)return;const{scene:l}=s;this._interceptCellContent(t.range);const{startColumn:u,endColumn:f,startRow:d}=r;for(let p=u;p<=f;p++){const m=`sheets-filter-button-${p}`,S=de.getCoordByCell(d,p,l,a),{startX:E,startY:g,endX:b,endY:R}=S,w=b-E,C=R-g;if(C<=it||w<=it)continue;const x=!!n.getFilterColumn(p),$=b-_e-it,T=R-_e-it,H={left:$,top:T,height:_e,width:_e,zIndex:Mo,cellHeight:C,cellWidth:w,filterParams:{unitId:o,subUnitId:i,col:p,hasCriteria:x}},j=this._injector.createInstance(Qt,m,H);this._filterButtonShapes.push(j)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(t){const{startRow:r,startColumn:n,endColumn:o}=t;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(G.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(a,i,s)=>{const{row:l,col:u}=i;return l!==r||u<n||u>o?s(a):s({...a,fontRenderExtension:{...a==null?void 0:a.fontRenderExtension,rightOffset:_e}})},priority:10})}_disposeRendering(){var t,r;(t=this._filterRangeShape)==null||t.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};Gt=Po([ge(1,L.Inject(L.Injector)),ge(2,L.Inject(de.SheetSkeletonManagerService)),ge(3,L.Inject(c.SheetsFilterService)),ge(4,L.Inject(_.ThemeService)),ge(5,L.Inject(G.SheetInterceptorService)),ge(6,L.Inject(de.SheetRenderController)),ge(7,_.ICommandService),ge(8,Ke.IRenderManagerService),ge(9,de.ISelectionRenderService)],Gt);var wo=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,Lo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ao(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&wo(t,r,o),o},oe=(e,t)=>(r,n)=>t(r,n,e);const Do={},Fr="FILTER_PANEL_POPUP";let Xe=class extends _.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,f,d,p,m){super();I(this,"_popupDisposable");this._config=t,this._injector=r,this._componentManager=n,this._sheetsFilterPanelService=o,this._sheetCanvasPopupService=a,this._sheetsFilterService=i,this._localeService=s,this._renderManagerService=l,this._shortcutService=u,this._commandService=f,this._menuService=d,this._contextService=p,this._messageService=m,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI(),this._initRenderControllers()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[So].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Ie,De,Pr,Nr,wr,gt,qe].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){const{menu:t={}}=this._config;[Eo,bo,yo].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r),t))})}_initUI(){this.disposeWithMe(this._componentManager.register(Fr,go)),this.disposeWithMe(this._componentManager.register("FilterSingle",Ir)),this.disposeWithMe(this._contextService.subscribeContextValue$($e).pipe(N.distinctUntilChanged()).subscribe(t=>{t?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(t=>{t&&this._messageService.show({type:q.MessageType.Error,content:this._localeService.t(t)})}))}_initRenderControllers(){this.disposeWithMe(this._renderManagerService.registerRenderController(_.UniverInstanceType.UNIVER_SHEET,Gt))}_openFilterPopup(){const t=this._sheetsFilterPanelService.filterModel;if(!t)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=t.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:Fr,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(qe.id),offset:[5,0]})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};Xe=Lo([_.OnLifecycle(_.LifecycleStages.Ready,Xe),oe(1,L.Inject(L.Injector)),oe(2,L.Inject(D.ComponentManager)),oe(3,L.Inject(Oe)),oe(4,L.Inject(de.SheetCanvasPopManagerService)),oe(5,L.Inject(c.SheetsFilterService)),oe(6,L.Inject(_.LocaleService)),oe(7,Ke.IRenderManagerService),oe(8,D.IShortcutService),oe(9,_.ICommandService),oe(10,D.IMenuService),oe(11,_.IContextService),oe(12,D.IMessageService)],Xe);var $o=Object.defineProperty,Ho=Object.getOwnPropertyDescriptor,Uo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ho(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&$o(t,r,o),o},ot=(e,t)=>(r,n)=>t(r,n,e);let ut=class extends _.Disposable{constructor(e,t,r,n){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=r,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{var t;if(e.id===Ie.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithoutRange({workbookTypes:[G.WorkbookEditablePermission],rangeTypes:[G.RangeProtectionPermissionViewPoint],worksheetTypes:[G.WorksheetFilterPermission,G.WorksheetEditPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"))),e.id===gt.id){const r=e.params,{unitId:n,subUnitId:o}=r,a=(t=this._sheetsFilterService.getFilterModel(n,o))==null?void 0:t.getRange(),i=_.Tools.deepClone(a);i&&(i.startColumn=r.col,i.endColumn=r.col,this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[G.WorkbookEditablePermission],rangeTypes:[G.RangeProtectionPermissionViewPoint],worksheetTypes:[G.WorksheetFilterPermission,G.WorksheetEditPermission]},[i])||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")))}}))}};ut=Uo([_.OnLifecycle(_.LifecycleStages.Ready,ut),ot(0,L.Inject(c.SheetsFilterService)),ot(1,L.Inject(_.LocaleService)),ot(2,_.ICommandService),ot(3,L.Inject(de.SheetPermissionInterceptorBaseController))],ut);var xo=Object.defineProperty,Bo=Object.getOwnPropertyDescriptor,jo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Bo(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&xo(t,r,o),o},Rr=(e,t)=>(r,n)=>t(r,n,e);const Wo="SHEET_FILTER_UI_PLUGIN";var st;exports.UniverSheetsFilterUIPlugin=(st=class extends _.Plugin{constructor(t={},r,n){super(),this._config=t,this._injector=r,this._localeService=n,this._config=_.Tools.deepMerge({},Do,this._config)}onStarting(t){[[Oe],[ut],[Xe,{useFactory:()=>this._injector.createInstance(Xe,this._config)}]].forEach(r=>t.add(r))}},I(st,"type",_.UniverInstanceType.UNIVER_SHEET),I(st,"pluginName",Wo),st);exports.UniverSheetsFilterUIPlugin=jo([Rr(1,L.Inject(L.Injector)),Rr(2,L.Inject(_.LocaleService))],exports.UniverSheetsFilterUIPlugin);const ko={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"筛选","clear-filter-criteria":"清除筛选条件","re-calc-filter-conditions":"重新计算"},command:{"not-valid-filter-range":"选中的区域只有一行,无法进行筛选"},shortcut:{"smart-toggle-filter":"切换筛选"},panel:{"clear-filter":"清除筛选",cancel:"取消",confirm:"确认","by-values":"按值","by-conditions":"按条件","filter-only":"仅筛选","search-placeholder":"使用空格分隔关键字","select-all":"全选","input-values-placeholder":"请输入",or:"或",and:"和",empty:"(空白)","?":"可用 ? 代表单个字符","*":"可用 * 代表任意多个字符"},conditions:{none:"无",empty:"为空","not-empty":"不为空","text-contains":"文本包含","does-not-contain":"文本不包含","starts-with":"文本开头","ends-with":"文本结尾",equals:"文本相符","greater-than":"大于","greater-than-or-equal":"大于等于","less-than":"小于","less-than-or-equal":"小于等于",equal:"等于","not-equal":"不等于",between:"介于","not-between":"不介于",custom:"自定义"},msg:{"filter-header-forbidden":"无法移动筛选行头"}}},Vo=Object.freeze(Object.defineProperty({__proto__:null,default:ko},Symbol.toStringTag,{value:"Module"})),zo={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Toggle Filter","clear-filter-criteria":"Clear Filter Conditions","re-calc-filter-conditions":"Re-calc Filter Conditions"},command:{"not-valid-filter-range":"The selected range only has one row and not valid for filter."},shortcut:{"smart-toggle-filter":"Toggle Filter"},panel:{"clear-filter":"Clear Filter",cancel:"Cancel",confirm:"Confirm","by-values":"By Values","by-conditions":"By Conditions","filter-only":"Filter Only","search-placeholder":"Use space to separate keywords","select-all":"Select All","input-values-placeholder":"Input Values",and:"AND",or:"OR",empty:"(empty)","?":"Use “?” to represent a single character.","*":"Use “*” to represent multiple characters."},conditions:{none:"None",empty:"Is Empty","not-empty":"Is Not Empty","text-contains":"Text Contains","does-not-contain":"Text Does Not Contain","starts-with":"Text Starts With","ends-with":"Text Ends With",equals:"Text Equals","greater-than":"Greater Than","greater-than-or-equal":"Greater Than Or Equal To","less-than":"Less Than","less-than-or-equal":"Less Than Or Equal To",equal:"Equal","not-equal":"Not Equal",between:"Between","not-between":"Not Between",custom:"Custom"},msg:{"filter-header-forbidden":"You can't move the header row of a filter."}}},Qo=Object.freeze(Object.defineProperty({__proto__:null,default:zo},Symbol.toStringTag,{value:"Module"})),Go={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Переключить фильтр","clear-filter-criteria":"Очистить условия фильтра","re-calc-filter-conditions":"Пересчитать условия фильтра"},command:{"not-valid-filter-range":"Выбранный диапазон содержит только одну строку и не подходит для фильтра."},shortcut:{"smart-toggle-filter":"Переключить фильтр"},panel:{"clear-filter":"Очистить фильтр",cancel:"Отмена",confirm:"Подтвердить","by-values":"По значениям","by-conditions":"По условиям","filter-only":"Только фильтр","search-placeholder":"Используйте пробел для разделения ключевых слов","select-all":"Выбрать все","input-values-placeholder":"Введите значения",and:"И",or:"ИЛИ",empty:"(пусто)","?":"Используйте “?” для обозначения одного символа.","*":"Используйте “*” для обозначения нескольких символов."},conditions:{none:"Нет",empty:"Пусто","not-empty":"Не пусто","text-contains":"Содержит текст","does-not-contain":"Не содержит текст","starts-with":"Начинается с","ends-with":"Заканчивается на",equals:"Равно","greater-than":"Больше чем","greater-than-or-equal":"Больше или равно","less-than":"Меньше чем","less-than-or-equal":"Меньше или равно",equal:"Равно","not-equal":"Не равно",between:"Между","not-between":"Не между",custom:"Пользовательский"},msg:{"filter-header-forbidden":"Вы не можете переместить строку заголовка фильтра."}}},qo=Object.freeze(Object.defineProperty({__proto__:null,default:Go},Symbol.toStringTag,{value:"Module"}));exports.OpenFilterPanelOperation=gt;exports.SmartToggleSheetsFilterCommand=Ie;exports.enUS=Qo;exports.ruRU=qo;exports.zhCN=Vo;
|
|
14
|
+
*/var qt=Symbol.for("react.element"),Yt=Symbol.for("react.portal"),Et=Symbol.for("react.fragment"),bt=Symbol.for("react.strict_mode"),yt=Symbol.for("react.profiler"),Ft=Symbol.for("react.provider"),Ot=Symbol.for("react.context"),_i=Symbol.for("react.server_context"),Rt=Symbol.for("react.forward_ref"),Ct=Symbol.for("react.suspense"),Tt=Symbol.for("react.suspense_list"),It=Symbol.for("react.memo"),Pt=Symbol.for("react.lazy"),Si=Symbol.for("react.offscreen"),xr;xr=Symbol.for("react.module.reference");function ce(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case qt:switch(e=e.type,e){case Et:case yt:case bt:case Ct:case Tt:return e;default:switch(e=e&&e.$$typeof,e){case _i:case Ot:case Rt:case Pt:case It:case Ft:return e;default:return t}}case Yt:return t}}}A.ContextConsumer=Ot;A.ContextProvider=Ft;A.Element=qt;A.ForwardRef=Rt;A.Fragment=Et;A.Lazy=Pt;A.Memo=It;A.Portal=Yt;A.Profiler=yt;A.StrictMode=bt;A.Suspense=Ct;A.SuspenseList=Tt;A.isAsyncMode=function(){return!1};A.isConcurrentMode=function(){return!1};A.isContextConsumer=function(e){return ce(e)===Ot};A.isContextProvider=function(e){return ce(e)===Ft};A.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===qt};A.isForwardRef=function(e){return ce(e)===Rt};A.isFragment=function(e){return ce(e)===Et};A.isLazy=function(e){return ce(e)===Pt};A.isMemo=function(e){return ce(e)===It};A.isPortal=function(e){return ce(e)===Yt};A.isProfiler=function(e){return ce(e)===yt};A.isStrictMode=function(e){return ce(e)===bt};A.isSuspense=function(e){return ce(e)===Ct};A.isSuspenseList=function(e){return ce(e)===Tt};A.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Et||e===yt||e===bt||e===Ct||e===Tt||e===Si||typeof e=="object"&&e!==null&&(e.$$typeof===Pt||e.$$typeof===It||e.$$typeof===Ft||e.$$typeof===Ot||e.$$typeof===Rt||e.$$typeof===xr||e.getModuleId!==void 0)};A.typeOf=ce;Hr.exports=A;var Ge=Hr.exports;function jt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=[];return h.Children.forEach(e,function(n){n==null&&!t.keepEmpty||(Array.isArray(n)?r=r.concat(jt(n)):Ge.isFragment(n)&&n.props?r=r.concat(jt(n.props.children,t)):r.push(n))}),r}function pr(e){return e instanceof HTMLElement||e instanceof SVGElement}function Ei(e){return e&&ue(e)==="object"&&pr(e.nativeElement)?e.nativeElement:pr(e)?e:null}function ut(e){var t=Ei(e);if(t)return t;if(e instanceof h.Component){var r;return(r=ft.findDOMNode)===null||r===void 0?void 0:r.call(ft,e)}return null}function bi(e,t,r){var n=p.useRef({});return(!("value"in n.current)||r(n.current.condition,t))&&(n.current.value=e(),n.current.condition=t),n.current.value}var yi=function(t,r){typeof t=="function"?t(r):ue(t)==="object"&&t&&"current"in t&&(t.current=r)},Fi=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r.filter(Boolean);return o.length<=1?o[0]:function(a){r.forEach(function(i){yi(i,a)})}},Oi=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return bi(function(){return Fi.apply(void 0,r)},r,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},Ri=function(t){var r,n,o=Ge.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((r=o.prototype)!==null&&r!==void 0&&r.render)&&o.$$typeof!==Ge.ForwardRef||typeof t=="function"&&!((n=t.prototype)!==null&&n!==void 0&&n.render)&&t.$$typeof!==Ge.ForwardRef)};function vr(e){return h.isValidElement(e)&&!Ge.isFragment(e)}Number(h.version.split(".")[0])>=19;var Wt=p.createContext(null);function Ci(e){var t=e.children,r=e.onBatchResize,n=p.useRef(0),o=p.useRef([]),a=p.useContext(Wt),i=p.useCallback(function(s,l,u){n.current+=1;var f=n.current;o.current.push({size:s,element:l,data:u}),Promise.resolve().then(function(){f===n.current&&(r==null||r(o.current),o.current=[])}),a==null||a(s,l,u)},[r,a]);return p.createElement(Wt.Provider,{value:i},t)}var Br=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(o,a){return o[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];r.call(n,i[1],i[0])}},t}()}(),kt=typeof window<"u"&&typeof document<"u"&&window.document===document,vt=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Ti=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(vt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Ii=2;function Pi(e,t){var r=!1,n=!1,o=0;function a(){r&&(r=!1,e()),n&&s()}function i(){Ti(a)}function s(){var l=Date.now();if(r){if(l-o<Ii)return;n=!0}else r=!0,n=!1,setTimeout(i,t);o=l}return s}var Ni=20,Mi=["top","right","bottom","left","width","height","size","weight"],wi=typeof MutationObserver<"u",Ai=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Pi(this.refresh.bind(this),Ni)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!kt||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),wi?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!kt||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=Mi.some(function(a){return!!~n.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),jr=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},$e=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||vt},Wr=Nt(0,0,0,0);function gt(e){return parseFloat(e)||0}function gr(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,o){var a=e["border-"+o+"-width"];return n+gt(a)},0)}function Li(e){for(var t=["top","right","bottom","left"],r={},n=0,o=t;n<o.length;n++){var a=o[n],i=e["padding-"+a];r[a]=gt(i)}return r}function Di(e){var t=e.getBBox();return Nt(0,0,t.width,t.height)}function $i(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return Wr;var n=$e(e).getComputedStyle(e),o=Li(n),a=o.left+o.right,i=o.top+o.bottom,s=gt(n.width),l=gt(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=gr(n,"left","right")+a),Math.round(l+i)!==r&&(l-=gr(n,"top","bottom")+i)),!Hi(e)){var u=Math.round(s+a)-t,f=Math.round(l+i)-r;Math.abs(u)!==1&&(s-=u),Math.abs(f)!==1&&(l-=f)}return Nt(o.left,o.top,s,l)}var Ui=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof $e(e).SVGGraphicsElement}:function(e){return e instanceof $e(e).SVGElement&&typeof e.getBBox=="function"}}();function Hi(e){return e===$e(e).document.documentElement}function xi(e){return kt?Ui(e)?Di(e):$i(e):Wr}function Bi(e){var t=e.x,r=e.y,n=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return jr(i,{x:t,y:r,width:n,height:o,top:r,right:t+n,bottom:o+r,left:t}),i}function Nt(e,t,r,n){return{x:e,y:t,width:r,height:n}}var ji=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Nt(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=xi(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),Wi=function(){function e(t,r){var n=Bi(r);jr(this,{target:t,contentRect:n})}return e}(),ki=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new Br,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof $e(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new ji(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof $e(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new Wi(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),kr=typeof WeakMap<"u"?new WeakMap:new Br,Vr=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Ai.getInstance(),n=new ki(t,r,this);kr.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Vr.prototype[e]=function(){var t;return(t=kr.get(this))[e].apply(t,arguments)}});var Vi=function(){return typeof vt.ResizeObserver<"u"?vt.ResizeObserver:Vr}(),ye=new Map;function zi(e){e.forEach(function(t){var r,n=t.target;(r=ye.get(n))===null||r===void 0||r.forEach(function(o){return o(n)})})}var zr=new Vi(zi);function Qi(e,t){ye.has(e)||(ye.set(e,new Set),zr.observe(e)),ye.get(e).add(t)}function Gi(e,t){ye.has(e)&&(ye.get(e).delete(t),ye.get(e).size||(zr.unobserve(e),ye.delete(e)))}function Qr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qi(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$r(n.key),n)}}function Gr(e,t,r){return t&&qi(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vt(e,t){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Vt(e,t)}function Yi(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vt(e,t)}function _t(e){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(e)}function qr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qr=function(){return!!e})()}function Xi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ki(e,t){if(t&&(ue(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xi(e)}function Zi(e){var t=qr();return function(){var r,n=_t(e);if(t){var o=_t(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ki(this,r)}}var Ji=function(e){Yi(r,e);var t=Zi(r);function r(){return Qr(this,r),t.apply(this,arguments)}return Gr(r,[{key:"render",value:function(){return this.props.children}}]),r}(p.Component);function eo(e,t){var r=e.children,n=e.disabled,o=p.useRef(null),a=p.useRef(null),i=p.useContext(Wt),s=typeof r=="function",l=s?r(o):r,u=p.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),f=!s&&p.isValidElement(l)&&Ri(l),m=f?l.ref:null,v=Oi(m,o),d=function(){var F;return ut(o.current)||(o.current&&ue(o.current)==="object"?ut((F=o.current)===null||F===void 0?void 0:F.nativeElement):null)||ut(a.current)};p.useImperativeHandle(t,function(){return d()});var E=p.useRef(e);E.current=e;var _=p.useCallback(function(S){var F=E.current,b=F.onResize,I=F.data,T=S.getBoundingClientRect(),W=T.width,$=T.height,C=S.offsetWidth,U=S.offsetHeight,x=Math.floor(W),k=Math.floor($);if(u.current.width!==x||u.current.height!==k||u.current.offsetWidth!==C||u.current.offsetHeight!==U){var te={width:x,height:k,offsetWidth:C,offsetHeight:U};u.current=te;var q=C===Math.round(W)?W:C,ie=U===Math.round($)?$:U,Y=K(K({},te),{},{offsetWidth:q,offsetHeight:ie});i==null||i(Y,S,I),b&&Promise.resolve().then(function(){b(Y,S)})}},[]);return p.useEffect(function(){var S=d();return S&&!n&&Qi(S,_),function(){return Gi(S,_)}},[o.current,n]),p.createElement(Ji,{ref:a},f?p.cloneElement(l,{ref:v}):l)}var to=p.forwardRef(eo),ro="rc-observer-key";function no(e,t){var r=e.children,n=typeof r=="function"?[r]:jt(r);return n.map(function(o,a){var i=(o==null?void 0:o.key)||"".concat(ro,"-").concat(a);return p.createElement(to,Ke({},e,{key:i,ref:a===0?t:void 0}),o)})}var Xt=p.forwardRef(no);Xt.Collection=Ci;function _r(e){var t=p.useRef();t.current=e;var r=p.useCallback(function(){for(var n,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return(n=t.current)===null||n===void 0?void 0:n.call.apply(n,[t].concat(a))},[]);return r}function io(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Sr=io()?p.useLayoutEffect:p.useEffect,qe=function(t,r){var n=p.useRef(!0);Sr(function(){return t(n.current)},r),Sr(function(){return n.current=!1,function(){n.current=!0}},[])},Yr=p.forwardRef(function(e,t){var r=e.height,n=e.offsetY,o=e.offsetX,a=e.children,i=e.prefixCls,s=e.onInnerResize,l=e.innerProps,u=e.rtl,f=e.extra,m={},v={display:"flex",flexDirection:"column"};return n!==void 0&&(m={height:r,position:"relative",overflow:"hidden"},v=K(K({},v),{},ee(ee(ee(ee(ee({transform:"translateY(".concat(n,"px)")},u?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),p.createElement("div",{style:m},p.createElement(Xt,{onResize:function(E){var _=E.offsetHeight;_&&s&&s()}},p.createElement("div",Ke({style:v,className:pt(ee({},"".concat(i,"-holder-inner"),i)),ref:t},l),a,f)))});Yr.displayName="Filler";function oo(e){var t=e.children,r=e.setRef,n=p.useCallback(function(o){r(o)},[]);return p.cloneElement(t,{ref:n})}function so(e,t,r,n,o,a,i,s){var l=s.getKey;return e.slice(t,r+1).map(function(u,f){var m=t+f,v=i(u,m,{style:{width:n},offsetX:o}),d=l(u);return p.createElement(oo,{key:d,setRef:function(_){return a(u,_)}},v)})}function ao(e,t,r){var n=e.length,o=t.length,a,i;if(n===0&&o===0)return null;n<o?(a=e,i=t):(a=t,i=e);var s={__EMPTY_ITEM__:!0};function l(E){return E!==void 0?r(E):s}for(var u=null,f=Math.abs(n-o)!==1,m=0;m<i.length;m+=1){var v=l(a[m]),d=l(i[m]);if(v!==d){u=m,f=f||v!==l(i[m+1]);break}}return u===null?null:{index:u,multiple:f}}function lo(e,t,r){var n=p.useState(e),o=X(n,2),a=o[0],i=o[1],s=p.useState(null),l=X(s,2),u=l[0],f=l[1];return p.useEffect(function(){var m=ao(a||[],e||[],t);(m==null?void 0:m.index)!==void 0&&f(e[m.index]),i(e)},[e]),[u]}var Xr=function(t){return+setTimeout(t,16)},Kr=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(Xr=function(t){return window.requestAnimationFrame(t)},Kr=function(t){return window.cancelAnimationFrame(t)});var Er=0,Kt=new Map;function Zr(e){Kt.delete(e)}var de=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;Er+=1;var n=Er;function o(a){if(a===0)Zr(n),t();else{var i=Xr(function(){o(a-1)});Kt.set(n,i)}}return o(r),n};de.cancel=function(e){var t=Kt.get(e);return Zr(e),Kr(t)};var br=(typeof navigator>"u"?"undefined":ue(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const Jr=function(e,t,r,n){var o=h.useRef(!1),a=h.useRef(null);function i(){clearTimeout(a.current),o.current=!0,a.current=setTimeout(function(){o.current=!1},50)}var s=h.useRef({top:e,bottom:t,left:r,right:n});return s.current.top=e,s.current.bottom=t,s.current.left=r,s.current.right=n,function(l,u){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,m=l?u<0&&s.current.left||u>0&&s.current.right:u<0&&s.current.top||u>0&&s.current.bottom;return f&&m?(clearTimeout(a.current),o.current=!1):(!m||o.current)&&i(),!o.current&&m}};function uo(e,t,r,n,o,a,i){var s=h.useRef(0),l=h.useRef(null),u=h.useRef(null),f=h.useRef(!1),m=Jr(t,r,n,o);function v(b,I){de.cancel(l.current),s.current+=I,u.current=I,!m(!1,I)&&(br||b.preventDefault(),l.current=de(function(){var T=f.current?10:1;i(s.current*T),s.current=0}))}function d(b,I){i(I,!0),br||b.preventDefault()}var E=h.useRef(null),_=h.useRef(null);function S(b){if(e){de.cancel(_.current),_.current=de(function(){E.current=null},2);var I=b.deltaX,T=b.deltaY,W=b.shiftKey,$=I,C=T;(E.current==="sx"||!E.current&&W&&T&&!I)&&($=T,C=0,E.current="sx");var U=Math.abs($),x=Math.abs(C);E.current===null&&(E.current=a&&U>x?"x":"y"),E.current==="y"?v(b,C):d(b,$)}}function F(b){e&&(f.current=b.detail===u.current)}return[S,F]}function co(e,t,r,n){var o=p.useMemo(function(){return[new Map,[]]},[e,r.id,n]),a=X(o,2),i=a[0],s=a[1],l=function(f){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f,v=i.get(f),d=i.get(m);if(v===void 0||d===void 0)for(var E=e.length,_=s.length;_<E;_+=1){var S,F=e[_],b=t(F);i.set(b,_);var I=(S=r.get(b))!==null&&S!==void 0?S:n;if(s[_]=(s[_-1]||0)+I,b===f&&(v=_),b===m&&(d=_),v!==void 0&&d!==void 0)break}return{top:s[v-1]||0,bottom:s[d]}};return l}var fo=function(){function e(){Qr(this,e),ee(this,"maps",void 0),ee(this,"id",0),this.maps=Object.create(null)}return Gr(e,[{key:"set",value:function(r,n){this.maps[r]=n,this.id+=1}},{key:"get",value:function(r){return this.maps[r]}}]),e}();function ho(e,t,r){var n=p.useState(0),o=X(n,2),a=o[0],i=o[1],s=h.useRef(new Map),l=h.useRef(new fo),u=h.useRef();function f(){de.cancel(u.current)}function m(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;f();var E=function(){s.current.forEach(function(S,F){if(S&&S.offsetParent){var b=ut(S),I=b.offsetHeight;l.current.get(F)!==I&&l.current.set(F,b.offsetHeight)}}),i(function(S){return S+1})};d?E():u.current=de(E)}function v(d,E){var _=e(d);s.current.get(_),E?(s.current.set(_,E),m()):s.current.delete(_)}return h.useEffect(function(){return f},[]),[v,m,l.current,a]}var yr=14/15;function mo(e,t,r){var n=h.useRef(!1),o=h.useRef(0),a=h.useRef(0),i=h.useRef(null),s=h.useRef(null),l,u=function(d){if(n.current){var E=Math.ceil(d.touches[0].pageX),_=Math.ceil(d.touches[0].pageY),S=o.current-E,F=a.current-_,b=Math.abs(S)>Math.abs(F);b?o.current=E:a.current=_,r(b,b?S:F)&&d.preventDefault(),clearInterval(s.current),s.current=setInterval(function(){b?S*=yr:F*=yr;var I=Math.floor(b?S:F);(!r(b,I,!0)||Math.abs(I)<=.1)&&clearInterval(s.current)},16)}},f=function(){n.current=!1,l()},m=function(d){l(),d.touches.length===1&&!n.current&&(n.current=!0,o.current=Math.ceil(d.touches[0].pageX),a.current=Math.ceil(d.touches[0].pageY),i.current=d.target,i.current.addEventListener("touchmove",u),i.current.addEventListener("touchend",f))};l=function(){i.current&&(i.current.removeEventListener("touchmove",u),i.current.removeEventListener("touchend",f))},qe(function(){return e&&t.current.addEventListener("touchstart",m),function(){var v;(v=t.current)===null||v===void 0||v.removeEventListener("touchstart",m),l(),clearInterval(s.current)}},[e])}var po=10;function vo(e,t,r,n,o,a,i,s){var l=p.useRef(),u=p.useState(null),f=X(u,2),m=f[0],v=f[1];return qe(function(){if(m&&m.times<po){if(!e.current){v(function(Z){return K({},Z)});return}a();var d=m.targetAlign,E=m.originAlign,_=m.index,S=m.offset,F=e.current.clientHeight,b=!1,I=d,T=null;if(F){for(var W=d||E,$=0,C=0,U=0,x=Math.min(t.length-1,_),k=0;k<=x;k+=1){var te=o(t[k]);C=$;var q=r.get(te);U=C+(q===void 0?n:q),$=U}for(var ie=W==="top"?S:F-S,Y=x;Y>=0;Y-=1){var Ie=o(t[Y]),re=r.get(Ie);if(re===void 0){b=!0;break}if(ie-=re,ie<=0)break}switch(W){case"top":T=C-S;break;case"bottom":T=U-F+S;break;default:{var Oe=e.current.scrollTop,fe=Oe+F;C<Oe?I="top":U>fe&&(I="bottom")}}T!==null&&i(T),T!==m.lastTop&&(b=!0)}b&&v(K(K({},m),{},{times:m.times+1,targetAlign:I,lastTop:T}))}},[m,e.current]),function(d){if(d==null){s();return}if(de.cancel(l.current),typeof d=="number")i(d);else if(d&&ue(d)==="object"){var E,_=d.align;"index"in d?E=d.index:E=t.findIndex(function(b){return o(b)===d.key});var S=d.offset,F=S===void 0?0:S;v({times:0,index:E,offset:F,originAlign:_})}}}function Fr(e,t){var r="touches"in e?e.touches[0]:e;return r[t?"pageX":"pageY"]}var Or=p.forwardRef(function(e,t){var r=e.prefixCls,n=e.rtl,o=e.scrollOffset,a=e.scrollRange,i=e.onStartMove,s=e.onStopMove,l=e.onScroll,u=e.horizontal,f=e.spinSize,m=e.containerSize,v=e.style,d=e.thumbStyle,E=p.useState(!1),_=X(E,2),S=_[0],F=_[1],b=p.useState(null),I=X(b,2),T=I[0],W=I[1],$=p.useState(null),C=X($,2),U=C[0],x=C[1],k=!n,te=p.useRef(),q=p.useRef(),ie=p.useState(!1),Y=X(ie,2),Ie=Y[0],re=Y[1],Oe=p.useRef(),fe=function(){clearTimeout(Oe.current),re(!0),Oe.current=setTimeout(function(){re(!1)},3e3)},Z=a-m||0,Ue=m-f||0,B=p.useMemo(function(){if(o===0||Z===0)return 0;var ne=o/Z;return ne*Ue},[o,Z,Ue]),Re=function(H){H.stopPropagation(),H.preventDefault()},Pe=p.useRef({top:B,dragging:S,pageY:T,startTop:U});Pe.current={top:B,dragging:S,pageY:T,startTop:U};var Ne=function(H){F(!0),W(Fr(H,u)),x(Pe.current.top),i(),H.stopPropagation(),H.preventDefault()};p.useEffect(function(){var ne=function(Me){Me.preventDefault()},H=te.current,se=q.current;return H.addEventListener("touchstart",ne),se.addEventListener("touchstart",Ne),function(){H.removeEventListener("touchstart",ne),se.removeEventListener("touchstart",Ne)}},[]);var Ze=p.useRef();Ze.current=Z;var He=p.useRef();He.current=Ue,p.useEffect(function(){if(S){var ne,H=function(Me){var xe=Pe.current,et=xe.dragging,tt=xe.pageY,rt=xe.startTop;if(de.cancel(ne),et){var nt=Fr(Me,u)-tt,Se=rt;!k&&u?Se-=nt:Se+=nt;var Be=Ze.current,it=He.current,Mt=it?Se/it:0,Ce=Math.ceil(Mt*Be);Ce=Math.max(Ce,0),Ce=Math.min(Ce,Be),ne=de(function(){l(Ce,u)})}},se=function(){F(!1),s()};return window.addEventListener("mousemove",H),window.addEventListener("touchmove",H),window.addEventListener("mouseup",se),window.addEventListener("touchend",se),function(){window.removeEventListener("mousemove",H),window.removeEventListener("touchmove",H),window.removeEventListener("mouseup",se),window.removeEventListener("touchend",se),de.cancel(ne)}}},[S]),p.useEffect(function(){fe()},[o]),p.useImperativeHandle(t,function(){return{delayHidden:fe}});var J="".concat(r,"-scrollbar"),oe={position:"absolute",visibility:Ie?null:"hidden"},pe={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(oe.height=8,oe.left=0,oe.right=0,oe.bottom=0,pe.height="100%",pe.width=f,k?pe.left=B:pe.right=B):(oe.width=8,oe.top=0,oe.bottom=0,k?oe.right=0:oe.left=0,pe.width="100%",pe.height=f,pe.top=B),p.createElement("div",{ref:te,className:pt(J,ee(ee(ee({},"".concat(J,"-horizontal"),u),"".concat(J,"-vertical"),!u),"".concat(J,"-visible"),Ie)),style:K(K({},oe),v),onMouseDown:Re,onMouseMove:fe},p.createElement("div",{ref:q,className:pt("".concat(J,"-thumb"),ee({},"".concat(J,"-thumb-moving"),S)),style:K(K({},pe),d),onMouseDown:Ne}))}),go=20;function Rr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=e/t*e;return isNaN(r)&&(r=0),r=Math.max(r,go),Math.floor(r)}var _o=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles"],So=[],Eo={overflowY:"auto",overflowAnchor:"none"};function bo(e,t){var r=e.prefixCls,n=r===void 0?"rc-virtual-list":r,o=e.className,a=e.height,i=e.itemHeight,s=e.fullHeight,l=s===void 0?!0:s,u=e.style,f=e.data,m=e.children,v=e.itemKey,d=e.virtual,E=e.direction,_=e.scrollWidth,S=e.component,F=S===void 0?"div":S,b=e.onScroll,I=e.onVirtualScroll,T=e.onVisibleChange,W=e.innerProps,$=e.extraRender,C=e.styles,U=pi(e,_o),x=p.useCallback(function(O){return typeof v=="function"?v(O):O==null?void 0:O[v]},[v]),k=ho(x),te=X(k,4),q=te[0],ie=te[1],Y=te[2],Ie=te[3],re=!!(d!==!1&&a&&i),Oe=p.useMemo(function(){return Object.values(Y.maps).reduce(function(O,y){return O+y},0)},[Y.id,Y.maps]),fe=re&&f&&(Math.max(i*f.length,Oe)>a||!!_),Z=E==="rtl",Ue=pt(n,ee({},"".concat(n,"-rtl"),Z),o),B=f||So,Re=h.useRef(),Pe=h.useRef(),Ne=h.useRef(),Ze=h.useState(0),He=X(Ze,2),J=He[0],oe=He[1],pe=h.useState(0),ne=X(pe,2),H=ne[0],se=ne[1],Je=h.useState(!1),Me=X(Je,2),xe=Me[0],et=Me[1],tt=function(){et(!0)},rt=function(){et(!1)},nt={getKey:x};function Se(O){oe(function(y){var w;typeof O=="function"?w=O(y):w=O;var V=cn(w);return Re.current.scrollTop=V,V})}var Be=h.useRef({start:0,end:B.length}),it=h.useRef(),Mt=lo(B,x),Ce=X(Mt,1),nn=Ce[0];it.current=nn;var ot=p.useMemo(function(){if(!re)return{scrollHeight:void 0,start:0,end:B.length-1,offset:void 0};if(!fe){var O;return{scrollHeight:((O=Pe.current)===null||O===void 0?void 0:O.offsetHeight)||0,start:0,end:B.length-1,offset:void 0}}for(var y=0,w,V,Ee,_n=B.length,Ve=0;Ve<_n;Ve+=1){var Sn=B[Ve],En=x(Sn),hr=Y.get(En),Ht=y+(hr===void 0?i:hr);Ht>=J&&w===void 0&&(w=Ve,V=y),Ht>J+a&&Ee===void 0&&(Ee=Ve),y=Ht}return w===void 0&&(w=0,V=0,Ee=Math.ceil(a/i)),Ee===void 0&&(Ee=B.length-1),Ee=Math.min(Ee+1,B.length-1),{scrollHeight:y,start:w,end:Ee,offset:V}},[fe,re,J,B,Ie,a]),we=ot.scrollHeight,je=ot.start,We=ot.end,Zt=ot.offset;Be.current.start=je,Be.current.end=We;var on=p.useState({width:0,height:a}),Jt=X(on,2),ve=Jt[0],sn=Jt[1],an=function(y){sn({width:y.width||y.offsetWidth,height:y.height||y.offsetHeight})},er=h.useRef(),tr=h.useRef(),ln=p.useMemo(function(){return Rr(ve.width,_)},[ve.width,_]),un=p.useMemo(function(){return Rr(ve.height,we)},[ve.height,we]),wt=we-a,At=h.useRef(wt);At.current=wt;function cn(O){var y=O;return Number.isNaN(At.current)||(y=Math.min(y,At.current)),y=Math.max(y,0),y}var rr=J<=0,nr=J>=wt,ir=H<=0,or=H>=_,fn=Jr(rr,nr,ir,or),Lt=function(){return{x:Z?-H:H,y:J}},Dt=h.useRef(Lt()),st=_r(function(O){if(I){var y=K(K({},Lt()),O);(Dt.current.x!==y.x||Dt.current.y!==y.y)&&(I(y),Dt.current=y)}});function sr(O,y){var w=O;y?(ft.flushSync(function(){se(w)}),st()):Se(w)}function hn(O){var y=O.currentTarget.scrollTop;y!==J&&Se(y),b==null||b(O),st()}var $t=function(y){var w=y,V=_?_-ve.width:0;return w=Math.max(w,0),w=Math.min(w,V),w},dn=_r(function(O,y){y?(ft.flushSync(function(){se(function(w){var V=w+(Z?-O:O);return $t(V)})}),st()):Se(function(w){var V=w+O;return V})}),mn=uo(re,rr,nr,ir,or,!!_,dn),ar=X(mn,2),Ut=ar[0],lr=ar[1];mo(re,Re,function(O,y,w){return fn(O,y,w)?!1:(Ut({preventDefault:function(){},deltaX:O?y:0,deltaY:O?0:y}),!0)}),qe(function(){function O(w){re&&w.preventDefault()}var y=Re.current;return y.addEventListener("wheel",Ut),y.addEventListener("DOMMouseScroll",lr),y.addEventListener("MozMousePixelScroll",O),function(){y.removeEventListener("wheel",Ut),y.removeEventListener("DOMMouseScroll",lr),y.removeEventListener("MozMousePixelScroll",O)}},[re]),qe(function(){if(_){var O=$t(H);se(O),st({x:O})}},[ve.width,_]);var ur=function(){var y,w;(y=er.current)===null||y===void 0||y.delayHidden(),(w=tr.current)===null||w===void 0||w.delayHidden()},cr=vo(Re,B,Y,i,x,function(){return ie(!0)},Se,ur);p.useImperativeHandle(t,function(){return{nativeElement:Ne.current,getScrollInfo:Lt,scrollTo:function(y){function w(V){return V&&ue(V)==="object"&&("left"in V||"top"in V)}w(y)?(y.left!==void 0&&se($t(y.left)),cr(y.top)):cr(y)}}}),qe(function(){if(T){var O=B.slice(je,We+1);T(O,B)}},[je,We,B]);var pn=co(B,x,Y,i),vn=$==null?void 0:$({start:je,end:We,virtual:fe,offsetX:H,offsetY:Zt,rtl:Z,getSize:pn}),gn=so(B,je,We,_,H,q,m,nt),ke=null;a&&(ke=K(ee({},l?"height":"maxHeight",a),Eo),re&&(ke.overflowY="hidden",_&&(ke.overflowX="hidden"),xe&&(ke.pointerEvents="none")));var fr={};return Z&&(fr.dir="rtl"),p.createElement("div",Ke({ref:Ne,style:K(K({},u),{},{position:"relative"}),className:Ue},fr,U),p.createElement(Xt,{onResize:an},p.createElement(F,{className:"".concat(n,"-holder"),style:ke,ref:Re,onScroll:hn,onMouseEnter:ur},p.createElement(Yr,{prefixCls:n,height:we,offsetX:H,offsetY:Zt,scrollWidth:_,onInnerResize:ie,ref:Pe,innerProps:W,rtl:Z,extra:vn},gn))),fe&&we>a&&p.createElement(Or,{ref:er,prefixCls:n,scrollOffset:J,scrollRange:we,rtl:Z,onScroll:sr,onStartMove:tt,onStopMove:rt,spinSize:un,containerSize:ve.height,style:C==null?void 0:C.verticalScrollBar,thumbStyle:C==null?void 0:C.verticalScrollBarThumb}),fe&&_>ve.width&&p.createElement(Or,{ref:tr,prefixCls:n,scrollOffset:H,scrollRange:_,rtl:Z,onScroll:sr,onStartMove:tt,onStopMove:rt,spinSize:ln,containerSize:ve.width,horizontal:!0,style:C==null?void 0:C.horizontalScrollBar,thumbStyle:C==null?void 0:C.horizontalScrollBarThumb}))}var en=p.forwardRef(bo);en.displayName="List";function yo(e){const{model:t}=e,r=ze.useDependency(g.LocaleService),n=D.useObservable(t.searchString$,"",!0),o=D.useObservable(t.filterItems$,void 0,!0),a=r.t("sheets-filter.panel.filter-only"),i=Bt(o),s=i.checked>0&&i.unchecked===0,l=i.checked>0&&i.unchecked>0,u=h.useCallback((d,E)=>{t.onFilterCheckToggled(d,E)},[t]),f=h.useCallback(d=>{t.onFilterOnly(d)},[t]),m=h.useCallback(()=>{t.onCheckAllToggled(!s)},[t,s]),v=h.useCallback(d=>{t.setSearchString(d)},[t]);return h.createElement("div",{className:j.sheetsFilterPanelValuesContainer},h.createElement(G.Input,{value:n,placeholder:r.t("sheets-filter.panel.search-placeholder"),onChange:v}),h.createElement("div",{className:j.sheetsFilterPanelValuesList},h.createElement("div",{className:j.sheetsFilterPanelValuesItem},h.createElement("div",{className:j.sheetsFilterPanelValuesItemInner},h.createElement(G.Checkbox,{indeterminate:l,disabled:o.length===0,checked:s,onChange:m}),h.createElement("span",{className:j.sheetsFilterPanelValuesItemText},`${r.t("sheets-filter.panel.select-all")}`),h.createElement("span",{className:j.sheetsFilterPanelValuesItemCount},`(${i.checked}/${i.checked+i.unchecked})`))),h.createElement("div",{className:j.sheetsFilterPanelValuesVirtual},h.createElement(en,{style:{paddingRight:8},data:o,height:190,itemHeight:32,itemKey:d=>`${d.value}----${d.checked}`},d=>h.createElement("div",{className:j.sheetsFilterPanelValuesItem},h.createElement("div",{className:j.sheetsFilterPanelValuesItemInner},h.createElement(G.Checkbox,{checked:d.checked,onChange:()=>u(d,!d.checked)}),h.createElement(G.Tooltip,{showIfEllipsis:!0,placement:"top",title:d.value},h.createElement("span",{className:j.sheetsFilterPanelValuesItemText},d.value)),h.createElement("span",{className:j.sheetsFilterPanelValuesItemCount},`(${d.count})`),h.createElement(G.Button,{className:j.sheetsFilterPanelValuesItemExcludeButton,size:"small",type:"link",onClick:()=>f(d)},a)))))))}function Fo(){const e=ze.useDependency(Fe),t=ze.useDependency(g.LocaleService),r=ze.useDependency(g.ICommandService),n=D.useObservable(e.filterBy$,void 0,!0),o=D.useObservable(e.filterByModel$,void 0,!1),a=D.useObservable(()=>(o==null?void 0:o.canApply$)||N.of(!1),void 0,!1,[o]),i=Oo(t),s=!D.useObservable(e.hasCriteria$),l=h.useCallback(v=>{r.executeCommand(Dr.id,{filterBy:v})},[r]),u=h.useCallback(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Qe.id)},[o,r]),f=h.useCallback(()=>{r.executeCommand(Qe.id)},[r]),m=h.useCallback(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Qe.id)},[o,r]);return h.createElement("div",{className:j.sheetsFilterPanel},h.createElement("div",{className:j.sheetsFilterPanelHeader},h.createElement(G.Segmented,{value:n,options:i,onChange:v=>l(v)})),o?h.createElement("div",{className:j.sheetsFilterPanelContent},n===ht.VALUES?h.createElement(yo,{model:o}):h.createElement(si,{model:o})):null,h.createElement("div",{className:j.sheetsFilterPanelFooter},h.createElement(G.Button,{type:"link",onClick:u,disabled:s},t.t("sheets-filter.panel.clear-filter")),h.createElement("span",{className:j.sheetsFilterPanelFooterPrimaryButtons},h.createElement(G.Button,{type:"default",onClick:f},t.t("sheets-filter.panel.cancel")),h.createElement(G.Button,{disabled:!a,type:"primary",onClick:m},t.t("sheets-filter.panel.confirm")))))}function Oo(e){const t=e.getCurrentLocale();return h.useMemo(()=>[{label:e.t("sheets-filter.panel.by-values"),value:ht.VALUES},{label:e.t("sheets-filter.panel.by-conditions"),value:ht.CONDITIONS}],[t,e])}const Ro={id:Te.id,binding:D.KeyCode.L|D.MetaKeys.CTRL_COMMAND|D.MetaKeys.SHIFT,description:"sheets-filter.shortcut.smart-toggle-filter",preconditions:me.whenSheetEditorFocused,group:"4_sheet-edit"};function Co(e){const t=e.get(c.SheetsFilterService);return{id:Te.id,group:D.MenuGroup.TOOLBAR_FORMULAS_INSERT,type:D.MenuItemType.BUTTON_SELECTOR,icon:"FilterSingle",tooltip:"sheets-filter.toolbar.smart-toggle-filter-tooltip",positions:[D.MenuPosition.TOOLBAR_START],hidden$:D.getMenuHiddenObservable(e,g.UniverInstanceType.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(N.map(r=>!!r)),disabled$:me.getCurrentRangeDisable$(e,{workbookTypes:[Q.WorkbookEditablePermission],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission],rangeTypes:[Q.RangeProtectionPermissionEditPoint]})}}function To(e){const t=e.get(c.SheetsFilterService);return{id:wr.id,group:D.MenuGroup.TOOLBAR_OTHERS,type:D.MenuItemType.BUTTON,title:"sheets-filter.toolbar.clear-filter-criteria",positions:[Te.id],hidden$:D.getMenuHiddenObservable(e,g.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}function Io(e){const t=e.get(c.SheetsFilterService);return{id:Ar.id,group:D.MenuGroup.TOOLBAR_OTHERS,type:D.MenuItemType.BUTTON,title:"sheets-filter.toolbar.re-calc-filter-conditions",positions:[Te.id],hidden$:D.getMenuHiddenObservable(e,g.UniverInstanceType.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(N.switchMap(r=>{var n;return(n=r==null?void 0:r.hasCriteria$.pipe(N.map(o=>!o)))!=null?n:N.of(!0)}))}}const be=16,Po=new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");class Cr{static drawNoCriteria(t,r,n,o){t.save(),Xe.Rect.drawWith(t,{radius:2,width:be,height:be,fill:o}),t.lineCap="square",t.strokeStyle=n,t.scale(r/be,r/be),t.beginPath(),t.lineWidth=1,t.lineCap="round",t.moveTo(3,4),t.lineTo(13,4),t.moveTo(4.5,8),t.lineTo(11.5,8),t.moveTo(6,12),t.lineTo(10,12),t.stroke(),t.restore()}static drawHasCriteria(t,r,n,o){t.save(),Xe.Rect.drawWith(t,{radius:2,width:be,height:be,fill:o}),t.scale(r/be,r/be),t.fillStyle=n,t.fill(Po),t.restore()}}var No=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,wo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Mo(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&No(t,r,o),o},xt=(e,t)=>(r,n)=>t(r,n,e);const _e=16,at=1;let zt=class extends Xe.Shape{constructor(t,r,n,o,a){super(t,r);M(this,"_cellWidth",0);M(this,"_cellHeight",0);M(this,"_filterParams");M(this,"_hovered",!1);this._contextService=n,this._commandService=o,this._themeService=a,this.setShapeProps(r),this.onPointerDownObserver.add(i=>this.onPointerDown(i)),this.onPointerEnterObserver.add(()=>this.onPointerEnter()),this.onPointerLeaveObserver.add(()=>this.onPointerLeave())}setShapeProps(t){typeof t.cellHeight<"u"&&(this._cellHeight=t.cellHeight),typeof t.cellWidth<"u"&&(this._cellWidth=t.cellWidth),typeof t.filterParams<"u"&&(this._filterParams=t.filterParams),this.transformByState({width:t.width,height:t.height})}_draw(t){const r=this._cellHeight,n=this._cellWidth,o=_e-n,a=_e-r;t.save();const i=new Path2D;i.rect(o,a,n,r),t.clip(i);const{hasCriteria:s}=this._filterParams,l=this._themeService.getCurrentTheme().primaryColor,u=this._hovered?this._themeService.getCurrentTheme().grey50:"rgba(255, 255, 255, 1.0)";s?Cr.drawHasCriteria(t,_e,l,u):Cr.drawNoCriteria(t,_e,l,u),t.restore()}onPointerDown(t){if(t.button===2)return;const{col:r,unitId:n,subUnitId:o}=this._filterParams;this._contextService.getContextValue(De)||setTimeout(()=>{this._commandService.executeCommand(St.id,{unitId:n,subUnitId:o,col:r})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};zt=wo([xt(2,g.IContextService),xt(3,g.ICommandService),xt(4,L.Inject(g.ThemeService))],zt);var Ao=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Do=(e,t,r,n)=>{for(var o=n>1?void 0:n?Lo(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Ao(t,r,o),o},ge=(e,t)=>(r,n)=>t(r,n,e);const $o=1e3,Uo=5e3;let Qt=class extends g.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,f){super();M(this,"_filterRangeShape",null);M(this,"_buttonRenderDisposable",null);M(this,"_filterButtonShapes",[]);this._context=t,this._injector=r,this._sheetSkeletonManagerService=n,this._sheetsFilterService=o,this._themeService=a,this._sheetInterceptorService=i,this._sheetsRenderService=s,this._commandService=l,this._renderManagerService=u,this._selectionRenderService=f,[c.SetSheetsFilterRangeMutation,c.SetSheetsFilterCriteriaMutation,c.RemoveSheetsFilterMutation,c.ReCalcSheetsFilterMutation].forEach(m=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(m.id))),this._initRenderer()}_initRenderer(){N.combineLatest([this._selectionRenderService.usable$,this._sheetSkeletonManagerService.currentSkeleton$]).pipe(N.filter(([t])=>t),N.switchMap(([t,r])=>{var l;if(!r)return N.of(null);const{unit:n,unitId:o}=this._context,a=n.getActiveSheet().getSheetId(),i=(l=this._sheetsFilterService.getFilterModel(o,a))!=null?l:void 0,s=()=>({unitId:o,worksheetId:a,filterModel:i,range:i==null?void 0:i.getRange(),skeleton:r.skeleton});return g.fromCallback(this._commandService.onCommandExecuted).pipe(N.filter(([u])=>u.type===g.CommandType.MUTATION&&u.params.unitId===n.getUnitId()&&c.FILTER_MUTATIONS.has(u.id)),N.throttleTime(20,void 0,{leading:!1,trailing:!0}),N.map(s),N.startWith(s()))}),N.takeUntil(this.dispose$)).subscribe(t=>{this._disposeRendering(),!(!t||!t.range)&&(this._renderRange(t.unitId,t.range,t.skeleton),this._renderButtons(t))})}_renderRange(t,r,n){const o=this._renderManagerService.getRenderById(t);if(!o)return;const{scene:a}=o,{rangeWithCoord:i,style:s}=this._selectionRenderService.attachSelectionWithCoord({range:r,primary:null,style:null}),{rowHeaderWidth:l,columnHeaderHeight:u}=n,f=this._filterRangeShape=new me.SelectionShape(a,$o,!0,this._themeService);f.update(i,l,u,{hasAutoFill:!1,fill:"rgba(0, 0, 0, 0.0)",...s}),f.setEvent(!1),a.makeDirty(!0)}_renderButtons(t){const{range:r,filterModel:n,unitId:o,skeleton:a,worksheetId:i}=t,s=this._renderManagerService.getRenderById(o);if(!s)return;const{scene:l}=s;this._interceptCellContent(t.range);const{startColumn:u,endColumn:f,startRow:m}=r;for(let v=u;v<=f;v++){const d=`sheets-filter-button-${v}`,E=me.getCoordByCell(m,v,l,a),{startX:_,startY:S,endX:F,endY:b}=E,I=F-_,T=b-S;if(T<=at||I<=at)continue;const W=!!n.getFilterColumn(v),$=F-_e-at,C=b-_e-at,U={left:$,top:C,height:_e,width:_e,zIndex:Uo,cellHeight:T,cellWidth:I,filterParams:{unitId:o,subUnitId:i,col:v,hasCriteria:W}},x=this._injector.createInstance(zt,d,U);this._filterButtonShapes.push(x)}l.addObjects(this._filterButtonShapes),l.makeDirty()}_interceptCellContent(t){const{startRow:r,startColumn:n,endColumn:o}=t;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(Q.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(a,i,s)=>{const{row:l,col:u}=i;return l!==r||u<n||u>o?s(a):s({...a,fontRenderExtension:{...a==null?void 0:a.fontRenderExtension,rightOffset:_e}})},priority:10})}_disposeRendering(){var t,r;(t=this._filterRangeShape)==null||t.dispose(),this._filterButtonShapes.forEach(n=>n.dispose()),(r=this._buttonRenderDisposable)==null||r.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};Qt=Do([ge(1,L.Inject(L.Injector)),ge(2,L.Inject(me.SheetSkeletonManagerService)),ge(3,L.Inject(c.SheetsFilterService)),ge(4,L.Inject(g.ThemeService)),ge(5,L.Inject(Q.SheetInterceptorService)),ge(6,L.Inject(me.SheetsRenderService)),ge(7,g.ICommandService),ge(8,Xe.IRenderManagerService),ge(9,me.ISelectionRenderService)],Qt);var Ho=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,Bo=(e,t,r,n)=>{for(var o=n>1?void 0:n?xo(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Ho(t,r,o),o},ae=(e,t)=>(r,n)=>t(r,n,e);const jo={},Tr="FILTER_PANEL_POPUP";let Ye=class extends g.RxDisposable{constructor(t,r,n,o,a,i,s,l,u,f,m,v,d){super();M(this,"_popupDisposable");this._config=t,this._injector=r,this._componentManager=n,this._sheetsFilterPanelService=o,this._sheetCanvasPopupService=a,this._sheetsFilterService=i,this._localeService=s,this._renderManagerService=l,this._shortcutService=u,this._commandService=f,this._menuService=m,this._contextService=v,this._messageService=d,this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI(),this._initRenderControllers()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[Ro].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_initCommands(){[Te,Le,wr,Ar,Dr,St,Qe].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initMenuItems(){const{menu:t={}}=this._config;[Co,To,Io].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r),t))})}_initUI(){this.disposeWithMe(this._componentManager.register(Tr,Fo)),this.disposeWithMe(this._componentManager.register("FilterSingle",Mr)),this.disposeWithMe(this._contextService.subscribeContextValue$(De).pipe(N.distinctUntilChanged()).subscribe(t=>{t?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(t=>{t&&this._messageService.show({type:G.MessageType.Error,content:this._localeService.t(t)})}))}_initRenderControllers(){this.disposeWithMe(this._renderManagerService.registerRenderController(g.UniverInstanceType.UNIVER_SHEET,Qt))}_openFilterPopup(){const t=this._sheetsFilterPanelService.filterModel;if(!t)throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");const r=t.getRange(),n=this._sheetsFilterPanelService.col,{startRow:o}=r;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(o,n,{componentKey:Tr,direction:"horizontal",closeOnSelfTarget:!0,onClickOutside:()=>this._commandService.syncExecuteCommand(Qe.id),offset:[5,0]})}_closeFilterPopup(){var t;(t=this._popupDisposable)==null||t.dispose(),this._popupDisposable=null}};Ye=Bo([g.OnLifecycle(g.LifecycleStages.Ready,Ye),ae(1,L.Inject(L.Injector)),ae(2,L.Inject(D.ComponentManager)),ae(3,L.Inject(Fe)),ae(4,L.Inject(me.SheetCanvasPopManagerService)),ae(5,L.Inject(c.SheetsFilterService)),ae(6,L.Inject(g.LocaleService)),ae(7,Xe.IRenderManagerService),ae(8,D.IShortcutService),ae(9,g.ICommandService),ae(10,D.IMenuService),ae(11,g.IContextService),ae(12,D.IMessageService)],Ye);var Wo=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Vo=(e,t,r,n)=>{for(var o=n>1?void 0:n?ko(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Wo(t,r,o),o},lt=(e,t)=>(r,n)=>t(r,n,e);let ct=class extends g.Disposable{constructor(e,t,r,n){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=r,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{var t;if(e.id===Te.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithoutRange({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionViewPoint],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr"))),e.id===St.id){const r=e.params,{unitId:n,subUnitId:o}=r,a=(t=this._sheetsFilterService.getFilterModel(n,o))==null?void 0:t.getRange(),i=g.Tools.deepClone(a);i&&(i.startColumn=r.col,i.endColumn=r.col,this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[Q.WorkbookEditablePermission],rangeTypes:[Q.RangeProtectionPermissionViewPoint],worksheetTypes:[Q.WorksheetFilterPermission,Q.WorksheetEditPermission]},[i])||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.filterErr")))}}))}};ct=Vo([g.OnLifecycle(g.LifecycleStages.Ready,ct),lt(0,L.Inject(c.SheetsFilterService)),lt(1,L.Inject(g.LocaleService)),lt(2,g.ICommandService),lt(3,L.Inject(me.SheetPermissionInterceptorBaseController))],ct);var tn=Object.defineProperty,zo=Object.getOwnPropertyDescriptor,Qo=(e,t,r)=>t in e?tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Go=(e,t,r,n)=>{for(var o=n>1?void 0:n?zo(t,r):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&tn(t,r,o),o},Ir=(e,t)=>(r,n)=>t(r,n,e),rn=(e,t,r)=>(Qo(e,typeof t!="symbol"?t+"":t,r),r);const qo="SHEET_FILTER_UI_PLUGIN";exports.UniverSheetsFilterUIPlugin=class extends g.Plugin{constructor(t={},r,n){super(),this._config=t,this._injector=r,this._localeService=n,this._config=g.Tools.deepMerge({},jo,this._config)}onStarting(t){[[Fe],[ct],[Ye,{useFactory:()=>this._injector.createInstance(Ye,this._config)}]].forEach(r=>t.add(r))}};rn(exports.UniverSheetsFilterUIPlugin,"type",g.UniverInstanceType.UNIVER_SHEET);rn(exports.UniverSheetsFilterUIPlugin,"pluginName",qo);exports.UniverSheetsFilterUIPlugin=Go([g.DependentOn(c.UniverSheetsFilterPlugin),Ir(1,L.Inject(L.Injector)),Ir(2,L.Inject(g.LocaleService))],exports.UniverSheetsFilterUIPlugin);const Yo={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"筛选","clear-filter-criteria":"清除筛选条件","re-calc-filter-conditions":"重新计算"},command:{"not-valid-filter-range":"选中的区域只有一行,无法进行筛选"},shortcut:{"smart-toggle-filter":"切换筛选"},panel:{"clear-filter":"清除筛选",cancel:"取消",confirm:"确认","by-values":"按值","by-conditions":"按条件","filter-only":"仅筛选","search-placeholder":"使用空格分隔关键字","select-all":"全选","input-values-placeholder":"请输入",or:"或",and:"和",empty:"(空白)","?":"可用 ? 代表单个字符","*":"可用 * 代表任意多个字符"},conditions:{none:"无",empty:"为空","not-empty":"不为空","text-contains":"文本包含","does-not-contain":"文本不包含","starts-with":"文本开头","ends-with":"文本结尾",equals:"文本相符","greater-than":"大于","greater-than-or-equal":"大于等于","less-than":"小于","less-than-or-equal":"小于等于",equal:"等于","not-equal":"不等于",between:"介于","not-between":"不介于",custom:"自定义"},msg:{"filter-header-forbidden":"无法移动筛选行头"}}},Xo=Object.freeze(Object.defineProperty({__proto__:null,default:Yo},Symbol.toStringTag,{value:"Module"})),Ko={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Toggle Filter","clear-filter-criteria":"Clear Filter Conditions","re-calc-filter-conditions":"Re-calc Filter Conditions"},command:{"not-valid-filter-range":"The selected range only has one row and not valid for filter."},shortcut:{"smart-toggle-filter":"Toggle Filter"},panel:{"clear-filter":"Clear Filter",cancel:"Cancel",confirm:"Confirm","by-values":"By Values","by-conditions":"By Conditions","filter-only":"Filter Only","search-placeholder":"Use space to separate keywords","select-all":"Select All","input-values-placeholder":"Input Values",and:"AND",or:"OR",empty:"(empty)","?":"Use “?” to represent a single character.","*":"Use “*” to represent multiple characters."},conditions:{none:"None",empty:"Is Empty","not-empty":"Is Not Empty","text-contains":"Text Contains","does-not-contain":"Text Does Not Contain","starts-with":"Text Starts With","ends-with":"Text Ends With",equals:"Text Equals","greater-than":"Greater Than","greater-than-or-equal":"Greater Than Or Equal To","less-than":"Less Than","less-than-or-equal":"Less Than Or Equal To",equal:"Equal","not-equal":"Not Equal",between:"Between","not-between":"Not Between",custom:"Custom"},msg:{"filter-header-forbidden":"You can't move the header row of a filter."}}},Zo=Object.freeze(Object.defineProperty({__proto__:null,default:Ko},Symbol.toStringTag,{value:"Module"})),Jo={"sheets-filter":{toolbar:{"smart-toggle-filter-tooltip":"Переключить фильтр","clear-filter-criteria":"Очистить условия фильтра","re-calc-filter-conditions":"Пересчитать условия фильтра"},command:{"not-valid-filter-range":"Выбранный диапазон содержит только одну строку и не подходит для фильтра."},shortcut:{"smart-toggle-filter":"Переключить фильтр"},panel:{"clear-filter":"Очистить фильтр",cancel:"Отмена",confirm:"Подтвердить","by-values":"По значениям","by-conditions":"По условиям","filter-only":"Только фильтр","search-placeholder":"Используйте пробел для разделения ключевых слов","select-all":"Выбрать все","input-values-placeholder":"Введите значения",and:"И",or:"ИЛИ",empty:"(пусто)","?":"Используйте “?” для обозначения одного символа.","*":"Используйте “*” для обозначения нескольких символов."},conditions:{none:"Нет",empty:"Пусто","not-empty":"Не пусто","text-contains":"Содержит текст","does-not-contain":"Не содержит текст","starts-with":"Начинается с","ends-with":"Заканчивается на",equals:"Равно","greater-than":"Больше чем","greater-than-or-equal":"Больше или равно","less-than":"Меньше чем","less-than-or-equal":"Меньше или равно",equal:"Равно","not-equal":"Не равно",between:"Между","not-between":"Не между",custom:"Пользовательский"},msg:{"filter-header-forbidden":"Вы не можете переместить строку заголовка фильтра."}}},es=Object.freeze(Object.defineProperty({__proto__:null,default:Jo},Symbol.toStringTag,{value:"Module"}));exports.OpenFilterPanelOperation=St;exports.SmartToggleSheetsFilterCommand=Te;exports.enUS=Zo;exports.ruRU=es;exports.zhCN=Xo;
|