Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/components/bitrix/main.ui.grid/templates/.default/
Upload File :
Current File : /var/www/homesaver/www/bitrix/components/bitrix/main.ui.grid/templates/.default/script.min.js

(function(exports,ui_cnt,ui_dialogs_checkboxList,main_core,main_core_events,main_loader,main_popup){"use strict";(function(){BX.namespace("BX.Grid");BX.Grid.ActionPanel=function(t,e,i){this.parent=null;this.rel={};this.actions=null;this.types=null;this.lastActivated=[];this.init(t,e,i);this.button=[];this.elements=[];this.buttonOnChange=[];this.buttonData={}};BX.Grid.ActionPanel.prototype={init(parent,actions,types){this.parent=parent;this.actions=eval(actions);this.types=eval(types);BX.addCustomEvent(window,"Dropdown::change",BX.proxy(this._dropdownEventHandle,this));BX.addCustomEvent(window,"Dropdown::load",BX.proxy(this._dropdownEventHandle,this));const panel=this.getPanel();BX.bind(panel,"change",BX.delegate(this._checkboxChange,this));BX.bind(panel,"click",BX.delegate(this._clickOnButton,this));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this._gridUpdatedEventHandle,this))},destroy(){BX.removeCustomEvent(window,"Dropdown::change",BX.proxy(this._dropdownEventHandle,this));BX.removeCustomEvent(window,"Dropdown::load",BX.proxy(this._dropdownEventHandle,this));BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this._gridUpdatedEventHandle,this))},_gridUpdatedEventHandle(){const t=BX("grid_cancel_button");t&&BX.fireEvent(BX.firstChild(t),"click")},_dropdownEventHandle(t,e,i,s){this.isPanelControl(BX(t))&&this._dropdownChange(t,e,i,s)},resetForAllCheckbox(){const t=this.getForAllCheckbox();if(BX.type.isDomNode(t)){t.checked=null}},getForAllCheckbox(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classForAllCheckbox"),true)},getPanel(){return BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classActionPanel"),true)},getApplyButton(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classPanelApplyButton"),true)},isPanelControl(t){return BX.hasClass(t,this.parent.settings.get("classPanelControl"))},getTextInputs(){return BX.Grid.Utils.getBySelector(this.getPanel(),'input[type="text"]')},getHiddenInputs(){return BX.Grid.Utils.getBySelector(this.getPanel(),'input[type="hidden"]')},getSelects(){return BX.Grid.Utils.getBySelector(this.getPanel(),"select")},getDropdowns(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classDropdown"))},getCheckboxes(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classPanelCheckbox"))},getButtons(){return BX.Grid.Utils.getByClass(this.getPanel(),this.parent.settings.get("classPanelButton"))},isDropdown(t){return BX.hasClass(t,this.parent.settings.get("classDropdown"))},isCheckbox(t){return BX.hasClass(t,this.parent.settings.get("classPanelCheckbox"))},isTextInput(t){return t.type==="text"},isHiddenInput(t){return t.type==="hidden"},isSelect(t){return t.tagName==="SELECT"},createDropdown(t,e){const i=t.EMPTY_TEXT||"";const s=t.MULTIPLE==="Y";const n=this.createContainer(t.ID,e,{});const o=BX.create("div",{props:{className:"main-dropdown main-grid-panel-control",id:`${t.ID}_control`},attrs:{name:t.NAME,"data-name":t.NAME,"data-empty-text":i,"data-multiple":s?"Y":"N","data-items":JSON.stringify(t.ITEMS),"data-value":s?"":t.ITEMS[0].VALUE,"data-popup-position":"fixed"},children:[BX.create("span",{props:{className:"main-dropdown-inner"},html:s?i:t.ITEMS[0].NAME})]});n.appendChild(o);return n},createCheckbox(t,e){const i=this.createContainer(t.ID,e,{});const s=BX.create("span",{props:{className:"main-grid-checkbox-container"}});const n=BX.create("span",{props:{className:"main-grid-control-panel-content-title"}});const o=BX.create("input",{props:{type:"checkbox",className:`${this.parent.settings.get("classPanelCheckbox")} main-grid-checkbox`,id:`${t.ID}_control`},attrs:{value:t.VALUE||"",title:t.TITLE||"",name:t.NAME||"","data-onchange":JSON.stringify(t.ONCHANGE)}});o.checked=t.CHECKED||null;i.appendChild(s);i.appendChild(n);s.appendChild(o);s.appendChild(BX.create("label",{props:{className:"main-grid-checkbox"},attrs:{for:`${t.ID}_control`,title:t.TITLE}}));n.appendChild(BX.create("label",{attrs:{for:`${t.ID}_control`,title:t.TITLE},html:t.LABEL}));return i},createText(t,e){const i=this.createContainer(t.ID,e,{});const s=BX.type.isNotEmptyString(t.TITLE)?t.TITLE:"";if(s!==""){i.appendChild(BX.create("label",{attrs:{title:s,for:`${t.ID}_control`},text:s}))}i.appendChild(BX.create("input",{props:{className:"main-grid-control-panel-input-text main-grid-panel-control",id:`${t.ID}_control`},attrs:{name:t.NAME,title:s,placeholder:t.PLACEHOLDER||"",value:t.VALUE||"",type:"text","data-onchange":JSON.stringify(t.ONCHANGE||[])}}));return i},createHidden(t,e){const i=this.createContainer(t.ID,e,{CLASS:"main-grid-panel-hidden-control-container"});i.appendChild(BX.create("input",{props:{id:`${t.ID}_control`,type:"hidden"},attrs:{name:t.NAME,value:t.VALUE||""}}));return i},createButton(t,e){this.buttonOnChange=t.ONCHANGE||[];this.buttonData=t;this.button=this.createButtonNode(t);BX.removeCustomEvent(window,"Grid::unselectRow",BX.proxy(this.prepareButton,this));BX.removeCustomEvent(window,"Grid::selectRow",BX.proxy(this.prepareButton,this));BX.removeCustomEvent(window,"Grid::allRowsSelected",BX.proxy(this.prepareButton,this));BX.removeCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this.prepareButton,this));if(this.buttonData.SETTINGS&&t.ID===this.buttonData.SETTINGS.buttonId){BX.addCustomEvent(window,"Grid::unselectRow",BX.proxy(this.prepareButton,this));BX.addCustomEvent(window,"Grid::selectRow",BX.proxy(this.prepareButton,this));BX.addCustomEvent(window,"Grid::allRowsSelected",BX.proxy(this.prepareButton,this));BX.addCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this.prepareButton,this))}this.prepareButton();const i=this.createContainer(t.ID,e,{});i.appendChild(this.button);return i},createButtonNode(t){return BX.create("button",{props:{className:`ui-btn${t.CLASS?` ${t.CLASS}`:""}`,id:`${t.ID}_control`,title:BX.type.isNotEmptyString(t.TITLE)?t.TITLE:""},attrs:{name:t.NAME||""},html:t.TEXT})},prepareButton(){if(this.isSetButtonDisabled()){BX.Dom.attr(this.button,"data-onchange",[]);BX.Dom.addClass(this.button,"ui-btn-disabled")}else{BX.Dom.attr(this.button,"data-onchange",this.buttonOnChange);BX.Dom.removeClass(this.button,"ui-btn-disabled")}},isSetButtonDisabled(){return Boolean(this.buttonData.SETTINGS&&this.buttonData.SETTINGS.minSelectedRows&&this.getSelectedIds().length<this.buttonData.SETTINGS.minSelectedRows)},createLink(t,e){const i=this.createContainer(t.ID,e,{});const s=BX.create("a",{props:{className:`main-grid-link${t.CLASS?` ${t.CLASS}`:""}`,id:`${t.ID}_control`},attrs:{href:t.HREF||"","data-onchange":JSON.stringify(t.ONCHANGE||[])},html:t.TEXT});i.appendChild(s);return i},createCustom(t,e){const i=this.createContainer(t.ID,e,{CLASS:"main-grid-panel-hidden-control-container"});const s=BX.create("div",{props:{className:`main-grid-panel-custom${t.CLASS?` ${t.CLASS}`:""}`},html:t.VALUE});i.appendChild(s);return i},createContainer(t,e,i){t=t.replace("_control","");e=e.replace("_control","");i=i||{};return BX.create("span",{props:{className:this.parent.settings.get("classPanelControlContainer")+(i.CLASS?` ${i.CLASS}`:""),id:t},attrs:{"data-relative":e}})},removeItemsRelativeCurrent(t){let e=t;const i=[t.id];const s=[];let n;while(e){n=BX.data(e,"relative");if(i.includes(n)){i.push(e.id);s.push(e)}e=e.nextElementSibling}s.forEach((t=>{BX.remove(t)}))},validateData(t){return"ONCHANGE"in t&&BX.type.isArray(t.ONCHANGE)},activateControl(t){const e=BX(t);if(BX.type.isDomNode(e)){BX.removeClass(e,this.parent.settings.get("classDisable"));e.disabled=null}},deactivateControl(t){const e=BX(t);if(BX.type.isDomNode(e)){BX.addClass(e,this.parent.settings.get("classDisable"));e.disabled=true}},showControl(t){const e=BX(t);e&&BX.show(e)},hideControl(t){const e=BX(t);e&&BX.hide(e)},validateActionObject(t){return BX.type.isPlainObject(t)&&"ACTION"in t&&BX.type.isNotEmptyString(t.ACTION)&&(t.ACTION===this.actions.RESET_CONTROLS||"DATA"in t&&BX.type.isArray(t.DATA))},validateControlObject(t){return BX.type.isPlainObject(t)&&"TYPE"in t&&"ID"in t},createDate(t,e){const i=this.createContainer(t.ID,e,{});const s=BX.decl({block:"main-ui-date",mix:["main-grid-panel-date"],calendarButton:true,valueDelete:true,placeholder:"PLACEHOLDER"in t?t.PLACEHOLDER:"",name:"NAME"in t?`${t.NAME}_from`:"",tabindex:"TABINDEX"in t?t.TABINDEX:"",value:"VALUE"in t?t.VALUE:"",enableTime:"TIME"in t?t.TIME?"true":"false":"false"});i.appendChild(s);return i},createControl(t,e){let i=null;switch(t.TYPE){case this.types.DROPDOWN:i=this.createDropdown(t,e);break;case this.types.CHECKBOX:i=this.createCheckbox(t,e);break;case this.types.TEXT:i=this.createText(t,e);break;case this.types.HIDDEN:i=this.createHidden(t,e);break;case this.types.BUTTON:i=this.createButton(t,e);break;case this.types.LINK:i=this.createLink(t,e);break;case this.types.CUSTOM:i=this.createCustom(t,e);break;case this.types.DATE:i=this.createDate(t,e);break}return i},onChangeHandler(container,actions,isPseudo){let newElement;let callback;const self=this;if(BX.type.isDomNode(container)&&BX.type.isArray(actions)){actions.forEach((function(action){if(self.validateActionObject(action)){if(action.ACTION===self.actions.CREATE){self.removeItemsRelativeCurrent(container);const t=BX.Runtime.clone(action.DATA).reverse();t.forEach((t=>{if(self.validateControlObject(t)){newElement=self.createControl(t,container.id||BX.data(container,"relative"));if(BX.type.isDomNode(newElement)){BX.insertAfter(newElement,container);if("ONCHANGE"in t&&t.TYPE===self.types.CHECKBOX&&"CHECKED"in t&&t.CHECKED){self.onChangeHandler(newElement,t.ONCHANGE)}if(t.TYPE===self.types.DROPDOWN&&BX.type.isArray(t.ITEMS)&&t.ITEMS.length>0&&"ONCHANGE"in t.ITEMS[0]&&BX.type.isArray(t.ITEMS[0].ONCHANGE)){self.onChangeHandler(newElement,t.ITEMS[0].ONCHANGE)}}}}))}if(action.ACTION===self.actions.ACTIVATE){self.removeItemsRelativeCurrent(container);if(BX.type.isArray(action.DATA)){action.DATA.forEach((t=>{self.lastActivated.push(t.ID);self.activateControl(t.ID)}))}}if(action.ACTION===self.actions.SHOW&&BX.type.isArray(action.DATA)){action.DATA.forEach((t=>{self.showControl(t.ID)}))}if(action.ACTION===self.actions.HIDE&&BX.type.isArray(action.DATA)){action.DATA.forEach((t=>{self.hideControl(t.ID)}))}if(action.ACTION===self.actions.HIDE_ALL_EXPECT&&BX.type.isArray(action.DATA)){(self.getControls()||[]).forEach((t=>{if(!action.DATA.some((e=>e.ID===t.id))){self.hideControl(t.id)}}))}if(action.ACTION===self.actions.SHOW_ALL){(self.getControls()||[]).forEach((t=>{self.showControl(t.id)}))}if(action.ACTION===self.actions.REMOVE&&BX.type.isArray(action.DATA)){action.DATA.forEach((t=>{BX.remove(BX(t.ID))}))}if(action.ACTION===self.actions.CALLBACK){this.confirmDialog(action,BX.delegate((()=>{if(BX.type.isArray(action.DATA)){action.DATA.forEach((currentCallback=>{if(currentCallback.JS.includes("Grid.")){callback=currentCallback.JS.replace("Grid","self.parent");callback=callback.replace("()","");callback+=".apply(self.parent, [container])";try{eval(callback)}catch(t){throw new Error(t)}}else if(BX.type.isNotEmptyString(currentCallback.JS)){try{eval(currentCallback.JS)}catch(t){throw new Error(t)}}}))}}),this))}if(action.ACTION===self.actions.RESET_CONTROLS){this.removeItemsRelativeCurrent(container)}}}),this)}else{if(!isPseudo){this.removeItemsRelativeCurrent(container)}self.lastActivated.forEach((t=>{self.deactivateControl(t)}));self.lastActivated=[]}},confirmDialog(t,e,i){this.parent.confirmDialog(t,e,i)},_dropdownChange(t,e,i,s){const n=BX(t);const o=n.parentNode;const a=s&&"ONCHANGE"in s?s.ONCHANGE:null;const r=s&&"PSEUDO"in s&&s.PSEUDO!==false;this.onChangeHandler(o,a,r)},_checkboxChange(event){let onChange;try{onChange=eval(BX.data(event.target,"onchange"))}catch{onChange=null}this.onChangeHandler(BX.findParent(event.target,{className:this.parent.settings.get("classPanelContainer")},true,false),event.target.checked||event.target.id.includes("actallrows_")?onChange:null)},_clickOnButton(event){let onChange;if(this.isButton(event.target)){event.preventDefault();try{onChange=eval(BX.data(event.target,"onchange"))}catch{onChange=null}this.onChangeHandler(BX.findParent(event.target,{className:this.parent.settings.get("classPanelContainer")},true,false),onChange)}},isButton(t){return BX.hasClass(t,this.parent.settings.get("classPanelButton"))},getSelectedIds(){const t=this.parent.getRows().getSelected().filter((t=>t.isShown()));return t.map((t=>t.getId()))},getControls(){return BX.findChild(this.getPanel(),{className:this.parent.settings.get("classPanelControlContainer")},true,true)},getValues(){const t={};const e=this;const i=[].concat(this.getDropdowns(),this.getTextInputs(),this.getHiddenInputs(),this.getSelects(),this.getCheckboxes(),this.getButtons());(i||[]).forEach((i=>{if(BX.type.isDomNode(i)){if(e.isDropdown(i)){let e=BX.data(i,"value");const s=BX.data(i,"multiple")==="Y";e=e!==null&&e!==undefined?e:"";t[BX.data(i,"name")]=s?e.split(","):e}if(e.isSelect(i)){t[i.getAttribute("name")]=i.options[i.selectedIndex].value}if(e.isCheckbox(i)&&i.checked){t[i.getAttribute("name")]=i.value}if(e.isTextInput(i)||e.isHiddenInput(i)){t[i.getAttribute("name")]=i.value}if(e.isButton(i)){const e=BX.data(i,"name");let s=BX.data(i,"value");s=s!==null&&s!==undefined?s:"";if(e){t[e]=s}}}}));return t}}})();(function(){BX.namespace("BX.Grid");BX.Grid.BaseClass=function(t){this.parent=t};BX.Grid.BaseClass.prototype={getParent(){return this.parent}}})();class CellActionState{}CellActionState.SHOW_BY_HOVER="main-grid-cell-content-action-by-hover";CellActionState.ACTIVE="main-grid-cell-content-action-active";const namespace=main_core.Reflection.namespace("BX.Grid");namespace.CellActionState=CellActionState;class CellActions{}CellActions.PIN="main-grid-cell-content-action-pin";CellActions.MUTE="main-grid-cell-content-action-mute";const namespace$1=main_core.Reflection.namespace("BX.Grid");namespace$1.CellActions=CellActions;(function(){BX.namespace("BX.Grid");BX.Grid.ColsSortable=function(t){this.parent=null;this.dragItem=null;this.targetItem=null;this.rowsList=null;this.colsList=null;this.dragRect=null;this.offset=null;this.startDragOffset=null;this.dragColumn=null;this.targetColumn=null;this.isDrag=null;this.init(t)};BX.Grid.ColsSortable.prototype={init(t){this.parent=t;this.colsList=this.getColsList();this.rowsList=this.getRowsList();if(!this.inited){this.inited=true;BX.addCustomEvent("Grid::updated",BX.proxy(this.reinit,this));BX.addCustomEvent("Grid::headerUpdated",BX.proxy(this.reinit,this))}this.registerObjects()},destroy(){BX.removeCustomEvent("Grid::updated",BX.proxy(this.reinit,this));this.unregisterObjects()},reinit(){this.unregisterObjects();this.reset();this.init(this.parent)},reset(){this.dragItem=null;this.targetItem=null;this.rowsList=null;this.colsList=null;this.dragRect=null;this.offset=null;this.startDragOffset=null;this.dragColumn=null;this.targetColumn=null;this.isDrag=null;this.fixedTableColsList=null},isActive(){return this.isDrag},registerObjects(){this.unregisterObjects();this.getColsList().forEach(this.register,this);this.getFixedHeaderColsList().forEach(this.register,this)},unregisterObjects(){this.getColsList().forEach(this.unregister,this);this.getFixedHeaderColsList().forEach(this.unregister,this)},unregister(t){jsDD.unregisterObject(t)},register(t){t.onbxdragstart=BX.proxy(this._onDragStart,this);t.onbxdrag=BX.proxy(this._onDrag,this);t.onbxdragstop=BX.proxy(this._onDragEnd,this);jsDD.registerObject(t)},getColsList(){if(!this.colsList){this.colsList=BX.Grid.Utils.getByTag(this.parent.getRows().getHeadFirstChild().getNode(),"th");this.colsList=this.colsList.filter((function(t){return!this.isStatic(t)}),this)}return this.colsList},getFixedHeaderColsList(){if(!this.fixedTableColsList&&this.parent.getParam("ALLOW_PIN_HEADER")){this.fixedTableColsList=BX.Grid.Utils.getByTag(this.parent.getPinHeader().getFixedTable(),"th");this.fixedTableColsList=this.fixedTableColsList.filter((function(t){return!this.isStatic(t)}),this)}return this.fixedTableColsList||[]},getRowsList(){let t=this.parent.getRows().getSourceRows();if(this.parent.getParam("ALLOW_PIN_HEADER")){t=t.concat(BX.Grid.Utils.getByTag(this.parent.getPinHeader().getFixedTable(),"tr"))}return t},isStatic(t){return BX.hasClass(t,this.parent.settings.get("classCellStatic"))&&!BX.hasClass(t,"main-grid-fixed-column")},getDragOffset(){const t=this.parent.getScrollContainer().scrollLeft-this.startScrollOffset;return jsDD.x-this.startDragOffset-this.dragRect.left+t},getColumn(t){let e=[];if(t instanceof HTMLTableCellElement){e=this.rowsList.map((e=>e.cells[t.cellIndex]))}return e},_onDragStart(){if(this.parent.getParam("ALLOW_PIN_HEADER")&&this.parent.getPinHeader().isPinned()){this.colsList=this.getFixedHeaderColsList()}else{this.colsList=this.getColsList()}this.startScrollOffset=this.parent.getScrollContainer().scrollLeft;this.isDrag=true;this.dragItem=jsDD.current_node;this.dragRect=this.dragItem.getBoundingClientRect();this.offset=Math.ceil(this.dragRect.width);this.startDragOffset=jsDD.start_x-this.dragRect.left;this.dragColumn=this.getColumn(this.dragItem);this.dragIndex=BX.Grid.Utils.getIndex(this.colsList,this.dragItem);this.parent.preventSortableClick=true},isDragToRight(t,e){const i=t.getBoundingClientRect();const s=Math.ceil(i.left+i.width/2+BX.scrollLeft(window));const n=this.dragIndex;const o=jsDD.x;return e>n&&o>s},isDragToLeft(t,e){const i=t.getBoundingClientRect();const s=Math.ceil(i.left+i.width/2+BX.scrollLeft(window));const n=this.dragIndex;const o=jsDD.x;return e<n&&o<s},isDragToBack(t,e){const i=t.getBoundingClientRect();const s=Math.ceil(i.left+i.width/2+BX.scrollLeft(window));const n=this.dragIndex;const o=jsDD.x;return e>n&&o<s||e<n&&o>s},isMovedToRight(t){return t.style.transform===`translate3d(${-this.offset}px, 0px, 0px)`},isMovedToLeft(t){return t.style.transform===`translate3d(${this.offset}px, 0px, 0px)`},isMoved(t){return t.style.transform!=="translate3d(0px, 0px, 0px)"&&t.style.transform!==""},moveColumn(t,e,i){i=BX.type.isNumber(i)?i:300;BX.Grid.Utils.styleForEach(t,{transition:`${i}ms`,transform:`translate3d(${e}px, 0px, 0px)`})},_onDrag(){this.dragOffset=this.getDragOffset();this.targetItem=this.targetItem||this.dragItem;this.targetColumn=this.targetColumn||this.dragColumn;const t=-this.offset;const e=this.offset;const i=0;const s=0;this.moveColumn(this.dragColumn,this.dragOffset,s);[].forEach.call(this.colsList,(function(s,n){if(s&&!s.classList.contains("main-grid-cell-static")){if(this.isDragToRight(s,n)&&!this.isMovedToRight(s)){this.targetColumn=this.getColumn(s);this.moveColumn(this.targetColumn,t)}if(this.isDragToLeft(s,n)&&!this.isMovedToLeft(s)){this.targetColumn=this.getColumn(s);this.moveColumn(this.targetColumn,e)}if(this.isDragToBack(s,n)&&this.isMoved(s)){this.targetColumn=this.getColumn(s);this.moveColumn(this.targetColumn,i)}}}),this)},_onDragEnd(){[].forEach.call(this.dragColumn,(function(t,e){BX.Grid.Utils.collectionSort(t,this.targetColumn[e])}),this);this.rowsList.forEach((t=>{BX.Grid.Utils.styleForEach(t.cells,{transition:"",transform:""})}));this.reinit();const t=this.colsList.map((t=>BX.data(t,"name")));this.parent.getUserOptions().setColumns(t);BX.onCustomEvent(this.parent.getContainer(),"Grid::columnMoved",[this.parent]);setTimeout((()=>{this.parent.preventSortableClick=false}),10)}}})();class Counters{}Counters.Type={LEFT:"left",LEFT_ALIGNED:"left-aligned",RIGHT:"right"};Counters.Color={DANGER:"ui-counter-danger",SUCCESS:"ui-counter-success",PRIMARY:"ui-counter-primary",GRAY:"ui-counter-gray",LIGHT:"ui-counter-light",DARK:"ui-counter-dark",WARNING:"ui-counter-warning"};Counters.Size={LARGE:"ui-counter-lg",MEDIUM:"ui-counter-md"};const namespace$2=main_core.Reflection.namespace("BX.Grid");namespace$2.Counters=Counters;(function(){BX.namespace("BX.Grid");const t=window.parent.BX.ajax.UpdatePageData;function e(){window.parent.BX.ajax.UpdatePageData=function(){}}function i(){window.parent.BX.ajax.UpdatePageData=t}BX.Grid.Data=function(t){this.parent=t;this.reset()};BX.Grid.Data.prototype.reset=function(){this.response=null;this.xhr=null;this.headRows=null;this.bodyRows=null;this.footRows=null;this.moreButton=null;this.pagination=null;this.counterDisplayed=null;this.counterSelected=null;this.counterTotal=null;this.limit=null;this.actionPanel=null;this.rowsByParentId={};this.rowById={};this.isValidResponse=null};BX.Grid.Data.prototype.getParent=function(){return this.parent};BX.Grid.Data.prototype.validateResponse=function(){if(!BX.type.isBoolean(this.isValidResponse)){this.isValidResponse=Boolean(this.getResponse())&&Boolean(BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classContainer"),true))}return this.isValidResponse};BX.Grid.Data.prototype.request=function(t,s,n,o,a,r){if(!BX.type.isString(t)){t=""}if(!BX.type.isNotEmptyString(s)){s="GET"}if(!BX.type.isPlainObject(n)){n={}}const l={gridId:this.parent.getId(),url:t,method:s,data:n};this.parent.disableCheckAllCheckboxes();BX.onCustomEvent(window,"Grid::beforeRequest",[this,l]);if(l.hasOwnProperty("cancelRequest")&&l.cancelRequest===true){return}t=l.url;if(!BX.type.isNotEmptyString(t)){t=this.parent.baseUrl}t=BX.Grid.Utils.addUrlParams(t,{sessid:BX.bitrix_sessid(),internal:"true",grid_id:this.parent.getId()});if("apply_filter"in n&&n.apply_filter==="Y"){t=BX.Grid.Utils.addUrlParams(t,{apply_filter:"Y"})}else{t=BX.util.remove_url_param(t,"apply_filter")}if("clear_nav"in n&&n.clear_nav==="Y"){t=BX.Grid.Utils.addUrlParams(t,{clear_nav:"Y"})}else{t=BX.util.remove_url_param(t,"clear_nav")}t=BX.Grid.Utils.addUrlParams(t,{grid_action:o||"showpage"});s=l.method;n=l.data;this.reset();const d=this;setTimeout((()=>{const l=BX.Http.Data.convertObjectToFormData(n);e();var h=BX.ajax({url:BX.Grid.Utils.ajaxUrl(t,d.getParent().getAjaxId()),data:l,method:s,dataType:"html",headers:[{name:"X-Ajax-Grid-UID",value:d.getParent().getAjaxId()},{name:"X-Ajax-Grid-Req",value:JSON.stringify({action:o||"showpage"})}],processData:true,scriptsRunFirst:false,start:false,preparePost:false,onsuccess(t){d.response=BX.create("div",{html:t});d.response=d.response.querySelector(`#${d.parent.getContainerId()}`);d.xhr=h;if(d.parent.getParam("HANDLE_RESPONSE_ERRORS")){let e;try{e=JSON.parse(t)}catch{e={messages:[]}}if(e.messages.length>0){d.parent.arParams.MESSAGES=e.messages;d.parent.messages.show();d.parent.tableUnfade();if(BX.type.isFunction(r)){BX.delegate(r,d)(h)}return}}if(BX.type.isFunction(a)){d.parent.enableCheckAllCheckboxes();BX.delegate(a,d)(t,h)}i()},onerror(t){d.error=r;d.xhr=h;if(BX.type.isFunction(r)){d.parent.enableCheckAllCheckboxes();BX.delegate(r,d)(h,t)}}});h.send(l)}),0)};BX.Grid.Data.prototype.getResponse=function(){return this.response};BX.Grid.Data.prototype.getContainer=function(){const t=this.getParent().settings.get("classContainer");if(BX.Dom.hasClass(this.getResponse(),t)){return this.getResponse()}return BX.Grid.Utils.getByClass(this.getResponse(),t,true)};BX.Grid.Data.prototype.getHeadRows=function(){if(!this.headRows){this.headRows=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classHeadRow"))}return this.headRows};BX.Grid.Data.prototype.getBodyRows=function(){if(!this.bodyRows){this.bodyRows=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classBodyRow"))}return this.bodyRows};BX.Grid.Data.prototype.getRowsByParentId=function(t){if(!(t in this.rowsByParentId)){this.rowsByParentId[t]=BX.Grid.Utils.getBySelector(this.getResponse(),`.${this.getParent().settings.get("classBodyRow")}[data-parent-id="${t}"]`)}return this.rowsByParentId[t]};BX.Grid.Data.prototype.getRowById=function(t){if(!(t in this.rowById)){this.rowById[t]=BX.Grid.Utils.getBySelector(this.getResponse(),`.${this.getParent().settings.get("classBodyRow")}[data-id="${t}"]`,true)}return this.rowById[t]};BX.Grid.Data.prototype.getFootRows=function(){if(!this.footRows){this.footRows=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classFootRow"))}return this.footRows};BX.Grid.Data.prototype.getMoreButton=function(){if(!this.moreButton){this.moreButton=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classMoreButton"),true)}return this.moreButton};BX.Grid.Data.prototype.getPagination=function(){if(!this.pagination){this.pagination=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classPagination"),true);if(BX.type.isDomNode(this.pagination)){this.pagination=BX.firstChild(this.pagination)}}return this.pagination};BX.Grid.Data.prototype.getCounterDisplayed=function(){if(!this.counterDisplayed){this.counterDisplayed=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classCounterDisplayed"),true)}return this.counterDisplayed};BX.Grid.Data.prototype.getCounterSelected=function(){if(!this.counterSelected){this.counterSelected=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classCounterSelected"),true)}return this.counterSelected};BX.Grid.Data.prototype.getCounterTotal=function(){if(!BX.type.isDomNode(this.counterTotal)){const t=`.${this.getParent().settings.get("classCounterTotal")} .${this.getParent().settings.get("classPanelCellContent")}`;this.counterTotal=BX.Grid.Utils.getBySelector(this.getResponse(),t,true)}return this.counterTotal};BX.Grid.Data.prototype.getLimit=function(){if(!this.limit){this.limit=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classPageSize"),true)}return this.limit};BX.Grid.Data.prototype.getPageSize=function(){return this.getLimit()};BX.Grid.Data.prototype.getActionPanel=function(){if(!this.actionPanel){this.actionPanel=BX.Grid.Utils.getByClass(this.getResponse(),this.getParent().settings.get("classActionPanel"),true)}return this.actionPanel}})();(function(){BX.namespace("BX.Main");BX.Main.dropdown=function(t){this.id=null;this.dropdown=null;this.items=null;this.value=null;this.menuId=null;this.menu=null;this.menuItems=null;this.multiple=null;this.emptyText=null;this.dataItems="items";this.dataValue="value";this.dataPseudo="pseudo";this.dropdownItemClass="main-dropdown-item";this.activeClass="main-dropdown-active";this.selectedClass="main-dropdown-item-selected";this.notSelectedClass="main-dropdown-item-not-selected";this.lockedClass="main-dropdown-item-locked";this.menuItemClass="menu-popup-item";this.init(t)};BX.Main.dropdown.prototype={init(t){this.id=t.id;this.dropdown=t;this.items=this.getItems();this.value=this.getValue();this.menuId=this.getMenuId();this.multiple=this.getMultiple();this.emptyText=this.getEmptyText();this.menu=this.createMenu();this.menu.popupWindow.show();this.adjustPosition();BX.bind(this.dropdown,"click",BX.delegate(this.showMenu,this))},getMenuId(){return`${this.id}_menu`},getItems(){let t;try{const e=this.dropdown.dataset[this.dataItems];t=JSON.parse(e);t=t.map((t=>{t.VALUE=String(t.VALUE);return t}))}catch{t=[]}return t},getValue(){return this.dropdown.dataset[this.dataValue]},getValueItem(){const t=this.getValue();return this.items.find((e=>e.VALUE===t))},getValueAsArray(){let t=this.getValue();if(t===undefined){t=""}return t.toString().split(",").filter((t=>t!==""))},getValueItems(){const t=this.getValueAsArray();return this.items.filter((e=>t.includes(e.VALUE)))},toggleValue(t){if(this.multiple){if(t||t===0||t==="0"){const e=this.getValueAsArray();const i=e.indexOf(t);if(i<0){e.push(t)}else{e.splice(i,1)}this.dropdown.dataset[this.dataValue]=e.join(",")}else{this.dropdown.dataset[this.dataValue]=null}}else{this.dropdown.dataset[this.dataValue]=t}},getValueText(){if(this.multiple){return this.getValueItems().map((t=>t.NAME)).filter((t=>Boolean(t))).join(", ")||this.emptyText}const t=this.getValueItem();return t?t.NAME:this.emptyText},getMultiple(){return this.dropdown.dataset.multiple==="Y"},getEmptyText(){return this.dropdown.dataset.emptyText||null},prepareMenuItems(){const t=this;let e;let i;const s=this.multiple?this.getValueAsArray():this.getValue();function n(o){const a=t.dropdown.dataset.htmlEntity==="true";return o.map((o=>{e={};e[`data-${t.dataValue}`]=o.VALUE;e[`data-${t.dataPseudo}`]="PSEUDO"in o&&o.PSEUDO?"true":"false";i=BX.create("div",{children:[BX.create("span",{props:{className:t.dropdownItemClass},attrs:e,html:a?o.NAME:null,text:a?null:o.NAME})]});const r=t.multiple?s.includes(o.VALUE):s===o.VALUE;return{html:i.innerHTML,className:r?t.selectedClass:t.notSelectedClass,delimiter:o.DELIMITER,items:"ITEMS"in o?n(o.ITEMS):null}}))}const o=n(this.items);BX.onCustomEvent(window,"Dropdown::onPrepareItems",[this.id,this.menuId,o]);return o},createMenu(){const t=this;return BX.PopupMenu.create(this.getMenuId(),this.dropdown,this.prepareMenuItems(),{autoHide:true,offsetTop:-8,offsetLeft:Number(this.dropdown.dataset.menuOffsetLeft||40),maxHeight:Number(this.dropdown.dataset.menuMaxHeight||170),events:{onPopupClose:BX.delegate(this._onCloseMenu,this),onPopupShow(){t._onShowMenu()}}})},showMenu(){this.menu=BX.PopupMenu.getMenuById(this.menuId);if(!this.menu){this.menu=this.createMenu();this.menu.popupWindow.show()}this.adjustPosition()},adjustPosition(){if(this.dropdown.dataset.popupPosition==="fixed"){const t=this.menu.popupWindow.popupContainer;t.style.setProperty("top","auto");t.style.setProperty("bottom","45px");t.style.setProperty("left","0px");this.dropdown.appendChild(t)}},getSubItem(t){return BX.Grid.Utils.getByClass(t,this.dropdownItemClass,true)},refresh(t){const e=this.getSubItem(t);let i=BX.data(e,this.dataValue);if(BX.Type.isUndefined(i)){i=""}this.toggleValue(i);if(this.dropdown.dataset.htmlEntity==="true"){BX.firstChild(this.dropdown).innerHTML=this.getValueText()}else{BX.firstChild(this.dropdown).innerText=this.getValueText()}},selectItem(t){const e=this;(this.menu.menuItems||[]).forEach((i=>{if(e.multiple){if(t===i.layout.item){if(BX.hasClass(t,e.selectedClass)){BX.addClass(i.layout.item,e.notSelectedClass);BX.removeClass(i.layout.item,e.selectedClass)}else{BX.removeClass(i.layout.item,e.notSelectedClass);BX.addClass(i.layout.item,e.selectedClass)}}return}BX.removeClass(i.layout.item,e.selectedClass);if(t===i.layout.item){BX.removeClass(i.layout.item,e.notSelectedClass);BX.addClass(i.layout.item,e.selectedClass)}else{BX.addClass(i.layout.item,e.notSelectedClass)}}))},lockedItem(t){BX.addClass(t,this.lockedClass)},getDataItemIndexByValue(t,e){if(BX.type.isArray(t)){t.map(((t,i)=>{if(t.VALUE===e){return false}}))}return false},getDataItemByValue(t){const e=this.items.filter((e=>e.VALUE===t));return e.length>0?e[0]:null},_onShowMenu(){const t=this;BX.addClass(this.dropdown,this.activeClass);(this.menu.menuItems||[]).forEach((e=>{BX.bind(e.layout.item,"click",BX.delegate(t._onItemClick,t))}))},_onCloseMenu(){BX.removeClass(this.dropdown,this.activeClass);BX.PopupMenu.destroy(this.menuId)},_onItemClick(t){const e=this.getMenuItem(t.target);let i;let s;const n=this.getSubItem(e);const o=BX.data(n,"pseudo");if(o==="true"){i=BX.data(n,"value");s=this.getDataItemByValue(i)}else{this.refresh(e);this.selectItem(e);if(!this.multiple){this.menu.popupWindow.close()}i=this.getValue();s=this.getDataItemByValue(i)}t.stopPropagation();BX.onCustomEvent(window,"Dropdown::change",[this.dropdown.id,t,e,s,i])},getMenuItem(t){let e=t;if(!BX.hasClass(e,this.menuItemClass)){e=BX.findParent(e,{class:this.menuItemClass})}return e}}})();(function(){BX.namespace("BX.Main");BX.Main.dropdownManager={dropdownClass:"main-dropdown",data:{},init(){const self=this;let result;let onLoadItems;let items;BX.bind(document,"click",BX.delegate((function(t){if(BX.hasClass(t.target,this.dropdownClass)){t.preventDefault();result=this.getById(t.target.id);if(result&&result.dropdown===t.target){self.push(t.target.id,this.getById(t.target.id))}else{self.push(t.target.id,new BX.Main.dropdown(t.target))}}}),this));onLoadItems=BX.Grid.Utils.getByClass(document.body,this.dropdownClass);if(BX.type.isArray(onLoadItems)){onLoadItems.forEach((current=>{result=self.getById(current.id);try{items=eval(BX.data(current,"items"))}catch{}BX.onCustomEvent(window,"Dropdown::load",[current.id,{},null,BX.type.isArray(items)&&items.length>0?items[0]:[],BX.data(current,"value")])}))}},push(t,e){this.data[t]=e},getById(t){return t in this.data?this.data[t]:null}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Element=function(t,e){this.node=null;this.href=null;this.parent=null;this.init(t,e)};BX.Grid.Element.prototype={init(t,e){this.node=t;this.parent=e;this.resetOnclickAttr()},getParent(){return this.parent},load(){BX.addClass(this.getNode(),this.getParent().settings.get("classLoad"))},unload(){BX.removeClass(this.getNode(),this.getParent().settings.get("classLoad"))},isLoad(){return BX.hasClass(this.getNode(),this.getParent().settings.get("classLoad"))},resetOnclickAttr(){if(BX.type.isDomNode(this.getNode())){this.getNode().onclick=null}},getObserver(){return BX.Grid.observer},getNode(){return this.node},getLink(){let t;try{t=this.getNode().href}catch{t=null}return t}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Fader=function(t){this.parent=null;this.table=null;this.container=null;this.init(t)};BX.Grid.Fader.prototype={init(t){this.parent=t;this.table=this.parent.getTable();this.container=this.table.parentNode;this.scrollStartEventName=this.parent.isTouch()?"touchstart":"mouseenter";this.scrollEndEventName=this.parent.isTouch()?"touchend":"mouseleave";if(this.parent.getParam("ALLOW_PIN_HEADER")){this.fixedTable=this.parent.getPinHeader().getFixedTable()}this.debounceScrollHandler=BX.debounce(this._onWindowScroll,400,this);BX.bind(window,"resize",BX.proxy(this.toggle,this));document.addEventListener("scroll",this.debounceScrollHandler,BX.Grid.Utils.listenerParams({passive:true}));this.container.addEventListener("scroll",BX.proxy(this.toggle,this),BX.Grid.Utils.listenerParams({passive:true}));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this.toggle,this));BX.addCustomEvent(window,"Grid::resize",BX.proxy(this.toggle,this));BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this._onHeaderUpdated,this));BX.addCustomEvent(window,"Grid::columnResize",BX.proxy(this.toggle,this));BX.bind(this.getEarLeft(),this.scrollStartEventName,BX.proxy(this._onMouseoverLeft,this));BX.bind(this.getEarRight(),this.scrollStartEventName,BX.proxy(this._onMouseoverRight,this));BX.bind(this.getEarLeft(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));BX.bind(this.getEarRight(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));this.toggle();this.adjustEarOffset(true)},destroy(){BX.unbind(window,"resize",BX.proxy(this.toggle,this));document.removeEventListener("scroll",this.debounceScrollHandler,BX.Grid.Utils.listenerParams({passive:true}));this.container.removeEventListener("scroll",BX.proxy(this.toggle,this),BX.Grid.Utils.listenerParams({passive:true}));BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this.toggle,this));BX.removeCustomEvent(window,"Grid::headerUpdated",BX.proxy(this._onHeaderUpdated,this));BX.removeCustomEvent(window,"Grid::columnResize",BX.proxy(this.toggle,this));BX.unbind(this.getEarLeft(),this.scrollStartEventName,BX.proxy(this._onMouseoverLeft,this));BX.unbind(this.getEarRight(),this.scrollStartEventName,BX.proxy(this._onMouseoverRight,this));BX.unbind(this.getEarLeft(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));BX.unbind(this.getEarRight(),this.scrollEndEventName,BX.proxy(this.stopScroll,this));this.hideLeftEar();this.hideRightEar();this.stopScroll()},_onHeaderUpdated(){if(this.parent.getParam("ALLOW_PIN_HEADER")){this.fixedTable=this.parent.getPinHeader().getFixedTable()}},_onMouseoverLeft(t){this.parent.isTouch()&&t.preventDefault();this.startScrollByDirection("left")},_onMouseoverRight(t){this.parent.isTouch()&&t.preventDefault();this.startScrollByDirection("right")},stopScroll(){clearTimeout(this.scrollTimer);clearInterval(this.scrollInterval)},startScrollByDirection(t){const e=this.container;let i=e.scrollLeft;const s=this;const n=8;const o=1e3/60/2;this.scrollTimer=setTimeout((()=>{s.scrollInterval=setInterval((()=>{e.scrollLeft=t=="right"?i+=n:i-=n}),o)}),100)},getEarLeft(){if(!this.earLeft){this.earLeft=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classEarLeft"),true)}return this.earLeft},getEarRight(){if(!this.earRight){this.earRight=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classEarRight"),true)}return this.earRight},getShadowLeft(){return this.parent.getContainer().querySelector(".main-grid-fade-shadow-left")},getShadowRight(){return this.parent.getContainer().querySelector(".main-grid-fade-shadow-right")},adjustEarOffset(t){if(t){this.windowHeight=BX.height(window);this.tbodyPos=BX.pos(this.table.tBodies[0]);this.headerPos=BX.pos(this.table.tHead)}let e=window.scrollY;if(this.parent.isIE()){e=document.documentElement.scrollTop}let i=e+this.windowHeight-this.tbodyPos.top;let s=e-this.tbodyPos.top;if(i>this.tbodyPos.bottom-this.tbodyPos.top){i=this.tbodyPos.bottom-this.tbodyPos.top}if(s<this.headerPos.height){s=this.headerPos.height}else{i-=s;i+=this.headerPos.height}BX.Grid.Utils.requestAnimationFrame(BX.proxy((function(){if(s!==this.lastPosTop){const t=`translate3d(0px, ${s}px, 0)`;this.getEarLeft().style.transform=t;this.getEarRight().style.transform=t}if(i!==this.lastBottomPos){this.getEarLeft().style.height=`${i}px`;this.getEarRight().style.height=`${i}px`}this.lastPosTop=s;this.lastBottomPos=i}),this))},_onWindowScroll(){this.adjustEarOffset()},hasScroll(){return this.table.offsetWidth>this.container.clientWidth},hasScrollLeft(){return this.container.scrollLeft>0},hasScrollRight(){return this.table.offsetWidth>Math.round(this.container.scrollLeft+this.container.clientWidth)},showLeftEar(){BX.addClass(this.container.parentNode,this.parent.settings.get("classFadeContainerLeft"));BX.addClass(this.getEarLeft(),this.parent.settings.get("classShow"))},hideLeftEar(){BX.removeClass(this.container.parentNode,this.parent.settings.get("classFadeContainerLeft"));BX.removeClass(this.getEarLeft(),this.parent.settings.get("classShow"))},showRightEar(){BX.addClass(this.container.parentNode,this.parent.settings.get("classFadeContainerRight"));BX.addClass(this.getEarRight(),this.parent.settings.get("classShow"))},hideRightEar(){BX.removeClass(this.container.parentNode,this.parent.settings.get("classFadeContainerRight"));BX.removeClass(this.getEarRight(),this.parent.settings.get("classShow"))},adjustFixedTablePosition(){const t=this.container.scrollLeft;BX.Grid.Utils.requestAnimationFrame(BX.delegate((function(){this.fixedTable.style.marginLeft=`${-t}px`}),this))},toggle(){this.adjustEarOffset(true);this.fixedTable&&this.adjustFixedTablePosition();if(this.hasScroll()){this.hasScrollLeft()?this.showLeftEar():this.hideLeftEar();this.hasScrollRight()?this.showRightEar():this.hideRightEar()}else{this.hideLeftEar();this.hideRightEar()}}}})();(function(){BX.namespace("BX.Main");BX.Main.grid=function(t,e,i,s,n,o,a,r,l){BX.Event.EventEmitter.makeObservable(this,"BX.Main.Grid");this.settings=null;this.containerId="";this.container=null;this.wrapper=null;this.fadeContainer=null;this.scrollContainer=null;this.pagination=null;this.moreButton=null;this.table=null;this.rows=null;this.history=false;this.userOptions=null;this.checkAll=null;this.sortable=null;this.updater=null;this.data=null;this.fader=null;this.editor=null;this.isEditMode=null;this.pinHeader=null;this.pinPanel=null;this.arParams=null;this.resize=null;this.editableRows=[];this.init(t,e,i,s,n,o,a,r,l)};BX.Main.grid.prototype={init(t,e,i,s,n,o,a,r,l){this.baseUrl=window.location.pathname+window.location.search;this.container=BX(t);if(!BX.type.isNotEmptyString(t)){throw"BX.Main.grid.init: parameter containerId is empty"}if(BX.type.isPlainObject(e)){this.arParams=e}else{throw new TypeError("BX.Main.grid.init: arParams isn't object")}this.settings=new BX.Grid.Settings;this.containerId=t;this.userOptions=new BX.Grid.UserOptions(this,i,s,n);this.gridSettings=new BX.Grid.SettingsWindow.Manager(this);this.messages=new BX.Grid.Message(this,l);this.cache=new BX.Cache.MemoryCache;if(this.getParam("ALLOW_PIN_HEADER")){this.pinHeader=new BX.Grid.PinHeader(this);BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.bindOnCheckAll,this))}this.bindOnCheckAll();if(this.getParam("ALLOW_HORIZONTAL_SCROLL")){this.fader=new BX.Grid.Fader(this)}this.pageSize=new BX.Grid.Pagesize(this);this.editor=new BX.Grid.InlineEditor(this,r);if(this.getParam("SHOW_ACTION_PANEL")){this.actionPanel=new BX.Grid.ActionPanel(this,o,a);this.pinPanel=new BX.Grid.PinPanel(this)}this.isEditMode=false;if(!BX.type.isDomNode(this.getContainer())){throw`BX.Main.grid.init: Failed to find container with id ${this.getContainerId()}`}if(!BX.type.isDomNode(this.getTable())){throw"BX.Main.grid.init: Failed to find table"}this.bindOnRowEvents();if(this.getParam("ALLOW_COLUMNS_RESIZE")){this.resize=new BX.Grid.Resize(this)}this.bindOnMoreButtonEvents();this.bindOnClickPaginationLinks();this.bindOnClickHeader();if(this.getParam("ALLOW_ROWS_SORT")){this.initRowsDragAndDrop()}if(this.getParam("ALLOW_COLUMNS_SORT")){this.initColsDragAndDrop()}this.getRows().initSelected();this.adjustEmptyTable(this.getRows().getSourceBodyChild());BX.onCustomEvent(this.getContainer(),"Grid::ready",[this]);BX.addCustomEvent(window,"Grid::unselectRow",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::unselectRows",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this._onGridUpdated,this));window.frames[this.getFrameId()].onresize=BX.throttle(this._onFrameResize,20,this);if(this.getParam("ALLOW_STICKED_COLUMNS")){this.initStickedColumns()}},destroy(){BX.removeCustomEvent(window,"Grid::unselectRow",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::unselectRows",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::headerPinned",BX.proxy(this.bindOnCheckAll,this));BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this._onGridUpdated,this));this.getPinHeader()&&this.getPinHeader().destroy();this.getFader()&&this.getFader().destroy();this.getResize()&&this.getResize().destroy();this.getColsSortable()&&this.getColsSortable().destroy();this.getRowsSortable()&&this.getRowsSortable().destroy();this.getSettingsWindow()&&this.getSettingsWindow().destroy();this.getActionsPanel()&&this.getActionsPanel().destroy();this.getPinPanel()&&this.getPinPanel().destroy();this.getPageSize()&&this.getPageSize().destroy()},_onFrameResize(){BX.onCustomEvent(window,"Grid::resize",[this])},_onGridUpdated(){this.initStickedColumns();this.adjustFadePosition(this.getFadeOffset())},getFrameId(){return`main-grid-tmp-frame-${this.getContainerId()}`},enableActionsPanel(){if(this.getParam("SHOW_ACTION_PANEL")){const t=this.getActionsPanel().getPanel();if(BX.type.isDomNode(t)){BX.removeClass(t,this.settings.get("classDisable"))}}},disableActionsPanel(){if(this.getParam("SHOW_ACTION_PANEL")){const t=this.getActionsPanel().getPanel();if(BX.type.isDomNode(t)){BX.addClass(t,this.settings.get("classDisable"))}}},getSettingsWindow(){return this.gridSettings},_onUnselectRows(){const t=this.getActionsPanel();let e;if(t instanceof BX.Grid.ActionPanel){e=t.getForAllCheckbox();if(BX.type.isDomNode(e)){e.checked=null;this.disableForAllCounter()}}this.adjustCheckAllCheckboxes()},isIE(){if(!BX.type.isBoolean(this.ie)){this.ie=BX.hasClass(document.documentElement,"bx-ie")}return this.ie},isTouch(){if(!BX.type.isBoolean(this.touch)){this.touch=BX.hasClass(document.documentElement,"bx-touch")}return this.touch},getParam(t,e){if(e===undefined){e=null}return this.arParams.hasOwnProperty(t)?this.arParams[t]:e},getCounterTotal(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterTotal"),true)},getActionKey(){return`action_button_${this.getId()}`},getPinHeader(){if(this.getParam("ALLOW_PIN_HEADER")){this.pinHeader=this.pinHeader||new BX.Grid.PinHeader(this)}return this.pinHeader},getResize(){if(!(this.resize instanceof BX.Grid.Resize)&&this.getParam("ALLOW_COLUMNS_RESIZE")){this.resize=new BX.Grid.Resize(this)}return this.resize},confirmForAll(t){let e;const i=this;if(BX.type.isDomNode(t)){e=BX.Grid.Utils.getByTag(t,"input",true)}if(e.checked){this.getActionsPanel().confirmDialog({CONFIRM:true,CONFIRM_MESSAGE:this.arParams.CONFIRM_FOR_ALL_MESSAGE},(()=>{if(BX.type.isDomNode(e)){e.checked=true}i.selectAllCheckAllCheckboxes();i.getRows().selectAll();i.enableForAllCounter();i.updateCounterDisplayed();i.updateCounterSelected();i.enableActionsPanel();i.adjustCheckAllCheckboxes();i.lastRowAction=null;BX.onCustomEvent(window,"Grid::allRowsSelected",[])}),(()=>{if(BX.type.isDomNode(e)){e.checked=null;i.disableForAllCounter();i.updateCounterDisplayed();i.updateCounterSelected();i.adjustCheckAllCheckboxes();i.lastRowAction=null}}))}else{this.unselectAllCheckAllCheckboxes();this.adjustCheckAllCheckboxes();this.getRows().unselectAll();this.disableForAllCounter();this.updateCounterDisplayed();this.updateCounterSelected();this.disableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsUnselected",[])}},disableCheckAllCheckboxes(){this.getCheckAllCheckboxes().forEach((t=>{t.getNode().disabled=true}))},enableCheckAllCheckboxes(){this.getCheckAllCheckboxes().forEach((t=>{t.getNode().disabled=false}))},indeterminateCheckAllCheckboxes(){this.getCheckAllCheckboxes().forEach((t=>{t.getNode().indeterminate=true}))},determinateCheckAllCheckboxes(){this.getCheckAllCheckboxes().forEach((t=>{t.getNode().indeterminate=false}))},editSelected(){this.disableCheckAllCheckboxes();this.getRows().editSelected();if(this.getParam("ALLOW_PIN_HEADER")){this.getPinHeader()._onGridUpdate()}BX.onCustomEvent(window,"Grid::resize",[this])},editSelectedSave(){const t={FIELDS:this.getRows().getEditSelectedValues(true)};if(this.getParam("ALLOW_VALIDATE")){this.tableFade();t[this.getActionKey()]="validate";this.getData().request("","POST",t,"validate",(e=>{e=JSON.parse(e);if(e.messages.length>0){this.arParams.MESSAGES=e.messages;this.messages.show();const t=this.getActionsPanel().getButtons().find((t=>t.id==="grid_edit_button_control"));this.tableUnfade();BX.fireEvent(t,"click")}else{t[this.getActionKey()]="edit";this.reloadTable("POST",t)}}));return}if(this.getParam("HANDLE_RESPONSE_ERRORS")){t[this.getActionKey()]="edit";const e=this;this.tableFade();this.getData().request("","POST",t,"",(function(t){try{t=JSON.parse(t)}catch{t={messages:[]}}if(t.messages.length>0){e.arParams.MESSAGES=t.messages;e.messages.show();const i=e.getActionsPanel().getButtons().find((t=>t.id==="grid_edit_button_control"));e.tableUnfade();BX.fireEvent(i,"click");return}e.getRows().reset();const i=this.getBodyRows();e.getUpdater().updateContainer(this.getContainer());e.getUpdater().updateHeadRows(this.getHeadRows());e.getUpdater().updateBodyRows(i);e.getUpdater().updateFootRows(this.getFootRows());e.getUpdater().updatePagination(this.getPagination());e.getUpdater().updateMoreButton(this.getMoreButton());e.getUpdater().updateCounterTotal(this.getCounterTotal());e.adjustEmptyTable(i);e.bindOnRowEvents();e.bindOnMoreButtonEvents();e.bindOnClickPaginationLinks();e.bindOnClickHeader();e.bindOnCheckAll();e.updateCounterDisplayed();e.updateCounterSelected();e.disableActionsPanel();e.disableForAllCounter();if(e.getParam("SHOW_ACTION_PANEL")){e.getUpdater().updateGroupActions(this.getActionPanel())}if(e.getParam("ALLOW_COLUMNS_SORT")){e.colsSortable.reinit()}if(e.getParam("ALLOW_ROWS_SORT")){e.rowsSortable.reinit()}e.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[e])}),(t=>{const i=e.getActionsPanel().getButtons().find((t=>t.id==="grid_edit_button_control"));e.tableUnfade();BX.fireEvent(i,"click")}));return}t[this.getActionKey()]="edit";this.reloadTable("POST",t)},getForAllKey(){return`action_all_rows_${this.getId()}`},updateRow(t,e,i,s){const n=this.getRows().getById(t);if(n instanceof BX.Grid.Row){n.update(e,i,s)}},removeRow(t,e,i,s){const n=this.getRows().getById(t);if(n instanceof BX.Grid.Row){n.remove(e,i,s)}},addRow(t,e,i){const s=this.getUserOptions().getAction("GRID_ADD_ROW");const n={action:s,data:t};const o=this;this.tableFade();this.getData().request(e,"POST",n,null,(function(){const e=this.getBodyRows();o.getUpdater().updateBodyRows(e);o.tableUnfade();o.getRows().reset();o.getUpdater().updateFootRows(this.getFootRows());o.getUpdater().updatePagination(this.getPagination());o.getUpdater().updateMoreButton(this.getMoreButton());o.getUpdater().updateCounterTotal(this.getCounterTotal());o.bindOnRowEvents();o.adjustEmptyTable(e);o.bindOnMoreButtonEvents();o.bindOnClickPaginationLinks();o.updateCounterDisplayed();o.updateCounterSelected();if(o.getParam("ALLOW_COLUMNS_SORT")){o.colsSortable.reinit()}if(o.getParam("ALLOW_ROWS_SORT")){o.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowAdded",[{data:t,grid:o,response:this}]);BX.onCustomEvent(window,"Grid::updated",[o]);if(BX.type.isFunction(i)){i({data:t,grid:o,response:this})}}))},editSelectedCancel(){this.getRows().editSelectedCancel();this.enableCheckAllCheckboxes();if(this.getParam("ALLOW_PIN_HEADER")){this.getPinHeader()._onGridUpdate()}},removeSelected(){const t={ID:this.getRows().getSelectedIds()};const e=this.getActionsPanel().getValues();t[this.getActionKey()]="delete";t[this.getForAllKey()]=this.getForAllKey()in e?e[this.getForAllKey()]:"N";this.reloadTable("POST",t)},sendSelected(){const t=this.getActionsPanel().getValues();const e=this.getRows().getSelectedIds();const i={rows:e,controls:t};this.reloadTable("POST",i)},sendRowAction(t,e){if(!BX.type.isPlainObject(e)){e={}}e[this.getActionKey()]=t;this.reloadTable("POST",e)},getActionsPanel(){return this.actionPanel},getPinPanel(){return this.pinPanel},getApplyButton(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classPanelButton"),true)},getEditor(){return this.editor},reload(t){this.reloadTable("GET",{},null,t)},getPanels(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classPanels"),true)},getEmptyBlock(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classEmptyBlock"),true)},adjustEmptyTable(t){function e(t){const e=t.currentTarget;BX.style(s,"transform",`translate3d(${BX.scrollLeft(e)}px, 0px, 0`)}const i=t.filter((t=>BX.Dom.attr(t,"data-id")!=="template_0"&&!BX.Dom.hasClass(t,"main-grid-hide")));if(!BX.hasClass(document.documentElement,"bx-ie")&&i.length===1&&BX.hasClass(i[0],this.settings.get("classEmptyRows"))){const t=BX.pos(this.getContainer());const i=BX.scrollTop(window)+BX.height(window);const n=t.bottom-i;const o=BX.height(this.getPanels());var s=this.getEmptyBlock();const a=BX.width(this.getContainer());if(a){BX.width(s,a)}BX.style(s,"transform",`translate3d(${BX.scrollLeft(this.getScrollContainer())}px, 0px, 0`);BX.unbind(this.getScrollContainer(),"scroll",e);BX.bind(this.getScrollContainer(),"scroll",e);let r=this.getContainer();let l=0;while(r=r.parentElement){const t=parseFloat(BX.style(r,"padding-top"));const e=parseFloat(BX.style(r,"padding-bottom"));if(!isNaN(t)){l+=t}if(!isNaN(e)){l+=e}}if(n>0){BX.style(this.getTable(),"min-height",`${t.height-n-o-l}px`)}else if(Math.abs(n)===i){BX.style(this.getTable(),"min-height","")}else{BX.style(this.getTable(),"min-height",`${t.height+Math.abs(n)-o-l}px`)}BX.Dom.addClass(this.getContainer(),"main-grid-empty-stub");if(this.getCurrentPage()<=1){this.hidePanels()}}else{BX.style(this.getTable(),"min-height","");BX.style(this.getTable(),"height","1px");requestAnimationFrame((()=>{BX.style(this.getTable(),"height","1px")}));this.showPanels();BX.Dom.removeClass(this.getContainer(),"main-grid-empty-stub")}},reloadTable(t,e,i,s){let n;if(!BX.type.isNotEmptyString(t)){t="GET"}if(!BX.type.isPlainObject(e)){e={}}const o=this;this.tableFade();if(!BX.type.isString(s)){s=""}this.getData().request(s,t,e,"",(function(){BX.onCustomEvent(window,"BX.Main.Grid:onBeforeReload",[o]);o.getRows().reset();n=this.getBodyRows();o.getUpdater().updateContainer(this.getContainer());o.getUpdater().updateHeadRows(this.getHeadRows());o.getUpdater().updateBodyRows(n);o.getUpdater().updateFootRows(this.getFootRows());o.getUpdater().updatePagination(this.getPagination());o.getUpdater().updateMoreButton(this.getMoreButton());o.getUpdater().updateCounterTotal(this.getCounterTotal());o.adjustEmptyTable(n);o.bindOnRowEvents();o.bindOnMoreButtonEvents();o.bindOnClickPaginationLinks();o.bindOnClickHeader();o.bindOnCheckAll();o.updateCounterDisplayed();o.updateCounterSelected();o.disableActionsPanel();o.disableForAllCounter();if(o.getParam("SHOW_ACTION_PANEL")){o.getUpdater().updateGroupActions(this.getActionPanel())}if(o.getParam("ALLOW_COLUMNS_SORT")){o.colsSortable.reinit()}if(o.getParam("ALLOW_ROWS_SORT")){o.rowsSortable.reinit()}o.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[o]);if(BX.type.isFunction(i)){i()}if(o.getParam("ALLOW_PIN_HEADER")){o.getPinHeader()._onGridUpdate()}}))},getGroupEditButton(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classGroupEditButton"),true)},getGroupDeleteButton(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classGroupDeleteButton"),true)},enableGroupActions(){const t=this.getGroupEditButton();const e=this.getGroupDeleteButton();if(BX.type.isDomNode(t)){BX.removeClass(t,this.settings.get("classGroupActionsDisabled"))}if(BX.type.isDomNode(e)){BX.removeClass(e,this.settings.get("classGroupActionsDisabled"))}},disableGroupActions(){const t=this.getGroupEditButton();const e=this.getGroupDeleteButton();if(BX.type.isDomNode(t)){BX.addClass(t,this.settings.get("classGroupActionsDisabled"))}if(BX.type.isDomNode(e)){BX.addClass(e,this.settings.get("classGroupActionsDisabled"))}},closeActionsMenu(){const t=this.getRows().getRows();for(let e=0,i=t.length;e<i;e++){t[e].closeActionsMenu()}},getPageSize(){return this.pageSize},getFader(){return this.fader},getData(){this.data=this.data||new BX.Grid.Data(this);return this.data},getUpdater(){this.updater=this.updater||new BX.Grid.Updater(this);return this.updater},isSortableHeader(t){return BX.hasClass(t,this.settings.get("classHeaderSortable"))},isNoSortableHeader(t){return BX.hasClass(t,this.settings.get("classHeaderNoSortable"))},bindOnClickHeader(){const t=this;let e;BX.bind(this.getContainer(),"click",(i=>{e=BX.findParent(i.target,{tag:"th"},true,false);if(e&&t.isSortableHeader(e)&&!t.preventSortableClick){const s=new BX.Event.BaseEvent({data:{grid:t,columnName:BX.data(e,"name")}});BX.Event.EventEmitter.emit("BX.Main.grid:onBeforeSort",s);if(s.isDefaultPrevented()){return}t.preventSortableClick=false;t._clickOnSortableHeader(e,i)}}))},enableEditMode(){this.isEditMode=true},disableEditMode(){this.isEditMode=false},isEditMode(){return this.isEditMode},getColumnHeaderCellByName(t){return BX.Grid.Utils.getBySelector(this.getContainer(),`#${this.getId()} th[data-name="${t}"]`,true)},getColumnByName(t){const e=this.getParam("DEFAULT_COLUMNS");return Boolean(t)&&t in e?e[t]:null},adjustIndex(t){const e=this.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;return t+e},getColumnByIndex(t){t=this.adjustIndex(t);return this.getAllRows().reduce(((e,i)=>{if(!i.classList.contains("main-grid-row-custom")&&!i.classList.contains("main-grid-row-empty")){e.push(i.children[t])}return e}),[])},getAllRows(){const t=[].slice.call(this.getTable().rows);const e=this.getContainer().parentElement.querySelector(".main-grid-fixed-bar table");if(e){t.push(e.rows[0])}return t},hasEmptyRow(){return this.getAllRows().some((t=>BX.hasClass(t,"main-grid-row-empty")))},initStickedColumns(){if(this.hasEmptyRow()){return}[].slice.call(this.getAllRows()[0].children).forEach((function(t,e){if(t.classList.contains("main-grid-sticked-column")){this.stickyColumnByIndex(e)}}),this);if(this.getParam("ALLOW_COLUMNS_RESIZE")){this.getResize().destroy();this.getResize().init(this)}},setStickedColumns(t){if(BX.type.isArray(t)){const e=this.getUserOptions();const i=[{action:e.getAction("GRID_SET_STICKED_COLUMNS"),stickedColumns:t}];e.batch(i,(()=>{this.reloadTable()}))}},getStickedColumns(){const t=[].slice.call(this.getHead().querySelectorAll(".main-grid-cell-head"));return t.reduce(((t,e)=>{if(BX.hasClass(e,"main-grid-fixed-column")&&!BX.hasClass(e,"main-grid-cell-checkbox")&&!BX.hasClass(e,"main-grid-cell-action")){t.push(e.dataset.name)}return t}),[])},stickyColumnByIndex(t){const e=this.getColumnByIndex(t);const i=e[0].clientWidth;const s=e.map((t=>BX.height(t)));e.forEach((function(t,e){t.style.minWidth=`${i}px`;t.style.width=`${i}px`;t.style.minHeight=`${s[e]}px`;const n=BX.clone(t);const o=this.getLastStickyCellFromRowByIndex(e);if(o){let e=parseInt(BX.style(o,"left"));let i=parseInt(BX.style(o,"width"));e=isNaN(e)?0:e;i=isNaN(i)?0:i;t.style.left=`${e+i}px`}t.classList.add("main-grid-fixed-column");t.classList.add("main-grid-cell-static");n.classList.add("main-grid-cell-static");if(this.getColsSortable()){this.getColsSortable().unregister(t);this.getColsSortable().unregister(n)}BX.insertAfter(n,t)}),this);this.adjustFadePosition(this.getFadeOffset())},adjustFixedColumnsPosition(){const t=this.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;const e=[].slice.call(this.getAllRows()[0].children).reduce(((t,e,i,s)=>{let n;let o;if(s[i-1]&&s[i-1].classList.contains("main-grid-fixed-column")){n=parseInt(BX.style(s[i-1],"left"));o=parseInt(BX.style(s[i-1],"width"));n=isNaN(n)?0:n;o=isNaN(o)?0:o;t.push({index:i+1,left:n+o})}return t}),[]);e.forEach((function(i){const s=this.getColumnByIndex(i.index-t);s.forEach((t=>{if(i.index!==e[e.length-1].index){t.style.left=`${i.left}px`}}))}),this);this.getAllRows().forEach((t=>{const e=BX.height(t);const i=[].slice.call(t.children);i.forEach((t=>{t.style.minHeight=`${e}px`}))}))},getLastStickyCellFromRowByIndex(t){return[].slice.call(this.getAllRows()[t].children).reduceRight(((t,e)=>{if(!t&&e.classList.contains("main-grid-fixed-column")){t=e}return t}),null)},getFadeOffset(){let t=0;const e=this.getLastStickyCellFromRowByIndex(0);if(e){let i=parseInt(BX.style(e,"left"));let s=e.offsetWidth;i=isNaN(i)?0:i;s=isNaN(s)?0:s;t=i+s}return t},adjustFadePosition(t){const e=this.getFader().getEarLeft();const i=this.getFader().getShadowLeft();e.style.left=`${t}px`;i.style.left=`${t}px`},sortByColumn(t){let e=null;let i=null;if(BX.type.isPlainObject(t)){i=t;i.sort_url=this.prepareSortUrl(t)}else{e=this.getColumnHeaderCellByName(t);i=this.getColumnByName(t)}if(i&&(Boolean(e)&&!BX.hasClass(e,this.settings.get("classLoad"))||!e)){Boolean(e)&&BX.addClass(e,this.settings.get("classLoad"));this.tableFade();const t=this;this.getUserOptions().setSort(i.sort_by,i.sort_order,(()=>{t.getData().request(i.sort_url,null,null,"sort",(function(){t.rows=null;t.getUpdater().updateHeadRows(this.getHeadRows());t.getUpdater().updateBodyRows(this.getBodyRows());t.getUpdater().updatePagination(this.getPagination());t.getUpdater().updateMoreButton(this.getMoreButton());t.bindOnRowEvents();t.bindOnMoreButtonEvents();t.bindOnClickPaginationLinks();t.bindOnCheckAll();t.updateCounterDisplayed();t.updateCounterSelected();t.disableActionsPanel();t.disableForAllCounter();if(t.getParam("SHOW_ACTION_PANEL")){t.getActionsPanel().resetForAllCheckbox()}if(t.getParam("ALLOW_ROWS_SORT")){t.rowsSortable.reinit()}if(t.getParam("ALLOW_COLUMNS_SORT")){t.colsSortable.reinit()}BX.onCustomEvent(window,"BX.Main.grid:sort",[i,t]);BX.onCustomEvent(window,"Grid::updated",[t]);t.tableUnfade()}))}))}},prepareSortUrl(t){let e=window.location.toString();if("sort_by"in t){e=BX.util.add_url_param(e,{by:t.sort_by})}if("sort_order"in t){e=BX.util.add_url_param(e,{order:t.sort_order})}return e},_clickOnSortableHeader(t,e){e.preventDefault();this.sortByColumn(BX.data(t,"name"))},getObserver(){return BX.Grid.observer},initRowsDragAndDrop(){this.rowsSortable=new BX.Grid.RowsSortable(this)},initColsDragAndDrop(){this.colsSortable=new BX.Grid.ColsSortable(this)},getRowsSortable(){return this.rowsSortable},getColsSortable(){return this.colsSortable},getUserOptionsHandlerUrl(){return this.userOptionsHandlerUrl||""},getUserOptions(){return this.userOptions},getCheckAllCheckboxes(){const t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCheckAllCheckboxes"));return t.map((t=>new BX.Grid.Element(t)))},selectAllCheckAllCheckboxes(){this.getCheckAllCheckboxes().forEach((t=>{t.getNode().checked=true}))},unselectAllCheckAllCheckboxes(){this.getCheckAllCheckboxes().forEach((t=>{t.getNode().checked=false}))},adjustCheckAllCheckboxes(){const t=this.getRows().getBodyChild().filter((t=>t.isShown()&&Boolean(t.getCheckbox()))).length;const e=this.getRows().getSelected().filter((t=>t.isShown())).length;if(t>0&&e>0&&t===e){this.selectAllCheckAllCheckboxes()}else{this.unselectAllCheckAllCheckboxes()}if(e>0&&e<t){this.indeterminateCheckAllCheckboxes()}else{this.determinateCheckAllCheckboxes()}},bindOnCheckAll(){const t=this;this.getCheckAllCheckboxes().forEach((e=>{e.getObserver().add(e.getNode(),"change",t._clickOnCheckAll,t)}))},_clickOnCheckAll(t){t.preventDefault();this.toggleSelectionAll();this.determinateCheckAllCheckboxes()},toggleSelectionAll(){if(!this.getRows().isAllSelected()&&(this.lastRowAction==="select"||!this.lastRowAction)){this.getRows().selectAll();this.selectAllCheckAllCheckboxes();this.enableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsSelected",[this])}else{this.getRows().unselectAll();this.unselectAllCheckAllCheckboxes();this.disableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsUnselected",[this])}delete this.lastRowAction;this.updateCounterSelected()},bindOnClickPaginationLinks(){const t=this;this.getPagination().getLinks().forEach((e=>{e.getObserver().add(e.getNode(),"click",t._clickOnPaginationLink,t)}))},bindOnMoreButtonEvents(){const t=this;this.getMoreButton().getObserver().add(this.getMoreButton().getNode(),"click",t._clickOnMoreButton,t)},bindOnRowEvents(){const t=this.getObserver();const e=this.getParam("SHOW_ROW_CHECKBOXES");const i=this.getParam("ENABLE_COLLAPSIBLE_ROWS");this.getRows().getBodyChild().forEach((function(s){e&&t.add(s.getNode(),"click",this._onClickOnRow,this);s.getDefaultAction()&&t.add(s.getNode(),"dblclick",this._onRowDblclick,this);s.getActionsButton()&&t.add(s.getActionsButton(),"click",this._clickOnRowActionsButton,this);i&&s.getCollapseButton()&&t.add(s.getCollapseButton(),"click",this._onCollapseButtonClick,this)}),this)},_onCollapseButtonClick(t){t.preventDefault();t.stopPropagation();const e=this.getRows().get(t.currentTarget);e.toggleChildRows();if(e.isCustom()){this.getUserOptions().setCollapsedGroups(this.getRows().getIdsCollapsedGroups())}else{this.getUserOptions().setExpandedRows(this.getRows().getIdsExpandedRows())}BX.fireEvent(document.body,"click")},_clickOnRowActionsButton(t){const e=this.getRows().get(t.target);t.preventDefault();if(e.actionsMenuIsShown()){e.closeActionsMenu()}else{e.showActionsMenu()}},_onRowDblclick(event){event.preventDefault();const row=this.getRows().get(event.target);let defaultJs="";if(!row.isEdit()){clearTimeout(this.clickTimer);this.clickPrevent=true;try{defaultJs=row.getDefaultAction();eval(defaultJs)}catch(t){console.warn(t)}}},_onClickOnRow(t){const e=50;const i=window.getSelection();if(t.target.nodeName==="LABEL"){t.preventDefault()}if(t.shiftKey||i.toString().length===0){if(t.shiftKey){i.removeAllRanges()}this.clickTimer=setTimeout(BX.delegate((function(){if(!this.clickPrevent){s.apply(this,[t])}this.clickPrevent=false}),this),e)}function s(t){let e;let i;let s;let n;let o;let a;let r=true;if(t.target.nodeName!=="A"&&t.target.nodeName!=="INPUT"){i=this.getRows().get(t.target);if(i){a=i.getContentContainer(t.target);if(BX.type.isDomNode(a)&&t.target.nodeName!=="TD"&&t.target!==a){r=BX.data(a,"prevent-default")==="true"}if(r){if(i.getCheckbox()){e=[];this.currentIndex=0;this.getRows().getRows().forEach((function(t,e){if(t===i){this.currentIndex=e}}),this);this.lastIndex=this.lastIndex||this.currentIndex;if(t.shiftKey){n=Math.min(this.currentIndex,this.lastIndex);o=Math.max(this.currentIndex,this.lastIndex);while(n<=o){e.push(this.getRows().getRows()[n]);n++}s=e.some((t=>!t.isSelected()));if(s){e.forEach((t=>{t.select()}));this.lastRowAction="select";BX.onCustomEvent(window,"Grid::selectRows",[e,this])}else{e.forEach((t=>{t.unselect()}));this.lastRowAction="unselect";BX.onCustomEvent(window,"Grid::unselectRows",[e,this])}}else if(i.isSelected()){this.lastRowAction="unselect";i.unselect();BX.onCustomEvent(window,"Grid::unselectRow",[i,this])}else{this.lastRowAction="select";i.select();BX.onCustomEvent(window,"Grid::selectRow",[i,this])}this.updateCounterSelected();this.lastIndex=this.currentIndex}this.adjustRows();this.adjustCheckAllCheckboxes()}}}}},adjustRows(){if(this.getRows().isSelected()){BX.onCustomEvent(window,"Grid::thereSelectedRows",[this]);this.enableActionsPanel()}else{BX.onCustomEvent(window,"Grid::noSelectedRows",[]);this.disableActionsPanel()}},getPagination(){return new BX.Grid.Pagination(this)},getState(){return window.history.state},tableFade(){BX.addClass(this.getTable(),this.settings.get("classTableFade"));this.getLoader().show();BX.onCustomEvent("Grid::disabled",[this])},tableUnfade(){BX.removeClass(this.getTable(),this.settings.get("classTableFade"));this.getLoader().hide();BX.onCustomEvent("Grid::enabled",[this])},_clickOnPaginationLink(t){t.preventDefault();const e=this;const i=this.getPagination().getLink(t.target);if(!i.isLoad()){this.getUserOptions().resetExpandedRows();i.load();this.tableFade();this.getData().request(i.getLink(),null,null,"pagination",(function(){e.rows=null;e.getUpdater().updateBodyRows(this.getBodyRows());e.getUpdater().updateHeadRows(this.getHeadRows());e.getUpdater().updateMoreButton(this.getMoreButton());e.getUpdater().updatePagination(this.getPagination());e.bindOnRowEvents();e.bindOnMoreButtonEvents();e.bindOnClickPaginationLinks();e.bindOnCheckAll();e.updateCounterDisplayed();e.updateCounterSelected();e.disableActionsPanel();e.disableForAllCounter();if(e.getParam("SHOW_ACTION_PANEL")){e.getActionsPanel().resetForAllCheckbox()}if(e.getParam("ALLOW_ROWS_SORT")){e.rowsSortable.reinit()}if(e.getParam("ALLOW_COLUMNS_SORT")){e.colsSortable.reinit()}i.unload();e.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[e])}))}},_clickOnMoreButton(t){t.preventDefault();const e=this;const i=this.getMoreButton();i.load();this.getData().request(i.getLink(),null,null,"more",(function(){e.getUpdater().appendBodyRows(this.getBodyRows());e.getUpdater().updateMoreButton(this.getMoreButton());e.getUpdater().updatePagination(this.getPagination());e.getRows().reset();e.bindOnRowEvents();e.bindOnMoreButtonEvents();e.bindOnClickPaginationLinks();e.bindOnCheckAll();e.updateCounterDisplayed();e.updateCounterSelected();if(e.getParam("ALLOW_PIN_HEADER")){e.getPinHeader()._onGridUpdate()}if(e.getParam("ALLOW_ROWS_SORT")){e.rowsSortable.reinit()}if(e.getParam("ALLOW_COLUMNS_SORT")){e.colsSortable.reinit()}e.unselectAllCheckAllCheckboxes();BX.onCustomEvent(window,"Grid::updated",[e])}))},getAjaxId(){return BX.data(this.getContainer(),this.settings.get("ajaxIdDataProp"))},update(t,e){let i;let s;let n;let o;let a;let r;if(!BX.type.isNotEmptyString(t)){return}o=BX.Grid.Utils.getByTag(this.getTable(),"tbody",true);a=BX.Grid.Utils.getByTag(this.getTable(),"thead",true);r=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classNavPanel"),true);t=BX.create("div",{html:t});s=BX.Grid.Utils.getByClass(t,this.settings.get("classHeadRow"));i=BX.Grid.Utils.getByClass(t,this.settings.get("classDataRows"));n=BX.Grid.Utils.getByClass(t,this.settings.get("classNavPanel"),true);if(e===this.settings.get("updateActionMore")){this.getRows().addRows(i);this.unselectAllCheckAllCheckboxes()}if(e===this.settings.get("updateActionPagination")){BX.cleanNode(o);this.getRows().addRows(i);this.unselectAllCheckAllCheckboxes()}if(e===this.settings.get("updateActionSort")){BX.cleanNode(a);BX.cleanNode(o);a.appendChild(s[0]);this.getRows().addRows(i)}r.innerHTML=n.innerHTML;this.bindOnRowEvents();this.bindOnMoreButtonEvents();this.bindOnClickPaginationLinks();this.bindOnClickHeader();this.bindOnCheckAll();this.updateCounterDisplayed();this.updateCounterSelected();this.sortable.reinit()},getCounterDisplayed(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterDisplayed"))},getCounterSelected(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterSelected"))},updateCounterDisplayed(){const t=this.getCounterDisplayed();let e;if(BX.type.isArray(t)){e=this.getRows();t.forEach((t=>{if(BX.type.isDomNode(t)){t.innerText=e.getCountDisplayed()}}))}},updateCounterSelected(){const t=this.getCounterSelected();let e;if(BX.type.isArray(t)){e=this.getRows();t.forEach((t=>{if(BX.type.isDomNode(t)){t.innerText=e.getCountSelected()}}))}},getContainerId(){return this.containerId},getId(){return this.containerId},getContainer(){return BX(this.getContainerId())},getCounter(){if(!this.counter){this.counter=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounter"))}return this.counter},enableForAllCounter(){const t=this.getCounter();if(BX.type.isArray(t)){t.forEach((function(t){BX.addClass(t,this.settings.get("classForAllCounterEnabled"))}),this)}},disableForAllCounter(){const t=this.getCounter();if(BX.type.isArray(t)){t.forEach((function(t){BX.removeClass(t,this.settings.get("classForAllCounterEnabled"))}),this)}},getScrollContainer(){if(!this.scrollContainer){this.scrollContainer=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classScrollContainer"),true)}return this.scrollContainer},getWrapper(){if(!this.wrapper){this.wrapper=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classWrapper"),true)}return this.wrapper},getFadeContainer(){if(!this.fadeContainer){this.fadeContainer=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classFadeContainer"),true)}return this.fadeContainer},getTable(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classTable"),true)},getHeaders(){return BX.Grid.Utils.getBySelector(this.getWrapper(),`.main-grid-header[data-relative="${this.getContainerId()}"]`)},getHead(){return BX.Grid.Utils.getByTag(this.getContainer(),"thead",true)},getBody(){return BX.Grid.Utils.getByTag(this.getContainer(),"tbody",true)},getFoot(){return BX.Grid.Utils.getByTag(this.getContainer(),"tfoot",true)},getRows(){if(!(this.rows instanceof BX.Grid.Rows)){this.rows=new BX.Grid.Rows(this)}return this.rows},getMoreButton(){const t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classMoreButton"),true);return new BX.Grid.Element(t,this)},getLoader(){if(!(this.loader instanceof BX.Grid.Loader)){this.loader=new BX.Grid.Loader(this)}return this.loader},blockSorting(){const t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classHeadCell"));t.forEach((function(t){if(this.isSortableHeader(t)){BX.removeClass(t,this.settings.get("classHeaderSortable"));BX.addClass(t,this.settings.get("classHeaderNoSortable"))}}),this)},unblockSorting(){const t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classHeadCell"));t.forEach((function(t){if(this.isNoSortableHeader(t)&&t.dataset.sortBy){BX.addClass(t,this.settings.get("classHeaderSortable"));BX.removeClass(t,this.settings.get("classHeaderNoSortable"))}}),this)},confirmDialog(t,e,i){let s;let n;let o;let a;if("CONFIRM"in t&&t.CONFIRM){t.CONFIRM_MESSAGE=t.CONFIRM_MESSAGE||this.arParams.CONFIRM_MESSAGE;t.CONFIRM_APPLY_BUTTON=t.CONFIRM_APPLY_BUTTON||this.arParams.CONFIRM_APPLY;t.CONFIRM_CANCEL_BUTTON=t.CONFIRM_CANCEL_BUTTON||this.arParams.CONFIRM_CANCEL;s=new BX.PopupWindow(`${this.getContainerId()}-confirm-dialog`,null,{content:`<div class="main-grid-confirm-content">${t.CONFIRM_MESSAGE}</div>`,titleBar:"CONFIRM_TITLE"in t?t.CONFIRM_TITLE:"",autoHide:false,zIndex:9999,overlay:.4,offsetTop:-100,closeIcon:false,closeByEsc:true,events:{onClose(){BX.unbind(window,"keydown",r);s.destroy()}},buttons:[new BX.PopupWindowButton({text:t.CONFIRM_APPLY_BUTTON,id:`${this.getContainerId()}-confirm-dialog-apply-button`,events:{click(){BX.type.isFunction(e)?e():null;this.popupWindow.close();this.popupWindow.destroy();BX.onCustomEvent(window,"Grid::confirmDialogApply",[this]);BX.unbind(window,"keydown",r)}}}),new BX.PopupWindowButtonLink({text:t.CONFIRM_CANCEL_BUTTON,id:`${this.getContainerId()}-confirm-dialog-cancel-button`,events:{click(){BX.type.isFunction(i)?i():null;this.popupWindow.close();this.popupWindow.destroy();BX.onCustomEvent(window,"Grid::confirmDialogCancel",[this]);BX.unbind(window,"keydown",r)}}})]});if(!s.isShown()){s.show();n=s.popupContainer;BX.removeClass(n,this.settings.get("classCloseAnimation"));BX.addClass(n,this.settings.get("classShowAnimation"));o=BX(`${this.getContainerId()}-confirm-dialog-apply-button`);a=BX(`${this.getContainerId()}-confirm-dialog-cancel-button`);BX.bind(window,"keydown",r)}}else{BX.type.isFunction(e)?e():null}function r(t){if(t.code==="Enter"){t.preventDefault();t.stopPropagation();BX.fireEvent(o,"click")}if(t.code==="Escape"){t.preventDefault();t.stopPropagation();BX.fireEvent(a,"click")}}},getCurrentPage(){const t=parseInt(this.arParams.CURRENT_PAGE);if(BX.Type.isNumber(t)){return t}return 0},getEmptyStub(){return this.getTable().querySelector(".main-grid-row-empty")},showEmptyStub(){const t=this.getEmptyStub();if(t){BX.Dom.attr(t,"hidden",null);BX.Dom.addClass(this.getContainer(),"main-grid-empty-stub");if(this.getCurrentPage()<=1){this.hidePanels()}}},hideEmptyStub(){const t=this.getEmptyStub();if(t){BX.Dom.attr(t,"hidden",true);BX.Dom.removeClass(this.getContainer(),"main-grid-empty-stub");BX.Dom.style(this.getTable(),"min-height",null);this.showPanels()}},showPanels(){BX.Dom.show(this.getPanels());if(this.getPanels().offsetHeight>0){BX.Dom.removeClass(this.getContainer(),"main-grid-empty-footer")}},hidePanels(){BX.Dom.hide(this.getPanels());BX.Dom.addClass(this.getContainer(),"main-grid-empty-footer")},getTemplateRow(){const t=BX.Runtime.clone(this.getRows().getBodyChild(true).find((t=>t.getId()==="template_0")));const e=BX.Runtime.clone(t.getNode());BX.Dom.prepend(e,this.getBody());const i=e.querySelector('[type="checkbox"]');if(i){BX.Dom.attr(i,"disabled",null);BX.Dom.attr(i,"data-disabled",null)}return new BX.Grid.Row(this,e)},getRowEditorValue(t){this.rows=null;return this.getRows().getSelected(t).map((t=>t.getEditorValue()))},getRowEditorActionPanel(){if(!this.rowEditorActionPanel){this.rowEditorActionPanel=BX.Dom.create({tag:"div",props:{className:"main-ui-grid-row-editor-actions-panel"},children:[BX.Dom.create({tag:"span",props:{className:"ui-btn ui-btn-success"},text:this.arParams.SAVE_BUTTON_LABEL,events:{click:this.saveRows.bind(this)}}),BX.Dom.create({tag:"span",props:{className:"ui-btn ui-btn-link"},text:this.arParams.CANCEL_BUTTON_LABEL,events:{click:this.hideRowsEditor.bind(this)}})]})}return this.rowEditorActionPanel},showRowEditorActionsPanel(){const t=this.getRowEditorActionPanel();BX.Dom.append(t,this.actionPanel.getPanel())},hideRowEditorActionsPanel(){BX.Dom.remove(this.getRowEditorActionPanel())},prependRowEditor(){return this.addRowEditor("prepend")},appendRowEditor(){return this.addRowEditor("append")},addRowEditor(t="prepend"){BX.Dom.style(this.getTable(),"min-height",null);const e=this.getTemplateRow();this.editableRows.push(e);if(t==="prepend"){e.prependTo(this.getBody())}else{e.appendTo(this.getBody())}e.show();e.select();e.edit();this.getRows().reset();if(this.getParam("ALLOW_ROWS_SORT")){this.rowsSortable.reinit()}if(this.getParam("ALLOW_COLUMNS_SORT")){this.colsSortable.reinit()}this.hideEmptyStub();return e},hideRowsEditor(){this.editableRows.forEach((t=>{BX.Dom.remove(t.getNode())}));this.editableRows=[]},saveRows(){const t=this.getRowEditorValue(true);this.emitAsync("onAddRowsAsync",{rows:t}).then((t=>{t.forEach(((t,e)=>{const i=this.editableRows[e];if(i){i.editCancel();i.unselect();i.makeCountable();i.setId(t.id);i.setActions(t.actions);i.setCellsContent(t.columns)}}));this.bindOnRowEvents();this.updateCounterDisplayed();this.updateCounterSelected();this.editableRows=[]}))},getRealtime(){return this.cache.remember("realtime",(()=>new BX.Grid.Realtime({grid:this})))}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Updater=function(t){this.parent=t};BX.Grid.Updater.prototype.getParent=function(){return this.parent};BX.Grid.Updater.prototype.updateHeadRows=function(t){let e;if(BX.type.isArray(t)&&t.length>0){e=this.getParent().getHeaders();e.forEach((e=>{e=BX.cleanNode(e);t.forEach((t=>{if(BX.type.isDomNode(t)){e.appendChild(BX.clone(t))}}))}))}};BX.Grid.Updater.prototype.appendHeadRows=function(t){let e;if(BX.type.isArray(t)&&t.length>0){e=this.getParent().getHeaders();e.forEach((e=>{t.forEach((t=>{if(BX.type.isDomNode(t)){e.appendChild(BX.clone(t))}}))}))}};BX.Grid.Updater.prototype.prependHeadRows=function(t){let e;if(BX.type.isArray(t)&&t.length>0){e=this.getParent().getHeaders();e.forEach((e=>{e=BX.cleanNode(e);t.forEach((t=>{if(BX.type.isDomNode(t)){e.prepend(BX.clone(t))}}))}))}};BX.Grid.Updater.prototype.updateBodyRowById=function(t,e){if((BX.type.isNumber(t)||BX.type.isNotEmptyString(t))&&BX.type.isDomNode(e)){const i=this.getParent().getRows().getById(t);if(i){const t=i.getNode();BX.insertAfter(e,t);BX.remove(t)}}};BX.Grid.Updater.prototype.updateBodyRows=function(t){if(BX.type.isArray(t)){const e=this.getParent().getBody();e.innerHTML="";t.forEach((t=>{Boolean(t)&&e.appendChild(t)}))}};BX.Grid.Updater.prototype.appendBodyRows=function(t){let e;if(BX.type.isArray(t)){e=this.getParent().getBody();t.forEach((t=>{if(BX.type.isDomNode(t)){e.appendChild(t)}}))}};BX.Grid.Updater.prototype.prependBodyRows=function(t){let e;if(BX.type.isArray(t)){e=this.getParent().getBody();t.forEach((t=>{if(BX.type.isDomNode(t)){BX.prepend(e,t)}}))}};BX.Grid.Updater.prototype.updateFootRows=function(t){let e;if(BX.type.isArray(t)){e=BX.cleanNode(this.getParent().getFoot());t.forEach((t=>{if(BX.type.isDomNode(t)){e.appendChild(t)}}))}};BX.Grid.Updater.prototype.updateCounterTotal=function(t){let e;if(BX.type.isDomNode(t)){e=BX.cleanNode(this.getParent().getCounterTotal());e.appendChild(t)}};BX.Grid.Updater.prototype.updatePagination=function(t){const e=this.getParent().getPagination().getContainer();if(e){e.innerHTML="";if(BX.type.isDomNode(t)){e.appendChild(t)}}};BX.Grid.Updater.prototype.updateMoreButton=function(t){if(BX.type.isDomNode(t)){const e=BX.Grid.Utils.closestParent(this.getParent().getMoreButton().getNode());e.innerHTML="";e.appendChild(t)}};BX.Grid.Updater.prototype.updateGroupActions=function(t){const e=this.parent.getActionsPanel();if(Boolean(e)&&BX.type.isDomNode(t)){const i=e.getPanel();if(BX.type.isDomNode(i)){i.innerHTML="";const e=BX.firstChild(t);if(BX.type.isDomNode(e)){i.appendChild(e)}}}};BX.Grid.Updater.prototype.updateContainer=function(t){if(BX.Type.isDomNode(t)){this.getParent().getContainer().className=t.className}}})();(function(){BX.Reflection.namespace("BX.Grid");BX.Grid.ImageField=function(t,e){this.parent=t;this.options=e;this.cache=new BX.Cache.MemoryCache};BX.Grid.ImageField.prototype={getPreview(){return this.cache.remember("preview",(()=>BX.create("img",{props:{className:"main-grid-image-editor-preview"},attrs:{src:this.options.VALUE}})))},getFileInput(){return this.cache.remember("fileInput",(()=>BX.create("input",{props:{className:"main-grid-image-editor-file-input"},attrs:{type:"file",accept:"image/*",name:this.options.NAME},events:{change:function(t){const e=new FileReader;e.onload=function(t){this.getPreview().src=t.currentTarget.result}.bind(this);e.readAsDataURL(t.target.files[0]);BX.Dom.remove(this.getFakeField());BX.Dom.append(this.getFileInput(),this.getLayout());BX.Dom.removeClass(this.getRemoveButton(),"ui-btn-disabled");BX.Dom.style(this.getPreview(),null)}.bind(this)}})))},getUploadButton(){return this.cache.remember("uploadButton",(()=>BX.create("button",{props:{className:"ui-btn ui-btn-xs"},text:this.parent.getParam("MAIN_UI_GRID_IMAGE_EDITOR_BUTTON_EDIT"),events:{click:function(t){t.preventDefault();this.getFileInput().click()}.bind(this)}})))},getRemoveButton(){return this.cache.remember("removeButton",(()=>BX.create("button",{props:{className:"ui-btn ui-btn-xs ui-btn-danger"},events:{click:function(t){t.preventDefault();BX.Dom.append(this.getFakeField(),this.getLayout());BX.Dom.remove(this.getFileInput());BX.Dom.addClass(this.getRemoveButton(),"ui-btn-disabled");BX.Dom.style(this.getPreview(),{opacity:.4})}.bind(this)},text:this.parent.getParam("MAIN_UI_GRID_IMAGE_EDITOR_BUTTON_REMOVE")})))},getFakeField(){return this.cache.remember("deleted",(()=>BX.create("input",{props:{className:"main-grid-image-editor-fake-file-input"},attrs:{type:"hidden",name:this.options.NAME,value:"null"}})))},getLayout(){return this.cache.remember("layout",(()=>BX.create("div",{props:{className:"main-grid-image-editor main-grid-editor"},attrs:{name:this.options.NAME},children:[BX.create("div",{props:{className:"main-grid-image-editor-left"},children:[this.getPreview()]}),BX.create("div",{props:{className:"main-grid-image-editor-right"},children:[this.getUploadButton(),this.getRemoveButton()]}),this.getFileInput()]})))}}})();let _=t=>t,_t,_t2;(function(){BX.namespace("BX.Grid");BX.Grid.InlineEditor=function(t,e){this.parent=null;this.types=null;this.isDropdownChangeEventSubscribed=false;this.init(t,e)};BX.Grid.InlineEditor.prototype={init(parent,types){this.parent=parent;try{this.types=eval(types)}catch{this.types=null}},createContainer(){return BX.create("div",{props:{className:this.parent.settings.get("classEditorContainer")}})},createTextarea(t,e){return BX.create("textarea",{props:{className:[this.parent.settings.get("classEditor"),this.parent.settings.get("classEditorTextarea")].join(" ")},attrs:{name:t.NAME,style:`height:${e}px`},html:t.VALUE||""})},createInput(t){let e=this.parent.settings.get("classEditorText");const i={value:t.VALUE!==undefined&&t.VALUE!==null?BX.util.htmlspecialcharsback(t.VALUE):"",name:t.NAME!==undefined&&t.NAME!==null?t.NAME:""};if(t.TYPE===this.types.CHECKBOX){e=this.parent.settings.get("classEditorCheckbox");i.type="checkbox";i.checked=i.value=="Y"}if(t.TYPE===this.types.DATE){e=[e,this.parent.settings.get("classEditorDate")].join(" ")}if(t.TYPE===this.types.NUMBER){e=[e,this.parent.settings.get("classEditorNumber")].join(" ");i.type="number"}if(t.TYPE===this.types.RANGE){e=[e,this.parent.settings.get("classEditorRange")].join(" ");i.type="range";if(BX.type.isPlainObject(t.DATA)){i.min=t.DATA.MIN||"0";i.max=t.DATA.MAX||99999;i.step=t.DATA.STEP||""}}if(BX.type.isNotEmptyString(t.PLACEHOLDER)){i.placeholder=BX.util.htmlspecialchars(t.PLACEHOLDER)}if(t.DISABLED){i.disabled=true}e=[this.parent.settings.get("classEditor"),e].join(" ");return BX.create("input",{props:{className:e,id:`${t.NAME}_control`},attrs:i})},createCustom(t){let e=this.parent.settings.get("classEditorCustom");e=[this.parent.settings.get("classEditor"),e].join(" ");return BX.create("div",{props:{className:e},attrs:{"data-name":t.NAME},html:t.VALUE||""})},createMoney(t){const e=t.VALUE;const i=[];const s=e.PRICE||{};s.PLACEHOLDER=t.PLACEHOLDER||"";i.push(this.createMoneyPrice(s));if(BX.type.isArray(t.CURRENCY_LIST)&&t.CURRENCY_LIST.length>0){const s=e.CURRENCY||{};s.DATA={ITEMS:t.CURRENCY_LIST};s.HTML_ENTITY=t.HTML_ENTITY||false;i.push(this.createMoneyCurrency(s))}if(BX.type.isNotEmptyObject(e.HIDDEN)){for(const t in e.HIDDEN){if(e.HIDDEN.hasOwnProperty(t)&&BX.type.isNotEmptyString(t)){const s=this.createInput({NAME:t,VALUE:e.HIDDEN[t],TYPE:this.types.TEXT});s.type="hidden";i.push(s)}}}let n=this.parent.settings.get("classEditorMoney");n=[this.parent.settings.get("classEditor"),n].join(" ");const o=e.ATTRIBUTES||{};o["data-name"]=t.NAME;return BX.create("div",{props:{className:n},attrs:o,children:i})},createMoneyPrice(t){t.TYPE=this.types.NUMBER;const e=this.createInput(t);e.classList.add("main-grid-editor-money-price");main_core.Event.bind(e,"change",(t=>{const e=t.target.parentNode;const i=e.querySelector(".main-grid-editor-money-currency");const s={field:e,values:{price:t.target.value||"",currency:i.dataset.value||""}};main_core_events.EventEmitter.emit("Grid.MoneyField::change",s)}));return e},createMoneyCurrency(t){const e=this.createDropdown(t);e.dataset.menuOffsetLeft=15;e.dataset.menuMaxHeight=200;e.classList.add("main-grid-editor-money-currency");if(t.DISABLED===true){e.classList.remove("main-dropdown");e.dataset.disabled=true}if(!this.isDropdownChangeEventSubscribed){this.isDropdownChangeEventSubscribed=true;main_core_events.EventEmitter.subscribe("Dropdown::change",(t=>{const[e]=t.getData();if(!BX.type.isNotEmptyString(e)){return}const i=BX.Main.dropdownManager.getById(e);if(i.dropdown&&i.dropdown.classList.contains("main-grid-editor-money-currency")){const t=i.dropdown.parentNode;const e=t.querySelector(".main-grid-editor-money-price");const s={field:t,values:{price:e.value||"",currency:i.dropdown.dataset.value||""}};main_core_events.EventEmitter.emit("Grid.MoneyField::change",s)}}))}return e},createOutput(t){return BX.create("output",{props:{className:this.parent.settings.get("classEditorOutput")||""},attrs:{for:`${t.NAME}_control`},text:t.VALUE||""})},getDropdownValueItemByValue(t,e){const i=String(e);const s=t.filter((t=>String(t.VALUE)===i));return s.length>0?s[0]:t[0]},createDropdown(t){const e=this.getDropdownValueItemByValue(t.DATA.ITEMS,t.VALUE);const i="HTML_ENTITY"in t&&t.HTML_ENTITY===true;return BX.create("div",{props:{className:[this.parent.settings.get("classEditor"),"main-dropdown main-grid-editor-dropdown"].join(" "),id:`${t.NAME}_control`},attrs:{name:t.NAME,tabindex:"0","data-items":JSON.stringify(t.DATA.ITEMS),"data-value":e.VALUE,"data-html-entity":t.HTML_ENTITY},children:[BX.create("span",{props:{className:"main-dropdown-inner"},html:i?e.NAME:null,text:i?null:e.NAME})]})},createMultiselect(t){const e=[];const i=(()=>{if(BX.Type.isArrayFilled(t.VALUE)){return t.VALUE.map((i=>{var s;const n=this.getDropdownValueItemByValue(t.DATA.ITEMS,i);e.push(n);const o=(s=n.HTML)!=null?s:BX.util.htmlspecialchars(n.NAME);const a=BX.Tag.render(_t||(_t=_`
							<span class="main-ui-square">
								<span class="main-ui-square-item">${0}</span>
								<span class="main-ui-item-icon main-ui-square-delete"></span>
							</span>
						`),o);BX.Dom.attr(a,"data-item",n);return a}))}return[]})();const s=BX.Tag.render(_t2||(_t2=_`
				<div
					class="main-grid-editor main-ui-control main-ui-multi-select"
					name="${0}"
					id="${0}"
				>
					<span class="main-ui-square-container">${0}</span>
					<span class="main-ui-hide main-ui-control-value-delete">
						<span class="main-ui-control-value-delete-item"></span>
					</span>
					<span class="main-ui-square-search">
						<input type="text" class="main-ui-square-search-item">
					</span>
				</div>
			`),BX.Text.encode(t.NAME),`${BX.Text.encode(t.NAME)}_control`,i);BX.Dom.attr(s,{"data-params":{isMulti:true},"data-items":t.DATA.ITEMS,"data-value":e});return s},validateEditObject(t){return BX.type.isPlainObject(t)&&"TYPE"in t&&"NAME"in t&&"VALUE"in t&&(!("items"in t)||BX.type.isArray(t.items)&&t.items.length)},initCalendar(t){BX.calendar({node:t.target,field:t.target})},bindOnRangeChange(t,e){function i(t,e){BX.html(e,t.value);const i=parseFloat(t.value);const s=parseFloat(t.getAttribute("max"));const n=parseFloat(t.getAttribute("min"));const o=16;const a=s-n;const r=(i-n)/a*100;const l=Math.round(o*r/100)-o/2;e.style.left=`${r}%`;e.style.marginLeft=`${-l}px`}setTimeout((()=>{i(t,e)}),0);BX.bind(t,"input",(()=>{i(t,e)}))},createImageEditor(t){return new BX.Grid.ImageField(this.parent,t).getLayout()},getEditor(t,e){let i;let s;const n=this.createContainer();if(this.validateEditObject(t)){t.VALUE=t.VALUE===null?"":t.VALUE;switch(t.TYPE){case this.types.TEXT:{i=this.createInput(t);BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.DATE:{i=this.createInput(t);BX.bind(i,"click",this.initCalendar);BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.NUMBER:{i=this.createInput(t);BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.RANGE:{i=this.createInput(t);s=this.createOutput(t);this.bindOnRangeChange(i,s);BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.CHECKBOX:{i=this.createInput(t);BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.TEXTAREA:{i=this.createTextarea(t,e);BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.DROPDOWN:{i=this.createDropdown(t);break}case this.types.MULTISELECT:{i=this.createMultiselect(t);break}case this.types.IMAGE:{i=this.createImageEditor(t);break}case this.types.MONEY:{i=this.createMoney(t);BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}case this.types.CUSTOM:{i=this.createCustom(t);requestAnimationFrame((()=>{const e=t.HTML||t.VALUE||null;if(e){const t=BX.processHTML(e);t.SCRIPT.forEach((t=>{if(t.isInternal&&t.JS){BX.evalGlobal(t.JS)}}))}}));BX.bind(i,"click",(t=>{t.stopPropagation()}));BX.bind(i,"keydown",BX.delegate(this._onControlKeydown,this));break}default:{break}}}if(BX.type.isDomNode(s)){n.appendChild(s)}if(BX.type.isDomNode(i)){n.appendChild(i)}return n},_onControlKeydown(t){if(t.code==="Enter"){t.preventDefault();const e=BX.Grid.Utils.getBySelector(this.parent.getContainer(),"#grid_save_button > button",true);if(e){BX.fireEvent(e,"click")}}}}})();class Label{}Label.Color={DEFAULT:"ui-label-default",DANGER:"ui-label-danger",SUCCESS:"ui-label-success",WARNING:"ui-label-warning",PRIMARY:"ui-label-primary",SECONDARY:"ui-label-secondary",LIGHTGREEN:"ui-label-lightgreen",LIGHTBLUE:"ui-label-lightblue",LIGHT:"ui-label-light"};Label.RemoveButtonType={INSIDE:"main-grid-tag-remove-inside",OUTSIDE:"main-grid-tag-remove-outside"};const namespace$3=main_core.Reflection.namespace("BX.Grid");namespace$3.Label=Label;(function(){BX.namespace("BX.Grid");BX.Grid.Loader=function(t){this.parent=null;this.container=null;this.windowHeight=null;this.tbodyPos=null;this.headerPos=null;this.lastPosTop=null;this.lastBottomPos=null;this.table=null;this.loader=null;this.adjustLoaderOffset=this.adjustLoaderOffset.bind(this);this.init(t)};BX.Grid.Loader.prototype={init(t){this.parent=t;this.table=this.parent.getTable();this.loader=new BX.Loader({target:this.getContainer()})},adjustLoaderOffset(){this.windowHeight=BX.height(window);this.tbodyPos=BX.pos(this.table.tBodies[0]);this.headerPos=BX.pos(this.table.tHead);let t=window.scrollY;if(this.parent.isIE()){t=document.documentElement.scrollTop}let e=t+this.windowHeight-this.tbodyPos.top;let i=t-this.tbodyPos.top;if(e>this.tbodyPos.bottom-this.tbodyPos.top){e=this.tbodyPos.bottom-this.tbodyPos.top}if(i<this.headerPos.height){i=this.headerPos.height}else{e-=i;e+=this.headerPos.height}requestAnimationFrame((()=>{if(i!==this.lastPosTop){this.getContainer().style.transform=`translate3d(0px, ${i}px, 0)`}if(e!==this.lastBottomPos){this.getContainer().style.height=`${e}px`}this.lastPosTop=i;this.lastBottomPos=e}))},getContainer(){if(!this.container){this.container=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classLoader"),true)}return this.container},show(){if(!this.loader.isShown()){this.adjustLoaderOffset();this.getContainer().style.display="block";this.getContainer().style.opacity="1";this.getContainer().style.visibility="visible";const t=this.parent.getRows().getCountDisplayed();if(t>0&&t<=2){this.loader.setOptions({size:60});this.loader.show()}else{this.loader.setOptions({size:110});this.loader.show()}}},hide(){if(this.loader.isShown()){this.adjustLoaderOffset();this.loader.hide().then((()=>{this.getContainer().style.display="none"}))}}}})();(function(){BX.namespace("BX.Main");if(BX.Main.gridManager){return}BX.Main.gridManager={data:[],push(t,e){if(BX.type.isNotEmptyString(t)&&e){const i={id:t,instance:e,old:null};if(this.getById(t)===null){this.data.push(i)}else{this.data[0]=i}}},getById(t){const e=this.data.filter((e=>e.id===t||e.id.replace("main_grid_","")===t));return e.length===1?e[0]:null},getInstanceById(t){const e=this.getById(t);return BX.type.isPlainObject(e)?e.instance:null},reload(t,e){const i=this.getInstanceById(t);if(i){i.reload(e)}},getDataIndex(t){let e=null;this.data.forEach(((i,s)=>{if(i.id===t){e=s}}));return e},destroy(t){if(BX.type.isNotEmptyString(t)){const e=this.getInstanceById(t);if(e instanceof BX.Main.grid){e.destroy();const i=this.getDataIndex(t);if(i!==null){delete this.data[i]}}}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Message=function(t,e){this.parent=null;this.types=null;this.messages=null;this.popup=null;this.init(t,e)};BX.Grid.Message.prototype={init(t,e){this.parent=t;this.types=e;this.show();BX.addCustomEvent("BX.Main.grid:paramsUpdated",BX.proxy(this.onUpdated,this))},onUpdated(){this.show()},getData(){return this.parent.arParams.MESSAGES},isNeedShow(){return this.getData().length>0},show(){if(this.isNeedShow()){this.getPopup().setContent(this.getContent());this.getPopup().show()}},getContent(){const t=this.getData();let e=null;if(BX.type.isArray(t)&&t.length>0){const i={block:"main-grid-messages",content:[]};t.forEach((t=>{const e={block:"main-grid-message",mix:`main-grid-message-${t.TYPE.toLowerCase()}`,content:[]};if(BX.type.isNotEmptyString(t.TITLE)){e.content.push({block:"main-grid-message-title",content:BX.create("div",{html:t.TITLE}).innerText})}if(BX.type.isNotEmptyString(t.TEXT)){e.content.push({block:"main-grid-message-text",content:BX.create("div",{html:t.TEXT}).innerText})}i.content.push(e)}));e=BX.decl(i)}return e},getPopup(){if(this.popup===null){this.popup=new BX.PopupWindow(this.getPopupId(),null,{autoHide:true,overlay:.3,minWidth:400,maxWidth:800,contentNoPaddings:true,closeByEsc:true,buttons:[new BX.PopupWindowButton({text:this.parent.getParam("CLOSE"),className:"webform-small-button-blue webform-small-button",events:{click(){this.popupWindow.close()}}})]})}return this.popup},getPopupId(){return`${this.parent.getContainerId()}-main-grid-message`}}})();(function(){BX.namespace("BX.Grid");BX.Grid.observer={handlers:[],add(t,e,i,s){BX.bind(t,e,s?BX.proxy(i,s):i)}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Pagesize=function(t){this.parent=null;this.init(t)};BX.Grid.Pagesize.prototype={init(t){this.parent=t;BX.addCustomEvent("Dropdown::change",BX.proxy(this.onChange,this))},destroy(){BX.removeCustomEvent("Dropdown::change",BX.proxy(this.onChange,this))},onChange(t,e,i,s,n){const o=this;if(t===`${this.parent.getContainerId()}_${this.parent.settings.get("pageSizeId")}`&&n>=0){this.parent.tableFade();this.parent.getUserOptions().setPageSize(n,(()=>{o.parent.reloadTable();BX.onCustomEvent(o.parent.getContainer(),"Grid::pageSizeChanged",[o.parent])}))}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Pagination=function(t){this.parent=null;this.container=null;this.links=null;this.init(t)};BX.Grid.Pagination.prototype={init(t){this.parent=t},getParent(){return this.parent},getContainer(){if(!this.container){this.container=BX.Grid.Utils.getByClass(this.getParent().getContainer(),this.getParent().settings.get("classPagination"),true)}return this.container},getLinks(){const t=this;const e=BX.Grid.Utils.getByTag(this.getContainer(),"a");this.links=[];if(e){this.links=e.map((e=>new BX.Grid.Element(e,t.getParent())))}return this.links},getLink(t){let e=null;let i;if(BX.type.isDomNode(t)){i=this.getLinks().filter((e=>t===e.getNode()));if(i.length>0){e=i[0]}}return e}}})();(function(){BX.namespace("BX.Grid");BX.Grid.PinHeader=function(t){this.parent=null;this.table=null;this.header=null;this.container=null;this.parentNodeResizeObserver=null;const e=this.getAdminPanel();if(e){this.mo=new MutationObserver(this.onAdminPanelMutation.bind(this));this.mo.observe(document.documentElement,{attributes:true})}this.init(t)};BX.Grid.PinHeader.prototype={init(t){this.parent=t;this.rect=BX.pos(this.parent.getHead());this.gridRect=BX.pos(this.parent.getTable());let e=BX.Grid.Utils.getBySelector(document,"#workarea-content",true);if(!e){e=this.parent.getContainer().parentNode;e=e?e.parentNode:e}if(e){this.parentNodeResizeObserver=new BX.ResizeObserver(BX.proxy(this.refreshRect,this));this.parentNodeResizeObserver.observe(e)}this.create(true);document.addEventListener("scroll",BX.proxy(this._onScroll,this),BX.Grid.Utils.listenerParams({passive:true}));document.addEventListener("resize",BX.proxy(this._onResize,this),BX.Grid.Utils.listenerParams({passive:true}));BX.addCustomEvent("Grid::updated",BX.proxy(this._onGridUpdate,this));BX.addCustomEvent("Grid::resize",BX.proxy(this._onGridUpdate,this));BX.bind(window,"resize",BX.proxy(this._onGridUpdate,this))},refreshRect(){this.gridRect=BX.pos(this.parent.getTable());this.rect=BX.pos(this.parent.getHead())},_onGridUpdate(){const t=this.isPinned();BX.remove(this.getContainer());this.create();t&&this.pin();this.table=null;this.refreshRect();this._onScroll();BX.onCustomEvent(window,"Grid::headerUpdated",[])},create(t){const e=BX.Grid.Utils.getByTag(this.parent.getHead(),"th");const i=BX.clone(this.parent.getHead());const s=BX.Grid.Utils.getByTag(i,"th");const n=function(){e.forEach(((t,i)=>{let n=BX.width(t);if(i>0){n-=parseInt(BX.style(t,"border-left-width"));n-=parseInt(BX.style(t,"border-right-width"))}s[i].firstElementChild&&(s[i].firstElementChild.style.width=`${n}px`);if(e.length-1>i){s[i].style.width=`${n}px`}}))};t?setTimeout(n,0):n();this.container=BX.decl({block:"main-grid-fixed-bar",mix:"main-grid-fixed-top",attrs:{style:`width: ${BX.width(this.parent.getContainer())}px`},content:{block:"main-grid-table",tag:"table",content:i}});this.container.hidden=true;this.parent.getWrapper().appendChild(this.container)},getContainer(){return this.container},getFixedTable(){return this.table||(this.table=BX.Grid.Utils.getByTag(this.getContainer(),"table",true))},getAdminPanel(){if(!this.adminPanel){this.adminPanel=document.querySelector(".adm-header")}return this.adminPanel},isAdminPanelPinned(){return BX.hasClass(document.documentElement,"adm-header-fixed")},getPinOffset(){const t=this.getAdminPanel();if(t&&this.isAdminPanelPinned()){return BX.Text.toNumber(BX.style(t,"height"))}return 0},pin(){const t=this.getContainer();if(t){t.hidden=false}BX.onCustomEvent(window,"Grid::headerPinned",[])},unpin(){const t=this.getContainer();if(t){t.hidden=true}BX.onCustomEvent(window,"Grid::headerUnpinned",[])},stopPin(){BX.Grid.Utils.styleForEach([this.getContainer()],{position:"absolute",top:`${this.gridRect.bottom-this.rect.height-this.gridRect.top}px`,"box-shadow":"none"})},startPin(){BX.Grid.Utils.styleForEach([this.getContainer()],{position:"fixed",top:`${this.getPinOffset()}px`,"box-shadow":""})},isPinned(){return!this.getContainer().hidden},_onScroll(){let t=0;if(this.scrollRect){t=this.scrollRect.scrollTop}else if(document.scrollingElement){this.scrollRect=document.scrollingElement}else if(document.documentElement.scrollTop>0){this.scrollRect=document.documentElement}else if(document.body.scrollTop>0){this.scrollRect=document.body}if(this.gridRect.bottom>t+this.rect.height){this.startPin();const e=this.getPinOffset();if(this.rect.top-e<=t){!this.isPinned()&&this.pin()}else{this.isPinned()&&this.unpin()}}else{this.stopPin()}},onAdminPanelMutation(){this._onScroll()},_onResize(){this.rect=BX.pos(this.parent.getHead())}}})();(function(){BX.namespace("BX.Grid");BX.Grid.PinPanel=function(t){this.parent=null;this.panel=null;this.isSelected=null;this.offset=null;this.animationDuration=null;this.pinned=false;this.init(t)};BX.Grid.PinPanel.prototype={init(t){this.parent=t;this.offset=10;this.animationDuration=200;this.panel=this.getPanel();this.bindOnRowsEvents()},destroy(){this.unbindOnRowsEvents()},bindOnRowsEvents(){BX.addCustomEvent("Grid::thereSelectedRows",BX.proxy(this._onThereSelectedRows,this));BX.addCustomEvent("Grid::allRowsSelected",BX.proxy(this._onThereSelectedRows,this));BX.addCustomEvent("Grid::noSelectedRows",BX.proxy(this._onNoSelectedRows,this));BX.addCustomEvent("Grid::allRowsUnselected",BX.proxy(this._onNoSelectedRows,this));BX.addCustomEvent("Grid::updated",BX.proxy(this._onNoSelectedRows,this))},unbindOnRowsEvents(){BX.removeCustomEvent("Grid::thereSelectedRows",BX.proxy(this._onThereSelectedRows,this));BX.removeCustomEvent("Grid::allRowsSelected",BX.proxy(this._onThereSelectedRows,this));BX.removeCustomEvent("Grid::noSelectedRows",BX.proxy(this._onNoSelectedRows,this));BX.removeCustomEvent("Grid::allRowsUnselected",BX.proxy(this._onNoSelectedRows,this));BX.removeCustomEvent("Grid::updated",BX.proxy(this._onNoSelectedRows,this))},bindOnWindowEvents(){BX.bind(window,"resize",BX.proxy(this._onResize,this));document.addEventListener("scroll",BX.proxy(this._onScroll,this),BX.Grid.Utils.listenerParams({passive:true}))},unbindOnWindowEvents(){BX.unbind(window,"resize",BX.proxy(this._onResize,this));document.removeEventListener("scroll",BX.proxy(this._onScroll,this),BX.Grid.Utils.listenerParams({passive:true}))},getPanel(){this.panel=this.panel||this.parent.getActionsPanel().getPanel();return this.panel},getScrollBottom(){return BX.scrollTop(window)+this.getWindowHeight()},getPanelRect(){if(!BX.type.isPlainObject(this.panelRect)){this.panelRect=BX.pos(this.getPanel())}return this.panelRect},getPanelPrevBottom(){const t=BX.previousSibling(this.getPanel());return BX.pos(t).bottom+parseFloat(BX.style(t,"margin-bottom"))},getWindowHeight(){this.windowHeight=this.windowHeight||BX.height(window);return this.windowHeight},pinPanel(t){const e=this.getPanel();const i=BX.width(this.getPanel().parentNode);const s=BX.height(this.getPanel().parentNode);const n=BX.pos(this.parent.getBody());const o=this.getStartDiffPanelPosition();e.parentNode.style.setProperty("height",`${s}px`);e.style.setProperty("transform",`translateY(${o}px)`);e.classList.add("main-grid-fixed-bottom");e.style.setProperty("width",`${i}px`);e.style.removeProperty("position");e.style.removeProperty("top");requestAnimationFrame((()=>{if(t!==false){e.style.setProperty("transition","transform 200ms ease")}e.style.setProperty("transform","translateY(0)")}));if(this.isNeedPinAbsolute()&&!this.absolutePin){this.absolutePin=true;e.style.removeProperty("transition");e.style.setProperty("position","absolute");e.style.setProperty("top",`${n.top}px`)}if(!this.isNeedPinAbsolute()&&this.absolutePin){this.absolutePin=false}this.adjustPanelPosition();this.pinned=true},unpinPanel(t){const e=this.getPanel();const i=BX.pos(e);const s=BX.pos(e.parentNode);const n=Math.abs(i.bottom-s.bottom);if(t!==false){e.style.setProperty("transition","transform 200ms ease")}const o=n<i.height?`${n}px`:"100%";e.style.setProperty("transform",`translateY(${o})`);const a=function(e,i){if(t!==false){return setTimeout(e,i)}e()};a((()=>{e.parentNode.style.removeProperty("height");e.classList.remove("main-grid-fixed-bottom");e.style.removeProperty("transition");e.style.removeProperty("transform");e.style.removeProperty("width");e.style.removeProperty("position");e.style.removeProperty("top")}),t===false?0:200);this.pinned=false},isSelectedRows(){return this.isSelected},isNeedPinAbsolute(){return BX.pos(this.parent.getBody()).top+this.getPanelRect().height>=this.getScrollBottom()},isNeedPin(){return this.getScrollBottom()-this.getPanelRect().height<=this.getPanelPrevBottom()},adjustPanelPosition(){const t=window.pageXOffset;this.lastScrollX=this.lastScrollX===null?t:this.lastScrollX;BX.Grid.Utils.requestAnimationFrame(BX.proxy((function(){if(t!==this.lastScrollX){const e=this.getPanelRect();BX.style(this.getPanel(),"left",`${e.left-t}px`)}}),this));this.lastScrollX=t},pinController(t){if(this.getPanel()){if(!this.isPinned()&&this.isNeedPin()&&this.isSelectedRows()){return this.pinPanel(t)}if(this.isPinned()&&!this.isNeedPin()||!this.isSelectedRows()){this.unpinPanel(t)}}},getEndDiffPanelPosition(){const t=BX.pos(this.getPanel());const e=BX.pos(BX.previousSibling(this.getPanel()));const i=BX.scrollTop(window);const s=i+BX.height(window);let n=t.height+this.offset;const o=e.bottom+parseFloat(BX.style(this.getPanel(),"margin-top"));if(o<s&&o+t.height>s){n=Math.abs(s-(o+t.height))}return n},getStartDiffPanelPosition(){const t=BX.pos(this.getPanel());const e=BX.scrollTop(window);const i=e+BX.height(window);let s=t.height;if(t.bottom>i&&t.top<i){s=t.bottom-i}return s},isPinned(){return this.pinned},_onThereSelectedRows(){this.bindOnWindowEvents();this.isSelected=true;if(this.lastIsSelected){this.pinController()}else{this.lastIsSelected=true;this.pinController()}},_onNoSelectedRows(){this.unbindOnWindowEvents();this.isSelected=false;this.pinController();this.lastIsSelected=false},_onScroll(){this.pinController(false)},_onResize(){this.windowHeight=BX.height(window);this.panel=this.parent.getActionsPanel().getPanel();this.panelRect=this.getPanel().getBoundingClientRect();this.pinController(false)}}})();let _$1=t=>t,_t$1,_t2$1,_t3,_t4,_t5;class Realtime extends main_core_events.EventEmitter{constructor(t){super();this.setEventNamespace("BX.Grid.Realtime");this.options={...t}}addRow(t){const{grid:e}=this.options;const i=e.getTemplateRow();i.makeCountable();e.hideEmptyStub();if(main_core.Type.isNumber(t.id)||main_core.Type.isStringFilled(t.id)){i.setId(t.id)}else{throw new ReferenceError("id is not number or string")}if(main_core.Type.isArrayFilled(t.actions)){i.setActions(t.actions)}if(main_core.Type.isPlainObject(t.columns)){i.setCellsContent(t.columns)}if(main_core.Type.isPlainObject(t.cellActions)){i.setCellActions(t.cellActions)}if(main_core.Type.isPlainObject(t.counters)){const e=Object.entries(t.counters).reduce(((t,[e,i])=>{if(main_core.Type.isPlainObject(i)){var s;t[e]={...i,isDouble:(s=i.isDouble)!=null?s:false,secondaryColor:i.secondaryColor,animation:main_core.Text.toBoolean(i.animation)}}return t}),{});i.setCounters(e)}if(t.prepend===true){i.prependTo(e.getBody())}else if(t.append===true){i.appendTo(e.getBody())}else if(main_core.Type.isNumber(t.insertBefore)||main_core.Type.isStringFilled(t.insertBefore)){const s=e.getRows().getById(t.insertBefore);if(s){BX.Dom.insertBefore(i.getNode(),s.getNode())}}else if(main_core.Type.isNumber(t.insertAfter)||main_core.Type.isStringFilled(t.insertAfter)){const s=e.getRows().getById(t.insertAfter);if(s){BX.Dom.insertAfter(i.getNode(),s.getNode())}}else{throw new ReferenceError("prepend, append, insertBefore or insertAfter not filled")}i.show();if(t.animation!==false){i.enableAbsolutePosition();const t=e.getRows().getSourceBodyChild().filter((t=>t.rowIndex>i.getIndex()));const s=document.createElement("tr");main_core.Dom.style(s,{height:"0px",transition:"200ms height linear"});main_core.Dom.append(s,e.getBody());const n=i.getHeight();main_core.Dom.style(s,"height",`${n}px`);t.forEach((t=>{main_core.Dom.style(t,{transition:"200ms transform linear",transform:`translateY(${n}px) translateZ(0)`})}));main_core.Dom.addClass(i.getNode(),"main-ui-grid-show-new-row");main_core.Event.bind(i.getNode(),"animationend",(e=>{if(e.animationName==="showNewRow"){t.forEach((t=>{main_core.Dom.style(t,{transition:null,transform:null})}));main_core.Dom.remove(s);i.disableAbsolutePosition();main_core.Dom.removeClass(i.getNode(),"main-ui-grid-show-new-row")}}))}e.getRows().reset();e.bindOnRowEvents();e.updateCounterDisplayed();e.updateCounterSelected();if(e.getParam("ALLOW_ROWS_SORT")){e.rowsSortable.reinit()}if(e.getParam("ALLOW_COLUMNS_SORT")){e.colsSortable.reinit()}}showStub(t={}){const e=document.createElement("tr");main_core.Dom.addClass(e,"main-grid-row main-grid-row-empty main-grid-row-body");const i=document.createElement("td");main_core.Dom.addClass(i,"main-grid-cell main-grid-cell-center");const s=this.options.grid.getRows().getHeadFirstChild().getCells().length;main_core.Dom.attr(i,"colspan",s);const n=(()=>{if(main_core.Type.isPlainObject(t.content)){const e=[];if(main_core.Type.isStringFilled(t.content.title)){e.push(main_core.Tag.render(_t$1||(_t$1=_$1`
							<div class="main-grid-empty-block-title">
								${0}
							</div>
						`),t.content.title))}if(main_core.Type.isStringFilled(t.content.description)){e.push(main_core.Tag.render(_t2$1||(_t2$1=_$1`
							<div class="main-grid-empty-block-description">
								${0}
							</div>
						`),t.content.description))}return e}if(main_core.Type.isStringFilled(t.content)||main_core.Type.isDomNode(t.content)){return t.content}return[main_core.Tag.render(_t3||(_t3=_$1`<div class="main-grid-empty-image"></div>`)),main_core.Tag.render(_t4||(_t4=_$1`<div class="main-grid-empty-text">${0}</div>`),this.options.grid.getParam("EMPTY_STUB_TEXT"))]})();const o=main_core.Tag.render(_t5||(_t5=_$1`
			<div class="main-grid-empty-block">
				<div class="main-grid-empty-inner">
					${0}
				</div>
			</div>
		`),n);main_core.Dom.append(o,i);main_core.Dom.append(i,e);const a=this.options.grid.getBody().querySelector(".main-grid-row-empty");if(a){main_core.Dom.remove(a)}main_core.Dom.append(e,this.options.grid.getBody());this.options.grid.getRows().getBodyChild().forEach((t=>{t.hide()}));this.options.grid.adjustEmptyTable(this.options.grid.getRows().getSourceBodyChild())}}const namespace$4=main_core.Reflection.namespace("BX.Grid");namespace$4.Realtime=Realtime;(function(){BX.namespace("BX.Grid");BX.Grid.Resize=function(t){this.parent=null;this.lastRegisterButtons=null;this.init(t)};BX.Grid.Resize.prototype={init(t){this.parent=t;BX.addCustomEvent(window,"Grid::updated",BX.proxy(this.registerTableButtons,this));BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.registerPinnedTableButtons,this));this.registerTableButtons();this.registerPinnedTableButtons()},destroy(){BX.removeCustomEvent(window,"Grid::updated",BX.proxy(this.registerTableButtons,this));BX.removeCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.registerPinnedTableButtons,this));BX.type.isArray(this.lastRegisterButtons)&&this.lastRegisterButtons.forEach(jsDD.unregisterObject);(this.getButtons()||[]).forEach(jsDD.unregisterObject)},registerTableButtons(){(this.getButtons()||[]).forEach(this.register,this);this.registerPinnedTableButtons()},register(t){if(BX.type.isDomNode(t)){t.onbxdragstart=BX.delegate(this._onDragStart,this);t.onbxdragstop=BX.delegate(this._onDragEnd,this);t.onbxdrag=BX.delegate(this._onDrag,this);jsDD.registerObject(t)}},registerPinnedTableButtons(){if(this.parent.getParam("ALLOW_PIN_HEADER")){const t=this.getPinnedTableButtons();if(BX.type.isArray(this.lastRegisterButtons)&&this.lastRegisterButtons.length>0){this.lastRegisterButtons.forEach(jsDD.unregisterObject)}this.lastRegisterButtons=t;(this.getPinnedTableButtons()||[]).forEach(this.register,this)}},getButtons(){return BX.Grid.Utils.getByClass(this.parent.getRows().getHeadFirstChild().getNode(),this.parent.settings.get("classResizeButton"))},getPinnedTableButtons(){return BX.Grid.Utils.getByClass(this.parent.getPinHeader().getFixedTable(),this.parent.settings.get("classResizeButton"))},_onDragStart(){const t=BX.findParent(jsDD.current_node,{className:this.parent.settings.get("classHeadCell")});const e=this.parent.getRows().getHeadFirstChild().getCells();const i=Object.keys(e);let s;this.__overlay=BX.create("div",{props:{className:"main-grid-cell-overlay"}});BX.append(this.__overlay,t);this.__resizeCell=t.cellIndex;i.forEach((t=>{if(!BX.hasClass(e[t],"main-grid-special-empty")){let i=BX.width(e[t]);if(t>0){i-=parseInt(BX.style(e[t],"border-left-width"));i-=parseInt(BX.style(e[t],"border-right-width"))}BX.width(e[t],i);s=BX.firstChild(e[t]);BX.width(s,i)}}))},_onDrag(t){const e=this.parent.getTable();const i=this.parent.getParam("ALLOW_PIN_HEADER")?this.parent.getPinHeader().getFixedTable():null;const s=e.rows[0].cells[this.__resizeCell];let n;let o;const a=BX.pos(s);const r=parseFloat(s.style.width);let l;t-=a.left;l=t;if(a.width>r){t=a.width}t=l>t?l:t;t=Math.max(t,80);if(t!==a.width){const e=this.parent.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;let s=this.parent.getColumnByIndex(this.__resizeCell-e);s.forEach((e=>{e.style.width=`${t}px`;e.style.minWidth=`${t}px`;e.style.maxWidth=`${t}px`;BX.Dom.style(e.firstElementChild,"width",`${t}px`)}));if(s[0].classList.contains("main-grid-fixed-column")){s=this.parent.getColumnByIndex(this.__resizeCell-e+1);s.forEach((e=>{e.style.width=`${t}px`;e.style.minWidth=`${t}px`;e.style.maxWidth=`${t}px`}))}this.parent.adjustFixedColumnsPosition();this.parent.adjustFadePosition(this.parent.getFadeOffset());if(BX.type.isDomNode(i)&&BX.type.isDomNode(i.rows[0])){n=i.rows[0].cells[this.__resizeCell];o=BX.firstChild(n);o.style.width=`${t}px`;o.style.minWidth=`${t}px`;n.style.width=`${t}px`;n.style.minWidth=`${t}px`}}BX.onCustomEvent(window,"Grid::columnResize",[])},_onDragEnd(){this.saveSizes();const t=BX.findParent(jsDD.current_node,{className:this.parent.settings.get("classHeadCell")});const e=t.querySelector(".main-grid-cell-overlay");if(e){BX.Dom.remove(e)}},getColumnSizes(){const t=this.parent.getRows().getHeadFirstChild().getCells();const e={};let i;[].forEach.call(t,(t=>{i=BX.data(t,"name");if(BX.type.isNotEmptyString(i)){e[i]=BX.width(t)}}),this);return e},saveSizes(){this.parent.getUserOptions().setColumnSizes(this.getColumnSizes(),1)}}})();let _$2=t=>t,_t$2,_t2$2,_t3$1,_t4$1,_t5$1,_t6,_t7,_t8,_t9,_t10,_t11,_t12,_t13,_t14,_t15,_t16;(function(){BX.namespace("BX.Grid");BX.Grid.Row=function(t,e){this.node=null;this.checkbox=null;this.sort=null;this.actions=null;this.settings=null;this.index=null;this.actionsButton=null;this.parent=null;this.depth=null;this.parentId=null;this.editData=null;this.custom=null;this.onElementClick=this.onElementClick.bind(this);this.init(t,e);this.initElementsEvents()};BX.Grid.Row.prototype={init(t,e){if(BX.type.isDomNode(e)){this.node=e;this.parent=t;this.settings=new BX.Grid.Settings;this.bindNodes=[];if(this.isBodyChild()){this.bindNodes=[].slice.call(this.node.parentNode.querySelectorAll(`tr[data-bind="${this.getId()}"]`));if(this.bindNodes.length>0){this.node.addEventListener("mouseover",this.onMouseOver.bind(this));this.node.addEventListener("mouseleave",this.onMouseLeave.bind(this));this.bindNodes.forEach((function(t){t.addEventListener("mouseover",this.onMouseOver.bind(this));t.addEventListener("mouseleave",this.onMouseLeave.bind(this));t.addEventListener("click",(()=>{if(this.isSelected()){this.unselect()}else{this.select()}}))}),this)}}if(this.parent.getParam("ALLOW_CONTEXT_MENU")){BX.bind(this.getNode(),"contextmenu",BX.delegate(this._onRightClick,this))}}},onMouseOver(){this.node.classList.add("main-grid-row-over");this.bindNodes.forEach((t=>{t.classList.add("main-grid-row-over")}))},onMouseLeave(){this.node.classList.remove("main-grid-row-over");this.bindNodes.forEach((t=>{t.classList.remove("main-grid-row-over")}))},isCustom(){if(this.custom===null){this.custom=BX.hasClass(this.getNode(),this.parent.settings.get("classRowCustom"))}return this.custom},_onRightClick(t){t.preventDefault();if(!this.isHeadChild()){this.showActionsMenu(t)}},getDefaultAction(){return BX.data(this.getNode(),"default-action")},getEditorValue(){const t=this;const e=this.getCells();const i={};let s;[].forEach.call(e,(e=>{s=t.getCellEditorValue(e);if(BX.type.isArray(s)){s.forEach((t=>{i[t.NAME]=t.VALUE===undefined?"":t.VALUE;if(t.hasOwnProperty("RAW_NAME")&&t.hasOwnProperty("RAW_VALUE")){i[`${t.NAME}_custom`]=i[`${t.NAME}_custom`]||{};i[`${t.NAME}_custom`][t.RAW_NAME]=i[`${t.NAME}_custom`][t.RAW_NAME]||t.RAW_VALUE}}))}else if(s){i[s.NAME]=s.VALUE===undefined?"":s.VALUE}}));return i},editGetValues(){return this.getEditorValue()},getCellEditorValue(t){const e=BX.Grid.Utils.getByClass(t,this.parent.settings.get("classEditor"),true);let i=null;if(BX.type.isDomNode(e)){if(BX.hasClass(e,"main-grid-editor-checkbox")){i={NAME:e.getAttribute("name"),VALUE:e.checked?"Y":"N"}}else if(BX.hasClass(e,"main-grid-editor-custom")){i=this.getCustomValue(e)}else if(BX.hasClass(e,"main-grid-editor-money")){i=this.getMoneyValue(e)}else if(BX.hasClass(e,"main-ui-multi-select")){i=this.getMultiSelectValues(e)}else{i=this.getImageValue(e)}}return i},isEdit(){return BX.hasClass(this.getNode(),"main-grid-row-edit")},hide(){BX.addClass(this.getNode(),this.parent.settings.get("classHide"))},show(){BX.Dom.attr(this.getNode(),"hidden",null);BX.removeClass(this.getNode(),this.parent.settings.get("classHide"))},isShown(){return!BX.hasClass(this.getNode(),this.parent.settings.get("classHide"))},isNotCount(){return BX.hasClass(this.getNode(),this.parent.settings.get("classNotCount"))},getContentContainer(t){if(BX.Type.isDomNode(t)){const e=t.closest(".main-grid-cell");if(BX.Type.isDomNode(e)){return e.querySelector(".main-grid-cell-content")}}return t},getContent(t){const e=this.getContentContainer(t);let i;if(BX.type.isDomNode(e)){i=BX.html(e)}return i},getMoneyValue(t){const e=[];const i={PRICE:{},CURRENCY:{},HIDDEN:{}};const s=t.getAttribute("data-name");const n=[].slice.call(t.querySelectorAll("input"));n.forEach((t=>{e.push({NAME:s,RAW_NAME:t.name,RAW_VALUE:t.value||"",VALUE:t.value||""});if(t.classList.contains("main-grid-editor-money-price")){i.PRICE={NAME:t.name,VALUE:t.value}}else if(t.type===" hidden"){i.HIDDEN[t.name]=t.value}}));const o=t.querySelector(".main-grid-editor-dropdown");if(o){const t=o.getAttribute("name");if(BX.type.isNotEmptyString(t)){e.push({NAME:s,RAW_NAME:t,RAW_VALUE:o.dataset.value||"",VALUE:o.dataset.value||""});i.CURRENCY={NAME:t,VALUE:o.dataset.value}}}e.push({NAME:s,VALUE:i});return e},getCustomValue(t){const e=new Map;const i=t.getAttribute("data-name");const s=[].slice.call(t.querySelectorAll("input, select, textarea"));s.forEach((t=>{if(t.name===""){return}if(t.hasAttribute("data-ignore-field")){return}let s={NAME:i,RAW_NAME:t.name,RAW_VALUE:t.value,VALUE:t.value};switch(t.tagName){case"SELECT":if(t.multiple){const i=[];t.querySelectorAll("option").forEach((t=>{if(t.selected){i.push(t.value)}}));s.RAW_VALUE=i;s.VALUE=i;e.set(t.name,s)}else{e.set(t.name,s)}break;case"INPUT":switch(t.type.toUpperCase()){case"RADIO":if(t.checked){e.set(t.name,s)}break;case"CHECKBOX":if(t.checked){if(this.isMultipleCustomValue(t.name)){if(e.has(t.name)){s=e.get(t.name);s.RAW_VALUE.push(t.value);s.VALUE.push(t.value)}else{s.RAW_VALUE=[t.value];s.VALUE=[t.value]}}e.set(t.name,s)}break;case"FILE":s.RAW_VALUE=t.files[0];s.VALUE=t.files[0];e.set(t.name,s);break;default:if(this.isMultipleCustomValue(t.name)){if(e.has(t.name)){s=e.get(t.name);s.RAW_VALUE.push(t.value);s.VALUE.push(t.value)}else{s.RAW_VALUE=[t.value];s.VALUE=[t.value]}}e.set(t.name,s)}break;default:e.set(t.name,s);break}}));const n=[];e.forEach((t=>{n.push(t)}));return n},isMultipleCustomValue(t){return t.length>2&&t.lastIndexOf("[]")===t.length-2},getImageValue(t){let e=null;if(BX.hasClass(t,"main-grid-image-editor")){const i=t.querySelector(".main-grid-image-editor-file-input");if(i){e={NAME:i.name,VALUE:i.files[0]}}else{const i=t.querySelector(".main-grid-image-editor-fake-file-input");if(i){e={NAME:i.name,VALUE:i.value}}}}else if(t.value){e={NAME:t.getAttribute("name"),VALUE:t.value}}else{e={NAME:t.getAttribute("name"),VALUE:BX.data(t,"value")}}return e},getMultiSelectValues(t){const e=JSON.parse(BX.data(t,"value"));return{NAME:t.getAttribute("name"),VALUE:main_core.Type.isArrayFilled(e)?e:""}},getEditorContainer(t){return BX.Grid.Utils.getByClass(t,this.parent.settings.get("classEditorContainer"),true)},getCollapseButton(){if(!this.collapseButton){this.collapseButton=BX.Grid.Utils.getByClass(this.getNode(),this.parent.settings.get("classCollapseButton"),true)}return this.collapseButton},stateLoad(){BX.addClass(this.getNode(),this.parent.settings.get("classRowStateLoad"))},stateUnload(){BX.removeClass(this.getNode(),this.parent.settings.get("classRowStateLoad"))},stateExpand(){BX.addClass(this.getNode(),this.parent.settings.get("classRowStateExpand"))},stateCollapse(){BX.removeClass(this.getNode(),this.parent.settings.get("classRowStateExpand"))},getParentId(){if(this.parentId===null){this.parentId=BX.data(this.getNode(),"parent-id");if(typeof this.parentId!=="undefined"&&this.parentId!==null){this.parentId=this.parentId.toString()}}return this.parentId},getDataset(){return this.getNode().dataset},getDepth(){if(this.depth===null){this.depth=BX.data(this.getNode(),"depth")}return this.depth},setDepth(t){t=parseInt(t);if(BX.type.isNumber(t)){const e=t-parseInt(this.getDepth());const i=this.parent.getRows();this.getDataset().depth=t;this.getShiftCells().forEach((e=>{BX.data(e,"depth",t);BX.style(e,"padding-left",`${t*20}px`)}));i.getRowsByParentId(this.getId(),true).forEach((t=>{const i=parseInt(e)+parseInt(t.getDepth());t.getDataset().depth=i;t.getShiftCells().forEach((t=>{BX.data(t,"depth",i);BX.style(t,"padding-left",`${i*20}px`)}))}))}},setParentId(t){this.getDataset().parentId=t},getShiftCells(){return BX.Grid.Utils.getBySelector(this.getNode(),'td[data-shift="true"]')},showChildRows(){const t=this.getChildren();const e=this.isCustom();t.forEach((t=>{t.show();if(!e&&t.isExpand()){t.showChildRows()}}));this.parent.updateCounterDisplayed();this.parent.updateCounterSelected();this.parent.adjustCheckAllCheckboxes();this.parent.adjustRows()},getChildren(){const t=this.isCustom()?"getRowsByGroupId":"getRowsByParentId";const e=this.isCustom()?this.getGroupId():this.getId();return this.parent.getRows()[t](e,true)},hideChildRows(){const t=this.getChildren();t.forEach((t=>{t.hide()}));this.parent.updateCounterDisplayed();this.parent.updateCounterSelected();this.parent.adjustCheckAllCheckboxes();this.parent.adjustRows()},isChildsLoaded(){if(!BX.type.isBoolean(this.childsLoaded)){this.childsLoaded=this.isCustom()||BX.data(this.getNode(),"child-loaded")==="true"}return this.childsLoaded},expand(){const t=this;this.stateExpand();if(this.isChildsLoaded()){this.showChildRows()}else{this.stateLoad();this.loadChildRows((e=>{e.reverse().forEach((e=>{BX.insertAfter(e,t.getNode())}));t.parent.getRows().reset();t.parent.bindOnRowEvents();if(t.parent.getParam("ALLOW_ROWS_SORT")){t.parent.getRowsSortable().reinit()}if(t.parent.getParam("ALLOW_COLUMNS_SORT")){t.parent.getColsSortable().reinit()}t.stateUnload();BX.data(t.getNode(),"child-loaded","true");t.parent.updateCounterDisplayed();t.parent.updateCounterSelected();t.parent.adjustCheckAllCheckboxes()}))}},collapse(){this.stateCollapse();this.hideChildRows()},isExpand(){return BX.hasClass(this.getNode(),this.parent.settings.get("classRowStateExpand"))},toggleChildRows(){if(this.isExpand()){this.collapse()}else{this.expand()}},loadChildRows(t){if(BX.type.isFunction(t)){const e=this;let i=parseInt(this.getDepth());const s=this.parent.getUserOptions().getAction("GRID_GET_CHILD_ROWS");i=BX.type.isNumber(i)?i+1:1;this.parent.getData().request("","POST",{action:s,parent_id:this.getId(),depth:i},null,(function(){const i=this.getRowsByParentId(e.getId());t.apply(null,[i])}))}},update(t,e,i){t=t||"";const s=this.parent.getUserOptions().getAction("GRID_UPDATE_ROW");const n=this.getDepth();const o=this.getId();const a=this.getParentId();const r={id:o,parentId:a,action:s,depth:n,data:t};const l=this;this.stateLoad();this.parent.getData().request(e,"POST",r,null,(function(){const e=this.getBodyRows();l.parent.getUpdater().updateBodyRows(e);l.stateUnload();l.parent.getRows().reset();l.parent.getUpdater().updateFootRows(this.getFootRows());l.parent.getUpdater().updatePagination(this.getPagination());l.parent.getUpdater().updateMoreButton(this.getMoreButton());l.parent.getUpdater().updateCounterTotal(this.getCounterTotal());l.parent.bindOnRowEvents();l.parent.adjustEmptyTable(e);l.parent.bindOnMoreButtonEvents();l.parent.bindOnClickPaginationLinks();l.parent.updateCounterDisplayed();l.parent.updateCounterSelected();if(l.parent.getParam("ALLOW_COLUMNS_SORT")){l.parent.colsSortable.reinit()}if(l.parent.getParam("ALLOW_ROWS_SORT")){l.parent.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowUpdated",[{id:o,data:t,grid:l.parent,response:this}]);BX.onCustomEvent(window,"Grid::updated",[l.parent]);if(BX.type.isFunction(i)){i({id:o,data:t,grid:l.parent,response:this})}}))},remove(t,e,i){t=t||"";const s=this.parent.getUserOptions().getAction("GRID_DELETE_ROW");const n=this.getDepth();const o=this.getId();const a=this.getParentId();const r={id:o,parentId:a,action:s,depth:n,data:t};const l=this;this.stateLoad();this.parent.getData().request(e,"POST",r,null,(function(){const e=this.getBodyRows();l.parent.getUpdater().updateBodyRows(e);l.stateUnload();l.parent.getRows().reset();l.parent.getUpdater().updateFootRows(this.getFootRows());l.parent.getUpdater().updatePagination(this.getPagination());l.parent.getUpdater().updateMoreButton(this.getMoreButton());l.parent.getUpdater().updateCounterTotal(this.getCounterTotal());l.parent.bindOnRowEvents();l.parent.adjustEmptyTable(e);l.parent.bindOnMoreButtonEvents();l.parent.bindOnClickPaginationLinks();l.parent.updateCounterDisplayed();l.parent.updateCounterSelected();if(l.parent.getParam("ALLOW_COLUMNS_SORT")){l.parent.colsSortable.reinit()}if(l.parent.getParam("ALLOW_ROWS_SORT")){l.parent.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowRemoved",[{id:o,data:t,grid:l.parent,response:this}]);BX.onCustomEvent(window,"Grid::updated",[l.parent]);if(BX.type.isFunction(i)){i({id:o,data:t,grid:l.parent,response:this})}}))},editCancel(){const t=this.getCells();const e=this;let i;[].forEach.call(t,(t=>{i=e.getEditorContainer(t);if(BX.type.isDomNode(i)){BX.remove(e.getEditorContainer(t));BX.show(e.getContentContainer(t))}}));BX.removeClass(this.getNode(),"main-grid-row-edit")},getCellByIndex(t){return this.getCells()[t]},getEditDataByCellIndex(index){return eval(BX.data(this.getCellByIndex(index),"edit"))},getCellNameByCellIndex(t){return BX.data(this.getCellByIndex(t),"name")},resetEditData(){this.editData=null},setEditData(t){this.editData=t},getEditData(){if(this.editData===null){const t=this.parent.getParam("EDITABLE_DATA");const e=this.getId();if(BX.type.isPlainObject(t)&&e in t){this.editData=t[e]}else{this.editData={}}}return this.editData},getCellEditDataByCellIndex(t){const e=this.getEditData();let i=null;t=parseInt(t);if(BX.type.isNumber(t)&&BX.type.isPlainObject(e)){const s=this.parent.getRows().getHeadFirstChild().getEditDataByCellIndex(t);if(BX.type.isPlainObject(s)){i=s;i.VALUE=e[s.NAME]}}return i},edit(){const t=this.getCells();const e=this;let i;let s;let n;let o;[].forEach.call(t,((t,a)=>{if(t.dataset.editable==="true"){try{i=e.getCellEditDataByCellIndex(a)}catch(t){throw new Error(t)}if(e.parent.getEditor().validateEditObject(i)){o=e.getContentContainer(t);n=BX.height(o);s=e.parent.getEditor().getEditor(i,n);if(!e.getEditorContainer(t)&&BX.type.isDomNode(s)){t.appendChild(s);BX.hide(o)}}}}));BX.addClass(this.getNode(),"main-grid-row-edit")},setDraggable(t){if(t){BX.removeClass(this.getNode(),this.parent.settings.get("classDisableDrag"));this.parent.getRowsSortable().register(this.getNode())}else{BX.addClass(this.getNode(),this.parent.settings.get("classDisableDrag"));this.parent.getRowsSortable().unregister(this.getNode())}},isDraggable(){return!BX.hasClass(this.getNode(),this.parent.settings.get("classDisableDrag"))},getNode(){return this.node},getIndex(){return this.getNode().rowIndex},getId(){return String(BX.data(this.getNode(),"id"))},getGroupId(){return BX.data(this.getNode(),"group-id").toString()},getObserver(){return BX.Grid.observer},getCheckbox(){if(!this.checkbox){this.checkbox=BX.Grid.Utils.getByClass(this.getNode(),this.settings.get("classRowCheckbox"),true)}return this.checkbox},hasActionsButton(){return BX.Type.isDomNode(this.getActionsButton())},getActionsMenu(){if(!this.actionsMenu&&this.hasActionsButton()){const t=this.getActionsButton().getBoundingClientRect();this.actionsMenu=BX.PopupMenu.create(`main-grid-actions-menu-${this.getId()}`,this.getActionsButton(),this.getMenuItems(),{autoHide:true,offsetTop:-(t.height/2+26),offsetLeft:30,angle:{position:"left",offset:t.height/2-8},events:{onPopupClose:BX.delegate(this._onCloseMenu,this),onPopupShow:BX.delegate(this._onPopupShow,this)}});BX.addCustomEvent("Grid::updated",(()=>{if(this.actionsMenu){this.actionsMenu.destroy();this.actionsMenu=null}}));BX.bind(this.actionsMenu.popupWindow.popupContainer,"click",BX.delegate((function(t){const e=this.getActionsMenu();if(e){const i=BX.getEventTarget(t);const s=BX.findParent(i,{className:"menu-popup-item"},10);if(!s||!s.dataset.preventCloseContextMenu){e.close()}}}),this))}return this.actionsMenu},_onCloseMenu(){},_onPopupShow(t){t.setBindElement(this.getActionsButton())},actionsMenuIsShown(){return this.getActionsMenu().popupWindow.isShown()},showActionsMenu(t){BX.fireEvent(document.body,"click");this.getActionsMenu().popupWindow.show();if(t){this.getActionsMenu().popupWindow.popupContainer.style.top=`${t.pageY-25+BX.PopupWindow.getOption("offsetTop")}px`;this.getActionsMenu().popupWindow.popupContainer.style.left=`${t.pageX+20+BX.PopupWindow.getOption("offsetLeft")}px`}},closeActionsMenu(){if(this.actionsMenu&&this.actionsMenu.popupWindow){this.actionsMenu.popupWindow.close()}},getMenuItems(){return this.getActions()||[]},getActions(){try{this.actions=this.actions||eval(BX.data(this.getActionsButton(),this.settings.get("dataActionsKey")))}catch{this.actions=null}return this.actions},getActionsButton(){if(!this.actionsButton){this.actionsButton=BX.Grid.Utils.getByClass(this.getNode(),this.settings.get("classRowActionButton"),true)}return this.actionsButton},initSelect(){if(this.isSelected()&&!BX.hasClass(this.getNode(),this.settings.get("classCheckedRow"))){BX.addClass(this.getNode(),this.settings.get("classCheckedRow"))}},getParentNode(){let t;try{t=this.getNode().parentNode}catch{t=null}return t},getParentNodeName(){let t;try{t=this.getParentNode().nodeName}catch{t=null}return t},isSelectable(){return!this.isEdit()||this.parent.getParam("ALLOW_EDIT_SELECTION")},select(){let t;if(this.isSelectable()&&(this.parent.getParam("ADVANCED_EDIT_MODE")||!this.parent.getRows().hasEditable())){t=this.getCheckbox();if(t&&!BX.data(t,"disabled")){BX.addClass(this.getNode(),this.settings.get("classCheckedRow"));this.bindNodes.forEach((function(t){BX.addClass(t,this.settings.get("classCheckedRow"))}),this);t.checked=true}}},unselect(){if(this.isSelectable()){BX.removeClass(this.getNode(),this.settings.get("classCheckedRow"));this.bindNodes.forEach((function(t){BX.removeClass(t,this.settings.get("classCheckedRow"))}),this);if(this.getCheckbox()){this.getCheckbox().checked=false}}},getCells(){return this.getNode().cells},isSelected(){return this.getCheckbox()&&this.getCheckbox().checked||BX.hasClass(this.getNode(),this.settings.get("classCheckedRow"))},isHeadChild(){return this.getParentNodeName()==="THEAD"&&BX.hasClass(this.getNode(),this.settings.get("classHeadRow"))},isBodyChild(){return BX.hasClass(this.getNode(),this.settings.get("classBodyRow"))&&!BX.hasClass(this.getNode(),this.settings.get("classEmptyRows"))},isFootChild(){return this.getParentNodeName()==="TFOOT"&&BX.hasClass(this.getNode(),this.settings.get("classFootRow"))},prependTo(t){BX.Dom.prepend(this.getNode(),t)},appendTo(t){BX.Dom.append(this.getNode(),t)},setId(t){BX.Dom.attr(this.getNode(),"data-id",t)},setActions(t){const e=this.getNode().querySelector(".main-grid-cell-action");if(e){let i=e.querySelector(".main-grid-row-action-button");if(!i){i=BX.Dom.create({tag:"div",props:{className:"main-grid-row-action-button"}});const t=this.getContentContainer(e);BX.Dom.append(i,t)}BX.Dom.attr(i,{href:"#","data-actions":t});this.actions=t;if(this.actionsMenu){this.actionsMenu.destroy();this.actionsMenu=null}}},makeCountable(){BX.Dom.removeClass(this.getNode(),"main-grid-not-count")},makeNotCountable(){BX.Dom.addClass(this.getNode(),"main-grid-not-count")},getColumnOptions(t){const e=this.parent.getParam("COLUMNS_ALL");if(BX.Type.isPlainObject(e)&&Reflect.has(e,t)){return e[t]}return null},setCellsContent(t){const e=this.parent.getRows().getHeadFirstChild();[...this.getCells()].forEach(((i,s)=>{const n=e.getCellNameByCellIndex(s);if(Reflect.has(t,n)){const e=this.getColumnOptions(n);const s=this.getContentContainer(i);const o=t[n];if(e.type==="labels"&&BX.Type.isArray(o)){const t=o.map((t=>{const e=BX.Tag.render(_t$2||(_t$2=_$2`
								<span class="ui-label ${0}"></span>
							`),t.color);if(t.light!==true){BX.Dom.addClass(e,"ui-label-fill")}if(BX.Type.isPlainObject(t.events)){if(Reflect.has(t.events,"click")){BX.Dom.addClass(e,"ui-label-link")}this.bindOnEvents(e,t.events)}const i=(()=>{if(BX.Type.isStringFilled(t.html)){return t.html}return t.text})();const s=BX.Tag.render(_t2$2||(_t2$2=_$2`
								<span class="ui-label-inner">${0}</span>
							`),i);BX.Dom.append(s,e);if(BX.Type.isPlainObject(t.removeButton)){const i=(()=>{if(t.removeButton.type===BX.Grid.Label.RemoveButtonType.INSIDE){return BX.Tag.render(_t3$1||(_t3$1=_$2`
											<span class="ui-label-icon"></span>
										`))}return BX.Tag.render(_t4$1||(_t4$1=_$2`
										<span class="main-grid-label-remove-button ${0}"></span>
									`),t.removeButton.type)})();if(BX.Type.isPlainObject(t.removeButton.events)){this.bindOnEvents(i,t.removeButton.events)}BX.Dom.append(i,e)}return e}));const e=BX.Tag.render(_t5$1||(_t5$1=_$2`
							<div class="main-grid-labels">${0}</div>
						`),t);BX.Dom.clean(s);const i=s.querySelector(".main-grid-labels");if(BX.Type.isDomNode(i)){BX.Dom.replace(i,e)}else{BX.Dom.append(e,s)}}else if(e.type==="tags"&&BX.Type.isPlainObject(o)){const t=o.items.map((t=>{const e=BX.Tag.render(_t6||(_t6=_$2`
								<span class="main-grid-tag"></span>
							`));this.bindOnEvents(e,t.events);if(t.active===true){BX.Dom.addClass(e,"main-grid-tag-active")}const i=(()=>{if(BX.Type.isStringFilled(t.html)){return t.html}return BX.Text.encode(t.text)})();const s=BX.Tag.render(_t7||(_t7=_$2`
								<span class="main-grid-tag-inner">${0}</span>
							`),i);BX.Dom.append(s,e);if(t.active===true){const i=BX.Tag.render(_t8||(_t8=_$2`
									<span class="main-grid-tag-remove"></span>
								`));BX.Dom.append(i,e);if(BX.Type.isPlainObject(t.removeButton)){this.bindOnEvents(i,t.removeButton.events)}}return e}));const e=BX.Tag.render(_t9||(_t9=_$2`
							<span class="main-grid-tags">${0}</span>
						`),t);const i=BX.Tag.render(_t10||(_t10=_$2`
							<span class="main-grid-tag-add"></span>
						`));if(BX.Type.isPlainObject(o.addButton)){this.bindOnEvents(i,o.addButton.events)}BX.Dom.append(i,e);const n=s.querySelector(".main-grid-tags");if(BX.Type.isDomNode(n)){BX.Dom.replace(n,e)}else{BX.Dom.append(e,s)}}else if(BX.Type.isDomNode(o)){BX.Dom.append(o,s)}else{BX.Runtime.html(s,o)}}}))},getCellById(t){const e=this.parent.getRows().getHeadFirstChild();return[...this.getCells()].find(((i,s)=>e.getCellNameByCellIndex(s)===t))},isTemplate(){return this.isBodyChild()&&/^template_\d$/.test(this.getId())},enableAbsolutePosition(){const t=[...this.parent.getRows().getHeadFirstChild().getCells()];const e=t.map((t=>BX.Dom.style(t,"width")));const i=this.getCells();e.forEach(((t,e)=>{BX.Dom.style(i[e],"width",t)}));BX.Dom.style(this.getNode(),"position","absolute")},disableAbsolutePosition(){BX.Dom.style(this.getNode(),"position",null)},getHeight(){return BX.Text.toNumber(BX.Dom.style(this.getNode(),"height"))},setCellActions(t){Object.entries(t).forEach((([t,e])=>{const i=this.getCellById(t);if(i){const t=i.querySelector(".main-grid-cell-inner");if(t){const i=(()=>{const e=t.querySelector(".main-grid-cell-content-actions");if(e){BX.Dom.clean(e);return e}const i=BX.Tag.render(_t11||(_t11=_$2`
								<div class="main-grid-cell-content-actions"></div>
							`));BX.Dom.append(i,t);return i})();if(BX.Type.isArrayFilled(e)){e.forEach((t=>{const e=(()=>{if(BX.Type.isArrayFilled(t.class)){return t.class.join(" ")}return t.class})();const s=BX.Tag.render(_t12||(_t12=_$2`
									<span class="main-grid-cell-content-action ${0}"></span>
								`),e);if(BX.Type.isPlainObject(t.events)){this.bindOnEvents(s,t.events)}if(BX.Type.isPlainObject(t.attributes)){BX.Dom.attr(s,t.attributes)}BX.Dom.append(s,i)}))}}}}))},initElementsEvents(){const buttons=[...this.getNode().querySelectorAll(".main-grid-cell [data-events]")];if(BX.Type.isArrayFilled(buttons)){buttons.forEach((button=>{const events=eval(BX.Dom.attr(button,"data-events"));if(BX.Type.isPlainObject(events)){BX.Dom.attr(button,"data-events",null);this.bindOnEvents(button,events)}}))}},onElementClick(t){t.stopPropagation()},bindOnEvents(button,events){if(BX.Type.isDomNode(button)&&BX.Type.isPlainObject(events)){BX.Event.bind(button,"click",this.onElementClick.bind(this));const target=(()=>{const t=BX.Dom.attr(button,"data-target");if(t){return button.closest(t)}return button})();const event=new BX.Event.BaseEvent({data:{button:button,target:target,row:this}});event.setTarget(target);Object.entries(events).forEach((([eventName,handler])=>{const preparedHandler=eval(handler);BX.Event.bind(button,eventName,preparedHandler.bind(null,event))}))}},setCounters(t){if(BX.Type.isPlainObject(t)){Object.entries(t).forEach((([t,e])=>{const i=this.getCellById(t);if(BX.Type.isDomNode(i)){const t=i.querySelector(".main-grid-cell-inner");const s=(()=>{const t=i.querySelector(".main-grid-cell-counter");if(BX.Type.isDomNode(t)){return t}return BX.Tag.render(_t13||(_t13=_$2`
								<span class="main-grid-cell-counter"></span>
							`))})();const n=(()=>{const t=s.querySelector(".ui-counter");if(BX.Type.isDomNode(t)){return t}const e=BX.Tag.render(_t14||(_t14=_$2`
								<span class="ui-counter"></span>
							`));BX.Dom.append(e,s);return e})();if(BX.Type.isPlainObject(e.events)){this.bindOnEvents(n,e.events)}const o=(()=>{const t=n.querySelector(".ui-counter-inner");if(BX.Type.isDomNode(t)){return t}const e=BX.Tag.render(_t15||(_t15=_$2`
								<span class="ui-counter-inner"></span>
							`));BX.Dom.append(e,n);return e})();if(e.isDouble){const t=(()=>{const t=n.querySelector(".ui-counter-secondary");if(BX.Type.isDomNode(t)){return t}const e=BX.Tag.render(_t16||(_t16=_$2`
									<span class="ui-counter-secondary"></span>
								`));BX.Dom.append(e,n);return e})();if(BX.Type.isStringFilled(e.secondaryColor)){Object.values(BX.Grid.Counters.Color).forEach((e=>{BX.Dom.removeClass(t,e)}));BX.Dom.addClass(t,e.secondaryColor)}}if(BX.Type.isStringFilled(e.type)){Object.values(BX.Grid.Counters.Type).forEach((t=>{BX.Dom.removeClass(s,`main-grid-cell-counter-${t}`)}));BX.Dom.addClass(s,`main-grid-cell-counter-${e.type}`)}if(BX.Type.isStringFilled(e.color)){Object.values(BX.Grid.Counters.Color).forEach((t=>{BX.Dom.removeClass(n,t)}));BX.Dom.addClass(n,e.color)}if(BX.Type.isStringFilled(e.size)){Object.values(BX.Grid.Counters.Size).forEach((t=>{BX.Dom.removeClass(n,t)}));BX.Dom.addClass(n,e.size)}if(BX.Type.isStringFilled(e.class)){BX.Dom.addClass(n,e.class)}if(BX.Type.isStringFilled(e.value)||BX.Type.isNumber(e.value)){const t=BX.Text.toNumber(o.innerText);const i=BX.Text.toNumber(e.value);if(i>0){if(i<100){o.innerText=e.value}else{o.innerText="99+"}if(e.animation!==false){if(i!==t){if(i>t){BX.Dom.addClass(o,"ui-counter-plus")}else{BX.Dom.addClass(o,"ui-counter-minus")}}BX.Event.bindOnce(o,"animationend",(t=>{if(t.animationName==="uiCounterPlus"||t.animationName==="uiCounterMinus"){BX.Dom.removeClass(o,["ui-counter-plus","ui-counter-minus"])}}))}}}if(BX.Text.toNumber(e.value)>0){const i=e.type===BX.Grid.Counters.Type.RIGHT?"right":"left";if(i==="left"){BX.Dom.prepend(s,t)}else if(i==="right"){BX.Dom.append(s,t)}}else{const t=`main-grid-cell-counter-${BX.Grid.Counters.Type.LEFT_ALIGNED}`;if(BX.Dom.hasClass(s,t)){BX.remove(n)}else{BX.remove(s)}}}}))}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Rows=function(t){this.parent=null;this.rows=null;this.headChild=null;this.bodyChild=null;this.footChild=null;this.init(t)};BX.Grid.Rows.prototype={init:function(t){this.parent=t},reset:function(){this.rows=null;this.headChild=null;this.bodyChild=null;this.footChild=null},enableDragAndDrop:function(){this.parent.arParams["ALLOW_ROWS_SORT"]=true;if(!(this.parent.getRowsSortable()instanceof BX.Grid.RowsSortable)){this.parent.rowsSortable=new BX.Grid.RowsSortable(this.parent)}},disableDragAndDrop:function(){this.parent.arParams["ALLOW_ROWS_SORT"]=false;if(this.parent.getRowsSortable()instanceof BX.Grid.RowsSortable){this.parent.getRowsSortable().destroy();this.parent.rowsSortable=null}},getFootLastChild:function(){return this.getLast(this.getFootChild())},getFootFirstChild:function(){return this.getFirst(this.getFootChild())},getBodyLastChild:function(){return this.getLast(this.getBodyChild())},getBodyFirstChild:function(){return this.getFirst(this.getBodyChild())},getHeadLastChild:function(){return this.getLast(this.getHeadChild())},getHeadFirstChild:function(){return this.getFirst(this.getHeadChild())},getEditSelectedValues:function(t){var e=this.getSelected(t);var i={};e.forEach((function(t){i[t.getId()]=t.editGetValues()}));return i},getSelectedIds:function(t){return this.getSelected(t).map((function(t){return t.getId()}))},initSelected:function(){var t=this.getSelected();if(BX.type.isArray(t)&&t.length){t.forEach((function(t){t.initSelect()}));this.parent.enableActionsPanel()}},editSelected:function(){this.getSelected().forEach((function(t){t.edit()}));BX.onCustomEvent(window,"Grid::thereEditedRows",[])},editSelectedCancel:function(t){this.getSelected(t).forEach((function(t){t.editCancel()}));BX.onCustomEvent(window,"Grid::noEditedRows",[])},isSelected:function(){return this.getBodyChild().some((function(t){return t.isShown()&&t.isSelected()}))},isAllSelected:function(){return!this.getBodyChild().filter((function(t){return!!t.getCheckbox()&&t.getCheckbox().disabled!==true})).some((function(t){return!t.isSelected()}))},getParent:function(){return this.parent},getCountSelected:function(){var t;try{t=this.getSelected().filter((function(t){return!t.isNotCount()&&t.isShown()})).length}catch(e){t=0}return t},getCountDisplayed:function(){var t;try{t=this.getBodyChild().filter((function(t){return t.isShown()&&!t.isNotCount()})).length}catch(e){t=0}return t},addRows:function(t){var e=BX.findChild(this.getParent().getTable(),{tag:"TBODY"},true,false);t.forEach((function(t){e.appendChild(t)}))},getRows:function(){var t;var e=this;if(!this.rows){t=[].slice.call(this.getParent().getTable().querySelectorAll("tr[data-id], thead > tr"));this.rows=t.map((function(t){return new BX.Grid.Row(e.parent,t)}))}return this.rows},getSelected:function(t){return this.getBodyChild(t).filter((function(t){return t.isShown()&&t.isSelected()}))},normalizeNode:function(t){if(!BX.hasClass(t,this.getParent().settings.get("classBodyRow"))){t=BX.findParent(t,{className:this.getParent().settings.get("classBodyRow")},true,false)}return t},getById:function(t){return this.getBodyChild().find((function(e){return String(e.getId())===String(t)}))||null},get:function(t){if(BX.Type.isDomNode(t)){const e=t.closest(".main-grid-row");if(BX.Type.isDomNode(e)){const t=this.getRows().find((t=>t.getNode()===e));if(t){return t}}}return null},getLast:function(t){var e;try{e=t[t.length-1]}catch(t){e=null}return e},getFirst:function(t){var e;try{e=t[0]}catch(t){e=null}return e},getHeadChild:function(){this.headChild=this.headChild||this.getRows().filter((function(t){return t.isHeadChild()}));return this.headChild},getBodyChild:function(t){return this.getRows().filter((function(e){return e.isBodyChild()&&(!e.isTemplate()||t)}))},getFootChild:function(){this.footChild=this.footChild||this.getRows().filter((function(t){return t.isFootChild()}));return this.footChild},selectAll:function(){this.getRows().map((function(t){t.isShown()&&t.select()}))},unselectAll:function(){this.getRows().map((function(t){t.unselect()}))},getByIndex:function(t){var e=this.getBodyChild().filter((function(t){return t})).filter((function(e){return e.getNode().rowIndex===t}));return e.length?e[0]:null},getRowsByParentId:function(t,e){var i=[];var s=this;if(!t){return i}t=t.toString();function n(t){s.getBodyChild().forEach((function(s){if(s.getParentId()===t){i.push(s);e&&n(s.getId())}}),s)}n(t);return i},getRowsByGroupId:function(t){var e=[];var i=this;if(!t){return e}t=t.toString();function s(t){i.getBodyChild().forEach((function(i){if(i.getGroupId()===t&&!i.isCustom()){e.push(i)}}),i)}s(t);return e},getExpandedRows:function(){return this.getRows().filter((function(t){return t.isShown()&&t.isExpand()}))},getIdsExpandedRows:function(){return this.getExpandedRows().map((function(t){return t.getId()}))},getIdsCollapsedGroups:function(){return this.getRows().filter((function(t){return t.isCustom()&&!t.isExpand()})).map((function(t){return t.getId()}))},getSourceRows:function(){return BX.Grid.Utils.getBySelector(this.getParent().getTable(),[".main-grid-header > tr",".main-grid-header + tbody > tr"].join(", "))},getSourceBodyChild:function(){return this.getSourceRows().filter((function(t){return BX.Grid.Utils.closestParent(t).nodeName==="TBODY"}))},getSourceHeadChild:function(){return this.getSourceRows().filter((function(t){return BX.Grid.Utils.closestParent(t).nodeName==="THEAD"}))},getSourceFootChild:function(){return this.getSourceRows().filter((function(t){return BX.Grid.Utils.closestParent(t).nodeName==="TFOOT"}))},hasEditable:function(){return this.getBodyChild().some((function(t){return t.isEdit()}))},insertAfter:function(t,e){const i=this.getById(t);const s=this.getById(e);if(i&&s){BX.Dom.insertAfter(i.getNode(),s.getNode());this.reset()}},insertBefore:function(t,e){const i=this.getById(t);const s=this.getById(e);if(i&&s){BX.Dom.insertBefore(i.getNode(),s.getNode());this.reset()}}}})();(function(){BX.namespace("BX.Grid");BX.Grid.RowDragEvent=function(t){this.allowMoveRow=true;this.allowInsertBeforeTarget=true;this.dragItem=null;this.targetItem=null;this.eventName=t||"";this.errorMessage=""};BX.Grid.RowDragEvent.prototype={allowMove(){this.allowMoveRow=true;this.errorMessage=""},allowInsertBefore(){this.allowInsertBeforeTarget=true},disallowMove(t){this.allowMoveRow=false;this.errorMessage=t||""},disallowInsertBefore(){this.allowInsertBeforeTarget=false},getDragItem(){return this.dragItem},getTargetItem(){return this.targetItem},getEventName(){return this.eventName},setDragItem(t){return this.dragItem=t},setTargetItem(t){return this.targetItem=t},setEventName(t){return this.eventName=t},isAllowedMove(){return this.allowMoveRow},isAllowedInsertBefore(){return this.allowInsertBeforeTarget},getErrorMessage(){return this.errorMessage}};BX.Grid.RowsSortable=function(t){this.parent=null;this.list=null;this.setDefaultProps();this.init(t)};BX.Grid.RowsSortable.prototype={init(t){this.parent=t;this.list=this.getList();this.prepareListItems();jsDD.Enable();if(!this.inited){this.inited=true;this.onscrollDebounceHandler=BX.debounce(this._onWindowScroll,300,this);if(!this.parent.getParam("ALLOW_ROWS_SORT_IN_EDIT_MODE",false)){BX.addCustomEvent("Grid::thereEditedRows",BX.proxy(this.disable,this));BX.addCustomEvent("Grid::noEditedRows",BX.proxy(this.enable,this))}document.addEventListener("scroll",this.onscrollDebounceHandler,BX.Grid.Utils.listenerParams({passive:true}))}},destroy(){if(!this.parent.getParam("ALLOW_ROWS_SORT_IN_EDIT_MODE",false)){BX.removeCustomEvent("Grid::thereEditedRows",BX.proxy(this.disable,this));BX.removeCustomEvent("Grid::noEditedRows",BX.proxy(this.enable,this))}document.removeEventListener("scroll",this.onscrollDebounceHandler,BX.Grid.Utils.listenerParams({passive:true}));this.unregisterObjects()},_onWindowScroll(){this.windowScrollTop=BX.scrollTop(window);this.rowsRectList=null},disable(){this.unregisterObjects()},enable(){this.reinit()},reinit(){this.unregisterObjects();this.setDefaultProps();this.init(this.parent)},getList(){return this.parent.getRows().getSourceBodyChild()},unregisterObjects(){this.list.forEach(this.unregister,this)},prepareListItems(){this.list.forEach(this.register,this)},register(t){const e=this.parent.getRows();const i=e.get(t);if(i&&i.isDraggable()){t.onbxdragstart=BX.delegate(this._onDragStart,this);t.onbxdrag=BX.delegate(this._onDrag,this);t.onbxdragstop=BX.delegate(this._onDragEnd,this);jsDD.registerObject(t)}},unregister(t){jsDD.unregisterObject(t)},getIndex(t){return BX.Grid.Utils.getIndex(this.list,t)},calcOffset(){let t=this.dragRect.height;if(this.additionalDragItems.length>0){this.additionalDragItems.forEach((e=>{t+=e.clientHeight}))}return t},getTheadCells(t){return[].map.call(t,((e,i)=>({block:"",tag:"th",attrs:{style:`width: ${BX.width(t[i])}px;`}})))},createFake(){const t=[];this.cloneDragItem=BX.clone(this.dragItem);this.cloneDragAdditionalDragItems=[];this.cloneDragAdditionalDragItemRows=[];const e=this.getTheadCells(this.dragItem.cells);t.push(this.cloneDragItem);this.additionalDragItems.forEach((function(e){const i=BX.clone(e);t.push(i);this.cloneDragAdditionalDragItems.push(i);this.cloneDragAdditionalDragItemRows.push(new BX.Grid.Row(this.parent,i))}),this);const i=BX.width(this.parent.getTable());this.fake=BX.decl({block:"main-grid-fake-container",attrs:{style:`position: absolute; top: ${this.getDragStartRect().top}px; width: ${i}px`},content:{block:"main-grid-table",mix:"main-grid-table-fake",tag:"table",attrs:{style:`width: ${i}px`},content:[{block:"main-grid-header",tag:"thead",content:{block:"main-grid-row-head",tag:"tr",content:e}},{block:"",tag:"tbody",content:t}]}});BX.insertAfter(this.fake,this.parent.getTable());this.cloneDragItem=new BX.Grid.Row(this.parent,this.cloneDragItem);return this.fake},getDragStartRect(){return BX.pos(this.dragItem,this.parent.getTable())},_onDragStart(){this.moved=false;this.dragItem=jsDD.current_node;this.targetItem=this.dragItem;this.additionalDragItems=this.getAdditionalDragItems(this.dragItem);this.dragIndex=this.getIndex(this.dragItem);this.dragRect=this.getRowRect(this.dragItem,this.dragIndex);this.offset=this.calcOffset();this.dragStartOffset=jsDD.start_y-this.dragRect.top;this.dragEvent=new BX.Grid.RowDragEvent;this.dragEvent.setEventName("BX.Main.grid:rowDragStart");this.dragEvent.setDragItem(this.dragItem);this.dragEvent.setTargetItem(this.targetItem);this.dragEvent.allowInsertBefore();const t=this.parent.getRows().get(this.dragItem);this.startDragDepth=t.getDepth();this.startDragParentId=t.getParentId();this.createFake();BX.addClass(this.parent.getContainer(),this.parent.settings.get("classOnDrag"));BX.addClass(this.dragItem,this.parent.settings.get("classDragActive"));BX.onCustomEvent(window,"BX.Main.grid:rowDragStart",[this.dragEvent,this.parent])},getAdditionalDragItems(t){const e=this.parent.getRows();return e.getRowsByParentId(e.get(t).getId(),true).map((t=>t.getNode()))},moveRow(t,e,i){if(t){const s=BX.type.isNumber(i)?i:300;t.style.transition=`${s}ms`;t.style.transform=`translate3d(0px, ${e}px, 0px)`}},getDragOffset(){return jsDD.y-this.dragRect.top-this.dragStartOffset},getWindowScrollTop(){if(this.windowScrollTop===null){this.windowScrollTop=BX.scrollTop(window)}return this.windowScrollTop},getSortOffset(){return jsDD.y},getRowRect(t,e){if(!this.rowsRectList){this.rowsRectList={};this.list.forEach((function(t,e){this.rowsRectList[e]=t.getBoundingClientRect()}),this)}return this.rowsRectList[e]},getRowCenter(t,e){const i=this.getRowRect(t,e);return i.top+this.getWindowScrollTop()+i.height/2},isDragToBottom(t,e){const i=this.getRowCenter(t,e);const s=this.getSortOffset();return e>this.dragIndex&&i<s},isMovedToBottom(t){return t.style.transform===`translate3d(0px, ${-this.offset}px, 0px)`},isDragToTop(t,e){const i=this.getRowCenter(t,e);const s=this.getSortOffset();return e<this.dragIndex&&i>s},isMovedToTop(t){return t.style.transform===`translate3d(0px, ${this.offset}px, 0px)`},isDragToBack(t,e){const i=this.getRowCenter(t,e);const s=this.dragIndex;const n=jsDD.y;return e>s&&n<i||e<s&&n>i},isMoved(t){return t.style.transform!=="translate3d(0px, 0px, 0px)"&&t.style.transform!==""},_onDrag(){const t=0;const e=0;this.moveRow(this.dragItem,this.getDragOffset(),t);this.moveRow(this.fake,this.getDragOffset(),t);BX.Grid.Utils.styleForEach(this.additionalDragItems,{transition:`${t}ms`,transform:`translate3d(0px, ${this.getDragOffset()}px, 0px)`});this.list.forEach((function(t,i){if(Boolean(t)&&t!==this.dragItem&&!this.additionalDragItems.includes(t)){if(this.isDragToTop(t,i)&&!this.isMovedToTop(t)){this.targetItem=t;this.moveRow(t,this.offset);this.dragEvent.setEventName("BX.Main.grid:rowDragMove");this.dragEvent.setTargetItem(this.targetItem);BX.onCustomEvent(window,"BX.Main.grid:rowDragMove",[this.dragEvent,this.parent]);this.checkError(this.dragEvent);this.updateProperties(this.dragItem,this.targetItem);this.isDragetToTop=true;this.moved=true}if(this.isDragToBottom(t,i)&&!this.isMovedToBottom(t)){this.targetItem=this.findNextVisible(this.list,i);this.moveRow(t,-this.offset);this.dragEvent.setEventName("BX.Main.grid:rowDragMove");this.dragEvent.setTargetItem(this.targetItem);BX.onCustomEvent(window,"BX.Main.grid:rowDragMove",[this.dragEvent,this.parent]);this.checkError(this.dragEvent);this.updateProperties(this.dragItem,this.targetItem);this.isDragetToTop=false;if(this.targetItem){this.moved=true}}if(this.isDragToBack(t,i)&&this.isMoved(t)){this.moveRow(t,e);this.targetItem=t;if(this.isDragetToTop){this.targetItem=this.findNextVisible(this.list,i)}this.moved=true;this.dragEvent.setEventName("BX.Main.grid:rowDragMove");this.dragEvent.setTargetItem(this.targetItem);BX.onCustomEvent(window,"BX.Main.grid:rowDragMove",[this.dragEvent,this.parent]);this.checkError(this.dragEvent);this.updateProperties(this.dragItem,this.targetItem)}}}),this)},createError(t,e){const i=BX.decl({block:"main-grid-error",content:e||""});Boolean(t)&&t.appendChild(i);setTimeout((()=>{BX.addClass(i,"main-grid-error-show")}),0);return i},checkError(t){if(!t.isAllowedMove()&&!this.error){this.error=this.createError(this.fake,t.getErrorMessage())}if(t.isAllowedMove()&&this.error){BX.remove(this.error);this.error=null}},findNextVisible(t,e){let i=null;const s=this.parent.getRows();t.forEach(((t,n)=>{if(!i&&n>e){const e=s.get(t);if(e&&e.isShown()){i=t}}}));return i},updateProperties(t,e){const i=this.parent.getRows();const s=i.get(t);let n=0;let o=0;if(e){const t=i.get(e);n=t.getDepth();o=t.getParentId()}s.setDepth(n);s.setParentId(o);this.cloneDragItem.setDepth(n);this.cloneDragAdditionalDragItemRows.forEach((function(t,e){t.setDepth(BX.data(this.additionalDragItems[e],"depth"))}),this)},resetDragProperties(){const t=this.parent.getRows().get(this.dragItem);t.setDepth(this.startDragDepth);t.setParentId(this.startDragParentId)},_onDragOver(){},_onDragLeave(){},_onDragEnd(){BX.onCustomEvent(window,"BX.Main.grid:rowDragEnd",[this.dragEvent,this.parent]);BX.removeClass(this.parent.getContainer(),this.parent.settings.get("classOnDrag"));BX.removeClass(this.dragItem,this.parent.settings.get("classDragActive"));BX.Grid.Utils.styleForEach(this.list,{transition:"",transform:""});if(this.dragEvent.isAllowedMove()){this.sortRows(this.dragItem,this.targetItem);this.sortAdditionalDragItems(this.dragItem,this.additionalDragItems);this.list=this.getList();this.parent.getRows().reset();const t=this.parent.getRows().get(this.dragItem);const e=this.parent.getRows().getBodyChild().map((t=>t.getId()));if(this.parent.getParam("ALLOW_ROWS_SORT_INSTANT_SAVE",true)){this.saveRowsSort(e)}BX.onCustomEvent(window,"Grid::rowMoved",[e,t,this.parent])}else{this.resetDragProperties()}BX.remove(this.fake);this.setDefaultProps()},sortAdditionalDragItems(t,e){e.reduce(((t,e)=>{Boolean(e)&&BX.insertAfter(e,t);return e}),t)},sortRows(t,e){if(e){e.parentNode.insertBefore(t,e)}else if(this.moved){t.parentNode.appendChild(t)}},saveRowsSort(t){const e={ids:t,action:this.parent.getUserOptions().getAction("GRID_SAVE_ROWS_SORT")};this.parent.getData().request(null,"POST",e)},setDefaultProps(){this.moved=false;this.dragItem=null;this.targetItem=null;this.dragRect=null;this.dragIndex=null;this.offset=null;this.realX=null;this.realY=null;this.dragStartOffset=null;this.windowScrollTop=null;this.rowsRectList=null;this.error=false}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Settings=function(){this.settings={};this.defaultSettings={classContainer:"main-grid",classWrapper:"main-grid-wrapper",classTable:"main-grid-table",classScrollContainer:"main-grid-container",classFadeContainer:"main-grid-fade",classFadeContainerRight:"main-grid-fade-right",classFadeContainerLeft:"main-grid-fade-left",classNavPanel:"main-grid-nav-panel",classActionPanel:"main-grid-action-panel",classCursor:"main-grid-cursor",classRowCustom:"main-grid-row-custom",classMoreButton:"main-grid-more-btn",classRow:"main-grid-row",classHeadRow:"main-grid-row-head",classBodyRow:"main-grid-row-body",classFootRow:"main-grid-row-foot",classDataRows:"main-grid-row-data",classPanels:"main-grid-bottom-panels",classCellHeadContainer:"main-grid-cell-head-container",classCellHeadOndrag:"main-grid-cell-head-ondrag",classEmptyRows:"main-grid-row-empty",classEmptyBlock:"main-grid-empty-block",classCheckAllCheckboxes:"main-grid-check-all",classCheckedRow:"main-grid-row-checked",classRowCheckbox:"main-grid-row-checkbox",classPagination:"main-grid-panel-cell-pagination",classActionCol:"main-grid-cell-action",classCounterDisplayed:"main-grid-counter-displayed",classCounterSelected:"main-grid-counter-selected",classCounterTotal:"main-grid-panel-total",classTableFade:"main-grid-table-fade",classDragActive:"main-grid-on-row-drag",classResizeButton:"main-grid-resize-button",classOnDrag:"main-grid-ondrag",classDisableDrag:"main-grid-row-drag-disabled",classPanelCellContent:"main-grid-panel-content",classCollapseButton:"main-grid-plus-button",classRowStateLoad:"main-grid-load-row",classRowStateExpand:"main-grid-row-expand",classHeaderSortable:"main-grid-col-sortable",classHeaderNoSortable:"main-grid-col-no-sortable",classCellStatic:"main-grid-cell-static",classHeadCell:"main-grid-cell-head",classPageSize:"main-grid-panel-select-pagesize",classGroupEditButton:"main-grid-control-panel-action-edit",classGroupDeleteButton:"main-grid-control-panel-action-remove",classGroupActionsDisabled:"main-grid-control-panel-action-icon-disable",classPanelButton:"ui-btn",classPanelApplyButton:"main-grid-control-panel-apply-button",classPanelCheckbox:"main-grid-panel-checkbox",classEditor:"main-grid-editor",classEditorContainer:"main-grid-editor-container",classEditorText:"main-grid-editor-text",classEditorDate:"main-grid-editor-date",classEditorNumber:"main-grid-editor-number",classEditorRange:"main-grid-editor-range",classEditorCheckbox:"main-grid-editor-checkbox",classEditorTextarea:"main-grid-editor-textarea",classEditorCustom:"main-grid-editor-custom",classEditorMoney:"main-grid-editor-money",classCellContainer:"main-grid-cell-content",classEditorOutput:"main-grid-editor-output",classSettingsWindow:"main-grid-settings-window",classSettingsWindowColumn:"main-grid-settings-window-list-item",classSettingsWindowColumnLabel:"main-grid-settings-window-list-item-label",classSettingsWindowColumnEditState:"main-grid-settings-window-list-item-edit",classSettingsWindowColumnEditInput:"main-grid-settings-window-list-item-edit-input",classSettingsWindowColumnEditButton:"main-grid-settings-window-list-item-edit-button",classSettingsWindowColumnCheckbox:"main-grid-settings-window-list-item-checkbox",classSettingsWindowShow:"main-grid-settings-window-show",classSettingsWindowSelectAll:"main-grid-settings-window-select-all",classSettingsWindowUnselectAll:"main-grid-settings-window-unselect-all",classSettingsWindowSearchSectionsWrapper:"main-grid-settings-window-search-section-wrapper",classSettingsWindowSearchActiveSectionIcon:"main-grid-settings-window-search-section-item-icon-active",classSettingsWindowSearchSectionInput:"main-grid-settings-window-search-section-input",classSettingsWindowSearchSectionItemHidden:"main-grid-settings-window-list-item-hidden",classSettingsWindowSearchSectionItemVisible:"main-grid-settings-window-list-item-visible",classSettingsButton:"main-grid-interface-settings-icon",classSettingsButtonActive:"main-grid-interface-settings-icon-active",classSettingsWindowClose:"main-grid-settings-window-actions-item-close",classSettingsWindowReset:"main-grid-settings-window-actions-item-reset",classSettingsWindowColumnChecked:"main-grid-settings-window-list-item-checked",classShowAnimation:"main-grid-show-popup-animation",classCloseAnimation:"main-grid-close-popup-animation",classLoader:"main-grid-loader-container",classLoaderShow:"main-grid-show-loader",classLoaderHide:"main-grid-hide-loader",classRowError:"main-grid-error",loaderHideAnimationName:"hideLoader",classHide:"main-grid-hide",classEar:"main-grid-ear",classEarLeft:"main-grid-ear-left",classEarRight:"main-grid-ear-right",classNotCount:"main-grid-not-count",classCounter:"main-grid-panel-counter",classForAllCounterEnabled:"main-grid-panel-counter-for-all-enable",classLoad:"load",classRowActionButton:"main-grid-row-action-button",classDropdown:"main-dropdown",classPanelControl:"main-grid-panel-control",classPanelControlContainer:"main-grid-panel-control-container",classForAllCheckbox:"main-grid-for-all-checkbox",classDisable:"main-grid-disable",dataActionsKey:"actions",updateActionMore:"more",classShow:"show",classGridShow:"main-grid-show",updateActionPagination:"pagination",updateActionSort:"sort",ajaxIdDataProp:"ajaxid",pageSizeId:"grid_page_size",sortableRows:true,sortableColumns:true,animationDuration:300};this.prepare()};BX.Grid.Settings.prototype={prepare(){this.settings=this.defaultSettings},getDefault(){return this.defaultSettings},get(t){let e;try{e=this.getDefault()[t]}catch{e=null}return e},getList(){return this.getDefault()}}})();const namespace$5=main_core.Reflection.namespace("BX.Grid.SettingsWindow");const SAVE_FOR_ALL="forAll";const SAVE_FOR_ME="forMe";class CheckboxList{constructor(t){this.params={};this.options={};this.stickyColumns=new Set;this.popup=null;this.popupItems=null;this.params=t;this.grid=t.grid;this.parent=t.parent;this.options=this.grid.arParams.CHECKBOX_LIST_OPTIONS;this.useSearch=Boolean(this.grid.arParams.ENABLE_FIELDS_SEARCH);this.useSectioning=main_core.Type.isArrayFilled(this.options.sections);this.isForAllValue=false}getPopup(){if(!this.popup){this.createPopup()}return this.popup}createPopup(){if(this.popup){return}const{useSearch:t,useSectioning:e,params:{title:i,placeholder:s,emptyStateTitle:n,emptyStateDescription:o,allSectionsDisabledTitle:a}}=this;const r={parentType:"grid"};this.popup=new ui_dialogs_checkboxList.CheckboxList({context:r,popupOptions:{width:1100},columnCount:4,lang:{title:i,placeholder:s,emptyStateTitle:n,emptyStateDescription:o,allSectionsDisabledTitle:a},sections:this.getSections(),categories:this.getCategories(),options:this.getOptions(),events:{onApply:t=>this.onApply(t),onDefault:t=>this.onDefault(t)},params:{useSearch:t,useSectioning:e,destroyPopupAfterClose:false,closeAfterApply:false,isEditableOptionsTitle:true},customFooterElements:this.getCustomFooterElements()})}getSections(){var t;const e=(t=this.options.sections)!=null?t:[];const i=[];e.forEach((t=>{const{id:e,name:s,selected:n}=t;i.push({key:e,title:s,value:n})}));return i}getCategories(){var t;const e=(t=this.options.categories)!=null?t:[];const i=[];if(e.length===0){this.getSections().forEach((t=>{const{key:e,title:s}=t;i.push({key:e,title:s,sectionKey:e})}));return i}e.forEach((t=>{const{title:e,sectionKey:s,key:n}=t;i.push({title:e,sectionKey:s,key:n})}));return i}getOptions(){var t,e,i,s;const n=this.options;const o=(t=n.columns)!=null?t:[];const a=(e=n.columnsWithSections)!=null?e:[];const r=[];const l=(i=(s=this.grid.getUserOptions().getCurrentOptions())==null?void 0:s.custom_names)!=null?i:{};if(this.useSectioning){for(const t in a){a[t].forEach((e=>{const{id:i,default:s}=e;let{name:n}=e;if(main_core.Type.isPlainObject(l)&&Object.hasOwn(l,"id")){n=l[i]}r.push({title:main_core.Text.decode(n),value:this.isChecked(i),categoryKey:t,defaultValue:s,id:i});this.prepareColumnParams(e)}))}return r}o.forEach((t=>{const{id:e,name:i,default:s}=t;r.push({title:main_core.Text.decode(i),value:this.isChecked(e),defaultValue:s,id:e});this.prepareColumnParams(t)}));return r}isChecked(t){var e;const i=(e=this.options.checked)!=null?e:[];return i.includes(t)}prepareColumnParams(t){const{sticked:e,id:i}=t;if(e){this.stickyColumns.add(i)}}getCustomFooterElements(){if(this.isAdmin()){const{arParams:t,containerId:e}=this.parent;return[{type:"textToggle",id:`${e}-${SAVE_FOR_ALL}`,title:t.SETTINGS_FOR_LABEL,dataItems:[{value:SAVE_FOR_ME,label:t.SETTINGS_FOR_FOR_ME_LABEL},{value:SAVE_FOR_ALL,label:t.SETTINGS_FOR_FOR_ALL_LABEL}],onClick:t=>{this.isForAllValue=t===SAVE_FOR_ALL}}]}return[]}show(){this.popup.show()}getStickedColumns(){const{ALLOW_STICKED_COLUMNS:t,HAS_STICKED_COLUMNS:e}=this.parent.arParams;if(t&&e){return this.stickyColumns.values()}return[]}onApply(t){const{fields:e,data:i}=t.data;if(this.isForAll()){const t={CONFIRM:true,CONFIRM_MESSAGE:this.grid.getParam("SETTINGS_FOR_ALL_CONFIRM_MESSAGE")};this.grid.confirmDialog(t,(()=>this.saveColumnsAndHidePopup(e,i)))}else{this.saveColumnsAndHidePopup(e,i)}}saveColumnsAndHidePopup(t,e){this.saveColumns(t,e);this.popup.hide()}prepareOrderedColumnsList(t){if(main_core.Type.isArray(t)){var e;const i=this.grid.getUserOptions().getCurrentOptions();const s=i==null?void 0:(e=i.columns)==null?void 0:e.split==null?void 0:e.split(",");if(main_core.Type.isArray(s)){const e=s.filter((e=>t.includes(e)));const i=t.filter((t=>!e.includes(t)));return[...e,...i]}}return t}saveColumns(t,e){const i=this.grid.getUserOptions();const s=this.getColumnNames(e);const n=this.getStickedColumns();const o=this.prepareOrderedColumnsList(t);const a=[{action:i.getAction("GRID_SET_COLUMNS"),columns:o.join(",")},{action:i.getAction("SET_CUSTOM_NAMES"),custom_names:s},{action:i.getAction("GRID_SET_STICKED_COLUMNS"),stickedColumns:n}];if(this.isForAll()){a.push({action:i.getAction("GRID_SAVE_SETTINGS"),view_id:"default",set_default_settings:"Y",delete_user_settings:"Y"})}i.batch(a,(()=>this.grid.reloadTable()))}getColumnNames(t){var e;const i=this.options;const s=(e=i.columns)!=null?e:[];const n={};const{titles:o}=t;if(!main_core.Type.isObjectLike(o)){return{}}s.forEach((t=>{const e=t.id;if(main_core.Type.isStringFilled(o[e])&&o[e]!==t.name){n[e]=o[e]}else if(main_core.Type.isStringFilled(this.parent.arParams.DEFAULT_COLUMNS[e].name)&&this.parent.arParams.DEFAULT_COLUMNS[e].name!==t.name){n[e]=t.name}}));return n}onDefault(t){const e={CONFIRM:true,CONFIRM_MESSAGE:this.grid.arParams.CONFIRM_RESET_MESSAGE};this.grid.confirmDialog(e,(()=>{this.grid.getUserOptions().reset(this.isForAll(),(()=>{this.reset();this.grid.reloadTable(null,null,(()=>{this.popup.options.forEach((t=>{this.grid.gridSettings.select(t.id,t.defaultValue===true)}))}))}))}));t.preventDefault();return t}sortItems(){}reset(){this.options.checked=[];this.popup.options.filter((t=>t.defaultValue)).forEach((t=>{this.options.checked.push(t.id)}));this.close()}getSelectedColumns(){return this.getPopup().getSelectedOptions()}close(){var t;(t=this.popup)==null?void 0:t.destroy()}isForAll(){return this.isForAllValue}isAdmin(){var t;return Boolean((t=this.parent.arParams.IS_ADMIN)!=null?t:false)}getPopupItems(){return this.options.columns}getItems(){return this.getPopup().getOptions()}select(t,e=true){var i,s;if(((i=this.getPopup())==null?void 0:(s=i.selectOption)==null?void 0:s.length)===1&&e===false){return}this.getPopup().selectOption(t,e)}saveColumnsByNames(t,e){this.getItems().filter((e=>t.includes(e.id))).forEach((t=>this.select(t.id)));this.getPopup().apply();if(main_core.Type.isFunction(e)){e()}}}namespace$5.CheckboxList=CheckboxList;(function(){BX.namespace("BX.Grid.SettingsWindow");BX.Grid.SettingsWindow.Column=function(t,e){this.node=null;this.label=null;this.checkbox=null;this.editButton=null;this.settings=null;this.parent=null;this.default=null;this.defaultTitle=null;this.state=null;this.lastTitle=null;this.init(t,e)};BX.Grid.SettingsWindow.Column.inited={};BX.Grid.SettingsWindow.Column.prototype={init:function(t,e){this.parent=t;this.node=e;try{this.lastTitle=e.querySelector("label").innerText.trim()}catch(t){}this.updateState();if(!BX.Grid.SettingsWindow.Column.inited[this.getId()]){BX.Grid.SettingsWindow.Column.inited[this.getId()]=true;BX.bind(this.getEditButton(),"click",BX.proxy(this.onEditButtonClick,this));BX.bind(this.getStickyButton(),"click",BX.proxy(this.onStickyButtonClick,this))}},getStickyButton:function(){return this.node.querySelector(".main-grid-settings-window-list-item-sticky-button")},isSticked:function(){return this.node.classList.contains("main-grid-settings-window-list-item-sticked")},onStickyButtonClick:function(){if(this.isSticked()){this.unstick()}else{this.stick()}},stick:function(){this.node.classList.add("main-grid-settings-window-list-item-sticked")},unstick:function(){this.node.classList.remove("main-grid-settings-window-list-item-sticked")},onEditButtonClick:function(t){t.stopPropagation();this.isEditEnabled()?this.disableEdit():this.enableEdit()},setState:function(t){this.state=t},getState:function(){return this.state},updateState:function(){this.setState({selected:this.isSelected(),sticked:this.isSticked(),title:this.getTitle()})},restoreState:function(){var t=this.getState();t.selected?this.select():this.unselect();t.sticked?this.stick():this.unstick();this.setTitle(t.title)},getId:function(){return this.getNode().dataset.name},getTitle:function(){return this.getLabel().innerText},setTitle:function(t){this.getLabel().innerText=!!t&&t!=="undefined"?t:this.getDefaultTitle()},isEdited:function(){return this.getTitle()!==this.getDefaultTitle()},getSettings:function(){if(this.settings===null){var t=this.parent.getParam("DEFAULT_COLUMNS");this.settings=this.getId()in t?t[this.getId()]:{}}return this.settings},isDefault:function(){if(this.default===null){var t=this.getSettings();this.default="default"in t?t.default:false}return this.default},restore:function(){this.isDefault()?this.select():this.unselect();this.setTitle(this.getDefaultTitle());this.node.dataset.stickedDefault==="true"?this.stick():this.unstick();this.disableEdit();this.updateState()},getDefaultTitle:function(){if(this.defaultTitle===null){var t=this.getSettings();this.defaultTitle="name"in t?t.name:this.lastTitle}return this.defaultTitle},getNode:function(){return this.node},getLabel:function(){if(this.label===null){this.label=BX.Grid.Utils.getByTag(this.getNode(),"label",true);BX.Event.bind(this.label,"paste",this.onLabelPaste.bind(this));BX.Event.bind(this.label,"keydown",this.onLabelKeydown.bind(this))}return this.label},onLabelPaste:function(t){t.preventDefault();if(t.clipboardData&&t.clipboardData.getData){var e=t.clipboardData.getData("text/plain");var i=BX.Text.encode(e);var s=i.trim().replace(new RegExp("\t","g")," ").replace(new RegExp("\n","g")," ").replace(/ +(?= )/g,"");document.execCommand("insertHTML",false,s)}},onLabelKeydown:function(t){if(t.keyCode===13){t.preventDefault()}},getCheckbox:function(){if(this.checkbox===null){this.checkbox=BX.Grid.Utils.getBySelector(this.getNode(),'input[type="checkbox"]',true)}return this.checkbox},getEditButton:function(){if(this.editButton===null){this.editButton=BX.Grid.Utils.getByClass(this.getNode(),this.parent.settings.get("classSettingsWindowColumnEditButton"),true)}return this.editButton},enableEdit:function(){this.getLabel().contentEditable=true;this.getCheckbox().disabled=true;this.adjustCaret()},disableEdit:function(){this.getLabel().contentEditable=false;this.getCheckbox().disabled=false},isEditEnabled:function(){return this.getLabel().isContentEditable},isSelected:function(){return this.getCheckbox().checked},select:function(){this.getCheckbox().checked=true},unselect:function(){this.getCheckbox().checked=false},adjustCaret:function(){var t=document.createRange();var e=window.getSelection();var i=this.getLabel().innerText.length;var s=this.getLabel().childNodes;var n=s[s.length-1];t.setStart(n,i);t.setEnd(n,i);t.collapse(true);e.removeAllRanges();e.addRange(t);BX.fireEvent(this.getNode(),"focus")}}})();let _$3=t=>t,_t$3;(function(){BX.namespace("BX.Grid.SettingsWindow");BX.Grid.SettingsWindow.Manager=function(t){this.parent=null;this.fieldsSettingsInstance=null;this.init(t)};BX.Grid.SettingsWindow.Manager.prototype={init(t){this.parent=t;BX.bind(this.parent.getContainer(),"click",BX.proxy(this._onContainerClick,this));BX.addCustomEvent(window,"Grid::columnMoved",BX.proxy(this._onColumnMoved,this))},destroy(){BX.unbind(this.parent.getContainer(),"click",BX.proxy(this._onContainerClick,this));BX.removeCustomEvent(window,"Grid::columnMoved",BX.proxy(this._onColumnMoved,this));this.getPopup().close()},_onContainerClick(t){if(BX.hasClass(t.target,this.parent.settings.get("classSettingsButton"))){this._onSettingsButtonClick(t)}},_onSettingsButtonClick(){this.getFieldsSettingsInstance().then((t=>{this.fieldsSettingsInstance=t;this.fieldsSettingsInstance.show();BX.onCustomEvent(window,"BX.Grid.SettingsWindow:show",[this.fieldsSettingsInstance])}))},getFieldsSettingsInstance(){if(this.fieldsSettingsInstance){return Promise.resolve(this.fieldsSettingsInstance)}return new Promise((t=>{const e=this.createFieldsSettingsInstance();t(e)}))},createFieldsSettingsInstance(){let t=null;const{parent:e}=this;const i={grid:e,parent:e,isUseLazyLoadColumns:this.useLazyLoadColumns(),title:this.getPopupTitle(),placeholder:e.getParam("SETTINGS_FIELD_SEARCH_PLACEHOLDER"),emptyStateTitle:e.getParam("SETTINGS_FIELD_SEARCH_EMPTY_STATE_TITLE"),emptyStateDescription:e.getParam("SETTINGS_FIELD_SEARCH_EMPTY_STATE_DESCRIPTION"),allSectionsDisabledTitle:e.getParam("SETTINGS_FIELD_SEARCH_ALL_SECTIONS_DISABLED")};if(this.useCheckboxList()){t=new BX.Grid.SettingsWindow.CheckboxList(i)}else{t=new BX.Grid.SettingsWindow.Popup(i)}t.createPopup();BX.onCustomEvent(window,"BX.Grid.SettingsWindow:init",[t]);return t},useCheckboxList(){var t;return Boolean(this.parent.getParam("USE_CHECKBOX_LIST_FOR_SETTINGS_POPUP"))&&main_core.Type.isFunction((t=BX.UI)==null?void 0:t.CheckboxList)},useLazyLoadColumns(){return Boolean(this.parent.getParam("LAZY_LOAD"))},_onColumnMoved(){this.sortItems();this.reset()},sortItems(){this.getPopup().sortItems()},reset(){this.getPopup().reset()},getSelectedColumns(){return this.getPopup().getSelectedColumns()},getPopup(){if(this.fieldsSettingsInstance===null){this.fieldsSettingsInstance=this.createFieldsSettingsInstance()}return this.fieldsSettingsInstance},getPopupTitle(){const t=this.parent.getParam("SETTINGS_WINDOW_TITLE");const e=this.parent.getParam("SETTINGS_TITLE");const i=main_core.Tag.render(_t$3||(_t$3=_$3`<div></div>`));if(main_core.Type.isStringFilled(t)){i.innerHTML=`<span>${e} &laquo;${t}&raquo;</span>`;return i.firstChild.innerText}const s=BX.Main.gridManager.data.length;if(s===1){const t=t=>{const e=document.getElementById(t);return main_core.Type.isDomNode(e)&&main_core.Type.isStringFilled(e.innerText)?main_core.Text.encode(e.innerText):""};const s=t("pagetitle");const n=t("pagetitle_btn_wrapper");const o=`${s} ${n}`.trim();i.innerHTML=`<span>${e} &laquo;${o}&raquo;</span>`;return i.firstChild.innerText}return e},getShowedColumns(){const t=[];const e=this.parent.getRows().getHeadFirstChild().getCells();[].slice.call(e).forEach((e=>{if("name"in e.dataset){t.push(e.dataset.name)}}));return t},getItems(){return this.getPopup().getItems()},saveColumns(t,e){this.getPopup().saveColumnsByNames(t,e)},select(t,e=true){this.getPopup().select(t,e)}}})();let _$4=t=>t,_t$4,_t2$3;const namespace$6=main_core.Reflection.namespace("BX.Grid.SettingsWindow");class Popup{constructor(t){this.options={};this.items=null;this.popupItems=null;this.popup=null;this.filterSectionsSearchInput=null;this.filterSections=null;this.allColumns=null;this.applyButton=null;this.resetButton=null;this.cancelButton=null;this.selectAllButton=null;this.unselectAllButton=null;this.options=t;this.grid=t.grid;this.parent=t.parent}getPopup(){if(!this.popup){this.createPopup()}return this.popup}createPopup(){if(this.popup){return}const t=20;const e=20;const i=document.body.offsetWidth>1e3?1e3:document.body.offsetWidth-t-e;const{title:s}=this.options;this.popup=new main_popup.Popup(this.getPopupId(),null,{titleBar:s,autoHide:false,overlay:.6,width:i,closeIcon:true,closeByEsc:true,contentNoPaddings:true,content:this.getSourceContent(),events:{onPopupClose:this.onPopupClose.bind(this)}});this.getItems().forEach((t=>{main_core.Event.bind(t.getNode(),"click",this.onItemClick.bind(this));main_core.Event.bind(t.getNode(),"animationend",this.onAnimationEnd.bind(this,t.getNode()))}));main_core.Event.bind(this.getResetButton(),"click",this.onResetButtonClick.bind(this));main_core.Event.bind(this.getApplyButton(),"click",this.onApplyButtonClick.bind(this));main_core.Event.bind(this.getCancelButton(),"click",this.popup.close.bind(this.popup));main_core.Event.bind(this.getSelectAllButton(),"click",this.onSelectAll.bind(this));main_core.Event.bind(this.getUnselectAllButton(),"click",this.onUnselectAll.bind(this));if(main_core.Type.isObjectLike(this.grid.arParams.COLUMNS_ALL_WITH_SECTIONS)&&Object.keys(this.grid.arParams.COLUMNS_ALL_WITH_SECTIONS).length>0){this.prepareFilterSections()}if(this.grid.arParams.ENABLE_FIELDS_SEARCH){this.prepareFilterSectionsSearchInput()}}show(){this.popup.show()}close(){this.onPopupClose()}onPopupClose(){this.emitSaveEvent();this.restoreLastColumns();this.disableAllColumnsLabelEdit();this.adjustActionButtonsState()}emitSaveEvent(){main_core_events.EventEmitter.emit(window,"BX.Grid.SettingsWindow:close",[this,this.parent])}restoreLastColumns(){this.getItems().forEach((t=>t.restoreState()))}disableAllColumnsLabelEdit(){this.getItems().forEach((t=>t.disableEdit()))}getPopupId(){return`${this.grid.getContainerId()}-grid-settings-window`}getSourceContent(){const t=this.grid.settings.get("classSettingsWindow");const e=this.grid.getContainer().querySelector(`.${t}`);if(!this.options.isUseLazyLoadColumns){return e}const i=e.querySelector(".main-grid-settings-window-list");i.innerHTML="";const s=new main_loader.Loader({target:i});void s.show();this.fetchColumns().then((t=>{t.forEach((t=>{this.prepareColumnOptions(t);main_core.Dom.append(this.createColumnElement(t),i)}));this.hideAndDestroyLoader();this.reset();this.getItems().forEach((t=>{main_core.Event.bind(t.getNode(),"click",this.onItemClick)}));const s=main_core.Tag.render(_t$4||(_t$4=_$4`
					<div class="main-grid-popup-window-buttons-wrapper"></div>
				`));main_core.Dom.append(e.querySelector(".popup-window-buttons"),s);requestAnimationFrame((()=>{main_core.Dom.style(s,{width:`${this.getPopupContainer().clientWidth}px`});main_core.Dom.append(s,this.getPopupContainer())}))})).catch((t=>{console.error(t)}));return e}fetchColumns(){const t=new BX.Promise;const e=this.grid.getParam("LAZY_LOAD");const i=this.grid.getId();if(main_core.Type.isPlainObject(e)){const{controller:s,GET_LIST:n}=e;if(main_core.Type.isNil(s)){ajax({url:n,method:"GET",dataType:"json",onsuccess:t.fulfill.bind(t)})}else{main_core.ajax.runAction(`${s}.getColumnsList`,{method:"GET",data:{gridId:i}}).then(t.fulfill.bind(t))}}return t}prepareColumnOptions(t){if(!main_core.Type.isPlainObject(t)){return}const e=this.grid.getUserOptions().getCurrentOptions().custom_names;if(main_core.Type.isPlainObject(e)&&t.id in e){t.name=e[t.id]}if(this.grid.getColumnHeaderCellByName(t.id)){t.selected=true}}createColumnElement(t){const e=`${t.id}-checkbox`;const i=t.selected?" checked":"";return main_core.Tag.render(_t2$3||(_t2$3=_$4`
			<div data-name=${0} class='main-grid-settings-window-list-item'>
				<input
					id='${0}'
					type='checkbox'
					class='main-grid-settings-window-list-item-checkbox${0})'
				>
				<label
					for='${0}'
					class='main-grid-settings-window-list-item-label'
				>
					${0}
				</label>
				<span class='main-grid-settings-window-list-item-edit-button'></span>
			</div>
		`),t.id,e,i,e,t.name)}hideAndDestroyLoader(t){void t.hide().then((()=>t.destroy()))}onItemClick(){this.adjustActionButtonsState()}onAnimationEnd(t){const e=main_core.Dom.hasClass(t,this.grid.settings.get("classSettingsWindowSearchSectionItemHidden"))?"none":"inline-block";main_core.Dom.style(t,{display:e})}adjustActionButtonsState(){if(this.getSelectedColumns().length>0){this.enableActions();return}this.disableActions()}getSelectedColumns(){const t=[];this.getItems().forEach((e=>{if(e.isSelected()){t.push(e.getId())}}));return t}getItems(){if(this.items===null){const{grid:t}=this;const e=this.getPopupItems();this.items=[...e].map((e=>new BX.Grid.SettingsWindow.Column(t,e)))}return this.items}getPopupItems(){if(!this.popupItems){const t=this.getPopupContentContainer();const e=this.grid.settings.get("classSettingsWindowColumn");this.popupItems=t.getElementsByClassName(e)}return this.popupItems}enableActions(){const t=this.getApplyButton();if(t){main_core.Dom.removeClass(t,this.grid.settings.get("classDisable"))}}prepareFilterSectionsSearchInput(){const t=this.getFilterSectionsSearchInput();main_core.Event.bind(t,"input",this.onFilterSectionSearchInput.bind(this));main_core.Event.bind(t.previousElementSibling,"click",this.onFilterSectionSearchInputClear.bind(this))}getFilterSectionsSearchInput(){if(!this.filterSectionsSearchInput){const t=this.grid.settings.get("classSettingsWindowSearchSectionInput");this.filterSectionsSearchInput=this.getPopupContentContainer().querySelector(`.${t}`)}return this.filterSectionsSearchInput}onFilterSectionSearchInput(){let t=this.filterSectionsSearchInput.value;if(t.length>0){t=t.toLowerCase()}this.items.forEach((e=>{const i=e.lastTitle.toLowerCase();const s=e.getNode();if(t.length>0&&!i.includes(t)){main_core.Dom.removeClass(s,this.grid.settings.get("classSettingsWindowSearchSectionItemVisible"));main_core.Dom.addClass(s,this.grid.settings.get("classSettingsWindowSearchSectionItemHidden"))}else{main_core.Dom.removeClass(s,this.grid.settings.get("classSettingsWindowSearchSectionItemHidden"));main_core.Dom.addClass(s,this.grid.settings.get("classSettingsWindowSearchSectionItemVisible"));main_core.Dom.style(s,{display:"inline-block"})}}))}onFilterSectionSearchInputClear(){this.filterSectionsSearchInput.value="";this.onFilterSectionSearchInput()}getResetButton(){if(this.resetButton===null){this.resetButton=document.getElementById(this.getResetButtonId())}return this.resetButton}getResetButtonId(){return`${this.grid.getContainerId()}-grid-settings-reset-button`}onResetButtonClick(){const t={CONFIRM:true,CONFIRM_MESSAGE:this.grid.arParams.CONFIRM_RESET_MESSAGE};this.grid.confirmDialog(t,(()=>{this.enableWait(this.getApplyButton());this.grid.getUserOptions().reset(this.isForAll(),(()=>{this.grid.reloadTable(null,null,(()=>{this.restoreColumns();this.disableWait(this.getApplyButton());this.popup.close()}))}))}))}restoreColumns(){this.getItems().forEach((t=>t.restore()));this.sortItems();this.reset()}sortItems(){const t=this.getShowedColumns();const e={};this.getAllColumns().forEach((t=>{e[t]=t}));let i=0;Object.keys(e).forEach((s=>{if(this.isShowedColumn(s)){e[s]=t[i];i++}const n=this.getColumnByName(e[s]);if(n){main_core.Dom.append(n,n.parentNode)}}))}getShowedColumns(){return this.parent.gridSettings.getSelectedColumns()}getColumnByName(t){return BX.Grid.Utils.getBySelector(this.getPopupContainer(),`.${this.grid.settings.get("classSettingsWindowColumn")}[data-name="${t}"]`,true)}isShowedColumn(t){return this.getSelectedColumns().includes(t)}getAllColumns(){if(!this.allColumns){this.allColumns=this.getItems().map((t=>t.getId()))}return this.allColumns}reset(){this.popupItems=null;this.allColumns=null;this.items=null}getApplyButton(){if(this.applyButton===null){this.applyButton=document.getElementById(this.getApplyButtonId())}return this.applyButton}getApplyButtonId(){return`${this.grid.getContainerId()}-grid-settings-apply-button`}onApplyButtonClick(){const t={CONFIRM:this.isForAll(),CONFIRM_MESSAGE:this.grid.getParam("SETTINGS_FOR_ALL_CONFIRM_MESSAGE")};this.grid.confirmDialog(t,(()=>this.onApplyConfirmDialogButton()),(()=>this.unselectForAllCheckbox()))}onApplyConfirmDialogButton(){this.enableWait(this.getApplyButton());this.saveColumns(this.getSelectedColumns(),(()=>{this.popup.close();this.disableWait(this.getApplyButton());this.unselectForAllCheckbox()}));this.emitSaveEvent()}enableWait(t){main_core.Dom.addClass(t,"ui-btn-wait");main_core.Dom.removeClass(t,"popup-window-button")}disableWait(t){main_core.Dom.removeClass(t,"ui-btn-wait");main_core.Dom.addClass(t,"popup-window-button")}saveColumns(t,e){const i=this.grid.getUserOptions();const s=this.getColumnNames();const n=this.getStickedColumns();const o=[{action:i.getAction("GRID_SET_COLUMNS"),columns:t.join(",")},{action:i.getAction("SET_CUSTOM_NAMES"),custom_names:s},{action:i.getAction("GRID_SET_STICKED_COLUMNS"),stickedColumns:n}];if(this.isForAll()){o.push({action:i.getAction("GRID_SAVE_SETTINGS"),view_id:"default",set_default_settings:"Y",delete_user_settings:"Y"})}i.batch(o,(()=>this.grid.reloadTable(null,null,e)));this.updateColumnsState()}getColumnNames(){const t={};this.getItems().forEach((e=>{if(e.isEdited()){t[e.getId()]=e.getTitle()}}));return t}getStickedColumns(){return this.getItems().reduce(((t,e)=>{if(e.isSticked()){t.push(e.getId())}return t}),[])}updateColumnsState(){this.getItems().forEach((t=>t.updateState()))}isForAll(){const t=this.getForAllCheckbox();return t&&Boolean(t.checked)}unselectForAllCheckbox(){const t=this.getForAllCheckbox();if(t){t.checked=null}}getForAllCheckbox(){return this.getPopupContainer().querySelector(".main-grid-settings-window-for-all-checkbox")}getPopupContainer(){return this.getPopup().getPopupContainer()}getPopupContentContainer(){return this.getPopup().getContentContainer()}getCancelButton(){if(this.cancelButton===null){this.cancelButton=document.getElementById(this.getCancelButtonId())}return this.cancelButton}getCancelButtonId(){return`${this.grid.getContainerId()}-grid-settings-cancel-button`}getSelectAllButton(){if(!this.selectAllButton){const t=this.grid.settings.get("classSettingsWindowSelectAll");this.selectAllButton=this.getPopupContentContainer().querySelector(`.${t}`)}return this.selectAllButton}onSelectAll(){this.selectAll();this.enableActions()}selectAll(){this.getItems().forEach((t=>t.select()))}getUnselectAllButton(){if(!this.unselectAllButton){const t=this.grid.settings.get("classSettingsWindowUnselectAll");this.unselectAllButton=this.getPopupContentContainer().querySelector(`.${t}`)}return this.unselectAllButton}onUnselectAll(){this.unselectAll();this.disableActions()}disableActions(){const t=this.getApplyButton();if(t){main_core.Dom.addClass(t,this.grid.settings.get("classDisable"))}}unselectAll(){this.getItems().forEach((t=>t.unselect()))}prepareFilterSections(){const t=this.getFilterSections();for(const e of t){main_core.Event.bind(e,"click",this.onFilterSectionClick.bind(this,e))}}getFilterSections(){if(!this.filterSections){var t;const e=this.grid.settings.get("classSettingsWindowSearchSectionsWrapper");const i=this.getPopupContentContainer().querySelector(`.${e}`);this.filterSections=(t=i.children)!=null?t:new HTMLCollection}return this.filterSections}onFilterSectionClick(t){var e;const i=this.grid.settings.get("classSettingsWindowSearchActiveSectionIcon");const s=(e=t.dataset)==null?void 0:e.uiGridFilterSectionButton;const n=document.querySelector(`[data-ui-grid-filter-section='${s}']`);if(main_core.Dom.hasClass(t.firstChild,i)){main_core.Dom.removeClass(t.firstChild,i);main_core.Dom.hide(n)}else{main_core.Dom.addClass(t.firstChild,i);main_core.Dom.show(n)}}select(t,e=true){const i=this.getItems().find((e=>e.getId()===t));if(e){i==null?void 0:i.select()}else{i==null?void 0:i.unselect()}}saveColumnsByNames(t,e){this.saveColumns(t,e)}}namespace$6.Popup=Popup;(function(){BX.namespace("BX.Grid");BX.Grid.UserOptions=function(t,e,i,s){this.options=null;this.actions=null;this.parent=null;this.url=null;this.init(t,e,i,s)};BX.Grid.UserOptions.prototype={init(parent,userOptions,userOptionsActions,url){this.url=url;this.parent=parent;try{this.options=eval(userOptions)}catch{console.warn("BX.Grid.UserOptions.init: Failed parse user options json string")}try{this.actions=eval(userOptionsActions)}catch{console.warn("BX.Grid.UserOptions.init: Failed parse user options actions json string")}},getCurrentViewName(){const t=this.getOptions();return"current_view"in t?t.current_view:null},getViewsList(){const t=this.getOptions();return"views"in t?t.views:{}},getCurrentOptions(){const t=this.getCurrentViewName();const e=this.getViewsList();let i=null;if(t in e){i=e[t]}if(!BX.type.isPlainObject(i)){i={}}return i},getUrl(t){return BX.util.add_url_param(this.url,{GRID_ID:this.parent.getContainerId(),bxajaxid:this.parent.getAjaxId(),action:t})},getOptions(){return this.options||{}},getActions(){return this.actions},getAction(t){let e=null;try{e=this.getActions()[t]}catch{e=null}return e},update(t){this.options=t},setColumns(t,e){const i=this.getCurrentOptions();if(BX.type.isPlainObject(i)){i.columns=t.join(",");this.save(this.getAction("GRID_SET_COLUMNS"),{columns:i.columns},e)}return this},setColumnsNames(t,e){const i={view_id:"default"};if(BX.type.isPlainObject(i)){i.custom_names=t;this.save(this.getAction("SET_CUSTOM_NAMES"),i,e)}return this},setColumnSizes(t,e){this.save(this.getAction("GRID_SET_COLUMN_SIZES"),{sizes:t,expand:e})},reset(t,e){let i={};if(t){i={view_id:"default",set_default_settings:"Y",delete_user_settings:"Y",view_settings:this.getCurrentOptions()}}this.save(this.getAction("GRID_RESET"),i,e)},setSort(t,e,i){if(t&&e){this.save(this.getAction("GRID_SET_SORT"),{by:t,order:e},i)}return this},setPageSize(t,e){if(BX.type.isNumber(parseInt(t))){this.save(this.getAction("GRID_SET_PAGE_SIZE"),{pageSize:t},e)}},setExpandedRows(t,e){BX.type.isArray(t)&&this.save(this.getAction("GRID_SET_EXPANDED_ROWS"),{ids:t},e)},setCollapsedGroups(t,e){BX.type.isArray(t)&&this.save(this.getAction("GRID_SET_COLLAPSED_GROUPS"),{ids:t},e)},resetExpandedRows(){this.save(this.getAction("GRID_RESET_EXPANDED_ROWS"),{})},saveForAll(t){this.save(this.getAction("GRID_SAVE_SETTINGS"),{view_id:"default",set_default_settings:"Y",delete_user_settings:"Y",view_settings:this.getCurrentOptions()},t)},batch(t,e){this.save(this.getAction("GRID_SAVE_BATH"),{bath:t},e)},save(t,e,i){const s=this;BX.ajax.post(this.getUrl(t),e,(t=>{try{t=JSON.parse(t);if(!t.error){s.update(t);if(BX.type.isFunction(i)){i(t)}BX.onCustomEvent(s.parent.getContainer(),"Grid::optionsChanged",[s.parent])}}catch{}}))}}})();(function(){BX.namespace("BX.Grid");BX.Grid.Utils={ajaxUrl(t,e){return this.addUrlParams(t,{bxajaxid:e})},addUrlParams(t,e){return BX.util.add_url_param(t,e)},arrayMove(t,e,i){if(i>=t.length){let e=i-t.length;while(e--+1){t.push(undefined)}}t.splice(i,0,t.splice(e,1)[0]);return t},getIndex(t,e){return[].indexOf.call(t||[],e)},getNext(t){if(t){return t.nextElementSibling||null}},getPrev(t){if(t){return t.previousElementSibling||null}},closestParent(t,e){if(t){if(!e){return t.parentNode||null}return BX.findParent(t,{className:e})}},closestChilds(t){if(t){return t.children||null}},collectionSort(t,e){let i;let s;let n;let o;let a;if(t&&e&&t!==e&&t.parentNode===e.parentNode){i=this.closestParent(e);s=this.closestChilds(i);n=s.length;o=this.getIndex(s,t);a=this.getIndex(s,e);if(n===a){i.appendChild(e)}if(o>a){i.insertBefore(t,e)}if(o<a&&n!==a){i.insertBefore(t,this.getNext(e))}}},getColumn(t,e){const i=this.getIndex(this.closestChilds(this.closestParent(e)),e);const s=[];[].forEach.call(t.rows,(t=>{s.push(t.cells[i])}));return s},styleForEach(t,e){e=BX.type.isPlainObject(e)?e:null;const i=Object.keys(e);[].forEach.call(t||[],(t=>{i.forEach((i=>{BX.style(t,i,e[i])}))}))},requestAnimationFrame(){const t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)};t.apply(window,arguments)},getByClass(t,e,i){let s=[];if(e){s=t?t.getElementsByClassName(e):[];if(i){s=s.length>0?s[0]:null}else{s=[].slice.call(s)}}return s},getByTag(t,e,i){let s=[];if(e){s=t?t.getElementsByTagName(e):[];if(i){s=s.length>0?s[0]:null}else{s=[].slice.call(s)}}return s},getBySelector(t,e,i){let s=[];if(e){if(i){s=t?t.querySelector(e):null}else{s=t?t.querySelectorAll(e):[];s=[].slice.call(s)}}return s},listenerParams(t){try{window.addEventListener("test",null,t)}catch{t=false}return t}}})()})(this.window=this.window||{},BX.UI,BX.UI,BX,BX.Event,BX,BX.Main);
//# sourceMappingURL=script.map.js