Skip to content
Snippets Groups Projects
onDeleteAccount.js 7.54 MiB
Newer Older
  • Learn to ignore specific revisions
  • Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    227001 227002 227003 227004 227005 227006 227007 227008 227009 227010 227011 227012 227013 227014 227015 227016 227017 227018 227019 227020 227021 227022 227023 227024 227025 227026 227027 227028 227029 227030 227031 227032 227033 227034 227035 227036 227037 227038 227039 227040 227041 227042 227043 227044 227045 227046 227047 227048 227049 227050 227051 227052 227053 227054 227055 227056 227057 227058 227059 227060 227061 227062 227063 227064 227065 227066 227067 227068 227069 227070 227071 227072 227073 227074 227075 227076 227077 227078 227079 227080 227081 227082 227083 227084 227085 227086 227087 227088 227089 227090 227091 227092 227093 227094 227095 227096 227097 227098 227099 227100 227101 227102 227103 227104 227105 227106 227107 227108 227109 227110 227111 227112 227113 227114 227115 227116 227117 227118 227119 227120 227121 227122 227123 227124 227125 227126 227127 227128 227129 227130 227131 227132 227133 227134 227135 227136 227137 227138 227139 227140 227141 227142 227143 227144 227145 227146 227147 227148 227149 227150 227151 227152 227153 227154 227155 227156 227157 227158 227159 227160 227161 227162 227163 227164 227165 227166 227167 227168 227169 227170 227171 227172 227173 227174 227175 227176 227177 227178 227179 227180 227181 227182 227183 227184 227185 227186 227187 227188 227189 227190 227191 227192 227193 227194 227195 227196 227197 227198 227199 227200 227201 227202 227203 227204 227205 227206 227207 227208 227209 227210 227211 227212 227213 227214 227215 227216 227217 227218 227219 227220 227221 227222 227223 227224 227225 227226 227227 227228 227229 227230 227231 227232 227233 227234 227235 227236 227237 227238 227239 227240 227241 227242 227243 227244 227245 227246 227247 227248 227249 227250 227251 227252 227253 227254 227255 227256 227257 227258 227259 227260 227261 227262 227263 227264 227265 227266 227267 227268 227269 227270 227271 227272 227273 227274 227275 227276 227277 227278 227279 227280 227281 227282 227283 227284 227285 227286 227287 227288 227289 227290 227291 227292 227293 227294 227295 227296 227297 227298 227299 227300 227301 227302 227303 227304 227305 227306 227307 227308 227309 227310 227311 227312 227313 227314 227315 227316 227317 227318 227319 227320 227321 227322 227323 227324 227325 227326 227327 227328 227329 227330 227331 227332 227333 227334 227335 227336 227337 227338 227339 227340 227341 227342 227343 227344 227345 227346 227347 227348 227349 227350 227351 227352 227353 227354 227355 227356 227357 227358 227359 227360 227361 227362 227363 227364 227365 227366 227367 227368 227369 227370 227371 227372 227373 227374 227375 227376 227377 227378 227379 227380 227381 227382 227383 227384 227385 227386 227387 227388 227389 227390 227391 227392 227393 227394 227395 227396 227397 227398 227399 227400 227401 227402 227403 227404 227405 227406 227407 227408 227409 227410 227411 227412 227413 227414 227415 227416 227417 227418 227419 227420 227421 227422 227423 227424 227425 227426 227427 227428 227429 227430 227431 227432 227433 227434 227435 227436 227437 227438 227439 227440 227441 227442 227443 227444 227445 227446 227447 227448 227449 227450 227451 227452 227453 227454 227455 227456 227457 227458 227459 227460 227461 227462 227463 227464 227465 227466 227467 227468 227469 227470 227471 227472 227473 227474 227475 227476 227477 227478 227479 227480 227481 227482 227483 227484 227485 227486 227487 227488 227489 227490 227491 227492 227493 227494 227495 227496 227497 227498 227499 227500 227501 227502 227503 227504 227505 227506 227507 227508 227509 227510 227511 227512 227513 227514 227515 227516 227517 227518 227519 227520 227521 227522 227523 227524 227525 227526 227527 227528 227529 227530 227531 227532 227533 227534 227535 227536 227537 227538 227539 227540 227541 227542 227543 227544 227545 227546 227547 227548 227549 227550 227551 227552 227553 227554 227555 227556 227557 227558 227559 227560 227561 227562 227563 227564 227565 227566 227567 227568 227569 227570 227571 227572 227573 227574 227575 227576 227577 227578 227579 227580 227581 227582 227583 227584 227585 227586 227587 227588 227589 227590 227591 227592 227593 227594 227595 227596 227597 227598 227599 227600 227601 227602 227603 227604 227605 227606 227607 227608 227609 227610 227611 227612 227613 227614 227615 227616 227617 227618 227619 227620 227621 227622 227623 227624 227625 227626 227627 227628 227629 227630 227631 227632 227633 227634 227635 227636 227637 227638 227639 227640 227641 227642 227643 227644 227645 227646 227647 227648 227649 227650
        'baseURL': defaultToConfig2,
        'transformRequest': defaultToConfig2,
        'transformResponse': defaultToConfig2,
        'paramsSerializer': defaultToConfig2,
        'timeout': defaultToConfig2,
        'timeoutMessage': defaultToConfig2,
        'withCredentials': defaultToConfig2,
        'adapter': defaultToConfig2,
        'responseType': defaultToConfig2,
        'xsrfCookieName': defaultToConfig2,
        'xsrfHeaderName': defaultToConfig2,
        'onUploadProgress': defaultToConfig2,
        'onDownloadProgress': defaultToConfig2,
        'decompress': defaultToConfig2,
        'maxContentLength': defaultToConfig2,
        'maxBodyLength': defaultToConfig2,
        'beforeRedirect': defaultToConfig2,
        'transport': defaultToConfig2,
        'httpAgent': defaultToConfig2,
        'httpsAgent': defaultToConfig2,
        'cancelToken': defaultToConfig2,
        'socketPath': defaultToConfig2,
        'responseEncoding': defaultToConfig2,
        'validateStatus': mergeDirectKeys
      };
    
      utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
        var merge = mergeMap[prop] || mergeDeepProperties;
        var configValue = merge(prop);
        (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
      });
    
      return config;
    };
    
    
    /***/ }),
    /* 1591 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    "use strict";
    
    
    var VERSION = (__webpack_require__(1585).version);
    var AxiosError = __webpack_require__(1569);
    
    var validators = {};
    
    // eslint-disable-next-line func-names
    ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
      validators[type] = function validator(thing) {
        return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
      };
    });
    
    var deprecatedWarnings = {};
    
    /**
     * Transitional option validator
     * @param {function|boolean?} validator - set to false if the transitional option has been removed
     * @param {string?} version - deprecated version / removed since version
     * @param {string?} message - some message with additional info
     * @returns {function}
     */
    validators.transitional = function transitional(validator, version, message) {
      function formatMessage(opt, desc) {
        return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
      }
    
      // eslint-disable-next-line func-names
      return function(value, opt, opts) {
        if (validator === false) {
          throw new AxiosError(
            formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
            AxiosError.ERR_DEPRECATED
          );
        }
    
        if (version && !deprecatedWarnings[opt]) {
          deprecatedWarnings[opt] = true;
          // eslint-disable-next-line no-console
          console.warn(
            formatMessage(
              opt,
              ' has been deprecated since v' + version + ' and will be removed in the near future'
            )
          );
        }
    
        return validator ? validator(value, opt, opts) : true;
      };
    };
    
    /**
     * Assert object's properties type
     * @param {object} options
     * @param {object} schema
     * @param {boolean?} allowUnknown
     */
    
    function assertOptions(options, schema, allowUnknown) {
      if (typeof options !== 'object') {
        throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
      }
      var keys = Object.keys(options);
      var i = keys.length;
      while (i-- > 0) {
        var opt = keys[i];
        var validator = schema[opt];
        if (validator) {
          var value = options[opt];
          var result = value === undefined || validator(value, opt, options);
          if (result !== true) {
            throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
          }
          continue;
        }
        if (allowUnknown !== true) {
          throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
        }
      }
    }
    
    module.exports = {
      assertOptions: assertOptions,
      validators: validators
    };
    
    
    /***/ }),
    /* 1592 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    "use strict";
    
    
    var CanceledError = __webpack_require__(1580);
    
    /**
     * A `CancelToken` is an object that can be used to request cancellation of an operation.
     *
     * @class
     * @param {Function} executor The executor function.
     */
    function CancelToken(executor) {
      if (typeof executor !== 'function') {
        throw new TypeError('executor must be a function.');
      }
    
      var resolvePromise;
    
      this.promise = new Promise(function promiseExecutor(resolve) {
        resolvePromise = resolve;
      });
    
      var token = this;
    
      // eslint-disable-next-line func-names
      this.promise.then(function(cancel) {
        if (!token._listeners) return;
    
        var i;
        var l = token._listeners.length;
    
        for (i = 0; i < l; i++) {
          token._listeners[i](cancel);
        }
        token._listeners = null;
      });
    
      // eslint-disable-next-line func-names
      this.promise.then = function(onfulfilled) {
        var _resolve;
        // eslint-disable-next-line func-names
        var promise = new Promise(function(resolve) {
          token.subscribe(resolve);
          _resolve = resolve;
        }).then(onfulfilled);
    
        promise.cancel = function reject() {
          token.unsubscribe(_resolve);
        };
    
        return promise;
      };
    
      executor(function cancel(message) {
        if (token.reason) {
          // Cancellation has already been requested
          return;
        }
    
        token.reason = new CanceledError(message);
        resolvePromise(token.reason);
      });
    }
    
    /**
     * Throws a `CanceledError` if cancellation has been requested.
     */
    CancelToken.prototype.throwIfRequested = function throwIfRequested() {
      if (this.reason) {
        throw this.reason;
      }
    };
    
    /**
     * Subscribe to the cancel signal
     */
    
    CancelToken.prototype.subscribe = function subscribe(listener) {
      if (this.reason) {
        listener(this.reason);
        return;
      }
    
      if (this._listeners) {
        this._listeners.push(listener);
      } else {
        this._listeners = [listener];
      }
    };
    
    /**
     * Unsubscribe from the cancel signal
     */
    
    CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
      if (!this._listeners) {
        return;
      }
      var index = this._listeners.indexOf(listener);
      if (index !== -1) {
        this._listeners.splice(index, 1);
      }
    };
    
    /**
     * Returns an object that contains a new `CancelToken` and a function that, when called,
     * cancels the `CancelToken`.
     */
    CancelToken.source = function source() {
      var cancel;
      var token = new CancelToken(function executor(c) {
        cancel = c;
      });
      return {
        token: token,
        cancel: cancel
      };
    };
    
    module.exports = CancelToken;
    
    
    /***/ }),
    /* 1593 */
    /***/ ((module) => {
    
    "use strict";
    
    
    /**
     * Syntactic sugar for invoking a function and expanding an array for arguments.
     *
     * Common use case would be to use `Function.prototype.apply`.
     *
     *  ```js
     *  function f(x, y, z) {}
     *  var args = [1, 2, 3];
     *  f.apply(null, args);
     *  ```
     *
     * With `spread` this example can be re-written.
     *
     *  ```js
     *  spread(function(x, y, z) {})([1, 2, 3]);
     *  ```
     *
     * @param {Function} callback
     * @returns {Function}
     */
    module.exports = function spread(callback) {
      return function wrap(arr) {
        return callback.apply(null, arr);
      };
    };
    
    
    /***/ }),
    /* 1594 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    "use strict";
    
    
    var utils = __webpack_require__(1560);
    
    /**
     * Determines whether the payload is an error thrown by Axios
     *
     * @param {*} payload The value to test
     * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
     */
    module.exports = function isAxiosError(payload) {
      return utils.isObject(payload) && (payload.isAxiosError === true);
    };
    
    
    /***/ }),
    /* 1595 */,
    /* 1596 */,
    /* 1597 */,
    /* 1598 */,
    /* 1599 */,
    /* 1600 */,
    /* 1601 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    // @ts-check
    const { log, errors } = __webpack_require__(1)
    const soapRequest = __webpack_require__(1331)
    const { parseTags, parseValue } = __webpack_require__(1555)
    const { commanderArretServiceSouscritMesures } = __webpack_require__(1556)
    const xml2js = __webpack_require__(1513)
    
    /**
     * @param {string} url
     * @param {string} apiAuthKey
     * @param {string} appLogin
     * @param {number} pointId
     * @param {number} serviceId
     * @return {Promise<string>} User contractId
     */
    async function terminateContract(
      url,
      apiAuthKey,
      appLogin,
      contractId,
      pointId,
      serviceId
    ) {
      log('info', 'terminateContract')
      const sgeHeaders = {
        'Content-Type': 'text/xml;charset=UTF-8',
        apikey: apiAuthKey,
      }
    
      const { response } = await soapRequest({
        url: `${url}/enedis_SGE_CommandeArretServiceSouscritMesures/1.0`,
        headers: sgeHeaders,
        xml: commanderArretServiceSouscritMesures(
          appLogin,
          contractId,
          pointId,
          serviceId
        ),
      }).catch(err => {
        log('error', 'commanderArretServiceSouscritMesures')
        log('error', err)
        throw errors.VENDOR_DOWN
      })
    
      const parsedReply = await xml2js.parseStringPromise(response.body, {
        tagNameProcessors: [parseTags],
        valueProcessors: [parseValue],
        explicitArray: false,
      })
    
      try {
        // We don't need any action on reply for now
        if (parsedReply.Envelope.Body.Fault) {
          log(
            'error',
            `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}`
          )
        }
        return parsedReply
      } catch (error) {
        log('error', 'Error while parsing user contract termination: ' + error)
        log(
          'error',
          `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}`
        )
        throw errors.VENDOR_DOWN
      }
    }
    
    module.exports = { terminateContract }
    
    
    /***/ }),
    /* 1602 */,
    /* 1603 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    const { log, updateOrCreate } = __webpack_require__(1)
    const { iSLocal } = __webpack_require__(1604)
    const cozyClient = __webpack_require__(485)
    
    async function saveAccountData(accountId, accountData) {
      log('info', `saveAccountData: ${accountId}`)
    
      let account = await getAccount(accountId)
    
      account = await updateOrCreate(
        [{ ...account, data: accountData }],
        'io.cozy.accounts'
      )
      return account
    }
    
    async function getAccount(accountId) {
      log('info', `getAccount: ${accountId}`)
      //TODO: refactor with usageof cozy-libs. Not working during implementation
      const accounts = await cozyClient.data.findAll('io.cozy.accounts')
      return accounts.filter(account =>
        iSLocal() ? account._id === accountId : account.account_type === accountId
      )[0]
    }
    
    module.exports = { getAccount, saveAccountData }
    
    
    /***/ }),
    /* 1604 */
    /***/ ((module) => {
    
    function iSLocal() {
      return (
        process.env.NODE_ENV === 'development' ||
        process.env.NODE_ENV === 'local' ||
        process.env.NODE_ENV === 'standalone'
      )
    }
    
    module.exports = { iSLocal }
    
    
    /***/ }),
    /* 1605 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    const { log, errors } = __webpack_require__(1)
    const { getAccountRev, getAccountSecret } = __webpack_require__(1606)
    const { getBoConsent, deleteBoConsent } = __webpack_require__(1557)
    const { terminateContract } = __webpack_require__(1601)
    const { getAccount } = __webpack_require__(1603)
    // const getAccountSecret = require('./helpers/getAccountSecret')
    const moment = __webpack_require__(1373)
    __webpack_require__(1510)
    moment.locale('fr') // set the language
    moment.tz.setDefault('Europe/Paris') // set the timezone
    const { iSLocal } = __webpack_require__(1604)
    const ACCOUNT_ID = iSLocal() ? 'default_account_id' : 'enedis-sge-grandlyon'
    
    async function onDeleteAccount() {
      log('info', 'Deleting account ...')
      log('info', 'Getting secrets ...')
      const secrets = getAccountSecret()
      const accountRev = getAccountRev()
    
      if (accountRev) {
        log('info', 'Account rev exist')
        const accountData = await getAccount(ACCOUNT_ID)
        const userConsent = await getBoConsent(accountData.data.consentId)
    
        if (userConsent.pointId && userConsent.pointId) {
          log('error', `Consent found for user`)
          if (userConsent.serviceId) {
            await deleteBoConsent(userConsent.id)
            await terminateContract(
              secrets.baseUrl,
              secrets.apiAuthKey,
              secrets.sgeLogin,
              secrets.contractId,
              userConsent.pointId,
              userConsent.serviceId
            )
          } else {
            log('error', `No service id retrieved from BO`)
            throw errors.VENDOR_DOWN
          }
        }
    
        log('info', 'Deleting account succeed')
      } else {
        log(
          'error',
          'No account revision was found, something went wrong during the deletion of said account'
        )
        throw errors.VENDOR_DOWN
      }
    }
    
    onDeleteAccount().then(
      () => {
        log('info', `onDeleteAccount: Successfully delete consent and account.`)
      },
      err => {
        log(
          'error',
          `onDeleteAccount: An error occured during script: ${err.message}`
        )
        throw errors.VENDOR_DOWN
      }
    )
    
    module.exports = { onDeleteAccount }
    
    
    /***/ }),
    /* 1606 */
    /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
    
    const { log } = __webpack_require__(1)
    const { iSLocal } = __webpack_require__(1604)
    
    function getAccountId() {
      log('info', `getAccountId`)
      try {
        return JSON.parse(process.env.COZY_FIELDS).account
      } catch (err) {
        throw new Error(`You must provide 'account' in COZY_FIELDS: ${err.message}`)
      }
    }
    
    function getAccountRev() {
      log('info', `getAccountRev`)
      try {
        return iSLocal()
          ? 'fakeAccountRev'
          : JSON.parse(process.env.COZY_FIELDS).account_rev
      } catch (err) {
        throw new Error(`You must provide 'account' in COZY_FIELDS: ${err.message}`)
      }
    }
    
    function getAccountSecret() {
      try {
        return iSLocal()
          ? {
              baseUrl: 'https://apis.grandlyon.fr',
              sgeLogin: 'donnees.energie@grandlyon.com',
              contractId: '4921350',
              apiAuthKey:
                'eyJ4NXQiOiJaR1l4TVRBeVlqaGxNbVU0T1dReE56SXhZbU01TUdZMk5XVmxNak15TWpVeE9XUXdOakppWlE9PSIsImtpZCI6ImdhdGV3YXlfY2VydGlmaWNhdGVfYWxpYXMiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJMREFQXC9JUEo5MTUzQGNhcmJvbi5zdXBlciIsImFwcGxpY2F0aW9uIjp7Im93bmVyIjoiTERBUFwvSVBKOTE1MyIsInRpZXJRdW90YVR5cGUiOm51bGwsInRpZXIiOiJVbmxpbWl0ZWQiLCJuYW1lIjoiU0dFIiwiaWQiOjMwLCJ1dWlkIjoiYjU0MWYxZDEtYTMzYi00ODYyLThiOGQtNTk4MDljYjQzNWRjIn0sImlzcyI6Imh0dHBzOlwvXC9hcGlzLmdyYW5kbHlvbi5mcjo0NDNcL29hdXRoMlwvdG9rZW4iLCJ0aWVySW5mbyI6eyJVbmxpbWl0ZWQiOnsidGllclF1b3RhVHlwZSI6InJlcXVlc3RDb3VudCIsImdyYXBoUUxNYXhDb21wbGV4aXR5IjowLCJncmFwaFFMTWF4RGVwdGgiOjAsInN0b3BPblF1b3RhUmVhY2giOnRydWUsInNwaWtlQXJyZXN0TGltaXQiOjAsInNwaWtlQXJyZXN0VW5pdCI6bnVsbH19LCJrZXl0eXBlIjoiUFJPRFVDVElPTiIsInBlcm1pdHRlZFJlZmVyZXIiOiIiLCJzdWJzY3JpYmVkQVBJcyI6W3sic3Vic2NyaWJlclRlbmFudERvbWFpbiI6ImNhcmJvbi5zdXBlciIsIm5hbWUiOiJlbmVkaXNfU0RFX3JlY2hlcmNoZS1wb2ludCIsImNvbnRleHQiOiJcL2VuZWRpc19TREVfcmVjaGVyY2hlLXBvaW50XC8xLjAiLCJwdWJsaXNoZXIiOiJhZG1pbiIsInZlcnNpb24iOiIxLjAiLCJz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kiLCJwZXJtaXR0ZWRJUCI6IiIsImlhdCI6MTY1MDg5MDYwNiwianRpIjoiYWQzNjNlNzAtMTVhOS00NzQ1LWExNDEtOGIxOTU5MjQwZTM3In0=.UK5Jx1WRA0A6KVUFK5rs5RH7e9qAWn4v_AmmX_CHD3MNzZWikaUFD1UmS_VvMfWvqLMvRBqbkVH0X5na46e8cZA6WYaQuI5xu9oEOptv8HRY3VX-4VBpjvmTcSSRmCN6AqyalggWbzVlDsKCpVyFWavGi-DFrd7Fe9U41kNs33Li-C9LU794LEaqBPfC8avNwHv8UTzkpExR1jwCXjkLXQ-M8txHgdGGYqZ2VN0_8DeuJ7BOYQGmmENxMt0orm9k9ubtLIijnfNAOLRUZcboQRAURE_IdtuBRG0EWBkkDocefWysmckKBt6lUMtYjxpzWCDyw9UYyQAaPC1Ogy6oAg==',
            }
          : JSON.parse(process.env.COZY_PARAMETERS).secret
      } catch (err) {
        throw new Error(
          `You must provide 'account-types' in COZY_PARAMETERS: ${err.message}`
        )
      }
    }
    module.exports = { getAccountId, getAccountRev, getAccountSecret }
    
    
    /***/ })
    /******/ 	]);
    /************************************************************************/
    /******/ 	// The module cache
    /******/ 	var __webpack_module_cache__ = {};
    /******/ 	
    /******/ 	// The require function
    /******/ 	function __webpack_require__(moduleId) {
    /******/ 		// Check if module is in cache
    /******/ 		var cachedModule = __webpack_module_cache__[moduleId];
    /******/ 		if (cachedModule !== undefined) {
    /******/ 			return cachedModule.exports;
    /******/ 		}
    /******/ 		// Create a new module (and put it into the cache)
    /******/ 		var module = __webpack_module_cache__[moduleId] = {
    /******/ 			id: moduleId,
    /******/ 			loaded: false,
    /******/ 			exports: {}
    /******/ 		};
    /******/ 	
    /******/ 		// Execute the module function
    /******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    /******/ 	
    /******/ 		// Flag the module as loaded
    /******/ 		module.loaded = true;
    /******/ 	
    /******/ 		// Return the exports of the module
    /******/ 		return module.exports;
    /******/ 	}
    /******/ 	
    /******/ 	// expose the module cache
    /******/ 	__webpack_require__.c = __webpack_module_cache__;
    /******/ 	
    /************************************************************************/
    /******/ 	/* webpack/runtime/compat get default export */
    /******/ 	(() => {
    /******/ 		// getDefaultExport function for compatibility with non-harmony modules
    /******/ 		__webpack_require__.n = (module) => {
    /******/ 			var getter = module && module.__esModule ?
    /******/ 				() => (module['default']) :
    /******/ 				() => (module);
    /******/ 			__webpack_require__.d(getter, { a: getter });
    /******/ 			return getter;
    /******/ 		};
    /******/ 	})();
    /******/ 	
    /******/ 	/* webpack/runtime/define property getters */
    /******/ 	(() => {
    /******/ 		// define getter functions for harmony exports
    /******/ 		__webpack_require__.d = (exports, definition) => {
    /******/ 			for(var key in definition) {
    /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    /******/ 				}
    /******/ 			}
    /******/ 		};
    /******/ 	})();
    /******/ 	
    /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    /******/ 	(() => {
    /******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
    /******/ 	})();
    /******/ 	
    /******/ 	/* webpack/runtime/make namespace object */
    /******/ 	(() => {
    /******/ 		// define __esModule on exports
    /******/ 		__webpack_require__.r = (exports) => {
    /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    /******/ 			}
    /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    /******/ 		};
    /******/ 	})();
    /******/ 	
    /******/ 	/* webpack/runtime/node module decorator */
    /******/ 	(() => {
    /******/ 		__webpack_require__.nmd = (module) => {
    /******/ 			module.paths = [];
    /******/ 			if (!module.children) module.children = [];
    /******/ 			return module;
    /******/ 		};
    /******/ 	})();
    /******/ 	
    /************************************************************************/
    /******/ 	
    /******/ 	// module cache are used so entry inlining is disabled
    /******/ 	// startup
    /******/ 	// Load entry module and return exports
    /******/ 	var __webpack_exports__ = __webpack_require__(__webpack_require__.s = 1605);
    /******/ 	
    /******/ })()
    ;