'use strict';

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

const index = require('./index-3e5ae956.js');
const index$1 = require('./index-24241cb6.js');
const hardwareBackButton = require('./overlays-b3b752a6.js');
const ionicGlobal = require('./ionic-global-81d6a4bb.js');
const helpers = require('./helpers-905b0d22.js');
const theme = require('./theme-b0b295c1.js');
require('./_commonjsHelpers-a5111d61.js');

const Checklist = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.ionChange = index.createEvent(this, "ionChange", 7);
    this.options = [];
    this.name = undefined;
    this.value = [];
    this.disabled = false;
  }
  render() {
    return (index.h("ion-list", null, (this.options || []).map((option) => (index.h("ion-item", null, index.h("ion-checkbox", { onIonChange: (event) => {
        var _a, _b;
        event.stopImmediatePropagation();
        if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.checked) &&
          !(this.value || []).includes(option === null || option === void 0 ? void 0 : option.value))
          this.value = [...this.value, option === null || option === void 0 ? void 0 : option.value];
        if (!((_b = event === null || event === void 0 ? void 0 : event.detail) === null || _b === void 0 ? void 0 : _b.checked) &&
          (this.value || []).includes(option === null || option === void 0 ? void 0 : option.value))
          this.value = this.value.filter((value) => (option === null || option === void 0 ? void 0 : option.value) !== value);
        this.ionChange.emit({
          value: this.value,
        });
      }, disabled: this.disabled, value: option === null || option === void 0 ? void 0 : option.value, checked: option === null || option === void 0 ? void 0 : option.checked, name: this.name, slot: "start" }), index.h("ion-label", null, (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.value) || ""))))));
  }
};

const flowCss = "fireenjin-flow .flow-controls{display:flex;justify-content:space-between}";

