import { ApplicationContext, Action as DUAction, ElementIDUtils, LockManager, LockManagerOperation, OverflowDirection, OVERFLOWED_CLASS_NAME, OverflowWatcher, SilentException, StringUtils, } from '@sankhyalabs/core';
import { h, Host } from '@stencil/core';
import { PresentationMode } from '../../lib/@types';
import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
import { AuthorizationElements, buildCustomButton, buildElem, TaskbarElement, VisibleWhenForbidden, } from './elements/taskbar-elements';
export class SnkTaskbar {
  constructor() {
    this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
    this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME = 'taskbar-custom-elements-container';
    this.NOT_OVERFLOW_ELEMENTS = ["moreOptions", "dataExporter_snkDataExporter", "actionsButton_snkActionsButton"];
    this.TASKBAR_CUSTOM_ELEMENTS = 'taskbar-custom-elements-container';
    this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME = 'taskbar-additional-slot-container';
    this.TASKBAR_ADDITIONAL_SLOT = 'taskbar-additional-slot-container';
    this._dataUnitInitialized = false;
    this._permissions = {};
    this._customElements = new Map();
    this._customElementsId = [];
    this._overFlowedElements = [];
    this._titleKeyByElement = {
      [TaskbarElement.UPDATE_MULTIPLE]: "snkTaskbar.titleUpdateMultiple",
      [TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
      [TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
      [TaskbarElement.NEXT]: "snkTaskbar.titleNext",
      [TaskbarElement.REFRESH]: "snkTaskbar.titleRefresh",
      [TaskbarElement.CLONE]: "snkTaskbar.titleClone",
      [TaskbarElement.REMOVE]: "snkTaskbar.titleRemove",
      [TaskbarElement.MORE_OPTIONS]: "snkTaskbar.titleMoreOptions",
      [TaskbarElement.INSERT]: "snkTaskbar.titleInsert",
      [TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
      [TaskbarElement.SAVE]: "snkTaskbar.titleSave",
      [TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
      [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
      [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
      [TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
    };
    this.onSaveEvent = (action) => {
      switch (action.type) {
        case DUAction.FIELD_INVALIDATED:
        case DUAction.INVALIDATE_CLEAN:
        case DUAction.DATA_SAVED:
        case DUAction.SAVING_ERROR:
        case DUAction.SAVING_CANCELED:
          this._isWaitingForSave = false;
          break;
        case DUAction.SAVING_DATA:
          this._isWaitingForSave = true;
          break;
      }
    };
    this._hiddenActionsList = [];
    this._isWaitingForSave = false;
    this._isLoading = true;
    this.alignRigth = false;
    this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
    this.additionalSlotId = "TASKBAR_ADDITIONAL_SLOT";
    this.customContainerId = undefined;
    this.overflowStrategy = 'hiddenItems';
    this.configName = undefined;
    this.resourceID = undefined;
    this.buttons = undefined;
    this.customButtons = undefined;
    this.actionsList = undefined;
    this.actionsSettingsList = undefined;
    this.customActionsList = undefined;
    this.primaryButton = undefined;
    this.disabledButtons = undefined;
    this.dataUnit = undefined;
    this.presentationMode = PresentationMode.PRIMARY;
    this.messagesBuilder = undefined;
    this.disableSkeleton = false;
    this.sizeButtons = 'small';
  }
  handleCustomSlotElementsLoaded(event) {
    if (this.hasToSearchCustomElements(event)) {
      this.getCustomElements(true);
    }
  }
  handleTaskbarSaveLocker() {
    if (this._isWaitingForSave !== true) {
      this._isWaitingForSave = true;
    }
  }
  handleTaskbarSaveUnlocker() {
    if (this._isWaitingForSave === true) {
      this._isWaitingForSave = false;
    }
  }
  hasToSearchCustomElements(event) {
    return this.customSlotId === event.detail && !this._slotContainer;
  }
  observeButtons() {
    this.handleDefinitions();
  }
  observeDisabledButtons() {
    this.handleDefinitions();
  }
  observeIsWaitingForSave(newValue, oldValue) {
    if (newValue == true && oldValue == false) {
      this.taskbarSaveLocker.emit();
    }
    if (newValue == false && oldValue == true) {
      this.taskbarSaveUnlocker.emit();
    }
  }
  observeDataUnit(newValue) {
    this.initializeDataUnit(newValue);
  }
  initializeDataUnit(dataUnit = this.dataUnit) {
    if (!!dataUnit && !this._dataUnitInitialized) {
      this._dataUnitInitialized = true;
      const dataInfo = { dataUnit: this.dataUnit };
      ElementIDUtils.addIDInfo(this._element, null, dataInfo);
      this.dataUnit.subscribe(this.onSaveEvent);
    }
  }
  elementsFromString(strButtons) {
    const elements = [];
    if (strButtons == null)
      return elements;
    strButtons.split(",").forEach(buttonName => {
      buttonName = buttonName.trim();
      if (VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
        elements.push(buttonName.trim());
      }
    });
    return elements;
  }
  isAllowed(buttonName) {
    if (!this._permissions) {
      return false;
    }
    if (this._permissions.isSup) {
      return true;
    }
    if (buttonName === AuthorizationElements.CONFIGURATOR) {
      return this._permissions[AuthorizationConfig.CONFIG_GRID] || this._permissions[AuthorizationConfig.CONFIG];
    }
    if (AuthorizationElements[buttonName]) {
      return this._permissions[buttonName];
    }
    return true;
  }
  /**
   * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
   * através de um pequeno modulo na estrutura da aplicação:
   * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
   * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
   */
  getTitle(element) {
    var _a;
    let key;
    if (this.isAllowed(element)) {
      key = this._titleKeyByElement[element];
    }
    else {
      key = "snkTaskbar.forbidden";
    }
    return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
  }
  elementClick(elem) {
    LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
      if (!this.dataUnit) {
        return;
      }
      switch (elem) {
        case TaskbarElement.PREVIOUS:
          this.dataUnit.previousRecord();
          break;
        case TaskbarElement.NEXT:
          this.dataUnit.nextRecord();
          break;
        case TaskbarElement.REFRESH:
          this.dataUnit.loadData();
          break;
        case TaskbarElement.CLONE:
          this.dataUnit.copySelected();
          break;
        case TaskbarElement.REMOVE:
          this.dataUnit.removeSelectedRecords();
          break;
        case TaskbarElement.INSERT:
          this.dataUnit.addRecord();
          break;
        case TaskbarElement.CANCEL:
          this.dataUnit.cancelEdition();
          break;
        case TaskbarElement.SAVE:
          if (!this._isWaitingForSave) {
            this._isWaitingForSave = true;
            this.dataUnit.saveData().catch((err) => {
              if (err instanceof SilentException) {
                return;
              }
              else {
                throw err;
              }
            }).finally(() => {
              this._isWaitingForSave = false;
            });
          }
          break;
      }
      if (this.isEnabled(elem))
        this.actionClick.emit(elem);
    });
  }
  isEnabled(elem) {
    if (!this.isAllowed(elem)) {
      return false;
    }
    return !(this.disabledButtons && this.disabledButtons.includes(elem));
  }
  getElement(index, def) {
    const className = {
      "taskbar-element": true,
      "space-between-item": index > 0
    };
    const taskbarElement = TaskbarElement[def.toString()];
    const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
    if (taskbarElement) {
      return buildElem({
        element: def,
        className,
        dataElementId: this.getIdElemBtnNative(def),
        getTitle: elem => this.getTitle(elem),
        action: elem => this.elementClick(elem),
        isEnabled: elem => this.isEnabled(elem),
        actions: def !== TaskbarElement.CONFIGURATOR ? this.buildDynamicActionsList() : this.buildActionsSettingsList(),
        dataExporterStoreKey,
        presentationMode: this.presentationMode,
        variant: def === this.primaryButton ? "primary" : "secondary",
        size: this.sizeButtons,
      });
    }
    else {
      return buildCustomButton({
        def: def,
        className,
        dataElementId: this.getIdElemBtnCustom(def),
        action: elem => this.elementClick(elem),
        isEnabled: elem => this.isEnabled(elem),
        size: this.sizeButtons
      });
    }
  }
  buildDivider() {
    return { value: '', label: '', type: 'divider' };
  }
  buildDynamicActionsList() {
    var _a, _b;
    const customActions = [...((_a = this.customActionsList) !== null && _a !== void 0 ? _a : [])].filter(a => a !== undefined);
    const defaultActionsList = [...((_b = this.actionsList) !== null && _b !== void 0 ? _b : [])].filter(a => a !== undefined);
    if (customActions.length > 0 && defaultActionsList.length > 0) {
      customActions.push(this.buildDivider());
    }
    const combinedList = [...customActions, ...defaultActionsList];
    if (this._hiddenActionsList.length) {
      return [...combinedList, ...this._hiddenActionsList];
    }
    return combinedList;
  }
  buildActionsSettingsList() {
    return this.actionsSettingsList;
  }
  getIdElemBtnNative(taskbarElem) {
    return StringUtils.toCamelCase(taskbarElem);
  }
  getIdElemBtnCustom(btnCustom) {
    return StringUtils.toCamelCase(btnCustom.name);
  }
  isDivider(element) {
    var _a;
    if (element === undefined) {
      return false;
    }
    return (_a = element.$attrs$) === null || _a === void 0 ? void 0 : _a["data-taskbar-divider"];
  }
  removeEmpty(elements) {
    let lastElem;
    return elements.filter(elem => {
      if (elem == undefined) {
        return false;
      }
      if (this.isDivider(lastElem) && this.isDivider(elem)) {
        return false;
      }
      lastElem = elem;
      return true;
    });
  }
  appendCustomElementsInTaskbar() {
    this._customElementsId.forEach(id => {
      const elementId = id.replace(this.TASKBAR_ITEM_ID_PREFIX, '');
      const customElement = this._customElements.get(elementId);
      const container = this._element.querySelector(`#${id}`);
      if (container) {
        container === null || container === void 0 ? void 0 : container.appendChild(customElement);
      }
      else {
        this.unlinkCustomElementFromTaskbar(customElement);
      }
    });
  }
  addCustomElementContainer(elem) {
    var _a;
    const elementId = `${this.TASKBAR_ITEM_ID_PREFIX}${elem}`;
    if (!this._customElementsId.includes(elementId)) {
      this._customElementsId.push(elementId);
      (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.addNotOverFlowElement(elementId);
    }
    return h("span", { class: "ez-padding-left--medium", key: elementId, id: elementId });
  }
  getCustomElements(searchOnDocument) {
    var _a, _b;
    this._customElementsId = [];
    this._customElements = new Map();
    this._slotContainer = this.buildSlotContainer(searchOnDocument);
    const customElementsArray = Array.from((_b = (_a = this._slotContainer) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []);
    customElementsArray.forEach(item => this._customElements.set(item.id, item));
  }
  buildSlotContainer(searchOnDocument) {
    let slotContainer;
    if (this.customContainerId) {
      const container = document.querySelector(`#${this.customContainerId}`);
      slotContainer = container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
    }
    else {
      slotContainer = this._element.querySelector(`#${this.customSlotId}`);
    }
    // Caso não encontre o slot container dentro do próprio elemento, tenta buscar na DOM do document.
    if (searchOnDocument && !slotContainer) {
      slotContainer = document.querySelector(`#${this.customSlotId}`);
    }
    return slotContainer;
  }
  handleOverFlow(overFlowingElements) {
    const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
    this.resetOverFlowedElements();
    this.doOverFlowElements(elementsToHandle);
  }
  resetOverFlowedElements() {
    this._overFlowedElements.forEach(element => {
      element.classList.remove(OVERFLOWED_CLASS_NAME);
    });
    this._hiddenActionsList = [];
    this._overFlowedElements = [];
  }
  doOverFlowElements(overFlowedElements) {
    overFlowedElements.forEach(element => {
      element.classList.add(OVERFLOWED_CLASS_NAME);
      this._overFlowedElements.push(element);
      this.addItemToActionList(element);
    });
  }
  getAttributeFromName(element, attributeName) {
    var _a;
    if (!element) {
      console.warn(`[snk-taskbar] Tentativa de acessar atributo "${attributeName}" em elemento nulo.`);
      return "";
    }
    let attributeValue = element.getAttribute(attributeName);
    if (!attributeValue && ((_a = element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'ez-tooltip') {
      const innerButton = element.querySelector('ez-button');
      if (innerButton) {
        attributeValue = innerButton.getAttribute(attributeName);
      }
    }
    return attributeValue !== null && attributeValue !== void 0 ? attributeValue : "";
  }
  addItemToActionList(element) {
    const taskbarElement = this.getAttributeFromName(element, 'data-taskbar-element');
    if (taskbarElement && this.isEnabled(taskbarElement) && this.isAllowed(taskbarElement)) {
      const optionItem = {
        value: taskbarElement,
        label: this.getAttributeFromName(element, 'data-taskbar-label'),
        iconName: this.getIconName(element)
      };
      this._hiddenActionsList.push(optionItem);
    }
  }
  getIconName(element) {
    const taskbarElement = this.getAttributeFromName(element, 'data-taskbar-element');
    if (taskbarElement === TaskbarElement.INSERT) {
      return "plus";
    }
    return this.getAttributeFromName(element, 'data-taskbar-icon');
  }
  hasToIgnoreOverFlow(element) {
    return element.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME) ||
      element.classList.contains(this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME);
  }
  handleOverFlowStrategy() {
    if (this.overflowStrategy === 'hiddenItems') {
      this._overFlowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
    }
  }
  buildOverFlowWatcherParams() {
    return {
      element: this._element,
      callback: this.handleOverFlow.bind(this),
      overFlowDirection: OverflowDirection.HORIZONTAL,
      notOverFlow: this.NOT_OVERFLOW_ELEMENTS
    };
  }
  handleDefinitions() {
    if (!this._permissions) {
      return;
    }
    this._definitions = this.elementsFromString(this.buttons);
    requestAnimationFrame(() => {
      requestAnimationFrame(() => {
        var _a;
        (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
      });
    });
  }
  async getAccess() {
    if (!this._application) {
      this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
    }
    if (!this._application) {
      console.warn('[snk-taskbar] Application context não encontrado. Permissões serão vazias.');
      this._permissions = {};
      return;
    }
    try {
      this._permissions = await this._application.getAllAccess(this.resourceID);
    }
    catch (error) {
      console.error('[snk-taskbar] Erro ao obter permissões:', error);
      this._permissions = {};
    }
  }
  unlinkAllCustomElements() {
    var _a;
    (_a = this._customElementsId) === null || _a === void 0 ? void 0 : _a.forEach(id => {
      const elementId = id.replace(this.TASKBAR_ITEM_ID_PREFIX, '');
      const customElement = this._customElements.get(elementId);
      this.unlinkCustomElementFromTaskbar(customElement);
    });
  }
  unlinkCustomElementFromTaskbar(customElement) {
    this._slotContainer.appendChild(customElement);
  }
  getHostClasses() {
    if (this.overflowStrategy !== 'hiddenItems')
      return 'no-wrap';
    return `full-width ${this.alignRigth ? 'align-right' : ""}`;
  }
  connectedCallback() {
    this.initializeDataUnit();
    this.handleOverFlowStrategy();
    this.getCustomElements();
  }
  async componentWillLoad() {
    this._isLoading = true;
    try {
      await this.getAccess();
      this.handleDefinitions();
    }
    catch (error) {
      console.error('[snk-taskbar] Erro ao obter permissões de acesso:', error);
    }
    finally {
      this._isLoading = false;
    }
  }
  componentDidRender() {
    this.appendCustomElementsInTaskbar();
  }
  disconnectedCallback() {
    var _a, _b;
    (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.unsubscribe(this.onSaveEvent);
    this.unlinkAllCustomElements();
    (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 : _b.destroy();
  }
  renderTaskbarElement(elem, index) {
    var _a, _b;
    if (TaskbarElement[elem]) {
      return this.getElement(index, TaskbarElement[elem]);
    }
    if ((_a = this.customButtons) === null || _a === void 0 ? void 0 : _a.has(elem)) {
      return this.getElement(index, this.customButtons.get(elem));
    }
    if (this._customElements.has(elem)) {
      return this.addCustomElementContainer(elem);
    }
    (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 : _b.addNotOverFlowElement(elem);
    return h("slot", { name: elem });
  }
  renderElements() {
    var _a, _b;
    const spacerIndex = (_a = this._definitions) === null || _a === void 0 ? void 0 : _a.indexOf(TaskbarElement.SPACER);
    const hasSpacerElement = spacerIndex !== undefined && spacerIndex !== -1;
    if (!hasSpacerElement) {
      const arrayOfElements = (_b = this._definitions) === null || _b === void 0 ? void 0 : _b.map((elem, index) => this.renderTaskbarElement(elem, index));
      return this.removeEmpty(arrayOfElements);
    }
    // Split elements into before and after spacer
    const elementsBeforeSpacer = this._definitions.slice(0, spacerIndex);
    const elementsAfterSpacer = this._definitions.slice(spacerIndex + 1);
    const beforeElements = elementsBeforeSpacer.map((elem, index) => this.renderTaskbarElement(elem, index));
    const afterElements = elementsAfterSpacer.map((elem, index) => this.renderTaskbarElement(elem, index + spacerIndex + 1));
    return [
      h("div", { class: "taskbar-group taskbar-group--start" }, this.removeEmpty(beforeElements)),
      h("div", { class: "taskbar-group taskbar-group--end" }, this.removeEmpty(afterElements))
    ];
  }
  render() {
    var _a, _b;
    if (!this._definitions) {
      return;
    }
    if (this._isLoading && !this.disableSkeleton) {
      return (h(Host, { class: this.getHostClasses() }, h("snk-taskbar-skeleton", null)));
    }
    return (h(Host, { class: this.getHostClasses() }, this.renderElements(), h("div", { id: this.TASKBAR_CUSTOM_ELEMENTS, class: this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME }, h("slot", { name: this.customSlotId }), (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 :
      _a.addNotOverFlowElement(this.TASKBAR_CUSTOM_ELEMENTS)), h("div", { id: this.TASKBAR_ADDITIONAL_SLOT, class: this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME }, h("slot", { name: this.additionalSlotId }), (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 :
      _b.addNotOverFlowElement(this.TASKBAR_ADDITIONAL_SLOT))));
  }
  static get is() { return "snk-taskbar"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() {
    return {
      "$": ["snk-taskbar.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["snk-taskbar.css"]
    };
  }
  static get properties() {
    return {
      "alignRigth": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define o alinhamento dos itens da barra de tarefas \u00E0 direita."
            }],
          "text": ""
        },
        "attribute": "align-rigth",
        "reflect": false,
        "defaultValue": "false"
      },
      "customSlotId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define o identificador do slot que recebe elementos personalizados."
            }],
          "text": ""
        },
        "attribute": "custom-slot-id",
        "reflect": false,
        "defaultValue": "\"TASKBAR_CUSTOM_ELEMENTS\""
      },
      "additionalSlotId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define o identificador do slot adicional."
            }],
          "text": ""
        },
        "attribute": "additional-slot-id",
        "reflect": false,
        "defaultValue": "\"TASKBAR_ADDITIONAL_SLOT\""
      },
      "customContainerId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define o identificador do cont\u00EAiner na DOM que \u00E9 respons\u00E1vel por guardar os elementos personalizados\nque n\u00E3o podem ser passados por slot."
            }, {
              "name": "example",
              "text": "Elementos customizados na Taskbar da aba de detalhes."
            }],
          "text": ""
        },
        "attribute": "custom-container-id",
        "reflect": false
      },
      "overflowStrategy": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "'hiddenItems' | 'none'",
          "resolved": "\"hiddenItems\" | \"none\"",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define como ser\u00E1 o comportamento da barra de tarefas quando ocorrer um overflow de itens."
            }],
          "text": ""
        },
        "attribute": "overflow-strategy",
        "reflect": false,
        "defaultValue": "'hiddenItems'"
      },
      "configName": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Nome da configura\u00E7\u00E3o usada para salvar ou recuperar as configura\u00E7\u00F5es do formul\u00E1rio. Tamb\u00E9m \u00E9 utilizado como fallback para a chave de armazenamento do exportador de dados."
            }],
          "text": ""
        },
        "attribute": "config-name",
        "reflect": false
      },
      "resourceID": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Identificador de recursos, como configura\u00E7\u00F5es e permiss\u00F5es de acesso."
            }],
          "text": ""
        },
        "attribute": "resource-i-d",
        "reflect": false
      },
      "buttons": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Lista de bot\u00F5es, separados por v\u00EDrgula, que define todos os elementos a serem criados na barra de tarefas."
            }],
          "text": ""
        },
        "attribute": "buttons",
        "reflect": false
      },
      "customButtons": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Map<string, CustomButton>",
          "resolved": "Map<string, CustomButton>",
          "references": {
            "Map": {
              "location": "global"
            },
            "CustomButton": {
              "location": "local"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Mapa com defini\u00E7\u00F5es de bot\u00F5es personalizados. A chave do mapa deve ser informada na propriedade `buttons` no local onde o bot\u00E3o deve ser renderizado."
            }],
          "text": ""
        }
      },
      "actionsList": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<Action>",
          "resolved": "Action[]",
          "references": {
            "Array": {
              "location": "global"
            },
            "Action": {
              "location": "local"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Lista de a\u00E7\u00F5es a serem exibidas no bot\u00E3o \"Mais op\u00E7\u00F5es\"."
            }],
          "text": ""
        }
      },
      "actionsSettingsList": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<Action>",
          "resolved": "Action[]",
          "references": {
            "Array": {
              "location": "global"
            },
            "Action": {
              "location": "local"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\" do componente snk-taskbar."
            }],
          "text": ""
        }
      },
      "customActionsList": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<Action>",
          "resolved": "Action[]",
          "references": {
            "Array": {
              "location": "global"
            },
            "Action": {
              "location": "local"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Lista de a\u00E7\u00F5es personalizadas que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\"."
            }],
          "text": ""
        }
      },
      "primaryButton": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define qual bot\u00E3o deve ter a apar\u00EAncia de destaque (prim\u00E1rio)."
            }],
          "text": ""
        },
        "attribute": "primary-button",
        "reflect": false
      },
      "disabledButtons": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<string>",
          "resolved": "string[]",
          "references": {
            "Array": {
              "location": "global"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Array contendo os identificadores de todos os bot\u00F5es que devem ser desabilitados."
            }],
          "text": ""
        }
      },
      "dataUnit": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "DataUnit",
          "resolved": "DataUnit",
          "references": {
            "DataUnit": {
              "location": "import",
              "path": "@sankhyalabs/core"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Inst\u00E2ncia do `DataUnit` com a qual a barra de tarefas ir\u00E1 interagir para realizar opera\u00E7\u00F5es de dados (ex: salvar, pr\u00F3ximo, anterior)."
            }],
          "text": ""
        }
      },
      "presentationMode": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "PresentationMode",
          "resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY | PresentationMode.SINGLE_TASKBAR",
          "references": {
            "PresentationMode": {
              "location": "import",
              "path": "../../lib/@types"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Altera o modo de apresenta\u00E7\u00E3o dos bot\u00F5es da barra de tarefas."
            }],
          "text": ""
        },
        "attribute": "presentation-mode",
        "reflect": true,
        "defaultValue": "PresentationMode.PRIMARY"
      },
      "messagesBuilder": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "SnkMessageBuilder",
          "resolved": "SnkMessageBuilder",
          "references": {
            "SnkMessageBuilder": {
              "location": "import",
              "path": "../../lib/message/SnkMessageBuilder"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
            }],
          "text": ""
        }
      },
      "disableSkeleton": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Se verdadeiro, desabilita a exibi\u00E7\u00E3o do esqueleto de carregamento da barra de tarefas."
            }],
          "text": ""
        },
        "attribute": "disable-skeleton",
        "reflect": false,
        "defaultValue": "false"
      },
      "sizeButtons": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "'small' | 'medium' | 'large'",
          "resolved": "\"large\" | \"medium\" | \"small\"",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Define o tamanho dos bot\u00F5es da barra de tarefas, podendo ser 'small', 'medium' ou 'large'."
            }],
          "text": ""
        },
        "attribute": "size-buttons",
        "reflect": false,
        "defaultValue": "'small'"
      }
    };
  }
  static get states() {
    return {
      "_hiddenActionsList": {},
      "_isWaitingForSave": {},
      "_isLoading": {}
    };
  }
  static get events() {
    return [{
        "method": "actionClick",
        "name": "actionClick",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Emitido sempre que um bot\u00E3o ou uma a\u00E7\u00E3o da barra de tarefas \u00E9 clicado."
            }, {
              "name": "eventProperty",
              "text": undefined
            }],
          "text": ""
        },
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        }
      }, {
        "method": "taskbarSaveLocker",
        "name": "taskbarSaveLocker",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Emitido quando uma a\u00E7\u00E3o de salvar \u00E9 iniciada pela barra de tarefas, indicando um estado de bloqueio para evitar a\u00E7\u00F5es concorrentes."
            }, {
              "name": "eventProperty",
              "text": undefined
            }],
          "text": ""
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }, {
        "method": "taskbarSaveUnlocker",
        "name": "taskbarSaveUnlocker",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [{
              "name": "description",
              "text": "Emitido quando a a\u00E7\u00E3o de salvar \u00E9 conclu\u00EDda ou cancelada, liberando o estado de bloqueio."
            }, {
              "name": "eventProperty",
              "text": undefined
            }],
          "text": ""
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }];
  }
  static get elementRef() { return "_element"; }
  static get watchers() {
    return [{
        "propName": "buttons",
        "methodName": "observeButtons"
      }, {
        "propName": "disabledButtons",
        "methodName": "observeDisabledButtons"
      }, {
        "propName": "_isWaitingForSave",
        "methodName": "observeIsWaitingForSave"
      }, {
        "propName": "dataUnit",
        "methodName": "observeDataUnit"
      }];
  }
  static get listeners() {
    return [{
        "name": "snkCustomSlotElementsLoaded",
        "method": "handleCustomSlotElementsLoaded",
        "target": "window",
        "capture": false,
        "passive": false
      }, {
        "name": "taskbarSaveLocker",
        "method": "handleTaskbarSaveLocker",
        "target": "window",
        "capture": false,
        "passive": false
      }, {
        "name": "taskbarSaveUnlocker",
        "method": "handleTaskbarSaveUnlocker",
        "target": "window",
        "capture": false,
        "passive": false
      }];
  }
}
