'use strict';

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

const index = require('./index-3e5ae956.js');
const getEventTypeOptions = require('./getEventTypeOptions-47c9dd2d.js');
const store = require('./store-c1e254ab.js');
require('./index-b020f7d8.js');
require('./getHandlebarsHelpers-93797155.js');
require('./_commonjsHelpers-a5111d61.js');
require('./index-ba857994.js');
require('./localforage-af1b8c0e.js');

const appTriggerListCss = "";

const AppTrigger = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.fireenjinTrigger = index.createEvent(this, "fireenjinTrigger", 7);
    this.fireenjinSubmit = index.createEvent(this, "fireenjinSubmit", 7);
    this.eventIconMap = {
      alert: "notifications",
      notion: "./assets/svg/notion.svg",
    };
    this.query = undefined;
    this.filters = [
      {
        name: "type",
        label: "Event Type",
        icon: "magnet",
        options: getEventTypeOptions.getEventTypeOptions(),
      },
    ];
  }
  onSearchInput(event) {
    this.query = event.target.value;
  }
  componentDidLoad() {
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
    // Get Data
  }
  render() {
    var _a;
    return [
      index.h("ion-content", { class: "ion-padding" }, index.h("div", { class: "ion-padding" }, index.h("fireenjin-search-bar", { ref: (el) => (this.filterBarEl = el), paginationEl: this.paginationEl, filters: this.filters }), index.h("fireenjin-pagination", { ref: (el) => (this.paginationEl = el), name: "triggers", resultsKey: "triggers", disableVirtualScroll: true, removeDuplicates: true, listEl: ({ result: trigger }) => {
          var _a, _b, _c, _d, _e, _f;
          return (index.h("ion-item", { href: `/triggers/${trigger.id}`, detail: true, lines: "full" }, index.h("ion-toggle", { slot: "start", name: "active", onClick: (event) => {
              event.preventDefault();
              event.stopPropagation();
            }, onIonChange: (event) => this.fireenjinSubmit.emit({
              endpoint: "editTrigger",
              id: trigger.id,
              data: {
                active: event.target.checked,
              },
            }), value: trigger === null || trigger === void 0 ? void 0 : trigger.id, checked: trigger === null || trigger === void 0 ? void 0 : trigger.active }), index.h("ion-grid", null, index.h("ion-row", { class: "ion-align-items-center ion-justify-content-between" }, index.h("ion-col", null, index.h("ion-label", null, index.h("h2", null, trigger.name))), index.h("ion-col", null, (trigger === null || trigger === void 0 ? void 0 : trigger.type) && (index.h("ion-chip", { outline: true, style: {
              float: "right",
              opacity: "0.6",
            } }, index.h("ion-icon", { name: "magnet" }), index.h("ion-label", null, trigger === null || trigger === void 0 ? void 0 :
            trigger.type, " \u00A0 => \u00A0", " ", trigger === null || trigger === void 0 ? void 0 :
            trigger.action), index.h("ion-icon", { name: !((_c = (_b = (_a = this.eventIconMap) === null || _a === void 0 ? void 0 : _a[trigger === null || trigger === void 0 ? void 0 : trigger.action]) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "/")) && this.eventIconMap[trigger === null || trigger === void 0 ? void 0 : trigger.action], src: ((_f = (_e = (_d = this.eventIconMap) === null || _d === void 0 ? void 0 : _d[trigger === null || trigger === void 0 ? void 0 : trigger.action]) === null || _e === void 0 ? void 0 : _e.includes) === null || _f === void 0 ? void 0 : _f.call(_e, "/")) && this.eventIconMap[trigger === null || trigger === void 0 ? void 0 : trigger.action] }))))))));
        }, display: "list", endpoint: "listTriggers", limit: 20, query: this.query }))),
      index.h("floodteam-navigation-footer", null, index.h("floodteam-title-bar", { back: "/dashboard" }, index.h("ion-breadcrumbs", null, index.h("ion-breadcrumb", { onClick: () => this.fireenjinTrigger.emit({
          name: "pin",
          payload: {
            icon: "flash",
            href: `/triggers`,
            name: "Triggers",
          },
        }) }, index.h("ion-icon", { color: ((_a = ((store.state === null || store.state === void 0 ? void 0 : store.state.pins) || [])
          .map((pin) => pin === null || pin === void 0 ? void 0 : pin.href)) === null || _a === void 0 ? void 0 : _a.includes(`/triggers`))
          ? "primary"
          : null, slot: "start", name: "pin" }), "Triggers")), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { fill: "solid", color: "primary", href: "/triggers/new" }, "Add")))),
    ];
  }
};
AppTrigger.style = appTriggerListCss;

exports.app_trigger_list = AppTrigger;
