Liferay.Loader.define("commerce-frontend-taglib@10.0.15/account_selector/AccountSelector.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["default"] = exports.templates = exports.AccountSelector = void 0;

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

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

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

    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

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

    function _possibleConstructorReturn(self, call) {
      if (call && (_typeof(call) === "object" || typeof call === "function")) {
        return call;
      }return _assertThisInitialized(self);
    }

    function _assertThisInitialized(self) {
      if (self === void 0) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }return self;
    }

    function _getPrototypeOf(o) {
      _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
        return o.__proto__ || Object.getPrototypeOf(o);
      };return _getPrototypeOf(o);
    }

    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function");
      }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);
    }

    function _setPrototypeOf(o, p) {
      _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
        o.__proto__ = p;return o;
      };return _setPrototypeOf(o, p);
    }

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

      goog.require('soydata');

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

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

      goog.module('AccountSelector.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 $templateAlias3 = _metalSoy["default"].getTemplate('AccountsTable.incrementaldom', 'render');

      var $templateAlias1 = _metalSoy["default"].getTemplate('ClayIcon.incrementaldom', 'render');

      var $templateAlias2 = _metalSoy["default"].getTemplate('OrdersTable.incrementaldom', 'render');
      /**
       * @param {{
       *  openingState: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  currentView: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  accounts: (!Array<{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  orders: (!Array<{addOrderLink: (!goog.soy.data.SanitizedContent|string), id: (!goog.soy.data.SanitizedContent|number|string), lastEdit: (!goog.soy.data.SanitizedContent|string), status: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  viewAllAccountsLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  createNewAccountLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  viewAllOrdersLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  createNewOrderLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  currentAccount: (null|undefined|{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}),
       *  currentOrder: (?),
       *  _handleChangeSelectedView: (*|null|undefined),
       *  _handleAccountSelected: (*|null|undefined),
       *  _handleOrderSelected: (*|null|undefined),
       *  _handleGetOrders: (*|null|undefined),
       *  _handleGetAccounts: (*|null|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string)
       * }} 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 {!goog.soy.data.SanitizedContent|null|string|undefined} */

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

        var currentView = soy.asserts.assertType(opt_data.currentView == null || goog.isString(opt_data.currentView) || opt_data.currentView instanceof goog.soy.data.SanitizedContent, 'currentView', opt_data.currentView, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {!Array<{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined} */

        var accounts = soy.asserts.assertType(opt_data.accounts == null || goog.isArray(opt_data.accounts), 'accounts', opt_data.accounts, '!Array<{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined');
        /** @type {!Array<{addOrderLink: (!goog.soy.data.SanitizedContent|string), id: (!goog.soy.data.SanitizedContent|number|string), lastEdit: (!goog.soy.data.SanitizedContent|string), status: (!goog.soy.data.SanitizedContent|string)}>|null|undefined} */

        var orders = soy.asserts.assertType(opt_data.orders == null || goog.isArray(opt_data.orders), 'orders', opt_data.orders, '!Array<{addOrderLink: (!goog.soy.data.SanitizedContent|string), id: (!goog.soy.data.SanitizedContent|number|string), lastEdit: (!goog.soy.data.SanitizedContent|string), status: (!goog.soy.data.SanitizedContent|string)}>|null|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */

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

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

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

        var createNewOrderLink = soy.asserts.assertType(opt_data.createNewOrderLink == null || goog.isString(opt_data.createNewOrderLink) || opt_data.createNewOrderLink instanceof goog.soy.data.SanitizedContent, 'createNewOrderLink', opt_data.createNewOrderLink, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {null|undefined|{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}} */

        var currentAccount = soy.asserts.assertType(opt_data.currentAccount == null || goog.isObject(opt_data.currentAccount), 'currentAccount', opt_data.currentAccount, 'null|undefined|{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}');
        /** @type {?} */

        var currentOrder = opt_data.currentOrder;
        /** @type {*|null|undefined} */

        var _handleChangeSelectedView = opt_data._handleChangeSelectedView;
        /** @type {*|null|undefined} */

        var _handleAccountSelected = opt_data._handleAccountSelected;
        /** @type {*|null|undefined} */

        var _handleOrderSelected = opt_data._handleOrderSelected;
        /** @type {*|null|undefined} */

        var _handleGetOrders = opt_data._handleGetOrders;
        /** @type {*|null|undefined} */

        var _handleGetAccounts = opt_data._handleGetAccounts;
        /** @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');
        var dropdownClasses__soy20 = '';
        dropdownClasses__soy20 += 'commerce-dropdown';
        dropdownClasses__soy20 += openingState != null ? ' is-' + openingState : '';
        var curtainClasses__soy29 = '';
        curtainClasses__soy29 += 'commerce-dropdown__curtain';
        curtainClasses__soy29 += openingState != null ? ' is-' + openingState : '';
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', dropdownClasses__soy20);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('button');
        incrementalDom.attr('class', 'commerce-topbar-button');
        incrementalDom.attr('data-onclick', 'toggleAccountSelector');
        incrementalDom.elementOpenEnd();
        $currentState(opt_data, null, opt_ijData);
        $templateAlias1({
          spritemap: spritemap,
          symbol: 'angle-down'
        }, null, opt_ijData);
        incrementalDom.elementClose('button');
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', curtainClasses__soy29);
        incrementalDom.attr('id', 'account-manager-curtain');
        incrementalDom.attr('ref', 'curtain');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-dropdown__absolute-content');
        incrementalDom.elementOpenEnd();

        $templateAlias2({
          events: {
            changeSelectedView: _handleChangeSelectedView,
            orderSelected: _handleOrderSelected,
            getOrders: _handleGetOrders
          },
          currentAccountName: currentAccount != null ? currentAccount.name : null,
          orders: orders,
          currentOrder: currentOrder,
          isVisible: currentView == 'orders',
          createNewOrderLink: createNewOrderLink,
          viewAllOrdersLink: viewAllOrdersLink,
          showBack: accounts != null && accounts.length > 1,
          spritemap: spritemap
        }, null, opt_ijData);

        $templateAlias3({
          events: {
            accountSelected: _handleAccountSelected,
            getAccounts: _handleGetAccounts
          },
          accounts: accounts,
          isVisible: currentView == 'accounts',
          createNewAccountLink: createNewAccountLink,
          viewAllAccountsLink: viewAllAccountsLink,
          spritemap: spritemap
        }, null, opt_ijData);
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('div');
      }

      exports.render = $render;
      /**
       * @typedef {{
       *  openingState: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  currentView: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  accounts: (!Array<{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  orders: (!Array<{addOrderLink: (!goog.soy.data.SanitizedContent|string), id: (!goog.soy.data.SanitizedContent|number|string), lastEdit: (!goog.soy.data.SanitizedContent|string), status: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  viewAllAccountsLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  createNewAccountLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  viewAllOrdersLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  createNewOrderLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  currentAccount: (null|undefined|{accountId: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}),
       *  currentOrder: (?),
       *  _handleChangeSelectedView: (*|null|undefined),
       *  _handleAccountSelected: (*|null|undefined),
       *  _handleOrderSelected: (*|null|undefined),
       *  _handleGetOrders: (*|null|undefined),
       *  _handleGetAccounts: (*|null|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string)
       * }}
       */

      $render.Params;

      if (goog.DEBUG) {
        $render.soyTemplateName = 'AccountSelector.render';
      }
      /**
       * @param {{
       *  currentAccount: (?),
       *  currentOrder: (?)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */

      function $currentState(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        /** @type {?} */

        var currentAccount = opt_data.currentAccount;
        /** @type {?} */

        var currentOrder = opt_data.currentOrder;

        if (currentAccount != null) {
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-selector');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-selector__image');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('img');
          incrementalDom.attr('alt', currentAccount.name);
          incrementalDom.attr('src', currentAccount.thumbnail);
          incrementalDom.elementOpenEnd();
          incrementalDom.elementClose('img');
          incrementalDom.elementClose('div');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-selector__title');
          incrementalDom.elementOpenEnd();
          soyIdom.print(currentAccount.name);
          incrementalDom.elementClose('div');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-selector__info');
          incrementalDom.elementOpenEnd();

          if (currentOrder != null) {
            soyIdom.print(currentOrder.id);
            incrementalDom.text(' | ');
            soyIdom.print(currentOrder.status);
          } else {
            /** @desc There is no order selected. */
            var MSG_EXTERNAL_6978148723116233592 = Liferay.Language.get('there-is-no-order-selected');
            incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_6978148723116233592));
          }

          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
        } else {
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-selector');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-selector__title');
          incrementalDom.elementOpenEnd();
          /** @desc Select Account & Order */

          var MSG_EXTERNAL_7775546349963615076 = Liferay.Language.get('select-account-and-order');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_7775546349963615076));
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
        }
      }

      exports.currentState = $currentState;
      /**
       * @typedef {{
       *  currentAccount: (?),
       *  currentOrder: (?)
       * }}
       */

      $currentState.Params;

      if (goog.DEBUG) {
        $currentState.soyTemplateName = 'AccountSelector.currentState';
      }

      exports.render.params = ["openingState", "currentView", "accounts", "orders", "viewAllAccountsLink", "createNewAccountLink", "viewAllOrdersLink", "createNewOrderLink", "currentAccount", "currentOrder", "_handleChangeSelectedView", "_handleAccountSelected", "_handleOrderSelected", "_handleGetOrders", "_handleGetAccounts", "spritemap"];
      exports.render.types = {
        "openingState": "string",
        "currentView": "string",
        "accounts": "list<[\n\t\tname: string,\n\t\taccountId: string,\n\t\tthumbnail: string\n\t]>",
        "orders": "list<[\n\t\tid: string|number,\n\t\tstatus: string,\n\t\tlastEdit: string,\n\t\taddOrderLink: string\n\t]>",
        "viewAllAccountsLink": "string",
        "createNewAccountLink": "string",
        "viewAllOrdersLink": "string",
        "createNewOrderLink": "string",
        "currentAccount": "[\n\t\taccountId: string,\n\t\tname: string,\n\t\tthumbnail: string\n\t]",
        "currentOrder": "?",
        "_handleChangeSelectedView": "any",
        "_handleAccountSelected": "any",
        "_handleOrderSelected": "any",
        "_handleGetOrders": "any",
        "_handleGetAccounts": "any",
        "spritemap": "string"
      };
      exports.currentState.params = ["currentAccount", "currentOrder"];
      exports.currentState.types = {
        "currentAccount": "? ",
        "currentOrder": "? "
      };
      exports.templates = templates = exports;
      return exports;
    });

    var AccountSelector = /*#__PURE__*/function (_Component) {
      _inherits(AccountSelector, _Component);

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

        return _possibleConstructorReturn(this, _getPrototypeOf(AccountSelector).apply(this, arguments));
      }

      return AccountSelector;
    }(_metalComponent["default"]);

    exports.AccountSelector = AccountSelector;

    _metalSoy["default"].register(AccountSelector, templates);

    var _default = templates;
    /* jshint ignore:end */

    exports["default"] = _default;
    //# sourceMappingURL=AccountSelector.soy.js.map
  }
});
//# sourceMappingURL=AccountSelector.soy.js.map