function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
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 _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } 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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
import { ELEMENT_PAGE_URL } from "../../../../constant/element";
import { parseSessionData } from "../../index";
import { generateIframeSrc as _generateIframeSrc } from "../util";
import BaseElementProcessor from "./baseElementProcessor";
var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
  _inherits(AuthProcessor, _BaseElementProcessor);
  var _super = _createSuper(AuthProcessor);
  function AuthProcessor() {
    _classCallCheck(this, AuthProcessor);
    return _super.apply(this, arguments);
  }
  _createClass(AuthProcessor, [{
    key: "onReady",
    value: function onReady(extraParam) {
      this.eventCenter.dispatchToApp({
        event: 'renderComponent',
        data: {
          params: extraParam,
          target: 'AUTH_ELEMENT'
        }
      });
    }
  }, {
    key: "parameterInitAndCheck",
    value: function parameterInitAndCheck() {
      // 实现 parameterInitAndCheck 方法
    }
  }, {
    key: "beforeMount",
    value: function beforeMount() {
      // 实现 beforeMount 方法
    }
  }, {
    key: "preload",
    value: function preload() {
      // 实现 preload 方法
    }
  }, {
    key: "generateIframeSrc",
    value: function generateIframeSrc(_ref) {
      var link = _ref.link,
        instanceId = _ref.instanceId;
      // 实现 generateIframeSrc 方法
      this.instanceId = instanceId;
      var _ref2 = this.elementContainer.getPaymentContext() || {},
        paymentSession = _ref2.paymentSession,
        paymentSessionObj = _ref2.paymentSessionObj,
        sdkMetaData = _ref2.sdkMetaData;
      var _this$options = this.options,
        environment = _this$options.env.environment,
        analytics = _this$options.analytics,
        locale = _this$options.locale;
      return _generateIframeSrc({
        paymentSession: paymentSession,
        paymentSessionObj: paymentSessionObj,
        environment: environment,
        analytics: analytics,
        locale: locale,
        link: link,
        appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
        pageUrl: ELEMENT_PAGE_URL.ELEMENT_AUTH,
        instanceId: instanceId
      });
    }
  }, {
    key: "obtainData",
    value: function obtainData() {
      // 实现 obtainData 方法
      this.obtainDataRes = {};
      return {};
    }
  }, {
    key: "getValue",
    value: function getValue() {
      // 实现 getValue 方法
      return {};
    }
  }, {
    key: "update",
    value: function update(_ref3) {
      var data = _ref3.data,
        paymentSessionData = _ref3.paymentSessionData;
      var _parseSessionData = parseSessionData(paymentSessionData),
        _parseSessionData2 = _slicedToArray(_parseSessionData, 2),
        parseData = _parseSessionData2[0],
        sessionData = _parseSessionData2[1];
      // 实现 update 方法的具体逻辑
      this.eventCenter.dispatchToApp({
        event: 'updatePayment',
        data: {
          params: {
            paymentSessionData: paymentSessionData,
            sessionResult: parseData,
            sessionData: sessionData,
            originActionQueryResult: data.originActionQueryResult,
            originOneAccountQueryResult: data.originOneAccountQueryResult
          }
        }
      });
    }
  }]);
  return AuthProcessor;
}(BaseElementProcessor);
export default AuthProcessor;