'use strict';

var core = require('@vue-layout/core');
var vue = require('vue');

function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    enumerableOnly && (symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    })), keys.push.apply(keys, symbols);
  }
  return keys;
}
function _objectSpread2(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = null != arguments[i] ? arguments[i] : {};
    i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
      _defineProperty(target, key, source[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
    });
  }
  return target;
}
function _typeof(obj) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
    return typeof obj;
  } : function (obj) {
    return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  }, _typeof(obj);
}
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
  if (!o) return;
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor) n = o.constructor.name;
  if (n === "Map" || n === "Set") return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length) len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  return arr2;
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function buildFormBaseOptions(options, component, defaults) {
  var _defaults$label;
  defaults = defaults || {};
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(component),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    "class": buildOrFail({
      key: 'class',
      value: options["class"],
      alt: defaults["class"] || ''
    }),
    props: buildOrFail({
      key: 'props',
      value: options.props,
      alt: defaults.props || {}
    }),
    label: buildOrFail({
      key: 'label',
      value: options.label,
      alt: (_defaults$label = defaults.label) !== null && _defaults$label !== void 0 ? _defaults$label : true
    }),
    labelClass: buildOrFail({
      key: 'labelClass',
      value: options.labelClass,
      alt: defaults.labelClass || ''
    }),
    labelContent: buildOrFail({
      key: 'labelContent',
      value: options.labelContent,
      alt: defaults.labelContent || 'Input'
    }),
    validationMessages: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.validationMessages), {}),
    validationResult: options.validationResult || {}
  });
}
function handleFormValueChanged(options, value) {
  if (typeof options.value !== 'undefined') {
    core.setMaybeRefValue(options.value, value);
  }
  if (options.onChange) {
    options.onChange.call(null, value);
  }
  return options;
}

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

exports.Component = void 0;
(function (Component) {
  Component["Pagination"] = "pagination";
  Component["ValidationGroup"] = "validationGroup";
  Component["FormInput"] = "formInput";
  Component["FormInputCheckbox"] = "formInputCheckbox";
  Component["FormInputText"] = "formInputText";
  Component["FormSelect"] = "formSelect";
  Component["FormSubmit"] = "formSubmit";
  Component["FormTextarea"] = "formTextarea";
  Component["ItemActionToggle"] = "itemActionToggle";
  Component["List"] = "list";
  Component["ListActionRefresh"] = "listActionRefresh";
  Component["ListHeader"] = "listHeader";
  Component["ListItem"] = "listItem";
  Component["ListItems"] = "listItems";
  Component["ListNoMore"] = "listNoMore";
  Component["ListPagination"] = "listPagination";
  Component["ListSearch"] = "listSearch";
  Component["ListTitle"] = "listTitle";
})(exports.Component || (exports.Component = {}));
exports.SlotName = void 0;
(function (SlotName) {
  SlotName["HEADER"] = "header";
  SlotName["HEADER_TITLE"] = "header-title";
  SlotName["HEADER_ACTIONS"] = "header-actions";
  SlotName["ITEMS"] = "items";
  SlotName["ITEMS_NO_MORE"] = "no-more";
  SlotName["ITEM"] = "item";
  SlotName["ITEM_ACTIONS"] = "item-actions";
  SlotName["ITEM_ACTIONS_EXTRA"] = "item-actions-extra";
})(exports.SlotName || (exports.SlotName = {}));

function isValidationRuleResultWithoutParams(input) {
  return _typeof(input) === 'object' && core.hasOwnProperty(input, '$message') && core.hasOwnProperty(input, '$pending') && core.hasOwnProperty(input, '$invalid') && core.hasOwnProperty(input, '$response');
}
function isValidationRuleResultWithParams(input) {
  return isValidationRuleResultWithoutParams(input) && core.hasOwnProperty(input, '$params');
}

function buildValidationGroupOptions(options) {
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.ValidationGroup),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    "class": buildOrFail({
      key: 'class',
      alt: []
    }),
    props: buildOrFail({
      key: 'props',
      value: vue.unref(options.props),
      alt: {}
    }),
    errorClass: buildOrFail({
      key: 'errorClass',
      alt: []
    }),
    warningClass: buildOrFail({
      key: 'warningClass',
      alt: []
    }),
    validationResult: options.validationResult || {}
  });
}
function buildValidationGroup(input) {
  var options = buildValidationGroupOptions(input);
  var translate = function translate(validator, properties) {
    if (options.validationMessages && Object.prototype.hasOwnProperty.call(options.validationMessages, validator)) {
      return options.validationMessages[validator];
    }
    if (typeof options.validationTranslator !== 'undefined') {
      var translation = options.validationTranslator(validator, properties || {});
      if (typeof translation === 'string' && translation !== validator) {
        return translation;
      }
    }
    return "The ".concat(validator, " operator condition is not fulfilled.");
  };
  var invalid = !!options.validationResult && !!options.validationResult.$dirty && !!options.validationResult.$invalid;
  var errors = [];
  var keys = Object.keys(options.validationResult);
  for (var i = 0; i < keys.length; i++) {
    if (options.validationResult[keys[i]].$invalid) {
      if (isValidationRuleResultWithParams(options.validationResult[keys[i]])) {
        errors.push(translate(keys[i], options.validationResult[keys[i]].$params));
      } else if (isValidationRuleResultWithoutParams(options.validationResult[keys[i]])) {
        errors.push(translate(keys[i]));
      }
    }
  }
  var renderChildren = function renderChildren() {
    var children = [];
    if (typeof options.content === 'function') {
      children.push(options.content({
        errors: errors,
        invalid: invalid
      }));
    } else {
      children.push(options.content);
    }
    children.push(errors.map(function (error) {
      return vue.h('div', {
        "class": 'form-group-hint group-required'
      }, [error]);
    }));
    return children;
  };
  return vue.h('div', _objectSpread2({
    "class": [options["class"]].concat(_toConsumableArray(options.validationResult.$invalid && options.validationResult.$dirty ? [options.errorClass] : []), _toConsumableArray(options.validationResult.$invalid && !options.validationResult.$dirty ? [options.warningClass] : []))
  }, options.props), renderChildren());
}