const Flow = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.currentIndex = 0;
    this.name = undefined;
    this.formData = {};
    this.nextButton = {
      label: "Next",
      color: "primary",
      fill: "clear",
      icon: "chevron-forward-circle-outline",
    };
    this.prevButton = {
      label: "Back",
      color: "medium",
      fill: "clear",
      icon: "chevron-back-circle-outline",
    };
    this.saveButton = {
      label: "Save",
      fill: "solid",
      color: "primary",
      icon: "checkmark-circle-outline",
    };
    this.hideControls = false;
    this.endpoint = undefined;
    this.documentId = undefined;
    this.excludeData = [];
    this.beforeSubmit = undefined;
    this.disableLoader = false;
    this.loading = false;
    this.disableEnterButton = false;
    this.confirmExit = false;
    this.hasChanged = false;
    this.method = "post";
    this.action = undefined;
    this.fetch = undefined;
    this.fetchParams = undefined;
    this.fetchDataMap = undefined;
    this.fetchKey = undefined;
    this.filterData = undefined;
    this.slidesOptions = { autoHeight: true, allowTouchMove: false };
    this.pager = false;
    this.scrollbar = false;
    this.steps = [];
    this.googleMapsKey = undefined;
    this.stripeKey = undefined;
    this.stripeElements = undefined;
    this.disableRequiredCheck = false;
    this.cacheKey = undefined;
    this.showSuccess = false;
    this.showSave = false;
  }
  async onKeydown(event) {
    if ((event === null || event === void 0 ? void 0 : event.key) !== "Enter" || this.disableEnterButton)
      return;
    this.slideNext();
  }
  async onSlideChange() {
    this.currentIndex = await this.getActiveIndex();
    this.currentStep = this.steps[this.currentIndex];
    if (this.currentIndex === this.steps.length - 1) {
      this.hideControls = true;
      this.showSave = true;
    }
    else {
      this.hideControls = false;
      this.showSave = false;
    }
    if (this.currentIndex === 0 && this.prevButton) {
      this.prevButton = Object.assign(Object.assign({}, this.prevButton), { disabled: true });
    }
    else {
      this.prevButton = Object.assign(Object.assign({}, this.prevButton), { disabled: false });
    }
  }
  onSubmit(event) {
    var _a;
    if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.endpoint) !== this.endpoint)
      return;
    this.showSuccess = false;
  }
  onSuccess(event) {
    var _a;
    if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.endpoint) !== this.endpoint)
      return;
    this.showSuccess = true;
  }
  async getActiveIndex() {
    return this.slidesEl.getActiveIndex();
  }
  async getSwiper() {
    return this.slidesEl.getSwiper();
  }
  async isBeginning() {
    return this.slidesEl.isBeginning();
  }
  async isEnd() {
    return this.slidesEl.isEnd();
  }
  async length() {
    return this.slidesEl.length();
  }
  async lockSwipeToNext(lock) {
    return this.slidesEl.lockSwipeToNext(lock);
  }
  async lockSwipeToPrev(lock) {
    return this.slidesEl.lockSwipeToPrev(lock);
  }
  async lockSwipes(lock) {
    return this.slidesEl.lockSwipes(lock);
  }
  async slideNext(speed, runCallbacks) {
    console.log(await this.checkStepValidity());
    if (!this.disableRequiredCheck && !(await this.checkStepValidity()))
      return;
    return this.slidesEl.slideNext(speed, runCallbacks);
  }
  async slidePrev(speed, runCallbacks) {
    if (this.hideControls)
      this.hideControls = false;
    return this.slidesEl.slidePrev(speed, runCallbacks);
  }
  async slideTo(index, speed, runCallbacks) {
    return this.slidesEl.slideTo(index, speed, runCallbacks);
  }
  async startAutoplay() {
    return this.slidesEl.startAutoplay();
  }
  async stopAutoplay() {
    return this.slidesEl.stopAutoplay();
  }
  async update() {
    return this.slidesEl.update();
  }
  async updateAutoHeight(speed) {
    return this.slidesEl.updateAutoHeight(speed);
  }
  async reportFormValidity() {
    this.formEl.reportFormValidity();
  }
  async setFormData(data) {
    this.formEl.setFormData(data);
  }
  async checkFormValidity(reportValidity) {
    this.formEl.checkFormValidity(reportValidity);
  }
  async reset(event) {
    this.formEl.reset(event);
    if (this.prevButton)
      this.prevButton.disabled = true;
  }
  async submit(event, options) {
    this.formEl.submit(event, options);
  }
  async checkStepValidity() {
    let response = true;
    await new Promise((resolve, reject) => {
      try {
        const requiredEls = this.flowEl.querySelectorAll(`ion-slide:nth-of-type(${this.currentIndex + 1}) [required]`);
        if (!requiredEls.length)
          resolve(true);
        (requiredEls || []).forEach((el, index) => {
          var _a;
          if ((typeof (el === null || el === void 0 ? void 0 : el.reportValidity) === "function" &&
            !(el === null || el === void 0 ? void 0 : el.reportValidity())) ||
            (typeof (el === null || el === void 0 ? void 0 : el.checkValidity) === "function" && !(el === null || el === void 0 ? void 0 : el.checkValidity())) ||
            el.value === null ||
            el.value === undefined ||
            (typeof el.value === "string" && ((_a = el.value) === null || _a === void 0 ? void 0 : _a.length) <= 0))
            response = false;
          if (index === requiredEls.length - 1)
            resolve(response);
        });
      }
      catch (e) {
        console.log(e);
        reject();
      }
    });
    return response;
  }
  componentWillLoad() {
    if (this.prevButton)
      this.prevButton.disabled = true;
  }
  renderField(field) {
    if ((field === null || field === void 0 ? void 0 : field.type) === "file") {
      return (index.h("fireenjin-input-file", { path: field === null || field === void 0 ? void 0 : field.path, icon: field === null || field === void 0 ? void 0 : field.icon, label: field === null || field === void 0 ? void 0 : field.label, fileName: field === null || field === void 0 ? void 0 : field.fileName, name: field === null || field === void 0 ? void 0 : field.name, accept: field === null || field === void 0 ? void 0 : field.accept, defaultValue: field === null || field === void 0 ? void 0 : field.defaultValue, value: field === null || field === void 0 ? void 0 : field.value, documentId: field === null || field === void 0 ? void 0 : field.documentId, endpoint: field === null || field === void 0 ? void 0 : field.endpoint, uploadData: field === null || field === void 0 ? void 0 : field.uploadData, disabled: !!(field === null || field === void 0 ? void 0 : field.disabled) }));
    }
    else if ((field === null || field === void 0 ? void 0 : field.type) === "photo") {
      return (index.h("fireenjin-input-photo", { path: field === null || field === void 0 ? void 0 : field.path, fileName: field === null || field === void 0 ? void 0 : field.fileName, name: field === null || field === void 0 ? void 0 : field.name, value: field === null || field === void 0 ? void 0 : field.value, documentId: field === null || field === void 0 ? void 0 : field.documentId, endpoint: field === null || field === void 0 ? void 0 : field.endpoint, disabled: !!(field === null || field === void 0 ? void 0 : field.disabled), fallback: field === null || field === void 0 ? void 0 : field.fallback, showButton: !!(field === null || field === void 0 ? void 0 : field.showButton), buttonText: field === null || field === void 0 ? void 0 : field.buttonText, initials: field === null || field === void 0 ? void 0 : field.initials, multiple: !!(field === null || field === void 0 ? void 0 : field.multiple), resize: !!(field === null || field === void 0 ? void 0 : field.resize), loading: !!(field === null || field === void 0 ? void 0 : field.loading) }));
    }
    else if ((field === null || field === void 0 ? void 0 : field.type) === "address") {
      return (index.h("fireenjin-input-address", { googleMapsKey: (field === null || field === void 0 ? void 0 : field.googleMapsKey) || this.googleMapsKey, placeholder: field === null || field === void 0 ? void 0 : field.placeholder, value: field === null || field === void 0 ? void 0 : field.value, label: field === null || field === void 0 ? void 0 : field.label, required: !!(field === null || field === void 0 ? void 0 : field.required), name: field === null || field === void 0 ? void 0 : field.name, lines: field === null || field === void 0 ? void 0 : field.lines, labelPosition: field === null || field === void 0 ? void 0 : field.labelPosition }));
    }
    else if ((field === null || field === void 0 ? void 0 : field.type) === "select") {
      return (index.h("fireenjin-select", { disabled: !!(field === null || field === void 0 ? void 0 : field.disabled), cancelText: field === null || field === void 0 ? void 0 : field.cancelText, okText: field === null || field === void 0 ? void 0 : field.okText, placeholder: field === null || field === void 0 ? void 0 : field.placeholder, name: field === null || field === void 0 ? void 0 : field.name, selectedText: field === null || field === void 0 ? void 0 : field.selectedText, multiple: !!(field === null || field === void 0 ? void 0 : field.multiple), interface: field === null || field === void 0 ? void 0 : field.interface, interfaceOptions: field === null || field === void 0 ? void 0 : field.interfaceOptions, compareWith: field === null || field === void 0 ? void 0 : field.compareWith, value: field === null || field === void 0 ? void 0 : field.value, icon: field === null || field === void 0 ? void 0 : field.icon, endpoint: field === null || field === void 0 ? void 0 : field.endpoint, header: field === null || field === void 0 ? void 0 : field.header, subHeader: field === null || field === void 0 ? void 0 : field.subHeader, message: field === null || field === void 0 ? void 0 : field.message, orderBy: field === null || field === void 0 ? void 0 : field.orderBy, dataPropsMap: field === null || field === void 0 ? void 0 : field.dataPropsMap, optionEl: field === null || field === void 0 ? void 0 : field.optionEl, limit: field === null || field === void 0 ? void 0 : field.limit, params: field === null || field === void 0 ? void 0 : field.params, query: field === null || field === void 0 ? void 0 : field.query, label: field === null || field === void 0 ? void 0 : field.label, options: field === null || field === void 0 ? void 0 : field.options, required: !!(field === null || field === void 0 ? void 0 : field.required), resultsKey: field === null || field === void 0 ? void 0 : field.resultsKey, labelPosition: field === null || field === void 0 ? void 0 : field.labelPosition, lines: field === null || field === void 0 ? void 0 : field.lines }));
    }
    else if ((field === null || field === void 0 ? void 0 : field.type) === "radios") {
      return (index.h("fireenjin-radios", { disabled: !!(field === null || field === void 0 ? void 0 : field.disabled), name: field === null || field === void 0 ? void 0 : field.name, value: field === null || field === void 0 ? void 0 : field.value, endpoint: field === null || field === void 0 ? void 0 : field.endpoint, orderBy: field === null || field === void 0 ? void 0 : field.orderBy, dataPropsMap: field === null || field === void 0 ? void 0 : field.dataPropsMap, optionEl: field === null || field === void 0 ? void 0 : field.optionEl, limit: field === null || field === void 0 ? void 0 : field.limit, params: field === null || field === void 0 ? void 0 : field.params, query: field === null || field === void 0 ? void 0 : field.query, label: field === null || field === void 0 ? void 0 : field.label, options: field === null || field === void 0 ? void 0 : field.options, required: !!(field === null || field === void 0 ? void 0 : field.required), resultsKey: field === null || field === void 0 ? void 0 : field.resultsKey, labelPosition: field === null || field === void 0 ? void 0 : field.labelPosition, lines: field === null || field === void 0 ? void 0 : field.lines }));
    }
    else if ((field === null || field === void 0 ? void 0 : field.type) === "search") {
      return (index.h("fireenjin-input-search", { name: field === null || field === void 0 ? void 0 : field.name, label: field === null || field === void 0 ? void 0 : field.label, placeholder: field === null || field === void 0 ? void 0 : field.placeholder, value: field === null || field === void 0 ? void 0 : field.value, required: !!(field === null || field === void 0 ? void 0 : field.required), autofocus: !!(field === null || field === void 0 ? void 0 : field.autofocus), disabled: !!(field === null || field === void 0 ? void 0 : field.disabled), endpoint: field === null || field === void 0 ? void 0 : field.endpoint, dataPropsMap: field === null || field === void 0 ? void 0 : field.dataPropsMap, template: field === null || field === void 0 ? void 0 : field.template, searchParams: field === null || field === void 0 ? void 0 : field.searchParams, iconEnd: field === null || field === void 0 ? void 0 : field.iconRight, iconStart: field === null || field === void 0 ? void 0 : field.iconLeft, results: field === null || field === void 0 ? void 0 : field.results, resultsKey: field === null || field === void 0 ? void 0 : field.resultsKey, lines: field === null || field === void 0 ? void 0 : field.lines, labelPosition: field === null || field === void 0 ? void 0 : field.labelPosition }));
    }
    else if ((field === null || field === void 0 ? void 0 : field.type) === "checklist") {
      return (index.h("fireenjin-checklist", { name: field === null || field === void 0 ? void 0 : field.name, value: field === null || field === void 0 ? void 0 : field.value, options: (field === null || field === void 0 ? void 0 : field.options) || [], disabled: field === null || field === void 0 ? void 0 : field.disabled }));
    }
    else {
      return (index.h("fireenjin-input", { type: (field === null || field === void 0 ? void 0 : field.type) || "text", stripeKey: (field === null || field === void 0 ? void 0 : field.stripeKey) || this.stripeKey, placeholder: field === null || field === void 0 ? void 0 : field.placeholder, label: field === null || field === void 0 ? void 0 : field.label, value: field === null || field === void 0 ? void 0 : field.value, required: !!(field === null || field === void 0 ? void 0 : field.required), name: field === null || field === void 0 ? void 0 : field.name, autocomplete: field === null || field === void 0 ? void 0 : field.autocomplete, autocapitalize: field === null || field === void 0 ? void 0 : field.autocapitalize, autocorrect: field === null || field === void 0 ? void 0 : field.autocorrect, autofocus: field === null || field === void 0 ? void 0 : field.autofocus, minlength: field === null || field === void 0 ? void 0 : field.minlength, maxlength: field === null || field === void 0 ? void 0 : field.maxlength, disabled: !!(field === null || field === void 0 ? void 0 : field.disabled), info: field === null || field === void 0 ? void 0 : field.info, edit: !!(field === null || field === void 0 ? void 0 : field.edit), min: field === null || field === void 0 ? void 0 : field.min, max: field === null || field === void 0 ? void 0 : field.max, iconLeft: field === null || field === void 0 ? void 0 : field.iconLeft, iconRight: field === null || field === void 0 ? void 0 : field.iconRight, silence: field === null || field === void 0 ? void 0 : field.silence, step: field === null || field === void 0 ? void 0 : field.step, actionOptions: field === null || field === void 0 ? void 0 : field.actionOptions, pattern: field === null || field === void 0 ? void 0 : field.pattern, clearInput: field === null || field === void 0 ? void 0 : field.clearInput, multiple: !!(field === null || field === void 0 ? void 0 : field.multiple), readOnly: !!(field === null || field === void 0 ? void 0 : field.readOnly), spellCheck: !!(field === null || field === void 0 ? void 0 : field.spellCheck), inputMode: field === null || field === void 0 ? void 0 : field.inputMode, stripeElements: (field === null || field === void 0 ? void 0 : field.stripeElements) || this.stripeElements, lines: field === null || field === void 0 ? void 0 : field.lines, labelPosition: field === null || field === void 0 ? void 0 : field.labelPosition }));
    }
  }
  render() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
    return (index.h("fireenjin-form", { ref: (el) => (this.formEl = el), name: this.name, formData: this.formData, submitButton: null, resetButton: null, documentId: this.documentId, endpoint: this.endpoint, hideControls: this.hideControls, filterData: this.filterData, beforeSubmit: this.beforeSubmit, disableLoader: this.disableLoader, loading: this.loading, disableEnterButton: true, confirmExit: this.confirmExit, hasChanged: this.hasChanged, method: this.method, action: this.action, fetch: this.fetch, fetchParams: this.fetchParams, fetchDataMap: this.fetchDataMap, fetchKey: this.fetchKey, cacheKey: this.cacheKey }, index.h("ion-slides", { ref: (el) => (this.slidesEl = el), pager: this.pager, options: this.slidesOptions, scrollbar: this.scrollbar, style: {
        transition: "all ease 0.5s",
        height: !this.showSuccess ? "auto" : "0",
        opacity: !this.showSuccess ? "1" : "0",
      } }, (this.steps || []).map((step) => {
      const StepComponent = (step === null || step === void 0 ? void 0 : step.component) || null;
      return (index.h("ion-slide", null, index.h("div", null, (step === null || step === void 0 ? void 0 : step.beforeHTML) && index.h("div", { innerHTML: step.beforeHTML }), StepComponent && (index.h(StepComponent, Object.assign({}, ((step === null || step === void 0 ? void 0 : step.componentProps) || {})))), ((step === null || step === void 0 ? void 0 : step.fields) || []).map((field) => [
        (field === null || field === void 0 ? void 0 : field.beforeHTML) && index.h("div", { innerHTML: field.beforeHTML }),
        this.renderField(field),
        (field === null || field === void 0 ? void 0 : field.afterHTML) && index.h("div", { innerHTML: field.afterHTML }),
      ])), (step === null || step === void 0 ? void 0 : step.afterHTML) && index.h("div", { innerHTML: step.afterHTML })));
    })), index.h("div", { class: "flow-controls control-pager", style: {
        display: this.hideControls ? "none" : "flex",
      } }, index.h("ion-button", { expand: (_a = this.prevButton) === null || _a === void 0 ? void 0 : _a.expand, disabled: !!((_b = this.prevButton) === null || _b === void 0 ? void 0 : _b.disabled), color: (_c = this.prevButton) === null || _c === void 0 ? void 0 : _c.color, fill: (_d = this.prevButton) === null || _d === void 0 ? void 0 : _d.fill, size: (_e = this.prevButton) === null || _e === void 0 ? void 0 : _e.size, onClick: (event) => {
        var _a;
        return typeof ((_a = this.prevButton) === null || _a === void 0 ? void 0 : _a.onClick) === "function"
          ? this.prevButton.onClick(event)
          : this.slidePrev();
      } }, ((_f = this.prevButton) === null || _f === void 0 ? void 0 : _f.icon) && (index.h("ion-icon", { slot: ((_g = this.prevButton) === null || _g === void 0 ? void 0 : _g.iconSlot) || "start", name: this.prevButton.icon })), ((_h = this.prevButton) === null || _h === void 0 ? void 0 : _h.label) && (index.h("ion-label", null, this.prevButton.label))), index.h("ion-button", { expand: (_j = this.nextButton) === null || _j === void 0 ? void 0 : _j.expand, disabled: !!((_k = this.nextButton) === null || _k === void 0 ? void 0 : _k.disabled), color: (_l = this.nextButton) === null || _l === void 0 ? void 0 : _l.color, fill: (_m = this.nextButton) === null || _m === void 0 ? void 0 : _m.fill, size: (_o = this.nextButton) === null || _o === void 0 ? void 0 : _o.size, onClick: (event) => {
        var _a;
        return typeof ((_a = this.nextButton) === null || _a === void 0 ? void 0 : _a.onClick) === "function"
          ? this.nextButton.onClick(event)
          : this.slideNext();
      } }, ((_p = this.nextButton) === null || _p === void 0 ? void 0 : _p.icon) && (index.h("ion-icon", { slot: ((_q = this.nextButton) === null || _q === void 0 ? void 0 : _q.iconSlot) || "end", name: this.nextButton.icon })), ((_r = this.nextButton) === null || _r === void 0 ? void 0 : _r.label) && (index.h("ion-label", null, this.nextButton.label)))), index.h("div", { class: "flow-controls control-confirmation", style: {
        display: this.showSave && !this.showSuccess ? "flex" : "none",
      } }, index.h("ion-button", { expand: (_s = this.prevButton) === null || _s === void 0 ? void 0 : _s.expand, disabled: !!((_t = this.prevButton) === null || _t === void 0 ? void 0 : _t.disabled), color: (_u = this.prevButton) === null || _u === void 0 ? void 0 : _u.color, fill: (_v = this.prevButton) === null || _v === void 0 ? void 0 : _v.fill, onClick: (event) => {
        var _a;
        return typeof ((_a = this.prevButton) === null || _a === void 0 ? void 0 : _a.onClick) === "function"
          ? this.prevButton.onClick(event)
          : this.slidePrev();
      } }, ((_w = this.prevButton) === null || _w === void 0 ? void 0 : _w.icon) && (index.h("ion-icon", { slot: ((_x = this.prevButton) === null || _x === void 0 ? void 0 : _x.iconSlot) || "start", name: this.prevButton.icon })), ((_y = this.prevButton) === null || _y === void 0 ? void 0 : _y.label) && (index.h("ion-label", null, this.prevButton.label))), index.h("ion-button", { expand: (_z = this.saveButton) === null || _z === void 0 ? void 0 : _z.expand, disabled: !!((_0 = this.saveButton) === null || _0 === void 0 ? void 0 : _0.disabled), color: (_1 = this.saveButton) === null || _1 === void 0 ? void 0 : _1.color, fill: (_2 = this.saveButton) === null || _2 === void 0 ? void 0 : _2.fill, type: "submit", size: (_3 = this.saveButton) === null || _3 === void 0 ? void 0 : _3.size, onClick: (event) => {
        var _a;
        return typeof ((_a = this.saveButton) === null || _a === void 0 ? void 0 : _a.onClick) === "function"
          ? this.saveButton.onClick(event)
          : null;
      } }, ((_4 = this.saveButton) === null || _4 === void 0 ? void 0 : _4.icon) && (index.h("ion-icon", { slot: ((_5 = this.saveButton) === null || _5 === void 0 ? void 0 : _5.iconSlot) || "end", name: this.saveButton.icon })), ((_6 = this.saveButton) === null || _6 === void 0 ? void 0 : _6.label) && (index.h("ion-label", null, this.saveButton.label)))), index.h("div", { class: "flow-success", style: {
        transition: "all ease 0.5s",
        height: this.showSuccess ? "auto" : "0",
        opacity: this.showSuccess ? "1" : "0",
      } }, index.h("slot", null))));
  }
  get flowEl() { return index.getElement(this); }
};
Flow.style = flowCss;

