import { r as t, g as i, h as e, H as s, a } from "./p-9b9ccd0c.js";

import { g as o } from "./p-d42e842b.js";

import "./p-6534555e.js";

import "lit";

import "lit/directives/when.js";

import "lit/directives/if-defined.js";

import { c as n } from "./p-c5196b3b.js";

import { L as h } from "./p-311eedf3.js";

import { s as l, g as r } from "./p-91e2ebb0.js";

import { r as d, m as c } from "./p-4d330836.js";

import { v as f } from "./p-b32b6b1f.js";

import { r as p } from "./p-1252519a.js";

const u = 'button.button-secondary{border-color:var(--color-border-neutral-default)}:host{display:grid;block-size:100%;overflow:auto;grid-template-rows:max-content 1fr max-content}.section{display:contents}.header-one-col{grid-template-columns:1fr}.location-wrapper{display:flex;align-items:center;gap:var(--spacing-gap-xs);min-block-size:var(--control-block-size)}.location-custom-wrapper{display:flex;align-items:center;gap:var(--spacing-gap-xs);flex-grow:1;min-inline-size:0}.location-field{flex-grow:1;min-inline-size:0}.location-field>.input{inline-size:100%}.basic{display:grid;grid-template:"basic-top basic-top" max-content "back-end front-end" 1fr;grid-template-columns:1fr 1fr}.basic__header{grid-area:basic-top;grid-template-columns:1fr 1fr}.dialog-header__back-end,.dialog-header__front-end{padding-block-start:16px}.main__back-end{border-inline-end:var(--section-common-border)}.main__back-end,.main__front-end{grid-auto-rows:max-content;padding-block:12px;overflow:auto}.section__back-end{grid-area:back-end;grid-auto-rows:max-content}.section__front-end{grid-area:front-end}.section__back-end,.section__front-end{display:grid;grid-template-rows:max-content 1fr;overflow:auto}.tab-advanced-title{grid-area:tab-advanced-title}.layout-tab-advanced-left-col{grid-area:layout-tab-advanced-left-col}.layout-tab-advanced-right-col{grid-area:layout-tab-advanced-right-col}.basic,.advanced{padding-block-start:12px;overflow:auto;block-size:100%}.tab-advanced__field-group{display:grid;grid-template-columns:1fr 1fr;grid-auto-rows:auto}.text-align-center{text-align:center}.tab::part(page){scrollbar-width:thin}.checkbox{inline-size:max-content}';