function buildFormInputOptions(input, component) {
  component = component || exports.Component.FormInput;
  var options = buildFormBaseOptions(input, component);
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(component),
    build = _createOptionValueBui.build,
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    type: buildOrFail({
      key: 'type',
      value: vue.unref(options.type),
      alt: 'text'
    }),
    groupClass: buildOrFail({
      key: 'groupClass',
      value: vue.unref(options.groupClass),
      alt: []
    }),
    groupAppend: buildOrFail({
      key: 'groupAppend',
      value: vue.unref(options.groupAppend),
      alt: false
    }),
    groupAppendClass: build({
      key: 'groupAppendClass',
      value: vue.unref(options.groupAppendClass),
      alt: ''
    }),
    groupAppendContent: build({
      key: 'groupAppendContent',
      value: vue.unref(options.groupAppendContent),
      alt: ''
    }),
    groupPrepend: buildOrFail({
      key: 'groupPrepend',
      value: vue.unref(options.groupPrepend),
      alt: false
    }),
    groupPrependClass: build({
      key: 'groupPrependClass',
      value: vue.unref(options.groupPrependClass),
      alt: ''
    }),
    groupPrependContent: build({
      key: 'groupPrependContent',
      value: vue.unref(options.groupPrependContent),
      alt: ''
    })
  });
}
function buildFormInput(input) {
  var options = buildFormInputOptions(input);
  return buildFormInputFromOptions(options);
}
function buildFormInputFromOptions(options) {
  var children = [];
  if (options.label) {
    children.push(vue.h('label', {
      "class": options.labelClass
    }, [options.labelContent]));
  }
  var inputGroupChildren = [];
  if (options.groupPrepend) {
    inputGroupChildren.push(vue.h('span', {
      "class": options.groupPrependClass
    }, [options.groupPrependContent]));
  }
  var rawValue = vue.unref(options.value);
  inputGroupChildren.push(vue.h('input', vue.mergeProps(_objectSpread2({
    type: options.type,
    "class": options["class"],
    onInput: function onInput($event) {
      if ($event.target.composing) {
        return;
      }
      handleFormValueChanged(options, $event.target.value);
    }
  }, typeof rawValue !== 'undefined' ? {
    value: rawValue
  } : {}), options.props)));
  if (options.groupAppend) {
    inputGroupChildren.push(vue.h('span', {
      "class": options.groupAppendClass
    }, [options.groupAppendContent]));
  }
  children.push(vue.h('div', {
    "class": options.groupClass
  }, inputGroupChildren));
  return buildValidationGroup({
    content: children,
    validationResult: options.validationResult,
    validationMessages: options.validationMessages,
    validationTranslator: options.validationTranslator
  });
}

function buildFormInputCheckboxOptions(input) {
  var options = buildFormBaseOptions(input, exports.Component.FormInputCheckbox);
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.FormInputCheckbox),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    groupClass: buildOrFail({
      key: 'groupClass',
      value: vue.unref(options.groupClass),
      alt: ''
    })
  });
}
function buildFormInputCheckbox(input) {
  var options = buildFormInputCheckboxOptions(input);
  var children = [];
  var id = (Math.random() + 1).toString(36).substring(7);
  var rawValue = vue.unref(options.value);
  children.push(vue.h('input', vue.mergeProps(_objectSpread2({
    id: id,
    type: 'checkbox',
    "class": options["class"],
    onInput: function onInput($event) {
      if ($event.target.composing) {
        return;
      }
      handleFormValueChanged(options, !rawValue);
    }
  }, typeof rawValue !== 'undefined' ? {
    checked: rawValue
  } : {}), options.props)));
  if (options.label) {
    children.push(vue.h('label', {
      "class": options.labelClass,
      "for": id
    }, [options.labelContent]));
  }
  return buildValidationGroup({
    content: vue.h('div', {
      "class": options.groupClass
    }, children),
    validationResult: options.validationResult,
    validationMessages: options.validationMessages,
    validationTranslator: options.validationTranslator
  });
}

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */
function buildFormInputText(input) {
  var options = buildFormInputOptions(input, exports.Component.FormInputText);
  return buildFormInputFromOptions(options);
}

function buildFormSelectOptions(input) {
  var options = buildFormBaseOptions(input, exports.Component.FormSelect);
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.FormSelect),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    options: vue.unref(core.extractValueFromOptionValueInput(options.options)),
    optionDefaultText: buildOrFail({
      key: 'optionDefaultText',
      value: vue.unref(options.optionDefaultText),
      alt: 'Select'
    })
  });
}
function buildFormSelect(input) {
  var options = buildFormSelectOptions(input);
  var children = [];
  if (options.label) {
    children.push(vue.h('label', [options.labelContent]));
  }
  var rawValue = vue.unref(options.value);
  return buildValidationGroup({
    content: [].concat(children, [vue.h('select', vue.mergeProps(_objectSpread2({
      "class": options["class"],
      onChange: function onChange($event) {
        var $$selectedVal = Array.prototype.filter.call($event.target.options, function (o) {
          return o.selected;
        }).map(function (o) {
          return '_value' in o ? o._value : o.value;
        });
        var value = $event.target.multiple ? $$selectedVal : $$selectedVal[0];
        handleFormValueChanged(options, value);
      }
    }, typeof rawValue !== 'undefined' ? {
      value: rawValue
    } : {}), options.props), [vue.h('option', {
      value: ''
    }, ['-- ', options.optionDefaultText, ' --']), options.options.map(function (item) {
      return vue.h('option', {
        key: item.id,
        value: item.id
      }, item.value);
    })])]),
    validationResult: options.validationResult,
    validationMessages: options.validationMessages,
    validationTranslator: options.validationTranslator
  });
}

