'use strict';

Liferay.Loader.define('frontend-taglib-clay$clay-management-toolbar@2.24.1/lib/ClayResultsBar.soy', ['module', 'exports', 'require', 'frontend-js-metal-web$metal-component', 'frontend-js-metal-web$metal-soy'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.templates = exports.ClayResultsBar = undefined;

    var _metalComponent = require('frontend-js-metal-web$metal-component');

    var _metalComponent2 = _interopRequireDefault(_metalComponent);

    var _metalSoy = require('frontend-js-metal-web$metal-soy');

    var _metalSoy2 = _interopRequireDefault(_metalSoy);

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }

    function _possibleConstructorReturn(self, call) {
      if (!self) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }return call && (typeof call === "object" || typeof call === "function") ? call : self;
    }

    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
      }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
    } /* jshint ignore:start */

    var templates;
    goog.loadModule(function (exports) {
      var soy = goog.require('soy');

      goog.require('soydata');

      // This file was automatically generated from ClayResultsBar.soy.
      // Please don't edit this file by hand.

      /**
       * @fileoverview Templates in namespace ClayResultsBar.
       * @public
       */

      goog.module('ClayResultsBar.incrementaldom');

      goog.require('goog.soy.data.SanitizedContent');
      goog.require('goog.string');
      var incrementalDom = goog.require('incrementaldom');
      goog.require('soy.asserts');
      var soyIdom = goog.require('soy.idom');

      var $templateAlias2 = _metalSoy2.default.getTemplate('ClayButton.incrementaldom', 'render');

      var $templateAlias3 = _metalSoy2.default.getTemplate('ClayFilterLabel.incrementaldom', 'render');

      var $templateAlias1 = _metalSoy2.default.getTemplate('ClayLink.incrementaldom', 'render');

      /**
       * @param {{
       *  filterLabels: !Array<?>,
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  totalItems: number,
       *  _handleClearResultsClick: (*|null|undefined),
       *  _handleFilterLabelCloseClicked: (*|null|undefined),
       *  clearResultsURL: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  searchValue: (!goog.soy.data.SanitizedContent|null|string|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */
      function $render(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        /** @type {!Array<?>} */
        var filterLabels = soy.asserts.assertType(goog.isArray(opt_data.filterLabels), 'filterLabels', opt_data.filterLabels, '!Array<?>');
        /** @type {!goog.soy.data.SanitizedContent|string} */
        soy.asserts.assertType(goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|string');

        /** @type {number} */
        var totalItems = soy.asserts.assertType(goog.isNumber(opt_data.totalItems), 'totalItems', opt_data.totalItems, 'number');
        /** @type {*|null|undefined} */
        opt_data._handleClearResultsClick;
        opt_data._handleFilterLabelCloseClicked;
        soy.asserts.assertType(opt_data.clearResultsURL == null || goog.isString(opt_data.clearResultsURL) || opt_data.clearResultsURL instanceof goog.soy.data.SanitizedContent, 'clearResultsURL', opt_data.clearResultsURL, '!goog.soy.data.SanitizedContent|null|string|undefined');

        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var searchValue = soy.asserts.assertType(opt_data.searchValue == null || goog.isString(opt_data.searchValue) || opt_data.searchValue instanceof goog.soy.data.SanitizedContent, 'searchValue', opt_data.searchValue, '!goog.soy.data.SanitizedContent|null|string|undefined');
        incrementalDom.elementOpenStart('nav');
        incrementalDom.attr('class', 'tbar tbar-inline-xs-down subnav-tbar subnav-tbar-primary');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'container-fluid container-fluid-max-xl');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('ul');
        incrementalDom.attr('class', 'tbar-nav tbar-nav-wrap');
        incrementalDom.elementOpenEnd();
        var hasFilterLabels__soy1280 = filterLabels.length > 0;
        $results({ expand: !hasFilterLabels__soy1280, searchValue: searchValue, totalItems: totalItems }, null, opt_ijData);
        if (hasFilterLabels__soy1280) {
          $filterLabels(opt_data, null, opt_ijData);
        }
        $clearResults(opt_data, null, opt_ijData);
        incrementalDom.elementClose('ul');
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('nav');
      }
      exports.render = $render;
      /**
       * @typedef {{
       *  filterLabels: !Array<?>,
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  totalItems: number,
       *  _handleClearResultsClick: (*|null|undefined),
       *  _handleFilterLabelCloseClicked: (*|null|undefined),
       *  clearResultsURL: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  searchValue: (!goog.soy.data.SanitizedContent|null|string|undefined)
       * }}
       */
      $render.Params;
      if (goog.DEBUG) {
        $render.soyTemplateName = 'ClayResultsBar.render';
      }

      /**
       * @param {{
       *  _handleClearResultsClick: (*|null|undefined),
       *  clearResultsURL: (!goog.soy.data.SanitizedContent|null|string|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */
      function $clearResults(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        opt_data = opt_data || {};
        /** @type {*|null|undefined} */
        var _handleClearResultsClick = opt_data._handleClearResultsClick;
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var clearResultsURL = soy.asserts.assertType(opt_data.clearResultsURL == null || goog.isString(opt_data.clearResultsURL) || opt_data.clearResultsURL instanceof goog.soy.data.SanitizedContent, 'clearResultsURL', opt_data.clearResultsURL, '!goog.soy.data.SanitizedContent|null|string|undefined');
        incrementalDom.elementOpenStart('li');
        incrementalDom.attr('class', 'tbar-item');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'tbar-section');
        incrementalDom.elementOpenEnd();
        if (clearResultsURL) {
          var msg_4439__soy4440 = '';
          /** @desc Label for clear results link */
          var MSG_EXTERNAL_517843663917688276 = Liferay.Language.get('clear');
          msg_4439__soy4440 += MSG_EXTERNAL_517843663917688276;
          $templateAlias1({ elementClasses: 'component-link tbar-link', events: { click: _handleClearResultsClick }, href: clearResultsURL, label: '' + msg_4439__soy4440, ref: 'clearSearch' }, null, opt_ijData);
        } else {
          var msg_4442__soy4443 = '';
          /** @desc Label for clear results button */
          var MSG_EXTERNAL_517843663917688276$$1 = Liferay.Language.get('clear');
          msg_4442__soy4443 += MSG_EXTERNAL_517843663917688276$$1;
          $templateAlias2({ elementClasses: 'component-link tbar-link', events: { click: _handleClearResultsClick }, label: '' + msg_4442__soy4443, ref: 'clearSearch', style: 'unstyled' }, null, opt_ijData);
        }
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('li');
      }
      exports.clearResults = $clearResults;
      /**
       * @typedef {{
       *  _handleClearResultsClick: (*|null|undefined),
       *  clearResultsURL: (!goog.soy.data.SanitizedContent|null|string|undefined)
       * }}
       */
      $clearResults.Params;
      if (goog.DEBUG) {
        $clearResults.soyTemplateName = 'ClayResultsBar.clearResults';
      }

      /**
       * @param {{
       *  filterLabels: !Array<?>,
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  _handleFilterLabelCloseClicked: (*|null|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */
      function $filterLabels(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        var $$temp;
        /** @type {!Array<?>} */
        var filterLabels = soy.asserts.assertType(goog.isArray(opt_data.filterLabels), 'filterLabels', opt_data.filterLabels, '!Array<?>');
        /** @type {!goog.soy.data.SanitizedContent|string} */
        var spritemap = soy.asserts.assertType(goog.isString(opt_data.spritemap) || opt_data.spritemap instanceof goog.soy.data.SanitizedContent, 'spritemap', opt_data.spritemap, '!goog.soy.data.SanitizedContent|string');
        /** @type {*|null|undefined} */
        var _handleFilterLabelCloseClicked = opt_data._handleFilterLabelCloseClicked;
        var filterLabel1361List = filterLabels;
        var filterLabel1361ListLen = filterLabel1361List.length;
        for (var filterLabel1361Index = 0; filterLabel1361Index < filterLabel1361ListLen; filterLabel1361Index++) {
          var filterLabel1361Data = filterLabel1361List[filterLabel1361Index];
          var clayFilterLabelClasses__soy1343 = '';
          clayFilterLabelClasses__soy1343 += 'tbar-item';
          clayFilterLabelClasses__soy1343 += filterLabel1361Index == filterLabel1361ListLen - 1 ? ' tbar-item-expand' : '';
          incrementalDom.elementOpenStart('li');
          incrementalDom.attr('class', clayFilterLabelClasses__soy1343);
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'tbar-section');
          incrementalDom.elementOpenEnd();
          $templateAlias3({ closeable: ($$temp = filterLabel1361Data.closeable) == null ? true : $$temp, data: { labelId: filterLabel1361Index }, events: { filterLabelCloseClicked: _handleFilterLabelCloseClicked }, filterData: filterLabel1361Data.data, label: filterLabel1361Data.label, ref: 'label' + filterLabel1361Index, spritemap: spritemap }, null, opt_ijData);
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('li');
        }
      }
      exports.filterLabels = $filterLabels;
      /**
       * @typedef {{
       *  filterLabels: !Array<?>,
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  _handleFilterLabelCloseClicked: (*|null|undefined)
       * }}
       */
      $filterLabels.Params;
      if (goog.DEBUG) {
        $filterLabels.soyTemplateName = 'ClayResultsBar.filterLabels';
      }

      /**
       * @param {{
       *  totalItems: number,
       *  expand: (boolean|null|undefined),
       *  searchValue: (!goog.soy.data.SanitizedContent|null|string|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */
      function $results(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        /** @type {number} */
        var totalItems = soy.asserts.assertType(goog.isNumber(opt_data.totalItems), 'totalItems', opt_data.totalItems, 'number');
        /** @type {boolean|null|undefined} */
        var expand = soy.asserts.assertType(opt_data.expand == null || goog.isBoolean(opt_data.expand) || opt_data.expand === 1 || opt_data.expand === 0, 'expand', opt_data.expand, 'boolean|null|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */
        var searchValue = soy.asserts.assertType(opt_data.searchValue == null || goog.isString(opt_data.searchValue) || opt_data.searchValue instanceof goog.soy.data.SanitizedContent, 'searchValue', opt_data.searchValue, '!goog.soy.data.SanitizedContent|null|string|undefined');
        var elementClasses__soy1369 = '';
        elementClasses__soy1369 += 'tbar-item';
        elementClasses__soy1369 += expand ? ' tbar-item-expand' : '';
        incrementalDom.elementOpenStart('li');
        incrementalDom.attr('class', elementClasses__soy1369);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'tbar-section');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('span');
        incrementalDom.attr('class', 'component-text text-truncate-inline');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('span');
        incrementalDom.attr('class', 'text-truncate');
        incrementalDom.elementOpenEnd();
        if (searchValue) {
          /** @desc Says how many results there are for a search */
          var MSG_EXTERNAL_2733824563254516660 = Liferay.Language.get('x-results-for-x');
	MSG_EXTERNAL_2733824563254516660 = MSG_EXTERNAL_2733824563254516660.replace(/{(\d+)}/g, '\x01$1\x01');

          var lastIndex_1381 = 0,
              partRe_1381 = /\x01\d+\x01/g,
              match_1381;
          do {
            match_1381 = partRe_1381.exec(MSG_EXTERNAL_2733824563254516660) || undefined;
            incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_2733824563254516660.substring(lastIndex_1381, match_1381 && match_1381.index)));
            lastIndex_1381 = partRe_1381.lastIndex;
            switch (match_1381 && match_1381[0]) {
              case '\x011\x01':
                soyIdom.print(searchValue);
                break;
              case '\x010\x01':
                soyIdom.print(totalItems);
                break;
            }
          } while (match_1381);
        } else {
          /** @desc Says how many results there are */
          var MSG_EXTERNAL_4190590659130781466 = Liferay.Language.get('x-results-for');
	MSG_EXTERNAL_4190590659130781466 = MSG_EXTERNAL_4190590659130781466.replace(/{(\d+)}/g, '\x01$1\x01');

          var lastIndex_1393 = 0,
              partRe_1393 = /\x01\d+\x01/g,
              match_1393;
          do {
            match_1393 = partRe_1393.exec(MSG_EXTERNAL_4190590659130781466) || undefined;
            incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_4190590659130781466.substring(lastIndex_1393, match_1393 && match_1393.index)));
            lastIndex_1393 = partRe_1393.lastIndex;
            switch (match_1393 && match_1393[0]) {
              case '\x010\x01':
                soyIdom.print(totalItems);
                break;
            }
          } while (match_1393);
        }
        incrementalDom.elementClose('span');
        incrementalDom.elementClose('span');
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('li');
      }
      exports.results = $results;
      /**
       * @typedef {{
       *  totalItems: number,
       *  expand: (boolean|null|undefined),
       *  searchValue: (!goog.soy.data.SanitizedContent|null|string|undefined)
       * }}
       */
      $results.Params;
      if (goog.DEBUG) {
        $results.soyTemplateName = 'ClayResultsBar.results';
      }

      exports.render.params = ["filterLabels", "spritemap", "totalItems", "_handleClearResultsClick", "_handleFilterLabelCloseClicked", "clearResultsURL", "searchValue"];
      exports.render.types = { "filterLabels": "list<?>", "spritemap": "string", "totalItems": "number", "_handleClearResultsClick": "any", "_handleFilterLabelCloseClicked": "any", "clearResultsURL": "string", "searchValue": "string" };
      exports.clearResults.params = ["_handleClearResultsClick", "clearResultsURL"];
      exports.clearResults.types = { "_handleClearResultsClick": "any", "clearResultsURL": "string" };
      exports.filterLabels.params = ["filterLabels", "spritemap", "_handleFilterLabelCloseClicked"];
      exports.filterLabels.types = { "filterLabels": "list<?>", "spritemap": "string", "_handleFilterLabelCloseClicked": "any" };
      exports.results.params = ["totalItems", "expand", "searchValue"];
      exports.results.types = { "totalItems": "number", "expand": "bool", "searchValue": "string" };
      exports.templates = templates = exports;
      return exports;
    });

    var ClayResultsBar = function (_Component) {
      _inherits(ClayResultsBar, _Component);

      function ClayResultsBar() {
        _classCallCheck(this, ClayResultsBar);

        return _possibleConstructorReturn(this, (ClayResultsBar.__proto__ || Object.getPrototypeOf(ClayResultsBar)).apply(this, arguments));
      }

      return ClayResultsBar;
    }(_metalComponent2.default);

    _metalSoy2.default.register(ClayResultsBar, templates);
    exports.ClayResultsBar = ClayResultsBar;
    exports.templates = templates;
    exports.default = templates;
    /* jshint ignore:end */
    //# sourceMappingURL=ClayResultsBar.soy.js.map
  }
});
//# sourceMappingURL=ClayResultsBar.soy.js.map