const inputFileCss = "fireenjin-input-file ion-card{width:95%;margin:15px auto;background-color:var(--ion-color-light-tint);--background-color:var(--ion-color-light-tint);padding:0}fireenjin-input-file ion-card.drag-over{opacity:0.8}fireenjin-input-file ion-card ion-item{padding:5px 0;background-color:var(--ion-color-light-tint);--ion-color-base:var(--ion-color-light-tint);--background:var(--ion-color-light-tint);pointer-events:none}fireenjin-input-file ion-card ion-item ion-icon{height:50px;width:50px;color:var(--ion-color-medium)}fireenjin-input-file ion-card ion-item h2{font-size:20px;color:var(--ion-color-dark);margin:0}fireenjin-input-file ion-card ion-item p{color:var(--ion-color-darker-grey);margin:0}fireenjin-input-file ion-card:hover{cursor:pointer}fireenjin-input-file ion-card:hover h2{color:var(--ion-color-primary)}fireenjin-input-file ion-card:hover ion-icon{color:var(--ion-color-primary)}fireenjin-input-file input{float:left;height:0;width:0;visibility:hidden}";

const InputFile = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.fireenjinUpload = index.createEvent(this, "fireenjinUpload", 7);
    this.ionInput = index.createEvent(this, "ionInput", 7);
    this.path = undefined;
    this.icon = undefined;
    this.label = undefined;
    this.fileName = undefined;
    this.name = undefined;
    this.accept = undefined;
    this.defaultValue = undefined;
    this.value = undefined;
    this.type = "file";
    this.documentId = undefined;
    this.disabled = false;
    this.endpoint = "upload";
    this.uploadData = {};
    this.isLoading = undefined;
    this.fileUrl = undefined;
    this.selectedFile = undefined;
    this.dragOver = false;
  }
  onFileChange() {
    if (!this.value)
      return false;
    this.ionInput.emit({
      name: this.name,
      value: this.value,
    });
  }
  async openFile() {
    const fileInputEl = this.fileUploaderEl.querySelector('input[type="file"]');
    fileInputEl.click();
    return fileInputEl;
  }
  uploadFile(file) {
    this.isLoading = true;
    if (!window.FileReader)
      return;
    const reader = new FileReader();
    reader.onload = async (event) => {
      if (event.target.readyState != 2)
        return;
      if (event.target.error) {
        alert("Error while reading file");
        return;
      }
      this.fireenjinUpload.emit({
        event,
        name: this.name,
        endpoint: this.endpoint,
        data: Object.assign({
          id: this.documentId,
          type: this.type,
          fileName: this.fileName,
          file,
          path: this.path,
          encodedContent: event.target.result,
        }, this.uploadData),
      });
    };
    reader.readAsDataURL(file);
  }
  selectFile(event) {
    this.isLoading = true;
    const file = event.target.files[0];
    this.selectedFile = file.name;
    this.uploadFile(file);
  }
  onDrop(event) {
    event.preventDefault();
    if (event.dataTransfer.items) {
      // Use DataTransferItemList interface to access the file(s)
      for (var i = 0; i < event.dataTransfer.items.length; i++) {
        // If dropped items aren't files, reject them
        if (event.dataTransfer.items[i].kind === "file") {
          var file = event.dataTransfer.items[i].getAsFile();
          this.selectedFile = file.name;
          this.uploadFile(file);
        }
      }
    }
    else {
      // Use DataTransfer interface to access the file(s)
      for (var i = 0; i < event.dataTransfer.files.length; i++) {
        const file = event.dataTransfer.files[i];
        this.selectedFile = file.name;
        this.uploadFile(file);
        console.log("... file[" + i + "].name = " + file.name);
      }
    }
    this.dragOver = false;
  }
  onDrag(event) {
    event.preventDefault();
  }
  onDragOver(event) {
    event.preventDefault();
  }
  onDragEnter(event) {
    console.log("Show UI to drop file", event);
    this.dragOver = true;
  }
  onDragLeave(event) {
    console.log("Hide UI to drop file", event);
    this.dragOver = false;
  }
  render() {
    return (index.h("ion-card", { disabled: this.disabled, class: { "drag-over": this.dragOver }, onDragEnter: (event) => this.onDragEnter(event), onDragOver: (event) => this.onDragOver(event), onDrag: (event) => this.onDrag(event), onDrop: (event) => this.onDrop(event), onDragLeave: (event) => this.onDragLeave(event), onClick: () => this.openFile() }, index.h("ion-item", { lines: "none" }, index.h("ion-icon", { name: this.icon ? this.icon : "document", slot: "start" }), index.h("div", null, index.h("h2", null, this.dragOver
      ? "Drop File Here"
      : this.label
        ? this.label
        : "Upload a File"), index.h("p", null, this.selectedFile
      ? this.selectedFile
      : this.defaultValue
        ? this.defaultValue
        : "Select a letterhead"))), index.h("input", { disabled: this.disabled, type: "file", onChange: (event) => this.selectFile(event), accept: this.accept ? this.accept : null, value: "blah" })));
  }
  get fileUploaderEl() { return index.getElement(this); }
  static get watchers() { return {
    "value": ["onFileChange"]
  }; }
};
InputFile.style = inputFileCss;