function buildFormSubmitOptions(options) {
  var _options$busy, _options$valid;
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.FormSubmit),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    type: buildOrFail({
      key: 'type',
      value: vue.unref(options.type),
      alt: 'button'
    }),
    "class": buildOrFail({
      key: 'class',
      value: vue.unref(options["class"]),
      alt: []
    }),
    validationResult: core.unrefWithDefault(options.validationResult, {}),
    updateText: buildOrFail({
      key: 'updateText',
      value: vue.unref(options.updateText),
      alt: 'Update'
    }),
    updateIconClass: buildOrFail({
      key: 'updateIconClass',
      value: vue.unref(options.updateIconClass),
      alt: []
    }),
    updateButtonClass: buildOrFail({
      key: 'updateButtonClass',
      value: vue.unref(options.updateButtonClass),
      alt: []
    }),
    createText: buildOrFail({
      key: 'createText',
      value: vue.unref(options.createText),
      alt: 'Create'
    }),
    createIconClass: buildOrFail({
      key: 'createIconClass',
      value: vue.unref(options.createIconClass),
      alt: []
    }),
    createButtonClass: buildOrFail({
      key: 'createButtonClass',
      value: vue.unref(options.createButtonClass),
      alt: []
    }),
    busy: (_options$busy = options.busy) !== null && _options$busy !== void 0 ? _options$busy : false,
    valid: (_options$valid = options.valid) !== null && _options$valid !== void 0 ? _options$valid : true,
    isEditing: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.isEditing), false)
  });
}
function buildFormSubmit(input) {
  var options = buildFormSubmitOptions(input);
  return vue.h('div', {
    "class": 'form-group'
  }, [vue.h(options.type, _objectSpread2(_objectSpread2({}, options.type === 'button' ? {
    type: 'submit'
  } : {}), {}, {
    "class": [].concat(_toConsumableArray(options.isEditing ? [options.updateButtonClass] : []), _toConsumableArray(!options.isEditing ? [options.createButtonClass] : [])),
    disabled: options.validationResult.$invalid || !options.valid || vue.unref(options.busy),
    onClick: function onClick($event) {
      $event.preventDefault();
      core.setMaybeRefValue(options.busy, true);
      var promise = options.submit.apply(null);
      if (core.isPromise(promise)) {
        promise.then(function () {
          return core.setMaybeRefValue(options.busy, false);
        })["catch"](function (e) {
          core.setMaybeRefValue(options.busy, false);
          throw e;
        });
      }
      return promise;
    }
  }), [vue.h('i', {
    "class": [].concat(_toConsumableArray(options.isEditing ? [options.updateIconClass] : []), _toConsumableArray(!options.isEditing ? [options.createIconClass] : []))
  }), ' ', options.isEditing ? options.updateText : options.createText])]);
}

function buildFormTextareaOptions(input) {
  var options = buildFormBaseOptions(input, exports.Component.FormTextarea);
  return _objectSpread2({}, options);
}
function buildFormTextarea(input) {
  var options = buildFormTextareaOptions(input);
  var children = [];
  if (options.label) {
    children.push(vue.h('label', {
      "class": options.labelClass
    }, [options.labelContent]));
  }
  var rawValue = vue.unref(options.value);
  return buildValidationGroup({
    content: [].concat(children, [vue.h('textarea', vue.mergeProps(_objectSpread2({
      placeholder: '...',
      "class": options["class"],
      onInput: function onInput($event) {
        if ($event.target.composing) {
          return;
        }
        handleFormValueChanged(options, $event.target.value);
      }
    }, typeof rawValue !== 'undefined' ? {
      value: rawValue
    } : {}), options.props))]),
    validationResult: options.validationResult,
    validationMessages: options.validationMessages,
    validationTranslator: options.validationTranslator
  });
}

function buildItemActionToggleOptions(options) {
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.ItemActionToggle),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    type: buildOrFail({
      key: 'type',
      value: vue.unref(options.type),
      alt: 'button'
    }),
    "class": buildOrFail({
      key: 'class',
      value: vue.unref(options["class"]),
      alt: []
    }),
    disabledClass: buildOrFail({
      key: 'disabledClass',
      value: vue.unref(options.disabledClass),
      alt: []
    }),
    enabledClass: buildOrFail({
      key: 'enabledClass',
      value: vue.unref(options.enabledClass),
      alt: []
    }),
    childType: buildOrFail({
      key: 'childType',
      value: vue.unref(options.childType),
      alt: 'i'
    }),
    childDisabledContent: buildOrFail({
      key: 'childDisabledContent',
      value: vue.unref(options.childDisabledContent),
      alt: []
    }),
    childDisabledClass: buildOrFail({
      key: 'childDisabledClass',
      value: vue.unref(options.childDisabledClass),
      alt: []
    }),
    childEnabledContent: buildOrFail({
      key: 'childEnabledContent',
      value: vue.unref(options.childEnabledContent),
      alt: []
    }),
    childEnabledClass: buildOrFail({
      key: 'childEnabledClass',
      value: vue.unref(options.childEnabledClass),
      alt: []
    }),
    busy: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.busy), false)
  });
}
function buildItemActionToggle(input) {
  var options = buildItemActionToggleOptions(input);
  var busy = core.unrefWithDefault(options.busy, false);
  var value = vue.unref(options.value);
  var currentValue = vue.unref(options.currentValue);
  var children = [];
  var childClass = value === currentValue ? options.childEnabledClass : options.childDisabledClass;
  var childContent = value === currentValue ? options.childEnabledContent : options.childDisabledContent;
  if (childClass || childContent) {
    children = [vue.h(options.childType, {
      "class": childClass
    }, [childContent])];
  }
  return vue.h(options.type, _objectSpread2(_objectSpread2({}, options.type === 'button' ? {
    type: 'button'
  } : {}), {}, {
    disabled: busy,
    "class": [].concat(_toConsumableArray(options["class"] ? [options["class"]] : []), _toConsumableArray(options.disabledClass && value !== currentValue ? [options.disabledClass] : []), _toConsumableArray(options.enabledClass && value === currentValue ? [options.enabledClass] : [])),
    onClick: function onClick($event) {
      $event.preventDefault();
      if (Array.isArray(currentValue)) {
        var index = currentValue.indexOf(value);
        if (index === -1) {
          core.pushMaybeRefArrayValue(options.currentValue, value);
        } else {
          core.spliceMaybeRefArray(options.currentValue, index, 1);
        }
        if (options.currentValue && options.onChange) {
          options.onChange(options.currentValue);
        }
        return;
      }
      var setValue = function setValue(value) {
        core.setMaybeRefValue(options.currentValue, value);
        if (options.onChange) {
          options.onChange(value);
        }
      };
      if (value === currentValue) {
        setValue(null);
        return;
      }
      setValue(value);
    }
  }), [children]);
}

