@slickgrid-universal/vanilla-force-bundle 5.3.0 → 5.3.2

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.
@@ -1,5 +1,5 @@
1
1
  (function(ke,oe){typeof exports=="object"&&typeof module<"u"?oe(exports):typeof define=="function"&&define.amd?define(["exports"],oe):(ke=typeof globalThis<"u"?globalThis:ke||self,oe(ke.Slicker={}))})(this,function(ke){"use strict";var oe;(function(r){r.local="local",r.remote="remote"})(oe||(oe={}));class Zr{constructor(e){this.rxjs=e}addRxJsResource(e){this.rxjs=e}executeBackendProcessesCallback(e,t,i,s){const n=new Date;t&&i.service.postProcess&&i.service.postProcess(t),t&&(i!=null&&i.internalPostProcess)&&i.internalPostProcess(t),i.postProcess!==void 0&&(t instanceof Object&&(t.metrics={startTime:e,endTime:n,executionTime:n.valueOf()-e.valueOf(),itemCount:s,totalItemCount:s}),i.postProcess(t))}onBackendError(e,t){if(typeof(t==null?void 0:t.onError)=="function")t.onError(e);else throw e}executeBackendCallback(e,t,i,s,n,o){var l;if(e){i&&!i.clearFilterTriggered&&!i.clearSortTriggered&&(o!=null&&o.emitActionChangedCallback)&&o.emitActionChangedCallback.call(this,oe.remote);const a=e.process(t);if(a instanceof Promise&&a.then)a.then(h=>{var d;this.executeBackendProcessesCallback(s,h,e,n),(d=o==null?void 0:o.successCallback)==null||d.call(this,i)}).catch(h=>{var d;(d=o==null?void 0:o.errorCallback)==null||d.call(this,i),this.onBackendError(h,e)});else if((l=this.rxjs)!=null&&l.isObservable(a)){const h=this.rxjs;h.isObservable(o==null?void 0:o.httpCancelRequestSubject)&&(o==null||o.httpCancelRequestSubject.next()),a.pipe(h.takeUntil(h.iif(()=>h.isObservable(o==null?void 0:o.httpCancelRequestSubject),o==null?void 0:o.httpCancelRequestSubject,h.EMPTY))).subscribe(d=>{var c;this.executeBackendProcessesCallback(s,d,e,n),(c=o==null?void 0:o.successCallback)==null||c.call(this,i)},d=>{var c;(c=o==null?void 0:o.errorCallback)==null||c.call(this,i),this.onBackendError(d,e)})}}}refreshBackendDataset(e){var s;let t="";const i=e==null?void 0:e.backendServiceApi;if(!i||!i.service||!i.process)throw new Error('BackendServiceApi requires at least a "process" function and a "service" defined');if(i.service&&(t=i.service.buildQuery()),t&&t!==""){const n=new Date;i.preProcess&&i.preProcess();const o=((s=e==null?void 0:e.pagination)==null?void 0:s.totalItems)??0;this.executeBackendCallback(i,t,null,n,o)}}}const dh=Object.freeze(Object.defineProperty({__proto__:null,BackendUtilityService:Zr},Symbol.toStringTag,{value:"Module"}));function Pi(r,e){["pop","push","reverse","shift","unshift","splice","sort"].forEach(i=>{r[i]=(...s)=>{const n=Array.prototype[i].apply(r,s);return e.apply(r,[r,s]),n}})}function ls(r,e,t){let i=r[e];Object.defineProperty(r,e,{configurable:!0,get(){return i},set(s){i=s,t.apply(r,[s,r[e]])}})}const ch=Object.freeze(Object.defineProperty({__proto__:null,collectionObserver:Pi,propertyObserver:ls},Symbol.toStringTag,{value:"Module"})),uh=r=>r;function ph(r,e,t=uh,i=()=>{}){const s=r&&r.length?[{pointer:r,offset:0}]:[],n=[];let o;for(;s.length;)for(o=s.pop();o.offset<o.pointer.length;){const l=o.pointer[o.offset],a=i(l),h=e(l);n.push(t(l,o.node,a,o.nodeId)),o.offset+=1,h&&(s.push(o),o={pointer:h,offset:0,node:l,nodeId:a})}return n}class R{}R.locales={TEXT_ALL_SELECTED:"All Selected",TEXT_ALL_X_RECORDS_SELECTED:"All {{x}} records selected",TEXT_APPLY_MASS_UPDATE:"Apply Mass Update",TEXT_APPLY_TO_SELECTION:"Update Selection",TEXT_CANCEL:"Cancel",TEXT_CLEAR_ALL_FILTERS:"Clear all Filters",TEXT_CLEAR_ALL_GROUPING:"Clear all Grouping",TEXT_CLEAR_ALL_SORTING:"Clear all Sorting",TEXT_CLEAR_PINNING:"Unfreeze Columns/Rows",TEXT_CLONE:"Clone",TEXT_COLLAPSE_ALL_GROUPS:"Collapse all Groups",TEXT_CONTAINS:"Contains",TEXT_COLUMNS:"Columns",TEXT_COLUMN_RESIZE_BY_CONTENT:"Resize by Content",TEXT_COMMANDS:"Commands",TEXT_COPY:"Copy",TEXT_DROP_COLUMN_HEADER_TO_GROUP_BY:"Drop a column header here to group by the column",TEXT_EQUALS:"Equals",TEXT_EQUAL_TO:"Equal to",TEXT_ENDS_WITH:"Ends With",TEXT_ERROR_EDITABLE_GRID_REQUIRED:"Your grid must be editable in order to use the Composite Editor Modal.",TEXT_ERROR_ENABLE_CELL_NAVIGATION_REQUIRED:'Composite Editor requires the flag "enableCellNavigation" to be set to True in your Grid Options.',TEXT_ERROR_NO_CHANGES_DETECTED:"Sorry we could not detect any changes.",TEXT_ERROR_NO_EDITOR_FOUND:"We could not find any Editor in your Column Definition.",TEXT_ERROR_NO_RECORD_FOUND:"No records selected for edit or clone operation.",TEXT_ERROR_ROW_NOT_EDITABLE:"Current row is not editable.",TEXT_ERROR_ROW_SELECTION_REQUIRED:"You must select some rows before trying to apply new value(s).",TEXT_EXPAND_ALL_GROUPS:"Expand all Groups",TEXT_EXPORT_TO_CSV:"Export in CSV format",TEXT_EXPORT_TO_TEXT_FORMAT:"Export in Text format (Tab delimited)",TEXT_EXPORT_TO_EXCEL:"Export to Excel",TEXT_EXPORT_TO_TAB_DELIMITED:"Export in Text format (Tab delimited)",TEXT_FORCE_FIT_COLUMNS:"Force fit columns",TEXT_FILTER_SHORTCUTS:"Filter Shortcuts",TEXT_FREEZE_COLUMNS:"Freeze Columns",TEXT_GREATER_THAN:"Greater than",TEXT_GREATER_THAN_OR_EQUAL_TO:"Greater than or equal to",TEXT_GROUP_BY:"Group By",TEXT_HIDE_COLUMN:"Hide Column",TEXT_ITEMS:"items",TEXT_ITEMS_PER_PAGE:"items per page",TEXT_ITEMS_SELECTED:"items selected",TEXT_OF:"of",TEXT_OK:"OK",TEXT_LAST_UPDATE:"Last Update",TEXT_LESS_THAN:"Less than",TEXT_LESS_THAN_OR_EQUAL_TO:"Less than or equal to",TEXT_NOT_CONTAINS:"Not contains",TEXT_NOT_EQUAL_TO:"Not equal to",TEXT_PAGE:"Page",TEXT_RECORDS_SELECTED:"records selected",TEXT_REFRESH_DATASET:"Refresh Dataset",TEXT_REMOVE_FILTER:"Remove Filter",TEXT_REMOVE_SORT:"Remove Sort",TEXT_RESET_INPUT_VALUE:"Reset Input Value",TEXT_RESET_FORM:"Reset Form",TEXT_SAVE:"Save",TEXT_SELECT_ALL:"Select All",TEXT_SYNCHRONOUS_RESIZE:"Synchronous resize",TEXT_SORT_ASCENDING:"Sort Ascending",TEXT_SORT_DESCENDING:"Sort Descending",TEXT_STARTS_WITH:"Starts With",TEXT_TOGGLE_ALL_GROUPS:"Toggle all Groups",TEXT_TOGGLE_DARK_MODE:"Toggle Dark Mode",TEXT_TOGGLE_FILTER_ROW:"Toggle Filter Row",TEXT_TOGGLE_PRE_HEADER_ROW:"Toggle Pre-Header Row",TEXT_UNFREEZE_COLUMNS:"Unfreeze Columns",TEXT_X_OF_Y_SELECTED:"# of % selected",TEXT_X_OF_Y_MASS_SELECTED:"{{x}} of {{y}} selected"},R.treeDataProperties={CHILDREN_PROP:"children",COLLAPSED_PROP:"__collapsed",HAS_CHILDREN_PROP:"__hasChildren",TREE_LEVEL_PROP:"__treeLevel",PARENT_PROP:"__parentId"},R.DEFAULT_FORMATTER_NUMBER_MIN_DECIMAL=2,R.DEFAULT_FORMATTER_NUMBER_MAX_DECIMAL=2,R.DEFAULT_FORMATTER_CURRENCY_MIN_DECIMAL=2,R.DEFAULT_FORMATTER_CURRENCY_MAX_DECIMAL=4,R.DEFAULT_FORMATTER_PERCENT_MIN_DECIMAL=void 0,R.DEFAULT_FORMATTER_PERCENT_MAX_DECIMAL=void 0,R.DEFAULT_NUMBER_DECIMAL_SEPARATOR=".",R.DEFAULT_NUMBER_THOUSAND_SEPARATOR="",R.DEFAULT_NEGATIVE_NUMBER_WRAPPED_IN_BRAQUET=!1,R.SLIDER_DEFAULT_MIN_VALUE=0,R.SLIDER_DEFAULT_MAX_VALUE=100,R.SLIDER_DEFAULT_STEP=1,R.VALIDATION_REQUIRED_FIELD="Field is required",R.VALIDATION_EDITOR_VALID_NUMBER="Please enter a valid number",R.VALIDATION_EDITOR_VALID_INTEGER="Please enter a valid integer number",R.VALIDATION_EDITOR_INTEGER_BETWEEN="Please enter a valid integer number between {{minValue}} and {{maxValue}}",R.VALIDATION_EDITOR_INTEGER_MAX="Please enter a valid integer number that is lower than {{maxValue}}",R.VALIDATION_EDITOR_INTEGER_MAX_INCLUSIVE="Please enter a valid integer number that is lower than or equal to {{maxValue}}",R.VALIDATION_EDITOR_INTEGER_MIN="Please enter a valid integer number that is greater than {{minValue}}",R.VALIDATION_EDITOR_INTEGER_MIN_INCLUSIVE="Please enter a valid integer number that is greater than or equal to {{minValue}}",R.VALIDATION_EDITOR_NUMBER_BETWEEN="Please enter a valid number between {{minValue}} and {{maxValue}}",R.VALIDATION_EDITOR_NUMBER_MAX="Please enter a valid number that is lower than {{maxValue}}",R.VALIDATION_EDITOR_NUMBER_MAX_INCLUSIVE="Please enter a valid number that is lower than or equal to {{maxValue}}",R.VALIDATION_EDITOR_NUMBER_MIN="Please enter a valid number that is greater than {{minValue}}",R.VALIDATION_EDITOR_NUMBER_MIN_INCLUSIVE="Please enter a valid number that is greater than or equal to {{minValue}}",R.VALIDATION_EDITOR_DECIMAL_BETWEEN="Please enter a valid number with a maximum of {{maxDecimal}} decimals",R.VALIDATION_EDITOR_TEXT_LENGTH_BETWEEN="Please make sure your text length is between {{minLength}} and {{maxLength}} characters",R.VALIDATION_EDITOR_TEXT_MAX_LENGTH="Please make sure your text is less than {{maxLength}} characters",R.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE="Please make sure your text is less than or equal to {{maxLength}} characters",R.VALIDATION_EDITOR_TEXT_MIN_LENGTH="Please make sure your text is more than {{minLength}} character(s)",R.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE="Please make sure your text is at least {{minLength}} character(s)";var fn;(function(r){r[r.camelCase=0]="camelCase",r[r.pascalCase=1]="pascalCase",r[r.snakeCase=2]="snakeCase",r[r.kebabCase=3]="kebabCase"})(fn||(fn={}));var wt;(function(r){r.colon=":",r.comma=",",r.equalSign="=",r.pipe="|",r.semicolon=";",r.space=" ",r.tab=" ",r.doubleColon="::",r.doublePipe="||",r.doubleSemicolon=";;"})(wt||(wt={}));var G;(function(r){r.autoTooltip="autoTooltip",r.cellExternalCopyManager="cellExternalCopyManager",r.cellMenu="cellMenu",r.checkboxSelector="checkboxSelector",r.columnPicker="columnPicker",r.contextMenu="contextMenu",r.customTooltip="customTooltip",r.draggableGrouping="draggableGrouping",r.groupItemMetaProvider="groupItemMetaProvider",r.gridMenu="gridMenu",r.headerButton="headerButton",r.headerMenu="headerMenu",r.rowBasedEdit="rowBasedEdit",r.rowDetailView="rowDetailView",r.rowMoveManager="rowMoveManager",r.rowSelection="rowSelection"})(G||(G={}));const S={unknown:"unknown",string:"string",boolean:"boolean",integer:"integer",float:"float",number:"number",date:"date",dateIso:"dateIso",dateUtc:"dateUtc",dateTime:"dateTime",dateTimeIso:"dateTimeIso",dateTimeIsoAmPm:"dateTimeIsoAmPm",dateTimeIsoAM_PM:"dateTimeIsoAM_PM",dateTimeShortIso:"dateTimeShortIso",dateEuro:"dateEuro",dateEuroShort:"dateEuroShort",dateTimeShortEuro:"dateTimeShortEuro",dateTimeEuro:"dateTimeEuro",dateTimeEuroAmPm:"dateTimeEuroAmPm",dateTimeEuroAM_PM:"dateTimeEuroAM_PM",dateTimeEuroShort:"dateTimeEuroShort",dateTimeEuroShortAmPm:"dateTimeEuroShortAmPm",dateTimeEuroShortAM_PM:"dateTimeEuroShortAM_PM",dateUs:"dateUs",dateUsShort:"dateUsShort",dateTimeShortUs:"dateTimeShortUs",dateTimeUs:"dateTimeUs",dateTimeUsAmPm:"dateTimeUsAmPm",dateTimeUsAM_PM:"dateTimeUsAM_PM",dateTimeUsShort:"dateTimeUsShort",dateTimeUsShortAmPm:"dateTimeUsShortAmPm",dateTimeUsShortAM_PM:"dateTimeUsShortAM_PM",object:"object",password:"password",text:"text",readonly:"readonly"};var ve;(function(r){r.csv="csv",r.txt="txt",r.xls="xls",r.xlsx="xlsx"})(ve||(ve={}));var hi;(function(r){r.merge="merge",r.chain="chain"})(hi||(hi={}));var ze;(function(r){r.columns="columns",r.filter="filter",r.pagination="pagination",r.pinning="pinning",r.rowSelection="rowSelection",r.sorter="sorter",r.treeData="treeData"})(ze||(ze={}));var H;(function(r){r.empty="",r.custom="Custom",r.contains="Contains",r.notContains="Not_Contains",r.lessThan="LT",r.lessThanOrEqual="LE",r.greaterThan="GT",r.greaterThanOrEqual="GE",r.notEqual="NE",r.equal="EQ",r.endsWith="EndsWith",r.rangeInclusive="RangeInclusive",r.rangeExclusive="RangeExclusive",r.startsWith="StartsWith",r.startsWithEndsWith="StartsWithEndsWith",r.in="IN",r.notIn="NOT_IN",r.inContains="IN_CONTAINS",r.notInContains="NOT_IN_CONTAINS",r.inCollection="IN_COLLECTION",r.notInCollection="NOT_IN_COLLECTION"})(H||(H={}));var dt;(function(r){r.asc="asc",r.ASC="ASC",r.desc="desc",r.DESC="DESC"})(dt||(dt={}));var ae;(function(r){r[r.asc=1]="asc",r[r.desc=-1]="desc",r[r.neutral=0]="neutral"})(ae||(ae={}));var Tt;(function(r){r.toggleCollapse="toggle-collapse",r.fullExpand="full-expand",r.fullCollapse="full-collapse",r.toggleExpand="toggle-expand"})(Tt||(Tt={}));const gn=Object.freeze(Object.defineProperty({__proto__:null,get CaseType(){return fn},get DelimiterType(){return wt},get EmitterType(){return oe},get ExtensionName(){return G},FieldType:S,get FileType(){return ve},get FilterMultiplePassType(){return hi},get GridStateType(){return ze},get OperatorType(){return H},get SortDirection(){return dt},get SortDirectionNumber(){return ae},get ToggleStateChangeType(){return Tt}},Symbol.toStringTag,{value:"Module"}));class ki extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ki.prototype)}}function Jr(r){let e=!1;return r instanceof Promise?{promise:r.then(t=>{if(e)throw new ki("Cancelled Promise");return t}),cancel:()=>e=!0}:r}function eo(r,e,t=""){let i=e;if(e instanceof Promise)return e;if(r.isObservable(e)&&(i=r.firstValueFrom(e)),!(i instanceof Promise))throw new Error(`Something went wrong, Slickgrid-Universal ${t} is not able to convert the Observable into a Promise.`);return i}function as(r,e,t=0){const i=(e==null?void 0:e.childrenPropName)??R.treeDataProperties.CHILDREN_PROP;Array.isArray(r)&&r.forEach(s=>{s&&(Array.isArray(s[i])&&s[i].length>0&&(t++,as(s[i],e,t),t--),s[e.levelPropName]=t)})}function Fi(r,e,t=0,i=null){const s=(e==null?void 0:e.childrenPropName)??R.treeDataProperties.CHILDREN_PROP,{aggregator:n}=e;Array.isArray(r)&&r.forEach(o=>{if(o){const l=Array.isArray(o[s]);Array.isArray(o[s])&&o[s].length>0&&(n.init(o,!0),t++,Fi(o[s],e,t,o),t--),i&&n.isInitialized&&typeof n.accumulate=="function"&&!(o!=null&&o.__filteredOut)&&(n.accumulate(o,l),n.storeResult(i.__treeTotals)),o[e.levelPropName]=t}})}function to(r,e){const t=(e==null?void 0:e.identifierPropName)??"id",i=(e==null?void 0:e.childrenPropName)??R.treeDataProperties.CHILDREN_PROP,s=(e==null?void 0:e.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP,n=(e==null?void 0:e.parentPropName)??R.treeDataProperties.PARENT_PROP,o=(e==null?void 0:e.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;return e!=null&&e.shouldAddTreeLevelNumber&&(e!=null&&e.aggregators?e.aggregators.forEach(a=>{Fi(r,{childrenPropName:i,levelPropName:o,aggregator:a})}):as(r,{childrenPropName:i,levelPropName:o})),ph(r,a=>a[i],(a,h)=>({[t]:a[t],[n]:h!==void 0?h[t]:null,[s]:!!a[i],...so(a,i)}))}function io(r,e){const t=(e==null?void 0:e.identifierPropName)??"id",i=(e==null?void 0:e.childrenPropName)??R.treeDataProperties.CHILDREN_PROP,s=(e==null?void 0:e.parentPropName)??R.treeDataProperties.PARENT_PROP,n=(e==null?void 0:e.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP,o=(e==null?void 0:e.collapsedPropName)??R.treeDataProperties.COLLAPSED_PROP,l=r||[],a=[],h={};return l.forEach(d=>h[d[t]]=d),Object.keys(h).forEach(d=>{const c=h[d];if(!(s in c)||c[s]===null||c[s]===void 0||c[s]==="")a.push(c);else if(c[s]in h){const u=h[c[s]];i in u||(u[i]=[]),u[i].push(c),u[o]===void 0&&(u[o]=(e==null?void 0:e.initiallyCollapsed)??!1)}}),e!=null&&e.aggregators?e.aggregators.forEach(d=>{Fi(a,{childrenPropName:i,levelPropName:n,aggregator:d},0)}):as(a,{childrenPropName:i,levelPropName:n},0),a}function Di(r,e,t){if(!t)throw new Error('findRecursive requires parameter "childrenPropertyName"');const i=r.find(e),s=r.filter(n=>(n==null?void 0:n.hasOwnProperty(t))&&n[t]);if(i)return i;if(s.length){const n=[];return s.forEach(o=>{o!=null&&o.hasOwnProperty(t)&&n.push(...o[t])}),Di(n,e,t)}}function Lt(r,e,t,i=".",s=""){if(isNaN(+r))return r;const n=e===void 0?2:e,o=t===void 0?2:t;let l=String(Math.round(+r*Math.pow(10,o))/Math.pow(10,o));for(l.indexOf(".")<0&&n>0&&(l+=".");l.length-l.indexOf(".")<=n;)l+="0";const a=l.split(".");let h,d;s?h=a.length>=1?Ot(a[0],s):void 0:h=a.length>=1?a[0]:l,a.length>1&&(d=a[1]);let c="";return h!==void 0&&d!==void 0?c=`${h}${i}${d}`:h!=null&&(c=h),c}function Ie(r,e,t,i,s="",n="",o=".",l=""){if(isNaN(+r))return r;const a=Math.round(parseFloat(r)*1e6)/1e6;if(a<0){const h=Math.abs(a);if(i){if(!isNaN(e)||!isNaN(t))return`(${s}${Lt(h,e,t,o,l)}${n})`;const d=Ot(`${h}`,l);return`(${s}${d}${n})`}else{if(!isNaN(e)||!isNaN(t))return`-${s}${Lt(h,e,t,o,l)}${n}`;const d=Ot(`${h}`,l);return`-${s}${d}${n}`}}else{if(!isNaN(e)||!isNaN(t))return`${s}${Lt(r,e,t,o,l)}${n}`;const h=Ot(`${r}`,l);return`${s}${h}${n}`}}function Mi(r,e,t){if(typeof r.queryFieldNameGetterFn=="function"){const i=r.queryFieldNameGetterFn(e);(i==null?void 0:i.indexOf("."))>=0?t=Ee(e,i):t=e.hasOwnProperty(i)?e[i]:t}return t}function Ee(r,e){return!r||!e?r:e.split(".").reduce((t,i)=>t&&t[i],r)}function ot(r){return r&&r.translationNamespace?r.translationNamespace+(r.translationNamespaceSeparator||""):""}function Ni(r){return r.outputType||r.type||S.string}function _n(r){switch(r){case S.date:case S.dateTime:case S.dateIso:case S.dateTimeIso:case S.dateTimeShortIso:case S.dateTimeIsoAmPm:case S.dateTimeIsoAM_PM:case S.dateEuro:case S.dateEuroShort:case S.dateTimeEuro:case S.dateTimeShortEuro:case S.dateTimeEuroAmPm:case S.dateTimeEuroAM_PM:case S.dateTimeEuroShort:case S.dateTimeEuroShortAmPm:case S.dateTimeEuroShortAM_PM:case S.dateUs:case S.dateUsShort:case S.dateTimeUs:case S.dateTimeShortUs:case S.dateTimeUsAmPm:case S.dateTimeUsAM_PM:case S.dateTimeUsShort:case S.dateTimeUsShortAmPm:case S.dateTimeUsShortAM_PM:case S.dateUtc:return!0;default:return!1}}function mh(r){let e;switch(r){case"<":case"LT":e=H.lessThan;break;case"<=":case"LE":e=H.lessThanOrEqual;break;case">":case"GT":e=H.greaterThan;break;case">=":case"GE":e=H.greaterThanOrEqual;break;case"!=":case"NE":e=H.notEqual;break;case"*":case"a*":case"StartsWith":e=H.startsWith;break;case"*z":case"EndsWith":e=H.endsWith;break;case"=":case"==":case"EQ":e=H.equal;break;case"IN":e=H.in;break;case"NIN":case"NOT_IN":e=H.notIn;break;case"<>":case"Not_Contains":case"NOT_CONTAINS":e=H.notContains;break;case"Contains":case"CONTAINS":default:e=H.contains;break}return e}function di(r){let e="";switch(r){case H.greaterThan:case">":e=">";break;case H.greaterThanOrEqual:case">=":e=">=";break;case H.lessThan:case"<":e="<";break;case H.lessThanOrEqual:case"<=":e="<=";break;case H.notEqual:case"<>":e="<>";break;case H.equal:case"=":case"==":case"EQ":e="=";break;case H.startsWith:case"a*":case"*":e="a*";break;case H.endsWith:case"*z":e="*z";break;default:e=r;break}return e}function Cn(r){let e;if(_n(r))e=H.equal;else switch(r){case S.unknown:case S.string:case S.text:case S.password:case S.readonly:e=H.contains;break;case S.float:case S.number:default:e=H.equal;break}return e}function so(r,e){return Object.keys(r).reduce((t,i)=>(i!==e&&(t[i]=r[i]),t),{})}function Ot(r,e=","){if(r!=null){const t=`${r}`,i=t.split(".");return i.length===2?`${i[0].replace(/\B(?=(\d{3})+(?!\d))/g,e)}.${i[1]}`:t.replace(/\B(?=(\d{3})+(?!\d))/g,e)}return r}function xt(r,e,t={}){return Array.isArray(r)?r.find(e)||t:r}function hs(r){if(Array.isArray(r))for(;r.length>0;){const e=r.pop();e!=null&&e.unsubscribe&&e.unsubscribe()}return r}const fh=Object.freeze(Object.defineProperty({__proto__:null,CancelledException:ki,addTreeLevelAndAggregatorsByMutation:Fi,addTreeLevelByMutation:as,cancellablePromise:Jr,castObservableToPromise:eo,decimalFormatted:Lt,findItemInTreeStructure:Di,findOrDefault:xt,flattenToParentChildArray:to,formatNumber:Ie,getCellValueFromQueryFieldGetter:Mi,getColumnFieldType:Ni,getDescendantProperty:Ee,getTranslationPrefix:ot,isColumnDateType:_n,mapOperatorByFieldType:Cn,mapOperatorToShorthandDesignation:di,mapOperatorType:mh,objectWithoutKey:so,thousandSeparatorFormatted:Ot,unflattenParentChildArrayToTree:io,unsubscribeAll:hs},Symbol.toStringTag,{value:"Module"})),gh=(r,e,t=ae.neutral)=>{let i=0;return r===e?i=0:r===null?i=-1:e===null?i=1:t?i=r<e?-1:1:i=r<e?1:-1,t*i},_h=(r,e,t=ae.neutral,i,s)=>{if(!i||!i.dataKey)throw new Error('Sorting a "FieldType.object" requires you to provide the "dataKey" (object property name) of the object so that we can use it to sort correctly');const n=r!=null&&r.hasOwnProperty(i.dataKey)?r[i.dataKey]:r,o=e!=null&&e.hasOwnProperty(i.dataKey)?e[i.dataKey]:e,l=(i==null?void 0:i.valueCouldBeUndefined)??(s==null?void 0:s.cellValueCouldBeUndefined)??!1;let a=0;return typeof r!="object"?a=-1/0:typeof e!="object"?a=1/0:n===null||l&&n===void 0?a=-1:o===null||l&&o===void 0?a=1:n===o?a=0:t?a=n<o?-1:1:a=n<o?1:-1,t*a};function Li(r){let e=0,t=0,i=0,s=0;const n=window.innerHeight??0,o=window.innerWidth??0,l=bn(),a=l.top,h=l.left,d=me(r);if(d){const c=d.top??0,u=d.left??0;t=c-a,i=u-h,e=n-(c-a+r.clientHeight),s=o-(u-h+r.clientWidth)}return{top:t,bottom:e,left:i,right:s}}function v(r,e,t){const i=document.createElement(r);return e&&Object.keys(e).forEach(s=>{s==="innerHTML"&&console.warn(`[Slickgrid-Universal] For better CSP (Content Security Policy) support, do not use "innerHTML" directly in "createDomElement('${r}', { innerHTML: 'some html'})", it is better as separate assignment: "const elm = createDomElement('span'); elm.innerHTML = 'some html';"`);const n=e[s];typeof n=="object"?Object.assign(i[s],n):i[s]=e[s]}),t!=null&&t.appendChild&&t.appendChild(i),i}function he(r=""){return r.split(" ").filter(e=>e)}function vn(r){typeof r=="object"&&Object.keys(r).forEach(e=>{Array.isArray(r[e])&&vn(r[e]),r[e]instanceof HTMLElement&&(r[e]=null)})}function J(r){for(;r!=null&&r.firstChild;)r.removeChild(r.firstChild);return r}function gt(r,e="innerHTML"){return r instanceof DocumentFragment?[].map.call(r.childNodes,t=>t[e]).join("")||r.textContent||"":r instanceof HTMLElement?r[e]:String(r??"")}function no(r,e){if(!r||!e)return;const t=r.getBoundingClientRect(),i=e.getBoundingClientRect();return{top:i.top-t.top,right:i.right-t.right,bottom:i.bottom-t.bottom,left:i.left-t.left}}function me(r){if(!r||!r.getBoundingClientRect)return;const e=r.getBoundingClientRect(),t=document.documentElement;let i=0,s=0,n=0,o=0;return(e==null?void 0:e.top)!==void 0&&e.left!==void 0&&(i=e.top+window.pageYOffset-t.clientTop,s=e.left+window.pageXOffset-t.clientLeft,o=e.right,n=e.bottom),{top:i,left:s,bottom:n,right:o}}function ds(r,e){let t=0;if(r){const i=e==="height"?"clientHeight":"clientWidth",s=e==="height"?["top","bottom"]:["left","right"];t=r[i];for(const n of s){const o=parseFloat(ro(r,`padding-${n}`)||"")||0;t-=o}}return t}function ro(r,e){return r?window.getComputedStyle(r).getPropertyValue(e):null}function Hi(r,e){if(r)for(const t of e){const i=r.getAttribute(t);if(i)return i}return null}function It(r,e="auto"){return(/^[0-9]+$/i.test(`${r}`)?`${+r}px`:r)||e}function oo(r){const e=typeof r=="string"?r:String(r),t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return(e||"").toString().replace(/[&<>"']/g,i=>t[i])}function lo(r){return r.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(t))}function ao(r,e){const t=r.length;let i=oo(r);if(t<e)for(let s=t;s<e;s++)i+="&nbsp;";return i}function ho(r,e){var t;(t=r.parentNode)==null||t.insertBefore(e,r.nextSibling)}function bn(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}const cs=Object.prototype.hasOwnProperty,co=Object.prototype.toString,uo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,mo=function(e){return typeof Array.isArray=="function"?Array.isArray(e):co.call(e)==="[object Array]"},fo=function(e){if(!e||co.call(e)!=="[object Object]")return!1;const t=cs.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&cs.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!i)return!1;let s;for(s in e);return typeof s>"u"||cs.call(e,s)},go=function(e,t){uo&&t.name==="__proto__"?uo(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},_o=function(e,t){if(t==="__proto__")if(cs.call(e,t)){if(po)return po(e,t).value}else return;return e[t]};function de(...r){let e,t,i,s,n,o,l=r[0],a=1;const h=r.length;let d=!1;for(typeof l=="boolean"&&(d=l,l=r[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<h;++a)if(e=r[a],e!=null)for(t in e)i=_o(l,t),s=_o(e,t),l!==s&&(d&&s&&(fo(s)||(n=mo(s)))?(n?(n=!1,o=i&&mo(i)?i:[]):o=i&&fo(i)?i:{},go(l,{name:t,newValue:de(d,o,s)})):typeof s<"u"&&go(l,{name:t,newValue:s}));return l}function Ch(r,e,t="id"){let i=-1;e&&typeof e=="object"&&t in e?i=r.findIndex(s=>s[t]===e[t]):i=r.findIndex(s=>s===e),i<0&&r.push(e)}function Vi(r,e=" "){let t="";for(let i=0;i<r;i++)t+=e;return t}function Sn(r,e){return r.filter((t,i)=>e!==i)}function vh(r){if(!Array.isArray(r)&&!Ht(r))return r;const e=Array.isArray(r)?[]:{};return de(!0,e,r)}function Kt(r,...e){if(!e.length)return r;const t=e.shift();return r=!Ht(r)&&Ht(t)?{}:r,Ht(r)&&Ht(t)&&Object.keys(t).forEach(i=>{t.hasOwnProperty(i)&&(i in r?typeof r[i]!="object"||typeof t[i]!="object"?r[i]=t[i]:r[i].concat&&t[i].concat?r[i]=r[i].concat(t[i]):r[i]=Kt(r[i],t[i]):r[i]=t[i])}),Kt(r,...e)}function Co(r){return Ht(r)&&Object.keys(r).forEach(e=>{r.hasOwnProperty(e)&&delete r[e]}),r=null,r={},r}function yn(r,e=!0){let t=!1;const i=n=>{const o=n.toString();if(t=o.includes("async "),o.replaceAll(" ","").includes("=>({")){const h=o.match(/(({.*}))/g)||[];return h.length>=1?`return ${h[0].trimStart()}`:o}const l=!o.includes("{")&&o.includes("=>"),a=o.substring(o.indexOf("{")+1||o.indexOf("=>")+2,o.includes("}")?o.lastIndexOf("}"):o.length);return e&&l&&!a.startsWith("return")?"return "+a.trimStart():a};return{params:(n=>{const o=/(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,)]*))/mg,l=/([^\s,]+)/g,a=n.toString().replace(o,"");return a.slice(a.indexOf("(")+1,a.indexOf(")")).match(l)??[]})(r),body:i(r),isAsync:t}}function En(r){return r==null?!0:Object.entries(r).length===0}function ie(r){return r!=null&&r!==""}function Qt(r){return r!==null&&!isNaN(r)&&r!==""}function Ht(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)}function Bi(r){return typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r===null||r===void 0}function Zt(r){return r instanceof HTMLElement||r instanceof DocumentFragment||Bi(r)}function U(r,e=!1){return e?r==null||typeof r=="string"?!1:!isNaN(r):r==null||r===""?!1:!isNaN(+r)}function vo(r){return!r||r&&typeof r=="object"&&Object.keys(r).length===0}function us(r){return/(true|1)/i.test(r+"")}function ci(r,e=!1){const t=typeof r.normalize=="function"?r.normalize("NFD").replace(/[\u0300-\u036f]/g,""):r;return e?t.toLowerCase():t}function $e(r,e,t){if(typeof e=="string"&&(e=e.split(".")),e.length>1){const i=e.shift();r&&i!==void 0&&$e(r[i]=ie(r[i])&&(Array.isArray(r[i])||Object.prototype.toString.call(r[i])==="[object Object]")?r[i]:{},e,t)}else r&&e[0]&&(r[e[0]]=t)}function Jt(r,e=!1){return typeof r=="string"?e?r.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()):r.charAt(0).toUpperCase()+r.slice(1):r}function wn(r){return typeof r=="string"?r.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_/])/g,(e,t)=>/[\s+\-_/]/.test(e)?"":t===0?e.toLowerCase():e.toUpperCase()):r}function ui(r){return typeof r=="string"?wn(r).replace(/([A-Z])|([-_])/g,"-$1").toLowerCase():r}function _t(r){if(typeof r=="string"){const e=r.replace(/([A-Z])|([-_])/g," $1").replace(/\s+/g," ").trim();return e.charAt(0).toUpperCase()+e.slice(1)}return r}function bh(r){return typeof r=="string"?wn(r).replace(/([A-Z])/g,"_$1").toLowerCase():r}function bo(r){return Array.isArray(r)&&r.length>0?r.filter((e,t)=>r.indexOf(e)>=t):r}function Sh(r,e="id"){if(Array.isArray(r)&&r.length>0){const t=[],i=new Map;for(const s of r)s&&!i.has(s[e])&&(i.set(s[e],!0),t.push({id:s[e],name:s.name}));return t}return r}const zi=Symbol("plaintext"),So=Symbol("html"),yo=Symbol("comment"),yh=/<(\w*)>/g,Eh=/<\/?([^\s/>]+)/;function we(r,e,t){function i(a,h,d){if(typeof a!="string"&&(U(a)||typeof a=="boolean"))return String(a);if(a instanceof HTMLElement&&(a=a.innerHTML),typeof a!="string"&&a!==void 0&&a!==null)throw new TypeError("'html' parameter must be a string");return n(a||"",s(h||"",d||""))}function s(a,h){return{allowable_tags:o(a),tag_replacement:h,state:zi,tag_buffer:"",depth:0,in_quote_char:""}}function n(a,h){const d=h.allowable_tags,c=h.tag_replacement;let u=h.state,p=h.tag_buffer,m=h.depth,f=h.in_quote_char,g="";for(let _=0,b=a.length;_<b;_++){const C=a[_];if(u===zi)switch(C){case"<":u=So,p+=C;break;default:g+=C;break}else if(u===So)switch(C){case"<":if(f)break;m++;break;case">":if(f)break;if(m){m--;break}f="",u=zi,p+=">",d.has(l(p))?g+=p:g+=c,p="";break;case'"':case"'":C===f?f="":f=f||C,p+=C;break;case"-":p==="<!-"&&(u=yo),p+=C;break;case" ":case`
2
- `:if(p==="<"){u=zi,g+="< ",p="";break}p+=C;break;default:p+=C;break}else if(u===yo)switch(C){case">":p.slice(-2)==="--"&&(u=zi),p="";break;default:p+=C;break}}return h.state=u,h.tag_buffer=p,h.depth=m,h.in_quote_char=f,g}function o(a){let h=new Set;if(typeof a=="string"){let d;for(;d=yh.exec(a);)h.add(d[1])}else typeof a[Symbol.iterator]=="function"&&(h=new Set(a));return h}function l(a){const h=Eh.exec(a);return h?h[1].toLowerCase():null}return i(r,e,t)}const wh=Object.freeze(Object.defineProperty({__proto__:null,addToArrayWhenNotExists:Ch,addWhiteSpaces:Vi,arrayRemoveItemByIndex:Sn,calculateAvailableSpace:Li,classNameToList:he,createDomElement:v,deepCopy:vh,deepMerge:Kt,destroyAllElementProps:vn,emptyElement:J,emptyObject:Co,extend:de,findFirstAttribute:Hi,findWidthOrDefault:It,getFunctionDetails:yn,getHtmlStringOutput:gt,getInnerSize:ds,getOffset:me,getOffsetRelativeToParent:no,getStyleProp:ro,htmlEncode:oo,htmlEncodeWithPadding:ao,htmlEntityDecode:lo,insertAfterElement:ho,isDefined:ie,isDefinedNumber:Qt,isEmptyObject:En,isNumber:U,isObject:Ht,isObjectEmpty:vo,isPrimitiveOrHTML:Zt,isPrimitiveValue:Bi,parseBoolean:us,removeAccentFromText:ci,setDeepValue:$e,stripTags:we,titleCase:Jt,toCamelCase:wn,toKebabCase:ui,toSentenceCase:_t,toSnakeCase:bh,uniqueArray:bo,uniqueObjectArray:Sh,windowScrollPosition:bn},Symbol.toStringTag,{value:"Module"})),Th=(r,e,t=ae.neutral,i,s)=>{let n=0;const o=(i==null?void 0:i.valueCouldBeUndefined)??(s==null?void 0:s.cellValueCouldBeUndefined)??!1;return r===e?n=0:r===null||o&&r===void 0?n=-1:e===null||o&&e===void 0?n=1:(s!=null&&s.ignoreAccentOnStringFilterAndSort&&(r=ci(r,!1),e=ci(e,!1)),t?n=r<e?-1:1:n=r<e?1:-1),t*n},Eo=(r,e,t=ae.neutral,i,s)=>{const n=(i==null?void 0:i.valueCouldBeUndefined)??(s==null?void 0:s.cellValueCouldBeUndefined)??!1,o=isNaN(r)||r===""||r===null||n&&r===void 0?-1/0:parseFloat(r),l=isNaN(e)||e===""||e===null||n&&e===void 0?-1/0:parseFloat(e);return t*(o===l?0:o>l?1:-1)};var wo=/^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\.[0-9]+)?(Z|(?:\+|\-)[0-9]{2}:?[0-9]{2})?$/;function Oh(r){const e=r.match(wo);if(e){const t=Number(e[2]);if(t<1||t>12)return!1;if(typeof e[3]!==void 0){const i=Number(e[3]);if(i<1||i>31)return!1}if(typeof e[4]!==void 0){const i=Number(e[4]);if(i<0||i>23)return!1}return!0}return!1}function xh(r){const e=r.match(wo);return e&&typeof e[4]>"u"?r+="T00:00:00":r}function Vt(r){if(r||(r=new Date),r instanceof Date){const e=new Date(r);return e.setMilliseconds(0),e}if(r=r.trim(),Oh(r))return new Date(xh(r));throw new Error(`Non ISO 8601 compliant date (${r}).`)}function Ih(r){const e=Vt(r);return e.setDate(1),e.setMonth(e.getMonth()+1),e.setDate(0),e}function Rh(r){return Ih(r).getDate()}var Tn="1999-03-04T02:05:01.000Z",On=new Map,xn=[["YYYY",{year:"numeric"}],["YY",{year:"2-digit"}],["MMMM",{month:"long"}],["MMM",{month:"short"}],["MM",{month:"2-digit"}],["M",{month:"numeric"}],["DD",{day:"2-digit"}],["D",{day:"numeric"}],["dddd",{weekday:"long"}],["ddd",{weekday:"short"}],["d",{weekday:"narrow"}],["mm",{minute:"2-digit"}],["m",{minute:"numeric"}],["ss",{second:"2-digit"}],["s",{second:"numeric"}],["ZZ",{timeZoneName:"long"}],["Z",{timeZoneName:"short"}]],In=[["HH",{hour:"2-digit"}],["H",{hour:"numeric"}]],Rn=[["hh",{hour:"2-digit"}],["h",{hour:"numeric"}],["a",{dayPeriod:"narrow"}],["A",{dayPeriod:"narrow"}]],ps={DD:2,HH:2,MM:2,YY:2,YYYY:4,hh:2,mm:2,ss:2};function To(r){if(/^[+-]\d{2}:\d{2}/.test(r))return 6;if(/^[+-]\d{4}/.test(r))return 5;throw new Error("Invalid offset format")}var Ah=["MMMM","MMM","dddd","ddd"],Te=new Map([...xn,...In,...Rn].map(r=>[r[0],r])),Oo=new Map,xo=["full","long","medium","short"],Bt=r=>String(r).padStart(2,"0"),An=r=>String(r).padStart(2,"0");function Rt(r){return r.type==="literal"&&(r.value=r.value.normalize("NFKC")),r}function Ph(r,e,t,i=!1,s=null){const n=kh(r,e,t,i),o=Vt(r);function l({partName:a,partValue:h,token:d}){if(a==="literal")return h;const c=n[a];if(a==="hour"&&d==="H")return c.replace(/^0/,"")||"0";if(["mm","ss","MM"].includes(d)&&c.length===1)return`0${c}`;if(a==="dayPeriod"){const u=pi(o.getUTCHours()<12?"am":"pm",t);return d==="A"?u.toUpperCase():u.toLowerCase()}return a==="timeZoneName"?s??Io(-1*o.getTimezoneOffset(),d):c}return e.map(a=>({...a,value:l(a)}))}function kh(r,e,t,i=!1){const s=Vt(r),n=e.filter(d=>d.hour12),o=e.filter(d=>!d.hour12),l=[],a=[];function h(d,c=!1){const u=`${t}-u-hc-${c?"h12":"h23"}`;if(l.push(...new Intl.DateTimeFormat(u,d.reduce((p,m)=>m.partName==="literal"?p:(i&&Ah.includes(m.token)&&a.push(m),Object.assign(p,m.option)),{timeZone:"UTC"})).formatToParts(s).map(Rt)),i&&a.length)for(const p of a){let m=[];switch(p.token){case"MMMM":m=new Intl.DateTimeFormat(u,{dateStyle:"long",timeZone:"UTC"}).formatToParts(s).map(Rt);break;case"MMM":m=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:"UTC"}).formatToParts(s).map(Rt);break}const f=m.find(_=>_.type===p.partName),g=l.findIndex(_=>_.type===p.partName);f&&g>-1&&(l[g]=f)}}return n.length&&h(n,!0),o.length&&h(o),l.reduce((d,c)=>(d[c.type]=c.value,d),{})}function Io(r,e="Z"){const t=String(Math.floor(Math.abs(r/60))).padStart(2,"0"),i=String(Math.abs(r%60)).padStart(2,"0"),s=r<0?"-":"+";return e==="ZZ"?`${s}${t}${i}`:`${s}${t}:${i}`}function Fh(r,e){Ro(r,e);const[t,i,s,n]=r.match(/([+-])([0-3][0-9]):?([0-6][0-9])/),o=Number(s)*60+Number(n);return i==="+"?o:-o}function Ro(r,e="Z"){if(!(i=>{switch(i){case"Z":return/^([+-])[0-3][0-9]:[0-6][0-9]$/.test(r);case"ZZ":return/^([+-])[0-3][0-9][0-6][0-9]$/.test(r)}})(e))throw new Error(`Invalid offset: ${r}`);return r}function Dh(r){return xn.concat(In).concat(Rn).sort((e,t)=>e[0].length>t[0].length?1:-1).reduce((e,t)=>e.replace(t[0],`\\${t[0]}`),r)}function Mh(r){return["numeric","2-digit"].includes(r.partValue)}function Nh(r){let e;for(const t of r){if(t.partName==="literal"&&!isNaN(parseFloat(t.partValue)))throw new Error(`Numbers in format (${t.partValue}).`);if(e&&e.partName!=="literal"&&t.partName!=="literal"&&!(e.token in ps)&&!(t.token in ps)&&!(Mh(e)&&t.token.toLowerCase()==="a"))throw new Error(`Illegal adjacent tokens (${e.token}, ${t.token})`);e=t}return r}function Lh(r){return typeof r=="string"?r.includes("ZZ")?"ZZ":"Z":"time"in r&&r.time==="full"?"Z":"ZZ"}function pi(r,e){const t=Oo.get(e);if(t&&t[r])return t[r];const i=new Date(Tn);i.setUTCHours(r==="am"?5:20);const n=new Intl.DateTimeFormat(e,{timeStyle:"full",timeZone:"UTC",hour12:!0}).formatToParts(i).map(Rt).find(o=>o.type==="dayPeriod");if(n){const o=t||{};return Oo.set(e,Object.assign(o,{[r]:n.value})),n.value}return r}function Hh(r,e="+00:00"){const t=Vt(r),i=(()=>{switch(To(e)){case 5:return"ZZ";case 6:return"Z"}})(),s=Fh(e,i);return new Date(t.getTime()+s*1e3*60)}function Ao(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Po(r,e){const t=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:e,hourCycle:"h23"}).formatToParts(r).map(Rt),i={};return t.forEach(s=>{i[s.type]=s.value}),new Date(`${i.year}-${i.month}-${i.day}T${i.hour}:${i.minute}:${i.second}Z`)}function Pn(r,e="UTC",t="device",i="Z"){var s;t=t==="device"?(s=Ao())!=null?s:"utc":t;const n=Vt(r),o=Po(n,e),l=Po(n,t),a=Math.round((l.getTime()-o.getTime())/1e3/60);return Io(a,i)}function ko(r){const e=Vt(r);return e.setHours(0,0,0),e}function kn(r,e){if(xo.includes(r)||typeof r=="object")return Vh(r,e);let t=r,i=0;const s=d=>{if(d[2]||(d[2]=new RegExp(`(.)?(${d[0]})`,"g")),d[2].test(t)){let c=0;return t=t.replace(d[2],(u,p,m)=>p==="\\"?m:`${typeof p=="string"?p:""}{!${c++?i:i++}!}`),!!c}return!1};function n(d){const c=d.map(p=>p.partName),u=new Set(c);if(c.length>u.size)throw new Error("Cannot reuse format tokens.");return d}function o(d,[c,u,p]){const m=Object.keys(u)[0],f=u[m];return{option:u,partName:m,partValue:f,token:c,pattern:p,hour12:d}}const l=xn.filter(s).concat(In.filter(s)).map(o.bind(null,!1)),a=n(l.concat(Rn.filter(s).map(o.bind(null,!0)))),h=/^\{!(\d+)!\}$/;return t.split(/(\{!\d+!\})/).map(d=>{const c=d.match(h);return c?a[Number(c[1])]:{option:{literal:d},partName:"literal",partValue:d,token:d,pattern:new RegExp(""),hour12:!1}}).filter(d=>!(d.partName==="literal"&&d.partValue===""))}function Vh(r,e){const t={timeZone:"UTC"};typeof r=="string"?t.dateStyle=r:("date"in r&&(t.dateStyle=r.date),"time"in r&&(t.timeStyle=r.time));const i=new Intl.DateTimeFormat(e,t),s=i.formatToParts(new Date(Tn)).map(Rt),o=i.formatToParts(new Date("1999-04-05T23:05:01.000Z")).map(Rt).find(a=>a.type==="hour"),l=o&&o.value==="23"?24:12;return s.map(a=>{const h=a.type,d=Bh(a.type,a.value,e,a.type==="hour"?l:void 0,t);if(d===void 0)return;const c=d[1][h];if(c)return d[2]||(d[2]=new RegExp(`${d[0]}`,"g")),{option:{[h]:c},partName:h,partValue:c,token:d[0],pattern:d[2],hour12:l===12}}).filter(a=>!!a)}function Bh(r,e,t,i,s){const n=e.length,o=!isNaN(Number(e));let l;switch(r){case"year":return n===2?Te.get("YY"):Te.get("YYYY");case"month":if(o)return n===1?Te.get("M"):Te.get("MM");switch(l=Fo(t,r,e),l){case"long":return Te.get("MMMM");default:return Te.get("MMM")}case"day":return n===1?Te.get("D"):Te.get("DD");case"weekday":switch(l=Fo(t,r,e),l){case"narrow":return Te.get("d");case"short":return Te.get("ddd");default:return Te.get("dddd")}case"hour":return i===12?n===1?Te.get("h"):Te.get("hh"):n===1?Te.get("H"):Te.get("HH");case"minute":return n===1?Te.get("m"):Te.get("mm");case"second":return n===1?Te.get("s"):Te.get("ss");case"dayPeriod":return/^[A-Z]+$/u.test(e)?Te.get("A"):Te.get("a");case"literal":return[e,{literal:e},new RegExp("")];case"timeZoneName":return s.timeStyle==="full"?Te.get("Z"):Te.get("ZZ");default:return}}function Fo(r,e,t){if(!On.has(r)){const s=new Date(Tn),n=[3,8,9,7,6,4,3],o=["weekday","month","dayPeriod"],l=["long","short","narrow"],a={};for(let h=0;h<12;h++){s.setMonth(0+h),h in n&&s.setDate(n[h]),s.setUTCHours(8+h);for(const d of l){const c=new Intl.DateTimeFormat(r,o.reduce((u,p)=>Object.assign(u,{[p]:d}),{hour12:!0,timeZone:"UTC"})).formatToParts(s).map(Rt);if(d==="long"||d==="short"){const p=new Intl.DateTimeFormat(r,{dateStyle:d==="short"?"medium":"long",timeZone:"UTC"}).formatToParts(s).map(Rt).find(f=>f.type==="month"),m=c.findIndex(f=>f.type==="month");m>-1&&p&&(c[m]=p)}c.forEach(u=>{if(u.type==="literal")return;const p=u.type;a[p]=Object.assign(a[p]||{},{[u.value]:d})})}}On.set(r,a)}const i=On.get(r);return i?i[e][t]:void 0}function Do(r,e="+00:00"){const t=e.slice(0,1)==="+";return Hh(r,e.replace(t?"+":"-",t?"-":"+"))}function zh(){return Intl.DateTimeFormat().resolvedOptions().locale}function Qe(r,e="long",t="device",i=!1,s){let n,o;return typeof r=="object"&&!(r instanceof Date)&&({date:r,format:e,locale:t,genitive:i,partFilter:s,tz:n}=r),e==="ISO8601"?Vt(r).toISOString():(n&&(o=Pn(r,"utc",n,Lh(e))),n??(n=Ao()),(n==null?void 0:n.toLowerCase())!=="utc"&&(r=Do(r,Pn(r,n,"utc"))),(!t||t==="device")&&(t=zh()),Ph(r,kn(e,t).filter(s??(()=>!0)),t,i,o).map(l=>l.value).join(""))}function $h(r,e="en",t=!1,i=()=>!0){return kn(r,e).filter(i).reduce((s,n)=>s+=t&&n.partName==="literal"?Dh(n.token):n.token,"").normalize("NFKC")}function Wh(r){const e=new Date().getFullYear(),t=e%100,i=Math.floor(e/100),s=Number(r);return(i+(s>t+20?-1:0))*100+s}function Mo(r,e="en",t=!1){const i=(s,n)=>Array(s).fill("").map((o,l)=>`${n(l)}`);if(r==="M")return i(12,s=>s+1);if(r==="MM")return i(12,s=>{const n=s+1;return n<10?`0${n}`:n});if(r.startsWith("M"))return Mo("MM").map(s=>Qe(`2000-${s}-05`,r,e,t));if(r.startsWith("d"))return i(7,s=>`0${s+2}`).map(s=>Qe(`2022-10-${s}`,r,e));if(r==="a")return[pi("am",e).toLowerCase(),pi("pm",e).toLowerCase()];if(r==="A")return[pi("am",e).toUpperCase(),pi("pm",e).toUpperCase()];if(r.startsWith("Y")){const s=new Date().getFullYear();return i(120,n=>n+1).reduce((n,o)=>(o!=="120"&&n.push(Qe(`${s+Number(o)}-06-06`,r,e)),n.unshift(Qe(`${s-Number(o)}-06-06`,r,e)),n),[Qe(`${s}-06-06`,r,e)])}return r.startsWith("D")?i(31,s=>`${r==="DD"&&s<9?"0":""}${s+1}`):r.startsWith("H")?i(24,s=>`${r==="HH"&&s<10?"0":""}${s}`):r.startsWith("h")?i(12,s=>`${r==="hh"&&s<9?"0":""}${s+1}`):r.startsWith("m")||r.startsWith("s")?i(60,s=>`${r.length>1&&s<10?"0":""}${s}`):[]}function ms(r,e="ISO8601",t="device"){let i=()=>!0,s,n="backward";if(typeof r=="object"?{date:s,format:e="ISO8601",locale:t="device",dateOverflow:n="backward",partFilter:i=()=>!0}=r:s=r,!s)throw new Error("parse() requires a date string.");const o=()=>{throw new Error(`Date (${s}) does not match format (${$h(e,t)})`)};if(e==="ISO8601")return Vt(s);const l=xo.includes(e)||typeof e=="object",a=Nh(kn(e,t).filter(i));if(!a.length)throw new Error("parse() requires a pattern.");let h;try{h=Gh(s,a)}catch{return o()}const d=new Date,c=new Map([["YYYY",d.getFullYear()],["MM",d.getMonth()+1],["DD",d.getDate()],["HH",0],["mm",0],["ss",0]]);let u=null,p="";h.forEach(O=>{if(O.partName==="literal")return;if(O.token===O.value)return o();const I=Number(O.value);if(c.has(O.token))c.set(O.token,I);else if(O.token==="YY")c.set("YYYY",Wh(O.value));else{const A=O.token;if(A.startsWith("d"))return;if(A==="D")c.set("DD",I);else if(A==="H"||A.startsWith("h"))c.set("HH",I);else if(A==="M")c.set("MM",I);else if(A==="a"||A==="A")u=O.value.toLowerCase()===pi("am",t).toLowerCase();else if(A==="Z"||A==="ZZ")p=Ro(O.value,A);else{const L=Mo(A,t,l).indexOf(O.value);if(L!==-1)switch(A){case"MMM":case"MMMM":c.set("MM",L+1);break}}}});let m=c.get("HH")||0;u===!1?(m+=m===12?0:12,c.set("HH",m===24?0:m)):u===!0&&m===12&&c.set("HH",0),c.set("MM",(c.get("MM")||1)-1);let[f,g,_,b,C,E]=Array.from(c.values());const y=Rh(new Date(`${An(f)}-${Bt(g+1)}-10`));if(y<_&&n==="throw")throw new Error(`Invalid date ${An(f)}-${Bt(g+1)}-${Bt(_)}`);_=n==="backward"?Math.min(_,y):_;const T=`${An(f)}-${Bt(g+1)}-${Bt(_)}T${Bt(b)}:${Bt(C)}:${Bt(E)}${p}`,x=new Date(T);return isFinite(+x)?x:o()}function Gh(r,e){let t=0;const i=l=>[l[t++],l[t]];let s=0;const n=[];let o;do{const[l,a]=i(e);o=a;let h=1;if(l.partName==="literal")h=l.partValue.length;else if(l.partName==="timeZoneName")h=To(r.substring(s));else if(l.token in ps)h=ps[l.token];else if(a)if(a.partName==="literal"){if(h=r.indexOf(a.partValue,s)-s,h<0)throw new Error}else if(a.partName==="dayPeriod"){for(let d=1;d<=4;d++)if(isNaN(Number(r.charAt(s+d)))){h=d;break}}else{const d=r.substring(s).search(/\d/);d!==-1&&(h=s+d)}else h=r.length;n.push({...l,value:r.substring(s,s+h)}),s+=h}while(o);return n}function Ze(r,e=!1){let t;switch(r){case S.dateTime:case S.dateTimeIso:t="YYYY-MM-DD HH:mm:ss";break;case S.dateTimeIsoAmPm:t="YYYY-MM-DD hh:mm:ss a";break;case S.dateTimeIsoAM_PM:t="YYYY-MM-DD hh:mm:ss A";break;case S.dateTimeShortIso:t="YYYY-MM-DD HH:mm";break;case S.dateEuro:t="DD/MM/YYYY";break;case S.dateEuroShort:t=e?"DD/MM/YY":"D/M/YY";break;case S.dateTimeEuro:t="DD/MM/YYYY HH:mm:ss";break;case S.dateTimeShortEuro:t=e?"DD/MM/YYYY HH:mm":"D/M/YYYY H:m";break;case S.dateTimeEuroAmPm:t="DD/MM/YYYY hh:mm:ss a";break;case S.dateTimeEuroAM_PM:t="DD/MM/YYYY hh:mm:ss A";break;case S.dateTimeEuroShort:t=e?"DD/MM/YY HH:mm:ss":"D/M/YY H:m:s";break;case S.dateTimeEuroShortAmPm:t=e?"DD/MM/YY hh:mm:ss a":"D/M/YY h:m:s a";break;case S.dateTimeEuroShortAM_PM:t=e?"DD/MM/YY hh:mm:ss A":"D/M/YY h:m:s A";break;case S.dateUs:t="MM/DD/YYYY";break;case S.dateUsShort:t=e?"MM/DD/YY":"M/D/YY";break;case S.dateTimeUs:t="MM/DD/YYYY HH:mm:ss";break;case S.dateTimeUsAmPm:t="MM/DD/YYYY hh:mm:ss a";break;case S.dateTimeUsAM_PM:t="MM/DD/YYYY hh:mm:ss A";break;case S.dateTimeUsShort:t=e?"MM/DD/YY HH:mm:ss":"M/D/YY H:m:s";break;case S.dateTimeUsShortAmPm:t=e?"MM/DD/YY hh:mm:ss a":"M/D/YY h:m:s a";break;case S.dateTimeUsShortAM_PM:t=e?"MM/DD/YY hh:mm:ss A":"M/D/YY h:m:s A";break;case S.dateTimeShortUs:t=e?"MM/DD/YYYY HH:mm":"M/D/YYYY H:m";break;case S.dateUtc:t="ISO8601";break;case S.date:case S.dateIso:default:t="YYYY-MM-DD";break}return t}function Ct(r,e,t){const i=e?Ze(e):void 0,s=Ze(t),n=r instanceof Date?r:At(r,i);return n&&r!==void 0?t===S.dateUtc?n.toISOString():Qe(n,s,"en-US"):""}function At(r,e,t=!1){try{return r?r instanceof Date?r:ms({date:r,format:e,dateOverflow:t?"throw":"backward",locale:"en-US"}):!1}catch{return!1}}function Uh(r){return Do(r,Pn(r,"utc"))}function No(r,e,t,i,s){let n=0;if(r===e)n=0;else{let o=At(r,i,s),l=At(e,i,s);o||(o=new Date(1001,1,1)),l||(l=new Date(1001,1,1)),n=o.valueOf()-l.valueOf()}return t*n}function ue(r){const e=r===S.date?void 0:Ze(r);return(t,i,s)=>e===void 0?No(t,i,s,e,!1):No(t,i,s,e,!0)}const ei={boolean:gh,date:ue(S.date),dateIso:ue(S.dateIso),dateUtc:ue(S.dateUtc),dateTime:ue(S.dateTime),dateTimeIso:ue(S.dateTimeIso),dateTimeIsoAmPm:ue(S.dateTimeIsoAmPm),dateTimeIsoAM_PM:ue(S.dateTimeIsoAM_PM),dateTimeShortIso:ue(S.dateTimeShortIso),dateEuro:ue(S.dateEuro),dateEuroShort:ue(S.dateEuroShort),dateTimeShortEuro:ue(S.dateTimeShortEuro),dateTimeEuro:ue(S.dateTimeEuro),dateTimeEuroAmPm:ue(S.dateTimeEuroAmPm),dateTimeEuroAM_PM:ue(S.dateTimeEuroAM_PM),dateTimeEuroShort:ue(S.dateTimeEuroShort),dateTimeEuroShortAmPm:ue(S.dateTimeEuroShortAmPm),dateTimeEuroShortAM_PM:ue(S.dateTimeEuroShortAM_PM),dateUs:ue(S.dateUs),dateUsShort:ue(S.dateUsShort),dateTimeShortUs:ue(S.dateTimeShortUs),dateTimeUs:ue(S.dateTimeUs),dateTimeUsAmPm:ue(S.dateTimeUsAmPm),dateTimeUsAM_PM:ue(S.dateTimeUsAM_PM),dateTimeUsShort:ue(S.dateTimeUsShort),dateTimeUsShortAmPm:ue(S.dateTimeUsShortAmPm),dateTimeUsShortAM_PM:ue(S.dateTimeUsShortAM_PM),numeric:Eo,objectString:_h,string:Th};function mi(r,e,t,i,s,n){let o=0;switch(r){case S.boolean:o=ei.boolean(e,t,i,s,n);break;case S.float:case S.integer:case S.number:o=ei.numeric(e,t,i,s,n);break;case S.date:case S.dateIso:case S.dateUtc:case S.dateTime:case S.dateTimeIso:case S.dateTimeIsoAmPm:case S.dateTimeIsoAM_PM:case S.dateTimeShortIso:case S.dateEuro:case S.dateEuroShort:case S.dateTimeShortEuro:case S.dateTimeEuro:case S.dateTimeEuroAmPm:case S.dateTimeEuroAM_PM:case S.dateTimeEuroShort:case S.dateTimeEuroShortAmPm:case S.dateTimeEuroShortAM_PM:case S.dateUs:case S.dateUsShort:case S.dateTimeShortUs:case S.dateTimeUs:case S.dateTimeUsAmPm:case S.dateTimeUsAM_PM:case S.dateTimeUsShort:case S.dateTimeUsShortAmPm:case S.dateTimeUsShortAM_PM:o=ue(r).call(this,e,t,i,s,n);break;case S.object:o=ei.objectString(e,t,i,s,n);break;case S.string:case S.text:case S.password:case S.readonly:default:o=ei.string(e,t,i,s,n);break}return o}const jh=Object.freeze(Object.defineProperty({__proto__:null,sortByFieldType:mi},Symbol.toStringTag,{value:"Module"}));var ct;(function(r){r.camelCase="camelCase",r.kebabCase="kebabCase",r.lowerCase="lowerCase",r.lowerCaseWithoutOnPrefix="lowerCaseWithoutOnPrefix"})(ct||(ct={}));class Lo{get elementSource(){return this._elementSource}set elementSource(e){this._elementSource=e}get subscribedEvents(){return this._subscribedEvents}get subscribedEventNames(){return this._subscribedEvents.map(e=>e.name)}constructor(e){this._subscribedEvents=[],this.eventNamingStyle=ct.camelCase,this._elementSource=e||document.createElement("div")}dispose(){var e;this.unsubscribeAll(),this._subscribedEvents=[],clearTimeout(this._timer),(e=this._elementSource)==null||e.remove(),this._elementSource=null}dispatchCustomEvent(e,t,i=!0,s=!0,n){var a;const o={bubbles:i,cancelable:s};t&&(o.detail=t);const l=new CustomEvent(e,o);return typeof n=="function"&&n(l),(a=this._elementSource)==null?void 0:a.dispatchEvent(l)}getEventNameByNamingConvention(e,t){let i="";switch(this.eventNamingStyle){case ct.camelCase:i=t!==""?`${t}${Jt(e)}`:e;break;case ct.kebabCase:i=t!==""?`${t}-${ui(e)}`:ui(e);break;case ct.lowerCase:i=`${t}${e}`.toLowerCase();break;case ct.lowerCaseWithoutOnPrefix:i=`${t}${e.replace(/^on/,"")}`.toLowerCase();break}return i}publish(e,t,i,s){const n=this.getEventNameByNamingConvention(e,"");return i?new Promise(o=>{clearTimeout(this._timer),this._timer=setTimeout(()=>o(this.dispatchCustomEvent(n,t,!0,!0,s)),i)}):this.dispatchCustomEvent(n,t,!0,!0,s)}subscribe(e,t){const i=this.getEventNameByNamingConvention(e,"");return this._elementSource.addEventListener(i,s=>t.call(null,s.detail)),this._subscribedEvents.push({name:i,listener:t}),{unsubscribe:()=>this.unsubscribe(i,t)}}subscribeEvent(e,t){const i=this.getEventNameByNamingConvention(e,"");return this._elementSource.addEventListener(i,t),this._subscribedEvents.push({name:i,listener:t}),{unsubscribe:()=>this.unsubscribe(i,t)}}unsubscribe(e,t,i=!0){const s=this.getEventNameByNamingConvention(e,"");this._elementSource.removeEventListener(s,t),i&&this.removeSubscribedEventWhenFound(e,t)}unsubscribeAll(e){if(Array.isArray(e)){let t;do t=e.pop(),t!=null&&t.dispose?t.dispose():t!=null&&t.unsubscribe&&t.unsubscribe();while(t)}else{let t=this._subscribedEvents.pop();for(;t;)this.unsubscribe(t.name,t.listener,!1),t=this._subscribedEvents.pop()}}removeSubscribedEventWhenFound(e,t){const i=this._subscribedEvents.findIndex(s=>s.name===e&&s.listener===t);i>=0&&this._subscribedEvents.splice(i,1)}}function fs(r){var e=document,t=r.container||e.createElement("div"),i=r.preventSubmit||0;t.id=t.id||"autocomplete-"+b();var s=t.style,n=r.debounceWaitMs||0,o=r.disableAutoSelect||!1,l=t.parentElement,a=[],h="",d=2,c=r.showOnFocus,u,p=0,m,f=!1,g=!1;if(r.minLength!==void 0&&(d=r.minLength),!r.input)throw new Error("input undefined");var _=r.input;t.className="autocomplete "+(r.className||""),t.setAttribute("role","listbox"),_.setAttribute("role","combobox"),_.setAttribute("aria-expanded","false"),_.setAttribute("aria-autocomplete","list"),_.setAttribute("aria-controls",t.id),_.setAttribute("aria-owns",t.id),_.setAttribute("aria-activedescendant",""),_.setAttribute("aria-haspopup","listbox"),s.position="absolute";function b(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function C(){var M=t.parentNode;M&&M.removeChild(t)}function E(){m&&window.clearTimeout(m)}function y(){t.parentNode||(l||e.body).appendChild(t)}function T(){return!!t.parentNode}function x(){p++,a=[],h="",u=void 0,_.setAttribute("aria-activedescendant",""),_.setAttribute("aria-expanded","false"),C()}function O(){if(!T())return;_.setAttribute("aria-expanded","true"),s.height="auto",s.width=_.offsetWidth+"px";var M=0,te;function Ne(){var Ue=e.documentElement,nt=Ue.clientTop||e.body.clientTop||0,rt=Ue.clientLeft||e.body.clientLeft||0,Ai=window.pageYOffset||Ue.scrollTop,Nt=window.pageXOffset||Ue.scrollLeft;te=_.getBoundingClientRect();var Ke=te.top+_.offsetHeight+Ai-nt,os=te.left+Nt-rt;s.top=Ke+"px",s.left=os+"px",M=window.innerHeight-(te.top+_.offsetHeight),M<0&&(M=0),s.top=Ke+"px",s.bottom="",s.left=os+"px",s.maxHeight=M+"px"}Ne(),Ne(),r.customize&&te&&r.customize(_,te,t,M)}function I(){t.textContent="",_.setAttribute("aria-activedescendant","");var M=function(rt,Ai,Nt){var Ke=e.createElement("div");return Ke.textContent=rt.label||"",Ke};r.render&&(M=r.render);var te=function(rt,Ai){var Nt=e.createElement("div");return Nt.textContent=rt,Nt};r.renderGroup&&(te=r.renderGroup);var Ne=e.createDocumentFragment(),Ue=b();if(a.forEach(function(rt,Ai){if(rt.group&&rt.group!==Ue){Ue=rt.group;var Nt=te(rt.group,h);Nt&&(Nt.className+=" group",Ne.appendChild(Nt))}var Ke=M(rt,h,Ai);Ke&&(Ke.id=t.id+"_"+Ai,Ke.setAttribute("role","option"),Ke.addEventListener("click",function(os){g=!0;try{r.onSelect(rt,_)}finally{g=!1}x(),os.preventDefault(),os.stopPropagation()}),rt===u&&(Ke.className+=" selected",Ke.setAttribute("aria-selected","true"),_.setAttribute("aria-activedescendant",Ke.id)),Ne.appendChild(Ke))}),t.appendChild(Ne),a.length<1)if(r.emptyMsg){var nt=e.createElement("div");nt.id=t.id+"_"+b(),nt.className="empty",nt.textContent=r.emptyMsg,t.appendChild(nt),_.setAttribute("aria-activedescendant",nt.id)}else{x();return}y(),O(),W()}function A(){T()&&I()}function k(){A()}function L(M){M.target!==t?A():M.preventDefault()}function N(){g||Me(0)}function W(){var M=t.getElementsByClassName("selected");if(M.length>0){var te=M[0],Ne=te.previousElementSibling;if(Ne&&Ne.className.indexOf("group")!==-1&&!Ne.previousElementSibling&&(te=Ne),te.offsetTop<t.scrollTop)t.scrollTop=te.offsetTop;else{var Ue=te.offsetTop+te.offsetHeight,nt=t.scrollTop+t.offsetHeight;Ue>nt&&(t.scrollTop+=Ue-nt)}}}function X(){var M=a.indexOf(u);u=M===-1?void 0:a[(M+a.length-1)%a.length],q(M)}function Z(){var M=a.indexOf(u);u=a.length<1?void 0:M===-1?a[0]:a[(M+1)%a.length],q(M)}function q(M){a.length>0&&(Be(M),ee(a.indexOf(u)),W())}function ee(M){var te=e.getElementById(t.id+"_"+M);te&&(te.classList.add("selected"),te.setAttribute("aria-selected","true"),_.setAttribute("aria-activedescendant",te.id))}function Be(M){var te=e.getElementById(t.id+"_"+M);te&&(te.classList.remove("selected"),te.removeAttribute("aria-selected"),_.removeAttribute("aria-activedescendant"))}function st(M,te){var Ne=T();if(te==="Escape")x();else{if(!Ne||a.length<1)return;te==="ArrowUp"?X():Z()}M.preventDefault(),Ne&&M.stopPropagation()}function ge(M){if(u){i===2&&M.preventDefault(),g=!0;try{r.onSelect(u,_)}finally{g=!1}x()}i===1&&M.preventDefault()}function xe(M){var te=M.key;switch(te){case"ArrowUp":case"ArrowDown":case"Escape":st(M,te);break;case"Enter":ge(M);break}}function Ye(){c&&Me(1)}function Me(M){_.value.length>=d||M===1?(E(),m=window.setTimeout(function(){return Pe(_.value,M,_.selectionStart||0)},M===0||M===2?n:0)):x()}function Pe(M,te,Ne){if(!f){var Ue=++p;r.fetch(M,function(nt){p===Ue&&nt&&(a=nt,h=M,u=a.length<1||o?void 0:a[0],I())},te,Ne)}}function K(M){if(r.keyup){r.keyup({event:M,fetch:function(){return Me(0)}});return}!T()&&M.key==="ArrowDown"&&Me(0)}function ce(M){r.click&&r.click({event:M,fetch:function(){return Me(2)}})}function ht(){setTimeout(function(){e.activeElement!==_&&x()},200)}function li(){Pe(_.value,3,_.selectionStart||0)}t.addEventListener("mousedown",function(M){M.stopPropagation(),M.preventDefault()}),t.addEventListener("focus",function(){return _.focus()}),C();function Mt(){_.removeEventListener("focus",Ye),_.removeEventListener("keyup",K),_.removeEventListener("click",ce),_.removeEventListener("keydown",xe),_.removeEventListener("input",N),_.removeEventListener("blur",ht),window.removeEventListener("resize",k),e.removeEventListener("scroll",L,!0),_.removeAttribute("role"),_.removeAttribute("aria-expanded"),_.removeAttribute("aria-autocomplete"),_.removeAttribute("aria-controls"),_.removeAttribute("aria-activedescendant"),_.removeAttribute("aria-owns"),_.removeAttribute("aria-haspopup"),E(),x(),f=!0}return _.addEventListener("keyup",K),_.addEventListener("click",ce),_.addEventListener("keydown",xe),_.addEventListener("input",N),_.addEventListener("blur",ht),_.addEventListener("focus",Ye),window.addEventListener("resize",k),e.addEventListener("scroll",L,!0),{destroy:Mt,fetch:li}}class gs{constructor(e){this._value=null,this._boundedEventWithListeners=[],this._elementBindings=[],this._binding=e,this._property=e.property||"",this._elementBindings=[],e.property&&e.variable&&(e.variable.hasOwnProperty(e.property)||e.property in e.variable)?this._value=e.variable[e.property]:this._value=e.variable,typeof e.variable=="object"&&Object.defineProperty(e.variable,e.property,{get:this.valueGetter.bind(this),set:this.valueSetter.bind(this)})}get boundedEventWithListeners(){return this._boundedEventWithListeners}get elementBindings(){return this._elementBindings}get property(){return this._property}dispose(){this.unbindAll(),this._boundedEventWithListeners=[],this._elementBindings=[]}valueGetter(){return this._value}valueSetter(e){if(this._value=e,Array.isArray(this._elementBindings))for(const t of this._elementBindings)t!=null&&t.element&&(t!=null&&t.attribute)&&(t.element[t.attribute]=e)}bind(e,t,i,s){return e&&e.forEach?e.forEach(n=>this.bindSingleElement(n,t,i,s)):e&&this.bindSingleElement(e,t,i,s),this}unbind(e,t,i,s,n){if(e){e.removeEventListener(t,i,s);const o=this._boundedEventWithListeners.findIndex(l=>l.uid===n);o>=0&&this._boundedEventWithListeners.splice(o,1)}}unbindAll(){let e=this._boundedEventWithListeners.pop();for(;e;){const{element:t,eventName:i,listener:s,uid:n}=e;this.unbind(t,i,s,void 0,n),e=this._boundedEventWithListeners.pop()}this._boundedEventWithListeners=[]}bindSingleElement(e,t,i,s){const n={element:e,attribute:t};if(e){if(i){const o=()=>{let l=e[t];if(this.hasData(l)&&(e==null?void 0:e.type)==="number"&&(l=+l),this.valueSetter(l),(this._binding.variable.hasOwnProperty(this._binding.property)||this._binding.property in this._binding.variable)&&(this._binding.variable[this._binding.property]=this.valueGetter()),typeof s=="function")return s(this.valueGetter())};n.event=i,n.listener=o,e.addEventListener(i,o),this._boundedEventWithListeners.push({element:e,eventName:i,listener:o,uid:this.generateUuidV4()})}this._elementBindings.push(n),e[t]=this._value}}generateUuidV4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}hasData(e){return e!=null&&e!==""}}class Ho{constructor(){this._observers=[],this._querySelectorPrefix=""}get querySelectorPrefix(){return this._querySelectorPrefix||""}set querySelectorPrefix(e){this._querySelectorPrefix=e}get observers(){return this._observers}dispose(){let e=this._observers.pop();for(;e;)e.dispose(),e=this._observers.pop();this._observers=[]}addElementBinding(e,t,i,s,n,o){const l=document.querySelectorAll(`${this.querySelectorPrefix}${i}`);let a=this._observers.find(h=>h.property===e);a||(a=new gs({variable:e,property:t})),Array.isArray(n)?n.forEach(h=>a==null?void 0:a.bind(l,s,h,o)):a==null||a.bind(l,s,n,o),this._observers.push(a)}bindEventHandler(e,t,i,s){document.querySelectorAll(`${this.querySelectorPrefix}${e}`).forEach(o=>{o!=null&&o.addEventListener&&o.addEventListener(t,i,s)})}setElementAttributeValue(e,t,i){document.querySelectorAll(`${this.querySelectorPrefix}${e}`).forEach(n=>{n.textContent="",n&&t in n&&(n[t]=i)})}}class Ae{constructor(){this._boundedEvents=[]}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(e,t,i,s,n=""){const o=Array.isArray(t)?t:[t];if(e!=null&&e.forEach)e.forEach(l=>{for(const a of o)l.addEventListener(a,i,s),this._boundedEvents.push({element:l,eventName:a,listener:i,groupName:n})});else if(e)for(const l of o)e.addEventListener(l,i,s),this._boundedEvents.push({element:e,eventName:l,listener:i,groupName:n})}unbind(e,t,i){const s=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t];for(const o of n)for(const l of s)typeof(l==null?void 0:l.removeEventListener)=="function"&&l.removeEventListener(o,i)}unbindByEventName(e,t){const i=this._boundedEvents.find(s=>s.element===e&&s.eventName===t);i&&this.unbind(i.element,i.eventName,i.listener)}unbindAll(e){if(e){const t=Array.isArray(e)?e:[e];for(let i=this._boundedEvents.length-1;i>=0;--i){const s=this._boundedEvents[i];if(t.some(n=>n===s.groupName)){const{element:n,eventName:o,listener:l}=s;this.unbind(n,o,l),this._boundedEvents.splice(i,1)}}}else for(;this._boundedEvents.length>0;){const t=this._boundedEvents.pop(),{element:i,eventName:s,listener:n}=t;this.unbind(i,s,n)}}}var Vo=Object.prototype.hasOwnProperty;function ut(r,e){var t,i;if(r===e)return!0;if(r&&e&&(t=r.constructor)===e.constructor){if(t===Date)return r.getTime()===e.getTime();if(t===RegExp)return r.toString()===e.toString();if(t===Array){if((i=r.length)===e.length)for(;i--&&ut(r[i],e[i]););return i===-1}if(!t||typeof r=="object"){i=0;for(t in r)if(Vo.call(r,t)&&++i&&!Vo.call(e,t)||!(t in e)||!ut(r[t],e[t]))return!1;return Object.keys(e).length===i}}return r!==r&&e!==e}function Bo(r,e){const t=e.fetch;t&&(e.fetch=(i,s,n,o)=>{r.classList.add("slick-autocomplete-loading");const l=s;t(i,h=>{l(h),r.classList.remove("slick-autocomplete-loading")},n,o)})}function $i(r,e,t,i){var h,d;const{oldVal:s,newVal:n,columnDef:o,selectedSettings:l,updatePickerUI:a}=i;if(s!==n){const c=r.type||o.type,u=o.outputType||r.type||o.type||S.dateUtc,p=Array.isArray(n)?n:[n||""],m=[],f=Ze(S.dateIso),g=c?Ze(c):void 0;for(const b of p){const C=b instanceof Date?b:At(b,g);C&&m.push(C)}const _=l??{dates:[m.map(b=>Qe(b,f)).join(":")],month:(h=m[0])==null?void 0:h.getMonth(),year:(d=m[0])==null?void 0:d.getFullYear(),time:g==="ISO8601"||(g||"").toLowerCase().includes("h")?Qe(m[0],"HH:mm"):void 0};ut(t.settings.selected,_)||(t.settings.selected=_,a&&(t!=null&&t.update)&&t.update({dates:!0,month:!0,year:!0,time:!0})),e.value=p.length?m.map(b=>Ct(b,void 0,u)).join(" — "):""}}function Fn(r,e){const t=v("select",{className:"form-control"});for(const i of r){const s=document.createElement("option");s.value=i.operator,e.applyHtmlCode(s,`${ao(i.operatorAlt||i.operator,3)}${i.descAlt||i.desc}`),t.appendChild(s)}return t}function Yh(r,e,t){const i=(e==null?void 0:e.filter)??{},s=(i==null?void 0:i.collectionOptions)??{};if(s&&s.collectionInsideObjectProperty){const n=s.collectionInsideObjectProperty;r=Ee(r,n)}if(!Array.isArray(r))throw new Error('Something went wrong while trying to pull the collection from the "collectionAsync" call in the Filter, the collection is not a valid array.');i.collection=r,t(r)}async function zo(r,e,t,i,s){const n=(e==null?void 0:e.filter)??{},o=(n==null?void 0:n.collectionOptions)??{};let l=null;if(r){const a=(i==null?void 0:i.isObservable(r))??!1;a&&i&&(l=await eo(i,r));const h=await r;if(Array.isArray(h)?l=h:(h==null?void 0:h.status)>=200&&h.status<300&&typeof h.json=="function"?l=await h.json():h&&h.content&&(l=h.content),!Array.isArray(l)&&(o!=null&&o.collectionInsideObjectProperty)){const d=l||h,c=o.collectionInsideObjectProperty;l=Ee(d,c||"")}if(!Array.isArray(l))throw new Error('Something went wrong while trying to pull the collection from the "collectionAsync" call in the Filter, the collection is not a valid array.');n.collection=l,t(l),a&&Xh(e,t,i,s)}return l}function Xh(r,e,t,i){const s=(r==null?void 0:r.filter)??{},n=t==null?void 0:t.createSubject();s.collectionAsync=n,i&&n&&i.push(n.subscribe(o=>Yh(o,r,e)))}function lt(r,e,t,i,s){if(i!=null&&i.enableTranslate&&(s!=null&&s.translate)){const o=ot(i);return s.translate(`${o}${r}`)}const n=i.locales||R.locales;return(n==null?void 0:n[e])??t}function qh(r,e){return[{operator:"",desc:lt("CONTAINS","TEXT_CONTAINS","Contains",r,e)},{operator:"<>",desc:lt("NOT_CONTAINS","TEXT_NOT_CONTAINS","Not Contains",r,e)},{operator:"=",desc:lt("EQUALS","TEXT_EQUALS","Equals",r,e)},{operator:"!=",desc:lt("NOT_EQUAL_TO","TEXT_NOT_EQUAL_TO","Not equal to",r,e)},{operator:"a*",desc:lt("STARTS_WITH","TEXT_STARTS_WITH","Starts with",r,e)},{operator:"*z",desc:lt("ENDS_WITH","TEXT_ENDS_WITH","Ends with",r,e)}]}function Dn(r,e){return[{operator:"",desc:""},{operator:"=",desc:lt("EQUAL_TO","TEXT_EQUAL_TO","Equal to",r,e)},{operator:"<",desc:lt("LESS_THAN","TEXT_LESS_THAN","Less than",r,e)},{operator:"<=",desc:lt("LESS_THAN_OR_EQUAL_TO","TEXT_LESS_THAN_OR_EQUAL_TO","Less than or equal to",r,e)},{operator:">",desc:lt("GREATER_THAN","TEXT_GREATER_THAN","Greater than",r,e)},{operator:">=",desc:lt("GREATER_THAN_OR_EQUAL_TO","TEXT_GREATER_THAN_OR_EQUAL_TO","Greater than or equal to",r,e)},{operator:"<>",desc:lt("NOT_EQUAL_TO","TEXT_NOT_EQUAL_TO","Not equal to",r,e)}]}function Mn(r,e,t){if(r.compoundOperatorAltTexts){for(const i of e)if(r.compoundOperatorAltTexts.hasOwnProperty(t)){const s=r.compoundOperatorAltTexts[t][i.operator];i.operatorAlt=(s==null?void 0:s.operatorAlt)||"",i.descAlt=(s==null?void 0:s.descAlt)||""}}}class Kh{constructor(e,t,i){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this.searchTerms=[],this.isFilled=!1,this.isItemSelected=!1,this.valueName="label",this.enableTranslateLabel=!1,this.subscriptions=[],this._bindEventService=new Ae}get autocompleterOptions(){return this._autocompleterOptions||{}}get collectionOptions(){var e,t;return((t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.collectionOptions)??{}}get collection(){return this._collection}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)||{}}get filterDomElement(){return this._filterElm}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.autocompleter,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get customStructure(){var i,s,n,o,l;let e=(i=this.columnFilter)==null?void 0:i.customStructure;const t=((s=this.columnFilter)==null?void 0:s.type)??((n=this.columnDef)==null?void 0:n.type);return!e&&t===S.object&&((o=this.columnDef)!=null&&o.dataKey)&&((l=this.columnDef)!=null&&l.labelKey)&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get defaultOperator(){return H.equal}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get instance(){return this._instance}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){var i,s,n,o,l,a;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this.filterContainerElm=e.filterContainerElm,!this.grid||!this.columnDef||!this.columnFilter||!this.columnFilter.collection&&!this.columnFilter.collectionAsync&&!this.columnFilter.filterOptions)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") for the AutoComplete Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: model: Filters.autocompleter, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }`);this.enableTranslateLabel=((i=this.columnFilter)==null?void 0:i.enableTranslateLabel)??!1,this.labelName=((s=this.customStructure)==null?void 0:s.label)??"label",this.valueName=((n=this.customStructure)==null?void 0:n.value)??"value",this.labelPrefixName=((o=this.customStructure)==null?void 0:o.labelPrefix)??"labelPrefix",this.labelSuffixName=((l=this.customStructure)==null?void 0:l.labelSuffix)??"labelSuffix",this._locales=((a=this.gridOptions)==null?void 0:a.locales)??R.locales;const t=this.columnFilter.collection;return this._collection=t,this.renderDomElement(t),new Promise(async(h,d)=>{try{const c=this.columnFilter.collectionAsync;let u;c&&!this.columnFilter.collection?(u=zo(c,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),h(u)):(u=t,h(t)),(c||this.columnFilter.enableCollectionWatch)&&(await(u??c),this.watchCollectionChanges())}catch(c){d(c)}})}clear(e=!0){this._filterElm&&(this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[],this._filterElm.value="",this._filterElm.dispatchEvent(new CustomEvent("input")),this.updateFilterStyle(!1))}destroy(){var e,t,i;typeof((e=this._instance)==null?void 0:e.destroy)=="function"&&this._instance.destroy(),this._filterElm,(i=(t=this._filterElm)==null?void 0:t.remove)==null||i.call(t),this._collection=void 0,this._bindEventService.unbindAll(),hs(this.subscriptions)}getValues(){var e;return((e=this._filterElm)==null?void 0:e.value)||""}setValues(e,t,i=!1){e&&this._filterElm&&(this._filterElm.value=e),this.updateFilterStyle(this.getValues()!==""),this.operator=t||this.defaultOperator,i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:[this.getValues()],shouldTriggerQuery:!0})}filterCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const s=this.columnFilter.collectionFilterBy,n=this.columnFilter.collectionOptions&&this.columnFilter.collectionOptions.filterResultAfterEachPass||null;t=((i=this.collectionService)==null?void 0:i.filterCollection(t,s,n))||[]}return t}sortCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const s=this.columnFilter.collectionSortBy;t=((i=this.collectionService)==null?void 0:i.sortCollection(this.columnDef,t,s,this.enableTranslateLabel))||[]}return t}watchCollectionChanges(){var e;(e=this.columnFilter)!=null&&e.collection&&(Pi(this.columnFilter.collection,t=>{this.renderDomElement(this.columnFilter.collection||t||[])}),ls(this.columnFilter,"collection",t=>{this.renderDomElement(t||[]),this.columnFilter.collection&&Pi(this.columnFilter.collection,i=>{this.renderDomElement(this.columnFilter.collection||i||[])})}))}renderDomElement(e){var s;if(!Array.isArray(e)&&((s=this.collectionOptions)!=null&&s.collectionInsideObjectProperty)){const n=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,n||"")}let t=e;t&&(t=this.filterCollection(t),t=this.sortCollection(t));const i=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this._collection=t,this._filterElm=this.createFilterElement(t,i),this._bindEventService.bind(this._filterElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._filterElm,"blur",()=>{this.isItemSelected||this.clear()})}createFilterElement(e,t){var l,a,h,d,c,u,p,m,f,g,_;this._collection=e;const i=((l=this.columnDef)==null?void 0:l.id)??"";J(this.filterContainerElm);let s=((a=this.gridOptions)==null?void 0:a.defaultFilterPlaceholder)??"";(h=this.columnFilter)!=null&&h.placeholder&&(s=this.columnFilter.placeholder),this._filterElm=v("input",{type:"text",ariaLabel:((d=this.columnFilter)==null?void 0:d.ariaLabel)??`${_t(i+"")} Search Filter`,autocomplete:"off",ariaAutoComplete:"none",placeholder:s,className:`form-control search-filter filter-${i} slick-autocomplete-container`,value:t??"",dataset:{columnid:`${i}`}});const n=t;Array.isArray(e)&&(e.every(b=>Bi(b))?e=e.map(b=>({label:b,value:b})):e=e.map(b=>({label:b==null?void 0:b[this.labelName],value:b==null?void 0:b[this.valueName],labelPrefix:(b==null?void 0:b[this.labelPrefixName])??"",labelSuffix:(b==null?void 0:b[this.labelSuffixName])??""}))),this._autocompleterOptions={input:this._filterElm,debounceWaitMs:200,className:`slick-autocomplete ${((c=this.filterOptions)==null?void 0:c.className)??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&((u=this.translaterService)!=null&&u.translate)?this.translaterService.translate("NO_ELEMENTS_FOUND"):((p=this._locales)==null?void 0:p.TEXT_NO_ELEMENTS_FOUND)??"No elements found",customize:(b,C,E)=>{E.style.width=""},onSelect:b=>{this.isItemSelected=!0,this.handleSelect(b)},...this.filterOptions},(m=this.gridOptions)!=null&&m.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=he(this.autocompleterOptions.className).join(" "),(f=this._autocompleterOptions.renderItem)!=null&&f.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${ui(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=((g=this._autocompleterOptions.render)==null?void 0:g.bind(this))??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),(_=this.filterOptions)!=null&&_.fetch?(Bo(this._filterElm,this._autocompleterOptions),this._instance=fs(this._autocompleterOptions)):this._instance=fs({...this._autocompleterOptions,fetch:(b,C)=>{e&&C(e.filter(E=>((typeof E=="string"?E:E==null?void 0:E.label)||"").toLowerCase().includes(b.toLowerCase())))}}),this._filterElm.value=n??"";const o=v("div",{className:"autocomplete-filter-container"});return o.appendChild(this._filterElm),o.appendChild(v("span")),t&&this._filterElm.classList.add("filled"),this.filterContainerElm.appendChild(o),this.filterContainerElm.appendChild(document.createElement("span")),this._filterElm}handleSelect(e){var t;if(e!==void 0){const s=((t=this.filterOptions)==null?void 0:t.renderItem)??!1,n=typeof e=="string"?e:s?e[this.labelName]:e.label;let o=typeof e=="string"?e:s?e[this.valueName]:e.value;o=this.trimWhitespaceWhenEnabled(o),this.updateFilterStyle(o!==""),this.setValues(n),this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:[o],shouldTriggerQuery:this._shouldTriggerQuery}),this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0}return!1}handleOnInputChange(e){var s;let t=((s=e==null?void 0:e.target)==null?void 0:s.value)??"";const i=this.filterOptions.triggerOnEveryKeyStroke??!1;if(t=this.trimWhitespaceWhenEnabled(t),this._clearFilterTriggered||t===""||i){const n={columnDef:this.columnDef,shouldTriggerQuery:this._shouldTriggerQuery};this._clearFilterTriggered?n.clearFilterTriggered=this._clearFilterTriggered:(n.operator=this.operator,n.searchTerms=[t]),this.updateFilterStyle(t!==""),this.callback(e,n)}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0}renderRegularItem(e){const t=typeof e=="string"?e:(e==null?void 0:e.label)??"";return v("div",{textContent:t||""})}renderCustomItem(e){var s,n;const t=((n=(s=this._autocompleterOptions)==null?void 0:s.renderItem)==null?void 0:n.templateCallback(e))??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){var h;const t=((h=this.columnFilter)==null?void 0:h.enableRenderHtml)??!1,i=e.labelPrefix||"",s=e.label||"",n=e.labelSuffix||"",o=i+s+n,l=this.grid.sanitizeHtmlString(o)||"",a=document.createElement("div");return a[t?"innerHTML":"textContent"]=l,a}trimWhitespaceWhenEnabled(e){let t=e;const i=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;return typeof e=="string"&&i&&(t=e.trim()),t}updateFilterStyle(e){this.isItemSelected=e,e?this._filterElm.classList.add("filled"):this._filterElm.classList.remove("filled")}}/*! name: vanilla-calendar-picker | url: https://github.com/uvarov-frontend/vanilla-calendar-picker */var Qh=Object.defineProperty,$o=Object.getOwnPropertySymbols,Zh=Object.prototype.hasOwnProperty,Jh=Object.prototype.propertyIsEnumerable,Nn=(r,e,t)=>e in r?Qh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wo=(r,e)=>{for(var t in e||(e={}))Zh.call(e,t)&&Nn(r,t,e[t]);if($o)for(var t of $o(e))Jh.call(e,t)&&Nn(r,t,e[t]);return r},Y=(r,e,t)=>(Nn(r,typeof e!="symbol"?e+"":e,t),t);const ed={calendar:"vanilla-calendar",calendarDefault:"vanilla-calendar_default",calendarMultiple:"vanilla-calendar_multiple",calendarMonth:"vanilla-calendar_month",calendarYear:"vanilla-calendar_year",calendarHidden:"vanilla-calendar_hidden",calendarToInput:"vanilla-calendar_to-input",calendarToInputTop:"vanilla-calendar_to-input_top",calendarToInputBottom:"vanilla-calendar_to-input_bottom",controls:"vanilla-calendar-controls",grid:"vanilla-calendar-grid",gridDisabled:"vanilla-calendar-grid_disabled",column:"vanilla-calendar-column",columnMonth:"vanilla-calendar-column_month",columnYear:"vanilla-calendar-column_year",header:"vanilla-calendar-header",headerContent:"vanilla-calendar-header__content",month:"vanilla-calendar-month",monthDisabled:"vanilla-calendar-month_disabled",year:"vanilla-calendar-year",yearDisabled:"vanilla-calendar-year_disabled",arrow:"vanilla-calendar-arrow",arrowPrev:"vanilla-calendar-arrow_prev",arrowNext:"vanilla-calendar-arrow_next",wrapper:"vanilla-calendar-wrapper",content:"vanilla-calendar-content",week:"vanilla-calendar-week",weekDay:"vanilla-calendar-week__day",weekDayWeekend:"vanilla-calendar-week__day_weekend",days:"vanilla-calendar-days",daysSelecting:"vanilla-calendar-days_selecting",months:"vanilla-calendar-months",monthsSelecting:"vanilla-calendar-months_selecting",monthsMonth:"vanilla-calendar-months__month",monthsMonthSelected:"vanilla-calendar-months__month_selected",monthsMonthDisabled:"vanilla-calendar-months__month_disabled",years:"vanilla-calendar-years",yearsSelecting:"vanilla-calendar-years_selecting",yearsYear:"vanilla-calendar-years__year",yearsYearSelected:"vanilla-calendar-years__year_selected",yearsYearDisabled:"vanilla-calendar-years__year_disabled",time:"vanilla-calendar-time",timeContent:"vanilla-calendar-time__content",timeHours:"vanilla-calendar-time__hours",timeMinutes:"vanilla-calendar-time__minutes",timeKeeping:"vanilla-calendar-time__keeping",timeRanges:"vanilla-calendar-time__ranges",timeRange:"vanilla-calendar-time__range",day:"vanilla-calendar-day",dayHoverFirst:"vanilla-calendar-day_hover-first",dayHoverLast:"vanilla-calendar-day_hover-last",dayHoverIntermediate:"vanilla-calendar-day_hover-intermediate",daySelectedFirst:"vanilla-calendar-day_selected-first",daySelectedLast:"vanilla-calendar-day_selected-last",daySelectedIntermediate:"vanilla-calendar-day_selected-intermediate",dayPopup:"vanilla-calendar-day__popup",dayBtn:"vanilla-calendar-day__btn",dayBtnPrev:"vanilla-calendar-day__btn_prev",dayBtnNext:"vanilla-calendar-day__btn_next",dayBtnToday:"vanilla-calendar-day__btn_today",dayBtnSelected:"vanilla-calendar-day__btn_selected",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnWeekend:"vanilla-calendar-day__btn_weekend",dayBtnHoliday:"vanilla-calendar-day__btn_holiday",weekNumbers:"vanilla-calendar-week-numbers",weekNumbersTitle:"vanilla-calendar-week-numbers__title",weekNumbersContent:"vanilla-calendar-week-numbers__content",weekNumber:"vanilla-calendar-week-number",isFocus:"vanilla-calendar-is-focus"},td=r=>`<div class="${r.header}"><#ArrowPrev /><div class="${r.headerContent}"><#Month /><#Year /></div><#ArrowNext /></div><div class="${r.wrapper}"><#WeekNumbers /><div class="${r.content}"><#Week /><#Days /></div></div><#ControlTime />`,id=r=>`<div class="${r.controls}"><#ArrowPrev /><#ArrowNext /></div><div class="${r.grid}"><#Multiple><div class="${r.column}"><div class="${r.header}"><div class="${r.headerContent}"><#Month /><#Year /></div></div><div class="${r.wrapper}"><#WeekNumbers /><div class="${r.content}"><#Week /><#Days /></div></div></div><#/Multiple></div><#ControlTime />`,sd=r=>`<div class="${r.header}"><div class="${r.headerContent}"><#Month /><#Year /></div></div><div class="${r.wrapper}"><div class="${r.content}"><#Months /></div></div>`,nd=r=>`<div class="${r.header}"><#ArrowPrev /><div class="${r.headerContent}"><#Month /><#Year /></div><#ArrowNext /></div><div class="${r.wrapper}"><div class="${r.content}"><#Years /></div></div>`;class rd{constructor(){Y(this,"isInit",!1),Y(this,"isInputInit",!1),Y(this,"input",!1),Y(this,"type","default"),Y(this,"months",2),Y(this,"jumpMonths",1),Y(this,"toggleSelected",!0),Y(this,"jumpToSelectedDate",!1),Y(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),Y(this,"settings",{lang:"en",iso8601:!0,range:{min:this.date.min,max:this.date.max,disablePast:!1,disableGaps:!1,edgesOnly:!1,disableAllDays:!1,disableWeekday:void 0,disabled:void 0,enabled:void 0},selection:{day:"single",month:!0,year:!0,time:!1,controlTime:"all",stepHours:1,stepMinutes:1,cancelableDay:!0},selected:{dates:void 0,month:void 0,year:void 0,holidays:void 0,time:void 0},visibility:{theme:"system",themeDetect:"html[data-theme]",monthShort:!0,weekNumbers:!1,weekend:!0,today:!0,disabled:!1,daysOutside:!0,positionToInput:"left"}}),Y(this,"locale",{months:[],weekday:[]}),Y(this,"sanitizer",e=>e),Y(this,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,getMonths:null,getYears:null,initCalendar:null,updateCalendar:null,destroyCalendar:null,showCalendar:null,hideCalendar:null}),Y(this,"popups",{}),Y(this,"CSSClasses",Wo({},ed)),Y(this,"DOMTemplates",{default:td(this.CSSClasses),multiple:id(this.CSSClasses),month:sd(this.CSSClasses),year:nd(this.CSSClasses)}),Y(this,"HTMLElement"),Y(this,"HTMLOriginalElement"),Y(this,"HTMLInputElement"),Y(this,"rangeMin"),Y(this,"rangeMax"),Y(this,"rangeDisabled"),Y(this,"rangeEnabled"),Y(this,"selectedDates"),Y(this,"selectedHolidays"),Y(this,"selectedMonth"),Y(this,"selectedYear"),Y(this,"selectedHours"),Y(this,"selectedMinutes"),Y(this,"selectedKeeping"),Y(this,"selectedTime"),Y(this,"currentType"),Y(this,"correctMonths"),Y(this,"viewYear"),Y(this,"dateMin"),Y(this,"dateMax")}}const vt=r=>`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`,fe=r=>new Date(`${r}T00:00:00`),fi=r=>r.reduce((e,t)=>{if(t instanceof Date||typeof t=="number"){const i=t instanceof Date?t:new Date(t);e.push(i.toISOString().substring(0,10))}else t.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(t):t.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,(i,s,n)=>{const o=fe(s),l=fe(n),a=new Date(o.getTime());for(;a<=l;a.setDate(a.getDate()+1))e.push(vt(a));return i});return e},[]),Go=()=>{const r=new Date;return new Date(r.getTime()-6e4*r.getTimezoneOffset()).toISOString().substring(0,10)},Wi=r=>r?{0:"12",13:"01",14:"02",15:"03",16:"04",17:"05",18:"06",19:"07",20:"08",21:"09",22:"10",23:"11"}[Number(r)]||String(r):"",gi={notFoundSelector:r=>`${r} is not found, check the first argument passed to new VanillaCalendar.`,notInit:'The calendar has not been initialized, please initialize it using the "init()" method first.',notLocale:'You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".',incorrectTheme:'Incorrect name of theme in "settings.visibility.theme".',incorrectTime:"The value of the time property can be: false, true, 12 or 24."},od=r=>{var e;if(r.jumpToSelectedDate&&((e=r.settings.selected.dates)!=null&&e.length)&&r.settings.selected.month===void 0&&r.settings.selected.year===void 0){const s=fe(fi(r.settings.selected.dates)[0]);r.settings.selected.month=s.getMonth(),r.settings.selected.year=s.getFullYear()}const t=r.settings.selected.month!==void 0&&Number(r.settings.selected.month)>=0&&Number(r.settings.selected.month)<12,i=r.settings.selected.year!==void 0&&Number(r.settings.selected.year)>=0&&Number(r.settings.selected.year)<=9999;r.selectedMonth=t?Number(r.settings.selected.month):r.date.today.getMonth(),r.selectedYear=i?Number(r.settings.selected.year):r.date.today.getFullYear(),r.viewYear=r.selectedYear},ld=r=>{var e,t,i;r.settings.range.min==="today"&&(r.settings.range.min=Go()),r.settings.range.max==="today"&&(r.settings.range.max=Go()),r.settings.range.min=fe(r.date.min)>=fe(r.settings.range.min)?r.date.min:r.settings.range.min,r.settings.range.max=fe(r.date.max)<=fe(r.settings.range.max)?r.date.max:r.settings.range.max;const s=r.settings.range.disablePast&&!r.settings.range.disableAllDays&&fe(r.settings.range.min)<r.date.today;r.rangeMin=s||r.settings.range.disableAllDays?vt(r.date.today):r.settings.range.min,r.rangeMax=r.settings.range.disableAllDays?vt(r.date.today):r.settings.range.max,r.rangeDisabled=r.settings.range.disabled&&!r.settings.range.disableAllDays?fi(r.settings.range.disabled):r.settings.range.disableAllDays?[r.rangeMin]:[],r.rangeDisabled.length>1&&r.rangeDisabled.sort((n,o)=>+new Date(n)-+new Date(o)),r.rangeEnabled=r.settings.range.enabled?fi(r.settings.range.enabled):[],(e=r.rangeEnabled)!=null&&e[0]&&((t=r.rangeDisabled)!=null&&t[0])&&(r.rangeDisabled=r.rangeDisabled.filter(n=>!r.rangeEnabled.includes(n))),r.rangeEnabled.length>1&&r.rangeEnabled.sort((n,o)=>+new Date(n)-+new Date(o)),(i=r.rangeEnabled)!=null&&i[0]&&r.settings.range.disableAllDays&&(r.rangeMin=r.rangeEnabled[0],r.rangeMax=r.rangeEnabled[r.rangeEnabled.length-1])},ad=r=>{var e,t;r.selectedDates=(e=r.settings.selected.dates)!=null&&e[0]?fi(r.settings.selected.dates):[],r.selectedHolidays=(t=r.settings.selected.holidays)!=null&&t[0]?fi(r.settings.selected.holidays):[]},hd=r=>{r.dateMin=r.settings.visibility.disabled?fe(r.date.min):fe(r.rangeMin),r.dateMax=r.settings.visibility.disabled?fe(r.date.max):fe(r.rangeMax)},dd=r=>{const e=r.settings.selection.time===!0||r.settings.selection.time===12;if(e||r.settings.selection.time===24){let t=!1;if(typeof r.settings.selected.time=="string"){const i=e?/^([0-9]|0[1-9]|1[0-2]):([0-5][0-9])|(AM|PM)/g:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])/g;r.settings.selected.time.replace(i,(s,n,o,l)=>(n&&o&&(t=!0,r.selectedHours=n,r.selectedMinutes=o),l&&e?r.selectedKeeping=l:e&&(r.selectedKeeping="AM"),""))}!t&&e?(r.selectedHours=Wi(String(r.date.today.getHours())),r.selectedMinutes=String(r.date.today.getMinutes()),r.selectedKeeping=Number(r.date.today.getHours())>=12?"PM":"AM"):t||(r.selectedHours=String(r.date.today.getHours()),r.selectedMinutes=String(r.date.today.getMinutes())),r.selectedHours=Number(r.selectedHours)<10?`0${Number(r.selectedHours)}`:`${r.selectedHours}`,r.selectedMinutes=Number(r.selectedMinutes)<10?`0${Number(r.selectedMinutes)}`:`${r.selectedMinutes}`,r.selectedTime=`${r.selectedHours}:${r.selectedMinutes}${r.selectedKeeping?` ${r.selectedKeeping}`:""}`}else if(r.settings.selection.time)throw new Error(gi.incorrectTime)},cd=r=>{r.correctMonths=r.type==="multiple"?r.months===1?2:r.months>12?12:r.months:1},Uo=r=>{r.currentType=r.type,od(r),ld(r),ad(r),hd(r),dd(r),cd(r)},jo=({arrowPrev:r,arrowNext:e,isPrevHidden:t,isNextHidden:i})=>{r.style.visibility=t?"hidden":"",e.style.visibility=i?"hidden":""},Ln=r=>{var e,t;if(r.currentType==="month")return;const i=(e=r.HTMLElement)==null?void 0:e.querySelector(`.${r.CSSClasses.arrowPrev}`),s=(t=r.HTMLElement)==null?void 0:t.querySelector(`.${r.CSSClasses.arrowNext}`);!i||!s||{default:()=>{const n=fe(vt(new Date(r.selectedYear,r.selectedMonth,1))),o=new Date(n.getTime()),l=new Date(n.getTime());o.setMonth(o.getMonth()-r.jumpMonths),l.setMonth(l.getMonth()+r.jumpMonths),r.settings.selection.year||(r.dateMin.setFullYear(n.getFullYear()),r.dateMax.setFullYear(n.getFullYear()));const a=!r.settings.selection.month||o.getFullYear()<r.dateMin.getFullYear()||o.getFullYear()===r.dateMin.getFullYear()&&o.getMonth()<r.dateMin.getMonth(),h=!r.settings.selection.month||l.getFullYear()>r.dateMax.getFullYear()||l.getFullYear()===r.dateMax.getFullYear()&&l.getMonth()>r.dateMax.getMonth();jo({arrowPrev:i,arrowNext:s,isPrevHidden:a,isNextHidden:h})},year:()=>{jo({arrowPrev:i,arrowNext:s,isPrevHidden:r.dateMin.getFullYear()&&r.viewYear-7<=r.dateMin.getFullYear(),isNextHidden:r.dateMax.getFullYear()&&r.viewYear+7>=r.dateMax.getFullYear()})}}[r.currentType==="multiple"?"default":r.currentType]()},Yo=(r,e)=>{if(!r)return null;const t=fe(r),i=e?t.getDay()||7:t.getDay();t.setDate(t.getDate()+4-i);const s=new Date(t.getFullYear(),0,1),n=Math.ceil(((+t-+s)/864e5+1)/7);return{year:t.getFullYear(),week:n}},ud=(r,e,t,i)=>{const s=t.querySelector(`[data-calendar-day="${r}"]`);s&&(e!=null&&e.modifier&&s.classList.add(...e.modifier.trim().split(" ")),e!=null&&e.html&&(s.parentElement.innerHTML+=`<div class="${i}">${e.html}</div>`))},pd=(r,e)=>{var t;r.popups&&((t=Object.entries(r.popups))==null||t.forEach(([i,s])=>ud(i,s,e,r.CSSClasses.dayPopup)))},md=(r,e,t,i,s)=>{const n=e[t].querySelector(`.${r.CSSClasses.dayBtn}`),o=Yo(n==null?void 0:n.dataset.calendarDay,r.settings.iso8601);if(!o)return;const l=i.cloneNode(!0);l.innerText=String(o.week),l.dataset.calendarYearWeek=String(o.year),s.appendChild(l)},fd=(r,e,t,i,s)=>{if(!r.settings.visibility.weekNumbers)return;i.textContent="";const n=document.createElement("b");n.className=r.CSSClasses.weekNumbersTitle,n.innerText="#",i.appendChild(n);const o=document.createElement("div");o.className=r.CSSClasses.weekNumbersContent,i.appendChild(o);const l=document.createElement("button");l.type="button",l.className=r.CSSClasses.weekNumber;const a=s.querySelectorAll(`.${r.CSSClasses.day}`),h=Math.ceil((e+t)/7);for(let d=0;d<h;d++)md(r,a,d===0?6:7*d,l,o)},gd=(r,e,t)=>{var i,s,n,o,l;const a=(i=r.settings.range.disableWeekday)==null?void 0:i.includes(t),h=r.settings.range.disableAllDays&&!!((s=r.rangeEnabled)!=null&&s[0]);!a&&!h||(n=r.rangeEnabled)!=null&&n.includes(e)||(o=r.rangeDisabled)!=null&&o.includes(e)||(r.rangeDisabled.push(e),(l=r.rangeDisabled)==null||l.sort((d,c)=>+new Date(d)-+new Date(c)))},_d=(r,e,t,i,s,n,o)=>{var l,a,h;if((fe(r.rangeMin)>fe(n)||fe(r.rangeMax)<fe(n)||(l=r.rangeDisabled)!=null&&l.includes(n)||!r.settings.selection.month&&o||!r.settings.selection.year&&fe(n).getFullYear()!==e)&&(i.classList.add(r.CSSClasses.dayBtnDisabled),i.tabIndex=-1),r.settings.visibility.today&&vt(r.date.today)===n&&i.classList.add(r.CSSClasses.dayBtnToday),!r.settings.visibility.weekend||s!==0&&s!==6||i.classList.add(r.CSSClasses.dayBtnWeekend),(a=r.selectedHolidays)!=null&&a.includes(n)&&i.classList.add(r.CSSClasses.dayBtnHoliday),(h=r.selectedDates)!=null&&h.includes(n)&&(i.classList.add(r.CSSClasses.dayBtnSelected),r.selectedDates.length>1&&r.settings.selection.day==="multiple-ranged"&&(r.selectedDates[0]===n&&t.classList.add(r.CSSClasses.daySelectedFirst),r.selectedDates[r.selectedDates.length-1]===n&&t.classList.add(r.CSSClasses.daySelectedLast),r.selectedDates[0]!==n&&r.selectedDates[r.selectedDates.length-1]!==n&&t.classList.add(r.CSSClasses.daySelectedIntermediate))),r.settings.range.edgesOnly&&r.selectedDates.length>1&&r.settings.selection.day==="multiple-ranged"){const d=+new Date(r.selectedDates[0]),c=+new Date(r.selectedDates[r.selectedDates.length-1]),u=+new Date(n);u>d&&u<c&&(i.classList.add(r.CSSClasses.dayBtnSelected),t.classList.add(r.CSSClasses.daySelectedIntermediate))}},Hn=(r,e,t,i,s,n,o,l)=>{const a=document.createElement("div");a.className=r.CSSClasses.day;const h=document.createElement("button");h.className=`${r.CSSClasses.dayBtn}${l?` ${l}`:""}`,h.type="button",h.innerText=String(i),h.dataset.calendarDay=n,r.settings.visibility.weekNumbers&&(()=>{const d=Yo(n,r.settings.iso8601);d&&(h.dataset.calendarWeekNumber=String(d.week))})(),o?r.settings.visibility.daysOutside&&a.appendChild(h):a.appendChild(h),gd(r,n,s),_d(r,e,a,h,s,n,o),t.appendChild(a),r.actions.getDays&&r.actions.getDays(i,n,a,h,r)},Cd=(r,e,t,i,s)=>{let n=new Date(t,i,0).getDate()-(s-1);const o=i===0?t-1:t,l=i===0?12:i<10?`0${i}`:i;for(let a=s;a>0;a--,n++){const h=`${o}-${l}-${n}`,d=fe(h).getDay();Hn(r,t,e,n,d,h,!0,r.CSSClasses.dayBtnPrev)}},vd=(r,e,t,i,s)=>{for(let n=1;n<=t;n++){const o=new Date(i,s,n),l=vt(o),a=o.getDay();Hn(r,i,e,n,a,l,!1,null)}},bd=(r,e,t,i,s,n)=>{const o=n+t,l=7*Math.ceil(o/7)-o,a=s+1===12?i+1:i,h=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let d=1;d<=l;d++){const c=`${a}-${h}-${d<10?`0${d}`:String(d)}`,u=fe(c).getDay();Hn(r,i,e,d,u,c,!0,r.CSSClasses.dayBtnNext)}},_s=r=>{const e=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.days}`),t=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.weekNumbers}`),i=new Date(r.selectedYear,r.selectedMonth,1);e.forEach((s,n)=>{const o=new Date(i);o.setMonth(o.getMonth()+n);const l=o.getMonth(),a=o.getFullYear(),h=new Date(a,l,1),d=new Date(a,l+1,0).getDate(),c=r.settings.iso8601?(h.getDay()!==0?h.getDay():7)-1:h.getDay();r.settings.selection.day&&s.classList.add(r.CSSClasses.daysSelecting),s.textContent="",Cd(r,s,a,l,c),vd(r,s,d,a,l),bd(r,s,d,a,l,c),fd(r,c,d,t[n],s),pd(r,s)})},Sd=(r,e,t,i)=>{const s=new Date(i.setMonth(r.selectedMonth+t)).getMonth(),n=r.settings.selection.month===!1||r.settings.selection.month==="only-arrows";e.tabIndex=n?-1:0,e.classList.toggle(r.CSSClasses.monthDisabled,n),e.setAttribute("data-calendar-selected-month",String(s)),e.innerText=r.locale.months[s]},yd=(r,e,t,i)=>{const s=new Date(i.setFullYear(r.selectedYear,r.selectedMonth+t)).getFullYear(),n=r.settings.selection.year===!1||r.settings.selection.year==="only-arrows";e.tabIndex=n?-1:0,e.classList.toggle(r.CSSClasses.yearDisabled,n),e.setAttribute("data-calendar-selected-year",String(s)),e.innerText=String(s)},Cs=r=>{var e,t;const i=(e=r.HTMLElement)==null?void 0:e.querySelectorAll("[data-calendar-selected-month]"),s=(t=r.HTMLElement)==null?void 0:t.querySelectorAll("[data-calendar-selected-year]");if(!(i!=null&&i[0])&&(s!=null&&s[0]))return;const n=new Date(r.selectedYear,r.selectedMonth,1);i==null||i.forEach((o,l)=>Sd(r,o,l,n)),s==null||s.forEach((o,l)=>yd(r,o,l,n))},Vn=(r,e)=>{const t=fe(vt(new Date(r.selectedYear,r.selectedMonth,1)));({prev:()=>t.setMonth(t.getMonth()-r.jumpMonths),next:()=>t.setMonth(t.getMonth()+r.jumpMonths)})[e](),[r.selectedMonth,r.selectedYear]=[t.getMonth(),t.getFullYear()],Cs(r),Ln(r),_s(r)},Ed=r=>`<button type="button"class="${r.CSSClasses.arrow} ${r.CSSClasses.arrowPrev}"data-calendar-arrow="prev"></button>`,wd=r=>`<button type="button"class="${r.CSSClasses.arrow} ${r.CSSClasses.arrowNext}"data-calendar-arrow="next"></button>`,Td=r=>`<button type="button"class="${r.CSSClasses.month}"data-calendar-selected-month></button>`,Od=r=>`<button type="button"class="${r.CSSClasses.year}"data-calendar-selected-year></button>`,xd=r=>`<div class="${r.CSSClasses.week}"></div>`,Id=r=>`<div class="${r.CSSClasses.days}"></div>`,Rd=r=>`<div class="${r.CSSClasses.months}"></div>`,Ad=r=>`<div class="${r.CSSClasses.years}"></div>`,Pd=r=>r.settings.visibility.weekNumbers?`<div class="${r.CSSClasses.weekNumbers}"></div>`:"",kd=r=>r.settings.selection.time?`<div class="${r.CSSClasses.time}"></div>`:"",Fd=Object.freeze(Object.defineProperty({__proto__:null,ArrowNext:wd,ArrowPrev:Ed,ControlTime:kd,Days:Id,Month:Td,Months:Rd,Week:xd,WeekNumbers:Pd,Year:Od,Years:Ad},Symbol.toStringTag,{value:"Module"})),Dd=r=>Fd[r],Gi=(r,e)=>e.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,(t,i)=>{const s=Dd(i.replace(/[/\s\n\t]/g,"")),n=s?s(r):"";return r.sanitizer(n)}).replace(/[\n\t]/g,""),Md=(r,e)=>e.replace(/<#Multiple>(.*?)<#\/Multiple>/g,(t,i)=>{let s="";for(let n=0;n<r.correctMonths;n++)s+=i;return r.sanitizer(s)}).replace(/[\n\t]/g,""),Bn=(r,e)=>{const{HTMLElement:t,CSSClasses:i,DOMTemplates:s,type:n,currentType:o,correctMonths:l}=r,a=(d,c)=>{if(!e)return;const u=t.querySelector(`.${i.controls}`);u&&t.removeChild(u),t.querySelector(`.${i.grid}`).classList.add(i.gridDisabled);const p=e.closest(`.${i.column}`);p.classList.add(d),p.innerHTML=Gi(r,c)},h={default:()=>{t.classList.add(i.calendarDefault),t.classList.remove(i.calendarMonth,i.calendarYear),t.innerHTML=Gi(r,s.default)},multiple:()=>{l&&(t.classList.add(i.calendarMultiple),t.classList.remove(i.calendarMonth,i.calendarYear),t.innerHTML=Md(r,Gi(r,s.multiple)))},month:()=>{n!=="multiple"?(t.classList.add(i.calendarMonth),t.classList.remove(i.calendarDefault,i.calendarYear),t.innerHTML=Gi(r,s.month)):a(i.columnMonth,s.month)},year:()=>{n!=="multiple"?(t.classList.add(i.calendarYear),t.classList.remove(i.calendarDefault,i.calendarMonth),t.innerHTML=Gi(r,s.year)):a(i.columnYear,s.year)}};t.classList.add(i.calendar),h[o]()},Nd=(r,e,t,i,s)=>{const n=e.cloneNode(!1);return n.className=`${r.CSSClasses.yearsYear}${t===s?` ${r.CSSClasses.yearsYearSelected}`:i?` ${r.CSSClasses.yearsYearDisabled}`:""}`,n.dataset.calendarYear=String(s),n.title=String(s),n.innerText=String(s),i&&(n.tabIndex=-1),n},zn=(r,e)=>{const t=e!=null&&e.dataset.calendarSelectedYear?Number(e==null?void 0:e.dataset.calendarSelectedYear):r.selectedYear;r.currentType="year",Bn(r,e),Cs(r),Ln(r);const i=r.HTMLElement.querySelector(`.${r.CSSClasses.years}`);if(!r.settings.selection.year||!i)return;i.classList.add(r.CSSClasses.yearsSelecting);const s=r.type!=="multiple"||r.selectedYear===t?0:1,n=document.createElement("button");n.type="button";for(let o=r.viewYear-7;o<r.viewYear+8;o++){const l=o<r.dateMin.getFullYear()+s||o>r.dateMax.getFullYear(),a=Nd(r,n,t,l,o);i.appendChild(a),r.actions.getYears&&r.actions.getYears(o,a,r)}},Ld=(r,e)=>{const t=e.target.closest(`.${r.CSSClasses.arrow}`);t&&(["default","multiple"].includes(r.currentType)?Vn(r,t.dataset.calendarArrow):r.currentType==="year"&&r.viewYear!==void 0&&(r.viewYear+={prev:-15,next:15}[t.dataset.calendarArrow],zn(r,e.target)),r.actions.clickArrow&&r.actions.clickArrow(e,r))},Hd=(r,e)=>{var t;if(!r.settings.visibility.weekNumbers||!r.actions.clickWeekNumber)return;const i=e.target.closest(`.${r.CSSClasses.weekNumber}`),s=(t=r.HTMLElement)==null?void 0:t.querySelectorAll("[data-calendar-week-number]");if(!i||!s)return;const n=Number(i.innerText),o=Number(i.dataset.calendarYearWeek),l=Array.from(s).filter(a=>Number(a.dataset.calendarWeekNumber)===n);r.actions.clickWeekNumber(e,n,l,o,r)},Xo=r=>`${r.charAt(0).toUpperCase()}${r.substring(1,r.length)}`.replace(/\./,""),Vd=(r,e)=>{const t=new Date(`1978-01-0${e+1}T00:00:00.000Z`).toLocaleString(r.settings.lang,{weekday:"short",timeZone:"UTC"});r.locale.weekday.push(Xo(t))},Bd=(r,e)=>{const t=new Date(`1978-${e+1<=9?`0${e+1}`:e+1}-01T00:00:00.000Z`).toLocaleString(r.settings.lang,{month:"long",timeZone:"UTC"});r.locale.months.push(Xo(t))},zd=r=>{if(r.settings.lang!=="define"||!r.locale.weekday[6]||!r.locale.months[11]){if(r.settings.lang==="define")throw new Error(gi.notLocale);r.locale.weekday=[],r.locale.months=[];for(let e=0;e<7;e++)Vd(r,e);for(let e=0;e<12;e++)Bd(r,e)}},qo=r=>{if(r.type!=="multiple")return 0;const e=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.column}`),t=Array.from(e).findIndex(i=>i.classList.contains(`${r.CSSClasses.columnMonth}`));return t>0?t:0},$d=(r,e,t,i,s,n)=>{const o=e.cloneNode(!1);return o.className=`${r.CSSClasses.monthsMonth}${t===n?` ${r.CSSClasses.monthsMonthSelected}`:s?` ${r.CSSClasses.monthsMonthDisabled}`:""}`,o.title=i,o.innerText=`${r.settings.visibility.monthShort?i.substring(0,3):i}`,o.dataset.calendarMonth=String(n),s&&(o.tabIndex=-1),o},Ko=(r,e)=>{var t,i;const s=e!=null&&e.dataset.calendarSelectedMonth?Number(e.dataset.calendarSelectedMonth):r.selectedMonth,n=(t=e==null?void 0:e.closest(`.${r.CSSClasses.column}`))==null?void 0:t.querySelector(`.${r.CSSClasses.year}`),o=n?Number(n.dataset.calendarSelectedYear):r.selectedYear;r.currentType="month",Bn(r,e),Cs(r);const l=(i=r.HTMLElement)==null?void 0:i.querySelector(`.${r.CSSClasses.months}`);if(!r.settings.selection.month||!l)return;l.classList.add(r.CSSClasses.monthsSelecting);const a=r.jumpMonths>1?r.locale.months.map((d,c)=>s-r.jumpMonths*c).concat(r.locale.months.map((d,c)=>s+r.jumpMonths*c)).filter(d=>d>=0&&d<=12):Array.from(Array(12).keys()),h=document.createElement("button");h.type="button";for(let d=0;d<12;d++){const c=r.locale.months[d],u=d<r.dateMin.getMonth()+qo(r)&&o<=r.dateMin.getFullYear()||d>r.dateMax.getMonth()+qo(r)&&o>=r.dateMax.getFullYear()||d!==s&&!a.includes(d),p=$d(r,h,s,c,u,d);l.appendChild(p),r.actions.getMonths&&r.actions.getMonths(d,p,r)}},$n=(r,e)=>r&&e?{0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"12",PM:"12"}}[Number(r)][e]:"",vs=(r,e,t)=>r.querySelector(`.${e}${t?` input[name="${t}"]`:""}`),Qo=(r,e,t)=>{r.addEventListener("mouseover",()=>e.classList.add(t)),r.addEventListener("mouseout",()=>e.classList.remove(t))},ti=(r,e,t,i)=>{({hours:()=>{r.selectedHours=t},minutes:()=>{r.selectedMinutes=t}})[i](),r.selectedTime=`${r.selectedHours}:${r.selectedMinutes}${r.selectedKeeping?` ${r.selectedKeeping}`:""}`,r.actions.changeTime&&r.actions.changeTime(e,r),r.input&&r.HTMLInputElement&&r.actions.changeToInput&&r.actions.changeToInput(e,r)},Zo=(r,e,t,i,s,n)=>{e.addEventListener("input",o=>{const l=o.target,a=Number(l.value),h=a<10?`0${a}`:`${a}`;if(s!=="hours"||n!==12)return t.value=h,void ti(r,o,h,s);a<n&&a>0?(t.value=h,r.selectedKeeping="AM",i.innerText=r.selectedKeeping,ti(r,o,h,s)):(a===0?(r.selectedKeeping="AM",i.innerText="AM"):(r.selectedKeeping="PM",i.innerText="PM"),t.value=Wi(l.value),ti(r,o,Wi(l.value),s))})},Jo=(r,e,t,i,s,n)=>{t.addEventListener("change",o=>{const l=o.target,a=Number(l.value),h=a<10?`0${a}`:`${a}`;s==="hours"&&n===12?l.value&&a<=n&&a>0?(l.value=h,e.value=$n(h,r.selectedKeeping),ti(r,o,h,s)):l.value&&a<24&&(a>n||a===0)?(a===0?(r.selectedKeeping="AM",i.innerText="AM"):(r.selectedKeeping="PM",i.innerText="PM"),l.value=Wi(l.value),e.value=h,ti(r,o,Wi(l.value),s)):l.value=r.selectedHours:l.value&&a<=n&&a>=0?(l.value=h,e.value=h,ti(r,o,h,s)):s==="hours"?l.value=r.selectedHours:s==="minutes"&&(l.value=r.selectedMinutes)})},Wd=(r,e,t)=>{e.addEventListener("click",i=>{r.selectedKeeping=e.innerText.includes("AM")?"PM":"AM",e.innerText=r.selectedKeeping,t.value=$n(r.selectedHours,r.selectedKeeping),ti(r,i,r.selectedHours,"hours")})},Gd=(r,e,t)=>{const i=t===24?23:t||12,s=vs(e,r.CSSClasses.timeRange,"hours"),n=vs(e,r.CSSClasses.timeRange,"minutes"),o=vs(e,r.CSSClasses.timeHours,"hours"),l=vs(e,r.CSSClasses.timeMinutes,"minutes"),a=e.querySelector(`.${r.CSSClasses.timeKeeping}`);Qo(s,o,r.CSSClasses.isFocus),Qo(n,l,r.CSSClasses.isFocus),Zo(r,s,o,a,"hours",i),Zo(r,n,l,a,"minutes",0),Jo(r,s,o,a,"hours",i),Jo(r,n,l,a,"minutes",59),a&&Wd(r,a,s)},el=(r,e,t,i)=>`<label class="${e}"><input type="text"name="${r}"maxlength="2"value="${t}"${i?"disabled":""}></label>`,tl=(r,e,t,i,s,n)=>`<label class="${e}"><input type="range"name="${r}"min="${t}"max="${i}"step="${s}"value="${n}"></label>`,Ud=r=>{const e=r.HTMLElement.querySelector(`.${r.CSSClasses.time}`);if(!e)return;const t=r.settings.selection.time===!0?12:r.settings.selection.time,i=r.settings.selection.controlTime==="range",[s,n]=[0,23],[o,l]=[0,59];e.innerHTML=r.sanitizer(`<div class="${r.CSSClasses.timeContent}">${el("hours",r.CSSClasses.timeHours,r.selectedHours,i)}${el("minutes",r.CSSClasses.timeMinutes,r.selectedMinutes,i)}${t===12?`<button type="button" class="${r.CSSClasses.timeKeeping}"${i?"disabled":""}>${r.selectedKeeping}</button>`:""}</div><div class="${r.CSSClasses.timeRanges}">${tl("hours",r.CSSClasses.timeRange,s,n,r.settings.selection.stepHours,r.selectedKeeping?$n(r.selectedHours,r.selectedKeeping):r.selectedHours)}${tl("minutes",r.CSSClasses.timeRange,o,l,r.settings.selection.stepMinutes,r.selectedMinutes)}</div>`),Gd(r,e,t)},jd=(r,e,t)=>{const i=document.createElement("b");e.textContent="";for(let s=0;s<t.length;s++){const n=t[s],o=i.cloneNode(!0);o.className=`${r.CSSClasses.weekDay}`,o.className=`${r.CSSClasses.weekDay}${r.settings.visibility.weekend&&r.settings.iso8601?s===5||s===6?` ${r.CSSClasses.weekDayWeekend}`:"":r.settings.visibility.weekend&&!r.settings.iso8601&&(s===0||s===6)?` ${r.CSSClasses.weekDayWeekend}`:""}`,o.innerText=`${n}`,e.appendChild(o)}},il=r=>{const e=[...r.locale.weekday];e[0]&&(r.settings.iso8601&&e.push(e.shift()),r.HTMLElement.querySelectorAll(`.${r.CSSClasses.week}`).forEach(t=>jd(r,t,e)))},sl=["light","dark","system"],bs={value:!1,set:()=>{bs.value=!0},check:()=>bs.value},nl=(r,e)=>sl.find(t=>{var i;return t!=="system"&&((i=r.getAttribute(e))==null?void 0:i.includes(t))}),ii=(r,e)=>{r.dataset.calendarTheme=e},rl=(r,e)=>{var t;if(t=e,ii(r.HTMLElement,t.matches?"dark":"light"),r.settings.visibility.theme!=="system"||bs.check())return;const i=s=>{const n=document.querySelectorAll(`.${r.CSSClasses.calendar}`);n==null||n.forEach(o=>ii(o,s.matches?"dark":"light"))};e.addEventListener?e.addEventListener("change",i):e.addListener(i),bs.set()},Yd=(r,e,t)=>{new MutationObserver(i=>{for(let s=0;s<i.length;s++)if(i[s].attributeName===t){const n=nl(e,t);n&&ii(r.HTMLElement,n);break}}).observe(e,{attributes:!0})},Xd=(r,e)=>{const t=r.settings.visibility.themeDetect?document.querySelector(r.settings.visibility.themeDetect):null;if(!t)return void rl(r,e);const i=r.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,(n,o)=>o),s=nl(t,i);s?(ii(r.HTMLElement,s),Yd(r,t,i)):rl(r,e)},qd=r=>{if(!sl.includes(r.settings.visibility.theme))throw new Error(gi.incorrectTheme);if(window.matchMedia("(prefers-color-scheme)").media==="not all")return void ii(r.HTMLElement,"light");({light:()=>ii(r.HTMLElement,"light"),dark:()=>ii(r.HTMLElement,"dark"),system:()=>Xd(r,window.matchMedia("(prefers-color-scheme: dark)"))})[r.settings.visibility.theme]()},Ui=r=>{const e={default:()=>{il(r),_s(r)},multiple:()=>{il(r),_s(r)},month:()=>Ko(r),year:()=>zn(r)};qd(r),zd(r),Bn(r),Cs(r),Ln(r),Ud(r),e[r.currentType]()},Q={self:null,rangeMin:void 0,rangeMax:void 0},ol=()=>{var r;if(!((r=Q.self)!=null&&r.HTMLElement))return;const{CSSClasses:e}=Q.self;Q.self.HTMLElement.querySelectorAll(`.${Q.self.CSSClasses.dayBtnHover}`).forEach(t=>{var i;t.classList.remove(Q.self.CSSClasses.dayBtnHover),(i=t.parentElement)==null||i.classList.remove(e.dayHoverIntermediate,e.dayHoverFirst,e.dayHoverLast)})},Kd=(r,e,t)=>{var i,s,n;if(!((i=Q.self)!=null&&i.selectedDates))return;const o=vt(r),{CSSClasses:l}=Q.self;if((s=Q.self.rangeDisabled)!=null&&s.includes(o))return;const a=(n=Q.self.HTMLElement)==null?void 0:n.querySelectorAll(`[data-calendar-day="${o}"]`);a==null||a.forEach(h=>{var d;h.classList.add(l.dayBtnHover),(d=h.parentElement)==null||d.classList.add(l.dayHoverIntermediate)}),e==null||e.forEach(h=>{var d;return(d=h.parentElement)==null?void 0:d.classList.add(l.dayHoverFirst)}),t==null||t.forEach(h=>{var d;return(d=h.parentElement)==null?void 0:d.classList.add(l.dayHoverLast)})},Wn=r=>{var e;if(!r.target||!((e=Q.self)!=null&&e.selectedDates))return;if(!r.target.closest(`.${Q.self.CSSClasses.days}`))return void ol();const t=r.target.closest("[data-calendar-day]");if(!t)return;const i=t.dataset.calendarDay,s=fe(Q.self.selectedDates[0]),n=fe(i),o=Q.self.HTMLElement.querySelectorAll(`[data-calendar-day="${Q.self.selectedDates[0]}"]`),l=Q.self.HTMLElement.querySelectorAll(`[data-calendar-day="${i}"]`),[a,h]=s<n?[o,l]:[l,o],[d,c]=s<n?[s,n]:[n,s];ol();for(let u=new Date(d);u<=c;u.setDate(u.getDate()+1))Kd(u,a,h)},Gn=r=>{Q.self&&r.key==="Escape"&&(Q.self.selectedDates=[],Q.self.HTMLElement.removeEventListener("mousemove",Wn),document.removeEventListener("keydown",Gn),Ui(Q.self))},Qd=()=>{var r,e,t;if(!((e=(r=Q.self)==null?void 0:r.selectedDates)!=null&&e[0])||!Q.self.rangeDisabled||((t=Q.self.rangeDisabled)==null?void 0:t.length)<2)return;const i=fe(Q.self.selectedDates[0]),[s,n]=Q.self.rangeDisabled.map(o=>fe(o)).reduce(([o,l],a)=>[i>=a?a:o,i<a&&l===null?a:l],[null,null]);s&&(Q.self.rangeMin=vt(new Date(s.setDate(s.getDate()+1)))),n&&(Q.self.rangeMax=vt(new Date(n.setDate(n.getDate()-1))))},Zd=()=>{Q.self&&(Q.self.rangeMin=Q.rangeMin,Q.self.rangeMax=Q.rangeMax)},ll=(r,e)=>{var t;if(e){const i=r.selectedDates.length===1&&r.selectedDates[0].includes(e);r.selectedDates=i&&!r.settings.selection.cancelableDay?[e,e]:i&&r.settings.selection.cancelableDay?[]:r.selectedDates.length>1?[e]:[...r.selectedDates,e],(t=r.selectedDates)==null||t.sort((s,n)=>+new Date(s)-+new Date(n))}r.settings.range.disableGaps&&(Q.rangeMin=Q.rangeMin?Q.rangeMin:r.rangeMin,Q.rangeMax=Q.rangeMax?Q.rangeMax:r.rangeMax),Q.self=r,{set:()=>{r.HTMLElement.addEventListener("mousemove",Wn),document.addEventListener("keydown",Gn),r.settings.range.disableGaps&&Qd()},reset:()=>{const[i,s]=[r.selectedDates[0],r.selectedDates[r.selectedDates.length-1]];r.selectedDates=r.selectedDates[0]!==r.selectedDates[r.selectedDates.length-1]?r.settings.range.edgesOnly?[i,s]:fi([`${i}:${s}`]):[r.selectedDates[0],r.selectedDates[0]],r.HTMLElement.removeEventListener("mousemove",Wn),document.removeEventListener("keydown",Gn),r.settings.range.disableGaps&&Zd()}}[r.selectedDates.length===1?"set":"reset"]()},al=(r,e,t)=>{if(!e.dataset.calendarDay)return;const i=e.dataset.calendarDay,s=e.classList.contains(r.CSSClasses.dayBtnSelected);if(s&&!r.settings.selection.cancelableDay)return;let n=!0;r.toggleSelected!==void 0&&(n=typeof r.toggleSelected=="function"?r.toggleSelected(r):r.toggleSelected),s&&!n||(r.selectedDates=s?r.selectedDates.filter(o=>o!==i):t?[...r.selectedDates,i]:[i])},Jd=(r,e)=>{var t;const i=e.target,s=a=>i.closest(`.${a}`),n=s(r.CSSClasses.dayBtn);if(!r.settings.selection.day||!["single","multiple","multiple-ranged"].includes(r.settings.selection.day)||!n)return;({single:()=>al(r,n,!1),multiple:()=>al(r,n,!0),"multiple-ranged":()=>ll(r,n.dataset.calendarDay)})[r.settings.selection.day](),(t=r.selectedDates)==null||t.sort((a,h)=>+new Date(a)-+new Date(h)),r.actions.clickDay&&r.actions.clickDay(e,r),r.input&&r.HTMLInputElement&&r.HTMLElement&&r.actions.changeToInput&&r.actions.changeToInput(e,r);const o=s(r.CSSClasses.dayBtnPrev),l=s(r.CSSClasses.dayBtnNext);({prev:()=>Vn(r,"prev"),next:()=>Vn(r,"next"),default:()=>_s(r)})[o?"prev":l?"next":"default"]()},hl=(r,e,t,i,s)=>{const n=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.column}`),o=Array.from(n).findIndex(a=>a.classList.contains(e)),l=Number(n[o].querySelector(`.${t}`).getAttribute(s));return r.currentType==="month"&&o>=0?i-o:r.currentType==="year"&&r.selectedYear!==l?i-1:i},ec=(r,e,t,i,s)=>{const n={year:()=>{var o,l;return(l=(o=r.actions).clickYear)==null?void 0:l.call(o,e,r)},month:()=>{var o,l;return(l=(o=r.actions).clickMonth)==null?void 0:l.call(o,e,r)}};({year:()=>{if(r.type==="multiple"){const o=hl(r,r.CSSClasses.columnYear,r.CSSClasses.year,Number(s.dataset.calendarYear),"data-calendar-selected-year"),l=r.selectedMonth<r.dateMin.getMonth()&&o<=r.dateMin.getFullYear(),a=r.selectedMonth>r.dateMax.getMonth()&&o>=r.dateMax.getFullYear(),h=o<r.dateMin.getFullYear(),d=o>r.dateMax.getFullYear();l||h?(r.selectedYear=r.dateMin.getFullYear(),r.selectedMonth=r.dateMin.getMonth()):a||d?(r.selectedYear=r.dateMax.getFullYear(),r.selectedMonth=r.dateMax.getMonth()):r.selectedYear=o}else r.selectedYear=Number(s.dataset.calendarYear)},month:()=>{if(r.type==="multiple"){const o=hl(r,r.CSSClasses.columnMonth,r.CSSClasses.month,Number(s.dataset.calendarMonth),"data-calendar-selected-month"),l=s.closest(`.${i.column}`).querySelector(`.${r.CSSClasses.year}`);r.selectedYear=Number(l.dataset.calendarSelectedYear);const a=o<r.dateMin.getMonth()&&r.selectedYear<=r.dateMin.getFullYear(),h=o>r.dateMax.getMonth()&&r.selectedYear>=r.dateMax.getFullYear();r.selectedMonth=a?r.dateMin.getMonth():h?r.dateMax.getMonth():o}else r.selectedMonth=Number(s.dataset.calendarMonth)}})[t](),n[t](),r.currentType=r.type,Ui(r)},dl=(r,e,t,i)=>{if(!r.settings.selection[t])return;const s=e.target,n=d=>s.closest(`.${d}`),o=n(i.header),l=n(i.item),a=n(r.CSSClasses.grid),h=n(r.CSSClasses.column);r.currentType!==t&&o?{year:()=>zn(r,s),month:()=>Ko(r,s)}[t]():l?ec(r,e,t,i,l):(r.currentType===t&&o||r.type==="multiple"&&r.currentType===t&&a&&!h)&&(r.currentType=r.type,Ui(r))},cl=r=>{const e=t=>{Ld(r,t),Hd(r,t),Jd(r,t),dl(r,t,"month",{header:r.CSSClasses.month,item:r.CSSClasses.monthsMonth,column:r.CSSClasses.columnMonth}),dl(r,t,"year",{header:r.CSSClasses.year,item:r.CSSClasses.yearsYear,column:r.CSSClasses.columnYear})};return r.HTMLElement.addEventListener("click",e),()=>r.HTMLElement.removeEventListener("click",e)};function ul(r){if(!r||!r.getBoundingClientRect)return;const e=r.getBoundingClientRect(),t=document.documentElement;return{bottom:e.bottom,right:e.right,top:e.top+window.pageYOffset-t.clientTop,left:e.left+window.pageXOffset-t.clientLeft}}function tc(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}function pl(){return{vw:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),vh:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function ic(r){var e,t;let i=0,s=0,n=0,o=0;const l=tc(),a=ul(r),{vh:h,vw:d}=pl(),c=l.top,u=l.left;if(a){const p=(e=a.top)!=null?e:0,m=(t=a.left)!=null?t:0;s=p-c,n=m-u,i=h-(p-c+r.clientHeight),o=d-(m-u+r.clientWidth)}return{top:s,bottom:i,left:n,right:o}}function sc(r,e,t=5){const i={top:!0,bottom:!0,left:!0,right:!0},s=[];if(e&&r){const{bottom:n,top:o}=ic(r),{top:l,left:a}=ul(r),{height:h,width:d}=e.getBoundingClientRect(),{vh:c,vw:u}=pl(),p={x:u/2,y:c/2};l<p.y&&s.push("top"),l>p.y&&s.push("bottom"),a<p.x&&s.push("left"),a>p.x&&s.push("right"),h>o-t&&(i.top=!1),h>n-t&&(i.bottom=!1),d>a&&(i.left=!1),u-a<d&&(i.right=!1)}return{canShow:i,parentPositions:s}}function nc(r,e){let t="left";if(e&&r){const{canShow:i,parentPositions:s}=sc(r,e);if(!i.left||!i.right)return Array.isArray(s)&&(s[0]=s[0]==="bottom"?"top":"bottom"),s;i.bottom?t="center":i.top&&(t=["top","center"])}return t}const Un=(r,e,t,i)=>{if(r){const s=t==="auto"?nc(r,e):t,n={top:-e.offsetHeight,bottom:r.offsetHeight,left:0,center:r.offsetWidth/2-e.offsetWidth/2,right:r.offsetWidth-e.offsetWidth},o=Array.isArray(s)?s[0]:"bottom",l=Array.isArray(s)?s[1]:s;e.classList.add(o==="bottom"?i.calendarToInputBottom:i.calendarToInputTop);const a=r.getBoundingClientRect(),h=window.scrollX||document.documentElement.scrollLeft,d=window.scrollY||document.documentElement.scrollTop,c=a.top+d+n[o],u=a.left+h+n[l];Object.assign(e.style,{left:`${u}px`,top:`${c}px`})}},ml=(r,{year:e,month:t,dates:i,holidays:s,time:n}={})=>{var o;const l=Wo({},r.settings.selected);r.settings.selected.year=e?l.year:r.selectedYear,r.settings.selected.month=t?l.month:r.selectedMonth,r.settings.selected.holidays=s?l.holidays:r.selectedHolidays,r.settings.selected.time=n?l.time:r.selectedTime,r.settings.selected.dates=i==="only-first"&&((o=r.selectedDates)!=null&&o[0])?[r.selectedDates[0]]:i===!0?l.dates:r.selectedDates,Uo(r),Ui(r),r.settings.selected=l,r.settings.selection.day==="multiple-ranged"&&i&&ll(r)},fl=(r,e=!0)=>{r.isInputInit=!0;const t=document.createElement("div");return t.className=`${r.CSSClasses.calendar} ${r.CSSClasses.calendarToInput} ${r.CSSClasses.calendarHidden}`,r.HTMLElement=t,document.body.appendChild(r.HTMLElement),r.HTMLElement.style.visibility="hidden",e&&queueMicrotask(()=>{Un(r.HTMLInputElement,t,r.settings.visibility.positionToInput,r.CSSClasses),r.HTMLElement.style.visibility="visible",r.show()}),ml(r,{year:!0,month:!0,dates:!0,holidays:!0,time:!0}),r.actions.initCalendar&&r.actions.initCalendar(r),cl(r)},rc=r=>{const e=[];r.HTMLInputElement=r.HTMLElement;const t=()=>Un(r.HTMLInputElement,r.HTMLElement,r.settings.visibility.positionToInput,r.CSSClasses),i=s=>{var n;r&&s.target!==r.HTMLInputElement&&!((n=r.HTMLElement)!=null&&n.contains(s.target))&&(r.HTMLInputElement&&r.HTMLElement&&r.hide(),window.removeEventListener("resize",t),document.removeEventListener("click",i,{capture:!0}))};return r.HTMLInputElement.addEventListener("click",()=>{r.isInputInit?(Un(r.HTMLInputElement,r.HTMLElement,r.settings.visibility.positionToInput,r.CSSClasses),r.HTMLElement.style.visibility="visible",r.show()):e.push(fl(r)),window.addEventListener("resize",t),document.addEventListener("click",i,{capture:!0})}),()=>{e.forEach(s=>s())}},oc=r=>(r.HTMLOriginalElement=r.HTMLElement.cloneNode(!0),r.isInit=!0,r.input?rc(r):(Uo(r),Ui(r),r.actions.initCalendar&&r.actions.initCalendar(r),cl(r))),lc=(r,{year:e,month:t,dates:i,holidays:s,time:n}={})=>{if(!r.isInit)throw new Error(gi.notInit);r.input&&!r.isInputInit&&fl(r,!1),ml(r,{year:e,month:t,dates:i,holidays:s,time:n}),r.actions.updateCalendar&&r.actions.updateCalendar(r)},ac=r=>{var e,t,i,s,n,o;if(!r.isInit)throw new Error(gi.notInit);r.input?((t=(e=r.HTMLElement)==null?void 0:e.parentElement)==null||t.removeChild(r.HTMLElement),(s=(i=r.HTMLInputElement)==null?void 0:i.replaceWith)==null||s.call(i,r.HTMLOriginalElement),r.HTMLInputElement=void 0):(o=(n=r.HTMLElement)==null?void 0:n.replaceWith)==null||o.call(n,r.HTMLOriginalElement),r.HTMLElement=r.HTMLOriginalElement,r.actions.destroyCalendar&&r.actions.destroyCalendar(r)},hc=r=>{r.currentType?(r.HTMLElement.classList.remove(r.CSSClasses.calendarHidden),r.actions.showCalendar&&r.actions.showCalendar(r)):r.HTMLElement.click()},dc=r=>{r.currentType&&(r.HTMLElement.classList.add(r.CSSClasses.calendarHidden),r.actions.hideCalendar&&r.actions.hideCalendar(r))};function jn(r,...e){const t=s=>s&&typeof s=="object"&&!Array.isArray(s);if(!e.length)return r;const i=e.shift();return t(r)&&t(i)&&Object.keys(i).forEach(s=>{t(i[s])?(r[s]||Object.assign(r,{[s]:{}}),jn(r[s],i[s])):Object.assign(r,{[s]:i[s]})}),jn(r,...e)}function cc(r,e,t){r.settings=jn(r.settings,{[e]:t})}class gl extends rd{constructor(e,t){if(super(),Y(this,"init",()=>oc(this)),Y(this,"update",s=>lc(this,s)),Y(this,"destroy",()=>ac(this)),Y(this,"show",()=>hc(this)),Y(this,"hide",()=>dc(this)),Y(this,"changeSetting",(s,n)=>cc(this,s,n)),this.HTMLElement=typeof e=="string"?document.querySelector(e):e,!this.HTMLElement)throw new Error(gi.notFoundSelector(e));if(!t)return;const i=(s,n)=>{Object.keys(n).forEach(o=>{typeof s[o]!="object"||typeof n[o]!="object"||n[o]instanceof Date?s[o]=n[o]:i(s[o],n[o])})};i(this,t)}}class _l{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._lastClickIsDate=!1,this._shouldTriggerQuery=!0,this.hasTimePicker=!1,this.inputFilterType="range",this.searchTerms=[],this._bindEventService=new Ae}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)||{}}get currentDateOrDates(){return this._currentDateOrDates}get defaultOperator(){return this.inputFilterType==="compound"?H.empty:this.gridOptions.defaultFilterRangeOperator||H.rangeInclusive}get pickerOptions(){return this._pickerOptions||{}}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.date,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get operator(){var e;return this.inputFilterType==="compound"?this._operator||this.columnFilter.operator||this.defaultOperator:((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.inputFilterType==="compound"?this._operator=e:this.columnFilter&&(this.columnFilter.operator=e)}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.inputFilterType==="compound"&&(this.operator=e.operator||""),this.searchTerms=(e==null?void 0:e.searchTerms)??[],this.filterContainerElm=e.filterContainerElm;const t=this.inputFilterType==="compound"?Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"":this.searchTerms;this._filterElm=this.createDomFilterElement(t),this.updateFilterStyle(this.searchTerms.length>0),this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this)),this._bindEventService.bind(document.body,"keydown",i=>{(i.key==="Escape"||i.key==="Tab")&&this.hide()}),this._bindEventService.bind(this._dateInputElm,"keydown",i=>{i.key==="Backspace"&&this.clear(!0,!1)})}clear(e=!0,t=!0){if(this.calendarInstance&&(this._clearFilterTriggered=t,this._shouldTriggerQuery=e,this._currentValue="",this.searchTerms=[],this._currentDateStrings=[],this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.calendarInstance)){const i=new Date;$i(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this._currentDateOrDates,newVal:"",updatePickerUI:!0,selectedSettings:{dates:[],month:i.getMonth(),year:i.getFullYear()}})}this.onTriggerEvent(new Event("keyup")),this.updateFilterStyle(!1)}destroy(){var e,t,i,s;this._bindEventService.unbindAll(),(e=this.calendarInstance)==null||e.destroy(),J(this.filterContainerElm),(t=this.filterContainerElm)==null||t.remove(),(i=this._selectOperatorElm)==null||i.remove(),(s=this._filterElm)==null||s.remove()}hide(){var e;typeof((e=this.calendarInstance)==null?void 0:e.hide)=="function"&&this.calendarInstance.hide()}show(){var e;typeof((e=this.calendarInstance)==null?void 0:e.show)=="function"&&this.calendarInstance.show()}getValues(){return this._currentDateOrDates}setValues(e,t,i=!1){let s;this.inputFilterType==="compound"?s=Array.isArray(e)?e[0]:e:typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"&&e[0].indexOf("..")>0?s=typeof e=="string"?[e]:e[0].split(".."):Array.isArray(e)&&(s=e),this.calendarInstance&&s!==void 0&&($i(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this._currentDateOrDates,newVal:s,updatePickerUI:!0}),this._currentDateOrDates=e&&s?s:void 0);const n=this.getValues()||[],o=Array.isArray(n)?n:[n];if(this.updateFilterStyle(o.length>0),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const l=di(this.operator);this._selectOperatorElm.value=l}i&&this.callback(void 0,{columnDef:this.columnDef,searchTerms:o,operator:this.operator,shouldTriggerQuery:!0})}buildDatePickerInput(e){var u,p,m,f,g,_,b,C,E,y,T;const t=((u=this.columnDef)==null?void 0:u.id)??"",i=this.columnFilter.type||this.columnDef.type||S.dateIso,s=this.columnDef.outputType||this.columnFilter.type||this.columnDef.type||S.dateUtc,n=Ze(s),o=this.columnFilter.type||this.columnDef.type||S.dateIso;n&&this.inputFilterType!=="range"&&(n==="ISO8601"||n.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const l=Ze(this.hasTimePicker?S.dateTimeIsoAM_PM:S.dateIso),a=(((p=this.filterOptions)==null?void 0:p.locale)??((f=(m=this.translaterService)==null?void 0:m.getCurrentLanguage)==null?void 0:f.call(m)))||this.gridOptions.locale||"en";let h;this.inputFilterType==="compound"?e&&(h=e,this._currentDateOrDates=e):(typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"&&e[0].indexOf("..")>0?h=typeof e=="string"?[e]:e[0].split(".."):Array.isArray(e)&&(h=e),Array.isArray(h)&&(this._currentDateOrDates=h,this._currentDateStrings=h.map(x=>Ct(x,void 0,o))));const d={input:!0,jumpToSelectedDate:!0,type:this.inputFilterType==="range"?"multiple":"default",sanitizer:x=>this.grid.sanitizeHtmlString(x),toggleSelected:!1,actions:{clickDay:x=>{this._lastClickIsDate=!0},changeToInput:(x,O)=>{if(O.HTMLInputElement){let I=[],A="",k="";if(O.selectedDates[1]){O.selectedDates.sort((W,X)=>+new Date(W)-+new Date(X)),A=O.selectedDates[0],k=O.selectedDates[O.selectedDates.length-1];const L=Qe(O.selectedDates[0],n,"en-US"),N=Qe(k,n,"en-US");O.HTMLInputElement.value=`${L} — ${N}`,I=[A,k]}else O.selectedDates[0]?(A=O.selectedDates[0],O.HTMLInputElement.value=Ct(A,S.dateIso,s),I=O.selectedDates):O.HTMLInputElement.value="";if(this.hasTimePicker&&A){const L=ms(A,l);L.setHours(+(O.selectedHours||0)),L.setMinutes(+(O.selectedMinutes||0)),O.HTMLInputElement.value=Ct(L,void 0,s),I=[L]}if(this.inputFilterType==="compound"?this._currentValue=Ct(I[0],void 0,i):Array.isArray(I)&&(this._currentDateStrings=I.map(L=>Ct(L,void 0,i)),this._currentValue=this._currentDateStrings.join("..")),this._currentDateOrDates=I.map(L=>L instanceof Date?L:ms(L,l)),this._currentValue){const L=this.hasTimePicker?new Event("keyup"):void 0;this.onTriggerEvent(L)}this.inputFilterType==="range"&&O.selectedDates.length<2&&(this._lastClickIsDate=!1),this._lastClickIsDate&&(O.hide(),this._lastClickIsDate=!1)}}},settings:{lang:a,iso8601:!1,visibility:{theme:(g=this.gridOptions)!=null&&g.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};this.inputFilterType==="range"&&(d.type="multiple",d.months=2,d.jumpMonths=2,d.settings={...d.settings,range:{edgesOnly:!0},selection:{day:"multiple-ranged"},visibility:{...(_=d.settings)==null?void 0:_.visibility,daysOutside:!1}}),this.hasTimePicker&&((b=d.settings).selection??(b.selection={}),d.settings.selection.time=24),this._pickerOptions=de(!0,{},d,{settings:this.filterOptions});let c=((C=this.gridOptions)==null?void 0:C.defaultFilterPlaceholder)??"";(E=this.columnFilter)!=null&&E.placeholder&&(c=this.columnFilter.placeholder),this._dateInputElm=v("input",{type:"text",className:"form-control date-picker",placeholder:c,readOnly:!0,dataset:{input:"",columnid:`${t}`}}),this.calendarInstance=new gl(this._dateInputElm,this._pickerOptions),this.calendarInstance.init(),(T=(y=this._pickerOptions.settings)==null?void 0:y.selected)!=null&&T.dates&&(h=this._pickerOptions.settings.selected.dates),h&&$i(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:void 0,newVal:h,updatePickerUI:!1})}getOperatorOptionValues(){var t;let e;return(t=this.columnFilter)!=null&&t.compoundOperatorList?e=this.columnFilter.compoundOperatorList:e=Dn(this.gridOptions,this.translaterService),Mn(this.gridOptions,e,"numeric"),e}createDomFilterElement(e){var i;const t=((i=this.columnDef)==null?void 0:i.id)??"";if(J(this.filterContainerElm),this.buildDatePickerInput(e),this.inputFilterType==="range"){const s=v("div",{className:`date-picker form-group search-filter filter-${t}`});return Array.isArray(e)&&e.length>0&&e[0]!==""&&(this._currentDateOrDates=e,this._currentValue=e[0]),s.appendChild(this._dateInputElm),s&&this.filterContainerElm.appendChild(s),s}else{this._selectOperatorElm=Fn(this.getOperatorOptionValues(),this.grid);const s=v("div",{className:`date-picker form-group search-filter filter-${t}`}),n=v("div",{className:"input-group date-picker"},s);if(v("div",{className:"input-group-addon input-group-prepend operator"},n).appendChild(this._selectOperatorElm),n.appendChild(this._dateInputElm),this.operator){const l=di(this.operator);this._selectOperatorElm.value=l}return this._currentDateOrDates=e,this._currentValue=e,s&&this.filterContainerElm.appendChild(s),s}}onTriggerEvent(e){if(this._clearFilterTriggered)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else if(this.inputFilterType==="range"){const t=this._currentDateStrings?this._currentDateStrings:[this._currentValue];this.updateFilterStyle(t.length>0),this.callback(e,{columnDef:this.columnDef,searchTerms:t,operator:this.operator||"",shouldTriggerQuery:this._shouldTriggerQuery})}else if(this.inputFilterType==="compound"&&this._selectOperatorElm){const t=this._selectOperatorElm.value;this.updateFilterStyle(!!this._currentValue);const i=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput===void 0,s=i&&ie(this._currentDateOrDates)||this._currentDateOrDates===""&&ie(this._lastSearchValue);(!i||!i||s)&&this.callback(e,{columnDef:this.columnDef,searchTerms:this._currentValue?[this._currentValue]:null,operator:t||"",shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._lastSearchValue=this._currentValue}updateFilterStyle(e){e?this._filterElm.classList.add("filled"):this._filterElm.classList.remove("filled")}}class uc extends _l{constructor(e){super(e),this.translaterService=e,this.inputFilterType="compound"}}class Cl{constructor(e){this.translaterService=e}filterCollection(e,t,i=hi.chain){let s=[];return Array.isArray(t)?(s=i===hi.merge?[]:[...e],t.forEach(n=>{if(i===hi.merge){const o=this.singleFilterCollection(e,n);s=bo([...s,...o])}else s=this.singleFilterCollection(s,n)})):s=this.singleFilterCollection(e,t),s}singleFilterCollection(e,t){let i=[];if(t){const s=t.property,n=t.operator||H.equal,o=typeof t.value>"u"?"":t.value;switch(n){case H.equal:s?i=e.filter(l=>l[s]===o):i=e.filter(l=>l===o);break;case H.contains:s?i=e.filter(l=>{var a;return((a=l[s])==null?void 0:a.toString().indexOf(o.toString()))!==-1}):i=e.filter(l=>l!=null&&l.toString().indexOf(o.toString())!==-1);break;case H.notContains:s?i=e.filter(l=>{var a;return((a=l[s])==null?void 0:a.toString().indexOf(o.toString()))===-1}):i=e.filter(l=>l!=null&&l.toString().indexOf(o.toString())===-1);break;case H.notEqual:default:s?i=e.filter(l=>l[s]!==o):i=e.filter(l=>l!==o)}}return i}sortCollection(e,t,i,s){if(s&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');let n=[];if(i){if(Array.isArray(i))n=t.sort((o,l)=>{var a,h;for(let d=0,c=i.length;d<c;d++){const u=i[d];if(u!=null&&u.property){const p=u.sortDesc?ae.desc:ae.asc,m=u.property,f=(u==null?void 0:u.fieldType)??(e==null?void 0:e.type)??S.string,g=s?((a=this.translaterService)==null?void 0:a.translate)&&this.translaterService.translate(o[m]||" "):o[m],_=s?((h=this.translaterService)==null?void 0:h.translate)&&this.translaterService.translate(l[m]||" "):l[m],b=mi(f,g,_,p,e);if(b!==ae.neutral)return b}}return ae.neutral});else if(i!=null&&i.property){const o=i.property,l=i.sortDesc?ae.desc:ae.asc,a=(i==null?void 0:i.fieldType)??(e==null?void 0:e.type)??S.string;n=t.sort((h,d)=>{var m,f;const c=s?((m=this.translaterService)==null?void 0:m.translate)&&this.translaterService.translate(h[o]||" "):h[o],u=s?((f=this.translaterService)==null?void 0:f.translate)&&this.translaterService.translate(d[o]||" "):d[o],p=mi(a,c,u,l,e);return p!==ae.neutral?p:ae.neutral})}else if(i&&!i.property){const o=i.sortDesc?ae.desc:ae.asc,l=(i==null?void 0:i.fieldType)??(e==null?void 0:e.type)??S.string;n=t.sort((a,h)=>{var p,m;const d=s?((p=this.translaterService)==null?void 0:p.translate)&&this.translaterService.translate(a||" "):a,c=s?((m=this.translaterService)==null?void 0:m.translate)&&this.translaterService.translate(h||" "):h,u=mi(l,d,c,o,e);return u!==ae.neutral?u:ae.neutral})}}return n}}function vl(r,e,t,i,s=!1,n,o){var O,I,A,k,L;const l=(t==null?void 0:t.id)??"",a=i.getOptions(),h=(r==="editor"?t==null?void 0:t.editor:t==null?void 0:t.filter)??{},d=(h==null?void 0:h.collectionOptions)??{},c=(d==null?void 0:d.separatorBetweenTextLabels)??"",u=(h==null?void 0:h.enableTranslateLabel)??!1,p=(a==null?void 0:a.enableTranslate)??!1,m=(h==null?void 0:h.enableRenderHtml)??!1,f=((O=h==null?void 0:h.customStructure)==null?void 0:O.label)??"label",g=((I=h==null?void 0:h.customStructure)==null?void 0:I.labelPrefix)??"labelPrefix",_=((A=h==null?void 0:h.customStructure)==null?void 0:A.labelSuffix)??"labelSuffix",b=((k=h==null?void 0:h.customStructure)==null?void 0:k.optionLabel)??"value",C=((L=h==null?void 0:h.customStructure)==null?void 0:L.value)??"value",E=v("select",{className:"ms-filter search-filter"}),y=r==="filter"?["search-filter",`filter-${l}`]:["select-editor",`editor-${l}`];E.classList.add(...y),E.multiple=s;const T=[];let x=!1;return Array.isArray(e)&&(e.every(N=>typeof N=="number"||typeof N=="string")?e.forEach(N=>{const W={text:String(N),value:N};r==="filter"&&Array.isArray(o)&&(W.selected=o.findIndex(X=>X===N)>=0),T.push(W),(W.selected&&s||W.selected&&!s&&N!=="")&&(x=!0)}):e.forEach(N=>{if(N===void 0||typeof N=="object"&&N[f]===void 0&&N.labelKey===void 0)throw new Error("[Slickgrid-Universal] Select Filter/Editor collection with value/label (or value/labelKey when using Locale) is required to populate the Select list, for example:: { filter: model: Filters.multipleSelect, collection: [ { value: '1', label: 'One' } ]')");const W=N.labelKey||N[f],X=(N.labelKey||u&&n)&&W&&p?n==null?void 0:n.translate(W||" "):W;let Z=N[g]||"",q=N[_]||"",ee=N.hasOwnProperty(b)?N[b]:"";ee!=null&&ee.toString&&(ee=ee.toString().replace(/"/g,"'")),Z=u&&n&&Z&&typeof Z=="string"?n.translate(Z||" "):Z,q=u&&n&&q&&typeof q=="string"?n.translate(q||" "):q,ee=u&&n&&ee&&typeof ee=="string"?n.translate(ee||" "):ee;let st=[Z,typeof X=="string"||typeof X=="number"?X.toString():X,q].filter(Ye=>Ye).join(c);const ge={text:"",value:""};m&&(st=i.sanitizeHtmlString(st)),ge.text=st;let xe=N[C];xe==null&&(xe=""),r==="filter"&&Array.isArray(o)&&(ge.selected=o.findIndex(Ye=>`${Ye}`==`${N[C]}`)>=0),ge.value=`${xe??""}`,T.push(ge),(ge.selected&&s||ge.selected&&!s&&N[C]!=="")&&(x=!0)})),{selectElement:E,dataCollection:T,hasFoundSearchTerm:x}}class pc{constructor(e,t,i){this.sharedService=e,this.backendUtilities=t,this.translaterService=i}getPickerTitleOutputString(e,t){var c,u,p,m,f,g,_,b,C,E,y,T,x,O;if((c=this.sharedService.gridOptions)!=null&&c.enableTranslate&&!((u=this.translaterService)!=null&&u.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');let i="";const s=((p=this.sharedService.gridOptions)==null?void 0:p[t])??{},n=((m=this.sharedService.gridOptions)==null?void 0:m.enableTranslate)??!1,o=((f=this.sharedService.gridOptions)==null?void 0:f.locales)??R.locales,l=s==null?void 0:s[e],a=s==null?void 0:s[`${e}Key`],h=this.sharedService.gridOptions,d=ot(h);if(a&&((g=this.translaterService)!=null&&g.translate))i=this.translaterService.translate(a||" ");else switch(e){case"commandTitle":i=l||n&&((_=this.translaterService)==null?void 0:_.getCurrentLanguage)&&((b=this.translaterService)==null?void 0:b.translate(`${d}COMMANDS`))||(o==null?void 0:o.TEXT_COMMANDS);break;case"columnTitle":i=l||n&&((C=this.translaterService)==null?void 0:C.getCurrentLanguage)&&((E=this.translaterService)==null?void 0:E.translate(`${d}COLUMNS`))||(o==null?void 0:o.TEXT_COLUMNS);break;case"forceFitTitle":i=l||n&&((y=this.translaterService)==null?void 0:y.getCurrentLanguage)&&((T=this.translaterService)==null?void 0:T.translate(`${d}FORCE_FIT_COLUMNS`))||(o==null?void 0:o.TEXT_FORCE_FIT_COLUMNS);break;case"syncResizeTitle":i=l||n&&((x=this.translaterService)==null?void 0:x.getCurrentLanguage)&&((O=this.translaterService)==null?void 0:O.translate(`${d}SYNCHRONOUS_RESIZE`))||(o==null?void 0:o.TEXT_SYNCHRONOUS_RESIZE);break;default:i=l;break}return i}readjustFrozenColumnIndexWhenNeeded(e,t,i){if(e>=0){const s=i.findIndex(n=>n.id===this.sharedService.frozenVisibleColumnId);s>=0&&s!==e&&(this.sharedService.gridOptions.frozenColumn=s,this.sharedService.slickGrid.setOptions({frozenColumn:s})),Array.isArray(i)&&Array.isArray(t)&&i.length!==t.length&&this.sharedService.slickGrid.setColumns(i)}}refreshBackendDataset(e){var i;let t=this.sharedService.gridOptions;e&&(t={...this.sharedService.gridOptions,...e},this.sharedService.gridOptions=t),(i=this.backendUtilities)==null||i.refreshBackendDataset(t)}runOverrideFunctionWhenExists(e,t){return typeof e=="function"?!!e.call(this,t):!0}sortItems(e,t){Array.isArray(e)&&e.sort((i,s)=>i&&s&&i.hasOwnProperty(t)&&s.hasOwnProperty(t)?i[t]-s[t]:0)}translateItems(e,t,i){var s,n;if(Array.isArray(e))for(const o of e)o.hasOwnProperty(t)&&(o[i]=(n=(s=this.translaterService)==null?void 0:s.translate)==null?void 0:n.call(s,o[t]))}translateMenuItemsFromTitleKey(e,t="commandItems"){for(const i of e)typeof i=="object"&&(i.titleKey&&(i.title=this.translateWhenEnabledAndServiceExist(`${i.titleKey}`,`TEXT_${i.titleKey}`)),i.subMenuTitleKey&&(i.subMenuTitle=this.translateWhenEnabledAndServiceExist(`${i.subMenuTitleKey}`,`TEXT_${i.subMenuTitleKey}`))),Array.isArray(i==null?void 0:i[t])&&this.translateMenuItemsFromTitleKey(i==null?void 0:i[t])}translateWhenEnabledAndServiceExist(e,t,i){var l,a;let s="";const n=(l=this.sharedService)==null?void 0:l.gridOptions,o=(n==null?void 0:n.locales)??R.locales;return i?s=i:n.enableTranslate&&((a=this.translaterService)!=null&&a.translate)?s=this.translaterService.translate(e||" "):t in o?s=o[t]:s=t,s}}class le{get defaultPrevented(){return this._isDefaultPrevented}constructor(e,t){this.event=e,this.args=t,this._isPropagationStopped=!1,this._isImmediatePropagationStopped=!1,this._isDefaultPrevented=!1,this.returnValue=void 0,this.nativeEvent=e,this._arguments=t,e&&["altKey","ctrlKey","metaKey","shiftKey","key","keyCode","clientX","clientY","offsetX","offsetY","pageX","pageY","bubbles","target","type","which","x","y"].forEach(i=>this[i]=e[i]),this._eventTarget=this.nativeEvent?this.nativeEvent.target:void 0}stopPropagation(){var e;this._isPropagationStopped=!0,(e=this.nativeEvent)==null||e.stopPropagation()}isPropagationStopped(){return this._isPropagationStopped}stopImmediatePropagation(){this._isImmediatePropagationStopped=!0,this.nativeEvent&&this.nativeEvent.stopImmediatePropagation()}isImmediatePropagationStopped(){return this._isImmediatePropagationStopped}getNativeEvent(){return this.nativeEvent}preventDefault(){this.nativeEvent&&this.nativeEvent.preventDefault(),this._isDefaultPrevented=!0}isDefaultPrevented(){return this.nativeEvent?this.nativeEvent.defaultPrevented:this._isDefaultPrevented}addReturnValue(e){this.returnValue===void 0&&e!==void 0&&(this.returnValue=e)}getReturnValue(){return this.returnValue}getArguments(){return this._arguments}resetReturnValue(){this.returnValue=void 0}}class P{get subscriberCount(){return this._handlers.length}constructor(e,t){this.eventName=e,this.pubSub=t,this._handlers=[],this._pubSubService=t}subscribe(e){this._handlers.push(e)}unsubscribe(e){for(let t=this._handlers.length-1;t>=0;t--)this._handlers[t]===e&&this._handlers.splice(t,1)}notify(e,t,i,s=!1){var o;const n=t instanceof le?t:new le(t,e);s&&n.resetReturnValue(),i=i||this;for(let l=0;l<this._handlers.length&&!(n.isPropagationStopped()||n.isImmediatePropagationStopped());l++){const a=this._handlers[l].call(i,n,e);n.addReturnValue(a)}if(typeof((o=this._pubSubService)==null?void 0:o.publish)=="function"&&this.eventName){const l=this._pubSubService.publish(this.eventName,{args:e,eventData:n},void 0,a=>n.nativeEvent??(n.nativeEvent=a));n.addReturnValue(l)}return n}setPubSubService(e){this._pubSubService=e}}class pe{constructor(){this.handlers=[]}get subscriberCount(){return this.handlers.length}subscribe(e,t){return this.handlers.push({event:e,handler:t}),e.subscribe(t),this}unsubscribe(e,t){let i=this.handlers.length;for(;i--;)if(this.handlers[i].event===e&&this.handlers[i].handler===t){this.handlers.splice(i,1),e.unsubscribe(t);return}return this}unsubscribeAll(){let e=this.handlers.length;for(;e--;)this.handlers[e].event.unsubscribe(this.handlers[e].handler);return this.handlers=[],this}}class Je{constructor(e,t,i,s){i===void 0&&s===void 0&&(i=e,s=t),this.fromRow=Math.min(e,i),this.fromCell=Math.min(t,s),this.toRow=Math.max(e,i),this.toCell=Math.max(t,s)}isSingleCell(){return this.fromRow===this.toRow&&this.fromCell===this.toCell}isSingleRow(){return this.fromRow===this.toRow}contains(e,t){return e>=this.fromRow&&e<=this.toRow&&t>=this.fromCell&&t<=this.toCell}toString(){return this.isSingleCell()?`(${this.fromRow}:${this.fromCell})`:`(${this.fromRow}:${this.fromCell} - ${this.toRow}:${this.toCell})`}}class bl{constructor(){this.__nonDataRow=!0}}class Ss extends bl{constructor(){super(),this.__group=!0,this.level=0,this.count=0,this.value=null,this.title=null,this.collapsed=!1,this.selectChecked=!1,this.totals=null,this.rows=[],this.groups=null,this.groupingKey=""}equals(e){return this.value===e.value&&this.count===e.count&&this.collapsed===e.collapsed&&this.title===e.title}}class mc extends bl{constructor(){super(),this.__groupTotals=!0,this.group=null,this.initialized=!1}}class fc{constructor(){this.activeEditController=null}isActive(e){return e?this.activeEditController===e:this.activeEditController!==null}activate(e){if(e!==this.activeEditController){if(this.activeEditController!==null)throw new Error("SlickEditorLock.activate: an editController is still active, can't activate another editController");if(!e.commitCurrentEdit)throw new Error("SlickEditorLock.activate: editController must implement .commitCurrentEdit()");if(!e.cancelCurrentEdit)throw new Error("SlickEditorLock.activate: editController must implement .cancelCurrentEdit()");this.activeEditController=e}}deactivate(e){if(this.activeEditController){if(this.activeEditController!==e)throw new Error("SlickEditorLock.deactivate: specified editController is not the currently active one");this.activeEditController=null}}commitCurrentEdit(){return this.activeEditController?this.activeEditController.commitCurrentEdit():!0}cancelCurrentEdit(){return this.activeEditController?this.activeEditController.cancelCurrentEdit():!0}}class w{static height(e,t){if(e){if(t===void 0)return e.getBoundingClientRect().height;w.setStyleSize(e,"height",t)}}static width(e,t){if(!(!e||!e.getBoundingClientRect)){if(t===void 0)return e.getBoundingClientRect().width;w.setStyleSize(e,"width",t)}}static setStyleSize(e,t,i){typeof i=="function"&&(i=i()),e.style[t]=typeof i=="string"?i:`${i}px`}static isHidden(e){return e.offsetWidth===0&&e.offsetHeight===0}static parents(e,t){const i=[],s=t===":visible",n=t===":hidden";for(;(e=e.parentNode)&&e!==document&&!(!e||!e.parentNode);)n?w.isHidden(e)&&i.push(e):s?w.isHidden(e)||i.push(e):(!t||e.matches(t))&&i.push(e);return i}static toFloat(e){const t=parseFloat(e);return isNaN(t)?0:t}static show(e,t=""){Array.isArray(e)?e.forEach(i=>i.style.display=t):e.style.display=t}static hide(e){Array.isArray(e)?e.forEach(t=>t.style.display="none"):e.style.display="none"}static applyDefaults(e,t){typeof t=="object"&&Object.keys(t).forEach(i=>{t.hasOwnProperty(i)&&!e.hasOwnProperty(i)&&(e[i]=t[i])})}static addSlickEventPubSubWhenDefined(e,t){if(e)for(const i in t)t[i]instanceof P&&typeof t[i].setPubSubService=="function"&&t[i].setPubSubService(e)}}w.storage={_storage:new WeakMap,put:function(r,e,t){this._storage.has(r)||this._storage.set(r,new Map),this._storage.get(r).set(e,t)},get:function(r,e){const t=this._storage.get(r);return t?t.get(e):null},remove:function(r,e){const t=this._storage.get(r).delete(e);return this._storage.get(r).size!==0&&this._storage.delete(r),t}};const ji=new fc,gc="slick-edit-preclick";class Sl{constructor(e){this.pluginName="GroupItemMetadataProvider",this._defaults={groupCssClass:"slick-group",groupTitleCssClass:"slick-group-title",totalsCssClass:"slick-group-totals",groupFocusable:!0,indentation:15,totalsFocusable:!1,toggleCssClass:"slick-group-toggle",toggleExpandedCssClass:"expanded",toggleCollapsedCssClass:"collapsed",enableExpandCollapse:!0,groupFormatter:this.defaultGroupCellFormatter.bind(this),totalsFormatter:this.defaultTotalsCellFormatter.bind(this),includeHeaderTotals:!1},this._eventHandler=new pe,this._options=de(!0,{},this._defaults,e)}get eventHandler(){return this._eventHandler}get dataView(){var e;return((e=this._grid)==null?void 0:e.getData())??{}}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())||{}}init(e,t){this._grid=e,this._options={...this._defaults,...t},this._eventHandler.subscribe(e.onClick,this.handleGridClick.bind(this)),this._eventHandler.subscribe(e.onKeyDown,this.handleGridKeyDown.bind(this))}destroy(){this.dispose()}dispose(){var e;(e=this._eventHandler)==null||e.unsubscribeAll()}getOptions(){return this._options}setOptions(e){this._options={...this._options,...e}}getGroupRowMetadata(e){return{selectable:!1,focusable:this._options.groupFocusable,cssClasses:`${this._options.groupCssClass} slick-group-level-${(e==null?void 0:e.level)||0}`,formatter:this._options.includeHeaderTotals&&this._options.totalsFormatter||void 0,columns:{0:{colspan:this._options.includeHeaderTotals?"1":"*",formatter:this._options.groupFormatter,editorClass:null}}}}getTotalsRowMetadata(e){var t;return{selectable:!1,focusable:this._options.totalsFocusable,cssClasses:`${this._options.totalsCssClass} slick-group-level-${((t=e==null?void 0:e.group)==null?void 0:t.level)||0}`,formatter:this._options.totalsFormatter,editorClass:null}}defaultGroupCellFormatter(e,t,i,s,n){var u,p;if(!this._options.enableExpandCollapse)return n.title;const o=n.level||0,l=((u=this._options)==null?void 0:u.indentation)??15,a=`${o*l}px`,h=n.collapsed?this._options.toggleCollapsedCssClass:this._options.toggleExpandedCssClass,d=(p=this.gridOptions)!=null&&p.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment;d.appendChild(v("span",{className:`${this._options.toggleCssClass} ${h}`,ariaExpanded:String(!n.collapsed),style:{marginLeft:a}}));const c=v("span",{className:this._options.groupTitleCssClass||""});return c.setAttribute("level",o),n.title instanceof HTMLElement||n.title instanceof DocumentFragment?c.appendChild(n.title):this._grid.applyHtmlCode(c,n.title??""),d.appendChild(c),d}defaultTotalsCellFormatter(e,t,i,s,n,o){var l;return((l=s==null?void 0:s.groupTotalsFormatter)==null?void 0:l.call(s,n,s,o))??""}handleGridClick(e,t){var n;const i=e.target,s=(n=this._grid)==null?void 0:n.getDataItem(t.row);s instanceof Ss&&i.classList.contains(this._options.toggleCssClass||"")&&(this.handleDataViewExpandOrCollapse(s),e.stopImmediatePropagation(),e.preventDefault())}handleGridKeyDown(e){var t;if(this._options.enableExpandCollapse&&e.key===" "){const i=(t=this._grid)==null?void 0:t.getActiveCell();if(i){const s=this._grid.getDataItem(i.row);s instanceof Ss&&(this.handleDataViewExpandOrCollapse(s),e.stopImmediatePropagation(),e.preventDefault())}}}handleDataViewExpandOrCollapse(e){var i;const t=(i=this._grid)==null?void 0:i.getRenderedRange();this.dataView.setRefreshHints({ignoreDiffsBefore:t.top,ignoreDiffsAfter:t.bottom+1}),e.collapsed?this.dataView.expandGroup(e.groupingKey):this.dataView.collapseGroup(e.groupingKey)}}class _c{constructor(e,t){this.externalPubSub=t,this.defaults={groupItemMetadataProvider:null,inlineFilters:!1,useCSPSafeFilter:!1},this.idProperty="id",this.items=[],this.rows=[],this.idxById=new Map,this.rowsById=void 0,this.filter=null,this.filterCSPSafe=null,this.updated=null,this.suspend=!1,this.isBulkSuspend=!1,this.bulkDeleteIds=new Map,this.sortAsc=!0,this.refreshHints={},this.prevRefreshHints={},this.filteredItems=[],this.filterCache=[],this.groupingInfoDefaults={getter:void 0,formatter:void 0,comparer:(i,s)=>i.value===s.value?0:i.value>s.value?1:-1,predefinedValues:[],aggregators:[],aggregateEmpty:!1,aggregateCollapsed:!1,aggregateChildGroups:!1,collapsed:!1,displayTotalsRow:!0,lazyTotalsCalculation:!1},this.groupingInfos=[],this.groups=[],this.toggledGroupsByLevel=[],this.groupingDelimiter=":|:",this.selectedRowIds=[],this.pagesize=0,this.pagenum=0,this.totalRows=0,this.onBeforePagingInfoChanged=new P("onBeforePagingInfoChanged",t),this.onGroupExpanded=new P("onGroupExpanded",t),this.onGroupCollapsed=new P("onGroupCollapsed",t),this.onPagingInfoChanged=new P("onPagingInfoChanged",t),this.onRowCountChanged=new P("onRowCountChanged",t),this.onRowsChanged=new P("onRowsChanged",t),this.onRowsOrCountChanged=new P("onRowsOrCountChanged",t),this.onSelectedRowIdsChanged=new P("onSelectedRowIdsChanged",t),this.onSetItemsCalled=new P("onSetItemsCalled",t),this._options=de(!0,{},this.defaults,e)}beginUpdate(e){this.suspend=!0,this.isBulkSuspend=e===!0}endUpdate(){const e=this.isBulkSuspend;this.isBulkSuspend=!1,this.suspend=!1,e&&(this.processBulkDelete(),this.ensureIdUniqueness()),this.refresh()}destroy(){var e,t,i;this.items=[],this.idProperty="id",this.idxById=null,this.rowsById=null,this.filter=null,this.filterCSPSafe=null,this.updated=null,this.sortComparer=null,this.filterCache=[],this.filteredItems=[],this.compiledFilter=null,this.compiledFilterCSPSafe=null,this.compiledFilterWithCaching=null,this.compiledFilterWithCachingCSPSafe=null,this._grid&&((e=this._grid.onSelectedRowsChanged)==null||e.unsubscribe(),(t=this._grid.onCellCssStylesChanged)==null||t.unsubscribe()),(i=this.onRowsOrCountChanged)==null||i.unsubscribe()}setRefreshHints(e){this.refreshHints=e}getFilterArgs(){return this.filterArgs}setFilterArgs(e){this.filterArgs=e}processBulkDelete(){if(!this.idxById)return;let e,t,i=0;for(let s=0,n=this.items.length;s<n;s++){if(t=this.items[s],e=t[this.idProperty],e===void 0)throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");this.bulkDeleteIds.has(e)?this.idxById.delete(e):(this.items[i]=t,this.idxById.set(e,i),++i)}this.items.length=i,this.bulkDeleteIds=new Map}updateIdxById(e){if(this.isBulkSuspend||!this.idxById)return;e=e||0;let t;for(let i=e,s=this.items.length;i<s;i++){if(t=this.items[i][this.idProperty],t===void 0)throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");this.idxById.set(t,i)}}ensureIdUniqueness(){if(this.isBulkSuspend||!this.idxById)return;let e;for(let t=0,i=this.items.length;t<i;t++)if(e=this.items[t][this.idProperty],e===void 0||this.idxById.get(e)!==t)throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property")}getItems(){return this.items}getIdPropertyName(){return this.idProperty}setItems(e,t){t!==void 0&&(this.idProperty=t),this.items=this.filteredItems=e,this.onSetItemsCalled.notify({idProperty:this.idProperty,itemCount:this.items.length},null,this),this.idxById=new Map,this.updateIdxById(),this.ensureIdUniqueness(),this.refresh()}setPagingOptions(e){this.onBeforePagingInfoChanged.notify(this.getPagingInfo(),null,this).getReturnValue()!==!1&&(ie(e.pageSize)&&(this.pagesize=e.pageSize,this.pagenum=this.pagesize?Math.min(this.pagenum,Math.max(0,Math.ceil(this.totalRows/this.pagesize)-1)):0),ie(e.pageNum)&&(this.pagenum=Math.min(e.pageNum,Math.max(0,Math.ceil(this.totalRows/this.pagesize)-1))),this.onPagingInfoChanged.notify(this.getPagingInfo(),null,this),this.refresh())}getPagingInfo(){const e=this.pagesize?Math.max(1,Math.ceil(this.totalRows/this.pagesize)):1;return{pageSize:this.pagesize,pageNum:this.pagenum,totalRows:this.totalRows,totalPages:e,dataView:this}}sort(e,t){this.sortAsc=t,this.sortComparer=e,t===!1&&this.items.reverse(),this.items.sort(e),t===!1&&this.items.reverse(),this.idxById=new Map,this.updateIdxById(),this.refresh()}reSort(){this.sortComparer&&this.sort(this.sortComparer,this.sortAsc)}getFilteredItems(){return this.filteredItems}getFilteredItemCount(){return this.filteredItems.length}getFilter(){return this._options.useCSPSafeFilter?this.filterCSPSafe:this.filter}setFilter(e){this.filterCSPSafe=e,this.filter=e,this._options.inlineFilters&&(this.compiledFilterCSPSafe=this.compileFilterCSPSafe,this.compiledFilterWithCachingCSPSafe=this.compileFilterWithCachingCSPSafe,this.compiledFilter=this.compileFilter(this._options.useCSPSafeFilter),this.compiledFilterWithCaching=this.compileFilterWithCaching(this._options.useCSPSafeFilter)),this.refresh()}getGrouping(){return this.groupingInfos}setGrouping(e){this._options.groupItemMetadataProvider||(this._options.groupItemMetadataProvider=new Sl),this.groups=[],this.toggledGroupsByLevel=[],e=e||[],this.groupingInfos=e instanceof Array?e:[e];for(let t=0;t<this.groupingInfos.length;t++){const i=this.groupingInfos[t]=de(!0,{},this.groupingInfoDefaults,this.groupingInfos[t]);i.getterIsAFn=typeof i.getter=="function",i.compiledAccumulators=[];let s=i.aggregators.length;for(;s--;)i.compiledAccumulators[s]=this.compileAccumulatorLoopCSPSafe(i.aggregators[s]);this.toggledGroupsByLevel[t]={}}this.refresh()}getItemByIdx(e){return this.items[e]}getIdxById(e){var t;return(t=this.idxById)==null?void 0:t.get(e)}ensureRowsByIdCache(){if(!this.rowsById){this.rowsById={};for(let e=0,t=this.rows.length;e<t;e++)this.rowsById[this.rows[e][this.idProperty]]=e}}getRowByItem(e){var t;return this.ensureRowsByIdCache(),(t=this.rowsById)==null?void 0:t[e[this.idProperty]]}getRowById(e){var t;return this.ensureRowsByIdCache(),(t=this.rowsById)==null?void 0:t[e]}getItemById(e){return this.items[this.idxById.get(e)]}mapItemsToRows(e){var i;const t=[];this.ensureRowsByIdCache();for(let s=0,n=e.length;s<n;s++){const o=(i=this.rowsById)==null?void 0:i[e[s][this.idProperty]];ie(o)&&(t[t.length]=o)}return t}mapIdsToRows(e){var i;const t=[];this.ensureRowsByIdCache();for(let s=0,n=e.length;s<n;s++){const o=(i=this.rowsById)==null?void 0:i[e[s]];ie(o)&&(t[t.length]=o)}return t}mapRowsToIds(e){const t=[];for(let i=0,s=e.length;i<s;i++)if(e[i]<this.rows.length){const n=this.rows[e[i]];t[t.length]=n[this.idProperty]}return t}updateSingleItem(e,t){var i;if(this.idxById){if(!this.idxById.has(e))throw new Error("[SlickGrid DataView] Invalid id");if(e!==t[this.idProperty]){const s=t[this.idProperty];if(!ie(s))throw new Error("[SlickGrid DataView] Cannot update item to associate with a null id");if(this.idxById.has(s))throw new Error("[SlickGrid DataView] Cannot update item to associate with a non-unique id");this.idxById.set(s,this.idxById.get(e)),this.idxById.delete(e),(i=this.updated)!=null&&i[e]&&delete this.updated[e],e=s}this.items[this.idxById.get(e)]=t,this.updated||(this.updated={}),this.updated[e]=!0}}updateItem(e,t){this.updateSingleItem(e,t),this.refresh()}updateItems(e,t){if(e.length!==t.length)throw new Error("[SlickGrid DataView] Mismatch on the length of ids and items provided to update");for(let i=0,s=t.length;i<s;i++)this.updateSingleItem(e[i],t[i]);this.refresh()}insertItem(e,t){this.items.splice(e,0,t),this.updateIdxById(e),this.refresh()}insertItems(e,t){Array.prototype.splice.apply(this.items,[e,0].concat(t)),this.updateIdxById(e),this.refresh()}addItem(e){this.items.push(e),this.updateIdxById(this.items.length-1),this.refresh()}addItems(e){this.items=this.items.concat(e),this.updateIdxById(this.items.length-e.length),this.refresh()}deleteItem(e){if(this.idxById)if(this.isBulkSuspend)this.bulkDeleteIds.set(e,!0);else{const t=this.idxById.get(e);if(t===void 0)throw new Error("[SlickGrid DataView] Invalid id");this.idxById.delete(e),this.items.splice(t,1),this.updateIdxById(t),this.refresh()}}deleteItems(e){if(!(e.length===0||!this.idxById))if(this.isBulkSuspend)for(let t=0,i=e.length;t<i;t++){const s=e[t];if(this.idxById.get(s)===void 0)throw new Error("[SlickGrid DataView] Invalid id");this.bulkDeleteIds.set(s,!0)}else{const t=[];for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.idxById.get(n);if(o===void 0)throw new Error("[SlickGrid DataView] Invalid id");this.idxById.delete(n),t.push(o)}t.sort();for(let i=t.length-1;i>=0;--i)this.items.splice(t[i],1);this.updateIdxById(t[0]),this.refresh()}}sortedAddItem(e){if(!this.sortComparer)throw new Error("[SlickGrid DataView] sortedAddItem() requires a sort comparer, use sort()");this.insertItem(this.sortedIndex(e),e)}sortedUpdateItem(e,t){if(!this.idxById)return;if(!this.idxById.has(e)||e!==t[this.idProperty])throw new Error(`[SlickGrid DataView] Invalid or non-matching id ${e}`);if(!this.sortComparer)throw new Error("[SlickGrid DataView] sortedUpdateItem() requires a sort comparer, use sort()");const i=this.getItemById(e);this.sortComparer(i,t)!==0?(this.deleteItem(e),this.sortedAddItem(t)):this.updateItem(e,t)}sortedIndex(e){let t=0,i=this.items.length;for(;t<i;){const s=t+i>>>1;this.sortComparer(this.items[s],e)===-1?t=s+1:i=s}return t}getItemCount(){return this.items.length}getLength(){return this.rows.length}getItem(e){var i;const t=this.rows[e];if(t!=null&&t.__group&&t.totals&&!((i=t.totals)!=null&&i.initialized)){const s=this.groupingInfos[t.level];s.displayTotalsRow||(this.calculateTotals(t.totals),t.title=s.formatter?s.formatter(t):t.value)}else t!=null&&t.__groupTotals&&!t.initialized&&this.calculateTotals(t);return t}getItemMetadata(e){const t=this.rows[e];return t===void 0?null:t.__group?this._options.groupItemMetadataProvider.getGroupRowMetadata(t):t.__groupTotals?this._options.groupItemMetadataProvider.getTotalsRowMetadata(t):null}expandCollapseAllGroups(e,t){if(ie(e))this.toggledGroupsByLevel[e]={},this.groupingInfos[e].collapsed=t,t===!0?this.onGroupCollapsed.notify({level:e,groupingKey:null}):this.onGroupExpanded.notify({level:e,groupingKey:null});else for(let i=0;i<this.groupingInfos.length;i++)this.toggledGroupsByLevel[i]={},this.groupingInfos[i].collapsed=t,t===!0?this.onGroupCollapsed.notify({level:i,groupingKey:null}):this.onGroupExpanded.notify({level:i,groupingKey:null});this.refresh()}collapseAllGroups(e){this.expandCollapseAllGroups(e,!0)}expandAllGroups(e){this.expandCollapseAllGroups(e,!1)}expandCollapseGroup(e,t,i){this.toggledGroupsByLevel[e]&&(this.toggledGroupsByLevel[e][t]=this.groupingInfos[e].collapsed^i),this.refresh()}collapseGroup(...e){const i=Array.prototype.slice.call(e)[0];let s,n;e.length===1&&i.indexOf(this.groupingDelimiter)!==-1?(s=i,n=i.split(this.groupingDelimiter).length-1):(s=e.join(this.groupingDelimiter),n=e.length-1),this.expandCollapseGroup(n,s,!0),this.onGroupCollapsed.notify({level:n,groupingKey:s})}expandGroup(...e){const i=Array.prototype.slice.call(e)[0];let s,n;e.length===1&&i.indexOf(this.groupingDelimiter)!==-1?(n=i.split(this.groupingDelimiter).length-1,s=i):(n=e.length-1,s=e.join(this.groupingDelimiter)),this.expandCollapseGroup(n,s,!1),this.onGroupExpanded.notify({level:n,groupingKey:s})}getGroups(){return this.groups}extractGroups(e,t){var d,c;let i,s;const n=[],o={};let l;const a=t?t.level+1:0,h=this.groupingInfos[a];for(let u=0,p=((d=h.predefinedValues)==null?void 0:d.length)??0;u<p;u++)s=(c=h.predefinedValues)==null?void 0:c[u],i=o[s],i||(i=new Ss,i.value=s,i.level=a,i.groupingKey=(t?t.groupingKey+this.groupingDelimiter:"")+s,n[n.length]=i,o[s]=i);for(let u=0,p=e.length;u<p;u++)l=e[u],s=h.getterIsAFn?h.getter(l):l[h.getter],i=o[s],i||(i=new Ss,i.value=s,i.level=a,i.groupingKey=(t?t.groupingKey+this.groupingDelimiter:"")+s,n[n.length]=i,o[s]=i),i.rows[i.count++]=l;if(a<this.groupingInfos.length-1)for(let u=0;u<n.length;u++)i=n[u],i.groups=this.extractGroups(i.rows,i);return n.length&&this.addTotals(n,a),n.sort(this.groupingInfos[a].comparer),n}calculateTotals(e){var l;const t=e.group,i=this.groupingInfos[(t==null?void 0:t.level)??0],s=t.level===this.groupingInfos.length;let n,o=i.aggregators.length;if(!s&&i.aggregateChildGroups){let a=((l=t.groups)==null?void 0:l.length)??0;for(;a--;)t.groups[a].totals.initialized||this.calculateTotals(t.groups[a].totals)}for(;o--;)n=i.aggregators[o],n.init(),!s&&i.aggregateChildGroups?i.compiledAccumulators[o].call(n,t.groups):i.compiledAccumulators[o].call(n,t.rows),n.storeResult(e);e.initialized=!0}addGroupTotals(e){const t=this.groupingInfos[e.level],i=new mc;i.group=e,e.totals=i,t.lazyTotalsCalculation||this.calculateTotals(i)}addTotals(e,t){var a,h;t=t||0;const i=this.groupingInfos[t],s=i.collapsed,n=this.toggledGroupsByLevel[t];let o=e.length,l;for(;o--;)l=e[o],!(l.collapsed&&!i.aggregateCollapsed)&&(l.groups&&this.addTotals(l.groups,t+1),(a=i.aggregators)!=null&&a.length&&(i.aggregateEmpty||l.rows.length||(h=l.groups)!=null&&h.length)&&this.addGroupTotals(l),l.collapsed=s^n[l.groupingKey],l.title=i.formatter?i.formatter(l):l.value)}flattenGroupedRows(e,t){t=t||0;const i=this.groupingInfos[t],s=[];let n,o=0,l;for(let a=0,h=e.length;a<h;a++){if(l=e[a],s[o++]=l,!l.collapsed){n=l.groups?this.flattenGroupedRows(l.groups,t+1):l.rows;for(let d=0,c=n.length;d<c;d++)s[o++]=n[d]}l.totals&&i.displayTotalsRow&&(!l.collapsed||i.aggregateCollapsed)&&(s[o++]=l.totals)}return s}compileAccumulatorLoopCSPSafe(e){return e.accumulate?function(t){let i;if(Array.isArray(t))for(let s=0;s<t.length;s++){const n=t[s];i=e.accumulate.call(e,n)}return i}:function(){}}compileFilterCSPSafe(e,t){if(typeof this.filterCSPSafe!="function")return[];const i=[],s=e.length;for(let n=0;n<s;n++)this.filterCSPSafe(e[n],t)&&i.push(e[n]);return i}compileFilter(e=!1){if(e)return null;const t=yn(this.filter),i="{ continue _coreloop; }$1",s="{ _retval[_idx++] = $item$; continue _coreloop; }$1",n=t.body.replace(/return false\s*([;}]|\}|$)/gi,i).replace(/return!1([;}]|\}|$)/gi,i).replace(/return true\s*([;}]|\}|$)/gi,s).replace(/return!0([;}]|\}|$)/gi,s).replace(/return ([^;}]+?)\s*([;}]|$)/gi,"{ if ($1) { _retval[_idx++] = $item$; }; continue _coreloop; }$2");let o=["var _retval = [], _idx = 0; ","var $item$, $args$ = _args; ","_coreloop: ","for (var _i = 0, _il = _items.length; _i < _il; _i++) { ","$item$ = _items[_i]; ","$filter$; ","} ","return _retval; "].join("");o=o.replace(/\$filter\$/gi,n),o=o.replace(/\$item\$/gi,t.params[0]),o=o.replace(/\$args\$/gi,t.params[1]);const l=new Function("_items,_args",o),a="compiledFilter";return l.displayName=a,l.name=this.setFunctionName(l,a),l}compileFilterWithCaching(e=!1){if(e)return null;const t=yn(this.filter),i="{ continue _coreloop; }$1",s="{ _cache[_i] = true;_retval[_idx++] = $item$; continue _coreloop; }$1",n=t.body.replace(/return false\s*([;}]|\}|$)/gi,i).replace(/return!1([;}]|\}|$)/gi,i).replace(/return true\s*([;}]|\}|$)/gi,s).replace(/return!0([;}]|\}|$)/gi,s).replace(/return ([^;}]+?)\s*([;}]|$)/gi,"{ if ((_cache[_i] = $1)) { _retval[_idx++] = $item$; }; continue _coreloop; }$2");let o=["var _retval = [], _idx = 0; ","var $item$, $args$ = _args; ","_coreloop: ","for (var _i = 0, _il = _items.length; _i < _il; _i++) { ","$item$ = _items[_i]; ","if (_cache[_i]) { ","_retval[_idx++] = $item$; ","continue _coreloop; ","} ","$filter$; ","} ","return _retval; "].join("");o=o.replace(/\$filter\$/gi,n),o=o.replace(/\$item\$/gi,t.params[0]),o=o.replace(/\$args\$/gi,t.params[1]);const l=new Function("_items,_args,_cache",o),a="compiledFilterWithCaching";return l.displayName=a,l.name=this.setFunctionName(l,a),l}compileFilterWithCachingCSPSafe(e,t,i){if(typeof this.filterCSPSafe!="function")return[];const s=[],n=e.length;for(let o=0;o<n;o++)(i[o]||this.filterCSPSafe(e[o],t))&&s.push(e[o]);return s}setFunctionName(e,t){try{Object.defineProperty(e,"name",{writable:!0,value:t})}catch{e.name=t}}uncompiledFilter(e,t){var n;const i=[];let s=0;for(let o=0,l=e.length;o<l;o++)(n=this.filter)!=null&&n.call(this,e[o],t)&&(i[s++]=e[o]);return i}uncompiledFilterWithCaching(e,t,i){var l;const s=[];let n=0,o;for(let a=0,h=e.length;a<h;a++)o=e[a],i[a]?s[n++]=o:(l=this.filter)!=null&&l.call(this,o,t)&&(s[n++]=o,i[a]=!0);return s}getFilteredAndPagedItems(e){if(this._options.useCSPSafeFilter?this.filterCSPSafe:this.filter){let i,s;this._options.useCSPSafeFilter?(i=this._options.inlineFilters?this.compiledFilterCSPSafe:this.uncompiledFilter,s=this._options.inlineFilters?this.compiledFilterWithCachingCSPSafe:this.uncompiledFilterWithCaching):(i=this._options.inlineFilters?this.compiledFilter:this.uncompiledFilter,s=this._options.inlineFilters?this.compiledFilterWithCaching:this.uncompiledFilterWithCaching),this.refreshHints.isFilterNarrowing?this.filteredItems=i.call(this,this.filteredItems,this.filterArgs):this.refreshHints.isFilterExpanding?this.filteredItems=s.call(this,e,this.filterArgs,this.filterCache):this.refreshHints.isFilterUnchanged||(this.filteredItems=i.call(this,e,this.filterArgs))}else this.filteredItems=this.pagesize?e:e.concat();let t;return this.pagesize?(this.filteredItems.length<=this.pagenum*this.pagesize&&(this.filteredItems.length===0?this.pagenum=0:this.pagenum=Math.floor((this.filteredItems.length-1)/this.pagesize)),t=this.filteredItems.slice(this.pagesize*this.pagenum,this.pagesize*this.pagenum+this.pagesize)):t=this.filteredItems,{totalRows:this.filteredItems.length,rows:t}}getRowDiffs(e,t){var h,d,c;let i,s,n;const o=[];let l=0,a=Math.max(t.length,e.length);(h=this.refreshHints)!=null&&h.ignoreDiffsBefore&&(l=Math.max(0,Math.min(t.length,this.refreshHints.ignoreDiffsBefore))),(d=this.refreshHints)!=null&&d.ignoreDiffsAfter&&(a=Math.min(t.length,Math.max(0,this.refreshHints.ignoreDiffsAfter)));for(let u=l,p=e.length;u<a;u++)u>=p?o[o.length]=u:(i=t[u],s=e[u],(!i||this.groupingInfos.length&&(n=i.__nonDataRow||s.__nonDataRow)&&i.__group!==s.__group||i.__group&&!i.equals(s)||n&&(i.__groupTotals||s.__groupTotals)||i[this.idProperty]!==s[this.idProperty]||(c=this.updated)!=null&&c[i[this.idProperty]])&&(o[o.length]=u));return o}recalc(e){this.rowsById=void 0,(this.refreshHints.isFilterNarrowing!==this.prevRefreshHints.isFilterNarrowing||this.refreshHints.isFilterExpanding!==this.prevRefreshHints.isFilterExpanding)&&(this.filterCache=[]);const t=this.getFilteredAndPagedItems(e);this.totalRows=t.totalRows;let i=t.rows;this.groups=[],this.groupingInfos.length&&(this.groups=this.extractGroups(i),this.groups.length&&(i=this.flattenGroupedRows(this.groups)));const s=this.getRowDiffs(this.rows,i);return this.rows=i,s}refresh(){if(this.suspend)return;const e=de(!0,{},this.getPagingInfo()),t=this.rows.length,i=this.totalRows;let s=this.recalc(this.items);this.pagesize&&this.totalRows<this.pagenum*this.pagesize&&(this.pagenum=Math.max(0,Math.ceil(this.totalRows/this.pagesize)-1),s=this.recalc(this.items)),this.updated=null,this.prevRefreshHints=this.refreshHints,this.refreshHints={},i!==this.totalRows&&this.onBeforePagingInfoChanged.notify(e,null,this).getReturnValue()!==!1&&this.onPagingInfoChanged.notify(this.getPagingInfo(),null,this),t!==this.rows.length&&this.onRowCountChanged.notify({previous:t,current:this.rows.length,itemCount:this.items.length,dataView:this,callingOnRowsChanged:s.length>0},null,this),s.length>0&&this.onRowsChanged.notify({rows:s,itemCount:this.items.length,dataView:this,calledOnRowCountChanged:t!==this.rows.length},null,this),(t!==this.rows.length||s.length>0)&&this.onRowsOrCountChanged.notify({rowsDiff:s,previousRowCount:t,currentRowCount:this.rows.length,itemCount:this.items.length,rowCountChanged:t!==this.rows.length,rowsChanged:s.length>0,dataView:this},null,this)}syncGridSelection(e,t,i){this._grid=e;let s;this.selectedRowIds=this.mapRowsToIds(e.getSelectedRows());const n=e.getOptions(),o=a=>{a===!1?this.selectedRowIds=[]:this.selectedRowIds.sort().join(",")!==a.sort().join(",")&&(this.selectedRowIds=a)},l=()=>{if((this.selectedRowIds||[]).length>0&&!s){s=!0;const a=this.mapIdsToRows(this.selectedRowIds||[]);if(!t){const h={grid:this._grid,ids:this.mapRowsToIds(a),rows:a,dataView:this};this.preSelectedRowIdsChangeFn(h),this.onSelectedRowIdsChanged.notify(Object.assign(h,{selectedRowIds:this.selectedRowIds,filteredIds:this.getAllSelectedFilteredIds()}),new le,this)}e.setSelectedRows(a),s=!1}};return e.onSelectedRowsChanged.subscribe((a,h)=>{if(!s){const d=this.mapRowsToIds(h.rows),c={grid:this._grid,ids:d,rows:h.rows,added:!0,dataView:this};this.preSelectedRowIdsChangeFn(c),this.onSelectedRowIdsChanged.notify(Object.assign(c,{selectedRowIds:this.selectedRowIds,filteredIds:this.getAllSelectedFilteredIds()}),new le,this)}}),this.preSelectedRowIdsChangeFn=a=>{var h,d;if(!s){if(s=!0,typeof a.added>"u")o(a.ids);else{let u;a.added?i&&n.multiSelect?u=((h=this.selectedRowIds)==null?void 0:h.filter(m=>this.getRowById(m)===void 0)).concat(a.ids):u=a.ids:i&&n.multiSelect?u=(d=this.selectedRowIds)==null?void 0:d.filter(p=>a.ids.indexOf(p)===-1):u=[],o(u)}s=!1}},this.onRowsOrCountChanged.subscribe(l.bind(this)),this.onSelectedRowIdsChanged}getAllSelectedIds(){return this.selectedRowIds}getAllSelectedFilteredIds(){return this.getAllSelectedFilteredItems().map(e=>e[this.idProperty])}setSelectedIds(e,t){var a;let i=t==null?void 0:t.isRowBeingAdded;const s=t==null?void 0:t.shouldTriggerEvent,n=t==null?void 0:t.applyRowSelectionToGrid;i!==!1&&(i=!0);const o=this.mapIdsToRows(e),l={grid:this._grid,ids:e,rows:o,added:i,dataView:this};(a=this.preSelectedRowIdsChangeFn)==null||a.call(this,l),s!==!1&&this.onSelectedRowIdsChanged.notify(Object.assign(l,{selectedRowIds:this.selectedRowIds,filteredIds:this.getAllSelectedFilteredIds()}),new le,this),n!==!1&&this._grid&&this._grid.setSelectedRows(o)}getAllSelectedItems(){const e=[];return this.getAllSelectedIds().forEach(i=>{e.push(this.getItemById(i))}),e}getAllSelectedFilteredItems(){return Array.isArray(this.selectedRowIds)?this.filteredItems.filter(t=>this.selectedRowIds.some(i=>t[this.idProperty]===i))||[]:[]}syncGridCellCssStyles(e,t){let i,s;const n=l=>{i={},typeof l=="object"&&Object.keys(l).forEach(a=>{if(l&&this.rows[a]){const h=this.rows[a][this.idProperty];i[h]=l[a]}})};n(e.getCellCssStyles(t));const o=()=>{if(typeof i=="object"){s=!0,this.ensureRowsByIdCache();const l={};Object.keys(i).forEach(a=>{var d;const h=(d=this.rowsById)==null?void 0:d[a];ie(h)&&(l[h]=i[a])}),e.setCellCssStyles(t,l),s=!1}};e.onCellCssStylesChanged.subscribe((l,a)=>{s||t!==a.key||(a.hash?n(a.hash):(e.onCellCssStylesChanged.unsubscribe(),this.onRowsOrCountChanged.unsubscribe(o)))}),this.onRowsOrCountChanged.subscribe(o.bind(this))}}/**!
2
+ `:if(p==="<"){u=zi,g+="< ",p="";break}p+=C;break;default:p+=C;break}else if(u===yo)switch(C){case">":p.slice(-2)==="--"&&(u=zi),p="";break;default:p+=C;break}}return h.state=u,h.tag_buffer=p,h.depth=m,h.in_quote_char=f,g}function o(a){let h=new Set;if(typeof a=="string"){let d;for(;d=yh.exec(a);)h.add(d[1])}else typeof a[Symbol.iterator]=="function"&&(h=new Set(a));return h}function l(a){const h=Eh.exec(a);return h?h[1].toLowerCase():null}return i(r,e,t)}const wh=Object.freeze(Object.defineProperty({__proto__:null,addToArrayWhenNotExists:Ch,addWhiteSpaces:Vi,arrayRemoveItemByIndex:Sn,calculateAvailableSpace:Li,classNameToList:he,createDomElement:v,deepCopy:vh,deepMerge:Kt,destroyAllElementProps:vn,emptyElement:J,emptyObject:Co,extend:de,findFirstAttribute:Hi,findWidthOrDefault:It,getFunctionDetails:yn,getHtmlStringOutput:gt,getInnerSize:ds,getOffset:me,getOffsetRelativeToParent:no,getStyleProp:ro,htmlEncode:oo,htmlEncodeWithPadding:ao,htmlEntityDecode:lo,insertAfterElement:ho,isDefined:ie,isDefinedNumber:Qt,isEmptyObject:En,isNumber:U,isObject:Ht,isObjectEmpty:vo,isPrimitiveOrHTML:Zt,isPrimitiveValue:Bi,parseBoolean:us,removeAccentFromText:ci,setDeepValue:$e,stripTags:we,titleCase:Jt,toCamelCase:wn,toKebabCase:ui,toSentenceCase:_t,toSnakeCase:bh,uniqueArray:bo,uniqueObjectArray:Sh,windowScrollPosition:bn},Symbol.toStringTag,{value:"Module"})),Th=(r,e,t=ae.neutral,i,s)=>{let n=0;const o=(i==null?void 0:i.valueCouldBeUndefined)??(s==null?void 0:s.cellValueCouldBeUndefined)??!1;return r===e?n=0:r===null||o&&r===void 0?n=-1:e===null||o&&e===void 0?n=1:(s!=null&&s.ignoreAccentOnStringFilterAndSort&&(r=ci(r,!1),e=ci(e,!1)),t?n=r<e?-1:1:n=r<e?1:-1),t*n},Eo=(r,e,t=ae.neutral,i,s)=>{const n=(i==null?void 0:i.valueCouldBeUndefined)??(s==null?void 0:s.cellValueCouldBeUndefined)??!1,o=isNaN(r)||r===""||r===null||n&&r===void 0?-1/0:parseFloat(r),l=isNaN(e)||e===""||e===null||n&&e===void 0?-1/0:parseFloat(e);return t*(o===l?0:o>l?1:-1)};var wo=/^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\.[0-9]+)?(Z|(?:\+|\-)[0-9]{2}:?[0-9]{2})?$/;function Oh(r){const e=r.match(wo);if(e){const t=Number(e[2]);if(t<1||t>12)return!1;if(typeof e[3]!==void 0){const i=Number(e[3]);if(i<1||i>31)return!1}if(typeof e[4]!==void 0){const i=Number(e[4]);if(i<0||i>23)return!1}return!0}return!1}function xh(r){const e=r.match(wo);return e&&typeof e[4]>"u"?r+="T00:00:00":r}function Vt(r){if(r||(r=new Date),r instanceof Date){const e=new Date(r);return e.setMilliseconds(0),e}if(r=r.trim(),Oh(r))return new Date(xh(r));throw new Error(`Non ISO 8601 compliant date (${r}).`)}function Ih(r){const e=Vt(r);return e.setDate(1),e.setMonth(e.getMonth()+1),e.setDate(0),e}function Rh(r){return Ih(r).getDate()}var Tn="1999-03-04T02:05:01.000Z",On=new Map,xn=[["YYYY",{year:"numeric"}],["YY",{year:"2-digit"}],["MMMM",{month:"long"}],["MMM",{month:"short"}],["MM",{month:"2-digit"}],["M",{month:"numeric"}],["DD",{day:"2-digit"}],["D",{day:"numeric"}],["dddd",{weekday:"long"}],["ddd",{weekday:"short"}],["d",{weekday:"narrow"}],["mm",{minute:"2-digit"}],["m",{minute:"numeric"}],["ss",{second:"2-digit"}],["s",{second:"numeric"}],["ZZ",{timeZoneName:"long"}],["Z",{timeZoneName:"short"}]],In=[["HH",{hour:"2-digit"}],["H",{hour:"numeric"}]],Rn=[["hh",{hour:"2-digit"}],["h",{hour:"numeric"}],["a",{dayPeriod:"narrow"}],["A",{dayPeriod:"narrow"}]],ps={DD:2,HH:2,MM:2,YY:2,YYYY:4,hh:2,mm:2,ss:2};function To(r){if(/^[+-]\d{2}:\d{2}/.test(r))return 6;if(/^[+-]\d{4}/.test(r))return 5;throw new Error("Invalid offset format")}var Ah=["MMMM","MMM","dddd","ddd"],Te=new Map([...xn,...In,...Rn].map(r=>[r[0],r])),Oo=new Map,xo=["full","long","medium","short"],Bt=r=>String(r).padStart(2,"0"),An=r=>String(r).padStart(2,"0");function Rt(r){return r.type==="literal"&&(r.value=r.value.normalize("NFKC")),r}function Ph(r,e,t,i=!1,s=null){const n=kh(r,e,t,i),o=Vt(r);function l({partName:a,partValue:h,token:d}){if(a==="literal")return h;const c=n[a];if(a==="hour"&&d==="H")return c.replace(/^0/,"")||"0";if(["mm","ss","MM"].includes(d)&&c.length===1)return`0${c}`;if(a==="dayPeriod"){const u=pi(o.getUTCHours()<12?"am":"pm",t);return d==="A"?u.toUpperCase():u.toLowerCase()}return a==="timeZoneName"?s??Io(-1*o.getTimezoneOffset(),d):c}return e.map(a=>({...a,value:l(a)}))}function kh(r,e,t,i=!1){const s=Vt(r),n=e.filter(d=>d.hour12),o=e.filter(d=>!d.hour12),l=[],a=[];function h(d,c=!1){const u=`${t}-u-hc-${c?"h12":"h23"}`;if(l.push(...new Intl.DateTimeFormat(u,d.reduce((p,m)=>m.partName==="literal"?p:(i&&Ah.includes(m.token)&&a.push(m),Object.assign(p,m.option)),{timeZone:"UTC"})).formatToParts(s).map(Rt)),i&&a.length)for(const p of a){let m=[];switch(p.token){case"MMMM":m=new Intl.DateTimeFormat(u,{dateStyle:"long",timeZone:"UTC"}).formatToParts(s).map(Rt);break;case"MMM":m=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:"UTC"}).formatToParts(s).map(Rt);break}const f=m.find(_=>_.type===p.partName),g=l.findIndex(_=>_.type===p.partName);f&&g>-1&&(l[g]=f)}}return n.length&&h(n,!0),o.length&&h(o),l.reduce((d,c)=>(d[c.type]=c.value,d),{})}function Io(r,e="Z"){const t=String(Math.floor(Math.abs(r/60))).padStart(2,"0"),i=String(Math.abs(r%60)).padStart(2,"0"),s=r<0?"-":"+";return e==="ZZ"?`${s}${t}${i}`:`${s}${t}:${i}`}function Fh(r,e){Ro(r,e);const[t,i,s,n]=r.match(/([+-])([0-3][0-9]):?([0-6][0-9])/),o=Number(s)*60+Number(n);return i==="+"?o:-o}function Ro(r,e="Z"){if(!(i=>{switch(i){case"Z":return/^([+-])[0-3][0-9]:[0-6][0-9]$/.test(r);case"ZZ":return/^([+-])[0-3][0-9][0-6][0-9]$/.test(r)}})(e))throw new Error(`Invalid offset: ${r}`);return r}function Dh(r){return xn.concat(In).concat(Rn).sort((e,t)=>e[0].length>t[0].length?1:-1).reduce((e,t)=>e.replace(t[0],`\\${t[0]}`),r)}function Mh(r){return["numeric","2-digit"].includes(r.partValue)}function Nh(r){let e;for(const t of r){if(t.partName==="literal"&&!isNaN(parseFloat(t.partValue)))throw new Error(`Numbers in format (${t.partValue}).`);if(e&&e.partName!=="literal"&&t.partName!=="literal"&&!(e.token in ps)&&!(t.token in ps)&&!(Mh(e)&&t.token.toLowerCase()==="a"))throw new Error(`Illegal adjacent tokens (${e.token}, ${t.token})`);e=t}return r}function Lh(r){return typeof r=="string"?r.includes("ZZ")?"ZZ":"Z":"time"in r&&r.time==="full"?"Z":"ZZ"}function pi(r,e){const t=Oo.get(e);if(t&&t[r])return t[r];const i=new Date(Tn);i.setUTCHours(r==="am"?5:20);const n=new Intl.DateTimeFormat(e,{timeStyle:"full",timeZone:"UTC",hour12:!0}).formatToParts(i).map(Rt).find(o=>o.type==="dayPeriod");if(n){const o=t||{};return Oo.set(e,Object.assign(o,{[r]:n.value})),n.value}return r}function Hh(r,e="+00:00"){const t=Vt(r),i=(()=>{switch(To(e)){case 5:return"ZZ";case 6:return"Z"}})(),s=Fh(e,i);return new Date(t.getTime()+s*1e3*60)}function Ao(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Po(r,e){const t=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:e,hourCycle:"h23"}).formatToParts(r).map(Rt),i={};return t.forEach(s=>{i[s.type]=s.value}),new Date(`${i.year}-${i.month}-${i.day}T${i.hour}:${i.minute}:${i.second}Z`)}function Pn(r,e="UTC",t="device",i="Z"){var s;t=t==="device"?(s=Ao())!=null?s:"utc":t;const n=Vt(r),o=Po(n,e),l=Po(n,t),a=Math.round((l.getTime()-o.getTime())/1e3/60);return Io(a,i)}function ko(r){const e=Vt(r);return e.setHours(0,0,0),e}function kn(r,e){if(xo.includes(r)||typeof r=="object")return Vh(r,e);let t=r,i=0;const s=d=>{if(d[2]||(d[2]=new RegExp(`(.)?(${d[0]})`,"g")),d[2].test(t)){let c=0;return t=t.replace(d[2],(u,p,m)=>p==="\\"?m:`${typeof p=="string"?p:""}{!${c++?i:i++}!}`),!!c}return!1};function n(d){const c=d.map(p=>p.partName),u=new Set(c);if(c.length>u.size)throw new Error("Cannot reuse format tokens.");return d}function o(d,[c,u,p]){const m=Object.keys(u)[0],f=u[m];return{option:u,partName:m,partValue:f,token:c,pattern:p,hour12:d}}const l=xn.filter(s).concat(In.filter(s)).map(o.bind(null,!1)),a=n(l.concat(Rn.filter(s).map(o.bind(null,!0)))),h=/^\{!(\d+)!\}$/;return t.split(/(\{!\d+!\})/).map(d=>{const c=d.match(h);return c?a[Number(c[1])]:{option:{literal:d},partName:"literal",partValue:d,token:d,pattern:new RegExp(""),hour12:!1}}).filter(d=>!(d.partName==="literal"&&d.partValue===""))}function Vh(r,e){const t={timeZone:"UTC"};typeof r=="string"?t.dateStyle=r:("date"in r&&(t.dateStyle=r.date),"time"in r&&(t.timeStyle=r.time));const i=new Intl.DateTimeFormat(e,t),s=i.formatToParts(new Date(Tn)).map(Rt),o=i.formatToParts(new Date("1999-04-05T23:05:01.000Z")).map(Rt).find(a=>a.type==="hour"),l=o&&o.value==="23"?24:12;return s.map(a=>{const h=a.type,d=Bh(a.type,a.value,e,a.type==="hour"?l:void 0,t);if(d===void 0)return;const c=d[1][h];if(c)return d[2]||(d[2]=new RegExp(`${d[0]}`,"g")),{option:{[h]:c},partName:h,partValue:c,token:d[0],pattern:d[2],hour12:l===12}}).filter(a=>!!a)}function Bh(r,e,t,i,s){const n=e.length,o=!isNaN(Number(e));let l;switch(r){case"year":return n===2?Te.get("YY"):Te.get("YYYY");case"month":if(o)return n===1?Te.get("M"):Te.get("MM");switch(l=Fo(t,r,e),l){case"long":return Te.get("MMMM");default:return Te.get("MMM")}case"day":return n===1?Te.get("D"):Te.get("DD");case"weekday":switch(l=Fo(t,r,e),l){case"narrow":return Te.get("d");case"short":return Te.get("ddd");default:return Te.get("dddd")}case"hour":return i===12?n===1?Te.get("h"):Te.get("hh"):n===1?Te.get("H"):Te.get("HH");case"minute":return n===1?Te.get("m"):Te.get("mm");case"second":return n===1?Te.get("s"):Te.get("ss");case"dayPeriod":return/^[A-Z]+$/u.test(e)?Te.get("A"):Te.get("a");case"literal":return[e,{literal:e},new RegExp("")];case"timeZoneName":return s.timeStyle==="full"?Te.get("Z"):Te.get("ZZ");default:return}}function Fo(r,e,t){if(!On.has(r)){const s=new Date(Tn),n=[3,8,9,7,6,4,3],o=["weekday","month","dayPeriod"],l=["long","short","narrow"],a={};for(let h=0;h<12;h++){s.setMonth(0+h),h in n&&s.setDate(n[h]),s.setUTCHours(8+h);for(const d of l){const c=new Intl.DateTimeFormat(r,o.reduce((u,p)=>Object.assign(u,{[p]:d}),{hour12:!0,timeZone:"UTC"})).formatToParts(s).map(Rt);if(d==="long"||d==="short"){const p=new Intl.DateTimeFormat(r,{dateStyle:d==="short"?"medium":"long",timeZone:"UTC"}).formatToParts(s).map(Rt).find(f=>f.type==="month"),m=c.findIndex(f=>f.type==="month");m>-1&&p&&(c[m]=p)}c.forEach(u=>{if(u.type==="literal")return;const p=u.type;a[p]=Object.assign(a[p]||{},{[u.value]:d})})}}On.set(r,a)}const i=On.get(r);return i?i[e][t]:void 0}function Do(r,e="+00:00"){const t=e.slice(0,1)==="+";return Hh(r,e.replace(t?"+":"-",t?"-":"+"))}function zh(){return Intl.DateTimeFormat().resolvedOptions().locale}function Qe(r,e="long",t="device",i=!1,s){let n,o;return typeof r=="object"&&!(r instanceof Date)&&({date:r,format:e,locale:t,genitive:i,partFilter:s,tz:n}=r),e==="ISO8601"?Vt(r).toISOString():(n&&(o=Pn(r,"utc",n,Lh(e))),n??(n=Ao()),(n==null?void 0:n.toLowerCase())!=="utc"&&(r=Do(r,Pn(r,n,"utc"))),(!t||t==="device")&&(t=zh()),Ph(r,kn(e,t).filter(s??(()=>!0)),t,i,o).map(l=>l.value).join(""))}function $h(r,e="en",t=!1,i=()=>!0){return kn(r,e).filter(i).reduce((s,n)=>s+=t&&n.partName==="literal"?Dh(n.token):n.token,"").normalize("NFKC")}function Wh(r){const e=new Date().getFullYear(),t=e%100,i=Math.floor(e/100),s=Number(r);return(i+(s>t+20?-1:0))*100+s}function Mo(r,e="en",t=!1){const i=(s,n)=>Array(s).fill("").map((o,l)=>`${n(l)}`);if(r==="M")return i(12,s=>s+1);if(r==="MM")return i(12,s=>{const n=s+1;return n<10?`0${n}`:n});if(r.startsWith("M"))return Mo("MM").map(s=>Qe(`2000-${s}-05`,r,e,t));if(r.startsWith("d"))return i(7,s=>`0${s+2}`).map(s=>Qe(`2022-10-${s}`,r,e));if(r==="a")return[pi("am",e).toLowerCase(),pi("pm",e).toLowerCase()];if(r==="A")return[pi("am",e).toUpperCase(),pi("pm",e).toUpperCase()];if(r.startsWith("Y")){const s=new Date().getFullYear();return i(120,n=>n+1).reduce((n,o)=>(o!=="120"&&n.push(Qe(`${s+Number(o)}-06-06`,r,e)),n.unshift(Qe(`${s-Number(o)}-06-06`,r,e)),n),[Qe(`${s}-06-06`,r,e)])}return r.startsWith("D")?i(31,s=>`${r==="DD"&&s<9?"0":""}${s+1}`):r.startsWith("H")?i(24,s=>`${r==="HH"&&s<10?"0":""}${s}`):r.startsWith("h")?i(12,s=>`${r==="hh"&&s<9?"0":""}${s+1}`):r.startsWith("m")||r.startsWith("s")?i(60,s=>`${r.length>1&&s<10?"0":""}${s}`):[]}function ms(r,e="ISO8601",t="device"){let i=()=>!0,s,n="backward";if(typeof r=="object"?{date:s,format:e="ISO8601",locale:t="device",dateOverflow:n="backward",partFilter:i=()=>!0}=r:s=r,!s)throw new Error("parse() requires a date string.");const o=()=>{throw new Error(`Date (${s}) does not match format (${$h(e,t)})`)};if(e==="ISO8601")return Vt(s);const l=xo.includes(e)||typeof e=="object",a=Nh(kn(e,t).filter(i));if(!a.length)throw new Error("parse() requires a pattern.");let h;try{h=Gh(s,a)}catch{return o()}const d=new Date,c=new Map([["YYYY",d.getFullYear()],["MM",d.getMonth()+1],["DD",d.getDate()],["HH",0],["mm",0],["ss",0]]);let u=null,p="";h.forEach(O=>{if(O.partName==="literal")return;if(O.token===O.value)return o();const I=Number(O.value);if(c.has(O.token))c.set(O.token,I);else if(O.token==="YY")c.set("YYYY",Wh(O.value));else{const A=O.token;if(A.startsWith("d"))return;if(A==="D")c.set("DD",I);else if(A==="H"||A.startsWith("h"))c.set("HH",I);else if(A==="M")c.set("MM",I);else if(A==="a"||A==="A")u=O.value.toLowerCase()===pi("am",t).toLowerCase();else if(A==="Z"||A==="ZZ")p=Ro(O.value,A);else{const L=Mo(A,t,l).indexOf(O.value);if(L!==-1)switch(A){case"MMM":case"MMMM":c.set("MM",L+1);break}}}});let m=c.get("HH")||0;u===!1?(m+=m===12?0:12,c.set("HH",m===24?0:m)):u===!0&&m===12&&c.set("HH",0),c.set("MM",(c.get("MM")||1)-1);let[f,g,_,b,C,E]=Array.from(c.values());const y=Rh(new Date(`${An(f)}-${Bt(g+1)}-10`));if(y<_&&n==="throw")throw new Error(`Invalid date ${An(f)}-${Bt(g+1)}-${Bt(_)}`);_=n==="backward"?Math.min(_,y):_;const T=`${An(f)}-${Bt(g+1)}-${Bt(_)}T${Bt(b)}:${Bt(C)}:${Bt(E)}${p}`,x=new Date(T);return isFinite(+x)?x:o()}function Gh(r,e){let t=0;const i=l=>[l[t++],l[t]];let s=0;const n=[];let o;do{const[l,a]=i(e);o=a;let h=1;if(l.partName==="literal")h=l.partValue.length;else if(l.partName==="timeZoneName")h=To(r.substring(s));else if(l.token in ps)h=ps[l.token];else if(a)if(a.partName==="literal"){if(h=r.indexOf(a.partValue,s)-s,h<0)throw new Error}else if(a.partName==="dayPeriod"){for(let d=1;d<=4;d++)if(isNaN(Number(r.charAt(s+d)))){h=d;break}}else{const d=r.substring(s).search(/\d/);d!==-1&&(h=s+d)}else h=r.length;n.push({...l,value:r.substring(s,s+h)}),s+=h}while(o);return n}function Ze(r,e=!1){let t;switch(r){case S.dateTime:case S.dateTimeIso:t="YYYY-MM-DD HH:mm:ss";break;case S.dateTimeIsoAmPm:t="YYYY-MM-DD hh:mm:ss a";break;case S.dateTimeIsoAM_PM:t="YYYY-MM-DD hh:mm:ss A";break;case S.dateTimeShortIso:t="YYYY-MM-DD HH:mm";break;case S.dateEuro:t="DD/MM/YYYY";break;case S.dateEuroShort:t=e?"DD/MM/YY":"D/M/YY";break;case S.dateTimeEuro:t="DD/MM/YYYY HH:mm:ss";break;case S.dateTimeShortEuro:t=e?"DD/MM/YYYY HH:mm":"D/M/YYYY H:m";break;case S.dateTimeEuroAmPm:t="DD/MM/YYYY hh:mm:ss a";break;case S.dateTimeEuroAM_PM:t="DD/MM/YYYY hh:mm:ss A";break;case S.dateTimeEuroShort:t=e?"DD/MM/YY HH:mm:ss":"D/M/YY H:m:s";break;case S.dateTimeEuroShortAmPm:t=e?"DD/MM/YY hh:mm:ss a":"D/M/YY h:m:s a";break;case S.dateTimeEuroShortAM_PM:t=e?"DD/MM/YY hh:mm:ss A":"D/M/YY h:m:s A";break;case S.dateUs:t="MM/DD/YYYY";break;case S.dateUsShort:t=e?"MM/DD/YY":"M/D/YY";break;case S.dateTimeUs:t="MM/DD/YYYY HH:mm:ss";break;case S.dateTimeUsAmPm:t="MM/DD/YYYY hh:mm:ss a";break;case S.dateTimeUsAM_PM:t="MM/DD/YYYY hh:mm:ss A";break;case S.dateTimeUsShort:t=e?"MM/DD/YY HH:mm:ss":"M/D/YY H:m:s";break;case S.dateTimeUsShortAmPm:t=e?"MM/DD/YY hh:mm:ss a":"M/D/YY h:m:s a";break;case S.dateTimeUsShortAM_PM:t=e?"MM/DD/YY hh:mm:ss A":"M/D/YY h:m:s A";break;case S.dateTimeShortUs:t=e?"MM/DD/YYYY HH:mm":"M/D/YYYY H:m";break;case S.dateUtc:t="ISO8601";break;case S.date:case S.dateIso:default:t="YYYY-MM-DD";break}return t}function Ct(r,e,t){const i=e?Ze(e):void 0,s=Ze(t),n=r instanceof Date?r:At(r,i);return n&&r!==void 0?t===S.dateUtc?n.toISOString():Qe(n,s,"en-US"):""}function At(r,e,t=!1){try{return r?r instanceof Date?r:ms({date:r,format:e,dateOverflow:t?"throw":"backward",locale:"en-US"}):!1}catch{return!1}}function Uh(r){return Do(r,Pn(r,"utc"))}function No(r,e,t,i,s){let n=0;if(r===e)n=0;else{let o=At(r,i,s),l=At(e,i,s);o||(o=new Date(1001,1,1)),l||(l=new Date(1001,1,1)),n=o.valueOf()-l.valueOf()}return t*n}function ue(r){const e=r===S.date?void 0:Ze(r);return(t,i,s)=>e===void 0?No(t,i,s,e,!1):No(t,i,s,e,!0)}const ei={boolean:gh,date:ue(S.date),dateIso:ue(S.dateIso),dateUtc:ue(S.dateUtc),dateTime:ue(S.dateTime),dateTimeIso:ue(S.dateTimeIso),dateTimeIsoAmPm:ue(S.dateTimeIsoAmPm),dateTimeIsoAM_PM:ue(S.dateTimeIsoAM_PM),dateTimeShortIso:ue(S.dateTimeShortIso),dateEuro:ue(S.dateEuro),dateEuroShort:ue(S.dateEuroShort),dateTimeShortEuro:ue(S.dateTimeShortEuro),dateTimeEuro:ue(S.dateTimeEuro),dateTimeEuroAmPm:ue(S.dateTimeEuroAmPm),dateTimeEuroAM_PM:ue(S.dateTimeEuroAM_PM),dateTimeEuroShort:ue(S.dateTimeEuroShort),dateTimeEuroShortAmPm:ue(S.dateTimeEuroShortAmPm),dateTimeEuroShortAM_PM:ue(S.dateTimeEuroShortAM_PM),dateUs:ue(S.dateUs),dateUsShort:ue(S.dateUsShort),dateTimeShortUs:ue(S.dateTimeShortUs),dateTimeUs:ue(S.dateTimeUs),dateTimeUsAmPm:ue(S.dateTimeUsAmPm),dateTimeUsAM_PM:ue(S.dateTimeUsAM_PM),dateTimeUsShort:ue(S.dateTimeUsShort),dateTimeUsShortAmPm:ue(S.dateTimeUsShortAmPm),dateTimeUsShortAM_PM:ue(S.dateTimeUsShortAM_PM),numeric:Eo,objectString:_h,string:Th};function mi(r,e,t,i,s,n){let o=0;switch(r){case S.boolean:o=ei.boolean(e,t,i,s,n);break;case S.float:case S.integer:case S.number:o=ei.numeric(e,t,i,s,n);break;case S.date:case S.dateIso:case S.dateUtc:case S.dateTime:case S.dateTimeIso:case S.dateTimeIsoAmPm:case S.dateTimeIsoAM_PM:case S.dateTimeShortIso:case S.dateEuro:case S.dateEuroShort:case S.dateTimeShortEuro:case S.dateTimeEuro:case S.dateTimeEuroAmPm:case S.dateTimeEuroAM_PM:case S.dateTimeEuroShort:case S.dateTimeEuroShortAmPm:case S.dateTimeEuroShortAM_PM:case S.dateUs:case S.dateUsShort:case S.dateTimeShortUs:case S.dateTimeUs:case S.dateTimeUsAmPm:case S.dateTimeUsAM_PM:case S.dateTimeUsShort:case S.dateTimeUsShortAmPm:case S.dateTimeUsShortAM_PM:o=ue(r).call(this,e,t,i,s,n);break;case S.object:o=ei.objectString(e,t,i,s,n);break;case S.string:case S.text:case S.password:case S.readonly:default:o=ei.string(e,t,i,s,n);break}return o}const jh=Object.freeze(Object.defineProperty({__proto__:null,sortByFieldType:mi},Symbol.toStringTag,{value:"Module"}));var ct;(function(r){r.camelCase="camelCase",r.kebabCase="kebabCase",r.lowerCase="lowerCase",r.lowerCaseWithoutOnPrefix="lowerCaseWithoutOnPrefix"})(ct||(ct={}));class Lo{get elementSource(){return this._elementSource}set elementSource(e){this._elementSource=e}get subscribedEvents(){return this._subscribedEvents}get subscribedEventNames(){return this._subscribedEvents.map(e=>e.name)}constructor(e){this._subscribedEvents=[],this.eventNamingStyle=ct.camelCase,this._elementSource=e||document.createElement("div")}dispose(){var e;this.unsubscribeAll(),this._subscribedEvents=[],clearTimeout(this._timer),(e=this._elementSource)==null||e.remove(),this._elementSource=null}dispatchCustomEvent(e,t,i=!0,s=!0,n){var a;const o={bubbles:i,cancelable:s};t&&(o.detail=t);const l=new CustomEvent(e,o);return typeof n=="function"&&n(l),(a=this._elementSource)==null?void 0:a.dispatchEvent(l)}getEventNameByNamingConvention(e,t){let i="";switch(this.eventNamingStyle){case ct.camelCase:i=t!==""?`${t}${Jt(e)}`:e;break;case ct.kebabCase:i=t!==""?`${t}-${ui(e)}`:ui(e);break;case ct.lowerCase:i=`${t}${e}`.toLowerCase();break;case ct.lowerCaseWithoutOnPrefix:i=`${t}${e.replace(/^on/,"")}`.toLowerCase();break}return i}publish(e,t,i,s){const n=this.getEventNameByNamingConvention(e,"");return i?new Promise(o=>{clearTimeout(this._timer),this._timer=setTimeout(()=>o(this.dispatchCustomEvent(n,t,!0,!0,s)),i)}):this.dispatchCustomEvent(n,t,!0,!0,s)}subscribe(e,t){const i=this.getEventNameByNamingConvention(e,"");return this._elementSource.addEventListener(i,s=>t.call(null,s.detail)),this._subscribedEvents.push({name:i,listener:t}),{unsubscribe:()=>this.unsubscribe(i,t)}}subscribeEvent(e,t){const i=this.getEventNameByNamingConvention(e,"");return this._elementSource.addEventListener(i,t),this._subscribedEvents.push({name:i,listener:t}),{unsubscribe:()=>this.unsubscribe(i,t)}}unsubscribe(e,t,i=!0){const s=this.getEventNameByNamingConvention(e,"");this._elementSource.removeEventListener(s,t),i&&this.removeSubscribedEventWhenFound(e,t)}unsubscribeAll(e){if(Array.isArray(e)){let t;do t=e.pop(),t!=null&&t.dispose?t.dispose():t!=null&&t.unsubscribe&&t.unsubscribe();while(t)}else{let t=this._subscribedEvents.pop();for(;t;)this.unsubscribe(t.name,t.listener,!1),t=this._subscribedEvents.pop()}}removeSubscribedEventWhenFound(e,t){const i=this._subscribedEvents.findIndex(s=>s.name===e&&s.listener===t);i>=0&&this._subscribedEvents.splice(i,1)}}function fs(r){var e=document,t=r.container||e.createElement("div"),i=r.preventSubmit||0;t.id=t.id||"autocomplete-"+b();var s=t.style,n=r.debounceWaitMs||0,o=r.disableAutoSelect||!1,l=t.parentElement,a=[],h="",d=2,c=r.showOnFocus,u,p=0,m,f=!1,g=!1;if(r.minLength!==void 0&&(d=r.minLength),!r.input)throw new Error("input undefined");var _=r.input;t.className="autocomplete "+(r.className||""),t.setAttribute("role","listbox"),_.setAttribute("role","combobox"),_.setAttribute("aria-expanded","false"),_.setAttribute("aria-autocomplete","list"),_.setAttribute("aria-controls",t.id),_.setAttribute("aria-owns",t.id),_.setAttribute("aria-activedescendant",""),_.setAttribute("aria-haspopup","listbox"),s.position="absolute";function b(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function C(){var M=t.parentNode;M&&M.removeChild(t)}function E(){m&&window.clearTimeout(m)}function y(){t.parentNode||(l||e.body).appendChild(t)}function T(){return!!t.parentNode}function x(){p++,a=[],h="",u=void 0,_.setAttribute("aria-activedescendant",""),_.setAttribute("aria-expanded","false"),C()}function O(){if(!T())return;_.setAttribute("aria-expanded","true"),s.height="auto",s.width=_.offsetWidth+"px";var M=0,te;function Ne(){var Ue=e.documentElement,nt=Ue.clientTop||e.body.clientTop||0,rt=Ue.clientLeft||e.body.clientLeft||0,Ai=window.pageYOffset||Ue.scrollTop,Nt=window.pageXOffset||Ue.scrollLeft;te=_.getBoundingClientRect();var Ke=te.top+_.offsetHeight+Ai-nt,os=te.left+Nt-rt;s.top=Ke+"px",s.left=os+"px",M=window.innerHeight-(te.top+_.offsetHeight),M<0&&(M=0),s.top=Ke+"px",s.bottom="",s.left=os+"px",s.maxHeight=M+"px"}Ne(),Ne(),r.customize&&te&&r.customize(_,te,t,M)}function I(){t.textContent="",_.setAttribute("aria-activedescendant","");var M=function(rt,Ai,Nt){var Ke=e.createElement("div");return Ke.textContent=rt.label||"",Ke};r.render&&(M=r.render);var te=function(rt,Ai){var Nt=e.createElement("div");return Nt.textContent=rt,Nt};r.renderGroup&&(te=r.renderGroup);var Ne=e.createDocumentFragment(),Ue=b();if(a.forEach(function(rt,Ai){if(rt.group&&rt.group!==Ue){Ue=rt.group;var Nt=te(rt.group,h);Nt&&(Nt.className+=" group",Ne.appendChild(Nt))}var Ke=M(rt,h,Ai);Ke&&(Ke.id=t.id+"_"+Ai,Ke.setAttribute("role","option"),Ke.addEventListener("click",function(os){g=!0;try{r.onSelect(rt,_)}finally{g=!1}x(),os.preventDefault(),os.stopPropagation()}),rt===u&&(Ke.className+=" selected",Ke.setAttribute("aria-selected","true"),_.setAttribute("aria-activedescendant",Ke.id)),Ne.appendChild(Ke))}),t.appendChild(Ne),a.length<1)if(r.emptyMsg){var nt=e.createElement("div");nt.id=t.id+"_"+b(),nt.className="empty",nt.textContent=r.emptyMsg,t.appendChild(nt),_.setAttribute("aria-activedescendant",nt.id)}else{x();return}y(),O(),W()}function A(){T()&&I()}function k(){A()}function L(M){M.target!==t?A():M.preventDefault()}function N(){g||Me(0)}function W(){var M=t.getElementsByClassName("selected");if(M.length>0){var te=M[0],Ne=te.previousElementSibling;if(Ne&&Ne.className.indexOf("group")!==-1&&!Ne.previousElementSibling&&(te=Ne),te.offsetTop<t.scrollTop)t.scrollTop=te.offsetTop;else{var Ue=te.offsetTop+te.offsetHeight,nt=t.scrollTop+t.offsetHeight;Ue>nt&&(t.scrollTop+=Ue-nt)}}}function X(){var M=a.indexOf(u);u=M===-1?void 0:a[(M+a.length-1)%a.length],q(M)}function Z(){var M=a.indexOf(u);u=a.length<1?void 0:M===-1?a[0]:a[(M+1)%a.length],q(M)}function q(M){a.length>0&&(Be(M),ee(a.indexOf(u)),W())}function ee(M){var te=e.getElementById(t.id+"_"+M);te&&(te.classList.add("selected"),te.setAttribute("aria-selected","true"),_.setAttribute("aria-activedescendant",te.id))}function Be(M){var te=e.getElementById(t.id+"_"+M);te&&(te.classList.remove("selected"),te.removeAttribute("aria-selected"),_.removeAttribute("aria-activedescendant"))}function st(M,te){var Ne=T();if(te==="Escape")x();else{if(!Ne||a.length<1)return;te==="ArrowUp"?X():Z()}M.preventDefault(),Ne&&M.stopPropagation()}function ge(M){if(u){i===2&&M.preventDefault(),g=!0;try{r.onSelect(u,_)}finally{g=!1}x()}i===1&&M.preventDefault()}function xe(M){var te=M.key;switch(te){case"ArrowUp":case"ArrowDown":case"Escape":st(M,te);break;case"Enter":ge(M);break}}function Ye(){c&&Me(1)}function Me(M){_.value.length>=d||M===1?(E(),m=window.setTimeout(function(){return Pe(_.value,M,_.selectionStart||0)},M===0||M===2?n:0)):x()}function Pe(M,te,Ne){if(!f){var Ue=++p;r.fetch(M,function(nt){p===Ue&&nt&&(a=nt,h=M,u=a.length<1||o?void 0:a[0],I())},te,Ne)}}function K(M){if(r.keyup){r.keyup({event:M,fetch:function(){return Me(0)}});return}!T()&&M.key==="ArrowDown"&&Me(0)}function ce(M){r.click&&r.click({event:M,fetch:function(){return Me(2)}})}function ht(){setTimeout(function(){e.activeElement!==_&&x()},200)}function li(){Pe(_.value,3,_.selectionStart||0)}t.addEventListener("mousedown",function(M){M.stopPropagation(),M.preventDefault()}),t.addEventListener("focus",function(){return _.focus()}),C();function Mt(){_.removeEventListener("focus",Ye),_.removeEventListener("keyup",K),_.removeEventListener("click",ce),_.removeEventListener("keydown",xe),_.removeEventListener("input",N),_.removeEventListener("blur",ht),window.removeEventListener("resize",k),e.removeEventListener("scroll",L,!0),_.removeAttribute("role"),_.removeAttribute("aria-expanded"),_.removeAttribute("aria-autocomplete"),_.removeAttribute("aria-controls"),_.removeAttribute("aria-activedescendant"),_.removeAttribute("aria-owns"),_.removeAttribute("aria-haspopup"),E(),x(),f=!0}return _.addEventListener("keyup",K),_.addEventListener("click",ce),_.addEventListener("keydown",xe),_.addEventListener("input",N),_.addEventListener("blur",ht),_.addEventListener("focus",Ye),window.addEventListener("resize",k),e.addEventListener("scroll",L,!0),{destroy:Mt,fetch:li}}class gs{constructor(e){this._value=null,this._boundedEventWithListeners=[],this._elementBindings=[],this._binding=e,this._property=e.property||"",this._elementBindings=[],e.property&&e.variable&&(e.variable.hasOwnProperty(e.property)||e.property in e.variable)?this._value=e.variable[e.property]:this._value=e.variable,typeof e.variable=="object"&&Object.defineProperty(e.variable,e.property,{get:this.valueGetter.bind(this),set:this.valueSetter.bind(this)})}get boundedEventWithListeners(){return this._boundedEventWithListeners}get elementBindings(){return this._elementBindings}get property(){return this._property}dispose(){this.unbindAll(),this._boundedEventWithListeners=[],this._elementBindings=[]}valueGetter(){return this._value}valueSetter(e){if(this._value=e,Array.isArray(this._elementBindings))for(const t of this._elementBindings)t!=null&&t.element&&(t!=null&&t.attribute)&&(t.element[t.attribute]=e)}bind(e,t,i,s){return e&&e.forEach?e.forEach(n=>this.bindSingleElement(n,t,i,s)):e&&this.bindSingleElement(e,t,i,s),this}unbind(e,t,i,s,n){if(e){e.removeEventListener(t,i,s);const o=this._boundedEventWithListeners.findIndex(l=>l.uid===n);o>=0&&this._boundedEventWithListeners.splice(o,1)}}unbindAll(){let e=this._boundedEventWithListeners.pop();for(;e;){const{element:t,eventName:i,listener:s,uid:n}=e;this.unbind(t,i,s,void 0,n),e=this._boundedEventWithListeners.pop()}this._boundedEventWithListeners=[]}bindSingleElement(e,t,i,s){const n={element:e,attribute:t};if(e){if(i){const o=()=>{let l=e[t];if(this.hasData(l)&&(e==null?void 0:e.type)==="number"&&(l=+l),this.valueSetter(l),(this._binding.variable.hasOwnProperty(this._binding.property)||this._binding.property in this._binding.variable)&&(this._binding.variable[this._binding.property]=this.valueGetter()),typeof s=="function")return s(this.valueGetter())};n.event=i,n.listener=o,e.addEventListener(i,o),this._boundedEventWithListeners.push({element:e,eventName:i,listener:o,uid:this.generateUuidV4()})}this._elementBindings.push(n),e[t]=this._value}}generateUuidV4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}hasData(e){return e!=null&&e!==""}}class Ho{constructor(){this._observers=[],this._querySelectorPrefix=""}get querySelectorPrefix(){return this._querySelectorPrefix||""}set querySelectorPrefix(e){this._querySelectorPrefix=e}get observers(){return this._observers}dispose(){let e=this._observers.pop();for(;e;)e.dispose(),e=this._observers.pop();this._observers=[]}addElementBinding(e,t,i,s,n,o){const l=document.querySelectorAll(`${this.querySelectorPrefix}${i}`);let a=this._observers.find(h=>h.property===e);a||(a=new gs({variable:e,property:t})),Array.isArray(n)?n.forEach(h=>a==null?void 0:a.bind(l,s,h,o)):a==null||a.bind(l,s,n,o),this._observers.push(a)}bindEventHandler(e,t,i,s){document.querySelectorAll(`${this.querySelectorPrefix}${e}`).forEach(o=>{o!=null&&o.addEventListener&&o.addEventListener(t,i,s)})}setElementAttributeValue(e,t,i){document.querySelectorAll(`${this.querySelectorPrefix}${e}`).forEach(n=>{n.textContent="",n&&t in n&&(n[t]=i)})}}class Ae{constructor(){this._boundedEvents=[]}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(e,t,i,s,n=""){const o=Array.isArray(t)?t:[t];if(e!=null&&e.forEach)e.forEach(l=>{for(const a of o)l.addEventListener(a,i,s),this._boundedEvents.push({element:l,eventName:a,listener:i,groupName:n})});else if(e)for(const l of o)e.addEventListener(l,i,s),this._boundedEvents.push({element:e,eventName:l,listener:i,groupName:n})}unbind(e,t,i){const s=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t];for(const o of n)for(const l of s)typeof(l==null?void 0:l.removeEventListener)=="function"&&l.removeEventListener(o,i)}unbindByEventName(e,t){const i=this._boundedEvents.find(s=>s.element===e&&s.eventName===t);i&&this.unbind(i.element,i.eventName,i.listener)}unbindAll(e){if(e){const t=Array.isArray(e)?e:[e];for(let i=this._boundedEvents.length-1;i>=0;--i){const s=this._boundedEvents[i];if(t.some(n=>n===s.groupName)){const{element:n,eventName:o,listener:l}=s;this.unbind(n,o,l),this._boundedEvents.splice(i,1)}}}else for(;this._boundedEvents.length>0;){const t=this._boundedEvents.pop(),{element:i,eventName:s,listener:n}=t;this.unbind(i,s,n)}}}var Vo=Object.prototype.hasOwnProperty;function ut(r,e){var t,i;if(r===e)return!0;if(r&&e&&(t=r.constructor)===e.constructor){if(t===Date)return r.getTime()===e.getTime();if(t===RegExp)return r.toString()===e.toString();if(t===Array){if((i=r.length)===e.length)for(;i--&&ut(r[i],e[i]););return i===-1}if(!t||typeof r=="object"){i=0;for(t in r)if(Vo.call(r,t)&&++i&&!Vo.call(e,t)||!(t in e)||!ut(r[t],e[t]))return!1;return Object.keys(e).length===i}}return r!==r&&e!==e}function Bo(r,e){const t=e.fetch;t&&(e.fetch=(i,s,n,o)=>{r.classList.add("slick-autocomplete-loading");const l=s;t(i,h=>{l(h),r.classList.remove("slick-autocomplete-loading")},n,o)})}function $i(r,e,t,i){var h,d;const{oldVal:s,newVal:n,columnDef:o,selectedSettings:l,updatePickerUI:a}=i;if(s!==n){const c=r.type||o.type,u=o.outputType||r.type||o.type||S.dateUtc,p=Array.isArray(n)?n:[n||""],m=[],f=Ze(S.dateIso),g=c?Ze(c):void 0;for(const b of p){const C=b instanceof Date?b:At(b,g);C&&m.push(C)}const _=l??{dates:[m.map(b=>Qe(b,f)).join(":")],month:(h=m[0])==null?void 0:h.getMonth(),year:(d=m[0])==null?void 0:d.getFullYear(),time:g==="ISO8601"||(g||"").toLowerCase().includes("h")?Qe(m[0],"HH:mm"):void 0};ut(t.settings.selected,_)||(t.settings.selected=_,a&&(t!=null&&t.update)&&t.update({dates:!0,month:!0,year:!0,time:!0})),e.value=p.length?m.map(b=>Ct(b,void 0,u)).join(" — "):""}}function Fn(r,e){const t=v("select",{className:"form-control"});for(const i of r){const s=document.createElement("option");s.value=i.operator,e.applyHtmlCode(s,`${ao(i.operatorAlt||i.operator,3)}${i.descAlt||i.desc}`),t.appendChild(s)}return t}function Yh(r,e,t){const i=(e==null?void 0:e.filter)??{},s=(i==null?void 0:i.collectionOptions)??{};if(s&&s.collectionInsideObjectProperty){const n=s.collectionInsideObjectProperty;r=Ee(r,n)}if(!Array.isArray(r))throw new Error('Something went wrong while trying to pull the collection from the "collectionAsync" call in the Filter, the collection is not a valid array.');i.collection=r,t(r)}async function zo(r,e,t,i,s){const n=(e==null?void 0:e.filter)??{},o=(n==null?void 0:n.collectionOptions)??{};let l=null;if(r){const a=(i==null?void 0:i.isObservable(r))??!1;a&&i&&(l=await eo(i,r));const h=await r;if(Array.isArray(h)?l=h:(h==null?void 0:h.status)>=200&&h.status<300&&typeof h.json=="function"?l=await h.json():h&&h.content&&(l=h.content),!Array.isArray(l)&&(o!=null&&o.collectionInsideObjectProperty)){const d=l||h,c=o.collectionInsideObjectProperty;l=Ee(d,c||"")}if(!Array.isArray(l))throw new Error('Something went wrong while trying to pull the collection from the "collectionAsync" call in the Filter, the collection is not a valid array.');n.collection=l,t(l),a&&Xh(e,t,i,s)}return l}function Xh(r,e,t,i){const s=(r==null?void 0:r.filter)??{},n=t==null?void 0:t.createSubject();s.collectionAsync=n,i&&n&&i.push(n.subscribe(o=>Yh(o,r,e)))}function lt(r,e,t,i,s){if(i!=null&&i.enableTranslate&&(s!=null&&s.translate)){const o=ot(i);return s.translate(`${o}${r}`)}const n=i.locales||R.locales;return(n==null?void 0:n[e])??t}function qh(r,e){return[{operator:"",desc:lt("CONTAINS","TEXT_CONTAINS","Contains",r,e)},{operator:"<>",desc:lt("NOT_CONTAINS","TEXT_NOT_CONTAINS","Not Contains",r,e)},{operator:"=",desc:lt("EQUALS","TEXT_EQUALS","Equals",r,e)},{operator:"!=",desc:lt("NOT_EQUAL_TO","TEXT_NOT_EQUAL_TO","Not equal to",r,e)},{operator:"a*",desc:lt("STARTS_WITH","TEXT_STARTS_WITH","Starts with",r,e)},{operator:"*z",desc:lt("ENDS_WITH","TEXT_ENDS_WITH","Ends with",r,e)}]}function Dn(r,e){return[{operator:"",desc:""},{operator:"=",desc:lt("EQUAL_TO","TEXT_EQUAL_TO","Equal to",r,e)},{operator:"<",desc:lt("LESS_THAN","TEXT_LESS_THAN","Less than",r,e)},{operator:"<=",desc:lt("LESS_THAN_OR_EQUAL_TO","TEXT_LESS_THAN_OR_EQUAL_TO","Less than or equal to",r,e)},{operator:">",desc:lt("GREATER_THAN","TEXT_GREATER_THAN","Greater than",r,e)},{operator:">=",desc:lt("GREATER_THAN_OR_EQUAL_TO","TEXT_GREATER_THAN_OR_EQUAL_TO","Greater than or equal to",r,e)},{operator:"<>",desc:lt("NOT_EQUAL_TO","TEXT_NOT_EQUAL_TO","Not equal to",r,e)}]}function Mn(r,e,t){if(r.compoundOperatorAltTexts){for(const i of e)if(r.compoundOperatorAltTexts.hasOwnProperty(t)){const s=r.compoundOperatorAltTexts[t][i.operator];i.operatorAlt=(s==null?void 0:s.operatorAlt)||"",i.descAlt=(s==null?void 0:s.descAlt)||""}}}class Kh{constructor(e,t,i){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this.searchTerms=[],this.isFilled=!1,this.isItemSelected=!1,this.valueName="label",this.enableTranslateLabel=!1,this.subscriptions=[],this._bindEventService=new Ae}get autocompleterOptions(){return this._autocompleterOptions||{}}get collectionOptions(){var e,t;return((t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.collectionOptions)??{}}get collection(){return this._collection}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)||{}}get filterDomElement(){return this._filterElm}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.autocompleter,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get customStructure(){var i,s,n,o,l;let e=(i=this.columnFilter)==null?void 0:i.customStructure;const t=((s=this.columnFilter)==null?void 0:s.type)??((n=this.columnDef)==null?void 0:n.type);return!e&&t===S.object&&((o=this.columnDef)!=null&&o.dataKey)&&((l=this.columnDef)!=null&&l.labelKey)&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get defaultOperator(){return H.equal}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get instance(){return this._instance}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){var i,s,n,o,l,a;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this.filterContainerElm=e.filterContainerElm,!this.grid||!this.columnDef||!this.columnFilter||!this.columnFilter.collection&&!this.columnFilter.collectionAsync&&!this.columnFilter.filterOptions)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") for the AutoComplete Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: model: Filters.autocompleter, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }`);this.enableTranslateLabel=((i=this.columnFilter)==null?void 0:i.enableTranslateLabel)??!1,this.labelName=((s=this.customStructure)==null?void 0:s.label)??"label",this.valueName=((n=this.customStructure)==null?void 0:n.value)??"value",this.labelPrefixName=((o=this.customStructure)==null?void 0:o.labelPrefix)??"labelPrefix",this.labelSuffixName=((l=this.customStructure)==null?void 0:l.labelSuffix)??"labelSuffix",this._locales=((a=this.gridOptions)==null?void 0:a.locales)??R.locales;const t=this.columnFilter.collection;return this._collection=t,this.renderDomElement(t),new Promise(async(h,d)=>{try{const c=this.columnFilter.collectionAsync;let u;c&&!this.columnFilter.collection?(u=zo(c,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),h(u)):(u=t,h(t)),(c||this.columnFilter.enableCollectionWatch)&&(await(u??c),this.watchCollectionChanges())}catch(c){d(c)}})}clear(e=!0){this._filterElm&&(this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[],this._filterElm.value="",this._filterElm.dispatchEvent(new CustomEvent("input")),this.updateFilterStyle(!1))}destroy(){var e,t,i;typeof((e=this._instance)==null?void 0:e.destroy)=="function"&&this._instance.destroy(),this._filterElm,(i=(t=this._filterElm)==null?void 0:t.remove)==null||i.call(t),this._collection=void 0,this._bindEventService.unbindAll(),hs(this.subscriptions)}getValues(){var e;return((e=this._filterElm)==null?void 0:e.value)||""}setValues(e,t,i=!1){e&&this._filterElm&&(this._filterElm.value=e),this.updateFilterStyle(this.getValues()!==""),this.operator=t||this.defaultOperator,i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:[this.getValues()],shouldTriggerQuery:!0})}filterCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const s=this.columnFilter.collectionFilterBy,n=this.columnFilter.collectionOptions&&this.columnFilter.collectionOptions.filterResultAfterEachPass||null;t=((i=this.collectionService)==null?void 0:i.filterCollection(t,s,n))||[]}return t}sortCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const s=this.columnFilter.collectionSortBy;t=((i=this.collectionService)==null?void 0:i.sortCollection(this.columnDef,t,s,this.enableTranslateLabel))||[]}return t}watchCollectionChanges(){var e;(e=this.columnFilter)!=null&&e.collection&&(Pi(this.columnFilter.collection,t=>{this.renderDomElement(this.columnFilter.collection||t||[])}),ls(this.columnFilter,"collection",t=>{this.renderDomElement(t||[]),this.columnFilter.collection&&Pi(this.columnFilter.collection,i=>{this.renderDomElement(this.columnFilter.collection||i||[])})}))}renderDomElement(e){var s;if(!Array.isArray(e)&&((s=this.collectionOptions)!=null&&s.collectionInsideObjectProperty)){const n=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,n||"")}let t=e;t&&(t=this.filterCollection(t),t=this.sortCollection(t));const i=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this._collection=t,this._filterElm=this.createFilterElement(t,i),this._bindEventService.bind(this._filterElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._filterElm,"blur",()=>{this.isItemSelected||this.clear()})}createFilterElement(e,t){var l,a,h,d,c,u,p,m,f,g,_;this._collection=e;const i=((l=this.columnDef)==null?void 0:l.id)??"";J(this.filterContainerElm);let s=((a=this.gridOptions)==null?void 0:a.defaultFilterPlaceholder)??"";(h=this.columnFilter)!=null&&h.placeholder&&(s=this.columnFilter.placeholder),this._filterElm=v("input",{type:"text",ariaLabel:((d=this.columnFilter)==null?void 0:d.ariaLabel)??`${_t(i+"")} Search Filter`,autocomplete:"off",ariaAutoComplete:"none",placeholder:s,className:`form-control search-filter filter-${i} slick-autocomplete-container`,value:t??"",dataset:{columnid:`${i}`}});const n=t;Array.isArray(e)&&(e.every(b=>Bi(b))?e=e.map(b=>({label:b,value:b})):e=e.map(b=>({label:b==null?void 0:b[this.labelName],value:b==null?void 0:b[this.valueName],labelPrefix:(b==null?void 0:b[this.labelPrefixName])??"",labelSuffix:(b==null?void 0:b[this.labelSuffixName])??""}))),this._autocompleterOptions={input:this._filterElm,debounceWaitMs:200,className:`slick-autocomplete ${((c=this.filterOptions)==null?void 0:c.className)??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&((u=this.translaterService)!=null&&u.translate)?this.translaterService.translate("NO_ELEMENTS_FOUND"):((p=this._locales)==null?void 0:p.TEXT_NO_ELEMENTS_FOUND)??"No elements found",customize:(b,C,E)=>{E.style.width=""},onSelect:b=>{this.isItemSelected=!0,this.handleSelect(b)},...this.filterOptions},(m=this.gridOptions)!=null&&m.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=he(this.autocompleterOptions.className).join(" "),(f=this._autocompleterOptions.renderItem)!=null&&f.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${ui(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=((g=this._autocompleterOptions.render)==null?void 0:g.bind(this))??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),(_=this.filterOptions)!=null&&_.fetch?(Bo(this._filterElm,this._autocompleterOptions),this._instance=fs(this._autocompleterOptions)):this._instance=fs({...this._autocompleterOptions,fetch:(b,C)=>{e&&C(e.filter(E=>((typeof E=="string"?E:E==null?void 0:E.label)||"").toLowerCase().includes(b.toLowerCase())))}}),this._filterElm.value=n??"";const o=v("div",{className:"autocomplete-filter-container"});return o.appendChild(this._filterElm),o.appendChild(v("span")),t&&this._filterElm.classList.add("filled"),this.filterContainerElm.appendChild(o),this.filterContainerElm.appendChild(document.createElement("span")),this._filterElm}handleSelect(e){var t;if(e!==void 0){const s=((t=this.filterOptions)==null?void 0:t.renderItem)??!1,n=typeof e=="string"?e:s?e[this.labelName]:e.label;let o=typeof e=="string"?e:s?e[this.valueName]:e.value;o=this.trimWhitespaceWhenEnabled(o),this.updateFilterStyle(o!==""),this.setValues(n),this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:[o],shouldTriggerQuery:this._shouldTriggerQuery}),this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0}return!1}handleOnInputChange(e){var s;let t=((s=e==null?void 0:e.target)==null?void 0:s.value)??"";const i=this.filterOptions.triggerOnEveryKeyStroke??!1;if(t=this.trimWhitespaceWhenEnabled(t),this._clearFilterTriggered||t===""||i){const n={columnDef:this.columnDef,shouldTriggerQuery:this._shouldTriggerQuery};this._clearFilterTriggered?n.clearFilterTriggered=this._clearFilterTriggered:(n.operator=this.operator,n.searchTerms=[t]),this.updateFilterStyle(t!==""),this.callback(e,n)}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0}renderRegularItem(e){const t=typeof e=="string"?e:(e==null?void 0:e.label)??"";return v("div",{textContent:t||""})}renderCustomItem(e){var s,n;const t=((n=(s=this._autocompleterOptions)==null?void 0:s.renderItem)==null?void 0:n.templateCallback(e))??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){var h;const t=((h=this.columnFilter)==null?void 0:h.enableRenderHtml)??!1,i=e.labelPrefix||"",s=e.label||"",n=e.labelSuffix||"",o=i+s+n,l=this.grid.sanitizeHtmlString(o)||"",a=document.createElement("div");return a[t?"innerHTML":"textContent"]=l,a}trimWhitespaceWhenEnabled(e){let t=e;const i=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;return typeof e=="string"&&i&&(t=e.trim()),t}updateFilterStyle(e){this.isItemSelected=e,e?this._filterElm.classList.add("filled"):this._filterElm.classList.remove("filled")}}/*! name: vanilla-calendar-picker | url: https://github.com/uvarov-frontend/vanilla-calendar-picker */var Qh=Object.defineProperty,$o=Object.getOwnPropertySymbols,Zh=Object.prototype.hasOwnProperty,Jh=Object.prototype.propertyIsEnumerable,Nn=(r,e,t)=>e in r?Qh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wo=(r,e)=>{for(var t in e||(e={}))Zh.call(e,t)&&Nn(r,t,e[t]);if($o)for(var t of $o(e))Jh.call(e,t)&&Nn(r,t,e[t]);return r},Y=(r,e,t)=>(Nn(r,typeof e!="symbol"?e+"":e,t),t);const ed={calendar:"vanilla-calendar",calendarDefault:"vanilla-calendar_default",calendarMultiple:"vanilla-calendar_multiple",calendarMonth:"vanilla-calendar_month",calendarYear:"vanilla-calendar_year",calendarHidden:"vanilla-calendar_hidden",calendarToInput:"vanilla-calendar_to-input",calendarToInputTop:"vanilla-calendar_to-input_top",calendarToInputBottom:"vanilla-calendar_to-input_bottom",controls:"vanilla-calendar-controls",grid:"vanilla-calendar-grid",gridDisabled:"vanilla-calendar-grid_disabled",column:"vanilla-calendar-column",columnMonth:"vanilla-calendar-column_month",columnYear:"vanilla-calendar-column_year",header:"vanilla-calendar-header",headerContent:"vanilla-calendar-header__content",month:"vanilla-calendar-month",monthDisabled:"vanilla-calendar-month_disabled",year:"vanilla-calendar-year",yearDisabled:"vanilla-calendar-year_disabled",arrow:"vanilla-calendar-arrow",arrowPrev:"vanilla-calendar-arrow_prev",arrowNext:"vanilla-calendar-arrow_next",wrapper:"vanilla-calendar-wrapper",content:"vanilla-calendar-content",week:"vanilla-calendar-week",weekDay:"vanilla-calendar-week__day",weekDayWeekend:"vanilla-calendar-week__day_weekend",days:"vanilla-calendar-days",daysSelecting:"vanilla-calendar-days_selecting",months:"vanilla-calendar-months",monthsSelecting:"vanilla-calendar-months_selecting",monthsMonth:"vanilla-calendar-months__month",monthsMonthSelected:"vanilla-calendar-months__month_selected",monthsMonthDisabled:"vanilla-calendar-months__month_disabled",years:"vanilla-calendar-years",yearsSelecting:"vanilla-calendar-years_selecting",yearsYear:"vanilla-calendar-years__year",yearsYearSelected:"vanilla-calendar-years__year_selected",yearsYearDisabled:"vanilla-calendar-years__year_disabled",time:"vanilla-calendar-time",timeContent:"vanilla-calendar-time__content",timeHours:"vanilla-calendar-time__hours",timeMinutes:"vanilla-calendar-time__minutes",timeKeeping:"vanilla-calendar-time__keeping",timeRanges:"vanilla-calendar-time__ranges",timeRange:"vanilla-calendar-time__range",day:"vanilla-calendar-day",dayHoverFirst:"vanilla-calendar-day_hover-first",dayHoverLast:"vanilla-calendar-day_hover-last",dayHoverIntermediate:"vanilla-calendar-day_hover-intermediate",daySelectedFirst:"vanilla-calendar-day_selected-first",daySelectedLast:"vanilla-calendar-day_selected-last",daySelectedIntermediate:"vanilla-calendar-day_selected-intermediate",dayPopup:"vanilla-calendar-day__popup",dayBtn:"vanilla-calendar-day__btn",dayBtnPrev:"vanilla-calendar-day__btn_prev",dayBtnNext:"vanilla-calendar-day__btn_next",dayBtnToday:"vanilla-calendar-day__btn_today",dayBtnSelected:"vanilla-calendar-day__btn_selected",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnWeekend:"vanilla-calendar-day__btn_weekend",dayBtnHoliday:"vanilla-calendar-day__btn_holiday",weekNumbers:"vanilla-calendar-week-numbers",weekNumbersTitle:"vanilla-calendar-week-numbers__title",weekNumbersContent:"vanilla-calendar-week-numbers__content",weekNumber:"vanilla-calendar-week-number",isFocus:"vanilla-calendar-is-focus"},td=r=>`<div class="${r.header}"><#ArrowPrev /><div class="${r.headerContent}"><#Month /><#Year /></div><#ArrowNext /></div><div class="${r.wrapper}"><#WeekNumbers /><div class="${r.content}"><#Week /><#Days /></div></div><#ControlTime />`,id=r=>`<div class="${r.controls}"><#ArrowPrev /><#ArrowNext /></div><div class="${r.grid}"><#Multiple><div class="${r.column}"><div class="${r.header}"><div class="${r.headerContent}"><#Month /><#Year /></div></div><div class="${r.wrapper}"><#WeekNumbers /><div class="${r.content}"><#Week /><#Days /></div></div></div><#/Multiple></div><#ControlTime />`,sd=r=>`<div class="${r.header}"><div class="${r.headerContent}"><#Month /><#Year /></div></div><div class="${r.wrapper}"><div class="${r.content}"><#Months /></div></div>`,nd=r=>`<div class="${r.header}"><#ArrowPrev /><div class="${r.headerContent}"><#Month /><#Year /></div><#ArrowNext /></div><div class="${r.wrapper}"><div class="${r.content}"><#Years /></div></div>`;class rd{constructor(){Y(this,"isInit",!1),Y(this,"isInputInit",!1),Y(this,"input",!1),Y(this,"type","default"),Y(this,"months",2),Y(this,"jumpMonths",1),Y(this,"toggleSelected",!0),Y(this,"jumpToSelectedDate",!1),Y(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),Y(this,"settings",{lang:"en",iso8601:!0,range:{min:this.date.min,max:this.date.max,disablePast:!1,disableGaps:!1,edgesOnly:!1,disableAllDays:!1,disableWeekday:void 0,disabled:void 0,enabled:void 0},selection:{day:"single",month:!0,year:!0,time:!1,controlTime:"all",stepHours:1,stepMinutes:1,cancelableDay:!0},selected:{dates:void 0,month:void 0,year:void 0,holidays:void 0,time:void 0},visibility:{theme:"system",themeDetect:"html[data-theme]",monthShort:!0,weekNumbers:!1,weekend:!0,today:!0,disabled:!1,daysOutside:!0,positionToInput:"left"}}),Y(this,"locale",{months:[],weekday:[]}),Y(this,"sanitizer",e=>e),Y(this,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,getMonths:null,getYears:null,initCalendar:null,updateCalendar:null,destroyCalendar:null,showCalendar:null,hideCalendar:null}),Y(this,"popups",{}),Y(this,"CSSClasses",Wo({},ed)),Y(this,"DOMTemplates",{default:td(this.CSSClasses),multiple:id(this.CSSClasses),month:sd(this.CSSClasses),year:nd(this.CSSClasses)}),Y(this,"HTMLElement"),Y(this,"HTMLOriginalElement"),Y(this,"HTMLInputElement"),Y(this,"rangeMin"),Y(this,"rangeMax"),Y(this,"rangeDisabled"),Y(this,"rangeEnabled"),Y(this,"selectedDates"),Y(this,"selectedHolidays"),Y(this,"selectedMonth"),Y(this,"selectedYear"),Y(this,"selectedHours"),Y(this,"selectedMinutes"),Y(this,"selectedKeeping"),Y(this,"selectedTime"),Y(this,"currentType"),Y(this,"correctMonths"),Y(this,"viewYear"),Y(this,"dateMin"),Y(this,"dateMax")}}const vt=r=>`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`,fe=r=>new Date(`${r}T00:00:00`),fi=r=>r.reduce((e,t)=>{if(t instanceof Date||typeof t=="number"){const i=t instanceof Date?t:new Date(t);e.push(i.toISOString().substring(0,10))}else t.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(t):t.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,(i,s,n)=>{const o=fe(s),l=fe(n),a=new Date(o.getTime());for(;a<=l;a.setDate(a.getDate()+1))e.push(vt(a));return i});return e},[]),Go=()=>{const r=new Date;return new Date(r.getTime()-6e4*r.getTimezoneOffset()).toISOString().substring(0,10)},Wi=r=>r?{0:"12",13:"01",14:"02",15:"03",16:"04",17:"05",18:"06",19:"07",20:"08",21:"09",22:"10",23:"11"}[Number(r)]||String(r):"",gi={notFoundSelector:r=>`${r} is not found, check the first argument passed to new VanillaCalendar.`,notInit:'The calendar has not been initialized, please initialize it using the "init()" method first.',notLocale:'You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".',incorrectTheme:'Incorrect name of theme in "settings.visibility.theme".',incorrectTime:"The value of the time property can be: false, true, 12 or 24."},od=r=>{var e;if(r.jumpToSelectedDate&&((e=r.settings.selected.dates)!=null&&e.length)&&r.settings.selected.month===void 0&&r.settings.selected.year===void 0){const s=fe(fi(r.settings.selected.dates)[0]);r.settings.selected.month=s.getMonth(),r.settings.selected.year=s.getFullYear()}const t=r.settings.selected.month!==void 0&&Number(r.settings.selected.month)>=0&&Number(r.settings.selected.month)<12,i=r.settings.selected.year!==void 0&&Number(r.settings.selected.year)>=0&&Number(r.settings.selected.year)<=9999;r.selectedMonth=t?Number(r.settings.selected.month):r.date.today.getMonth(),r.selectedYear=i?Number(r.settings.selected.year):r.date.today.getFullYear(),r.viewYear=r.selectedYear},ld=r=>{var e,t,i;r.settings.range.min==="today"&&(r.settings.range.min=Go()),r.settings.range.max==="today"&&(r.settings.range.max=Go()),r.settings.range.min=fe(r.date.min)>=fe(r.settings.range.min)?r.date.min:r.settings.range.min,r.settings.range.max=fe(r.date.max)<=fe(r.settings.range.max)?r.date.max:r.settings.range.max;const s=r.settings.range.disablePast&&!r.settings.range.disableAllDays&&fe(r.settings.range.min)<r.date.today;r.rangeMin=s||r.settings.range.disableAllDays?vt(r.date.today):r.settings.range.min,r.rangeMax=r.settings.range.disableAllDays?vt(r.date.today):r.settings.range.max,r.rangeDisabled=r.settings.range.disabled&&!r.settings.range.disableAllDays?fi(r.settings.range.disabled):r.settings.range.disableAllDays?[r.rangeMin]:[],r.rangeDisabled.length>1&&r.rangeDisabled.sort((n,o)=>+new Date(n)-+new Date(o)),r.rangeEnabled=r.settings.range.enabled?fi(r.settings.range.enabled):[],(e=r.rangeEnabled)!=null&&e[0]&&((t=r.rangeDisabled)!=null&&t[0])&&(r.rangeDisabled=r.rangeDisabled.filter(n=>!r.rangeEnabled.includes(n))),r.rangeEnabled.length>1&&r.rangeEnabled.sort((n,o)=>+new Date(n)-+new Date(o)),(i=r.rangeEnabled)!=null&&i[0]&&r.settings.range.disableAllDays&&(r.rangeMin=r.rangeEnabled[0],r.rangeMax=r.rangeEnabled[r.rangeEnabled.length-1])},ad=r=>{var e,t;r.selectedDates=(e=r.settings.selected.dates)!=null&&e[0]?fi(r.settings.selected.dates):[],r.selectedHolidays=(t=r.settings.selected.holidays)!=null&&t[0]?fi(r.settings.selected.holidays):[]},hd=r=>{r.dateMin=r.settings.visibility.disabled?fe(r.date.min):fe(r.rangeMin),r.dateMax=r.settings.visibility.disabled?fe(r.date.max):fe(r.rangeMax)},dd=r=>{const e=r.settings.selection.time===!0||r.settings.selection.time===12;if(e||r.settings.selection.time===24){let t=!1;if(typeof r.settings.selected.time=="string"){const i=e?/^([0-9]|0[1-9]|1[0-2]):([0-5][0-9])|(AM|PM)/g:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])/g;r.settings.selected.time.replace(i,(s,n,o,l)=>(n&&o&&(t=!0,r.selectedHours=n,r.selectedMinutes=o),l&&e?r.selectedKeeping=l:e&&(r.selectedKeeping="AM"),""))}!t&&e?(r.selectedHours=Wi(String(r.date.today.getHours())),r.selectedMinutes=String(r.date.today.getMinutes()),r.selectedKeeping=Number(r.date.today.getHours())>=12?"PM":"AM"):t||(r.selectedHours=String(r.date.today.getHours()),r.selectedMinutes=String(r.date.today.getMinutes())),r.selectedHours=Number(r.selectedHours)<10?`0${Number(r.selectedHours)}`:`${r.selectedHours}`,r.selectedMinutes=Number(r.selectedMinutes)<10?`0${Number(r.selectedMinutes)}`:`${r.selectedMinutes}`,r.selectedTime=`${r.selectedHours}:${r.selectedMinutes}${r.selectedKeeping?` ${r.selectedKeeping}`:""}`}else if(r.settings.selection.time)throw new Error(gi.incorrectTime)},cd=r=>{r.correctMonths=r.type==="multiple"?r.months===1?2:r.months>12?12:r.months:1},Uo=r=>{r.currentType=r.type,od(r),ld(r),ad(r),hd(r),dd(r),cd(r)},jo=({arrowPrev:r,arrowNext:e,isPrevHidden:t,isNextHidden:i})=>{r.style.visibility=t?"hidden":"",e.style.visibility=i?"hidden":""},Ln=r=>{var e,t;if(r.currentType==="month")return;const i=(e=r.HTMLElement)==null?void 0:e.querySelector(`.${r.CSSClasses.arrowPrev}`),s=(t=r.HTMLElement)==null?void 0:t.querySelector(`.${r.CSSClasses.arrowNext}`);!i||!s||{default:()=>{const n=fe(vt(new Date(r.selectedYear,r.selectedMonth,1))),o=new Date(n.getTime()),l=new Date(n.getTime());o.setMonth(o.getMonth()-r.jumpMonths),l.setMonth(l.getMonth()+r.jumpMonths),r.settings.selection.year||(r.dateMin.setFullYear(n.getFullYear()),r.dateMax.setFullYear(n.getFullYear()));const a=!r.settings.selection.month||o.getFullYear()<r.dateMin.getFullYear()||o.getFullYear()===r.dateMin.getFullYear()&&o.getMonth()<r.dateMin.getMonth(),h=!r.settings.selection.month||l.getFullYear()>r.dateMax.getFullYear()||l.getFullYear()===r.dateMax.getFullYear()&&l.getMonth()>r.dateMax.getMonth();jo({arrowPrev:i,arrowNext:s,isPrevHidden:a,isNextHidden:h})},year:()=>{jo({arrowPrev:i,arrowNext:s,isPrevHidden:r.dateMin.getFullYear()&&r.viewYear-7<=r.dateMin.getFullYear(),isNextHidden:r.dateMax.getFullYear()&&r.viewYear+7>=r.dateMax.getFullYear()})}}[r.currentType==="multiple"?"default":r.currentType]()},Yo=(r,e)=>{if(!r)return null;const t=fe(r),i=e?t.getDay()||7:t.getDay();t.setDate(t.getDate()+4-i);const s=new Date(t.getFullYear(),0,1),n=Math.ceil(((+t-+s)/864e5+1)/7);return{year:t.getFullYear(),week:n}},ud=(r,e,t,i)=>{const s=t.querySelector(`[data-calendar-day="${r}"]`);s&&(e!=null&&e.modifier&&s.classList.add(...e.modifier.trim().split(" ")),e!=null&&e.html&&(s.parentElement.innerHTML+=`<div class="${i}">${e.html}</div>`))},pd=(r,e)=>{var t;r.popups&&((t=Object.entries(r.popups))==null||t.forEach(([i,s])=>ud(i,s,e,r.CSSClasses.dayPopup)))},md=(r,e,t,i,s)=>{const n=e[t].querySelector(`.${r.CSSClasses.dayBtn}`),o=Yo(n==null?void 0:n.dataset.calendarDay,r.settings.iso8601);if(!o)return;const l=i.cloneNode(!0);l.innerText=String(o.week),l.dataset.calendarYearWeek=String(o.year),s.appendChild(l)},fd=(r,e,t,i,s)=>{if(!r.settings.visibility.weekNumbers)return;i.textContent="";const n=document.createElement("b");n.className=r.CSSClasses.weekNumbersTitle,n.innerText="#",i.appendChild(n);const o=document.createElement("div");o.className=r.CSSClasses.weekNumbersContent,i.appendChild(o);const l=document.createElement("button");l.type="button",l.className=r.CSSClasses.weekNumber;const a=s.querySelectorAll(`.${r.CSSClasses.day}`),h=Math.ceil((e+t)/7);for(let d=0;d<h;d++)md(r,a,d===0?6:7*d,l,o)},gd=(r,e,t)=>{var i,s,n,o,l;const a=(i=r.settings.range.disableWeekday)==null?void 0:i.includes(t),h=r.settings.range.disableAllDays&&!!((s=r.rangeEnabled)!=null&&s[0]);!a&&!h||(n=r.rangeEnabled)!=null&&n.includes(e)||(o=r.rangeDisabled)!=null&&o.includes(e)||(r.rangeDisabled.push(e),(l=r.rangeDisabled)==null||l.sort((d,c)=>+new Date(d)-+new Date(c)))},_d=(r,e,t,i,s,n,o)=>{var l,a,h;if((fe(r.rangeMin)>fe(n)||fe(r.rangeMax)<fe(n)||(l=r.rangeDisabled)!=null&&l.includes(n)||!r.settings.selection.month&&o||!r.settings.selection.year&&fe(n).getFullYear()!==e)&&(i.classList.add(r.CSSClasses.dayBtnDisabled),i.tabIndex=-1),r.settings.visibility.today&&vt(r.date.today)===n&&i.classList.add(r.CSSClasses.dayBtnToday),!r.settings.visibility.weekend||s!==0&&s!==6||i.classList.add(r.CSSClasses.dayBtnWeekend),(a=r.selectedHolidays)!=null&&a.includes(n)&&i.classList.add(r.CSSClasses.dayBtnHoliday),(h=r.selectedDates)!=null&&h.includes(n)&&(i.classList.add(r.CSSClasses.dayBtnSelected),r.selectedDates.length>1&&r.settings.selection.day==="multiple-ranged"&&(r.selectedDates[0]===n&&t.classList.add(r.CSSClasses.daySelectedFirst),r.selectedDates[r.selectedDates.length-1]===n&&t.classList.add(r.CSSClasses.daySelectedLast),r.selectedDates[0]!==n&&r.selectedDates[r.selectedDates.length-1]!==n&&t.classList.add(r.CSSClasses.daySelectedIntermediate))),r.settings.range.edgesOnly&&r.selectedDates.length>1&&r.settings.selection.day==="multiple-ranged"){const d=+new Date(r.selectedDates[0]),c=+new Date(r.selectedDates[r.selectedDates.length-1]),u=+new Date(n);u>d&&u<c&&(i.classList.add(r.CSSClasses.dayBtnSelected),t.classList.add(r.CSSClasses.daySelectedIntermediate))}},Hn=(r,e,t,i,s,n,o,l)=>{const a=document.createElement("div");a.className=r.CSSClasses.day;const h=document.createElement("button");h.className=`${r.CSSClasses.dayBtn}${l?` ${l}`:""}`,h.type="button",h.innerText=String(i),h.dataset.calendarDay=n,r.settings.visibility.weekNumbers&&(()=>{const d=Yo(n,r.settings.iso8601);d&&(h.dataset.calendarWeekNumber=String(d.week))})(),o?r.settings.visibility.daysOutside&&a.appendChild(h):a.appendChild(h),gd(r,n,s),_d(r,e,a,h,s,n,o),t.appendChild(a),r.actions.getDays&&r.actions.getDays(i,n,a,h,r)},Cd=(r,e,t,i,s)=>{let n=new Date(t,i,0).getDate()-(s-1);const o=i===0?t-1:t,l=i===0?12:i<10?`0${i}`:i;for(let a=s;a>0;a--,n++){const h=`${o}-${l}-${n}`,d=fe(h).getDay();Hn(r,t,e,n,d,h,!0,r.CSSClasses.dayBtnPrev)}},vd=(r,e,t,i,s)=>{for(let n=1;n<=t;n++){const o=new Date(i,s,n),l=vt(o),a=o.getDay();Hn(r,i,e,n,a,l,!1,null)}},bd=(r,e,t,i,s,n)=>{const o=n+t,l=7*Math.ceil(o/7)-o,a=s+1===12?i+1:i,h=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let d=1;d<=l;d++){const c=`${a}-${h}-${d<10?`0${d}`:String(d)}`,u=fe(c).getDay();Hn(r,i,e,d,u,c,!0,r.CSSClasses.dayBtnNext)}},_s=r=>{const e=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.days}`),t=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.weekNumbers}`),i=new Date(r.selectedYear,r.selectedMonth,1);e.forEach((s,n)=>{const o=new Date(i);o.setMonth(o.getMonth()+n);const l=o.getMonth(),a=o.getFullYear(),h=new Date(a,l,1),d=new Date(a,l+1,0).getDate(),c=r.settings.iso8601?(h.getDay()!==0?h.getDay():7)-1:h.getDay();r.settings.selection.day&&s.classList.add(r.CSSClasses.daysSelecting),s.textContent="",Cd(r,s,a,l,c),vd(r,s,d,a,l),bd(r,s,d,a,l,c),fd(r,c,d,t[n],s),pd(r,s)})},Sd=(r,e,t,i)=>{const s=new Date(i.setMonth(r.selectedMonth+t)).getMonth(),n=r.settings.selection.month===!1||r.settings.selection.month==="only-arrows";e.tabIndex=n?-1:0,e.classList.toggle(r.CSSClasses.monthDisabled,n),e.setAttribute("data-calendar-selected-month",String(s)),e.innerText=r.locale.months[s]},yd=(r,e,t,i)=>{const s=new Date(i.setFullYear(r.selectedYear,r.selectedMonth+t)).getFullYear(),n=r.settings.selection.year===!1||r.settings.selection.year==="only-arrows";e.tabIndex=n?-1:0,e.classList.toggle(r.CSSClasses.yearDisabled,n),e.setAttribute("data-calendar-selected-year",String(s)),e.innerText=String(s)},Cs=r=>{var e,t;const i=(e=r.HTMLElement)==null?void 0:e.querySelectorAll("[data-calendar-selected-month]"),s=(t=r.HTMLElement)==null?void 0:t.querySelectorAll("[data-calendar-selected-year]");if(!(i!=null&&i[0])&&(s!=null&&s[0]))return;const n=new Date(r.selectedYear,r.selectedMonth,1);i==null||i.forEach((o,l)=>Sd(r,o,l,n)),s==null||s.forEach((o,l)=>yd(r,o,l,n))},Vn=(r,e)=>{const t=fe(vt(new Date(r.selectedYear,r.selectedMonth,1)));({prev:()=>t.setMonth(t.getMonth()-r.jumpMonths),next:()=>t.setMonth(t.getMonth()+r.jumpMonths)})[e](),[r.selectedMonth,r.selectedYear]=[t.getMonth(),t.getFullYear()],Cs(r),Ln(r),_s(r)},Ed=r=>`<button type="button"class="${r.CSSClasses.arrow} ${r.CSSClasses.arrowPrev}"data-calendar-arrow="prev"></button>`,wd=r=>`<button type="button"class="${r.CSSClasses.arrow} ${r.CSSClasses.arrowNext}"data-calendar-arrow="next"></button>`,Td=r=>`<button type="button"class="${r.CSSClasses.month}"data-calendar-selected-month></button>`,Od=r=>`<button type="button"class="${r.CSSClasses.year}"data-calendar-selected-year></button>`,xd=r=>`<div class="${r.CSSClasses.week}"></div>`,Id=r=>`<div class="${r.CSSClasses.days}"></div>`,Rd=r=>`<div class="${r.CSSClasses.months}"></div>`,Ad=r=>`<div class="${r.CSSClasses.years}"></div>`,Pd=r=>r.settings.visibility.weekNumbers?`<div class="${r.CSSClasses.weekNumbers}"></div>`:"",kd=r=>r.settings.selection.time?`<div class="${r.CSSClasses.time}"></div>`:"",Fd=Object.freeze(Object.defineProperty({__proto__:null,ArrowNext:wd,ArrowPrev:Ed,ControlTime:kd,Days:Id,Month:Td,Months:Rd,Week:xd,WeekNumbers:Pd,Year:Od,Years:Ad},Symbol.toStringTag,{value:"Module"})),Dd=r=>Fd[r],Gi=(r,e)=>e.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,(t,i)=>{const s=Dd(i.replace(/[/\s\n\t]/g,"")),n=s?s(r):"";return r.sanitizer(n)}).replace(/[\n\t]/g,""),Md=(r,e)=>e.replace(/<#Multiple>(.*?)<#\/Multiple>/g,(t,i)=>{let s="";for(let n=0;n<r.correctMonths;n++)s+=i;return r.sanitizer(s)}).replace(/[\n\t]/g,""),Bn=(r,e)=>{const{HTMLElement:t,CSSClasses:i,DOMTemplates:s,type:n,currentType:o,correctMonths:l}=r,a=(d,c)=>{if(!e)return;const u=t.querySelector(`.${i.controls}`);u&&t.removeChild(u),t.querySelector(`.${i.grid}`).classList.add(i.gridDisabled);const p=e.closest(`.${i.column}`);p.classList.add(d),p.innerHTML=Gi(r,c)},h={default:()=>{t.classList.add(i.calendarDefault),t.classList.remove(i.calendarMonth,i.calendarYear),t.innerHTML=Gi(r,s.default)},multiple:()=>{l&&(t.classList.add(i.calendarMultiple),t.classList.remove(i.calendarMonth,i.calendarYear),t.innerHTML=Md(r,Gi(r,s.multiple)))},month:()=>{n!=="multiple"?(t.classList.add(i.calendarMonth),t.classList.remove(i.calendarDefault,i.calendarYear),t.innerHTML=Gi(r,s.month)):a(i.columnMonth,s.month)},year:()=>{n!=="multiple"?(t.classList.add(i.calendarYear),t.classList.remove(i.calendarDefault,i.calendarMonth),t.innerHTML=Gi(r,s.year)):a(i.columnYear,s.year)}};t.classList.add(i.calendar),h[o]()},Nd=(r,e,t,i,s)=>{const n=e.cloneNode(!1);return n.className=`${r.CSSClasses.yearsYear}${t===s?` ${r.CSSClasses.yearsYearSelected}`:i?` ${r.CSSClasses.yearsYearDisabled}`:""}`,n.dataset.calendarYear=String(s),n.title=String(s),n.innerText=String(s),i&&(n.tabIndex=-1),n},zn=(r,e)=>{const t=e!=null&&e.dataset.calendarSelectedYear?Number(e==null?void 0:e.dataset.calendarSelectedYear):r.selectedYear;r.currentType="year",Bn(r,e),Cs(r),Ln(r);const i=r.HTMLElement.querySelector(`.${r.CSSClasses.years}`);if(!r.settings.selection.year||!i)return;i.classList.add(r.CSSClasses.yearsSelecting);const s=r.type!=="multiple"||r.selectedYear===t?0:1,n=document.createElement("button");n.type="button";for(let o=r.viewYear-7;o<r.viewYear+8;o++){const l=o<r.dateMin.getFullYear()+s||o>r.dateMax.getFullYear(),a=Nd(r,n,t,l,o);i.appendChild(a),r.actions.getYears&&r.actions.getYears(o,a,r)}},Ld=(r,e)=>{const t=e.target.closest(`.${r.CSSClasses.arrow}`);t&&(["default","multiple"].includes(r.currentType)?Vn(r,t.dataset.calendarArrow):r.currentType==="year"&&r.viewYear!==void 0&&(r.viewYear+={prev:-15,next:15}[t.dataset.calendarArrow],zn(r,e.target)),r.actions.clickArrow&&r.actions.clickArrow(e,r))},Hd=(r,e)=>{var t;if(!r.settings.visibility.weekNumbers||!r.actions.clickWeekNumber)return;const i=e.target.closest(`.${r.CSSClasses.weekNumber}`),s=(t=r.HTMLElement)==null?void 0:t.querySelectorAll("[data-calendar-week-number]");if(!i||!s)return;const n=Number(i.innerText),o=Number(i.dataset.calendarYearWeek),l=Array.from(s).filter(a=>Number(a.dataset.calendarWeekNumber)===n);r.actions.clickWeekNumber(e,n,l,o,r)},Xo=r=>`${r.charAt(0).toUpperCase()}${r.substring(1,r.length)}`.replace(/\./,""),Vd=(r,e)=>{const t=new Date(`1978-01-0${e+1}T00:00:00.000Z`).toLocaleString(r.settings.lang,{weekday:"short",timeZone:"UTC"});r.locale.weekday.push(Xo(t))},Bd=(r,e)=>{const t=new Date(`1978-${e+1<=9?`0${e+1}`:e+1}-01T00:00:00.000Z`).toLocaleString(r.settings.lang,{month:"long",timeZone:"UTC"});r.locale.months.push(Xo(t))},zd=r=>{if(r.settings.lang!=="define"||!r.locale.weekday[6]||!r.locale.months[11]){if(r.settings.lang==="define")throw new Error(gi.notLocale);r.locale.weekday=[],r.locale.months=[];for(let e=0;e<7;e++)Vd(r,e);for(let e=0;e<12;e++)Bd(r,e)}},qo=r=>{if(r.type!=="multiple")return 0;const e=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.column}`),t=Array.from(e).findIndex(i=>i.classList.contains(`${r.CSSClasses.columnMonth}`));return t>0?t:0},$d=(r,e,t,i,s,n)=>{const o=e.cloneNode(!1);return o.className=`${r.CSSClasses.monthsMonth}${t===n?` ${r.CSSClasses.monthsMonthSelected}`:s?` ${r.CSSClasses.monthsMonthDisabled}`:""}`,o.title=i,o.innerText=`${r.settings.visibility.monthShort?i.substring(0,3):i}`,o.dataset.calendarMonth=String(n),s&&(o.tabIndex=-1),o},Ko=(r,e)=>{var t,i;const s=e!=null&&e.dataset.calendarSelectedMonth?Number(e.dataset.calendarSelectedMonth):r.selectedMonth,n=(t=e==null?void 0:e.closest(`.${r.CSSClasses.column}`))==null?void 0:t.querySelector(`.${r.CSSClasses.year}`),o=n?Number(n.dataset.calendarSelectedYear):r.selectedYear;r.currentType="month",Bn(r,e),Cs(r);const l=(i=r.HTMLElement)==null?void 0:i.querySelector(`.${r.CSSClasses.months}`);if(!r.settings.selection.month||!l)return;l.classList.add(r.CSSClasses.monthsSelecting);const a=r.jumpMonths>1?r.locale.months.map((d,c)=>s-r.jumpMonths*c).concat(r.locale.months.map((d,c)=>s+r.jumpMonths*c)).filter(d=>d>=0&&d<=12):Array.from(Array(12).keys()),h=document.createElement("button");h.type="button";for(let d=0;d<12;d++){const c=r.locale.months[d],u=d<r.dateMin.getMonth()+qo(r)&&o<=r.dateMin.getFullYear()||d>r.dateMax.getMonth()+qo(r)&&o>=r.dateMax.getFullYear()||d!==s&&!a.includes(d),p=$d(r,h,s,c,u,d);l.appendChild(p),r.actions.getMonths&&r.actions.getMonths(d,p,r)}},$n=(r,e)=>r&&e?{0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"12",PM:"12"}}[Number(r)][e]:"",vs=(r,e,t)=>r.querySelector(`.${e}${t?` input[name="${t}"]`:""}`),Qo=(r,e,t)=>{r.addEventListener("mouseover",()=>e.classList.add(t)),r.addEventListener("mouseout",()=>e.classList.remove(t))},ti=(r,e,t,i)=>{({hours:()=>{r.selectedHours=t},minutes:()=>{r.selectedMinutes=t}})[i](),r.selectedTime=`${r.selectedHours}:${r.selectedMinutes}${r.selectedKeeping?` ${r.selectedKeeping}`:""}`,r.actions.changeTime&&r.actions.changeTime(e,r),r.input&&r.HTMLInputElement&&r.actions.changeToInput&&r.actions.changeToInput(e,r)},Zo=(r,e,t,i,s,n)=>{e.addEventListener("input",o=>{const l=o.target,a=Number(l.value),h=a<10?`0${a}`:`${a}`;if(s!=="hours"||n!==12)return t.value=h,void ti(r,o,h,s);a<n&&a>0?(t.value=h,r.selectedKeeping="AM",i.innerText=r.selectedKeeping,ti(r,o,h,s)):(a===0?(r.selectedKeeping="AM",i.innerText="AM"):(r.selectedKeeping="PM",i.innerText="PM"),t.value=Wi(l.value),ti(r,o,Wi(l.value),s))})},Jo=(r,e,t,i,s,n)=>{t.addEventListener("change",o=>{const l=o.target,a=Number(l.value),h=a<10?`0${a}`:`${a}`;s==="hours"&&n===12?l.value&&a<=n&&a>0?(l.value=h,e.value=$n(h,r.selectedKeeping),ti(r,o,h,s)):l.value&&a<24&&(a>n||a===0)?(a===0?(r.selectedKeeping="AM",i.innerText="AM"):(r.selectedKeeping="PM",i.innerText="PM"),l.value=Wi(l.value),e.value=h,ti(r,o,Wi(l.value),s)):l.value=r.selectedHours:l.value&&a<=n&&a>=0?(l.value=h,e.value=h,ti(r,o,h,s)):s==="hours"?l.value=r.selectedHours:s==="minutes"&&(l.value=r.selectedMinutes)})},Wd=(r,e,t)=>{e.addEventListener("click",i=>{r.selectedKeeping=e.innerText.includes("AM")?"PM":"AM",e.innerText=r.selectedKeeping,t.value=$n(r.selectedHours,r.selectedKeeping),ti(r,i,r.selectedHours,"hours")})},Gd=(r,e,t)=>{const i=t===24?23:t||12,s=vs(e,r.CSSClasses.timeRange,"hours"),n=vs(e,r.CSSClasses.timeRange,"minutes"),o=vs(e,r.CSSClasses.timeHours,"hours"),l=vs(e,r.CSSClasses.timeMinutes,"minutes"),a=e.querySelector(`.${r.CSSClasses.timeKeeping}`);Qo(s,o,r.CSSClasses.isFocus),Qo(n,l,r.CSSClasses.isFocus),Zo(r,s,o,a,"hours",i),Zo(r,n,l,a,"minutes",0),Jo(r,s,o,a,"hours",i),Jo(r,n,l,a,"minutes",59),a&&Wd(r,a,s)},el=(r,e,t,i)=>`<label class="${e}"><input type="text"name="${r}"maxlength="2"value="${t}"${i?"disabled":""}></label>`,tl=(r,e,t,i,s,n)=>`<label class="${e}"><input type="range"name="${r}"min="${t}"max="${i}"step="${s}"value="${n}"></label>`,Ud=r=>{const e=r.HTMLElement.querySelector(`.${r.CSSClasses.time}`);if(!e)return;const t=r.settings.selection.time===!0?12:r.settings.selection.time,i=r.settings.selection.controlTime==="range",[s,n]=[0,23],[o,l]=[0,59];e.innerHTML=r.sanitizer(`<div class="${r.CSSClasses.timeContent}">${el("hours",r.CSSClasses.timeHours,r.selectedHours,i)}${el("minutes",r.CSSClasses.timeMinutes,r.selectedMinutes,i)}${t===12?`<button type="button" class="${r.CSSClasses.timeKeeping}"${i?"disabled":""}>${r.selectedKeeping}</button>`:""}</div><div class="${r.CSSClasses.timeRanges}">${tl("hours",r.CSSClasses.timeRange,s,n,r.settings.selection.stepHours,r.selectedKeeping?$n(r.selectedHours,r.selectedKeeping):r.selectedHours)}${tl("minutes",r.CSSClasses.timeRange,o,l,r.settings.selection.stepMinutes,r.selectedMinutes)}</div>`),Gd(r,e,t)},jd=(r,e,t)=>{const i=document.createElement("b");e.textContent="";for(let s=0;s<t.length;s++){const n=t[s],o=i.cloneNode(!0);o.className=`${r.CSSClasses.weekDay}`,o.className=`${r.CSSClasses.weekDay}${r.settings.visibility.weekend&&r.settings.iso8601?s===5||s===6?` ${r.CSSClasses.weekDayWeekend}`:"":r.settings.visibility.weekend&&!r.settings.iso8601&&(s===0||s===6)?` ${r.CSSClasses.weekDayWeekend}`:""}`,o.innerText=`${n}`,e.appendChild(o)}},il=r=>{const e=[...r.locale.weekday];e[0]&&(r.settings.iso8601&&e.push(e.shift()),r.HTMLElement.querySelectorAll(`.${r.CSSClasses.week}`).forEach(t=>jd(r,t,e)))},sl=["light","dark","system"],bs={value:!1,set:()=>{bs.value=!0},check:()=>bs.value},nl=(r,e)=>sl.find(t=>{var i;return t!=="system"&&((i=r.getAttribute(e))==null?void 0:i.includes(t))}),ii=(r,e)=>{r.dataset.calendarTheme=e},rl=(r,e)=>{var t;if(t=e,ii(r.HTMLElement,t.matches?"dark":"light"),r.settings.visibility.theme!=="system"||bs.check())return;const i=s=>{const n=document.querySelectorAll(`.${r.CSSClasses.calendar}`);n==null||n.forEach(o=>ii(o,s.matches?"dark":"light"))};e.addEventListener?e.addEventListener("change",i):e.addListener(i),bs.set()},Yd=(r,e,t)=>{new MutationObserver(i=>{for(let s=0;s<i.length;s++)if(i[s].attributeName===t){const n=nl(e,t);n&&ii(r.HTMLElement,n);break}}).observe(e,{attributes:!0})},Xd=(r,e)=>{const t=r.settings.visibility.themeDetect?document.querySelector(r.settings.visibility.themeDetect):null;if(!t)return void rl(r,e);const i=r.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,(n,o)=>o),s=nl(t,i);s?(ii(r.HTMLElement,s),Yd(r,t,i)):rl(r,e)},qd=r=>{if(!sl.includes(r.settings.visibility.theme))throw new Error(gi.incorrectTheme);if(window.matchMedia("(prefers-color-scheme)").media==="not all")return void ii(r.HTMLElement,"light");({light:()=>ii(r.HTMLElement,"light"),dark:()=>ii(r.HTMLElement,"dark"),system:()=>Xd(r,window.matchMedia("(prefers-color-scheme: dark)"))})[r.settings.visibility.theme]()},Ui=r=>{const e={default:()=>{il(r),_s(r)},multiple:()=>{il(r),_s(r)},month:()=>Ko(r),year:()=>zn(r)};qd(r),zd(r),Bn(r),Cs(r),Ln(r),Ud(r),e[r.currentType]()},Q={self:null,rangeMin:void 0,rangeMax:void 0},ol=()=>{var r;if(!((r=Q.self)!=null&&r.HTMLElement))return;const{CSSClasses:e}=Q.self;Q.self.HTMLElement.querySelectorAll(`.${Q.self.CSSClasses.dayBtnHover}`).forEach(t=>{var i;t.classList.remove(Q.self.CSSClasses.dayBtnHover),(i=t.parentElement)==null||i.classList.remove(e.dayHoverIntermediate,e.dayHoverFirst,e.dayHoverLast)})},Kd=(r,e,t)=>{var i,s,n;if(!((i=Q.self)!=null&&i.selectedDates))return;const o=vt(r),{CSSClasses:l}=Q.self;if((s=Q.self.rangeDisabled)!=null&&s.includes(o))return;const a=(n=Q.self.HTMLElement)==null?void 0:n.querySelectorAll(`[data-calendar-day="${o}"]`);a==null||a.forEach(h=>{var d;h.classList.add(l.dayBtnHover),(d=h.parentElement)==null||d.classList.add(l.dayHoverIntermediate)}),e==null||e.forEach(h=>{var d;return(d=h.parentElement)==null?void 0:d.classList.add(l.dayHoverFirst)}),t==null||t.forEach(h=>{var d;return(d=h.parentElement)==null?void 0:d.classList.add(l.dayHoverLast)})},Wn=r=>{var e;if(!r.target||!((e=Q.self)!=null&&e.selectedDates))return;if(!r.target.closest(`.${Q.self.CSSClasses.days}`))return void ol();const t=r.target.closest("[data-calendar-day]");if(!t)return;const i=t.dataset.calendarDay,s=fe(Q.self.selectedDates[0]),n=fe(i),o=Q.self.HTMLElement.querySelectorAll(`[data-calendar-day="${Q.self.selectedDates[0]}"]`),l=Q.self.HTMLElement.querySelectorAll(`[data-calendar-day="${i}"]`),[a,h]=s<n?[o,l]:[l,o],[d,c]=s<n?[s,n]:[n,s];ol();for(let u=new Date(d);u<=c;u.setDate(u.getDate()+1))Kd(u,a,h)},Gn=r=>{Q.self&&r.key==="Escape"&&(Q.self.selectedDates=[],Q.self.HTMLElement.removeEventListener("mousemove",Wn),document.removeEventListener("keydown",Gn),Ui(Q.self))},Qd=()=>{var r,e,t;if(!((e=(r=Q.self)==null?void 0:r.selectedDates)!=null&&e[0])||!Q.self.rangeDisabled||((t=Q.self.rangeDisabled)==null?void 0:t.length)<2)return;const i=fe(Q.self.selectedDates[0]),[s,n]=Q.self.rangeDisabled.map(o=>fe(o)).reduce(([o,l],a)=>[i>=a?a:o,i<a&&l===null?a:l],[null,null]);s&&(Q.self.rangeMin=vt(new Date(s.setDate(s.getDate()+1)))),n&&(Q.self.rangeMax=vt(new Date(n.setDate(n.getDate()-1))))},Zd=()=>{Q.self&&(Q.self.rangeMin=Q.rangeMin,Q.self.rangeMax=Q.rangeMax)},ll=(r,e)=>{var t;if(e){const i=r.selectedDates.length===1&&r.selectedDates[0].includes(e);r.selectedDates=i&&!r.settings.selection.cancelableDay?[e,e]:i&&r.settings.selection.cancelableDay?[]:r.selectedDates.length>1?[e]:[...r.selectedDates,e],(t=r.selectedDates)==null||t.sort((s,n)=>+new Date(s)-+new Date(n))}r.settings.range.disableGaps&&(Q.rangeMin=Q.rangeMin?Q.rangeMin:r.rangeMin,Q.rangeMax=Q.rangeMax?Q.rangeMax:r.rangeMax),Q.self=r,{set:()=>{r.HTMLElement.addEventListener("mousemove",Wn),document.addEventListener("keydown",Gn),r.settings.range.disableGaps&&Qd()},reset:()=>{const[i,s]=[r.selectedDates[0],r.selectedDates[r.selectedDates.length-1]];r.selectedDates=r.selectedDates[0]!==r.selectedDates[r.selectedDates.length-1]?r.settings.range.edgesOnly?[i,s]:fi([`${i}:${s}`]):[r.selectedDates[0],r.selectedDates[0]],r.HTMLElement.removeEventListener("mousemove",Wn),document.removeEventListener("keydown",Gn),r.settings.range.disableGaps&&Zd()}}[r.selectedDates.length===1?"set":"reset"]()},al=(r,e,t)=>{if(!e.dataset.calendarDay)return;const i=e.dataset.calendarDay,s=e.classList.contains(r.CSSClasses.dayBtnSelected);if(s&&!r.settings.selection.cancelableDay)return;let n=!0;r.toggleSelected!==void 0&&(n=typeof r.toggleSelected=="function"?r.toggleSelected(r):r.toggleSelected),s&&!n||(r.selectedDates=s?r.selectedDates.filter(o=>o!==i):t?[...r.selectedDates,i]:[i])},Jd=(r,e)=>{var t;const i=e.target,s=a=>i.closest(`.${a}`),n=s(r.CSSClasses.dayBtn);if(!r.settings.selection.day||!["single","multiple","multiple-ranged"].includes(r.settings.selection.day)||!n)return;({single:()=>al(r,n,!1),multiple:()=>al(r,n,!0),"multiple-ranged":()=>ll(r,n.dataset.calendarDay)})[r.settings.selection.day](),(t=r.selectedDates)==null||t.sort((a,h)=>+new Date(a)-+new Date(h)),r.actions.clickDay&&r.actions.clickDay(e,r),r.input&&r.HTMLInputElement&&r.HTMLElement&&r.actions.changeToInput&&r.actions.changeToInput(e,r);const o=s(r.CSSClasses.dayBtnPrev),l=s(r.CSSClasses.dayBtnNext);({prev:()=>Vn(r,"prev"),next:()=>Vn(r,"next"),default:()=>_s(r)})[o?"prev":l?"next":"default"]()},hl=(r,e,t,i,s)=>{const n=r.HTMLElement.querySelectorAll(`.${r.CSSClasses.column}`),o=Array.from(n).findIndex(a=>a.classList.contains(e)),l=Number(n[o].querySelector(`.${t}`).getAttribute(s));return r.currentType==="month"&&o>=0?i-o:r.currentType==="year"&&r.selectedYear!==l?i-1:i},ec=(r,e,t,i,s)=>{const n={year:()=>{var o,l;return(l=(o=r.actions).clickYear)==null?void 0:l.call(o,e,r)},month:()=>{var o,l;return(l=(o=r.actions).clickMonth)==null?void 0:l.call(o,e,r)}};({year:()=>{if(r.type==="multiple"){const o=hl(r,r.CSSClasses.columnYear,r.CSSClasses.year,Number(s.dataset.calendarYear),"data-calendar-selected-year"),l=r.selectedMonth<r.dateMin.getMonth()&&o<=r.dateMin.getFullYear(),a=r.selectedMonth>r.dateMax.getMonth()&&o>=r.dateMax.getFullYear(),h=o<r.dateMin.getFullYear(),d=o>r.dateMax.getFullYear();l||h?(r.selectedYear=r.dateMin.getFullYear(),r.selectedMonth=r.dateMin.getMonth()):a||d?(r.selectedYear=r.dateMax.getFullYear(),r.selectedMonth=r.dateMax.getMonth()):r.selectedYear=o}else r.selectedYear=Number(s.dataset.calendarYear)},month:()=>{if(r.type==="multiple"){const o=hl(r,r.CSSClasses.columnMonth,r.CSSClasses.month,Number(s.dataset.calendarMonth),"data-calendar-selected-month"),l=s.closest(`.${i.column}`).querySelector(`.${r.CSSClasses.year}`);r.selectedYear=Number(l.dataset.calendarSelectedYear);const a=o<r.dateMin.getMonth()&&r.selectedYear<=r.dateMin.getFullYear(),h=o>r.dateMax.getMonth()&&r.selectedYear>=r.dateMax.getFullYear();r.selectedMonth=a?r.dateMin.getMonth():h?r.dateMax.getMonth():o}else r.selectedMonth=Number(s.dataset.calendarMonth)}})[t](),n[t](),r.currentType=r.type,Ui(r)},dl=(r,e,t,i)=>{if(!r.settings.selection[t])return;const s=e.target,n=d=>s.closest(`.${d}`),o=n(i.header),l=n(i.item),a=n(r.CSSClasses.grid),h=n(r.CSSClasses.column);r.currentType!==t&&o?{year:()=>zn(r,s),month:()=>Ko(r,s)}[t]():l?ec(r,e,t,i,l):(r.currentType===t&&o||r.type==="multiple"&&r.currentType===t&&a&&!h)&&(r.currentType=r.type,Ui(r))},cl=r=>{const e=t=>{Ld(r,t),Hd(r,t),Jd(r,t),dl(r,t,"month",{header:r.CSSClasses.month,item:r.CSSClasses.monthsMonth,column:r.CSSClasses.columnMonth}),dl(r,t,"year",{header:r.CSSClasses.year,item:r.CSSClasses.yearsYear,column:r.CSSClasses.columnYear})};return r.HTMLElement.addEventListener("click",e),()=>r.HTMLElement.removeEventListener("click",e)};function ul(r){if(!r||!r.getBoundingClientRect)return;const e=r.getBoundingClientRect(),t=document.documentElement;return{bottom:e.bottom,right:e.right,top:e.top+window.pageYOffset-t.clientTop,left:e.left+window.pageXOffset-t.clientLeft}}function tc(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}function pl(){return{vw:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),vh:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function ic(r){var e,t;let i=0,s=0,n=0,o=0;const l=tc(),a=ul(r),{vh:h,vw:d}=pl(),c=l.top,u=l.left;if(a){const p=(e=a.top)!=null?e:0,m=(t=a.left)!=null?t:0;s=p-c,n=m-u,i=h-(p-c+r.clientHeight),o=d-(m-u+r.clientWidth)}return{top:s,bottom:i,left:n,right:o}}function sc(r,e,t=5){const i={top:!0,bottom:!0,left:!0,right:!0},s=[];if(e&&r){const{bottom:n,top:o}=ic(r),{top:l,left:a}=ul(r),{height:h,width:d}=e.getBoundingClientRect(),{vh:c,vw:u}=pl(),p={x:u/2,y:c/2};l<p.y&&s.push("top"),l>p.y&&s.push("bottom"),a<p.x&&s.push("left"),a>p.x&&s.push("right"),h>o-t&&(i.top=!1),h>n-t&&(i.bottom=!1),d>a&&(i.left=!1),u-a<d&&(i.right=!1)}return{canShow:i,parentPositions:s}}function nc(r,e){let t="left";if(e&&r){const{canShow:i,parentPositions:s}=sc(r,e);if(!i.left||!i.right)return Array.isArray(s)&&(s[0]=s[0]==="bottom"?"top":"bottom"),s;i.bottom?t="center":i.top&&(t=["top","center"])}return t}const Un=(r,e,t,i)=>{if(r){const s=t==="auto"?nc(r,e):t,n={top:-e.offsetHeight,bottom:r.offsetHeight,left:0,center:r.offsetWidth/2-e.offsetWidth/2,right:r.offsetWidth-e.offsetWidth},o=Array.isArray(s)?s[0]:"bottom",l=Array.isArray(s)?s[1]:s;e.classList.add(o==="bottom"?i.calendarToInputBottom:i.calendarToInputTop);const a=r.getBoundingClientRect(),h=window.scrollX||document.documentElement.scrollLeft,d=window.scrollY||document.documentElement.scrollTop,c=a.top+d+n[o],u=a.left+h+n[l];Object.assign(e.style,{left:`${u}px`,top:`${c}px`})}},ml=(r,{year:e,month:t,dates:i,holidays:s,time:n}={})=>{var o;const l=Wo({},r.settings.selected);r.settings.selected.year=e?l.year:r.selectedYear,r.settings.selected.month=t?l.month:r.selectedMonth,r.settings.selected.holidays=s?l.holidays:r.selectedHolidays,r.settings.selected.time=n?l.time:r.selectedTime,r.settings.selected.dates=i==="only-first"&&((o=r.selectedDates)!=null&&o[0])?[r.selectedDates[0]]:i===!0?l.dates:r.selectedDates,Uo(r),Ui(r),r.settings.selected=l,r.settings.selection.day==="multiple-ranged"&&i&&ll(r)},fl=(r,e=!0)=>{r.isInputInit=!0;const t=document.createElement("div");return t.className=`${r.CSSClasses.calendar} ${r.CSSClasses.calendarToInput} ${r.CSSClasses.calendarHidden}`,r.HTMLElement=t,document.body.appendChild(r.HTMLElement),r.HTMLElement.style.visibility="hidden",e&&queueMicrotask(()=>{Un(r.HTMLInputElement,t,r.settings.visibility.positionToInput,r.CSSClasses),r.HTMLElement.style.visibility="visible",r.show()}),ml(r,{year:!0,month:!0,dates:!0,holidays:!0,time:!0}),r.actions.initCalendar&&r.actions.initCalendar(r),cl(r)},rc=r=>{const e=[];r.HTMLInputElement=r.HTMLElement;const t=()=>Un(r.HTMLInputElement,r.HTMLElement,r.settings.visibility.positionToInput,r.CSSClasses),i=s=>{var n;r&&s.target!==r.HTMLInputElement&&!((n=r.HTMLElement)!=null&&n.contains(s.target))&&(r.HTMLInputElement&&r.HTMLElement&&r.hide(),window.removeEventListener("resize",t),document.removeEventListener("click",i,{capture:!0}))};return r.HTMLInputElement.addEventListener("click",()=>{r.isInputInit?(Un(r.HTMLInputElement,r.HTMLElement,r.settings.visibility.positionToInput,r.CSSClasses),r.HTMLElement.style.visibility="visible",r.show()):e.push(fl(r)),window.addEventListener("resize",t),document.addEventListener("click",i,{capture:!0})}),()=>{e.forEach(s=>s())}},oc=r=>(r.HTMLOriginalElement=r.HTMLElement.cloneNode(!0),r.isInit=!0,r.input?rc(r):(Uo(r),Ui(r),r.actions.initCalendar&&r.actions.initCalendar(r),cl(r))),lc=(r,{year:e,month:t,dates:i,holidays:s,time:n}={})=>{if(!r.isInit)throw new Error(gi.notInit);r.input&&!r.isInputInit&&fl(r,!1),ml(r,{year:e,month:t,dates:i,holidays:s,time:n}),r.actions.updateCalendar&&r.actions.updateCalendar(r)},ac=r=>{var e,t,i,s,n,o;if(!r.isInit)throw new Error(gi.notInit);r.input?((t=(e=r.HTMLElement)==null?void 0:e.parentElement)==null||t.removeChild(r.HTMLElement),(s=(i=r.HTMLInputElement)==null?void 0:i.replaceWith)==null||s.call(i,r.HTMLOriginalElement),r.HTMLInputElement=void 0):(o=(n=r.HTMLElement)==null?void 0:n.replaceWith)==null||o.call(n,r.HTMLOriginalElement),r.HTMLElement=r.HTMLOriginalElement,r.actions.destroyCalendar&&r.actions.destroyCalendar(r)},hc=r=>{r.currentType?(r.HTMLElement.classList.remove(r.CSSClasses.calendarHidden),r.actions.showCalendar&&r.actions.showCalendar(r)):r.HTMLElement.click()},dc=r=>{r.currentType&&(r.HTMLElement.classList.add(r.CSSClasses.calendarHidden),r.actions.hideCalendar&&r.actions.hideCalendar(r))};function jn(r,...e){const t=s=>s&&typeof s=="object"&&!Array.isArray(s);if(!e.length)return r;const i=e.shift();return t(r)&&t(i)&&Object.keys(i).forEach(s=>{t(i[s])?(r[s]||Object.assign(r,{[s]:{}}),jn(r[s],i[s])):Object.assign(r,{[s]:i[s]})}),jn(r,...e)}function cc(r,e,t){r.settings=jn(r.settings,{[e]:t})}class gl extends rd{constructor(e,t){if(super(),Y(this,"init",()=>oc(this)),Y(this,"update",s=>lc(this,s)),Y(this,"destroy",()=>ac(this)),Y(this,"show",()=>hc(this)),Y(this,"hide",()=>dc(this)),Y(this,"changeSetting",(s,n)=>cc(this,s,n)),this.HTMLElement=typeof e=="string"?document.querySelector(e):e,!this.HTMLElement)throw new Error(gi.notFoundSelector(e));if(!t)return;const i=(s,n)=>{Object.keys(n).forEach(o=>{typeof s[o]!="object"||typeof n[o]!="object"||n[o]instanceof Date?s[o]=n[o]:i(s[o],n[o])})};i(this,t)}}class _l{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._lastClickIsDate=!1,this._shouldTriggerQuery=!0,this.hasTimePicker=!1,this.inputFilterType="range",this.searchTerms=[],this._bindEventService=new Ae}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)||{}}get currentDateOrDates(){return this._currentDateOrDates}get defaultOperator(){return this.inputFilterType==="compound"?H.empty:this.gridOptions.defaultFilterRangeOperator||H.rangeInclusive}get pickerOptions(){return this._pickerOptions||{}}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.date,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get operator(){var e;return this.inputFilterType==="compound"?this._operator||this.columnFilter.operator||this.defaultOperator:((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.inputFilterType==="compound"?this._operator=e:this.columnFilter&&(this.columnFilter.operator=e)}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.inputFilterType==="compound"&&(this.operator=e.operator||""),this.searchTerms=(e==null?void 0:e.searchTerms)??[],this.filterContainerElm=e.filterContainerElm;const t=this.inputFilterType==="compound"?Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"":this.searchTerms;this._filterElm=this.createDomFilterElement(t),this.updateFilterStyle(this.searchTerms.length>0),this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this)),this._bindEventService.bind(document.body,"keydown",i=>{(i.key==="Escape"||i.key==="Tab")&&this.hide()}),this._bindEventService.bind(this._dateInputElm,"keydown",i=>{i.key==="Backspace"&&this.clear(!0,!1)})}clear(e=!0,t=!0){if(this.calendarInstance&&(this._clearFilterTriggered=t,this._shouldTriggerQuery=e,this._currentValue="",this.searchTerms=[],this._currentDateStrings=[],this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.calendarInstance)){const i=new Date;$i(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this._currentDateOrDates,newVal:"",updatePickerUI:!0,selectedSettings:{dates:[],month:i.getMonth(),year:i.getFullYear()}})}this.onTriggerEvent(new Event("keyup")),this.updateFilterStyle(!1)}destroy(){var e,t,i,s;this._bindEventService.unbindAll(),(e=this.calendarInstance)==null||e.destroy(),J(this.filterContainerElm),(t=this.filterContainerElm)==null||t.remove(),(i=this._selectOperatorElm)==null||i.remove(),(s=this._filterElm)==null||s.remove()}hide(){var e;typeof((e=this.calendarInstance)==null?void 0:e.hide)=="function"&&this.calendarInstance.hide()}show(){var e;typeof((e=this.calendarInstance)==null?void 0:e.show)=="function"&&this.calendarInstance.show()}getValues(){return this._currentDateOrDates}setValues(e,t,i=!1){let s;this.inputFilterType==="compound"?s=Array.isArray(e)?e[0]:e:typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"&&e[0].indexOf("..")>0?s=typeof e=="string"?[e]:e[0].split(".."):Array.isArray(e)&&(s=e),this.calendarInstance&&s!==void 0&&($i(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,newVal:s,updatePickerUI:!0}),this._currentDateOrDates=e&&s?s:void 0);const n=this.getValues()||[],o=Array.isArray(n)?n:[n];if(this.updateFilterStyle(o.length>0),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const l=di(this.operator);this._selectOperatorElm.value=l}i&&this.callback(void 0,{columnDef:this.columnDef,searchTerms:o,operator:this.operator,shouldTriggerQuery:!0})}buildDatePickerInput(e){var u,p,m,f,g,_,b,C,E,y,T;const t=((u=this.columnDef)==null?void 0:u.id)??"",i=this.columnFilter.type||this.columnDef.type||S.dateIso,s=this.columnDef.outputType||this.columnFilter.type||this.columnDef.type||S.dateUtc,n=Ze(s),o=this.columnFilter.type||this.columnDef.type||S.dateIso;n&&this.inputFilterType!=="range"&&(n==="ISO8601"||n.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const l=Ze(this.hasTimePicker?S.dateTimeIsoAM_PM:S.dateIso),a=(((p=this.filterOptions)==null?void 0:p.locale)??((f=(m=this.translaterService)==null?void 0:m.getCurrentLanguage)==null?void 0:f.call(m)))||this.gridOptions.locale||"en";let h;this.inputFilterType==="compound"?e&&(h=e,this._currentDateOrDates=e):(typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"&&e[0].indexOf("..")>0?h=typeof e=="string"?[e]:e[0].split(".."):Array.isArray(e)&&(h=e),Array.isArray(h)&&(this._currentDateOrDates=h,this._currentDateStrings=h.map(x=>Ct(x,void 0,o))));const d={input:!0,jumpToSelectedDate:!0,type:this.inputFilterType==="range"?"multiple":"default",sanitizer:x=>this.grid.sanitizeHtmlString(x),toggleSelected:!1,actions:{clickDay:x=>{this._lastClickIsDate=!0},changeToInput:(x,O)=>{if(O.HTMLInputElement){let I=[],A="",k="";if(O.selectedDates[1]){O.selectedDates.sort((W,X)=>+new Date(W)-+new Date(X)),A=O.selectedDates[0],k=O.selectedDates[O.selectedDates.length-1];const L=Qe(O.selectedDates[0],n,"en-US"),N=Qe(k,n,"en-US");O.HTMLInputElement.value=`${L} — ${N}`,I=[A,k]}else O.selectedDates[0]?(A=O.selectedDates[0],O.HTMLInputElement.value=Ct(A,S.dateIso,s),I=O.selectedDates):O.HTMLInputElement.value="";if(this.hasTimePicker&&A){const L=ms(A,l);L.setHours(+(O.selectedHours||0)),L.setMinutes(+(O.selectedMinutes||0)),O.HTMLInputElement.value=Ct(L,void 0,s),I=[L]}if(this.inputFilterType==="compound"?this._currentValue=Ct(I[0],void 0,i):Array.isArray(I)&&(this._currentDateStrings=I.map(L=>Ct(L,void 0,i)),this._currentValue=this._currentDateStrings.join("..")),this._currentDateOrDates=I.map(L=>L instanceof Date?L:ms(L,l)),this._currentValue){const L=this.hasTimePicker?new Event("keyup"):void 0;this.onTriggerEvent(L)}this.inputFilterType==="range"&&O.selectedDates.length<2&&(this._lastClickIsDate=!1),this._lastClickIsDate&&(O.hide(),this._lastClickIsDate=!1)}}},settings:{lang:a,iso8601:!1,visibility:{theme:(g=this.gridOptions)!=null&&g.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};this.inputFilterType==="range"&&(d.type="multiple",d.months=2,d.jumpMonths=2,d.settings={...d.settings,range:{edgesOnly:!0},selection:{day:"multiple-ranged"},visibility:{...(_=d.settings)==null?void 0:_.visibility,daysOutside:!1}}),this.hasTimePicker&&((b=d.settings).selection??(b.selection={}),d.settings.selection.time=24),this._pickerOptions=de(!0,{},d,{settings:this.filterOptions});let c=((C=this.gridOptions)==null?void 0:C.defaultFilterPlaceholder)??"";(E=this.columnFilter)!=null&&E.placeholder&&(c=this.columnFilter.placeholder),this._dateInputElm=v("input",{type:"text",className:"form-control date-picker",placeholder:c,readOnly:!0,dataset:{input:"",columnid:`${t}`}}),this.calendarInstance=new gl(this._dateInputElm,this._pickerOptions),this.calendarInstance.init(),(T=(y=this._pickerOptions.settings)==null?void 0:y.selected)!=null&&T.dates&&(h=this._pickerOptions.settings.selected.dates),h&&$i(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:void 0,newVal:h,updatePickerUI:!1})}getOperatorOptionValues(){var t;let e;return(t=this.columnFilter)!=null&&t.compoundOperatorList?e=this.columnFilter.compoundOperatorList:e=Dn(this.gridOptions,this.translaterService),Mn(this.gridOptions,e,"numeric"),e}createDomFilterElement(e){var i;const t=((i=this.columnDef)==null?void 0:i.id)??"";if(J(this.filterContainerElm),this.buildDatePickerInput(e),this.inputFilterType==="range"){const s=v("div",{className:`date-picker form-group search-filter filter-${t}`});return Array.isArray(e)&&e.length>0&&e[0]!==""&&(this._currentDateOrDates=e,this._currentValue=e[0]),s.appendChild(this._dateInputElm),s&&this.filterContainerElm.appendChild(s),s}else{this._selectOperatorElm=Fn(this.getOperatorOptionValues(),this.grid);const s=v("div",{className:`date-picker form-group search-filter filter-${t}`}),n=v("div",{className:"input-group date-picker"},s);if(v("div",{className:"input-group-addon input-group-prepend operator"},n).appendChild(this._selectOperatorElm),n.appendChild(this._dateInputElm),this.operator){const l=di(this.operator);this._selectOperatorElm.value=l}return this._currentDateOrDates=e,this._currentValue=e,s&&this.filterContainerElm.appendChild(s),s}}onTriggerEvent(e){if(this._clearFilterTriggered)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else if(this.inputFilterType==="range"){const t=this._currentDateStrings?this._currentDateStrings:[this._currentValue];this.updateFilterStyle(t.length>0),this.callback(e,{columnDef:this.columnDef,searchTerms:t,operator:this.operator||"",shouldTriggerQuery:this._shouldTriggerQuery})}else if(this.inputFilterType==="compound"&&this._selectOperatorElm){const t=this._selectOperatorElm.value;this.updateFilterStyle(!!this._currentValue);const i=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput===void 0,s=i&&ie(this._currentDateOrDates)||this._currentDateOrDates===""&&ie(this._lastSearchValue);(!i||!i||s)&&this.callback(e,{columnDef:this.columnDef,searchTerms:this._currentValue?[this._currentValue]:null,operator:t||"",shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._lastSearchValue=this._currentValue}updateFilterStyle(e){e?this._filterElm.classList.add("filled"):this._filterElm.classList.remove("filled")}}class uc extends _l{constructor(e){super(e),this.translaterService=e,this.inputFilterType="compound"}}class Cl{constructor(e){this.translaterService=e}filterCollection(e,t,i=hi.chain){let s=[];return Array.isArray(t)?(s=i===hi.merge?[]:[...e],t.forEach(n=>{if(i===hi.merge){const o=this.singleFilterCollection(e,n);s=bo([...s,...o])}else s=this.singleFilterCollection(s,n)})):s=this.singleFilterCollection(e,t),s}singleFilterCollection(e,t){let i=[];if(t){const s=t.property,n=t.operator||H.equal,o=typeof t.value>"u"?"":t.value;switch(n){case H.equal:s?i=e.filter(l=>l[s]===o):i=e.filter(l=>l===o);break;case H.contains:s?i=e.filter(l=>{var a;return((a=l[s])==null?void 0:a.toString().indexOf(o.toString()))!==-1}):i=e.filter(l=>l!=null&&l.toString().indexOf(o.toString())!==-1);break;case H.notContains:s?i=e.filter(l=>{var a;return((a=l[s])==null?void 0:a.toString().indexOf(o.toString()))===-1}):i=e.filter(l=>l!=null&&l.toString().indexOf(o.toString())===-1);break;case H.notEqual:default:s?i=e.filter(l=>l[s]!==o):i=e.filter(l=>l!==o)}}return i}sortCollection(e,t,i,s){if(s&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');let n=[];if(i){if(Array.isArray(i))n=t.sort((o,l)=>{var a,h;for(let d=0,c=i.length;d<c;d++){const u=i[d];if(u!=null&&u.property){const p=u.sortDesc?ae.desc:ae.asc,m=u.property,f=(u==null?void 0:u.fieldType)??(e==null?void 0:e.type)??S.string,g=s?((a=this.translaterService)==null?void 0:a.translate)&&this.translaterService.translate(o[m]||" "):o[m],_=s?((h=this.translaterService)==null?void 0:h.translate)&&this.translaterService.translate(l[m]||" "):l[m],b=mi(f,g,_,p,e);if(b!==ae.neutral)return b}}return ae.neutral});else if(i!=null&&i.property){const o=i.property,l=i.sortDesc?ae.desc:ae.asc,a=(i==null?void 0:i.fieldType)??(e==null?void 0:e.type)??S.string;n=t.sort((h,d)=>{var m,f;const c=s?((m=this.translaterService)==null?void 0:m.translate)&&this.translaterService.translate(h[o]||" "):h[o],u=s?((f=this.translaterService)==null?void 0:f.translate)&&this.translaterService.translate(d[o]||" "):d[o],p=mi(a,c,u,l,e);return p!==ae.neutral?p:ae.neutral})}else if(i&&!i.property){const o=i.sortDesc?ae.desc:ae.asc,l=(i==null?void 0:i.fieldType)??(e==null?void 0:e.type)??S.string;n=t.sort((a,h)=>{var p,m;const d=s?((p=this.translaterService)==null?void 0:p.translate)&&this.translaterService.translate(a||" "):a,c=s?((m=this.translaterService)==null?void 0:m.translate)&&this.translaterService.translate(h||" "):h,u=mi(l,d,c,o,e);return u!==ae.neutral?u:ae.neutral})}}return n}}function vl(r,e,t,i,s=!1,n,o){var O,I,A,k,L;const l=(t==null?void 0:t.id)??"",a=i.getOptions(),h=(r==="editor"?t==null?void 0:t.editor:t==null?void 0:t.filter)??{},d=(h==null?void 0:h.collectionOptions)??{},c=(d==null?void 0:d.separatorBetweenTextLabels)??"",u=(h==null?void 0:h.enableTranslateLabel)??!1,p=(a==null?void 0:a.enableTranslate)??!1,m=(h==null?void 0:h.enableRenderHtml)??!1,f=((O=h==null?void 0:h.customStructure)==null?void 0:O.label)??"label",g=((I=h==null?void 0:h.customStructure)==null?void 0:I.labelPrefix)??"labelPrefix",_=((A=h==null?void 0:h.customStructure)==null?void 0:A.labelSuffix)??"labelSuffix",b=((k=h==null?void 0:h.customStructure)==null?void 0:k.optionLabel)??"value",C=((L=h==null?void 0:h.customStructure)==null?void 0:L.value)??"value",E=v("select",{className:"ms-filter search-filter"}),y=r==="filter"?["search-filter",`filter-${l}`]:["select-editor",`editor-${l}`];E.classList.add(...y),E.multiple=s;const T=[];let x=!1;return Array.isArray(e)&&(e.every(N=>typeof N=="number"||typeof N=="string")?e.forEach(N=>{const W={text:String(N),value:N};r==="filter"&&Array.isArray(o)&&(W.selected=o.findIndex(X=>X===N)>=0),T.push(W),(W.selected&&s||W.selected&&!s&&N!=="")&&(x=!0)}):e.forEach(N=>{if(N===void 0||typeof N=="object"&&N[f]===void 0&&N.labelKey===void 0)throw new Error("[Slickgrid-Universal] Select Filter/Editor collection with value/label (or value/labelKey when using Locale) is required to populate the Select list, for example:: { filter: model: Filters.multipleSelect, collection: [ { value: '1', label: 'One' } ]')");const W=N.labelKey||N[f],X=(N.labelKey||u&&n)&&W&&p?n==null?void 0:n.translate(W||" "):W;let Z=N[g]||"",q=N[_]||"",ee=N.hasOwnProperty(b)?N[b]:"";ee!=null&&ee.toString&&(ee=ee.toString().replace(/"/g,"'")),Z=u&&n&&Z&&typeof Z=="string"?n.translate(Z||" "):Z,q=u&&n&&q&&typeof q=="string"?n.translate(q||" "):q,ee=u&&n&&ee&&typeof ee=="string"?n.translate(ee||" "):ee;let st=[Z,typeof X=="string"||typeof X=="number"?X.toString():X,q].filter(Ye=>Ye).join(c);const ge={text:"",value:""};m&&(st=i.sanitizeHtmlString(st)),ge.text=st;let xe=N[C];xe==null&&(xe=""),r==="filter"&&Array.isArray(o)&&(ge.selected=o.findIndex(Ye=>`${Ye}`==`${N[C]}`)>=0),ge.value=`${xe??""}`,T.push(ge),(ge.selected&&s||ge.selected&&!s&&N[C]!=="")&&(x=!0)})),{selectElement:E,dataCollection:T,hasFoundSearchTerm:x}}class pc{constructor(e,t,i){this.sharedService=e,this.backendUtilities=t,this.translaterService=i}getPickerTitleOutputString(e,t){var c,u,p,m,f,g,_,b,C,E,y,T,x,O;if((c=this.sharedService.gridOptions)!=null&&c.enableTranslate&&!((u=this.translaterService)!=null&&u.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');let i="";const s=((p=this.sharedService.gridOptions)==null?void 0:p[t])??{},n=((m=this.sharedService.gridOptions)==null?void 0:m.enableTranslate)??!1,o=((f=this.sharedService.gridOptions)==null?void 0:f.locales)??R.locales,l=s==null?void 0:s[e],a=s==null?void 0:s[`${e}Key`],h=this.sharedService.gridOptions,d=ot(h);if(a&&((g=this.translaterService)!=null&&g.translate))i=this.translaterService.translate(a||" ");else switch(e){case"commandTitle":i=l||n&&((_=this.translaterService)==null?void 0:_.getCurrentLanguage)&&((b=this.translaterService)==null?void 0:b.translate(`${d}COMMANDS`))||(o==null?void 0:o.TEXT_COMMANDS);break;case"columnTitle":i=l||n&&((C=this.translaterService)==null?void 0:C.getCurrentLanguage)&&((E=this.translaterService)==null?void 0:E.translate(`${d}COLUMNS`))||(o==null?void 0:o.TEXT_COLUMNS);break;case"forceFitTitle":i=l||n&&((y=this.translaterService)==null?void 0:y.getCurrentLanguage)&&((T=this.translaterService)==null?void 0:T.translate(`${d}FORCE_FIT_COLUMNS`))||(o==null?void 0:o.TEXT_FORCE_FIT_COLUMNS);break;case"syncResizeTitle":i=l||n&&((x=this.translaterService)==null?void 0:x.getCurrentLanguage)&&((O=this.translaterService)==null?void 0:O.translate(`${d}SYNCHRONOUS_RESIZE`))||(o==null?void 0:o.TEXT_SYNCHRONOUS_RESIZE);break;default:i=l;break}return i}readjustFrozenColumnIndexWhenNeeded(e,t,i){if(e>=0){const s=i.findIndex(n=>n.id===this.sharedService.frozenVisibleColumnId);s>=0&&s!==e&&(this.sharedService.gridOptions.frozenColumn=s,this.sharedService.slickGrid.setOptions({frozenColumn:s})),Array.isArray(i)&&Array.isArray(t)&&i.length!==t.length&&this.sharedService.slickGrid.setColumns(i)}}refreshBackendDataset(e){var i;let t=this.sharedService.gridOptions;e&&(t={...this.sharedService.gridOptions,...e},this.sharedService.gridOptions=t),(i=this.backendUtilities)==null||i.refreshBackendDataset(t)}runOverrideFunctionWhenExists(e,t){return typeof e=="function"?!!e.call(this,t):!0}sortItems(e,t){Array.isArray(e)&&e.sort((i,s)=>i&&s&&i.hasOwnProperty(t)&&s.hasOwnProperty(t)?i[t]-s[t]:0)}translateItems(e,t,i){var s,n;if(Array.isArray(e))for(const o of e)o.hasOwnProperty(t)&&(o[i]=(n=(s=this.translaterService)==null?void 0:s.translate)==null?void 0:n.call(s,o[t]))}translateMenuItemsFromTitleKey(e,t="commandItems"){for(const i of e)typeof i=="object"&&(i.titleKey&&(i.title=this.translateWhenEnabledAndServiceExist(`${i.titleKey}`,`TEXT_${i.titleKey}`)),i.subMenuTitleKey&&(i.subMenuTitle=this.translateWhenEnabledAndServiceExist(`${i.subMenuTitleKey}`,`TEXT_${i.subMenuTitleKey}`))),Array.isArray(i==null?void 0:i[t])&&this.translateMenuItemsFromTitleKey(i==null?void 0:i[t])}translateWhenEnabledAndServiceExist(e,t,i){var l,a;let s="";const n=(l=this.sharedService)==null?void 0:l.gridOptions,o=(n==null?void 0:n.locales)??R.locales;return i?s=i:n.enableTranslate&&((a=this.translaterService)!=null&&a.translate)?s=this.translaterService.translate(e||" "):t in o?s=o[t]:s=t,s}}class le{get defaultPrevented(){return this._isDefaultPrevented}constructor(e,t){this.event=e,this.args=t,this._isPropagationStopped=!1,this._isImmediatePropagationStopped=!1,this._isDefaultPrevented=!1,this.returnValue=void 0,this.nativeEvent=e,this._arguments=t,e&&["altKey","ctrlKey","metaKey","shiftKey","key","keyCode","clientX","clientY","offsetX","offsetY","pageX","pageY","bubbles","target","type","which","x","y"].forEach(i=>this[i]=e[i]),this._eventTarget=this.nativeEvent?this.nativeEvent.target:void 0}stopPropagation(){var e;this._isPropagationStopped=!0,(e=this.nativeEvent)==null||e.stopPropagation()}isPropagationStopped(){return this._isPropagationStopped}stopImmediatePropagation(){this._isImmediatePropagationStopped=!0,this.nativeEvent&&this.nativeEvent.stopImmediatePropagation()}isImmediatePropagationStopped(){return this._isImmediatePropagationStopped}getNativeEvent(){return this.nativeEvent}preventDefault(){this.nativeEvent&&this.nativeEvent.preventDefault(),this._isDefaultPrevented=!0}isDefaultPrevented(){return this.nativeEvent?this.nativeEvent.defaultPrevented:this._isDefaultPrevented}addReturnValue(e){this.returnValue===void 0&&e!==void 0&&(this.returnValue=e)}getReturnValue(){return this.returnValue}getArguments(){return this._arguments}resetReturnValue(){this.returnValue=void 0}}class P{get subscriberCount(){return this._handlers.length}constructor(e,t){this.eventName=e,this.pubSub=t,this._handlers=[],this._pubSubService=t}subscribe(e){this._handlers.push(e)}unsubscribe(e){for(let t=this._handlers.length-1;t>=0;t--)this._handlers[t]===e&&this._handlers.splice(t,1)}notify(e,t,i,s=!1){var o;const n=t instanceof le?t:new le(t,e);s&&n.resetReturnValue(),i=i||this;for(let l=0;l<this._handlers.length&&!(n.isPropagationStopped()||n.isImmediatePropagationStopped());l++){const a=this._handlers[l].call(i,n,e);n.addReturnValue(a)}if(typeof((o=this._pubSubService)==null?void 0:o.publish)=="function"&&this.eventName){const l=this._pubSubService.publish(this.eventName,{args:e,eventData:n},void 0,a=>n.nativeEvent??(n.nativeEvent=a));n.addReturnValue(l)}return n}setPubSubService(e){this._pubSubService=e}}class pe{constructor(){this.handlers=[]}get subscriberCount(){return this.handlers.length}subscribe(e,t){return this.handlers.push({event:e,handler:t}),e.subscribe(t),this}unsubscribe(e,t){let i=this.handlers.length;for(;i--;)if(this.handlers[i].event===e&&this.handlers[i].handler===t){this.handlers.splice(i,1),e.unsubscribe(t);return}return this}unsubscribeAll(){let e=this.handlers.length;for(;e--;)this.handlers[e].event.unsubscribe(this.handlers[e].handler);return this.handlers=[],this}}class Je{constructor(e,t,i,s){i===void 0&&s===void 0&&(i=e,s=t),this.fromRow=Math.min(e,i),this.fromCell=Math.min(t,s),this.toRow=Math.max(e,i),this.toCell=Math.max(t,s)}isSingleCell(){return this.fromRow===this.toRow&&this.fromCell===this.toCell}isSingleRow(){return this.fromRow===this.toRow}contains(e,t){return e>=this.fromRow&&e<=this.toRow&&t>=this.fromCell&&t<=this.toCell}toString(){return this.isSingleCell()?`(${this.fromRow}:${this.fromCell})`:`(${this.fromRow}:${this.fromCell} - ${this.toRow}:${this.toCell})`}}class bl{constructor(){this.__nonDataRow=!0}}class Ss extends bl{constructor(){super(),this.__group=!0,this.level=0,this.count=0,this.value=null,this.title=null,this.collapsed=!1,this.selectChecked=!1,this.totals=null,this.rows=[],this.groups=null,this.groupingKey=""}equals(e){return this.value===e.value&&this.count===e.count&&this.collapsed===e.collapsed&&this.title===e.title}}class mc extends bl{constructor(){super(),this.__groupTotals=!0,this.group=null,this.initialized=!1}}class fc{constructor(){this.activeEditController=null}isActive(e){return e?this.activeEditController===e:this.activeEditController!==null}activate(e){if(e!==this.activeEditController){if(this.activeEditController!==null)throw new Error("SlickEditorLock.activate: an editController is still active, can't activate another editController");if(!e.commitCurrentEdit)throw new Error("SlickEditorLock.activate: editController must implement .commitCurrentEdit()");if(!e.cancelCurrentEdit)throw new Error("SlickEditorLock.activate: editController must implement .cancelCurrentEdit()");this.activeEditController=e}}deactivate(e){if(this.activeEditController){if(this.activeEditController!==e)throw new Error("SlickEditorLock.deactivate: specified editController is not the currently active one");this.activeEditController=null}}commitCurrentEdit(){return this.activeEditController?this.activeEditController.commitCurrentEdit():!0}cancelCurrentEdit(){return this.activeEditController?this.activeEditController.cancelCurrentEdit():!0}}class w{static height(e,t){if(e){if(t===void 0)return e.getBoundingClientRect().height;w.setStyleSize(e,"height",t)}}static width(e,t){if(!(!e||!e.getBoundingClientRect)){if(t===void 0)return e.getBoundingClientRect().width;w.setStyleSize(e,"width",t)}}static setStyleSize(e,t,i){typeof i=="function"&&(i=i()),e.style[t]=typeof i=="string"?i:`${i}px`}static isHidden(e){return e.offsetWidth===0&&e.offsetHeight===0}static parents(e,t){const i=[],s=t===":visible",n=t===":hidden";for(;(e=e.parentNode)&&e!==document&&!(!e||!e.parentNode);)n?w.isHidden(e)&&i.push(e):s?w.isHidden(e)||i.push(e):(!t||e.matches(t))&&i.push(e);return i}static toFloat(e){const t=parseFloat(e);return isNaN(t)?0:t}static show(e,t=""){Array.isArray(e)?e.forEach(i=>i.style.display=t):e.style.display=t}static hide(e){Array.isArray(e)?e.forEach(t=>t.style.display="none"):e.style.display="none"}static applyDefaults(e,t){typeof t=="object"&&Object.keys(t).forEach(i=>{t.hasOwnProperty(i)&&!e.hasOwnProperty(i)&&(e[i]=t[i])})}static addSlickEventPubSubWhenDefined(e,t){if(e)for(const i in t)t[i]instanceof P&&typeof t[i].setPubSubService=="function"&&t[i].setPubSubService(e)}}w.storage={_storage:new WeakMap,put:function(r,e,t){this._storage.has(r)||this._storage.set(r,new Map),this._storage.get(r).set(e,t)},get:function(r,e){const t=this._storage.get(r);return t?t.get(e):null},remove:function(r,e){const t=this._storage.get(r).delete(e);return this._storage.get(r).size!==0&&this._storage.delete(r),t}};const ji=new fc,gc="slick-edit-preclick";class Sl{constructor(e){this.pluginName="GroupItemMetadataProvider",this._defaults={groupCssClass:"slick-group",groupTitleCssClass:"slick-group-title",totalsCssClass:"slick-group-totals",groupFocusable:!0,indentation:15,totalsFocusable:!1,toggleCssClass:"slick-group-toggle",toggleExpandedCssClass:"expanded",toggleCollapsedCssClass:"collapsed",enableExpandCollapse:!0,groupFormatter:this.defaultGroupCellFormatter.bind(this),totalsFormatter:this.defaultTotalsCellFormatter.bind(this),includeHeaderTotals:!1},this._eventHandler=new pe,this._options=de(!0,{},this._defaults,e)}get eventHandler(){return this._eventHandler}get dataView(){var e;return((e=this._grid)==null?void 0:e.getData())??{}}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())||{}}init(e,t){this._grid=e,this._options={...this._defaults,...t},this._eventHandler.subscribe(e.onClick,this.handleGridClick.bind(this)),this._eventHandler.subscribe(e.onKeyDown,this.handleGridKeyDown.bind(this))}destroy(){this.dispose()}dispose(){var e;(e=this._eventHandler)==null||e.unsubscribeAll()}getOptions(){return this._options}setOptions(e){this._options={...this._options,...e}}getGroupRowMetadata(e){return{selectable:!1,focusable:this._options.groupFocusable,cssClasses:`${this._options.groupCssClass} slick-group-level-${(e==null?void 0:e.level)||0}`,formatter:this._options.includeHeaderTotals&&this._options.totalsFormatter||void 0,columns:{0:{colspan:this._options.includeHeaderTotals?"1":"*",formatter:this._options.groupFormatter,editorClass:null}}}}getTotalsRowMetadata(e){var t;return{selectable:!1,focusable:this._options.totalsFocusable,cssClasses:`${this._options.totalsCssClass} slick-group-level-${((t=e==null?void 0:e.group)==null?void 0:t.level)||0}`,formatter:this._options.totalsFormatter,editorClass:null}}defaultGroupCellFormatter(e,t,i,s,n){var u,p;if(!this._options.enableExpandCollapse)return n.title;const o=n.level||0,l=((u=this._options)==null?void 0:u.indentation)??15,a=`${o*l}px`,h=n.collapsed?this._options.toggleCollapsedCssClass:this._options.toggleExpandedCssClass,d=(p=this.gridOptions)!=null&&p.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment;d.appendChild(v("span",{className:`${this._options.toggleCssClass} ${h}`,ariaExpanded:String(!n.collapsed),style:{marginLeft:a}}));const c=v("span",{className:this._options.groupTitleCssClass||""});return c.setAttribute("level",o),n.title instanceof HTMLElement||n.title instanceof DocumentFragment?c.appendChild(n.title):this._grid.applyHtmlCode(c,n.title??""),d.appendChild(c),d}defaultTotalsCellFormatter(e,t,i,s,n,o){var l;return((l=s==null?void 0:s.groupTotalsFormatter)==null?void 0:l.call(s,n,s,o))??""}handleGridClick(e,t){var n;const i=e.target,s=(n=this._grid)==null?void 0:n.getDataItem(t.row);s instanceof Ss&&i.classList.contains(this._options.toggleCssClass||"")&&(this.handleDataViewExpandOrCollapse(s),e.stopImmediatePropagation(),e.preventDefault())}handleGridKeyDown(e){var t;if(this._options.enableExpandCollapse&&e.key===" "){const i=(t=this._grid)==null?void 0:t.getActiveCell();if(i){const s=this._grid.getDataItem(i.row);s instanceof Ss&&(this.handleDataViewExpandOrCollapse(s),e.stopImmediatePropagation(),e.preventDefault())}}}handleDataViewExpandOrCollapse(e){var i;const t=(i=this._grid)==null?void 0:i.getRenderedRange();this.dataView.setRefreshHints({ignoreDiffsBefore:t.top,ignoreDiffsAfter:t.bottom+1}),e.collapsed?this.dataView.expandGroup(e.groupingKey):this.dataView.collapseGroup(e.groupingKey)}}class _c{constructor(e,t){this.externalPubSub=t,this.defaults={groupItemMetadataProvider:null,inlineFilters:!1,useCSPSafeFilter:!1},this.idProperty="id",this.items=[],this.rows=[],this.idxById=new Map,this.rowsById=void 0,this.filter=null,this.filterCSPSafe=null,this.updated=null,this.suspend=!1,this.isBulkSuspend=!1,this.bulkDeleteIds=new Map,this.sortAsc=!0,this.refreshHints={},this.prevRefreshHints={},this.filteredItems=[],this.filterCache=[],this.groupingInfoDefaults={getter:void 0,formatter:void 0,comparer:(i,s)=>i.value===s.value?0:i.value>s.value?1:-1,predefinedValues:[],aggregators:[],aggregateEmpty:!1,aggregateCollapsed:!1,aggregateChildGroups:!1,collapsed:!1,displayTotalsRow:!0,lazyTotalsCalculation:!1},this.groupingInfos=[],this.groups=[],this.toggledGroupsByLevel=[],this.groupingDelimiter=":|:",this.selectedRowIds=[],this.pagesize=0,this.pagenum=0,this.totalRows=0,this.onBeforePagingInfoChanged=new P("onBeforePagingInfoChanged",t),this.onGroupExpanded=new P("onGroupExpanded",t),this.onGroupCollapsed=new P("onGroupCollapsed",t),this.onPagingInfoChanged=new P("onPagingInfoChanged",t),this.onRowCountChanged=new P("onRowCountChanged",t),this.onRowsChanged=new P("onRowsChanged",t),this.onRowsOrCountChanged=new P("onRowsOrCountChanged",t),this.onSelectedRowIdsChanged=new P("onSelectedRowIdsChanged",t),this.onSetItemsCalled=new P("onSetItemsCalled",t),this._options=de(!0,{},this.defaults,e)}beginUpdate(e){this.suspend=!0,this.isBulkSuspend=e===!0}endUpdate(){const e=this.isBulkSuspend;this.isBulkSuspend=!1,this.suspend=!1,e&&(this.processBulkDelete(),this.ensureIdUniqueness()),this.refresh()}destroy(){var e,t,i;this.items=[],this.idProperty="id",this.idxById=null,this.rowsById=null,this.filter=null,this.filterCSPSafe=null,this.updated=null,this.sortComparer=null,this.filterCache=[],this.filteredItems=[],this.compiledFilter=null,this.compiledFilterCSPSafe=null,this.compiledFilterWithCaching=null,this.compiledFilterWithCachingCSPSafe=null,this._grid&&((e=this._grid.onSelectedRowsChanged)==null||e.unsubscribe(),(t=this._grid.onCellCssStylesChanged)==null||t.unsubscribe()),(i=this.onRowsOrCountChanged)==null||i.unsubscribe()}setRefreshHints(e){this.refreshHints=e}getFilterArgs(){return this.filterArgs}setFilterArgs(e){this.filterArgs=e}processBulkDelete(){if(!this.idxById)return;let e,t,i=0;for(let s=0,n=this.items.length;s<n;s++){if(t=this.items[s],e=t[this.idProperty],e===void 0)throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");this.bulkDeleteIds.has(e)?this.idxById.delete(e):(this.items[i]=t,this.idxById.set(e,i),++i)}this.items.length=i,this.bulkDeleteIds=new Map}updateIdxById(e){if(this.isBulkSuspend||!this.idxById)return;e=e||0;let t;for(let i=e,s=this.items.length;i<s;i++){if(t=this.items[i][this.idProperty],t===void 0)throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");this.idxById.set(t,i)}}ensureIdUniqueness(){if(this.isBulkSuspend||!this.idxById)return;let e;for(let t=0,i=this.items.length;t<i;t++)if(e=this.items[t][this.idProperty],e===void 0||this.idxById.get(e)!==t)throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property")}getItems(){return this.items}getIdPropertyName(){return this.idProperty}setItems(e,t){t!==void 0&&(this.idProperty=t),this.items=this.filteredItems=e,this.onSetItemsCalled.notify({idProperty:this.idProperty,itemCount:this.items.length},null,this),this.idxById=new Map,this.updateIdxById(),this.ensureIdUniqueness(),this.refresh()}setPagingOptions(e){this.onBeforePagingInfoChanged.notify(this.getPagingInfo(),null,this).getReturnValue()!==!1&&(ie(e.pageSize)&&(this.pagesize=e.pageSize,this.pagenum=this.pagesize?Math.min(this.pagenum,Math.max(0,Math.ceil(this.totalRows/this.pagesize)-1)):0),ie(e.pageNum)&&(this.pagenum=Math.min(e.pageNum,Math.max(0,Math.ceil(this.totalRows/this.pagesize)-1))),this.onPagingInfoChanged.notify(this.getPagingInfo(),null,this),this.refresh())}getPagingInfo(){const e=this.pagesize?Math.max(1,Math.ceil(this.totalRows/this.pagesize)):1;return{pageSize:this.pagesize,pageNum:this.pagenum,totalRows:this.totalRows,totalPages:e,dataView:this}}sort(e,t){this.sortAsc=t,this.sortComparer=e,t===!1&&this.items.reverse(),this.items.sort(e),t===!1&&this.items.reverse(),this.idxById=new Map,this.updateIdxById(),this.refresh()}reSort(){this.sortComparer&&this.sort(this.sortComparer,this.sortAsc)}getFilteredItems(){return this.filteredItems}getFilteredItemCount(){return this.filteredItems.length}getFilter(){return this._options.useCSPSafeFilter?this.filterCSPSafe:this.filter}setFilter(e){this.filterCSPSafe=e,this.filter=e,this._options.inlineFilters&&(this.compiledFilterCSPSafe=this.compileFilterCSPSafe,this.compiledFilterWithCachingCSPSafe=this.compileFilterWithCachingCSPSafe,this.compiledFilter=this.compileFilter(this._options.useCSPSafeFilter),this.compiledFilterWithCaching=this.compileFilterWithCaching(this._options.useCSPSafeFilter)),this.refresh()}getGrouping(){return this.groupingInfos}setGrouping(e){this._options.groupItemMetadataProvider||(this._options.groupItemMetadataProvider=new Sl),this.groups=[],this.toggledGroupsByLevel=[],e=e||[],this.groupingInfos=e instanceof Array?e:[e];for(let t=0;t<this.groupingInfos.length;t++){const i=this.groupingInfos[t]=de(!0,{},this.groupingInfoDefaults,this.groupingInfos[t]);i.getterIsAFn=typeof i.getter=="function",i.compiledAccumulators=[];let s=i.aggregators.length;for(;s--;)i.compiledAccumulators[s]=this.compileAccumulatorLoopCSPSafe(i.aggregators[s]);this.toggledGroupsByLevel[t]={}}this.refresh()}getItemByIdx(e){return this.items[e]}getIdxById(e){var t;return(t=this.idxById)==null?void 0:t.get(e)}ensureRowsByIdCache(){if(!this.rowsById){this.rowsById={};for(let e=0,t=this.rows.length;e<t;e++)this.rowsById[this.rows[e][this.idProperty]]=e}}getRowByItem(e){var t;return this.ensureRowsByIdCache(),(t=this.rowsById)==null?void 0:t[e[this.idProperty]]}getRowById(e){var t;return this.ensureRowsByIdCache(),(t=this.rowsById)==null?void 0:t[e]}getItemById(e){return this.items[this.idxById.get(e)]}mapItemsToRows(e){var i;const t=[];this.ensureRowsByIdCache();for(let s=0,n=e.length;s<n;s++){const o=(i=this.rowsById)==null?void 0:i[e[s][this.idProperty]];ie(o)&&(t[t.length]=o)}return t}mapIdsToRows(e){var i;const t=[];this.ensureRowsByIdCache();for(let s=0,n=e.length;s<n;s++){const o=(i=this.rowsById)==null?void 0:i[e[s]];ie(o)&&(t[t.length]=o)}return t}mapRowsToIds(e){const t=[];for(let i=0,s=e.length;i<s;i++)if(e[i]<this.rows.length){const n=this.rows[e[i]];t[t.length]=n[this.idProperty]}return t}updateSingleItem(e,t){var i;if(this.idxById){if(!this.idxById.has(e))throw new Error("[SlickGrid DataView] Invalid id");if(e!==t[this.idProperty]){const s=t[this.idProperty];if(!ie(s))throw new Error("[SlickGrid DataView] Cannot update item to associate with a null id");if(this.idxById.has(s))throw new Error("[SlickGrid DataView] Cannot update item to associate with a non-unique id");this.idxById.set(s,this.idxById.get(e)),this.idxById.delete(e),(i=this.updated)!=null&&i[e]&&delete this.updated[e],e=s}this.items[this.idxById.get(e)]=t,this.updated||(this.updated={}),this.updated[e]=!0}}updateItem(e,t){this.updateSingleItem(e,t),this.refresh()}updateItems(e,t){if(e.length!==t.length)throw new Error("[SlickGrid DataView] Mismatch on the length of ids and items provided to update");for(let i=0,s=t.length;i<s;i++)this.updateSingleItem(e[i],t[i]);this.refresh()}insertItem(e,t){this.items.splice(e,0,t),this.updateIdxById(e),this.refresh()}insertItems(e,t){Array.prototype.splice.apply(this.items,[e,0].concat(t)),this.updateIdxById(e),this.refresh()}addItem(e){this.items.push(e),this.updateIdxById(this.items.length-1),this.refresh()}addItems(e){this.items=this.items.concat(e),this.updateIdxById(this.items.length-e.length),this.refresh()}deleteItem(e){if(this.idxById)if(this.isBulkSuspend)this.bulkDeleteIds.set(e,!0);else{const t=this.idxById.get(e);if(t===void 0)throw new Error("[SlickGrid DataView] Invalid id");this.idxById.delete(e),this.items.splice(t,1),this.updateIdxById(t),this.refresh()}}deleteItems(e){if(!(e.length===0||!this.idxById))if(this.isBulkSuspend)for(let t=0,i=e.length;t<i;t++){const s=e[t];if(this.idxById.get(s)===void 0)throw new Error("[SlickGrid DataView] Invalid id");this.bulkDeleteIds.set(s,!0)}else{const t=[];for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.idxById.get(n);if(o===void 0)throw new Error("[SlickGrid DataView] Invalid id");this.idxById.delete(n),t.push(o)}t.sort();for(let i=t.length-1;i>=0;--i)this.items.splice(t[i],1);this.updateIdxById(t[0]),this.refresh()}}sortedAddItem(e){if(!this.sortComparer)throw new Error("[SlickGrid DataView] sortedAddItem() requires a sort comparer, use sort()");this.insertItem(this.sortedIndex(e),e)}sortedUpdateItem(e,t){if(!this.idxById)return;if(!this.idxById.has(e)||e!==t[this.idProperty])throw new Error(`[SlickGrid DataView] Invalid or non-matching id ${e}`);if(!this.sortComparer)throw new Error("[SlickGrid DataView] sortedUpdateItem() requires a sort comparer, use sort()");const i=this.getItemById(e);this.sortComparer(i,t)!==0?(this.deleteItem(e),this.sortedAddItem(t)):this.updateItem(e,t)}sortedIndex(e){let t=0,i=this.items.length;for(;t<i;){const s=t+i>>>1;this.sortComparer(this.items[s],e)===-1?t=s+1:i=s}return t}getItemCount(){return this.items.length}getLength(){return this.rows.length}getItem(e){var i;const t=this.rows[e];if(t!=null&&t.__group&&t.totals&&!((i=t.totals)!=null&&i.initialized)){const s=this.groupingInfos[t.level];s.displayTotalsRow||(this.calculateTotals(t.totals),t.title=s.formatter?s.formatter(t):t.value)}else t!=null&&t.__groupTotals&&!t.initialized&&this.calculateTotals(t);return t}getItemMetadata(e){const t=this.rows[e];return t===void 0?null:t.__group?this._options.groupItemMetadataProvider.getGroupRowMetadata(t):t.__groupTotals?this._options.groupItemMetadataProvider.getTotalsRowMetadata(t):null}expandCollapseAllGroups(e,t){if(ie(e))this.toggledGroupsByLevel[e]={},this.groupingInfos[e].collapsed=t,t===!0?this.onGroupCollapsed.notify({level:e,groupingKey:null}):this.onGroupExpanded.notify({level:e,groupingKey:null});else for(let i=0;i<this.groupingInfos.length;i++)this.toggledGroupsByLevel[i]={},this.groupingInfos[i].collapsed=t,t===!0?this.onGroupCollapsed.notify({level:i,groupingKey:null}):this.onGroupExpanded.notify({level:i,groupingKey:null});this.refresh()}collapseAllGroups(e){this.expandCollapseAllGroups(e,!0)}expandAllGroups(e){this.expandCollapseAllGroups(e,!1)}expandCollapseGroup(e,t,i){this.toggledGroupsByLevel[e]&&(this.toggledGroupsByLevel[e][t]=this.groupingInfos[e].collapsed^i),this.refresh()}collapseGroup(...e){const i=Array.prototype.slice.call(e)[0];let s,n;e.length===1&&i.indexOf(this.groupingDelimiter)!==-1?(s=i,n=i.split(this.groupingDelimiter).length-1):(s=e.join(this.groupingDelimiter),n=e.length-1),this.expandCollapseGroup(n,s,!0),this.onGroupCollapsed.notify({level:n,groupingKey:s})}expandGroup(...e){const i=Array.prototype.slice.call(e)[0];let s,n;e.length===1&&i.indexOf(this.groupingDelimiter)!==-1?(n=i.split(this.groupingDelimiter).length-1,s=i):(n=e.length-1,s=e.join(this.groupingDelimiter)),this.expandCollapseGroup(n,s,!1),this.onGroupExpanded.notify({level:n,groupingKey:s})}getGroups(){return this.groups}extractGroups(e,t){var d,c;let i,s;const n=[],o={};let l;const a=t?t.level+1:0,h=this.groupingInfos[a];for(let u=0,p=((d=h.predefinedValues)==null?void 0:d.length)??0;u<p;u++)s=(c=h.predefinedValues)==null?void 0:c[u],i=o[s],i||(i=new Ss,i.value=s,i.level=a,i.groupingKey=(t?t.groupingKey+this.groupingDelimiter:"")+s,n[n.length]=i,o[s]=i);for(let u=0,p=e.length;u<p;u++)l=e[u],s=h.getterIsAFn?h.getter(l):l[h.getter],i=o[s],i||(i=new Ss,i.value=s,i.level=a,i.groupingKey=(t?t.groupingKey+this.groupingDelimiter:"")+s,n[n.length]=i,o[s]=i),i.rows[i.count++]=l;if(a<this.groupingInfos.length-1)for(let u=0;u<n.length;u++)i=n[u],i.groups=this.extractGroups(i.rows,i);return n.length&&this.addTotals(n,a),n.sort(this.groupingInfos[a].comparer),n}calculateTotals(e){var l;const t=e.group,i=this.groupingInfos[(t==null?void 0:t.level)??0],s=t.level===this.groupingInfos.length;let n,o=i.aggregators.length;if(!s&&i.aggregateChildGroups){let a=((l=t.groups)==null?void 0:l.length)??0;for(;a--;)t.groups[a].totals.initialized||this.calculateTotals(t.groups[a].totals)}for(;o--;)n=i.aggregators[o],n.init(),!s&&i.aggregateChildGroups?i.compiledAccumulators[o].call(n,t.groups):i.compiledAccumulators[o].call(n,t.rows),n.storeResult(e);e.initialized=!0}addGroupTotals(e){const t=this.groupingInfos[e.level],i=new mc;i.group=e,e.totals=i,t.lazyTotalsCalculation||this.calculateTotals(i)}addTotals(e,t){var a,h;t=t||0;const i=this.groupingInfos[t],s=i.collapsed,n=this.toggledGroupsByLevel[t];let o=e.length,l;for(;o--;)l=e[o],!(l.collapsed&&!i.aggregateCollapsed)&&(l.groups&&this.addTotals(l.groups,t+1),(a=i.aggregators)!=null&&a.length&&(i.aggregateEmpty||l.rows.length||(h=l.groups)!=null&&h.length)&&this.addGroupTotals(l),l.collapsed=s^n[l.groupingKey],l.title=i.formatter?i.formatter(l):l.value)}flattenGroupedRows(e,t){t=t||0;const i=this.groupingInfos[t],s=[];let n,o=0,l;for(let a=0,h=e.length;a<h;a++){if(l=e[a],s[o++]=l,!l.collapsed){n=l.groups?this.flattenGroupedRows(l.groups,t+1):l.rows;for(let d=0,c=n.length;d<c;d++)s[o++]=n[d]}l.totals&&i.displayTotalsRow&&(!l.collapsed||i.aggregateCollapsed)&&(s[o++]=l.totals)}return s}compileAccumulatorLoopCSPSafe(e){return e.accumulate?function(t){let i;if(Array.isArray(t))for(let s=0;s<t.length;s++){const n=t[s];i=e.accumulate.call(e,n)}return i}:function(){}}compileFilterCSPSafe(e,t){if(typeof this.filterCSPSafe!="function")return[];const i=[],s=e.length;for(let n=0;n<s;n++)this.filterCSPSafe(e[n],t)&&i.push(e[n]);return i}compileFilter(e=!1){if(e)return null;const t=yn(this.filter),i="{ continue _coreloop; }$1",s="{ _retval[_idx++] = $item$; continue _coreloop; }$1",n=t.body.replace(/return false\s*([;}]|\}|$)/gi,i).replace(/return!1([;}]|\}|$)/gi,i).replace(/return true\s*([;}]|\}|$)/gi,s).replace(/return!0([;}]|\}|$)/gi,s).replace(/return ([^;}]+?)\s*([;}]|$)/gi,"{ if ($1) { _retval[_idx++] = $item$; }; continue _coreloop; }$2");let o=["var _retval = [], _idx = 0; ","var $item$, $args$ = _args; ","_coreloop: ","for (var _i = 0, _il = _items.length; _i < _il; _i++) { ","$item$ = _items[_i]; ","$filter$; ","} ","return _retval; "].join("");o=o.replace(/\$filter\$/gi,n),o=o.replace(/\$item\$/gi,t.params[0]),o=o.replace(/\$args\$/gi,t.params[1]);const l=new Function("_items,_args",o),a="compiledFilter";return l.displayName=a,l.name=this.setFunctionName(l,a),l}compileFilterWithCaching(e=!1){if(e)return null;const t=yn(this.filter),i="{ continue _coreloop; }$1",s="{ _cache[_i] = true;_retval[_idx++] = $item$; continue _coreloop; }$1",n=t.body.replace(/return false\s*([;}]|\}|$)/gi,i).replace(/return!1([;}]|\}|$)/gi,i).replace(/return true\s*([;}]|\}|$)/gi,s).replace(/return!0([;}]|\}|$)/gi,s).replace(/return ([^;}]+?)\s*([;}]|$)/gi,"{ if ((_cache[_i] = $1)) { _retval[_idx++] = $item$; }; continue _coreloop; }$2");let o=["var _retval = [], _idx = 0; ","var $item$, $args$ = _args; ","_coreloop: ","for (var _i = 0, _il = _items.length; _i < _il; _i++) { ","$item$ = _items[_i]; ","if (_cache[_i]) { ","_retval[_idx++] = $item$; ","continue _coreloop; ","} ","$filter$; ","} ","return _retval; "].join("");o=o.replace(/\$filter\$/gi,n),o=o.replace(/\$item\$/gi,t.params[0]),o=o.replace(/\$args\$/gi,t.params[1]);const l=new Function("_items,_args,_cache",o),a="compiledFilterWithCaching";return l.displayName=a,l.name=this.setFunctionName(l,a),l}compileFilterWithCachingCSPSafe(e,t,i){if(typeof this.filterCSPSafe!="function")return[];const s=[],n=e.length;for(let o=0;o<n;o++)(i[o]||this.filterCSPSafe(e[o],t))&&s.push(e[o]);return s}setFunctionName(e,t){try{Object.defineProperty(e,"name",{writable:!0,value:t})}catch{e.name=t}}uncompiledFilter(e,t){var n;const i=[];let s=0;for(let o=0,l=e.length;o<l;o++)(n=this.filter)!=null&&n.call(this,e[o],t)&&(i[s++]=e[o]);return i}uncompiledFilterWithCaching(e,t,i){var l;const s=[];let n=0,o;for(let a=0,h=e.length;a<h;a++)o=e[a],i[a]?s[n++]=o:(l=this.filter)!=null&&l.call(this,o,t)&&(s[n++]=o,i[a]=!0);return s}getFilteredAndPagedItems(e){if(this._options.useCSPSafeFilter?this.filterCSPSafe:this.filter){let i,s;this._options.useCSPSafeFilter?(i=this._options.inlineFilters?this.compiledFilterCSPSafe:this.uncompiledFilter,s=this._options.inlineFilters?this.compiledFilterWithCachingCSPSafe:this.uncompiledFilterWithCaching):(i=this._options.inlineFilters?this.compiledFilter:this.uncompiledFilter,s=this._options.inlineFilters?this.compiledFilterWithCaching:this.uncompiledFilterWithCaching),this.refreshHints.isFilterNarrowing?this.filteredItems=i.call(this,this.filteredItems,this.filterArgs):this.refreshHints.isFilterExpanding?this.filteredItems=s.call(this,e,this.filterArgs,this.filterCache):this.refreshHints.isFilterUnchanged||(this.filteredItems=i.call(this,e,this.filterArgs))}else this.filteredItems=this.pagesize?e:e.concat();let t;return this.pagesize?(this.filteredItems.length<=this.pagenum*this.pagesize&&(this.filteredItems.length===0?this.pagenum=0:this.pagenum=Math.floor((this.filteredItems.length-1)/this.pagesize)),t=this.filteredItems.slice(this.pagesize*this.pagenum,this.pagesize*this.pagenum+this.pagesize)):t=this.filteredItems,{totalRows:this.filteredItems.length,rows:t}}getRowDiffs(e,t){var h,d,c;let i,s,n;const o=[];let l=0,a=Math.max(t.length,e.length);(h=this.refreshHints)!=null&&h.ignoreDiffsBefore&&(l=Math.max(0,Math.min(t.length,this.refreshHints.ignoreDiffsBefore))),(d=this.refreshHints)!=null&&d.ignoreDiffsAfter&&(a=Math.min(t.length,Math.max(0,this.refreshHints.ignoreDiffsAfter)));for(let u=l,p=e.length;u<a;u++)u>=p?o[o.length]=u:(i=t[u],s=e[u],(!i||this.groupingInfos.length&&(n=i.__nonDataRow||s.__nonDataRow)&&i.__group!==s.__group||i.__group&&!i.equals(s)||n&&(i.__groupTotals||s.__groupTotals)||i[this.idProperty]!==s[this.idProperty]||(c=this.updated)!=null&&c[i[this.idProperty]])&&(o[o.length]=u));return o}recalc(e){this.rowsById=void 0,(this.refreshHints.isFilterNarrowing!==this.prevRefreshHints.isFilterNarrowing||this.refreshHints.isFilterExpanding!==this.prevRefreshHints.isFilterExpanding)&&(this.filterCache=[]);const t=this.getFilteredAndPagedItems(e);this.totalRows=t.totalRows;let i=t.rows;this.groups=[],this.groupingInfos.length&&(this.groups=this.extractGroups(i),this.groups.length&&(i=this.flattenGroupedRows(this.groups)));const s=this.getRowDiffs(this.rows,i);return this.rows=i,s}refresh(){if(this.suspend)return;const e=de(!0,{},this.getPagingInfo()),t=this.rows.length,i=this.totalRows;let s=this.recalc(this.items);this.pagesize&&this.totalRows<this.pagenum*this.pagesize&&(this.pagenum=Math.max(0,Math.ceil(this.totalRows/this.pagesize)-1),s=this.recalc(this.items)),this.updated=null,this.prevRefreshHints=this.refreshHints,this.refreshHints={},i!==this.totalRows&&this.onBeforePagingInfoChanged.notify(e,null,this).getReturnValue()!==!1&&this.onPagingInfoChanged.notify(this.getPagingInfo(),null,this),t!==this.rows.length&&this.onRowCountChanged.notify({previous:t,current:this.rows.length,itemCount:this.items.length,dataView:this,callingOnRowsChanged:s.length>0},null,this),s.length>0&&this.onRowsChanged.notify({rows:s,itemCount:this.items.length,dataView:this,calledOnRowCountChanged:t!==this.rows.length},null,this),(t!==this.rows.length||s.length>0)&&this.onRowsOrCountChanged.notify({rowsDiff:s,previousRowCount:t,currentRowCount:this.rows.length,itemCount:this.items.length,rowCountChanged:t!==this.rows.length,rowsChanged:s.length>0,dataView:this},null,this)}syncGridSelection(e,t,i){this._grid=e;let s;this.selectedRowIds=this.mapRowsToIds(e.getSelectedRows());const n=e.getOptions(),o=a=>{a===!1?this.selectedRowIds=[]:this.selectedRowIds.sort().join(",")!==a.sort().join(",")&&(this.selectedRowIds=a)},l=()=>{if((this.selectedRowIds||[]).length>0&&!s){s=!0;const a=this.mapIdsToRows(this.selectedRowIds||[]);if(!t){const h={grid:this._grid,ids:this.mapRowsToIds(a),rows:a,dataView:this};this.preSelectedRowIdsChangeFn(h),this.onSelectedRowIdsChanged.notify(Object.assign(h,{selectedRowIds:this.selectedRowIds,filteredIds:this.getAllSelectedFilteredIds()}),new le,this)}e.setSelectedRows(a),s=!1}};return e.onSelectedRowsChanged.subscribe((a,h)=>{if(!s){const d=this.mapRowsToIds(h.rows),c={grid:this._grid,ids:d,rows:h.rows,added:!0,dataView:this};this.preSelectedRowIdsChangeFn(c),this.onSelectedRowIdsChanged.notify(Object.assign(c,{selectedRowIds:this.selectedRowIds,filteredIds:this.getAllSelectedFilteredIds()}),new le,this)}}),this.preSelectedRowIdsChangeFn=a=>{var h,d;if(!s){if(s=!0,typeof a.added>"u")o(a.ids);else{let u;a.added?i&&n.multiSelect?u=((h=this.selectedRowIds)==null?void 0:h.filter(m=>this.getRowById(m)===void 0)).concat(a.ids):u=a.ids:i&&n.multiSelect?u=(d=this.selectedRowIds)==null?void 0:d.filter(p=>a.ids.indexOf(p)===-1):u=[],o(u)}s=!1}},this.onRowsOrCountChanged.subscribe(l.bind(this)),this.onSelectedRowIdsChanged}getAllSelectedIds(){return this.selectedRowIds}getAllSelectedFilteredIds(){return this.getAllSelectedFilteredItems().map(e=>e[this.idProperty])}setSelectedIds(e,t){var a;let i=t==null?void 0:t.isRowBeingAdded;const s=t==null?void 0:t.shouldTriggerEvent,n=t==null?void 0:t.applyRowSelectionToGrid;i!==!1&&(i=!0);const o=this.mapIdsToRows(e),l={grid:this._grid,ids:e,rows:o,added:i,dataView:this};(a=this.preSelectedRowIdsChangeFn)==null||a.call(this,l),s!==!1&&this.onSelectedRowIdsChanged.notify(Object.assign(l,{selectedRowIds:this.selectedRowIds,filteredIds:this.getAllSelectedFilteredIds()}),new le,this),n!==!1&&this._grid&&this._grid.setSelectedRows(o)}getAllSelectedItems(){const e=[];return this.getAllSelectedIds().forEach(i=>{e.push(this.getItemById(i))}),e}getAllSelectedFilteredItems(){return Array.isArray(this.selectedRowIds)?this.filteredItems.filter(t=>this.selectedRowIds.some(i=>t[this.idProperty]===i))||[]:[]}syncGridCellCssStyles(e,t){let i,s;const n=l=>{i={},typeof l=="object"&&Object.keys(l).forEach(a=>{if(l&&this.rows[a]){const h=this.rows[a][this.idProperty];i[h]=l[a]}})};n(e.getCellCssStyles(t));const o=()=>{if(typeof i=="object"){s=!0,this.ensureRowsByIdCache();const l={};Object.keys(i).forEach(a=>{var d;const h=(d=this.rowsById)==null?void 0:d[a];ie(h)&&(l[h]=i[a])}),e.setCellCssStyles(t,l),s=!1}};e.onCellCssStylesChanged.subscribe((l,a)=>{s||t!==a.key||(a.hash?n(a.hash):(e.onCellCssStylesChanged.unsubscribe(),this.onRowsOrCountChanged.unsubscribe(o)))}),this.onRowsOrCountChanged.subscribe(o.bind(this))}}/**!
3
3
  * Sortable 1.15.2
4
4
  * @author RubaXa <trash@rubaxa.org>
5
5
  * @author owenm <owen23355@gmail.com>
@@ -13,8 +13,8 @@
13
13
  [Slickgrid-Universal] Resizer Service requires a valid Grid object and DOM Element Container to be provided.
14
14
  You can fix this by setting your gridOption to use "enableAutoResize" or create an instance of the ResizerService by calling bindAutoResizeDataGrid() once.`);this._grid=e,this._gridContainerElm=t;const i=(s=this.gridOptions)!=null&&s.gridHeight||(n=this.gridOptions)!=null&&n.gridWidth?{height:(o=this.gridOptions)==null?void 0:o.gridHeight,width:(l=this.gridOptions)==null?void 0:l.gridWidth}:void 0;this._autoResizeOptions=((a=this.gridOptions)==null?void 0:a.autoResize)??{container:"grid1",bottomPadding:0},i!=null&&i.width&&(t!=null&&t.style)&&(t.style.width=typeof i.width=="string"?i.width:`${i.width}px`),this._gridDomElm=e.getContainerNode(),typeof this._autoResizeOptions.container=="string"?this._pageContainerElm=typeof this._autoResizeOptions.container=="string"?document.querySelector(this._autoResizeOptions.container):this._autoResizeOptions.container:this._pageContainerElm=this._autoResizeOptions.container,i&&(this._fixedHeight=i.height,this._fixedWidth=i.width),this.gridOptions.enableAutoResize&&this.bindAutoResizeDataGrid(),this.gridOptions.autoResize&&this._subscriptions.push(this.pubSubService.subscribe("onFullResizeByContentRequested",()=>this.resizeColumnsByCellContent(!0))),this.gridOptions.enableColumnResizeOnDoubleClick&&(this._subscriptions.push(this.pubSubService.subscribe("onHeaderMenuColumnResizeByContent",h=>{this.handleSingleColumnResizeByContent(h.columnId)})),this._eventHandler.subscribe(this._grid.onColumnsResizeDblClick,(h,d)=>{this.handleSingleColumnResizeByContent(d.triggeredByColumn)}))}bindAutoResizeDataGrid(e){var t;if(((t=this.gridOptions.autoResize)==null?void 0:t.resizeDetection)==="container"){if(!this._pageContainerElm||!this._pageContainerElm)throw new Error(`
15
15
  [Slickgrid-Universal] Resizer Service requires a container when gridOption.autoResize.resizeDetection="container"
16
- You can fix this by setting your gridOption.autoResize.container`);this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>this.resizeObserverCallback())),this._resizeObserver.observe(this._pageContainerElm)}else{if(this._gridDomElm===void 0||me(this._gridDomElm)===void 0)return null;this.resizeGrid().then(()=>this.resizeGridWhenStylingIsBrokenUntilCorrected()).catch(i=>console.log("Error:",i)),this.resizeGrid(10,e),this._bindingEventService.bind(window,"resize",this.handleResizeGrid.bind(this,e))}}handleResizeGrid(e){this.pubSubService.publish("onGridBeforeResize"),this._resizePaused||(this.resizeGrid(0,e),this.resizeGrid(0,e))}resizeObserverCallback(){this._resizePaused||this.resizeGrid()}calculateGridNewDimensions(e){var f,g;const t=(e==null?void 0:e.autoResize)??{},i=me(this._gridDomElm);if(!window||i===void 0)return null;let s=(t==null?void 0:t.bottomPadding)!==void 0?t.bottomPadding:bu;if(s&&e.enablePagination&&(s+=yu),s&&e.showCustomFooter){const _=((g=(f=this.gridOptions)==null?void 0:f.customFooterOptions)==null?void 0:g.footerHeight)??Su;s+=parseInt(`${_}`,10)}let n=0,o=0;t.calculateAvailableSizeBy==="container"?n=ds(this._pageContainerElm,"height")||0:(n=window.innerHeight||0,o=(i==null?void 0:i.top)??0);const l=n-o-s,a=ds(this._pageContainerElm,"width")||window.innerWidth||0,h=t==null?void 0:t.maxHeight,d=(t==null?void 0:t.minHeight)??Eu,c=t==null?void 0:t.maxWidth,u=(t==null?void 0:t.minWidth)??wu;let p=l,m=t!=null&&t.rightPadding?a-t.rightPadding:a;return p<d&&(p=d),h&&p>h&&(p=h),m<u&&(m=u),c&&m>c&&(m=c),{height:this._fixedHeight||p,width:this._fixedWidth||m}}getLastResizeDimensions(){return this._lastDimensions}pauseResizer(e){this._resizePaused=e}resizeGrid(e,t){return new Promise(i=>{e=e||0,e>0?(clearTimeout(this._timer),this._timer=setTimeout(()=>i(this.resizeGridCallback(t)),e)):i(this.resizeGridCallback(t))})}resizeGridCallback(e){var i,s;const t=this.resizeGridWithDimensions(e);return this.pubSubService.publish("onGridAfterResize",t),this.gridOptions.enableAutoResizeColumnsByCellContent&&(!((i=this._lastDimensions)!=null&&i.width)||(t==null?void 0:t.width)!==((s=this._lastDimensions)==null?void 0:s.width))&&this.resizeColumnsByCellContent(!1),this._lastDimensions=t,t}resizeGridWithDimensions(e){var i,s,n,o;const t=this.calculateGridNewDimensions(this.gridOptions);if((e||t)&&this._gridDomElm){const l=e!=null&&e.height?e.height:t==null?void 0:t.height,a=e!=null&&e.width?e.width:t==null?void 0:t.width;this.gridOptions.autoHeight||(this._gridDomElm.style.height=`${l}px`),this._gridDomElm.style.width=`${a}px`,this._gridContainerElm&&(this._gridContainerElm.style.width=`${a}px`),(i=this._grid)!=null&&i.resizeCanvas&&this._gridContainerElm&&this._grid.resizeCanvas(),this._grid&&((s=this.gridOptions)!=null&&s.enableAutoSizeColumns)?this.gridUid&&document.querySelector(this.gridUidSelector)&&(!this._lastDimensions||this._lastDimensions.height!==l||this._lastDimensions.width!==a)&&this._grid.autosizeColumns():this.gridOptions.enableAutoResizeColumnsByCellContent&&(!((n=this._lastDimensions)!=null&&n.width)||a!==((o=this._lastDimensions)==null?void 0:o.width))&&this.resizeColumnsByCellContent(!1),this._lastDimensions={height:l||0,width:a||0}}return this._lastDimensions}requestStopOfAutoFixResizeGrid(e=!0){this._isStopResizeIntervalRequested=e}resizeColumnsByCellContent(e=!1){var h,d;const t=this._grid.getColumns(),i=this.dataView.getItems(),s={};let n=!1,o=0;const l=((h=this._gridContainerElm)==null?void 0:h.offsetWidth)??0;if(!Array.isArray(i)||i.length===0||!e&&this._totalColumnsWidthByContent>0&&this._totalColumnsWidthByContent<l){this._grid.autosizeColumns();return}if(this._hasResizedByContentAtLeastOnce&&((d=this.gridOptions)!=null&&d.resizeByContentOnlyOnFirstLoad)&&!e)return;if(this.pubSubService.publish("onBeforeResizeByContent",void 0,0),this._totalColumnsWidthByContent===0||e){for(const u of t)s[u.id]=u.originalWidth??u.minWidth??0;o=this.calculateCellWidthByReadingDataset(t,s,this.resizeByContentOptions.maxItemToInspectCellContentWidth);let c=0;for(const u of t){const p=u.resizeAlwaysRecalculateWidth??this.resizeByContentOptions.alwaysRecalculateColumnWidth??!1;u.originalWidth&&!p?u.width=u.originalWidth:s[u.id]!==void 0&&(u.rerenderOnResize&&(n=!0),this.applyNewCalculatedColumnWidthByReference(u,s[u.id])),c+=u.width||0,this._totalColumnsWidthByContent=c}}this._grid.setColumns(t),this._hasResizedByContentAtLeastOnce=!0;const a={};for(const c of t)a[c.id]=c.width;this._totalColumnsWidthByContent>l?this._grid.reRenderColumns(n):this._grid.autosizeColumns(),this.pubSubService.publish("onAfterResizeByContent",{readItemCount:o,calculateColumnWidths:a})}calculateCellWidthByReadingDataset(e,t,i=1e3,s){const n=Array.isArray(e)?e:[e],o=this.dataView.getItems();let l=0;for(const[a,h]of o.entries()){if(a>i)break;Array.isArray(n)&&typeof t=="object"&&n.forEach((d,c)=>{const u=this.calculateCellWidthByContent(h,d,a,s??c,t[d.id]);u!==void 0&&(t[d.id]=u)}),l=a+1}return l}calculateCellWidthByContent(e,t,i,s,n){const o=this.resizeByContentOptions.cellCharWidthInPx??7;if(!t.originalWidth){const l=(t==null?void 0:t.resizeCharWidthInPx)??o,a=zs(t==null?void 0:t.formatter,i,s,t,e,this._grid),h=Zt(a)?we(a):"",d=Math.ceil(h.length*l),c=t.resizeMaxWidthThreshold;t&&(n===void 0||d>n)&&(n=c!==void 0&&d>c?c:t.maxWidth!==void 0&&d>t.maxWidth?t.maxWidth:d)}return n}applyNewCalculatedColumnWidthByReference(e,t){var a;const i=this.resizeByContentOptions.cellPaddingWidthInPx??6,s=this.resizeByContentOptions.formatterPaddingWidthInPx??6,n=((a=e==null?void 0:e.filter)==null?void 0:a.type)??(e==null?void 0:e.type)??S.string;let o=t;const l=(e==null?void 0:e.resizeCalcWidthRatio)??this.resizeByContentOptions.defaultRatioForStringType??.9;o*=n==="string"?l:1,o+=i,e.resizeExtraWidthPadding&&(o+=e.resizeExtraWidthPadding),e.editor&&this.gridOptions.editable&&(o+=s),e.maxWidth!==void 0&&o>e.maxWidth&&(o=e.maxWidth),e.resizeMaxWidthThreshold!==void 0&&o>e.resizeMaxWidthThreshold&&(o=e.resizeMaxWidthThreshold),o=Math.ceil(o),(e.originalWidth===void 0||e.resizeAlwaysRecalculateWidth===!0||this.resizeByContentOptions.alwaysRecalculateColumnWidth===!0)&&(e.width=this.readjustNewColumnWidthWhenOverLimit(e,o))}handleSingleColumnResizeByContent(e){const t=this._grid.getColumns(),i=t.findIndex(s=>s.id===e);if(i>=0){const s=t[i],n={[e]:s.originalWidth??s.minWidth??0};s.originalWidth=void 0,this.calculateCellWidthByReadingDataset(s,n,this.resizeByContentOptions.maxItemToInspectSingleColumnWidthByContent,i),this.applyNewCalculatedColumnWidthByReference(s,n[e]),this._grid.reRenderColumns((s==null?void 0:s.rerenderOnResize)??!1)}}readjustNewColumnWidthWhenOverLimit(e,t){var o,l;const i=this.gridOptions.frozenColumn??-1,s=this._grid.getColumns().findIndex(a=>a.id===e.id)??0;let n=t;if(i>=0&&s<=i){const a=Array.from(this._grid.getViewports());if(a){const h=((o=a.find(m=>m.classList.contains("slick-viewport-left")))==null?void 0:o.clientWidth)??0,d=((l=a.find(m=>m.classList.contains("slick-viewport-right")))==null?void 0:l.clientWidth)??0,c=h+d,u=h-(e.width??0);if(u+t>c){const m=this.resizeByContentOptions.widthToRemoveFromExceededWidthReadjustment??50;n=h-u+d-m}}}return Math.ceil(n)}checkIsGridShown(){var e;return!!(((e=document.querySelector(`${this.gridUidSelector}`))==null?void 0:e.offsetParent)??!1)}resizeGridWhenStylingIsBrokenUntilCorrected(){var l,a;const e=((l=this.gridOptions)==null?void 0:l.autoFixResizeTimeout)??18e3,t=((a=this.gridOptions)==null?void 0:a.autoFixResizeRequiredGoodCount)??5,i=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-header`),s=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-viewport`);let n=0,o=0;if(i&&s&&this.gridOptions.autoFixResizeWhenBrokenStyleDetected){const h=this.dataView.getItemCount(),d=this._grid.getColumns()||[];this._intervalId=setInterval(async()=>{var C,E,y;const u=me(i);let p=(u==null?void 0:u.top)??0;(C=this.gridOptions)!=null&&C.enableFiltering&&this.gridOptions.headerRowHeight&&(p+=this.gridOptions.headerRowHeight),(E=this.gridOptions)!=null&&E.createPreHeaderPanel&&this.gridOptions.showPreHeaderPanel&&this.gridOptions.preHeaderPanelHeight&&(p+=this.gridOptions.preHeaderPanelHeight),p+=44;const m=me(s),f=(m==null?void 0:m.top)??0,g=me(this._gridContainerElm);let _=(u==null?void 0:u.top)===0||p-f>2||(g==null?void 0:g.left)===0&&(g==null?void 0:g.top)===0;const b=((y=this._grid.getRenderedRange())==null?void 0:y.rightPx)??0;!_&&h>0&&b===0&&d.length>1&&(_=!0),this._isStopResizeIntervalRequested&&(_=!1,n=e),this.checkIsGridShown()&&(_||(g==null?void 0:g.left)===0||(g==null?void 0:g.top)===0)&&(await this.resizeGrid(),o<5&&this._grid.updateColumns(),this.checkIsGridShown()&&(_=!1)),this.checkIsGridShown()&&o++,this.checkIsGridShown()&&!_&&(o>=t||n++>=e)&&clearInterval(this._intervalId)},this.intervalRetryDelay)}}}class xu{constructor(){this._hasColumnsReordered=!1,this._hideHeaderRowAfterPageLoad=!1}get allColumns(){return this._allColumns}set allColumns(e){this._allColumns=e}get columnDefinitions(){var e;return((e=this._grid)==null?void 0:e.getColumns())??[]}get currentPagination(){return this._currentPagination}set currentPagination(e){this._currentPagination=e}get dataView(){return this._dataView}set dataView(e){this._dataView=e}get frozenVisibleColumnId(){return this._frozenVisibleColumnId}set frozenVisibleColumnId(e){this._frozenVisibleColumnId=e}get hasColumnsReordered(){return this._hasColumnsReordered}set hasColumnsReordered(e){this._hasColumnsReordered=e}get slickGrid(){return this._grid}set slickGrid(e){this._grid=e}get gridContainerElement(){return this._gridContainerElm}set gridContainerElement(e){this._gridContainerElm=e}get gridOptions(){var e;return this._gridOptions||((e=this._grid)==null?void 0:e.getOptions())||{}}set gridOptions(e){this._gridOptions=e}get groupItemMetadataProvider(){return this._groupItemMetadataProvider}set groupItemMetadataProvider(e){this._groupItemMetadataProvider=e}get hideHeaderRowAfterPageLoad(){return this._hideHeaderRowAfterPageLoad}set hideHeaderRowAfterPageLoad(e){this._hideHeaderRowAfterPageLoad=e}get externalRegisteredResources(){return this._externalRegisteredResources}set externalRegisteredResources(e){this._externalRegisteredResources=e}get visibleColumns(){return this._visibleColumns}set visibleColumns(e){this._visibleColumns=e}get hierarchicalDataset(){return this._hierarchicalDataset}set hierarchicalDataset(e){this._hierarchicalDataset=e}}class Iu{constructor(e,t,i,s){this.sharedService=e,this.pubSubService=t,this.backendUtilities=i,this.rxjs=s,this._currentLocalSorters=[],this._isBackendGrid=!1,this._eventHandler=new pe,this.rxjs&&(this.httpCancelRequests$=this.rxjs.createSubject())}get eventHandler(){return this._eventHandler}get _gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}get _columnDefinitions(){var e;return((e=this._grid)==null?void 0:e.getColumns())??[]}dispose(){var e,t;(e=this._eventHandler)!=null&&e.unsubscribeAll&&this._eventHandler.unsubscribeAll(),this.httpCancelRequests$&&((t=this.rxjs)!=null&&t.isObservable(this.httpCancelRequests$))&&(this.httpCancelRequests$.next(),this.httpCancelRequests$.complete())}addRxJsResource(e){this.rxjs=e}bindBackendOnSort(e){this._isBackendGrid=!0,this._grid=e,this._dataView=e==null?void 0:e.getData(),this._eventHandler.subscribe(e.onSort,this.onBackendSortChanged.bind(this))}bindLocalOnSort(e){this._isBackendGrid=!1,this._grid=e,this._dataView=e==null?void 0:e.getData(),this.processTreeDataInitialSort(),this._eventHandler.subscribe(e.onSort,this.handleLocalOnSort.bind(this))}handleLocalOnSort(e,t){var s;const i=t.multiColumnSort?t.sortCols:new Array({columnId:((s=t.sortCol)==null?void 0:s.id)??"",sortAsc:t.sortAsc,sortCol:t.sortCol});this._currentLocalSorters=[],Array.isArray(i)&&i.forEach(n=>{n.sortCol&&this._currentLocalSorters.push({columnId:n.sortCol.id,direction:n.sortAsc?dt.ASC:dt.DESC})}),this.onLocalSortChanged(this._grid,i),this.emitSortChanged(oe.local)}clearSortByColumnId(e,t){var n;const i=this.getCurrentColumnSorts(),s=this.getCurrentColumnSorts(`${t}`);if(Array.isArray(i)&&Array.isArray(s)&&i.length!==s.length){if(this._gridOptions.backendServiceApi)this.onBackendSortChanged(e,{multiColumnSort:!0,sortCols:s,grid:this._grid});else if(this._dataView)this.onLocalSortChanged(this._grid,s,!0,!0);else{const a=((n=this._gridOptions)==null?void 0:n.multiColumnSort)??!1?s:s[0];this._grid.onSort.notify(a)}const o=s.map(l=>{var a;return{columnId:((a=l==null?void 0:l.sortCol)==null?void 0:a.id)??"",sortAsc:l==null?void 0:l.sortAsc,sortCol:l==null?void 0:l.sortCol}});this._grid.setSortColumns(o)}Array.isArray(s)&&s.length===0&&this.sortLocalGridByDefaultSortFieldId()}clearSorting(e=!0){var t,i;if(this._grid&&this._gridOptions&&this._dataView){if(this._grid.setSortColumns([]),e)this._isBackendGrid?this.onBackendSortChanged(void 0,{grid:this._grid,multiColumnSort:!0,sortCols:[],clearSortTriggered:!0}):this._columnDefinitions&&Array.isArray(this._columnDefinitions)&&this._columnDefinitions.length>0&&this.sortLocalGridByDefaultSortFieldId();else if(this._isBackendGrid){const s=(i=(t=this._gridOptions)==null?void 0:t.backendServiceApi)==null?void 0:i.service;s!=null&&s.clearSorters&&s.clearSorters()}}this._currentLocalSorters=[],this.pubSubService.publish("onSortCleared",!0)}disableSortFunctionality(e=!0,t=!0){const s=!this._gridOptions.enableSorting;this._gridOptions.enableSorting=s;let n;e?(t&&this.clearSorting(),this._eventHandler.unsubscribeAll(),n=this.disableAllSortingCommands(!0)):(n=this.disableAllSortingCommands(!1),this._eventHandler.subscribe(this._grid.onSort,(o,l)=>this.handleLocalOnSort(o,l))),this._grid.setOptions({enableSorting:this._gridOptions.enableSorting},!1,!0),this.sharedService.gridOptions=this._gridOptions,this._grid.setColumns(n)}toggleSortFunctionality(e=!0){const t=this._gridOptions.enableSorting;this.disableSortFunctionality(t,e)}emitSortChanged(e,t){var i;if(e===oe.remote&&((i=this._gridOptions)!=null&&i.backendServiceApi)){let s=[];const n=this._gridOptions.backendServiceApi.service;n!=null&&n.getCurrentSorters&&(s=n.getCurrentSorters()),this.pubSubService.publish("onSortChanged",s)}else e===oe.local&&(t&&(this._currentLocalSorters=t),this.pubSubService.publish("onSortChanged",this.getCurrentLocalSorters()))}getCurrentLocalSorters(){return this._currentLocalSorters}getCurrentColumnSorts(e){if(this._grid){const t=this._grid.getSortColumns();if(Array.isArray(t))return t.reduce((s,n)=>(n&&(!e||n.columnId!==e)&&s.push({columnId:n.columnId||"",sortCol:this._columnDefinitions[this._grid.getColumnIndex(n.columnId||"")],sortAsc:n.sortAsc}),s),[])}return[]}loadGridSorters(e){this._currentLocalSorters=[];const t=[];return Array.isArray(e)&&((this._gridOptions.multiColumnSort?e:e.slice(0,1)).forEach(s=>{const n=this._columnDefinitions.find(o=>o.id===s.columnId);if(n){if(!n.sortable){let o="[Slickgrid-Universal] Cannot add sort icon to a column that is not sortable, please add `sortable: true` to your column or remove it from your list of columns to sort.";throw this._gridOptions.enableTreeData&&(o+=" Also note that TreeData feature requires the column holding the tree (expand/collapse icons) to be sortable."),new Error(o)}t.push({columnId:n.id,sortAsc:s.direction.toUpperCase()===dt.ASC,sortCol:n}),this._currentLocalSorters.push({columnId:String(n.id),direction:s.direction.toUpperCase()})}}),this.onLocalSortChanged(this._grid,t),this._grid.setSortColumns(t.map(s=>({columnId:s.columnId,sortAsc:s.sortAsc})))),t}processTreeDataInitialSort(){var e,t,i;if((e=this._gridOptions)!=null&&e.enableTreeData&&this._gridOptions.treeDataOptions){const s=this._gridOptions.treeDataOptions,n=this._columnDefinitions.find(o=>o.id===s.columnId);if(n){let o=dt.ASC,l={columnId:s.columnId,sortCol:n,sortAsc:!0};if((t=s==null?void 0:s.initialSort)!=null&&t.columnId){const a=s.initialSort.columnId,h=this._columnDefinitions.find(d=>d.id===a);o=(s.initialSort.direction||dt.ASC).toUpperCase(),l={columnId:a,sortCol:h,sortAsc:o===dt.ASC}}l!=null&&l.columnId&&((i=this.sharedService)!=null&&i.hierarchicalDataset)&&this.updateSorting([{columnId:l.columnId||"",direction:o}])}}}onBackendSortChanged(e,t){var a,h,d;if(!t||!t.grid)throw new Error('Something went wrong when trying to bind the "onBackendSortChanged(event, args)" function, it seems that "args" is not populated correctly');const i=((a=t.grid)==null?void 0:a.getOptions())??{},s=i.backendServiceApi;if(!s||!s.process||!s.service)throw new Error('BackendServiceApi requires at least a "process" function and a "service" defined');const n=new Date;s.preProcess&&s.preProcess();const o=s.service.processOnSortChanged(e,t),l=((h=i==null?void 0:i.pagination)==null?void 0:h.totalItems)||0;(d=this.backendUtilities)==null||d.executeBackendCallback(s,o,t,n,l,{emitActionChangedCallback:this.emitSortChanged.bind(this),errorCallback:()=>{var u,p,m;this._grid.setSortColumns(t.previousSortColumns||[]);const c=(u=t.previousSortColumns)==null?void 0:u.map(f=>({columnId:f.columnId,sortAsc:f.sortAsc,sortCol:this._columnDefinitions.find(g=>g.id===f.columnId)}));(m=(p=s==null?void 0:s.service)==null?void 0:p.updateSorters)==null||m.call(p,c||[])},httpCancelRequestSubject:this.httpCancelRequests$})}async onLocalSortChanged(e,t,i=!1,s=!1){var a,h;const n=((a=this._gridOptions)==null?void 0:a.datasetIdPropertyName)??"id",o=((h=this._gridOptions)==null?void 0:h.enableTreeData)??!1,l=e.getData();if(await this.pubSubService.publish("onBeforeSortChange",{sortColumns:t},0),e&&l){if(i&&!o&&l.reSort(),o&&this.sharedService&&Array.isArray(this.sharedService.hierarchicalDataset)){const d=this.sortHierarchicalDataset(this.sharedService.hierarchicalDataset,t);this._dataView.setItems(d.flat,n),this._dataView.onRowCountChanged.notify({previous:this._dataView.getFilteredItemCount(),current:this._dataView.getLength(),itemCount:this._dataView.getItemCount(),dataView:this._dataView,callingOnRowsChanged:!0})}else l.sort(this.sortComparers.bind(this,t));e.invalidate(),s&&this.emitSortChanged(oe.local,t.map(d=>{var c;return{columnId:((c=d.sortCol)==null?void 0:c.id)??"id",direction:d.sortAsc?dt.ASC:dt.DESC}}))}}sortHierarchicalDataset(e,t,i=!1){var a,h,d;this.sortTreeData(e,t);const s=((a=this._gridOptions)==null?void 0:a.datasetIdPropertyName)??"id",n=((h=this._gridOptions)==null?void 0:h.treeDataOptions)??{columnId:""},o={...n,identifierPropName:n.identifierPropName??s,shouldAddTreeLevelNumber:!0},l=to(e,o);if(i){this._currentLocalSorters=[],t.forEach(u=>{this._currentLocalSorters.push({columnId:u.columnId,direction:u.sortAsc?"ASC":"DESC"})});const c=(d=this._gridOptions)!=null&&d.backendServiceApi?oe.remote:oe.local;this.emitSortChanged(c)}return{hierarchical:e,flat:l}}sortLocalGridByDefaultSortFieldId(){const e=this._gridOptions&&this._gridOptions.defaultColumnSortFieldId||this._gridOptions.datasetIdPropertyName||"id",t={id:e,field:e};this.onLocalSortChanged(this._grid,new Array({columnId:t.id,sortAsc:!0,sortCol:t,clearSortTriggered:!0}),!1,!0)}sortComparers(e,t,i){if(Array.isArray(e))for(const s of e){const n=this.sortComparer(s,t,i);if(n!==void 0)return n}return ae.neutral}sortComparer(e,t,i,s){if(e!=null&&e.sortCol){const n=e.sortCol,o=e.sortAsc?ae.asc:ae.desc;let l=s||n.queryFieldSorter||n.queryField||n.field,a=l;const h=n.type||S.string;typeof n.queryFieldNameGetterFn=="function"&&(l=n.queryFieldNameGetterFn(t),a=n.queryFieldNameGetterFn(i));let d=t[l],c=i[a];if((l==null?void 0:l.indexOf("."))>=0&&(d=Ee(t,l)),(a==null?void 0:a.indexOf("."))>=0&&(c=Ee(i,a)),n.sortComparer){const u=n.sortComparer(d,c,o,n,this._gridOptions);if(u!==ae.neutral)return u}else{const u=mi(h,d,c,o,n,this._gridOptions);if(u!==ae.neutral)return u}}}sortTreeData(e,t){Array.isArray(t)&&t.forEach(i=>{this.sortTreeChildren(e,i,0)})}sortTreeChildren(e,t,i){var o;const s=(o=this._gridOptions)==null?void 0:o.treeDataOptions,n=(s==null?void 0:s.childrenPropName)??"children";e.sort((l,a)=>this.sortComparer(t,l,a)??ae.neutral),e.forEach(l=>{l&&l.hasOwnProperty(n)&&Array.isArray(l[n])&&(i++,this.sortTreeChildren(l[n],t,i),i--)})}updateSorting(e,t=!0,i=!0){var s,n;if(!this._gridOptions||!this._gridOptions.enableSorting)throw new Error('[Slickgrid-Universal] in order to use "updateSorting" method, you need to have Sortable Columns defined in your grid and "enableSorting" set in your Grid Options');if(Array.isArray(e)){const o=(s=this._gridOptions)==null?void 0:s.backendServiceApi;if(o){const l=o==null?void 0:o.service;l!=null&&l.updateSorters&&(l.updateSorters(void 0,e),i&&((n=this.backendUtilities)==null||n.refreshBackendDataset(this._gridOptions)))}else this.loadGridSorters(e);if(t){const l=o?oe.remote:oe.local;this.emitSortChanged(l)}}}disableAllSortingCommands(e=!0){var s,n;const t=this._grid.getColumns();t.forEach(o=>{var l,a;o.sortable!==void 0&&(o.sortable=!e),(l=o==null?void 0:o.header)!=null&&l.menu&&((a=o.header.menu.commandItems)==null||a.forEach(h=>{if(h&&typeof h!="string"){const d=h.command;(d==="sort-asc"||d==="sort-desc"||d==="clear-sort")&&(h.hidden=e)}}))});const i=(n=(s=this._gridOptions)==null?void 0:s.gridMenu)==null?void 0:n.commandItems;return i&&i.forEach(o=>{o&&typeof o!="string"&&o.command==="clear-sorting"&&(o.hidden=e)}),t}}class Ru{constructor(e,t,i){this.pubSubService=e,this.sharedService=t,this.sortService=i,this._currentToggledItems=[],this._isLastFullToggleCollapsed=!1,this._isOneCpuCyclePassed=!1,this._isTreeDataEnabled=!1,this._subscriptions=[],this._treeDataRecalcHandler=null,this._eventHandler=new pe,setTimeout(()=>this._isOneCpuCyclePassed=!0)}set currentToggledItems(e){this._currentToggledItems=e}get dataset(){var e;return(e=this.dataView)==null?void 0:e.getItems()}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}get dataView(){var e;return(e=this._grid)==null?void 0:e.getData()}get eventHandler(){return this._eventHandler}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}get treeDataOptions(){return this.gridOptions.treeDataOptions}dispose(){this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions)}init(e){var t,i,s,n,o,l,a,h;if(this._grid=e,this._isTreeDataEnabled=((t=this.gridOptions)==null?void 0:t.enableTreeData)??!1,this._isLastFullToggleCollapsed=((i=this.treeDataOptions)==null?void 0:i.initiallyCollapsed)??!1,this._currentToggledItems=((n=(s=this.gridOptions.presets)==null?void 0:s.treeData)==null?void 0:n.toggledItems)??[],this._lastToggleStateChange={type:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this._isTreeDataEnabled){if((o=this.gridOptions)!=null&&o.multiColumnSort)throw new Error('[Slickgrid-Universal] It looks like you are trying to use Tree Data with multi-column sorting, unfortunately it is not supported because of its complexity, you can disable it via "multiColumnSort: false" grid option and/or help in providing support for this feature.');if(!((l=this.gridOptions)!=null&&l.enableFiltering))throw new Error('[Slickgrid-Universal] It looks like you are trying to use Tree Data without using the filtering option, unfortunately that is not possible with Tree Data since it relies heavily on the filters to expand/collapse the tree. You need to enable it via "enableFiltering: true"');if((a=this.gridOptions)!=null&&a.backendServiceApi||(h=this.gridOptions)!=null&&h.enablePagination)throw new Error("[Slickgrid-Universal] It looks like you are trying to use Tree Data with Pagination and/or a Backend Service (OData, GraphQL) but unfortunately that is simply not supported because of its complexity.");if(!this.gridOptions.treeDataOptions||!this.gridOptions.treeDataOptions.columnId)throw new Error('[Slickgrid-Universal] When enabling tree data, you must also provide the "treeDataOption" property in your Grid Options with "childrenPropName" or "parentPropName" (depending if your array is hierarchical or flat) for the Tree Data to work properly.')}this._eventHandler.subscribe(e.onClick,this.handleOnCellClick.bind(this)),this._subscriptions.push(this.pubSubService.subscribe("onGridMenuClearAllSorting",this.clearSorting.bind(this))),this._treeDataRecalcHandler=this.setAutoRecalcTotalsCallbackWhenFeatEnabled(this.gridOptions),this._eventHandler.subscribe(this.dataView.onRowCountChanged,()=>{var d;typeof this._treeDataRecalcHandler=="function"&&this._isOneCpuCyclePassed&&(clearTimeout(this._timer),this._timer=setTimeout(()=>{var c;return(c=this._treeDataRecalcHandler)==null?void 0:c.call(this)},((d=this.treeDataOptions)==null?void 0:d.autoRecalcTotalsDebounce)??0))})}applyToggledItemStateChanges(e,t,i=!0,s=!1){if(Array.isArray(e)){const n=this.getTreeDataOptionPropName("collapsedPropName"),o=this.getTreeDataOptionPropName("hasChildrenPropName");this.dataView.beginUpdate(!0);const a=(t??this._lastToggleStateChange.previousFullToggleType)==="full-collapse";t&&(this._lastToggleStateChange.previousFullToggleType=t),i&&(this.dataView.getItems()||[]).forEach(h=>{h[o]&&(h[n]=a)}),this.dynamicallyToggleItemState(e,s)}}dynamicallyToggleItemState(e,t=!0){Array.isArray(e)&&(this.dataView.beginUpdate(!0),e.forEach(i=>{const s=this.dataView.getItemById(i.itemId);if(this.updateToggledItem(s,i.isCollapsed),t){const n=this._currentToggledItems.findIndex(o=>o.itemId===i.itemId);n>=0?this._currentToggledItems[n].isCollapsed=i.isCollapsed:this._currentToggledItems.push({itemId:i.itemId,isCollapsed:i.isCollapsed}),this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:i.itemId,toggledItems:this._currentToggledItems,type:i.isCollapsed?Tt.toggleCollapse:Tt.toggleExpand})}}),this.dataView.endUpdate(),this.dataView.refresh())}getCurrentToggleState(){return this._lastToggleStateChange}getInitialSort(e,t){var o;const i=t==null?void 0:t.treeDataOptions,s=(i==null?void 0:i.initialSort)??{columnId:(i==null?void 0:i.columnId)??"",direction:"ASC"},n=e.find(l=>l.id===s.columnId);return{columnId:s.columnId,sortAsc:((o=s==null?void 0:s.direction)==null?void 0:o.toUpperCase())!=="DESC",sortCol:n}}getItemCount(e){if(e!==void 0){const t=this.getTreeDataOptionPropName("levelPropName");return this.dataView.getItems().filter(i=>i[t]===e).length}return this.dataView.getItemCount()}getToggledItems(){return this._currentToggledItems}getTreeDataOptionPropName(e){var i,s,n,o,l,a,h;let t="";switch(e){case"childrenPropName":t=((i=this.treeDataOptions)==null?void 0:i.childrenPropName)??R.treeDataProperties.CHILDREN_PROP;break;case"collapsedPropName":t=((s=this.treeDataOptions)==null?void 0:s.collapsedPropName)??R.treeDataProperties.COLLAPSED_PROP;break;case"hasChildrenPropName":t=((n=this.treeDataOptions)==null?void 0:n.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP;break;case"identifierPropName":t=((o=this.treeDataOptions)==null?void 0:o.identifierPropName)??((l=this.gridOptions)==null?void 0:l.datasetIdPropertyName)??"id";break;case"levelPropName":t=((a=this.treeDataOptions)==null?void 0:a.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;break;case"parentPropName":t=((h=this.treeDataOptions)==null?void 0:h.parentPropName)??R.treeDataProperties.PARENT_PROP;break}return t}clearSorting(){const e=this.getInitialSort(this.sharedService.columnDefinitions,this.sharedService.gridOptions);this.sortService.loadGridSorters([{columnId:e.columnId,direction:e.sortAsc?"ASC":"DESC"}])}convertFlatParentChildToTreeDatasetAndSort(e,t,i,s){var a;const n=this.convertFlatParentChildToTreeDataset(e,i),o=Array.isArray(s)&&s.length?s[0]:this.getInitialSort(t,i),l=this.sortService.sortHierarchicalDataset(n,[o],!0);return(a=this._grid)==null||a.setSortColumns([o]),l}convertFlatParentChildToTreeDataset(e,t){const i=(t==null?void 0:t.datasetIdPropertyName)??"id",s=(t==null?void 0:t.treeDataOptions)??{columnId:"id"},n={...s,identifierPropName:s.identifierPropName??i,initiallyCollapsed:this._isLastFullToggleCollapsed};return io(e,n)}enableAutoRecalcTotalsFeature(e=!0){e&&this._isTreeDataEnabled?this._treeDataRecalcHandler=this.recalculateTreeTotals.bind(this,this.gridOptions):this._treeDataRecalcHandler=null}recalculateTreeTotals(e){const t=e.treeDataOptions,i=(t==null?void 0:t.childrenPropName)??R.treeDataProperties.CHILDREN_PROP,s=(t==null?void 0:t.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;t!=null&&t.aggregators&&(t.aggregators.forEach(n=>{Fi(this.sharedService.hierarchicalDataset||[],{childrenPropName:i,levelPropName:s,aggregator:n})}),this._grid.invalidate())}sortHierarchicalDataset(e,t){const i=t??this.getInitialSort(this.sharedService.allColumns,this.gridOptions),s=Array.isArray(i)?i:[i];return this.sortService.sortHierarchicalDataset(e,s)}async toggleTreeDataCollapse(e,t=!0){var s;if((s=this.gridOptions)!=null&&s.enableTreeData){const n=this.getTreeDataOptionPropName("hasChildrenPropName");t&&await this.pubSubService.publish("onTreeFullToggleStart",{collapsing:e}),this.dataView.beginUpdate(!0),(this.dataView.getItems()||[]).forEach(o=>{o[n]&&this.updateToggledItem(o,e)}),this.dataView.endUpdate(),this.dataView.refresh(),this._isLastFullToggleCollapsed=e}const i=e?Tt.fullCollapse:Tt.fullExpand;this._lastToggleStateChange={type:i,previousFullToggleType:i,toggledItems:null},t&&this.pubSubService.publish("onTreeFullToggleEnd",this._lastToggleStateChange)}handleOnCellClick(e,t){if(e&&t){const i=e.target||{},s=this.gridOptions.datasetIdPropertyName??"id",n=this.getTreeDataOptionPropName("collapsedPropName"),o=this.getTreeDataOptionPropName("childrenPropName");if(typeof(i==null?void 0:i.className)=="string"&&(i.className.indexOf("toggle")>=0||!1)){const a=this.dataView.getItem(t.row);if(a){a[n]=!a[n];const h=a[n],d=a[s],c=this._currentToggledItems.findIndex(m=>m.itemId===d);c>=0?this._currentToggledItems[c].isCollapsed=h:this._currentToggledItems.push({itemId:d,isCollapsed:h}),this.dataView.updateItem(d,a);const u=m=>m[s]===d,p=Di(this.sharedService.hierarchicalDataset||[],u,o);p&&(p[n]=h),this._grid.invalidate(),this._lastToggleStateChange={type:h?Tt.toggleCollapse:Tt.toggleExpand,previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:d})}e.stopImmediatePropagation()}}}updateToggledItem(e,t){var o;const i=((o=this.gridOptions)==null?void 0:o.datasetIdPropertyName)??"id",s=this.getTreeDataOptionPropName("childrenPropName"),n=this.getTreeDataOptionPropName("collapsedPropName");if(e){e[n]=t,this.dataView.updateItem(e[i],e);const l=h=>h[i]===e[i],a=Di(this.sharedService.hierarchicalDataset||[],l,s);a&&(a[n]=t)}}setAutoRecalcTotalsCallbackWhenFeatEnabled(e){var t,i;return e!=null&&e.enableTreeData&&((t=e==null?void 0:e.treeDataOptions)!=null&&t.autoRecalcTotalsOnFilterChange)&&((i=e==null?void 0:e.treeDataOptions)!=null&&i.aggregators)?this.recalculateTreeTotals.bind(this,e):null}}class Ut{constructor(e){this.translaterService=e,this._debounceTypingDelay=0,this._shouldTriggerQuery=!0,this._inputType="text",this.inputFilterType="single",this.searchTerms=[],this._bindEventService=new Ae}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get defaultOperator(){return H.empty}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}init(e){var s,n,o;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.inputFilterType==="compound"&&(this.operator=e.operator||""),this.searchTerms=(e==null?void 0:e.searchTerms)??[],this._cellContainerElm=e.filterContainerElm;const t=(s=this.gridOptions)==null?void 0:s.backendServiceApi;this._debounceTypingDelay=(t?(t==null?void 0:t.filterTypingDebounce)??((n=this.gridOptions)==null?void 0:n.defaultBackendServiceFilterTypingDebounce):(o=this.gridOptions)==null?void 0:o.filterTypingDebounce)??0;const i=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this.createDomFilterElement(i),this._bindEventService.bind(this._filterInputElm,["keyup","blur","change"],this.onTriggerEvent.bind(this)),this._bindEventService.bind(this._filterInputElm,"wheel",this.onTriggerEvent.bind(this),{passive:!0}),this.inputFilterType==="compound"&&this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this))}clear(e=!0){this._filterInputElm&&(this._shouldTriggerQuery=e,this.searchTerms=[],this._filterInputElm.value="",this._currentValue=void 0,this.updateFilterStyle(!1),this.inputFilterType==="compound"&&this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.onTriggerEvent(void 0,!0))}destroy(){var e,t,i,s;this._bindEventService.unbindAll(),(t=(e=this._selectOperatorElm)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._filterInputElm)==null?void 0:i.remove)==null||s.call(i)}getValues(){return this._filterInputElm.value}setValues(e,t,i=!1){const s=Array.isArray(e)?e:[e];let n="";for(const o of s)this.inputFilterType==="single"?n=t?this.addOptionalOperatorIntoSearchString(o,t):o:n=`${o}`,this._filterInputElm.value=`${n??""}`,this._currentValue=this._filterInputElm.value;if(this.updateFilterStyle(this.getValues()!==""),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const o=di(this.operator);this._selectOperatorElm.value=o}i&&this.onTriggerEvent(void 0,!1)}addOptionalOperatorIntoSearchString(e,t){let i="",s="",n=e==null?"":`${e}`;if(t&&n){switch(t){case"<>":case"!=":case"=":case"==":case">":case">=":case"<":case"<=":i=t;break;case"EndsWith":case"*z":i="*";break;case"StartsWith":case"a*":s="*";break}n=`${i}${n}${s}`}return n}getCompoundOperatorOptionValues(){var s;const e=this.columnDef.type&&this.columnDef.type?this.columnDef.type:S.string;let t,i="text";if((s=this.columnFilter)!=null&&s.compoundOperatorList)t=this.columnFilter.compoundOperatorList;else switch(e){case S.string:case S.text:case S.readonly:case S.password:i="text",t=qh(this.gridOptions,this.translaterService);break;default:i="numeric",t=Dn(this.gridOptions,this.translaterService);break}return Mn(this.gridOptions,t,i),t}createDomFilterElement(e){var n,o,l,a;const t=((n=this.columnDef)==null?void 0:n.id)??"";J(this._cellContainerElm);let i=((o=this.gridOptions)==null?void 0:o.defaultFilterPlaceholder)??"";(l=this.columnFilter)!=null&&l.placeholder&&(i=this.columnFilter.placeholder);const s=`${e??""}`;if(this._filterInputElm=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",placeholder:i,ariaLabel:((a=this.columnFilter)==null?void 0:a.ariaLabel)??`${_t(t+"")} Search Filter`,className:`form-control filter-${t}`,value:s,dataset:{columnid:`${t}`}}),this.updateFilterStyle(!!e),e!==void 0&&(this._currentValue=s),this.inputFilterType==="single")this._filterContainerElm=this._filterInputElm,this._filterInputElm.classList.add("search-filter"),this._cellContainerElm.appendChild(this._filterInputElm),this._cellContainerElm.appendChild(document.createElement("span"));else{this._filterInputElm.classList.add("compound-input"),this._selectOperatorElm=Fn(this.getCompoundOperatorOptionValues(),this.grid),this._filterContainerElm=v("div",{className:`form-group search-filter filter-${t}`});const h=v("div",{className:"input-group"},this._filterContainerElm);v("div",{className:"input-group-addon input-group-prepend operator"},h).appendChild(this._selectOperatorElm),h.appendChild(this._filterInputElm),h.appendChild(v("span")),this.operator&&(this._selectOperatorElm.value=di(this.operator)),this._filterContainerElm&&this._cellContainerElm.appendChild(this._filterContainerElm)}}onTriggerEvent(e,t=!1){var i,s;if(t)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else{const n=(e==null?void 0:e.type)??"",o=((i=this._selectOperatorElm)==null?void 0:i.value)??this.operator;let l=this._filterInputElm.value;const a=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof l=="string"&&a&&(l=l.trim()),((s=e==null?void 0:e.target)==null?void 0:s.tagName.toLowerCase())!=="select"&&(this._currentValue=l),this.updateFilterStyle(l!=="");const h={columnDef:this.columnDef,operator:o,searchTerms:l?[l]:null,shouldTriggerQuery:this._shouldTriggerQuery},d=n==="keyup"&&(e==null?void 0:e.key)!=="Enter"?this._debounceTypingDelay:0,c=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,u=c&&ie(this._currentValue)||this._currentValue===""&&ie(this._lastSearchValue);(this.inputFilterType==="single"||!c||u)&&(d>0?(clearTimeout(this._timer),this._timer=setTimeout(()=>this.callback(e,h),d)):this.callback(e,h)),this._lastSearchValue=l}this._shouldTriggerQuery=!0}updateFilterStyle(e){var t,i;e?((t=this._filterContainerElm)==null||t.classList.add("filled"),this._filterInputElm.classList.add("filled")):((i=this._filterContainerElm)==null||i.classList.remove("filled"),this._filterInputElm.classList.remove("filled"))}}class ba extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="text",this.inputFilterType="compound"}}class Au extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number",this.inputFilterType="compound"}}class Pu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password",this.inputFilterType="compound"}}const vr="#86bff8",Us=0,ku=20;class br{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._sliderTrackFilledColor=vr,this.sliderType="double",this.searchTerms=[],this._bindEventService=new Ae}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get currentValue(){return this._currentValue}get currentValues(){return this._currentValues}get defaultOperator(){return this.sliderType==="compound"?H.empty:this.sliderType==="single"?H.greaterThanOrEqual:this.gridOptions.defaultFilterRangeOperator||H.rangeInclusive}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.slider,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get sliderOptions(){return this._sliderOptions}get operator(){return this._operator||(this.columnFilter.operator??this.defaultOperator)}set operator(e){this._operator=e}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.operator=e.operator||"",this.searchTerms=(e==null?void 0:e.searchTerms)??[],this._argFilterContainerElm=e.filterContainerElm,this._sliderTrackFilledColor=window.getComputedStyle(document.documentElement).getPropertyValue("--slick-slider-filter-filled-track-color")||vr,this._filterElm=this.createDomFilterElement(this.searchTerms)}clear(e=!0){var t,i,s,n,o,l,a;if(this._filterElm){this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[];const h=+(((t=this.filterOptions)==null?void 0:t.sliderStartValue)??R.SLIDER_DEFAULT_MIN_VALUE),d=+(((i=this.filterOptions)==null?void 0:i.sliderEndValue)??R.SLIDER_DEFAULT_MAX_VALUE);this.sliderType==="double"?(this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=`${h}`),this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${d}`),this._currentValues=[h,d],(s=this._sliderLeftInputElm)==null||s.dispatchEvent(new Event("change")),(n=this._sliderRightInputElm)==null||n.dispatchEvent(new Event("change"))):(this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${h}`),this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this._currentValue=h,(o=this._sliderRightInputElm)==null||o.dispatchEvent(new Event("change"))),(((l=this.filterOptions)==null?void 0:l.hideSliderNumber)??((a=this.filterOptions)==null?void 0:a.hideSliderNumbers))||(this.sliderType==="double"?this.renderSliderValues(h,d):this.renderSliderValues(void 0,h)),this.updateFilterStyle(!1),this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:e,searchTerms:[]})}}destroy(){var e,t,i;this._bindEventService.unbindAll(),(e=this._sliderTrackElm)==null||e.remove(),(t=this._sliderLeftInputElm)==null||t.remove(),(i=this._sliderRightInputElm)==null||i.remove()}renderSliderValues(e,t){var i,s;(i=this._leftSliderNumberElm)!=null&&i.textContent&&e&&(this._leftSliderNumberElm.textContent=e.toString()),(s=this._rightSliderNumberElm)!=null&&s.textContent&&t&&(this._rightSliderNumberElm.textContent=t.toString())}getValues(){return this.sliderType==="double"?this._currentValues:this._currentValue}setValues(e,t,i=!1){var o;if(e){let l=[];const a=Array.isArray(e)?e==null?void 0:e[0]:e;if(Array.isArray(e)&&e.length===2?l=e:typeof a=="string"&&a.indexOf("..")>0?(l=a.split(".."),this._currentValue=+((l==null?void 0:l[0])??0)):(ie(a)||a==="")&&(this._currentValue=a===null?void 0:+a,l=[a]),this.sliderType!=="double"&&this._sliderRightInputElm)this._sliderRightInputElm.value=typeof e=="string"?e:`${a}`,this.renderSliderValues(void 0,this._sliderRightInputElm.value);else if(Array.isArray(l)&&l.length===2&&!((o=this.filterOptions)!=null&&o.hideSliderNumbers)){const[h,d]=l;this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=String(h??R.SLIDER_DEFAULT_MIN_VALUE)),this._sliderRightInputElm&&(this._sliderRightInputElm.value=String(d??R.SLIDER_DEFAULT_MAX_VALUE)),this.renderSliderValues(...l)}}else this._currentValue=void 0,this._currentValues=void 0;const s=this.getValues(),n=s===void 0?[]:Array.isArray(s)?s:[s];if(this.updateFilterStyle(n.length>0),t!==void 0&&(this.operator=t),this.operator&&this._selectOperatorElm){const l=di(this.operator);this._selectOperatorElm.value=l}i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:n,shouldTriggerQuery:!0})}createDomFilterElement(e){var c,u,p,m,f;const t=((c=this.columnDef)==null?void 0:c.id)??"",i=+(this.columnFilter.minValue??R.SLIDER_DEFAULT_MIN_VALUE),s=+(this.columnFilter.maxValue??R.SLIDER_DEFAULT_MAX_VALUE),n=+(this.columnFilter.valueStep??R.SLIDER_DEFAULT_STEP);J(this._argFilterContainerElm);const o=+((Array.isArray(e)&&(e==null?void 0:e[0]))??((u=this.filterOptions)==null?void 0:u.sliderStartValue)??i),l=+((Array.isArray(e)&&(e==null?void 0:e[1]))??((p=this.filterOptions)==null?void 0:p.sliderEndValue)??s);if(this._sliderRangeContainElm=v("div",{className:`filter-input filter-${t} slider-input-container slider-values`,title:this.sliderType==="double"?`${o} - ${l}`:`${o}`}),this._sliderTrackElm=v("div",{className:"slider-track"}),this.sliderType==="compound"){const g=v("span",{className:"input-group-addon input-group-prepend operator"});this._selectOperatorElm=Fn(this.getOperatorOptionValues(),this.grid),g.appendChild(this._selectOperatorElm)}this.sliderType==="double"&&(this._sliderLeftInputElm=v("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${_t(t+"")} Search Filter`,defaultValue:`${o}`,value:`${o}`,min:`${i}`,max:`${s}`,step:`${n}`}));const a=this.sliderType==="double"?l:o;this._sliderRightInputElm=v("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${_t(t+"")} Search Filter`,defaultValue:`${a}`,value:`${a}`,min:`${i}`,max:`${s}`,step:`${n}`});const h=((m=this.filterOptions)==null?void 0:m.hideSliderNumber)??((f=this.filterOptions)==null?void 0:f.hideSliderNumbers),d=h?"":"input-group";if(this._divContainerFilterElm=v("div",{className:`${d} search-filter slider-container slider-values filter-${t}`.trim()}),this._sliderRangeContainElm.appendChild(this._sliderTrackElm),this.sliderType==="double"&&this._sliderLeftInputElm&&this._sliderRangeContainElm.appendChild(this._sliderLeftInputElm),this._sliderRangeContainElm.appendChild(this._sliderRightInputElm),h)this._divContainerFilterElm.appendChild(this._sliderRangeContainElm);else{let g;this.sliderType==="compound"&&this._selectOperatorElm?(g=v("span",{className:"input-group-addon input-group-prepend operator"}),g.appendChild(this._selectOperatorElm)):this.sliderType==="double"&&(g=v("div",{className:"input-group-addon input-group-prepend slider-range-value"}),this._leftSliderNumberElm=v("span",{className:`input-group-text lowest-range-${t}`,textContent:`${o}`}),g.appendChild(this._leftSliderNumberElm));const _=v("div",{className:"input-group-addon input-group-append slider-range-value"});this._rightSliderNumberElm=v("span",{className:`input-group-text highest-range-${t}`,textContent:`${a}`},_),g&&this._divContainerFilterElm.appendChild(g),this._divContainerFilterElm.appendChild(this._sliderRangeContainElm),this._divContainerFilterElm.appendChild(_)}return this._sliderOptions={minValue:i,maxValue:s,step:n},this._currentValues=[o,l],Array.isArray(e)&&e.length>0&&e[0]!==""&&(this.updateFilterStyle(!0),this._currentValue=o),(this.filterOptions.sliderStartValue!==void 0||this.columnFilter.minValue!==void 0)&&(this._currentValue=o),this._argFilterContainerElm.appendChild(this._divContainerFilterElm),this.updateTrackFilledColorWhenEnabled(),this._bindEventService.bind(this._sliderTrackElm,"click",this.sliderTrackClicked.bind(this)),this._bindEventService.bind(this._sliderRightInputElm,["input","change"],this.slideRightInputChanged.bind(this)),this._bindEventService.bind(this._sliderRightInputElm,["change","mouseup","touchend"],this.onValueChanged.bind(this)),this.sliderType==="compound"&&this._selectOperatorElm?this._bindEventService.bind(this._selectOperatorElm,["change"],this.onValueChanged.bind(this)):this.sliderType==="double"&&this._sliderLeftInputElm&&(this._bindEventService.bind(this._sliderLeftInputElm,["input","change"],this.slideLeftInputChanged.bind(this)),this._bindEventService.bind(this._sliderLeftInputElm,["change","mouseup","touchend"],this.onValueChanged.bind(this))),this._divContainerFilterElm}getOperatorOptionValues(){let e;return this.columnFilter.compoundOperatorList?e=this.columnFilter.compoundOperatorList:e=Dn(this.gridOptions,this.translaterService),Mn(this.gridOptions,e,"numeric"),e}onValueChanged(e){var n,o,l,a,h;const t=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);let i,s;if(this.sliderType==="compound"||this.sliderType==="single")((l=(o=e==null?void 0:e.target)==null?void 0:o.tagName)==null?void 0:l.toLowerCase())!=="select"&&(this._currentValue=+t),i=this._currentValue,s=[i||"0"];else if(this.sliderType==="double"){const c=[parseInt(((a=this._sliderLeftInputElm)==null?void 0:a.value)??"",10),t];i=c.join(".."),s=c}if(this._clearFilterTriggered)this.updateFilterStyle(!1),this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,searchTerms:[],shouldTriggerQuery:this._shouldTriggerQuery});else{const d=((h=this._selectOperatorElm)==null?void 0:h.value)??this.operator;this.updateFilterStyle(i!=="");const c=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,u=c&&ie(this._currentValue)||!ie(this._currentValue)&&ie(this._lastSearchValue);(this.sliderType!=="compound"||!c||u)&&this.callback(e,{columnDef:this.columnDef,operator:d||"",searchTerms:s,shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this.changeBothSliderFocuses(!1),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e)),this._lastSearchValue=i}changeBothSliderFocuses(e){var i,s;const t=e?"add":"remove";(i=this._sliderLeftInputElm)==null||i.classList[t]("focus"),(s=this._sliderRightInputElm)==null||s.classList[t]("focus")}slideLeftInputChanged(e){var s,n,o,l;const t=parseInt(((s=this._sliderLeftInputElm)==null?void 0:s.value)??"",10),i=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);this._sliderLeftInputElm&&i-t<=(((o=this.filterOptions)==null?void 0:o.stopGapBetweenSliderHandles)??Us)&&(this._sliderLeftInputElm.value=String(t-(((l=this.filterOptions)==null?void 0:l.stopGapBetweenSliderHandles)??Us))),this._sliderLeftInputElm&&this._sliderRightInputElm&&(+this._sliderLeftInputElm.value>=+this._sliderRightInputElm.value-ku?(this._sliderLeftInputElm.style.zIndex="1",this._sliderRightInputElm.style.zIndex="0"):(this._sliderLeftInputElm.style.zIndex="0",this._sliderRightInputElm.style.zIndex="1")),this.sliderLeftOrRightChanged(e,t,i)}slideRightInputChanged(e){var s,n,o,l;const t=parseInt(((s=this._sliderLeftInputElm)==null?void 0:s.value)??"",10),i=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);this.sliderType==="double"&&this._sliderRightInputElm&&i-t<=(((o=this.filterOptions)==null?void 0:o.stopGapBetweenSliderHandles)??Us)&&(this._sliderRightInputElm.value=String(t+(((l=this.filterOptions)==null?void 0:l.stopGapBetweenSliderHandles)??Us))),this.sliderLeftOrRightChanged(e,t,i)}sliderLeftOrRightChanged(e,t,i){var n,o,l,a,h,d;this.updateTrackFilledColorWhenEnabled(),this.changeBothSliderFocuses(!0),this._sliderRangeContainElm.title=this.sliderType==="double"?`${t} - ${i}`:`${i}`,(((n=this.filterOptions)==null?void 0:n.hideSliderNumber)??((o=this.filterOptions)==null?void 0:o.hideSliderNumbers))||((l=this._leftSliderNumberElm)!=null&&l.textContent&&(this._leftSliderNumberElm.textContent=((a=this._sliderLeftInputElm)==null?void 0:a.value)??""),(h=this._rightSliderNumberElm)!=null&&h.textContent&&(this._rightSliderNumberElm.textContent=((d=this._sliderRightInputElm)==null?void 0:d.value)??"")),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e))}sliderTrackClicked(e){e.preventDefault();const t=e.offsetX,i=this._sliderTrackElm.offsetWidth,s=(t+0)*100/i;this._sliderRightInputElm&&this.sliderType!=="double"?(this._sliderRightInputElm.value=`${s}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))):this._sliderLeftInputElm&&this._sliderRightInputElm&&(s<=50?(this._sliderLeftInputElm.value=`${s}`,this._sliderLeftInputElm.dispatchEvent(new Event("change"))):(this._sliderRightInputElm.value=`${s}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))))}updateTrackFilledColorWhenEnabled(){var e,t,i,s;if((e=this.filterOptions)!=null&&e.enableSliderTrackColoring&&this._sliderRightInputElm){let n=0;this._sliderLeftInputElm&&(n=(+this._sliderLeftInputElm.value-+this._sliderLeftInputElm.min)/(((t=this.sliderOptions)==null?void 0:t.maxValue)??0-+this._sliderLeftInputElm.min)*100);const o=(+this._sliderRightInputElm.value-+this._sliderRightInputElm.min)/(((i=this.sliderOptions)==null?void 0:i.maxValue)??0-+this._sliderRightInputElm.min)*100,l="linear-gradient(to right, %b %p1, %c %p1, %c %p2, %b %p2)".replace(/%b/g,"#eee").replace(/%c/g,((s=this.filterOptions)==null?void 0:s.sliderTrackFilledColor)||this._sliderTrackFilledColor||vr).replace(/%p1/g,`${n}%`).replace(/%p2/g,`${o}%`);this._sliderTrackElm.style.background=l,this._sliderOptions.sliderTrackBackground=l}}updateFilterStyle(e){var t,i;e?(this._divContainerFilterElm.classList.add("filled"),(t=this._filterElm)==null||t.classList.add("filled")):(this._divContainerFilterElm.classList.remove("filled"),(i=this._filterElm)==null||i.classList.remove("filled"))}}class Fu extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="compound"}}class Du extends _l{constructor(e){super(e),this.translaterService=e,this.inputFilterType="range"}}class Mu extends Ut{constructor(e){super(e),this.translaterService=e,this._inputMask="",this.inputType="text"}get inputMask(){return this._inputMask}init(e){var i,s,n,o;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this._cellContainerElm=e.filterContainerElm,(s=(i=this.columnDef)==null?void 0:i.params)!=null&&s.mask?this._inputMask=this.columnDef.params.mask:(o=(n=this.columnFilter)==null?void 0:n.params)!=null&&o.mask&&(this._inputMask=this.columnFilter.params.mask),!this._inputMask)throw new Error(`[Slickgrid-Universal] The Filters.inputMask requires the mask to be passed in the filter params or the column definition params
17
- for example:: this.columnDefinitions: [{ id: 'phone', field: 'phone', filter: { model: Filters.inputMask, params: { mask: '000-000-0000' }}}]`);const t=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this.createDomFilterElement(t),this._bindEventService.bind(this._filterInputElm,["keyup","blur","change"],this.onTriggerEvent.bind(this))}onTriggerEvent(e,t=!1){var s,n;let i="";if((s=e==null?void 0:e.target)!=null&&s.value){let o=((n=e==null?void 0:e.target)==null?void 0:n.value)??"";const l=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof o=="string"&&l&&(o=o.trim());const a=this.unmaskValue(o),h=this.maskValue(a);i=a,(e==null?void 0:e.keyCode)>=48&&(this._filterInputElm.value=h,e.preventDefault())}t?(this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this._filterInputElm.classList.remove("filled")):(this._filterInputElm.classList.add("filled"),this.callback(e,{columnDef:this.columnDef,operator:this.operator,searchTerms:[i],shouldTriggerQuery:this._shouldTriggerQuery})),this._shouldTriggerQuery=!0}maskValue(e){let t=0,i="";return this._inputMask&&(i=this._inputMask.replace(/[09A]/gi,s=>((s==="0"||s==="9")&&/\d+/g.test(e[t])||s.toUpperCase()==="A"&&/[^\d]+/gi.test(e[t]))&&e[t++]||"")),i}unmaskValue(e){const t=e.replace(/[^0-9a-z]*/gi,""),i=this._inputMask.replace(/[^0-9a-z]*/gi,"");let s="";for(let n=0;n<i.length;n++)t[n]&&((i[n]==="0"||i[n]==="9")&&/\d+/g.test(t[n])||i[n].toUpperCase()==="A"&&/[^\d]+/gi.test(t[n]))&&(s+=t[n]);return s}}class Nu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number"}}class Lu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password"}}var Hu=Object.defineProperty,Vu=(r,e,t)=>e in r?Hu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e,t)=>Vu(r,typeof e!="symbol"?e+"":e,t),Bu=class{constructor(r){V(this,"_distinctEvent"),V(this,"_boundedEvents",[]),this._distinctEvent=(r==null?void 0:r.distinctEvent)??!1}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(r,e,t,i,s=""){let n=Array.isArray(e)?e:[e];if(typeof(r==null?void 0:r.forEach)=="function")r.forEach(o=>{for(let l of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(o,l))&&(o.addEventListener(l,t,i),this._boundedEvents.push({element:o,eventName:l,listener:t,groupName:s}))});else for(let o of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(r,o))&&(r.addEventListener(o,t,i),this._boundedEvents.push({element:r,eventName:o,listener:t,groupName:s}))}hasBinding(r,e){return this._boundedEvents.some(t=>t.element===r&&(!e||t.eventName===e))}unbind(r,e,t){var i;if(r){let s=Array.isArray(r)?r:[r],n=Array.isArray(e)?e||"":[e||""];for(let o of s){t||(t=this._boundedEvents.find(l=>{if(l.element===o&&(!e||l.eventName===e))return l.listener}));for(let l of n)(i=o==null?void 0:o.removeEventListener)==null||i.call(o,l,t)}}}unbindAll(r){if(r){let e=Array.isArray(r)?r:[r];for(let t=this._boundedEvents.length-1;t>=0;--t){let i=this._boundedEvents[t];if(e.some(s=>s===i.groupName)){let{element:s,eventName:n,listener:o}=i;this.unbind(s,n,o),this._boundedEvents.splice(t,1)}}}else for(;this._boundedEvents.length>0;){let e=this._boundedEvents.pop(),{element:t,eventName:i,listener:s}=e;this.unbind(t,i,s)}}},Sa=typeof window<"u"&&window.multipleSelect!==void 0?window.multipleSelect:{locales:{}},zu={formatSelectAll(){return"[Select all]"},formatAllSelected(){return"All selected"},formatCountSelected(r,e){return`${r} of ${e} selected`},formatNoMatchesFound(){return"No matches found"},formatOkButton(){return"OK"}};Sa.locales["en-US"]=zu;var ya=Sa.locales,$u=50,Wu=4,Ea={name:"",placeholder:"",classes:"",classPrefix:"",data:void 0,locale:void 0,selectAll:!0,single:void 0,singleRadio:!1,multiple:!1,hideOptgroupCheckboxes:!1,multipleWidth:80,width:void 0,dropWidth:void 0,maxHeight:250,maxHeightUnit:"px",position:"bottom",displayValues:!1,displayTitle:!1,displayDelimiter:", ",minimumCountSelected:3,ellipsis:!1,isOpen:!1,keepOpen:!1,openOnHover:!1,container:null,filter:!1,filterGroup:!1,filterPlaceholder:"",filterAcceptOnEnter:!1,filterByDataLength:void 0,customFilter(r){let{text:e,label:t,search:i}=r;return(t||e||"").includes(i)},showClear:!1,autoAdjustDropHeight:!1,autoAdjustDropPosition:!1,autoAdjustDropWidthByTextSize:!1,adjustedHeightPadding:10,useSelectOptionLabel:!1,useSelectOptionLabelToHtml:!1,navigationHighlight:!0,infiniteScroll:!1,virtualScroll:!0,cssStyler:()=>null,textTemplate:r=>r.innerHTML.trim(),labelTemplate:r=>r.label,onOpen:()=>!1,onClose:()=>!1,onCheckAll:()=>!1,onUncheckAll:()=>!1,onFocus:()=>!1,onBlur:()=>!1,onOptgroupClick:()=>!1,onBeforeClick:()=>!0,onClick:()=>!1,onFilter:()=>!1,onFilterClear:()=>!1,onClear:()=>!1,onAfterCreate:()=>!1,onDestroy:()=>!1,onAfterDestroy:()=>!1,onDestroyed:()=>!1},Gu=["init","getOptions","refreshOptions","getSelects","setSelects","enable","disable","open","close","check","uncheck","checkAll","uncheckAll","checkInvert","focus","blur","refresh","destroy"];Object.assign(Ea,ya["en-US"]);var Uu={BLOCK_ROWS:$u,CLUSTER_BLOCKS:Wu,DEFAULTS:Ea,METHODS:Gu},ft=Uu;function ju(r,e,t=!1){let i=Object.keys(r),s=Object.keys(e);if(t&&i.length!==s.length)return!1;for(let n of i)if(s.includes(n)&&r[n]!==e[n])return!1;return!0}function Sr(r){let e=()=>{let s={};for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=Sr(r[n]));return s},t=()=>r.map(s=>Sr(s)),i=Object.prototype.toString.call(r).slice(8,-1).toLowerCase();return i==="object"?e():i==="array"?t():r}function yr(r){return r!=null&&r!==""}function Yu(r,e){return typeof r=="object"?Object.fromEntries(e?Object.entries(r).filter(([t,i])=>!yr(i)&&!e.includes(t)||yr(i)):Object.entries(r).filter(([t,i])=>yr(i))):r}function Xu(r){let e=0;return r.forEach((t,i)=>{t.type==="optgroup"?(t._key=`group_${i}`,t.visible=typeof t.visible>"u"?!0:t.visible,t.children.forEach((s,n)=>{s&&(s.visible=typeof(s==null?void 0:s.visible)>"u"?!0:s.visible,s.divider||(s._key=`option_${i}_${n}`,e+=1))})):(t.visible=typeof t.visible>"u"?!0:t.visible,t.divider||(t._key=`option_${i}`,e+=1))}),e}function js(r,e,t){if(Array.isArray(r))for(let i of r){if(i[e]===t||i[e]===`${+i[e]}`&&+i[e]===t)return i;if(i.type==="optgroup"){for(let s of i.children)if(s&&(s[e]===t||s[e]===`${+s[e]}`&&+s[e]===t))return s}}}function qu(r){return r.replace(/(\b)(on[a-z]+)(\s*)=([^>]*)|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(&lt;|&#60;)(\/*)(script|script defer)(.*)(&#62;|&gt;|&gt;">)/gi,"")}function Er(r){return Object.keys(r).forEach(e=>r[e]===void 0?delete r[e]:""),r}function Ei(r,e){if(typeof r!="string")return r;if(typeof e=="function")return e(r);if(typeof r.normalize=="function")return r.normalize("NFD").replace(/[\u0300-\u036F]/g,"");throw new Error("[Multiple-Select-Vanilla] `normalize()` function is not defined, you can optionally provide a custom parser via the `diacriticParser` option.")}function wr(r){let e=0,t=0,i=0,s=0,n=window.innerHeight??0,o=window.innerWidth??0,l=Zu(),a=l.top,h=l.left,d=xr(r);if(d){let c=d.top??0,u=d.left??0;t=c-a,e=n-(c-a),i=u-h,s=o-(u-h)}return{top:t,bottom:e,left:i,right:s}}function Tr(r=""){return r.split(" ").filter(e=>e)}function Ge(r,e,t){let i=document.createElement(r);return e&&Object.keys(e).forEach(s=>{let n=e[s];typeof n=="object"?Object.assign(i[s],n):i[s]=e[s]}),t!=null&&t.appendChild&&t.appendChild(i),i}function wa(r,e,t){var n;let i=(n=r.props)!=null&&n.innerHTML?Qu(r.props,"innerHTML"):r.props,s=Ge(r.tagName,Yu(i,["className","title","style"]),e);if(r.props.innerHTML&&(s.innerHTML=r.props.innerHTML),r.attrs)for(let o of Object.keys(r.attrs))s.setAttribute(o,r.attrs[o]);if(r.children)for(let o of r.children)wa(o,s);return e==null||e.appendChild(s),s}function Or(r){return r.hasOwnProperty("tagName")?wa(r):document.createElement("li")}function Ys(r){for(;r!=null&&r.firstChild;)r.lastChild&&r.removeChild(r.lastChild);return r}function xr(r){var o;if(!r)return;let e=(o=r==null?void 0:r.getBoundingClientRect)==null?void 0:o.call(r),t=0,i=0,s=0,n=0;return(e==null?void 0:e.top)!==void 0&&e.left!==void 0&&(t=e.top+window.pageYOffset,i=e.left+window.pageXOffset,n=e.right,s=e.bottom),{top:t,left:i,bottom:s,right:n}}function Xs(r,e,t){if(!r)return 0;let i=Number.parseFloat(r.style[t]);if(!i||Number.isNaN(i)){switch(e){case"outer":i=r[t==="width"?"offsetWidth":"offsetHeight"];break;case"scroll":i=r[t==="width"?"scrollWidth":"scrollHeight"];break;case"inner":default:i=r[t==="width"?"clientWidth":"clientHeight"];break}i=r.getBoundingClientRect()[t]}if(!i||Number.isNaN(i)){let s=r.style.display,n=r.style.position;r.style.display="block",r.style.position="absolute";let o=window.getComputedStyle(r)[t];i=Number.parseFloat(o),Number.isNaN(i)&&(i=0),r.style.display=s,r.style.position=n}return i||0}function Ta(r,e){let t=null,i=r==null?void 0:r.parentElement;for(;i;){let[s,n,o,l]=e.match(/^([a-z]*)([#.]{1})([a-z\-]+)$/i)||[];if(o&&l)for(let a of l.replace(o,"").split(" "))i.classList.contains(a)&&(n?(i==null?void 0:i.tagName.toLowerCase())===n&&(t=i):t=i);i=i.parentElement}return t}function Ku(r,e){var t;(t=r.parentNode)==null||t.insertBefore(e,r.nextSibling)}function Qu(r,e){let{[e]:t,...i}=r;return i}function Oa(r,e){r!=null&&r.style&&(r.style.display=r.style.display==="none"&&e!==!1||e===!0?"block":"none")}function Zu(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}var Ju=class{constructor(e){var i;V(this,"clusterRows"),V(this,"cache"),V(this,"scrollEl"),V(this,"blockHeight"),V(this,"clusterHeight"),V(this,"contentEl"),V(this,"parentEl"),V(this,"itemHeight"),V(this,"lastCluster"),V(this,"scrollTop"),V(this,"dataStart"),V(this,"dataEnd"),V(this,"rows"),V(this,"destroy"),V(this,"callback"),V(this,"sanitizer"),this.rows=e.rows,this.scrollEl=e.scrollEl,this.contentEl=e.contentEl,this.parentEl=(i=e.contentEl)==null?void 0:i.parentElement,this.callback=e.callback,this.cache={},this.scrollTop=this.scrollEl.scrollTop,this.initDOM(this.rows),this.scrollEl.scrollTop=this.scrollTop,this.lastCluster=0;let t=()=>{this.lastCluster!==(this.lastCluster=this.getNum())&&(this.initDOM(this.rows),this.callback())};this.scrollEl.addEventListener("scroll",t,!1),this.destroy=()=>{this.scrollEl.removeEventListener("scroll",t,!1),Ys(this.contentEl)}}reset(e){this.lastCluster=0,this.cache={},Ys(this.contentEl),this.initDOM(e)}initDOM(e){if(typeof this.clusterHeight>"u"){this.cache.scrollTop=this.scrollEl.scrollTop;let o=Or(e[0]);this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.cache.data=[e[0]],this.getRowsHeight()}let t=this.initData(e,this.getNum()),i=this.checkChanges("data",t.rows),s=this.checkChanges("top",t.topOffset),n=this.checkChanges("bottom",t.bottomOffset);Ys(this.contentEl),i&&s?(t.topOffset&&this.contentEl.appendChild(this.getExtra("top",t.topOffset)),t.rows.forEach(o=>this.contentEl.appendChild(Or(o))),t.bottomOffset&&this.contentEl.appendChild(this.getExtra("bottom",t.bottomOffset))):n&&this.contentEl.lastChild&&(this.contentEl.lastChild.style.height=`${t.bottomOffset}px`)}getRowsHeight(){var e;if(typeof this.itemHeight>"u"){let t=((e=this.parentEl)==null?void 0:e.style.display)||"";this.parentEl&&(t===""||t==="none")&&(this.parentEl.style.display="block");let i=this.contentEl.children,s=i[Math.floor(i.length/2)];this.itemHeight=s.offsetHeight,this.parentEl&&(this.parentEl.style.display=t)}this.blockHeight=this.itemHeight*ft.BLOCK_ROWS,this.clusterRows=ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS,this.clusterHeight=this.blockHeight*ft.CLUSTER_BLOCKS}getNum(){this.scrollTop=this.scrollEl.scrollTop;let e=(this.clusterHeight||0)-(this.blockHeight||0);return e&&Math.floor(this.scrollTop/e)||0}initData(e,t){if(e.length<ft.BLOCK_ROWS)return{topOffset:0,bottomOffset:0,rowsAbove:0,rows:e};let i=Math.max((this.clusterRows-ft.BLOCK_ROWS)*t,0),s=i+this.clusterRows,n=Math.max(i*this.itemHeight,0),o=Math.max((e.length-s)*this.itemHeight,0),l=[],a=i;n<1&&a++;for(let h=i;h<s;h++)e[h]&&l.push(e[h]);return this.dataStart=i,this.dataEnd=s,{topOffset:n,bottomOffset:o,rowsAbove:a,rows:l}}checkChanges(e,t){let i=t!==this.cache[e];return this.cache[e]=t,i}getExtra(e,t){let i=document.createElement("li");return i.className=`virtual-scroll-${e}`,t&&(i.style.height=`${t}px`),i}},ns=".ms-select-all, ul li[data-key]",ep=".ms-select-all.highlighted, ul li[data-key].highlighted",tp=class{constructor(e,t){this.elm=e,V(this,"_bindEventService"),V(this,"isAllSelected",!1),V(this,"isPartiallyAllSelected",!1),V(this,"fromHtml",!1),V(this,"choiceElm"),V(this,"selectClearElm"),V(this,"closeElm"),V(this,"clearSearchIconElm"),V(this,"filterText",""),V(this,"updateData",[]),V(this,"data",[]),V(this,"dataTotal"),V(this,"dropElm"),V(this,"okButtonElm"),V(this,"filterParentElm"),V(this,"lastFocusedItemKey",""),V(this,"lastMouseOverPosition",""),V(this,"ulElm"),V(this,"parentElm"),V(this,"labelElm"),V(this,"selectAllParentElm"),V(this,"selectAllElm"),V(this,"searchInputElm"),V(this,"selectGroupElms"),V(this,"selectItemElms"),V(this,"noResultsElm"),V(this,"options"),V(this,"selectAllName",""),V(this,"selectGroupName",""),V(this,"selectItemName",""),V(this,"scrolledByMouse",!1),V(this,"openDelayTimer"),V(this,"updateDataStart"),V(this,"updateDataEnd"),V(this,"virtualScroll"),V(this,"_currentHighlightIndex",-1),V(this,"_currentSelectedElm"),V(this,"isMoveUpRecalcRequired",!1),V(this,"locales",{}),this.options=Object.assign({},ft.DEFAULTS,this.elm.dataset,t),this._bindEventService=new Bu({distinctEvent:!0})}get isRenderAsHtml(){return this.options.renderOptionLabelAsHtml||this.options.useSelectOptionLabelToHtml}init(){this.initLocale(),this.initContainer(),this.initData(),this.initSelected(!0),this.initFilter(),this.initDrop(),this.initView(),this.options.onAfterCreate()}destroy(e=!0){var t,i,s,n,o;this.elm&&this.parentElm&&(this.options.onDestroy({hardDestroy:e}),e&&this.options.onHardDestroy(),this.elm.parentElement&&this.parentElm.parentElement&&this.elm.parentElement.insertBefore(this.elm,this.parentElm.parentElement.firstChild),this.elm.classList.remove("ms-offscreen"),this._bindEventService.unbindAll(),(t=this.virtualScroll)==null||t.destroy(),(i=this.dropElm)==null||i.remove(),this.dropElm=void 0,(s=this.parentElm.parentNode)==null||s.removeChild(this.parentElm),this.fromHtml&&(delete this.options.data,this.fromHtml=!1),this.options.onAfterDestroy({hardDestroy:e}),e&&((o=(n=this.options).onAfterHardDestroy)==null||o.call(n),Object.keys(this.options).forEach(l=>delete this[l])))}initLocale(){if(this.options.locale){if(typeof this.options.locale=="object"){Object.assign(this.options,this.options.locale);return}let e=window.multipleSelect.locales,t=this.options.locale.split(/-|_/);if(t[0]=t[0].toLowerCase(),t[1]&&(t[1]=t[1].toUpperCase()),e[this.options.locale])Object.assign(this.options,e[this.options.locale]);else if(e[t.join("-")])Object.assign(this.options,e[t.join("-")]);else if(e[t[0]])Object.assign(this.options,e[t[0]]);else throw new Error(`[multiple-select-vanilla] invalid locales "${this.options.locale}", make sure to import it before using it`)}}initContainer(){var s;let e=this.elm.getAttribute("name")||this.options.name||"";this.options.classes&&this.elm.classList.add(this.options.classes),this.options.classPrefix&&(this.elm.classList.add(this.options.classPrefix),this.options.size&&this.elm.classList.add(`${this.options.classPrefix}-${this.options.size}`)),this.elm.style.display="none",this.labelElm=this.elm.closest("label"),!this.labelElm&&this.elm.id&&(this.labelElm=document.createElement("label"),this.labelElm.htmlFor=this.elm.id),(s=this.labelElm)!=null&&s.querySelector("input")&&(this.labelElm=null),typeof this.options.single>"u"&&(this.options.single=!this.elm.multiple),this.parentElm=Ge("div",{className:Tr(`ms-parent ${this.elm.className||""} ${this.options.classes}`).join(" "),dataset:{test:"sel"}}),this.options.darkMode&&this.parentElm.classList.add("ms-dark-mode");let t=this.elm.getAttribute("title")||"";t&&(this.parentElm.title=t),this.options.placeholder=this.options.placeholder||this.elm.getAttribute("placeholder")||"",this.choiceElm=Ge("button",{className:"ms-choice",type:"button"},this.parentElm),this.options.labelId&&(this.choiceElm.id=this.options.labelId,this.choiceElm.setAttribute("aria-labelledby",this.options.labelId)),this.choiceElm.appendChild(Ge("span",{className:"ms-placeholder",textContent:this.options.placeholder})),this.options.showClear&&(this.selectClearElm=Ge("div",{className:"ms-icon ms-icon-close"}),this.selectClearElm.style.display="none",this.choiceElm.appendChild(this.selectClearElm)),this.choiceElm.appendChild(Ge("div",{className:"ms-icon ms-icon-caret"})),this.dropElm=Ge("div",{className:`ms-drop ${this.options.position}`,ariaExpanded:"false"},this.parentElm),this.options.darkMode&&this.dropElm.classList.add("ms-dark-mode"),e&&(this.dropElm.dataset.name=e);let i=this.elm.getAttribute("data-test")||this.options.dataTest;i&&(this.parentElm.dataset.test=i,this.dropElm.dataset.test=i),this.closeElm=this.choiceElm.querySelector(".ms-icon-close"),this.options.dropWidth&&(this.dropElm.style.width=typeof this.options.dropWidth=="string"?this.options.dropWidth:`${this.options.dropWidth}px`),Ku(this.elm,this.parentElm),this.elm.disabled&&(this.choiceElm.classList.add("disabled"),this.choiceElm.disabled=!0),this.selectAllName=`selectAll${e}`,this.selectGroupName=`selectGroup${e}`,this.selectItemName=`selectItem${e}`,this.options.keepOpen||(this._bindEventService.unbindAll("body-click"),this._bindEventService.bind(document.body,"click",n=>{this.getEventTarget(n)===this.choiceElm||Ta(this.getEventTarget(n),".ms-choice")===this.choiceElm||(this.getEventTarget(n)===this.dropElm||Ta(this.getEventTarget(n),".ms-drop")!==this.dropElm&&this.getEventTarget(n)!==this.elm)&&this.options.isOpen&&this.close("body.click")},void 0,"body-click"))}initData(){let e=[];if(this.options.data){if(Array.isArray(this.options.data))this.data=this.options.data.map(t=>typeof t=="string"||typeof t=="number"?{text:t,value:t}:t);else if(typeof this.options.data=="object"){for(let[t,i]of Object.entries(this.options.data))e.push({value:t,text:`${i}`});this.data=e}}else this.elm.childNodes.forEach(t=>{let i=this.initRow(t);i&&e.push(i)}),this.options.data=e,this.data=e,this.fromHtml=!0;this.dataTotal=Xu(this.data||[])}initRow(e,t){var s,n;let i={};return((s=e.tagName)==null?void 0:s.toLowerCase())==="option"?(i.type="option",i.text=this.options.textTemplate(e),i.value=e.value,i.visible=!0,i.selected=!!e.selected,i.disabled=t||e.disabled,i.classes=e.getAttribute("class")||"",i.title=e.getAttribute("title")||"",e.dataset.value&&(i._value=e.dataset.value),Object.keys(e.dataset).length&&(i._data=e.dataset,i._data.divider&&(i.divider=i._data.divider)),i):((n=e.tagName)==null?void 0:n.toLowerCase())==="optgroup"?(i.type="optgroup",i.label=this.options.labelTemplate(e),i.visible=!0,i.selected=!!e.selected,i.disabled=e.disabled,i.children=[],Object.keys(e.dataset).length&&(i._data=e.dataset),e.childNodes.forEach(o=>{i.children.push(this.initRow(o,i.disabled))}),i):null}initDrop(){this.initList(),this.update(!0),this.options.isOpen&&this.open(10),this.options.openOnHover&&this.parentElm&&(this._bindEventService.bind(this.parentElm,"mouseover",()=>this.open(null)),this._bindEventService.bind(this.parentElm,"mouseout",()=>this.close("hover.mouseout")))}initFilter(){if(this.filterText="",this.options.filter||!this.options.filterByDataLength)return;let e=0;for(let t of this.data||[])t.type==="optgroup"?e+=t.children.length:e+=1;this.options.filter=e>this.options.filterByDataLength}initList(){var e,t;if(this.options.filter&&(this.filterParentElm=Ge("div",{className:"ms-search"},this.dropElm),this.filterParentElm.appendChild(Ge("input",{autocomplete:"off",autocapitalize:"off",spellcheck:!1,type:"text",placeholder:this.options.filterPlaceholder||"🔎︎"})),this.options.showSearchClear&&this.filterParentElm.appendChild(Ge("span",{className:"ms-icon ms-icon-close"}))),this.options.selectAll&&!this.options.single){let i=this.elm.getAttribute("name")||this.options.name||"";this.selectAllParentElm=Ge("div",{className:"ms-select-all",dataset:{key:"select_all"}});let s=document.createElement("label"),n=`ms-icon ${this.isAllSelected?"ms-icon-check":this.isPartiallyAllSelected?"ms-icon-minus":"ms-icon-uncheck"}`,o=Ge("div",{className:"icon-checkbox-container"},s);Ge("input",{type:"checkbox",ariaChecked:String(this.isAllSelected),checked:this.isAllSelected,dataset:{name:`selectAll${i}`}},o),Ge("div",{className:n},o),s.appendChild(Ge("span",{textContent:this.formatSelectAll()})),this.selectAllParentElm.appendChild(s),(e=this.dropElm)==null||e.appendChild(this.selectAllParentElm)}this.ulElm=document.createElement("ul"),this.ulElm.role="combobox",this.ulElm.ariaExpanded="false",this.ulElm.ariaMultiSelectable=String(!this.options.single),(t=this.dropElm)==null||t.appendChild(this.ulElm),this.options.showOkButton&&!this.options.single&&(this.okButtonElm=Ge("button",{className:"ms-ok-button",type:"button",textContent:this.formatOkButton()},this.dropElm)),this.initListItems()}initListItems(){var i;let e=0,t=this.getListRows();if(this.options.selectAll&&!this.options.single&&(e=-1),t.length>ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS){let s=this.dropElm&&((i=this.dropElm)==null?void 0:i.style.display)!=="none";!s&&this.dropElm&&(this.dropElm.style.left="-10000",this.dropElm.style.display="block",this.dropElm.ariaExpanded="true");let n=()=>{if(this.virtualScroll){this._currentHighlightIndex=0,this.updateDataStart=this.virtualScroll.dataStart+e,this.updateDataEnd=this.virtualScroll.dataEnd+e,this.updateDataStart<0&&(this.updateDataStart=0,this._currentHighlightIndex=0);let o=this.getDataLength();this.updateDataEnd>o&&(this.updateDataEnd=o),this.ulElm&&(this.isMoveUpRecalcRequired?this.recalculateArrowMove("up"):this.virtualScroll.dataStart>this.updateDataStart&&this.recalculateArrowMove("down"))}};this.ulElm&&(this.virtualScroll?this.virtualScroll.reset(t):this.virtualScroll=new Ju({rows:t,scrollEl:this.ulElm,contentEl:this.ulElm,sanitizer:this.options.sanitizer,callback:()=>{n(),this.events()}})),n(),!s&&this.dropElm&&(this.dropElm.style.left="0",this.dropElm.style.display="none",this.dropElm.ariaExpanded="false")}else this.ulElm&&(Ys(this.ulElm),t.forEach(s=>this.ulElm.appendChild(Or(s)))),this.updateDataStart=0,this.updateDataEnd=this.updateData.length;return this.events(),t}getEventTarget(e){return e.composedPath?e.composedPath()[0]:e.target}getListRows(){var t;let e=[];return this.updateData=[],(t=this.data)==null||t.forEach(i=>e.push(...this.initListItem(i))),this.options.infiniteScroll&&e.push({tagName:"li",props:{className:"ms-infinite-option",role:"option"}}),e.push({tagName:"li",props:{className:"ms-no-results",textContent:this.formatNoMatchesFound()}}),e}initListItem(e,t=0){let i=(e==null?void 0:e.title)||"",s=this.options.multiple?"multiple":"",n=this.options.single?"radio":"checkbox",o=!!(e!=null&&e.selected),l=this.options.single&&!this.options.singleRadio,a="";if(!(e!=null&&e.visible))return[];if(this.updateData.push(e),l&&(a="hide-radio "),e.selected&&(a+="selected "),e.type==="optgroup"){let g=[],_;if(this.options.hideOptgroupCheckboxes||this.options.single)_={tagName:"span",props:{dataset:{name:this.selectGroupName,key:e._key}}};else{let y={tagName:"input",props:{type:"checkbox",dataset:{name:this.selectGroupName,key:e._key},checked:o,disabled:e.disabled}};l?_=y:_={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[y,{tagName:"div",props:{className:`ms-icon ${o?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]}}!a.includes("hide-radio")&&(this.options.hideOptgroupCheckboxes||this.options.single)&&(a+="hide-radio ");let b={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(b.props,e.label);let C={tagName:"li",props:{className:Tr(`group${this.options.single||e.disabled?" disabled":""} ${a}`).join(" "),role:"option",ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:Tr(`optgroup${this.options.single||e.disabled?" disabled":""}`).join(" ")},children:[_,b]}]},E=this.options.cssStyler(e);return E&&(C.props.style=E),g.push(C),e.children.forEach(y=>g.push(...this.initListItem(y,1))),g}if(a+=e.classes||"",t&&this.options.single&&(a+=`option-level-${t} `),e.divider)return[{tagName:"li",props:{className:"option-divider"}}];let h=s||a?(s+a).trim():"";e.disabled&&(h+=" disabled");let d=`${e.disabled?"disabled":""}`,c={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(c.props,e.text);let u={tagName:"input",props:{type:n,value:encodeURI(e.value),dataset:{key:e._key,name:this.selectItemName},checked:o,disabled:!!e.disabled}};e.selected&&(u.attrs={checked:"checked"});let p={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[u,{tagName:"div",props:{className:`ms-icon ${u.props.checked?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]},m={tagName:"li",props:{role:"option",title:i,ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:d},children:[l?u:p,c]}]};h&&(m.props.className=h);let f=this.options.cssStyler(e);return f&&(m.props.style=f),[m]}initSelected(e=!1){var i,s;let t=0;for(let n of this.data||[])if(n.type==="optgroup"){let o=n.children.filter(l=>(l==null?void 0:l.selected)&&!l.disabled&&l.visible).length;n.children.length&&(n.selected=!this.options.single&&o&&o===n.children.filter(l=>l&&!l.disabled&&l.visible&&!l.divider).length),t+=o}else t+=n.selected&&!n.disabled&&n.visible?1:0;this.isAllSelected=((i=this.data)==null?void 0:i.filter(n=>n.selected&&!n.disabled&&n.visible).length)===((s=this.data)==null?void 0:s.filter(n=>!n.disabled&&n.visible&&!n.divider).length),this.isPartiallyAllSelected=!this.isAllSelected&&t>0,e||(this.isAllSelected?this.options.onCheckAll():t===0&&this.options.onUncheckAll())}initView(){let e;window.getComputedStyle?(e=window.getComputedStyle(this.elm).width,e==="auto"&&(e=Xs(this.dropElm,"outer","width")+20)):e=Xs(this.elm,"outer","width")+20,this.parentElm.style.width=`${this.options.width||e}px`,this.elm.classList.add("ms-offscreen")}events(){var t,i,s,n,o,l,a;this._bindEventService.unbindAll(["ok-button","search-input","select-all-checkbox","input-checkbox-list","group-checkbox-list","hover-highlight","arrow-highlight","option-list-scroll"]),this.clearSearchIconElm=(t=this.filterParentElm)==null?void 0:t.querySelector(".ms-icon-close"),this.searchInputElm=(i=this.dropElm)==null?void 0:i.querySelector(".ms-search input"),this.selectAllElm=(s=this.dropElm)==null?void 0:s.querySelector(`input[data-name="${this.selectAllName}"]`),this.selectGroupElms=(n=this.dropElm)==null?void 0:n.querySelectorAll(`input[data-name="${this.selectGroupName}"],span[data-name="${this.selectGroupName}"]`),this.selectItemElms=(o=this.dropElm)==null?void 0:o.querySelectorAll(`input[data-name="${this.selectItemName}"]:enabled`),this.noResultsElm=(l=this.dropElm)==null?void 0:l.querySelector(".ms-no-results");let e=h=>{h.preventDefault(),!this.getEventTarget(h).classList.contains("ms-icon-close")&&(this.options.isOpen?this.close("toggle.close"):this.open())};this.labelElm&&this._bindEventService.bind(this.labelElm,"click",h=>{this.getEventTarget(h).nodeName.toLowerCase()==="label"&&(e(h),(!this.options.filter||!this.options.isOpen)&&this.focus(),h.stopPropagation())}),this._bindEventService.bind(this.choiceElm,"click",e),this.options.onFocus&&this._bindEventService.bind(this.choiceElm,"focus",this.options.onFocus),this.options.onBlur&&this._bindEventService.bind(this.choiceElm,"blur",this.options.onBlur),this._bindEventService.bind(this.parentElm,"keydown",h=>{h.code==="Escape"&&this.handleEscapeKey()}),this.closeElm&&this._bindEventService.bind(this.closeElm,"click",h=>{h.preventDefault(),this._checkAll(!1,!0),this.initSelected(!1),this.updateSelected(),this.update(),this.options.onClear()}),this.clearSearchIconElm&&this._bindEventService.bind(this.clearSearchIconElm,"click",h=>{h.preventDefault(),this.searchInputElm&&(this.searchInputElm.value="",this.searchInputElm.focus()),this._currentHighlightIndex=-1,this.moveHighlightDown(),this.filter(),this.options.onFilterClear()}),this.searchInputElm&&(this._bindEventService.bind(this.searchInputElm,"keydown",h=>{h.code==="Tab"&&h.shiftKey&&this.close("key.shift+tab")},void 0,"search-input"),this._bindEventService.bind(this.searchInputElm,"keyup",h=>{var d,c,u;if(this.options.filterAcceptOnEnter&&["Enter","Space"].includes(h.code)&&((d=this.searchInputElm)!=null&&d.value)){if(this.options.single){let p=[];(c=this.selectItemElms)==null||c.forEach(m=>{var f;((f=m.closest("li"))==null?void 0:f.style.display)!=="none"&&p.push(m)}),p.length&&p[0].hasAttribute("data-name")&&this.setSelects([p[0].value])}else(u=this.selectAllElm)==null||u.click();this.close(`key.${h.code.toLowerCase()}`),this.focus();return}this.filter()},void 0,"search-input")),this.selectAllElm&&this._bindEventService.bind(this.selectAllElm,"click",h=>{var d;return this._checkAll((d=h.currentTarget)==null?void 0:d.checked)},void 0,"select-all-checkbox"),this.okButtonElm&&this._bindEventService.bind(this.okButtonElm,"click",h=>{e(h),h.stopPropagation()},void 0,"ok-button"),this.selectGroupElms&&this._bindEventService.bind(this.selectGroupElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key);this._checkGroup(u,c),this.options.onOptgroupClick(Er({label:u.label,selected:u.selected,data:u._data,children:u.children.map(p=>{if(p)return Er({text:p.text,value:p.value,selected:p.selected,disabled:p.disabled,data:p._data})})}))},void 0,"group-checkbox-list"),this.selectItemElms&&this._bindEventService.bind(this.selectItemElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key),p=()=>{this.options.single&&this.options.isOpen&&!this.options.keepOpen&&this.close("selection")};if(this.options.onBeforeClick(u)===!1){p();return}this._check(u,c),this.options.onClick(Er({text:u.text,value:u.value,selected:u.selected,data:u._data})),p()},void 0,"input-checkbox-list"),this.lastFocusedItemKey&&this.dropElm&&((a=this.dropElm.querySelector(`li[data-key=${this.lastFocusedItemKey}]`))==null||a.focus()),this.options.navigationHighlight&&this.dropElm&&(this._bindEventService.bind(this.dropElm,"mouseover",h=>{var c,u;let d=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if((c=this.dropElm)!=null&&c.contains(d)&&this.lastMouseOverPosition!==`${h.clientX}:${h.clientY}`){let p=((u=this.dropElm)==null?void 0:u.querySelectorAll(ns))||[],m=Array.from(p).findIndex(f=>f.dataset.key===d.dataset.key);this._currentHighlightIndex!==m&&!d.classList.contains("disabled")&&(this._currentSelectedElm=d,this._currentHighlightIndex=m,this.changeCurrentOptionHighlight(d))}this.lastMouseOverPosition=`${h.clientX}:${h.clientY}`},void 0,"hover-highlight"),this._bindEventService.bind(this.dropElm,"keydown",h=>{var d,c,u,p;switch(h.key){case"ArrowUp":h.preventDefault(),this.moveHighlightUp();break;case"ArrowDown":h.preventDefault(),this.moveHighlightDown();break;case"Escape":this.handleEscapeKey();break;case"Enter":case" ":{if(document.activeElement!==this.okButtonElm){let m=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if(h.key===" "&&this.options.filter||this.options.filterAcceptOnEnter&&!m)return;h.preventDefault(),(c=(d=this._currentSelectedElm)==null?void 0:d.querySelector("input"))==null||c.click(),this.options.single&&(this.choiceElm.focus(),this.lastFocusedItemKey=((u=this.choiceElm)==null?void 0:u.dataset.key)||"")}break}case"Tab":{h.preventDefault(),h.shiftKey?document.activeElement===this.okButtonElm?(this.focusSelectAllOrList(),this.highlightCurrentOption()):(this.close("key.shift+tab"),this.choiceElm.focus()):(this.changeCurrentOptionHighlight(),(p=this.okButtonElm)==null||p.focus());break}}},void 0,"arrow-highlight")),this.ulElm&&this.options.infiniteScroll&&this._bindEventService.bind(this.ulElm,"scroll",this.infiniteScrollHandler.bind(this),void 0,"option-list-scroll")}handleEscapeKey(){this.options.keepOpen||(this.close("key.escape"),this.choiceElm.focus())}infiniteScrollHandler(e,t,i){let s=!1;e&&this.getEventTarget(e)&&this.ulElm&&this.scrolledByMouse?this.getEventTarget(e).scrollTop+this.getEventTarget(e).clientHeight===this.ulElm.scrollHeight&&(s=!0):t!==void 0&&t+1===i&&(s=!0),s&&this.ulElm&&(this.virtualScroll?this.initListItems():this.ulElm.scrollTop=0,this._currentHighlightIndex=0,this.highlightCurrentOption())}open(e=0){return new Promise(t=>{e!==null&&e>=0?(clearTimeout(this.openDelayTimer),this.openDelayTimer=setTimeout(()=>{this.openDrop(),t()},e)):(this.openDrop(),t())})}openDrop(){var s,n,o,l,a;if(!this.dropElm||(s=this.choiceElm)!=null&&s.classList.contains("disabled"))return;if(this.options.isOpen=!0,this.parentElm.classList.add("ms-parent-open"),(o=(n=this.choiceElm)==null?void 0:n.querySelector("div.ms-icon-caret"))==null||o.classList.add("open"),this.dropElm.style.display="block",this.dropElm.ariaExpanded="true",(l=this.selectAllElm)!=null&&l.parentElement&&(this.selectAllElm.parentElement.style.display="inline-flex"),this.noResultsElm&&(this.noResultsElm.style.display="none"),this.getDataLength()||((a=this.selectAllElm)!=null&&a.parentElement&&(this.selectAllElm.parentElement.style.display="none"),this.noResultsElm&&(this.noResultsElm.style.display="block")),this.options.container){let h=xr(this.dropElm),d;this.options.container instanceof Node?d=this.options.container:typeof this.options.container=="string"&&(d=this.options.container==="body"?document.body:document.querySelector(this.options.container)),d.appendChild(this.dropElm),this.dropElm.style.top=`${(h==null?void 0:h.top)??0}px`,this.dropElm.style.left=`${(h==null?void 0:h.left)??0}px`,this.dropElm.style.minWidth="auto",this.dropElm.style.width=`${Xs(this.parentElm,"outer","width")}px`}let e=this.options.minHeight,t=this.options.maxHeight;this.options.maxHeightUnit==="row"&&(t=Xs(this.dropElm.querySelector("ul>li"),"outer","height")*this.options.maxHeight),this.ulElm??(this.ulElm=this.dropElm.querySelector("ul")),this.ulElm&&(e&&(this.ulElm.style.minHeight=`${e}px`),this.ulElm.style.maxHeight=`${t}px`),this.dropElm.querySelectorAll(".multiple").forEach(h=>{h.style.width=`${this.options.multipleWidth}px`}),this.getDataLength()&&this.options.filter?(this.searchInputElm&&(this.searchInputElm.value="",this.searchInputElm.focus()),this.filter(!0)):this.focusSelectAllOrList(),this._currentHighlightIndex<0?this.moveHighlightDown():this.highlightCurrentOption(),this.options.autoAdjustDropWidthByTextSize&&this.adjustDropWidthByText();let i=this.options.position;if(this.options.autoAdjustDropHeight){if(this.options.autoAdjustDropPosition){let{bottom:h,top:d}=wr(this.dropElm),c=this.dropElm.getBoundingClientRect().height;i=h<c&&d>h?"top":"bottom"}this.adjustDropHeight(i)}this.options.autoAdjustDropPosition&&this.adjustDropPosition(!0),this.options.onOpen()}focusSelectAllOrList(){this.selectAllElm?this.selectAllElm.focus():this.ulElm&&(this.ulElm.tabIndex=0,this.ulElm.focus())}highlightCurrentOption(){var t;let e=((t=this.dropElm)==null?void 0:t.querySelectorAll(ns))||[];if(this._currentHighlightIndex<=e.length){let i=e[this._currentHighlightIndex];i&&(this.lastFocusedItemKey=i.dataset.key||"",this._currentSelectedElm=i,this.scrolledByMouse=!1,i.scrollIntoView({block:"nearest"}),this.changeCurrentOptionHighlight(i),setTimeout(()=>this.scrolledByMouse=!0,10))}}changeCurrentOptionHighlight(e){var t;e==null||e.classList.add("highlighted"),(((t=this.dropElm)==null?void 0:t.querySelectorAll(ep))||[]).forEach(i=>{i!==e&&i.classList.remove("highlighted")})}moveHighlightDown(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=e.length;this._currentHighlightIndex<t-1?(this._currentHighlightIndex++,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightDown()):this.options.infiniteScroll&&this.infiniteScrollHandler(null,this._currentHighlightIndex,t),this.highlightCurrentOption()}moveHighlightUp(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=this.options.single?0:1;if(this.virtualScroll&&this._currentHighlightIndex<=t&&this.updateDataStart>0&&this.ulElm){let n=e[this._currentHighlightIndex+(this.options.single?0:1)],o=n==null?void 0:n.dataset.key;this.lastFocusedItemKey=o,this.ulElm.scrollTop=this.ulElm.scrollTop-(n==null?void 0:n.getBoundingClientRect().height)||10,this.isMoveUpRecalcRequired=!0;return}this._currentHighlightIndex>0&&(this._currentHighlightIndex--,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightUp()),this.highlightCurrentOption()}recalculateArrowMove(e){var s;let t=((s=this.dropElm)==null?void 0:s.querySelectorAll(ns))||[],i=Array.from(t).findIndex(n=>n.dataset.key===this.lastFocusedItemKey);this._currentHighlightIndex=i-1,e==="down"?this.moveHighlightDown():e==="up"&&(this.moveHighlightUp(),this.isMoveUpRecalcRequired=!1)}close(e){var t,i;this.options.isOpen=!1,this.parentElm.classList.remove("ms-parent-open"),(i=(t=this.choiceElm)==null?void 0:t.querySelector("div.ms-icon-caret"))==null||i.classList.remove("open"),this.dropElm&&(this.dropElm.style.display="none",this.dropElm.ariaExpanded="false",this.options.container&&(this.parentElm.appendChild(this.dropElm),this.dropElm.style.top="auto",this.dropElm.style.left="auto")),this.options.onClose(e)}applyAsTextOrHtmlWhenEnabled(e,t){e||(e={}),this.isRenderAsHtml?e.innerHTML=typeof this.options.sanitizer=="function"?this.options.sanitizer(t):t:e.textContent=t}update(e=!1){var h;let t=this.getSelects(),i=this.getSelects("text");this.options.displayValues&&(i=t);let s=(h=this.choiceElm)==null?void 0:h.querySelector("span"),n=t.length,o=null,l=()=>{if(this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml){let d=t.join(this.options.displayDelimiter);return this.options.useSelectOptionLabelToHtml?qu(d):d}return i.join(this.options.displayDelimiter)};if(s){if(n===0){let d=this.options.placeholder||"";s.classList.add("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,d)}else n<this.options.minimumCountSelected?o=l():this.formatAllSelected()&&n===this.dataTotal?o=this.formatAllSelected():this.options.ellipsis&&n>this.options.minimumCountSelected?o=`${i.slice(0,this.options.minimumCountSelected).join(this.options.displayDelimiter)}...`:this.formatCountSelected(n,this.dataTotal)&&n>this.options.minimumCountSelected?o=this.formatCountSelected(n,this.dataTotal):o=l();if(o!==null&&(s==null||s.classList.remove("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,o)),this.options.showClear&&this.selectClearElm){let d=o?"block":"none";this.selectClearElm.style.display=d}if(this.options.displayTitle){let d=this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml?"value":"text";s.title=this.getSelects(d).join(this.options.displayDelimiter)}}let a=this.getSelects();this.options.single?this.elm.value=a.length?a[0]:"":Array.from(this.elm.options).forEach(d=>{d.selected=a.some(c=>c===d.value)}),e||this.elm.dispatchEvent(new Event("change"))}updateSelected(e){var i,s,n;for(let o=this.updateDataStart;o<this.updateDataEnd;o++){let l=this.updateData[o],a=(i=this.dropElm)==null?void 0:i.querySelector(`input[data-key=${l._key}]`);if(a){a.checked=l.selected;let h=a.closest("li"),d=h==null?void 0:h.querySelector(".icon-checkbox-container div");h&&(l.selected&&!h.classList.contains("selected")?(h.classList.add("selected"),h.ariaSelected="true",d&&(d.className=`ms-icon ms-icon-${a.type==="radio"?"radio":"check"}`)):l.selected||(h.classList.remove("selected"),h.ariaSelected="false",d&&(d.className="ms-icon ms-icon-uncheck")))}}let t=((s=this.data)==null?void 0:s.filter(o=>o.visible).length)===0;if(this.selectAllElm){this.selectAllElm.ariaChecked=String(this.isAllSelected);let o=(n=this.dropElm)==null?void 0:n.querySelector(".ms-select-all .icon-checkbox-container div");if(o){let l="";this.isAllSelected?l="ms-icon-check":this.isPartiallyAllSelected?l="ms-icon-minus":l="ms-icon-uncheck",o.className=`ms-icon ${l}`}this.selectAllElm.checked=this.isAllSelected,Oa(this.selectAllElm.closest("li"),!t)}Oa(this.noResultsElm,t),this.virtualScroll&&(this.virtualScroll.rows=e??this.getListRows())}getData(){return this.options.data}getDataLength(){var e;return((e=this.data)==null?void 0:e.length)??0}getOptions(e=!0){let t=Object.assign({},this.options);return delete t.data,e?Sr(t):this.options}refreshOptions(e){ju(this.options,e,!0)||(this.options=Object.assign(this.options,e),this.destroy(!1),this.init())}getDropElement(){return this.dropElm}getParentElement(){return this.parentElm}getSelects(e="value"){let t=[];for(let i of this.data||[])if(i.type==="optgroup"){let s=i.children.filter(n=>n==null?void 0:n.selected);if(!s.length)continue;if(e==="value"||this.options.single)t.push(...s.map(n=>e==="value"&&n._value||n[e]));else{let n=[];n.push("["),n.push(i.label),n.push(`: ${s.map(o=>o[e]).join(", ")}`),n.push("]"),t.push(n.join(""))}}else i.selected&&t.push(e==="value"&&i._value||i[e]);return t}setSelects(e,t="value",i=!1){let s=!1,n=o=>{var l;for(let a of o){let h=!1;if(t==="text"){let d=document.createElement("div");this.applyAsTextOrHtmlWhenEnabled(d,a.text),h=e.includes(((l=d.textContent)==null?void 0:l.trim())??"")}else h=e.includes(a._value||a.value),!h&&a.value===`${+a.value}`&&(h=e.includes(+a.value));a.selected!==h&&(s=!0),a.selected=h}};for(let o of this.data||[])o.type==="optgroup"?n(o.children):n([o]);s&&(this.initSelected(i),this.updateSelected(),this.update(i))}enable(){this.choiceElm&&(this.choiceElm.classList.remove("disabled"),this.choiceElm.disabled=!1)}disable(){var e;this.choiceElm&&((e=this.choiceElm)==null||e.classList.add("disabled"),this.choiceElm.disabled=!0)}check(e){let t=js(this.data,"value",e);t&&this._check(t,!0)}uncheck(e){let t=js(this.data,"value",e);t&&this._check(t,!1)}_check(e,t){this.options.single&&this._checkAll(!1,!0),e.selected=t,this.initSelected(),this.updateSelected(),this.update()}checkAll(){this._checkAll(!0)}uncheckAll(){this._checkAll(!1)}_checkAll(e,t){for(let i of this.data||[])i.type==="optgroup"?this._checkGroup(i,e,!0):!i.disabled&&!i.divider&&(t||i.visible)&&(i.selected=e);t||(this.initSelected(),this.updateSelected(),this.update())}_checkGroup(e,t,i){e.selected=t,e.children.forEach(s=>{s&&!s.disabled&&!s.divider&&(i||s.visible)&&(s.selected=t)}),i||(this.initSelected(),this.updateSelected(),this.update())}checkInvert(){if(!this.options.single){for(let e of this.data||[])if(e.type==="optgroup")for(let t of e.children)t&&(t.divider||(t.selected=!t.selected));else e&&!e.divider&&(e.selected=!e.selected);this.initSelected(),this.updateSelected(),this.update()}}focus(){var e;(e=this.choiceElm)==null||e.focus(),this.options.onFocus()}blur(){var e;(e=this.choiceElm)==null||e.blur(),this.options.onBlur()}refresh(){this.destroy(!1),this.init()}filter(e){var n;let t=((n=this.searchInputElm)==null?void 0:n.value.trim())??"",i=t.toLowerCase();if(this.filterText===i)return;this.filterText=i;for(let o of this.data||[])if(o.type==="optgroup")if(this.options.filterGroup){let l=`${(o==null?void 0:o.label)??""}`;if(o!=null){let a=this.options.customFilter({label:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalLabel:l,originalSearch:t,row:o});o.visible=a;for(let h of o.children)h&&(h.visible=a)}}else{for(let l of o.children)if(l!=null){let a=`${(l==null?void 0:l.text)??""}`;l.visible=this.options.customFilter({text:Ei(a.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:a,originalSearch:t,row:l,parent:o})}o.visible=o.children.filter(l=>l==null?void 0:l.visible).length>0}else{let l=`${(o==null?void 0:o.text)??""}`;o.visible=this.options.customFilter({text:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:l,originalSearch:t,row:o})}let s=this.initListItems();this.initSelected(e),this.updateSelected(s),e||this.options.onFilter(t)}adjustDropHeight(e){var d,c,u,p;let t=e!=="top",i=((d=this.filterParentElm)==null?void 0:d.getBoundingClientRect().height)??0,s=((c=this.okButtonElm)==null?void 0:c.getBoundingClientRect().height)??0,n=this.options.single?0:((u=this.selectAllParentElm)==null?void 0:u.getBoundingClientRect().height)??0,o=i+s+n+5,{bottom:l,top:a}=wr(this.parentElm),h=this.options.maxHeight;if(t?h=l-o-this.options.adjustedHeightPadding:h=a-o-this.options.adjustedHeightPadding,!this.options.maxHeight||this.options.maxHeight&&h<this.options.maxHeight){let m=(p=this.dropElm)==null?void 0:p.querySelector("ul");return m&&(m.style.maxHeight=`${h}px`),!0}return!1}adjustDropPosition(e){let t="bottom";if(this.dropElm&&this.parentElm){let{bottom:i,top:s}=wr(this.dropElm),{top:n,left:o}=xr(this.parentElm),l=this.dropElm.getBoundingClientRect().height,a=this.dropElm.getBoundingClientRect().width,h=document.body.offsetWidth||window.innerWidth,d=this.parentElm.getBoundingClientRect().width;if(i>l)t="bottom";else if(l>i&&s>i){if(this.options.container){let c=n-l;c<0&&(c=0),(c>0||e)&&(t="top",this.dropElm.style.top=`${c<0?0:c}px`)}else t="top",this.dropElm.classList.add(t);this.dropElm.classList.remove("bottom")}h-a<o&&(this.dropElm.style.left=`${o-(a-d)}px`)}return t}adjustDropWidthByText(){if(this.dropElm){let e=this.parentElm.scrollWidth;(this.options.dropWidth||this.options.width)&&(e=this.options.dropWidth||this.options.width||0);let t=this.dropElm.querySelector(".ms-select-all span"),i=this.dropElm.querySelector("ul"),s=26,n=(t==null?void 0:t.clientWidth)??0+s,o=i.scrollHeight>i.clientHeight?this.getScrollbarWidth():0,l=0;this.dropElm.querySelectorAll("li label").forEach(a=>{a.scrollWidth>l&&(l=a.scrollWidth)}),l+=s+o,l<n&&(l=n),this.options.maxWidth&&l>this.options.maxWidth&&(l=this.options.maxWidth),this.options.minWidth&&l<this.options.minWidth&&(l=this.options.minWidth),(e==="100%"||+e<l)&&(this.dropElm.style.width=`${l}px`,this.dropElm.style.maxWidth=`${l}px`)}}getScrollbarWidth(){var n;let e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",document.body.appendChild(e);let t=e.offsetWidth;e.style.overflow="scroll";let i=document.createElement("div");i.style.width="100%",e.appendChild(i);let s=i.offsetWidth;return(n=e.parentNode)==null||n.removeChild(e),t-s}formatAllSelected(){return this.options.allSelectedText||this.options.formatAllSelected()}formatCountSelected(e,t){return this.options.countSelectedText?this.options.countSelectedText.replace("#",`${e}`).replace("%",`${t}`):this.options.formatCountSelected(e,t)}formatNoMatchesFound(){return this.options.noMatchesFoundText||this.options.formatNoMatchesFound()}formatOkButton(){return this.options.okButtonText||this.options.formatOkButton()}formatSelectAll(){return this.options.selectAllText||this.options.formatSelectAll()}},wi=(r,e)=>typeof r=="string"?Ir(document.querySelectorAll(r),e):r instanceof Node?Ir([r],e):Ir(r,e);function Ir(r,e){let t=Array.from(r),i=[];for(let s=0;s<t.length;s++){let n=t[s];try{n._multipleSelect!==void 0&&(n._multipleSelect.destroy(),delete n._multipleSelect),n._multipleSelect=new tp(n,e||{}),n._multipleSelect.init();let o=n._multipleSelect.getOptions(!1);o.onHardDestroy=()=>delete n._multipleSelect,o.onAfterHardDestroyed=()=>i[s]=null,i.push(n._multipleSelect)}catch(o){console.error(o)}}return i.length===1?i[0]:i}wi.defaults=ft.DEFAULTS,wi.locales={...ya},wi.methods=ft.METHODS,typeof window<"u"&&(window.multipleSelect=wi);class xa{constructor(e,t,i,s=!0){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._isMultipleSelect=!0,this._collectionLength=0,this._shouldTriggerQuery=!0,this.isFilled=!1,this.enableTranslateLabel=!1,this.subscriptions=[],this._isMultipleSelect=s}get collectionOptions(){var e,t;return((t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.collectionOptions)??{}}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.customStructure}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get defaultOperator(){return this.isMultipleSelect?H.in:H.equal}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.select,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get isMultipleSelect(){return this._isMultipleSelect}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){var s,n,o,l,a,h,d,c,u,p,m;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this.filterContainerElm=e.filterContainerElm,!this.grid||!this.columnDef||!this.columnFilter||!this.columnFilter.collection&&!this.columnFilter.collectionAsync)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") for the MultipleSelect/SingleSelect Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: model: Filters.multipleSelect, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }`);if(this.enableTranslateLabel=((s=this.columnFilter)==null?void 0:s.enableTranslateLabel)??!1,this.labelName=((n=this.customStructure)==null?void 0:n.label)??"label",this.labelPrefixName=((o=this.customStructure)==null?void 0:o.labelPrefix)??"labelPrefix",this.labelSuffixName=((l=this.customStructure)==null?void 0:l.labelSuffix)??"labelSuffix",this.optionLabel=((a=this.customStructure)==null?void 0:a.optionLabel)??"value",this.valueName=((h=this.customStructure)==null?void 0:h.value)??"value",this.enableTranslateLabel&&(!this.translaterService||typeof this.translaterService.translate!="function"))throw new Error('[select-filter] The Translate Service is required for the Select Filter to work correctly when "enableTranslateLabel" is set.');this._locales=((d=this.gridOptions)==null?void 0:d.locales)??R.locales,this.initMultipleSelectTemplate();let t=((c=this.gridOptions)==null?void 0:c.defaultFilterPlaceholder)||"";(u=this.columnFilter)!=null&&u.placeholder&&(t=this.columnFilter.placeholder),this.defaultOptions.placeholder=t||"",this._isMultipleSelect&&((p=this.columnDef)!=null&&p.filter)&&(this.columnDef.filter.emptySearchTermReturnAllValues=((m=this.columnDef.filter)==null?void 0:m.emptySearchTermReturnAllValues)??!1);const i=this.columnFilter.collection||[];return new Promise(async(f,g)=>{try{let _;this.columnFilter.collectionAsync&&!this.columnFilter.collection?(_=zo(this.columnFilter.collectionAsync,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),f(_)):(_=i,this.renderDomElement(i),f(i)),(this.columnFilter.collectionAsync||this.columnFilter.enableCollectionWatch)&&(await(_??this.columnFilter.collectionAsync),this.watchCollectionChanges())}catch(_){g(_)}})}clear(e=!0){this._msInstance&&this._collectionLength>0&&(this._msInstance.setSelects([]),this.updateFilterStyle(!1),this.searchTerms=[],this._shouldTriggerQuery=e,this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:this._shouldTriggerQuery}),this._shouldTriggerQuery=!0)}destroy(){var e,t;typeof((e=this._msInstance)==null?void 0:e.destroy)=="function"&&this._msInstance.destroy(),(t=this.filterElm)==null||t.remove(),hs(this.subscriptions)}getValues(){var e;return((e=this._msInstance)==null?void 0:e.getSelects())??[]}setValues(e,t,i=!1){e!==void 0&&this._msInstance&&(e=Array.isArray(e)?e.every(s=>Bi(s))?e.map(String):e:[e],this._msInstance.setSelects(e)),this.updateFilterStyle(this.getValues().length>0),this.operator=t||this.defaultOperator,i&&this.onTriggerEvent()}filterCollection(e){var i,s;let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const n=this.columnFilter.collectionFilterBy,o=((i=this.columnFilter.collectionOptions)==null?void 0:i.filterResultAfterEachPass)||null;t=((s=this.collectionService)==null?void 0:s.filterCollection(t,n,o))||[]}return t}sortCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const s=this.columnFilter.collectionSortBy;t=((i=this.collectionService)==null?void 0:i.sortCollection(this.columnDef,t,s,this.enableTranslateLabel))||[]}return t}watchCollectionChanges(){var e;(e=this.columnFilter)!=null&&e.collection&&(Pi(this.columnFilter.collection,this.watchCallback.bind(this)),ls(this.columnFilter,"collection",this.propertyObserverCallback.bind(this)))}propertyObserverCallback(e){this.renderDomElement(e||[]),this.columnFilter.collection&&Pi(this.columnFilter.collection,this.watchCallback.bind(this))}watchCallback(e){this.renderDomElement(this.columnFilter.collection||e||[])}renderDomElement(e){var n,o,l,a;if(!Array.isArray(e)&&((n=this.collectionOptions)!=null&&n.collectionInsideObjectProperty)){const h=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,h||"")}if(!Array.isArray(e))throw new Error('The "collection" passed to the Select Filter is not a valid array.');let t=[];if(e.length>0&&(t=[...e]),(o=this.collectionOptions)!=null&&o.addBlankEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==""&&t.unshift(this.createBlankEntry()),(l=this.collectionOptions)!=null&&l.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&t.unshift(this.collectionOptions.addCustomFirstEntry),(a=this.collectionOptions)!=null&&a.addCustomLastEntry&&Array.isArray(t)&&t.length>0){const h=t.length-1;t[h][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;i=this.filterCollection(i),i=this.sortCollection(i);const s=vl("filter",i,this.columnDef,this.grid,this.isMultipleSelect,this.translaterService,this.searchTerms||[]);this.isFilled=s.hasFoundSearchTerm,this.createFilterElement(s.selectElement,s.dataCollection),this._collectionLength=i.length}createBlankEntry(){const e={[this.labelName]:"",[this.valueName]:""};return this.labelPrefixName&&(e[this.labelPrefixName]=""),this.labelSuffixName&&(e[this.labelSuffixName]=""),e}createFilterElement(e,t){var s;const i=((s=this.columnDef)==null?void 0:s.id)??"";this.elementName=`filter-${i}`,this.defaultOptions.name=this.elementName,J(this.filterContainerElm),this.filterElm=e,this.filterElm.dataset.columnId=`${i}`,this.updateFilterStyle(this.isFilled),this.filterContainerElm.appendChild(e),this.filterElmOptions={...this.defaultOptions,...this.filterOptions,data:t},this._msInstance=wi(e,this.filterElmOptions)}initMultipleSelectTemplate(){var s,n,o,l,a,h,d,c,u,p,m,f,g;const e=((s=this.gridOptions)==null?void 0:s.enableTranslate)??!1,i={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,name:`${((n=this.columnDef)==null?void 0:n.id)??""}`,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,single:!0,singleRadio:!0,showSearchClear:!0,renderOptionLabelAsHtml:((o=this.columnFilter)==null?void 0:o.enableRenderHtml)??!1,sanitizer:_=>this.grid.sanitizeHtmlString(_),onClose:()=>this.onTriggerEvent(),onClear:()=>this.clear()};if(this._isMultipleSelect){i.single=!1,i.singleRadio=!1,i.showOkButton=!0,i.displayTitle=!0;const _=ot(this.gridOptions);i.countSelectedText=e&&((l=this.translaterService)!=null&&l.translate)?this.translaterService.translate(`${_}X_OF_Y_SELECTED`):(a=this._locales)==null?void 0:a.TEXT_X_OF_Y_SELECTED,i.allSelectedText=e&&((h=this.translaterService)!=null&&h.translate)?this.translaterService.translate(`${_}ALL_SELECTED`):(d=this._locales)==null?void 0:d.TEXT_ALL_SELECTED,i.noMatchesFoundText=e&&((c=this.translaterService)!=null&&c.translate)?this.translaterService.translate(`${_}NO_MATCHES_FOUND`):(u=this._locales)==null?void 0:u.TEXT_NO_MATCHES_FOUND,i.okButtonText=e&&((p=this.translaterService)!=null&&p.translate)?this.translaterService.translate(`${_}OK`):(m=this._locales)==null?void 0:m.TEXT_OK,i.selectAllText=e&&((f=this.translaterService)!=null&&f.translate)?this.translaterService.translate(`${_}SELECT_ALL`):(g=this._locales)==null?void 0:g.TEXT_SELECT_ALL}this.defaultOptions=i}onTriggerEvent(){if(this._msInstance){const e=this.getValues();this.updateFilterStyle(Array.isArray(e)&&e.length>1||e.length===1&&e[0]!==""),this.searchTerms=e,this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:e,shouldTriggerQuery:this._shouldTriggerQuery}),this._shouldTriggerQuery=!0}}updateFilterStyle(e){var t,i,s,n,o,l;e?(this.isFilled=!0,(t=this.filterElm)==null||t.classList.add("filled"),(s=(i=this._msInstance)==null?void 0:i.getParentElement())==null||s.classList.add("filled")):(this.isFilled=!1,(n=this.filterElm)==null||n.classList.remove("filled"),(l=(o=this._msInstance)==null?void 0:o.getParentElement())==null||l.classList.remove("filled"))}}class ip extends xa{constructor(e,t,i){super(e,t,i,!0),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class sp extends xa{constructor(e,t,i){super(e,t,i,!1),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class np extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="single"}}class rp extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="double"}}const qs={autocompleter:Kh,compoundDate:uc,compoundInput:ba,compoundInputNumber:Au,compoundInputPassword:Pu,compoundInputText:ba,compoundSlider:Fu,dateRange:Du,input:Ut,inputMask:Mu,inputNumber:Nu,inputPassword:Lu,inputText:Ut,multipleSelect:ip,singleSelect:sp,slider:np,sliderRange:rp};class op{constructor(e,t,i,s){var n;this.config=e,this.translaterService=t,this.collectionService=i,this.rxjs=s,this._options=((n=this.config)==null?void 0:n.options)??{}}addRxJsResource(e){this.rxjs=e}createFilter(e){let t;return e!=null&&e.model&&(t=typeof e.model=="function"?new e.model(this.translaterService,this.collectionService,this.rxjs):e.model),!t&&this._options.defaultFilter&&(t=new this._options.defaultFilter(this.translaterService,this.collectionService,this.rxjs)),t}}const Rr={alwaysShowVerticalScroll:!0,autoEdit:!1,asyncEditorLoading:!1,autoFitColumnsOnFirstLoad:!0,autoFixResizeTimeout:5*60*5,autoFixResizeRequiredGoodCount:2,autoFixResizeWhenBrokenStyleDetected:!1,autoParseInputFilterOperator:!0,autoResize:{applyResizeToContainer:!0,calculateAvailableSizeBy:"window",bottomPadding:20,minHeight:180,minWidth:300,rightPadding:0},cellHighlightCssClass:"slick-cell-modified",checkboxSelector:{cssClass:"slick-cell-checkboxsel",width:40},columnGroupSeparator:" - ",columnPicker:{hideForceFitButton:!1,hideSyncResizeButton:!0,headerColumnValueExtractor:Ia},cellMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideCommandSection:!1,hideOptionSection:!1,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},compositeEditorOptions:{labels:{cancelButtonKey:"CANCEL",cloneButtonKey:"CLONE",resetEditorButtonTooltipKey:"RESET_INPUT_VALUE",resetFormButtonKey:"RESET_FORM",massSelectionButtonKey:"APPLY_TO_SELECTION",massSelectionStatusKey:"X_OF_Y_MASS_SELECTED",massUpdateButtonKey:"APPLY_MASS_UPDATE",massUpdateStatusKey:"ALL_X_RECORDS_SELECTED",saveButtonKey:"SAVE"}},contextMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideClearAllGrouping:!1,hideCollapseAllGroups:!1,hideCommandSection:!1,hideCopyCellValueCommand:!1,hideExpandAllGroups:!1,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideMenuOnScroll:!0,hideOptionSection:!1,iconCollapseAllGroupsCommand:"mdi mdi-arrow-collapse",iconExpandAllGroupsCommand:"mdi mdi-arrow-expand",iconClearGroupingCommand:"mdi mdi-close",iconCopyCellValueCommand:"mdi mdi-content-copy",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},customFooterOptions:{dateFormat:"YYYY-MM-DD, hh:mm a",hideRowSelectionCount:!1,hideTotalItemCount:!1,hideLastUpdateTimestamp:!0,footerHeight:25,leftContainerClass:"col-xs-12 col-sm-5",rightContainerClass:"col-xs-6 col-sm-7",metricSeparator:"|",metricTexts:{itemsKey:"ITEMS",ofKey:"OF",itemsSelectedKey:"ITEMS_SELECTED"}},customTooltip:{tooltipTextMaxLength:700,maxWidth:500},dataView:{syncGridSelection:{preserveHidden:!1,preserveHiddenOnSelectionChange:!0},syncGridSelectionWithBackendService:!1},datasetIdPropertyName:"id",defaultFilter:qs.input,defaultBackendServiceFilterTypingDebounce:500,enableFilterTrimWhiteSpace:!1,defaultFilterPlaceholder:"🔎︎",defaultFilterRangeOperator:H.rangeInclusive,defaultColumnSortFieldId:"id",draggableGrouping:{hideToggleAllButton:!1,toggleAllButtonText:"",dropPlaceHolderTextKey:"DROP_COLUMN_HEADER_TO_GROUP_BY"},editable:!1,editorTypingDebounce:450,filterTypingDebounce:0,enableEmptyDataWarningMessage:!0,emptyDataWarning:{className:"slick-empty-data-warning",messageKey:"EMPTY_DATA_WARNING_MESSAGE",hideFrozenLeftWarning:!1,hideFrozenRightWarning:!1,leftViewportMarginLeft:"40%",rightViewportMarginLeft:"40%",frozenLeftViewportMarginLeft:"0px",frozenRightViewportMarginLeft:"40%"},enableAutoResize:!0,enableAutoSizeColumns:!0,enableCellNavigation:!1,enableColumnPicker:!0,enableColumnReorder:!0,enableColumnResizeOnDoubleClick:!0,enableContextMenu:!0,enableExcelExport:!1,enableTextExport:!1,enableGridMenu:!0,enableHeaderMenu:!0,enableMouseHoverHighlightRow:!0,enableSorting:!0,enableTextSelectionOnCells:!0,explicitInitialization:!0,excelExportOptions:{addGroupIndentation:!0,autoDetectCellFormat:!0,exportWithFormatter:!1,filename:"export",format:ve.xlsx,groupingColumnHeaderTitle:"Group By",groupCollapsedSymbol:"⮞",groupExpandedSymbol:"⮟",groupingAggregatorRowText:"",sanitizeDataExport:!0},textExportOptions:{delimiter:wt.comma,exportWithFormatter:!1,filename:"export",format:ve.csv,groupingColumnHeaderTitle:"Group By",groupingAggregatorRowText:"",sanitizeDataExport:!0,useUtf8WithBom:!0},eventNamingStyle:ct.lowerCase,forceFitColumns:!1,frozenHeaderWidthCalcDifferential:1,gridMenu:{dropSide:"left",commandLabels:{clearAllFiltersCommandKey:"CLEAR_ALL_FILTERS",clearAllSortingCommandKey:"CLEAR_ALL_SORTING",clearFrozenColumnsCommandKey:"CLEAR_PINNING",exportCsvCommandKey:"EXPORT_TO_CSV",exportExcelCommandKey:"EXPORT_TO_EXCEL",exportTextDelimitedCommandKey:"EXPORT_TO_TAB_DELIMITED",refreshDatasetCommandKey:"REFRESH_DATASET",toggleDarkModeCommandKey:"TOGGLE_DARK_MODE",toggleFilterCommandKey:"TOGGLE_FILTER_ROW",togglePreHeaderCommandKey:"TOGGLE_PRE_HEADER_ROW"},hideClearAllFiltersCommand:!1,hideClearAllSortingCommand:!1,hideClearFrozenColumnsCommand:!0,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideForceFitButton:!1,hideRefreshDatasetCommand:!1,hideSyncResizeButton:!0,hideToggleFilterCommand:!1,hideToggleDarkModeCommand:!0,hideTogglePreHeaderCommand:!1,iconCssClass:"mdi mdi-menu",iconClearAllFiltersCommand:"mdi mdi-filter-remove-outline",iconClearAllSortingCommand:"mdi mdi-sort-variant-off",iconClearFrozenColumnsCommand:"mdi mdi-pin-off-outline",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",iconRefreshDatasetCommand:"mdi mdi-sync",iconToggleDarkModeCommand:"mdi mdi-brightness-4",iconToggleFilterCommand:"mdi mdi-flip-vertical",iconTogglePreHeaderCommand:"mdi mdi-flip-vertical",menuWidth:16,resizeOnShowHeaderRow:!0,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270",headerColumnValueExtractor:Ia},headerMenu:{autoAlign:!0,autoAlignOffset:4,minWidth:140,iconClearFilterCommand:"mdi mdi-filter-remove-outline",iconClearSortCommand:"mdi mdi-sort-variant-off",iconFilterShortcutSubMenu:"mdi mdi-filter-outline",iconFreezeColumns:"mdi mdi-pin-outline",iconSortAscCommand:"mdi mdi-sort-ascending",iconSortDescCommand:"mdi mdi-sort-descending",iconColumnHideCommand:"mdi mdi-close",iconColumnResizeByContentCommand:"mdi mdi-arrow-expand-horizontal",hideColumnResizeByContentCommand:!1,hideColumnHideCommand:!1,hideClearFilterCommand:!1,hideClearSortCommand:!1,hideFreezeColumnsCommand:!0,hideSortCommands:!1,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},ignoreAccentOnStringFilterAndSort:!1,multiColumnSort:!0,numberedMultiColumnSort:!0,tristateMultiColumnSort:!1,sortColNumberInSeparateSpan:!0,suppressActiveCellChangeOnEdit:!1,pagination:{pageSizes:[10,15,20,25,30,40,50,75,100],pageSize:25,totalItems:0},headerRowHeight:35,rowHeight:35,topPanelHeight:30,translationNamespaceSeparator:":",resetFilterSearchValueAfterOnBeforeCancellation:!0,resizeByContentOnlyOnFirstLoad:!0,resizeByContentOptions:{alwaysRecalculateColumnWidth:!1,cellCharWidthInPx:7.8,cellPaddingWidthInPx:14,defaultRatioForStringType:.88,formatterPaddingWidthInPx:0,maxItemToInspectCellContentWidth:1e3,maxItemToInspectSingleColumnWidthByContent:5e3,widthToRemoveFromExceededWidthReadjustment:50},treeDataOptions:{exportIndentMarginLeft:5,exportIndentationLeadingChar:"͏͏͏͏͏͏͏͏͏·"}};function Ia(r,e){const t=(r==null?void 0:r.columnGroup)||"",i=(e==null?void 0:e.columnGroupSeparator)??" - ";return t?t+i+r.name:(r==null?void 0:r.name)??""}class lp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._sum=0,this._itemCount=0,this._type="sum",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._isTreeAggregator=t,this._isInitialized=!0,this._sum=0,this._itemCount=0,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.count={}),e.__treeTotals.count[this._field]=0,e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals[this._type][this._field]??0),this._itemCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._itemCount=1):U(i)&&(this._sum+=parseFloat(i))}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),this.addGroupTotalPropertiesWhenNotExist(e);let t=this._sum,i=this._itemCount;this._isTreeAggregator&&(t+=e[this._type][this._field],i+=e.count[this._field],e.count[this._field]=i),e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}class ap{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._max=null,this._type="max",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._max=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMaxValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._max===null||s>this._max)&&(this._max=s)}else U(i)&&this.keepMaxValueWhenFound(i)}storeResult(e){let t=this._max;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i>t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMaxValueWhenFound(e){U(e)&&(this._max===null||e>this._max)&&(this._max=parseFloat(e))}}class hp{constructor(e){this._isInitialized=!1,this._distinctValues=[],this._type="distinct",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._distinctValues=[],this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:void 0;this._distinctValues.indexOf(t)===-1&&t!==void 0&&this._distinctValues.push(t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._distinctValues}}class dp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._min=null,this._type="min",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._min=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMinValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._min===null||s<this._min)&&(this._min=s)}else U(i)&&this.keepMinValueWhenFound(i)}storeResult(e){let t=this._min;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i<t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMinValueWhenFound(e){U(e)&&(this._min===null||e<this._min)&&(this._min=parseFloat(e))}}class cp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._count=0,this._type="count",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._count=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator&&(t?(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),this._count=e.__treeTotals[this._type][this._field]??0):U(i)&&(this._count=1))}storeResult(e){var i;(!e||e[this._type]===void 0)&&(e[this._type]={});let t=this._count;this._isTreeAggregator?t+=e[this._type][this._field]:t=((i=e.group)==null?void 0:i.rows.length)??0,e[this._type][this._field]=t}}class up{constructor(e){this._isInitialized=!1,this._data="",this._type="clone",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._data="",this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:null;t!==null&&t!==""&&(this._data=t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._data}}class pp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._nonNullCount=0,this._sum=0,this._type="avg",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._sum=0,this._nonNullCount=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.sum={},e.__treeTotals.count={}),e.__treeTotals[this._type][this._field]=0,e.__treeTotals.count[this._field]=0,e.__treeTotals.sum[this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals.sum[this._field]??0),this._nonNullCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._nonNullCount=1):U(i)&&(this._nonNullCount++,this._sum+=parseFloat(i))}storeResult(e){let t=this._sum,i=this._nonNullCount;this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&(t+=e.sum[this._field],i+=e.count[this._field],e.sum[this._field]=t,e.count[this._field]=i),i!==0&&(e[this._type][this._field]=i===0?t:t/i)}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.sum===void 0&&(e.sum={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}const Ar={Avg:pp,Clone:up,Count:cp,Distinct:hp,Min:dp,Max:ap,Sum:lp};function Ks(r,e){const t=e.errorMessage,i=e.required,s=e.minLength,n=e.maxLength,o=e.operatorConditionalType||"inclusive",l={"{{minLength}}":s,"{{maxLength}}":n};let a=!0,h="";const d=(r==null?void 0:r.length)??0;if(e.validator)return e.validator(r,e.editorArgs);if(i&&r==="")a=!1,h=t||R.VALIDATION_REQUIRED_FIELD;else if(s!==void 0&&n!==void 0&&(o==="exclusive"&&(d<=s||d>=n)||o==="inclusive"&&(d<s||d>n)))a=!1,h=t||R.VALIDATION_EDITOR_TEXT_LENGTH_BETWEEN.replace(/{{minLength}}|{{maxLength}}/gi,c=>l[c]);else if(s!==void 0&&d!==null&&(o==="exclusive"&&d<=s||o==="inclusive"&&d!==null&&d<s)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MIN_LENGTH;h=t||c.replace(/{{minLength}}/gi,u=>l[u])}else if(n!==void 0&&d!==null&&(o==="exclusive"&&d>=n||o==="inclusive"&&d!==null&&d>n)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MAX_LENGTH;h=t||c.replace(/{{maxLength}}/gi,u=>l[u])}return{valid:a,msg:h}}const mp=3;class fp{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastTriggeredByClearInput=!1,this.disabled=!1,this.forceUserInput=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this._bindEventService=new Ae,(t=this.gridOptions)!=null&&t.translater&&(this._translater=this.gridOptions.translater),this._locales=this.gridOptions&&this.gridOptions.locales||R.locales,this.init()}get autocompleterOptions(){return this._autocompleterOptions||{}}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get editorDomElement(){return this._inputElm}get elementCollection(){return this._elementCollection}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get customStructure(){var i,s,n,o,l;let e=(i=this.columnEditor)==null?void 0:i.customStructure;const t=((s=this.columnEditor)==null?void 0:s.type)??((n=this.columnDef)==null?void 0:n.type);return!e&&t===S.object&&((o=this.columnDef)!=null&&o.dataKey)&&((l=this.columnDef)!=null&&l.labelKey)&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get dataContext(){return this.args.item}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.autocompleter,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get instance(){return this._instance}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var t,i,s,n,o,l;this.labelName=((t=this.customStructure)==null?void 0:t.label)??"label",this.valueName=((i=this.customStructure)==null?void 0:i.value)??"value",this.labelPrefixName=((s=this.customStructure)==null?void 0:s.labelPrefix)??"labelPrefix",this.labelSuffixName=((n=this.customStructure)==null?void 0:n.labelSuffix)??"labelSuffix";let e=this.columnEditor.collection;(o=this.columnEditor)!=null&&o.collectionAsync&&!e&&(e=[]),this.renderDomElement(e),(this.disabled||(l=this.columnEditor)!=null&&l.collectionAsync&&Array.isArray(e)&&e.length===0)&&this.disable(!0)}destroy(){var e,t,i;this._bindEventService.unbindAll(),typeof((e=this._instance)==null?void 0:e.destroy)=="function"&&this._instance.destroy(),(i=(t=this._inputElm)==null?void 0:t.remove)==null||i.call(t),this._elementCollection=null}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.clear(!0)}else this._inputElm.disabled=!1}focus(){this.grid.focus(),this._inputElm&&(this._inputElm.focus(),this._inputElm.select())}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this._inputElm.value=e!=null&&e.hasOwnProperty(this.labelName)?e[this.labelName]:e,t){this._currentValue=e,this._defaultTextValue=typeof e=="string"?e:(e==null?void 0:e[this.labelName])??"",this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var n,o;let i=t;const s=(n=this.columnDef)==null?void 0:n.field;if(s!==void 0){Array.isArray(this.collection)&&this.collection.length>0&&(i=xt(this.collection,h=>h&&Ht(t)&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===(t.hasOwnProperty(this.valueName)&&t[this.valueName].toString()):h&&typeof t=="string"&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===t:(h==null?void 0:h.toString())===t,""));const l=(s==null?void 0:s.indexOf("."))>0,a=this.validate(null,i);if(i=a!=null&&a.valid?i:"",l){const h=((o=this.columnEditor)==null?void 0:o.complexObjectPath)??s??"";$e(e,h,i)}else e[s]=i}}isValueChanged(){var s,n;const e=this._inputElm.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;if((n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter")return!0;const i=!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue;return this._lastTriggeredByClearInput||i}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._currentValue=n,this._originalValue=n,this._defaultTextValue=typeof n=="string"?n:(n==null?void 0:n[this.labelName])??"",this._inputElm.value=this._defaultTextValue,this._inputElm.select()}}clear(e=!1){this._inputElm&&(this._currentValue="",this._defaultTextValue="",this.setValue("",!0)),this._isValueTouched=!0,this._lastTriggeredByClearInput=!0;const t=this.args.compositeEditorOptions;if(t){const i=!e;this.handleChangeOnCompositeEditor(null,t,"user",i)}else this.save()}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._inputElm&&(this._currentValue=s,this._defaultTextValue=typeof s=="string"?s:(s==null?void 0:s[this.labelName])??"",this._inputElm.value=this._defaultTextValue),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e,t,i,s,n;if(this._inputElm&&this.editorOptions.forceUserInput){const o=((e=this.editorOptions)==null?void 0:e.minLength)??mp;this._currentValue=this._inputElm.value.length>o?this._inputElm.value:this._currentValue}return this.customStructure&&this._currentValue&&this._currentValue.hasOwnProperty(this.valueName)&&((t=this.columnDef)==null?void 0:t.type)!==S.object&&((i=this.columnEditor)==null?void 0:i.type)!==S.object?this._currentValue[this.valueName]:this._currentValue&&this._currentValue.value!==void 0?((s=this.columnDef)==null?void 0:s.type)===S.object||((n=this.columnEditor)==null?void 0:n.type)===S.object?{[this.labelName]:this._currentValue.label,[this.valueName]:this._currentValue.value}:this._currentValue.value:this._currentValue}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._inputElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleSelect(e){var t;if(e!==void 0){const s=e;this._currentValue=s,this._isValueTouched=!0;const n=this.args.compositeEditorOptions,o=((t=this.editorOptions)==null?void 0:t.renderItem)??!1,l=typeof s=="string"?s:o?s[this.labelName]:s.label;if(this.setValue(l),n?this.handleChangeOnCompositeEditor(null,n):this.save(),typeof this.editorOptions.onSelectItem=="function"){const{row:a,cell:h}=this.grid.getActiveCell()||{};this.editorOptions.onSelectItem(e,a,h,this.args.column,this.args.item)}setTimeout(()=>this._lastTriggeredByClearInput=!1)}return!1}renderRegularItem(e){const t=typeof e=="string"?e:(e==null?void 0:e.label)??"";return v("div",{textContent:t||""})}renderCustomItem(e){var s,n;const t=((n=(s=this._autocompleterOptions)==null?void 0:s.renderItem)==null?void 0:n.templateCallback(e))??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){var h;const t=((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,i=e.labelPrefix||"",s=e.label||"",n=e.labelSuffix||"",o=i+s+n,l=this.grid.sanitizeHtmlString(o)||"",a=document.createElement("div");return a[t?"innerHTML":"textContent"]=l,a}renderDomElement(e){var l,a,h,d,c,u,p,m,f,g,_,b;const t=((l=this.columnDef)==null?void 0:l.id)??"",i=((a=this.columnEditor)==null?void 0:a.placeholder)??"",s=((h=this.columnEditor)==null?void 0:h.title)??"";this._editorInputGroupElm=v("div",{className:"autocomplete-container input-group"});const n=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{type:"text",placeholder:i,title:s,autocomplete:"off",ariaAutoComplete:"none",className:`autocomplete form-control editor-text input-group-editor editor-${t}`,dataset:{input:""}},this._editorInputGroupElm),this._editorInputGroupElm.appendChild(document.createElement("span")),(d=this.editorOptions)!=null&&d.hideClearButton||(n.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(n),this._bindEventService.bind(this._clearButtonElm,"click",()=>this.clear())),this._bindEventService.bind(this._inputElm,"focus",()=>{var C;return(C=this._inputElm)==null?void 0:C.select()}),this._bindEventService.bind(this._inputElm,"keydown",C=>{this._lastInputKeyEvent=C,(C.key==="ArrowLeft"||C.key==="ArrowRight")&&C.stopImmediatePropagation(),C.key==="Enter"&&C.target.value===""&&this.columnEditor.alwaysSaveOnEnterKey&&(this._currentValue=null)});let o=e;if(o&&((c=this.columnEditor)!=null&&c.collectionOverride)){const C={column:this.columnDef,dataContext:this.dataContext,grid:this.grid,originalCollections:this.collection};if(this.args.compositeEditorOptions){const{formValues:E,modalType:y}=this.args.compositeEditorOptions;C.compositeEditorOptions={formValues:E,modalType:y}}o=this.columnEditor.collectionOverride(o,C)}o&&(this.finalCollection=o),Array.isArray(o)&&(this.collection.every(C=>Bi(C))?o=o.map(C=>({label:C,value:C})):o=o.map(C=>({label:C==null?void 0:C[this.labelName],value:C==null?void 0:C[this.valueName],labelPrefix:(C==null?void 0:C[this.labelPrefixName])??"",labelSuffix:(C==null?void 0:C[this.labelSuffixName])??""})),this._elementCollection=o),this._autocompleterOptions={input:this._inputElm,debounceWaitMs:200,className:`slick-autocomplete ${((u=this.editorOptions)==null?void 0:u.className)??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&((p=this._translater)!=null&&p.translate)?this._translater.translate("NO_ELEMENTS_FOUND"):((m=this._locales)==null?void 0:m.TEXT_NO_ELEMENTS_FOUND)??"No elements found",customize:(C,E,y)=>{y.style.width=""},onSelect:this.handleSelect.bind(this),...this.editorOptions},(f=this.gridOptions)!=null&&f.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=he(this.autocompleterOptions.className).join(" "),(g=this._autocompleterOptions.renderItem)!=null&&g.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${ui(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=((_=this._autocompleterOptions.render)==null?void 0:_.bind(this))??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),(b=this._autocompleterOptions)!=null&&b.fetch?(Bo(this._inputElm,this._autocompleterOptions),this._instance=fs(this._autocompleterOptions)):this._instance=fs({...this._autocompleterOptions,fetch:(C,E)=>{o&&E(o.filter(y=>((typeof y=="string"?y:y==null?void 0:y.label)||"").toLowerCase().includes(C.toLowerCase())))}}),this.args.container.appendChild(this._editorInputGroupElm),this.args.compositeEditorOptions||setTimeout(()=>this.focus(),50)}}class gp{constructor(e){if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._checkboxContainerElm=v("div",{className:`checkbox-editor-container editor-${e}`}),this._input=v("input",{type:"checkbox",value:"true",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Checkbox Editor`,className:`editor-checkbox editor-${e}`,title:((o=this.columnEditor)==null?void 0:o.title)??""});const i=(l=this.args)==null?void 0:l.container;i&&typeof i.appendChild=="function"&&(t?(this._checkboxContainerElm.appendChild(this._input),i.appendChild(this._checkboxContainerElm)):i.appendChild(this._input)),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,"click",()=>{this._isValueTouched=!0,this.save()}),t?this._bindEventService.bind(this._input,"change",a=>{this._isValueTouched=!0,this.handleChangeOnCompositeEditor(a,t)}):this.focus()}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled"),this._checkboxContainerElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==!1&&this.reset(!1,!0,!0)}else this._input.removeAttribute("disabled"),this._checkboxContainerElm.classList.remove("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}preClick(){this._input&&(this._input.checked=!this._input.checked)}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}setValue(e,t=!1,i=!0){const s=!!e;if(this._input&&(this._input.checked=s),t){this.applyValue(this.args.item,this.serializeValue());const n=this.args.compositeEditorOptions;n&&i&&this.handleChangeOnCompositeEditor(null,n,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else e[i]=l}}isValueChanged(){return this.serializeValue()!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s,this._input.checked=!!this._originalValue}}reset(e,t=!0,i=!1){const s=e??this._originalValue??!1;this._input&&(this._originalValue=s,this._input.checked=!!s),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t!==void 0?t:(l=this._input)==null?void 0:l.checked,n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&!s?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}}class _p{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastClickIsDate=!1,this._lastTriggeredByClearDate=!1,this.hasTimePicker=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(t=this.gridOptions)!=null&&t.translater&&(this._translaterService=this.gridOptions.translater),this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._inputElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.date,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get pickerOptions(){return this._pickerMergedOptions}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}async init(){var e,t,i,s,n,o,l;if(this.args&&this.columnDef){const a=this.args.compositeEditorOptions,h=((e=this.columnDef)==null?void 0:e.id)??"",d=this.args.grid.getOptions()||{};this.defaultDate=(t=this.args.item)==null?void 0:t[this.columnDef.field];const c=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,u=Ze(c),p=((s=(i=this._translaterService)==null?void 0:i.getCurrentLanguage)==null?void 0:s.call(i))||d.locale||"en";u&&(u==="ISO8601"||u.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const m=Ze(this.hasTimePicker?S.dateTimeIsoAM_PM:S.dateIso),f={input:!0,jumpToSelectedDate:!0,sanitizer:b=>this.grid.sanitizeHtmlString(b),toggleSelected:!1,actions:{clickDay:()=>{this._lastClickIsDate=!0},changeToInput:(b,C)=>{if(C.HTMLInputElement){let E="";if(C.selectedDates[0]?(E=C.selectedDates[0],C.HTMLInputElement.value=Ct(C.selectedDates[0],void 0,c)):C.HTMLInputElement.value="",E&&this.hasTimePicker){const y=ms(E,m);y.setHours(+(C.selectedHours||0)),y.setMinutes(+(C.selectedMinutes||0)),C.HTMLInputElement.value=Ct(y,void 0,c)}this._lastClickIsDate&&(this.handleOnDateChange(),C.hide())}}},settings:{lang:p,iso8601:!1,visibility:{theme:(n=this.gridOptions)!=null&&n.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};this.hasTimePicker&&(f.settings.selection={time:24}),this._pickerMergedOptions=de(!0,{},f,{settings:this.editorOptions,type:"default"});const g=`.editor-text.date-picker.editor-${h}.form-control.input-group-editor`;this._editorInputGroupElm=v("div",{className:"vanilla-picker input-group"});const _=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:this.columnEditor&&this.columnEditor.title||"",className:g.replace(/\./g," "),dataset:{input:"",defaultdate:this.defaultDate},readOnly:!0},this._editorInputGroupElm),this.args.container.appendChild(this._editorInputGroupElm),(l=this.columnEditor.editorOptions)!=null&&l.hideClearButton||(_.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(_),this._bindEventService.bind(this._clearButtonElm,"click",()=>{this.clear(),this.handleOnDateChange()})),queueMicrotask(()=>{this.calendarInstance=new gl(this._inputElm,this._pickerMergedOptions),this.calendarInstance.init(),a||(this.show(),this.focus()),this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this.getValue(),newVal:this.defaultDate,updatePickerUI:!0})})}}destroy(){queueMicrotask(()=>{var e,t,i;this.hide(),(e=this.calendarInstance)==null||e.destroy(),J(this._editorInputGroupElm),J(this._inputElm),(t=this._editorInputGroupElm)==null||t.remove(),(i=this._inputElm)==null||i.remove()}),this._bindEventService.unbindAll()}clear(){this._lastTriggeredByClearDate=!0,this.calendarInstance&&(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.setAttribute("disabled","disabled"),this._clearButtonElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._inputElm.removeAttribute("disabled"),this._clearButtonElm.disabled=!1}changeEditorOption(e,t){this.columnEditor.editorOptions||(this.columnEditor.editorOptions={}),this.columnEditor.editorOptions[e]=t,this._pickerMergedOptions=de(!0,{},this._pickerMergedOptions,{settings:{[e]:t}})}focus(){var e;this.grid.focus(),this.show(),(e=this._inputElm)==null||e.focus()}hide(){var e;(e=this.calendarInstance)==null||e.hide()}show(){var t;const e=!!((t=this.args)!=null&&t.compositeEditorOptions);!e&&this.calendarInstance?this.calendarInstance.show():e&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this.getValue(),newVal:e,updatePickerUI:!0}),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(this.columnDef&&i!==void 0){const o=this.columnDef.saveOutputType||this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,l=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,a=i.indexOf(".")>0,h=this.validate(null,t),d=t&&(h!=null&&h.valid)?Ct(t,l,o):"";if(a){const c=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i;$e(e,c,d)}else e[i]=d}}isValueChanged(){let e=!1;const t=this.getValue();return this.columnDef&&(e=this._lastTriggeredByClearDate||!(t===""&&this._originalDate==="")&&t!==this._originalDate),e}isValueTouched(){return this._isValueTouched}loadValue(e){var i,s;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&this.columnDef&&t!==void 0){const o=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t],l=this.columnEditor.type||((s=this.columnDef)==null?void 0:s.type)||S.dateIso,a=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateIso;this._originalDate=Ct(o,l,a),this._inputElm.value=this._originalDate}}reset(e,t=!0,i=!1){const s=e??this._originalDate??"";this.calendarInstance&&(this._originalDate=s,this.calendarInstance.settings.selected.dates=[s],s||(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){const e=this.getValue();return e||""}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t??((l=this._inputElm)==null?void 0:l.value),n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&s===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleOnDateChange(){if(this._isValueTouched=!0,this.args){const e=this.args.compositeEditorOptions;e?this.handleChangeOnCompositeEditor(e):this.save()}setTimeout(()=>this._lastTriggeredByClearDate=!1)}handleChangeOnCompositeEditor(e,t="user",i=!1){var c,u,p;const s=this.grid.getActiveCell(),n=this.args.column,o=((c=this.columnDef)==null?void 0:c.id)??"",l=this.dataContext,a=this.grid,h=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,h),this.applyValue(e.formValues,h);const d=((p=(u=this.gridOptions)==null?void 0:u.compositeEditorOptions)==null?void 0:p.excludeDisabledFieldFormValues)??!1;(i||this.disabled&&d&&e.formValues.hasOwnProperty(o))&&delete e.formValues[o],a.onCompositeEditorChange.notify({...s,item:l,grid:a,column:n,formValues:e.formValues,editors:e.editors,triggeredBy:t},new le)}}function Ra(r,e){const t=isNaN(r)?null:parseFloat(r),i=e.decimal||0,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a=e.errorMessage,h={"{{minValue}}":n,"{{maxValue}}":o,"{{minDecimal}}":0,"{{maxDecimal}}":i};let d=!0,c="";if(typeof e.validator=="function")return e.validator(r,e.editorArgs);if(s&&r==="")d=!1,c=a||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||i===0&&!/^[-+]?(\d*(\.)?(\d)*)$/.test(r)))d=!1,c=a||R.VALIDATION_EDITOR_VALID_NUMBER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))d=!1,c=a||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,u=>h[u]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t<+n)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MIN;c=a||u.replace(/{{minValue}}/gi,p=>h[p])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t>+o)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MAX;c=a||u.replace(/{{maxValue}}/gi,p=>h[p])}else i>0&&!new RegExp(`^[-+]?(\\d*(\\.)?(\\d){0,${i}})$`).test(r)&&(d=!1,c=a||R.VALIDATION_EDITOR_DECIMAL_BETWEEN.replace(/{{minDecimal}}|{{maxDecimal}}/gi,u=>h[u]));return{valid:d,msg:c}}function Aa(r,e){let t=isNaN(r)?null:parseInt(r,10);t!==null&&isNaN(t)&&(t=null);const i=e.errorMessage,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a={"{{minValue}}":n,"{{maxValue}}":o};let h=!0,d="";if(e.validator)return e.validator(r,e.editorArgs);if(s&&r==="")h=!1,d=i||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||!/^[+-]?\d+$/.test(r)))h=!1,d=i||R.VALIDATION_EDITOR_VALID_INTEGER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))h=!1,d=i||R.VALIDATION_EDITOR_INTEGER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,c=>a[c]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t!==null&&t<+n)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MIN;d=i||c.replace(/{{minValue}}/gi,u=>a[u])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t!==null&&t>+o)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MAX;d=i||c.replace(/{{maxValue}}/gi,u=>a[u])}return{valid:h,msg:d}}function Cp(r,e){const t=e.required,i=e.minValue,s=e.maxValue,n=e.errorMessage,o={"{{minValue}}":i,"{{maxValue}}":s};return e.validator?e.validator(r,e.editorArgs):t&&r===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:i!==void 0&&s!==void 0&&r!==null&&(r<i||r>s)?{valid:!1,msg:n||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,l=>o[l])}:{valid:!0,msg:null}}class vp{constructor(e){if(this.args=e,this._isValueSaveCalled=!1,this._isLeftValueTouched=!1,this._isRightValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._eventHandler=new pe,this._bindEventService=new Ae,this.init(),this._eventHandler.subscribe(this.grid.onValidationError,()=>this._isValueSaveCalled=!0)}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return{leftInput:this._leftInput,rightInput:this._rightInput}}get editorParams(){return this.columnEditor.params||{}}get eventHandler(){return this._eventHandler}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get isValueSaveCalled(){return this._isValueSaveCalled}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var i,s,n,o;if(!this.editorParams||!this.editorParams.leftInput||!this.editorParams.leftInput.field||!this.editorParams.rightInput||!this.editorParams.rightInput.field)throw new Error(`[Slickgrid-Universal] Please make sure that your Combo Input Editor has params defined with "leftInput" and "rightInput" (example: { editor: { model: Editors.comboInput, params: { leftInput: { field: 'firstName' }, { rightSide: { field: 'lastName' } }}}`);this._leftFieldName=(i=this.editorParams.leftInput)==null?void 0:i.field,this._rightFieldName=(s=this.editorParams.rightInput)==null?void 0:s.field,this._leftInput=this.createInput("leftInput"),this._rightInput=this.createInput("rightInput");const e=(n=this.args)==null?void 0:n.container;e&&typeof e.appendChild=="function"&&(e.appendChild(this._leftInput),e.appendChild(this._rightInput)),this._bindEventService.bind(this._leftInput,"keydown",l=>this.handleKeyDown(l,"leftInput")),this._bindEventService.bind(this._rightInput,"keydown",l=>this.handleKeyDown(l,"rightInput")),this.hasAutoCommitEdit&&(this._bindEventService.bind(this._leftInput,"focusout",l=>this.handleFocusOut(l,"leftInput")),this._bindEventService.bind(this._rightInput,"focusout",l=>this.handleFocusOut(l,"rightInput"))),((o=this.args)==null?void 0:o.compositeEditorOptions)?(this._bindEventService.bind(this._leftInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this)),this._bindEventService.bind(this._rightInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this))):setTimeout(()=>this._leftInput.select(),50)}handleFocusOut(e,t){var o;const i=((o=e.relatedTarget)==null?void 0:o.className)||"";!this.args.compositeEditorOptions&&i.indexOf("dual-editor")===-1&&this._lastEventType!=="focusout-right"&&(t==="rightInput"||t==="leftInput"&&this._lastEventType!=="focusout-left")&&(t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this.save());const n=t==="leftInput"?"left":"right";this._lastEventType=`${e==null?void 0:e.type}-${n}`}handleKeyDown(e,t){t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this._lastInputKeyEvent=e,(e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="Tab")&&e.stopImmediatePropagation()}destroy(){var e,t,i,s;this._eventHandler.unsubscribeAll(),this._bindEventService.unbindAll(),(t=(e=this._leftInput)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._rightInput)==null?void 0:i.remove)==null||s.call(i)}createInput(e){var a,h,d,c;const t=this.editorParams[e],i=((a=this.columnDef)==null?void 0:a.id)??"",s=this.gridOptions.datasetIdPropertyName||"id",n=((d=(h=this.args)==null?void 0:h.item)==null?void 0:d[s])??"";let o=t.type||"text";(o==="float"||o==="integer")&&(o="number");const l=v("input",{type:o||"text",id:`item-${n}-${e}`,ariaLabel:((c=this.columnEditor)==null?void 0:c.ariaLabel)??`${_t(i+"")} Input Editor`,className:`dual-editor-text editor-${i} ${e.replace(/input/gi,"")}`,autocomplete:"off",ariaAutoComplete:"none",placeholder:t.placeholder||"",title:t.title||""});return o==="readonly"&&(l.readOnly=!0,o="text"),o==="number"&&(l.step=this.getInputDecimalSteps(e)),l}disable(e=!0){var i;const t=this.disabled;this.disabled=e,this._leftInput&&this._rightInput&&(e?(this._leftInput.setAttribute("disabled","disabled"),this._rightInput.setAttribute("disabled","disabled"),t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&this.reset("",!0,!0)):(this._leftInput.removeAttribute("disabled"),this._rightInput.removeAttribute("disabled")))}focus(){this.grid.focus()}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValues(){const e={},t=this._leftInput.value,i=this._rightInput.value,s=this.editorParams.leftInput&&(this.editorParams.leftInput.type==="float"||this.editorParams.leftInput.type==="integer"),n=this.editorParams.rightInput&&(this.editorParams.rightInput.type==="float"||this.editorParams.rightInput.type==="integer"),o=t!==""&&s?+this._leftInput.value:t||"",l=i!==""&&n?+this._rightInput.value:i||"";return $e(e,this._leftFieldName,o),$e(e,this._rightFieldName,l),e}setValues(e){Array.isArray(e)&&e.length===2&&(this._leftInput.value=`${e[0]}`,this._rightInput.value=`${e[1]}`)}applyValue(e,t){this.applyValueByPosition(e,t,"leftInput"),this.applyValueByPosition(e,t,"rightInput")}applyValueByPosition(e,t,i){var n;const s=i==="leftInput"?this._leftFieldName:this._rightFieldName;if(s!==void 0){const o=(s==null?void 0:s.indexOf("."))>0;let l=s;if(o){const d=s.split(/\.(.*)/);l=d.length>1?d[1]:d}const a=o?Ee(t,l):t[s],h=this.validate(null,{position:i,inputValue:a});if(o){const d=Ee(t,l),c=h&&h.valid?d:"",u=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??s??"";$e(e,u,c)}else s&&(e[s]=h&&h.valid?t[s]:"")}}isValueChanged(){var a,h,d;const e=this._leftInput.value,t=this._rightInput.value,i=(a=this.editorParams)==null?void 0:a.leftInput,s=(h=this.editorParams)==null?void 0:h.rightInput,n=(d=this._lastInputKeyEvent)==null?void 0:d.key;if((i&&i.alwaysSaveOnEnterKey||s&&s.alwaysSaveOnEnterKey)&&n==="Enter")return!0;const o=!(e===""&&(this._originalLeftValue===null||this._originalLeftValue===void 0))&&e!==this._originalLeftValue,l=!(t===""&&(this._originalRightValue===null||this._originalRightValue===void 0))&&t!==this._originalRightValue;return o||l}isValueTouched(){return this._isLeftValueTouched||this._isRightValueTouched}loadValue(e){this.loadValueByPosition(e,"leftInput"),this.loadValueByPosition(e,"rightInput"),this._leftInput.select()}loadValueByPosition(e,t){const i=t==="leftInput"?this._leftFieldName:this._rightFieldName,s=t==="leftInput"?"_originalLeftValue":"_originalRightValue",n=t==="leftInput"?"_leftInput":"_rightInput";if(e&&i!==void 0){const l=(i==null?void 0:i.indexOf("."))>0?Ee(e,i):e.hasOwnProperty(i)?e[i]:"";if(this[s]=l,this.editorParams[t].type==="float"){const a=this.getDecimalPlaces(t);a!==null&&(this[s]||this[s]===0)&&this[s]!==void 0&&(this[s]=(+this[s]).toFixed(a))}this[n]&&(this[n].value=`${this[s]}`)}}reset(e,t=!0,i=!1){const s=e??this._originalLeftValue??"",n=e??this._originalRightValue??"";this._leftInput&&this._rightInput&&(this._originalLeftValue=s,this._originalRightValue=n,this._leftInput.value=`${s}`,this._rightInput.value=`${n}`),this._isLeftValueTouched=!1,this._isRightValueTouched=!1;const o=this.args.compositeEditorOptions;if(o&&t){const l=!i;this.handleChangeOnCompositeEditor(null,o,"user",l)}}save(){const e=this.validate(),t=e&&e.valid||!1;this._isValueSaveCalled||(this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges(),this._isValueSaveCalled=!0)}serializeValue(){const e={},t=this.serializeValueByPosition("leftInput"),i=this.serializeValueByPosition("rightInput");return $e(e,this._leftFieldName,t),$e(e,this._rightFieldName,i),e}serializeValueByPosition(e){const t=e==="leftInput"?this._leftInput.value:this._rightInput.value;if(t===""||isNaN(+t))return t;let i=parseFloat(t);const s=this.getDecimalPlaces(e);return s!==null&&(i||i===0)&&i.toFixed&&(i=parseFloat(i.toFixed(s))),i}getDecimalPlaces(e){const i=e==="leftInput"?"leftInput":"rightInput",s=this.editorParams[i],n=s==null?void 0:s.decimal;return n===void 0?0:n}getInputDecimalSteps(e){const t=this.getDecimalPlaces(e);let i="";for(let s=1;s<t;s++)i+="0";return t>0?`0.${i}1`:"1"}validate(e,t){if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};if(t){const i=this.validateByPosition(t.position,t.inputValue);if(!i.valid)return t.position==="leftInput"?this._leftInput.select():this._rightInput.select(),i}else{const i=this.validateByPosition("leftInput"),s=this.validateByPosition("rightInput");if(!i.valid)return this._leftInput.select(),i;if(!s.valid)return this._rightInput.select(),s}return{valid:!0,msg:""}}validateByPosition(e,t){var l;const i=this.editorParams[e];let s="";if(t)s=t;else{const a=e==="leftInput"?this._leftInput:this._rightInput;s=a&&a.value}const n=this.validator;s=typeof n=="function"?this.getValues():s;const o={editorArgs:this.args,errorMessage:i.errorMessage,required:(l=this.args)!=null&&l.compositeEditorOptions?!1:i.required,validator:typeof n=="function"?n:i.validator};switch(i.type){case"float":return Ra(s,{...o,decimal:this.getDecimalPlaces(e),minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"integer":return Aa(s,{...o,minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"text":case"password":default:return Ks(s,o)}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var p,m,f,g,_,b;const n=this.grid.getActiveCell(),o=this.args.column,l=((m=(p=this.columnEditor.params)==null?void 0:p.leftInput)==null?void 0:m.field)??"",a=((g=(f=this.columnEditor.params)==null?void 0:f.rightInput)==null?void 0:g.field)??"",h=this.dataContext,d=this.grid,c=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,c),this.applyValue(t.formValues,c);const u=((b=(_=this.gridOptions)==null?void 0:_.compositeEditorOptions)==null?void 0:b.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&u&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],(s||this.disabled&&u&&t.formValues.hasOwnProperty(a))&&delete t.formValues[a],d.onCompositeEditorChange.notify({...n,item:h,grid:d,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleChangeOnCompositeEditorDebounce(e){var i,s;const t=(i=this.args)==null?void 0:i.compositeEditorOptions;if(t){const n=((s=this.gridOptions)==null?void 0:s.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),n)}}}const bp=0;class Qs{constructor(e,t="text"){if(this.args=e,this._inputType="text",this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=e.grid&&e.grid.getOptions(),this._bindEventService=new Ae,this.inputType=t,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._input=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Input Editor`,className:`editor-text editor-${e}`,placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:((l=this.columnEditor)==null?void 0:l.title)??""}),this.inputType==="number"&&(this._input.step=`${this.columnEditor.valueStep!==void 0?this.columnEditor.valueStep:this.getInputDecimalSteps()}`);const i=this.args.container;i&&typeof i.appendChild=="function"&&i.appendChild(this._input),this._bindEventService.bind(this._input,"focus",()=>{var a;return(a=this._input)==null?void 0:a.select()}),this._bindEventService.bind(this._input,"keydown",a=>{this._isValueTouched=!0,this._lastInputKeyEvent=a,(a.key==="ArrowLeft"||a.key==="ArrowRight")&&a.stopImmediatePropagation()}),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,["focusout","blur"],()=>{this._isValueTouched=!0,this.save()}),t&&(this._bindEventService.bind(this._input,["input","paste"],this.handleOnInputChange.bind(this)),this.inputType==="number"&&this._bindEventService.bind(this._input,"wheel",this.handleOnMouseWheel.bind(this),{passive:!0}))}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._input.removeAttribute("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}getDecimalPlaces(){var t,i,s;let e=((t=this.columnEditor)==null?void 0:t.decimal)??((s=(i=this.columnEditor)==null?void 0:i.params)==null?void 0:s.decimalPlaces)??void 0;return e===void 0&&(e=bp),!e&&e!==0?null:e}getInputDecimalSteps(){const e=this.getDecimalPlaces();let t="";for(let i=1;i<e;i++)t+="0";return e>0?`0.${t}1`:"1"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.value)||""}setValue(e,t=!1,i=!0){if(this._input&&(this._input.value=`${e}`,t)){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o!=null&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else i&&(e[i]=l)}}isValueChanged(){var i,s,n;const e=(i=this._input)==null?void 0:i.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;return(n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter"?!0:!(e===""&&(this._originalValue===null||this._originalValue===void 0))&&e!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e.hasOwnProperty(t)&&e[t]||"";this._originalValue=n,this._input.value=this._originalValue,this._input.select()}}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._input&&(this._originalValue=s,this._input.value=`${s}`),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.value)??""}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this._input&&this._input.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleOnInputChange(e){var i;this._isValueTouched=!0;const t=this.args.compositeEditorOptions;if(t){const s=((i=this.gridOptions)==null?void 0:i.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),s)}}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class Sp extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(t!==void 0&&e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s;const n=this.getDecimalPlaces();n!==null&&(this._originalValue||this._originalValue===0)&&this._originalValue!==void 0&&(this._originalValue=(+this._originalValue).toFixed(n)),this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var s;const e=(s=this._input)==null?void 0:s.value;if(e===void 0||e===""||isNaN(+e))return e;let t=parseFloat(e);const i=this.getDecimalPlaces();return i!==null&&(t||t===0)&&t.toFixed&&(t=parseFloat(t.toFixed(i))),t}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._input)==null?void 0:s.value;return Ra(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,decimal:this.getDecimalPlaces(),minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}}class yp extends Qs{constructor(e){super(e,"password"),this.args=e}}class Ep extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(t!==void 0&&e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=isNaN(n)||n===null||n===void 0?n:`${n}`,this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var i;const e=(i=this._input)==null?void 0:i.value;if(e===void 0||e===""||isNaN(+e))return e;const t=isNaN(+e)?e:parseInt(e,10);return isNaN(+t)?e:t}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this.getValue();return Aa(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class wp{constructor(e){var i,s;if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=(i=e.grid)==null?void 0:i.getOptions();const t=this.gridOptions||this.args.column.params||{};t!=null&&t.translater&&(this._translater=t.translater),this._locales=((s=this.gridOptions)==null?void 0:s.locales)||R.locales,this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this._textareaElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.longText,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){var e;return((e=this.gridOptions)==null?void 0:e.autoCommitEdit)??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var d,c,u,p,m,f,g,_,b,C,E,y,T,x,O;let e="",t="";if(this._translater&&this._translater.translate&&this.gridOptions.enableTranslate){const I=ot(this.gridOptions),A=((d=this.editorOptions.buttonTexts)==null?void 0:d.cancelKey)??`${I}CANCEL`,k=((c=this.editorOptions.buttonTexts)==null?void 0:c.saveKey)??`${I}SAVE`;e=this._translater.translate(`${I}${A}`),t=this._translater.translate(`${I}${k}`)}else e=((u=this.editorOptions.buttonTexts)==null?void 0:u.cancel)??((p=this._locales)==null?void 0:p.TEXT_CANCEL)??"Cancel",t=((m=this.editorOptions.buttonTexts)==null?void 0:m.save)??((f=this._locales)==null?void 0:f.TEXT_SAVE)??"Save";const i=this.args.compositeEditorOptions,s=((g=this.columnDef)==null?void 0:g.id)??"",n=(_=this.columnEditor)==null?void 0:_.maxLength,o=((b=this.editorOptions)==null?void 0:b.rows)??4,l=i?this.args.container:document.body;this._wrapperElm=v("div",{className:`slick-large-editor-text editor-${s}`,style:{position:i?"relative":"absolute"}}),(C=this.gridOptions)!=null&&C.darkMode&&this._wrapperElm.classList.add("slick-dark-mode"),l.appendChild(this._wrapperElm),this._textareaElm=v("textarea",{ariaLabel:((E=this.columnEditor)==null?void 0:E.ariaLabel)??`${_t(s+"")} Text Editor`,cols:((y=this.editorOptions)==null?void 0:y.cols)??40,rows:i&&o>3?3:o,placeholder:((T=this.columnEditor)==null?void 0:T.placeholder)??"",title:((x=this.columnEditor)==null?void 0:x.title)??""},this._wrapperElm);const a=v("div",{className:"editor-footer"}),h=v("span",{className:"counter"});if(this._currentLengthElm=v("span",{className:"text-length",textContent:"0"}),h.appendChild(this._currentLengthElm),n!==void 0&&(h.appendChild(v("span",{className:"separator",textContent:"/"})),h.appendChild(v("span",{className:"max-length",textContent:`${n}`}))),a.appendChild(h),!i){const I=v("button",{className:"btn btn-cancel btn-default btn-xs",textContent:e},a),A=v("button",{className:"btn btn-save btn-primary btn-xs",textContent:t},a);this._bindEventService.bind(I,"click",this.cancel.bind(this)),this._bindEventService.bind(A,"click",this.save.bind(this)),this.position((O=this.args)==null?void 0:O.position),this._textareaElm.focus(),this._textareaElm.select()}this._wrapperElm.appendChild(a),this._bindEventService.bind(this._textareaElm,"keydown",this.handleKeyDown.bind(this)),this._bindEventService.bind(this._textareaElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._textareaElm,"paste",this.handleOnInputChange.bind(this))}cancel(){var t;const e=this._defaultTextValue||"";this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,(t=this.args)!=null&&t.cancelChanges&&this.args.cancelChanges()}hide(){this._wrapperElm.style.display="none"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)?this.applyInputUsabilityState():this._wrapperElm.style.display="block"}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._wrapperElm)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._textareaElm&&this._wrapperElm)if(e){this._textareaElm.disabled=!0,this._wrapperElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._textareaElm.disabled=!1,this._wrapperElm.classList.remove("disabled")}focus(){this.grid.focus(),this._textareaElm&&(this._textareaElm.focus(),this._textareaElm.select())}getValue(){return this._textareaElm.value}setValue(e,t=!1,i=!0){if(this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(i!==void 0){const o=(i==null?void 0:i.indexOf("."))>0,l=this.validate(void 0,t),a=l!=null&&l.valid?t:"";if(o){const h=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i??"";$e(e,h,a)}else e[i]=a}}isValueChanged(){const e=this._textareaElm.value;return!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._defaultTextValue=n||"",this._textareaElm.value=this._defaultTextValue,this._currentLengthElm.textContent=this._defaultTextValue.length,this._textareaElm.defaultValue=this._defaultTextValue,this._textareaElm.select()}}position(e){var u,p;const t=me(this.args.container),i=this.args.container.offsetHeight,s=this.args.container.offsetWidth,n=this._wrapperElm.getBoundingClientRect().height||this.args.position.height,o=this._wrapperElm.getBoundingClientRect().width||this.args.position.width,l=document.body.offsetHeight||window.innerHeight,a=document.body.offsetWidth||window.innerWidth;let h=(t==null?void 0:t.top)??e.top??0,d=(t==null?void 0:t.left)??e.left??0;const c=((u=this.editorOptions)==null?void 0:u.position)??"auto";if(c==="left"||c==="auto"&&d+o>a){const m=((p=this.editorOptions)==null?void 0:p.marginRight)??0;d-=o-s+m}(c==="top"||c==="auto"&&h+n>l)&&(h-=n-i),this._wrapperElm.style.top=`${h}px`,this._wrapperElm.style.left=`${d}px`}reset(e,t=!0,i=!1){const s=e??this._defaultTextValue??"";this._textareaElm&&(this._defaultTextValue=s,this._textareaElm.value=s,this._currentLengthElm.textContent=s.length),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){return this._textareaElm.value}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._textareaElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleKeyDown(e){const t=e.key;this._isValueTouched=!0,this.args.compositeEditorOptions||(t==="Enter"&&e.ctrlKey||e.ctrlKey&&e.key.toUpperCase()==="S"?(e.preventDefault(),this.save()):t==="Escape"?(e.preventDefault(),this.cancel()):t==="Tab"&&e.shiftKey?(e.preventDefault(),this.args&&this.grid&&this.grid.navigatePrev()):t==="Tab"&&(e.preventDefault(),this.args&&this.grid&&this.grid.navigateNext()))}handleOnInputChange(e){var n,o;const t=this.args.compositeEditorOptions,i=(n=this.columnEditor)==null?void 0:n.maxLength;let s=!1;if(i&&(s=this.truncateText(this._textareaElm,i)),s)this._currentLengthElm.textContent=`${i}`;else{const l=e.type==="paste"?e.clipboardData.getData("text"):e.target.value;this._currentLengthElm.textContent=`${l.length}`}if(t){const l=((o=this.gridOptions)==null?void 0:o.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),l)}}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}truncateText(e,t){const i=e.value+"";return i.length>t?(e.value=i.substring(0,t),!0):!1}}class Pa{constructor(e,t,i=-1){var l,a,h,d,c,u,p,m,f;if(this.args=e,this.isMultipleSelect=t,this.delayOpening=i,this._isValueTouched=!1,this._isDisposingOrCallingSave=!1,this.disabled=!1,this.enableTranslateLabel=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(l=this.gridOptions)!=null&&l.translater&&(this._translaterService=this.gridOptions.translater),this._locales=this.gridOptions.locales||R.locales;const s=((a=this.columnDef)==null?void 0:a.id)??"";this.elementName=`editor-${s}`;const n=this.args.compositeEditorOptions,o={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,minHeight:25,name:this.elementName,single:!0,singleRadio:!0,renderOptionLabelAsHtml:((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,sanitizer:g=>this.grid.sanitizeHtmlString(g),onClick:()=>this._isValueTouched=!0,onCheckAll:()=>this._isValueTouched=!0,onUncheckAll:()=>this._isValueTouched=!0,onClose:g=>{if(g==="key.escape"||g==="body.click"||!this.hasAutoCommitEdit&&!this.isValueChanged()){g==="key.escape"&&this.cancel();return}n?this.handleChangeOnCompositeEditor(n):(this._isDisposingOrCallingSave=!0,this.save(this.hasAutoCommitEdit))}};if(t)if(o.single=!1,o.singleRadio=!1,o.displayTitle=!0,o.showOkButton=!0,(d=this._translaterService)!=null&&d.getCurrentLanguage()){const g=ot(this.gridOptions);o.countSelectedText=this._translaterService.translate(`${g}X_OF_Y_SELECTED`),o.allSelectedText=this._translaterService.translate(`${g}ALL_SELECTED`),o.selectAllText=this._translaterService.translate(`${g}SELECT_ALL`),o.okButtonText=this._translaterService.translate(`${g}OK`),o.noMatchesFoundText=this._translaterService.translate(`${g}NO_MATCHES_FOUND`)}else o.countSelectedText=(c=this._locales)==null?void 0:c.TEXT_X_OF_Y_SELECTED,o.allSelectedText=(u=this._locales)==null?void 0:u.TEXT_ALL_SELECTED,o.selectAllText=(p=this._locales)==null?void 0:p.TEXT_SELECT_ALL,o.okButtonText=(m=this._locales)==null?void 0:m.TEXT_OK,o.noMatchesFoundText=(f=this._locales)==null?void 0:f.TEXT_NO_MATCHES_FOUND;this.defaultOptions=o,this.init()}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get collectionOptions(){var e;return(e=this.columnEditor)==null?void 0:e.collectionOptions}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this.editorElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.select,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get isCompositeEditor(){var e;return!!((e=this.args)!=null&&e.compositeEditorOptions)}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.editor)==null?void 0:t.customStructure}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get currentValues(){var s,n,o;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[];if(this.collection.every(l=>typeof l=="number"||typeof l=="string"))return this.collection.filter(l=>e==null?void 0:e.some(a=>`${a}`===(l==null?void 0:l.toString())));const t=((n=this.collectionOptions)==null?void 0:n.separatorBetweenTextLabels)??"",i=((o=this.collectionOptions)==null?void 0:o.includePrefixSuffixToSelectedValues)??!1;return this.collection.filter(l=>e.some(a=>{var h;return`${a}`===((h=l==null?void 0:l[this.valueName])==null?void 0:h.toString())})).map(l=>{var m,f;const a=l[this.valueName];let h=l[this.labelPrefixName]||"",d=l[this.labelSuffixName]||"";const c=((m=this.columnDef)==null?void 0:m.field)??"",u=(c==null?void 0:c.indexOf("."))>0,p=((f=this.columnEditor)==null?void 0:f.serializeComplexValueFormat)??"object";return u&&typeof l=="object"&&p==="object"?l:(h=this.enableTranslateLabel&&this._translaterService&&h&&typeof h=="string"?this._translaterService.translate(h||" "):h,d=this.enableTranslateLabel&&this._translaterService&&d&&typeof d=="string"?this._translaterService.translate(d||" "):d,i?[h,a,d].filter(_=>_).join(t):a)})}get currentValue(){var s,n,o,l,a;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[],t=e.length?e[0]:"",i=(n=this.columnDef)==null?void 0:n.field;if(i!==void 0){if(this.collection.every(m=>typeof m=="number"||typeof m=="string"))return xt(this.collection,m=>{var f;return((f=m==null?void 0:m.toString)==null?void 0:f.call(m))===`${t}`});const h=((o=this.collectionOptions)==null?void 0:o.separatorBetweenTextLabels)??"",d=((l=this.collectionOptions)==null?void 0:l.includePrefixSuffixToSelectedValues)??!1,c=xt(this.collection,m=>{var f;return m.hasOwnProperty(this.valueName)&&((f=m[this.valueName])==null?void 0:f.toString())===`${t}`}),u=(i==null?void 0:i.indexOf("."))>0,p=((a=this.columnEditor)==null?void 0:a.serializeComplexValueFormat)??"object";if(u&&typeof c=="object"&&p==="object")return c;if(c&&c.hasOwnProperty(this.valueName)){const m=c[this.valueName];if(d){let f=c[this.labelPrefixName]||"",g=c[this.labelSuffixName]||"";return f=this.enableTranslateLabel&&this._translaterService&&f&&typeof f=="string"?this._translaterService.translate(f||" "):f,g=this.enableTranslateLabel&&this._translaterService&&g&&typeof g=="string"?this._translaterService.translate(g||" "):g,[f,m,g].filter(b=>b).join(h)}return m}}return""}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var e,t,i,s,n,o,l;if(!this.columnDef||!this.columnDef.editor||!this.columnDef.editor.collection&&!this.columnDef.editor.collectionAsync)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") inside Column Definition Editor for the MultipleSelect/SingleSelect Editor to work correctly.
16
+ You can fix this by setting your gridOption.autoResize.container`);this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>this.resizeObserverCallback())),this._resizeObserver.observe(this._pageContainerElm)}else{if(this._gridDomElm===void 0||me(this._gridDomElm)===void 0)return null;this.resizeGrid().then(()=>this.resizeGridWhenStylingIsBrokenUntilCorrected()).catch(i=>console.log("Error:",i)),this.resizeGrid(10,e),this._bindingEventService.bind(window,"resize",this.handleResizeGrid.bind(this,e))}}handleResizeGrid(e){this.pubSubService.publish("onGridBeforeResize"),this._resizePaused||(this.resizeGrid(0,e),this.resizeGrid(0,e))}resizeObserverCallback(){this._resizePaused||this.resizeGrid()}calculateGridNewDimensions(e){var f,g;const t=(e==null?void 0:e.autoResize)??{},i=me(this._gridDomElm);if(!window||i===void 0)return null;let s=(t==null?void 0:t.bottomPadding)!==void 0?t.bottomPadding:bu;if(s&&e.enablePagination&&(s+=yu),s&&e.showCustomFooter){const _=((g=(f=this.gridOptions)==null?void 0:f.customFooterOptions)==null?void 0:g.footerHeight)??Su;s+=parseInt(`${_}`,10)}let n=0,o=0;t.calculateAvailableSizeBy==="container"?n=ds(this._pageContainerElm,"height")||0:(n=window.innerHeight||0,o=(i==null?void 0:i.top)??0);const l=n-o-s,a=ds(this._pageContainerElm,"width")||window.innerWidth||0,h=t==null?void 0:t.maxHeight,d=(t==null?void 0:t.minHeight)??Eu,c=t==null?void 0:t.maxWidth,u=(t==null?void 0:t.minWidth)??wu;let p=l,m=t!=null&&t.rightPadding?a-t.rightPadding:a;return p<d&&(p=d),h&&p>h&&(p=h),m<u&&(m=u),c&&m>c&&(m=c),{height:this._fixedHeight||p,width:this._fixedWidth||m}}getLastResizeDimensions(){return this._lastDimensions}pauseResizer(e){this._resizePaused=e}resizeGrid(e,t){return new Promise(i=>{e=e||0,e>0?(clearTimeout(this._timer),this._timer=setTimeout(()=>i(this.resizeGridCallback(t)),e)):i(this.resizeGridCallback(t))})}resizeGridCallback(e){var i,s;const t=this.resizeGridWithDimensions(e);return this.pubSubService.publish("onGridAfterResize",t),this.gridOptions.enableAutoResizeColumnsByCellContent&&(!((i=this._lastDimensions)!=null&&i.width)||(t==null?void 0:t.width)!==((s=this._lastDimensions)==null?void 0:s.width))&&this.resizeColumnsByCellContent(!1),this._lastDimensions=t,t}resizeGridWithDimensions(e){var i,s,n,o;const t=this.calculateGridNewDimensions(this.gridOptions);if((e||t)&&this._gridDomElm){const l=e!=null&&e.height?e.height:t==null?void 0:t.height,a=e!=null&&e.width?e.width:t==null?void 0:t.width;this.gridOptions.autoHeight||(this._gridDomElm.style.height=`${l}px`),this._gridDomElm.style.width=`${a}px`,this._gridContainerElm&&(this._gridContainerElm.style.width=`${a}px`),(i=this._grid)!=null&&i.resizeCanvas&&this._gridContainerElm&&this._grid.resizeCanvas(),this._grid&&((s=this.gridOptions)!=null&&s.enableAutoSizeColumns)?this.gridUid&&document.querySelector(this.gridUidSelector)&&(!this._lastDimensions||this._lastDimensions.height!==l||this._lastDimensions.width!==a)&&this._grid.autosizeColumns():this.gridOptions.enableAutoResizeColumnsByCellContent&&(!((n=this._lastDimensions)!=null&&n.width)||a!==((o=this._lastDimensions)==null?void 0:o.width))&&this.resizeColumnsByCellContent(!1),this._lastDimensions={height:l||0,width:a||0}}return this._lastDimensions}requestStopOfAutoFixResizeGrid(e=!0){this._isStopResizeIntervalRequested=e}resizeColumnsByCellContent(e=!1){var h,d;const t=this._grid.getColumns(),i=this.dataView.getItems(),s={};let n=!1,o=0;const l=((h=this._gridContainerElm)==null?void 0:h.offsetWidth)??0;if(!Array.isArray(i)||i.length===0||!e&&this._totalColumnsWidthByContent>0&&this._totalColumnsWidthByContent<l){this._grid.autosizeColumns();return}if(this._hasResizedByContentAtLeastOnce&&((d=this.gridOptions)!=null&&d.resizeByContentOnlyOnFirstLoad)&&!e)return;if(this.pubSubService.publish("onBeforeResizeByContent",void 0,0),this._totalColumnsWidthByContent===0||e){for(const u of t)s[u.id]=u.originalWidth??u.minWidth??0;o=this.calculateCellWidthByReadingDataset(t,s,this.resizeByContentOptions.maxItemToInspectCellContentWidth);let c=0;for(const u of t){const p=u.resizeAlwaysRecalculateWidth??this.resizeByContentOptions.alwaysRecalculateColumnWidth??!1;u.originalWidth&&!p?u.width=u.originalWidth:s[u.id]!==void 0&&(u.rerenderOnResize&&(n=!0),this.applyNewCalculatedColumnWidthByReference(u,s[u.id])),c+=u.width||0,this._totalColumnsWidthByContent=c}}this._grid.setColumns(t),this._hasResizedByContentAtLeastOnce=!0;const a={};for(const c of t)a[c.id]=c.width;this._totalColumnsWidthByContent>l?this._grid.reRenderColumns(n):this._grid.autosizeColumns(),this.pubSubService.publish("onAfterResizeByContent",{readItemCount:o,calculateColumnWidths:a})}calculateCellWidthByReadingDataset(e,t,i=1e3,s){const n=Array.isArray(e)?e:[e],o=this.dataView.getItems();let l=0;for(const[a,h]of o.entries()){if(a>i)break;Array.isArray(n)&&typeof t=="object"&&n.forEach((d,c)=>{const u=this.calculateCellWidthByContent(h,d,a,s??c,t[d.id]);u!==void 0&&(t[d.id]=u)}),l=a+1}return l}calculateCellWidthByContent(e,t,i,s,n){const o=this.resizeByContentOptions.cellCharWidthInPx??7;if(!t.originalWidth){const l=(t==null?void 0:t.resizeCharWidthInPx)??o,a=zs(t==null?void 0:t.formatter,i,s,t,e,this._grid),h=Zt(a)?we(a):"",d=Math.ceil(h.length*l),c=t.resizeMaxWidthThreshold;t&&(n===void 0||d>n)&&(n=c!==void 0&&d>c?c:t.maxWidth!==void 0&&d>t.maxWidth?t.maxWidth:d)}return n}applyNewCalculatedColumnWidthByReference(e,t){var a;const i=this.resizeByContentOptions.cellPaddingWidthInPx??6,s=this.resizeByContentOptions.formatterPaddingWidthInPx??6,n=((a=e==null?void 0:e.filter)==null?void 0:a.type)??(e==null?void 0:e.type)??S.string;let o=t;const l=(e==null?void 0:e.resizeCalcWidthRatio)??this.resizeByContentOptions.defaultRatioForStringType??.9;o*=n==="string"?l:1,o+=i,e.resizeExtraWidthPadding&&(o+=e.resizeExtraWidthPadding),e.editor&&this.gridOptions.editable&&(o+=s),e.maxWidth!==void 0&&o>e.maxWidth&&(o=e.maxWidth),e.resizeMaxWidthThreshold!==void 0&&o>e.resizeMaxWidthThreshold&&(o=e.resizeMaxWidthThreshold),o=Math.ceil(o),(e.originalWidth===void 0||e.resizeAlwaysRecalculateWidth===!0||this.resizeByContentOptions.alwaysRecalculateColumnWidth===!0)&&(e.width=this.readjustNewColumnWidthWhenOverLimit(e,o))}handleSingleColumnResizeByContent(e){const t=this._grid.getColumns(),i=t.findIndex(s=>s.id===e);if(i>=0){const s=t[i],n={[e]:s.originalWidth??s.minWidth??0};s.originalWidth=void 0,this.calculateCellWidthByReadingDataset(s,n,this.resizeByContentOptions.maxItemToInspectSingleColumnWidthByContent,i),this.applyNewCalculatedColumnWidthByReference(s,n[e]),this._grid.reRenderColumns((s==null?void 0:s.rerenderOnResize)??!1)}}readjustNewColumnWidthWhenOverLimit(e,t){var o,l;const i=this.gridOptions.frozenColumn??-1,s=this._grid.getColumns().findIndex(a=>a.id===e.id)??0;let n=t;if(i>=0&&s<=i){const a=Array.from(this._grid.getViewports());if(a){const h=((o=a.find(m=>m.classList.contains("slick-viewport-left")))==null?void 0:o.clientWidth)??0,d=((l=a.find(m=>m.classList.contains("slick-viewport-right")))==null?void 0:l.clientWidth)??0,c=h+d,u=h-(e.width??0);if(u+t>c){const m=this.resizeByContentOptions.widthToRemoveFromExceededWidthReadjustment??50;n=h-u+d-m}}}return Math.ceil(n)}checkIsGridShown(){var e;return!!(((e=document.querySelector(`${this.gridUidSelector}`))==null?void 0:e.offsetParent)??!1)}resizeGridWhenStylingIsBrokenUntilCorrected(){var l,a;const e=((l=this.gridOptions)==null?void 0:l.autoFixResizeTimeout)??18e3,t=((a=this.gridOptions)==null?void 0:a.autoFixResizeRequiredGoodCount)??5,i=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-header`),s=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-viewport`);let n=0,o=0;if(i&&s&&this.gridOptions.autoFixResizeWhenBrokenStyleDetected){const h=this.dataView.getItemCount(),d=this._grid.getColumns()||[];this._intervalId=setInterval(async()=>{var C,E,y;const u=me(i);let p=(u==null?void 0:u.top)??0;(C=this.gridOptions)!=null&&C.enableFiltering&&this.gridOptions.headerRowHeight&&(p+=this.gridOptions.headerRowHeight),(E=this.gridOptions)!=null&&E.createPreHeaderPanel&&this.gridOptions.showPreHeaderPanel&&this.gridOptions.preHeaderPanelHeight&&(p+=this.gridOptions.preHeaderPanelHeight),p+=44;const m=me(s),f=(m==null?void 0:m.top)??0,g=me(this._gridContainerElm);let _=(u==null?void 0:u.top)===0||p-f>2||(g==null?void 0:g.left)===0&&(g==null?void 0:g.top)===0;const b=((y=this._grid.getRenderedRange())==null?void 0:y.rightPx)??0;!_&&h>0&&b===0&&d.length>1&&(_=!0),this._isStopResizeIntervalRequested&&(_=!1,n=e),this.checkIsGridShown()&&(_||(g==null?void 0:g.left)===0||(g==null?void 0:g.top)===0)&&(await this.resizeGrid(),o<5&&this._grid.updateColumns(),this.checkIsGridShown()&&(_=!1)),this.checkIsGridShown()&&o++,this.checkIsGridShown()&&!_&&(o>=t||n++>=e)&&clearInterval(this._intervalId)},this.intervalRetryDelay)}}}class xu{constructor(){this._hasColumnsReordered=!1,this._hideHeaderRowAfterPageLoad=!1}get allColumns(){return this._allColumns}set allColumns(e){this._allColumns=e}get columnDefinitions(){var e;return((e=this._grid)==null?void 0:e.getColumns())??[]}get currentPagination(){return this._currentPagination}set currentPagination(e){this._currentPagination=e}get dataView(){return this._dataView}set dataView(e){this._dataView=e}get frozenVisibleColumnId(){return this._frozenVisibleColumnId}set frozenVisibleColumnId(e){this._frozenVisibleColumnId=e}get hasColumnsReordered(){return this._hasColumnsReordered}set hasColumnsReordered(e){this._hasColumnsReordered=e}get slickGrid(){return this._grid}set slickGrid(e){this._grid=e}get gridContainerElement(){return this._gridContainerElm}set gridContainerElement(e){this._gridContainerElm=e}get gridOptions(){var e;return this._gridOptions||((e=this._grid)==null?void 0:e.getOptions())||{}}set gridOptions(e){this._gridOptions=e}get groupItemMetadataProvider(){return this._groupItemMetadataProvider}set groupItemMetadataProvider(e){this._groupItemMetadataProvider=e}get hideHeaderRowAfterPageLoad(){return this._hideHeaderRowAfterPageLoad}set hideHeaderRowAfterPageLoad(e){this._hideHeaderRowAfterPageLoad=e}get externalRegisteredResources(){return this._externalRegisteredResources}set externalRegisteredResources(e){this._externalRegisteredResources=e}get visibleColumns(){return this._visibleColumns}set visibleColumns(e){this._visibleColumns=e}get hierarchicalDataset(){return this._hierarchicalDataset}set hierarchicalDataset(e){this._hierarchicalDataset=e}}class Iu{constructor(e,t,i,s){this.sharedService=e,this.pubSubService=t,this.backendUtilities=i,this.rxjs=s,this._currentLocalSorters=[],this._isBackendGrid=!1,this._eventHandler=new pe,this.rxjs&&(this.httpCancelRequests$=this.rxjs.createSubject())}get eventHandler(){return this._eventHandler}get _gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}get _columnDefinitions(){var e;return((e=this._grid)==null?void 0:e.getColumns())??[]}dispose(){var e,t;(e=this._eventHandler)!=null&&e.unsubscribeAll&&this._eventHandler.unsubscribeAll(),this.httpCancelRequests$&&((t=this.rxjs)!=null&&t.isObservable(this.httpCancelRequests$))&&(this.httpCancelRequests$.next(),this.httpCancelRequests$.complete())}addRxJsResource(e){this.rxjs=e}bindBackendOnSort(e){this._isBackendGrid=!0,this._grid=e,this._dataView=e==null?void 0:e.getData(),this._eventHandler.subscribe(e.onSort,this.onBackendSortChanged.bind(this))}bindLocalOnSort(e){this._isBackendGrid=!1,this._grid=e,this._dataView=e==null?void 0:e.getData(),this.processTreeDataInitialSort(),this._eventHandler.subscribe(e.onSort,this.handleLocalOnSort.bind(this))}handleLocalOnSort(e,t){var s;const i=t.multiColumnSort?t.sortCols:new Array({columnId:((s=t.sortCol)==null?void 0:s.id)??"",sortAsc:t.sortAsc,sortCol:t.sortCol});this._currentLocalSorters=[],Array.isArray(i)&&i.forEach(n=>{n.sortCol&&this._currentLocalSorters.push({columnId:n.sortCol.id,direction:n.sortAsc?dt.ASC:dt.DESC})}),this.onLocalSortChanged(this._grid,i),this.emitSortChanged(oe.local)}clearSortByColumnId(e,t){var n;const i=this.getCurrentColumnSorts(),s=this.getCurrentColumnSorts(`${t}`);if(Array.isArray(i)&&Array.isArray(s)&&i.length!==s.length){if(this._gridOptions.backendServiceApi)this.onBackendSortChanged(e,{multiColumnSort:!0,sortCols:s,grid:this._grid});else if(this._dataView)this.onLocalSortChanged(this._grid,s,!0,!0);else{const a=((n=this._gridOptions)==null?void 0:n.multiColumnSort)??!1?s:s[0];this._grid.onSort.notify(a)}const o=s.map(l=>{var a;return{columnId:((a=l==null?void 0:l.sortCol)==null?void 0:a.id)??"",sortAsc:l==null?void 0:l.sortAsc,sortCol:l==null?void 0:l.sortCol}});this._grid.setSortColumns(o)}Array.isArray(s)&&s.length===0&&this.sortLocalGridByDefaultSortFieldId()}clearSorting(e=!0){var t,i;if(this._grid&&this._gridOptions&&this._dataView){if(this._grid.setSortColumns([]),e)this._isBackendGrid?this.onBackendSortChanged(void 0,{grid:this._grid,multiColumnSort:!0,sortCols:[],clearSortTriggered:!0}):this._columnDefinitions&&Array.isArray(this._columnDefinitions)&&this._columnDefinitions.length>0&&this.sortLocalGridByDefaultSortFieldId();else if(this._isBackendGrid){const s=(i=(t=this._gridOptions)==null?void 0:t.backendServiceApi)==null?void 0:i.service;s!=null&&s.clearSorters&&s.clearSorters()}}this._currentLocalSorters=[],this.pubSubService.publish("onSortCleared",!0)}disableSortFunctionality(e=!0,t=!0){const s=!this._gridOptions.enableSorting;this._gridOptions.enableSorting=s;let n;e?(t&&this.clearSorting(),this._eventHandler.unsubscribeAll(),n=this.disableAllSortingCommands(!0)):(n=this.disableAllSortingCommands(!1),this._eventHandler.subscribe(this._grid.onSort,(o,l)=>this.handleLocalOnSort(o,l))),this._grid.setOptions({enableSorting:this._gridOptions.enableSorting},!1,!0),this.sharedService.gridOptions=this._gridOptions,this._grid.setColumns(n)}toggleSortFunctionality(e=!0){const t=this._gridOptions.enableSorting;this.disableSortFunctionality(t,e)}emitSortChanged(e,t){var i;if(e===oe.remote&&((i=this._gridOptions)!=null&&i.backendServiceApi)){let s=[];const n=this._gridOptions.backendServiceApi.service;n!=null&&n.getCurrentSorters&&(s=n.getCurrentSorters()),this.pubSubService.publish("onSortChanged",s)}else e===oe.local&&(t&&(this._currentLocalSorters=t),this.pubSubService.publish("onSortChanged",this.getCurrentLocalSorters()))}getCurrentLocalSorters(){return this._currentLocalSorters}getCurrentColumnSorts(e){if(this._grid){const t=this._grid.getSortColumns();if(Array.isArray(t))return t.reduce((s,n)=>(n&&(!e||n.columnId!==e)&&s.push({columnId:n.columnId||"",sortCol:this._columnDefinitions[this._grid.getColumnIndex(n.columnId||"")],sortAsc:n.sortAsc}),s),[])}return[]}loadGridSorters(e){this._currentLocalSorters=[];const t=[];return Array.isArray(e)&&((this._gridOptions.multiColumnSort?e:e.slice(0,1)).forEach(s=>{const n=this._columnDefinitions.find(o=>o.id===s.columnId);if(n){if(!n.sortable){let o="[Slickgrid-Universal] Cannot add sort icon to a column that is not sortable, please add `sortable: true` to your column or remove it from your list of columns to sort.";throw this._gridOptions.enableTreeData&&(o+=" Also note that TreeData feature requires the column holding the tree (expand/collapse icons) to be sortable."),new Error(o)}t.push({columnId:n.id,sortAsc:s.direction.toUpperCase()===dt.ASC,sortCol:n}),this._currentLocalSorters.push({columnId:String(n.id),direction:s.direction.toUpperCase()})}}),this.onLocalSortChanged(this._grid,t),this._grid.setSortColumns(t.map(s=>({columnId:s.columnId,sortAsc:s.sortAsc})))),t}processTreeDataInitialSort(){var e,t,i;if((e=this._gridOptions)!=null&&e.enableTreeData&&this._gridOptions.treeDataOptions){const s=this._gridOptions.treeDataOptions,n=this._columnDefinitions.find(o=>o.id===s.columnId);if(n){let o=dt.ASC,l={columnId:s.columnId,sortCol:n,sortAsc:!0};if((t=s==null?void 0:s.initialSort)!=null&&t.columnId){const a=s.initialSort.columnId,h=this._columnDefinitions.find(d=>d.id===a);o=(s.initialSort.direction||dt.ASC).toUpperCase(),l={columnId:a,sortCol:h,sortAsc:o===dt.ASC}}l!=null&&l.columnId&&((i=this.sharedService)!=null&&i.hierarchicalDataset)&&this.updateSorting([{columnId:l.columnId||"",direction:o}])}}}onBackendSortChanged(e,t){var a,h,d;if(!t||!t.grid)throw new Error('Something went wrong when trying to bind the "onBackendSortChanged(event, args)" function, it seems that "args" is not populated correctly');const i=((a=t.grid)==null?void 0:a.getOptions())??{},s=i.backendServiceApi;if(!s||!s.process||!s.service)throw new Error('BackendServiceApi requires at least a "process" function and a "service" defined');const n=new Date;s.preProcess&&s.preProcess();const o=s.service.processOnSortChanged(e,t),l=((h=i==null?void 0:i.pagination)==null?void 0:h.totalItems)||0;(d=this.backendUtilities)==null||d.executeBackendCallback(s,o,t,n,l,{emitActionChangedCallback:this.emitSortChanged.bind(this),errorCallback:()=>{var u,p,m;this._grid.setSortColumns(t.previousSortColumns||[]);const c=(u=t.previousSortColumns)==null?void 0:u.map(f=>({columnId:f.columnId,sortAsc:f.sortAsc,sortCol:this._columnDefinitions.find(g=>g.id===f.columnId)}));(m=(p=s==null?void 0:s.service)==null?void 0:p.updateSorters)==null||m.call(p,c||[])},httpCancelRequestSubject:this.httpCancelRequests$})}async onLocalSortChanged(e,t,i=!1,s=!1){var a,h;const n=((a=this._gridOptions)==null?void 0:a.datasetIdPropertyName)??"id",o=((h=this._gridOptions)==null?void 0:h.enableTreeData)??!1,l=e.getData();if(await this.pubSubService.publish("onBeforeSortChange",{sortColumns:t},0),e&&l){if(i&&!o&&l.reSort(),o&&this.sharedService&&Array.isArray(this.sharedService.hierarchicalDataset)){const d=this.sortHierarchicalDataset(this.sharedService.hierarchicalDataset,t);this._dataView.setItems(d.flat,n),this._dataView.onRowCountChanged.notify({previous:this._dataView.getFilteredItemCount(),current:this._dataView.getLength(),itemCount:this._dataView.getItemCount(),dataView:this._dataView,callingOnRowsChanged:!0})}else l.sort(this.sortComparers.bind(this,t));e.invalidate(),s&&this.emitSortChanged(oe.local,t.map(d=>{var c;return{columnId:((c=d.sortCol)==null?void 0:c.id)??"id",direction:d.sortAsc?dt.ASC:dt.DESC}}))}}sortHierarchicalDataset(e,t,i=!1){var a,h,d;this.sortTreeData(e,t);const s=((a=this._gridOptions)==null?void 0:a.datasetIdPropertyName)??"id",n=((h=this._gridOptions)==null?void 0:h.treeDataOptions)??{columnId:""},o={...n,identifierPropName:n.identifierPropName??s,shouldAddTreeLevelNumber:!0},l=to(e,o);if(i){this._currentLocalSorters=[],t.forEach(u=>{this._currentLocalSorters.push({columnId:u.columnId,direction:u.sortAsc?"ASC":"DESC"})});const c=(d=this._gridOptions)!=null&&d.backendServiceApi?oe.remote:oe.local;this.emitSortChanged(c)}return{hierarchical:e,flat:l}}sortLocalGridByDefaultSortFieldId(){const e=this._gridOptions&&this._gridOptions.defaultColumnSortFieldId||this._gridOptions.datasetIdPropertyName||"id",t={id:e,field:e};this.onLocalSortChanged(this._grid,new Array({columnId:t.id,sortAsc:!0,sortCol:t,clearSortTriggered:!0}),!1,!0)}sortComparers(e,t,i){if(Array.isArray(e))for(const s of e){const n=this.sortComparer(s,t,i);if(n!==void 0)return n}return ae.neutral}sortComparer(e,t,i,s){if(e!=null&&e.sortCol){const n=e.sortCol,o=e.sortAsc?ae.asc:ae.desc;let l=s||n.queryFieldSorter||n.queryField||n.field,a=l;const h=n.type||S.string;typeof n.queryFieldNameGetterFn=="function"&&(l=n.queryFieldNameGetterFn(t),a=n.queryFieldNameGetterFn(i));let d=t[l],c=i[a];if((l==null?void 0:l.indexOf("."))>=0&&(d=Ee(t,l)),(a==null?void 0:a.indexOf("."))>=0&&(c=Ee(i,a)),n.sortComparer){const u=n.sortComparer(d,c,o,n,this._gridOptions);if(u!==ae.neutral)return u}else{const u=mi(h,d,c,o,n,this._gridOptions);if(u!==ae.neutral)return u}}}sortTreeData(e,t){Array.isArray(t)&&t.forEach(i=>{this.sortTreeChildren(e,i,0)})}sortTreeChildren(e,t,i){var o;const s=(o=this._gridOptions)==null?void 0:o.treeDataOptions,n=(s==null?void 0:s.childrenPropName)??"children";e.sort((l,a)=>this.sortComparer(t,l,a)??ae.neutral),e.forEach(l=>{l&&l.hasOwnProperty(n)&&Array.isArray(l[n])&&(i++,this.sortTreeChildren(l[n],t,i),i--)})}updateSorting(e,t=!0,i=!0){var s,n;if(!this._gridOptions||!this._gridOptions.enableSorting)throw new Error('[Slickgrid-Universal] in order to use "updateSorting" method, you need to have Sortable Columns defined in your grid and "enableSorting" set in your Grid Options');if(Array.isArray(e)){const o=(s=this._gridOptions)==null?void 0:s.backendServiceApi;if(o){const l=o==null?void 0:o.service;l!=null&&l.updateSorters&&(l.updateSorters(void 0,e),i&&((n=this.backendUtilities)==null||n.refreshBackendDataset(this._gridOptions)))}else this.loadGridSorters(e);if(t){const l=o?oe.remote:oe.local;this.emitSortChanged(l)}}}disableAllSortingCommands(e=!0){var s,n;const t=this._grid.getColumns();t.forEach(o=>{var l,a;o.sortable!==void 0&&(o.sortable=!e),(l=o==null?void 0:o.header)!=null&&l.menu&&((a=o.header.menu.commandItems)==null||a.forEach(h=>{if(h&&typeof h!="string"){const d=h.command;(d==="sort-asc"||d==="sort-desc"||d==="clear-sort")&&(h.hidden=e)}}))});const i=(n=(s=this._gridOptions)==null?void 0:s.gridMenu)==null?void 0:n.commandItems;return i&&i.forEach(o=>{o&&typeof o!="string"&&o.command==="clear-sorting"&&(o.hidden=e)}),t}}class Ru{constructor(e,t,i){this.pubSubService=e,this.sharedService=t,this.sortService=i,this._currentToggledItems=[],this._isLastFullToggleCollapsed=!1,this._isOneCpuCyclePassed=!1,this._isTreeDataEnabled=!1,this._subscriptions=[],this._treeDataRecalcHandler=null,this._eventHandler=new pe,setTimeout(()=>this._isOneCpuCyclePassed=!0)}set currentToggledItems(e){this._currentToggledItems=e}get dataset(){var e;return(e=this.dataView)==null?void 0:e.getItems()}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}get dataView(){var e;return(e=this._grid)==null?void 0:e.getData()}get eventHandler(){return this._eventHandler}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}get treeDataOptions(){return this.gridOptions.treeDataOptions}dispose(){this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions)}init(e){var t,i,s,n,o,l,a,h;if(this._grid=e,this._isTreeDataEnabled=((t=this.gridOptions)==null?void 0:t.enableTreeData)??!1,this._isLastFullToggleCollapsed=((i=this.treeDataOptions)==null?void 0:i.initiallyCollapsed)??!1,this._currentToggledItems=((n=(s=this.gridOptions.presets)==null?void 0:s.treeData)==null?void 0:n.toggledItems)??[],this._lastToggleStateChange={type:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this._isTreeDataEnabled){if((o=this.gridOptions)!=null&&o.multiColumnSort)throw new Error('[Slickgrid-Universal] It looks like you are trying to use Tree Data with multi-column sorting, unfortunately it is not supported because of its complexity, you can disable it via "multiColumnSort: false" grid option and/or help in providing support for this feature.');if(!((l=this.gridOptions)!=null&&l.enableFiltering))throw new Error('[Slickgrid-Universal] It looks like you are trying to use Tree Data without using the filtering option, unfortunately that is not possible with Tree Data since it relies heavily on the filters to expand/collapse the tree. You need to enable it via "enableFiltering: true"');if((a=this.gridOptions)!=null&&a.backendServiceApi||(h=this.gridOptions)!=null&&h.enablePagination)throw new Error("[Slickgrid-Universal] It looks like you are trying to use Tree Data with Pagination and/or a Backend Service (OData, GraphQL) but unfortunately that is simply not supported because of its complexity.");if(!this.gridOptions.treeDataOptions||!this.gridOptions.treeDataOptions.columnId)throw new Error('[Slickgrid-Universal] When enabling tree data, you must also provide the "treeDataOption" property in your Grid Options with "childrenPropName" or "parentPropName" (depending if your array is hierarchical or flat) for the Tree Data to work properly.')}this._eventHandler.subscribe(e.onClick,this.handleOnCellClick.bind(this)),this._subscriptions.push(this.pubSubService.subscribe("onGridMenuClearAllSorting",this.clearSorting.bind(this))),this._treeDataRecalcHandler=this.setAutoRecalcTotalsCallbackWhenFeatEnabled(this.gridOptions),this._eventHandler.subscribe(this.dataView.onRowCountChanged,()=>{var d;typeof this._treeDataRecalcHandler=="function"&&this._isOneCpuCyclePassed&&(clearTimeout(this._timer),this._timer=setTimeout(()=>{var c;return(c=this._treeDataRecalcHandler)==null?void 0:c.call(this)},((d=this.treeDataOptions)==null?void 0:d.autoRecalcTotalsDebounce)??0))})}applyToggledItemStateChanges(e,t,i=!0,s=!1){if(Array.isArray(e)){const n=this.getTreeDataOptionPropName("collapsedPropName"),o=this.getTreeDataOptionPropName("hasChildrenPropName");this.dataView.beginUpdate(!0);const a=(t??this._lastToggleStateChange.previousFullToggleType)==="full-collapse";t&&(this._lastToggleStateChange.previousFullToggleType=t),i&&(this.dataView.getItems()||[]).forEach(h=>{h[o]&&(h[n]=a)}),this.dynamicallyToggleItemState(e,s)}}dynamicallyToggleItemState(e,t=!0){Array.isArray(e)&&(this.dataView.beginUpdate(!0),e.forEach(i=>{const s=this.dataView.getItemById(i.itemId);if(this.updateToggledItem(s,i.isCollapsed),t){const n=this._currentToggledItems.findIndex(o=>o.itemId===i.itemId);n>=0?this._currentToggledItems[n].isCollapsed=i.isCollapsed:this._currentToggledItems.push({itemId:i.itemId,isCollapsed:i.isCollapsed}),this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:i.itemId,toggledItems:this._currentToggledItems,type:i.isCollapsed?Tt.toggleCollapse:Tt.toggleExpand})}}),this.dataView.endUpdate(),this.dataView.refresh())}getCurrentToggleState(){return this._lastToggleStateChange}getInitialSort(e,t){var o;const i=t==null?void 0:t.treeDataOptions,s=(i==null?void 0:i.initialSort)??{columnId:(i==null?void 0:i.columnId)??"",direction:"ASC"},n=e.find(l=>l.id===s.columnId);return{columnId:s.columnId,sortAsc:((o=s==null?void 0:s.direction)==null?void 0:o.toUpperCase())!=="DESC",sortCol:n}}getItemCount(e){if(e!==void 0){const t=this.getTreeDataOptionPropName("levelPropName");return this.dataView.getItems().filter(i=>i[t]===e).length}return this.dataView.getItemCount()}getToggledItems(){return this._currentToggledItems}getTreeDataOptionPropName(e){var i,s,n,o,l,a,h;let t="";switch(e){case"childrenPropName":t=((i=this.treeDataOptions)==null?void 0:i.childrenPropName)??R.treeDataProperties.CHILDREN_PROP;break;case"collapsedPropName":t=((s=this.treeDataOptions)==null?void 0:s.collapsedPropName)??R.treeDataProperties.COLLAPSED_PROP;break;case"hasChildrenPropName":t=((n=this.treeDataOptions)==null?void 0:n.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP;break;case"identifierPropName":t=((o=this.treeDataOptions)==null?void 0:o.identifierPropName)??((l=this.gridOptions)==null?void 0:l.datasetIdPropertyName)??"id";break;case"levelPropName":t=((a=this.treeDataOptions)==null?void 0:a.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;break;case"parentPropName":t=((h=this.treeDataOptions)==null?void 0:h.parentPropName)??R.treeDataProperties.PARENT_PROP;break}return t}clearSorting(){const e=this.getInitialSort(this.sharedService.columnDefinitions,this.sharedService.gridOptions);this.sortService.loadGridSorters([{columnId:e.columnId,direction:e.sortAsc?"ASC":"DESC"}])}convertFlatParentChildToTreeDatasetAndSort(e,t,i,s){var a;const n=this.convertFlatParentChildToTreeDataset(e,i),o=Array.isArray(s)&&s.length?s[0]:this.getInitialSort(t,i),l=this.sortService.sortHierarchicalDataset(n,[o],!0);return(a=this._grid)==null||a.setSortColumns([o]),l}convertFlatParentChildToTreeDataset(e,t){const i=(t==null?void 0:t.datasetIdPropertyName)??"id",s=(t==null?void 0:t.treeDataOptions)??{columnId:"id"},n={...s,identifierPropName:s.identifierPropName??i,initiallyCollapsed:this._isLastFullToggleCollapsed};return io(e,n)}enableAutoRecalcTotalsFeature(e=!0){e&&this._isTreeDataEnabled?this._treeDataRecalcHandler=this.recalculateTreeTotals.bind(this,this.gridOptions):this._treeDataRecalcHandler=null}recalculateTreeTotals(e){const t=e.treeDataOptions,i=(t==null?void 0:t.childrenPropName)??R.treeDataProperties.CHILDREN_PROP,s=(t==null?void 0:t.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;t!=null&&t.aggregators&&(t.aggregators.forEach(n=>{Fi(this.sharedService.hierarchicalDataset||[],{childrenPropName:i,levelPropName:s,aggregator:n})}),this._grid.invalidate())}sortHierarchicalDataset(e,t){const i=t??this.getInitialSort(this.sharedService.allColumns,this.gridOptions),s=Array.isArray(i)?i:[i];return this.sortService.sortHierarchicalDataset(e,s)}async toggleTreeDataCollapse(e,t=!0){var s;if((s=this.gridOptions)!=null&&s.enableTreeData){const n=this.getTreeDataOptionPropName("hasChildrenPropName");t&&await this.pubSubService.publish("onTreeFullToggleStart",{collapsing:e}),this.dataView.beginUpdate(!0),(this.dataView.getItems()||[]).forEach(o=>{o[n]&&this.updateToggledItem(o,e)}),this.dataView.endUpdate(),this.dataView.refresh(),this._isLastFullToggleCollapsed=e}const i=e?Tt.fullCollapse:Tt.fullExpand;this._lastToggleStateChange={type:i,previousFullToggleType:i,toggledItems:null},t&&this.pubSubService.publish("onTreeFullToggleEnd",this._lastToggleStateChange)}handleOnCellClick(e,t){if(e&&t){const i=e.target||{},s=this.gridOptions.datasetIdPropertyName??"id",n=this.getTreeDataOptionPropName("collapsedPropName"),o=this.getTreeDataOptionPropName("childrenPropName");if(typeof(i==null?void 0:i.className)=="string"&&(i.className.indexOf("toggle")>=0||!1)){const a=this.dataView.getItem(t.row);if(a){a[n]=!a[n];const h=a[n],d=a[s],c=this._currentToggledItems.findIndex(m=>m.itemId===d);c>=0?this._currentToggledItems[c].isCollapsed=h:this._currentToggledItems.push({itemId:d,isCollapsed:h}),this.dataView.updateItem(d,a);const u=m=>m[s]===d,p=Di(this.sharedService.hierarchicalDataset||[],u,o);p&&(p[n]=h),this._grid.invalidate(),this._lastToggleStateChange={type:h?Tt.toggleCollapse:Tt.toggleExpand,previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:d})}e.stopImmediatePropagation()}}}updateToggledItem(e,t){var o;const i=((o=this.gridOptions)==null?void 0:o.datasetIdPropertyName)??"id",s=this.getTreeDataOptionPropName("childrenPropName"),n=this.getTreeDataOptionPropName("collapsedPropName");if(e){e[n]=t,this.dataView.updateItem(e[i],e);const l=h=>h[i]===e[i],a=Di(this.sharedService.hierarchicalDataset||[],l,s);a&&(a[n]=t)}}setAutoRecalcTotalsCallbackWhenFeatEnabled(e){var t,i;return e!=null&&e.enableTreeData&&((t=e==null?void 0:e.treeDataOptions)!=null&&t.autoRecalcTotalsOnFilterChange)&&((i=e==null?void 0:e.treeDataOptions)!=null&&i.aggregators)?this.recalculateTreeTotals.bind(this,e):null}}class Ut{constructor(e){this.translaterService=e,this._debounceTypingDelay=0,this._shouldTriggerQuery=!0,this._inputType="text",this.inputFilterType="single",this.searchTerms=[],this._bindEventService=new Ae}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get defaultOperator(){return H.empty}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}init(e){var s,n,o;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.inputFilterType==="compound"&&(this.operator=e.operator||""),this.searchTerms=(e==null?void 0:e.searchTerms)??[],this._cellContainerElm=e.filterContainerElm;const t=(s=this.gridOptions)==null?void 0:s.backendServiceApi;this._debounceTypingDelay=(t?(t==null?void 0:t.filterTypingDebounce)??((n=this.gridOptions)==null?void 0:n.defaultBackendServiceFilterTypingDebounce):(o=this.gridOptions)==null?void 0:o.filterTypingDebounce)??0;const i=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this.createDomFilterElement(i),this._bindEventService.bind(this._filterInputElm,["keyup","blur","change"],this.onTriggerEvent.bind(this)),this._bindEventService.bind(this._filterInputElm,"wheel",this.onTriggerEvent.bind(this),{passive:!0}),this.inputFilterType==="compound"&&this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this))}clear(e=!0){this._filterInputElm&&(this._shouldTriggerQuery=e,this.searchTerms=[],this._filterInputElm.value="",this._currentValue=void 0,this.updateFilterStyle(!1),this.inputFilterType==="compound"&&this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.onTriggerEvent(void 0,!0))}destroy(){var e,t,i,s;this._bindEventService.unbindAll(),(t=(e=this._selectOperatorElm)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._filterInputElm)==null?void 0:i.remove)==null||s.call(i)}getValues(){return this._filterInputElm.value}setValues(e,t,i=!1){const s=Array.isArray(e)?e:[e];let n="";for(const o of s)this.inputFilterType==="single"?n=t?this.addOptionalOperatorIntoSearchString(o,t):o:n=`${o}`,this._filterInputElm.value=`${n??""}`,this._currentValue=this._filterInputElm.value;if(this.updateFilterStyle(this.getValues()!==""),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const o=di(this.operator);this._selectOperatorElm.value=o}i&&this.onTriggerEvent(void 0,!1)}addOptionalOperatorIntoSearchString(e,t){let i="",s="",n=e==null?"":`${e}`;if(t&&n){switch(t){case"<>":case"!=":case"=":case"==":case">":case">=":case"<":case"<=":i=t;break;case"EndsWith":case"*z":i="*";break;case"StartsWith":case"a*":s="*";break}n=`${i}${n}${s}`}return n}getCompoundOperatorOptionValues(){var s;const e=this.columnDef.type&&this.columnDef.type?this.columnDef.type:S.string;let t,i="text";if((s=this.columnFilter)!=null&&s.compoundOperatorList)t=this.columnFilter.compoundOperatorList;else switch(e){case S.string:case S.text:case S.readonly:case S.password:i="text",t=qh(this.gridOptions,this.translaterService);break;default:i="numeric",t=Dn(this.gridOptions,this.translaterService);break}return Mn(this.gridOptions,t,i),t}createDomFilterElement(e){var n,o,l,a;const t=((n=this.columnDef)==null?void 0:n.id)??"";J(this._cellContainerElm);let i=((o=this.gridOptions)==null?void 0:o.defaultFilterPlaceholder)??"";(l=this.columnFilter)!=null&&l.placeholder&&(i=this.columnFilter.placeholder);const s=`${e??""}`;if(this._filterInputElm=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",placeholder:i,ariaLabel:((a=this.columnFilter)==null?void 0:a.ariaLabel)??`${_t(t+"")} Search Filter`,className:`form-control filter-${t}`,value:s,dataset:{columnid:`${t}`}}),this.updateFilterStyle(!!e),e!==void 0&&(this._currentValue=s),this.inputFilterType==="single")this._filterContainerElm=this._filterInputElm,this._filterInputElm.classList.add("search-filter"),this._cellContainerElm.appendChild(this._filterInputElm),this._cellContainerElm.appendChild(document.createElement("span"));else{this._filterInputElm.classList.add("compound-input"),this._selectOperatorElm=Fn(this.getCompoundOperatorOptionValues(),this.grid),this._filterContainerElm=v("div",{className:`form-group search-filter filter-${t}`});const h=v("div",{className:"input-group"},this._filterContainerElm);v("div",{className:"input-group-addon input-group-prepend operator"},h).appendChild(this._selectOperatorElm),h.appendChild(this._filterInputElm),h.appendChild(v("span")),this.operator&&(this._selectOperatorElm.value=di(this.operator)),this._filterContainerElm&&this._cellContainerElm.appendChild(this._filterContainerElm)}}onTriggerEvent(e,t=!1){var i,s;if(t)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else{const n=(e==null?void 0:e.type)??"",o=((i=this._selectOperatorElm)==null?void 0:i.value)??this.operator;let l=this._filterInputElm.value;const a=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof l=="string"&&a&&(l=l.trim()),((s=e==null?void 0:e.target)==null?void 0:s.tagName.toLowerCase())!=="select"&&(this._currentValue=l),this.updateFilterStyle(l!=="");const h={columnDef:this.columnDef,operator:o,searchTerms:l?[l]:null,shouldTriggerQuery:this._shouldTriggerQuery},d=n==="keyup"&&(e==null?void 0:e.key)!=="Enter"?this._debounceTypingDelay:0,c=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,u=c&&ie(this._currentValue)||this._currentValue===""&&ie(this._lastSearchValue);(this.inputFilterType==="single"||!c||u)&&(d>0?(clearTimeout(this._timer),this._timer=setTimeout(()=>this.callback(e,h),d)):this.callback(e,h)),this._lastSearchValue=l}this._shouldTriggerQuery=!0}updateFilterStyle(e){var t,i;e?((t=this._filterContainerElm)==null||t.classList.add("filled"),this._filterInputElm.classList.add("filled")):((i=this._filterContainerElm)==null||i.classList.remove("filled"),this._filterInputElm.classList.remove("filled"))}}class ba extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="text",this.inputFilterType="compound"}}class Au extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number",this.inputFilterType="compound"}}class Pu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password",this.inputFilterType="compound"}}const vr="#86bff8",Us=0,ku=20;class br{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._sliderTrackFilledColor=vr,this.sliderType="double",this.searchTerms=[],this._bindEventService=new Ae}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get currentValue(){return this._currentValue}get currentValues(){return this._currentValues}get defaultOperator(){return this.sliderType==="compound"?H.empty:this.sliderType==="single"?H.greaterThanOrEqual:this.gridOptions.defaultFilterRangeOperator||H.rangeInclusive}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.slider,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get sliderOptions(){return this._sliderOptions}get operator(){return this._operator||(this.columnFilter.operator??this.defaultOperator)}set operator(e){this._operator=e}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.operator=e.operator||"",this.searchTerms=(e==null?void 0:e.searchTerms)??[],this._argFilterContainerElm=e.filterContainerElm,this._sliderTrackFilledColor=window.getComputedStyle(document.documentElement).getPropertyValue("--slick-slider-filter-filled-track-color")||vr,this._filterElm=this.createDomFilterElement(this.searchTerms)}clear(e=!0){var t,i,s,n,o,l,a;if(this._filterElm){this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[];const h=+(((t=this.filterOptions)==null?void 0:t.sliderStartValue)??R.SLIDER_DEFAULT_MIN_VALUE),d=+(((i=this.filterOptions)==null?void 0:i.sliderEndValue)??R.SLIDER_DEFAULT_MAX_VALUE);this.sliderType==="double"?(this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=`${h}`),this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${d}`),this._currentValues=[h,d],(s=this._sliderLeftInputElm)==null||s.dispatchEvent(new Event("change")),(n=this._sliderRightInputElm)==null||n.dispatchEvent(new Event("change"))):(this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${h}`),this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this._currentValue=h,(o=this._sliderRightInputElm)==null||o.dispatchEvent(new Event("change"))),(((l=this.filterOptions)==null?void 0:l.hideSliderNumber)??((a=this.filterOptions)==null?void 0:a.hideSliderNumbers))||(this.sliderType==="double"?this.renderSliderValues(h,d):this.renderSliderValues(void 0,h)),this.updateFilterStyle(!1),this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:e,searchTerms:[]})}}destroy(){var e,t,i;this._bindEventService.unbindAll(),(e=this._sliderTrackElm)==null||e.remove(),(t=this._sliderLeftInputElm)==null||t.remove(),(i=this._sliderRightInputElm)==null||i.remove()}renderSliderValues(e,t,i=!0){var o,l;const s=(e==null?void 0:e.toString())||"",n=(t==null?void 0:t.toString())||"";(o=this._leftSliderNumberElm)!=null&&o.textContent&&(this._leftSliderNumberElm.textContent=s),(l=this._rightSliderNumberElm)!=null&&l.textContent&&(this._rightSliderNumberElm.textContent=n),this._sliderRangeContainElm.title=this.sliderType==="double"?`${s} - ${n}`:`${n}`,i&&this.grid.onHeaderRowMouseLeave.notify({column:this.columnDef,grid:this.grid})}getValues(){return this.sliderType==="double"?this._currentValues:this._currentValue}setValues(e,t,i=!1){var o;if(e){let l=[];const a=Array.isArray(e)?e==null?void 0:e[0]:e;if(Array.isArray(e)&&e.length===2?l=e:typeof a=="string"&&a.indexOf("..")>0?(l=a.split(".."),this._currentValue=+((l==null?void 0:l[0])??0)):(ie(a)||a==="")&&(this._currentValue=a===null?void 0:+a,l=[a]),this.sliderType!=="double"&&this._sliderRightInputElm)this._sliderRightInputElm.value=typeof e=="string"?e:`${a}`,this.renderSliderValues(void 0,this._sliderRightInputElm.value);else if(Array.isArray(l)&&l.length===2&&!((o=this.filterOptions)!=null&&o.hideSliderNumbers)){const[h,d]=l;this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=String(h??R.SLIDER_DEFAULT_MIN_VALUE)),this._sliderRightInputElm&&(this._sliderRightInputElm.value=String(d??R.SLIDER_DEFAULT_MAX_VALUE)),this.renderSliderValues(...l)}}else this._currentValue=void 0,this._currentValues=void 0;const s=this.getValues(),n=s===void 0?[]:Array.isArray(s)?s:[s];if(this.updateFilterStyle(n.length>0),t!==void 0&&(this.operator=t),this.operator&&this._selectOperatorElm){const l=di(this.operator);this._selectOperatorElm.value=l}i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:n,shouldTriggerQuery:!0})}createDomFilterElement(e){var c,u,p,m,f;const t=((c=this.columnDef)==null?void 0:c.id)??"",i=+(this.columnFilter.minValue??R.SLIDER_DEFAULT_MIN_VALUE),s=+(this.columnFilter.maxValue??R.SLIDER_DEFAULT_MAX_VALUE),n=+(this.columnFilter.valueStep??R.SLIDER_DEFAULT_STEP);J(this._argFilterContainerElm);const o=+((Array.isArray(e)&&(e==null?void 0:e[0]))??((u=this.filterOptions)==null?void 0:u.sliderStartValue)??i),l=+((Array.isArray(e)&&(e==null?void 0:e[1]))??((p=this.filterOptions)==null?void 0:p.sliderEndValue)??s);if(this._sliderRangeContainElm=v("div",{className:`filter-input filter-${t} slider-input-container slider-values`,title:this.sliderType==="double"?`${o} - ${l}`:`${o}`}),this._sliderTrackElm=v("div",{className:"slider-track"}),this.sliderType==="compound"){const g=v("span",{className:"input-group-addon input-group-prepend operator"});this._selectOperatorElm=Fn(this.getOperatorOptionValues(),this.grid),g.appendChild(this._selectOperatorElm)}this.sliderType==="double"&&(this._sliderLeftInputElm=v("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${_t(t+"")} Search Filter`,defaultValue:`${o}`,value:`${o}`,min:`${i}`,max:`${s}`,step:`${n}`}));const a=this.sliderType==="double"?l:o;this._sliderRightInputElm=v("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${_t(t+"")} Search Filter`,defaultValue:`${a}`,value:`${a}`,min:`${i}`,max:`${s}`,step:`${n}`});const h=((m=this.filterOptions)==null?void 0:m.hideSliderNumber)??((f=this.filterOptions)==null?void 0:f.hideSliderNumbers),d=h?"":"input-group";if(this._divContainerFilterElm=v("div",{className:`${d} search-filter slider-container slider-values filter-${t}`.trim()}),this._sliderRangeContainElm.appendChild(this._sliderTrackElm),this.sliderType==="double"&&this._sliderLeftInputElm&&this._sliderRangeContainElm.appendChild(this._sliderLeftInputElm),this._sliderRangeContainElm.appendChild(this._sliderRightInputElm),h)this._divContainerFilterElm.appendChild(this._sliderRangeContainElm);else{let g;this.sliderType==="compound"&&this._selectOperatorElm?(g=v("span",{className:"input-group-addon input-group-prepend operator"}),g.appendChild(this._selectOperatorElm)):this.sliderType==="double"&&(g=v("div",{className:"input-group-addon input-group-prepend slider-range-value"}),this._leftSliderNumberElm=v("span",{className:`input-group-text lowest-range-${t}`,textContent:`${o}`}),g.appendChild(this._leftSliderNumberElm));const _=v("div",{className:"input-group-addon input-group-append slider-range-value"});this._rightSliderNumberElm=v("span",{className:`input-group-text highest-range-${t}`,textContent:`${a}`},_),g&&this._divContainerFilterElm.appendChild(g),this._divContainerFilterElm.appendChild(this._sliderRangeContainElm),this._divContainerFilterElm.appendChild(_)}return this._sliderOptions={minValue:i,maxValue:s,step:n},this._currentValues=[o,l],Array.isArray(e)&&e.length>0&&e[0]!==""&&(this.updateFilterStyle(!0),this._currentValue=o),(this.filterOptions.sliderStartValue!==void 0||this.columnFilter.minValue!==void 0)&&(this._currentValue=o),this._argFilterContainerElm.appendChild(this._divContainerFilterElm),this.updateTrackFilledColorWhenEnabled(),this._bindEventService.bind(this._sliderTrackElm,"click",this.sliderTrackClicked.bind(this)),this._bindEventService.bind(this._sliderRightInputElm,["input","change"],this.slideRightInputChanged.bind(this)),this._bindEventService.bind(this._sliderRightInputElm,["change","mouseup","touchend"],this.onValueChanged.bind(this)),this.sliderType==="compound"&&this._selectOperatorElm?this._bindEventService.bind(this._selectOperatorElm,["change"],this.onValueChanged.bind(this)):this.sliderType==="double"&&this._sliderLeftInputElm&&(this._bindEventService.bind(this._sliderLeftInputElm,["input","change"],this.slideLeftInputChanged.bind(this)),this._bindEventService.bind(this._sliderLeftInputElm,["change","mouseup","touchend"],this.onValueChanged.bind(this))),this._divContainerFilterElm}getOperatorOptionValues(){let e;return this.columnFilter.compoundOperatorList?e=this.columnFilter.compoundOperatorList:e=Dn(this.gridOptions,this.translaterService),Mn(this.gridOptions,e,"numeric"),e}onValueChanged(e){var n,o,l,a,h;const t=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);let i,s;if(this.sliderType==="compound"||this.sliderType==="single")((l=(o=e==null?void 0:e.target)==null?void 0:o.tagName)==null?void 0:l.toLowerCase())!=="select"&&(this._currentValue=+t),i=this._currentValue,s=[i||"0"];else if(this.sliderType==="double"){const c=[parseInt(((a=this._sliderLeftInputElm)==null?void 0:a.value)??"",10),t];i=c.join(".."),s=c}if(this._clearFilterTriggered)this.updateFilterStyle(!1),this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,searchTerms:[],shouldTriggerQuery:this._shouldTriggerQuery});else{const d=((h=this._selectOperatorElm)==null?void 0:h.value)??this.operator;this.updateFilterStyle(i!=="");const c=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,u=c&&ie(this._currentValue)||!ie(this._currentValue)&&ie(this._lastSearchValue);(this.sliderType!=="compound"||!c||u)&&this.callback(e,{columnDef:this.columnDef,operator:d||"",searchTerms:s,shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this.changeBothSliderFocuses(!1),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e)),this._lastSearchValue=i}changeBothSliderFocuses(e){var i,s;const t=e?"add":"remove";(i=this._sliderLeftInputElm)==null||i.classList[t]("focus"),(s=this._sliderRightInputElm)==null||s.classList[t]("focus")}slideLeftInputChanged(e){var s,n,o,l;const t=parseInt(((s=this._sliderLeftInputElm)==null?void 0:s.value)??"",10),i=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);this._sliderLeftInputElm&&i-t<=(((o=this.filterOptions)==null?void 0:o.stopGapBetweenSliderHandles)??Us)&&(this._sliderLeftInputElm.value=String(t-(((l=this.filterOptions)==null?void 0:l.stopGapBetweenSliderHandles)??Us))),this._sliderLeftInputElm&&this._sliderRightInputElm&&(+this._sliderLeftInputElm.value>=+this._sliderRightInputElm.value-ku?(this._sliderLeftInputElm.style.zIndex="1",this._sliderRightInputElm.style.zIndex="0"):(this._sliderLeftInputElm.style.zIndex="0",this._sliderRightInputElm.style.zIndex="1")),this.sliderLeftOrRightChanged(e,t,i)}slideRightInputChanged(e){var s,n,o,l;const t=parseInt(((s=this._sliderLeftInputElm)==null?void 0:s.value)??"",10),i=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);this.sliderType==="double"&&this._sliderRightInputElm&&i-t<=(((o=this.filterOptions)==null?void 0:o.stopGapBetweenSliderHandles)??Us)&&(this._sliderRightInputElm.value=String(t+(((l=this.filterOptions)==null?void 0:l.stopGapBetweenSliderHandles)??Us))),this.sliderLeftOrRightChanged(e,t,i)}sliderLeftOrRightChanged(e,t,i){var n,o,l,a,h,d;this.updateTrackFilledColorWhenEnabled(),this.changeBothSliderFocuses(!0),this._sliderRangeContainElm.title=this.sliderType==="double"?`${t} - ${i}`:`${i}`,(((n=this.filterOptions)==null?void 0:n.hideSliderNumber)??((o=this.filterOptions)==null?void 0:o.hideSliderNumbers))||((l=this._leftSliderNumberElm)!=null&&l.textContent&&(this._leftSliderNumberElm.textContent=((a=this._sliderLeftInputElm)==null?void 0:a.value)??""),(h=this._rightSliderNumberElm)!=null&&h.textContent&&(this._rightSliderNumberElm.textContent=((d=this._sliderRightInputElm)==null?void 0:d.value)??"")),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e))}sliderTrackClicked(e){e.preventDefault();const t=e.offsetX,i=this._sliderTrackElm.offsetWidth,s=(t+0)*100/i;this._sliderRightInputElm&&this.sliderType!=="double"?(this._sliderRightInputElm.value=`${s}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))):this._sliderLeftInputElm&&this._sliderRightInputElm&&(s<=50?(this._sliderLeftInputElm.value=`${s}`,this._sliderLeftInputElm.dispatchEvent(new Event("change"))):(this._sliderRightInputElm.value=`${s}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))))}updateTrackFilledColorWhenEnabled(){var e,t,i,s;if((e=this.filterOptions)!=null&&e.enableSliderTrackColoring&&this._sliderRightInputElm){let n=0;this._sliderLeftInputElm&&(n=(+this._sliderLeftInputElm.value-+this._sliderLeftInputElm.min)/(((t=this.sliderOptions)==null?void 0:t.maxValue)??0-+this._sliderLeftInputElm.min)*100);const o=(+this._sliderRightInputElm.value-+this._sliderRightInputElm.min)/(((i=this.sliderOptions)==null?void 0:i.maxValue)??0-+this._sliderRightInputElm.min)*100,l="linear-gradient(to right, %b %p1, %c %p1, %c %p2, %b %p2)".replace(/%b/g,"#eee").replace(/%c/g,((s=this.filterOptions)==null?void 0:s.sliderTrackFilledColor)||this._sliderTrackFilledColor||vr).replace(/%p1/g,`${n}%`).replace(/%p2/g,`${o}%`);this._sliderTrackElm.style.background=l,this._sliderOptions.sliderTrackBackground=l}}updateFilterStyle(e){var t,i;e?(this._divContainerFilterElm.classList.add("filled"),(t=this._filterElm)==null||t.classList.add("filled")):(this._divContainerFilterElm.classList.remove("filled"),(i=this._filterElm)==null||i.classList.remove("filled"))}}class Fu extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="compound"}}class Du extends _l{constructor(e){super(e),this.translaterService=e,this.inputFilterType="range"}}class Mu extends Ut{constructor(e){super(e),this.translaterService=e,this._inputMask="",this.inputType="text"}get inputMask(){return this._inputMask}init(e){var i,s,n,o;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this._cellContainerElm=e.filterContainerElm,(s=(i=this.columnDef)==null?void 0:i.params)!=null&&s.mask?this._inputMask=this.columnDef.params.mask:(o=(n=this.columnFilter)==null?void 0:n.params)!=null&&o.mask&&(this._inputMask=this.columnFilter.params.mask),!this._inputMask)throw new Error(`[Slickgrid-Universal] The Filters.inputMask requires the mask to be passed in the filter params or the column definition params
17
+ for example:: this.columnDefinitions: [{ id: 'phone', field: 'phone', filter: { model: Filters.inputMask, params: { mask: '000-000-0000' }}}]`);const t=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this.createDomFilterElement(t),this._bindEventService.bind(this._filterInputElm,["keyup","blur","change"],this.onTriggerEvent.bind(this))}onTriggerEvent(e,t=!1){var s,n;let i="";if((s=e==null?void 0:e.target)!=null&&s.value){let o=((n=e==null?void 0:e.target)==null?void 0:n.value)??"";const l=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof o=="string"&&l&&(o=o.trim());const a=this.unmaskValue(o),h=this.maskValue(a);i=a,(e==null?void 0:e.keyCode)>=48&&(this._filterInputElm.value=h,e.preventDefault())}t?(this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this._filterInputElm.classList.remove("filled")):(this._filterInputElm.classList.add("filled"),this.callback(e,{columnDef:this.columnDef,operator:this.operator,searchTerms:[i],shouldTriggerQuery:this._shouldTriggerQuery})),this._shouldTriggerQuery=!0}maskValue(e){let t=0,i="";return this._inputMask&&(i=this._inputMask.replace(/[09A]/gi,s=>((s==="0"||s==="9")&&/\d+/g.test(e[t])||s.toUpperCase()==="A"&&/[^\d]+/gi.test(e[t]))&&e[t++]||"")),i}unmaskValue(e){const t=e.replace(/[^0-9a-z]*/gi,""),i=this._inputMask.replace(/[^0-9a-z]*/gi,"");let s="";for(let n=0;n<i.length;n++)t[n]&&((i[n]==="0"||i[n]==="9")&&/\d+/g.test(t[n])||i[n].toUpperCase()==="A"&&/[^\d]+/gi.test(t[n]))&&(s+=t[n]);return s}}class Nu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number"}}class Lu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password"}}var Hu=Object.defineProperty,Vu=(r,e,t)=>e in r?Hu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e,t)=>Vu(r,typeof e!="symbol"?e+"":e,t),Bu=class{constructor(r){V(this,"_distinctEvent"),V(this,"_boundedEvents",[]),this._distinctEvent=(r==null?void 0:r.distinctEvent)??!1}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(r,e,t,i,s=""){let n=Array.isArray(e)?e:[e];if(typeof(r==null?void 0:r.forEach)=="function")r.forEach(o=>{for(let l of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(o,l))&&(o.addEventListener(l,t,i),this._boundedEvents.push({element:o,eventName:l,listener:t,groupName:s}))});else for(let o of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(r,o))&&(r.addEventListener(o,t,i),this._boundedEvents.push({element:r,eventName:o,listener:t,groupName:s}))}hasBinding(r,e){return this._boundedEvents.some(t=>t.element===r&&(!e||t.eventName===e))}unbind(r,e,t){var i;if(r){let s=Array.isArray(r)?r:[r],n=Array.isArray(e)?e||"":[e||""];for(let o of s){t||(t=this._boundedEvents.find(l=>{if(l.element===o&&(!e||l.eventName===e))return l.listener}));for(let l of n)(i=o==null?void 0:o.removeEventListener)==null||i.call(o,l,t)}}}unbindAll(r){if(r){let e=Array.isArray(r)?r:[r];for(let t=this._boundedEvents.length-1;t>=0;--t){let i=this._boundedEvents[t];if(e.some(s=>s===i.groupName)){let{element:s,eventName:n,listener:o}=i;this.unbind(s,n,o),this._boundedEvents.splice(t,1)}}}else for(;this._boundedEvents.length>0;){let e=this._boundedEvents.pop(),{element:t,eventName:i,listener:s}=e;this.unbind(t,i,s)}}},Sa=typeof window<"u"&&window.multipleSelect!==void 0?window.multipleSelect:{locales:{}},zu={formatSelectAll(){return"[Select all]"},formatAllSelected(){return"All selected"},formatCountSelected(r,e){return`${r} of ${e} selected`},formatNoMatchesFound(){return"No matches found"},formatOkButton(){return"OK"}};Sa.locales["en-US"]=zu;var ya=Sa.locales,$u=50,Wu=4,Ea={name:"",placeholder:"",classes:"",classPrefix:"",data:void 0,locale:void 0,selectAll:!0,single:void 0,singleRadio:!1,multiple:!1,hideOptgroupCheckboxes:!1,multipleWidth:80,width:void 0,dropWidth:void 0,maxHeight:250,maxHeightUnit:"px",position:"bottom",displayValues:!1,displayTitle:!1,displayDelimiter:", ",minimumCountSelected:3,ellipsis:!1,isOpen:!1,keepOpen:!1,openOnHover:!1,container:null,filter:!1,filterGroup:!1,filterPlaceholder:"",filterAcceptOnEnter:!1,filterByDataLength:void 0,customFilter(r){let{text:e,label:t,search:i}=r;return(t||e||"").includes(i)},showClear:!1,autoAdjustDropHeight:!1,autoAdjustDropPosition:!1,autoAdjustDropWidthByTextSize:!1,adjustedHeightPadding:10,useSelectOptionLabel:!1,useSelectOptionLabelToHtml:!1,navigationHighlight:!0,infiniteScroll:!1,virtualScroll:!0,cssStyler:()=>null,textTemplate:r=>r.innerHTML.trim(),labelTemplate:r=>r.label,onOpen:()=>!1,onClose:()=>!1,onCheckAll:()=>!1,onUncheckAll:()=>!1,onFocus:()=>!1,onBlur:()=>!1,onOptgroupClick:()=>!1,onBeforeClick:()=>!0,onClick:()=>!1,onFilter:()=>!1,onFilterClear:()=>!1,onClear:()=>!1,onAfterCreate:()=>!1,onDestroy:()=>!1,onAfterDestroy:()=>!1,onDestroyed:()=>!1},Gu=["init","getOptions","refreshOptions","getSelects","setSelects","enable","disable","open","close","check","uncheck","checkAll","uncheckAll","checkInvert","focus","blur","refresh","destroy"];Object.assign(Ea,ya["en-US"]);var Uu={BLOCK_ROWS:$u,CLUSTER_BLOCKS:Wu,DEFAULTS:Ea,METHODS:Gu},ft=Uu;function ju(r,e,t=!1){let i=Object.keys(r),s=Object.keys(e);if(t&&i.length!==s.length)return!1;for(let n of i)if(s.includes(n)&&r[n]!==e[n])return!1;return!0}function Sr(r){let e=()=>{let s={};for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=Sr(r[n]));return s},t=()=>r.map(s=>Sr(s)),i=Object.prototype.toString.call(r).slice(8,-1).toLowerCase();return i==="object"?e():i==="array"?t():r}function yr(r){return r!=null&&r!==""}function Yu(r,e){return typeof r=="object"?Object.fromEntries(e?Object.entries(r).filter(([t,i])=>!yr(i)&&!e.includes(t)||yr(i)):Object.entries(r).filter(([t,i])=>yr(i))):r}function Xu(r){let e=0;return r.forEach((t,i)=>{t.type==="optgroup"?(t._key=`group_${i}`,t.visible=typeof t.visible>"u"?!0:t.visible,t.children.forEach((s,n)=>{s&&(s.visible=typeof(s==null?void 0:s.visible)>"u"?!0:s.visible,s.divider||(s._key=`option_${i}_${n}`,e+=1))})):(t.visible=typeof t.visible>"u"?!0:t.visible,t.divider||(t._key=`option_${i}`,e+=1))}),e}function js(r,e,t){if(Array.isArray(r))for(let i of r){if(i[e]===t||i[e]===`${+i[e]}`&&+i[e]===t)return i;if(i.type==="optgroup"){for(let s of i.children)if(s&&(s[e]===t||s[e]===`${+s[e]}`&&+s[e]===t))return s}}}function qu(r){return r.replace(/(\b)(on[a-z]+)(\s*)=([^>]*)|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(&lt;|&#60;)(\/*)(script|script defer)(.*)(&#62;|&gt;|&gt;">)/gi,"")}function Er(r){return Object.keys(r).forEach(e=>r[e]===void 0?delete r[e]:""),r}function Ei(r,e){if(typeof r!="string")return r;if(typeof e=="function")return e(r);if(typeof r.normalize=="function")return r.normalize("NFD").replace(/[\u0300-\u036F]/g,"");throw new Error("[Multiple-Select-Vanilla] `normalize()` function is not defined, you can optionally provide a custom parser via the `diacriticParser` option.")}function wr(r){let e=0,t=0,i=0,s=0,n=window.innerHeight??0,o=window.innerWidth??0,l=Zu(),a=l.top,h=l.left,d=xr(r);if(d){let c=d.top??0,u=d.left??0;t=c-a,e=n-(c-a),i=u-h,s=o-(u-h)}return{top:t,bottom:e,left:i,right:s}}function Tr(r=""){return r.split(" ").filter(e=>e)}function Ge(r,e,t){let i=document.createElement(r);return e&&Object.keys(e).forEach(s=>{let n=e[s];typeof n=="object"?Object.assign(i[s],n):i[s]=e[s]}),t!=null&&t.appendChild&&t.appendChild(i),i}function wa(r,e,t){var n;let i=(n=r.props)!=null&&n.innerHTML?Qu(r.props,"innerHTML"):r.props,s=Ge(r.tagName,Yu(i,["className","title","style"]),e);if(r.props.innerHTML&&(s.innerHTML=r.props.innerHTML),r.attrs)for(let o of Object.keys(r.attrs))s.setAttribute(o,r.attrs[o]);if(r.children)for(let o of r.children)wa(o,s);return e==null||e.appendChild(s),s}function Or(r){return r.hasOwnProperty("tagName")?wa(r):document.createElement("li")}function Ys(r){for(;r!=null&&r.firstChild;)r.lastChild&&r.removeChild(r.lastChild);return r}function xr(r){var o;if(!r)return;let e=(o=r==null?void 0:r.getBoundingClientRect)==null?void 0:o.call(r),t=0,i=0,s=0,n=0;return(e==null?void 0:e.top)!==void 0&&e.left!==void 0&&(t=e.top+window.pageYOffset,i=e.left+window.pageXOffset,n=e.right,s=e.bottom),{top:t,left:i,bottom:s,right:n}}function Xs(r,e,t){if(!r)return 0;let i=Number.parseFloat(r.style[t]);if(!i||Number.isNaN(i)){switch(e){case"outer":i=r[t==="width"?"offsetWidth":"offsetHeight"];break;case"scroll":i=r[t==="width"?"scrollWidth":"scrollHeight"];break;case"inner":default:i=r[t==="width"?"clientWidth":"clientHeight"];break}i=r.getBoundingClientRect()[t]}if(!i||Number.isNaN(i)){let s=r.style.display,n=r.style.position;r.style.display="block",r.style.position="absolute";let o=window.getComputedStyle(r)[t];i=Number.parseFloat(o),Number.isNaN(i)&&(i=0),r.style.display=s,r.style.position=n}return i||0}function Ta(r,e){let t=null,i=r==null?void 0:r.parentElement;for(;i;){let[s,n,o,l]=e.match(/^([a-z]*)([#.]{1})([a-z\-]+)$/i)||[];if(o&&l)for(let a of l.replace(o,"").split(" "))i.classList.contains(a)&&(n?(i==null?void 0:i.tagName.toLowerCase())===n&&(t=i):t=i);i=i.parentElement}return t}function Ku(r,e){var t;(t=r.parentNode)==null||t.insertBefore(e,r.nextSibling)}function Qu(r,e){let{[e]:t,...i}=r;return i}function Oa(r,e){r!=null&&r.style&&(r.style.display=r.style.display==="none"&&e!==!1||e===!0?"block":"none")}function Zu(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}var Ju=class{constructor(e){var i;V(this,"clusterRows"),V(this,"cache"),V(this,"scrollEl"),V(this,"blockHeight"),V(this,"clusterHeight"),V(this,"contentEl"),V(this,"parentEl"),V(this,"itemHeight"),V(this,"lastCluster"),V(this,"scrollTop"),V(this,"dataStart"),V(this,"dataEnd"),V(this,"rows"),V(this,"destroy"),V(this,"callback"),V(this,"sanitizer"),this.rows=e.rows,this.scrollEl=e.scrollEl,this.contentEl=e.contentEl,this.parentEl=(i=e.contentEl)==null?void 0:i.parentElement,this.callback=e.callback,this.cache={},this.scrollTop=this.scrollEl.scrollTop,this.initDOM(this.rows),this.scrollEl.scrollTop=this.scrollTop,this.lastCluster=0;let t=()=>{this.lastCluster!==(this.lastCluster=this.getNum())&&(this.initDOM(this.rows),this.callback())};this.scrollEl.addEventListener("scroll",t,!1),this.destroy=()=>{this.scrollEl.removeEventListener("scroll",t,!1),Ys(this.contentEl)}}reset(e){this.lastCluster=0,this.cache={},Ys(this.contentEl),this.initDOM(e)}initDOM(e){if(typeof this.clusterHeight>"u"){this.cache.scrollTop=this.scrollEl.scrollTop;let o=Or(e[0]);this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.cache.data=[e[0]],this.getRowsHeight()}let t=this.initData(e,this.getNum()),i=this.checkChanges("data",t.rows),s=this.checkChanges("top",t.topOffset),n=this.checkChanges("bottom",t.bottomOffset);Ys(this.contentEl),i&&s?(t.topOffset&&this.contentEl.appendChild(this.getExtra("top",t.topOffset)),t.rows.forEach(o=>this.contentEl.appendChild(Or(o))),t.bottomOffset&&this.contentEl.appendChild(this.getExtra("bottom",t.bottomOffset))):n&&this.contentEl.lastChild&&(this.contentEl.lastChild.style.height=`${t.bottomOffset}px`)}getRowsHeight(){var e;if(typeof this.itemHeight>"u"){let t=((e=this.parentEl)==null?void 0:e.style.display)||"";this.parentEl&&(t===""||t==="none")&&(this.parentEl.style.display="block");let i=this.contentEl.children,s=i[Math.floor(i.length/2)];this.itemHeight=s.offsetHeight,this.parentEl&&(this.parentEl.style.display=t)}this.blockHeight=this.itemHeight*ft.BLOCK_ROWS,this.clusterRows=ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS,this.clusterHeight=this.blockHeight*ft.CLUSTER_BLOCKS}getNum(){this.scrollTop=this.scrollEl.scrollTop;let e=(this.clusterHeight||0)-(this.blockHeight||0);return e&&Math.floor(this.scrollTop/e)||0}initData(e,t){if(e.length<ft.BLOCK_ROWS)return{topOffset:0,bottomOffset:0,rowsAbove:0,rows:e};let i=Math.max((this.clusterRows-ft.BLOCK_ROWS)*t,0),s=i+this.clusterRows,n=Math.max(i*this.itemHeight,0),o=Math.max((e.length-s)*this.itemHeight,0),l=[],a=i;n<1&&a++;for(let h=i;h<s;h++)e[h]&&l.push(e[h]);return this.dataStart=i,this.dataEnd=s,{topOffset:n,bottomOffset:o,rowsAbove:a,rows:l}}checkChanges(e,t){let i=t!==this.cache[e];return this.cache[e]=t,i}getExtra(e,t){let i=document.createElement("li");return i.className=`virtual-scroll-${e}`,t&&(i.style.height=`${t}px`),i}},ns=".ms-select-all, ul li[data-key]",ep=".ms-select-all.highlighted, ul li[data-key].highlighted",tp=class{constructor(e,t){this.elm=e,V(this,"_bindEventService"),V(this,"isAllSelected",!1),V(this,"isPartiallyAllSelected",!1),V(this,"fromHtml",!1),V(this,"choiceElm"),V(this,"selectClearElm"),V(this,"closeElm"),V(this,"clearSearchIconElm"),V(this,"filterText",""),V(this,"updateData",[]),V(this,"data",[]),V(this,"dataTotal"),V(this,"dropElm"),V(this,"okButtonElm"),V(this,"filterParentElm"),V(this,"lastFocusedItemKey",""),V(this,"lastMouseOverPosition",""),V(this,"ulElm"),V(this,"parentElm"),V(this,"labelElm"),V(this,"selectAllParentElm"),V(this,"selectAllElm"),V(this,"searchInputElm"),V(this,"selectGroupElms"),V(this,"selectItemElms"),V(this,"noResultsElm"),V(this,"options"),V(this,"selectAllName",""),V(this,"selectGroupName",""),V(this,"selectItemName",""),V(this,"scrolledByMouse",!1),V(this,"openDelayTimer"),V(this,"updateDataStart"),V(this,"updateDataEnd"),V(this,"virtualScroll"),V(this,"_currentHighlightIndex",-1),V(this,"_currentSelectedElm"),V(this,"isMoveUpRecalcRequired",!1),V(this,"locales",{}),this.options=Object.assign({},ft.DEFAULTS,this.elm.dataset,t),this._bindEventService=new Bu({distinctEvent:!0})}get isRenderAsHtml(){return this.options.renderOptionLabelAsHtml||this.options.useSelectOptionLabelToHtml}init(){this.initLocale(),this.initContainer(),this.initData(),this.initSelected(!0),this.initFilter(),this.initDrop(),this.initView(),this.options.onAfterCreate()}destroy(e=!0){var t,i,s,n,o;this.elm&&this.parentElm&&(this.options.onDestroy({hardDestroy:e}),e&&this.options.onHardDestroy(),this.elm.parentElement&&this.parentElm.parentElement&&this.elm.parentElement.insertBefore(this.elm,this.parentElm.parentElement.firstChild),this.elm.classList.remove("ms-offscreen"),this._bindEventService.unbindAll(),(t=this.virtualScroll)==null||t.destroy(),(i=this.dropElm)==null||i.remove(),this.dropElm=void 0,(s=this.parentElm.parentNode)==null||s.removeChild(this.parentElm),this.fromHtml&&(delete this.options.data,this.fromHtml=!1),this.options.onAfterDestroy({hardDestroy:e}),e&&((o=(n=this.options).onAfterHardDestroy)==null||o.call(n),Object.keys(this.options).forEach(l=>delete this[l])))}initLocale(){if(this.options.locale){if(typeof this.options.locale=="object"){Object.assign(this.options,this.options.locale);return}let e=window.multipleSelect.locales,t=this.options.locale.split(/-|_/);if(t[0]=t[0].toLowerCase(),t[1]&&(t[1]=t[1].toUpperCase()),e[this.options.locale])Object.assign(this.options,e[this.options.locale]);else if(e[t.join("-")])Object.assign(this.options,e[t.join("-")]);else if(e[t[0]])Object.assign(this.options,e[t[0]]);else throw new Error(`[multiple-select-vanilla] invalid locales "${this.options.locale}", make sure to import it before using it`)}}initContainer(){var s;let e=this.elm.getAttribute("name")||this.options.name||"";this.options.classes&&this.elm.classList.add(this.options.classes),this.options.classPrefix&&(this.elm.classList.add(this.options.classPrefix),this.options.size&&this.elm.classList.add(`${this.options.classPrefix}-${this.options.size}`)),this.elm.style.display="none",this.labelElm=this.elm.closest("label"),!this.labelElm&&this.elm.id&&(this.labelElm=document.createElement("label"),this.labelElm.htmlFor=this.elm.id),(s=this.labelElm)!=null&&s.querySelector("input")&&(this.labelElm=null),typeof this.options.single>"u"&&(this.options.single=!this.elm.multiple),this.parentElm=Ge("div",{className:Tr(`ms-parent ${this.elm.className||""} ${this.options.classes}`).join(" "),dataset:{test:"sel"}}),this.options.darkMode&&this.parentElm.classList.add("ms-dark-mode");let t=this.elm.getAttribute("title")||"";t&&(this.parentElm.title=t),this.options.placeholder=this.options.placeholder||this.elm.getAttribute("placeholder")||"",this.choiceElm=Ge("button",{className:"ms-choice",type:"button"},this.parentElm),this.options.labelId&&(this.choiceElm.id=this.options.labelId,this.choiceElm.setAttribute("aria-labelledby",this.options.labelId)),this.choiceElm.appendChild(Ge("span",{className:"ms-placeholder",textContent:this.options.placeholder})),this.options.showClear&&(this.selectClearElm=Ge("div",{className:"ms-icon ms-icon-close"}),this.selectClearElm.style.display="none",this.choiceElm.appendChild(this.selectClearElm)),this.choiceElm.appendChild(Ge("div",{className:"ms-icon ms-icon-caret"})),this.dropElm=Ge("div",{className:`ms-drop ${this.options.position}`,ariaExpanded:"false"},this.parentElm),this.options.darkMode&&this.dropElm.classList.add("ms-dark-mode"),e&&(this.dropElm.dataset.name=e);let i=this.elm.getAttribute("data-test")||this.options.dataTest;i&&(this.parentElm.dataset.test=i,this.dropElm.dataset.test=i),this.closeElm=this.choiceElm.querySelector(".ms-icon-close"),this.options.dropWidth&&(this.dropElm.style.width=typeof this.options.dropWidth=="string"?this.options.dropWidth:`${this.options.dropWidth}px`),Ku(this.elm,this.parentElm),this.elm.disabled&&(this.choiceElm.classList.add("disabled"),this.choiceElm.disabled=!0),this.selectAllName=`selectAll${e}`,this.selectGroupName=`selectGroup${e}`,this.selectItemName=`selectItem${e}`,this.options.keepOpen||(this._bindEventService.unbindAll("body-click"),this._bindEventService.bind(document.body,"click",n=>{this.getEventTarget(n)===this.choiceElm||Ta(this.getEventTarget(n),".ms-choice")===this.choiceElm||(this.getEventTarget(n)===this.dropElm||Ta(this.getEventTarget(n),".ms-drop")!==this.dropElm&&this.getEventTarget(n)!==this.elm)&&this.options.isOpen&&this.close("body.click")},void 0,"body-click"))}initData(){let e=[];if(this.options.data){if(Array.isArray(this.options.data))this.data=this.options.data.map(t=>typeof t=="string"||typeof t=="number"?{text:t,value:t}:t);else if(typeof this.options.data=="object"){for(let[t,i]of Object.entries(this.options.data))e.push({value:t,text:`${i}`});this.data=e}}else this.elm.childNodes.forEach(t=>{let i=this.initRow(t);i&&e.push(i)}),this.options.data=e,this.data=e,this.fromHtml=!0;this.dataTotal=Xu(this.data||[])}initRow(e,t){var s,n;let i={};return((s=e.tagName)==null?void 0:s.toLowerCase())==="option"?(i.type="option",i.text=this.options.textTemplate(e),i.value=e.value,i.visible=!0,i.selected=!!e.selected,i.disabled=t||e.disabled,i.classes=e.getAttribute("class")||"",i.title=e.getAttribute("title")||"",e.dataset.value&&(i._value=e.dataset.value),Object.keys(e.dataset).length&&(i._data=e.dataset,i._data.divider&&(i.divider=i._data.divider)),i):((n=e.tagName)==null?void 0:n.toLowerCase())==="optgroup"?(i.type="optgroup",i.label=this.options.labelTemplate(e),i.visible=!0,i.selected=!!e.selected,i.disabled=e.disabled,i.children=[],Object.keys(e.dataset).length&&(i._data=e.dataset),e.childNodes.forEach(o=>{i.children.push(this.initRow(o,i.disabled))}),i):null}initDrop(){this.initList(),this.update(!0),this.options.isOpen&&this.open(10),this.options.openOnHover&&this.parentElm&&(this._bindEventService.bind(this.parentElm,"mouseover",()=>this.open(null)),this._bindEventService.bind(this.parentElm,"mouseout",()=>this.close("hover.mouseout")))}initFilter(){if(this.filterText="",this.options.filter||!this.options.filterByDataLength)return;let e=0;for(let t of this.data||[])t.type==="optgroup"?e+=t.children.length:e+=1;this.options.filter=e>this.options.filterByDataLength}initList(){var e,t;if(this.options.filter&&(this.filterParentElm=Ge("div",{className:"ms-search"},this.dropElm),this.filterParentElm.appendChild(Ge("input",{autocomplete:"off",autocapitalize:"off",spellcheck:!1,type:"text",placeholder:this.options.filterPlaceholder||"🔎︎"})),this.options.showSearchClear&&this.filterParentElm.appendChild(Ge("span",{className:"ms-icon ms-icon-close"}))),this.options.selectAll&&!this.options.single){let i=this.elm.getAttribute("name")||this.options.name||"";this.selectAllParentElm=Ge("div",{className:"ms-select-all",dataset:{key:"select_all"}});let s=document.createElement("label"),n=`ms-icon ${this.isAllSelected?"ms-icon-check":this.isPartiallyAllSelected?"ms-icon-minus":"ms-icon-uncheck"}`,o=Ge("div",{className:"icon-checkbox-container"},s);Ge("input",{type:"checkbox",ariaChecked:String(this.isAllSelected),checked:this.isAllSelected,dataset:{name:`selectAll${i}`}},o),Ge("div",{className:n},o),s.appendChild(Ge("span",{textContent:this.formatSelectAll()})),this.selectAllParentElm.appendChild(s),(e=this.dropElm)==null||e.appendChild(this.selectAllParentElm)}this.ulElm=document.createElement("ul"),this.ulElm.role="combobox",this.ulElm.ariaExpanded="false",this.ulElm.ariaMultiSelectable=String(!this.options.single),(t=this.dropElm)==null||t.appendChild(this.ulElm),this.options.showOkButton&&!this.options.single&&(this.okButtonElm=Ge("button",{className:"ms-ok-button",type:"button",textContent:this.formatOkButton()},this.dropElm)),this.initListItems()}initListItems(){var i;let e=0,t=this.getListRows();if(this.options.selectAll&&!this.options.single&&(e=-1),t.length>ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS){let s=this.dropElm&&((i=this.dropElm)==null?void 0:i.style.display)!=="none";!s&&this.dropElm&&(this.dropElm.style.left="-10000",this.dropElm.style.display="block",this.dropElm.ariaExpanded="true");let n=()=>{if(this.virtualScroll){this._currentHighlightIndex=0,this.updateDataStart=this.virtualScroll.dataStart+e,this.updateDataEnd=this.virtualScroll.dataEnd+e,this.updateDataStart<0&&(this.updateDataStart=0,this._currentHighlightIndex=0);let o=this.getDataLength();this.updateDataEnd>o&&(this.updateDataEnd=o),this.ulElm&&(this.isMoveUpRecalcRequired?this.recalculateArrowMove("up"):this.virtualScroll.dataStart>this.updateDataStart&&this.recalculateArrowMove("down"))}};this.ulElm&&(this.virtualScroll?this.virtualScroll.reset(t):this.virtualScroll=new Ju({rows:t,scrollEl:this.ulElm,contentEl:this.ulElm,sanitizer:this.options.sanitizer,callback:()=>{n(),this.events()}})),n(),!s&&this.dropElm&&(this.dropElm.style.left="0",this.dropElm.style.display="none",this.dropElm.ariaExpanded="false")}else this.ulElm&&(Ys(this.ulElm),t.forEach(s=>this.ulElm.appendChild(Or(s)))),this.updateDataStart=0,this.updateDataEnd=this.updateData.length;return this.events(),t}getEventTarget(e){return e.composedPath?e.composedPath()[0]:e.target}getListRows(){var t;let e=[];return this.updateData=[],(t=this.data)==null||t.forEach(i=>e.push(...this.initListItem(i))),this.options.infiniteScroll&&e.push({tagName:"li",props:{className:"ms-infinite-option",role:"option"}}),e.push({tagName:"li",props:{className:"ms-no-results",textContent:this.formatNoMatchesFound()}}),e}initListItem(e,t=0){let i=(e==null?void 0:e.title)||"",s=this.options.multiple?"multiple":"",n=this.options.single?"radio":"checkbox",o=!!(e!=null&&e.selected),l=this.options.single&&!this.options.singleRadio,a="";if(!(e!=null&&e.visible))return[];if(this.updateData.push(e),l&&(a="hide-radio "),e.selected&&(a+="selected "),e.type==="optgroup"){let g=[],_;if(this.options.hideOptgroupCheckboxes||this.options.single)_={tagName:"span",props:{dataset:{name:this.selectGroupName,key:e._key}}};else{let y={tagName:"input",props:{type:"checkbox",dataset:{name:this.selectGroupName,key:e._key},checked:o,disabled:e.disabled}};l?_=y:_={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[y,{tagName:"div",props:{className:`ms-icon ${o?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]}}!a.includes("hide-radio")&&(this.options.hideOptgroupCheckboxes||this.options.single)&&(a+="hide-radio ");let b={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(b.props,e.label);let C={tagName:"li",props:{className:Tr(`group${this.options.single||e.disabled?" disabled":""} ${a}`).join(" "),role:"option",ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:Tr(`optgroup${this.options.single||e.disabled?" disabled":""}`).join(" ")},children:[_,b]}]},E=this.options.cssStyler(e);return E&&(C.props.style=E),g.push(C),e.children.forEach(y=>g.push(...this.initListItem(y,1))),g}if(a+=e.classes||"",t&&this.options.single&&(a+=`option-level-${t} `),e.divider)return[{tagName:"li",props:{className:"option-divider"}}];let h=s||a?(s+a).trim():"";e.disabled&&(h+=" disabled");let d=`${e.disabled?"disabled":""}`,c={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(c.props,e.text);let u={tagName:"input",props:{type:n,value:encodeURI(e.value),dataset:{key:e._key,name:this.selectItemName},checked:o,disabled:!!e.disabled}};e.selected&&(u.attrs={checked:"checked"});let p={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[u,{tagName:"div",props:{className:`ms-icon ${u.props.checked?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]},m={tagName:"li",props:{role:"option",title:i,ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:d},children:[l?u:p,c]}]};h&&(m.props.className=h);let f=this.options.cssStyler(e);return f&&(m.props.style=f),[m]}initSelected(e=!1){var i,s;let t=0;for(let n of this.data||[])if(n.type==="optgroup"){let o=n.children.filter(l=>(l==null?void 0:l.selected)&&!l.disabled&&l.visible).length;n.children.length&&(n.selected=!this.options.single&&o&&o===n.children.filter(l=>l&&!l.disabled&&l.visible&&!l.divider).length),t+=o}else t+=n.selected&&!n.disabled&&n.visible?1:0;this.isAllSelected=((i=this.data)==null?void 0:i.filter(n=>n.selected&&!n.disabled&&n.visible).length)===((s=this.data)==null?void 0:s.filter(n=>!n.disabled&&n.visible&&!n.divider).length),this.isPartiallyAllSelected=!this.isAllSelected&&t>0,e||(this.isAllSelected?this.options.onCheckAll():t===0&&this.options.onUncheckAll())}initView(){let e;window.getComputedStyle?(e=window.getComputedStyle(this.elm).width,e==="auto"&&(e=Xs(this.dropElm,"outer","width")+20)):e=Xs(this.elm,"outer","width")+20,this.parentElm.style.width=`${this.options.width||e}px`,this.elm.classList.add("ms-offscreen")}events(){var t,i,s,n,o,l,a;this._bindEventService.unbindAll(["ok-button","search-input","select-all-checkbox","input-checkbox-list","group-checkbox-list","hover-highlight","arrow-highlight","option-list-scroll"]),this.clearSearchIconElm=(t=this.filterParentElm)==null?void 0:t.querySelector(".ms-icon-close"),this.searchInputElm=(i=this.dropElm)==null?void 0:i.querySelector(".ms-search input"),this.selectAllElm=(s=this.dropElm)==null?void 0:s.querySelector(`input[data-name="${this.selectAllName}"]`),this.selectGroupElms=(n=this.dropElm)==null?void 0:n.querySelectorAll(`input[data-name="${this.selectGroupName}"],span[data-name="${this.selectGroupName}"]`),this.selectItemElms=(o=this.dropElm)==null?void 0:o.querySelectorAll(`input[data-name="${this.selectItemName}"]:enabled`),this.noResultsElm=(l=this.dropElm)==null?void 0:l.querySelector(".ms-no-results");let e=h=>{h.preventDefault(),!this.getEventTarget(h).classList.contains("ms-icon-close")&&(this.options.isOpen?this.close("toggle.close"):this.open())};this.labelElm&&this._bindEventService.bind(this.labelElm,"click",h=>{this.getEventTarget(h).nodeName.toLowerCase()==="label"&&(e(h),(!this.options.filter||!this.options.isOpen)&&this.focus(),h.stopPropagation())}),this._bindEventService.bind(this.choiceElm,"click",e),this.options.onFocus&&this._bindEventService.bind(this.choiceElm,"focus",this.options.onFocus),this.options.onBlur&&this._bindEventService.bind(this.choiceElm,"blur",this.options.onBlur),this._bindEventService.bind(this.parentElm,"keydown",h=>{h.code==="Escape"&&this.handleEscapeKey()}),this.closeElm&&this._bindEventService.bind(this.closeElm,"click",h=>{h.preventDefault(),this._checkAll(!1,!0),this.initSelected(!1),this.updateSelected(),this.update(),this.options.onClear()}),this.clearSearchIconElm&&this._bindEventService.bind(this.clearSearchIconElm,"click",h=>{h.preventDefault(),this.searchInputElm&&(this.searchInputElm.value="",this.searchInputElm.focus()),this._currentHighlightIndex=-1,this.moveHighlightDown(),this.filter(),this.options.onFilterClear()}),this.searchInputElm&&(this._bindEventService.bind(this.searchInputElm,"keydown",h=>{h.code==="Tab"&&h.shiftKey&&this.close("key.shift+tab")},void 0,"search-input"),this._bindEventService.bind(this.searchInputElm,"keyup",h=>{var d,c,u;if(this.options.filterAcceptOnEnter&&["Enter","Space"].includes(h.code)&&((d=this.searchInputElm)!=null&&d.value)){if(this.options.single){let p=[];(c=this.selectItemElms)==null||c.forEach(m=>{var f;((f=m.closest("li"))==null?void 0:f.style.display)!=="none"&&p.push(m)}),p.length&&p[0].hasAttribute("data-name")&&this.setSelects([p[0].value])}else(u=this.selectAllElm)==null||u.click();this.close(`key.${h.code.toLowerCase()}`),this.focus();return}this.filter()},void 0,"search-input")),this.selectAllElm&&this._bindEventService.bind(this.selectAllElm,"click",h=>{var d;return this._checkAll((d=h.currentTarget)==null?void 0:d.checked)},void 0,"select-all-checkbox"),this.okButtonElm&&this._bindEventService.bind(this.okButtonElm,"click",h=>{e(h),h.stopPropagation()},void 0,"ok-button"),this.selectGroupElms&&this._bindEventService.bind(this.selectGroupElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key);this._checkGroup(u,c),this.options.onOptgroupClick(Er({label:u.label,selected:u.selected,data:u._data,children:u.children.map(p=>{if(p)return Er({text:p.text,value:p.value,selected:p.selected,disabled:p.disabled,data:p._data})})}))},void 0,"group-checkbox-list"),this.selectItemElms&&this._bindEventService.bind(this.selectItemElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key),p=()=>{this.options.single&&this.options.isOpen&&!this.options.keepOpen&&this.close("selection")};if(this.options.onBeforeClick(u)===!1){p();return}this._check(u,c),this.options.onClick(Er({text:u.text,value:u.value,selected:u.selected,data:u._data})),p()},void 0,"input-checkbox-list"),this.lastFocusedItemKey&&this.dropElm&&((a=this.dropElm.querySelector(`li[data-key=${this.lastFocusedItemKey}]`))==null||a.focus()),this.options.navigationHighlight&&this.dropElm&&(this._bindEventService.bind(this.dropElm,"mouseover",h=>{var c,u;let d=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if((c=this.dropElm)!=null&&c.contains(d)&&this.lastMouseOverPosition!==`${h.clientX}:${h.clientY}`){let p=((u=this.dropElm)==null?void 0:u.querySelectorAll(ns))||[],m=Array.from(p).findIndex(f=>f.dataset.key===d.dataset.key);this._currentHighlightIndex!==m&&!d.classList.contains("disabled")&&(this._currentSelectedElm=d,this._currentHighlightIndex=m,this.changeCurrentOptionHighlight(d))}this.lastMouseOverPosition=`${h.clientX}:${h.clientY}`},void 0,"hover-highlight"),this._bindEventService.bind(this.dropElm,"keydown",h=>{var d,c,u,p;switch(h.key){case"ArrowUp":h.preventDefault(),this.moveHighlightUp();break;case"ArrowDown":h.preventDefault(),this.moveHighlightDown();break;case"Escape":this.handleEscapeKey();break;case"Enter":case" ":{if(document.activeElement!==this.okButtonElm){let m=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if(h.key===" "&&this.options.filter||this.options.filterAcceptOnEnter&&!m)return;h.preventDefault(),(c=(d=this._currentSelectedElm)==null?void 0:d.querySelector("input"))==null||c.click(),this.options.single&&(this.choiceElm.focus(),this.lastFocusedItemKey=((u=this.choiceElm)==null?void 0:u.dataset.key)||"")}break}case"Tab":{h.preventDefault(),h.shiftKey?document.activeElement===this.okButtonElm?(this.focusSelectAllOrList(),this.highlightCurrentOption()):(this.close("key.shift+tab"),this.choiceElm.focus()):(this.changeCurrentOptionHighlight(),(p=this.okButtonElm)==null||p.focus());break}}},void 0,"arrow-highlight")),this.ulElm&&this.options.infiniteScroll&&this._bindEventService.bind(this.ulElm,"scroll",this.infiniteScrollHandler.bind(this),void 0,"option-list-scroll")}handleEscapeKey(){this.options.keepOpen||(this.close("key.escape"),this.choiceElm.focus())}infiniteScrollHandler(e,t,i){let s=!1;e&&this.getEventTarget(e)&&this.ulElm&&this.scrolledByMouse?this.getEventTarget(e).scrollTop+this.getEventTarget(e).clientHeight===this.ulElm.scrollHeight&&(s=!0):t!==void 0&&t+1===i&&(s=!0),s&&this.ulElm&&(this.virtualScroll?this.initListItems():this.ulElm.scrollTop=0,this._currentHighlightIndex=0,this.highlightCurrentOption())}open(e=0){return new Promise(t=>{e!==null&&e>=0?(clearTimeout(this.openDelayTimer),this.openDelayTimer=setTimeout(()=>{this.openDrop(),t()},e)):(this.openDrop(),t())})}openDrop(){var s,n,o,l,a;if(!this.dropElm||(s=this.choiceElm)!=null&&s.classList.contains("disabled"))return;if(this.options.isOpen=!0,this.parentElm.classList.add("ms-parent-open"),(o=(n=this.choiceElm)==null?void 0:n.querySelector("div.ms-icon-caret"))==null||o.classList.add("open"),this.dropElm.style.display="block",this.dropElm.ariaExpanded="true",(l=this.selectAllElm)!=null&&l.parentElement&&(this.selectAllElm.parentElement.style.display="inline-flex"),this.noResultsElm&&(this.noResultsElm.style.display="none"),this.getDataLength()||((a=this.selectAllElm)!=null&&a.parentElement&&(this.selectAllElm.parentElement.style.display="none"),this.noResultsElm&&(this.noResultsElm.style.display="block")),this.options.container){let h=xr(this.dropElm),d;this.options.container instanceof Node?d=this.options.container:typeof this.options.container=="string"&&(d=this.options.container==="body"?document.body:document.querySelector(this.options.container)),d.appendChild(this.dropElm),this.dropElm.style.top=`${(h==null?void 0:h.top)??0}px`,this.dropElm.style.left=`${(h==null?void 0:h.left)??0}px`,this.dropElm.style.minWidth="auto",this.dropElm.style.width=`${Xs(this.parentElm,"outer","width")}px`}let e=this.options.minHeight,t=this.options.maxHeight;this.options.maxHeightUnit==="row"&&(t=Xs(this.dropElm.querySelector("ul>li"),"outer","height")*this.options.maxHeight),this.ulElm??(this.ulElm=this.dropElm.querySelector("ul")),this.ulElm&&(e&&(this.ulElm.style.minHeight=`${e}px`),this.ulElm.style.maxHeight=`${t}px`),this.dropElm.querySelectorAll(".multiple").forEach(h=>{h.style.width=`${this.options.multipleWidth}px`}),this.getDataLength()&&this.options.filter?(this.searchInputElm&&(this.searchInputElm.value="",this.searchInputElm.focus()),this.filter(!0)):this.focusSelectAllOrList(),this._currentHighlightIndex<0?this.moveHighlightDown():this.highlightCurrentOption(),this.options.autoAdjustDropWidthByTextSize&&this.adjustDropWidthByText();let i=this.options.position;if(this.options.autoAdjustDropHeight){if(this.options.autoAdjustDropPosition){let{bottom:h,top:d}=wr(this.dropElm),c=this.dropElm.getBoundingClientRect().height;i=h<c&&d>h?"top":"bottom"}this.adjustDropHeight(i)}this.options.autoAdjustDropPosition&&this.adjustDropPosition(!0),this.options.onOpen()}focusSelectAllOrList(){this.selectAllElm?this.selectAllElm.focus():this.ulElm&&(this.ulElm.tabIndex=0,this.ulElm.focus())}highlightCurrentOption(){var t;let e=((t=this.dropElm)==null?void 0:t.querySelectorAll(ns))||[];if(this._currentHighlightIndex<=e.length){let i=e[this._currentHighlightIndex];i&&(this.lastFocusedItemKey=i.dataset.key||"",this._currentSelectedElm=i,this.scrolledByMouse=!1,i.scrollIntoView({block:"nearest"}),this.changeCurrentOptionHighlight(i),setTimeout(()=>this.scrolledByMouse=!0,10))}}changeCurrentOptionHighlight(e){var t;e==null||e.classList.add("highlighted"),(((t=this.dropElm)==null?void 0:t.querySelectorAll(ep))||[]).forEach(i=>{i!==e&&i.classList.remove("highlighted")})}moveHighlightDown(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=e.length;this._currentHighlightIndex<t-1?(this._currentHighlightIndex++,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightDown()):this.options.infiniteScroll&&this.infiniteScrollHandler(null,this._currentHighlightIndex,t),this.highlightCurrentOption()}moveHighlightUp(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=this.options.single?0:1;if(this.virtualScroll&&this._currentHighlightIndex<=t&&this.updateDataStart>0&&this.ulElm){let n=e[this._currentHighlightIndex+(this.options.single?0:1)],o=n==null?void 0:n.dataset.key;this.lastFocusedItemKey=o,this.ulElm.scrollTop=this.ulElm.scrollTop-(n==null?void 0:n.getBoundingClientRect().height)||10,this.isMoveUpRecalcRequired=!0;return}this._currentHighlightIndex>0&&(this._currentHighlightIndex--,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightUp()),this.highlightCurrentOption()}recalculateArrowMove(e){var s;let t=((s=this.dropElm)==null?void 0:s.querySelectorAll(ns))||[],i=Array.from(t).findIndex(n=>n.dataset.key===this.lastFocusedItemKey);this._currentHighlightIndex=i-1,e==="down"?this.moveHighlightDown():e==="up"&&(this.moveHighlightUp(),this.isMoveUpRecalcRequired=!1)}close(e){var t,i;this.options.isOpen=!1,this.parentElm.classList.remove("ms-parent-open"),(i=(t=this.choiceElm)==null?void 0:t.querySelector("div.ms-icon-caret"))==null||i.classList.remove("open"),this.dropElm&&(this.dropElm.style.display="none",this.dropElm.ariaExpanded="false",this.options.container&&(this.parentElm.appendChild(this.dropElm),this.dropElm.style.top="auto",this.dropElm.style.left="auto")),this.options.onClose(e)}applyAsTextOrHtmlWhenEnabled(e,t){e||(e={}),this.isRenderAsHtml?e.innerHTML=typeof this.options.sanitizer=="function"?this.options.sanitizer(t):t:e.textContent=t}update(e=!1){var h;let t=this.getSelects(),i=this.getSelects("text");this.options.displayValues&&(i=t);let s=(h=this.choiceElm)==null?void 0:h.querySelector("span"),n=t.length,o=null,l=()=>{if(this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml){let d=t.join(this.options.displayDelimiter);return this.options.useSelectOptionLabelToHtml?qu(d):d}return i.join(this.options.displayDelimiter)};if(s){if(n===0){let d=this.options.placeholder||"";s.classList.add("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,d)}else n<this.options.minimumCountSelected?o=l():this.formatAllSelected()&&n===this.dataTotal?o=this.formatAllSelected():this.options.ellipsis&&n>this.options.minimumCountSelected?o=`${i.slice(0,this.options.minimumCountSelected).join(this.options.displayDelimiter)}...`:this.formatCountSelected(n,this.dataTotal)&&n>this.options.minimumCountSelected?o=this.formatCountSelected(n,this.dataTotal):o=l();if(o!==null&&(s==null||s.classList.remove("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,o)),this.options.showClear&&this.selectClearElm){let d=o?"block":"none";this.selectClearElm.style.display=d}if(this.options.displayTitle){let d=this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml?"value":"text";s.title=this.getSelects(d).join(this.options.displayDelimiter)}}let a=this.getSelects();this.options.single?this.elm.value=a.length?a[0]:"":Array.from(this.elm.options).forEach(d=>{d.selected=a.some(c=>c===d.value)}),e||this.elm.dispatchEvent(new Event("change"))}updateSelected(e){var i,s,n;for(let o=this.updateDataStart;o<this.updateDataEnd;o++){let l=this.updateData[o],a=(i=this.dropElm)==null?void 0:i.querySelector(`input[data-key=${l._key}]`);if(a){a.checked=l.selected;let h=a.closest("li"),d=h==null?void 0:h.querySelector(".icon-checkbox-container div");h&&(l.selected&&!h.classList.contains("selected")?(h.classList.add("selected"),h.ariaSelected="true",d&&(d.className=`ms-icon ms-icon-${a.type==="radio"?"radio":"check"}`)):l.selected||(h.classList.remove("selected"),h.ariaSelected="false",d&&(d.className="ms-icon ms-icon-uncheck")))}}let t=((s=this.data)==null?void 0:s.filter(o=>o.visible).length)===0;if(this.selectAllElm){this.selectAllElm.ariaChecked=String(this.isAllSelected);let o=(n=this.dropElm)==null?void 0:n.querySelector(".ms-select-all .icon-checkbox-container div");if(o){let l="";this.isAllSelected?l="ms-icon-check":this.isPartiallyAllSelected?l="ms-icon-minus":l="ms-icon-uncheck",o.className=`ms-icon ${l}`}this.selectAllElm.checked=this.isAllSelected,Oa(this.selectAllElm.closest("li"),!t)}Oa(this.noResultsElm,t),this.virtualScroll&&(this.virtualScroll.rows=e??this.getListRows())}getData(){return this.options.data}getDataLength(){var e;return((e=this.data)==null?void 0:e.length)??0}getOptions(e=!0){let t=Object.assign({},this.options);return delete t.data,e?Sr(t):this.options}refreshOptions(e){ju(this.options,e,!0)||(this.options=Object.assign(this.options,e),this.destroy(!1),this.init())}getDropElement(){return this.dropElm}getParentElement(){return this.parentElm}getSelects(e="value"){let t=[];for(let i of this.data||[])if(i.type==="optgroup"){let s=i.children.filter(n=>n==null?void 0:n.selected);if(!s.length)continue;if(e==="value"||this.options.single)t.push(...s.map(n=>e==="value"&&n._value||n[e]));else{let n=[];n.push("["),n.push(i.label),n.push(`: ${s.map(o=>o[e]).join(", ")}`),n.push("]"),t.push(n.join(""))}}else i.selected&&t.push(e==="value"&&i._value||i[e]);return t}setSelects(e,t="value",i=!1){let s=!1,n=o=>{var l;for(let a of o){let h=!1;if(t==="text"){let d=document.createElement("div");this.applyAsTextOrHtmlWhenEnabled(d,a.text),h=e.includes(((l=d.textContent)==null?void 0:l.trim())??"")}else h=e.includes(a._value||a.value),!h&&a.value===`${+a.value}`&&(h=e.includes(+a.value));a.selected!==h&&(s=!0),a.selected=h}};for(let o of this.data||[])o.type==="optgroup"?n(o.children):n([o]);s&&(this.initSelected(i),this.updateSelected(),this.update(i))}enable(){this.choiceElm&&(this.choiceElm.classList.remove("disabled"),this.choiceElm.disabled=!1)}disable(){var e;this.choiceElm&&((e=this.choiceElm)==null||e.classList.add("disabled"),this.choiceElm.disabled=!0)}check(e){let t=js(this.data,"value",e);t&&this._check(t,!0)}uncheck(e){let t=js(this.data,"value",e);t&&this._check(t,!1)}_check(e,t){this.options.single&&this._checkAll(!1,!0),e.selected=t,this.initSelected(),this.updateSelected(),this.update()}checkAll(){this._checkAll(!0)}uncheckAll(){this._checkAll(!1)}_checkAll(e,t){for(let i of this.data||[])i.type==="optgroup"?this._checkGroup(i,e,!0):!i.disabled&&!i.divider&&(t||i.visible)&&(i.selected=e);t||(this.initSelected(),this.updateSelected(),this.update())}_checkGroup(e,t,i){e.selected=t,e.children.forEach(s=>{s&&!s.disabled&&!s.divider&&(i||s.visible)&&(s.selected=t)}),i||(this.initSelected(),this.updateSelected(),this.update())}checkInvert(){if(!this.options.single){for(let e of this.data||[])if(e.type==="optgroup")for(let t of e.children)t&&(t.divider||(t.selected=!t.selected));else e&&!e.divider&&(e.selected=!e.selected);this.initSelected(),this.updateSelected(),this.update()}}focus(){var e;(e=this.choiceElm)==null||e.focus(),this.options.onFocus()}blur(){var e;(e=this.choiceElm)==null||e.blur(),this.options.onBlur()}refresh(){this.destroy(!1),this.init()}filter(e){var n;let t=((n=this.searchInputElm)==null?void 0:n.value.trim())??"",i=t.toLowerCase();if(this.filterText===i)return;this.filterText=i;for(let o of this.data||[])if(o.type==="optgroup")if(this.options.filterGroup){let l=`${(o==null?void 0:o.label)??""}`;if(o!=null){let a=this.options.customFilter({label:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalLabel:l,originalSearch:t,row:o});o.visible=a;for(let h of o.children)h&&(h.visible=a)}}else{for(let l of o.children)if(l!=null){let a=`${(l==null?void 0:l.text)??""}`;l.visible=this.options.customFilter({text:Ei(a.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:a,originalSearch:t,row:l,parent:o})}o.visible=o.children.filter(l=>l==null?void 0:l.visible).length>0}else{let l=`${(o==null?void 0:o.text)??""}`;o.visible=this.options.customFilter({text:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:l,originalSearch:t,row:o})}let s=this.initListItems();this.initSelected(e),this.updateSelected(s),e||this.options.onFilter(t)}adjustDropHeight(e){var d,c,u,p;let t=e!=="top",i=((d=this.filterParentElm)==null?void 0:d.getBoundingClientRect().height)??0,s=((c=this.okButtonElm)==null?void 0:c.getBoundingClientRect().height)??0,n=this.options.single?0:((u=this.selectAllParentElm)==null?void 0:u.getBoundingClientRect().height)??0,o=i+s+n+5,{bottom:l,top:a}=wr(this.parentElm),h=this.options.maxHeight;if(t?h=l-o-this.options.adjustedHeightPadding:h=a-o-this.options.adjustedHeightPadding,!this.options.maxHeight||this.options.maxHeight&&h<this.options.maxHeight){let m=(p=this.dropElm)==null?void 0:p.querySelector("ul");return m&&(m.style.maxHeight=`${h}px`),!0}return!1}adjustDropPosition(e){let t="bottom";if(this.dropElm&&this.parentElm){let{bottom:i,top:s}=wr(this.dropElm),{top:n,left:o}=xr(this.parentElm),l=this.dropElm.getBoundingClientRect().height,a=this.dropElm.getBoundingClientRect().width,h=document.body.offsetWidth||window.innerWidth,d=this.parentElm.getBoundingClientRect().width;if(i>l)t="bottom";else if(l>i&&s>i){if(this.options.container){let c=n-l;c<0&&(c=0),(c>0||e)&&(t="top",this.dropElm.style.top=`${c<0?0:c}px`)}else t="top",this.dropElm.classList.add(t);this.dropElm.classList.remove("bottom")}h-a<o&&(this.dropElm.style.left=`${o-(a-d)}px`)}return t}adjustDropWidthByText(){if(this.dropElm){let e=this.parentElm.scrollWidth;(this.options.dropWidth||this.options.width)&&(e=this.options.dropWidth||this.options.width||0);let t=this.dropElm.querySelector(".ms-select-all span"),i=this.dropElm.querySelector("ul"),s=26,n=(t==null?void 0:t.clientWidth)??0+s,o=i.scrollHeight>i.clientHeight?this.getScrollbarWidth():0,l=0;this.dropElm.querySelectorAll("li label").forEach(a=>{a.scrollWidth>l&&(l=a.scrollWidth)}),l+=s+o,l<n&&(l=n),this.options.maxWidth&&l>this.options.maxWidth&&(l=this.options.maxWidth),this.options.minWidth&&l<this.options.minWidth&&(l=this.options.minWidth),(e==="100%"||+e<l)&&(this.dropElm.style.width=`${l}px`,this.dropElm.style.maxWidth=`${l}px`)}}getScrollbarWidth(){var n;let e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",document.body.appendChild(e);let t=e.offsetWidth;e.style.overflow="scroll";let i=document.createElement("div");i.style.width="100%",e.appendChild(i);let s=i.offsetWidth;return(n=e.parentNode)==null||n.removeChild(e),t-s}formatAllSelected(){return this.options.allSelectedText||this.options.formatAllSelected()}formatCountSelected(e,t){return this.options.countSelectedText?this.options.countSelectedText.replace("#",`${e}`).replace("%",`${t}`):this.options.formatCountSelected(e,t)}formatNoMatchesFound(){return this.options.noMatchesFoundText||this.options.formatNoMatchesFound()}formatOkButton(){return this.options.okButtonText||this.options.formatOkButton()}formatSelectAll(){return this.options.selectAllText||this.options.formatSelectAll()}},wi=(r,e)=>typeof r=="string"?Ir(document.querySelectorAll(r),e):r instanceof Node?Ir([r],e):Ir(r,e);function Ir(r,e){let t=Array.from(r),i=[];for(let s=0;s<t.length;s++){let n=t[s];try{n._multipleSelect!==void 0&&(n._multipleSelect.destroy(),delete n._multipleSelect),n._multipleSelect=new tp(n,e||{}),n._multipleSelect.init();let o=n._multipleSelect.getOptions(!1);o.onHardDestroy=()=>delete n._multipleSelect,o.onAfterHardDestroyed=()=>i[s]=null,i.push(n._multipleSelect)}catch(o){console.error(o)}}return i.length===1?i[0]:i}wi.defaults=ft.DEFAULTS,wi.locales={...ya},wi.methods=ft.METHODS,typeof window<"u"&&(window.multipleSelect=wi);class xa{constructor(e,t,i,s=!0){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._isMultipleSelect=!0,this._collectionLength=0,this._shouldTriggerQuery=!0,this.isFilled=!1,this.enableTranslateLabel=!1,this.subscriptions=[],this._isMultipleSelect=s}get collectionOptions(){var e,t;return((t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.collectionOptions)??{}}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.customStructure}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get defaultOperator(){return this.isMultipleSelect?H.in:H.equal}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.select,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get isMultipleSelect(){return this._isMultipleSelect}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){var s,n,o,l,a,h,d,c,u,p,m;if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this.filterContainerElm=e.filterContainerElm,!this.grid||!this.columnDef||!this.columnFilter||!this.columnFilter.collection&&!this.columnFilter.collectionAsync)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") for the MultipleSelect/SingleSelect Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: model: Filters.multipleSelect, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }`);if(this.enableTranslateLabel=((s=this.columnFilter)==null?void 0:s.enableTranslateLabel)??!1,this.labelName=((n=this.customStructure)==null?void 0:n.label)??"label",this.labelPrefixName=((o=this.customStructure)==null?void 0:o.labelPrefix)??"labelPrefix",this.labelSuffixName=((l=this.customStructure)==null?void 0:l.labelSuffix)??"labelSuffix",this.optionLabel=((a=this.customStructure)==null?void 0:a.optionLabel)??"value",this.valueName=((h=this.customStructure)==null?void 0:h.value)??"value",this.enableTranslateLabel&&(!this.translaterService||typeof this.translaterService.translate!="function"))throw new Error('[select-filter] The Translate Service is required for the Select Filter to work correctly when "enableTranslateLabel" is set.');this._locales=((d=this.gridOptions)==null?void 0:d.locales)??R.locales,this.initMultipleSelectTemplate();let t=((c=this.gridOptions)==null?void 0:c.defaultFilterPlaceholder)||"";(u=this.columnFilter)!=null&&u.placeholder&&(t=this.columnFilter.placeholder),this.defaultOptions.placeholder=t||"",this._isMultipleSelect&&((p=this.columnDef)!=null&&p.filter)&&(this.columnDef.filter.emptySearchTermReturnAllValues=((m=this.columnDef.filter)==null?void 0:m.emptySearchTermReturnAllValues)??!1);const i=this.columnFilter.collection||[];return new Promise(async(f,g)=>{try{let _;this.columnFilter.collectionAsync&&!this.columnFilter.collection?(_=zo(this.columnFilter.collectionAsync,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),f(_)):(_=i,this.renderDomElement(i),f(i)),(this.columnFilter.collectionAsync||this.columnFilter.enableCollectionWatch)&&(await(_??this.columnFilter.collectionAsync),this.watchCollectionChanges())}catch(_){g(_)}})}clear(e=!0){this._msInstance&&this._collectionLength>0&&(this._msInstance.setSelects([]),this.updateFilterStyle(!1),this.searchTerms=[],this._shouldTriggerQuery=e,this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:this._shouldTriggerQuery}),this._shouldTriggerQuery=!0)}destroy(){var e,t;typeof((e=this._msInstance)==null?void 0:e.destroy)=="function"&&this._msInstance.destroy(),(t=this.filterElm)==null||t.remove(),hs(this.subscriptions)}getValues(){var e;return((e=this._msInstance)==null?void 0:e.getSelects())??[]}setValues(e,t,i=!1){e!==void 0&&this._msInstance&&(e=Array.isArray(e)?e.every(s=>Bi(s))?e.map(String):e:[e],this._msInstance.setSelects(e)),this.updateFilterStyle(this.getValues().length>0),this.operator=t||this.defaultOperator,i&&this.onTriggerEvent()}filterCollection(e){var i,s;let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const n=this.columnFilter.collectionFilterBy,o=((i=this.columnFilter.collectionOptions)==null?void 0:i.filterResultAfterEachPass)||null;t=((s=this.collectionService)==null?void 0:s.filterCollection(t,n,o))||[]}return t}sortCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const s=this.columnFilter.collectionSortBy;t=((i=this.collectionService)==null?void 0:i.sortCollection(this.columnDef,t,s,this.enableTranslateLabel))||[]}return t}watchCollectionChanges(){var e;(e=this.columnFilter)!=null&&e.collection&&(Pi(this.columnFilter.collection,this.watchCallback.bind(this)),ls(this.columnFilter,"collection",this.propertyObserverCallback.bind(this)))}propertyObserverCallback(e){this.renderDomElement(e||[]),this.columnFilter.collection&&Pi(this.columnFilter.collection,this.watchCallback.bind(this))}watchCallback(e){this.renderDomElement(this.columnFilter.collection||e||[])}renderDomElement(e){var n,o,l,a;if(!Array.isArray(e)&&((n=this.collectionOptions)!=null&&n.collectionInsideObjectProperty)){const h=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,h||"")}if(!Array.isArray(e))throw new Error('The "collection" passed to the Select Filter is not a valid array.');let t=[];if(e.length>0&&(t=[...e]),(o=this.collectionOptions)!=null&&o.addBlankEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==""&&t.unshift(this.createBlankEntry()),(l=this.collectionOptions)!=null&&l.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&t.unshift(this.collectionOptions.addCustomFirstEntry),(a=this.collectionOptions)!=null&&a.addCustomLastEntry&&Array.isArray(t)&&t.length>0){const h=t.length-1;t[h][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;i=this.filterCollection(i),i=this.sortCollection(i);const s=vl("filter",i,this.columnDef,this.grid,this.isMultipleSelect,this.translaterService,this.searchTerms||[]);this.isFilled=s.hasFoundSearchTerm,this.createFilterElement(s.selectElement,s.dataCollection),this._collectionLength=i.length}createBlankEntry(){const e={[this.labelName]:"",[this.valueName]:""};return this.labelPrefixName&&(e[this.labelPrefixName]=""),this.labelSuffixName&&(e[this.labelSuffixName]=""),e}createFilterElement(e,t){var s;const i=((s=this.columnDef)==null?void 0:s.id)??"";this.elementName=`filter-${i}`,this.defaultOptions.name=this.elementName,J(this.filterContainerElm),this.filterElm=e,this.filterElm.dataset.columnId=`${i}`,this.updateFilterStyle(this.isFilled),this.filterContainerElm.appendChild(e),this.filterElmOptions={...this.defaultOptions,...this.filterOptions,data:t},this._msInstance=wi(e,this.filterElmOptions)}initMultipleSelectTemplate(){var s,n,o,l,a,h,d,c,u,p,m,f,g;const e=((s=this.gridOptions)==null?void 0:s.enableTranslate)??!1,i={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,name:`${((n=this.columnDef)==null?void 0:n.id)??""}`,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,single:!0,singleRadio:!0,showSearchClear:!0,renderOptionLabelAsHtml:((o=this.columnFilter)==null?void 0:o.enableRenderHtml)??!1,sanitizer:_=>this.grid.sanitizeHtmlString(_),onClose:()=>this.onTriggerEvent(),onClear:()=>this.clear()};if(this._isMultipleSelect){i.single=!1,i.singleRadio=!1,i.showOkButton=!0,i.displayTitle=!0;const _=ot(this.gridOptions);i.countSelectedText=e&&((l=this.translaterService)!=null&&l.translate)?this.translaterService.translate(`${_}X_OF_Y_SELECTED`):(a=this._locales)==null?void 0:a.TEXT_X_OF_Y_SELECTED,i.allSelectedText=e&&((h=this.translaterService)!=null&&h.translate)?this.translaterService.translate(`${_}ALL_SELECTED`):(d=this._locales)==null?void 0:d.TEXT_ALL_SELECTED,i.noMatchesFoundText=e&&((c=this.translaterService)!=null&&c.translate)?this.translaterService.translate(`${_}NO_MATCHES_FOUND`):(u=this._locales)==null?void 0:u.TEXT_NO_MATCHES_FOUND,i.okButtonText=e&&((p=this.translaterService)!=null&&p.translate)?this.translaterService.translate(`${_}OK`):(m=this._locales)==null?void 0:m.TEXT_OK,i.selectAllText=e&&((f=this.translaterService)!=null&&f.translate)?this.translaterService.translate(`${_}SELECT_ALL`):(g=this._locales)==null?void 0:g.TEXT_SELECT_ALL}this.defaultOptions=i}onTriggerEvent(){if(this._msInstance){const e=this.getValues();this.updateFilterStyle(Array.isArray(e)&&e.length>1||e.length===1&&e[0]!==""),this.searchTerms=e,this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:e,shouldTriggerQuery:this._shouldTriggerQuery}),this._shouldTriggerQuery=!0}}updateFilterStyle(e){var t,i,s,n,o,l;e?(this.isFilled=!0,(t=this.filterElm)==null||t.classList.add("filled"),(s=(i=this._msInstance)==null?void 0:i.getParentElement())==null||s.classList.add("filled")):(this.isFilled=!1,(n=this.filterElm)==null||n.classList.remove("filled"),(l=(o=this._msInstance)==null?void 0:o.getParentElement())==null||l.classList.remove("filled"))}}class ip extends xa{constructor(e,t,i){super(e,t,i,!0),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class sp extends xa{constructor(e,t,i){super(e,t,i,!1),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class np extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="single"}}class rp extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="double"}}const qs={autocompleter:Kh,compoundDate:uc,compoundInput:ba,compoundInputNumber:Au,compoundInputPassword:Pu,compoundInputText:ba,compoundSlider:Fu,dateRange:Du,input:Ut,inputMask:Mu,inputNumber:Nu,inputPassword:Lu,inputText:Ut,multipleSelect:ip,singleSelect:sp,slider:np,sliderRange:rp};class op{constructor(e,t,i,s){var n;this.config=e,this.translaterService=t,this.collectionService=i,this.rxjs=s,this._options=((n=this.config)==null?void 0:n.options)??{}}addRxJsResource(e){this.rxjs=e}createFilter(e){let t;return e!=null&&e.model&&(t=typeof e.model=="function"?new e.model(this.translaterService,this.collectionService,this.rxjs):e.model),!t&&this._options.defaultFilter&&(t=new this._options.defaultFilter(this.translaterService,this.collectionService,this.rxjs)),t}}const Rr={alwaysShowVerticalScroll:!0,autoEdit:!1,asyncEditorLoading:!1,autoFitColumnsOnFirstLoad:!0,autoFixResizeTimeout:5*60*5,autoFixResizeRequiredGoodCount:2,autoFixResizeWhenBrokenStyleDetected:!1,autoParseInputFilterOperator:!0,autoResize:{applyResizeToContainer:!0,calculateAvailableSizeBy:"window",bottomPadding:20,minHeight:180,minWidth:300,rightPadding:0},cellHighlightCssClass:"slick-cell-modified",checkboxSelector:{cssClass:"slick-cell-checkboxsel",width:40},columnGroupSeparator:" - ",columnPicker:{hideForceFitButton:!1,hideSyncResizeButton:!0,headerColumnValueExtractor:Ia},cellMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideCommandSection:!1,hideOptionSection:!1,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},compositeEditorOptions:{labels:{cancelButtonKey:"CANCEL",cloneButtonKey:"CLONE",resetEditorButtonTooltipKey:"RESET_INPUT_VALUE",resetFormButtonKey:"RESET_FORM",massSelectionButtonKey:"APPLY_TO_SELECTION",massSelectionStatusKey:"X_OF_Y_MASS_SELECTED",massUpdateButtonKey:"APPLY_MASS_UPDATE",massUpdateStatusKey:"ALL_X_RECORDS_SELECTED",saveButtonKey:"SAVE"}},contextMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideClearAllGrouping:!1,hideCollapseAllGroups:!1,hideCommandSection:!1,hideCopyCellValueCommand:!1,hideExpandAllGroups:!1,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideMenuOnScroll:!0,hideOptionSection:!1,iconCollapseAllGroupsCommand:"mdi mdi-arrow-collapse",iconExpandAllGroupsCommand:"mdi mdi-arrow-expand",iconClearGroupingCommand:"mdi mdi-close",iconCopyCellValueCommand:"mdi mdi-content-copy",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},customFooterOptions:{dateFormat:"YYYY-MM-DD, hh:mm a",hideRowSelectionCount:!1,hideTotalItemCount:!1,hideLastUpdateTimestamp:!0,footerHeight:25,leftContainerClass:"col-xs-12 col-sm-5",rightContainerClass:"col-xs-6 col-sm-7",metricSeparator:"|",metricTexts:{itemsKey:"ITEMS",ofKey:"OF",itemsSelectedKey:"ITEMS_SELECTED"}},customTooltip:{tooltipTextMaxLength:700,maxWidth:500},dataView:{syncGridSelection:{preserveHidden:!1,preserveHiddenOnSelectionChange:!0},syncGridSelectionWithBackendService:!1},datasetIdPropertyName:"id",defaultFilter:qs.input,defaultBackendServiceFilterTypingDebounce:500,enableFilterTrimWhiteSpace:!1,defaultFilterPlaceholder:"🔎︎",defaultFilterRangeOperator:H.rangeInclusive,defaultColumnSortFieldId:"id",draggableGrouping:{hideToggleAllButton:!1,toggleAllButtonText:"",dropPlaceHolderTextKey:"DROP_COLUMN_HEADER_TO_GROUP_BY"},editable:!1,editorTypingDebounce:450,filterTypingDebounce:0,enableEmptyDataWarningMessage:!0,emptyDataWarning:{className:"slick-empty-data-warning",messageKey:"EMPTY_DATA_WARNING_MESSAGE",hideFrozenLeftWarning:!1,hideFrozenRightWarning:!1,leftViewportMarginLeft:"40%",rightViewportMarginLeft:"40%",frozenLeftViewportMarginLeft:"0px",frozenRightViewportMarginLeft:"40%"},enableAutoResize:!0,enableAutoSizeColumns:!0,enableCellNavigation:!1,enableColumnPicker:!0,enableColumnReorder:!0,enableColumnResizeOnDoubleClick:!0,enableContextMenu:!0,enableExcelExport:!1,enableTextExport:!1,enableGridMenu:!0,enableHeaderMenu:!0,enableMouseHoverHighlightRow:!0,enableSorting:!0,enableTextSelectionOnCells:!0,explicitInitialization:!0,excelExportOptions:{addGroupIndentation:!0,autoDetectCellFormat:!0,exportWithFormatter:!1,filename:"export",format:ve.xlsx,groupingColumnHeaderTitle:"Group By",groupCollapsedSymbol:"⮞",groupExpandedSymbol:"⮟",groupingAggregatorRowText:"",sanitizeDataExport:!0},textExportOptions:{delimiter:wt.comma,exportWithFormatter:!1,filename:"export",format:ve.csv,groupingColumnHeaderTitle:"Group By",groupingAggregatorRowText:"",sanitizeDataExport:!0,useUtf8WithBom:!0},eventNamingStyle:ct.lowerCase,forceFitColumns:!1,frozenHeaderWidthCalcDifferential:1,gridMenu:{dropSide:"left",commandLabels:{clearAllFiltersCommandKey:"CLEAR_ALL_FILTERS",clearAllSortingCommandKey:"CLEAR_ALL_SORTING",clearFrozenColumnsCommandKey:"CLEAR_PINNING",exportCsvCommandKey:"EXPORT_TO_CSV",exportExcelCommandKey:"EXPORT_TO_EXCEL",exportTextDelimitedCommandKey:"EXPORT_TO_TAB_DELIMITED",refreshDatasetCommandKey:"REFRESH_DATASET",toggleDarkModeCommandKey:"TOGGLE_DARK_MODE",toggleFilterCommandKey:"TOGGLE_FILTER_ROW",togglePreHeaderCommandKey:"TOGGLE_PRE_HEADER_ROW"},hideClearAllFiltersCommand:!1,hideClearAllSortingCommand:!1,hideClearFrozenColumnsCommand:!0,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideForceFitButton:!1,hideRefreshDatasetCommand:!1,hideSyncResizeButton:!0,hideToggleFilterCommand:!1,hideToggleDarkModeCommand:!0,hideTogglePreHeaderCommand:!1,iconCssClass:"mdi mdi-menu",iconClearAllFiltersCommand:"mdi mdi-filter-remove-outline",iconClearAllSortingCommand:"mdi mdi-sort-variant-off",iconClearFrozenColumnsCommand:"mdi mdi-pin-off-outline",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",iconRefreshDatasetCommand:"mdi mdi-sync",iconToggleDarkModeCommand:"mdi mdi-brightness-4",iconToggleFilterCommand:"mdi mdi-flip-vertical",iconTogglePreHeaderCommand:"mdi mdi-flip-vertical",menuWidth:16,resizeOnShowHeaderRow:!0,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270",headerColumnValueExtractor:Ia},headerMenu:{autoAlign:!0,autoAlignOffset:4,minWidth:140,iconClearFilterCommand:"mdi mdi-filter-remove-outline",iconClearSortCommand:"mdi mdi-sort-variant-off",iconFilterShortcutSubMenu:"mdi mdi-filter-outline",iconFreezeColumns:"mdi mdi-pin-outline",iconSortAscCommand:"mdi mdi-sort-ascending",iconSortDescCommand:"mdi mdi-sort-descending",iconColumnHideCommand:"mdi mdi-close",iconColumnResizeByContentCommand:"mdi mdi-arrow-expand-horizontal",hideColumnResizeByContentCommand:!1,hideColumnHideCommand:!1,hideClearFilterCommand:!1,hideClearSortCommand:!1,hideFreezeColumnsCommand:!0,hideSortCommands:!1,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},ignoreAccentOnStringFilterAndSort:!1,multiColumnSort:!0,numberedMultiColumnSort:!0,tristateMultiColumnSort:!1,sortColNumberInSeparateSpan:!0,suppressActiveCellChangeOnEdit:!1,pagination:{pageSizes:[10,15,20,25,30,40,50,75,100],pageSize:25,totalItems:0},headerRowHeight:35,rowHeight:35,topPanelHeight:30,translationNamespaceSeparator:":",resetFilterSearchValueAfterOnBeforeCancellation:!0,resizeByContentOnlyOnFirstLoad:!0,resizeByContentOptions:{alwaysRecalculateColumnWidth:!1,cellCharWidthInPx:7.8,cellPaddingWidthInPx:14,defaultRatioForStringType:.88,formatterPaddingWidthInPx:0,maxItemToInspectCellContentWidth:1e3,maxItemToInspectSingleColumnWidthByContent:5e3,widthToRemoveFromExceededWidthReadjustment:50},treeDataOptions:{exportIndentMarginLeft:5,exportIndentationLeadingChar:"͏͏͏͏͏͏͏͏͏·"}};function Ia(r,e){const t=(r==null?void 0:r.columnGroup)||"",i=(e==null?void 0:e.columnGroupSeparator)??" - ";return t?t+i+r.name:(r==null?void 0:r.name)??""}class lp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._sum=0,this._itemCount=0,this._type="sum",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._isTreeAggregator=t,this._isInitialized=!0,this._sum=0,this._itemCount=0,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.count={}),e.__treeTotals.count[this._field]=0,e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals[this._type][this._field]??0),this._itemCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._itemCount=1):U(i)&&(this._sum+=parseFloat(i))}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),this.addGroupTotalPropertiesWhenNotExist(e);let t=this._sum,i=this._itemCount;this._isTreeAggregator&&(t+=e[this._type][this._field],i+=e.count[this._field],e.count[this._field]=i),e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}class ap{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._max=null,this._type="max",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._max=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMaxValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._max===null||s>this._max)&&(this._max=s)}else U(i)&&this.keepMaxValueWhenFound(i)}storeResult(e){let t=this._max;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i>t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMaxValueWhenFound(e){U(e)&&(this._max===null||e>this._max)&&(this._max=parseFloat(e))}}class hp{constructor(e){this._isInitialized=!1,this._distinctValues=[],this._type="distinct",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._distinctValues=[],this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:void 0;this._distinctValues.indexOf(t)===-1&&t!==void 0&&this._distinctValues.push(t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._distinctValues}}class dp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._min=null,this._type="min",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._min=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMinValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._min===null||s<this._min)&&(this._min=s)}else U(i)&&this.keepMinValueWhenFound(i)}storeResult(e){let t=this._min;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i<t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMinValueWhenFound(e){U(e)&&(this._min===null||e<this._min)&&(this._min=parseFloat(e))}}class cp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._count=0,this._type="count",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._count=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator&&(t?(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),this._count=e.__treeTotals[this._type][this._field]??0):U(i)&&(this._count=1))}storeResult(e){var i;(!e||e[this._type]===void 0)&&(e[this._type]={});let t=this._count;this._isTreeAggregator?t+=e[this._type][this._field]:t=((i=e.group)==null?void 0:i.rows.length)??0,e[this._type][this._field]=t}}class up{constructor(e){this._isInitialized=!1,this._data="",this._type="clone",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._data="",this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:null;t!==null&&t!==""&&(this._data=t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._data}}class pp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._nonNullCount=0,this._sum=0,this._type="avg",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._sum=0,this._nonNullCount=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.sum={},e.__treeTotals.count={}),e.__treeTotals[this._type][this._field]=0,e.__treeTotals.count[this._field]=0,e.__treeTotals.sum[this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals.sum[this._field]??0),this._nonNullCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._nonNullCount=1):U(i)&&(this._nonNullCount++,this._sum+=parseFloat(i))}storeResult(e){let t=this._sum,i=this._nonNullCount;this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&(t+=e.sum[this._field],i+=e.count[this._field],e.sum[this._field]=t,e.count[this._field]=i),i!==0&&(e[this._type][this._field]=i===0?t:t/i)}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.sum===void 0&&(e.sum={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}const Ar={Avg:pp,Clone:up,Count:cp,Distinct:hp,Min:dp,Max:ap,Sum:lp};function Ks(r,e){const t=e.errorMessage,i=e.required,s=e.minLength,n=e.maxLength,o=e.operatorConditionalType||"inclusive",l={"{{minLength}}":s,"{{maxLength}}":n};let a=!0,h="";const d=(r==null?void 0:r.length)??0;if(e.validator)return e.validator(r,e.editorArgs);if(i&&r==="")a=!1,h=t||R.VALIDATION_REQUIRED_FIELD;else if(s!==void 0&&n!==void 0&&(o==="exclusive"&&(d<=s||d>=n)||o==="inclusive"&&(d<s||d>n)))a=!1,h=t||R.VALIDATION_EDITOR_TEXT_LENGTH_BETWEEN.replace(/{{minLength}}|{{maxLength}}/gi,c=>l[c]);else if(s!==void 0&&d!==null&&(o==="exclusive"&&d<=s||o==="inclusive"&&d!==null&&d<s)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MIN_LENGTH;h=t||c.replace(/{{minLength}}/gi,u=>l[u])}else if(n!==void 0&&d!==null&&(o==="exclusive"&&d>=n||o==="inclusive"&&d!==null&&d>n)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MAX_LENGTH;h=t||c.replace(/{{maxLength}}/gi,u=>l[u])}return{valid:a,msg:h}}const mp=3;class fp{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastTriggeredByClearInput=!1,this.disabled=!1,this.forceUserInput=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this._bindEventService=new Ae,(t=this.gridOptions)!=null&&t.translater&&(this._translater=this.gridOptions.translater),this._locales=this.gridOptions&&this.gridOptions.locales||R.locales,this.init()}get autocompleterOptions(){return this._autocompleterOptions||{}}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get editorDomElement(){return this._inputElm}get elementCollection(){return this._elementCollection}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get customStructure(){var i,s,n,o,l;let e=(i=this.columnEditor)==null?void 0:i.customStructure;const t=((s=this.columnEditor)==null?void 0:s.type)??((n=this.columnDef)==null?void 0:n.type);return!e&&t===S.object&&((o=this.columnDef)!=null&&o.dataKey)&&((l=this.columnDef)!=null&&l.labelKey)&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get dataContext(){return this.args.item}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.autocompleter,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get instance(){return this._instance}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var t,i,s,n,o,l;this.labelName=((t=this.customStructure)==null?void 0:t.label)??"label",this.valueName=((i=this.customStructure)==null?void 0:i.value)??"value",this.labelPrefixName=((s=this.customStructure)==null?void 0:s.labelPrefix)??"labelPrefix",this.labelSuffixName=((n=this.customStructure)==null?void 0:n.labelSuffix)??"labelSuffix";let e=this.columnEditor.collection;(o=this.columnEditor)!=null&&o.collectionAsync&&!e&&(e=[]),this.renderDomElement(e),(this.disabled||(l=this.columnEditor)!=null&&l.collectionAsync&&Array.isArray(e)&&e.length===0)&&this.disable(!0)}destroy(){var e,t,i;this._bindEventService.unbindAll(),typeof((e=this._instance)==null?void 0:e.destroy)=="function"&&this._instance.destroy(),(i=(t=this._inputElm)==null?void 0:t.remove)==null||i.call(t),this._elementCollection=null}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.clear(!0)}else this._inputElm.disabled=!1}focus(){this.grid.focus(),this._inputElm&&(this._inputElm.focus(),this._inputElm.select())}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this._inputElm.value=e!=null&&e.hasOwnProperty(this.labelName)?e[this.labelName]:e,t){this._currentValue=e,this._defaultTextValue=typeof e=="string"?e:(e==null?void 0:e[this.labelName])??"",this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var n,o;let i=t;const s=(n=this.columnDef)==null?void 0:n.field;if(s!==void 0){Array.isArray(this.collection)&&this.collection.length>0&&(i=xt(this.collection,h=>h&&Ht(t)&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===(t.hasOwnProperty(this.valueName)&&t[this.valueName].toString()):h&&typeof t=="string"&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===t:(h==null?void 0:h.toString())===t,""));const l=(s==null?void 0:s.indexOf("."))>0,a=this.validate(null,i);if(i=a!=null&&a.valid?i:"",l){const h=((o=this.columnEditor)==null?void 0:o.complexObjectPath)??s??"";$e(e,h,i)}else e[s]=i}}isValueChanged(){var s,n;const e=this._inputElm.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;if((n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter")return!0;const i=!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue;return this._lastTriggeredByClearInput||i}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._currentValue=n,this._originalValue=n,this._defaultTextValue=typeof n=="string"?n:(n==null?void 0:n[this.labelName])??"",this._inputElm.value=this._defaultTextValue,this._inputElm.select()}}clear(e=!1){this._inputElm&&(this._currentValue="",this._defaultTextValue="",this.setValue("",!0)),this._isValueTouched=!0,this._lastTriggeredByClearInput=!0;const t=this.args.compositeEditorOptions;if(t){const i=!e;this.handleChangeOnCompositeEditor(null,t,"user",i)}else this.save()}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._inputElm&&(this._currentValue=s,this._defaultTextValue=typeof s=="string"?s:(s==null?void 0:s[this.labelName])??"",this._inputElm.value=this._defaultTextValue),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e,t,i,s,n;if(this._inputElm&&this.editorOptions.forceUserInput){const o=((e=this.editorOptions)==null?void 0:e.minLength)??mp;this._currentValue=this._inputElm.value.length>o?this._inputElm.value:this._currentValue}return this.customStructure&&this._currentValue&&this._currentValue.hasOwnProperty(this.valueName)&&((t=this.columnDef)==null?void 0:t.type)!==S.object&&((i=this.columnEditor)==null?void 0:i.type)!==S.object?this._currentValue[this.valueName]:this._currentValue&&this._currentValue.value!==void 0?((s=this.columnDef)==null?void 0:s.type)===S.object||((n=this.columnEditor)==null?void 0:n.type)===S.object?{[this.labelName]:this._currentValue.label,[this.valueName]:this._currentValue.value}:this._currentValue.value:this._currentValue}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._inputElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleSelect(e){var t;if(e!==void 0){const s=e;this._currentValue=s,this._isValueTouched=!0;const n=this.args.compositeEditorOptions,o=((t=this.editorOptions)==null?void 0:t.renderItem)??!1,l=typeof s=="string"?s:o?s[this.labelName]:s.label;if(this.setValue(l),n?this.handleChangeOnCompositeEditor(null,n):this.save(),typeof this.editorOptions.onSelectItem=="function"){const{row:a,cell:h}=this.grid.getActiveCell()||{};this.editorOptions.onSelectItem(e,a,h,this.args.column,this.args.item)}setTimeout(()=>this._lastTriggeredByClearInput=!1)}return!1}renderRegularItem(e){const t=typeof e=="string"?e:(e==null?void 0:e.label)??"";return v("div",{textContent:t||""})}renderCustomItem(e){var s,n;const t=((n=(s=this._autocompleterOptions)==null?void 0:s.renderItem)==null?void 0:n.templateCallback(e))??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){var h;const t=((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,i=e.labelPrefix||"",s=e.label||"",n=e.labelSuffix||"",o=i+s+n,l=this.grid.sanitizeHtmlString(o)||"",a=document.createElement("div");return a[t?"innerHTML":"textContent"]=l,a}renderDomElement(e){var l,a,h,d,c,u,p,m,f,g,_,b;const t=((l=this.columnDef)==null?void 0:l.id)??"",i=((a=this.columnEditor)==null?void 0:a.placeholder)??"",s=((h=this.columnEditor)==null?void 0:h.title)??"";this._editorInputGroupElm=v("div",{className:"autocomplete-container input-group"});const n=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{type:"text",placeholder:i,title:s,autocomplete:"off",ariaAutoComplete:"none",className:`autocomplete form-control editor-text input-group-editor editor-${t}`,dataset:{input:""}},this._editorInputGroupElm),this._editorInputGroupElm.appendChild(document.createElement("span")),(d=this.editorOptions)!=null&&d.hideClearButton||(n.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(n),this._bindEventService.bind(this._clearButtonElm,"click",()=>this.clear())),this._bindEventService.bind(this._inputElm,"focus",()=>{var C;return(C=this._inputElm)==null?void 0:C.select()}),this._bindEventService.bind(this._inputElm,"keydown",C=>{this._lastInputKeyEvent=C,(C.key==="ArrowLeft"||C.key==="ArrowRight")&&C.stopImmediatePropagation(),C.key==="Enter"&&C.target.value===""&&this.columnEditor.alwaysSaveOnEnterKey&&(this._currentValue=null)});let o=e;if(o&&((c=this.columnEditor)!=null&&c.collectionOverride)){const C={column:this.columnDef,dataContext:this.dataContext,grid:this.grid,originalCollections:this.collection};if(this.args.compositeEditorOptions){const{formValues:E,modalType:y}=this.args.compositeEditorOptions;C.compositeEditorOptions={formValues:E,modalType:y}}o=this.columnEditor.collectionOverride(o,C)}o&&(this.finalCollection=o),Array.isArray(o)&&(this.collection.every(C=>Bi(C))?o=o.map(C=>({label:C,value:C})):o=o.map(C=>({label:C==null?void 0:C[this.labelName],value:C==null?void 0:C[this.valueName],labelPrefix:(C==null?void 0:C[this.labelPrefixName])??"",labelSuffix:(C==null?void 0:C[this.labelSuffixName])??""})),this._elementCollection=o),this._autocompleterOptions={input:this._inputElm,debounceWaitMs:200,className:`slick-autocomplete ${((u=this.editorOptions)==null?void 0:u.className)??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&((p=this._translater)!=null&&p.translate)?this._translater.translate("NO_ELEMENTS_FOUND"):((m=this._locales)==null?void 0:m.TEXT_NO_ELEMENTS_FOUND)??"No elements found",customize:(C,E,y)=>{y.style.width=""},onSelect:this.handleSelect.bind(this),...this.editorOptions},(f=this.gridOptions)!=null&&f.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=he(this.autocompleterOptions.className).join(" "),(g=this._autocompleterOptions.renderItem)!=null&&g.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${ui(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=((_=this._autocompleterOptions.render)==null?void 0:_.bind(this))??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),(b=this._autocompleterOptions)!=null&&b.fetch?(Bo(this._inputElm,this._autocompleterOptions),this._instance=fs(this._autocompleterOptions)):this._instance=fs({...this._autocompleterOptions,fetch:(C,E)=>{o&&E(o.filter(y=>((typeof y=="string"?y:y==null?void 0:y.label)||"").toLowerCase().includes(C.toLowerCase())))}}),this.args.container.appendChild(this._editorInputGroupElm),this.args.compositeEditorOptions||setTimeout(()=>this.focus(),50)}}class gp{constructor(e){if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._checkboxContainerElm=v("div",{className:`checkbox-editor-container editor-${e}`}),this._input=v("input",{type:"checkbox",value:"true",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Checkbox Editor`,className:`editor-checkbox editor-${e}`,title:((o=this.columnEditor)==null?void 0:o.title)??""});const i=(l=this.args)==null?void 0:l.container;i&&typeof i.appendChild=="function"&&(t?(this._checkboxContainerElm.appendChild(this._input),i.appendChild(this._checkboxContainerElm)):i.appendChild(this._input)),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,"click",()=>{this._isValueTouched=!0,this.save()}),t?this._bindEventService.bind(this._input,"change",a=>{this._isValueTouched=!0,this.handleChangeOnCompositeEditor(a,t)}):this.focus()}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled"),this._checkboxContainerElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==!1&&this.reset(!1,!0,!0)}else this._input.removeAttribute("disabled"),this._checkboxContainerElm.classList.remove("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}preClick(){this._input&&(this._input.checked=!this._input.checked)}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}setValue(e,t=!1,i=!0){const s=!!e;if(this._input&&(this._input.checked=s),t){this.applyValue(this.args.item,this.serializeValue());const n=this.args.compositeEditorOptions;n&&i&&this.handleChangeOnCompositeEditor(null,n,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else e[i]=l}}isValueChanged(){return this.serializeValue()!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s,this._input.checked=!!this._originalValue}}reset(e,t=!0,i=!1){const s=e??this._originalValue??!1;this._input&&(this._originalValue=s,this._input.checked=!!s),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t!==void 0?t:(l=this._input)==null?void 0:l.checked,n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&!s?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}}class _p{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastClickIsDate=!1,this._lastTriggeredByClearDate=!1,this.hasTimePicker=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(t=this.gridOptions)!=null&&t.translater&&(this._translaterService=this.gridOptions.translater),this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._inputElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.date,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get pickerOptions(){return this._pickerMergedOptions}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}async init(){var e,t,i,s,n,o,l;if(this.args&&this.columnDef){const a=this.args.compositeEditorOptions,h=((e=this.columnDef)==null?void 0:e.id)??"",d=this.args.grid.getOptions()||{};this.defaultDate=(t=this.args.item)==null?void 0:t[this.columnDef.field];const c=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,u=Ze(c),p=((s=(i=this._translaterService)==null?void 0:i.getCurrentLanguage)==null?void 0:s.call(i))||d.locale||"en";u&&(u==="ISO8601"||u.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const m=Ze(this.hasTimePicker?S.dateTimeIsoAM_PM:S.dateIso),f={input:!0,jumpToSelectedDate:!0,sanitizer:b=>this.grid.sanitizeHtmlString(b),toggleSelected:!1,actions:{clickDay:()=>{this._lastClickIsDate=!0},changeToInput:(b,C)=>{if(C.HTMLInputElement){let E="";if(C.selectedDates[0]?(E=C.selectedDates[0],C.HTMLInputElement.value=Ct(C.selectedDates[0],void 0,c)):C.HTMLInputElement.value="",E&&this.hasTimePicker){const y=ms(E,m);y.setHours(+(C.selectedHours||0)),y.setMinutes(+(C.selectedMinutes||0)),C.HTMLInputElement.value=Ct(y,void 0,c)}this._lastClickIsDate&&(this.handleOnDateChange(),C.hide())}}},settings:{lang:p,iso8601:!1,visibility:{theme:(n=this.gridOptions)!=null&&n.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};this.hasTimePicker&&(f.settings.selection={time:24}),this._pickerMergedOptions=de(!0,{},f,{settings:this.editorOptions,type:"default"});const g=`.editor-text.date-picker.editor-${h}.form-control.input-group-editor`;this._editorInputGroupElm=v("div",{className:"vanilla-picker input-group"});const _=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:this.columnEditor&&this.columnEditor.title||"",className:g.replace(/\./g," "),dataset:{input:"",defaultdate:this.defaultDate},readOnly:!0},this._editorInputGroupElm),this.args.container.appendChild(this._editorInputGroupElm),(l=this.columnEditor.editorOptions)!=null&&l.hideClearButton||(_.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(_),this._bindEventService.bind(this._clearButtonElm,"click",()=>{this.clear(),this.handleOnDateChange()})),queueMicrotask(()=>{this.calendarInstance=new gl(this._inputElm,this._pickerMergedOptions),this.calendarInstance.init(),a||(this.show(),this.focus()),this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,newVal:this.defaultDate,updatePickerUI:!0})})}}destroy(){queueMicrotask(()=>{var e,t,i;this.hide(),(e=this.calendarInstance)==null||e.destroy(),J(this._editorInputGroupElm),J(this._inputElm),(t=this._editorInputGroupElm)==null||t.remove(),(i=this._inputElm)==null||i.remove()}),this._bindEventService.unbindAll()}clear(){this._lastTriggeredByClearDate=!0,this.calendarInstance&&(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.setAttribute("disabled","disabled"),this._clearButtonElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._inputElm.removeAttribute("disabled"),this._clearButtonElm.disabled=!1}changeEditorOption(e,t){this.columnEditor.editorOptions||(this.columnEditor.editorOptions={}),this.columnEditor.editorOptions[e]=t,this._pickerMergedOptions=de(!0,{},this._pickerMergedOptions,{settings:{[e]:t}})}focus(){var e;this.grid.focus(),this.show(),(e=this._inputElm)==null||e.focus()}hide(){var e;(e=this.calendarInstance)==null||e.hide()}show(){var t;const e=!!((t=this.args)!=null&&t.compositeEditorOptions);!e&&this.calendarInstance?this.calendarInstance.show():e&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,newVal:e,updatePickerUI:!0}),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(this.columnDef&&i!==void 0){const o=this.columnDef.saveOutputType||this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,l=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,a=i.indexOf(".")>0,h=this.validate(null,t),d=t&&(h!=null&&h.valid)?Ct(t,l,o):"";if(a){const c=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i;$e(e,c,d)}else e[i]=d}}isValueChanged(){let e=!1;const t=this.getValue();return this.columnDef&&(e=this._lastTriggeredByClearDate||!(t===""&&this._originalDate==="")&&t!==this._originalDate),e}isValueTouched(){return this._isValueTouched}loadValue(e){var i,s;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&this.columnDef&&t!==void 0){const o=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t],l=this.columnEditor.type||((s=this.columnDef)==null?void 0:s.type)||S.dateIso,a=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateIso;this._originalDate=Ct(o,l,a),this._inputElm.value=this._originalDate}}reset(e,t=!0,i=!1){const s=e??this._originalDate??"";this.calendarInstance&&(this._originalDate=s,this.calendarInstance.settings.selected.dates=[s],s||(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){const e=this.getValue();return e||""}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t??((l=this._inputElm)==null?void 0:l.value),n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&s===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleOnDateChange(){if(this._isValueTouched=!0,this.args){const e=this.args.compositeEditorOptions;e?this.handleChangeOnCompositeEditor(e):this.save()}setTimeout(()=>this._lastTriggeredByClearDate=!1)}handleChangeOnCompositeEditor(e,t="user",i=!1){var c,u,p;const s=this.grid.getActiveCell(),n=this.args.column,o=((c=this.columnDef)==null?void 0:c.id)??"",l=this.dataContext,a=this.grid,h=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,h),this.applyValue(e.formValues,h);const d=((p=(u=this.gridOptions)==null?void 0:u.compositeEditorOptions)==null?void 0:p.excludeDisabledFieldFormValues)??!1;(i||this.disabled&&d&&e.formValues.hasOwnProperty(o))&&delete e.formValues[o],a.onCompositeEditorChange.notify({...s,item:l,grid:a,column:n,formValues:e.formValues,editors:e.editors,triggeredBy:t},new le)}}function Ra(r,e){const t=isNaN(r)?null:parseFloat(r),i=e.decimal||0,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a=e.errorMessage,h={"{{minValue}}":n,"{{maxValue}}":o,"{{minDecimal}}":0,"{{maxDecimal}}":i};let d=!0,c="";if(typeof e.validator=="function")return e.validator(r,e.editorArgs);if(s&&r==="")d=!1,c=a||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||i===0&&!/^[-+]?(\d*(\.)?(\d)*)$/.test(r)))d=!1,c=a||R.VALIDATION_EDITOR_VALID_NUMBER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))d=!1,c=a||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,u=>h[u]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t<+n)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MIN;c=a||u.replace(/{{minValue}}/gi,p=>h[p])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t>+o)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MAX;c=a||u.replace(/{{maxValue}}/gi,p=>h[p])}else i>0&&!new RegExp(`^[-+]?(\\d*(\\.)?(\\d){0,${i}})$`).test(r)&&(d=!1,c=a||R.VALIDATION_EDITOR_DECIMAL_BETWEEN.replace(/{{minDecimal}}|{{maxDecimal}}/gi,u=>h[u]));return{valid:d,msg:c}}function Aa(r,e){let t=isNaN(r)?null:parseInt(r,10);t!==null&&isNaN(t)&&(t=null);const i=e.errorMessage,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a={"{{minValue}}":n,"{{maxValue}}":o};let h=!0,d="";if(e.validator)return e.validator(r,e.editorArgs);if(s&&r==="")h=!1,d=i||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||!/^[+-]?\d+$/.test(r)))h=!1,d=i||R.VALIDATION_EDITOR_VALID_INTEGER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))h=!1,d=i||R.VALIDATION_EDITOR_INTEGER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,c=>a[c]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t!==null&&t<+n)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MIN;d=i||c.replace(/{{minValue}}/gi,u=>a[u])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t!==null&&t>+o)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MAX;d=i||c.replace(/{{maxValue}}/gi,u=>a[u])}return{valid:h,msg:d}}function Cp(r,e){const t=e.required,i=e.minValue,s=e.maxValue,n=e.errorMessage,o={"{{minValue}}":i,"{{maxValue}}":s};return e.validator?e.validator(r,e.editorArgs):t&&r===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:i!==void 0&&s!==void 0&&r!==null&&(r<i||r>s)?{valid:!1,msg:n||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,l=>o[l])}:{valid:!0,msg:null}}class vp{constructor(e){if(this.args=e,this._isValueSaveCalled=!1,this._isLeftValueTouched=!1,this._isRightValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._eventHandler=new pe,this._bindEventService=new Ae,this.init(),this._eventHandler.subscribe(this.grid.onValidationError,()=>this._isValueSaveCalled=!0)}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return{leftInput:this._leftInput,rightInput:this._rightInput}}get editorParams(){return this.columnEditor.params||{}}get eventHandler(){return this._eventHandler}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get isValueSaveCalled(){return this._isValueSaveCalled}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var i,s,n,o;if(!this.editorParams||!this.editorParams.leftInput||!this.editorParams.leftInput.field||!this.editorParams.rightInput||!this.editorParams.rightInput.field)throw new Error(`[Slickgrid-Universal] Please make sure that your Combo Input Editor has params defined with "leftInput" and "rightInput" (example: { editor: { model: Editors.comboInput, params: { leftInput: { field: 'firstName' }, { rightSide: { field: 'lastName' } }}}`);this._leftFieldName=(i=this.editorParams.leftInput)==null?void 0:i.field,this._rightFieldName=(s=this.editorParams.rightInput)==null?void 0:s.field,this._leftInput=this.createInput("leftInput"),this._rightInput=this.createInput("rightInput");const e=(n=this.args)==null?void 0:n.container;e&&typeof e.appendChild=="function"&&(e.appendChild(this._leftInput),e.appendChild(this._rightInput)),this._bindEventService.bind(this._leftInput,"keydown",l=>this.handleKeyDown(l,"leftInput")),this._bindEventService.bind(this._rightInput,"keydown",l=>this.handleKeyDown(l,"rightInput")),this.hasAutoCommitEdit&&(this._bindEventService.bind(this._leftInput,"focusout",l=>this.handleFocusOut(l,"leftInput")),this._bindEventService.bind(this._rightInput,"focusout",l=>this.handleFocusOut(l,"rightInput"))),((o=this.args)==null?void 0:o.compositeEditorOptions)?(this._bindEventService.bind(this._leftInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this)),this._bindEventService.bind(this._rightInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this))):setTimeout(()=>this._leftInput.select(),50)}handleFocusOut(e,t){var o;const i=((o=e.relatedTarget)==null?void 0:o.className)||"";!this.args.compositeEditorOptions&&i.indexOf("dual-editor")===-1&&this._lastEventType!=="focusout-right"&&(t==="rightInput"||t==="leftInput"&&this._lastEventType!=="focusout-left")&&(t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this.save());const n=t==="leftInput"?"left":"right";this._lastEventType=`${e==null?void 0:e.type}-${n}`}handleKeyDown(e,t){t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this._lastInputKeyEvent=e,(e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="Tab")&&e.stopImmediatePropagation()}destroy(){var e,t,i,s;this._eventHandler.unsubscribeAll(),this._bindEventService.unbindAll(),(t=(e=this._leftInput)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._rightInput)==null?void 0:i.remove)==null||s.call(i)}createInput(e){var a,h,d,c;const t=this.editorParams[e],i=((a=this.columnDef)==null?void 0:a.id)??"",s=this.gridOptions.datasetIdPropertyName||"id",n=((d=(h=this.args)==null?void 0:h.item)==null?void 0:d[s])??"";let o=t.type||"text";(o==="float"||o==="integer")&&(o="number");const l=v("input",{type:o||"text",id:`item-${n}-${e}`,ariaLabel:((c=this.columnEditor)==null?void 0:c.ariaLabel)??`${_t(i+"")} Input Editor`,className:`dual-editor-text editor-${i} ${e.replace(/input/gi,"")}`,autocomplete:"off",ariaAutoComplete:"none",placeholder:t.placeholder||"",title:t.title||""});return o==="readonly"&&(l.readOnly=!0,o="text"),o==="number"&&(l.step=this.getInputDecimalSteps(e)),l}disable(e=!0){var i;const t=this.disabled;this.disabled=e,this._leftInput&&this._rightInput&&(e?(this._leftInput.setAttribute("disabled","disabled"),this._rightInput.setAttribute("disabled","disabled"),t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&this.reset("",!0,!0)):(this._leftInput.removeAttribute("disabled"),this._rightInput.removeAttribute("disabled")))}focus(){this.grid.focus()}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValues(){const e={},t=this._leftInput.value,i=this._rightInput.value,s=this.editorParams.leftInput&&(this.editorParams.leftInput.type==="float"||this.editorParams.leftInput.type==="integer"),n=this.editorParams.rightInput&&(this.editorParams.rightInput.type==="float"||this.editorParams.rightInput.type==="integer"),o=t!==""&&s?+this._leftInput.value:t||"",l=i!==""&&n?+this._rightInput.value:i||"";return $e(e,this._leftFieldName,o),$e(e,this._rightFieldName,l),e}setValues(e){Array.isArray(e)&&e.length===2&&(this._leftInput.value=`${e[0]}`,this._rightInput.value=`${e[1]}`)}applyValue(e,t){this.applyValueByPosition(e,t,"leftInput"),this.applyValueByPosition(e,t,"rightInput")}applyValueByPosition(e,t,i){var n;const s=i==="leftInput"?this._leftFieldName:this._rightFieldName;if(s!==void 0){const o=(s==null?void 0:s.indexOf("."))>0;let l=s;if(o){const d=s.split(/\.(.*)/);l=d.length>1?d[1]:d}const a=o?Ee(t,l):t[s],h=this.validate(null,{position:i,inputValue:a});if(o){const d=Ee(t,l),c=h&&h.valid?d:"",u=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??s??"";$e(e,u,c)}else s&&(e[s]=h&&h.valid?t[s]:"")}}isValueChanged(){var a,h,d;const e=this._leftInput.value,t=this._rightInput.value,i=(a=this.editorParams)==null?void 0:a.leftInput,s=(h=this.editorParams)==null?void 0:h.rightInput,n=(d=this._lastInputKeyEvent)==null?void 0:d.key;if((i&&i.alwaysSaveOnEnterKey||s&&s.alwaysSaveOnEnterKey)&&n==="Enter")return!0;const o=!(e===""&&(this._originalLeftValue===null||this._originalLeftValue===void 0))&&e!==this._originalLeftValue,l=!(t===""&&(this._originalRightValue===null||this._originalRightValue===void 0))&&t!==this._originalRightValue;return o||l}isValueTouched(){return this._isLeftValueTouched||this._isRightValueTouched}loadValue(e){this.loadValueByPosition(e,"leftInput"),this.loadValueByPosition(e,"rightInput"),this._leftInput.select()}loadValueByPosition(e,t){const i=t==="leftInput"?this._leftFieldName:this._rightFieldName,s=t==="leftInput"?"_originalLeftValue":"_originalRightValue",n=t==="leftInput"?"_leftInput":"_rightInput";if(e&&i!==void 0){const l=(i==null?void 0:i.indexOf("."))>0?Ee(e,i):e.hasOwnProperty(i)?e[i]:"";if(this[s]=l,this.editorParams[t].type==="float"){const a=this.getDecimalPlaces(t);a!==null&&(this[s]||this[s]===0)&&this[s]!==void 0&&(this[s]=(+this[s]).toFixed(a))}this[n]&&(this[n].value=`${this[s]}`)}}reset(e,t=!0,i=!1){const s=e??this._originalLeftValue??"",n=e??this._originalRightValue??"";this._leftInput&&this._rightInput&&(this._originalLeftValue=s,this._originalRightValue=n,this._leftInput.value=`${s}`,this._rightInput.value=`${n}`),this._isLeftValueTouched=!1,this._isRightValueTouched=!1;const o=this.args.compositeEditorOptions;if(o&&t){const l=!i;this.handleChangeOnCompositeEditor(null,o,"user",l)}}save(){const e=this.validate(),t=e&&e.valid||!1;this._isValueSaveCalled||(this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges(),this._isValueSaveCalled=!0)}serializeValue(){const e={},t=this.serializeValueByPosition("leftInput"),i=this.serializeValueByPosition("rightInput");return $e(e,this._leftFieldName,t),$e(e,this._rightFieldName,i),e}serializeValueByPosition(e){const t=e==="leftInput"?this._leftInput.value:this._rightInput.value;if(t===""||isNaN(+t))return t;let i=parseFloat(t);const s=this.getDecimalPlaces(e);return s!==null&&(i||i===0)&&i.toFixed&&(i=parseFloat(i.toFixed(s))),i}getDecimalPlaces(e){const i=e==="leftInput"?"leftInput":"rightInput",s=this.editorParams[i],n=s==null?void 0:s.decimal;return n===void 0?0:n}getInputDecimalSteps(e){const t=this.getDecimalPlaces(e);let i="";for(let s=1;s<t;s++)i+="0";return t>0?`0.${i}1`:"1"}validate(e,t){if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};if(t){const i=this.validateByPosition(t.position,t.inputValue);if(!i.valid)return t.position==="leftInput"?this._leftInput.select():this._rightInput.select(),i}else{const i=this.validateByPosition("leftInput"),s=this.validateByPosition("rightInput");if(!i.valid)return this._leftInput.select(),i;if(!s.valid)return this._rightInput.select(),s}return{valid:!0,msg:""}}validateByPosition(e,t){var l;const i=this.editorParams[e];let s="";if(t)s=t;else{const a=e==="leftInput"?this._leftInput:this._rightInput;s=a&&a.value}const n=this.validator;s=typeof n=="function"?this.getValues():s;const o={editorArgs:this.args,errorMessage:i.errorMessage,required:(l=this.args)!=null&&l.compositeEditorOptions?!1:i.required,validator:typeof n=="function"?n:i.validator};switch(i.type){case"float":return Ra(s,{...o,decimal:this.getDecimalPlaces(e),minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"integer":return Aa(s,{...o,minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"text":case"password":default:return Ks(s,o)}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var p,m,f,g,_,b;const n=this.grid.getActiveCell(),o=this.args.column,l=((m=(p=this.columnEditor.params)==null?void 0:p.leftInput)==null?void 0:m.field)??"",a=((g=(f=this.columnEditor.params)==null?void 0:f.rightInput)==null?void 0:g.field)??"",h=this.dataContext,d=this.grid,c=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,c),this.applyValue(t.formValues,c);const u=((b=(_=this.gridOptions)==null?void 0:_.compositeEditorOptions)==null?void 0:b.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&u&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],(s||this.disabled&&u&&t.formValues.hasOwnProperty(a))&&delete t.formValues[a],d.onCompositeEditorChange.notify({...n,item:h,grid:d,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleChangeOnCompositeEditorDebounce(e){var i,s;const t=(i=this.args)==null?void 0:i.compositeEditorOptions;if(t){const n=((s=this.gridOptions)==null?void 0:s.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),n)}}}const bp=0;class Qs{constructor(e,t="text"){if(this.args=e,this._inputType="text",this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=e.grid&&e.grid.getOptions(),this._bindEventService=new Ae,this.inputType=t,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._input=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Input Editor`,className:`editor-text editor-${e}`,placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:((l=this.columnEditor)==null?void 0:l.title)??""}),this.inputType==="number"&&(this._input.step=`${this.columnEditor.valueStep!==void 0?this.columnEditor.valueStep:this.getInputDecimalSteps()}`);const i=this.args.container;i&&typeof i.appendChild=="function"&&i.appendChild(this._input),this._bindEventService.bind(this._input,"focus",()=>{var a;return(a=this._input)==null?void 0:a.select()}),this._bindEventService.bind(this._input,"keydown",a=>{this._isValueTouched=!0,this._lastInputKeyEvent=a,(a.key==="ArrowLeft"||a.key==="ArrowRight")&&a.stopImmediatePropagation()}),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,["focusout","blur"],()=>{this._isValueTouched=!0,this.save()}),t&&(this._bindEventService.bind(this._input,["input","paste"],this.handleOnInputChange.bind(this)),this.inputType==="number"&&this._bindEventService.bind(this._input,"wheel",this.handleOnMouseWheel.bind(this),{passive:!0}))}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._input.removeAttribute("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}getDecimalPlaces(){var t,i,s;let e=((t=this.columnEditor)==null?void 0:t.decimal)??((s=(i=this.columnEditor)==null?void 0:i.params)==null?void 0:s.decimalPlaces)??void 0;return e===void 0&&(e=bp),!e&&e!==0?null:e}getInputDecimalSteps(){const e=this.getDecimalPlaces();let t="";for(let i=1;i<e;i++)t+="0";return e>0?`0.${t}1`:"1"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.value)||""}setValue(e,t=!1,i=!0){if(this._input&&(this._input.value=`${e}`,t)){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o!=null&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else i&&(e[i]=l)}}isValueChanged(){var i,s,n;const e=(i=this._input)==null?void 0:i.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;return(n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter"?!0:!(e===""&&(this._originalValue===null||this._originalValue===void 0))&&e!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e.hasOwnProperty(t)&&e[t]||"";this._originalValue=n,this._input.value=this._originalValue,this._input.select()}}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._input&&(this._originalValue=s,this._input.value=`${s}`),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.value)??""}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this._input&&this._input.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleOnInputChange(e){var i;this._isValueTouched=!0;const t=this.args.compositeEditorOptions;if(t){const s=((i=this.gridOptions)==null?void 0:i.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),s)}}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class Sp extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(t!==void 0&&e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s;const n=this.getDecimalPlaces();n!==null&&(this._originalValue||this._originalValue===0)&&this._originalValue!==void 0&&(this._originalValue=(+this._originalValue).toFixed(n)),this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var s;const e=(s=this._input)==null?void 0:s.value;if(e===void 0||e===""||isNaN(+e))return e;let t=parseFloat(e);const i=this.getDecimalPlaces();return i!==null&&(t||t===0)&&t.toFixed&&(t=parseFloat(t.toFixed(i))),t}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._input)==null?void 0:s.value;return Ra(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,decimal:this.getDecimalPlaces(),minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}}class yp extends Qs{constructor(e){super(e,"password"),this.args=e}}class Ep extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(t!==void 0&&e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=isNaN(n)||n===null||n===void 0?n:`${n}`,this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var i;const e=(i=this._input)==null?void 0:i.value;if(e===void 0||e===""||isNaN(+e))return e;const t=isNaN(+e)?e:parseInt(e,10);return isNaN(+t)?e:t}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this.getValue();return Aa(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class wp{constructor(e){var i,s;if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=(i=e.grid)==null?void 0:i.getOptions();const t=this.gridOptions||this.args.column.params||{};t!=null&&t.translater&&(this._translater=t.translater),this._locales=((s=this.gridOptions)==null?void 0:s.locales)||R.locales,this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this._textareaElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.longText,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){var e;return((e=this.gridOptions)==null?void 0:e.autoCommitEdit)??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var d,c,u,p,m,f,g,_,b,C,E,y,T,x,O;let e="",t="";if(this._translater&&this._translater.translate&&this.gridOptions.enableTranslate){const I=ot(this.gridOptions),A=((d=this.editorOptions.buttonTexts)==null?void 0:d.cancelKey)??`${I}CANCEL`,k=((c=this.editorOptions.buttonTexts)==null?void 0:c.saveKey)??`${I}SAVE`;e=this._translater.translate(`${I}${A}`),t=this._translater.translate(`${I}${k}`)}else e=((u=this.editorOptions.buttonTexts)==null?void 0:u.cancel)??((p=this._locales)==null?void 0:p.TEXT_CANCEL)??"Cancel",t=((m=this.editorOptions.buttonTexts)==null?void 0:m.save)??((f=this._locales)==null?void 0:f.TEXT_SAVE)??"Save";const i=this.args.compositeEditorOptions,s=((g=this.columnDef)==null?void 0:g.id)??"",n=(_=this.columnEditor)==null?void 0:_.maxLength,o=((b=this.editorOptions)==null?void 0:b.rows)??4,l=i?this.args.container:document.body;this._wrapperElm=v("div",{className:`slick-large-editor-text editor-${s}`,style:{position:i?"relative":"absolute"}}),(C=this.gridOptions)!=null&&C.darkMode&&this._wrapperElm.classList.add("slick-dark-mode"),l.appendChild(this._wrapperElm),this._textareaElm=v("textarea",{ariaLabel:((E=this.columnEditor)==null?void 0:E.ariaLabel)??`${_t(s+"")} Text Editor`,cols:((y=this.editorOptions)==null?void 0:y.cols)??40,rows:i&&o>3?3:o,placeholder:((T=this.columnEditor)==null?void 0:T.placeholder)??"",title:((x=this.columnEditor)==null?void 0:x.title)??""},this._wrapperElm);const a=v("div",{className:"editor-footer"}),h=v("span",{className:"counter"});if(this._currentLengthElm=v("span",{className:"text-length",textContent:"0"}),h.appendChild(this._currentLengthElm),n!==void 0&&(h.appendChild(v("span",{className:"separator",textContent:"/"})),h.appendChild(v("span",{className:"max-length",textContent:`${n}`}))),a.appendChild(h),!i){const I=v("button",{className:"btn btn-cancel btn-default btn-xs",textContent:e},a),A=v("button",{className:"btn btn-save btn-primary btn-xs",textContent:t},a);this._bindEventService.bind(I,"click",this.cancel.bind(this)),this._bindEventService.bind(A,"click",this.save.bind(this)),this.position((O=this.args)==null?void 0:O.position),this._textareaElm.focus(),this._textareaElm.select()}this._wrapperElm.appendChild(a),this._bindEventService.bind(this._textareaElm,"keydown",this.handleKeyDown.bind(this)),this._bindEventService.bind(this._textareaElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._textareaElm,"paste",this.handleOnInputChange.bind(this))}cancel(){var t;const e=this._defaultTextValue||"";this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,(t=this.args)!=null&&t.cancelChanges&&this.args.cancelChanges()}hide(){this._wrapperElm.style.display="none"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)?this.applyInputUsabilityState():this._wrapperElm.style.display="block"}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._wrapperElm)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._textareaElm&&this._wrapperElm)if(e){this._textareaElm.disabled=!0,this._wrapperElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._textareaElm.disabled=!1,this._wrapperElm.classList.remove("disabled")}focus(){this.grid.focus(),this._textareaElm&&(this._textareaElm.focus(),this._textareaElm.select())}getValue(){return this._textareaElm.value}setValue(e,t=!1,i=!0){if(this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(i!==void 0){const o=(i==null?void 0:i.indexOf("."))>0,l=this.validate(void 0,t),a=l!=null&&l.valid?t:"";if(o){const h=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i??"";$e(e,h,a)}else e[i]=a}}isValueChanged(){const e=this._textareaElm.value;return!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._defaultTextValue=n||"",this._textareaElm.value=this._defaultTextValue,this._currentLengthElm.textContent=this._defaultTextValue.length,this._textareaElm.defaultValue=this._defaultTextValue,this._textareaElm.select()}}position(e){var u,p;const t=me(this.args.container),i=this.args.container.offsetHeight,s=this.args.container.offsetWidth,n=this._wrapperElm.getBoundingClientRect().height||this.args.position.height,o=this._wrapperElm.getBoundingClientRect().width||this.args.position.width,l=document.body.offsetHeight||window.innerHeight,a=document.body.offsetWidth||window.innerWidth;let h=(t==null?void 0:t.top)??e.top??0,d=(t==null?void 0:t.left)??e.left??0;const c=((u=this.editorOptions)==null?void 0:u.position)??"auto";if(c==="left"||c==="auto"&&d+o>a){const m=((p=this.editorOptions)==null?void 0:p.marginRight)??0;d-=o-s+m}(c==="top"||c==="auto"&&h+n>l)&&(h-=n-i),this._wrapperElm.style.top=`${h}px`,this._wrapperElm.style.left=`${d}px`}reset(e,t=!0,i=!1){const s=e??this._defaultTextValue??"";this._textareaElm&&(this._defaultTextValue=s,this._textareaElm.value=s,this._currentLengthElm.textContent=s.length),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){return this._textareaElm.value}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._textareaElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleKeyDown(e){const t=e.key;this._isValueTouched=!0,this.args.compositeEditorOptions||(t==="Enter"&&e.ctrlKey||e.ctrlKey&&e.key.toUpperCase()==="S"?(e.preventDefault(),this.save()):t==="Escape"?(e.preventDefault(),this.cancel()):t==="Tab"&&e.shiftKey?(e.preventDefault(),this.args&&this.grid&&this.grid.navigatePrev()):t==="Tab"&&(e.preventDefault(),this.args&&this.grid&&this.grid.navigateNext()))}handleOnInputChange(e){var n,o;const t=this.args.compositeEditorOptions,i=(n=this.columnEditor)==null?void 0:n.maxLength;let s=!1;if(i&&(s=this.truncateText(this._textareaElm,i)),s)this._currentLengthElm.textContent=`${i}`;else{const l=e.type==="paste"?e.clipboardData.getData("text"):e.target.value;this._currentLengthElm.textContent=`${l.length}`}if(t){const l=((o=this.gridOptions)==null?void 0:o.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),l)}}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}truncateText(e,t){const i=e.value+"";return i.length>t?(e.value=i.substring(0,t),!0):!1}}class Pa{constructor(e,t,i=-1){var l,a,h,d,c,u,p,m,f;if(this.args=e,this.isMultipleSelect=t,this.delayOpening=i,this._isValueTouched=!1,this._isDisposingOrCallingSave=!1,this.disabled=!1,this.enableTranslateLabel=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(l=this.gridOptions)!=null&&l.translater&&(this._translaterService=this.gridOptions.translater),this._locales=this.gridOptions.locales||R.locales;const s=((a=this.columnDef)==null?void 0:a.id)??"";this.elementName=`editor-${s}`;const n=this.args.compositeEditorOptions,o={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,minHeight:25,name:this.elementName,single:!0,singleRadio:!0,renderOptionLabelAsHtml:((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,sanitizer:g=>this.grid.sanitizeHtmlString(g),onClick:()=>this._isValueTouched=!0,onCheckAll:()=>this._isValueTouched=!0,onUncheckAll:()=>this._isValueTouched=!0,onClose:g=>{if(g==="key.escape"||g==="body.click"||!this.hasAutoCommitEdit&&!this.isValueChanged()){g==="key.escape"&&this.cancel();return}n?this.handleChangeOnCompositeEditor(n):(this._isDisposingOrCallingSave=!0,this.save(this.hasAutoCommitEdit))}};if(t)if(o.single=!1,o.singleRadio=!1,o.displayTitle=!0,o.showOkButton=!0,(d=this._translaterService)!=null&&d.getCurrentLanguage()){const g=ot(this.gridOptions);o.countSelectedText=this._translaterService.translate(`${g}X_OF_Y_SELECTED`),o.allSelectedText=this._translaterService.translate(`${g}ALL_SELECTED`),o.selectAllText=this._translaterService.translate(`${g}SELECT_ALL`),o.okButtonText=this._translaterService.translate(`${g}OK`),o.noMatchesFoundText=this._translaterService.translate(`${g}NO_MATCHES_FOUND`)}else o.countSelectedText=(c=this._locales)==null?void 0:c.TEXT_X_OF_Y_SELECTED,o.allSelectedText=(u=this._locales)==null?void 0:u.TEXT_ALL_SELECTED,o.selectAllText=(p=this._locales)==null?void 0:p.TEXT_SELECT_ALL,o.okButtonText=(m=this._locales)==null?void 0:m.TEXT_OK,o.noMatchesFoundText=(f=this._locales)==null?void 0:f.TEXT_NO_MATCHES_FOUND;this.defaultOptions=o,this.init()}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get collectionOptions(){var e;return(e=this.columnEditor)==null?void 0:e.collectionOptions}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this.editorElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.select,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get isCompositeEditor(){var e;return!!((e=this.args)!=null&&e.compositeEditorOptions)}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.editor)==null?void 0:t.customStructure}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get currentValues(){var s,n,o;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[];if(this.collection.every(l=>typeof l=="number"||typeof l=="string"))return this.collection.filter(l=>e==null?void 0:e.some(a=>`${a}`===(l==null?void 0:l.toString())));const t=((n=this.collectionOptions)==null?void 0:n.separatorBetweenTextLabels)??"",i=((o=this.collectionOptions)==null?void 0:o.includePrefixSuffixToSelectedValues)??!1;return this.collection.filter(l=>e.some(a=>{var h;return`${a}`===((h=l==null?void 0:l[this.valueName])==null?void 0:h.toString())})).map(l=>{var m,f;const a=l[this.valueName];let h=l[this.labelPrefixName]||"",d=l[this.labelSuffixName]||"";const c=((m=this.columnDef)==null?void 0:m.field)??"",u=(c==null?void 0:c.indexOf("."))>0,p=((f=this.columnEditor)==null?void 0:f.serializeComplexValueFormat)??"object";return u&&typeof l=="object"&&p==="object"?l:(h=this.enableTranslateLabel&&this._translaterService&&h&&typeof h=="string"?this._translaterService.translate(h||" "):h,d=this.enableTranslateLabel&&this._translaterService&&d&&typeof d=="string"?this._translaterService.translate(d||" "):d,i?[h,a,d].filter(_=>_).join(t):a)})}get currentValue(){var s,n,o,l,a;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[],t=e.length?e[0]:"",i=(n=this.columnDef)==null?void 0:n.field;if(i!==void 0){if(this.collection.every(m=>typeof m=="number"||typeof m=="string"))return xt(this.collection,m=>{var f;return((f=m==null?void 0:m.toString)==null?void 0:f.call(m))===`${t}`});const h=((o=this.collectionOptions)==null?void 0:o.separatorBetweenTextLabels)??"",d=((l=this.collectionOptions)==null?void 0:l.includePrefixSuffixToSelectedValues)??!1,c=xt(this.collection,m=>{var f;return m.hasOwnProperty(this.valueName)&&((f=m[this.valueName])==null?void 0:f.toString())===`${t}`}),u=(i==null?void 0:i.indexOf("."))>0,p=((a=this.columnEditor)==null?void 0:a.serializeComplexValueFormat)??"object";if(u&&typeof c=="object"&&p==="object")return c;if(c&&c.hasOwnProperty(this.valueName)){const m=c[this.valueName];if(d){let f=c[this.labelPrefixName]||"",g=c[this.labelSuffixName]||"";return f=this.enableTranslateLabel&&this._translaterService&&f&&typeof f=="string"?this._translaterService.translate(f||" "):f,g=this.enableTranslateLabel&&this._translaterService&&g&&typeof g=="string"?this._translaterService.translate(g||" "):g,[f,m,g].filter(b=>b).join(h)}return m}}return""}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var e,t,i,s,n,o,l;if(!this.columnDef||!this.columnDef.editor||!this.columnDef.editor.collection&&!this.columnDef.editor.collectionAsync)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") inside Column Definition Editor for the MultipleSelect/SingleSelect Editor to work correctly.
18
18
  Also each option should include a value/label pair (or value/labelKey when using Locale).
19
19
  For example: { editor: { collection: [{ value: true, label: 'True' },{ value: false, label: 'False'}] } }`);if(this._collectionService=new Cl(this._translaterService),this.enableTranslateLabel=((e=this.columnEditor)==null?void 0:e.enableTranslateLabel)??!1,this.labelName=((t=this.customStructure)==null?void 0:t.label)??"label",this.labelPrefixName=((i=this.customStructure)==null?void 0:i.labelPrefix)??"labelPrefix",this.labelSuffixName=((s=this.customStructure)==null?void 0:s.labelSuffix)??"labelSuffix",this.optionLabel=((n=this.customStructure)==null?void 0:n.optionLabel)??"value",this.valueName=((o=this.customStructure)==null?void 0:o.value)??"value",this.enableTranslateLabel&&(!this._translaterService||typeof this._translaterService.translate!="function"))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');this.renderDomElement(this.collection),(this.disabled||(l=this.columnEditor)!=null&&l.collectionAsync&&Array.isArray(this.collection)&&this.collection.length===0)&&this.disable(!0)}getValue(){return this.isMultipleSelect?this.currentValues:this.currentValue}setValue(e,t=!1,i=!0){if(this.isMultipleSelect&&Array.isArray(e)?this.loadMultipleValues(e):this.loadSingleValue(e),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(s,"system")}}cancel(){var e;(e=this.args)!=null&&e.cancelChanges&&this.args.cancelChanges()}hide(){this._msInstance&&this._msInstance.close()}show(e){!this.isCompositeEditor&&this._msInstance?this._msInstance.open(e):this.isCompositeEditor&&this.applyInputUsabilityState()}applyValue(e,t){var o,l,a;const i=(o=this.columnDef)==null?void 0:o.field,s=(l=this.columnDef)==null?void 0:l.type;let n=t;if(i!==void 0){(s===S.number||s===S.integer||s===S.boolean)&&!isNaN(parseFloat(t))&&(n=parseFloat(t)),this.isMultipleSelect&&typeof t=="string"&&t.indexOf(",")>=0&&(n=t.split(","));const h=(i==null?void 0:i.indexOf("."))>0,d=this.validate(null,n);if(n=d!=null&&d.valid?n:"",h){const c=((a=this.columnEditor)==null?void 0:a.complexObjectPath)??i??"";$e(e,c,n)}else e[i]=n}}destroy(){var e,t;this._msInstance&&this.hasAutoCommitEdit&&this.isValueChanged()&&!this._isDisposingOrCallingSave&&!this.isCompositeEditor&&(this._isDisposingOrCallingSave=!0,this.save(!0)),this._isDisposingOrCallingSave=!0,typeof((e=this._msInstance)==null?void 0:e.destroy)=="function"&&this._msInstance.destroy(),(t=this.editorElm)==null||t.remove(),this._msInstance=void 0}loadValue(e){var s,n;const t=(s=this.columnDef)==null?void 0:s.field,i=t!==void 0&&(t==null?void 0:t.indexOf("."))>0;if(e&&t!==void 0){const o=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??t,l=i?Ee(e,o):e.hasOwnProperty(t)&&e[t],a=i&&(l!=null&&l.hasOwnProperty(this.valueName))?l[this.valueName]:l;this.isMultipleSelect&&Array.isArray(a)?this.loadMultipleValues(a):this.loadSingleValue(a)}}loadMultipleValues(e){var t;if(Array.isArray(e)){this.originalValue=e.map(s=>typeof s=="number"||typeof s=="boolean"?`${s}`:s),(t=this._msInstance)==null||t.setSelects(this.originalValue);const i=this.args.compositeEditorOptions;i&&this.handleChangeOnCompositeEditor(i)}}loadSingleValue(e){var t;this.originalValue=typeof e=="number"||typeof e=="boolean"?`${e}`:e,(t=this._msInstance)==null||t.setSelects([this.originalValue])}serializeValue(){return this.isMultipleSelect?this.currentValues:this.currentValue}changeEditorOption(e,t){var i;this.columnEditor&&(this.columnEditor.editorOptions||(this.columnEditor.editorOptions={}),this.columnEditor.editorOptions[e]=t,this.editorElmOptions={...this.editorElmOptions,[e]:t},(i=this._msInstance)==null||i.refreshOptions(this.editorElmOptions))}disable(e=!0){const t=this.disabled;if(this.disabled=e,this._msInstance)if(e){this._msInstance.disable();const i=this.getValue(),s=Array.isArray(i)&&this.isMultipleSelect?(i==null?void 0:i[0])==="":i==="";t!==e&&this.isCompositeEditor&&!s&&this.reset("",!0,!0)}else this._msInstance.enable()}focus(){var e;this.grid.focus(),(e=this._msInstance)==null||e.focus()}isValueChanged(){var i;const e=(i=this._msInstance)==null?void 0:i.getSelects();if(this.isMultipleSelect)return!ut(e,this.originalValue);const t=Array.isArray(e)&&e.length>0?e[0]:void 0;return t!==void 0&&t!==this.originalValue}isValueTouched(){return this._isValueTouched}reset(e,t=!0,i=!1){const s=e??this.originalValue;if(this._msInstance){this.originalValue=this.isMultipleSelect?s!==void 0?[s]:[]:s;const o=this.originalValue===void 0?[]:[this.originalValue];this._msInstance.setSelects(o)}this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(n,"user",o)}}save(e=!1){const t=this.validate(),i=(t==null?void 0:t.valid)??!1;(!this._isDisposingOrCallingSave||e)&&this.hasAutoCommitEdit&&i?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}validate(e,t){var o,l;const i=this.isCompositeEditor?!1:(o=this.columnEditor)==null?void 0:o.required,s=t!==void 0?t:(l=this._msInstance)==null?void 0:l.getSelects(),n=this.columnEditor&&this.columnEditor.errorMessage;if(this.isCompositeEditor&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};if(this.validator){const a=t!==void 0?t:this.isMultipleSelect?this.currentValues:this.currentValue;return this.validator(a,this.args)}return i&&(s===""||Array.isArray(s)&&s.length===0)?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}filterCollection(e){var i;let t=e;if(this.columnEditor&&this.columnEditor.collectionFilterBy){const s=this.columnEditor.collectionFilterBy,n=((i=this.columnEditor.collectionOptions)==null?void 0:i.filterResultAfterEachPass)??null;t=this._collectionService.filterCollection(t,s,n)}return t}sortCollection(e){let t=e;if(this.columnDef&&this.columnEditor&&this.columnEditor.collectionSortBy){const i=this.columnEditor.collectionSortBy;t=this._collectionService.sortCollection(this.columnDef,t,i,this.enableTranslateLabel)}return t}renderDomElement(e){var n,o,l,a,h;if(!Array.isArray(e)&&((n=this.collectionOptions)!=null&&n.collectionInsideObjectProperty)){const d=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,d)}if(!Array.isArray(e))throw new Error('The "collection" passed to the Select Editor is not a valid array.');let t=[];if(e.length>0&&(t=[...e]),(o=this.collectionOptions)!=null&&o.addBlankEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==""&&(t.unshift(this.createBlankEntry()),this.collection.unshift(this.createBlankEntry())),(l=this.collectionOptions)!=null&&l.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&(t.unshift(this.collectionOptions.addCustomFirstEntry),this.collection.unshift(this.collectionOptions.addCustomFirstEntry)),(a=this.collectionOptions)!=null&&a.addCustomLastEntry&&Array.isArray(t)&&t.length>0){const d=t.length-1;t[d][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;if(i=this.filterCollection(i),i=this.sortCollection(i),(h=this.columnEditor)!=null&&h.collectionOverride){const d={column:this.columnDef,dataContext:this.dataContext,grid:this.grid,originalCollections:this.collection};if(this.args.compositeEditorOptions){const{formValues:c,modalType:u}=this.args.compositeEditorOptions;d.compositeEditorOptions={formValues:c,modalType:u}}i=this.columnEditor.collectionOverride(i,d)}this.finalCollection=i;const s=vl("editor",i,this.columnDef,this.grid,this.isMultipleSelect,this._translaterService);this.createDomElement(s.selectElement,s.dataCollection)}createBlankEntry(){const e={[this.labelName]:"",[this.valueName]:""};return this.labelPrefixName&&(e[this.labelPrefixName]=""),this.labelSuffixName&&(e[this.labelSuffixName]=""),e}createDomElement(e,t){var n;const i=this.args.container;e&&i&&typeof i.appendChild=="function"&&(J(i),i.appendChild(e));const s=((n=this.columnEditor)==null?void 0:n.placeholder)??"";this.defaultOptions.placeholder=s||"",this.editorElmOptions={...this.defaultOptions,...this.editorOptions,data:t},this._msInstance=wi(e,this.editorElmOptions),this.editorElm=this._msInstance.getParentElement(),this.isCompositeEditor||this.show(this.delayOpening)}handleChangeOnCompositeEditor(e,t="user",i=!1){var c,u,p;const s=this.grid.getActiveCell(),n=this.args.column,o=((c=this.columnDef)==null?void 0:c.id)??"",l=this.dataContext,a=this.grid,h=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,h),this.applyValue(e.formValues,h);const d=((p=(u=this.gridOptions)==null?void 0:u.compositeEditorOptions)==null?void 0:p.excludeDisabledFieldFormValues)??!1;(i||this.disabled&&d&&e.formValues.hasOwnProperty(o))&&delete e.formValues[o],a.onCompositeEditorChange.notify({...s,item:l,grid:a,column:n,formValues:e.formValues,editors:e.editors,triggeredBy:t},new le)}}class Tp extends Pa{constructor(e,t=0){super(e,!0,t),this.args=e,this.delayOpening=t}}class Op extends Pa{constructor(e,t=0){super(e,!1,t),this.args=e,this.delayOpening=t}}class xp{constructor(e){if(this.args=e,this._defaultValue=0,this._isValueTouched=!1,this._sliderNumberElm=null,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this._editorElm}get editorInputDomElement(){return this._inputElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.slider,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get sliderOptions(){return this._sliderOptions}get validator(){var e;return this.columnEditor.validator??((e=this.columnDef)==null?void 0:e.validator)}init(){var e;if(this._cellContainerElm=(e=this.args)==null?void 0:e.container,this._cellContainerElm&&this.columnDef){const t=this.args.compositeEditorOptions;this._editorElm=this.buildDomElement(),t||this.focus(),this._cellContainerElm.appendChild(this._editorElm),this._bindEventService.bind(this._sliderTrackElm,["click","mouseup"],this.sliderTrackClicked.bind(this)),this._bindEventService.bind(this._inputElm,["change","mouseup","touchend"],this.handleChangeEvent.bind(this)),this._bindEventService.bind(this._inputElm,["input","change"],this.handleChangeSliderNumber.bind(this))}}cancel(){this._inputElm&&(this._inputElm.value=`${this._originalValue}`),this.args.cancelChanges()}destroy(){var e,t,i;this._bindEventService.unbindAll(),(e=this._inputElm)==null||e.remove(),(t=this._editorElm)==null||t.remove(),(i=this._sliderTrackElm)==null||i.remove()}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset(0,!0,!0)}else this._inputElm.disabled=!1}focus(){var e;this.grid.focus(),(e=this._inputElm)==null||e.focus()}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._inputElm)==null?void 0:e.value)??""}setValue(e,t=!1,i=!0){if(this._inputElm&&(this._inputElm.value=`${e}`),this._sliderNumberElm&&(this._sliderNumberElm.textContent=`${e}`),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s;const i=((s=this.columnDef)==null?void 0:s.field)??"";if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(void 0,t),l=o&&o.valid?t:"";if(n){const a=this.columnEditor.complexObjectPath??i??"";$e(e,a,l)}else e&&(e[i]=l)}}isValueChanged(){var t;const e=((t=this._inputElm)==null?void 0:t.value)??"";return!(e===""&&this._originalValue===void 0)&&+e!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=((i=this.columnDef)==null?void 0:i.field)??"";if(e&&t!==void 0){let n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e.hasOwnProperty(t)?e[t]:this._defaultValue;(n===""||n===null||n===void 0)&&(n=this._defaultValue),this._originalValue=+n,this._inputElm&&(this._inputElm.value=`${n}`,this._inputElm.title=`${n}`),this._sliderNumberElm&&(this._sliderNumberElm.textContent=`${n}`)}this.updateTrackFilledColorWhenEnabled()}reset(e,t=!0,i=!1){const s=e??this._originalValue??0;this._inputElm&&(this._inputElm.value=`${s}`),this._sliderNumberElm&&(this._sliderNumberElm.textContent=`${s}`),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var t;const e=((t=this._inputElm)==null?void 0:t.value)??"";return e!==""?parseInt(e,10):this._originalValue}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._inputElm)==null?void 0:s.value;return Cp(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}buildDomElement(){var h;const e=((h=this.columnDef)==null?void 0:h.id)??"",t=this.columnEditor.title??"",i=+(this.columnEditor.minValue??R.SLIDER_DEFAULT_MIN_VALUE),s=+(this.columnEditor.maxValue??R.SLIDER_DEFAULT_MAX_VALUE),n=+(this.columnEditor.valueStep??R.SLIDER_DEFAULT_STEP),o=this.editorOptions.sliderStartValue??i;this._defaultValue=+o,this._sliderTrackElm=v("div",{className:"slider-track"}),this._inputElm=v("input",{type:"range",title:t,defaultValue:`${o}`,value:`${o}`,min:`${i}`,max:`${s}`,step:`${this.columnEditor.valueStep??R.SLIDER_DEFAULT_STEP}`,ariaLabel:this.columnEditor.ariaLabel??`${_t(e+"")} Slider Editor`,className:`slider-editor-input editor-${e}`});const l=v("div",{className:"slider-container slider-editor"}),a=v("div",{className:"slider-input-container slider-editor"});if(a.appendChild(this._sliderTrackElm),a.appendChild(this._inputElm),l.appendChild(a),!this.editorOptions.hideSliderNumber){l.classList.add("input-group");const d=v("div",{className:"input-group-addon input-group-append slider-value"});this._sliderNumberElm=v("span",{className:"input-group-text",textContent:`${o}`}),d.appendChild(this._sliderNumberElm),l.appendChild(d)}return this._sliderOptions={minValue:i,maxValue:s,step:n},l}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeEvent(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t?this.handleChangeOnCompositeEditor(e,t):this.save()}handleChangeSliderNumber(e){var i,s;const t=((i=e.target)==null?void 0:i.value)??"";t!==""&&(!this.editorOptions.hideSliderNumber&&this._sliderNumberElm&&(this._sliderNumberElm.textContent=t),this._inputElm.title=t,(s=this.args)!=null&&s.compositeEditorOptions||this.grid.onMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e))),this.updateTrackFilledColorWhenEnabled()}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}sliderTrackClicked(e){e.preventDefault();const t=e.offsetX,i=this._sliderTrackElm.offsetWidth,s=(t+0)*100/i;this._inputElm&&(this._inputElm.value=`${s}`,this._inputElm.dispatchEvent(new Event("change")))}updateTrackFilledColorWhenEnabled(){var e,t;if(this.editorOptions.enableSliderTrackColoring&&this._inputElm){const s=(+this.getValue()-+this._inputElm.min)/(((e=this.sliderOptions)==null?void 0:e.maxValue)??0-+this._inputElm.min)*100,n="linear-gradient(to right, %b %p1, %c %p1, %c %p2, %b %p2)".replace(/%b/g,"#eee").replace(/%c/g,((t=this.editorOptions)==null?void 0:t.sliderTrackFilledColor)??"var(--slick-slider-filter-thumb-color, #86bff8)").replace(/%p1/g,"0%").replace(/%p2/g,`${s}%`);this._sliderTrackElm.style.background=n,this._sliderOptions.sliderTrackBackground=n}}}const Pr={autocompleter:fp,checkbox:gp,date:_p,dualInput:vp,float:Sp,integer:Ep,longText:wp,multipleSelect:Tp,password:yp,singleSelect:Op,slider:xp,text:Qs},Ip=(r,e,t,i,s)=>{var h;const n=i&&i.params||{},o=n.propertyNames,l=(n==null?void 0:n.includeTitle)??!0;let a=n.dataContextProperty;if(a||(a=((h=i==null?void 0:i.field)==null?void 0:h.split(".")[0])||""),!o||!Array.isArray(o)||!a)throw new Error(`Formatters.arrayObjectToCsv requires you to pass an array of "propertyNames" (declared in "params") that you want to pull the data from.
20
20
  For example, if we have an array of user objects that have the property of firstName & lastName then we need to pass in your column definition:: { params: { propertyNames: ['firtName'] }}.
@@ -25,9 +25,9 @@
25
25
  3- via the field name that includes a dot notation, example: this.columnDefs = [{ id: 'user', field: 'user.firstName'}] `);if(i.labelKey&&s.hasOwnProperty(o))return(l=s[o])==null?void 0:l[i.labelKey];if(typeof o=="string"&&o.indexOf(".")>0){let a=o.split(".").reduce((h,d)=>h!=null&&h.hasOwnProperty(d)?h[d]:"",s);return(a==null||typeof a=="object"&&Object.entries(a).length===0&&!(a instanceof Date))&&(a=""),a}return t},kp=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,numberPrefix:a,numberSuffix:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(i,n,"decimal","cell");return U(t)?Ie(t,o,l,u,a,h,d,c):t},Fp=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,decimalSeparator:a,thousandSeparator:h,wrapNegativeNumber:d}=Se(i,n,"currency","cell");return U(t)?Ie(t,o,l,d,"$","",a,h):t},Dp=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,decimalSeparator:a,thousandSeparator:h,wrapNegativeNumber:d}=Se(i,n,"currency","cell");if(U(t)){const c=t>=0?"green":"red",u=Ie(t,o,l,d,"$","",a,h),p=v("span",{ariaHidden:"true",textContent:u});return p.style.color=c,p}return t},Mp=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,decimalSeparator:a,thousandSeparator:h,wrapNegativeNumber:d}=Se(i,n,"currency","cell");if(U(t)){const c=t>=0?"green":"red",u=Ie(t,o,l,d,"$","",a,h),p=v("span",{ariaHidden:"true",textContent:u});return p.style.color=c,p.style.fontWeight="bold",p}return t},Np=(r,e,t,i,s,n)=>{const{currencyPrefix:o,currencySuffix:l,minDecimal:a,maxDecimal:h,numberPrefix:d,numberSuffix:c,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Se(i,n,"decimal","cell");if(U(t)){const f=Ie(t,a,h,m,o,l,u,p);return`${d}${f}${c}`}return t},Lp=(r,e,t,i,s,n)=>{const o=i&&i.params||{};let l=o.hyperlinkText?o.hyperlinkText:t;l=n.sanitizeHtmlString(l);let a=o.hyperlinkUrl?o.hyperlinkUrl:t;a=n.sanitizeHtmlString(a);const h=a.match(/^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&amp;:/~+#]*[\w\-@?^=%&amp;/~+#])?/i);if(h&&Array.isArray(h)&&h.length>0){const d=h[0];return v("a",{href:d,textContent:l})}return t},Hp=(r,e,t,i)=>{const n=((i==null?void 0:i.params)||{}).cssClass;if(!n)throw new Error('[Slickgrid-Universal] When using `Formatters.iconBoolean`, you must provide You must provide the "cssClass", e.g.: { formatter: Formatters.iconBoolean, params: { cssClass: "mdi mdi-check" }}');let o=!1;const l=!isNaN(t);return(t===!0||l&&parseFloat(t)>0||!l&&typeof t=="string"&&t.toLowerCase()!=="false"&&t!=="0")&&(o=!0),o?v("i",{className:n,ariaHidden:"true"}):""},Vp=(r,e,t,i)=>{const s=(i==null?void 0:i.params)??{},n=s.iconCssClass||s.icon||s.formatterIcon;if(!n)throw new Error('[Slickgrid-Universal] When using `Formatters.icon`, you must provide the "iconCssClass" via the generic "params". (e.g.: `{ formatter: Formatters.icon, params: { iconCssClass: "mdi mdi-magnify" }}`');return v("i",{className:n,ariaHidden:"true"})},Bp=(r,e,t,i,s,n)=>{const l=(i.params||{}).mask;if(!l)throw new Error(`You must provide a "mask" via the generic "params" options (e.g.: { formatter: Formatters.mask, params: { mask: '000-000' }}`);if(t){let a=0;const h=t.toString(),d=n.getOptions()||{},c=d!=null&&d.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment;return c.textContent=l.replace(/[09A]/gi,()=>h[a++]||""),c}return t},zp=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,decimalSeparator:a,thousandSeparator:h,wrapNegativeNumber:d}=Se(i,n,"percent","cell");if(U(t)){const c=t*100;return Ie(c,o,l,d,"","%",a,h)}return t},$p=(r,e,t)=>{if(!U(t))return"";let i="",s=parseFloat(t);return s>100&&(s=100),s<30?i="red":s<70?i="silver":i="green",v("span",{className:"percent-complete-bar",title:`${s}%`,style:{background:i,width:`${s}%`}})},Wp=(r,e,t)=>{if(!U(t))return"";let i="",s=parseFloat(t);return s>100&&(s=100),s<30?i="red":s<70?i="silver":i="green",v("div",{className:"percent-complete-bar-with-text",title:`${s}%`,textContent:`${s}%`,style:{background:i,width:`${s}%`}})},Gp=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,decimalSeparator:a,thousandSeparator:h,wrapNegativeNumber:d}=Se(i,n,"percent","cell");if(U(t)){const c=t<50?"red":"green",u=Ie(t,o,l,d,"","%",a,h),p=t>100?"100%":u;return v("span",{textContent:p,style:{color:c}})}return t},Up=(r,e,t,i,s,n)=>{const{minDecimal:o,maxDecimal:l,decimalSeparator:a,thousandSeparator:h,wrapNegativeNumber:d}=Se(i,n,"percent","cell");return U(t)?Ie(t,o,l,d,"","%",a,h):t},jp=(r,e,t)=>{if(!U(t))return"";let i="",s=parseFloat(t);s>100&&(s=100),s<30?i="danger":s<70?i="warning":i="success";const n=v("div",{className:"progress"});return n.appendChild(v("div",{className:`progress-bar progress-bar-${i} bg-${i}`,role:"progressbar",ariaValueNow:String(s),ariaValueMin:"0",ariaValueMax:"100",textContent:`${s}%`,style:{minWidth:"2em",width:`${s}%`}})),n},Yp=(r,e,t,i,s,n)=>{const l=((n==null?void 0:n.getOptions())??{}).translater||i&&i.params&&i.params.translater;if(!l||typeof l.translate!="function")throw new Error(`"Formatters.translate" requires the Translate Service to be provided as a Grid Options "translater" (or "i18n" depending on which framework you use).
26
26
  For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }`);return t!=null&&typeof t!="string"&&(t=t+""),t?l.translate(t):""},Xp=(r,e,t,i,s,n)=>{var x,O;const o=n.getOptions(),l=o==null?void 0:o.treeDataOptions,a=(l==null?void 0:l.collapsedPropName)??R.treeDataProperties.COLLAPSED_PROP,h=(l==null?void 0:l.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP,d=(l==null?void 0:l.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP,c=(l==null?void 0:l.exportIndentMarginLeft)??5,u=(l==null?void 0:l.exportIndentationLeadingChar)??".",p=(l==null?void 0:l.exportIndentationLeadingSpaceCount)??3,m=((x=o==null?void 0:o.excelExportOptions)==null?void 0:x.groupCollapsedSymbol)??"⮞",f=((O=o==null?void 0:o.excelExportOptions)==null?void 0:O.groupExpandedSymbol)??"⮟";let g=t;if(g=Mi(i,s,t),g==null||s===void 0)return"";if(!s.hasOwnProperty(d))throw new Error('[Slickgrid-Universal] You must provide valid "treeDataOptions" in your Grid Options, however it seems that we could not find any tree level info on the current item datacontext row.');const _=(s==null?void 0:s[d])??0;let b="",C=0;s[h]?(b=s!=null&&s[a]?m:f,C=_===0?0:c*_):C=c*(_===0?0:_+1);const E=Vi(C);return l!=null&&l.titleFormatter&&(g=zs(l.titleFormatter,r,e,i,s,n)),g=`${_===0&&b?"":_===0?`${u}${Vi(p)}`:u}${E}${b} ${g}`,we(g)},qp=(r,e,t,i,s,n)=>{const o=n.getOptions(),l=o==null?void 0:o.treeDataOptions,a=(l==null?void 0:l.indentMarginLeft)??15,h=(l==null?void 0:l.collapsedPropName)??R.treeDataProperties.COLLAPSED_PROP,d=(l==null?void 0:l.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP,c=(l==null?void 0:l.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;let u=t;if(u=Mi(i,s,t),u==null||s===void 0)return"";if(!s.hasOwnProperty(c))throw new Error('[Slickgrid-Universal] You must provide valid "treeDataOptions" in your Grid Options, however it seems that we could not find any tree level info on the current item datacontext row.');const p=(s==null?void 0:s[c])??0,m=document.createElement("span");m.style.display="inline-block",m.style.width=`${a*p}px`;const f=`slick-tree-level-${p}`;let g="";s[d]&&(g=s!=null&&s[h]?"collapsed":"expanded"),l!=null&&l.titleFormatter&&(u=zs(l.titleFormatter,r,e,i,s,n));const _=`slick-group-toggle ${g}`.trim(),b=v("div",{className:_,ariaExpanded:String(g==="expanded")}),C=v("span",{className:"slick-tree-title"});n.applyHtmlCode(C,u),C.setAttribute("level",p);const E=o!=null&&o.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment;return E.appendChild(m),E.appendChild(b),E.appendChild(C),{addClasses:f,html:E}},Kp=(r,e,t,i,s,n)=>{var c;const o=n.getOptions(),l=((c=o==null?void 0:o.treeDataOptions)==null?void 0:c.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP,{groupTotalsFormatter:a,treeTotalsFormatter:h,params:d}=i;if(!a&&!h)throw new Error('[Slickgrid-Universal] When using Formatters.treeParseTotals, you must provide a total formatter via "groupTotalsFormatter" or "treeTotalsFormatter".');if(s[l]&&(s!=null&&s.__treeTotals)&&(a||h))return(h??a)(s==null?void 0:s.__treeTotals,i,n);if(d.formatters){let u=t;for(const p of d.formatters)!s[l]&&!(s!=null&&s.__treeTotals)&&typeof p=="function"&&(u=p(r,e,u,i,s,n)||t);return u}return t},Qp=(r,e,t,i,s,n)=>{const l=((n==null?void 0:n.getOptions())??{}).translater||i&&i.params&&i.params.translater;if(!l||typeof l.translate!="function")throw new Error(`"Formatters.translateBoolean" requires the Translate Service to be provided as a Grid Options "translater" (or "i18n" depending on which framework you use).
27
27
  For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }`);return t!=null&&typeof t!="string"&&(t=t+""),t?l.translate(t.toUpperCase()):""},_e={arrayObjectToCsv:Ip,arrayToCsv:Zs,checkmarkMaterial:Rp,complex:ka,complexObject:ka,collection:Pp,collectionEditor:Ap,currency:Np,dateIso:ye(S.dateIso,"-"),dateTimeIso:ye(S.dateTimeIso,"-"),dateTimeShortIso:ye(S.dateTimeShortIso,"-"),dateTimeIsoAmPm:ye(S.dateTimeIsoAmPm,"-"),dateTimeIsoAM_PM:ye(S.dateTimeIsoAM_PM,"-"),dateEuro:ye(S.dateEuro,"/"),dateEuroShort:ye(S.dateEuroShort,"/"),dateTimeEuro:ye(S.dateTimeEuro,"/"),dateTimeEuroShort:ye(S.dateTimeEuroShort,"/"),dateTimeShortEuro:ye(S.dateTimeShortEuro,"/"),dateTimeEuroAmPm:ye(S.dateTimeEuroAmPm,"/"),dateTimeEuroAM_PM:ye(S.dateTimeEuroAM_PM,"/"),dateTimeEuroShortAmPm:ye(S.dateTimeEuroShortAmPm,"/"),dateTimeEuroShortAM_PM:ye(S.dateTimeEuroShortAM_PM,"/"),dateUs:ye(S.dateUs,"/"),dateTimeUs:ye(S.dateTimeUs,"/"),dateTimeShortUs:ye(S.dateTimeShortUs,"/"),dateTimeUsAmPm:ye(S.dateTimeUsAmPm,"/"),dateTimeUsAM_PM:ye(S.dateTimeUsAM_PM,"/"),dateTimeUsShort:ye(S.dateTimeUsShort,"/"),dateTimeUsShortAmPm:ye(S.dateTimeUsShortAmPm,"/"),dateTimeUsShortAM_PM:ye(S.dateTimeUsShortAM_PM,"/"),dateUsShort:ye(S.dateUsShort,"/"),dateUtc:ye(S.dateUtc,"-"),decimal:kp,dollar:Fp,dollarColored:Dp,dollarColoredBold:Mp,hyperlink:Lp,icon:Vp,iconBoolean:Hp,mask:Bp,multiple:Bs,percent:zp,percentComplete:Gp,percentCompleteBar:$p,percentCompleteBarWithText:Wp,percentSymbol:Up,progressBar:jp,translate:Yp,translateBoolean:Qp,tree:qp,treeParseTotals:Kp,treeExport:Xp},ne={avgTotals:(r,e,t)=>{var p;const i=e.field??"";let s=(p=r.avg)==null?void 0:p[i];const n=e==null?void 0:e.params;let o=(n==null?void 0:n.groupFormatterPrefix)||"";const l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"regular","group");if(U(s)){if(s<0)if(s=Math.abs(s),!u)o+="-";else{if(isNaN(a)&&isNaN(h)){const m=Ot(Math.round(s),c);return`${o}(${m})${l}`}return`${o}(${Lt(s,a,h,d,c)})${l}`}if(isNaN(a)&&isNaN(h)){const m=Ot(Math.round(s),c);return`${o}${m}${l}`}return`${o}${Lt(s,a,h,d,c)}${l}`}return""},avgTotalsCurrency:(r,e,t)=>{var f;const i=e.field??"",s=(f=r.avg)==null?void 0:f[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",a=(n==null?void 0:n.groupFormatterCurrencyPrefix)||"",h=(n==null?void 0:n.groupFormatterCurrencySuffix)||"",{minDecimal:d,maxDecimal:c,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Se(e,t,"currency","group");if(U(s)){const g=Ie(s,d,c,m,a,h,u,p);return`${o}${g}${l}`}return""},avgTotalsDollar:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.avg)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"currency","group");if(U(s)){const m=Ie(s,a,h,u,"$","",d,c);return`${o}${m}${l}`}return""},avgTotalsPercentage:(r,e,t)=>{var p;const i=e.field??"";let s=(p=r.avg)==null?void 0:p[i];const n=e==null?void 0:e.params;let o=(n==null?void 0:n.groupFormatterPrefix)||"";const l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"percent","group");if(U(s)){if(s<0)if(s=Math.abs(s),!u)o+="-";else{if(isNaN(a)&&isNaN(h)){const m=Ot(Math.round(s),c);return`${o}(${m}%)${l}`}return`${o}(${Lt(s,a,h,d,c)}%)${l}`}if(isNaN(a)&&isNaN(h)){const m=Ot(Math.round(s),c);return`${o}${m}%${l}`}return`${o}${Lt(s,a,h,d,c)}%${l}`}return""},maxTotals:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.max)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"regular","group");if(U(s)){const m=Ie(s,a,h,u,"","",d,c);return`${o}${m}${l}`}return""},minTotals:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.min)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"regular","group");if(U(s)){const m=Ie(s,a,h,u,"","",d,c);return`${o}${m}${l}`}return""},sumTotals:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"regular","group");if(U(s)){const m=Ie(s,a,h,u,"","",d,c);return`${o}${m}${l}`}return""},sumTotalsBold:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"regular","group");if(U(s)){const m=Ie(s,a,h,u,"","",d,c);return v("span",{style:{fontWeight:"bold"},textContent:`${o}${m}${l}`})}return""},sumTotalsColored:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"regular","group");if(U(s)){const m=s>=0?"green":"red",f=Ie(s,a,h,u,"","",d,c);return v("span",{style:{color:m},textContent:`${o}${f}${l}`})}return""},sumTotalsCurrency:(r,e,t)=>{var f;const i=e.field??"",s=(f=r.sum)==null?void 0:f[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",a=(n==null?void 0:n.groupFormatterCurrencyPrefix)||"",h=(n==null?void 0:n.groupFormatterCurrencySuffix)||"",{minDecimal:d,maxDecimal:c,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Se(e,t,"currency","group");if(U(s)){const g=Ie(s,d,c,m,a,h,u,p);return`${o}${g}${l}`}return""},sumTotalsCurrencyColored:(r,e,t)=>{var f;const i=e.field??"",s=(f=r.sum)==null?void 0:f[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",a=(n==null?void 0:n.groupFormatterCurrencyPrefix)||"",h=(n==null?void 0:n.groupFormatterCurrencySuffix)||"",{minDecimal:d,maxDecimal:c,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Se(e,t,"currency","group");if(U(s)){const g=s>=0?"green":"red",_=Ie(s,d,c,m,a,h,u,p);return v("span",{style:{color:g},textContent:`${o}${_}${l}`})}return""},sumTotalsDollar:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"currency","group");if(U(s)){const m=Ie(s,a,h,u,"$","",d,c);return`${o}${m}${l}`}return""},sumTotalsDollarBold:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"currency","group");if(U(s)){const m=Ie(s,a,h,u,"$","",d,c);return v("span",{style:{fontWeight:"bold"},textContent:`${o}${m}${l}`})}return""},sumTotalsDollarColored:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"currency","group");if(U(s)){const m=s>=0?"green":"red",f=Ie(s,a,h,u,"$","",d,c);return v("span",{style:{color:m},textContent:`${o}${f}${l}`})}return""},sumTotalsDollarColoredBold:(r,e,t)=>{var p;const i=e.field??"",s=(p=r.sum)==null?void 0:p[i],n=e==null?void 0:e.params,o=(n==null?void 0:n.groupFormatterPrefix)||"",l=(n==null?void 0:n.groupFormatterSuffix)||"",{minDecimal:a,maxDecimal:h,decimalSeparator:d,thousandSeparator:c,wrapNegativeNumber:u}=Se(e,t,"currency","group");if(U(s)){const m=s>=0?"green":"red",f=Ie(s,a,h,u,"$","",d,c);return v("span",{style:{color:m,fontWeight:"bold"},textContent:`${o}${f}${l}`})}return""}};class Zp{constructor(){this.options=Rr}}const kr={...dh,...ch,...fh,...jh,...wh,deepAssign:Kt};function Jp(r,e,t){let i;t={...{modalType:"edit",validationFailedMsg:"Some of the fields have failed validation",validationMsgPrefix:null,show:null,hide:null,position:null,destroy:null,formValues:{},editors:{}},...t};const n=()=>{},o=a=>{const h=e[a],d=me(h),c=(h==null?void 0:h.clientWidth)??0,u=(h==null?void 0:h.clientHeight)??0;return{top:(d==null?void 0:d.top)??0,left:(d==null?void 0:d.left)??0,bottom:((d==null?void 0:d.top)??0)+u,right:((d==null?void 0:d.left)??0)+c,width:c,height:u,visible:!0}};function l(a){const h=this;let d=[];function c(){let u={},p=0;for(;p<r.length;){if(r[p].editorClass){const m=r[p];u={...a},u.container=e[p],u.column=m,u.position=o(p),u.commitChanges=n,u.cancelChanges=n,u.compositeEditorOptions=t,u.formValues={};const f=new m.editorClass(u);t.editors[m.id]=f,d.push(f)}p++}setTimeout(()=>{Array.isArray(d)&&d.length>0&&typeof d[0].focus=="function"&&d[0].focus()},0)}h.getEditors=()=>d,h.destroy=()=>{var m;let u=d.pop();for(;u;)u==null||u.destroy(),u=d.pop();let p=e.pop();for(;p;)J(p),p==null||p.remove(),p=e.pop();(m=t==null?void 0:t.destroy)==null||m.call(t),d=[],e=null},h.focus=()=>{(i||d[0]).focus()},h.isValueChanged=()=>{let u=0;for(;u<d.length;){if(d[u].isValueChanged())return!0;u++}return!1},h.serializeValue=()=>{const u=[];let p=0;for(;p<d.length;)u[p]=d[p].serializeValue(),p++;return u},h.applyValue=(u,p)=>{let m=0;for(;m<d.length;)d[m].applyValue(u,p==null?void 0:p[m]),m++},h.loadValue=u=>{let p=0;for(;p<d.length;)d[p].loadValue(u),p++},h.validate=u=>{var g;let p;i=null;const m=[];let f=0;for(;f<d.length;){const _=(g=d[f].args)==null?void 0:g.column;if((_==null?void 0:_.id)!==void 0){const b=document.querySelector(".slick-editor-modal");let C=b==null?void 0:b.querySelector(`.item-details-validation.editor-${_.id}`),E=b==null?void 0:b.querySelector(`.item-details-label.editor-${_.id}`),y=b==null?void 0:b.querySelector(`[data-editorid=${_.id}]`);const T=(t==null?void 0:t.validationMsgPrefix)??"";(!u||y!=null&&y.contains(u))&&(p=d[f].validate(),p.valid?C&&(C.textContent="",y==null||y.classList.remove("invalid"),E==null||E.classList.remove("invalid")):(i=d[f],m.push({index:f,editor:d[f],container:e[f],msg:p.msg}),C&&(C.textContent=`${T}${p.msg}`,E==null||E.classList.add("invalid"),y==null||y.classList.add("invalid")))),C=null,E=null,y=null}f++}return u=null,m.length?{valid:!1,msg:t.validationFailedMsg,errors:m}:{valid:!0,msg:""}},h.hide=()=>{var p,m,f;let u=0;for(;u<d.length;)(m=(p=d[u])==null?void 0:p.hide)==null||m.call(p),u++;(f=t==null?void 0:t.hide)==null||f.call(t)},h.show=()=>{var p,m,f;let u=0;for(;u<d.length;)(m=(p=d[u])==null?void 0:p.show)==null||m.call(p),u++;(f=t==null?void 0:t.show)==null||f.call(t)},h.position=u=>{var p;(p=t==null?void 0:t.position)==null||p.call(t,u)},c()}return l.prototype=this,l}const Fa=r=>console.log(r.message);class Fr{get eventHandler(){return this._eventHandler}get dataView(){var e;return(e=this.grid)==null?void 0:e.getData()}get dataViewLength(){return this.dataView.getLength()}get formValues(){return this._formValues}get editors(){return this._editors}set editors(e){this._editors=e}get gridOptions(){var e;return(e=this.grid)==null?void 0:e.getOptions()}constructor(){this._columnDefinitions=[],this._lastActiveRowNumber=-1,this._formValues=null,this.gridService=null,this._eventHandler=new pe,this._bindEventService=new Ae}init(e,t){var i;if(this.grid=e,this.gridService=t.get("GridService"),this.translaterService=t.get("TranslaterService"),!this.gridService)throw new Error("[Slickgrid-Universal] it seems that the GridService is not being loaded properly, make sure the Container Service is properly implemented.");if(this.gridOptions.enableTranslate&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');this._locales=((i=this.gridOptions)==null?void 0:i.locales)??R.locales}dispose(){this._eventHandler.unsubscribeAll(),this._bindEventService.unbindAll(),this._formValues=null,this.disposeComponent()}disposeComponent(){var e,t,i;(e=this._modalBodyTopValidationElm)==null||e.remove(),(t=this._modalSaveButtonElm)==null||t.remove(),typeof((i=this._modalElm)==null?void 0:i.remove)=="function"&&(this._modalElm.remove(),document.body.classList.remove("slick-modal-open")),this._editorContainers=[]}changeFormInputValue(e,t,i=!1,s=!0){var d,c,u,p,m,f;const n=this.getColumnByObjectOrId(e),o=typeof e=="string"?e:(n==null?void 0:n.id)??"",l=(d=this._editors)==null?void 0:d[o];let a=t;if(!l&&!i)throw new Error(`Composite Editor with column id "${o}" not found.`);if(typeof(l==null?void 0:l.setValue)=="function"&&Array.isArray(this._editorContainers)){l.setValue(t,!0,s);const g=this._editorContainers.find(b=>b.dataset.editorid===o),_=((u=(c=this.gridOptions)==null?void 0:c.compositeEditorOptions)==null?void 0:u.excludeDisabledFieldFormValues)??!1;!l.disabled||l.disabled&&!_?(p=g==null?void 0:g.classList)==null||p.add("modified"):(a="",(m=g==null?void 0:g.classList)==null||m.remove("modified")),l.disabled&&(a!==""||a!==null||a!==void 0||a!==0)&&(a="")}const h=(n==null?void 0:n.field)??"";if(n&&(h!=null&&h.includes("."))){const g=((f=n.editor)==null?void 0:f.complexObjectPath)??h??"";$e(this._formValues??{},g,t)}else this._formValues={...this._formValues,[o]:a}}changeFormValue(e,t){var o;const i=this.getColumnByObjectOrId(e),s=typeof e=="string"?e:(i==null?void 0:i.id)??"",n=(i==null?void 0:i.field)??e;if(n!=null&&n.includes(".")){const l=((o=i==null?void 0:i.editor)==null?void 0:o.complexObjectPath)??n??"";$e(this._formValues,l,t)}else this._formValues={...this._formValues,[s]:t};this._formValues=Kt({},this._itemDataContext,this._formValues)}changeFormEditorOption(e,t,i){var n;const s=(n=this._editors)==null?void 0:n[e];if(s!=null&&s.changeEditorOption)s.changeEditorOption(t,i);else throw new Error(`Editor with column id "${e}" not found OR the Editor does not support "changeEditorOption" (current only available with AutoComplete, Date, MultipleSelect & SingleSelect Editors).`)}disableFormInput(e,t=!0){var s;const i=(s=this._editors)==null?void 0:s[e];i!=null&&i.disable&&Array.isArray(this._editorContainers)&&i.disable(t)}openDetails(e){var s,n,o,l,a,h,d,c,u;const t=e.onError??Fa,i={backdrop:"static",showCloseButtonOutside:!0,shouldClearRowSelectionAfterMassAction:!0,viewColumnLayout:"auto",modalType:"edit"};try{if(!this.grid||this.grid.getEditorLock().isActive()&&!this.grid.getEditorLock().commitCurrentEdit())return null;this._formValues=null,this._options={...i,...this.gridOptions.compositeEditorOptions,...e,labels:{...(s=this.gridOptions.compositeEditorOptions)==null?void 0:s.labels,...e==null?void 0:e.labels}},this._options.backdrop=e.backdrop!==void 0?e.backdrop:"static";const p=this._options.viewColumnLayout||1,m=this.grid.getActiveCell(),f=(m==null?void 0:m.cell)??0,g=(m==null?void 0:m.row)??0,_=this.grid.getUID()||"";let b=e.headerTitle||"";typeof this._options.onBeforeOpen=="function"&&this._options.onBeforeOpen(),this.hasRowSelectionEnabled()&&this._options.modalType==="auto-mass"&&this.grid.getSelectedRows&&((this.grid.getSelectedRows()||[]).length>0?(this._options.modalType="mass-selection",e!=null&&e.headerTitleMassSelection&&(b=e==null?void 0:e.headerTitleMassSelection)):(this._options.modalType="mass-update",e!=null&&e.headerTitleMassUpdate&&(b=e==null?void 0:e.headerTitleMassUpdate)));const C=this._options.modalType||"edit";if(this.gridOptions.editable)if(this.gridOptions.enableCellNavigation){if(!this.gridOptions.enableAddRow&&(C==="clone"||C==="create"))return t({type:"error",code:"ENABLE_ADD_ROW_REQUIRED",message:'Composite Editor requires the flag "enableAddRow" to be set to True in your Grid Options when cloning/creating a new item.'}),null;if(!m&&(C==="clone"||C==="edit"))return t({type:"warning",code:"NO_RECORD_FOUND",message:"No records selected for edit or clone operation."}),null;{const E=C==="mass-update"||C==="mass-selection",y=E?{}:this.grid.getDataItem(g);this._originalDataContext=de(!0,{},y),this._columnDefinitions=this.grid.getColumns();const T=this.hasRowSelectionEnabled()?this.grid.getSelectedRows():[],x=((n=this.dataView)==null?void 0:n.getItemCount())??0;this._lastActiveRowNumber=g;const O=this.dataView.getAllSelectedIds(),I=C==="create"?this.dataViewLength:g;if(!this.focusOnFirstColumnCellWithEditor(this._columnDefinitions,y,f,I,E))return null;if(C==="edit"&&!y)return t({type:"warning",code:"ROW_NOT_EDITABLE",message:"Current row is not editable."}),null;if(C==="mass-selection"&&T.length<1)return t({type:"warning",code:"ROW_SELECTION_REQUIRED",message:"You must select some rows before trying to apply new value(s)."}),null;let k=[];E?k=this._columnDefinitions.filter(K=>{var ce;return K.editorClass&&((ce=K.editor)==null?void 0:ce.massUpdate)===!0}):k=this._columnDefinitions.filter(K=>K.editorClass),k.some(K=>{var ce;return((ce=K.editor)==null?void 0:ce.compositeEditorFormOrder)!==void 0})&&k.sort((K,ce)=>{var Mt,M;const ht=((Mt=K==null?void 0:K.editor)==null?void 0:Mt.compositeEditorFormOrder)??1/0,li=((M=ce==null?void 0:ce.editor)==null?void 0:M.compositeEditorFormOrder)??1/0;return Eo(ht,li,ae.asc)});const L=b.replace(/\{\{(.*?)\}\}/g,(K,ce)=>Ee(y,ce)),N=p==="auto"?this.autoCalculateLayoutColumnCount(k.length):p;this._modalElm=v("div",{className:`slick-editor-modal ${_}`});const W=v("div",{className:"slick-editor-modal-content"});if((o=this.gridOptions)!=null&&o.darkMode&&W.classList.add("slick-dark-mode"),!isNaN(p)&&+p>1||p==="auto"&&N>1){const K=N===2?"split-view":"triple-split-view";W.classList.add(K)}const X=v("div",{className:"slick-editor-modal-title"});this.grid.applyHtmlCode(X,L);const Z=v("button",{type:"button",ariaLabel:"Close",textContent:"×",className:"close",dataset:{action:"close"}});this._options.showCloseButtonOutside&&((l=X==null?void 0:X.classList)==null||l.add("outside"),(a=Z==null?void 0:Z.classList)==null||a.add("outside"));const q=v("div",{ariaLabel:"Close",className:"slick-editor-modal-header"});q.appendChild(X),q.appendChild(Z);const ee=v("div",{className:"slick-editor-modal-body"});this._modalBodyTopValidationElm=v("div",{className:"validation-summary",style:{display:"none"}},ee);const Be=v("div",{className:"slick-editor-modal-footer"}),st=v("button",{type:"button",ariaLabel:this.getLabelText("cancelButton","TEXT_CANCEL","Cancel"),className:"btn btn-cancel btn-default btn-sm",textContent:this.getLabelText("cancelButton","TEXT_CANCEL","Cancel"),dataset:{action:"cancel"}});let ge="",xe="";switch(C){case"clone":xe=this.getLabelText("cloneButton","TEXT_CLONE","Clone");break;case"mass-update":const K=this.getLabelText("massUpdateStatus","TEXT_ALL_X_RECORDS_SELECTED","All {{x}} records selected");ge=this.parseText(K,{x}),xe=this.getLabelText("massUpdateButton","TEXT_APPLY_MASS_UPDATE","Mass Update");break;case"mass-selection":const ce=this.getLabelText("massSelectionStatus","TEXT_X_OF_Y_MASS_SELECTED","{{x}} of {{y}} selected");ge=this.parseText(ce,{x:O.length,y:x}),xe=this.getLabelText("massSelectionButton","TEXT_APPLY_TO_SELECTION","Update Selection");break;default:xe=this.getLabelText("saveButton","TEXT_SAVE","Save")}const Ye=v("div",{className:"footer-status-text",textContent:ge});this._modalSaveButtonElm=v("button",{type:"button",className:"btn btn-save btn-primary btn-sm",ariaLabel:xe,textContent:xe,dataset:{action:C==="create"||C==="edit"?"save":C,ariaLabel:xe}});const Me=v("div",{className:"footer-buttons"});(C==="mass-update"||C==="mass-selection")&&Be.appendChild(Ye),Me.appendChild(st),Me.appendChild(this._modalSaveButtonElm),Be.appendChild(Me),W.appendChild(q),W.appendChild(ee),W.appendChild(Be),this._modalElm.appendChild(W);for(const K of k)if(K.editorClass){const ce=v("div",{className:`item-details-container editor-${K.id}`});N===1?ce.classList.add("slick-col-medium-12"):ce.classList.add("slick-col-medium-6",`slick-col-xlarge-${12/N}`);const ht=v("div",{className:`item-details-label editor-${K.id}`});this.grid.applyHtmlCode(ht,this.getColumnLabel(K)||"n/a");const li=v("div",{className:"item-details-editor-container slick-cell",dataset:{editorid:`${K.id}`}}),Mt=v("div",{className:`item-details-validation editor-${K.id}`});if((h=this._options)!=null&&h.showResetButtonOnEachEditor){const M=this.createEditorResetButtonElement(`${K.id}`);this._bindEventService.bind(M,"click",this.handleResetInputValue.bind(this)),ht.appendChild(M)}ce.appendChild(ht),ce.appendChild(li),ce.appendChild(Mt),ee.appendChild(ce)}if((d=this._options)!=null&&d.showFormResetButton){const K=this.createFormResetButtonElement();this._bindEventService.bind(K,"click",this.handleResetFormClicked.bind(this)),ee.appendChild(K)}document.body.appendChild(this._modalElm),document.body.classList.add("slick-modal-open"),this._bindEventService.bind(document.body,"click",this.handleBodyClicked.bind(this)),typeof this._options.onRendered=="function"&&this._options.onRendered(this._modalElm),this._editors={},this._editorContainers=k.map(K=>ee.querySelector(`[data-editorid=${K.id}]`))||[],this._compositeOptions={destroy:this.disposeComponent.bind(this),modalType:C,validationMsgPrefix:"* ",formValues:{},editors:this._editors};const Pe=new Jp(k,this._editorContainers,this._compositeOptions);this.grid.editActiveCell(Pe),this._bindEventService.bind(Z,"click",this.cancelEditing.bind(this)),this._bindEventService.bind(st,"click",this.cancelEditing.bind(this)),this._bindEventService.bind(this._modalSaveButtonElm,"click",this.handleSaveClicked.bind(this)),this._bindEventService.bind(this._modalElm,"keydown",this.handleKeyDown.bind(this)),this._bindEventService.bind(this._modalElm,"focusout",this.validateCurrentEditor.bind(this)),this._bindEventService.bind(this._modalElm,"blur",this.validateCurrentEditor.bind(this)),this._eventHandler.subscribe(this.grid.onCompositeEditorChange,this.handleOnCompositeEditorChange.bind(this)),this._eventHandler.subscribe(this.grid.onAddNewRow,(K,ce)=>{this._originalDataContext=this.insertNewItemInDataView(ce.item)})}}else return t({type:"error",code:"ENABLE_CELL_NAVIGATION_REQUIRED",message:'Composite Editor requires the flag "enableCellNavigation" to be set to True in your Grid Options.'}),null;else return t({type:"error",code:"EDITABLE_GRID_REQUIRED",message:"Your grid must be editable in order to use the Composite Editor Modal."}),null;return this}catch(p){this.dispose();const m=typeof p=="string"?p:(p==null?void 0:p.message)??((c=p==null?void 0:p.body)==null?void 0:c.message)??"",f=typeof p=="string"?p:(p==null?void 0:p.status)??((u=p==null?void 0:p.body)==null?void 0:u.status)??m;return t({type:"error",code:f,message:m}),null}}async cancelEditing(){var t,i,s;let e=!0;this.formValues&&Object.keys(this.formValues).length>0&&typeof this._options.onClose=="function"&&(e=await this._options.onClose()),e&&((t=this.grid.getEditController())==null||t.cancelCurrentEdit(),(((i=this._options)==null?void 0:i.modalType)==="edit"||((s=this._options)==null?void 0:s.modalType)==="clone")&&this.resetCurrentRowDataContext(),this.grid.setActiveRow(this._lastActiveRowNumber),this.dispose())}showValidationSummaryText(e,t=""){var i,s;e&&t!==""?(this._modalBodyTopValidationElm.textContent=t,this._modalBodyTopValidationElm.style.display="block",(s=(i=this._modalBodyTopValidationElm).scrollIntoView)==null||s.call(i),this._modalSaveButtonElm.disabled=!1,this._modalSaveButtonElm.classList.remove("saving")):(this._modalBodyTopValidationElm.style.display="none",this._modalBodyTopValidationElm.textContent=t)}applySaveMassUpdateChanges(e,t,i=!0){const s=i?this.dataView.getItems():de(!0,[],this.dataView.getItems());return Object.keys(e).forEach(n=>{n in e&&s.forEach(o=>{var l;n in e&&(((l=this._options)==null?void 0:l.validateMassUpdateChange)===void 0||this._options.validateMassUpdateChange(n,o,e)!==!1)&&(o[n]=e[n])})}),i&&(this.dataView.setItems(s,this.gridOptions.datasetIdPropertyName),this.grid.invalidate()),s}applySaveMassSelectionChanges(e,t,i=!0){var l;const n=((t==null?void 0:t.dataContextIds)??[]).map(a=>this.dataView.getItemById(a)),o=i?n:de(!0,[],n);return Object.keys(e).forEach(a=>{a in e&&o.forEach(h=>{var d;a in e&&(((d=this._options)==null?void 0:d.validateMassUpdateChange)===void 0||this._options.validateMassUpdateChange(a,h,e)!==!1)&&(h[a]=e[a])})}),i&&((l=this.gridService)==null||l.updateItems(o)),o}autoCalculateLayoutColumnCount(e){return e>=15?3:e>=8?2:1}createEditorResetButtonElement(e){var i,s,n,o;const t=v("button",{type:"button",name:e,ariaLabel:"Reset",title:((s=(i=this._options)==null?void 0:i.labels)==null?void 0:s.resetFormButton)??"Reset Form Input",className:"btn btn-xs btn-editor-reset"});if((n=this._options)!=null&&n.resetEditorButtonCssClass){const l=he((o=this._options)==null?void 0:o.resetEditorButtonCssClass);for(const a of l)t.classList.add(a)}return t}createFormResetButtonElement(){var i;const e=v("div",{className:"reset-container"}),t=v("button",{type:"button",className:"btn btn-sm reset-form"},e);return v("span",{className:((i=this._options)==null?void 0:i.resetFormButtonIconCssClass)??""},t),t.appendChild(document.createTextNode(" Reset Form")),e}executeOnError(e){var i;(((i=this._options)==null?void 0:i.onError)??Fa)(e)}async executeOnSave(e,t,i,s){var n,o,l,a;try{if(this.showValidationSummaryText(!1,""),this.validateCompositeEditors().valid){if(this._modalSaveButtonElm.classList.add("saving"),this._modalSaveButtonElm.disabled=!0,typeof((n=this._options)==null?void 0:n.onSave)=="function"){const d=this._options.modalType==="mass-update"||this._options.modalType==="mass-selection";let c;d&&((o=this._options)!=null&&o.shouldPreviewMassChangeDataset)&&(c=e(this.formValues,this.getCurrentRowSelections(),!1));const u=d?c:s;await((l=this._options)==null?void 0:l.onSave(this.formValues,this.getCurrentRowSelections(),u))&&(e(this.formValues,this.getCurrentRowSelections()),t())}else e(this.formValues,this.getCurrentRowSelections()),t();typeof i=="function"&&i(),this.dispose()}}catch(h){const d=typeof h=="string"?h:(h==null?void 0:h.message)??((a=h==null?void 0:h.body)==null?void 0:a.message)??"";this.showValidationSummaryText(!0,d)}}focusOnFirstColumnCellWithEditor(e,t,i,s,n){const o=n&&!this.gridOptions.enableAddRow&&s>=this.dataViewLength?this.dataViewLength-1:s;let l=i;const a=e[i].editorClass;let h=this.grid.getCellNode(o,i);if(!a||!h||!this.getActiveCellEditor(o,i)){if(l=this.findNextAvailableEditorColumnIndex(e,t,s,n),l===-1)return this.executeOnError({type:"error",code:"NO_EDITOR_FOUND",message:"We could not find any Editor in your Column Definition"}),!1;this.grid.setActiveCell(o,l,!1),n&&this.grid.setActiveRow(this.dataViewLength,l,!0)}return h=this.grid.getCellNode(o,l),!!h}findNextAvailableEditorColumnIndex(e,t,i,s){var o;let n=-1;for(let l=0;l<e.length;l++){const a=e[l];if(a.editorClass&&(!s||s&&((o=a.editor)!=null&&o.massUpdate))){const h=this.grid.onBeforeEditCell.notify({row:i,cell:l,item:t,column:a,grid:this.grid,target:"composite",compositeEditorOptions:this._compositeOptions}).getReturnValue();if(this.grid.setActiveCell(i,l,!1),h!==!1){n=l;break}}}return n}getColumnByObjectOrId(e){let t;return typeof e=="object"?t=e:typeof e=="string"&&(t=this._columnDefinitions.find(i=>i.id===e)),t}getActiveCellEditor(e,t){return this.grid.setActiveCell(e,t,!1),this.grid.getCellEditor()}getColumnLabel(e){var o;const t=this.gridOptions.columnGroupSeparator||" - ";let i=e.nameCompositeEditor||e.name||"",s=e.columnGroup||"";if(this.gridOptions.enableTranslate&&this.translaterService){const l=e.nameCompositeEditorKey||e.nameKey;l&&(i=this.translaterService.translate(l)),e.columnGroupKey&&((o=this.translaterService)!=null&&o.translate)&&(s=this.translaterService.translate(e.columnGroupKey))}const n=s?`${s}${t}${i}`:i;return gt(n,"innerHTML")}getLabelText(e,t,i){var n,o,l,a,h;const s={...(n=this.gridOptions.compositeEditorOptions)==null?void 0:n.labels,...(o=this._options)==null?void 0:o.labels};if((l=this.gridOptions)!=null&&l.enableTranslate&&((a=this.translaterService)!=null&&a.translate)&&s.hasOwnProperty(`${e}Key`)){const d=s[`${e}Key`];return this.translaterService.translate(d||"")}return(s==null?void 0:s[e])??((h=this._locales)==null?void 0:h[t])??i}getCurrentRowSelections(){const e=this.dataView.getAllSelectedIds();return{gridRowIndexes:this.dataView.mapIdsToRows(e),dataContextIds:e}}handleBodyClicked(e){var t,i,s;(i=(t=e.target)==null?void 0:t.classList)!=null&&i.contains("slick-editor-modal")&&((s=this._options)==null?void 0:s.backdrop)!=="static"&&this.dispose()}handleKeyDown(e){e.code==="Escape"?(this.cancelEditing(),e.stopPropagation(),e.preventDefault()):e.code==="Tab"&&this.validateCurrentEditor()}handleResetInputValue(e){var s,n;const t=e.target.name,i=(s=this._editors)==null?void 0:s[t];typeof(i==null?void 0:i.reset)=="function"&&i.reset(),(n=this._formValues)==null||delete n[t]}async handleMassSaving(e,t){if(!this.formValues||Object.keys(this.formValues).length===0)this.executeOnError({type:"warning",code:"NO_CHANGES_DETECTED",message:"Sorry we could not detect any changes."});else{const i=e==="mass-update"?"applySaveMassUpdateChanges":"applySaveMassSelectionChanges";this.executeOnSave(this[i].bind(this),t.bind(this))}}handleOnCompositeEditorChange(e,t){var l,a,h,d;const i=((l=t.column)==null?void 0:l.id)??"";this._formValues={...this._formValues,...t.formValues};const s=(a=this._editors)==null?void 0:a[i],n=((h=s==null?void 0:s.isValueTouched)==null?void 0:h.call(s))??((d=s==null?void 0:s.isValueChanged)==null?void 0:d.call(s))??!1;this._itemDataContext=(s==null?void 0:s.dataContext)??{};const o=this._modalElm.querySelector(`[data-editorid=${i}]`);o!=null&&o.classList&&(n?o.classList.add("modified"):o.classList.remove("modified")),this.validateCompositeEditors()}hasRowSelectionEnabled(){const e=this.grid.getSelectionModel();return!!((this.gridOptions.enableRowSelection||this.gridOptions.enableCheckboxSelector)&&e)}handleResetFormClicked(){for(const e of Object.keys(this._editors)){const t=this._editors[e];t!=null&&t.reset&&t.reset()}this._formValues=Co(this._formValues)}async handleSaveClicked(){var t,i,s,n;const e=(t=this._options)==null?void 0:t.modalType;switch(e){case"mass-update":this.handleMassSaving(e,()=>{var h;(h=this.grid.getEditController())==null||h.cancelCurrentEdit(),this.grid.setActiveCell(0,0,!1),this._options.shouldClearRowSelectionAfterMassAction&&this.grid.setSelectedRows([])});break;case"mass-selection":this.handleMassSaving(e,()=>{var h;(h=this.grid.getEditController())==null||h.cancelCurrentEdit(),this.grid.setActiveRow(this._lastActiveRowNumber),this._options.shouldClearRowSelectionAfterMassAction&&this.grid.setSelectedRows([])});break;case"clone":const o={...this._originalDataContext,...this.formValues},l=()=>{var h;(h=this.grid.getEditController())==null||h.cancelCurrentEdit(),this.grid.setActiveCell(0,0,!1)};this.executeOnSave(this.insertNewItemInDataView.bind(this,o),l,this.resetCurrentRowDataContext.bind(this),o);break;case"create":case"edit":default:let a=(i=this.grid.getEditController())==null?void 0:i.commitCurrentEdit();if(a&&typeof((s=this._options)==null?void 0:s.onSave)=="function"){const h=e==="create"?this._originalDataContext:this.grid.getDataItem(this._lastActiveRowNumber);a=await((n=this._options)==null?void 0:n.onSave(this.formValues,this.getCurrentRowSelections(),h))}a&&this.dispose();break}}insertNewItemInDataView(e){var s,n;const t=((s=this.dataView)==null?void 0:s.getItemCount())||0,i=this._options.insertNewId??t+1;return e[this.gridOptions.datasetIdPropertyName||"id"]=i,this.dataView.getItemById(i)?this.executeOnError({type:"error",code:"ITEM_ALREADY_EXIST",message:`The item object which you are trying to add already exist with the same Id:: ${i}`}):(n=this.gridService)==null||n.addItem(e,this._options.insertOptions),e}parseText(e,t){return e.replace(/\{\{(.*?)\}\}/g,(i,s)=>t[s]!==void 0?t[s]:i)}resetCurrentRowDataContext(){const e=this.gridOptions.datasetIdPropertyName||"id";this.grid.getData().updateItem(this._originalDataContext[e],this._originalDataContext)}validateCompositeEditors(e){let t={valid:!0,msg:""};const i=this.grid.getCellEditor();return i&&(t=i.validate(e)),t}validateCurrentEditor(){const e=this.grid.getCellEditor();e!=null&&e.validate&&e.validate()}}class Dr{constructor(){this._isPreviouslyShown=!1,this._warningLeftElement=null,this._warningRightElement=null}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}init(e,t){this._grid=e,this._translaterService=t.get("TranslaterService")}dispose(){var e,t;(e=this._warningLeftElement)==null||e.remove(),(t=this._warningRightElement)==null||t.remove(),this._warningLeftElement=null,this._warningRightElement=null}showEmptyDataMessage(e=!0,t){var _,b,C,E;if(!this._grid||!this.gridOptions||this._isPreviouslyShown===e)return!1;this._isPreviouslyShown=e;const i=this._grid.getUID(),n={message:"No data to display.",...this.gridOptions.emptyDataWarning,...t},o=(n==null?void 0:n.className)??"slick-empty-data-warning";this._warningLeftElement=document.querySelector(`.${i} .${o}`);const l=document.querySelector(`.${i} .grid-canvas.grid-canvas-left`),a=document.querySelector(`.${i} .grid-canvas.grid-canvas-right`),h=n.leftViewportMarginLeft??0,d=n.rightViewportMarginLeft??0,c=n.frozenLeftViewportMarginLeft??0,u=n.frozenRightViewportMarginLeft??0,p=((_=this.gridOptions)==null?void 0:_.frozenColumn)!==void 0&&this.gridOptions.frozenColumn>=0,m=typeof h=="string"?h:`${h}px`,f=typeof d=="string"?d:`${d}px`;if(this.gridOptions.autoHeight){const y=document.querySelector(`.${i} .slick-pane.slick-pane-top.slick-pane-left`);if(y&&y.style&&l&&l.style){const T=parseInt(y.style.height,10)||0,x=((b=this.gridOptions)==null?void 0:b.rowHeight)??0,O=this.gridOptions.enableFiltering?((C=this.gridOptions)==null?void 0:C.headerRowHeight)??0:0,I=this.gridOptions.createPreHeaderPanel?((E=this.gridOptions)==null?void 0:E.preHeaderPanelHeight)??0:0;if(e){let A=T!==null&&T<100?T:100;A+=O+I,y.style.minHeight=`${A}px`,l.style.minHeight=`${x}px`}}}let g=n.message;if(this.gridOptions.enableTranslate&&this._translaterService&&(n!=null&&n.messageKey)&&(g=this._translaterService.translate(n.messageKey)),!this._warningLeftElement&&l&&a&&(this._warningLeftElement=document.createElement("div"),this._warningLeftElement.classList.add(...he(o)),this._warningLeftElement.classList.add("left"),this._grid.applyHtmlCode(this._warningLeftElement,g),this._warningRightElement=this._warningLeftElement.cloneNode(!0),this._warningRightElement.classList.add("right"),a.appendChild(this._warningRightElement),l.appendChild(this._warningLeftElement)),this._warningLeftElement){let y=e?"flex":"none";p&&e&&(y=n.hideFrozenLeftWarning?"none":"flex"),this._warningLeftElement.style.display=y;const T=typeof c=="string"?c:`${c}px`;this._warningLeftElement.style.marginLeft=p?T:m}if(this._warningRightElement){let y=e?"flex":"none";p&&e&&(y=n.hideFrozenRightWarning?"none":"flex"),this._warningRightElement.style.display=y;const T=typeof u=="string"?u:`${u}px`;this._warningRightElement.style.marginLeft=p?T:f}return e}}class Da{constructor(e,t,i,s){var n,o,l;if(this.paginationService=e,this.pubSubService=t,this.sharedService=i,this.translaterService=s,this._enableTranslate=!1,this._subscriptions=[],this.firstButtonClasses="",this.lastButtonClasses="",this.prevButtonClasses="",this.nextButtonClasses="",this.textItemsPerPage="items per page",this.textItems="items",this.textOf="of",this.textPage="Page",this._bindingHelper=new Ho,this._bindingEventService=new Ae,this._bindingHelper.querySelectorPrefix=`.${this.gridUid} `,this.currentPagination=this.paginationService.getFullPagination(),this._enableTranslate=((n=this.gridOptions)==null?void 0:n.enableTranslate)??!1,this._enableTranslate&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');if(this.translatePaginationTexts(),this._enableTranslate&&((o=this.pubSubService)!=null&&o.subscribe)){const a=((l=this.translaterService)==null?void 0:l.eventName)??"onLanguageChange";this._subscriptions.push(this.pubSubService.subscribe(a,()=>this.translatePaginationTexts()))}this._subscriptions.push(this.pubSubService.subscribe("onPaginationRefreshed",a=>{var h;for(const d of Object.keys(a))this.currentPagination[d]=a[d];this.updatePageButtonsUsability(),(h=this._spanInfoFromToElm)!=null&&h.style&&(this._spanInfoFromToElm.style.display=this.currentPagination.totalItems===0?"none":"")}),this.pubSubService.subscribe("onPaginationSetCursorBased",()=>{this.dispose(),this.renderPagination(this._gridParentContainerElm)}))}get availablePageSizes(){return this.paginationService.availablePageSizes||[]}get dataFrom(){return this.paginationService.dataFrom}get dataTo(){return this.paginationService.dataTo}get itemsPerPage(){return this.paginationService.itemsPerPage}set itemsPerPage(e){this.paginationService.changeItemPerPage(e)}get pageCount(){return this.paginationService.pageCount}get pageNumber(){return this.paginationService.pageNumber}get grid(){return this.sharedService.slickGrid}get gridOptions(){return this.sharedService.gridOptions}get gridUid(){var e;return((e=this.grid)==null?void 0:e.getUID())??""}get locales(){var e;return((e=this.gridOptions)==null?void 0:e.locales)??R.locales}get totalItems(){return this.paginationService.totalItems}get isLeftPaginationDisabled(){return this.pageNumber===1||this.totalItems===0}get isRightPaginationDisabled(){return this.pageNumber===this.pageCount||this.totalItems===0}dispose(){this.pubSubService.unsubscribeAll(this._subscriptions),this._bindingEventService.unbindAll(),this._bindingHelper.dispose(),this._paginationElement.remove()}renderPagination(e){this._gridParentContainerElm=e;const t=this.createPaginationContainer(),i=v("div",{className:"slick-pagination-nav"}),s=v("nav",{ariaLabel:"Page navigation"}),n=v("ul",{className:"pagination"});this._seekFirstElm=v("li",{className:"page-item seek-first"},n),this._seekFirstElm.appendChild(v("a",{className:"page-link icon-seek-first",ariaLabel:"First Page",role:"button"})),this._seekPrevElm=v("li",{className:"page-item seek-prev"},n),this._seekPrevElm.appendChild(v("a",{className:"page-link icon-seek-prev",ariaLabel:"Previous Page",role:"button"})),s.appendChild(n);const o=this.createPageNumberSection(),l=v("nav",{ariaLabel:"Page navigation"}),a=v("ul",{className:"pagination"});this._seekNextElm=v("li",{className:"page-item seek-next"},a),this._seekNextElm.appendChild(v("a",{className:"page-link icon-seek-next",ariaLabel:"Next Page",role:"button"})),this._seekEndElm=v("li",{className:"page-item seek-end"},a),this._seekEndElm.appendChild(v("a",{className:"page-link icon-seek-end",ariaLabel:"Last Page",role:"button"})),l.appendChild(a),t.appendChild(i),i.appendChild(s),i.appendChild(o),i.appendChild(l);const h=this.createPaginationSettingsSection();t.appendChild(i),t.appendChild(h),this._paginationElement.appendChild(t),e!=null&&e.appendChild&&this._paginationElement&&e.appendChild(this._paginationElement),this.renderPageSizes(),this.addBindings(),this.addEventListeners(),this.updatePageButtonsUsability()}renderPageSizes(){if(this._itemPerPageElm&&Array.isArray(this.availablePageSizes))for(const e of this.availablePageSizes)this._itemPerPageElm.appendChild(v("option",{value:`${e}`,text:`${e}`}))}addBindings(){this._bindingHelper.addElementBinding(this,"firstButtonClasses","li.page-item.seek-first","className"),this._bindingHelper.addElementBinding(this,"prevButtonClasses","li.page-item.seek-prev","className"),this._bindingHelper.addElementBinding(this,"lastButtonClasses","li.page-item.seek-end","className"),this._bindingHelper.addElementBinding(this,"nextButtonClasses","li.page-item.seek-next","className"),this._bindingHelper.addElementBinding(this.currentPagination,"dataFrom","span.item-from","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"dataTo","span.item-to","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"totalItems","span.total-items","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"pageCount","span.page-count","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"pageSize","select.items-per-page","value"),this.paginationService.isCursorBased?this._bindingHelper.addElementBinding(this.currentPagination,"pageNumber","span.page-number","textContent"):this._bindingHelper.addElementBinding(this.currentPagination,"pageNumber","input.page-number","value","change",this.changeToCurrentPage.bind(this)),this._bindingHelper.addElementBinding(this,"textItems","span.text-items","textContent"),this._bindingHelper.addElementBinding(this,"textItemsPerPage","span.text-item-per-page","textContent"),this._bindingHelper.addElementBinding(this,"textOf","span.text-of","textContent"),this._bindingHelper.addElementBinding(this,"textPage","span.text-page","textContent")}addEventListeners(){this._bindingEventService.bind(this._seekFirstElm,"click",this.changeToFirstPage.bind(this)),this._bindingEventService.bind(this._seekEndElm,"click",this.changeToLastPage.bind(this)),this._bindingEventService.bind(this._seekNextElm,"click",this.changeToNextPage.bind(this)),this._bindingEventService.bind(this._seekPrevElm,"click",this.changeToPreviousPage.bind(this)),this._bindingEventService.bind(this._itemPerPageElm,"change",this.updateItemsPerPage.bind(this))}changeToFirstPage(e){this.isLeftPaginationDisabled||this.paginationService.goToFirstPage(e)}changeToLastPage(e){this.isRightPaginationDisabled||this.paginationService.goToLastPage(e)}changeToNextPage(e){this.isRightPaginationDisabled||this.paginationService.goToNextPage(e)}changeToPreviousPage(e){this.isLeftPaginationDisabled||this.paginationService.goToPreviousPage(e)}changeToCurrentPage(e){this.paginationService.goToPageNumber(+e)}updateItemsPerPage(e){var t;this.itemsPerPage=+(((t=e==null?void 0:e.target)==null?void 0:t.value)??0)}translatePaginationTexts(){var e;if(this._enableTranslate&&((e=this.translaterService)!=null&&e.translate)){const t=ot(this.gridOptions);this.textItemsPerPage=this.translaterService.translate(`${t}ITEMS_PER_PAGE`),this.textItems=this.translaterService.translate(`${t}ITEMS`),this.textOf=this.translaterService.translate(`${t}OF`),this.textPage=this.translaterService.translate(`${t}PAGE`)}else this.locales&&(this.textItemsPerPage=this.locales.TEXT_ITEMS_PER_PAGE||"TEXT_ITEMS_PER_PAGE",this.textItems=this.locales.TEXT_ITEMS||"TEXT_ITEMS",this.textOf=this.locales.TEXT_OF||"TEXT_OF",this.textPage=this.locales.TEXT_PAGE||"TEXT_PAGE")}createPaginationContainer(){const e=v("div",{id:"pager",className:`slick-pagination-container ${this.gridUid} pager`,style:{width:"100%"}}),t=v("div",{className:"slick-pagination"});return e.appendChild(t),this._paginationElement=e,t}createPageNumberSection(){const e=v("div",{className:"slick-page-number"});return v("span",{className:"text-page",textContent:"Page"},e),e.appendChild(document.createTextNode(" ")),this.paginationService.isCursorBased?v("span",{className:"page-number",ariaLabel:"Page Number",dataset:{test:"page-number-label"},textContent:"1"},e):v("input",{type:"text",className:"form-control page-number",ariaLabel:"Page Number",value:"1",size:1,dataset:{test:"page-number-input"}},e),e.appendChild(document.createTextNode(" ")),v("span",{className:"text-of",textContent:"of"},e),e.appendChild(document.createTextNode(" ")),v("span",{className:"page-count",dataset:{test:"page-count"}},e),e}createPaginationSettingsSection(){const e=v("span",{className:"slick-pagination-settings"});this._itemPerPageElm=v("select",{id:"items-per-page-label",ariaLabel:"Items per Page",className:"items-per-page"},e),e.appendChild(document.createTextNode(" ")),v("span",{className:"text-item-per-page",textContent:"items per page"},e),e.appendChild(document.createTextNode(", "));const t=v("span",{className:"slick-pagination-count"},e);this._spanInfoFromToElm=v("span",{className:"page-info-from-to"},t),v("span",{className:"item-from",ariaLabel:"Page Item From",dataset:{test:"item-from"}},this._spanInfoFromToElm),this._spanInfoFromToElm.appendChild(document.createTextNode("-")),v("span",{className:"item-to",ariaLabel:"Page Item To",dataset:{test:"item-to"}},this._spanInfoFromToElm),this._spanInfoFromToElm.appendChild(document.createTextNode(" ")),v("span",{className:"text-of",textContent:"of"},this._spanInfoFromToElm),this._spanInfoFromToElm.appendChild(document.createTextNode(" "));const i=v("span",{className:"page-info-total-items"},t);return v("span",{className:"total-items",ariaLabel:"Total Items",dataset:{test:"total-items"}},i),i.appendChild(document.createTextNode(" ")),v("span",{className:"text-items",textContent:"items"},i),i.appendChild(document.createTextNode(" ")),e}updatePageButtonsUsability(){this.firstButtonClasses=this.isLeftPaginationDisabled?"page-item seek-first disabled":"page-item seek-first",this.prevButtonClasses=this.isLeftPaginationDisabled?"page-item seek-prev disabled":"page-item seek-prev",this.lastButtonClasses=this.isRightPaginationDisabled?"page-item seek-end disabled":"page-item seek-end",this.nextButtonClasses=this.isRightPaginationDisabled?"page-item seek-next disabled":"page-item seek-next"}}var Ma={},em=function(r,e,t,i,s){var n=new Worker(Ma[e]||(Ma[e]=URL.createObjectURL(new Blob([r+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return n.onmessage=function(o){var l=o.data,a=l.$e$;if(a){var h=new Error(a[0]);h.code=a[1],h.stack=a[2],s(h,null)}else s(null,l)},n.postMessage(t,i),n},Le=Uint8Array,qe=Uint16Array,Js=Int32Array,en=new Le([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),tn=new Le([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Mr=new Le([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Na=function(r,e){for(var t=new qe(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var s=new Js(t[30]),i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return{b:t,r:s}},La=Na(en,2),tm=La.b,sn=La.r;tm[28]=258,sn[258]=28;for(var im=Na(tn,0),Nr=im.r,nn=new qe(32768),Ce=0;Ce<32768;++Ce){var jt=(Ce&43690)>>1|(Ce&21845)<<1;jt=(jt&52428)>>2|(jt&13107)<<2,jt=(jt&61680)>>4|(jt&3855)<<4,nn[Ce]=((jt&65280)>>8|(jt&255)<<8)>>1}for(var Ti=function(r,e,t){for(var i=r.length,s=0,n=new qe(e);s<i;++s)r[s]&&++n[r[s]-1];var o=new qe(e);for(s=1;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;var l;if(t){l=new qe(1<<e);var a=15-e;for(s=0;s<i;++s)if(r[s])for(var h=s<<4|r[s],d=e-r[s],c=o[r[s]-1]++<<d,u=c|(1<<d)-1;c<=u;++c)l[nn[c]>>a]=h}else for(l=new qe(i),s=0;s<i;++s)r[s]&&(l[s]=nn[o[r[s]-1]++]>>15-r[s]);return l},Yt=new Le(288),Ce=0;Ce<144;++Ce)Yt[Ce]=8;for(var Ce=144;Ce<256;++Ce)Yt[Ce]=9;for(var Ce=256;Ce<280;++Ce)Yt[Ce]=7;for(var Ce=280;Ce<288;++Ce)Yt[Ce]=8;for(var rs=new Le(32),Ce=0;Ce<32;++Ce)rs[Ce]=5;var Ha=Ti(Yt,9,0),Va=Ti(rs,5,0),Lr=function(r){return(r+7)/8|0},Hr=function(r,e,t){return(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length),new Le(r.subarray(e,t))},sm=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Oi=function(r,e,t){var i=new Error(e||sm[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,Oi),!t)throw i;return i},Et=function(r,e,t){t<<=e&7;var i=e/8|0;r[i]|=t,r[i+1]|=t>>8},xi=function(r,e,t){t<<=e&7;var i=e/8|0;r[i]|=t,r[i+1]|=t>>8,r[i+2]|=t>>16},rn=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return{t:$r,l:0};if(s==1){var o=new Le(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(y,T){return y.f-T.f}),t.push({s:-1,f:25001});var l=t[0],a=t[1],h=0,d=1,c=2;for(t[0]={s:-1,f:l.f+a.f,l,r:a};d!=s-1;)l=t[t[h].f<t[c].f?h++:c++],a=t[h!=d&&t[h].f<t[c].f?h++:c++],t[d++]={s:-1,f:l.f+a.f,l,r:a};for(var u=n[0].s,i=1;i<s;++i)n[i].s>u&&(u=n[i].s);var p=new qe(u+1),m=on(t[d-1],p,0);if(m>e){var i=0,f=0,g=m-e,_=1<<g;for(n.sort(function(T,x){return p[x.s]-p[T.s]||T.f-x.f});i<s;++i){var b=n[i].s;if(p[b]>e)f+=_-(1<<m-p[b]),p[b]=e;else break}for(f>>=g;f>0;){var C=n[i].s;p[C]<e?f-=1<<e-p[C]++-1:++i}for(;i>=0&&f;--i){var E=n[i].s;p[E]==e&&(--p[E],++f)}m=e}return{t:new Le(p),l:m}},on=function(r,e,t){return r.s==-1?Math.max(on(r.l,e,t+1),on(r.r,e,t+1)):e[r.s]=t},Vr=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new qe(++e),i=0,s=r[0],n=1,o=function(a){t[i++]=a},l=1;l<=e;++l)if(r[l]==s&&l!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=r[l]}return{c:t.subarray(0,i),n:e}},Ii=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},Br=function(r,e,t){var i=t.length,s=Lr(e+2);r[s]=i&255,r[s+1]=i>>8,r[s+2]=r[s]^255,r[s+3]=r[s+1]^255;for(var n=0;n<i;++n)r[s+n+4]=t[n];return(s+4+i)*8},zr=function(r,e,t,i,s,n,o,l,a,h,d){Et(e,d++,t),++s[256];for(var c=rn(s,15),u=c.t,p=c.l,m=rn(n,15),f=m.t,g=m.l,_=Vr(u),b=_.c,C=_.n,E=Vr(f),y=E.c,T=E.n,x=new qe(19),O=0;O<b.length;++O)++x[b[O]&31];for(var O=0;O<y.length;++O)++x[y[O]&31];for(var I=rn(x,7),A=I.t,k=I.l,L=19;L>4&&!A[Mr[L-1]];--L);var N=h+5<<3,W=Ii(s,Yt)+Ii(n,rs)+o,X=Ii(s,u)+Ii(n,f)+o+14+3*L+Ii(x,A)+2*x[16]+3*x[17]+7*x[18];if(a>=0&&N<=W&&N<=X)return Br(e,d,r.subarray(a,a+h));var Z,q,ee,Be;if(Et(e,d,1+(X<W)),d+=2,X<W){Z=Ti(u,p,0),q=u,ee=Ti(f,g,0),Be=f;var st=Ti(A,k,0);Et(e,d,C-257),Et(e,d+5,T-1),Et(e,d+10,L-4),d+=14;for(var O=0;O<L;++O)Et(e,d+3*O,A[Mr[O]]);d+=3*L;for(var ge=[b,y],xe=0;xe<2;++xe)for(var Ye=ge[xe],O=0;O<Ye.length;++O){var Me=Ye[O]&31;Et(e,d,st[Me]),d+=A[Me],Me>15&&(Et(e,d,Ye[O]>>5&127),d+=Ye[O]>>12)}}else Z=Ha,q=Yt,ee=Va,Be=rs;for(var O=0;O<l;++O){var Pe=i[O];if(Pe>255){var Me=Pe>>18&31;xi(e,d,Z[Me+257]),d+=q[Me+257],Me>7&&(Et(e,d,Pe>>23&31),d+=en[Me]);var K=Pe&31;xi(e,d,ee[K]),d+=Be[K],K>3&&(xi(e,d,Pe>>5&8191),d+=tn[K])}else xi(e,d,Z[Pe]),d+=q[Pe]}return xi(e,d,Z[256]),d+q[256]},Ba=new Js([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$r=new Le(0),za=function(r,e,t,i,s,n){var o=n.z||r.length,l=new Le(i+o+5*(1+Math.ceil(o/7e3))+s),a=l.subarray(i,l.length-s),h=n.l,d=(n.r||0)&7;if(e){d&&(a[0]=n.r>>3);for(var c=Ba[e-1],u=c>>13,p=c&8191,m=(1<<t)-1,f=n.p||new qe(32768),g=n.h||new qe(m+1),_=Math.ceil(t/3),b=2*_,C=function(Ue){return(r[Ue]^r[Ue+1]<<_^r[Ue+2]<<b)&m},E=new Js(25e3),y=new qe(288),T=new qe(32),x=0,O=0,I=n.i||0,A=0,k=n.w||0,L=0;I+2<o;++I){var N=C(I),W=I&32767,X=g[N];if(f[W]=X,g[N]=W,k<=I){var Z=o-I;if((x>7e3||A>24576)&&(Z>423||!h)){d=zr(r,a,0,E,y,T,O,A,L,I-L,d),A=x=O=0,L=I;for(var q=0;q<286;++q)y[q]=0;for(var q=0;q<30;++q)T[q]=0}var ee=2,Be=0,st=p,ge=W-X&32767;if(Z>2&&N==C(I-ge))for(var xe=Math.min(u,Z)-1,Ye=Math.min(32767,I),Me=Math.min(258,Z);ge<=Ye&&--st&&W!=X;){if(r[I+ee]==r[I+ee-ge]){for(var Pe=0;Pe<Me&&r[I+Pe]==r[I+Pe-ge];++Pe);if(Pe>ee){if(ee=Pe,Be=ge,Pe>xe)break;for(var K=Math.min(ge,Pe-2),ce=0,q=0;q<K;++q){var ht=I-ge+q&32767,li=f[ht],Mt=ht-li&32767;Mt>ce&&(ce=Mt,X=ht)}}}W=X,X=f[W],ge+=W-X&32767}if(Be){E[A++]=268435456|sn[ee]<<18|Nr[Be];var M=sn[ee]&31,te=Nr[Be]&31;O+=en[M]+tn[te],++y[257+M],++T[te],k=I+ee,++x}else E[A++]=r[I],++y[r[I]]}}for(I=Math.max(I,k);I<o;++I)E[A++]=r[I],++y[r[I]];d=zr(r,a,h,E,y,T,O,A,L,I-L,d),h||(n.r=d&7|a[d/8|0]<<3,d-=7,n.h=g,n.p=f,n.i=I,n.w=k)}else{for(var I=n.w||0;I<o+h;I+=65535){var Ne=I+65535;Ne>=o&&(a[d/8|0]=h,Ne=o),d=Br(a,d+1,r.subarray(I,Ne))}n.i=o}return Hr(l,0,i+Lr(d)+s)},nm=function(){for(var r=new Int32Array(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(t&1&&-306674912)^t>>>1;r[e]=t}return r}(),rm=function(){var r=-1;return{p:function(e){for(var t=r,i=0;i<e.length;++i)t=nm[t&255^e[i]]^t>>>8;r=t},d:function(){return~r}}},$a=function(r,e,t,i,s){if(!s&&(s={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new Le(n.length+r.length);o.set(n),o.set(r,n.length),r=o,s.w=n.length}return za(r,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,t,i,s)},Wr=function(r,e){var t={};for(var i in r)t[i]=r[i];for(var i in e)t[i]=e[i];return t},Wa=function(r,e,t){for(var i=r(),s=r.toString(),n=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<i.length;++o){var l=i[o],a=n[o];if(typeof l=="function"){e+=";"+a+"=";var h=l.toString();if(l.prototype)if(h.indexOf("[native code]")!=-1){var d=h.indexOf(" ",8)+1;e+=h.slice(d,h.indexOf("(",d))}else{e+=h;for(var c in l.prototype)e+=";"+a+".prototype."+c+"="+l.prototype[c].toString()}else e+=h}else t[a]=l}return e},ln=[],om=function(r){var e=[];for(var t in r)r[t].buffer&&e.push((r[t]=new r[t].constructor(r[t])).buffer);return e},lm=function(r,e,t,i){if(!ln[t]){for(var s="",n={},o=r.length-1,l=0;l<o;++l)s=Wa(r[l],s,n);ln[t]={c:Wa(r[o],s,n),e:n}}var a=Wr({},ln[t].e);return em(ln[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",t,a,om(a),i)},am=function(){return[Le,qe,Js,en,tn,Mr,sn,Nr,Ha,Yt,Va,rs,nn,Ba,$r,Ti,Et,xi,rn,on,Vr,Ii,Br,zr,Lr,Hr,za,$a,Gr,Ga]},Ga=function(r){return postMessage(r,[r.buffer])},hm=function(r,e,t,i,s,n){var o=lm(t,i,s,function(l,a){o.terminate(),n(l,a)});return o.postMessage([r,e],e.consume?[r.buffer]:[]),function(){o.terminate()}},Ve=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function dm(r,e,t){return t||(t=e,e={}),typeof t!="function"&&Oi(7),hm(r,e,[am],function(i){return Ga(Gr(i.data[0],i.data[1]))},0,t)}function Gr(r,e){return $a(r,e||{},0,0)}var Ua=function(r,e,t,i){for(var s in r){var n=r[s],o=e+s,l=i;Array.isArray(n)&&(l=Wr(i,n[1]),n=n[0]),n instanceof Le?t[o]=[n,l]:(t[o+="/"]=[new Le(0),l],Ua(n,o,t,i))}},ja=typeof TextEncoder<"u"&&new TextEncoder,cm=typeof TextDecoder<"u"&&new TextDecoder,um=0;try{cm.decode($r,{stream:!0}),um=1}catch{}function Ur(r,e){if(e){for(var t=new Le(r.length),i=0;i<r.length;++i)t[i]=r.charCodeAt(i);return t}if(ja)return ja.encode(r);for(var s=r.length,n=new Le(r.length+(r.length>>1)),o=0,l=function(d){n[o++]=d},i=0;i<s;++i){if(o+5>n.length){var a=new Le(o+8+(s-i<<1));a.set(n),n=a}var h=r.charCodeAt(i);h<128||e?l(h):h<2048?(l(192|h>>6),l(128|h&63)):h>55295&&h<57344?(h=65536+(h&1047552)|r.charCodeAt(++i)&1023,l(240|h>>18),l(128|h>>12&63),l(128|h>>6&63),l(128|h&63)):(l(224|h>>12),l(128|h>>6&63),l(128|h&63))}return Hr(n,0,o)}var jr=function(r){var e=0;if(r)for(var t in r){var i=r[t].length;i>65535&&Oi(9),e+=i+4}return e},Ya=function(r,e,t,i,s,n,o,l){var a=i.length,h=t.extra,d=l&&l.length,c=jr(h);Ve(r,e,o!=null?33639248:67324752),e+=4,o!=null&&(r[e++]=20,r[e++]=t.os),r[e]=20,e+=2,r[e++]=t.flag<<1|(n<0&&8),r[e++]=s&&8,r[e++]=t.compression&255,r[e++]=t.compression>>8;var u=new Date(t.mtime==null?Date.now():t.mtime),p=u.getFullYear()-1980;if((p<0||p>119)&&Oi(10),Ve(r,e,p<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),e+=4,n!=-1&&(Ve(r,e,t.crc),Ve(r,e+4,n<0?-n-2:n),Ve(r,e+8,t.size)),Ve(r,e+12,a),Ve(r,e+14,c),e+=16,o!=null&&(Ve(r,e,d),Ve(r,e+6,t.attrs),Ve(r,e+10,o),e+=14),r.set(i,e),e+=a,c)for(var m in h){var f=h[m],g=f.length;Ve(r,e,+m),Ve(r,e+2,g),r.set(f,e+4),e+=4+g}return d&&(r.set(l,e),e+=d),e},pm=function(r,e,t,i,s){Ve(r,e,101010256),Ve(r,e+8,t),Ve(r,e+10,t),Ve(r,e+12,i),Ve(r,e+16,s)};function mm(r,e,t){t||(t=e,e={}),typeof t!="function"&&Oi(7);var i={};Ua(r,"",i,e);var s=Object.keys(i),n=s.length,o=0,l=0,a=n,h=new Array(n),d=[],c=function(){for(var g=0;g<d.length;++g)d[g]()},u=function(g,_){Xa(function(){t(g,_)})};Xa(function(){u=t});var p=function(){var g=new Le(l+22),_=o,b=l-o;l=0;for(var C=0;C<a;++C){var E=h[C];try{var y=E.c.length;Ya(g,l,E,E.f,E.u,y);var T=30+E.f.length+jr(E.extra),x=l+T;g.set(E.c,x),Ya(g,o,E,E.f,E.u,y,l,E.m),o+=16+T+(E.m?E.m.length:0),l=x+y}catch(O){return u(O,null)}}pm(g,o,h.length,b,_),u(null,g)};n||p();for(var m=function(g){var _=s[g],b=i[_],C=b[0],E=b[1],y=rm(),T=C.length;y.p(C);var x=Ur(_),O=x.length,I=E.comment,A=I&&Ur(I),k=A&&A.length,L=jr(E.extra),N=E.level==0?0:8,W=function(X,Z){if(X)c(),u(X,null);else{var q=Z.length;h[g]=Wr(E,{size:T,crc:y.d(),c:Z,f:x,m:A,u:O!=_.length||A&&I.length!=k,compression:N}),o+=30+O+L+q,l+=76+2*(O+L)+(k||0)+q,--n||p()}};if(O>65535&&W(Oi(11,0,1),null),!N)W(null,C);else if(T<16e4)try{W(null,Gr(C,E))}catch(X){W(X,null)}else d.push(dm(C,E,W))},f=0;f<a;++f)m(f);return c}var Xa=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(r){r()},fm=Object.defineProperty,gm=(r,e,t)=>e in r?fm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,D=(r,e,t)=>(gm(r,typeof e!="symbol"?e+"":e,t),t);const _m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qa=r=>(typeof r!="string"&&(r=`${r}`),r.replace(/[&<>"']/g,e=>_m[e]));function Dt(r){const e=typeof r;return r!=null&&(e==="object"||e==="function")}function Cm(r){if(typeof r!="object"||r===null||Object.prototype.toString.call(r)!=="[object Object]")return!1;const e=Object.getPrototypeOf(r);if(e===null)return!0;const t=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Function.prototype.call(t)===Function.prototype.call(r)}function Ri(r){return r!=null&&typeof r.valueOf()=="string"}function vm(r,e){return e.reduce((t,i)=>(r!=null&&r.hasOwnProperty(i)&&(t[i]=r[i]),t),{})}const Yr={};function Xt(r="$lodash$"){Yr[r]||(Yr[r]=0);const e=++Yr[r];return r==="$lodash$"?`${e}`:`${r}${e}`}class an{constructor(e,t){D(this,"documentElement"),this.documentElement=this.createElement(t),this.documentElement.setAttribute("xmlns",e)}createElement(e){return new hn({nodeName:e})}createTextNode(e){return new Ka(e)}toString(){return this.documentElement.toString()}}D(an,"Node",{Create:r=>{switch(r.type){case"XML":return new hn(r);case"TEXT":return new Ka(r.nodeValue);default:return null}}});class Ka{constructor(e){D(this,"nodeValue"),this.nodeValue=e}toJSON(){return{nodeValue:this.nodeValue,type:"TEXT"}}toString(){return qa(this.nodeValue)}}class hn{constructor(e){if(D(this,"nodeName",""),D(this,"children"),D(this,"nodeValue"),D(this,"attributes"),D(this,"firstChild"),this.nodeName=e.nodeName,this.children=[],this.nodeValue=e.nodeValue||"",this.attributes={},e.children)for(let t=0,i=e.children.length;t<i;t++)this.appendChild(an.Node.Create(e.children[t]));if(e.attributes)for(const t in e.attributes)e.attributes.hasOwnProperty(t)&&this.setAttribute(t,e.attributes[t])}toString(){let e=`<${this.nodeName}`;for(const i in this.attributes)this.attributes.hasOwnProperty(i)&&(e=`${e} ${i}="${qa(this.attributes[i])}"`);let t="";for(let i=0,s=this.children.length;i<s;i++)t+=this.children[i].toString();return t?e+=`>${t}</${this.nodeName}>`:e+="/>",e}toJSON(){const e=[];for(let t=0,i=this.children.length;t<i;t++)e.push(this.children[t].toJSON());return{nodeName:this.nodeName,children:e,nodeValue:this.nodeValue,attributes:this.attributes,type:"XML"}}setAttribute(e,t){if(t===null){delete this.attributes[e],delete this[e];return}this.attributes[e]=t,this[e]=t}appendChild(e){this.children.push(e),this.firstChild=this.children[0]}cloneNode(e){return new hn(this.toJSON())}}const dn=class ai{static uniqueId(e){return ai._idSpaces[e]||(ai._idSpaces[e]=1),ai._idSpaces[e]++}static createXmlDoc(e,t){return new an(e||null,t)}static createElement(e,t,i){const s=e.createElement(t);i=i||[];let n=i.length;for(;n--;)s.setAttribute(i[n][0],i[n][1]);return s}static setAttributesOnDoc(e,t){for(let[i,s]of Object.entries(t)){if(Cm(s))if(s.v!==null&&s.v!==void 0)switch(s.type){case Boolean:s=s.v?"1":"0";break}else s=null;s!=null&&e.setAttribute(i,s)}}static positionToLetterRef(e,t){let i=1,s,n=e,o="";const l="ABCDEFGHIJKLMNOPQRSTUVWXYZ";if(ai.LETTER_REFS[e])return ai.LETTER_REFS[e].concat(t);for(;n>0;)n-=Math.pow(26,i-1),s=n%Math.pow(26,i),n-=s,s=s/Math.pow(26,i-1),o=l.charAt(s)+o,i+=1;return ai.LETTER_REFS[e]=o,o.concat(String(t))}};D(dn,"_idSpaces",{}),D(dn,"LETTER_REFS",{}),D(dn,"schemas",{worksheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",sharedStrings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",stylesheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",relationships:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",relationshipPackage:"http://schemas.openxmlformats.org/package/2006/relationships",contentTypes:"http://schemas.openxmlformats.org/package/2006/content-types",spreadsheetml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",markupCompat:"http://schemas.openxmlformats.org/markup-compatibility/2006",x14ac:"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",package:"http://schemas.openxmlformats.org/package/2006/relationships",table:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",spreadsheetDrawing:"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",drawing:"http://schemas.openxmlformats.org/drawingml/2006/main",drawingRelationship:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"});let z=dn;const qt={};class Xr{constructor(){D(this,"relations",{}),D(this,"lastId",1),Xt("rId")}importData(e){this.relations=e.relations,this.lastId=e.lastId}exportData(){return{relations:this.relations,lastId:this.lastId}}addRelation(e,t){return this.relations[e.id]={id:Xt("rId"),schema:z.schemas[t],object:e},this.relations[e.id].id}getRelationshipId(e){return this.relations[e.id]?this.relations[e.id].id:null}toXML(){const e=z.createXmlDoc(z.schemas.relationshipPackage,"Relationships"),t=e.documentElement;for(const[i,s]of Object.entries(this.relations)){const n=z.createElement(e,"Relationship",[["Id",s.id],["Type",s.schema],["Target",s.object.target||qt[i]]]);s.object.targetMode&&n.setAttribute("TargetMode",s.object.targetMode),t.appendChild(n)}return e}}class bm{constructor(){D(this,"state",null),D(this,"xSplit",null),D(this,"ySplit",null),D(this,"activePane","bottomRight"),D(this,"topLeftCell",null),D(this,"_freezePane")}freezePane(e,t,i){this._freezePane={xSplit:e,ySplit:t,cell:i}}exportXML(e){const t=e.createElement("pane");return this.state!==null&&(t.setAttribute("xSplit",this._freezePane.xSplit),t.setAttribute("ySplit",this._freezePane.ySplit),t.setAttribute("topLeftCell",this._freezePane.cell),t.setAttribute("activePane","bottomRight"),t.setAttribute("state","frozen")),t}}class Qa{constructor(){D(this,"strings",{}),D(this,"stringArray",[]),D(this,"id",Xt("SharedStrings"))}addString(e){return this.strings[e]=this.stringArray.length,this.stringArray[this.stringArray.length]=e,this.strings[e]}exportData(){return this.strings}toXML(){const e=z.createXmlDoc(z.schemas.spreadsheetml,"sst"),t=e.documentElement;this.stringArray.reverse();let i=this.stringArray.length;t.setAttribute("count",i),t.setAttribute("uniqueCount",i);const s=e.createElement("si"),n=e.createElement("t");n.appendChild(e.createTextNode("--placeholder--")),s.appendChild(n);const o=this.stringArray;for(;i--;){const l=s.cloneNode(!0);typeof o[i]=="string"&&o[i].match(/\s+/)&&l.firstChild.setAttribute("xml:space","preserve"),l.firstChild.firstChild.nodeValue=o[i],t.appendChild(l)}return e}}class Sm{constructor(e){D(this,"pane"),D(this,"showZeros",null),D(this,"defaultGridColor",null),D(this,"colorId",null),D(this,"rightToLeft",null),D(this,"showFormulas",null),D(this,"showGridLines",null),D(this,"showOutlineSymbols",null),D(this,"showRowColHeaders",null),D(this,"showRuler",null),D(this,"showWhiteSpace",null),D(this,"tabSelected",null),D(this,"topLeftCell",null),D(this,"viewType",null),D(this,"windowProtection",null),D(this,"zoomScale",null),D(this,"zoomScaleNormal",null),D(this,"zoomScalePageLayoutView",null),D(this,"zoomScaleSheetLayoutView",null);const t=e||{};this.pane=t.pane||new bm}freezePane(e,t,i){this.pane.state="frozen",this.pane.xSplit=e,this.pane.ySplit=t,this.pane.topLeftCell=i}exportXML(e){const t=e.createElement("sheetViews"),i=e.createElement("sheetView");return z.setAttributesOnDoc(i,{workbookViewId:0,showZeros:{v:this.showZeros,type:Boolean},defaultGridColor:{v:this.defaultGridColor,type:Boolean},colorId:this.colorId,rightToLeft:{v:this.rightToLeft,type:Boolean},showFormulas:{v:this.showFormulas,type:Boolean},showGridLines:{v:this.showGridLines,type:Boolean},showOutlineSymbols:{v:this.showOutlineSymbols,type:Boolean},showRowColHeaders:{v:this.showRowColHeaders,type:Boolean},showRuler:{v:this.showRuler,type:Boolean},showWhiteSpace:{v:this.showWhiteSpace,type:Boolean},tabSelected:{v:this.tabSelected,type:Boolean},viewType:this.viewType,windowProtection:{v:this.windowProtection,type:Boolean},zoomScale:{v:this.zoomScale,type:Boolean},zoomScaleNormal:this.zoomScaleNormal,zoomScalePageLayoutView:this.zoomScalePageLayoutView,zoomScaleSheetLayoutView:this.zoomScaleSheetLayoutView}),i.appendChild(this.pane.exportXML(e)),t.appendChild(i),t}}class Za{constructor(){D(this,"id",Xt("StyleSheet")),D(this,"cellStyles",[{name:"Normal",xfId:"0",builtinId:"0"}]),D(this,"defaultTableStyle",!1),D(this,"differentialStyles",[{}]),D(this,"masterCellFormats",[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfid:0}]),D(this,"masterCellStyles",[{numFmtId:0,fontId:0,fillId:0,borderId:0}]),D(this,"fonts",[{}]),D(this,"numberFormatters",[]),D(this,"fills",[{},{type:"pattern",patternType:"gray125",fgColor:"FF333333",bgColor:"FF333333"}]),D(this,"borders",[{top:{},left:{},right:{},bottom:{},diagonal:{}}]),D(this,"tableStyles",[])}createSimpleFormatter(e){const t={id:this.masterCellFormats.length};switch(e){case"date":t.numFmtId=14;break}return this.masterCellFormats.push(t),t}createFill(e){const t=this.fills.length,i=e;return i.id=t,this.fills.push(i),i}createNumberFormatter(e){const t={id:this.numberFormatters.length+100,formatCode:e};return this.numberFormatters.push(t),t}createFormat(e){const t={id:this.masterCellFormats.length};if(e.protection&&(t.protection=e.protection),e.font&&Dt(e.font))t.fontId=this.createFontStyle(e.font).id;else if(e.font){if(Number.isNaN(parseInt(e.font,10)))throw new Error("Passing a non-numeric font id is not supported");t.fontId=e.font}if(e.format&&Ri(e.format))t.numFmtId=this.createNumberFormatter(e.format).id;else if(e.format){if(Number.isNaN(parseInt(e.format,10)))throw new Error("Invalid number formatter id");t.numFmtId=e.format}if(e.border&&Dt(e.border))t.borderId=this.createBorderFormatter(e.border).id;else if(e.border){if(Number.isNaN(parseInt(e.border,10)))throw new Error("Passing a non-numeric border id is not supported");t.borderId=e.border}if(e.fill&&Dt(e.fill))t.fillId=this.createFill(e.fill).id;else if(e.fill){if(Number.isNaN(parseInt(e.fill,10)))throw new Error("Passing a non-numeric fill id is not supported");t.fillId=e.fill}return e.alignment&&Dt(e.alignment)&&(t.alignment=vm(e.alignment,["horizontal","justifyLastLine","readingOrder","relativeIndent","shrinkToFit","textRotation","vertical","wrapText"])),this.masterCellFormats.push(t),t}createDifferentialStyle(e){const t=this.differentialStyles.length,i={id:t};return e.font&&Dt(e.font)&&(i.font=e.font),e.border&&Dt(e.border)&&(i.border=Object.assign({top:{},left:{},right:{},bottom:{},diagonal:{}},e.border)),e.fill&&Dt(e.fill)&&(i.fill=e.fill),e.alignment&&Dt(e.alignment)&&(i.alignment=e.alignment),e.format&&Ri(e.format)&&(i.numFmt=e.format),this.differentialStyles[t]=i,i}createTableStyle(e){this.tableStyles.push(e)}createBorderFormatter(e){return e={top:{},left:{},right:{},bottom:{},diagonal:{},id:this.borders.length,...e},this.borders.push(e),e}createFontStyle(e){const t={id:this.fonts.length};return e.bold&&(t.bold=!0),e.italic&&(t.italic=!0),e.superscript&&(t.vertAlign="superscript"),e.subscript&&(t.vertAlign="subscript"),e.underline&&(typeof e.underline=="string"&&["double","singleAccounting","doubleAccounting"].includes(e.underline)?t.underline=e.underline:t.underline=!0),e.strike&&(t.strike=!0),e.outline&&(t.outline=!0),e.shadow&&(t.shadow=!0),e.size&&(t.size=e.size),e.color&&(t.color=e.color),e.fontName&&(t.fontName=e.fontName),this.fonts.push(t),t}exportBorders(e){const t=e.createElement("borders");t.setAttribute("count",this.borders.length);for(let i=0,s=this.borders.length;i<s;i++)t.appendChild(this.exportBorder(e,this.borders[i]));return t}exportBorder(e,t){const i=e.createElement("border"),s=n=>{const o=e.createElement(n);return t[n].style&&o.setAttribute("style",t[n].style),t[n].color&&o.appendChild(this.exportColor(e,t[n].color)),o};return i.appendChild(s("left")),i.appendChild(s("right")),i.appendChild(s("top")),i.appendChild(s("bottom")),i.appendChild(s("diagonal")),i}exportColor(e,t){const i=e.createElement("color");return Ri(t)?(i.setAttribute("rgb",t),i):(t.tint!==void 0&&i.setAttribute("tint",t.tint),t.auto!==void 0&&i.setAttribute("auto",String(!!t.auto)),t.theme!==void 0&&i.setAttribute("theme",t.theme),i)}exportMasterCellFormats(e){const t=z.createElement(e,"cellXfs",[["count",this.masterCellFormats.length]]);for(let i=0,s=this.masterCellFormats.length;i<s;i++){const n=this.masterCellFormats[i];t.appendChild(this.exportCellFormatElement(e,n))}return t}exportMasterCellStyles(e){const t=z.createElement(e,"cellStyleXfs",[["count",this.masterCellStyles.length]]);for(let i=0,s=this.masterCellStyles.length;i<s;i++){const n=this.masterCellStyles[i];t.appendChild(this.exportCellFormatElement(e,n))}return t}exportCellFormatElement(e,t){const i=e.createElement("xf"),s=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","borderId","fillId","fontId","numFmtId","pivotButton","quotePrefix","xfId"],n=Object.keys(t).filter(l=>s.indexOf(l)!==-1);if(t.alignment){const l=t.alignment;i.appendChild(this.exportAlignment(e,l))}t.protection&&(i.appendChild(this.exportProtection(e,t.protection)),i.setAttribute("applyProtection","1"));let o=n.length;for(;o--;)i.setAttribute(n[o],t[n[o]]);return t.fillId&&i.setAttribute("applyFill","1"),t.fontId&&i.setAttribute("applyFont","1"),t.borderId&&i.setAttribute("applyBorder","1"),t.alignment&&i.setAttribute("applyAlignment","1"),t.numFmtId&&i.setAttribute("applyNumberFormat","1"),t.numFmtId!==void 0&&t.xfId===void 0&&i.setAttribute("xfId","0"),i}exportAlignment(e,t){const i=e.createElement("alignment"),s=Object.keys(t);for(let n=0,o=s.length;n<o;n++)i.setAttribute(s[n],t[s[n]]);return i}exportFonts(e){const t=e.createElement("fonts");t.setAttribute("count",String(this.fonts.length));for(let i=0,s=this.fonts.length;i<s;i++){const n=this.fonts[i];t.appendChild(this.exportFont(e,n))}return t}exportFont(e,t){const i=e.createElement("font");if(t.size){const s=e.createElement("sz");s.setAttribute("val",t.size),i.appendChild(s)}if(t.fontName){const s=e.createElement("name");s.setAttribute("val",t.fontName),i.appendChild(s)}if(t.bold&&i.appendChild(e.createElement("b")),t.italic&&i.appendChild(e.createElement("i")),t.vertAlign){const s=e.createElement("vertAlign");s.setAttribute("val",t.vertAlign),i.appendChild(s)}if(t.underline){const s=e.createElement("u");t.underline!==!0&&s.setAttribute("val",t.underline),i.appendChild(s)}return t.strike&&i.appendChild(e.createElement("strike")),t.shadow&&i.appendChild(e.createElement("shadow")),t.outline&&i.appendChild(e.createElement("outline")),t.color&&i.appendChild(this.exportColor(e,t.color)),i}exportFills(e){const t=e.createElement("fills");t.setAttribute("count",String(this.fills.length));for(let i=0,s=this.fills.length;i<s;i++){const n=this.fills[i];t.appendChild(this.exportFill(e,n))}return t}exportFill(e,t){let i;const s=e.createElement("fill");return t.type==="pattern"?(i=this.exportPatternFill(e,t),s.appendChild(i)):t.type==="gradient"&&(i=this.exportGradientFill(e,t),s.appendChild(i)),s}exportGradientFill(e,t){const i=e.createElement("gradientFill");t.degree?i.setAttribute("degree",t.degree):t.left&&(i.setAttribute("left",t.left),i.setAttribute("right",t.right),i.setAttribute("top",t.top),i.setAttribute("bottom",t.bottom));const s=e.createElement("stop");s.setAttribute("position",t.start.pureAt||0);const n=e.createElement("color");typeof t.start=="string"||t.start.color?n.setAttribute("rgb",t.start.color||t.start):t.start.theme&&n.setAttribute("theme",t.start.theme);const o=e.createElement("stop"),l=e.createElement("color");return o.setAttribute("position",t.end.pureAt||1),typeof t.start=="string"||t.end.color?l.setAttribute("rgb",t.end.color||t.end):t.end.theme&&l.setAttribute("theme",t.end.theme),s.appendChild(n),o.appendChild(l),i.appendChild(s),i.appendChild(o),i}exportPatternFill(e,t){const i=z.createElement(e,"patternFill",[["patternType",t.patternType]]);t.bgColor||(t.bgColor="FFFFFFFF"),t.fgColor||(t.fgColor="FFFFFFFF");const s=e.createElement("bgColor");Ri(t.bgColor)?s.setAttribute("rgb",t.bgColor):t.bgColor.theme?s.setAttribute("theme",t.bgColor.theme):s.setAttribute("rgb",t.bgColor.rbg);const n=e.createElement("fgColor");return Ri(t.fgColor)?n.setAttribute("rgb",t.fgColor):t.fgColor.theme?n.setAttribute("theme",t.fgColor.theme):n.setAttribute("rgb",t.fgColor.rbg),i.appendChild(n),i.appendChild(s),i}exportNumberFormatters(e){const t=e.createElement("numFmts");t.setAttribute("count",String(this.numberFormatters.length));for(let i=0,s=this.numberFormatters.length;i<s;i++){const n=this.numberFormatters[i];t.appendChild(this.exportNumberFormatter(e,n))}return t}exportNumberFormatter(e,t){const i=e.createElement("numFmt");return i.setAttribute("numFmtId",t.id),i.setAttribute("formatCode",t.formatCode),i}exportCellStyles(e){const t=e.createElement("cellStyles");t.setAttribute("count",String(this.cellStyles.length));for(let i=0,s=this.cellStyles.length;i<s;i++){const n=this.cellStyles[i];delete n.id;const o=z.createElement(e,"cellStyle");t.appendChild(o);const l=Object.keys(n);let a=l.length;for(;a--;)o.setAttribute(l[a],n[l[a]])}return t}exportDifferentialStyles(e){const t=e.createElement("dxfs");t.setAttribute("count",String(this.differentialStyles.length));for(let i=0,s=this.differentialStyles.length;i<s;i++){const n=this.differentialStyles[i];t.appendChild(this.exportDFX(e,n))}return t}exportDFX(e,t){const i=e.createElement("dxf");return t.font&&i.appendChild(this.exportFont(e,t.font)),t.fill&&i.appendChild(this.exportFill(e,t.fill)),t.border&&i.appendChild(this.exportBorder(e,t.border)),t.numFmt&&i.appendChild(this.exportNumberFormatter(e,t.numFmt)),t.alignment&&i.appendChild(this.exportAlignment(e,t.alignment)),i}exportTableStyles(e){const t=e.createElement("tableStyles");t.setAttribute("count",String(this.tableStyles.length)),this.defaultTableStyle&&t.setAttribute("defaultTableStyle",String(this.defaultTableStyle));for(let i=0,s=this.tableStyles.length;i<s;i++)t.appendChild(this.exportTableStyle(e,this.tableStyles[i]));return t}exportTableStyle(e,t){const i=e.createElement("tableStyle");i.setAttribute("name",t.name),i.setAttribute("pivot",String(0));let s=0;return Object.entries(t).forEach(([n,o])=>{if(n==="name")return;s++;const l=e.createElement("tableStyleElement");l.setAttribute("type",n),l.setAttribute("dxfId",o),i.appendChild(l)}),i.setAttribute("count",String(s)),i}exportProtection(e,t){const i=e.createElement("protection");for(const s in t)t.hasOwn(s)&&i.setAttribute(s,t[s]);return i}toXML(){const e=z.createXmlDoc(z.schemas.spreadsheetml,"styleSheet"),t=e.documentElement;return t.appendChild(this.exportNumberFormatters(e)),t.appendChild(this.exportFonts(e)),t.appendChild(this.exportFills(e)),t.appendChild(this.exportBorders(e)),t.appendChild(this.exportMasterCellStyles(e)),t.appendChild(this.exportMasterCellFormats(e)),t.appendChild(this.exportCellStyles(e)),t.appendChild(this.exportDifferentialStyles(e)),this.tableStyles.length&&t.appendChild(this.exportTableStyles(e)),e}}class ym{constructor(e){D(this,"name",""),D(this,"id",Xt("Worksheet")),D(this,"_timezoneOffset"),D(this,"relations",null),D(this,"columnFormats",[]),D(this,"data",[]),D(this,"mergedCells",[]),D(this,"columns",[]),D(this,"sheetProtection",!1),D(this,"_headers",[]),D(this,"_footers",[]),D(this,"_tables",[]),D(this,"_drawings",[]),D(this,"_orientation"),D(this,"_margin"),D(this,"_rowInstructions",{}),D(this,"_freezePane",{}),D(this,"sharedStrings",null),D(this,"hyperlinks",[]),D(this,"sheetView"),D(this,"showZeros",null),this._timezoneOffset=new Date().getTimezoneOffset()*60*1e3,this.sheetView=e.sheetView||new Sm,this.initialize(e)}initialize(e){e=e||{},this.name=e.name,this.id=Xt("Worksheet"),this._timezoneOffset=new Date().getTimezoneOffset()*60*1e3,e.columns&&this.setColumns(e.columns),this.relations=new Xr}exportData(){return{relations:this.relations.exportData(),columnFormats:this.columnFormats,data:this.data,columns:this.columns,mergedCells:this.mergedCells,_headers:this._headers,_footers:this._footers,_tables:this._tables,_rowInstructions:this._rowInstructions,_freezePane:this._freezePane,name:this.name,id:this.id}}importData(e){this.relations.importData(e.relations),delete e.relations,Object.assign(this,e)}setSharedStringCollection(e){this.sharedStrings=e}addTable(e){this._tables.push(e),this.relations.addRelation(e,"table")}addDrawings(e){this._drawings.push(e),this.relations.addRelation(e,"drawingRelationship")}setRowInstructions(e,t){this._rowInstructions[e]=t}setHeader(e){if(!Array.isArray(e))throw"Invalid argument type - setHeader expects an array of three instructions";this._headers=e}setFooter(e){if(!Array.isArray(e))throw"Invalid argument type - setFooter expects an array of three instructions";this._footers=e}compilePageDetailPackage(e){return e=e||"",["&L",this.compilePageDetailPiece(e[0]||""),"&C",this.compilePageDetailPiece(e[1]||""),"&R",this.compilePageDetailPiece(e[2]||"")].join("")}compilePageDetailPiece(e){if(Ri(e))return'&"-,Regular"'.concat(e);if(Dt(e)&&!Array.isArray(e)){let t="";if(e.font||e.bold){const i=e.bold?"Bold":"Regular";t+=`&"${e.font||"-"}`,t+=`,${i}"`}else t+='&"-,Regular"';return e.underline&&(t+="&U"),e.fontSize&&(t+=`&${e.fontSize}`),t+=e.text,t}if(Array.isArray(e))return e.reduce((t,i)=>t.concat(this.compilePageDetailPiece(i)),"")}exportHeader(e){const t=e.createElement("oddHeader");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._headers))),t}exportFooter(e){const t=e.createElement("oddFooter");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._footers))),t}_buildCache(e){const t=e.createElement("c"),i=e.createElement("v");i.appendChild(e.createTextNode("--temp--")),t.appendChild(i);const s=e.createElement("c"),n=e.createElement("f");n.appendChild(e.createTextNode("--temp--")),s.appendChild(n);const o=e.createElement("c");o.setAttribute("t","s");const l=e.createElement("v");return l.appendChild(e.createTextNode("--temp--")),o.appendChild(l),{number:t,date:t,string:o,formula:s}}collectSharedStrings(){const e=this.data,t={};for(let i=0,s=e.length;i<s;i++){const n=e[i],o=n.length;for(let l=0;l<o;l++){let a=n[l];const h=(a==null?void 0:a.metadata)||{};a&&typeof a=="object"&&(a=a.value),h.type||typeof a=="number"&&(h.type="number"),(h.type==="text"||!h.type)&&typeof t[a]>"u"&&(t[a]=!0)}}return Object.keys(t)}toXML(){var e,t,i;const s=this.data,n=this.columns||[],o=z.createXmlDoc(z.schemas.spreadsheetml,"worksheet"),l=o.documentElement;let a,h,d;l.setAttribute("xmlns:r",z.schemas.relationships),l.setAttribute("xmlns:mc",z.schemas.markupCompat);let c=0;const u=z.createElement(o,"sheetData"),p=this._buildCache(o);for(d=0,h=s.length;d<h;d++){const m=s[d],f=m.length;c=f>c?f:c;const g=o.createElement("row");for(let _=0;_<f;_++){n[_]=n[_]||{};let b=m[_],C;const E=(b==null?void 0:b.metadata)||{};switch(b&&typeof b=="object"&&(b=b.value),E.type||typeof b=="number"&&(E.type="number"),E.type){case"number":C=p.number.cloneNode(!0),C.firstChild.firstChild.nodeValue=b;break;case"date":C=p.date.cloneNode(!0),b instanceof Date&&(b=b.getTime()),C.firstChild.firstChild.nodeValue=25569+(b-this._timezoneOffset)/(60*60*24*1e3);break;case"formula":C=p.formula.cloneNode(!0),C.firstChild.firstChild.nodeValue=b;break;case"text":default:{let y;typeof((e=this.sharedStrings)==null?void 0:e.strings[b])<"u"?y=this.sharedStrings.strings[b]:y=(t=this.sharedStrings)==null?void 0:t.addString(b),C=p.string.cloneNode(!0),C.firstChild.firstChild.nodeValue=y;break}}E.style?C.setAttribute("s",E.style):((i=this._rowInstructions[d])==null?void 0:i.style)!==void 0&&C.setAttribute("s",this._rowInstructions[d].style),C.setAttribute("r",z.positionToLetterRef(_+1,String(d+1))),g.appendChild(C)}if(g.setAttribute("r",d+1),this._rowInstructions[d]){const _=this._rowInstructions[d];_.height!==void 0&&(g.setAttribute("customHeight","1"),g.setAttribute("ht",_.height)),_.style!==void 0&&(g.setAttribute("customFormat","1"),g.setAttribute("s",_.style))}u.appendChild(g)}if(c!==0?l.appendChild(z.createElement(o,"dimension",[["ref",`${z.positionToLetterRef(1,1)}:${z.positionToLetterRef(c,String(s.length))}`]])):l.appendChild(z.createElement(o,"dimension",[["ref",z.positionToLetterRef(1,1)]])),l.appendChild(this.sheetView.exportXML(o)),this.columns.length&&l.appendChild(this.exportColumns(o)),l.appendChild(u),this.sheetProtection&&l.appendChild(this.sheetProtection.exportXML(o)),this.hyperlinks.length>0){const m=o.createElement("hyperlinks"),f=this.hyperlinks;for(a=0,h=f.length;a<h;a++){const g=o.createElement("hyperlink"),_=f[a];g.setAttribute("ref",String(_.cell)),_.id=z.uniqueId("hyperlink"),this.relations.addRelation({id:_.id,target:_.location,targetMode:_.targetMode||"External"},"hyperlink"),g.setAttribute("r:id",this.relations.getRelationshipId(_)),m.appendChild(g)}l.appendChild(m)}if(this.mergedCells.length>0){const m=o.createElement("mergeCells");for(a=0,h=this.mergedCells.length;a<h;a++){const f=o.createElement("mergeCell");f.setAttribute("ref",`${this.mergedCells[a][0]}:${this.mergedCells[a][1]}`),m.appendChild(f)}l.appendChild(m)}if(this.exportPageSettings(o,l),this._headers.length>0||this._footers.length>0){const m=o.createElement("headerFooter");this._headers.length>0&&m.appendChild(this.exportHeader(o)),this._footers.length>0&&m.appendChild(this.exportFooter(o)),l.appendChild(m)}for(a=0,h=this._drawings.length;a<h;a++){const m=o.createElement("drawing");m.setAttribute("r:id",this.relations.getRelationshipId(this._drawings[a])),l.appendChild(m)}if(this._tables.length>0){const m=o.createElement("tableParts");for(m.setAttribute("count",this._tables.length),a=0,h=this._tables.length;a<h;a++){const f=o.createElement("tablePart");f.setAttribute("r:id",this.relations.getRelationshipId(this._tables[a])),m.appendChild(f)}l.appendChild(m)}return o}exportColumns(e){const t=z.createElement(e,"cols");for(let i=0,s=this.columns.length;i<s;i++){const n=this.columns[i],o=z.createElement(e,"col",[["min",n.min||i+1],["max",n.max||i+1]]);n.hidden&&o.setAttribute("hidden",String(1)),n.bestFit&&o.setAttribute("bestFit",String(1)),(n.customWidth||n.width)&&o.setAttribute("customWidth",String(1)),n.width?o.setAttribute("width",n.width):o.setAttribute("width",String(9.140625)),t.appendChild(o)}return t}exportPageSettings(e,t){if(this._margin){let i=.7;const s=this._margin.left?this._margin.left:i,n=this._margin.right?this._margin.right:i,o=this._margin.top?this._margin.top:i,l=this._margin.bottom?this._margin.bottom:i;i=.3;const a=this._margin.header?this._margin.header:i,h=this._margin.footer?this._margin.footer:i;t.appendChild(z.createElement(e,"pageMargins",[["top",o],["bottom",l],["left",s],["right",n],["header",a],["footer",h]]))}this._orientation&&t.appendChild(z.createElement(e,"pageSetup",[["orientation",this._orientation]]))}setPageOrientation(e){this._orientation=e}setPageMargin(e){this._margin=e}setColumns(e){this.columns=e}setData(e){this.data=e}mergeCells(e,t){this.mergedCells.push([e,t])}freezePane(e,t,i){this.sheetView.freezePane(e,t,i)}setColumnFormats(e){this.columnFormats=e}}class Em{constructor(){D(this,"id",Xt("Workbook")),D(this,"styleSheet",new Za),D(this,"sharedStrings",new Qa),D(this,"relations",new Xr),D(this,"worksheets",[]),D(this,"tables",[]),D(this,"drawings",[]),D(this,"media",{}),D(this,"printTitles"),this.initialize()}initialize(){this.id=Xt("Workbook"),this.styleSheet=new Za,this.sharedStrings=new Qa,this.relations=new Xr,this.relations.addRelation(this.styleSheet,"stylesheet"),this.relations.addRelation(this.sharedStrings,"sharedStrings")}createWorksheet(e){return e=Object.assign({},{name:"Sheet ".concat(String(this.worksheets.length+1))},e),new ym(e)}getStyleSheet(){return this.styleSheet}addTable(e){this.tables.push(e)}addDrawings(e){this.drawings.push(e)}setPrintTitleTop(e,t){this.printTitles==null&&(this.printTitles={}),this.printTitles[e]==null&&(this.printTitles[e]={}),this.printTitles[e].top=t}setPrintTitleLeft(e,t){this.printTitles==null&&(this.printTitles={}),this.printTitles[e]==null&&(this.printTitles[e]={}),this.printTitles[e].left=String.fromCharCode(64+t)}addMedia(e,t,i,s){const n=t.split("."),o=n[n.length-1];if(!s)switch(o.toLowerCase()){case"jpeg":case"jpg":s="image/jpeg";break;case"png":s="image/png";break;case"gif":s="image/gif";break;default:s=null;break}return this.media[t]||(this.media[t]={id:t,data:i,fileName:t,contentType:s,extension:o}),this.media[t]}addWorksheet(e){this.relations.addRelation(e,"worksheet"),e.setSharedStringCollection(this.sharedStrings),this.worksheets.push(e)}createContentTypes(){const e=z.createXmlDoc(z.schemas.contentTypes,"Types"),t=e.documentElement;let i,s;t.appendChild(z.createElement(e,"Default",[["Extension","rels"],["ContentType","application/vnd.openxmlformats-package.relationships+xml"]])),t.appendChild(z.createElement(e,"Default",[["Extension","xml"],["ContentType","application/xml"]]));const n={};for(const o in this.media)this.media.hasOwn(o)&&(n[this.media[o].extension]=this.media[o].contentType);for(const o in n)n.hasOwn(o)&&t.appendChild(z.createElement(e,"Default",[["Extension",o],["ContentType",n[o]]]));for(t.appendChild(z.createElement(e,"Override",[["PartName","/xl/workbook.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"]])),t.appendChild(z.createElement(e,"Override",[["PartName","/xl/sharedStrings.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"]])),t.appendChild(z.createElement(e,"Override",[["PartName","/xl/styles.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"]])),i=0,s=this.worksheets.length;i<s;i++)t.appendChild(z.createElement(e,"Override",[["PartName",`/xl/worksheets/sheet${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"]]));for(i=0,s=this.tables.length;i<s;i++)t.appendChild(z.createElement(e,"Override",[["PartName",`/xl/tables/table${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"]]));for(i=0,s=this.drawings.length;i<s;i++)t.appendChild(z.createElement(e,"Override",[["PartName",`/xl/drawings/drawing${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.drawing+xml"]]));return e}toXML(){const e=z.createXmlDoc(z.schemas.spreadsheetml,"workbook"),t=e.documentElement;t.setAttribute("xmlns:r",z.schemas.relationships);const i=31,s=z.createElement(e,"sheets");for(let l=0,a=this.worksheets.length;l<a;l++){const h=e.createElement("sheet");typeof console<"u"&&this.worksheets[l].name.length>i&&console.log(`Microsoft Excel requires work sheet names to be less than ${i+1} characters long, work sheet name "${this.worksheets[l].name}" is ${this.worksheets[l].name.length} characters long`),h.setAttribute("name",this.worksheets[l].name),h.setAttribute("sheetId",l+1),h.setAttribute("r:id",this.relations.getRelationshipId(this.worksheets[l])),s.appendChild(h)}t.appendChild(s);const n=z.createElement(e,"definedNames");let o=0;for(const l in this.printTitles){if(!this.printTitles.hasOwn(l))continue;const a=this.printTitles[l],h=e.createElement("definedName");h.setAttribute("name","_xlnm.Print_Titles"),h.setAttribute("localSheetId",o++);let d="";a.top&&(d+=`${l}!$1:$${a.top}`,a.left&&(d+=",")),a.left&&(d+=`${l}!$A:$${a.left}`),h.appendChild(e.createTextNode(d)),n.appendChild(h)}return t.appendChild(n),e}createWorkbookRelationship(){const e=z.createXmlDoc(z.schemas.relationshipPackage,"Relationships");return e.documentElement.appendChild(z.createElement(e,"Relationship",[["Id","rId1"],["Type",z.schemas.officeDocument],["Target","xl/workbook.xml"]])),e}_generateCorePaths(e){let t,i;for(qt[this.styleSheet.id]="styles.xml",qt[this.sharedStrings.id]="sharedStrings.xml",qt[this.id]="/xl/workbook.xml",t=0,i=this.tables.length;t<i;t++)e[`/xl/tables/table${t+1}.xml`]=this.tables[t].toXML(),qt[this.tables[t].id]=`/xl/tables/table${t+1}.xml`;for(const s in this.media)if(this.media.hasOwn(s)){const n=this.media[s];e[`/xl/media/${s}`]=n.data,qt[s]=`/xl/media/${s}`}for(t=0,i=this.drawings.length;t<i;t++)e[`/xl/drawings/drawing${t+1}.xml`]=this.drawings[t].toXML(),qt[this.drawings[t].id]=`/xl/drawings/drawing${t+1}.xml`,e[`/xl/drawings/_rels/drawing${t+1}.xml.rels`]=this.drawings[t].relations.toXML()}_prepareFilesForPackaging(e){Object.assign(e,{"/[Content_Types].xml":this.createContentTypes(),"/_rels/.rels":this.createWorkbookRelationship(),"/xl/styles.xml":this.styleSheet.toXML(),"/xl/workbook.xml":this.toXML(),"/xl/sharedStrings.xml":this.sharedStrings.toXML(),"/xl/_rels/workbook.xml.rels":this.relations.toXML()});for(const[t,i]of Object.entries(e))if(t.indexOf(".xml")!==-1||t.indexOf(".rels")!==-1){i instanceof an?e[t]=i.toString():e[t]=i.xml||new window.XMLSerializer().serializeToString(i);let s=e[t].replace(/xmlns=""/g,"");s=s.replace(/NS[\d]+:/g,""),s=s.replace(/xmlns:NS[\d]+=""/g,""),e[t]=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
28
- ${s}`}}generateFiles(){return new Promise(e=>{const t={};this._generateCorePaths(t);for(let i=0,s=this.worksheets.length;i<s;i++)t[`/xl/worksheets/sheet${i+1}.xml`]=this.worksheets[i].toXML(),qt[this.worksheets[i].id]=`worksheets/sheet${i+1}.xml`,t[`/xl/worksheets/_rels/sheet${i+1}.xml.rels`]=this.worksheets[i].relations.toXML();return this._prepareFilesForPackaging(t),e(t)})}}function wm(r,e,t){const i={};return new Promise((s,n)=>{r.generateFiles().then(o=>{for(const[l,a]of Object.entries(o))i[l.substr(1)]=Ur(a);return mm(i,(t==null?void 0:t.zipOptions)||{},(l,a)=>{if(l){n(l);return}if(e==="Uint8Array")s(a);else{const h=(t==null?void 0:t.fileFormat)??"xlsx";let d=t==null?void 0:t.mimeType;d===void 0&&(d=h==="xls"?"application/vnd.ms-excel":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),s(new Blob([a],{type:d}))}})})})}function Tm(r,e,t){if((t==null?void 0:t.downloadType)==="node")throw new Error('[Excel-Builder-Vanilla] Please note that `downloadExcelFile()` is currently only supporting the "browser" download type at the moment.');const i=e.match(/.*\.xls$/)?"xls":"xlsx";return wm(r,"Blob",{...t,fileFormat:i}).then(s=>{Om(e,s)})}function Om(r,e){const t=document.createElement("a"),i=URL.createObjectURL(e);t&&document&&(t.textContent="download",t.href=i,t.setAttribute("download",r),t.style.visibility="hidden",document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(i))}const xm=(r,{excelFormatId:e})=>e!==void 0?{value:r,metadata:{style:e}}:r,Im=(r,{columnDef:e,excelFormatId:t,gridOptions:i})=>({value:typeof r=="string"&&/\d/g.test(r)?Rm(r,e,i):r,metadata:{style:t}});function Rm(r,e,t){let i=r;if(typeof r=="string"&&r){const s=yt("decimalSeparator",e,t,R.DEFAULT_NUMBER_DECIMAL_SEPARATOR),n=parseFloat(s===","?r.replace(/[^0-9,-]+/g,"").replace(",","."):r.replace(/[^\d.-]/g,""));i=isNaN(n)?r:n}return i}function Am(r,e,t,i,s=!0){const n=Ni(t);let o,l=xm;return n===S.number&&s&&(o=qr(r,e,t,i,"cell").excelFormat.id,l=Im),{excelFormatId:o,getDataValueParser:l}}function Pm(r,e){var t;return((t=r==null?void 0:r[e.groupType])==null?void 0:t[e.columnDef.field])??0}function km(r,e,t){var s;let i;if(t==="group")switch(r.groupTotalsFormatter){case ne.avgTotalsCurrency:case ne.avgTotalsDollar:case ne.sumTotalsCurrency:case ne.sumTotalsCurrencyColored:case ne.sumTotalsDollar:case ne.sumTotalsDollarBold:case ne.sumTotalsDollarColored:case ne.sumTotalsDollarColoredBold:i="currency";break;case ne.avgTotalsPercentage:i="percent";break;case ne.avgTotals:case ne.minTotals:case ne.maxTotals:case ne.sumTotals:case ne.sumTotalsColored:case ne.sumTotalsBold:default:i="decimal";break}else if(r.formatter===_e.multiple&&Array.isArray((s=r.params)==null?void 0:s.formatters)){i="decimal";for(const n of r.params.formatters)if(i=Ja(n),i!=="decimal")break}else i=Ja(r.formatter);return Se(r,e,i,t)}function Ja(r){let e;switch(r){case _e.currency:case _e.dollar:case _e.dollarColored:case _e.dollarColoredBold:e="currency";break;case _e.percent:case _e.percentComplete:case _e.percentCompleteBar:case _e.percentCompleteBarWithText:case _e.percentSymbol:e="percent";break;case _e.decimal:default:e="decimal";break}return e}function qr(r,e,t,i,s){var h,d;let n="",o=((h=t.groupTotalsExcelExportOptions)==null?void 0:h.groupType)||"",l;const a=Ni(t);if(s==="group")switch(t.groupTotalsFormatter){case ne.avgTotals:case ne.avgTotalsCurrency:case ne.avgTotalsDollar:case ne.avgTotalsPercentage:o="avg";break;case ne.minTotals:o="min";break;case ne.maxTotals:o="max";break;case ne.sumTotals:case ne.sumTotalsBold:case ne.sumTotalsColored:case ne.sumTotalsCurrency:case ne.sumTotalsCurrencyColored:case ne.sumTotalsDollar:case ne.sumTotalsDollarColoredBold:case ne.sumTotalsDollarColored:case ne.sumTotalsDollarBold:o="sum";break;default:l=e.numberFormat;break}else switch(a){case S.number:switch(t.formatter){case _e.multiple:if(Array.isArray((d=t.params)==null?void 0:d.formatters))for(const c of t.params.formatters){const{excelFormat:u}=qr(r,e,{...t,formatter:c},i,s);if(u!==e.numberFormat){l=u;break}}l||(l=e.numberFormat);break;case _e.currency:case _e.decimal:case _e.dollar:case _e.dollarColored:case _e.dollarColoredBold:case _e.percent:case _e.percentComplete:case _e.percentCompleteBar:case _e.percentCompleteBarWithText:case _e.percentSymbol:n=th(t,i,"cell");break;default:l=e.numberFormat;break}break}return!l&&(t.formatter||t.groupTotalsFormatter)&&(n=th(t,i,s,o),e.hasOwnProperty(n)||(e[n]=r.createFormat({format:n})),l=e[n]),{excelFormat:l,groupType:o}}function eh(r){const[e,t,i,s,n,o,l,a]=(r==null?void 0:r.match(/^([^\d(-]*)([(]?)([^\d]*)([-]?[\w]]?[\d\s]*[.,\d]*[\d]*[^)\s%]?)([^\d.,)]*)([)]?)([^\d]*)$/i))||[],h=(n||"").replace(/1/g,"0").replace(/[2]/g,"#");return[cn(t??""),i??"",cn(s??""),h,cn(o??""),l??"",cn(a??"")].join("").replace(",",",")}function th(r,e,t,i=""){let s="",n="",o="";const{minDecimal:l,maxDecimal:a,thousandSeparator:h}=km(r,e,t),c=parseFloat(`${h?"2220":"0"}.${Fm(l,a)}`);return t==="group"&&r.groupTotalsFormatter?(n=we(r.groupTotalsFormatter({[i]:{[r.field]:c}},r,e)),o=we(r.groupTotalsFormatter({[i]:{[r.field]:-c}},r,e))):r.formatter&&(n=we(r.formatter(0,0,c,r,{},e)),o=we(r.formatter(0,0,-c,r,{},e))),n&&o&&(s=eh(n)+";"+eh(o)),s}function cn(r){return r&&`"${r}"`}function Fm(r,e){return ih("1",r)+ih("2",e-r)}function ih(r,e){let t="";for(let i=0;i<e;i++)t+=r;return t}const Dm={filename:"export",format:ve.xlsx};class Mm{constructor(){this._fileFormat=ve.xlsx,this._columnHeaders=[],this._hasColumnTitlePreHeader=!1,this._hasGroupedItems=!1,this._pubSubService=null,this._regularCellExcelFormats={},this._groupTotalExcelFormats={},this.className="ExcelExportService"}get _datasetIdPropName(){var e;return((e=this._gridOptions)==null?void 0:e.datasetIdPropertyName)??"id"}get _dataView(){var e;return(e=this._grid)==null?void 0:e.getData()}get _gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())||{}}get stylesheet(){return this._stylesheet}get stylesheetFormats(){return this._stylesheetFormats}get groupTotalExcelFormats(){return this._groupTotalExcelFormats}get regularCellExcelFormats(){return this._regularCellExcelFormats}dispose(){var e;(e=this._pubSubService)==null||e.unsubscribeAll()}init(e,t){var i,s;if(this._grid=e,this._pubSubService=t.get("PubSubService"),this._locales=((i=this._gridOptions)==null?void 0:i.locales)??R.locales,this._translaterService=(s=this._gridOptions)==null?void 0:s.translater,this._gridOptions.enableTranslate&&(!this._translaterService||!this._translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })')}exportToExcel(e){var t;if(!this._grid||!this._dataView||!this._pubSubService)throw new Error('[Slickgrid-Universal] it seems that the SlickGrid & DataView objects and/or PubSubService are not initialized did you forget to enable the grid option flag "enableExcelExport"?');return(t=this._pubSubService)==null||t.publish("onBeforeExportToExcel",!0),this._excelExportOptions=de(!0,{},{...Dm,...this._gridOptions.excelExportOptions,...e}),this._fileFormat=this._excelExportOptions.format||ve.xlsx,this._regularCellExcelFormats={},this._groupTotalExcelFormats={},new Promise(i=>{const s={name:this._excelExportOptions.sheetName||"Sheet1"};this._workbook=new Em,this._sheet=this._workbook.createWorksheet(s),this._stylesheet=this._workbook.getStyleSheet();const n=this._stylesheet.createFormat({font:{bold:!0}}),o=this._stylesheet.createFormat({format:"@"}),l=this._stylesheet.createFormat({format:"0"});this._stylesheetFormats={boldFormat:n,numberFormat:l,stringFormat:o},this._sheet.setColumnFormats([n]);const a=this.getDataOutput();setTimeout(async()=>{var m,f,g,_;(f=(m=this._gridOptions)==null?void 0:m.excelExportOptions)!=null&&f.customExcelHeader&&this._gridOptions.excelExportOptions.customExcelHeader(this._workbook,this._sheet);const h=((g=this._grid)==null?void 0:g.getColumns())||[];this._sheet.setColumns(this.getColumnStyles(h));const d=this._sheet.data;let c=d;Array.isArray(d)&&Array.isArray(a)&&(c=this._sheet.data.concat(a)),this._sheet.setData(c),this._workbook.addWorksheet(this._sheet);let u=(_=this._excelExportOptions)==null?void 0:_.mimeType;u===void 0&&(u=this._fileFormat===ve.xls?"application/vnd.ms-excel":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");const p=`${this._excelExportOptions.filename}.${this._fileFormat}`;Tm(this._workbook,p,{mimeType:u}).then(()=>{var b;(b=this._pubSubService)==null||b.publish("onAfterExportToExcel",{filename:p,mimeType:u}),i(!0)})})})}getExcelColumnNameByIndex(e){const t="ZABCDEFGHIJKLMNOPQRSTUVWXY";let i=Math.floor(e/26);const s=Math.floor(e%26);return s===0&&i--,e>26?this.getExcelColumnNameByIndex(i)+t[s]:t[s]+""}getDataOutput(){var o,l;const e=((o=this._grid)==null?void 0:o.getColumns())||[],t=[],i=(l=this._gridOptions)==null?void 0:l.excelExportOptions,s=i==null?void 0:i.columnHeaderStyle;let n=this._stylesheetFormats.boldFormat.id;if(s&&(n=this._stylesheet.createFormat(s).id),this._gridOptions.createPreHeaderPanel&&this._gridOptions.showPreHeaderPanel&&!this._gridOptions.enableDraggableGrouping){const a=this._stylesheet.createFormat({alignment:{horizontal:"center"},font:{bold:!0}});t.push(this.getColumnGroupedHeaderTitlesData(e,{style:a==null?void 0:a.id})),this._hasColumnTitlePreHeader=!0}return t.push(this.getColumnHeaderData(e,{style:n})),this.pushAllGridRowDataToArray(t,e),t}getColumnStyles(e){var s,n;const t=this._dataView.getGrouping(),i=[];return Array.isArray(t)&&t.length>0&&i.push({bestFit:!0,columnStyles:((n=(s=this._gridOptions)==null?void 0:s.excelExportOptions)==null?void 0:n.customColumnWidth)??10}),e.forEach(o=>{var a,h,d;const l=o.excludeFromExport??!1;(o.width===void 0||o.width>0)&&!l&&i.push({bestFit:!0,width:((a=o.excelExportOptions)==null?void 0:a.width)??((d=(h=this._gridOptions)==null?void 0:h.excelExportOptions)==null?void 0:d.customColumnWidth)??10})}),i}getColumnGroupedHeaderTitlesData(e,t){let i=[];this._groupedColumnHeaders=this.getColumnGroupedHeaderTitles(e)||[],this._groupedColumnHeaders&&Array.isArray(this._groupedColumnHeaders)&&this._groupedColumnHeaders.length>0&&(i=this._groupedColumnHeaders.map(o=>({value:o.title,metadata:t})));let s=0;const n=this._groupedColumnHeaders.length;for(let o=0;o<n;o++)if(o+1===n||o+1<n&&this._groupedColumnHeaders[o].title!==this._groupedColumnHeaders[o+1].title){const l=this.getExcelColumnNameByIndex(s+1),a=this.getExcelColumnNameByIndex(o+1);this._sheet.mergeCells(`${l}1`,`${a}1`),s=o+1}return i}getColumnHeaderData(e,t){let i=[];this._columnHeaders=this.getColumnHeaders(e)||[],this._columnHeaders&&Array.isArray(this._columnHeaders)&&this._columnHeaders.length>0&&(i=this._columnHeaders.map(n=>({value:we(n.title),metadata:t})));const s=this.getGroupColumnTitle();return s&&i.unshift({value:s,metadata:t}),i}getGroupColumnTitle(){var i;let e=this._excelExportOptions.groupingColumnHeaderTitle;!e&&this._gridOptions.enableTranslate&&((i=this._translaterService)!=null&&i.translate)?e=this._translaterService.translate(`${ot(this._gridOptions)}GROUP_BY`):e||(e=this._locales&&this._locales.TEXT_GROUP_BY);const t=this._dataView.getGrouping();return Array.isArray(t)&&t.length>0?(this._hasGroupedItems=!0,e):(this._hasGroupedItems=!1,null)}getColumnGroupedHeaderTitles(e){const t=[];return e&&Array.isArray(e)&&e.forEach(i=>{var o;let s="";i.columnGroupKey&&this._gridOptions.enableTranslate&&((o=this._translaterService)!=null&&o.translate)?s=this._translaterService.translate(i.columnGroupKey):s=i.columnGroup||"";const n=i.excludeFromExport||!1;(i.width===void 0||i.width>0)&&!n&&t.push({key:i.field||i.id,title:s||""})}),t}getColumnHeaders(e){const t=[];return e&&Array.isArray(e)&&e.forEach(i=>{var o;let s="";(i.nameKey||i.nameKey)&&this._gridOptions.enableTranslate&&((o=this._translaterService)!=null&&o.translate)?s=this._translaterService.translate(i.nameKey||i.nameKey):s=gt(i.name||"","innerHTML")||Jt(i.field);const n=i.excludeFromExport||!1;(i.width===void 0||i.width>0)&&!n&&t.push({key:(i.field||i.id)+"",title:s})}),t}pushAllGridRowDataToArray(e,t){const i=this._dataView.getLength();for(let s=0;s<i;s++){const n=this._dataView.getItem(s);n&&!n.hasOwnProperty("getItem")&&(n[this._datasetIdPropName]!==null&&n[this._datasetIdPropName]!==void 0?e.push(this.readRegularRowData(t,s,n,s)):this._hasGroupedItems&&n.__groupTotals===void 0?e.push([this.readGroupedRowTitle(n)]):n.__groupTotals&&e.push(this.readGroupedTotalRows(t,n,s)))}return e}readRegularRowData(e,t,i,s){var c,u,p,m;let n=0;const o=[],l=e.length;let a=1,h=0;const d=this._dataView.getItemMetadata(t);for(let f=0;f<l;f++){const g=e[f];if(g.excludeFromExport)continue;this._hasGroupedItems&&n===0&&o.push("");let _=1,b;if(d!=null&&d.columns){const C=d.columns,E=C[g.id]||C[f];!isNaN(a)&&+a>1||a==="*"&&f>0||(a=(E==null?void 0:E.colspan)??1),a==="*"?_=e.length-f:(_=a,g.id in C&&(b=g.id,h=f))}if(a==="*"&&f>0||!isNaN(a)&&+a>1&&g.id!==b){const C=t+(this._hasColumnTitlePreHeader?3:2);if(typeof a=="number"&&_-1===1){const E=this.getExcelColumnNameByIndex(h+1),y=this.getExcelColumnNameByIndex(f+1);this._sheet.mergeCells(`${E}${C}`,`${y}${C}`),o.push("")}else if(a==="*"&&_===1){const E=this.getExcelColumnNameByIndex(f+1);this._sheet.mergeCells(`A${C}`,`${E}${C}`)}else o.push("");typeof a=="number"&&!isNaN(a)&&+a>1&&(_=a--)}else{let C="";const E=Ni(g),y={...this._excelExportOptions};if(g.exportWithFormatter!==!1&&_n(E)&&(y.exportWithFormatter=!0),C=ur(t,f,g,i,this._grid,y),!this._regularCellExcelFormats.hasOwnProperty(g.id)){const O=((c=g.excelExportOptions)==null?void 0:c.autoDetectCellFormat)??((u=this._excelExportOptions)==null?void 0:u.autoDetectCellFormat),I=Am(this._stylesheet,this._stylesheetFormats,g,this._grid,O);(p=g.excelExportOptions)!=null&&p.style&&(I.excelFormatId=this._stylesheet.createFormat(g.excelExportOptions.style).id),(m=g.excelExportOptions)!=null&&m.valueParserCallback&&(I.getDataValueParser=g.excelExportOptions.valueParserCallback),this._regularCellExcelFormats[g.id]=I}typeof C=="string"&&(g.sanitizeDataExport||this._excelExportOptions.sanitizeDataExport)&&(C=we(C));const{excelFormatId:T,getDataValueParser:x}=this._regularCellExcelFormats[g.id];C=x(C,{columnDef:g,excelFormatId:T,stylesheet:this._stylesheet,gridOptions:this._gridOptions,dataRowIdx:s,dataContext:i}),o.push(C),n++}}return o}readGroupedRowTitle(e){const t=we(e.title);if(this._excelExportOptions&&this._excelExportOptions.addGroupIndentation){const i=this._excelExportOptions&&this._excelExportOptions.groupCollapsedSymbol||"⮞",s=this._excelExportOptions&&this._excelExportOptions.groupExpandedSymbol||"⮟";return(e.collapsed?i:s)+" "+Vi(5*e.level)+t}return t}readGroupedTotalRows(e,t,i){const n=[this._excelExportOptions.groupingAggregatorRowText||""];return e.forEach(o=>{var c,u,p,m,f,g,_;let l="";const a=Ni(o),h=o.excludeFromExport||!1;if(o.exportCustomGroupTotalsFormatter){const b=o.exportCustomGroupTotalsFormatter(t,o,this._grid);l=b instanceof HTMLElement?b.textContent||"":b}const d=((c=o.excelExportOptions)==null?void 0:c.autoDetectCellFormat)??((u=this._excelExportOptions)==null?void 0:u.autoDetectCellFormat);if(a===S.number&&d!==!1){let b=this._groupTotalExcelFormats[o.id];b!=null&&b.groupType||(b=qr(this._stylesheet,this._stylesheetFormats,o,this._grid,"group"),(p=o.groupTotalsExcelExportOptions)!=null&&p.style&&(b.excelFormat=this._stylesheet.createFormat(o.groupTotalsExcelExportOptions.style)),this._groupTotalExcelFormats[o.id]=b);const C=((m=o.groupTotalsExcelExportOptions)==null?void 0:m.valueParserCallback)??Pm;if(((f=t[b.groupType])==null?void 0:f[o.field])!==void 0){const E=C(t,{columnDef:o,groupType:b.groupType,excelFormatId:(g=b.excelFormat)==null?void 0:g.id,stylesheet:this._stylesheet,dataRowIdx:i});l=typeof E=="object"&&E.hasOwnProperty("metadata")?E:l={value:E,metadata:{style:(_=b.excelFormat)==null?void 0:_.id}}}}else if(o.groupTotalsFormatter){const b=o.groupTotalsFormatter(t,o,this._grid);l=b instanceof HTMLElement?b.textContent||"":b}typeof l=="string"&&(o.sanitizeDataExport||this._excelExportOptions.sanitizeDataExport)&&(l=we(l)),(o.width===void 0||o.width>0)&&!h&&n.push(l)}),n}}const un=["title","data-slick-tooltip"],oi="[title], [data-slick-tooltip]",Nm="slick-custom-tooltip";class Lm{constructor(){this.name="CustomTooltip",this._cellType="slick-cell",this._rxjs=null,this._sharedService=null,this._mousePosition={x:0,y:0},this._hasMultipleTooltips=!1,this._defaultOptions={bodyClassName:"tooltip-body",className:"",offsetArrow:3,offsetLeft:0,offsetRight:0,offsetTopBottom:4,hideArrow:!1,regularTooltipWhiteSpace:"pre-line",whiteSpace:"normal"},this._eventHandler=new pe}get addonOptions(){return this._addonOptions}get cancellablePromise(){return this._cancellablePromise}get cellAddonOptions(){return this._cellAddonOptions}get bodyClassName(){var e;return((e=this._cellAddonOptions)==null?void 0:e.bodyClassName)??"tooltip-body"}get className(){var t;let e=Nm;return(t=this._addonOptions)!=null&&t.className&&(e+=` ${this._addonOptions.className}`),e}get dataView(){return this._grid.getData()||{}}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())||{}}get gridUid(){var e;return((e=this._grid)==null?void 0:e.getUID())||""}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}get tooltipElm(){return this._tooltipElm}addRxJsResource(e){this._rxjs=e}init(e,t){var i,s;this._grid=e,this._rxjs=t.get("RxJsFacade"),this._sharedService=t.get("SharedService"),this._addonOptions={...this._defaultOptions,...(s=(i=this._sharedService)==null?void 0:i.gridOptions)==null?void 0:s.customTooltip},this._eventHandler.subscribe(e.onMouseEnter,this.handleOnMouseOver.bind(this)).subscribe(e.onHeaderMouseOver,(n,o)=>this.handleOnHeaderMouseOverByType(n,o,"slick-header-column")).subscribe(e.onHeaderRowMouseEnter,(n,o)=>this.handleOnHeaderMouseOverByType(n,o,"slick-headerrow-column")).subscribe(e.onHeaderRowMouseOver,(n,o)=>this.handleOnHeaderMouseOverByType(n,o,"slick-headerrow-column")).subscribe(e.onMouseLeave,this.hideTooltip.bind(this)).subscribe(e.onHeaderMouseOut,this.hideTooltip.bind(this)).subscribe(e.onHeaderRowMouseOut,this.hideTooltip.bind(this))}dispose(){this.hideTooltip(),this._cancellablePromise=void 0,this._eventHandler.unsubscribeAll()}hideTooltip(){var i,s;(i=this._cancellablePromise)==null||i.cancel(),(s=this._observable$)==null||s.unsubscribe();const e=he(this.className).join("."),t=document.body.querySelector(`.${e}${this.gridUidSelector}`);t==null||t.remove()}getOptions(){return this._addonOptions}setOptions(e){this._addonOptions={...this._addonOptions,...e}}asyncProcessCallback(e,t,i,s,n){var l,a;this.hideTooltip();const o={...n,[((l=this.addonOptions)==null?void 0:l.asyncParamsPropName)??"__params"]:e};(a=this._cellAddonOptions)!=null&&a.useRegularTooltip?this.renderRegularTooltip(this._cellAddonOptions.asyncPostFormatter,t,i,s,o):this.renderTooltipFormatter(this._cellAddonOptions.asyncPostFormatter,t,i,s,o)}handleOnHeaderMouseOverByType(e,t,i){var a,h,d,c;this._cellType=i,this._mousePosition={x:e.clientX||0,y:e.clientY||0},this._mouseTarget=(a=document.elementFromPoint(e.clientX||0,e.clientY||0))==null?void 0:a.closest(oi),this.hideTooltip();const s={row:-1,cell:this._grid.getColumns().findIndex(u=>{var p;return(((p=t==null?void 0:t.column)==null?void 0:p.id)??"")===u.id})},n=t.column,o={},l=i==="slick-headerrow-column";if(t=t||{},t.cell=s.cell,t.row=s.row,t.columnDef=n,t.dataContext=o,t.grid=this._grid,t.type=l?"header-row":"header",this._cellAddonOptions={...this._addonOptions,...n==null?void 0:n.customTooltip},!(n!=null&&n.disableTooltip||typeof((h=this._cellAddonOptions)==null?void 0:h.usabilityOverride)=="function"&&!this._cellAddonOptions.usabilityOverride(t))&&n&&e.target){this._cellNodeElm=e.target.closest(`.${i}`);const u=l?this._cellAddonOptions.headerRowFormatter:this._cellAddonOptions.headerFormatter;if((d=this._cellAddonOptions)!=null&&d.useRegularTooltip||!u){const p=l?(c=this._cellAddonOptions)!=null&&c.useRegularTooltip?null:u:n.name;this.renderRegularTooltip(p,s,null,n,o)}else this._cellNodeElm&&typeof u=="function"&&this.renderTooltipFormatter(u,s,null,n,o)}}async handleOnMouseOver(e){var t,i,s,n,o,l,a,h,d;if(this._cellType="slick-cell",this._mousePosition={x:e.clientX||0,y:e.clientY||0},this._mouseTarget=(t=document.elementFromPoint(e.clientX||0,e.clientY||0))==null?void 0:t.closest(oi),this.hideTooltip(),e&&this._grid){const c=(s=(i=e==null?void 0:e.target)==null?void 0:i.closest(".slick-cell"))==null?void 0:s.className,u=c&&/l\d+/.exec(c||"")?this._grid.getCellFromEvent(e):null;if(u){const p=this.dataView?this.dataView.getItem(u.row):this._grid.getDataItem(u.row),m=this._grid.getColumns()[u.cell];if(this._cellNodeElm=this._grid.getCellNode(u.row,u.cell),p&&m){if(this._cellAddonOptions={...this._addonOptions,...m==null?void 0:m.customTooltip},m!=null&&m.disableTooltip||typeof((n=this._cellAddonOptions)==null?void 0:n.usabilityOverride)=="function"&&!this._cellAddonOptions.usabilityOverride({cell:u.cell,row:u.row,dataContext:p,column:m,grid:this._grid,type:"cell"}))return;const f=p.hasOwnProperty(m.field)?p[m.field]:null,g=this._grid.getEditorLock().isActive()?null:f;if(this._cellAddonOptions.useRegularTooltip&&!((o=this._cellAddonOptions)!=null&&o.asyncProcess)||!((l=this._cellAddonOptions)!=null&&l.formatter))this.renderRegularTooltip(m.formatter,u,g,m,p);else if(typeof((a=this._cellAddonOptions)==null?void 0:a.formatter)=="function"&&this.renderTooltipFormatter(this._cellAddonOptions.formatter,u,g,m,p),typeof((h=this._cellAddonOptions)==null?void 0:h.asyncProcess)=="function"){const _=this._cellAddonOptions.asyncProcess(u.row,u.cell,f,m,p,this._grid);if(this._cellAddonOptions.asyncPostFormatter||console.error('[Slickgrid-Universal] when using "asyncProcess" with Custom Tooltip, you must also provide an "asyncPostFormatter" formatter.'),_ instanceof Promise)this._cancellablePromise=Jr(_),this._cancellablePromise.promise.then(b=>this.asyncProcessCallback(b,u,f,m,p)).catch(b=>{b instanceof ki||console.error(b)});else if((d=this._rxjs)!=null&&d.isObservable(_)){const b=this._rxjs;this._observable$=_.pipe(b.switchMap(C=>b.of(C))).subscribe(C=>this.asyncProcessCallback(C,u,f,m,p),C=>console.error(C))}}}}}}parseFormatterAndSanitize(e,t,i,s,n){if(typeof e=="function"){const o=e(t.row,t.cell,i,s,n,this._grid),l=Zt(o)?o:o.html||o.text;return this._grid.sanitizeHtmlString((l instanceof HTMLElement?l.textContent:l)||"")}else if(typeof e=="string")return this._grid.sanitizeHtmlString(e);return""}renderRegularTooltip(e,t,i,s,n){var d,c,u,p,m,f,g,_;const o=document.createElement("div");this._grid.applyHtmlCode(o,this.parseFormatterAndSanitize(e,t,i,s,n)),this._hasMultipleTooltips=(((d=this._cellNodeElm)==null?void 0:d.querySelectorAll(oi).length)||0)>1;let l;const a=(c=this._cellAddonOptions)!=null&&c.useRegularTooltipFromCellTextOnly||!this._mouseTarget?this._cellNodeElm:this._mouseTarget;let h=(s==null?void 0:s.toolTip)??"";h||(this._cellType==="slick-cell"&&a&&a.clientWidth<a.scrollWidth&&!((u=this._cellAddonOptions)!=null&&u.useRegularTooltipFromFormatterOnly)?(h=((p=a.textContent)==null?void 0:p.trim())??"",(m=this._cellAddonOptions)!=null&&m.tooltipTextMaxLength&&h.length>((f=this._cellAddonOptions)==null?void 0:f.tooltipTextMaxLength)&&(h=h.substring(0,this._cellAddonOptions.tooltipTextMaxLength-3)+"..."),l=a):((g=this._cellAddonOptions)!=null&&g.useRegularTooltipFromFormatterOnly?l=o.querySelector(oi):(l=Hi(a,un)?a:o.querySelector(oi),(!l||!Hi(l,un))&&a&&(l=a.querySelector(oi))),(l==null?void 0:l.style.display)==="none"||this._hasMultipleTooltips&&(!a||a===this._cellNodeElm)?h="":(!h||typeof e=="function"&&((_=this._cellAddonOptions)!=null&&_.useRegularTooltipFromFormatterOnly))&&(h=Hi(l,un)||""))),h!==""&&this.renderTooltipFormatter(e,t,i,s,n,h,l),this.swapAndClearTitleAttribute(l,h)}renderTooltipFormatter(e,t,i,s,n,o,l){var d,c,u,p,m,f,g,_,b;if(this._tooltipElm=v("div",{className:this.className}),this._tooltipBodyElm=v("div",{className:this.bodyClassName}),this._tooltipElm.classList.add(this.gridUid),this._tooltipElm.classList.add("l"+t.cell),this._tooltipElm.classList.add("r"+t.cell),(d=this.tooltipElm)==null||d.appendChild(this._tooltipBodyElm),i==null){const C=(c=this._cellNodeElm)==null?void 0:c.querySelector(oi);i=Hi(C,un)||i}let a=o||this.parseFormatterAndSanitize(e,t,i,s,n)||"";a=(u=this._cellAddonOptions)!=null&&u.tooltipTextMaxLength&&a.length>this._cellAddonOptions.tooltipTextMaxLength?a.substring(0,this._cellAddonOptions.tooltipTextMaxLength-3)+"...":a;let h="";!o||(p=this._cellAddonOptions)!=null&&p.renderRegularTooltipAsHtml?(h=this._grid.sanitizeHtmlString(a),this._grid.applyHtmlCode(this._tooltipBodyElm,h),this._tooltipBodyElm.style.whiteSpace=((m=this._cellAddonOptions)==null?void 0:m.whiteSpace)??this._defaultOptions.whiteSpace):(h=a||"",this._tooltipBodyElm.textContent=h,this._tooltipBodyElm.style.whiteSpace=((f=this._cellAddonOptions)==null?void 0:f.regularTooltipWhiteSpace)??this._defaultOptions.regularTooltipWhiteSpace),(g=this._cellAddonOptions)!=null&&g.maxHeight&&(this._tooltipElm.style.maxHeight=`${this._cellAddonOptions.maxHeight}px`),(_=this._cellAddonOptions)!=null&&_.maxWidth&&(this._tooltipElm.style.maxWidth=`${this._cellAddonOptions.maxWidth}px`),h.toString()&&(document.body.appendChild(this._tooltipElm),this.reposition(t),(b=this._cellAddonOptions)!=null&&b.hideArrow||this._tooltipElm.classList.add("tooltip-arrow"),this.swapAndClearTitleAttribute(l,a))}reposition(e){var t,i,s,n,o,l,a,h,d,c;if(this._tooltipElm){this._cellNodeElm=this._cellNodeElm||this._grid.getCellNode(e.row,e.cell);const u=me(this._cellNodeElm)||{top:0,left:0},p=this._cellNodeElm.offsetWidth,m=this._tooltipElm.getBoundingClientRect().height,f=this._tooltipElm.getBoundingClientRect().width,g=document.body.offsetWidth||window.innerWidth;let _=(u.top||0)-this._tooltipElm.offsetHeight-(((t=this._cellAddonOptions)==null?void 0:t.offsetTopBottom)??0),b=(u.left||0)-(((i=this._cellAddonOptions)==null?void 0:i.offsetRight)??0);const C=((s=this._cellAddonOptions)==null?void 0:s.position)??"auto";let E="";if(C==="center"?(b+=p/2-f/2+(((n=this._cellAddonOptions)==null?void 0:n.offsetRight)??0),E="top-center",this._tooltipElm.classList.remove("arrow-left-align","arrow-right-align"),this._tooltipElm.classList.add("arrow-center-align")):C==="right-align"||(C==="auto"||C!=="left-align")&&b+f>g?(E="right",b-=f-p-(((o=this._cellAddonOptions)==null?void 0:o.offsetLeft)??0),this._tooltipElm.classList.remove("arrow-center-align","arrow-left-align"),this._tooltipElm.classList.add("arrow-right-align")):(E="left",this._tooltipElm.classList.remove("arrow-center-align","arrow-right-align"),this._tooltipElm.classList.add("arrow-left-align")),C==="bottom"||(C==="auto"||C!=="top")&&m>Li(this._cellNodeElm).top?(_=(u.top||0)+(this.gridOptions.rowHeight??0)+(((l=this._cellAddonOptions)==null?void 0:l.offsetTopBottom)??0),E=`bottom-${E}`,this._tooltipElm.classList.remove("arrow-down"),this._tooltipElm.classList.add("arrow-up")):(E=`top-${E}`,this._tooltipElm.classList.remove("arrow-up"),this._tooltipElm.classList.add("arrow-down")),this._tooltipElm&&(this._hasMultipleTooltips||(a=this.cellAddonOptions)!=null&&a.repositionByMouseOverTarget)){const y=me(this._mouseTarget);E.includes("left")||E==="top-center"?b=y.left-(((h=this._addonOptions)==null?void 0:h.offsetArrow)??3):E.includes("right")&&(b=y.left-f+(((d=this._mouseTarget)==null?void 0:d.offsetWidth)??0)+(((c=this._addonOptions)==null?void 0:c.offsetArrow)??3))}this._tooltipElm.style.top=`${_}px`,this._tooltipElm.style.left=`${b}px`}}swapAndClearTitleAttribute(e,t){var n,o;let i;e&&(i=this._cellNodeElm&&(this._cellNodeElm.hasAttribute("title")&&this._cellNodeElm.getAttribute("title")?this._cellNodeElm:(n=this._cellNodeElm)==null?void 0:n.querySelector("[title]")));const s=e||this._cellNodeElm&&(this._cellNodeElm.hasAttribute("title")&&this._cellNodeElm.getAttribute("title")?this._cellNodeElm:(o=this._cellNodeElm)==null?void 0:o.querySelector("[title]"));s&&(s.setAttribute("data-slick-tooltip",t||""),s.hasAttribute("title")&&s.setAttribute("title",""),i!=null&&i.hasAttribute("title")&&i.setAttribute("title",""))}}function pn(r,e,t){return e<=r&&r<=t}function sh(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function Hm(r){for(var e=String(r),t=e.length,i=0,s=[];i<t;){var n=e.charCodeAt(i);if(n<55296||n>57343)s.push(n);else if(56320<=n&&n<=57343)s.push(65533);else if(55296<=n&&n<=56319)if(i===t-1)s.push(65533);else{var o=r.charCodeAt(i+1);if(56320<=o&&o<=57343){var l=n&1023,a=o&1023;s.push(65536+(l<<10)+a),i+=1}else s.push(65533)}i+=1}return s}var nh=-1;function rh(r){this.tokens=[].slice.call(r)}rh.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():nh},prepend:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.push(e.shift());else this.tokens.push(r)}};var Kr=-1,oh="utf-8";function mn(r,e){if(!(this instanceof mn))return new mn(r,e);if(r=r!==void 0?String(r).toLowerCase():oh,r!==oh)throw new Error("Encoding not supported. Only utf-8 is supported");e=sh(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mn.prototype={encode:function(e,t){e=e?String(e):"",t=sh(t),this._streaming||(this._encoder=new Vm(this._options)),this._streaming=!!t.stream;for(var i=[],s=new rh(Hm(e)),n;!s.endOfStream()&&(n=this._encoder.handler(s,s.read()),n!==Kr);)Array.isArray(n)?i.push.apply(i,n):i.push(n);if(!this._streaming){for(;n=this._encoder.handler(s,s.read()),n!==Kr;)Array.isArray(n)?i.push.apply(i,n):i.push(n);this._encoder=null}return new Uint8Array(i)}};function Vm(r){r.fatal,this.handler=function(e,t){if(t===nh)return Kr;if(pn(t,0,127))return t;var i,s;pn(t,128,2047)?(i=1,s=192):pn(t,2048,65535)?(i=2,s=224):pn(t,65536,1114111)&&(i=3,s=240);for(var n=[(t>>6*i)+s];i>0;){var o=t>>6*(i-1);n.push(128|o&63),i-=1}return n}}const Bm={delimiter:wt.comma,filename:"export",format:ve.csv,useUtf8WithBom:!0};class zm{constructor(){this._delimiter=",",this._exportQuoteWrapper="",this._fileFormat=ve.csv,this._lineCarriageReturn=`
28
+ ${s}`}}generateFiles(){return new Promise(e=>{const t={};this._generateCorePaths(t);for(let i=0,s=this.worksheets.length;i<s;i++)t[`/xl/worksheets/sheet${i+1}.xml`]=this.worksheets[i].toXML(),qt[this.worksheets[i].id]=`worksheets/sheet${i+1}.xml`,t[`/xl/worksheets/_rels/sheet${i+1}.xml.rels`]=this.worksheets[i].relations.toXML();return this._prepareFilesForPackaging(t),e(t)})}}function wm(r,e,t){const i={};return new Promise((s,n)=>{r.generateFiles().then(o=>{for(const[l,a]of Object.entries(o))i[l.substr(1)]=Ur(a);return mm(i,(t==null?void 0:t.zipOptions)||{},(l,a)=>{if(l){n(l);return}if(e==="Uint8Array")s(a);else{const h=(t==null?void 0:t.fileFormat)??"xlsx";let d=t==null?void 0:t.mimeType;d===void 0&&(d=h==="xls"?"application/vnd.ms-excel":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),s(new Blob([a],{type:d}))}})})})}function Tm(r,e,t){if((t==null?void 0:t.downloadType)==="node")throw new Error('[Excel-Builder-Vanilla] Please note that `downloadExcelFile()` is currently only supporting the "browser" download type at the moment.');const i=e.match(/.*\.xls$/)?"xls":"xlsx";return wm(r,"Blob",{...t,fileFormat:i}).then(s=>{Om(e,s)})}function Om(r,e){const t=document.createElement("a"),i=URL.createObjectURL(e);t&&document&&(t.textContent="download",t.href=i,t.setAttribute("download",r),t.style.visibility="hidden",document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(i))}const xm=(r,{excelFormatId:e})=>e!==void 0?{value:r,metadata:{style:e}}:r,Im=(r,{columnDef:e,excelFormatId:t,gridOptions:i})=>({value:typeof r=="string"&&/\d/g.test(r)?Rm(r,e,i):r,metadata:{style:t}});function Rm(r,e,t){let i=r;if(typeof r=="string"&&r){const s=yt("decimalSeparator",e,t,R.DEFAULT_NUMBER_DECIMAL_SEPARATOR),n=parseFloat(s===","?r.replace(/[^0-9,-]+/g,"").replace(",","."):r.replace(/[^\d.-]/g,""));i=isNaN(n)?r:n}return i}function Am(r,e,t,i,s=!0){const n=Ni(t);let o,l=xm;return n===S.number&&s&&(o=qr(r,e,t,i,"cell").excelFormat.id,l=Im),{excelFormatId:o,getDataValueParser:l}}function Pm(r,e){var t;return((t=r==null?void 0:r[e.groupType])==null?void 0:t[e.columnDef.field])??0}function km(r,e,t){var s;let i;if(t==="group")switch(r.groupTotalsFormatter){case ne.avgTotalsCurrency:case ne.avgTotalsDollar:case ne.sumTotalsCurrency:case ne.sumTotalsCurrencyColored:case ne.sumTotalsDollar:case ne.sumTotalsDollarBold:case ne.sumTotalsDollarColored:case ne.sumTotalsDollarColoredBold:i="currency";break;case ne.avgTotalsPercentage:i="percent";break;case ne.avgTotals:case ne.minTotals:case ne.maxTotals:case ne.sumTotals:case ne.sumTotalsColored:case ne.sumTotalsBold:default:i="decimal";break}else if(r.formatter===_e.multiple&&Array.isArray((s=r.params)==null?void 0:s.formatters)){i="decimal";for(const n of r.params.formatters)if(i=Ja(n),i!=="decimal")break}else i=Ja(r.formatter);return Se(r,e,i,t)}function Ja(r){let e;switch(r){case _e.currency:case _e.dollar:case _e.dollarColored:case _e.dollarColoredBold:e="currency";break;case _e.percent:case _e.percentComplete:case _e.percentCompleteBar:case _e.percentCompleteBarWithText:case _e.percentSymbol:e="percent";break;case _e.decimal:default:e="decimal";break}return e}function qr(r,e,t,i,s){var h,d;let n="",o=((h=t.groupTotalsExcelExportOptions)==null?void 0:h.groupType)||"",l;const a=Ni(t);if(s==="group")switch(t.groupTotalsFormatter){case ne.avgTotals:case ne.avgTotalsCurrency:case ne.avgTotalsDollar:case ne.avgTotalsPercentage:o="avg";break;case ne.minTotals:o="min";break;case ne.maxTotals:o="max";break;case ne.sumTotals:case ne.sumTotalsBold:case ne.sumTotalsColored:case ne.sumTotalsCurrency:case ne.sumTotalsCurrencyColored:case ne.sumTotalsDollar:case ne.sumTotalsDollarColoredBold:case ne.sumTotalsDollarColored:case ne.sumTotalsDollarBold:o="sum";break;default:l=e.numberFormat;break}else switch(a){case S.number:switch(t.formatter){case _e.multiple:if(Array.isArray((d=t.params)==null?void 0:d.formatters))for(const c of t.params.formatters){const{excelFormat:u}=qr(r,e,{...t,formatter:c},i,s);if(u!==e.numberFormat){l=u;break}}l||(l=e.numberFormat);break;case _e.currency:case _e.decimal:case _e.dollar:case _e.dollarColored:case _e.dollarColoredBold:case _e.percent:case _e.percentComplete:case _e.percentCompleteBar:case _e.percentCompleteBarWithText:case _e.percentSymbol:n=th(t,i,"cell");break;default:l=e.numberFormat;break}break}return!l&&(t.formatter||t.groupTotalsFormatter)&&(n=th(t,i,s,o),e.hasOwnProperty(n)||(e[n]=r.createFormat({format:n})),l=e[n]),{excelFormat:l,groupType:o}}function eh(r){const[e,t,i,s,n,o,l,a]=(r==null?void 0:r.match(/^([^\d(-]*)([(]?)([^\d]*)([-]?[\w]]?[\d\s]*[.,\d]*[\d]*[^)\s%]?)([^\d.,)]*)([)]?)([^\d]*)$/i))||[],h=(n||"").replace(/1/g,"0").replace(/[2]/g,"#");return[cn(t??""),i??"",cn(s??""),h,cn(o??""),l??"",cn(a??"")].join("").replace(",",",")}function th(r,e,t,i=""){let s="",n="",o="";const{minDecimal:l,maxDecimal:a,thousandSeparator:h}=km(r,e,t),c=parseFloat(`${h?"2220":"0"}.${Fm(l,a)}`);return t==="group"&&r.groupTotalsFormatter?(n=we(r.groupTotalsFormatter({[i]:{[r.field]:c}},r,e)),o=we(r.groupTotalsFormatter({[i]:{[r.field]:-c}},r,e))):r.formatter&&(n=we(r.formatter(0,0,c,r,{},e)),o=we(r.formatter(0,0,-c,r,{},e))),n&&o&&(s=eh(n)+";"+eh(o)),s}function cn(r){return r&&`"${r}"`}function Fm(r,e){return ih("1",r)+ih("2",e-r)}function ih(r,e){let t="";for(let i=0;i<e;i++)t+=r;return t}const Dm={filename:"export",format:ve.xlsx};class Mm{constructor(){this._fileFormat=ve.xlsx,this._columnHeaders=[],this._hasColumnTitlePreHeader=!1,this._hasGroupedItems=!1,this._pubSubService=null,this._regularCellExcelFormats={},this._groupTotalExcelFormats={},this.className="ExcelExportService"}get _datasetIdPropName(){var e;return((e=this._gridOptions)==null?void 0:e.datasetIdPropertyName)??"id"}get _dataView(){var e;return(e=this._grid)==null?void 0:e.getData()}get _gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())||{}}get stylesheet(){return this._stylesheet}get stylesheetFormats(){return this._stylesheetFormats}get groupTotalExcelFormats(){return this._groupTotalExcelFormats}get regularCellExcelFormats(){return this._regularCellExcelFormats}dispose(){var e;(e=this._pubSubService)==null||e.unsubscribeAll()}init(e,t){var i,s;if(this._grid=e,this._pubSubService=t.get("PubSubService"),this._locales=((i=this._gridOptions)==null?void 0:i.locales)??R.locales,this._translaterService=(s=this._gridOptions)==null?void 0:s.translater,this._gridOptions.enableTranslate&&(!this._translaterService||!this._translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })')}exportToExcel(e){var t;if(!this._grid||!this._dataView||!this._pubSubService)throw new Error('[Slickgrid-Universal] it seems that the SlickGrid & DataView objects and/or PubSubService are not initialized did you forget to enable the grid option flag "enableExcelExport"?');return(t=this._pubSubService)==null||t.publish("onBeforeExportToExcel",!0),this._excelExportOptions=de(!0,{},{...Dm,...this._gridOptions.excelExportOptions,...e}),this._fileFormat=this._excelExportOptions.format||ve.xlsx,this._regularCellExcelFormats={},this._groupTotalExcelFormats={},new Promise(i=>{const s={name:this._excelExportOptions.sheetName||"Sheet1"};this._workbook=new Em,this._sheet=this._workbook.createWorksheet(s),this._stylesheet=this._workbook.getStyleSheet();const n=this._stylesheet.createFormat({font:{bold:!0}}),o=this._stylesheet.createFormat({format:"@"}),l=this._stylesheet.createFormat({format:"0"});this._stylesheetFormats={boldFormat:n,numberFormat:l,stringFormat:o},this._sheet.setColumnFormats([n]);const a=this.getDataOutput();setTimeout(async()=>{var m,f,g,_;(f=(m=this._gridOptions)==null?void 0:m.excelExportOptions)!=null&&f.customExcelHeader&&this._gridOptions.excelExportOptions.customExcelHeader(this._workbook,this._sheet);const h=((g=this._grid)==null?void 0:g.getColumns())||[];this._sheet.setColumns(this.getColumnStyles(h));const d=this._sheet.data;let c=d;Array.isArray(d)&&Array.isArray(a)&&(c=this._sheet.data.concat(a)),this._sheet.setData(c),this._workbook.addWorksheet(this._sheet);let u=(_=this._excelExportOptions)==null?void 0:_.mimeType;u===void 0&&(u=this._fileFormat===ve.xls?"application/vnd.ms-excel":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");const p=`${this._excelExportOptions.filename}.${this._fileFormat}`;Tm(this._workbook,p,{mimeType:u}).then(()=>{var b;(b=this._pubSubService)==null||b.publish("onAfterExportToExcel",{filename:p,mimeType:u}),i(!0)})})})}getExcelColumnNameByIndex(e){const t="ZABCDEFGHIJKLMNOPQRSTUVWXY";let i=Math.floor(e/26);const s=Math.floor(e%26);return s===0&&i--,e>26?this.getExcelColumnNameByIndex(i)+t[s]:t[s]+""}getDataOutput(){var o,l;const e=((o=this._grid)==null?void 0:o.getColumns())||[],t=[],i=(l=this._gridOptions)==null?void 0:l.excelExportOptions,s=i==null?void 0:i.columnHeaderStyle;let n=this._stylesheetFormats.boldFormat.id;if(s&&(n=this._stylesheet.createFormat(s).id),this._gridOptions.createPreHeaderPanel&&this._gridOptions.showPreHeaderPanel&&!this._gridOptions.enableDraggableGrouping){const a=this._stylesheet.createFormat({alignment:{horizontal:"center"},font:{bold:!0}});t.push(this.getColumnGroupedHeaderTitlesData(e,{style:a==null?void 0:a.id})),this._hasColumnTitlePreHeader=!0}return t.push(this.getColumnHeaderData(e,{style:n})),this.pushAllGridRowDataToArray(t,e),t}getColumnStyles(e){var s,n;const t=this._dataView.getGrouping(),i=[];return Array.isArray(t)&&t.length>0&&i.push({bestFit:!0,columnStyles:((n=(s=this._gridOptions)==null?void 0:s.excelExportOptions)==null?void 0:n.customColumnWidth)??10}),e.forEach(o=>{var a,h,d;const l=o.excludeFromExport??!1;(o.width===void 0||o.width>0)&&!l&&i.push({bestFit:!0,width:((a=o.excelExportOptions)==null?void 0:a.width)??((d=(h=this._gridOptions)==null?void 0:h.excelExportOptions)==null?void 0:d.customColumnWidth)??10})}),i}getColumnGroupedHeaderTitlesData(e,t){let i=[];this._groupedColumnHeaders=this.getColumnGroupedHeaderTitles(e)||[],this._groupedColumnHeaders&&Array.isArray(this._groupedColumnHeaders)&&this._groupedColumnHeaders.length>0&&(i=this._groupedColumnHeaders.map(o=>({value:o.title,metadata:t})));let s=0;const n=this._groupedColumnHeaders.length;for(let o=0;o<n;o++)if(o+1===n||o+1<n&&this._groupedColumnHeaders[o].title!==this._groupedColumnHeaders[o+1].title){const l=this.getExcelColumnNameByIndex(s+1),a=this.getExcelColumnNameByIndex(o+1);this._sheet.mergeCells(`${l}1`,`${a}1`),s=o+1}return i}getColumnHeaderData(e,t){let i=[];this._columnHeaders=this.getColumnHeaders(e)||[],this._columnHeaders&&Array.isArray(this._columnHeaders)&&this._columnHeaders.length>0&&(i=this._columnHeaders.map(n=>({value:we(n.title),metadata:t})));const s=this.getGroupColumnTitle();return s&&i.unshift({value:s,metadata:t}),i}getGroupColumnTitle(){var i;let e=this._excelExportOptions.groupingColumnHeaderTitle;!e&&this._gridOptions.enableTranslate&&((i=this._translaterService)!=null&&i.translate)?e=this._translaterService.translate(`${ot(this._gridOptions)}GROUP_BY`):e||(e=this._locales&&this._locales.TEXT_GROUP_BY);const t=this._dataView.getGrouping();return Array.isArray(t)&&t.length>0?(this._hasGroupedItems=!0,e):(this._hasGroupedItems=!1,null)}getColumnGroupedHeaderTitles(e){const t=[];return e&&Array.isArray(e)&&e.forEach(i=>{var o;let s="";i.columnGroupKey&&this._gridOptions.enableTranslate&&((o=this._translaterService)!=null&&o.translate)?s=this._translaterService.translate(i.columnGroupKey):s=i.columnGroup||"";const n=i.excludeFromExport||!1;(i.width===void 0||i.width>0)&&!n&&t.push({key:i.field||i.id,title:s||""})}),t}getColumnHeaders(e){const t=[];return e&&Array.isArray(e)&&e.forEach(i=>{var o;let s="";(i.nameKey||i.nameKey)&&this._gridOptions.enableTranslate&&((o=this._translaterService)!=null&&o.translate)?s=this._translaterService.translate(i.nameKey||i.nameKey):s=gt(i.name||"","innerHTML")||Jt(i.field);const n=i.excludeFromExport||!1;(i.width===void 0||i.width>0)&&!n&&t.push({key:(i.field||i.id)+"",title:s})}),t}pushAllGridRowDataToArray(e,t){const i=this._dataView.getLength();for(let s=0;s<i;s++){const n=this._dataView.getItem(s);n&&!n.hasOwnProperty("getItem")&&(n[this._datasetIdPropName]!==null&&n[this._datasetIdPropName]!==void 0?e.push(this.readRegularRowData(t,s,n,s)):this._hasGroupedItems&&n.__groupTotals===void 0?e.push([this.readGroupedRowTitle(n)]):n.__groupTotals&&e.push(this.readGroupedTotalRows(t,n,s)))}return e}readRegularRowData(e,t,i,s){var c,u,p,m;let n=0;const o=[],l=e.length;let a=1,h=0;const d=this._dataView.getItemMetadata(t);for(let f=0;f<l;f++){const g=e[f];if(g.excludeFromExport)continue;this._hasGroupedItems&&n===0&&o.push("");let _=1,b;if(d!=null&&d.columns){const C=d.columns,E=C[g.id]||C[f];!isNaN(a)&&+a>1||a==="*"&&f>0||(a=(E==null?void 0:E.colspan)??1),a==="*"?_=e.length-f:(_=a,g.id in C&&(b=g.id,h=f))}if(a==="*"&&f>0||!isNaN(a)&&+a>1&&g.id!==b){const C=t+(this._hasColumnTitlePreHeader?3:2);if(typeof a=="number"&&_-1===1){const E=this.getExcelColumnNameByIndex(h+1),y=this.getExcelColumnNameByIndex(f+1);this._sheet.mergeCells(`${E}${C}`,`${y}${C}`),o.push("")}else if(a==="*"&&_===1){const E=this.getExcelColumnNameByIndex(f+1);this._sheet.mergeCells(`A${C}`,`${E}${C}`)}else o.push("");typeof a=="number"&&!isNaN(a)&&+a>1&&(_=a--)}else{let C="";const E=Ni(g),y={...this._excelExportOptions};if(g.exportWithFormatter!==!1&&_n(E)&&(y.exportWithFormatter=!0),C=ur(t,f,g,i,this._grid,y),!this._regularCellExcelFormats.hasOwnProperty(g.id)){const O=((c=g.excelExportOptions)==null?void 0:c.autoDetectCellFormat)??((u=this._excelExportOptions)==null?void 0:u.autoDetectCellFormat),I=Am(this._stylesheet,this._stylesheetFormats,g,this._grid,O);(p=g.excelExportOptions)!=null&&p.style&&(I.excelFormatId=this._stylesheet.createFormat(g.excelExportOptions.style).id),(m=g.excelExportOptions)!=null&&m.valueParserCallback&&(I.getDataValueParser=g.excelExportOptions.valueParserCallback),this._regularCellExcelFormats[g.id]=I}typeof C=="string"&&(g.sanitizeDataExport||this._excelExportOptions.sanitizeDataExport)&&(C=we(C));const{excelFormatId:T,getDataValueParser:x}=this._regularCellExcelFormats[g.id];C=x(C,{columnDef:g,excelFormatId:T,stylesheet:this._stylesheet,gridOptions:this._gridOptions,dataRowIdx:s,dataContext:i}),o.push(C),n++}}return o}readGroupedRowTitle(e){const t=we(e.title);if(this._excelExportOptions&&this._excelExportOptions.addGroupIndentation){const i=this._excelExportOptions&&this._excelExportOptions.groupCollapsedSymbol||"⮞",s=this._excelExportOptions&&this._excelExportOptions.groupExpandedSymbol||"⮟";return(e.collapsed?i:s)+" "+Vi(5*e.level)+t}return t}readGroupedTotalRows(e,t,i){const n=[this._excelExportOptions.groupingAggregatorRowText||""];return e.forEach(o=>{var c,u,p,m,f,g,_;let l="";const a=Ni(o),h=o.excludeFromExport||!1;if(o.exportCustomGroupTotalsFormatter){const b=o.exportCustomGroupTotalsFormatter(t,o,this._grid);l=b instanceof HTMLElement?b.textContent||"":b}const d=((c=o.excelExportOptions)==null?void 0:c.autoDetectCellFormat)??((u=this._excelExportOptions)==null?void 0:u.autoDetectCellFormat);if(a===S.number&&d!==!1){let b=this._groupTotalExcelFormats[o.id];b!=null&&b.groupType||(b=qr(this._stylesheet,this._stylesheetFormats,o,this._grid,"group"),(p=o.groupTotalsExcelExportOptions)!=null&&p.style&&(b.excelFormat=this._stylesheet.createFormat(o.groupTotalsExcelExportOptions.style)),this._groupTotalExcelFormats[o.id]=b);const C=((m=o.groupTotalsExcelExportOptions)==null?void 0:m.valueParserCallback)??Pm;if(((f=t[b.groupType])==null?void 0:f[o.field])!==void 0){const E=C(t,{columnDef:o,groupType:b.groupType,excelFormatId:(g=b.excelFormat)==null?void 0:g.id,stylesheet:this._stylesheet,dataRowIdx:i});l=typeof E=="object"&&E.hasOwnProperty("metadata")?E:l={value:E,metadata:{style:(_=b.excelFormat)==null?void 0:_.id}}}}else if(o.groupTotalsFormatter){const b=o.groupTotalsFormatter(t,o,this._grid);l=b instanceof HTMLElement?b.textContent||"":b}typeof l=="string"&&(o.sanitizeDataExport||this._excelExportOptions.sanitizeDataExport)&&(l=we(l)),(o.width===void 0||o.width>0)&&!h&&n.push(l)}),n}}const un=["title","data-slick-tooltip"],oi="[title], [data-slick-tooltip]",Nm="slick-custom-tooltip";class Lm{constructor(){this.name="CustomTooltip",this._cellType="slick-cell",this._rxjs=null,this._sharedService=null,this._mousePosition={x:0,y:0},this._hasMultipleTooltips=!1,this._defaultOptions={bodyClassName:"tooltip-body",className:"",offsetArrow:3,offsetLeft:0,offsetRight:0,offsetTopBottom:4,hideArrow:!1,regularTooltipWhiteSpace:"pre-line",whiteSpace:"normal"},this._eventHandler=new pe}get addonOptions(){return this._addonOptions}get cancellablePromise(){return this._cancellablePromise}get cellAddonOptions(){return this._cellAddonOptions}get bodyClassName(){var e;return((e=this._cellAddonOptions)==null?void 0:e.bodyClassName)??"tooltip-body"}get className(){var t;let e=Nm;return(t=this._addonOptions)!=null&&t.className&&(e+=` ${this._addonOptions.className}`),e}get dataView(){return this._grid.getData()||{}}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())||{}}get gridUid(){var e;return((e=this._grid)==null?void 0:e.getUID())||""}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}get tooltipElm(){return this._tooltipElm}addRxJsResource(e){this._rxjs=e}init(e,t){var i,s;this._grid=e,this._rxjs=t.get("RxJsFacade"),this._sharedService=t.get("SharedService"),this._addonOptions={...this._defaultOptions,...(s=(i=this._sharedService)==null?void 0:i.gridOptions)==null?void 0:s.customTooltip},this._eventHandler.subscribe(e.onMouseEnter,this.handleOnMouseOver.bind(this)).subscribe(e.onHeaderMouseOver,(n,o)=>this.handleOnHeaderMouseOverByType(n,o,"slick-header-column")).subscribe(e.onHeaderRowMouseEnter,(n,o)=>this.handleOnHeaderMouseOverByType(n,o,"slick-headerrow-column")).subscribe(e.onHeaderRowMouseOver,(n,o)=>this.handleOnHeaderMouseOverByType(n,o,"slick-headerrow-column")).subscribe(e.onMouseLeave,this.hideTooltip.bind(this)).subscribe(e.onHeaderMouseOut,this.hideTooltip.bind(this)).subscribe(e.onHeaderRowMouseLeave,this.hideTooltip.bind(this)).subscribe(e.onHeaderRowMouseOut,this.hideTooltip.bind(this))}dispose(){this.hideTooltip(),this._cancellablePromise=void 0,this._eventHandler.unsubscribeAll()}hideTooltip(){var i,s;(i=this._cancellablePromise)==null||i.cancel(),(s=this._observable$)==null||s.unsubscribe();const e=he(this.className).join("."),t=document.body.querySelector(`.${e}${this.gridUidSelector}`);t==null||t.remove()}getOptions(){return this._addonOptions}setOptions(e){this._addonOptions={...this._addonOptions,...e}}asyncProcessCallback(e,t,i,s,n){var l,a;this.hideTooltip();const o={...n,[((l=this.addonOptions)==null?void 0:l.asyncParamsPropName)??"__params"]:e};(a=this._cellAddonOptions)!=null&&a.useRegularTooltip?this.renderRegularTooltip(this._cellAddonOptions.asyncPostFormatter,t,i,s,o):this.renderTooltipFormatter(this._cellAddonOptions.asyncPostFormatter,t,i,s,o)}handleOnHeaderMouseOverByType(e,t,i){var a,h,d,c;this._cellType=i,this._mousePosition={x:e.clientX||0,y:e.clientY||0},this._mouseTarget=(a=document.elementFromPoint(e.clientX||0,e.clientY||0))==null?void 0:a.closest(oi),this.hideTooltip();const s={row:-1,cell:this._grid.getColumns().findIndex(u=>{var p;return(((p=t==null?void 0:t.column)==null?void 0:p.id)??"")===u.id})},n=t.column,o={},l=i==="slick-headerrow-column";if(t||(t={}),t.cell=s.cell,t.row=s.row,t.columnDef=n,t.dataContext=o,t.grid=this._grid,t.type=l?"header-row":"header",this._cellAddonOptions={...this._addonOptions,...n==null?void 0:n.customTooltip},!(n!=null&&n.disableTooltip||typeof((h=this._cellAddonOptions)==null?void 0:h.usabilityOverride)=="function"&&!this._cellAddonOptions.usabilityOverride(t))&&n&&e.target){this._cellNodeElm=e.target.closest(`.${i}`);const u=l?this._cellAddonOptions.headerRowFormatter:this._cellAddonOptions.headerFormatter;if((d=this._cellAddonOptions)!=null&&d.useRegularTooltip||!u){const p=l?(c=this._cellAddonOptions)!=null&&c.useRegularTooltip?null:u:n.name;this.renderRegularTooltip(p,s,null,n,o)}else this._cellNodeElm&&typeof u=="function"&&this.renderTooltipFormatter(u,s,null,n,o)}}async handleOnMouseOver(e){var t,i,s,n,o,l,a,h,d;if(this._cellType="slick-cell",this._mousePosition={x:e.clientX||0,y:e.clientY||0},this._mouseTarget=(t=document.elementFromPoint(e.clientX||0,e.clientY||0))==null?void 0:t.closest(oi),this.hideTooltip(),e&&this._grid){const c=(s=(i=e==null?void 0:e.target)==null?void 0:i.closest(".slick-cell"))==null?void 0:s.className,u=c&&/l\d+/.exec(c||"")?this._grid.getCellFromEvent(e):null;if(u){const p=this.dataView?this.dataView.getItem(u.row):this._grid.getDataItem(u.row),m=this._grid.getColumns()[u.cell];if(this._cellNodeElm=this._grid.getCellNode(u.row,u.cell),p&&m){if(this._cellAddonOptions={...this._addonOptions,...m==null?void 0:m.customTooltip},m!=null&&m.disableTooltip||typeof((n=this._cellAddonOptions)==null?void 0:n.usabilityOverride)=="function"&&!this._cellAddonOptions.usabilityOverride({cell:u.cell,row:u.row,dataContext:p,column:m,grid:this._grid,type:"cell"}))return;const f=p.hasOwnProperty(m.field)?p[m.field]:null,g=this._grid.getEditorLock().isActive()?null:f;if(this._cellAddonOptions.useRegularTooltip&&!((o=this._cellAddonOptions)!=null&&o.asyncProcess)||!((l=this._cellAddonOptions)!=null&&l.formatter))this.renderRegularTooltip(m.formatter,u,g,m,p);else if(typeof((a=this._cellAddonOptions)==null?void 0:a.formatter)=="function"&&this.renderTooltipFormatter(this._cellAddonOptions.formatter,u,g,m,p),typeof((h=this._cellAddonOptions)==null?void 0:h.asyncProcess)=="function"){const _=this._cellAddonOptions.asyncProcess(u.row,u.cell,f,m,p,this._grid);if(this._cellAddonOptions.asyncPostFormatter||console.error('[Slickgrid-Universal] when using "asyncProcess" with Custom Tooltip, you must also provide an "asyncPostFormatter" formatter.'),_ instanceof Promise)this._cancellablePromise=Jr(_),this._cancellablePromise.promise.then(b=>this.asyncProcessCallback(b,u,f,m,p)).catch(b=>{b instanceof ki||console.error(b)});else if((d=this._rxjs)!=null&&d.isObservable(_)){const b=this._rxjs;this._observable$=_.pipe(b.switchMap(C=>b.of(C))).subscribe(C=>this.asyncProcessCallback(C,u,f,m,p),C=>console.error(C))}}}}}}parseFormatterAndSanitize(e,t,i,s,n){if(typeof e=="function"){const o=e(t.row,t.cell,i,s,n,this._grid),l=Zt(o)?o:o.html||o.text;return this._grid.sanitizeHtmlString((l instanceof HTMLElement?l.textContent:l)||"")}else if(typeof e=="string")return this._grid.sanitizeHtmlString(e);return""}renderRegularTooltip(e,t,i,s,n){var d,c,u,p,m,f,g,_;const o=document.createElement("div");this._grid.applyHtmlCode(o,this.parseFormatterAndSanitize(e,t,i,s,n)),this._hasMultipleTooltips=(((d=this._cellNodeElm)==null?void 0:d.querySelectorAll(oi).length)||0)>1;let l;const a=(c=this._cellAddonOptions)!=null&&c.useRegularTooltipFromCellTextOnly||!this._mouseTarget?this._cellNodeElm:this._mouseTarget;let h=(s==null?void 0:s.toolTip)??"";h||(this._cellType==="slick-cell"&&a&&a.clientWidth<a.scrollWidth&&!((u=this._cellAddonOptions)!=null&&u.useRegularTooltipFromFormatterOnly)?(h=((p=a.textContent)==null?void 0:p.trim())??"",(m=this._cellAddonOptions)!=null&&m.tooltipTextMaxLength&&h.length>((f=this._cellAddonOptions)==null?void 0:f.tooltipTextMaxLength)&&(h=h.substring(0,this._cellAddonOptions.tooltipTextMaxLength-3)+"..."),l=a):((g=this._cellAddonOptions)!=null&&g.useRegularTooltipFromFormatterOnly?l=o.querySelector(oi):(l=Hi(a,un)?a:o.querySelector(oi),(!l||!Hi(l,un))&&a&&(l=a.querySelector(oi))),(l==null?void 0:l.style.display)==="none"||this._hasMultipleTooltips&&(!a||a===this._cellNodeElm)?h="":(!h||typeof e=="function"&&((_=this._cellAddonOptions)!=null&&_.useRegularTooltipFromFormatterOnly))&&(h=Hi(l,un)||""))),h!==""&&this.renderTooltipFormatter(e,t,i,s,n,h,l),this.swapAndClearTitleAttribute(l,h)}renderTooltipFormatter(e,t,i,s,n,o,l){var d,c,u,p,m,f,g,_,b;if(this._tooltipElm=v("div",{className:this.className}),this._tooltipBodyElm=v("div",{className:this.bodyClassName}),this._tooltipElm.classList.add(this.gridUid),this._tooltipElm.classList.add("l"+t.cell),this._tooltipElm.classList.add("r"+t.cell),(d=this.tooltipElm)==null||d.appendChild(this._tooltipBodyElm),i==null){const C=(c=this._cellNodeElm)==null?void 0:c.querySelector(oi);i=Hi(C,un)||i}let a=o||this.parseFormatterAndSanitize(e,t,i,s,n)||"";a=(u=this._cellAddonOptions)!=null&&u.tooltipTextMaxLength&&a.length>this._cellAddonOptions.tooltipTextMaxLength?a.substring(0,this._cellAddonOptions.tooltipTextMaxLength-3)+"...":a;let h="";!o||(p=this._cellAddonOptions)!=null&&p.renderRegularTooltipAsHtml?(h=this._grid.sanitizeHtmlString(a),this._grid.applyHtmlCode(this._tooltipBodyElm,h),this._tooltipBodyElm.style.whiteSpace=((m=this._cellAddonOptions)==null?void 0:m.whiteSpace)??this._defaultOptions.whiteSpace):(h=a||"",this._tooltipBodyElm.textContent=h,this._tooltipBodyElm.style.whiteSpace=((f=this._cellAddonOptions)==null?void 0:f.regularTooltipWhiteSpace)??this._defaultOptions.regularTooltipWhiteSpace),(g=this._cellAddonOptions)!=null&&g.maxHeight&&(this._tooltipElm.style.maxHeight=`${this._cellAddonOptions.maxHeight}px`),(_=this._cellAddonOptions)!=null&&_.maxWidth&&(this._tooltipElm.style.maxWidth=`${this._cellAddonOptions.maxWidth}px`),h.toString()&&(document.body.appendChild(this._tooltipElm),this.reposition(t),(b=this._cellAddonOptions)!=null&&b.hideArrow||this._tooltipElm.classList.add("tooltip-arrow"),this.swapAndClearTitleAttribute(l,a))}reposition(e){var t,i,s,n,o,l,a,h,d,c;if(this._tooltipElm){this._cellNodeElm=this._cellNodeElm||this._grid.getCellNode(e.row,e.cell);const u=me(this._cellNodeElm)||{top:0,left:0},p=this._cellNodeElm.offsetWidth,m=this._tooltipElm.getBoundingClientRect().height,f=this._tooltipElm.getBoundingClientRect().width,g=document.body.offsetWidth||window.innerWidth;let _=(u.top||0)-this._tooltipElm.offsetHeight-(((t=this._cellAddonOptions)==null?void 0:t.offsetTopBottom)??0),b=(u.left||0)-(((i=this._cellAddonOptions)==null?void 0:i.offsetRight)??0);const C=((s=this._cellAddonOptions)==null?void 0:s.position)??"auto";let E="";if(C==="center"?(b+=p/2-f/2+(((n=this._cellAddonOptions)==null?void 0:n.offsetRight)??0),E="top-center",this._tooltipElm.classList.remove("arrow-left-align","arrow-right-align"),this._tooltipElm.classList.add("arrow-center-align")):C==="right-align"||(C==="auto"||C!=="left-align")&&b+f>g?(E="right",b-=f-p-(((o=this._cellAddonOptions)==null?void 0:o.offsetLeft)??0),this._tooltipElm.classList.remove("arrow-center-align","arrow-left-align"),this._tooltipElm.classList.add("arrow-right-align")):(E="left",this._tooltipElm.classList.remove("arrow-center-align","arrow-right-align"),this._tooltipElm.classList.add("arrow-left-align")),C==="bottom"||(C==="auto"||C!=="top")&&m>Li(this._cellNodeElm).top?(_=(u.top||0)+(this.gridOptions.rowHeight??0)+(((l=this._cellAddonOptions)==null?void 0:l.offsetTopBottom)??0),E=`bottom-${E}`,this._tooltipElm.classList.remove("arrow-down"),this._tooltipElm.classList.add("arrow-up")):(E=`top-${E}`,this._tooltipElm.classList.remove("arrow-up"),this._tooltipElm.classList.add("arrow-down")),this._tooltipElm&&(this._hasMultipleTooltips||(a=this.cellAddonOptions)!=null&&a.repositionByMouseOverTarget)){const y=me(this._mouseTarget);E.includes("left")||E==="top-center"?b=y.left-(((h=this._addonOptions)==null?void 0:h.offsetArrow)??3):E.includes("right")&&(b=y.left-f+(((d=this._mouseTarget)==null?void 0:d.offsetWidth)??0)+(((c=this._addonOptions)==null?void 0:c.offsetArrow)??3))}this._tooltipElm.style.top=`${_}px`,this._tooltipElm.style.left=`${b}px`}}swapAndClearTitleAttribute(e,t){var n,o;let i;e&&(i=this._cellNodeElm&&(this._cellNodeElm.hasAttribute("title")&&this._cellNodeElm.getAttribute("title")?this._cellNodeElm:(n=this._cellNodeElm)==null?void 0:n.querySelector("[title]")));const s=e||this._cellNodeElm&&(this._cellNodeElm.hasAttribute("title")&&this._cellNodeElm.getAttribute("title")?this._cellNodeElm:(o=this._cellNodeElm)==null?void 0:o.querySelector("[title]"));s&&(s.setAttribute("data-slick-tooltip",t||""),s.hasAttribute("title")&&s.setAttribute("title",""),i!=null&&i.hasAttribute("title")&&i.setAttribute("title",""))}}function pn(r,e,t){return e<=r&&r<=t}function sh(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function Hm(r){for(var e=String(r),t=e.length,i=0,s=[];i<t;){var n=e.charCodeAt(i);if(n<55296||n>57343)s.push(n);else if(56320<=n&&n<=57343)s.push(65533);else if(55296<=n&&n<=56319)if(i===t-1)s.push(65533);else{var o=r.charCodeAt(i+1);if(56320<=o&&o<=57343){var l=n&1023,a=o&1023;s.push(65536+(l<<10)+a),i+=1}else s.push(65533)}i+=1}return s}var nh=-1;function rh(r){this.tokens=[].slice.call(r)}rh.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():nh},prepend:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.push(e.shift());else this.tokens.push(r)}};var Kr=-1,oh="utf-8";function mn(r,e){if(!(this instanceof mn))return new mn(r,e);if(r=r!==void 0?String(r).toLowerCase():oh,r!==oh)throw new Error("Encoding not supported. Only utf-8 is supported");e=sh(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mn.prototype={encode:function(e,t){e=e?String(e):"",t=sh(t),this._streaming||(this._encoder=new Vm(this._options)),this._streaming=!!t.stream;for(var i=[],s=new rh(Hm(e)),n;!s.endOfStream()&&(n=this._encoder.handler(s,s.read()),n!==Kr);)Array.isArray(n)?i.push.apply(i,n):i.push(n);if(!this._streaming){for(;n=this._encoder.handler(s,s.read()),n!==Kr;)Array.isArray(n)?i.push.apply(i,n):i.push(n);this._encoder=null}return new Uint8Array(i)}};function Vm(r){r.fatal,this.handler=function(e,t){if(t===nh)return Kr;if(pn(t,0,127))return t;var i,s;pn(t,128,2047)?(i=1,s=192):pn(t,2048,65535)?(i=2,s=224):pn(t,65536,1114111)&&(i=3,s=240);for(var n=[(t>>6*i)+s];i>0;){var o=t>>6*(i-1);n.push(128|o&63),i-=1}return n}}const Bm={delimiter:wt.comma,filename:"export",format:ve.csv,useUtf8WithBom:!0};class zm{constructor(){this._delimiter=",",this._exportQuoteWrapper="",this._fileFormat=ve.csv,this._lineCarriageReturn=`
29
29
  `,this._columnHeaders=[],this._hasGroupedItems=!1,this.className="TextExportService"}get _datasetIdPropName(){return this._gridOptions&&this._gridOptions.datasetIdPropertyName||"id"}get _dataView(){var e;return(e=this._grid)==null?void 0:e.getData()}get _gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}dispose(){var e;(e=this._pubSubService)==null||e.unsubscribeAll()}init(e,t){var i;if(this._grid=e,this._pubSubService=t.get("PubSubService"),this._locales=this._gridOptions&&this._gridOptions.locales||R.locales,this._translaterService=(i=this._gridOptions)==null?void 0:i.translater,this._gridOptions.enableTranslate&&(!this._translaterService||!this._translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })')}exportToFile(e){if(!this._grid||!this._dataView||!this._pubSubService)throw new Error('[Slickgrid-Universal] it seems that the SlickGrid & DataView objects and/or PubSubService are not initialized did you forget to enable the grid option flag "enableTextExport"?');return new Promise(t=>{var s;(s=this._pubSubService)==null||s.publish("onBeforeExportToTextFile",!0),this._exportOptions=de(!0,{},{...Bm,...this._gridOptions.textExportOptions,...e}),this._delimiter=this._exportOptions.delimiterOverride||this._exportOptions.delimiter||"",this._fileFormat=this._exportOptions.format||ve.csv;const i=this.getDataOutput();setTimeout(()=>{var o;const n={filename:`${this._exportOptions.filename}.${this._fileFormat}`,format:this._fileFormat||ve.csv,mimeType:this._exportOptions.mimeType||"text/plain",useUtf8WithBom:this._exportOptions&&this._exportOptions.hasOwnProperty("useUtf8WithBom")?this._exportOptions.useUtf8WithBom:!0};this.startDownloadFile({...n,content:i}),(o=this._pubSubService)==null||o.publish("onAfterExportToTextFile",n),t(!0)},0)})}startDownloadFile(e){const t=lo(e.content);let i;e.format===ve.csv?i=new mn("utf-8").encode(t):i=t;const s=new Blob([e.useUtf8WithBom?"\uFEFF":"",i],{type:e.mimeType});if(typeof navigator.msSaveOrOpenBlob=="function")navigator.msSaveOrOpenBlob(s,e.filename);else{const n=document.createElement("a"),o=URL.createObjectURL(s);n.textContent="download",n.href=o,n.setAttribute("download",e.filename),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n)}}getDataOutput(){var n,o,l;const e=this._grid.getColumns()||[];let t=this._exportOptions.groupingColumnHeaderTitle;!t&&this._gridOptions.enableTranslate&&((n=this._translaterService)!=null&&n.translate)&&((l=(o=this._translaterService)==null?void 0:o.getCurrentLanguage)!=null&&l.call(o))?t=this._translaterService.translate(`${ot(this._gridOptions)}GROUP_BY`):t||(t=this._locales&&this._locales.TEXT_GROUP_BY),this._exportQuoteWrapper=this._fileFormat===ve.csv?'"':"";let i="";const s=this._dataView.getGrouping();if(s&&Array.isArray(s)&&s.length>0?(this._hasGroupedItems=!0,i+=this._fileFormat===ve.csv?`"${t}"${this._delimiter}`:`${t}${this._delimiter}`):this._hasGroupedItems=!1,this._gridOptions.createPreHeaderPanel&&this._gridOptions.showPreHeaderPanel&&!this._gridOptions.enableDraggableGrouping&&(this._groupedColumnHeaders=this.getColumnGroupedHeaderTitles(e)||[],this._groupedColumnHeaders&&Array.isArray(this._groupedColumnHeaders)&&this._groupedColumnHeaders.length>0)){const a=this._groupedColumnHeaders.map(h=>`${this._exportQuoteWrapper}${h.title}${this._exportQuoteWrapper}`);i+=a.join(this._delimiter)+this._lineCarriageReturn}if(this._columnHeaders=this.getColumnHeaders(e)||[],this._columnHeaders&&Array.isArray(this._columnHeaders)&&this._columnHeaders.length>0){const a=this._columnHeaders.map(h=>we(`${this._exportQuoteWrapper}${h.title}${this._exportQuoteWrapper}`));i+=a.join(this._delimiter)+this._lineCarriageReturn}return i+=this.getAllGridRowData(e,this._lineCarriageReturn),i}getAllGridRowData(e,t){const i=[],s=this._dataView.getLength();for(let n=0;n<s;n++){const o=this._dataView.getItem(n);o&&!o.hasOwnProperty("getItem")&&(o[this._datasetIdPropName]!==null&&o[this._datasetIdPropName]!==void 0?i.push(this.readRegularRowData(e,n,o)):this._hasGroupedItems&&o.__groupTotals===void 0?i.push(this.readGroupedTitleRow(o)):o.__groupTotals&&i.push(this.readGroupedTotalRow(e,o)))}return i.join(t)}getColumnGroupedHeaderTitles(e){const t=[];return e&&Array.isArray(e)&&e.forEach(i=>{var o,l,a;let s="";i.columnGroupKey&&this._gridOptions.enableTranslate&&((o=this._translaterService)!=null&&o.translate)&&((a=(l=this._translaterService)==null?void 0:l.getCurrentLanguage)!=null&&a.call(l))?s=this._translaterService.translate(i.columnGroupKey):s=i.columnGroup||"";const n=i.excludeFromExport||!1;(i.width===void 0||i.width>0)&&!n&&t.push({key:i.field||i.id,title:s||""})}),t}getColumnHeaders(e){const t=[];return e&&Array.isArray(e)&&e.forEach(i=>{var o,l,a;let s="";(i.nameKey||i.nameKey)&&this._gridOptions.enableTranslate&&((o=this._translaterService)!=null&&o.translate)&&((a=(l=this._translaterService)==null?void 0:l.getCurrentLanguage)!=null&&a.call(l))?s=this._translaterService.translate(i.nameKey||i.nameKey):s=gt(i.name||"","innerHTML")||Jt(i.field);const n=i.excludeFromExport||!1;(i.width===void 0||i.width>0)&&!n&&t.push({key:i.field||i.id,title:s||""})}),t}readRegularRowData(e,t,i){let s=0;const n=[],o=this._exportQuoteWrapper;let l=1;const a=this._dataView.getItemMetadata(t);for(let h=0,d=e.length;h<d;h++){const c=e[h];if(c.excludeFromExport)continue;if(this._hasGroupedItems&&s===0){const p=this._fileFormat===ve.csv?'""':"";n.push(p)}let u;if(a!=null&&a.columns){const p=a==null?void 0:a.columns,m=p[c.id]||p[h];!isNaN(l)&&+l>1||l==="*"&&h>0||(l=(m==null?void 0:m.colspan)??1),l!=="*"&&c.id in p&&(u=c.id)}if(l==="*"&&h>0||!isNaN(l)&&+l>1&&c.id!==u)n.push(""),!isNaN(l)&&+l>1&&l--;else{let p=ur(t,h,c,i,this._grid,this._exportOptions);(c.sanitizeDataExport||this._exportOptions.sanitizeDataExport)&&(p=we(p)),this._fileFormat===ve.csv&&p&&(p=p.toString().replace(/"/gi,'""'));const m=c!=null&&c.exportCsvForceToKeepAsString?"=":"";n.push(m+o+p+o)}s++}return n.join(this._delimiter)}readGroupedTitleRow(e){let t=we(e.title);const i=this._exportQuoteWrapper;return t=Vi(5*e.level)+t,this._fileFormat===ve.csv&&(t=t.toString().replace(/"/gi,'""')),i+t+i}readGroupedTotalRow(e,t){const i=this._exportOptions.delimiter,s=this._exportOptions.format,n=this._exportOptions.groupingAggregatorRowText||"",o=this._exportQuoteWrapper,l=[`${o}${n}${o}`];return e.forEach(a=>{let h="";const d=a.excludeFromExport||!1;if(a.groupTotalsFormatter){const c=a.groupTotalsFormatter(t,a,this._grid);h=c instanceof HTMLElement?c.textContent||"":c}(a.sanitizeDataExport||this._exportOptions.sanitizeDataExport)&&(h=we(h)),s===ve.csv&&(h=h.toString().replace(/"/gi,'""')),(a.width===void 0||a.width>0)&&!d&&l.push(o+h+o)}),l.join(i)}}class $m{get eventHandler(){return this._eventHandler}get gridUid(){var e;return((e=this.grid)==null?void 0:e.getUID())??""}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get locales(){var e;return((e=this.gridOptions)==null?void 0:e.locales)??R.locales}set metrics(e){this.renderMetrics(e)}get leftFooterText(){var e;return((e=document.querySelector(`.slick-custom-footer${this.gridUidSelector} .left-footer`))==null?void 0:e.textContent)??""}set leftFooterText(e){this.renderLeftFooterText(e)}get rightFooterText(){var e;return((e=document.querySelector(`.slick-custom-footer${this.gridUidSelector} .right-footer`))==null?void 0:e.textContent)??""}set rightFooterText(e){this.renderRightFooterText(e)}constructor(e,t,i,s){var n,o,l,a,h;if(this.grid=e,this.customFooterOptions=t,this.pubSubService=i,this.translaterService=s,this._enableTranslate=!1,this._isLeftFooterOriginallyEmpty=!0,this._isLeftFooterDisplayingSelectionRowCount=!1,this._isRightFooterOriginallyEmpty=!0,this._selectedRowCount=0,this._subscriptions=[],this._bindingHelper=new Ho,this._bindingHelper.querySelectorPrefix=`.${this.gridUid} `,this._eventHandler=new pe,this._enableTranslate=((n=this.gridOptions)==null?void 0:n.enableTranslate)??!1,this._isLeftFooterOriginallyEmpty=!((o=this.gridOptions.customFooterOptions)!=null&&o.leftFooterText),this._isRightFooterOriginallyEmpty=!((l=this.gridOptions.customFooterOptions)!=null&&l.rightFooterText),this.registerOnSelectedRowsChangedWhenEnabled(t),this._enableTranslate&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');if(this.translateCustomFooterTexts(),this._enableTranslate&&((a=this.pubSubService)!=null&&a.subscribe)){const d=((h=this.translaterService)==null?void 0:h.eventName)??"onLanguageChange";this._subscriptions.push(this.pubSubService.subscribe(d,()=>this.translateCustomFooterTexts()))}}dispose(){var e;this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions),this._bindingHelper.dispose(),(e=this._footerElement)==null||e.remove()}renderFooter(e){this.translateCustomFooterTexts(),this.createFooterContainer(e)}renderMetrics(e){var i;const t=e!=null&&e.endTime?Qe(e.endTime,this.customFooterOptions.dateFormat,"en-US"):"";this._bindingHelper.setElementAttributeValue("span.last-update-timestamp","textContent",t),this._bindingHelper.setElementAttributeValue("span.item-count","textContent",e.itemCount),this._bindingHelper.setElementAttributeValue("span.total-count","textContent",e.totalItemCount),(i=this.customFooterOptions.metricTexts)!=null&&i.lastUpdate&&this._bindingHelper.addElementBinding(this.customFooterOptions.metricTexts,"lastUpdate","span.text-last-update","textContent"),this._bindingHelper.addElementBinding(this.customFooterOptions.metricTexts,"items","span.text-items","textContent"),this._bindingHelper.addElementBinding(this.customFooterOptions.metricTexts,"of","span.text-of","textContent")}renderLeftFooterText(e){this._bindingHelper.setElementAttributeValue("div.left-footer","textContent",e)}renderRightFooterText(e){this._bindingHelper.setElementAttributeValue("div.right-footer","textContent",e)}translateCustomFooterTexts(){var e,t,i,s,n;if(this.gridOptions.enableTranslate&&((e=this.translaterService)!=null&&e.translate)){this.customFooterOptions.metricTexts=this.customFooterOptions.metricTexts||{};for(const o of Object.keys(this.customFooterOptions.metricTexts))if(o.lastIndexOf("Key")>0){const l=o.substring(0,o.lastIndexOf("Key"));this.customFooterOptions.metricTexts[l]=this.translaterService.translate(this.customFooterOptions.metricTexts[o]||" ")}this._isLeftFooterDisplayingSelectionRowCount&&(this.leftFooterText=`${this._selectedRowCount} ${this.customFooterOptions.metricTexts.itemsSelected}`)}else this.locales&&(this.customFooterOptions.metricTexts=this.customFooterOptions.metricTexts||{},this.customFooterOptions.metricTexts.lastUpdate=this.customFooterOptions.metricTexts.lastUpdate||((t=this.locales)==null?void 0:t.TEXT_LAST_UPDATE)||"TEXT_LAST_UPDATE",this.customFooterOptions.metricTexts.items=this.customFooterOptions.metricTexts.items||((i=this.locales)==null?void 0:i.TEXT_ITEMS)||"TEXT_ITEMS",this.customFooterOptions.metricTexts.itemsSelected=this.customFooterOptions.metricTexts.itemsSelected||((s=this.locales)==null?void 0:s.TEXT_ITEMS_SELECTED)||"TEXT_ITEMS_SELECTED",this.customFooterOptions.metricTexts.of=this.customFooterOptions.metricTexts.of||((n=this.locales)==null?void 0:n.TEXT_OF)||"TEXT_OF")}createFooterContainer(e){const t=v("div",{className:`slick-custom-footer ${this.gridUid}`,style:{width:"100%",height:`${this.customFooterOptions.footerHeight||20}px`}}),i=v("div",{className:`left-footer ${this.customFooterOptions.leftContainerClass}`});this.grid.applyHtmlCode(i,this.customFooterOptions.leftFooterText),t.appendChild(i),t.appendChild(this.createFooterRightContainer()),this._footerElement=t,e!=null&&e.appendChild&&this._footerElement&&e.appendChild(this._footerElement)}createFooterRightContainer(){var t,i,s,n;const e=v("div",{className:`right-footer ${this.customFooterOptions.rightContainerClass||""}`});if(!this._isRightFooterOriginallyEmpty)this.grid.applyHtmlCode(e,this.customFooterOptions.rightFooterText);else if(!this.customFooterOptions.hideMetrics){e.classList.add("metrics");const o=v("span",{className:"timestamp"},e);if(!this.customFooterOptions.hideLastUpdateTimestamp){const l=this.createFooterLastUpdate();l&&o.appendChild(l)}e.appendChild(v("span",{className:"item-count",textContent:`${((t=this.metrics)==null?void 0:t.itemCount)??"0"}`})),this.customFooterOptions.hideTotalItemCount||(e.appendChild(document.createTextNode(`\r
30
30
  `)),e.appendChild(v("span",{className:"text-of",textContent:` ${((i=this.customFooterOptions.metricTexts)==null?void 0:i.of)??"of"} `})),e.appendChild(document.createTextNode(`\r
31
31
  `)),e.appendChild(v("span",{className:"total-count",textContent:`${((s=this.metrics)==null?void 0:s.totalItemCount)??"0"}`}))),e.appendChild(document.createTextNode(`\r
32
32
  `)),e.appendChild(v("span",{className:"text-items",textContent:` ${((n=this.customFooterOptions.metricTexts)==null?void 0:n.items)??"items"} `}))}return e}createFooterLastUpdate(){var s,n,o,l;const e=((n=(s=this.customFooterOptions)==null?void 0:s.metricTexts)==null?void 0:n.lastUpdate)??"Last Update",t=(o=this.metrics)!=null&&o.endTime?Qe((l=this.metrics)==null?void 0:l.endTime,this.customFooterOptions.dateFormat,"en-US"):"",i=v("span");return i.appendChild(v("span",{className:"text-last-update",textContent:e})),i.appendChild(document.createTextNode(`\r
33
- `)),i.appendChild(v("span",{className:"last-update-timestamp",textContent:t})),i.appendChild(v("span",{className:"separator",textContent:` ${this.customFooterOptions.metricSeparator||""} `})),i}registerOnSelectedRowsChangedWhenEnabled(e){var i,s;if((this.gridOptions.enableCheckboxSelector||this.gridOptions.enableRowSelection)&&e&&!e.hideRowSelectionCount&&this._isLeftFooterOriginallyEmpty){this._isLeftFooterDisplayingSelectionRowCount=!0;const n=((i=e.metricTexts)==null?void 0:i.itemsSelected)??((s=this.locales)==null?void 0:s.TEXT_ITEMS_SELECTED)??"TEXT_ITEMS_SELECTED";e.leftFooterText=`0 ${n}`,this._eventHandler.subscribe(this.grid.onSelectedRowsChanged,(o,l)=>{var h,d;this._selectedRowCount=l.rows.length;const a=((h=e.metricTexts)==null?void 0:h.itemsSelected)??((d=this.locales)==null?void 0:d.TEXT_ITEMS_SELECTED)??"TEXT_ITEMS_SELECTED";this.leftFooterText=`${this._selectedRowCount} ${a}`})}}}class Wm{constructor(){this.dependencies=[]}get(e){const t=this.dependencies.find(i=>i.key===e);return t!=null&&t.instance?t.instance:null}dispose(){this.dependencies=[]}registerInstance(e,t){this.dependencies.some(s=>s.key===e)||this.dependencies.push({key:e,instance:t})}}class lh{get eventHandler(){return this._eventHandler}get columnDefinitions(){return this._columnDefinitions||[]}set columnDefinitions(e){this._columnDefinitions=e,this._slickgridInitialized&&this.updateColumnDefinitionsList(this._columnDefinitions),e.length>0&&this.copyColumnWidthsReference(e)}get dataset(){var e;return((e=this.dataView)==null?void 0:e.getItems())||[]}set dataset(e){var o,l;const t=this._currentDatasetLength,i=ut(e,this.dataset||[]);let n=!!((o=this._gridOptions)!=null&&o.enableDeepCopyDatasetOnPageLoad)?de(!0,[],e):e;this.slickGrid&&((l=this.gridOptions)!=null&&l.enableTreeData)&&Array.isArray(e)&&(e.length>0||e.length!==t||!i)&&(this._isDatasetHierarchicalInitialized=!1,n=this.sortTreeDataset(e,!i)),this.refreshGridData(n||[]),this._currentDatasetLength=(e||[]).length,this.slickGrid&&this.gridOptions.autoFitColumnsOnFirstLoad&&t===0&&!this._isAutosizeColsCalled&&(this.slickGrid.autosizeColumns(),this._isAutosizeColsCalled=!0)}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}set datasetHierarchical(e){var s,n;const t=ut(e,this.sharedService.hierarchicalDataset||[]),i=this._currentDatasetLength;this.sharedService.hierarchicalDataset=e,e&&this.columnDefinitions&&((s=this.filterService)!=null&&s.clearFilters)&&this.filterService.clearFilters(),this.dataView&&e&&this.slickGrid&&((n=this.sortService)!=null&&n.processTreeDataInitialSort)&&(this.sortService.processTreeDataInitialSort(),queueMicrotask(()=>{var l;const o=((l=this.dataView)==null?void 0:l.getItemCount())??0;o>0&&(o!==i||!t)&&this.filterService.refreshTreeDataFilters()})),this._isDatasetHierarchicalInitialized=!0}set eventPubSubService(e){this._eventPubSubService=e}set isDatasetHierarchicalInitialized(e){this._isDatasetHierarchicalInitialized=e}get gridOptions(){return this._gridOptions||{}}set gridOptions(e){var i,s,n;let t;(i=this.slickGrid)!=null&&i.getOptions?t=de(!0,{},this.slickGrid.getOptions(),e):t=this.mergeGridOptions(e),(s=this.sharedService)!=null&&s.gridOptions&&((n=this.slickGrid)!=null&&n.setOptions)&&(this.sharedService.gridOptions=t,this.slickGrid.setOptions(t,!1,!0),this.slickGrid.reRenderColumns(!0)),this.setDarkMode(e.darkMode),this._gridOptions=t}get paginationOptions(){return this._paginationOptions}set paginationOptions(e){e&&this._paginationOptions?this._paginationOptions={...this._paginationOptions,...e}:this._paginationOptions=e,this.gridOptions.pagination=this._paginationOptions,this.paginationService.updateTotalItems((e==null?void 0:e.totalItems)??0,!0)}get isDatasetInitialized(){return this._isDatasetInitialized}set isDatasetInitialized(e){this._isDatasetInitialized=e}get isGridInitialized(){return this._isGridInitialized}get instances(){return this._slickerGridInstances}get extensions(){return this._extensions}get registeredResources(){return this._registeredResources}constructor(e,t,i,s,n,o){var d,c,u;if(this._currentDatasetLength=0,this._darkMode=!1,this._hideHeaderRowAfterPageLoad=!1,this._isAutosizeColsCalled=!1,this._isDatasetInitialized=!1,this._isDatasetHierarchicalInitialized=!1,this._isGridInitialized=!1,this._isLocalGrid=!0,this._isPaginationInitialized=!1,this._registeredResources=[],this._slickgridInitialized=!1,this.customDataView=!1,this.totalItems=0,this.subscriptions=[],this.showPagination=!1,e.querySelectorAll(".slickgrid-container").length!==0)return;e.classList.add("grid-pane"),this._gridParentContainerElm=e,this._gridContainerElm=document.createElement("div"),this._gridContainerElm.classList.add("slickgrid-container"),e.appendChild(this._gridContainerElm),this._hideHeaderRowAfterPageLoad=(i==null?void 0:i.showHeaderRow)===!1,this._columnDefinitions=t||[],this._columnDefinitions.length>0&&this.copyColumnWidthsReference(this._columnDefinitions),this._registeredResources=(i==null?void 0:i.externalResources)||[],this._gridOptions=this.mergeGridOptions(i||{});const l=!!((d=this._gridOptions)!=null&&d.enableDeepCopyDatasetOnPageLoad);this._gridOptions.darkMode&&this.setDarkMode(!0),this.universalContainerService=(o==null?void 0:o.universalContainerService)??new Wm,this.translaterService=(o==null?void 0:o.translaterService)??((c=this._gridOptions)==null?void 0:c.translater),this._eventPubSubService=(o==null?void 0:o.eventPubSubService)??new Lo(e),this._eventPubSubService.eventNamingStyle=((u=this._gridOptions)==null?void 0:u.eventNamingStyle)??ct.camelCase;const a=new Zp;this.backendUtilityService=(o==null?void 0:o.backendUtilityService)??new Zr,this.gridEventService=(o==null?void 0:o.gridEventService)??new gu,this.sharedService=(o==null?void 0:o.sharedService)??new xu,this.collectionService=(o==null?void 0:o.collectionService)??new Cl(this.translaterService),this.extensionUtility=(o==null?void 0:o.extensionUtility)??new pc(this.sharedService,this.backendUtilityService,this.translaterService),this.filterFactory=new op(a,this.translaterService,this.collectionService),this.filterService=(o==null?void 0:o.filterService)??new mu(this.filterFactory,this._eventPubSubService,this.sharedService,this.backendUtilityService),this.resizerService=(o==null?void 0:o.resizerService)??new Ou(this._eventPubSubService),this.sortService=(o==null?void 0:o.sortService)??new Iu(this.sharedService,this._eventPubSubService,this.backendUtilityService),this.treeDataService=(o==null?void 0:o.treeDataService)??new Ru(this._eventPubSubService,this.sharedService,this.sortService),this.paginationService=(o==null?void 0:o.paginationService)??new vu(this._eventPubSubService,this.sharedService,this.backendUtilityService),this.extensionService=(o==null?void 0:o.extensionService)??new su(this.extensionUtility,this.filterService,this._eventPubSubService,this.sharedService,this.sortService,this.treeDataService,this.translaterService,()=>this.gridService),this.gridStateService=(o==null?void 0:o.gridStateService)??new _u(this.extensionService,this.filterService,this._eventPubSubService,this.sharedService,this.sortService,this.treeDataService),this.gridService=(o==null?void 0:o.gridService)??new fu(this.gridStateService,this.filterService,this._eventPubSubService,this.paginationService,this.sharedService,this.sortService,this.treeDataService),this.groupingService=(o==null?void 0:o.groupingAndColspanService)??new Cu(this.extensionUtility,this._eventPubSubService),n&&(this.sharedService.hierarchicalDataset=(l?de(!0,[],n):n)||[]);const h=new pe;this.universalContainerService.registerInstance("PubSubService",this._eventPubSubService),this.universalContainerService.registerInstance("EventPubSubService",this._eventPubSubService),this.universalContainerService.registerInstance("ExtensionUtility",this.extensionUtility),this.universalContainerService.registerInstance("FilterService",this.filterService),this.universalContainerService.registerInstance("CollectionService",this.collectionService),this.universalContainerService.registerInstance("ExtensionService",this.extensionService),this.universalContainerService.registerInstance("GridEventService",this.gridEventService),this.universalContainerService.registerInstance("GridService",this.gridService),this.universalContainerService.registerInstance("GridStateService",this.gridStateService),this.universalContainerService.registerInstance("GroupingAndColspanService",this.groupingService),this.universalContainerService.registerInstance("PaginationService",this.paginationService),this.universalContainerService.registerInstance("ResizerService",this.resizerService),this.universalContainerService.registerInstance("SharedService",this.sharedService),this.universalContainerService.registerInstance("SortService",this.sortService),this.universalContainerService.registerInstance("TranslaterService",this.translaterService),this.universalContainerService.registerInstance("TreeDataService",this.treeDataService),this.initialization(this._gridContainerElm,h,s)}emptyGridContainerElm(){var i;const e=((i=this.gridOptions)==null?void 0:i.gridContainerId)??"grid1",t=document.querySelector(`#${e}`);J(t)}dispose(e=!1){var t,i,s,n,o,l,a,h,d,c,u,p,m,f,g,_,b,C,E,y,T,x,O,I,A;if((t=this._eventPubSubService)==null||t.publish("onBeforeGridDestroy",this.slickGrid),(i=this._eventHandler)==null||i.unsubscribeAll(),(s=this._eventPubSubService)==null||s.publish("onAfterGridDestroyed",!0),(n=this.extensionService)==null||n.dispose(),(o=this.filterService)==null||o.dispose(),(l=this.gridEventService)==null||l.dispose(),(a=this.gridService)==null||a.dispose(),(h=this.gridStateService)==null||h.dispose(),(d=this.groupingService)==null||d.dispose(),(c=this.paginationService)==null||c.dispose(),(u=this.resizerService)==null||u.dispose(),(p=this.sortService)==null||p.dispose(),(m=this.treeDataService)==null||m.dispose(),(f=this.universalContainerService)==null||f.dispose(),this.disposeExternalResources(),(g=this.slickFooter)==null||g.dispose(),(_=this.slickEmptyWarning)==null||_.dispose(),(b=this.slickPagination)==null||b.dispose(),hs(this.subscriptions),(C=this._eventPubSubService)==null||C.unsubscribeAll(),(E=this.dataView)==null||E.setItems([]),typeof((y=this.dataView)==null?void 0:y.destroy)=="function"&&((T=this.dataView)==null||T.destroy()),(x=this.slickGrid)==null||x.destroy(!0),this.slickGrid=null,J(this._gridContainerElm),J(this._gridParentContainerElm),(O=this._gridContainerElm)==null||O.remove(),(I=this._gridParentContainerElm)==null||I.remove(),this.backendServiceApi){for(const k of Object.keys(this.backendServiceApi))this.backendServiceApi[k]=null;this.backendServiceApi=void 0}for(const k of Object.keys(this.columnDefinitions))this.columnDefinitions[k]=null;for(const k of Object.keys(this.sharedService))this.sharedService[k]=null;this.datasetHierarchical=void 0,this._columnDefinitions=[],e&&this.emptyGridContainerElm(),(A=this._eventPubSubService)==null||A.dispose(),this._slickerGridInstances=null}disposeExternalResources(){if(Array.isArray(this._registeredResources))for(;this._registeredResources.length>0;){const e=this._registeredResources.pop();e!=null&&e.dispose&&e.dispose()}this._registeredResources=[]}initialization(e,t,i){var n,o,l,a,h,d,c,u,p,m,f,g,_,b,C,E,y,T,x,O,I;if(this.gridOptions&&(this.gridOptions.frozenRow!==void 0&&this.gridOptions.frozenRow>=0||this.gridOptions.frozenColumn!==void 0&&this.gridOptions.frozenColumn>=0)&&this.gridOptions.enableMouseWheelScrollHandler===void 0&&(this.gridOptions.enableMouseWheelScrollHandler=!0),this._gridContainerElm=e,this._eventPubSubService.publish("onBeforeGridCreate",!0),this._isAutosizeColsCalled=!1,this._eventHandler=t,this._gridOptions=this.mergeGridOptions(this._gridOptions||{}),this.backendServiceApi=(n=this._gridOptions)==null?void 0:n.backendServiceApi,this._isLocalGrid=!this.backendServiceApi,this._eventPubSubService.eventNamingStyle=((o=this._gridOptions)==null?void 0:o.eventNamingStyle)??ct.camelCase,this._paginationOptions=(l=this.gridOptions)==null?void 0:l.pagination,this.createBackendApiInternalPostProcessCallback(this._gridOptions),!this.customDataView){const A=((h=(a=this._gridOptions)==null?void 0:a.dataView)==null?void 0:h.inlineFilters)??!1;let k={...this._gridOptions.dataView,inlineFilters:A};(this.gridOptions.draggableGrouping||this.gridOptions.enableGrouping)&&(this.groupItemMetadataProvider=new Sl,this.sharedService.groupItemMetadataProvider=this.groupItemMetadataProvider,k={...k,groupItemMetadataProvider:this.groupItemMetadataProvider}),this.dataView=new _c(k,this._eventPubSubService),this._eventPubSubService.publish("onDataviewCreated",this.dataView)}this.preRegisterResources(),this._columnDefinitions=this.loadSlickGridEditors(this._columnDefinitions||[]),(d=this._gridOptions)!=null&&d.autoAddCustomEditorFormatter&&aa(this._columnDefinitions,this._gridOptions.autoAddCustomEditorFormatter),this.sharedService.allColumns=this._columnDefinitions,this.sharedService.visibleColumns=this._columnDefinitions,this.extensionService.createExtensionsBeforeGridCreation(this._columnDefinitions,this._gridOptions),(c=this.gridOptions.presets)!=null&&c.pinning&&(this.gridOptions={...this.gridOptions,...this.gridOptions.presets.pinning}),this.slickGrid=new Gc(e,this.dataView,this._columnDefinitions,this._gridOptions,this._eventPubSubService),this.sharedService.dataView=this.dataView,this.sharedService.slickGrid=this.slickGrid,this.sharedService.gridContainerElement=this._gridContainerElm,this.groupItemMetadataProvider&&this.slickGrid.registerPlugin(this.groupItemMetadataProvider),this.extensionService.bindDifferentExtensions(),this.bindDifferentHooks(this.slickGrid,this._gridOptions,this.dataView),this._slickgridInitialized=!0;const s=((u=this._gridOptions)==null?void 0:u.frozenColumn)??-1;if(s>=0&&s<=this._columnDefinitions.length&&this._columnDefinitions.length>0&&(this.sharedService.frozenVisibleColumnId=((p=this._columnDefinitions[s])==null?void 0:p.id)??""),this.registerResources(),this.slickGrid.init(),this.resizerService.init(this.slickGrid,this._gridParentContainerElm),!this.gridOptions.enablePagination&&this.gridOptions.showCustomFooter&&this.gridOptions.customFooterOptions&&(this.slickFooter=new $m(this.slickGrid,this.gridOptions.customFooterOptions,this._eventPubSubService,this.translaterService),this.slickFooter.renderFooter(this._gridParentContainerElm)),this.dataView){i=i||[];const A=(m=this.gridOptions)!=null&&m.enableTreeData?this.sortTreeDataset(i):i;this.dataView.beginUpdate(),this.dataView.setItems(A,this._gridOptions.datasetIdPropertyName),this._currentDatasetLength=i.length,this.dataView.endUpdate()}if((f=this.slickGrid)!=null&&f.getSelectionModel()&&((_=(g=this._gridOptions)==null?void 0:g.dataView)!=null&&_.hasOwnProperty("syncGridSelection"))){let A=!1;this._gridOptions.backendServiceApi&&this._gridOptions.dataView.hasOwnProperty("syncGridSelectionWithBackendService")&&(A=this._gridOptions.dataView.syncGridSelectionWithBackendService);const k=this._gridOptions.dataView.syncGridSelection;if(typeof k=="boolean"){let L=k;this._isLocalGrid||(L=k&&A),(b=this.dataView)==null||b.syncGridSelection(this.slickGrid,L)}else typeof k=="object"&&((C=this.dataView)==null||C.syncGridSelection(this.slickGrid,k.preserveHidden,k.preserveHiddenOnSelectionChange))}(((E=this.dataView)==null?void 0:E.getLength())??0)>0?(!this._isDatasetInitialized&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.loadRowSelectionPresetWhenExists(),this.loadFilterPresetsWhenDatasetInitialized(),this._isDatasetInitialized=!0):this.displayEmptyDataWarning(!0),this._hideHeaderRowAfterPageLoad&&(this.showHeaderRow(!1),this.sharedService.hideHeaderRowAfterPageLoad=this._hideHeaderRowAfterPageLoad),this.gridEventService.bindOnBeforeEditCell(this.slickGrid),this.gridEventService.bindOnCellChange(this.slickGrid),this.gridEventService.bindOnClick(this.slickGrid),(y=this.gridOptions)!=null&&y.backendServiceApi&&this.bindBackendCallbackFunctions(this.gridOptions),this._eventPubSubService.publish("onGridCreated",this.slickGrid),this.customDataView||this.executeAfterDataviewCreated(this.gridOptions),this.bindResizeHook(this.slickGrid,this.gridOptions),(T=this.gridOptions)!=null&&T.enablePagination&&this._isLocalGrid&&(this.showPagination=!0,this.loadLocalGridPagination(this.dataset)),this._slickerGridInstances={dataView:this.dataView,slickGrid:this.slickGrid,dispose:this.dispose.bind(this),backendService:(O=(x=this.gridOptions)==null?void 0:x.backendServiceApi)==null?void 0:O.service,eventPubSubService:this._eventPubSubService,filterService:this.filterService,gridEventService:this.gridEventService,gridStateService:this.gridStateService,gridService:this.gridService,groupingService:this.groupingService,extensionService:this.extensionService,extensionUtility:this.extensionUtility,paginationService:this.paginationService,resizerService:this.resizerService,sortService:this.sortService,treeDataService:this.treeDataService},this._extensions=(I=this.extensionService)==null?void 0:I.extensionList,this._eventPubSubService.publish("onSlickerGridCreated",this.instances),this._isGridInitialized=!0}mergeGridOptions(e){const t=de(!0,{},Rr,e);return t.enableFiltering&&!t.showHeaderRow&&(t.showHeaderRow=t.enableFiltering),t!=null&&t.pagination&&(e.enablePagination||e.backendServiceApi)&&e.pagination&&Array.isArray(e.pagination.pageSizes)&&(t.pagination.pageSizes=e.pagination.pageSizes),this.sharedService&&!t.enableFiltering&&t.enablePagination&&this._isLocalGrid&&(t.enableFiltering=!0,t.showHeaderRow=!1,this._hideHeaderRowAfterPageLoad=!0,this.sharedService.hideHeaderRowAfterPageLoad=!0),t}createBackendApiInternalPostProcessCallback(e){const t=e==null?void 0:e.backendServiceApi;if(t!=null&&t.service){const i=t.service;typeof i.getDatasetName=="function"&&(t.internalPostProcess=s=>{const n=t&&i&&typeof i.getDatasetName=="function"?i.getDatasetName():"";if(s&&s.data&&s.data[n]){const o=s.data[n].hasOwnProperty("nodes")?s.data[n].nodes:s.data[n],l=s.data[n].hasOwnProperty("totalCount")?s.data[n].totalCount:s.data[n].length;this.refreshGridData(o,l||0)}})}}bindDifferentHooks(e,t,i){var s,n;if(t.enableTranslate&&((s=this.translaterService)!=null&&s.addPubSubMessaging)&&this.translaterService.addPubSubMessaging(this._eventPubSubService),t.enableTranslate&&this.extensionService.translateAllExtensions(),this.subscriptions.push(this._eventPubSubService.subscribe("onLanguageChange",o=>{t.enableTranslate&&(this.extensionService.translateAllExtensions(o.language),(t.createPreHeaderPanel&&t.createTopHeaderPanel||t.createPreHeaderPanel&&!t.enableDraggableGrouping)&&this.groupingService.translateGroupingAndColSpan())})),t.backendServiceApi){const o=t.backendServiceApi;(n=o==null?void 0:o.service)!=null&&n.init&&o.service.init(o.options,t.pagination,this.slickGrid,this.sharedService)}i&&e&&(t.enableFiltering&&(this.filterService.init(e),t.backendServiceApi&&!t.backendServiceApi.useLocalFiltering?this.filterService.bindBackendOnFilter(e):this.filterService.bindLocalOnFilter(e)),t.enableSorting&&(t.backendServiceApi&&!t.backendServiceApi.useLocalSorting?this.sortService.bindBackendOnSort(e):this.sortService.bindLocalOnSort(e)),this._eventHandler.subscribe(i.onRowCountChanged,()=>{var o,l;e.invalidate(),this.handleOnItemCountChanged(((o=this.dataView)==null?void 0:o.getFilteredItemCount())||0,((l=this.dataView)==null?void 0:l.getItemCount())??0)}),this._eventHandler.subscribe(i.onSetItemsCalled,(o,l)=>{var a,h;this.handleOnItemCountChanged(((a=this.dataView)==null?void 0:a.getFilteredItemCount())||0,l.itemCount),l.itemCount>0&&(this.gridOptions.autosizeColumnsByCellContentOnFirstLoad||this.gridOptions.enableAutoResizeColumnsByCellContent)&&this.resizerService.resizeColumnsByCellContent(!((h=this.gridOptions)!=null&&h.resizeByContentOnlyOnFirstLoad))}),t!=null&&t.enableFiltering&&!t.enableRowDetailView&&this._eventHandler.subscribe(i.onRowsChanged,(o,l)=>{l!=null&&l.rows&&Array.isArray(l.rows)&&(l.rows.forEach(a=>e.updateRow(a)),e.render())}),this._eventHandler.subscribe(e.onColumnsReordered,(o,l)=>{this.sharedService.hasColumnsReordered=!0,this.sharedService.visibleColumns=l.impactedColumns}),this._eventHandler.subscribe(e.onSetOptions,(o,l)=>{l.optionsBefore.darkMode!==l.optionsAfter.darkMode&&this.setDarkMode(l.optionsAfter.darkMode)}),this.loadColumnPresetsWhenDatasetInitialized(),this.loadFilterPresetsWhenDatasetInitialized()),t!=null&&t.colspanCallback&&(i!=null&&i.getItem)&&(i!=null&&i.getItemMetadata)&&(i.getItemMetadata=o=>{let l=null;return t.colspanCallback&&(l=t.colspanCallback(i.getItem(o))),l})}bindBackendCallbackFunctions(e){var o,l,a;const t=e.backendServiceApi,i=t==null?void 0:t.service,s=(i==null?void 0:i.options)??{},n=s?s!=null&&s.hasOwnProperty("executeProcessCommandOnInit")?s.executeProcessCommandOnInit:!0:!1;if(i){if(e!=null&&e.presets){if(i.updateFilters&&Array.isArray(e.presets.filters)&&e.presets.filters.length>0&&i.updateFilters(e.presets.filters,!0),i.updateSorters&&Array.isArray(e.presets.sorters)&&e.presets.sorters.length>0){const h=(o=this._gridOptions)!=null&&o.multiColumnSort?e.presets.sorters:e.presets.sorters.slice(0,1);i.updateSorters(void 0,h)}if(i.updatePagination&&e.presets.pagination){const{pageNumber:h,pageSize:d}=e.presets.pagination;i.updatePagination(h,d)}}else{const h=this.filterService.getColumnFilters();h&&i.updateFilters&&i.updateFilters(h,!1)}if(t&&i&&(t.onInit||n)){const h=typeof i.buildQuery=="function"?i.buildQuery():"",d=n?((l=t.process)==null?void 0:l.call(t,h))??null:((a=t.onInit)==null?void 0:a.call(t,h))??null;queueMicrotask(()=>{var m,f,g;const c=this.backendUtilityService,u=new Date;t.preProcess&&t.preProcess();const p=((f=(m=this.gridOptions)==null?void 0:m.pagination)==null?void 0:f.totalItems)??0;d instanceof Promise?d.then(_=>c.executeBackendProcessesCallback(u,_,t,p)).catch(_=>c.onBackendError(_,t)):d&&((g=this.rxjs)!=null&&g.isObservable(d))&&this.subscriptions.push(d.subscribe(_=>c.executeBackendProcessesCallback(u,_,t,p),_=>c.onBackendError(_,t)))})}}}bindResizeHook(e,t){if(t.autoFitColumnsOnFirstLoad&&t.autosizeColumnsByCellContentOnFirstLoad||t.enableAutoSizeColumns&&t.enableAutoResizeColumnsByCellContent)throw new Error('[Slickgrid-Universal] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").');t.gridHeight||t.gridWidth?this.resizerService.resizeGrid(0,{height:t.gridHeight,width:t.gridWidth}):this.resizerService.resizeGrid(),e&&(t!=null&&t.enableAutoResize)&&t.autoFitColumnsOnFirstLoad&&t.enableAutoSizeColumns&&!this._isAutosizeColsCalled&&(e.autosizeColumns(),this._isAutosizeColsCalled=!0)}executeAfterDataviewCreated(e){var t;if(e.enableSorting&&e.presets&&Array.isArray(e.presets.sorters)){const i=(t=this._gridOptions)!=null&&t.multiColumnSort?e.presets.sorters:e.presets.sorters.slice(0,1);this.sortService.loadGridSorters(i)}}paginationChanged(e){var n,o;const t=((n=this.gridStateService)==null?void 0:n.needToPreserveRowSelection())??!1;this.slickGrid&&!t&&((o=this._gridOptions)!=null&&o.backendServiceApi)&&(this.gridOptions.enableRowSelection||this.gridOptions.enableCheckboxSelector)&&this.slickGrid.setSelectedRows([]);const{pageNumber:i,pageSize:s}=e;this.sharedService&&s!==void 0&&i!==void 0&&(this.sharedService.currentPagination={pageNumber:i,pageSize:s}),this._eventPubSubService.publish("onGridStateChanged",{change:{newValues:{pageNumber:i,pageSize:s},type:ze.pagination},gridState:this.gridStateService.getCurrentGridState()})}refreshGridData(e,t){var i,s,n,o,l;if(this.slickGrid&&this._gridOptions){if(this._gridOptions.enableEmptyDataWarningMessage&&Array.isArray(e)){const a=t||e.length;this.displayEmptyDataWarning(a<1)}if(Array.isArray(e)&&this.slickGrid&&((i=this.dataView)!=null&&i.setItems)){if(this.dataView.setItems(e,this._gridOptions.datasetIdPropertyName),!this._gridOptions.backendServiceApi&&!this._gridOptions.enableTreeData&&this.dataView.reSort(),e.length>0&&(this._isDatasetInitialized||(this.loadFilterPresetsWhenDatasetInitialized(),this._gridOptions.enableCheckboxSelector&&this.loadRowSelectionPresetWhenExists()),this._isDatasetInitialized=!0),e&&this.slickGrid.invalidate(),this.showPagination=!!(this._gridOptions&&(this._gridOptions.enablePagination||this._gridOptions.backendServiceApi&&this._gridOptions.enablePagination===void 0)),this._paginationOptions&&((s=this._gridOptions)!=null&&s.pagination)&&((n=this._gridOptions)!=null&&n.backendServiceApi)){const a=this.setPaginationOptionsWhenPresetDefined(this._gridOptions,this._paginationOptions),h=t!==void 0?t:(l=(o=this._gridOptions)==null?void 0:o.pagination)==null?void 0:l.totalItems;h!==void 0&&h!==this.totalItems&&(this.totalItems=+h),this._isPaginationInitialized?this.paginationService.updateTotalItems(this.totalItems):this.initializePaginationService(a)}if(this.slickGrid&&this._gridOptions.enableAutoResize){const a=this._gridOptions.autoResize&&this._gridOptions.autoResize.delay;this.resizerService.resizeGrid(a||10)}}}}updateColumnDefinitionsList(e){var t,i,s;this.slickGrid&&this._gridOptions&&Array.isArray(e)&&(e=this.loadSlickGridEditors(e),this._gridOptions.autoAddCustomEditorFormatter&&aa(e,this._gridOptions.autoAddCustomEditorFormatter),this._gridOptions.enableTranslate?this.extensionService.translateColumnHeaders(void 0,e):this.extensionService.renderColumnHeaders(e,!0),this.slickGrid&&((t=this._gridOptions)!=null&&t.enableAutoSizeColumns)?this.slickGrid.autosizeColumns():(i=this._gridOptions)!=null&&i.enableAutoResizeColumnsByCellContent&&((s=this.resizerService)!=null&&s.resizeColumnsByCellContent)&&this.resizerService.resizeColumnsByCellContent())}showHeaderRow(e=!0){var t;return(t=this.slickGrid)==null||t.setHeaderRowVisibility(e),this.slickGrid&&e===!0&&this._isGridInitialized&&this.slickGrid.setColumns(this.columnDefinitions),e}setData(e,t=!1){t&&(this._isAutosizeColsCalled=!1,this._currentDatasetLength=0),this.dataset=e||[]}setPaginationOptionsWhenPresetDefined(e,t){var i;return(i=e.presets)!=null&&i.pagination&&t&&!this._isPaginationInitialized&&(t.pageSize=e.presets.pagination.pageSize,t.pageNumber=e.presets.pagination.pageNumber),t}setDarkMode(e=!1){e?this._gridParentContainerElm.classList.add("slick-dark-mode"):this._gridParentContainerElm.classList.remove("slick-dark-mode")}copyColumnWidthsReference(e){e.forEach(t=>t.originalWidth=t.width)}displayEmptyDataWarning(e=!0){var t;this.gridOptions.enableEmptyDataWarningMessage&&((t=this.slickEmptyWarning)==null||t.showEmptyDataMessage(e))}handleOnItemCountChanged(e,t){var i;this._currentDatasetLength=t,this.metrics={startTime:new Date,endTime:new Date,itemCount:e,totalItemCount:t},this.slickFooter&&(this.slickFooter.metrics=this.metrics),this._isLocalGrid&&((i=this._gridOptions)!=null&&i.enableEmptyDataWarningMessage)&&this.displayEmptyDataWarning(e===0)}initializePaginationService(e){this.slickGrid&&this.gridOptions&&(this.paginationData={gridOptions:this.gridOptions,paginationService:this.paginationService},this.paginationService.totalItems=this.totalItems,this.paginationService.init(this.slickGrid,e,this.backendServiceApi),this.subscriptions.push(this._eventPubSubService.subscribe("onPaginationChanged",t=>this.paginationChanged(t)),this._eventPubSubService.subscribe("onPaginationVisibilityChanged",t=>{var i,s;this.showPagination=(t==null?void 0:t.visible)??!1,(i=this.gridOptions)!=null&&i.backendServiceApi&&((s=this.backendUtilityService)==null||s.refreshBackendDataset(this.gridOptions)),this.renderPagination(this.showPagination)})),this.renderPagination(),this._isPaginationInitialized=!0)}renderPagination(e=!0){var t;(t=this._gridOptions)!=null&&t.enablePagination&&!this._isPaginationInitialized&&e?(this.slickPagination=new Da(this.paginationService,this._eventPubSubService,this.sharedService,this.translaterService),this.slickPagination.renderPagination(this._gridParentContainerElm),this._isPaginationInitialized=!0):e||(this.slickPagination&&this.slickPagination.dispose(),this._isPaginationInitialized=!1)}loadEditorCollectionAsync(e){var t;if(e!=null&&e.editor){const i=e.editor.collectionAsync;e.editor.disabled=!0,i instanceof Promise?i.then(s=>{Array.isArray(s)?this.updateEditorCollection(e,s):(s==null?void 0:s.status)>=200&&s.status<300&&typeof s.json=="function"?s.bodyUsed?console.warn("[SlickGrid-Universal] The response body passed to collectionAsync was already read.Either pass the dataset from the Response or clone the response first using response.clone()"):s.json().then(n=>this.updateEditorCollection(e,n)):s!=null&&s.content&&this.updateEditorCollection(e,s.content)}):(t=this.rxjs)!=null&&t.isObservable(i)&&queueMicrotask(()=>{this.subscriptions.push(i.subscribe(s=>this.updateEditorCollection(e,s)))})}}insertDynamicPresetColumns(e,t){if(this._columnDefinitions){const i=this._columnDefinitions.findIndex(s=>s.id===e);if(i>=0){const s=this._columnDefinitions[i];(s==null?void 0:s.id)===e&&!t.some(n=>n.id===e)&&(i>0?t.splice(i,0,s):t.unshift(s))}}}loadColumnPresetsWhenDatasetInitialized(){var e,t,i,s,n,o;if(this.slickGrid&&this.gridOptions.presets&&Array.isArray(this.gridOptions.presets.columns)&&this.gridOptions.presets.columns.length>0){const l=this.gridStateService.getAssociatedGridColumns(this.slickGrid,this.gridOptions.presets.columns);if(l&&Array.isArray(l)&&l.length>0&&Array.isArray(this._columnDefinitions)){if(this.gridOptions.enableRowMoveManager){const a=((t=(e=this.gridOptions)==null?void 0:e.rowMoveManager)==null?void 0:t.columnId)??"_move";this.insertDynamicPresetColumns(a,l)}if(this.gridOptions.enableCheckboxSelector){const a=((s=(i=this.gridOptions)==null?void 0:i.checkboxSelector)==null?void 0:s.columnId)??"_checkbox_selector";this.insertDynamicPresetColumns(a,l)}if(this.gridOptions.enableRowDetailView){const a=((o=(n=this.gridOptions)==null?void 0:n.rowDetailView)==null?void 0:o.columnId)??"_detail_selector";this.insertDynamicPresetColumns(a,l)}l.forEach(a=>a.originalWidth=a.width),this.slickGrid.setColumns(l),this.sharedService.visibleColumns=l}}}loadFilterPresetsWhenDatasetInitialized(){var e,t,i;this.gridOptions&&!this.customDataView&&this.gridOptions.presets&&(Array.isArray(this.gridOptions.presets.filters)||Array.isArray((t=(e=this.gridOptions.presets)==null?void 0:e.treeData)==null?void 0:t.toggledItems))&&this.filterService.populateColumnFilterSearchTermPresets(((i=this.gridOptions.presets)==null?void 0:i.filters)||[])}loadLocalGridPagination(e){var t;if(this.gridOptions&&this._paginationOptions){if(this.totalItems=Array.isArray(e)?e.length:0,this._paginationOptions&&((t=this.dataView)!=null&&t.getPagingInfo)){const s=this.dataView.getPagingInfo();s!=null&&s.hasOwnProperty("totalRows")&&this._paginationOptions.totalItems!==s.totalRows&&(this.totalItems=(s==null?void 0:s.totalRows)||0)}this._paginationOptions.totalItems=this.totalItems;const i=this.setPaginationOptionsWhenPresetDefined(this.gridOptions,this._paginationOptions);this.initializePaginationService(i)}}loadRowSelectionPresetWhenExists(){var s,n;const e=(s=this.gridOptions)==null?void 0:s.presets,t=(n=this.slickGrid)==null?void 0:n.getSelectionModel(),i=this.gridOptions&&(this.gridOptions.enableCheckboxSelector||this.gridOptions.enableRowSelection);if(this.slickGrid&&this.dataView&&i&&t&&(e!=null&&e.rowSelection)&&(Array.isArray(e.rowSelection.gridRowIndexes)||Array.isArray(e.rowSelection.dataContextIds))){let o=e.rowSelection.dataContextIds,l=e.rowSelection.gridRowIndexes;Array.isArray(o)&&o.length>0?l=this.dataView.mapIdsToRows(o)||[]:Array.isArray(l)&&l.length>0&&(o=this.dataView.mapRowsToIds(l)||[]),this.slickGrid&&Array.isArray(l)&&(this.slickGrid.setSelectedRows(l),this.dataView.setSelectedIds(o||[],{isRowBeingAdded:!0,shouldTriggerEvent:!1,applyRowSelectionToGrid:!0}))}}registerExternalResources(e,t=!1){t&&this.disposeExternalResources(),e.forEach(i=>this._registeredResources.push(i)),this.initializeExternalResources(e)}resetExternalResources(){this._registeredResources=[]}preRegisterResources(){if(Array.isArray(this._registeredResources))for(const e of this._registeredResources)(e==null?void 0:e.className)==="RxJsResource"&&this.registerRxJsResource(e)}initializeExternalResources(e){if(Array.isArray(e))for(const t of e)this.slickGrid&&typeof t.init=="function"&&t.init(this.slickGrid,this.universalContainerService)}registerResources(){Array.isArray(this._registeredResources)&&(this.sharedService.externalRegisteredResources=this._registeredResources),this._registeredResources.push(this.gridService,this.gridStateService),(this.gridOptions.createPreHeaderPanel&&this.gridOptions.createTopHeaderPanel||this.gridOptions.createPreHeaderPanel&&!this.gridOptions.enableDraggableGrouping)&&this._registeredResources.push(this.groupingService),this.gridOptions.enableTreeData&&this._registeredResources.push(this.treeDataService),this.gridOptions.enableTranslate&&this.extensionService.translateColumnHeaders(),this.slickEmptyWarning=new Dr,this._registeredResources.push(this.slickEmptyWarning),this.initializeExternalResources(this._registeredResources)}registerRxJsResource(e){this.rxjs=e,this.backendUtilityService.addRxJsResource(this.rxjs),this.filterFactory.addRxJsResource(this.rxjs),this.filterService.addRxJsResource(this.rxjs),this.sortService.addRxJsResource(this.rxjs),this.paginationService.addRxJsResource(this.rxjs),this.universalContainerService.registerInstance("RxJsFacade",this.rxjs),this.universalContainerService.registerInstance("RxJsResource",this.rxjs)}sortTreeDataset(e,t=!1){var o,l;const i=this._currentDatasetLength;let s,n=[];return this._isDatasetHierarchicalInitialized&&this.datasetHierarchical?(s=this.treeDataService.sortHierarchicalDataset(this.datasetHierarchical),n=s.flat):Array.isArray(e)&&e.length>0&&((l=(o=this.gridOptions)==null?void 0:o.treeDataOptions)!=null&&l.initialSort?(s=this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(e,this._columnDefinitions||[],this.gridOptions),this.sharedService.hierarchicalDataset=s.hierarchical,n=s.flat):(this.sharedService.hierarchicalDataset=this.treeDataService.convertFlatParentChildToTreeDataset(e,this.gridOptions),n=e||[])),e.length>0&&(t||e.length!==i)&&this.filterService.refreshTreeDataFilters(n),n}loadSlickGridEditors(e){const t=Array.isArray(e)?e:[];return t.some(i=>`${i.id}`.includes("."))&&console.error('[Slickgrid-Universal] Make sure that none of your Column Definition "id" property includes a dot in its name because that will cause some problems with the Editors. For example if your column definition "field" property is "user.firstName" then use "firstName" as the column "id".'),t.map(i=>{var s,n;return(s=i.editor)!=null&&s.collectionAsync&&this.loadEditorCollectionAsync(i),{...i,editorClass:(n=i.editor)==null?void 0:n.model}})}updateEditorCollection(e,t){if(this.slickGrid&&e.editor){e.editor.collection=t,e.editor.disabled=!1;const i=this.slickGrid.getCellEditor();i!=null&&i.disable&&(i!=null&&i.renderDomElement)&&(typeof i.destroy=="function"&&i.destroy(),i.disable(!1),i.renderDomElement(t))}}}const Gm={GridBundle:lh,Aggregators:Ar,BindingService:gs,Editors:Pr,Enums:gn,Filters:qs,Formatters:_e,GroupTotalFormatters:ne,SortComparers:ei,Utilities:kr};typeof window<"u"&&(window.Slicker=Gm);const Qr=document.createElement("div");Qr.appendChild(v("span",{className:"mdi mdi-alert text-color-warning"})),Qr.appendChild(v("span",{textContent:"No data to display."}));const Um={autoEdit:!0,autoCommitEdit:!0,autoFixResizeTimeout:5*60*60,autoFixResizeRequiredGoodCount:5*60*60,autoFixResizeWhenBrokenStyleDetected:!0,cellValueCouldBeUndefined:!0,contextMenu:{hideCloseButton:!1},eventNamingStyle:ct.lowerCaseWithoutOnPrefix,compositeEditorOptions:{resetEditorButtonCssClass:"mdi mdi-refresh mdi-15px",resetFormButtonIconCssClass:"mdi mdi-refresh mdi-16px mdi-flip-h",shouldPreviewMassChangeDataset:!0},datasetIdPropertyName:"Id",emptyDataWarning:{message:Qr},enableDeepCopyDatasetOnPageLoad:!0,enableTextExport:!0,textExportOptions:{exportWithFormatter:!0,sanitizeDataExport:!0},enableCellNavigation:!0,customTooltip:{tooltipTextMaxLength:650},enableExcelExport:!0,excelExportOptions:{exportWithFormatter:!0,mimeType:"",sanitizeDataExport:!0},filterTypingDebounce:250,formatterOptions:{thousandSeparator:","},frozenHeaderWidthCalcDifferential:2,columnPicker:{hideForceFitButton:!0},gridMenu:{commandLabels:{clearFrozenColumnsCommandKey:"UNFREEZE_COLUMNS"},hideToggleDarkModeCommand:!1,hideTogglePreHeaderCommand:!0,hideRefreshDatasetCommand:!0,hideClearFrozenColumnsCommand:!1,hideForceFitButton:!0},headerMenu:{hideFreezeColumnsCommand:!1,iconSortAscCommand:"mdi mdi-arrow-up",iconSortDescCommand:"mdi mdi-arrow-down"},preventDocumentFragmentUsage:!0,sanitizer:r=>typeof r=="string"?r.replace(/(\b)(on[a-z]+)(\s*)=|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(&lt;)(\/*)(script|script defer)(.*)(&gt;|&gt;">)/gi,""):r,showCustomFooter:!0,customFooterOptions:{hideMetrics:!1,hideTotalItemCount:!1,hideLastUpdateTimestamp:!0,metricTexts:{itemsSelectedKey:"RECORDS_SELECTED"}},headerRowHeight:35,rowHeight:33,resizeByContentOnlyOnFirstLoad:!1,resizeByContentOptions:{formatterPaddingWidthInPx:8,maxItemToInspectCellContentWidth:500},rowMoveManager:{hideRowMoveShadow:!1},useSalesforceDefaultGridOptions:!0};class ah extends lh{constructor(e,t,i,s,n,o){super(e,t,i,s,n,o)}mergeGridOptions(e){var s;const t=e.useSalesforceDefaultGridOptions||(s=this._gridOptions)!=null&&s.useSalesforceDefaultGridOptions?Um:{},i=de(!0,{},Rr,t,e);return i.enableFiltering&&!i.showHeaderRow&&(i.showHeaderRow=i.enableFiltering),i!=null&&i.pagination&&(e.enablePagination||e.backendServiceApi)&&e.pagination&&Array.isArray(e.pagination.pageSizes)&&(i.pagination.pageSizes=e.pagination.pageSizes),!i.enableFiltering&&i.enablePagination&&this._isLocalGrid&&(i.enableFiltering=!0,i.showHeaderRow=!1,this._hideHeaderRowAfterPageLoad=!0,this.sharedService&&(this.sharedService.hideHeaderRowAfterPageLoad=!0)),i}registerResources(){if(this.gridOptions.enableTextExport&&this._registeredResources.push(new zm),this.gridOptions.enableTextExport&&this._registeredResources.push(new Mm),this._registeredResources.push(new Lm),Array.isArray(this._registeredResources)&&(this.sharedService.externalRegisteredResources=this._registeredResources),this._registeredResources.push(this.gridService,this.gridStateService),(this.gridOptions.createPreHeaderPanel&&this.gridOptions.createTopHeaderPanel||this.gridOptions.createPreHeaderPanel&&!this.gridOptions.enableDraggableGrouping)&&this._registeredResources.push(this.groupingService),this.gridOptions.enableTreeData&&this._registeredResources.push(this.treeDataService),this.gridOptions.enableTranslate&&this.extensionService.translateColumnHeaders(),this.slickEmptyWarning=new Dr,this._registeredResources.push(this.slickEmptyWarning),this.gridOptions.enableCompositeEditor&&(this._registeredResources.some(e=>e instanceof Fr)||(this.slickCompositeEditor=new Fr,this._registeredResources.push(this.slickCompositeEditor))),Array.isArray(this._registeredResources))for(const e of this._registeredResources)this.slickGrid&&typeof e.init=="function"&&e.init(this.slickGrid,this.universalContainerService)}}const hh={GridBundle:ah,Aggregators:Ar,BindingService:gs,Editors:Pr,Enums:gn,Filters:qs,Formatters:_e,GroupTotalFormatters:ne,SlickGlobalEditorLock:ji,SortComparers:ei,Utilities:kr};typeof window<"u"&&(window.Slicker=hh),ke.Aggregators=Ar,ke.BindingService=gs,ke.Editors=Pr,ke.Enums=gn,ke.EventPubSubService=Lo,ke.Filters=qs,ke.Formatters=_e,ke.GroupTotalFormatters=ne,ke.SlickCompositeEditorComponent=Fr,ke.SlickEmptyWarningComponent=Dr,ke.SlickPaginationComponent=Da,ke.Slicker=hh,ke.SortComparers=ei,ke.Utilities=kr,ke.VanillaForceGridBundle=ah,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})});
33
+ `)),i.appendChild(v("span",{className:"last-update-timestamp",textContent:t})),i.appendChild(v("span",{className:"separator",textContent:` ${this.customFooterOptions.metricSeparator||""} `})),i}registerOnSelectedRowsChangedWhenEnabled(e){var i,s;if((this.gridOptions.enableCheckboxSelector||this.gridOptions.enableRowSelection)&&e&&!e.hideRowSelectionCount&&this._isLeftFooterOriginallyEmpty){this._isLeftFooterDisplayingSelectionRowCount=!0;const n=((i=e.metricTexts)==null?void 0:i.itemsSelected)??((s=this.locales)==null?void 0:s.TEXT_ITEMS_SELECTED)??"TEXT_ITEMS_SELECTED";e.leftFooterText=`0 ${n}`,this._eventHandler.subscribe(this.grid.onSelectedRowsChanged,(o,l)=>{var h,d;this._selectedRowCount=l.rows.length;const a=((h=e.metricTexts)==null?void 0:h.itemsSelected)??((d=this.locales)==null?void 0:d.TEXT_ITEMS_SELECTED)??"TEXT_ITEMS_SELECTED";this.leftFooterText=`${this._selectedRowCount} ${a}`})}}}class Wm{constructor(){this.dependencies=[]}get(e){const t=this.dependencies.find(i=>i.key===e);return t!=null&&t.instance?t.instance:null}dispose(){this.dependencies=[]}registerInstance(e,t){this.dependencies.some(s=>s.key===e)||this.dependencies.push({key:e,instance:t})}}class lh{get eventHandler(){return this._eventHandler}get columnDefinitions(){return this._columnDefinitions||[]}set columnDefinitions(e){this._columnDefinitions=e,this._slickgridInitialized&&this.updateColumnDefinitionsList(this._columnDefinitions),e.length>0&&this.copyColumnWidthsReference(e)}get dataset(){var e;return((e=this.dataView)==null?void 0:e.getItems())||[]}set dataset(e){var o,l;const t=this._currentDatasetLength,i=ut(e,this.dataset||[]);let n=!!((o=this._gridOptions)!=null&&o.enableDeepCopyDatasetOnPageLoad)?de(!0,[],e):e;this.slickGrid&&((l=this.gridOptions)!=null&&l.enableTreeData)&&Array.isArray(e)&&(e.length>0||e.length!==t||!i)&&(this._isDatasetHierarchicalInitialized=!1,n=this.sortTreeDataset(e,!i)),this.refreshGridData(n||[]),this._currentDatasetLength=(e||[]).length,this.slickGrid&&this.gridOptions.autoFitColumnsOnFirstLoad&&t===0&&!this._isAutosizeColsCalled&&(this.slickGrid.autosizeColumns(),this._isAutosizeColsCalled=!0)}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}set datasetHierarchical(e){var s,n;const t=ut(e,this.sharedService.hierarchicalDataset||[]),i=this._currentDatasetLength;this.sharedService.hierarchicalDataset=e,e&&this.columnDefinitions&&((s=this.filterService)!=null&&s.clearFilters)&&this.filterService.clearFilters(),this.dataView&&e&&this.slickGrid&&((n=this.sortService)!=null&&n.processTreeDataInitialSort)&&(this.sortService.processTreeDataInitialSort(),queueMicrotask(()=>{var l;const o=((l=this.dataView)==null?void 0:l.getItemCount())??0;o>0&&(o!==i||!t)&&this.filterService.refreshTreeDataFilters()})),this._isDatasetHierarchicalInitialized=!0}set eventPubSubService(e){this._eventPubSubService=e}set isDatasetHierarchicalInitialized(e){this._isDatasetHierarchicalInitialized=e}get gridOptions(){return this._gridOptions||{}}set gridOptions(e){var i,s,n;let t;(i=this.slickGrid)!=null&&i.getOptions?t=de(!0,{},this.slickGrid.getOptions(),e):t=this.mergeGridOptions(e),(s=this.sharedService)!=null&&s.gridOptions&&((n=this.slickGrid)!=null&&n.setOptions)&&(this.sharedService.gridOptions=t,this.slickGrid.setOptions(t,!1,!0),this.slickGrid.reRenderColumns(!0)),this.setDarkMode(e.darkMode),this._gridOptions=t}get paginationOptions(){return this._paginationOptions}set paginationOptions(e){e&&this._paginationOptions?this._paginationOptions={...this._paginationOptions,...e}:this._paginationOptions=e,this.gridOptions.pagination=this._paginationOptions,this.paginationService.updateTotalItems((e==null?void 0:e.totalItems)??0,!0)}get isDatasetInitialized(){return this._isDatasetInitialized}set isDatasetInitialized(e){this._isDatasetInitialized=e}get isGridInitialized(){return this._isGridInitialized}get instances(){return this._slickerGridInstances}get extensions(){return this._extensions}get registeredResources(){return this._registeredResources}constructor(e,t,i,s,n,o){var d,c,u;if(this._currentDatasetLength=0,this._darkMode=!1,this._hideHeaderRowAfterPageLoad=!1,this._isAutosizeColsCalled=!1,this._isDatasetInitialized=!1,this._isDatasetHierarchicalInitialized=!1,this._isGridInitialized=!1,this._isLocalGrid=!0,this._isPaginationInitialized=!1,this._registeredResources=[],this._slickgridInitialized=!1,this.customDataView=!1,this.totalItems=0,this.subscriptions=[],this.showPagination=!1,!e||e.querySelectorAll(".slickgrid-container").length!==0)return;e.classList.add("grid-pane"),this._gridParentContainerElm=e,this._gridContainerElm=document.createElement("div"),this._gridContainerElm.classList.add("slickgrid-container"),e.appendChild(this._gridContainerElm),this._hideHeaderRowAfterPageLoad=(i==null?void 0:i.showHeaderRow)===!1,this._columnDefinitions=t||[],this._columnDefinitions.length>0&&this.copyColumnWidthsReference(this._columnDefinitions),this._registeredResources=(i==null?void 0:i.externalResources)||[],this._gridOptions=this.mergeGridOptions(i||{});const l=!!((d=this._gridOptions)!=null&&d.enableDeepCopyDatasetOnPageLoad);this._gridOptions.darkMode&&this.setDarkMode(!0),this.universalContainerService=(o==null?void 0:o.universalContainerService)??new Wm,this.translaterService=(o==null?void 0:o.translaterService)??((c=this._gridOptions)==null?void 0:c.translater),this._eventPubSubService=(o==null?void 0:o.eventPubSubService)??new Lo(e),this._eventPubSubService.eventNamingStyle=((u=this._gridOptions)==null?void 0:u.eventNamingStyle)??ct.camelCase;const a=new Zp;this.backendUtilityService=(o==null?void 0:o.backendUtilityService)??new Zr,this.gridEventService=(o==null?void 0:o.gridEventService)??new gu,this.sharedService=(o==null?void 0:o.sharedService)??new xu,this.collectionService=(o==null?void 0:o.collectionService)??new Cl(this.translaterService),this.extensionUtility=(o==null?void 0:o.extensionUtility)??new pc(this.sharedService,this.backendUtilityService,this.translaterService),this.filterFactory=new op(a,this.translaterService,this.collectionService),this.filterService=(o==null?void 0:o.filterService)??new mu(this.filterFactory,this._eventPubSubService,this.sharedService,this.backendUtilityService),this.resizerService=(o==null?void 0:o.resizerService)??new Ou(this._eventPubSubService),this.sortService=(o==null?void 0:o.sortService)??new Iu(this.sharedService,this._eventPubSubService,this.backendUtilityService),this.treeDataService=(o==null?void 0:o.treeDataService)??new Ru(this._eventPubSubService,this.sharedService,this.sortService),this.paginationService=(o==null?void 0:o.paginationService)??new vu(this._eventPubSubService,this.sharedService,this.backendUtilityService),this.extensionService=(o==null?void 0:o.extensionService)??new su(this.extensionUtility,this.filterService,this._eventPubSubService,this.sharedService,this.sortService,this.treeDataService,this.translaterService,()=>this.gridService),this.gridStateService=(o==null?void 0:o.gridStateService)??new _u(this.extensionService,this.filterService,this._eventPubSubService,this.sharedService,this.sortService,this.treeDataService),this.gridService=(o==null?void 0:o.gridService)??new fu(this.gridStateService,this.filterService,this._eventPubSubService,this.paginationService,this.sharedService,this.sortService,this.treeDataService),this.groupingService=(o==null?void 0:o.groupingAndColspanService)??new Cu(this.extensionUtility,this._eventPubSubService),n&&(this.sharedService.hierarchicalDataset=(l?de(!0,[],n):n)||[]);const h=new pe;this.universalContainerService.registerInstance("PubSubService",this._eventPubSubService),this.universalContainerService.registerInstance("EventPubSubService",this._eventPubSubService),this.universalContainerService.registerInstance("ExtensionUtility",this.extensionUtility),this.universalContainerService.registerInstance("FilterService",this.filterService),this.universalContainerService.registerInstance("CollectionService",this.collectionService),this.universalContainerService.registerInstance("ExtensionService",this.extensionService),this.universalContainerService.registerInstance("GridEventService",this.gridEventService),this.universalContainerService.registerInstance("GridService",this.gridService),this.universalContainerService.registerInstance("GridStateService",this.gridStateService),this.universalContainerService.registerInstance("GroupingAndColspanService",this.groupingService),this.universalContainerService.registerInstance("PaginationService",this.paginationService),this.universalContainerService.registerInstance("ResizerService",this.resizerService),this.universalContainerService.registerInstance("SharedService",this.sharedService),this.universalContainerService.registerInstance("SortService",this.sortService),this.universalContainerService.registerInstance("TranslaterService",this.translaterService),this.universalContainerService.registerInstance("TreeDataService",this.treeDataService),this.initialization(this._gridContainerElm,h,s)}emptyGridContainerElm(){var i;const e=((i=this.gridOptions)==null?void 0:i.gridContainerId)??"grid1",t=document.querySelector(`#${e}`);J(t)}dispose(e=!1){var t,i,s,n,o,l,a,h,d,c,u,p,m,f,g,_,b,C,E,y,T,x,O,I,A;if((t=this._eventPubSubService)==null||t.publish("onBeforeGridDestroy",this.slickGrid),(i=this._eventHandler)==null||i.unsubscribeAll(),(s=this._eventPubSubService)==null||s.publish("onAfterGridDestroyed",!0),(n=this.extensionService)==null||n.dispose(),(o=this.filterService)==null||o.dispose(),(l=this.gridEventService)==null||l.dispose(),(a=this.gridService)==null||a.dispose(),(h=this.gridStateService)==null||h.dispose(),(d=this.groupingService)==null||d.dispose(),(c=this.paginationService)==null||c.dispose(),(u=this.resizerService)==null||u.dispose(),(p=this.sortService)==null||p.dispose(),(m=this.treeDataService)==null||m.dispose(),(f=this.universalContainerService)==null||f.dispose(),this.disposeExternalResources(),(g=this.slickFooter)==null||g.dispose(),(_=this.slickEmptyWarning)==null||_.dispose(),(b=this.slickPagination)==null||b.dispose(),hs(this.subscriptions),(C=this._eventPubSubService)==null||C.unsubscribeAll(),(E=this.dataView)==null||E.setItems([]),typeof((y=this.dataView)==null?void 0:y.destroy)=="function"&&((T=this.dataView)==null||T.destroy()),(x=this.slickGrid)==null||x.destroy(!0),this.slickGrid=null,J(this._gridContainerElm),J(this._gridParentContainerElm),(O=this._gridContainerElm)==null||O.remove(),(I=this._gridParentContainerElm)==null||I.remove(),this.backendServiceApi){for(const k of Object.keys(this.backendServiceApi))this.backendServiceApi[k]=null;this.backendServiceApi=void 0}for(const k of Object.keys(this.columnDefinitions))this.columnDefinitions[k]=null;for(const k of Object.keys(this.sharedService))this.sharedService[k]=null;this.datasetHierarchical=void 0,this._columnDefinitions=[],e&&this.emptyGridContainerElm(),(A=this._eventPubSubService)==null||A.dispose(),this._slickerGridInstances=null}disposeExternalResources(){if(Array.isArray(this._registeredResources))for(;this._registeredResources.length>0;){const e=this._registeredResources.pop();e!=null&&e.dispose&&e.dispose()}this._registeredResources=[]}initialization(e,t,i){var n,o,l,a,h,d,c,u,p,m,f,g,_,b,C,E,y,T,x,O,I;if(this.gridOptions&&(this.gridOptions.frozenRow!==void 0&&this.gridOptions.frozenRow>=0||this.gridOptions.frozenColumn!==void 0&&this.gridOptions.frozenColumn>=0)&&this.gridOptions.enableMouseWheelScrollHandler===void 0&&(this.gridOptions.enableMouseWheelScrollHandler=!0),this._gridContainerElm=e,this._eventPubSubService.publish("onBeforeGridCreate",!0),this._isAutosizeColsCalled=!1,this._eventHandler=t,this._gridOptions=this.mergeGridOptions(this._gridOptions||{}),this.backendServiceApi=(n=this._gridOptions)==null?void 0:n.backendServiceApi,this._isLocalGrid=!this.backendServiceApi,this._eventPubSubService.eventNamingStyle=((o=this._gridOptions)==null?void 0:o.eventNamingStyle)??ct.camelCase,this._paginationOptions=(l=this.gridOptions)==null?void 0:l.pagination,this.createBackendApiInternalPostProcessCallback(this._gridOptions),!this.customDataView){const A=((h=(a=this._gridOptions)==null?void 0:a.dataView)==null?void 0:h.inlineFilters)??!1;let k={...this._gridOptions.dataView,inlineFilters:A};(this.gridOptions.draggableGrouping||this.gridOptions.enableGrouping)&&(this.groupItemMetadataProvider=new Sl,this.sharedService.groupItemMetadataProvider=this.groupItemMetadataProvider,k={...k,groupItemMetadataProvider:this.groupItemMetadataProvider}),this.dataView=new _c(k,this._eventPubSubService),this._eventPubSubService.publish("onDataviewCreated",this.dataView)}this.preRegisterResources(),this._columnDefinitions=this.loadSlickGridEditors(this._columnDefinitions||[]),(d=this._gridOptions)!=null&&d.autoAddCustomEditorFormatter&&aa(this._columnDefinitions,this._gridOptions.autoAddCustomEditorFormatter),this.sharedService.allColumns=this._columnDefinitions,this.sharedService.visibleColumns=this._columnDefinitions,this.extensionService.createExtensionsBeforeGridCreation(this._columnDefinitions,this._gridOptions),(c=this.gridOptions.presets)!=null&&c.pinning&&(this.gridOptions={...this.gridOptions,...this.gridOptions.presets.pinning}),this.slickGrid=new Gc(e,this.dataView,this._columnDefinitions,this._gridOptions,this._eventPubSubService),this.sharedService.dataView=this.dataView,this.sharedService.slickGrid=this.slickGrid,this.sharedService.gridContainerElement=this._gridContainerElm,this.groupItemMetadataProvider&&this.slickGrid.registerPlugin(this.groupItemMetadataProvider),this.extensionService.bindDifferentExtensions(),this.bindDifferentHooks(this.slickGrid,this._gridOptions,this.dataView),this._slickgridInitialized=!0;const s=((u=this._gridOptions)==null?void 0:u.frozenColumn)??-1;if(s>=0&&s<=this._columnDefinitions.length&&this._columnDefinitions.length>0&&(this.sharedService.frozenVisibleColumnId=((p=this._columnDefinitions[s])==null?void 0:p.id)??""),this.registerResources(),this.slickGrid.init(),this.resizerService.init(this.slickGrid,this._gridParentContainerElm),!this.gridOptions.enablePagination&&this.gridOptions.showCustomFooter&&this.gridOptions.customFooterOptions&&(this.slickFooter=new $m(this.slickGrid,this.gridOptions.customFooterOptions,this._eventPubSubService,this.translaterService),this.slickFooter.renderFooter(this._gridParentContainerElm)),this.dataView){i=i||[];const A=(m=this.gridOptions)!=null&&m.enableTreeData?this.sortTreeDataset(i):i;this.dataView.beginUpdate(),this.dataView.setItems(A,this._gridOptions.datasetIdPropertyName),this._currentDatasetLength=i.length,this.dataView.endUpdate()}if((f=this.slickGrid)!=null&&f.getSelectionModel()&&((_=(g=this._gridOptions)==null?void 0:g.dataView)!=null&&_.hasOwnProperty("syncGridSelection"))){let A=!1;this._gridOptions.backendServiceApi&&this._gridOptions.dataView.hasOwnProperty("syncGridSelectionWithBackendService")&&(A=this._gridOptions.dataView.syncGridSelectionWithBackendService);const k=this._gridOptions.dataView.syncGridSelection;if(typeof k=="boolean"){let L=k;this._isLocalGrid||(L=k&&A),(b=this.dataView)==null||b.syncGridSelection(this.slickGrid,L)}else typeof k=="object"&&((C=this.dataView)==null||C.syncGridSelection(this.slickGrid,k.preserveHidden,k.preserveHiddenOnSelectionChange))}(((E=this.dataView)==null?void 0:E.getLength())??0)>0?(!this._isDatasetInitialized&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.loadRowSelectionPresetWhenExists(),this.loadFilterPresetsWhenDatasetInitialized(),this._isDatasetInitialized=!0):this.displayEmptyDataWarning(!0),this._hideHeaderRowAfterPageLoad&&(this.showHeaderRow(!1),this.sharedService.hideHeaderRowAfterPageLoad=this._hideHeaderRowAfterPageLoad),this.gridEventService.bindOnBeforeEditCell(this.slickGrid),this.gridEventService.bindOnCellChange(this.slickGrid),this.gridEventService.bindOnClick(this.slickGrid),(y=this.gridOptions)!=null&&y.backendServiceApi&&this.bindBackendCallbackFunctions(this.gridOptions),this._eventPubSubService.publish("onGridCreated",this.slickGrid),this.customDataView||this.executeAfterDataviewCreated(this.gridOptions),this.bindResizeHook(this.slickGrid,this.gridOptions),(T=this.gridOptions)!=null&&T.enablePagination&&this._isLocalGrid&&(this.showPagination=!0,this.loadLocalGridPagination(this.dataset)),this._slickerGridInstances={dataView:this.dataView,slickGrid:this.slickGrid,dispose:this.dispose.bind(this),backendService:(O=(x=this.gridOptions)==null?void 0:x.backendServiceApi)==null?void 0:O.service,eventPubSubService:this._eventPubSubService,filterService:this.filterService,gridEventService:this.gridEventService,gridStateService:this.gridStateService,gridService:this.gridService,groupingService:this.groupingService,extensionService:this.extensionService,extensionUtility:this.extensionUtility,paginationService:this.paginationService,resizerService:this.resizerService,sortService:this.sortService,treeDataService:this.treeDataService},this._extensions=(I=this.extensionService)==null?void 0:I.extensionList,this._eventPubSubService.publish("onSlickerGridCreated",this.instances),this._isGridInitialized=!0}mergeGridOptions(e){const t=de(!0,{},Rr,e);return t.enableFiltering&&!t.showHeaderRow&&(t.showHeaderRow=t.enableFiltering),t!=null&&t.pagination&&(e.enablePagination||e.backendServiceApi)&&e.pagination&&Array.isArray(e.pagination.pageSizes)&&(t.pagination.pageSizes=e.pagination.pageSizes),this.sharedService&&!t.enableFiltering&&t.enablePagination&&this._isLocalGrid&&(t.enableFiltering=!0,t.showHeaderRow=!1,this._hideHeaderRowAfterPageLoad=!0,this.sharedService.hideHeaderRowAfterPageLoad=!0),t}createBackendApiInternalPostProcessCallback(e){const t=e==null?void 0:e.backendServiceApi;if(t!=null&&t.service){const i=t.service;typeof i.getDatasetName=="function"&&(t.internalPostProcess=s=>{const n=t&&i&&typeof i.getDatasetName=="function"?i.getDatasetName():"";if(s&&s.data&&s.data[n]){const o=s.data[n].hasOwnProperty("nodes")?s.data[n].nodes:s.data[n],l=s.data[n].hasOwnProperty("totalCount")?s.data[n].totalCount:s.data[n].length;this.refreshGridData(o,l||0)}})}}bindDifferentHooks(e,t,i){var s,n;if(t.enableTranslate&&((s=this.translaterService)!=null&&s.addPubSubMessaging)&&this.translaterService.addPubSubMessaging(this._eventPubSubService),t.enableTranslate&&this.extensionService.translateAllExtensions(),this.subscriptions.push(this._eventPubSubService.subscribe("onLanguageChange",o=>{t.enableTranslate&&(this.extensionService.translateAllExtensions(o.language),(t.createPreHeaderPanel&&t.createTopHeaderPanel||t.createPreHeaderPanel&&!t.enableDraggableGrouping)&&this.groupingService.translateGroupingAndColSpan())})),t.backendServiceApi){const o=t.backendServiceApi;(n=o==null?void 0:o.service)!=null&&n.init&&o.service.init(o.options,t.pagination,this.slickGrid,this.sharedService)}i&&e&&(t.enableFiltering&&(this.filterService.init(e),t.backendServiceApi&&!t.backendServiceApi.useLocalFiltering?this.filterService.bindBackendOnFilter(e):this.filterService.bindLocalOnFilter(e)),t.enableSorting&&(t.backendServiceApi&&!t.backendServiceApi.useLocalSorting?this.sortService.bindBackendOnSort(e):this.sortService.bindLocalOnSort(e)),this._eventHandler.subscribe(i.onRowCountChanged,()=>{var o,l;e.invalidate(),this.handleOnItemCountChanged(((o=this.dataView)==null?void 0:o.getFilteredItemCount())||0,((l=this.dataView)==null?void 0:l.getItemCount())??0)}),this._eventHandler.subscribe(i.onSetItemsCalled,(o,l)=>{var a,h;this.handleOnItemCountChanged(((a=this.dataView)==null?void 0:a.getFilteredItemCount())||0,l.itemCount),l.itemCount>0&&(this.gridOptions.autosizeColumnsByCellContentOnFirstLoad||this.gridOptions.enableAutoResizeColumnsByCellContent)&&this.resizerService.resizeColumnsByCellContent(!((h=this.gridOptions)!=null&&h.resizeByContentOnlyOnFirstLoad))}),t!=null&&t.enableFiltering&&!t.enableRowDetailView&&this._eventHandler.subscribe(i.onRowsChanged,(o,l)=>{l!=null&&l.rows&&Array.isArray(l.rows)&&(l.rows.forEach(a=>e.updateRow(a)),e.render())}),this._eventHandler.subscribe(e.onColumnsReordered,(o,l)=>{this.sharedService.hasColumnsReordered=!0,this.sharedService.visibleColumns=l.impactedColumns}),this._eventHandler.subscribe(e.onSetOptions,(o,l)=>{l.optionsBefore.darkMode!==l.optionsAfter.darkMode&&this.setDarkMode(l.optionsAfter.darkMode)}),this.loadColumnPresetsWhenDatasetInitialized(),this.loadFilterPresetsWhenDatasetInitialized()),t!=null&&t.colspanCallback&&(i!=null&&i.getItem)&&(i!=null&&i.getItemMetadata)&&(i.getItemMetadata=o=>{let l=null;return t.colspanCallback&&(l=t.colspanCallback(i.getItem(o))),l})}bindBackendCallbackFunctions(e){var o,l,a;const t=e.backendServiceApi,i=t==null?void 0:t.service,s=(i==null?void 0:i.options)??{},n=s?s!=null&&s.hasOwnProperty("executeProcessCommandOnInit")?s.executeProcessCommandOnInit:!0:!1;if(i){if(e!=null&&e.presets){if(i.updateFilters&&Array.isArray(e.presets.filters)&&e.presets.filters.length>0&&i.updateFilters(e.presets.filters,!0),i.updateSorters&&Array.isArray(e.presets.sorters)&&e.presets.sorters.length>0){const h=(o=this._gridOptions)!=null&&o.multiColumnSort?e.presets.sorters:e.presets.sorters.slice(0,1);i.updateSorters(void 0,h)}if(i.updatePagination&&e.presets.pagination){const{pageNumber:h,pageSize:d}=e.presets.pagination;i.updatePagination(h,d)}}else{const h=this.filterService.getColumnFilters();h&&i.updateFilters&&i.updateFilters(h,!1)}if(t&&i&&(t.onInit||n)){const h=typeof i.buildQuery=="function"?i.buildQuery():"",d=n?((l=t.process)==null?void 0:l.call(t,h))??null:((a=t.onInit)==null?void 0:a.call(t,h))??null;queueMicrotask(()=>{var m,f,g;const c=this.backendUtilityService,u=new Date;t.preProcess&&t.preProcess();const p=((f=(m=this.gridOptions)==null?void 0:m.pagination)==null?void 0:f.totalItems)??0;d instanceof Promise?d.then(_=>c.executeBackendProcessesCallback(u,_,t,p)).catch(_=>c.onBackendError(_,t)):d&&((g=this.rxjs)!=null&&g.isObservable(d))&&this.subscriptions.push(d.subscribe(_=>c.executeBackendProcessesCallback(u,_,t,p),_=>c.onBackendError(_,t)))})}}}bindResizeHook(e,t){if(t.autoFitColumnsOnFirstLoad&&t.autosizeColumnsByCellContentOnFirstLoad||t.enableAutoSizeColumns&&t.enableAutoResizeColumnsByCellContent)throw new Error('[Slickgrid-Universal] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").');t.gridHeight||t.gridWidth?this.resizerService.resizeGrid(0,{height:t.gridHeight,width:t.gridWidth}):this.resizerService.resizeGrid(),e&&(t!=null&&t.enableAutoResize)&&t.autoFitColumnsOnFirstLoad&&t.enableAutoSizeColumns&&!this._isAutosizeColsCalled&&(e.autosizeColumns(),this._isAutosizeColsCalled=!0)}executeAfterDataviewCreated(e){var t;if(e.enableSorting&&e.presets&&Array.isArray(e.presets.sorters)){const i=(t=this._gridOptions)!=null&&t.multiColumnSort?e.presets.sorters:e.presets.sorters.slice(0,1);this.sortService.loadGridSorters(i)}}paginationChanged(e){var n,o;const t=((n=this.gridStateService)==null?void 0:n.needToPreserveRowSelection())??!1;this.slickGrid&&!t&&((o=this._gridOptions)!=null&&o.backendServiceApi)&&(this.gridOptions.enableRowSelection||this.gridOptions.enableCheckboxSelector)&&this.slickGrid.setSelectedRows([]);const{pageNumber:i,pageSize:s}=e;this.sharedService&&s!==void 0&&i!==void 0&&(this.sharedService.currentPagination={pageNumber:i,pageSize:s}),this._eventPubSubService.publish("onGridStateChanged",{change:{newValues:{pageNumber:i,pageSize:s},type:ze.pagination},gridState:this.gridStateService.getCurrentGridState()})}refreshGridData(e,t){var i,s,n,o,l;if(this.slickGrid&&this._gridOptions){if(this._gridOptions.enableEmptyDataWarningMessage&&Array.isArray(e)){const a=t||e.length;this.displayEmptyDataWarning(a<1)}if(Array.isArray(e)&&this.slickGrid&&((i=this.dataView)!=null&&i.setItems)){if(this.dataView.setItems(e,this._gridOptions.datasetIdPropertyName),!this._gridOptions.backendServiceApi&&!this._gridOptions.enableTreeData&&this.dataView.reSort(),e.length>0&&(this._isDatasetInitialized||(this.loadFilterPresetsWhenDatasetInitialized(),this._gridOptions.enableCheckboxSelector&&this.loadRowSelectionPresetWhenExists()),this._isDatasetInitialized=!0),e&&this.slickGrid.invalidate(),this.showPagination=!!(this._gridOptions&&(this._gridOptions.enablePagination||this._gridOptions.backendServiceApi&&this._gridOptions.enablePagination===void 0)),this._paginationOptions&&((s=this._gridOptions)!=null&&s.pagination)&&((n=this._gridOptions)!=null&&n.backendServiceApi)){const a=this.setPaginationOptionsWhenPresetDefined(this._gridOptions,this._paginationOptions),h=t!==void 0?t:(l=(o=this._gridOptions)==null?void 0:o.pagination)==null?void 0:l.totalItems;h!==void 0&&h!==this.totalItems&&(this.totalItems=+h),this._isPaginationInitialized?this.paginationService.updateTotalItems(this.totalItems):this.initializePaginationService(a)}if(this.slickGrid&&this._gridOptions.enableAutoResize){const a=this._gridOptions.autoResize&&this._gridOptions.autoResize.delay;this.resizerService.resizeGrid(a||10)}}}}updateColumnDefinitionsList(e){var t,i,s;this.slickGrid&&this._gridOptions&&Array.isArray(e)&&(e=this.loadSlickGridEditors(e),this._gridOptions.autoAddCustomEditorFormatter&&aa(e,this._gridOptions.autoAddCustomEditorFormatter),this._gridOptions.enableTranslate?this.extensionService.translateColumnHeaders(void 0,e):this.extensionService.renderColumnHeaders(e,!0),this.slickGrid&&((t=this._gridOptions)!=null&&t.enableAutoSizeColumns)?this.slickGrid.autosizeColumns():(i=this._gridOptions)!=null&&i.enableAutoResizeColumnsByCellContent&&((s=this.resizerService)!=null&&s.resizeColumnsByCellContent)&&this.resizerService.resizeColumnsByCellContent())}showHeaderRow(e=!0){var t;return(t=this.slickGrid)==null||t.setHeaderRowVisibility(e),this.slickGrid&&e===!0&&this._isGridInitialized&&this.slickGrid.setColumns(this.columnDefinitions),e}setData(e,t=!1){t&&(this._isAutosizeColsCalled=!1,this._currentDatasetLength=0),this.dataset=e||[]}setPaginationOptionsWhenPresetDefined(e,t){var i;return(i=e.presets)!=null&&i.pagination&&t&&!this._isPaginationInitialized&&(t.pageSize=e.presets.pagination.pageSize,t.pageNumber=e.presets.pagination.pageNumber),t}setDarkMode(e=!1){e?this._gridParentContainerElm.classList.add("slick-dark-mode"):this._gridParentContainerElm.classList.remove("slick-dark-mode")}copyColumnWidthsReference(e){e.forEach(t=>t.originalWidth=t.width)}displayEmptyDataWarning(e=!0){var t;this.gridOptions.enableEmptyDataWarningMessage&&((t=this.slickEmptyWarning)==null||t.showEmptyDataMessage(e))}handleOnItemCountChanged(e,t){var i;this._currentDatasetLength=t,this.metrics={startTime:new Date,endTime:new Date,itemCount:e,totalItemCount:t},this.slickFooter&&(this.slickFooter.metrics=this.metrics),this._isLocalGrid&&((i=this._gridOptions)!=null&&i.enableEmptyDataWarningMessage)&&this.displayEmptyDataWarning(e===0)}initializePaginationService(e){this.slickGrid&&this.gridOptions&&(this.paginationData={gridOptions:this.gridOptions,paginationService:this.paginationService},this.paginationService.totalItems=this.totalItems,this.paginationService.init(this.slickGrid,e,this.backendServiceApi),this.subscriptions.push(this._eventPubSubService.subscribe("onPaginationChanged",t=>this.paginationChanged(t)),this._eventPubSubService.subscribe("onPaginationVisibilityChanged",t=>{var i,s;this.showPagination=(t==null?void 0:t.visible)??!1,(i=this.gridOptions)!=null&&i.backendServiceApi&&((s=this.backendUtilityService)==null||s.refreshBackendDataset(this.gridOptions)),this.renderPagination(this.showPagination)})),this.renderPagination(),this._isPaginationInitialized=!0)}renderPagination(e=!0){var t;(t=this._gridOptions)!=null&&t.enablePagination&&!this._isPaginationInitialized&&e?(this.slickPagination=new Da(this.paginationService,this._eventPubSubService,this.sharedService,this.translaterService),this.slickPagination.renderPagination(this._gridParentContainerElm),this._isPaginationInitialized=!0):e||(this.slickPagination&&this.slickPagination.dispose(),this._isPaginationInitialized=!1)}loadEditorCollectionAsync(e){var t;if(e!=null&&e.editor){const i=e.editor.collectionAsync;e.editor.disabled=!0,i instanceof Promise?i.then(s=>{Array.isArray(s)?this.updateEditorCollection(e,s):(s==null?void 0:s.status)>=200&&s.status<300&&typeof s.json=="function"?s.bodyUsed?console.warn("[SlickGrid-Universal] The response body passed to collectionAsync was already read.Either pass the dataset from the Response or clone the response first using response.clone()"):s.json().then(n=>this.updateEditorCollection(e,n)):s!=null&&s.content&&this.updateEditorCollection(e,s.content)}):(t=this.rxjs)!=null&&t.isObservable(i)&&queueMicrotask(()=>{this.subscriptions.push(i.subscribe(s=>this.updateEditorCollection(e,s)))})}}insertDynamicPresetColumns(e,t){if(this._columnDefinitions){const i=this._columnDefinitions.findIndex(s=>s.id===e);if(i>=0){const s=this._columnDefinitions[i];(s==null?void 0:s.id)===e&&!t.some(n=>n.id===e)&&(i>0?t.splice(i,0,s):t.unshift(s))}}}loadColumnPresetsWhenDatasetInitialized(){var e,t,i,s,n,o;if(this.slickGrid&&this.gridOptions.presets&&Array.isArray(this.gridOptions.presets.columns)&&this.gridOptions.presets.columns.length>0){const l=this.gridStateService.getAssociatedGridColumns(this.slickGrid,this.gridOptions.presets.columns);if(l&&Array.isArray(l)&&l.length>0&&Array.isArray(this._columnDefinitions)){if(this.gridOptions.enableRowMoveManager){const a=((t=(e=this.gridOptions)==null?void 0:e.rowMoveManager)==null?void 0:t.columnId)??"_move";this.insertDynamicPresetColumns(a,l)}if(this.gridOptions.enableCheckboxSelector){const a=((s=(i=this.gridOptions)==null?void 0:i.checkboxSelector)==null?void 0:s.columnId)??"_checkbox_selector";this.insertDynamicPresetColumns(a,l)}if(this.gridOptions.enableRowDetailView){const a=((o=(n=this.gridOptions)==null?void 0:n.rowDetailView)==null?void 0:o.columnId)??"_detail_selector";this.insertDynamicPresetColumns(a,l)}l.forEach(a=>a.originalWidth=a.width),this.slickGrid.setColumns(l),this.sharedService.visibleColumns=l}}}loadFilterPresetsWhenDatasetInitialized(){var e,t,i;this.gridOptions&&!this.customDataView&&this.gridOptions.presets&&(Array.isArray(this.gridOptions.presets.filters)||Array.isArray((t=(e=this.gridOptions.presets)==null?void 0:e.treeData)==null?void 0:t.toggledItems))&&this.filterService.populateColumnFilterSearchTermPresets(((i=this.gridOptions.presets)==null?void 0:i.filters)||[])}loadLocalGridPagination(e){var t;if(this.gridOptions&&this._paginationOptions){if(this.totalItems=Array.isArray(e)?e.length:0,this._paginationOptions&&((t=this.dataView)!=null&&t.getPagingInfo)){const s=this.dataView.getPagingInfo();s!=null&&s.hasOwnProperty("totalRows")&&this._paginationOptions.totalItems!==s.totalRows&&(this.totalItems=(s==null?void 0:s.totalRows)||0)}this._paginationOptions.totalItems=this.totalItems;const i=this.setPaginationOptionsWhenPresetDefined(this.gridOptions,this._paginationOptions);this.initializePaginationService(i)}}loadRowSelectionPresetWhenExists(){var s,n;const e=(s=this.gridOptions)==null?void 0:s.presets,t=(n=this.slickGrid)==null?void 0:n.getSelectionModel(),i=this.gridOptions&&(this.gridOptions.enableCheckboxSelector||this.gridOptions.enableRowSelection);if(this.slickGrid&&this.dataView&&i&&t&&(e!=null&&e.rowSelection)&&(Array.isArray(e.rowSelection.gridRowIndexes)||Array.isArray(e.rowSelection.dataContextIds))){let o=e.rowSelection.dataContextIds,l=e.rowSelection.gridRowIndexes;Array.isArray(o)&&o.length>0?l=this.dataView.mapIdsToRows(o)||[]:Array.isArray(l)&&l.length>0&&(o=this.dataView.mapRowsToIds(l)||[]),this.slickGrid&&Array.isArray(l)&&(this.slickGrid.setSelectedRows(l),this.dataView.setSelectedIds(o||[],{isRowBeingAdded:!0,shouldTriggerEvent:!1,applyRowSelectionToGrid:!0}))}}registerExternalResources(e,t=!1){t&&this.disposeExternalResources(),e.forEach(i=>this._registeredResources.push(i)),this.initializeExternalResources(e)}resetExternalResources(){this._registeredResources=[]}preRegisterResources(){if(Array.isArray(this._registeredResources))for(const e of this._registeredResources)(e==null?void 0:e.className)==="RxJsResource"&&this.registerRxJsResource(e)}initializeExternalResources(e){if(Array.isArray(e))for(const t of e)this.slickGrid&&typeof t.init=="function"&&t.init(this.slickGrid,this.universalContainerService)}registerResources(){Array.isArray(this._registeredResources)&&(this.sharedService.externalRegisteredResources=this._registeredResources),this._registeredResources.push(this.gridService,this.gridStateService),(this.gridOptions.createPreHeaderPanel&&this.gridOptions.createTopHeaderPanel||this.gridOptions.createPreHeaderPanel&&!this.gridOptions.enableDraggableGrouping)&&this._registeredResources.push(this.groupingService),this.gridOptions.enableTreeData&&this._registeredResources.push(this.treeDataService),this.gridOptions.enableTranslate&&this.extensionService.translateColumnHeaders(),this.slickEmptyWarning=new Dr,this._registeredResources.push(this.slickEmptyWarning),this.initializeExternalResources(this._registeredResources)}registerRxJsResource(e){this.rxjs=e,this.backendUtilityService.addRxJsResource(this.rxjs),this.filterFactory.addRxJsResource(this.rxjs),this.filterService.addRxJsResource(this.rxjs),this.sortService.addRxJsResource(this.rxjs),this.paginationService.addRxJsResource(this.rxjs),this.universalContainerService.registerInstance("RxJsFacade",this.rxjs),this.universalContainerService.registerInstance("RxJsResource",this.rxjs)}sortTreeDataset(e,t=!1){var o,l;const i=this._currentDatasetLength;let s,n=[];return this._isDatasetHierarchicalInitialized&&this.datasetHierarchical?(s=this.treeDataService.sortHierarchicalDataset(this.datasetHierarchical),n=s.flat):Array.isArray(e)&&e.length>0&&((l=(o=this.gridOptions)==null?void 0:o.treeDataOptions)!=null&&l.initialSort?(s=this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(e,this._columnDefinitions||[],this.gridOptions),this.sharedService.hierarchicalDataset=s.hierarchical,n=s.flat):(this.sharedService.hierarchicalDataset=this.treeDataService.convertFlatParentChildToTreeDataset(e,this.gridOptions),n=e||[])),e.length>0&&(t||e.length!==i)&&this.filterService.refreshTreeDataFilters(n),n}loadSlickGridEditors(e){const t=Array.isArray(e)?e:[];return t.some(i=>`${i.id}`.includes("."))&&console.error('[Slickgrid-Universal] Make sure that none of your Column Definition "id" property includes a dot in its name because that will cause some problems with the Editors. For example if your column definition "field" property is "user.firstName" then use "firstName" as the column "id".'),t.map(i=>{var s,n;return(s=i.editor)!=null&&s.collectionAsync&&this.loadEditorCollectionAsync(i),{...i,editorClass:(n=i.editor)==null?void 0:n.model}})}updateEditorCollection(e,t){if(this.slickGrid&&e.editor){e.editor.collection=t,e.editor.disabled=!1;const i=this.slickGrid.getCellEditor();i!=null&&i.disable&&(i!=null&&i.renderDomElement)&&(typeof i.destroy=="function"&&i.destroy(),i.disable(!1),i.renderDomElement(t))}}}const Gm={GridBundle:lh,Aggregators:Ar,BindingService:gs,Editors:Pr,Enums:gn,Filters:qs,Formatters:_e,GroupTotalFormatters:ne,SortComparers:ei,Utilities:kr};typeof window<"u"&&(window.Slicker=Gm);const Qr=document.createElement("div");Qr.appendChild(v("span",{className:"mdi mdi-alert text-color-warning"})),Qr.appendChild(v("span",{textContent:"No data to display."}));const Um={autoEdit:!0,autoCommitEdit:!0,autoFixResizeTimeout:5*60*60,autoFixResizeRequiredGoodCount:5*60*60,autoFixResizeWhenBrokenStyleDetected:!0,cellValueCouldBeUndefined:!0,contextMenu:{hideCloseButton:!1},eventNamingStyle:ct.lowerCaseWithoutOnPrefix,compositeEditorOptions:{resetEditorButtonCssClass:"mdi mdi-refresh mdi-15px",resetFormButtonIconCssClass:"mdi mdi-refresh mdi-16px mdi-flip-h",shouldPreviewMassChangeDataset:!0},datasetIdPropertyName:"Id",emptyDataWarning:{message:Qr},enableDeepCopyDatasetOnPageLoad:!0,enableTextExport:!0,textExportOptions:{exportWithFormatter:!0,sanitizeDataExport:!0},enableCellNavigation:!0,customTooltip:{tooltipTextMaxLength:650},enableExcelExport:!0,excelExportOptions:{exportWithFormatter:!0,mimeType:"",sanitizeDataExport:!0},filterTypingDebounce:250,formatterOptions:{thousandSeparator:","},frozenHeaderWidthCalcDifferential:2,columnPicker:{hideForceFitButton:!0},gridMenu:{commandLabels:{clearFrozenColumnsCommandKey:"UNFREEZE_COLUMNS"},hideToggleDarkModeCommand:!1,hideTogglePreHeaderCommand:!0,hideRefreshDatasetCommand:!0,hideClearFrozenColumnsCommand:!1,hideForceFitButton:!0},headerMenu:{hideFreezeColumnsCommand:!1,iconSortAscCommand:"mdi mdi-arrow-up",iconSortDescCommand:"mdi mdi-arrow-down"},preventDocumentFragmentUsage:!0,sanitizer:r=>typeof r=="string"?r.replace(/(\b)(on[a-z]+)(\s*)=|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(&lt;)(\/*)(script|script defer)(.*)(&gt;|&gt;">)/gi,""):r,showCustomFooter:!0,customFooterOptions:{hideMetrics:!1,hideTotalItemCount:!1,hideLastUpdateTimestamp:!0,metricTexts:{itemsSelectedKey:"RECORDS_SELECTED"}},headerRowHeight:35,rowHeight:33,resizeByContentOnlyOnFirstLoad:!1,resizeByContentOptions:{formatterPaddingWidthInPx:8,maxItemToInspectCellContentWidth:500},rowMoveManager:{hideRowMoveShadow:!1},useSalesforceDefaultGridOptions:!0};class ah extends lh{constructor(e,t,i,s,n,o){super(e,t,i,s,n,o)}mergeGridOptions(e){var s;const t=e.useSalesforceDefaultGridOptions||(s=this._gridOptions)!=null&&s.useSalesforceDefaultGridOptions?Um:{},i=de(!0,{},Rr,t,e);return i.enableFiltering&&!i.showHeaderRow&&(i.showHeaderRow=i.enableFiltering),i!=null&&i.pagination&&(e.enablePagination||e.backendServiceApi)&&e.pagination&&Array.isArray(e.pagination.pageSizes)&&(i.pagination.pageSizes=e.pagination.pageSizes),!i.enableFiltering&&i.enablePagination&&this._isLocalGrid&&(i.enableFiltering=!0,i.showHeaderRow=!1,this._hideHeaderRowAfterPageLoad=!0,this.sharedService&&(this.sharedService.hideHeaderRowAfterPageLoad=!0)),i}registerResources(){if(this.gridOptions.enableTextExport&&this._registeredResources.push(new zm),this.gridOptions.enableTextExport&&this._registeredResources.push(new Mm),this._registeredResources.push(new Lm),Array.isArray(this._registeredResources)&&(this.sharedService.externalRegisteredResources=this._registeredResources),this._registeredResources.push(this.gridService,this.gridStateService),(this.gridOptions.createPreHeaderPanel&&this.gridOptions.createTopHeaderPanel||this.gridOptions.createPreHeaderPanel&&!this.gridOptions.enableDraggableGrouping)&&this._registeredResources.push(this.groupingService),this.gridOptions.enableTreeData&&this._registeredResources.push(this.treeDataService),this.gridOptions.enableTranslate&&this.extensionService.translateColumnHeaders(),this.slickEmptyWarning=new Dr,this._registeredResources.push(this.slickEmptyWarning),this.gridOptions.enableCompositeEditor&&(this._registeredResources.some(e=>e instanceof Fr)||(this.slickCompositeEditor=new Fr,this._registeredResources.push(this.slickCompositeEditor))),Array.isArray(this._registeredResources))for(const e of this._registeredResources)this.slickGrid&&typeof e.init=="function"&&e.init(this.slickGrid,this.universalContainerService)}}const hh={GridBundle:ah,Aggregators:Ar,BindingService:gs,Editors:Pr,Enums:gn,Filters:qs,Formatters:_e,GroupTotalFormatters:ne,SlickGlobalEditorLock:ji,SortComparers:ei,Utilities:kr};typeof window<"u"&&(window.Slicker=hh),ke.Aggregators=Ar,ke.BindingService=gs,ke.Editors=Pr,ke.Enums=gn,ke.EventPubSubService=Lo,ke.Filters=qs,ke.Formatters=_e,ke.GroupTotalFormatters=ne,ke.SlickCompositeEditorComponent=Fr,ke.SlickEmptyWarningComponent=Dr,ke.SlickPaginationComponent=Da,ke.Slicker=hh,ke.SortComparers=ei,ke.Utilities=kr,ke.VanillaForceGridBundle=ah,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})});