/**
 * Get the value from an object using a dot notation string.
 *
 * @param obj The object you are searching through
 * @param path The dot noation path to the value
 * @returns The value of the path in the object
 */
function pathToValue(obj, path) {
  return path.split(".").reduce((o, i) => o[i], obj);
}

const inputSearchCss = "fireenjin-input-search .search-input ion-label{color:var(--ion-color-medium) !important;font-size:12px;font-weight:bold;text-transform:uppercase;font-family:arial;display:block;background:transparent;text-align:left;padding:0 0 8px 0;font-family:var(--ion-font-family)}fireenjin-input-search ion-icon{color:var(--ion-text-color)}fireenjin-input-search .search-input ion-icon[slot=\"start\"]{margin-right:5px}fireenjin-input-search .search-input [slot=\"end\"]{margin-left:5px}fireenjin-input-search .invalid{--border-color:var(--ion-color-danger) !important}fireenjin-input-search .invalid ion-label{color:var(--ion-color-danger) !important}fireenjin-input-search .valid{--border-color:var(--ion-color-success) !important}fireenjin-input-search .valid ion-label{color:var(--ion-color-success) !important}";

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const InputSearch = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.ionInput = index.createEvent(this, "ionInput", 7);
    this.fireenjinFetch = index.createEvent(this, "fireenjinFetch", 7);
    this.name = undefined;
    this.label = undefined;
    this.placeholder = undefined;
    this.value = undefined;
    this.required = false;
    this.autofocus = undefined;
    this.disabled = undefined;
    this.endpoint = undefined;
    this.dataPropsMap = undefined;
    this.template = undefined;
    this.type = "text";
    this.searchParams = {};
    this.disableSearch = false;
    this.mode = "popover";
    this.iconEnd = undefined;
    this.iconStart = undefined;
    this.results = [];
    this.resultsKey = undefined;
    this.lines = undefined;
    this.labelPosition = undefined;
  }
  async checkValidity(options) {
    if (this.required || (options && options.setValidationClass)) {
      await this.setValidationClass(options && options.validationClassOptions
        ? options.validationClassOptions
        : null);
    }
    return this.inputEl
      ? await (await this.inputEl.getInputElement()).checkValidity()
      : true;
  }
  async reportValidity() {
    const isValid = this.inputEl
      ? await (await this.inputEl.getInputElement()).reportValidity()
      : true;
    this.inputEl.classList[isValid ? "remove" : "add"]("invalid");
    await this.setValidationClass();
    return isValid;
  }
  async onBlur() {
    const isValid = await this.checkValidity();
    this.inputEl.classList[isValid ? "remove" : "add"]("invalid");
    await this.setValidationClass();
  }
  async onSuccess(event) {
    var _a, _b;
    if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.endpoint) !== this.endpoint || !((_b = event === null || event === void 0 ? void 0 : event.detail) === null || _b === void 0 ? void 0 : _b.data))
      return;
    this.results = await pathToValue(event.detail.data, this.resultsKey ? this.resultsKey : "searchUsers.results");
    if (this.mode === "popover") {
      this.resultsPopover = await hardwareBackButton.popoverController.create({
        translucent: true,
        showBackdrop: false,
        event: event.detail.event,
        component: "fireenjin-input-search-popover",
        componentProps: {
          results: this.results,
          template: this.template,
        },
      });
      this.resultsPopover.present();
    }
  }
  onInput(event) {
    var _a, _b;
    if (this.disableSearch || ((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length) <= 1)
      return;
    this.fireenjinFetch.emit({
      event,
      endpoint: this.endpoint,
      params: {
        data: Object.assign({ query: event.target.value }, this.searchParams),
      },
      dataPropsMap: this.dataPropsMap,
    });
  }
  async clearResults() {
    return (this.results = []);
  }
  async closePopover() {
    return this.resultsPopover.dismiss();
  }
  async openPopover() {
    return this.resultsPopover.present();
  }
  async setValidationClass(options) {
    const classList = Object.values(this.itemEl.classList);
    if (classList.indexOf("invalid") >= 0) {
      this.itemEl.classList.remove("invalid");
    }
    if (classList.indexOf("valid") >= 0) {
      this.itemEl.classList.remove("valid");
    }
    const isValid = await (await this.inputEl.getInputElement()).checkValidity();
    if (!options ||
      !options.ignoreInvalid ||
      (options && options.ignoreInvalid && isValid)) {
      this.itemEl.classList.add(isValid ? "valid" : "invalid");
    }
  }
  render() {
    var _a;
    return [
      index.h("ion-item", { lines: this.lines, class: "search-input", ref: (el) => (this.itemEl = el), onClick: (event) => this.onInput(event) }, index.h("slot", { name: "start" }), this.iconStart && index.h("ion-icon", { name: this.iconStart, slot: "start" }), this.label && (index.h("ion-label", { position: this.labelPosition }, this.label)), index.h("ion-input", { onInput: (event) => this.onInput(event), ref: (el) => (this.inputEl = el), disabled: this.disabled, type: this.type, name: this.name, placeholder: this.placeholder, required: this.required, autofocus: this.autofocus, value: this.value }), this.iconEnd && index.h("ion-icon", { name: this.iconEnd, slot: "end" }), index.h("slot", { name: "end" })),
      this.mode === "inline" && ((_a = this.results) === null || _a === void 0 ? void 0 : _a.length)
        ? this.results.map((result) => this.template(result))
        : null,
    ];
  }
};
__decorate([
  index$1.Debounce(1000)
], InputSearch.prototype, "onInput", null);
InputSearch.style = inputSearchCss;