function buildListBaseOptions(options, component, defaults) {
  defaults = defaults || {};
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(component),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    tag: buildOrFail({
      key: 'tag',
      value: vue.unref(options.tag),
      alt: defaults.tag || 'div'
    }),
    slotItems: options.slotItems || {},
    slotProps: buildOrFail({
      key: 'slotProps',
      value: vue.unref(options.slotProps),
      alt: defaults.slotProps || {}
    }),
    "class": buildOrFail({
      key: 'class',
      value: vue.unref(options["class"]),
      alt: defaults["class"] || []
    }),
    props: buildOrFail({
      key: 'props',
      value: vue.unref(options.props),
      alt: defaults.props || {}
    })
  });
}

function buildListTitleOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListTitle, {
    "class": []
  });
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.ListTitle),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    text: buildOrFail({
      key: 'text',
      value: vue.unref(options.text),
      alt: true
    }),
    textClass: buildOrFail({
      key: 'textClass',
      value: vue.unref(options.textClass),
      alt: []
    }),
    textType: buildOrFail({
      key: 'textType',
      value: vue.unref(options.textType),
      alt: 'h4'
    }),
    textProps: buildOrFail({
      key: 'textProps',
      value: vue.unref(options.textProps),
      alt: {}
    }),
    textContent: buildOrFail({
      key: 'textContent',
      value: vue.unref(options.textContent),
      alt: 'List'
    }),
    icon: buildOrFail({
      key: 'icon',
      value: vue.unref(options.icon),
      alt: true
    }),
    iconClass: buildOrFail({
      key: 'iconClass',
      value: vue.unref(options.iconClass),
      alt: []
    }),
    iconProps: buildOrFail({
      key: 'iconProps',
      value: vue.unref(options.iconProps),
      alt: {}
    })
  });
}
function buildListTitle(input) {
  var options = buildListTitleOptions(input);
  if (core.hasNormalizedSlot(exports.SlotName.HEADER_TITLE, options.slotItems)) {
    return core.normalizeSlot(exports.SlotName.HEADER_TITLE, options.slotItems);
  }
  var children = [];
  if (options.icon) {
    children.push(vue.h('i', vue.mergeProps({
      "class": options.iconClass
    }, options.iconProps)));
  }
  if (options.text) {
    if (options.icon && typeof options.textContent === 'string') {
      children.push(' ');
    }
    children = [vue.h(options.textType, vue.mergeProps({
      "class": options.textClass
    }, options.textProps), [].concat(_toConsumableArray(children), [options.textContent]))];
  }
  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), children);
}

function buildListActionRefreshOptions(input) {
  var _options$busy;
  var options = buildListBaseOptions(input, exports.Component.ListActionRefresh, {
    tag: 'button'
  });
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.ListActionRefresh),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    load: core.unrefWithDefault(options.load, function () {
      return Promise.resolve();
    }),
    busy: (_options$busy = options.busy) !== null && _options$busy !== void 0 ? _options$busy : false,
    text: buildOrFail({
      key: 'text',
      value: vue.unref(options.text),
      alt: true
    }),
    textContent: buildOrFail({
      key: 'textContent',
      value: vue.unref(options.textContent),
      alt: 'refresh'
    }),
    icon: buildOrFail({
      key: 'icon',
      value: vue.unref(options.icon),
      alt: true
    }),
    iconClass: buildOrFail({
      key: 'iconClass',
      value: vue.unref(options.iconClass),
      alt: []
    }),
    iconContent: buildOrFail({
      key: 'iconContent',
      value: vue.unref(options.iconContent),
      alt: []
    }),
    iconProps: core.unrefWithDefault(options.iconProps, {})
  });
}
function buildListActionRefresh(input) {
  var options = buildListActionRefreshOptions(input);
  var refreshActionChildren = [];
  if (options.icon) {
    refreshActionChildren.push(vue.h('i', vue.mergeProps({
      "class": options.iconClass
    }, options.iconProps), [options.iconContent]));
  }
  if (options.text) {
    if (options.icon && typeof options.textContent === 'string') {
      refreshActionChildren.push(' ');
    }
    refreshActionChildren.push(options.textContent);
  }
  return vue.h(options.tag, vue.mergeProps(_objectSpread2(_objectSpread2({}, options.tag === 'button' ? {
    type: options.tag
  } : {}), {}, {
    disabled: vue.unref(options.busy),
    onClick: function onClick($event) {
      $event.preventDefault();
      core.setMaybeRefValue(options.busy, true);
      var promise = options.load.apply(null);
      if (core.isPromise(promise)) {
        promise.then(function () {
          return core.setMaybeRefValue(options.busy, false);
        })["catch"](function (e) {
          core.setMaybeRefValue(options.busy, false);
          throw e;
        });
      }
      return promise;
    },
    "class": options["class"]
  }), options.props), refreshActionChildren);
}

