import { r as t, c as e, g as s, h as a, H as i, a as r } 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 l } from "./p-311eedf3.js";

import { f as c } from "./p-4d330836.js";

const d = "button.button-secondary{border-color:var(--color-border-neutral-default)}:host{display:grid;block-size:100%;grid-template-rows:max-content 1fr max-content;overflow:auto}.section{display:contents}.header{justify-content:end}.tabular-grid-main{overflow:auto;block-size:100%}.tabular-grid-main ch-tabular-grid-cell:is(:nth-child(2),:nth-child(3),:nth-child(4)){align-items:start;justify-content:start;display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-inline-size:0}";

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

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

var m, f, b, p, g, w, y, v, k, j, x;

const M = [ "resets/box-sizing", "components/button", "components/edit", "components/icon", "components/radio-group", "components/tabular-grid", "utils/form", "utils/layout", "utils/spacing", "utils/typography" ];

const W = o({
  category: "gemini-tools",
  name: "add-circle",
  colorType: "primary"
});

const z = class {
  constructor(i) {
    t(this, i);
    this.componentDidLoadEvent = e(this, "componentDidLoadEvent", 7);
    this.componentDidRenderFirstTime = e(this, "componentDidRenderFirstTime", 7);
    m.set(this, void 0);
    f.set(this, false);
    b.set(this, s(`./gx-ide-assets/team-dev-update-partial-selection/shortcuts.json`));
    p.set(this, void 0);
    g.set(this, (() => {
      this.cancelCallback();
    }));
    w.set(this, (() => {
      if (this.confirmCallback) {
        const t = [];
        this.selection.forEach((e => {
          t.push(e.id);
        }));
        this.confirmCallback(t);
      }
    }));
    y.set(this, (() => {
      this.addCallback().then((t => {
        if ((t === null || t === void 0 ? void 0 : t.length) > 0) {
          this.selection = [ ...this.selection, ...t ];
          this.selectedObjectsIds = [];
        }
      }));
    }));
    v.set(this, (() => {
      h(this, p, "f").addEventListener("selectionChanged", (t => {
        this.selectedObjectsIds = t.detail.rowsId;
      }));
    }));
    k.set(this, (() => {
      this.selection = [];
    }));
    j.set(this, (() => {
      const t = this.selection.filter((t => !this.selectedObjectsIds.includes(t.id)));
      this.selection = t;
      this.selectedObjectsIds = [];
    }));
    x.set(this, (() => a("ch-tabular-grid", {
      allowColumnReorder: false,
      columnResizeMode: "single",
      class: "tabular-grid tabular-grid-main",
      "row-selection-mode": "multiple",
      keyboardNavigationMode: "focus",
      ref: t => u(this, p, t, "f"),
      part: "ch-grid-objects"
    }, a("ch-tabular-grid-columnset", {
      class: "tabular-grid-column-set"
    }, a("ch-tabular-grid-column", {
      columnName: "",
      settingable: false,
      sortable: false,
      size: n.tabularGrid.colSize.minContent,
      class: "tabular-grid-column"
    }), a("ch-tabular-grid-column", {
      columnName: h(this, m, "f").tableHead.name,
      settingable: false,
      sortable: false,
      size: "1fr",
      class: "tabular-grid-column"
    }), a("ch-tabular-grid-column", {
      columnName: h(this, m, "f").tableHead.type,
      settingable: false,
      sortable: false,
      size: "minmax(120px,auto)",
      class: "tabular-grid-column"
    }), a("ch-tabular-grid-column", {
      columnName: h(this, m, "f").tableHead.description,
      settingable: false,
      sortable: false,
      size: "minmax(120px,auto)",
      class: "tabular-grid-column"
    }), a("ch-tabular-grid-column", {
      columnName: h(this, m, "f").tableHead.modifiedOn,
      settingable: false,
      sortable: false,
      size: n.tabularGrid.colSize.maxContent,
      class: "tabular-grid-column"
    })), this.selection.map((t => a("ch-tabular-grid-row", {
      rowid: t.id,
      key: t.id,
      class: "tabular-grid-row"
    }, a("ch-tabular-grid-cell", {
      class: "tabular-grid-cell"
    }, a("ch-image", {
      src: t.typeIcon,
      class: "icon-s"
    })), a("ch-tabular-grid-cell", {
      class: "tabular-grid-cell"
    }, t.name), a("ch-tabular-grid-cell", {
      class: "tabular-grid-cell"
    }, t.type), a("ch-tabular-grid-cell", {
      class: "tabular-grid-cell"
    }, t.description), a("ch-tabular-grid-cell", {
      class: "tabular-grid-cell"
    }, `${c(t.modifiedOn)}`)))))));
    this.selectedObjectsIds = [];
    this.addCallback = undefined;
    this.cancelCallback = undefined;
    this.confirmCallback = undefined;
    this.selection = [];
  }
  componentDidLoad() {
    h(this, v, "f").call(this);
  }
  componentDidRender() {
    if (!h(this, f, "f")) {
      this.componentDidRenderFirstTime.emit(h(this, m, "f").componentName);
      u(this, f, true, "f");
    }
  }
  async componentWillLoad() {
    u(this, m, await l.getComponentStrings(this.el), "f");
    this.componentDidLoadEvent.emit(true);
  }
  /**
     * Validate necessary data input
     */  async validate() {
    const t = true;
    return t;
  }
  render() {
    const t = !(this.selectedObjectsIds.length > 0);
    return a(i, {
      class: "widget"
    }, a("ch-theme", {
      model: M
    }), a("ch-shortcuts", {
      src: h(this, b, "f")
    }), a("section", {
      class: "section"
    }, a("header", {
      class: "header field-group dialog-header header header-two-cols spacing-body-block-start spacing-body-inline"
    }, a("div", {
      class: "buttons-spacer"
    }, a("button", {
      // remove selected button
      class: "button-secondary",
      onClick: !t && h(this, j, "f"),
      part: "remove",
      disabled: t
    }, h(this, m, "f").btnRemoveSelectedObjects), a("button", {
      // add button
      class: "button-secondary button-icon-and-text",
      onClick: h(this, y, "f"),
      part: "add"
    }, a("ch-image", {
      class: "icon-m",
      src: W
    }), h(this, m, "f").btnAddObject))), h(this, x, "f").call(this), a("footer", {
      class: "dialog-footer dialog-footer-space-between spacing-body-block-end spacing-body-inline"
    }, a("button", {
      // remove all button
      class: "button-tertiary",
      onClick: h(this, k, "f"),
      disabled: !(this.selection.length > 0),
      part: "clear"
    }, h(this, m, "f").footer.btnRemoveAll), a("div", {
      class: "buttons-spacer"
    }, a("button", {
      // cancel button
      class: "button-secondary",
      onClick: h(this, g, "f"),
      part: "cancel"
    }, h(this, m, "f").footer.btnCancel), a("button", {
      // confirm button
      class: "button-primary",
      onClick: h(this, w, "f"),
      part: "confirm"
    }, h(this, m, "f").footer.btnConfirm)))));
  }
  static get assetsDirs() {
    return [ "gx-ide-assets/team-dev-update-partial-selection" ];
  }
  get el() {
    return r(this);
  }
};

m = new WeakMap, f = new WeakMap, b = new WeakMap, p = new WeakMap, g = new WeakMap, 
w = new WeakMap, y = new WeakMap, v = new WeakMap, k = new WeakMap, j = new WeakMap, 
x = new WeakMap;

z.style = d;

export { z as gx_ide_team_dev_update_partial_selection };
//# sourceMappingURL=p-34577955.entry.js.map