const radiosCss = "";

const Radios = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.fireenjinFetch = index.createEvent(this, "fireenjinFetch", 7);
    this.label = undefined;
    this.value = undefined;
    this.required = false;
    this.pattern = undefined;
    this.options = undefined;
    this.name = undefined;
    this.disabled = false;
    this.allowEmptySelection = false;
    this.lines = "none";
    this.labelPosition = "stacked";
    this.endpoint = undefined;
    this.orderBy = undefined;
    this.dataPropsMap = undefined;
    this.optionEl = undefined;
    this.limit = 15;
    this.params = undefined;
    this.query = undefined;
    this.resultsKey = undefined;
    this.radioSlot = "start";
    this.color = undefined;
    this.mode = undefined;
    this.results = [];
  }
  onChange(event) {
    var _a, _b;
    if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.name) !== this.name)
      return;
    this.value = ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.value) || null;
  }
  onSuccess(event) {
    var _a, _b, _c;
    if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.name) !== "radios" ||
      event.detail.endpoint !== this.endpoint)
      return;
    this.results = ((_c = (_b = event === null || event === void 0 ? void 0 : event.detail) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.results)
      ? event.detail.data.results
      : [];
    setTimeout(() => {
      this.value = this.value;
    }, 200);
  }
  fetchData() {
    if (!this.endpoint)
      return;
    this.fireenjinFetch.emit({
      name: "radios",
      endpoint: this.endpoint,
      dataPropsMap: this.dataPropsMap
        ? this.dataPropsMap
        : this.resultsKey
          ? { [this.resultsKey]: "results" }
          : null,
      params: Object.assign({ data: Object.assign(Object.assign(Object.assign({}, (this.query ? { query: this.query } : {})), (this.orderBy ? { orderBy: this.orderBy } : {})), { limit: this.limit ? this.limit : 15 }) }, (this.params ? this.params : {})),
    });
  }
  componentWillLoad() {
    this.fetchData();
  }
  render() {
    return (index.h("ion-list", null, index.h("ion-radio-group", { name: this.name, value: this.value, allowEmptySelection: this.allowEmptySelection }, index.h("ion-list-header", null, this.label), (this.options ? this.options : []).map((option) => this.optionEl ? (this.optionEl(option)) : (index.h("ion-item", { lines: this.lines }, index.h("ion-label", null, (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.value)), index.h("ion-radio", { mode: this.mode, color: (option === null || option === void 0 ? void 0 : option.color) || this.color, disabled: this.disabled || option.disabled, slot: (option === null || option === void 0 ? void 0 : option.slot) || this.radioSlot, value: (option === null || option === void 0 ? void 0 : option.value) || null })))), (this.results ? this.results : []).map((result) => this.optionEl ? (this.optionEl(result)) : (index.h("ion-item", { lines: this.lines }, index.h("ion-label", { position: this.labelPosition }, (result === null || result === void 0 ? void 0 : result.label) || (result === null || result === void 0 ? void 0 : result.name) || (result === null || result === void 0 ? void 0 : result.value) || (result === null || result === void 0 ? void 0 : result.id)), index.h("ion-radio", { mode: this.mode, color: (result === null || result === void 0 ? void 0 : result.color) || this.color, disabled: this.disabled || (result === null || result === void 0 ? void 0 : result.disabled), slot: (result === null || result === void 0 ? void 0 : result.slot) || this.radioSlot, value: (result === null || result === void 0 ? void 0 : result.value) || (result === null || result === void 0 ? void 0 : result.id) || null }))))), index.h("input", { style: {
        opacity: "0",
        height: "0",
        width: "0",
        float: "left",
        margin: "0",
        padding: "0",
      }, type: "text", pattern: this.pattern, value: this.value, required: this.required })));
  }
};
Radios.style = radiosCss;