function buildListHeaderOptions(input) {
  var _options$load, _options$busy;
  var options = buildListBaseOptions(input, exports.Component.ListHeader, {
    "class": 'list-header'
  });
  return _objectSpread2(_objectSpread2({}, options), {}, {
    actionType: core.buildOptionValueOrFail({
      component: exports.Component.ListHeader,
      key: 'actionType',
      value: vue.unref(options.actionType),
      alt: 'div'
    }),
    actionClass: core.buildOptionValueOrFail({
      component: exports.Component.ListHeader,
      key: 'actionClass',
      value: vue.unref(options.actionClass),
      alt: []
    }),
    actionProps: core.unrefWithDefault(options.actionProps, {}),
    actionRefresh: core.buildOptionValueOrFail({
      component: exports.Component.ListHeader,
      key: 'actionRefresh',
      value: vue.unref(options.actionRefresh),
      alt: true
    }),
    title: core.buildOptionValueOrFail({
      component: exports.Component.ListHeader,
      key: 'title',
      value: vue.unref(options.title),
      alt: true
    }),
    load: (_options$load = options.load) !== null && _options$load !== void 0 ? _options$load : function () {
      return Promise.resolve();
    },
    busy: (_options$busy = options.busy) !== null && _options$busy !== void 0 ? _options$busy : false
  });
}
function buildListHeader(input) {
  input = input || {};
  var options = buildListHeaderOptions(input);
  var slotScope = {
    busy: options.busy,
    load: options.load
  };
  if (core.hasNormalizedSlot(exports.SlotName.HEADER, options.slotItems)) {
    return core.normalizeSlot(exports.SlotName.HEADER, slotScope, options.slotItems);
  }
  var headerChildren = [];
  if (options.title) {
    if (typeof options.title === 'boolean') {
      options.title = {};
    }
    options.title.slotItems = options.slotItems;
    headerChildren.push(buildListTitle(options.title));
  }

  // -------------------------------------------------------------

  if (core.hasNormalizedSlot(exports.SlotName.HEADER_ACTIONS, options.slotItems)) {
    headerChildren.push(core.normalizeSlot(exports.SlotName.HEADER_ACTIONS, {
      load: options.load,
      busy: options.busy
    }, options.slotItems));
  } else {
    var actions = [];
    if (options.actionRefresh) {
      actions.push(buildListActionRefresh(_objectSpread2({
        load: options.load,
        busy: options.busy
      }, typeof options.actionRefresh === 'boolean' ? {} : options.actionRefresh)));
    }
    if (actions.length > 0) {
      headerChildren.push(vue.h(options.actionType, vue.mergeProps({
        "class": options.actionClass
      }, options.actionProps), actions));
    }
  }

  // -------------------------------------------------------------

  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), headerChildren);
}

function buildListItemOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListItem, {
    "class": 'list-item'
  });
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.ListItem),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    icon: buildOrFail({
      key: 'icon',
      value: vue.unref(options.icon),
      alt: true
    }),
    iconClass: buildOrFail({
      key: 'iconClass',
      value: vue.unref(options.iconClass),
      alt: []
    }),
    iconProps: core.unrefWithDefault(options.iconProps, {}),
    textFn: options.textFn,
    textPropName: buildOrFail({
      key: 'textPropName',
      value: vue.unref(options.textPropName),
      alt: 'name'
    }),
    index: vue.unref(core.extractValueFromOptionValueInput(options.index)),
    key: vue.unref(core.extractValueFromOptionValueInput(options.key)),
    data: vue.unref(core.extractValueFromOptionValueInput(options.data)),
    actions: buildOrFail({
      key: 'actions',
      value: vue.unref(options.actions),
      alt: []
    }),
    busy: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.busy), false)
  });
}
function buildListItem(input) {
  var options = buildListItemOptions(input);
  var slotProps = _objectSpread2({
    data: options.data,
    busy: options.busy,
    index: options.index,
    deleted: function deleted() {
      if (options.onDeleted) {
        options.onDeleted(options.data);
      }
    },
    updated: function updated(item) {
      if (options.onUpdated) {
        options.onUpdated(item);
      }
    }
  }, options.slotProps || {});
  if (core.hasNormalizedSlot(exports.SlotName.ITEM, options.slotItems)) {
    return core.normalizeSlot(exports.SlotName.ITEM, slotProps, options.slotItems);
  }

  // todo: maybe wrap item :)
  if (typeof options.fn === 'function') {
    return options.fn(options.data, options.index);
  }
  var children = [];
  if (options.icon) {
    // class: pr-1
    children.push(vue.h('div', [vue.h('i', vue.mergeProps({
      "class": options.iconClass
    }, options.iconProps))]));
  }
  var itemText;
  if (options.textFn) {
    itemText = options.textFn(options.data);
  } else if (core.hasOwnProperty(options.data, options.textPropName)) {
    itemText = options.data[options.textPropName];
  }
  if (itemText) {
    children.push(itemText);
  }
  var actions = [];
  if (core.hasNormalizedSlot(exports.SlotName.ITEM_ACTIONS, options.slotItems)) {
    actions = [core.normalizeSlot(exports.SlotName.ITEM_ACTIONS, slotProps, options.slotItems)];
  } else if (options.actions) {
    actions = _toConsumableArray(Array.isArray(options.actions) ? options.actions : [options.actions]);
    if (core.hasNormalizedSlot(exports.SlotName.ITEM_ACTIONS_EXTRA, options.slotItems)) {
      actions.push(core.normalizeSlot(exports.SlotName.ITEM_ACTIONS_EXTRA, slotProps, options.slotItems));
    }
  }
  if (actions && actions.length > 0) {
    // todo: make VNode-class an option
    children.push(vue.h('div', {
      "class": 'ms-auto ml-auto'
    }, actions));
  }
  return vue.h(options.tag, vue.mergeProps({
    key: options.index
  }, {
    "class": options["class"]
  }, options.props), children);
}

function buildListItemsOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListItems, {
    "class": 'list-items'
  });
  return _objectSpread2(_objectSpread2({}, options), {}, {
    busy: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.busy), false),
    data: core.extractValueFromOptionValueInput(options.data) || [],
    item: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.item), {})
  });
}
function buildListItems(input) {
  input = input || {};
  var options = buildListItemsOptions(input);
  var deleted = function deleted(item) {
    var index = core.findIndexOfMaybeRefArray(options.data, options.filterFn || function (el) {
      return JSON.stringify(el) === JSON.stringify(item);
    });
    if (index !== -1) {
      core.spliceMaybeRefArray(options.data, index, 1);
      if (typeof options.onDeleted === 'function') {
        options.onDeleted(item);
      }
    }
  };
  var updated = function updated(item) {
    var index = core.findIndexOfMaybeRefArray(options.data, options.filterFn || function (el) {
      return JSON.stringify(el) === JSON.stringify(item);
    });
    if (index !== -1) {
      core.extendMaybeRefArrayValue(options.data, index, item);
      if (typeof options.onUpdated === 'function') {
        options.onUpdated(item);
      }
    }
  };
  if (core.hasNormalizedSlot(exports.SlotName.ITEMS, options.slotItems)) {
    var slotScope = _objectSpread2(_objectSpread2({}, options.slotProps), {}, {
      data: vue.unref(options.data),
      busy: options.busy,
      deleted: deleted,
      updated: updated
    });
    return core.normalizeSlot(exports.SlotName.ITEMS, slotScope, options.slotItems);
  }

  // ----------------------------------------------------------------------

  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), vue.unref(options.data).map(function (item, index) {
    return buildListItem(_objectSpread2(_objectSpread2({
      slotProps: options.slotProps,
      slotItems: options.slotItems
    }, options.item), {}, {
      data: item,
      index: index,
      onDeleted: deleted,
      onUpdated: updated
    }));
  }));
}

function buildListNoMoreOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListNoMore, {
    "class": 'list-no-more'
  });
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.ListNoMore),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    textContent: buildOrFail({
      key: 'textContent',
      value: vue.unref(options.textContent),
      alt: 'No more items available...'
    }),
    busy: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.busy), false),
    total: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.total), 0)
  });
}
function buildListNoMore(input) {
  input = input || {};
  var options = buildListNoMoreOptions(input);
  if (options.busy || options.total > 0) {
    return [];
  }
  if (core.hasNormalizedSlot(exports.SlotName.ITEMS_NO_MORE, options.slotItems)) {
    return core.normalizeSlot(exports.SlotName.ITEMS_NO_MORE, _objectSpread2(_objectSpread2({}, options.slotProps), {}, {
      busy: options.busy,
      total: options.total
    }), options.slotItems);
  }
  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), [options.textContent]);
}

function buildPaginationOptions(options) {
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.Pagination),
    buildOrFail = _createOptionValueBui.buildOrFail,
    build = _createOptionValueBui.build;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    busy: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.busy), false),
    tag: buildOrFail({
      key: 'tag',
      value: vue.unref(options.tag),
      alt: 'ul'
    }),
    "class": buildOrFail({
      key: 'class',
      value: vue.unref(options["class"]),
      alt: 'pagination'
    }),
    itemTag: buildOrFail({
      key: 'itemTag',
      value: vue.unref(options.itemTag),
      alt: 'li'
    }),
    itemClass: buildOrFail({
      key: 'itemClass',
      alt: 'page-item'
    }),
    linkClass: buildOrFail({
      key: 'linkClass',
      alt: 'page-link'
    }),
    linkActiveClass: buildOrFail({
      key: 'linkActiveClass',
      alt: 'active'
    }),
    prevType: buildOrFail({
      key: 'prevType',
      alt: 'i'
    }),
    prevClass: build({
      key: 'prevClass',
      alt: []
    }),
    prevContent: build({
      key: 'prevContent'
    }),
    nextType: buildOrFail({
      key: 'nextType',
      alt: 'i'
    }),
    nextClass: build({
      key: 'nextClass',
      alt: []
    }),
    nextContent: build({
      key: 'nextContent'
    })
  });
}
function buildPagination(input) {
  var options = buildPaginationOptions(input);
  var totalPages = 1;
  var currentPage = 1;
  if (options.total > 0 && options.limit > 0) {
    totalPages = Math.max(Math.ceil(options.total / options.limit), 1);
    currentPage = Math.floor(options.offset / options.limit) + 1;
  }
  var betweenPages = [];
  for (var i = currentPage - 2; i < currentPage + 2; i++) {
    if (i > 0 && i <= totalPages) {
      betweenPages.push(i);
    }
  }
  var loadPage = function loadPage(page) {
    if (options.busy || page === currentPage) return;
    var data = {
      page: page,
      offset: (page - 1) * options.limit,
      limit: options.limit,
      total: totalPages
    };
    options.load(data);
  };
  var renderPrevPage = function renderPrevPage() {
    var content;
    if (options.prevClass || options.prevContent) {
      content = vue.h(options.prevType, {
        "class": options.prevClass
      }, options.prevContent);
    } else {
      content = [currentPage - 1];
    }
    var prevPage = [];
    if (currentPage > 1) {
      prevPage = [vue.h(options.itemTag, {
        "class": options.itemClass
      }, [vue.h('button', {
        "class": options.linkClass,
        disabled: options.busy,
        onClick: function onClick($event) {
          $event.preventDefault();
          return loadPage(currentPage - 1);
        }
      }, [content])])];
    }
    return prevPage;
  };
  var renderBetweenPages = function renderBetweenPages() {
    var children = [];
    var _loop = function _loop(_i) {
      var node = vue.h(options.itemTag, {
        "class": options.itemClass
      }, [vue.h('button', _objectSpread2(_objectSpread2({}, vue.mergeProps(_objectSpread2({}, betweenPages[_i] === currentPage ? {
        "class": options.linkActiveClass
      } : {}), {
        "class": options.linkClass
      })), {}, {
        disabled: options.busy,
        onClick: function onClick($event) {
          $event.preventDefault();

          // eslint-disable-next-line prefer-rest-params
          return loadPage(betweenPages[_i]);
        }
      }), [betweenPages[_i]])]);
      children.push(node);
    };
    for (var _i = 0; _i < betweenPages.length; _i++) {
      _loop(_i);
    }
    return children;
  };
  var renderNextPage = function renderNextPage() {
    var nextPage = [];
    var content;
    if (options.nextClass || options.nextContent) {
      content = vue.h(options.nextType, {
        "class": options.nextClass
      }, options.nextContent);
    } else {
      content = [currentPage + 1];
    }
    if (currentPage < totalPages) {
      nextPage = [vue.h(options.itemTag, {
        "class": options.itemClass
      }, [vue.h('button', {
        "class": options.linkClass,
        disabled: options.busy,
        onClick: function onClick($event) {
          $event.preventDefault();
          return loadPage(currentPage + 1);
        }
      }, [content])])];
    }
    return nextPage;
  };
  return vue.h(options.tag, {
    "class": options["class"]
  }, [renderPrevPage(), renderBetweenPages(), renderNextPage()]);
}

function buildListPaginationOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListPagination, {
    "class": 'list-pagination'
  });
  return _objectSpread2(_objectSpread2({}, options), {}, {
    busy: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.busy), false),
    meta: core.unrefWithDefault(core.extractValueFromOptionValueInput(options.meta), {})
  });
}
function buildListPagination(input) {
  input = input || {};
  var options = buildListPaginationOptions(input);
  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), [buildPagination(_objectSpread2(_objectSpread2(_objectSpread2({}, options.meta), {}, {
    busy: options.busy
  }, options.load ? {
    load: options.load
  } : {
    load: function load() {
      return Promise.resolve();
    }
  }), options.props))]);
}

function buildListSearchOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListSearch, {
    "class": 'list-search'
  });
  return _objectSpread2({}, options);
}
function buildListSearch(input) {
  input = input || {};
  var options = buildListSearchOptions(input);
  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), [buildFormInput({
    value: options.value,
    onChange: options.onChange,
    label: false,
    groupPrepend: true,
    groupPrependContent: vue.h('i', {
      "class": 'fa fa-search'
    })
  })]);
}

function buildListOptions(input) {
  var options = buildListBaseOptions(input, exports.Component.ListItems, {
    "class": 'list'
  });
  var _createOptionValueBui = core.createOptionValueBuilderForComponent(exports.Component.List),
    buildOrFail = _createOptionValueBui.buildOrFail;
  return _objectSpread2(_objectSpread2({}, options), {}, {
    load: input.load,
    busy: options.busy,
    data: options.data,
    meta: options.meta,
    header: buildOrFail({
      key: 'header',
      value: vue.unref(options.header),
      alt: true
    }),
    search: buildOrFail({
      key: 'search',
      value: vue.unref(options.search),
      alt: true
    }),
    items: buildOrFail({
      key: 'items',
      value: vue.unref(options.items),
      alt: true
    }),
    noMore: buildOrFail({
      key: 'noMore',
      value: vue.unref(options.noMore),
      alt: true
    }),
    pagination: buildOrFail({
      key: 'pagination',
      value: vue.unref(options.pagination),
      alt: true
    })
  });
}
function buildList(input) {
  var options = buildListOptions(input);
  var children = [];
  if (options.header) {
    var headerOptions = typeof options.header === 'boolean' ? {} : options.header;
    headerOptions.load = options.load;
    headerOptions.busy = options.busy;
    headerOptions.slotItems = options.slotItems;
    headerOptions.slotProps = options.slotProps;
    var header = buildListHeader(headerOptions);
    children.push(header);
  }
  if (options.search) {
    var searchOptions = typeof options.search === 'boolean' ? {} : options.search;
    searchOptions.onChange = options.onChange;
    searchOptions.slotItems = options.slotItems;
    searchOptions.slotProps = options.slotProps;
    var search = buildListSearch(searchOptions);
    children.push(search);
  }
  if (options.items) {
    var itemsOptions = typeof options.items === 'boolean' ? {} : options.items;
    itemsOptions.data = options.data;
    itemsOptions.busy = options.busy;
    itemsOptions.slotItems = options.slotItems;
    itemsOptions.slotProps = options.slotProps;
    itemsOptions.onDeleted = options.onDeleted;
    itemsOptions.onUpdated = options.onUpdated;
    var items = buildListItems(itemsOptions);
    children.push(items);
  }
  if (options.noMore) {
    var noMoreOptions = typeof options.noMore === 'boolean' ? {} : options.noMore;
    noMoreOptions.busy = options.busy;
    noMoreOptions.slotItems = options.slotItems;
    noMoreOptions.slotProps = options.slotProps;
    var meta = vue.unref(options.meta);
    if (meta) {
      noMoreOptions.total = meta.total;
    } else {
      var data = vue.unref(options.data);
      if (data) {
        noMoreOptions.total = data.length;
      }
    }
    var noMore = buildListNoMore(noMoreOptions);
    children.push(noMore);
  }
  if (options.pagination) {
    var paginationOptions = typeof options.pagination === 'boolean' ? {} : options.pagination;
    paginationOptions.busy = options.busy;
    paginationOptions.meta = options.meta;
    paginationOptions.load = options.load;
    paginationOptions.slotItems = options.slotItems;
    paginationOptions.slotProps = options.slotProps;
    var pagination = buildListPagination(paginationOptions);
    children.push(pagination);
  }
  return vue.h(options.tag, vue.mergeProps({
    "class": options["class"]
  }, options.props), children);
}

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */
function setPresets(data) {
  return core.setPresets(data);
}
function setDefaults(data) {
  return core.setDefaults(data);
}

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

var bootstrapV4 = {
  formInput: {
    "class": 'form-control',
    groupClass: 'input-group',
    groupAppendClass: 'input-group-text',
    groupPrependClass: 'input-group-text'
  },
  formInputText: {
    "class": 'form-control',
    groupClass: 'input-group',
    groupAppendClass: 'input-group-text',
    groupPrependClass: 'input-group-text'
  },
  formInputCheckbox: {
    "class": 'form-check-input',
    labelClass: 'form-check-label',
    groupClass: 'form-check'
  },
  formSelect: {
    "class": 'form-control'
  },
  formSubmit: {
    createButtonClass: 'btn btn-xs btn-success',
    updateButtonClass: 'btn btn-xs btn-primary'
  },
  formTextarea: {
    "class": 'form-control'
  },
  itemActionToggle: {
    disabledClass: 'btn btn-xs btn-dark',
    enabledClass: 'btn btn-xs btn-warning'
  },
  listActionRefresh: {
    "class": 'btn btn-xs btn-dark'
  },
  listHeader: {
    "class": 'd-flex flex-row align-items-center',
    actionClass: 'd-flex flex-row ml-auto'
  },
  listItem: {
    "class": 'd-flex flex-row align-items-center',
    iconClass: 'pr-1'
  },
  listNoMore: {
    "class": 'alert alert-warning alert-sm'
  },
  listPagination: {
    "class": 'd-flex justify-content-center'
  },
  listTitle: {
    textClass: 'mb-0'
  },
  pagination: {
    "class": 'd-flex justify-content-center'
  },
  validationGroup: {
    "class": 'form-group',
    errorClass: 'form-group-error',
    warningClass: 'form-group-warning'
  }
};

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