var b = undefined && undefined.__classPrivateFieldGet || function(t, i, e, s) {
  if (e === "a" && !s) throw new TypeError("Private accessor was defined without a getter");
  if (typeof i === "function" ? t !== i || !s : !i.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return e === "m" ? s : e === "a" ? s.call(t) : s ? s.value : i.get(t);
};

var v = undefined && undefined.__classPrivateFieldSet || function(t, i, e, s, a) {
  if (s === "m") throw new TypeError("Private method is not writable");
  if (s === "a" && !a) throw new TypeError("Private accessor was defined without a setter");
  if (typeof i === "function" ? t !== i || !a : !i.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return s === "a" ? a.call(t, e) : a ? a.value = e : i.set(t, e), e;
};

var m, g, w, k, y, x, M, W, _, F, T, I, E, N, j, D, L, P, S, z, C, A, B, K, U, V, H, R, q, G, J, O, Q, X, Y, Z, $, tt, it, et, st, at, ot, nt, ht, lt, rt, dt;

const ct = [ "resets/box-sizing", "components/tab", "components/tooltip", "utils/form--full", "utils/layout", "utils/typography", "utils/spacing", "chameleon/scrollbar" ];

const ft = "windows-authentication";

const pt = "main";

const ut = "basic";

const bt = o({
  category: "system",
  name: "folder",
  colorType: "primary"
});

const vt = "default";

const mt = "custom";

const gt = "basic";

const wt = "advanced";

const kt = class {
  constructor(s) {
    t(this, s);
    m.set(this, false);
    /**
         * The component hard-coded strings translations.
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        g.set(this, void 0);
    /**
         * frontEndsState saves the id's of the front ends checkboxes that are checked
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        w.set(this, new Map);
    k.set(this, void 0);
    y.set(this, void 0);
    x.set(this, i(`./gx-ide-assets/new-kb/shortcuts.json`));
    M.set(this, []);
    /* References needed to collect data con "Create" button submit*/    W.set(this, void 0);
    _.set(this, void 0);
    F.set(this, void 0);
    T.set(this, void 0);
    I.set(this, void 0);
    E.set(this, void 0);
    N.set(this, void 0);
    j.set(this, void 0);
    D.set(this, void 0);
    L.set(this, false);
    P.set(this, void 0);
    S.set(this, void 0);
    z.set(this, void 0);
    C.set(this, void 0);
    A.set(this, void 0);
    B.set(this, void 0);
    K.set(this, void 0);
    U.set(this, void 0);
    // Uncomment when "TODO: define button handler and logic" is done.
    // #geminiToolsSearchPrimary = getIconPath({
    //   category: "gemini-tools",
    //   name: "search",
    //   colorType: "primary"
    // });
    // #geminiToolsResetPrimary = getIconPath({
    //   category: "gemini-tools",
    //   name: "reset",
    //   colorType: "primary"
    // });
        V.set(this, (t => {
      const i = t === null || t === void 0 ? void 0 : t.detail;
      b(this, $, "f").call(this, i);
    }));
    H.set(this, (t => {
      b(this, Y, "f").call(this, t.detail);
    }));
    R.set(this, (t => {
      v(this, k, t.detail, "f");
      b(this, st, "f").call(this);
      b(this, dt, "f").call(this);
    }));
    q.set(this, (async () => {
      await b(this, et, "f").call(this);
      b(this, st, "f").call(this);
    }));
    G.set(this, (() => {
      v(this, y, b(this, I, "f").value, "f");
    }));
    J.set(this, (() => [ e("h2", {
      // #knowledge base storage
      class: "dialog-header subtitle-regular-xs\t text-align-center"
    }, b(this, g, "f").tabAdvanced.tabTitle), e("div", {
      class: "field-group tab-advanced__field-group"
    }, e("div", {
      // #server name
      class: "field field-block server-name-field"
    }, e("label", {
      class: "label",
      htmlFor: "serverName"
    }, b(this, g, "f").tabAdvanced.serverName.label), e("ch-combo-box-render", {
      class: "combo-box",
      disabled: this.serverNames.length === 0,
      placeholder: this.serverNames.length === 0 ? b(this, g, "f").tabAdvanced.serverName.disabledPlaceholder : "",
      value: this.serverNamesInitialValue,
      ref: t => v(this, A, t, "f"),
      model: this.serverNamesComboBoxModel,
      onInput: this.serverNames.length > 0 && b(this, H, "f"),
      id: "serverName",
      part: "server-name"
    }), b(this, Z, "f").call(this, b(this, A, "f"))), e("div", {
      // #authentication type
      class: "field field-block authentication-type-field"
    }, e("label", {
      class: "label",
      htmlFor: "authenticationType"
    }, b(this, g, "f").tabAdvanced.authenticationType.label), e("ch-combo-box-render", {
      class: "combo-box",
      disabled: this.authenticationTypes.length === 0,
      placeholder: this.authenticationTypes.length === 0 ? b(this, g, "f").tabAdvanced.authenticationType.disabledPlaceholder : "",
      value: this.authenticationTypesInitialValue,
      ref: t => v(this, W, t, "f"),
      model: this.authenticationTypesComboBoxModel,
      id: "authenticationType",
      part: "authentication-type",
      onInput: this.authenticationTypes.length > 0 ? b(this, V, "f") : undefined
    }), b(this, Z, "f").call(this, b(this, W, "f"))), e("div", {
      // #database
      class: "field field-block database-field"
    }, e("label", {
      class: "label",
      htmlFor: "databaseName"
    }, b(this, g, "f").tabAdvanced.databaseName.label), e("ch-edit", {
      // TODO add placeholder
      class: "input",
      value: this.databaseName,
      id: "databaseName",
      part: "database-name",
      ref: t => v(this, T, t, "f")
    }), b(this, Z, "f").call(this, b(this, T, "f"))), this.userNameVisible ? e("div", {
      // #username
      class: "field field-block username-field"
    }, e("label", {
      class: "label",
      htmlFor: "userName"
    }, b(this, g, "f").tabAdvanced.userName.label), e("ch-edit", {
      // TODO add placeholder
      class: "input",
      value: this.userName,
      id: "userName",
      part: "user-name",
      ref: t => v(this, K, t, "f")
    }), b(this, Z, "f").call(this, b(this, K, "f"))) : null, e("div", {
      // #collation
      class: "field field-block collation-field"
    }, e("label", {
      class: "label",
      htmlFor: "collation"
    }, b(this, g, "f").tabAdvanced.collation.label), e("ch-combo-box-render", {
      class: "combo-box",
      disabled: this.serverNames.length === 0,
      placeholder: this.collations.length === 0 ? b(this, g, "f").tabAdvanced.collation.disabledPlaceholder : "",
      value: this.collationsInitialValue,
      ref: t => v(this, _, t, "f"),
      model: this.collationsComboBoxModel,
      id: "collation",
      part: "collation"
    }), b(this, Z, "f").call(this, b(this, _, "f"))), this.passwordVisible ? e("div", {
      // #password
      class: "field field-block password-field"
    }, e("label", {
      class: "label",
      htmlFor: "password"
    }, b(this, g, "f").tabAdvanced.password.label), e("ch-edit", {
      // TODO add placeholder
      class: "input",
      type: "password",
      value: this.password,
      id: "password",
      part: "password",
      ref: t => v(this, P, t, "f")
    }), b(this, Z, "f").call(this, b(this, P, "f"))) : null, e("ch-checkbox", {
      // #create data in knowledge base folder
      class: "checkbox create-data-in-kb-checkbox",
      checkedValue: "createDataFilesInKBFolder",
      caption: b(this, g, "f").tabAdvanced.createDataFilesInKbFolder,
      disabled: this.createDataInKbDisabled,
      part: "create-data-in-kb",
      id: "createDataFilesInKBFolder",
      ref: t => v(this, F, t, "f")
    }), this.savePasswordVisible ? e("ch-checkbox", {
      // #save password
      class: "checkbox save-password-checkbox",
      checkedValue: "password",
      caption: b(this, g, "f").tabAdvanced.savePassword,
      part: "save-password",
      id: "savePassword",
      ref: t => v(this, C, t, "f")
    }) : null) ]));
    O.set(this, (() => [ e("section", {
      class: "basic__header field-group dialog-header-with-border spacing-body-inline"
    }, e("div", {
      // #prototyping  target
      class: "field field-block prototyping-target"
    }, e("label", {
      class: "label",
      htmlFor: "prototypingTarget"
    }, b(this, g, "f").tabBasic.prototypingTarget.label), e("ch-combo-box-render", {
      id: "prototypingTarget",
      class: "combo-box",
      part: "prototyping-target",
      disabled: this.prototypingTargets.length === 0,
      placeholder: this.prototypingTargets.length === 0 ? b(this, g, "f").tabBasic.prototypingTarget.disabledPlaceholder : "",
      value: this.prototypingTargetsInitialValue,
      model: this.prototypingTargetsComboBoxModel,
      onInput: this.prototypingTargets.length > 0 ? b(this, q, "f") : undefined,
      ref: t => v(this, z, t, "f")
    }), b(this, Z, "f").call(this, b(this, z, "f"))), e("div", {
      // #user interface
      class: "field field-block user-interface-language"
    }, e("label", {
      class: "label",
      htmlFor: "userInterfaceLanguage"
    }, b(this, g, "f").tabBasic.userInterfaceLanguage.label), e("ch-combo-box-render", {
      class: "combo-box",
      disabled: this.userInterfaceLanguages.length === 0,
      placeholder: this.userInterfaceLanguages.length === 0 ? b(this, g, "f").tabBasic.userInterfaceLanguage.disabledPlaceholder : "",
      value: this.userInterfaceLanguagesInitialValue,
      ref: t => v(this, B, t, "f"),
      model: this.userInterfaceLanguagesComboBoxModel,
      id: "userInterfaceLanguage",
      part: "user-interface-language"
    }), b(this, Z, "f").call(this, b(this, B, "f")))), e("section", {
      class: "section__back-end"
    }, e("h2", {
      // back end
      class: "dialog-header dialog-header-with-border dialog-header__back-end subtitle-regular-xs\t text-align-center spacing-body-inline"
    }, b(this, g, "f").tabBasic.backEnd.backEndLabel), e("div", {
      class: "field-group main__back-end spacing-body-inline scrollable"
    }, e("div", {
      // #prototyping environment
      class: "field field-block"
    }, e("label", {
      class: "label",
      htmlFor: "prototypingEnvironment"
    }, b(this, g, "f").tabBasic.backEnd.prototypingEnvironment.label), e("ch-combo-box-render", {
      class: "combo-box",
      disabled: this.defaultPrototypingEnvironments.length === 0,
      placeholder: this.defaultPrototypingEnvironments.length === 0 ? b(this, g, "f").tabBasic.backEnd.prototypingEnvironment.disabledPlaceholder : "",
      value: b(this, k, "f"),
      ref: t => v(this, S, t, "f"),
      model: this.prototypingEnvironmentsComboBoxModel,
      onInput: b(this, R, "f"),
      part: "prototyping-environment",
      id: "prototypingEnvironment"
    }), b(this, Z, "f").call(this, b(this, S, "f"))), e("div", {
      // #data source
      class: "field field-block"
    }, e("label", {
      class: "label",
      htmlFor: "dataSource"
    }, b(this, g, "f").tabBasic.backEnd.dataSource.label), e("ch-combo-box-render", {
      class: "combo-box",
      disabled: this.defaultDataSources.length === 0,
      placeholder: this.defaultDataSources.length === 0 ? b(this, g, "f").tabBasic.backEnd.dataSource.disabledPlaceholder : "",
      value: b(this, y, "f"),
      ref: t => v(this, I, t, "f"),
      onInput: b(this, G, "f"),
      model: this.defaultDataSourcesComboBoxModel,
      part: "data-source",
      id: "dataSource"
    }), b(this, Z, "f").call(this, b(this, I, "f"))))), e("section", {
      class: "section__front-end"
    }, e("h2", {
      class: "dialog-header dialog-header-with-border dialog-header__front-end subtitle-regular-xs\t text-align-center spacing-body-inline"
    }, b(this, g, "f").tabBasic.frontEnd.frontEndLabel), e("div", {
      class: "field-group main__front-end spacing-body-inline scrollable"
    }, d(this.frontEnds, b(this, tt, "f"), b(this, w, "f").get(b(this, k, "f"))))) ]));
    // - - - - - - - - - -
        Q.set(this, (() => {
      if (this.cancelCallback) {
        this.cancelCallback();
      }
    }));
    X.set(this, (() => {
      var t, i, e, s, a, o, n, h, l, r, d, c, p, u, v;
      const m = (t = b(this, w, "f").get(b(this, k, "f"))) !== null && t !== void 0 ? t : [];
      this.createCallback({
        authenticationType: (i = b(this, W, "f")) === null || i === void 0 ? void 0 : i.value,
        collation: (e = b(this, _, "f")) === null || e === void 0 ? void 0 : e.value,
        createDataFilesInKBFolder: !!((s = b(this, F, "f")) === null || s === void 0 ? void 0 : s.value),
        dataSource: (a = b(this, I, "f")) === null || a === void 0 ? void 0 : a.value,
        databaseName: (o = b(this, T, "f")) === null || o === void 0 ? void 0 : o.value,
        frontEnds: m,
        kbLocation: (n = b(this, N, "f")) === null || n === void 0 ? void 0 : n.value,
        kbName: (h = b(this, E, "f")) === null || h === void 0 ? void 0 : h.value,
        password: (l = b(this, P, "f")) === null || l === void 0 ? void 0 : l.value,
        prototypingEnvironment: (r = b(this, S, "f")) === null || r === void 0 ? void 0 : r.value,
        prototypingTarget: (d = b(this, z, "f")) === null || d === void 0 ? void 0 : d.value,
        savePassword: !!((c = b(this, C, "f")) === null || c === void 0 ? void 0 : c.value),
        serverName: (p = b(this, A, "f")) === null || p === void 0 ? void 0 : p.value,
        userInterfaceLanguage: (u = b(this, B, "f")) === null || u === void 0 ? void 0 : u.value,
        userName: (v = b(this, K, "f")) === null || v === void 0 ? void 0 : v.value
      }).then((t => {
        this.validatableControls = f(t, this.validatableControls);
      }));
    }));
    /**
         * Disable "Create Data in Knowledge Base Folder" if the first Server Name
         * option is selected.
         * */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        Y.set(this, (t => {
      var i;
      if (((i = this.serverNames[0]) === null || i === void 0 ? void 0 : i.id) === t) {
        this.createDataInKbDisabled = true;
      } else {
        this.createDataInKbDisabled = false;
      }
    }));
    // TODO: evaluate if this should be a global helper function.
    // It is used on new-kb as well.
        Z.set(this, (t => {
      var i, s, a;
      return ((s = (i = this.validatableControls) === null || i === void 0 ? void 0 : i.get(t === null || t === void 0 ? void 0 : t.id)) === null || s === void 0 ? void 0 : s.hasError) && ((a = this.validatableControls.get(t.id)) === null || a === void 0 ? void 0 : a.message) && e("ch-tooltip", {
        class: "tooltip",
        actionElement: t,
        blockAlign: n.tooltipSettings.blockAlign,
        inlineAlign: n.tooltipSettings.inlineAlign,
        delay: n.tooltipSettings.delay
      }, this.validatableControls.get(t.id).message);
    }));
    /**
         * If "Authentication Type" is "Windows Authentication", hide User Name,
         * Password, and Save Password fields.
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        $.set(this, (t => {
      if (t === ft) {
        this.userNameVisible = false;
        this.passwordVisible = false;
        this.savePasswordVisible = false;
      } else {
        this.userNameVisible = true;
        this.passwordVisible = true;
        this.savePasswordVisible = true;
      }
    }));
    tt.set(this, (t => {
      const i = t.target.checkedValue;
      const e = t.detail === i;
      b(this, it, "f").call(this, i, e);
    }));
    /**
         * This function updates frontEndsCheckedMap, that contains the checked
         * checkboxes for each language front ends.
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        it.set(this, ((t, i) => {
      let e = b(this, w, "f").get(b(this, k, "f"));
      if (!e) {
        // first time
        e = [];
        b(this, w, "f").set(b(this, k, "f"), e);
      }
      if (i) {
        // update by adding
        e.push(t);
      } else {
        // update by removing
        const i = e.findIndex((i => i === t));
        p(e, i);
      }
    }));
    et.set(this, (async () => {
      if (this.getPrototypingEnvironmentsCallback) {
        const t = b(this, z, "f") ? b(this, z, "f").value : this.prototypingTargetsInitialValue;
        const i = await this.getPrototypingEnvironmentsCallback(t);
        if (i) {
          this.defaultPrototypingEnvironments = i;
        }
      }
    }));
    st.set(this, (() => {
      if (this.getDataSourcesCallback) {
        const t = b(this, S, "f").value;
        const i = b(this, z, "f").value;
        const e = this.getDataSourcesCallback(t, i);
        e.then((t => {
          if (t.length > 0) {
            t = l(t, b(this, y, "f"));
            v(this, y, r(t), "f");
            this.defaultDataSources = t;
            // set first option as selected
                        b(this, I, "f").value = b(this, y, "f") !== undefined ? b(this, y, "f") : this.defaultDataSources[0].id;
          }
        })).catch((() => {}));
      }
    }));
    at.set(this, (() => {
      const t = b(this, A, "f").value;
      b(this, Y, "f").call(this, t);
      const i = b(this, W, "f").value;
      b(this, $, "f").call(this, i);
      // map all "Advanced Tab" GxOption[]'s to ComboBoxModel's
            this.watchAuthenticationTypes(this.authenticationTypes);
      this.watchCollations(this.collations);
    }));
    ot.set(this, (() => {
      // populate #controlsValidation with the controls that could have errors.
      const t = [ b(this, I, "f"), b(this, E, "f"), b(this, S, "f"), b(this, z, "f"), b(this, B, "f") ];
      t.forEach((t => {
        if (t.id) {
          this.validatableControls.set(t.id, {
            reference: t,
            hasError: false,
            message: undefined
          });
        }
      }));
    }));
    nt.set(this, (() => {
      // populate #controlsValidation with the controls that could have errors.
      const t = [ b(this, W, "f"), b(this, F, "f"), b(this, A, "f"), b(this, W, "f"), b(this, T, "f"), b(this, K, "f"), b(this, _, "f"), b(this, P, "f"), b(this, C, "f") ];
      t.forEach((t => {
        if (t.id) {
          this.validatableControls.set(t.id, {
            reference: t,
            hasError: false,
            message: undefined
          });
        }
      }));
    }));
    /**
         * @description It allows defining the DBMS that will be used in the solution
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        ht.set(this, (() => {
      this.selectLocationCallback().then((t => {
        if (t) {
          this.kbLocation = t;
        }
      }));
    }));
    lt.set(this, (() => {
      this.locationMode = b(this, j, "f").value;
    }));
    rt.set(this, (t => {
      if (t.detail.newSelectedId === wt) {
        this.advancedTabIsVisible = true;
        // Some logic for advanced tab is done on componentDidRender lifecycle,
        // since the reference to the elements is needed.
            }
    }));
    /**
         * Evaluates which front-end options need updates on 'getFrontEndsCallback'
         * by comparing the new state (getFrontEndsCallback result) and previous state.
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        dt.set(this, (async () => {
      const t = await this.getFrontEndsCallback(b(this, k, "f"));
      if ((t === null || t === void 0 ? void 0 : t.length) > 0) {
        this.frontEnds = t;
        // Seed the checked map from the data's checked property so that
        // initially checked items render as checked on first load.
                if (!b(this, w, "f").has(b(this, k, "f"))) {
          const i = t.filter((t => t.checked)).map((t => t.value || t.id));
          if (i.length > 0) {
            b(this, w, "f").set(b(this, k, "f"), i);
          }
        }
      }
    }));
    this.advancedTabIsVisible = false;
    this.locationMode = vt;
    this.frontEnds = undefined;
    this.validatableControls = new Map;
    this.createDataInKbDisabled = false;
    this.userNameVisible = true;
    this.passwordVisible = true;
    this.savePasswordVisible = true;
    this.authenticationTypesComboBoxModel = [];
    this.authenticationTypesInitialValue = undefined;
    this.collationsComboBoxModel = [];
    this.collationsInitialValue = undefined;
    this.defaultDataSourcesComboBoxModel = [];
    this.prototypingTargetsComboBoxModel = [];
    this.prototypingTargetsInitialValue = undefined;
    this.prototypingEnvironmentsComboBoxModel = [];
    this.prototypingEnvironmentsInitialValue = undefined;
    this.serverNamesComboBoxModel = [];
    this.serverNamesInitialValue = undefined;
    this.userInterfaceLanguagesComboBoxModel = [];
    this.userInterfaceLanguagesInitialValue = undefined;
    this.authenticationTypes = [];
    this.cancelCallback = undefined;
    this.canSetLocation = false;
    this.collations = undefined;
    this.createCallback = undefined;
    this.createDataFilesInKBFolder = false;
    this.databaseName = undefined;
    this.defaultDataSources = [];
    this.getDataSourcesCallback = undefined;
    this.getFrontEndsCallback = undefined;
    this.getPrototypingEnvironmentsCallback = undefined;
    this.isAdvanced = false;
    this.kbLocation = undefined;
    this.kbName = undefined;
    this.password = undefined;
    this.defaultPrototypingEnvironments = [];
    this.prototypingTargets = [];
    this.savePassword = false;
    this.selectLocationCallback = undefined;
    this.serverNames = [];
    this.userInterfaceLanguages = [];
    this.userName = undefined;
  }
  watchAuthenticationTypes(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.authenticationTypesComboBoxModel = c(t);
      this.authenticationTypesInitialValue = r(t);
    }
  }
  watchCollations(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.collationsComboBoxModel = c(t);
      this.collationsInitialValue = r(t);
    }
  }
  watchDefaultDataSources(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.defaultDataSourcesComboBoxModel = c(t);
      const i = l(t, b(this, y, "f"));
      v(this, y, r(i), "f");
    }
  }
  watchDefaultPrototypingEnvironments(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.prototypingEnvironmentsComboBoxModel = c(t);
      v(this, k, r(t), "f");
      b(this, dt, "f").call(this);
    }
  }
  watchPrototypingTargets(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.prototypingTargetsComboBoxModel = c(t);
      this.prototypingTargetsInitialValue = r(t);
      b(this, et, "f").call(this);
    }
  }
  watchServerNames(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.serverNamesComboBoxModel = c(t);
      this.serverNamesInitialValue = r(t);
    }
  }
  watchUserInterfaceLanguages(t) {
    if (t === null || t === void 0 ? void 0 : t.length) {
      this.userInterfaceLanguagesComboBoxModel = c(t);
      this.userInterfaceLanguagesInitialValue = r(t);
    }
  }
  async componentWillLoad() {
    v(this, g, await h.getComponentStrings(this.el), "f");
    v(this, M, [ {
      id: gt,
      name: b(this, g, "f").tabBasic.tabLabel
    }, {
      id: wt,
      name: b(this, g, "f").tabAdvanced.tabLabel
    } ], "f");
    v(this, D, [ {
      value: vt,
      caption: b(this, g, "f").header.kbLocationDefault
    }, {
      value: mt,
      caption: b(this, g, "f").header.kbLocationCustom
    } ], "f");
  }
  connectedCallback() {
    this.watchDefaultDataSources(this.defaultDataSources);
    this.watchDefaultPrototypingEnvironments(this.defaultPrototypingEnvironments);
    this.watchPrototypingTargets(this.prototypingTargets);
    this.watchServerNames(this.serverNames);
    this.watchUserInterfaceLanguages(this.userInterfaceLanguages);
  }
  componentDidLoad() {
    b(this, ot, "f").call(this);
  }
  componentDidRender() {
    if (this.advancedTabIsVisible && !b(this, m, "f")) {
      // just call this once.
      b(this, at, "f").call(this);
      b(this, nt, "f").call(this);
      v(this, m, true, "f");
    }
    // Register the location input for validation once it's rendered (custom mode)
        if (this.locationMode === mt && !b(this, L, "f") && b(this, N, "f")) {
      this.validatableControls.set(b(this, N, "f").id, {
        reference: b(this, N, "f"),
        hasError: false,
        message: undefined
      });
      v(this, L, true, "f");
    }
  }
  /**
     * Suspends or reactivates the shortcuts
     */  async suspendShortcuts(t) {
    if (t) {
      b(this, U, "f").suspend = true;
    } else {
      b(this, U, "f").suspend = false;
    }
  }
  render() {
    return e(s, {
      class: "widget"
    }, e("ch-theme", {
      model: ct
    }), e("ch-shortcuts", {
      src: b(this, x, "f"),
      ref: t => v(this, U, t, "f")
    }), e("section", {
      class: "section"
    }, e("header", {
      class: {
        "field-group": true,
        "dialog-header-with-border": !this.isAdvanced,
        "dialog-header": this.isAdvanced,
        header: true,
        "header-one-col": true,
        "spacing-body-block-start": true,
        "spacing-body-inline": true
      }
    }, e("div", {
      // #kb name
      class: "field field-inline kb-name"
    }, e("label", {
      class: "label kb-label",
      htmlFor: "kbName"
    }, b(this, g, "f").header.kbName), e("ch-edit", {
      // TODO add placeholder
      autoFocus: true,
      class: "input kb-input",
      placeholder: "SalesInventory",
      value: this.kbName,
      ref: t => v(this, E, t, "f"),
      id: "kbName",
      part: "kb-name"
    }), b(this, Z, "f").call(this, b(this, E, "f"))), this.canSetLocation && e("div", {
      class: "location-wrapper"
    }, e("label", {
      class: "label location-label"
    }, b(this, g, "f").header.kbLocation), e("ch-radio-group-render", {
      class: "radio-group",
      model: b(this, D, "f"),
      value: vt,
      onChange: b(this, lt, "f"),
      ref: t => v(this, j, t, "f")
    }), this.locationMode === mt && e("div", {
      class: "location-custom-wrapper"
    }, e("div", {
      class: "location-field"
    }, e("ch-edit", {
      class: "input",
      value: this.kbLocation,
      ref: t => v(this, N, t, "f"),
      id: "kbLocation",
      part: "kb-location"
    }), b(this, Z, "f").call(this, b(this, N, "f"))), e("button", {
      class: "button-tertiary button-icon-only location-icon",
      "aria-label": b(this, g, "f").header.selectLocationButton,
      title: b(this, g, "f").header.selectLocationButton,
      part: "button-select-location",
      onClick: b(this, ht, "f")
    }, e("ch-image", {
      class: "icon-m",
      src: bt
    }))))), this.isAdvanced ? e("ch-tab-render", {
      // #tab
      class: {
        scrollable: true,
        tab: true,
        [pt]: true
      },
      tabListPosition: "block-start",
      model: b(this, M, "f"),
      selectedId: gt,
      overflow: "auto",
      contain: "size",
      onSelectedItemChange: !this.advancedTabIsVisible && b(this, rt, "f")
    }, e("div", {
      slot: gt,
      class: ut,
      part: "tab-button-basic"
    }, b(this, O, "f").call(this)), this.advancedTabIsVisible && e("div", {
      slot: wt,
      class: "advanced spacing-body-inline",
      part: "tab-button-advanced"
    }, b(this, J, "f").call(this))) : e("div", {
      class: pt
    }, e("div", {
      class: ut
    }, b(this, O, "f").call(this))), e("footer", {
      class: {
        "dialog-footer": this.isAdvanced,
        "dialog-footer-with-border": !this.isAdvanced,
        "spacing-body-block-end": true,
        "spacing-body-inline": true
      }
    }, e("div", {
      class: "buttons-spacer"
    }, e("button", {
      // #cancel
      class: "button-secondary",
      id: "button-cancel",
      onClick: b(this, Q, "f"),
      part: "button-cancel"
    }, b(this, g, "f").footer.btnCancel), e("button", {
      // #create
      class: "button-primary",
      id: "button-create",
      onClick: b(this, X, "f"),
      part: "button-create"
    }, b(this, g, "f").footer.btnCreate)))));
  }
  static get assetsDirs() {
    return [ "gx-ide-assets/new-kb" ];
  }
  get el() {
    return a(this);
  }
  static get watchers() {
    return {
      authenticationTypes: [ "watchAuthenticationTypes" ],
      collations: [ "watchCollations" ],
      defaultDataSources: [ "watchDefaultDataSources" ],
      defaultPrototypingEnvironments: [ "watchDefaultPrototypingEnvironments" ],
      prototypingTargets: [ "watchPrototypingTargets" ],
      serverNames: [ "watchServerNames" ],
      userInterfaceLanguages: [ "watchUserInterfaceLanguages" ]
    };
  }
};

m = new WeakMap, g = new WeakMap, w = new WeakMap, k = new WeakMap, y = new WeakMap, 
x = new WeakMap, M = new WeakMap, W = new WeakMap, _ = new WeakMap, F = new WeakMap, 
T = new WeakMap, I = new WeakMap, E = new WeakMap, N = new WeakMap, j = new WeakMap, 
D = new WeakMap, L = new WeakMap, P = new WeakMap, S = new WeakMap, z = new WeakMap, 
C = new WeakMap, A = new WeakMap, B = new WeakMap, K = new WeakMap, U = new WeakMap, 
V = new WeakMap, H = new WeakMap, R = new WeakMap, q = new WeakMap, G = new WeakMap, 
J = new WeakMap, O = new WeakMap, Q = new WeakMap, X = new WeakMap, Y = new WeakMap, 
Z = new WeakMap, $ = new WeakMap, tt = new WeakMap, it = new WeakMap, et = new WeakMap, 
st = new WeakMap, at = new WeakMap, ot = new WeakMap, nt = new WeakMap, ht = new WeakMap, 
lt = new WeakMap, rt = new WeakMap, dt = new WeakMap;

kt.style = u;

export { kt as gx_ide_new_kb };
//# sourceMappingURL=p-76e1c357.entry.js.map