'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

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 _jade_template_fn(locals) {
  locals = locals || {};;;
  var result_of_with = function ($attrs, $helpers, Object, inputValue) {
    var h = require('panel').h;
    var attrObj = Object.entries($attrs).reduce(function (acc, _ref) {
      var _ref2 = _slicedToArray(_ref, 2),
          attrName = _ref2[0],
          attrVal = _ref2[1];

      return Object.assign(acc, _defineProperty({}, attrName, attrVal));
    }, {
      type: 'text'
    });
    return {
      value: h("div", {
        "class": {
          'mp-icon-input-container': true
        }
      }, function () {
        var __jade_nodes = [];
        __jade_nodes = __jade_nodes.concat(h("div", {
          "class": {
            'mp-icon-input-icon': true
          }
        }, function () {
          var __jade_nodes = [];
          __jade_nodes = __jade_nodes.concat($attrs['icon'] ? function () {
            var __jade_nodes = [];
            __jade_nodes = __jade_nodes.concat(h("svg-icon", {
              "attrs": {
                icon: $attrs['icon']
              }
            }));;
            return __jade_nodes;
          }.call(this) : undefined);;
          return __jade_nodes;
        }.call(this).filter(Boolean)));
        __jade_nodes = __jade_nodes.concat(h("input", {
          "attrs": attrObj,
          "on": {
            input: $helpers.handleInput
          },
          "props": {
            value: inputValue
          },
          "class": Object.assign({}, {
            'mp-icon-input-rounded': $attrs['rounded']
          }, {
            'mp-icon-input-input': true
          })
        }));
        __jade_nodes = __jade_nodes.concat(inputValue ? function () {
          var __jade_nodes = [];
          __jade_nodes = __jade_nodes.concat(h("div", {
            "class": {
              'mp-icon-input-clear-icon': true
            }
          }, function () {
            var __jade_nodes = [];
            __jade_nodes = __jade_nodes.concat(h("svg-icon", {
              "attrs": {
                icon: 'x-clear-search'
              },
              "on": {
                click: $helpers.clearInput
              }
            }));;
            return __jade_nodes;
          }.call(this).filter(Boolean)));;
          return __jade_nodes;
        }.call(this) : undefined);;
        return __jade_nodes;
      }.call(this).filter(Boolean))
    };
  }.call(this, "$attrs" in locals ? locals.$attrs : typeof $attrs !== "undefined" ? $attrs : undefined, "$helpers" in locals ? locals.$helpers : typeof $helpers !== "undefined" ? $helpers : undefined, "Object" in locals ? locals.Object : typeof Object !== "undefined" ? Object : undefined, "inputValue" in locals ? locals.inputValue : typeof inputValue !== "undefined" ? inputValue : undefined);
  if (result_of_with) return result_of_with.value;
}
module.exports = _jade_template_fn;