var bootstrapV5 = {
  formInput: {
    "class": 'form-control',
    labelClass: 'form-label',
    groupClass: 'input-group',
    groupAppendClass: 'input-group-text',
    groupPrependClass: 'input-group-text'
  },
  formInputText: {
    "class": 'form-control',
    labelClass: 'form-label',
    groupClass: 'input-group',
    groupAppendClass: 'input-group-text',
    groupPrependClass: 'input-group-text'
  },
  formInputCheckbox: {
    "class": 'form-check-input',
    labelClass: 'form-check-label',
    groupClass: 'form-check'
  },
  formSelect: {
    "class": 'form-select',
    labelClass: 'form-label'
  },
  formSubmit: {
    createButtonClass: 'btn btn-xs btn-success',
    updateButtonClass: 'btn btn-xs btn-primary'
  },
  formTextarea: {
    "class": 'form-control',
    labelClass: 'form-label'
  },
  itemActionToggle: {
    disabledClass: 'btn btn-xs btn-dark',
    enabledClass: 'btn btn-xs btn-warning'
  },
  listActionRefresh: {
    "class": 'btn btn-xs btn-dark'
  },
  listHeader: {
    "class": 'd-flex flex-row align-items-center',
    actionClass: 'd-flex flex-row ms-auto'
  },
  listItem: {
    "class": 'd-flex flex-row align-items-center',
    iconClass: 'pe-1'
  },
  listNoMore: {
    "class": 'alert alert-warning alert-sm'
  },
  listPagination: {
    "class": 'd-flex justify-content-center'
  },
  listTitle: {
    textClass: 'mb-0'
  },
  pagination: {
    "class": 'd-flex justify-content-center'
  },
  validationGroup: {
    "class": 'form-group',
    errorClass: 'form-group-error',
    warningClass: 'form-group-warning'
  }
};

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

exports.PresetsBuildIn = void 0;
(function (PresetsBuildIn) {
  PresetsBuildIn["BOOTSTRAP_V4"] = "bootstrapV4";
  PresetsBuildIn["BOOTSTRAP_V5"] = "bootstrapV5";
  PresetsBuildIn["FONT_AWESOME"] = "fontAwesome";
})(exports.PresetsBuildIn || (exports.PresetsBuildIn = {}));

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

var fontAwesome = {
  formSubmit: {
    createIconClass: 'fa fa-plus',
    updateIconClass: 'fa fa-save'
  },
  itemActionToggle: {
    childDisabledClass: 'fa fa-plus',
    childEnabledClass: 'fa fa-minus'
  },
  listActionRefresh: {
    iconClass: 'fa fa-refresh'
  },
  listItem: {
    iconClass: 'fa fa-bars'
  },
  listTitle: {
    iconClass: 'fa fa-bars'
  },
  pagination: {
    prevClass: 'fa-solid fa-chevron-left',
    nextClass: 'fa-solid fa-chevron-right'
  }
};

/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */
function getBuildInPresets(input) {
  var presets = {};
  for (var i = 0; i < input.length; i++) {
    switch (input[i]) {
      case exports.PresetsBuildIn.BOOTSTRAP_V4:
        presets.bootstrapV4 = bootstrapV4;
        break;
      case exports.PresetsBuildIn.BOOTSTRAP_V5:
        presets.bootstrapV5 = bootstrapV5;
        break;
      case exports.PresetsBuildIn.FONT_AWESOME:
        presets.fontAwesome = fontAwesome;
        break;
    }
  }
  return presets;
}

Object.defineProperty(exports, 'extractValueFromOptionValueInput', {
  enumerable: true,
  get: function () { return core.extractValueFromOptionValueInput; }
});
Object.defineProperty(exports, 'isOptionValueConfig', {
  enumerable: true,
  get: function () { return core.isOptionValueConfig; }
});
exports.bootstrapV4 = bootstrapV4;
exports.bootstrapV5 = bootstrapV5;
exports.buildFormBaseOptions = buildFormBaseOptions;
exports.buildFormInput = buildFormInput;
exports.buildFormInputCheckbox = buildFormInputCheckbox;
exports.buildFormInputCheckboxOptions = buildFormInputCheckboxOptions;
exports.buildFormInputFromOptions = buildFormInputFromOptions;
exports.buildFormInputOptions = buildFormInputOptions;
exports.buildFormInputText = buildFormInputText;
exports.buildFormSelect = buildFormSelect;
exports.buildFormSelectOptions = buildFormSelectOptions;
exports.buildFormSubmit = buildFormSubmit;
exports.buildFormSubmitOptions = buildFormSubmitOptions;
exports.buildFormTextarea = buildFormTextarea;
exports.buildFormTextareaOptions = buildFormTextareaOptions;
exports.buildItemActionToggle = buildItemActionToggle;
exports.buildItemActionToggleOptions = buildItemActionToggleOptions;
exports.buildList = buildList;
exports.buildListActionRefresh = buildListActionRefresh;
exports.buildListActionRefreshOptions = buildListActionRefreshOptions;
exports.buildListBaseOptions = buildListBaseOptions;
exports.buildListHeader = buildListHeader;
exports.buildListHeaderOptions = buildListHeaderOptions;
exports.buildListItem = buildListItem;
exports.buildListItemOptions = buildListItemOptions;
exports.buildListItems = buildListItems;
exports.buildListItemsOptions = buildListItemsOptions;
exports.buildListNoMore = buildListNoMore;
exports.buildListNoMoreOptions = buildListNoMoreOptions;
exports.buildListOptions = buildListOptions;
exports.buildListPagination = buildListPagination;
exports.buildListPaginationOptions = buildListPaginationOptions;
exports.buildListSearch = buildListSearch;
exports.buildListSearchOptions = buildListSearchOptions;
exports.buildListTitle = buildListTitle;
exports.buildListTitleOptions = buildListTitleOptions;
exports.buildPagination = buildPagination;
exports.buildPaginationOptions = buildPaginationOptions;
exports.buildValidationGroup = buildValidationGroup;
exports.buildValidationGroupOptions = buildValidationGroupOptions;
exports.fontAwesome = fontAwesome;
exports.getBuildInPresets = getBuildInPresets;
exports.handleFormValueChanged = handleFormValueChanged;
exports.setDefaults = setDefaults;
exports.setPresets = setPresets;
//# sourceMappingURL=index.cjs.js.map