const progressBarIosCss = ":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:3px}";

const progressBarMdCss = ":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:4px}";

const ProgressBar = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    /**
     * The state of the progress bar, based on if the time the process takes is known or not.
     * Default options are: `"determinate"` (no animation), `"indeterminate"` (animate from left to right).
     */
    this.type = 'determinate';
    /**
     * If true, reverse the progress bar direction.
     */
    this.reversed = false;
    /**
     * The value determines how much of the active bar should display when the
     * `type` is `"determinate"`.
     * The value should be between [0, 1].
     */
    this.value = 0;
    /**
     * If the buffer and value are smaller than 1, the buffer circles will show.
     * The buffer should be between [0, 1].
     */
    this.buffer = 1;
  }
  render() {
    const { color, type, reversed, value, buffer } = this;
    const paused = ionicGlobal.config.getBoolean('_testing');
    const mode = ionicGlobal.getIonMode(this);
    return (index.h(index.Host, { role: "progressbar", "aria-valuenow": type === 'determinate' ? value : null, "aria-valuemin": "0", "aria-valuemax": "1", class: theme.createColorClasses(color, {
        [mode]: true,
        [`progress-bar-${type}`]: true,
        'progress-paused': paused,
        'progress-bar-reversed': document.dir === 'rtl' ? !reversed : reversed,
      }) }, type === 'indeterminate' ? renderIndeterminate() : renderProgress(value, buffer)));
  }
};
const renderIndeterminate = () => {
  return (index.h("div", { part: "track", class: "progress-buffer-bar" }, index.h("div", { class: "indeterminate-bar-primary" }, index.h("span", { part: "progress", class: "progress-indeterminate" })), index.h("div", { class: "indeterminate-bar-secondary" }, index.h("span", { part: "progress", class: "progress-indeterminate" }))));
};
const renderProgress = (value, buffer) => {
  const finalValue = helpers.clamp(0, value, 1);
  const finalBuffer = helpers.clamp(0, buffer, 1);
  return [
    index.h("div", { part: "progress", class: "progress", style: { transform: `scaleX(${finalValue})` } }),
    /**
     * Buffer circles with two container to move
     * the circles behind the buffer progress
     * with respecting the animation.
     * When finalBuffer === 1, we use display: none
     * instead of removing the element to avoid flickering.
     */
    index.h("div", { class: { 'buffer-circles-container': true, 'ion-hide': finalBuffer === 1 }, style: { transform: `translateX(${finalBuffer * 100}%)` } }, index.h("div", { class: "buffer-circles-container", style: { transform: `translateX(-${finalBuffer * 100}%)` } }, index.h("div", { part: "stream", class: "buffer-circles" }))),
    index.h("div", { part: "track", class: "progress-buffer-bar", style: { transform: `scaleX(${finalBuffer})` } }),
  ];
};
ProgressBar.style = {
  ios: progressBarIosCss,
  md: progressBarMdCss
};

exports.fireenjin_checklist = Checklist;
exports.fireenjin_flow = Flow;
exports.fireenjin_input_file = InputFile;
exports.fireenjin_input_search = InputSearch;
exports.fireenjin_radios = Radios;
exports.ion_progress_bar = ProgressBar;
