'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-17105557.js');
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-eccb267a.js');
require('@sankhyalabs/core');
require('./filter-item-type.enum-a7ffdaa6.js');
require('./index-62760a9c.js');

const snkFilterAdvancedModeCss = ".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";

const SnkFilterAdvancedMode = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.ezExpressionChange = index.createEvent(this, "ezExpressionChange", 7);
    this.filterAssistent = undefined;
    this.application = undefined;
  }
  getMessage(key, params) {
    return this.application.messagesBuilder.getMessage(key, params);
  }
  render() {
    var _a;
    return (index.h(index.Host, null, index.h("span", { class: "ez-title ez-title--small ez-padding-bottom--small snk-filter-advanced-mode__title" }, this.getMessage("snkPersonalizedFilter.info.applyExpression")), index.h("ez-text-area", { rows: 9, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.expression, onEzChange: (evt) => this.ezExpressionChange.emit(evt.detail) })));
  }
};
SnkFilterAdvancedMode.style = snkFilterAdvancedModeCss;

const snkFilterAssistentModeCss = ".sc-snk-filter-assistent-mode-h{display:flex;flex-direction:column;height:100%;--text-area--font-family:var(--font-pattern, Arial);--text-area__label--floating--top:var(--space--small, 6px);--snk-filter-assistent-mode__container--border-radius:var(--border--radius-medium, 12px);--snk-filter-assistent-mode__container--background:var(--background--medium, #f0f3f7);--snk-filter-assistent-mode__container--margin:var(--space--small, 6px) var(--space--medium, 12px)}.ez-box__container--external.sc-snk-filter-assistent-mode{height:100px;width:100%;overflow-y:auto;background-color:var(--snk-filter-assistent-mode__container--background);border-radius:var(--snk-filter-assistent-mode__container--border-radius)}.ez-box__container--internal.sc-snk-filter-assistent-mode{margin:var(--snk-filter-assistent-mode__container--margin)}.ez-box__container--title.sc-snk-filter-assistent-mode{display:block;user-select:none;font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--title--primary);top:var(--text-area__label--floating--top)}.ez-box__container--expression.sc-snk-filter-assistent-mode{display:block;font-family:var(--text-area--font-family);font-size:var(--text--medium);color:var(--title--primary);top:var(--text-area__label--floating--top)}.snk-personalized-filter__expression-input--line.sc-snk-filter-assistent-mode{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}";

const SnkFilterAssistentMode = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.ezChangeFilter = index.createEvent(this, "ezChangeFilter", 7);
    this.filterAssistent = undefined;
    this.messagesBuilder = undefined;
    this.filterId = undefined;
    this.entityUri = undefined;
    this.application = undefined;
    this.isDefaultFilter = false;
  }
  getMessage(key, params) {
    return this.application.messagesBuilder.getMessage(key, params);
  }
  async handleFilterGroupChange() {
    const assistent = await this._mainExpressionGroup.getExpressionGroup();
    this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
    this.filterAssistent.parameters = PersonalizedFilterUtils.PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
    this.filterAssistent.expression = PersonalizedFilterUtils.PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
    this.ezChangeFilter.emit(this.filterAssistent);
  }
  render() {
    var _a, _b;
    return (index.h(index.Host, null, index.h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, index.h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri, isDefaultFilter: this.isDefaultFilter })), index.h("div", { class: "ez-margin-top--auto" }, index.h("div", { class: "snk-personalized-filter__expression-input--line" }), index.h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, index.h("div", { class: "ez-box" }, index.h("div", { class: "ez-box__container--external" }, index.h("div", { class: "ez-box__container--internal" }, index.h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), index.h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
  }
};
SnkFilterAssistentMode.style = snkFilterAssistentModeCss;

exports.snk_filter_advanced_mode = SnkFilterAdvancedMode;
exports.snk_filter_assistent_mode = SnkFilterAssistentMode;
