[
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\n    [\n      \"es2015\", {\n        \"loose\": true,\n        \"modules\": false\n      }\n    ]\n  ],\n  \"env\": {\n    \"commonjs\": {\n      \"plugins\": [\n        [\"transform-es2015-modules-commonjs\", { \"loose\": true }]\n      ]\n    }\n  }\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "# Editor configuration, see http://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[index.d.ts]\nindent_style = space\nindent_size = 4\n"
  },
  {
    "path": ".eslintignore",
    "content": "src/BigInteger.js\n"
  },
  {
    "path": ".eslintrc.yaml",
    "content": "root: true\nextends:\n- airbnb-base\nenv:\n  browser: true\nsettings:\n  import/resolver: webpack\nrules:\n  # Git-controlled\n  linebreak-style: off\n  # sjcl hmac breaks new-cap\n  new-cap:\n  - error\n  - newIsCapExceptions:\n    - sjcl.misc.hmac\n  # Check JSDocs\n  valid-jsdoc: error\n  require-jsdoc:\n  - error\n  - require:\n      FunctionDeclaration: true\n      ClassDeclaration: true\n      MethodDefinition: true\n  # Seems this doesn't use import/resolver? import/no-unresolved catches most of these anyway.\n  # https://github.com/benmosher/eslint-plugin-import/issues/496\n  import/no-extraneous-dependencies: off\n"
  },
  {
    "path": ".gitignore",
    "content": "/node_modules/\nnpm-debug.log\n\n/docs/\n\nes\n\nios/RNAWSCognito.xcodeproj/xcuserdata/\nios/RNAWSCognito.project.xcworkspace/xcuserdata/\nios/RNAWSCognito.xcodeproj/project.xcworkspace/xcuserdata/\n\n.DS_Store\n"
  },
  {
    "path": ".npmignore",
    "content": ""
  },
  {
    "path": "LICENSE.txt",
    "content": "Amazon Software License\nThis Amazon Software License (“License”) governs your use, reproduction, and distribution of the accompanying software as specified below.\n1. Definitions\n“Licensor” means any person or entity that distributes its Work.\n\n“Software” means the original work of authorship made available under this License.\n\n“Work” means the Software and any additions to or derivative works of the Software that are made available under this License.\n\nThe terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the meaning as provided under U.S. copyright law; provided, however, that for the purposes of this License, derivative works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work.\n\nWorks, including the Software, are “made available” under this License by including in or with the Work either (a) a copyright notice referencing the applicability of this License to the Work, or (b) a copy of this License.\n2. License Grants\n2.1 Copyright Grant. Subject to the terms and conditions of this License, each Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free, copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense and distribute its Work and any resulting derivative works in any form.\n2.2 Patent Grant. Subject to the terms and conditions of this License, each Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free patent license to make, have made, use, sell, offer for sale, import, and otherwise transfer its Work, in whole or in part. The foregoing license applies only to the patent claims licensable by Licensor that would be infringed by Licensor’s Work (or portion thereof) individually and excluding any combinations with any other materials or technology.\n3. Limitations\n3.1 Redistribution. You may reproduce or distribute the Work only if (a) you do so under this License, (b) you include a complete copy of this License with your distribution, and (c) you retain without modification any copyright, patent, trademark, or attribution notices that are present in the Work.\n3.2 Derivative Works. You may specify that additional or different terms apply to the use, reproduction, and distribution of your derivative works of the Work (“Your Terms”) only if (a) Your Terms provide that the use limitation in Section 3.3 applies to your derivative works, and (b) you identify the specific derivative works that are subject to Your Terms. Notwithstanding Your Terms, this License (including the redistribution requirements in Section 3.1) will continue to apply to the Work itself.\n3.3 Use Limitation. The Work and any derivative works thereof only may be used or intended for use with the web services, computing platforms or applications provided by Amazon.com, Inc. or its affiliates, including Amazon Web Services, Inc.\n3.4 Patent Claims. If you bring or threaten to bring a patent claim against any Licensor (including any claim, cross-claim or counterclaim in a lawsuit) to enforce any patents that you allege are infringed by any Work, then your rights under this License from such Licensor (including the grants in Sections 2.1 and 2.2) will terminate immediately.\n3.5 Trademarks. This License does not grant any rights to use any Licensor’s or its affiliates’ names, logos, or trademarks, except as necessary to reproduce the notices described in this License.\n3.6 Termination. If you violate any term of this License, then your rights under this License (including the grants in Sections 2.1 and 2.2) will terminate immediately.\n4. Disclaimer of Warranty.\nTHE WORK IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF M ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER THIS LICENSE. SOME STATES’ CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.\n5. Limitation of Liability.\nEXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER COMM ERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\nEffective Date – April 18, 2008 © 2008 Amazon.com, Inc. or its affiliates. All rights reserved.\n"
  },
  {
    "path": "NOTICE.txt",
    "content": "Amazon Cognito Identity Provider SDK for JavaScript\nCopyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n=========================================================================\n==                 JavaScript BN library Notice                        ==\n=========================================================================\n\nThis product includes software developed by Tom Wu at Stanford University.\nhttp://www-cs-students.stanford.edu/%7Etjw/jsbn/jsbn.js\n\n=========================================================================\n==                 JKBigInteger library Notice                        ==\n=========================================================================\n\nThis product includes the JKBigInteger library licensed under the MIT license.\n\nCopyright (C) 2013 Jānis Kiršteins\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Amazon Cognito Identity SDK for JavaScript\n\n**NOTE: We have discontinued developing this library as part of this GitHub repository. We will continue to develop it as part of the [AWS Amplify](https://github.com/aws/aws-amplify/tree/master/packages/amazon-cognito-identity-js) GitHub repository. You can still reach us by creating an issue on the AWS Amplify GitHub repository or posting to the Amazon Cognito Identity forums. Versions 1.x will still be available via NPM. Future development will continue on the 2.x versions.**\n"
  },
  {
    "path": "RNAWSCognito.podspec",
    "content": "# coding: utf-8\nPod::Spec.new do |s|\n  s.name    = \"RNAWSCognito\"\n  s.version = \"1.29.0\"\n  s.requires_arc = true\n  s.platforms = { :ios => \"8.0\" }\n  s.license = { :file => 'LICENSE.txt' }\n  s.homepage = \"https://github.com/aws/amazon-cognito-identity-js\"\n  s.author = \"Amazon\"\n  \n  s.summary = \"Amazon Cognito Identity SDK for JavaScript\"\n  s.description = <<-DESC\n                    The Amazon Cognito Identity SDK for JavaScript allows JavaScript enabled applications to sign-up users, authenticate users, view, delete, and update user attributes within the Amazon Cognito Identity service.\n                  DESC\n\n  s.source = { :git => \"https://github.com/aws/amazon-cognito-identity-js.git\", :tag => s.version.to_s }\n  s.source_files     = 'ios/RNAWSCognito.{h,m}'\n  s.dependency 'JKBigInteger2', '0.0.5'\nend\n"
  },
  {
    "path": "android/build.gradle",
    "content": "buildscript {\n    repositories {\n        jcenter()\n    }\n\n    dependencies {\n        classpath 'com.android.tools.build:gradle:1.3.1'\n    }\n}\n\napply plugin: 'com.android.library'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.1\"\n\n    defaultConfig {\n        minSdkVersion 16\n        targetSdkVersion 22\n        versionCode 1\n        versionName \"1.0\"\n    }\n    lintOptions {\n        abortOnError false\n    }\n}\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    compile 'com.facebook.react:react-native:+'\n}\n"
  },
  {
    "path": "android/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          package=\"com.amazonaws\">\n\n</manifest>\n"
  },
  {
    "path": "android/src/main/java/com/amazonaws/RNAWSCognitoModule.java",
    "content": "package com.amazonaws;\n\nimport com.facebook.react.bridge.ReactApplicationContext;\nimport com.facebook.react.bridge.ReactContextBaseJavaModule;\nimport com.facebook.react.bridge.ReactMethod;\nimport com.facebook.react.bridge.ReadableMap;\nimport com.facebook.react.bridge.Callback;\nimport java.math.BigInteger;\n\npublic class RNAWSCognitoModule extends ReactContextBaseJavaModule {\n\n  private final ReactApplicationContext reactContext;\n\n  private static final String HEX_N = \"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1\"\n          + \"29024E088A67CC74020BBEA63B139B22514A08798E3404DD\"\n          + \"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245\"\n          + \"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED\"\n          + \"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D\"\n          + \"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F\"\n          + \"83655D23DCA3AD961C62F356208552BB9ED529077096966D\"\n          + \"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B\"\n          + \"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9\"\n          + \"DE2BCBF6955817183995497CEA956AE515D2261898FA0510\"\n          + \"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64\"\n          + \"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7\"\n          + \"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B\"\n          + \"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C\"\n          + \"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31\"\n          + \"43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF\";\n\n  private static final BigInteger N = new BigInteger(HEX_N, 16);\n\n  public RNAWSCognitoModule(ReactApplicationContext reactContext) {\n    super(reactContext);\n    this.reactContext = reactContext;\n  }\n\n  @Override\n  public String getName() {\n    return \"RNAWSCognito\";\n  }\n\n  @ReactMethod\n  public void computeModPow(final ReadableMap values, final Callback callback) {\n    try {\n      final BigInteger target = new BigInteger(values.getString(\"target\"), 16);\n      final BigInteger value = new BigInteger(values.getString(\"value\"), 16);\n      final BigInteger modifier = new BigInteger(values.getString(\"modifier\"), 16);\n      final BigInteger result = target.modPow(value, modifier);\n      callback.invoke(null, result.toString(16));\n    } catch (final Exception e) {\n      callback.invoke(e.getMessage(), null);\n    }\n  }\n\n  @ReactMethod\n  public void computeS(final ReadableMap values, final Callback callback) {\n    try {\n      final BigInteger g = new BigInteger(values.getString(\"g\"), 16);\n      final BigInteger x = new BigInteger(values.getString(\"x\"), 16);\n      final BigInteger k = new BigInteger(values.getString(\"k\"), 16);\n      final BigInteger a = new BigInteger(values.getString(\"a\"), 16);\n      final BigInteger b = new BigInteger(values.getString(\"b\"), 16);\n      final BigInteger u = new BigInteger(values.getString(\"u\"), 16);\n      final BigInteger exp = a.add(u.multiply(x));\n      final BigInteger base = b.subtract(k.multiply(g.modPow(x, N)));\n      final BigInteger result = base.modPow(exp, N).mod(N);\n      callback.invoke(null, result.toString(16));\n    } catch (final Exception e) {\n      callback.invoke(e.getMessage(), null);\n    }\n  }\n}"
  },
  {
    "path": "android/src/main/java/com/amazonaws/RNAWSCognitoPackage.java",
    "content": "package com.amazonaws;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.facebook.react.ReactPackage;\nimport com.facebook.react.bridge.NativeModule;\nimport com.facebook.react.bridge.ReactApplicationContext;\nimport com.facebook.react.uimanager.ViewManager;\nimport com.facebook.react.bridge.JavaScriptModule;\n\npublic class RNAWSCognitoPackage implements ReactPackage {\n    @Override\n    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {\n      return Arrays.<NativeModule>asList(new RNAWSCognitoModule(reactContext));\n    }\n\n    public List<Class<? extends JavaScriptModule>> createJSModules() {\n      return Collections.emptyList();\n    }\n\n    @Override\n    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {\n      return Collections.emptyList();\n    }\n}"
  },
  {
    "path": "dist/amazon-cognito-identity.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n * \n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n * \n *     http://aws.amazon.com/asl/\n * \n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License. \n */\n\n\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"aws-sdk/global\"), require(\"aws-sdk/clients/cognitoidentityserviceprovider\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"aws-sdk/global\", \"aws-sdk/clients/cognitoidentityserviceprovider\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AmazonCognitoIdentity\"] = factory(require(\"aws-sdk/global\"), require(\"aws-sdk/clients/cognitoidentityserviceprovider\"));\n\telse\n\t\troot[\"AmazonCognitoIdentity\"] = factory(root[\"AWSCognito\"], root[\"AWSCognito\"][\"CognitoIdentityServiceProvider\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_13__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _src = __webpack_require__(17);\n\n\tObject.keys(_src).forEach(function (key) {\n\t  if (key === \"default\" || key === \"__esModule\") return;\n\t  Object.defineProperty(exports, key, {\n\t    enumerable: true,\n\t    get: function get() {\n\t      return _src[key];\n\t    }\n\t  });\n\t});\n\n\tvar _cognitoidentityserviceprovider = __webpack_require__(13);\n\n\tvar _cognitoidentityserviceprovider2 = _interopRequireDefault(_cognitoidentityserviceprovider);\n\n\tvar enhancements = _interopRequireWildcard(_src);\n\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\tObject.keys(enhancements).forEach(function (key) {\n\t  _cognitoidentityserviceprovider2.default[key] = enhancements[key];\n\t});\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _global = __webpack_require__(1);\n\n\tvar _BigInteger = __webpack_require__(3);\n\n\tvar _BigInteger2 = _interopRequireDefault(_BigInteger);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n\t                                                                                                                                                           * Copyright 2016 Amazon.com,\n\t                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n\t                                                                                                                                                           * You may not use this file except in compliance with the\n\t                                                                                                                                                           * License. A copy of the License is located at\n\t                                                                                                                                                           *\n\t                                                                                                                                                           *     http://aws.amazon.com/asl/\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n\t                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n\t                                                                                                                                                           * for the specific language governing permissions and\n\t                                                                                                                                                           * limitations under the License.\n\t                                                                                                                                                           */\n\n\tvar initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD' + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245' + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D' + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F' + '83655D23DCA3AD961C62F356208552BB9ED529077096966D' + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9' + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510' + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64' + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B' + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C' + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\n\n\tvar newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n\n\t/** @class */\n\n\tvar AuthenticationHelper = function () {\n\t  /**\n\t   * Constructs a new AuthenticationHelper object\n\t   * @param {string} PoolName Cognito user pool name.\n\t   */\n\t  function AuthenticationHelper(PoolName) {\n\t    _classCallCheck(this, AuthenticationHelper);\n\n\t    this.N = new _BigInteger2.default(initN, 16);\n\t    this.g = new _BigInteger2.default('2', 16);\n\t    this.k = new _BigInteger2.default(this.hexHash('00' + this.N.toString(16) + '0' + this.g.toString(16)), 16);\n\n\t    this.smallAValue = this.generateRandomSmallA();\n\t    this.getLargeAValue(function () {});\n\n\t    this.infoBits = new _global.util.Buffer('Caldera Derived Key', 'utf8');\n\n\t    this.poolName = PoolName;\n\t  }\n\n\t  /**\n\t   * @returns {BigInteger} small A, a random number\n\t   */\n\n\n\t  AuthenticationHelper.prototype.getSmallAValue = function getSmallAValue() {\n\t    return this.smallAValue;\n\t  };\n\n\t  /**\n\t   * @param {nodeCallback<BigInteger>} callback Called with (err, largeAValue)\n\t   * @returns {void}\n\t   */\n\n\n\t  AuthenticationHelper.prototype.getLargeAValue = function getLargeAValue(callback) {\n\t    var _this = this;\n\n\t    if (this.largeAValue) {\n\t      callback(null, this.largeAValue);\n\t    } else {\n\t      this.calculateA(this.smallAValue, function (err, largeAValue) {\n\t        if (err) {\n\t          callback(err, null);\n\t        }\n\n\t        _this.largeAValue = largeAValue;\n\t        callback(null, _this.largeAValue);\n\t      });\n\t    }\n\t  };\n\n\t  /**\n\t   * helper function to generate a random big integer\n\t   * @returns {BigInteger} a random value.\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.generateRandomSmallA = function generateRandomSmallA() {\n\t    var hexRandom = _global.util.crypto.lib.randomBytes(128).toString('hex');\n\n\t    var randomBigInt = new _BigInteger2.default(hexRandom, 16);\n\t    var smallABigInt = randomBigInt.mod(this.N);\n\n\t    return smallABigInt;\n\t  };\n\n\t  /**\n\t   * helper function to generate a random string\n\t   * @returns {string} a random value.\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.generateRandomString = function generateRandomString() {\n\t    return _global.util.crypto.lib.randomBytes(40).toString('base64');\n\t  };\n\n\t  /**\n\t   * @returns {string} Generated random value included in password hash.\n\t   */\n\n\n\t  AuthenticationHelper.prototype.getRandomPassword = function getRandomPassword() {\n\t    return this.randomPassword;\n\t  };\n\n\t  /**\n\t   * @returns {string} Generated random value included in devices hash.\n\t   */\n\n\n\t  AuthenticationHelper.prototype.getSaltDevices = function getSaltDevices() {\n\t    return this.SaltToHashDevices;\n\t  };\n\n\t  /**\n\t   * @returns {string} Value used to verify devices.\n\t   */\n\n\n\t  AuthenticationHelper.prototype.getVerifierDevices = function getVerifierDevices() {\n\t    return this.verifierDevices;\n\t  };\n\n\t  /**\n\t   * Generate salts and compute verifier.\n\t   * @param {string} deviceGroupKey Devices to generate verifier for.\n\t   * @param {string} username User to generate verifier for.\n\t   * @param {nodeCallback<null>} callback Called with (err, null)\n\t   * @returns {void}\n\t   */\n\n\n\t  AuthenticationHelper.prototype.generateHashDevice = function generateHashDevice(deviceGroupKey, username, callback) {\n\t    var _this2 = this;\n\n\t    this.randomPassword = this.generateRandomString();\n\t    var combinedString = '' + deviceGroupKey + username + ':' + this.randomPassword;\n\t    var hashedString = this.hash(combinedString);\n\n\t    var hexRandom = _global.util.crypto.lib.randomBytes(16).toString('hex');\n\t    this.SaltToHashDevices = this.padHex(new _BigInteger2.default(hexRandom, 16));\n\n\t    this.g.modPow(new _BigInteger2.default(this.hexHash(this.SaltToHashDevices + hashedString), 16), this.N, function (err, verifierDevicesNotPadded) {\n\t      if (err) {\n\t        callback(err, null);\n\t      }\n\n\t      _this2.verifierDevices = _this2.padHex(verifierDevicesNotPadded);\n\t      callback(null, null);\n\t    });\n\t  };\n\n\t  /**\n\t   * Calculate the client's public value A = g^a%N\n\t   * with the generated random number a\n\t   * @param {BigInteger} a Randomly generated small A.\n\t   * @param {nodeCallback<BigInteger>} callback Called with (err, largeAValue)\n\t   * @returns {void}\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.calculateA = function calculateA(a, callback) {\n\t    var _this3 = this;\n\n\t    this.g.modPow(a, this.N, function (err, A) {\n\t      if (err) {\n\t        callback(err, null);\n\t      }\n\n\t      if (A.mod(_this3.N).equals(_BigInteger2.default.ZERO)) {\n\t        callback(new Error('Illegal paramater. A mod N cannot be 0.'), null);\n\t      }\n\n\t      callback(null, A);\n\t    });\n\t  };\n\n\t  /**\n\t   * Calculate the client's value U which is the hash of A and B\n\t   * @param {BigInteger} A Large A value.\n\t   * @param {BigInteger} B Server B value.\n\t   * @returns {BigInteger} Computed U value.\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.calculateU = function calculateU(A, B) {\n\t    this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n\t    var finalU = new _BigInteger2.default(this.UHexHash, 16);\n\n\t    return finalU;\n\t  };\n\n\t  /**\n\t   * Calculate a hash from a bitArray\n\t   * @param {Buffer} buf Value to hash.\n\t   * @returns {String} Hex-encoded hash.\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.hash = function hash(buf) {\n\t    var hashHex = _global.util.crypto.sha256(buf, 'hex');\n\t    return new Array(64 - hashHex.length).join('0') + hashHex;\n\t  };\n\n\t  /**\n\t   * Calculate a hash from a hex string\n\t   * @param {String} hexStr Value to hash.\n\t   * @returns {String} Hex-encoded hash.\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.hexHash = function hexHash(hexStr) {\n\t    return this.hash(new _global.util.Buffer(hexStr, 'hex'));\n\t  };\n\n\t  /**\n\t   * Standard hkdf algorithm\n\t   * @param {Buffer} ikm Input key material.\n\t   * @param {Buffer} salt Salt value.\n\t   * @returns {Buffer} Strong key material.\n\t   * @private\n\t   */\n\n\n\t  AuthenticationHelper.prototype.computehkdf = function computehkdf(ikm, salt) {\n\t    var prk = _global.util.crypto.hmac(salt, ikm, 'buffer', 'sha256');\n\t    var infoBitsUpdate = _global.util.buffer.concat([this.infoBits, new _global.util.Buffer(String.fromCharCode(1), 'utf8')]);\n\t    var hmac = _global.util.crypto.hmac(prk, infoBitsUpdate, 'buffer', 'sha256');\n\t    return hmac.slice(0, 16);\n\t  };\n\n\t  /**\n\t   * Calculates the final hkdf based on computed S value, and computed U value and the key\n\t   * @param {String} username Username.\n\t   * @param {String} password Password.\n\t   * @param {BigInteger} serverBValue Server B value.\n\t   * @param {BigInteger} salt Generated salt.\n\t   * @param {nodeCallback<Buffer>} callback Called with (err, hkdfValue)\n\t   * @returns {void}\n\t   */\n\n\n\t  AuthenticationHelper.prototype.getPasswordAuthenticationKey = function getPasswordAuthenticationKey(username, password, serverBValue, salt, callback) {\n\t    var _this4 = this;\n\n\t    if (serverBValue.mod(this.N).equals(_BigInteger2.default.ZERO)) {\n\t      throw new Error('B cannot be zero.');\n\t    }\n\n\t    this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n\t    if (this.UValue.equals(_BigInteger2.default.ZERO)) {\n\t      throw new Error('U cannot be zero.');\n\t    }\n\n\t    var usernamePassword = '' + this.poolName + username + ':' + password;\n\t    var usernamePasswordHash = this.hash(usernamePassword);\n\n\t    var xValue = new _BigInteger2.default(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n\t    this.calculateS(xValue, serverBValue, function (err, sValue) {\n\t      if (err) {\n\t        callback(err, null);\n\t      }\n\n\t      var hkdf = _this4.computehkdf(new _global.util.Buffer(_this4.padHex(sValue), 'hex'), new _global.util.Buffer(_this4.padHex(_this4.UValue.toString(16)), 'hex'));\n\n\t      callback(null, hkdf);\n\t    });\n\t  };\n\n\t  /**\n\t   * Calculates the S value used in getPasswordAuthenticationKey\n\t   * @param {BigInteger} xValue Salted password hash value.\n\t   * @param {BigInteger} serverBValue Server B value.\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  AuthenticationHelper.prototype.calculateS = function calculateS(xValue, serverBValue, callback) {\n\t    var _this5 = this;\n\n\t    this.g.modPow(xValue, this.N, function (err, gModPowXN) {\n\t      if (err) {\n\t        callback(err, null);\n\t      }\n\n\t      var intValue2 = serverBValue.subtract(_this5.k.multiply(gModPowXN));\n\t      intValue2.modPow(_this5.smallAValue.add(_this5.UValue.multiply(xValue)), _this5.N, function (err2, result) {\n\t        if (err2) {\n\t          callback(err2, null);\n\t        }\n\n\t        callback(null, result.mod(_this5.N));\n\t      });\n\t    });\n\t  };\n\n\t  /**\n\t  * Return constant newPasswordRequiredChallengeUserAttributePrefix\n\t  * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n\t  */\n\n\n\t  AuthenticationHelper.prototype.getNewPasswordRequiredChallengeUserAttributePrefix = function getNewPasswordRequiredChallengeUserAttributePrefix() {\n\t    return newPasswordRequiredChallengeUserAttributePrefix;\n\t  };\n\n\t  /**\n\t   * Converts a BigInteger (or hex string) to hex format padded with zeroes for hashing\n\t   * @param {BigInteger|String} bigInt Number or string to pad.\n\t   * @returns {String} Padded hex string.\n\t   */\n\n\n\t  AuthenticationHelper.prototype.padHex = function padHex(bigInt) {\n\t    var hashStr = bigInt.toString(16);\n\t    if (hashStr.length % 2 === 1) {\n\t      hashStr = '0' + hashStr;\n\t    } else if ('89ABCDEFabcdef'.indexOf(hashStr[0]) !== -1) {\n\t      hashStr = '00' + hashStr;\n\t    }\n\t    return hashStr;\n\t  };\n\n\t  return AuthenticationHelper;\n\t}();\n\n\texports.default = AuthenticationHelper;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t\"use strict\";\n\n\texports.__esModule = true;\n\t// A small implementation of BigInteger based on http://www-cs-students.stanford.edu/~tjw/jsbn/\n\t//\n\t// All public methods have been removed except the following:\n\t//   new BigInteger(a, b) (only radix 2, 4, 8, 16 and 32 supported)\n\t//   toString (only radix 2, 4, 8, 16 and 32 supported)\n\t//   negate\n\t//   abs\n\t//   compareTo\n\t//   bitLength\n\t//   mod\n\t//   equals\n\t//   add\n\t//   subtract\n\t//   multiply\n\t//   divide\n\t//   modPow\n\n\texports.default = BigInteger;\n\n\t/*\n\t * Copyright (c) 2003-2005  Tom Wu\n\t * All Rights Reserved.\n\t *\n\t * Permission is hereby granted, free of charge, to any person obtaining\n\t * a copy of this software and associated documentation files (the\n\t * \"Software\"), to deal in the Software without restriction, including\n\t * without limitation the rights to use, copy, modify, merge, publish,\n\t * distribute, sublicense, and/or sell copies of the Software, and to\n\t * permit persons to whom the Software is furnished to do so, subject to\n\t * the following conditions:\n\t *\n\t * The above copyright notice and this permission notice shall be\n\t * included in all copies or substantial portions of the Software.\n\t *\n\t * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n\t * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n\t * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n\t *\n\t * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n\t * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n\t * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n\t * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n\t * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\t *\n\t * In addition, the following condition applies:\n\t *\n\t * All redistributions must retain an intact copy of this copyright notice\n\t * and disclaimer.\n\t */\n\n\t// (public) Constructor\n\n\tfunction BigInteger(a, b) {\n\t  if (a != null) this.fromString(a, b);\n\t}\n\n\t// return new, unset BigInteger\n\tfunction nbi() {\n\t  return new BigInteger(null);\n\t}\n\n\t// Bits per digit\n\tvar dbits;\n\n\t// JavaScript engine analysis\n\tvar canary = 0xdeadbeefcafe;\n\tvar j_lm = (canary & 0xffffff) == 0xefcafe;\n\n\t// am: Compute w_j += (x*this_i), propagate carries,\n\t// c is initial carry, returns final carry.\n\t// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n\t// We need to select the fastest one that works in this environment.\n\n\t// am1: use a single mult and divide to get the high bits,\n\t// max digit bits should be 26 because\n\t// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n\tfunction am1(i, x, w, j, c, n) {\n\t  while (--n >= 0) {\n\t    var v = x * this[i++] + w[j] + c;\n\t    c = Math.floor(v / 0x4000000);\n\t    w[j++] = v & 0x3ffffff;\n\t  }\n\t  return c;\n\t}\n\t// am2 avoids a big mult-and-extract completely.\n\t// Max digit bits should be <= 30 because we do bitwise ops\n\t// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n\tfunction am2(i, x, w, j, c, n) {\n\t  var xl = x & 0x7fff,\n\t      xh = x >> 15;\n\t  while (--n >= 0) {\n\t    var l = this[i] & 0x7fff;\n\t    var h = this[i++] >> 15;\n\t    var m = xh * l + h * xl;\n\t    l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n\t    c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n\t    w[j++] = l & 0x3fffffff;\n\t  }\n\t  return c;\n\t}\n\t// Alternately, set max digit bits to 28 since some\n\t// browsers slow down when dealing with 32-bit numbers.\n\tfunction am3(i, x, w, j, c, n) {\n\t  var xl = x & 0x3fff,\n\t      xh = x >> 14;\n\t  while (--n >= 0) {\n\t    var l = this[i] & 0x3fff;\n\t    var h = this[i++] >> 14;\n\t    var m = xh * l + h * xl;\n\t    l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n\t    c = (l >> 28) + (m >> 14) + xh * h;\n\t    w[j++] = l & 0xfffffff;\n\t  }\n\t  return c;\n\t}\n\tvar inBrowser = typeof navigator !== \"undefined\";\n\tif (inBrowser && j_lm && navigator.appName == \"Microsoft Internet Explorer\") {\n\t  BigInteger.prototype.am = am2;\n\t  dbits = 30;\n\t} else if (inBrowser && j_lm && navigator.appName != \"Netscape\") {\n\t  BigInteger.prototype.am = am1;\n\t  dbits = 26;\n\t} else {\n\t  // Mozilla/Netscape seems to prefer am3\n\t  BigInteger.prototype.am = am3;\n\t  dbits = 28;\n\t}\n\n\tBigInteger.prototype.DB = dbits;\n\tBigInteger.prototype.DM = (1 << dbits) - 1;\n\tBigInteger.prototype.DV = 1 << dbits;\n\n\tvar BI_FP = 52;\n\tBigInteger.prototype.FV = Math.pow(2, BI_FP);\n\tBigInteger.prototype.F1 = BI_FP - dbits;\n\tBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n\n\t// Digit conversions\n\tvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\n\tvar BI_RC = new Array();\n\tvar rr, vv;\n\trr = \"0\".charCodeAt(0);\n\tfor (vv = 0; vv <= 9; ++vv) {\n\t  BI_RC[rr++] = vv;\n\t}rr = \"a\".charCodeAt(0);\n\tfor (vv = 10; vv < 36; ++vv) {\n\t  BI_RC[rr++] = vv;\n\t}rr = \"A\".charCodeAt(0);\n\tfor (vv = 10; vv < 36; ++vv) {\n\t  BI_RC[rr++] = vv;\n\t}function int2char(n) {\n\t  return BI_RM.charAt(n);\n\t}\n\tfunction intAt(s, i) {\n\t  var c = BI_RC[s.charCodeAt(i)];\n\t  return c == null ? -1 : c;\n\t}\n\n\t// (protected) copy this to r\n\tfunction bnpCopyTo(r) {\n\t  for (var i = this.t - 1; i >= 0; --i) {\n\t    r[i] = this[i];\n\t  }r.t = this.t;\n\t  r.s = this.s;\n\t}\n\n\t// (protected) set from integer value x, -DV <= x < DV\n\tfunction bnpFromInt(x) {\n\t  this.t = 1;\n\t  this.s = x < 0 ? -1 : 0;\n\t  if (x > 0) this[0] = x;else if (x < -1) this[0] = x + this.DV;else this.t = 0;\n\t}\n\n\t// return bigint initialized to value\n\tfunction nbv(i) {\n\t  var r = nbi();\n\n\t  r.fromInt(i);\n\n\t  return r;\n\t}\n\n\t// (protected) set from string and radix\n\tfunction bnpFromString(s, b) {\n\t  var k;\n\t  if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error(\"Only radix 2, 4, 8, 16, 32 are supported\");\n\t  this.t = 0;\n\t  this.s = 0;\n\t  var i = s.length,\n\t      mi = false,\n\t      sh = 0;\n\t  while (--i >= 0) {\n\t    var x = intAt(s, i);\n\t    if (x < 0) {\n\t      if (s.charAt(i) == \"-\") mi = true;\n\t      continue;\n\t    }\n\t    mi = false;\n\t    if (sh == 0) this[this.t++] = x;else if (sh + k > this.DB) {\n\t      this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;\n\t      this[this.t++] = x >> this.DB - sh;\n\t    } else this[this.t - 1] |= x << sh;\n\t    sh += k;\n\t    if (sh >= this.DB) sh -= this.DB;\n\t  }\n\t  this.clamp();\n\t  if (mi) BigInteger.ZERO.subTo(this, this);\n\t}\n\n\t// (protected) clamp off excess high words\n\tfunction bnpClamp() {\n\t  var c = this.s & this.DM;\n\t  while (this.t > 0 && this[this.t - 1] == c) {\n\t    --this.t;\n\t  }\n\t}\n\n\t// (public) return string representation in given radix\n\tfunction bnToString(b) {\n\t  if (this.s < 0) return \"-\" + this.negate().toString();\n\t  var k;\n\t  if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error(\"Only radix 2, 4, 8, 16, 32 are supported\");\n\t  var km = (1 << k) - 1,\n\t      d,\n\t      m = false,\n\t      r = \"\",\n\t      i = this.t;\n\t  var p = this.DB - i * this.DB % k;\n\t  if (i-- > 0) {\n\t    if (p < this.DB && (d = this[i] >> p) > 0) {\n\t      m = true;\n\t      r = int2char(d);\n\t    }\n\t    while (i >= 0) {\n\t      if (p < k) {\n\t        d = (this[i] & (1 << p) - 1) << k - p;\n\t        d |= this[--i] >> (p += this.DB - k);\n\t      } else {\n\t        d = this[i] >> (p -= k) & km;\n\t        if (p <= 0) {\n\t          p += this.DB;\n\t          --i;\n\t        }\n\t      }\n\t      if (d > 0) m = true;\n\t      if (m) r += int2char(d);\n\t    }\n\t  }\n\t  return m ? r : \"0\";\n\t}\n\n\t// (public) -this\n\tfunction bnNegate() {\n\t  var r = nbi();\n\n\t  BigInteger.ZERO.subTo(this, r);\n\n\t  return r;\n\t}\n\n\t// (public) |this|\n\tfunction bnAbs() {\n\t  return this.s < 0 ? this.negate() : this;\n\t}\n\n\t// (public) return + if this > a, - if this < a, 0 if equal\n\tfunction bnCompareTo(a) {\n\t  var r = this.s - a.s;\n\t  if (r != 0) return r;\n\t  var i = this.t;\n\t  r = i - a.t;\n\t  if (r != 0) return this.s < 0 ? -r : r;\n\t  while (--i >= 0) {\n\t    if ((r = this[i] - a[i]) != 0) return r;\n\t  }return 0;\n\t}\n\n\t// returns bit length of the integer x\n\tfunction nbits(x) {\n\t  var r = 1,\n\t      t;\n\t  if ((t = x >>> 16) != 0) {\n\t    x = t;\n\t    r += 16;\n\t  }\n\t  if ((t = x >> 8) != 0) {\n\t    x = t;\n\t    r += 8;\n\t  }\n\t  if ((t = x >> 4) != 0) {\n\t    x = t;\n\t    r += 4;\n\t  }\n\t  if ((t = x >> 2) != 0) {\n\t    x = t;\n\t    r += 2;\n\t  }\n\t  if ((t = x >> 1) != 0) {\n\t    x = t;\n\t    r += 1;\n\t  }\n\t  return r;\n\t}\n\n\t// (public) return the number of bits in \"this\"\n\tfunction bnBitLength() {\n\t  if (this.t <= 0) return 0;\n\t  return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);\n\t}\n\n\t// (protected) r = this << n*DB\n\tfunction bnpDLShiftTo(n, r) {\n\t  var i;\n\t  for (i = this.t - 1; i >= 0; --i) {\n\t    r[i + n] = this[i];\n\t  }for (i = n - 1; i >= 0; --i) {\n\t    r[i] = 0;\n\t  }r.t = this.t + n;\n\t  r.s = this.s;\n\t}\n\n\t// (protected) r = this >> n*DB\n\tfunction bnpDRShiftTo(n, r) {\n\t  for (var i = n; i < this.t; ++i) {\n\t    r[i - n] = this[i];\n\t  }r.t = Math.max(this.t - n, 0);\n\t  r.s = this.s;\n\t}\n\n\t// (protected) r = this << n\n\tfunction bnpLShiftTo(n, r) {\n\t  var bs = n % this.DB;\n\t  var cbs = this.DB - bs;\n\t  var bm = (1 << cbs) - 1;\n\t  var ds = Math.floor(n / this.DB),\n\t      c = this.s << bs & this.DM,\n\t      i;\n\t  for (i = this.t - 1; i >= 0; --i) {\n\t    r[i + ds + 1] = this[i] >> cbs | c;\n\t    c = (this[i] & bm) << bs;\n\t  }\n\t  for (i = ds - 1; i >= 0; --i) {\n\t    r[i] = 0;\n\t  }r[ds] = c;\n\t  r.t = this.t + ds + 1;\n\t  r.s = this.s;\n\t  r.clamp();\n\t}\n\n\t// (protected) r = this >> n\n\tfunction bnpRShiftTo(n, r) {\n\t  r.s = this.s;\n\t  var ds = Math.floor(n / this.DB);\n\t  if (ds >= this.t) {\n\t    r.t = 0;\n\t    return;\n\t  }\n\t  var bs = n % this.DB;\n\t  var cbs = this.DB - bs;\n\t  var bm = (1 << bs) - 1;\n\t  r[0] = this[ds] >> bs;\n\t  for (var i = ds + 1; i < this.t; ++i) {\n\t    r[i - ds - 1] |= (this[i] & bm) << cbs;\n\t    r[i - ds] = this[i] >> bs;\n\t  }\n\t  if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n\t  r.t = this.t - ds;\n\t  r.clamp();\n\t}\n\n\t// (protected) r = this - a\n\tfunction bnpSubTo(a, r) {\n\t  var i = 0,\n\t      c = 0,\n\t      m = Math.min(a.t, this.t);\n\t  while (i < m) {\n\t    c += this[i] - a[i];\n\t    r[i++] = c & this.DM;\n\t    c >>= this.DB;\n\t  }\n\t  if (a.t < this.t) {\n\t    c -= a.s;\n\t    while (i < this.t) {\n\t      c += this[i];\n\t      r[i++] = c & this.DM;\n\t      c >>= this.DB;\n\t    }\n\t    c += this.s;\n\t  } else {\n\t    c += this.s;\n\t    while (i < a.t) {\n\t      c -= a[i];\n\t      r[i++] = c & this.DM;\n\t      c >>= this.DB;\n\t    }\n\t    c -= a.s;\n\t  }\n\t  r.s = c < 0 ? -1 : 0;\n\t  if (c < -1) r[i++] = this.DV + c;else if (c > 0) r[i++] = c;\n\t  r.t = i;\n\t  r.clamp();\n\t}\n\n\t// (protected) r = this * a, r != this,a (HAC 14.12)\n\t// \"this\" should be the larger one if appropriate.\n\tfunction bnpMultiplyTo(a, r) {\n\t  var x = this.abs(),\n\t      y = a.abs();\n\t  var i = x.t;\n\t  r.t = i + y.t;\n\t  while (--i >= 0) {\n\t    r[i] = 0;\n\t  }for (i = 0; i < y.t; ++i) {\n\t    r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n\t  }r.s = 0;\n\t  r.clamp();\n\t  if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n\t}\n\n\t// (protected) r = this^2, r != this (HAC 14.16)\n\tfunction bnpSquareTo(r) {\n\t  var x = this.abs();\n\t  var i = r.t = 2 * x.t;\n\t  while (--i >= 0) {\n\t    r[i] = 0;\n\t  }for (i = 0; i < x.t - 1; ++i) {\n\t    var c = x.am(i, x[i], r, 2 * i, 0, 1);\n\t    if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n\t      r[i + x.t] -= x.DV;\n\t      r[i + x.t + 1] = 1;\n\t    }\n\t  }\n\t  if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n\t  r.s = 0;\n\t  r.clamp();\n\t}\n\n\t// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n\t// r != q, this != m.  q or r may be null.\n\tfunction bnpDivRemTo(m, q, r) {\n\t  var pm = m.abs();\n\t  if (pm.t <= 0) return;\n\t  var pt = this.abs();\n\t  if (pt.t < pm.t) {\n\t    if (q != null) q.fromInt(0);\n\t    if (r != null) this.copyTo(r);\n\t    return;\n\t  }\n\t  if (r == null) r = nbi();\n\t  var y = nbi(),\n\t      ts = this.s,\n\t      ms = m.s;\n\t  var nsh = this.DB - nbits(pm[pm.t - 1]);\n\t  // normalize modulus\n\t  if (nsh > 0) {\n\t    pm.lShiftTo(nsh, y);\n\t    pt.lShiftTo(nsh, r);\n\t  } else {\n\t    pm.copyTo(y);\n\t    pt.copyTo(r);\n\t  }\n\t  var ys = y.t;\n\t  var y0 = y[ys - 1];\n\t  if (y0 == 0) return;\n\t  var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n\t  var d1 = this.FV / yt,\n\t      d2 = (1 << this.F1) / yt,\n\t      e = 1 << this.F2;\n\t  var i = r.t,\n\t      j = i - ys,\n\t      t = q == null ? nbi() : q;\n\t  y.dlShiftTo(j, t);\n\t  if (r.compareTo(t) >= 0) {\n\t    r[r.t++] = 1;\n\t    r.subTo(t, r);\n\t  }\n\t  BigInteger.ONE.dlShiftTo(ys, t);\n\t  t.subTo(y, y);\n\t  // \"negative\" y so we can replace sub with am later\n\t  while (y.t < ys) {\n\t    y[y.t++] = 0;\n\t  }while (--j >= 0) {\n\t    // Estimate quotient digit\n\t    var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n\t    if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n\t      // Try it out\n\t      y.dlShiftTo(j, t);\n\t      r.subTo(t, r);\n\t      while (r[i] < --qd) {\n\t        r.subTo(t, r);\n\t      }\n\t    }\n\t  }\n\t  if (q != null) {\n\t    r.drShiftTo(ys, q);\n\t    if (ts != ms) BigInteger.ZERO.subTo(q, q);\n\t  }\n\t  r.t = ys;\n\t  r.clamp();\n\t  if (nsh > 0) r.rShiftTo(nsh, r);\n\t  // Denormalize remainder\n\t  if (ts < 0) BigInteger.ZERO.subTo(r, r);\n\t}\n\n\t// (public) this mod a\n\tfunction bnMod(a) {\n\t  var r = nbi();\n\t  this.abs().divRemTo(a, null, r);\n\t  if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n\t  return r;\n\t}\n\n\t// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n\t// justification:\n\t//         xy == 1 (mod m)\n\t//         xy =  1+km\n\t//   xy(2-xy) = (1+km)(1-km)\n\t// x[y(2-xy)] = 1-k^2m^2\n\t// x[y(2-xy)] == 1 (mod m^2)\n\t// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n\t// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n\t// JS multiply \"overflows\" differently from C/C++, so care is needed here.\n\tfunction bnpInvDigit() {\n\t  if (this.t < 1) return 0;\n\t  var x = this[0];\n\t  if ((x & 1) == 0) return 0;\n\t  var y = x & 3;\n\t  // y == 1/x mod 2^2\n\t  y = y * (2 - (x & 0xf) * y) & 0xf;\n\t  // y == 1/x mod 2^4\n\t  y = y * (2 - (x & 0xff) * y) & 0xff;\n\t  // y == 1/x mod 2^8\n\t  y = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff;\n\t  // y == 1/x mod 2^16\n\t  // last step - calculate inverse mod DV directly;\n\t  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n\t  y = y * (2 - x * y % this.DV) % this.DV;\n\t  // y == 1/x mod 2^dbits\n\t  // we really want the negative inverse, and -DV < y < DV\n\t  return y > 0 ? this.DV - y : -y;\n\t}\n\n\tfunction bnEquals(a) {\n\t  return this.compareTo(a) == 0;\n\t}\n\n\t// (protected) r = this + a\n\tfunction bnpAddTo(a, r) {\n\t  var i = 0,\n\t      c = 0,\n\t      m = Math.min(a.t, this.t);\n\t  while (i < m) {\n\t    c += this[i] + a[i];\n\t    r[i++] = c & this.DM;\n\t    c >>= this.DB;\n\t  }\n\t  if (a.t < this.t) {\n\t    c += a.s;\n\t    while (i < this.t) {\n\t      c += this[i];\n\t      r[i++] = c & this.DM;\n\t      c >>= this.DB;\n\t    }\n\t    c += this.s;\n\t  } else {\n\t    c += this.s;\n\t    while (i < a.t) {\n\t      c += a[i];\n\t      r[i++] = c & this.DM;\n\t      c >>= this.DB;\n\t    }\n\t    c += a.s;\n\t  }\n\t  r.s = c < 0 ? -1 : 0;\n\t  if (c > 0) r[i++] = c;else if (c < -1) r[i++] = this.DV + c;\n\t  r.t = i;\n\t  r.clamp();\n\t}\n\n\t// (public) this + a\n\tfunction bnAdd(a) {\n\t  var r = nbi();\n\n\t  this.addTo(a, r);\n\n\t  return r;\n\t}\n\n\t// (public) this - a\n\tfunction bnSubtract(a) {\n\t  var r = nbi();\n\n\t  this.subTo(a, r);\n\n\t  return r;\n\t}\n\n\t// (public) this * a\n\tfunction bnMultiply(a) {\n\t  var r = nbi();\n\n\t  this.multiplyTo(a, r);\n\n\t  return r;\n\t}\n\n\t// (public) this / a\n\tfunction bnDivide(a) {\n\t  var r = nbi();\n\n\t  this.divRemTo(a, r, null);\n\n\t  return r;\n\t}\n\n\t// Montgomery reduction\n\tfunction Montgomery(m) {\n\t  this.m = m;\n\t  this.mp = m.invDigit();\n\t  this.mpl = this.mp & 0x7fff;\n\t  this.mph = this.mp >> 15;\n\t  this.um = (1 << m.DB - 15) - 1;\n\t  this.mt2 = 2 * m.t;\n\t}\n\n\t// xR mod m\n\tfunction montConvert(x) {\n\t  var r = nbi();\n\t  x.abs().dlShiftTo(this.m.t, r);\n\t  r.divRemTo(this.m, null, r);\n\t  if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n\t  return r;\n\t}\n\n\t// x/R mod m\n\tfunction montRevert(x) {\n\t  var r = nbi();\n\t  x.copyTo(r);\n\t  this.reduce(r);\n\t  return r;\n\t}\n\n\t// x = x/R mod m (HAC 14.32)\n\tfunction montReduce(x) {\n\t  while (x.t <= this.mt2) {\n\t    // pad x so am has enough room later\n\t    x[x.t++] = 0;\n\t  }for (var i = 0; i < this.m.t; ++i) {\n\t    // faster way of calculating u0 = x[i]*mp mod DV\n\t    var j = x[i] & 0x7fff;\n\t    var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM;\n\t    // use am to combine the multiply-shift-add into one call\n\t    j = i + this.m.t;\n\t    x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n\t    // propagate carry\n\t    while (x[j] >= x.DV) {\n\t      x[j] -= x.DV;\n\t      x[++j]++;\n\t    }\n\t  }\n\t  x.clamp();\n\t  x.drShiftTo(this.m.t, x);\n\t  if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n\t}\n\n\t// r = \"x^2/R mod m\"; x != r\n\tfunction montSqrTo(x, r) {\n\t  x.squareTo(r);\n\n\t  this.reduce(r);\n\t}\n\n\t// r = \"xy/R mod m\"; x,y != r\n\tfunction montMulTo(x, y, r) {\n\t  x.multiplyTo(y, r);\n\n\t  this.reduce(r);\n\t}\n\n\tMontgomery.prototype.convert = montConvert;\n\tMontgomery.prototype.revert = montRevert;\n\tMontgomery.prototype.reduce = montReduce;\n\tMontgomery.prototype.mulTo = montMulTo;\n\tMontgomery.prototype.sqrTo = montSqrTo;\n\n\t// (public) this^e % m (HAC 14.85)\n\tfunction bnModPow(e, m, callback) {\n\t  var i = e.bitLength(),\n\t      k,\n\t      r = nbv(1),\n\t      z = new Montgomery(m);\n\t  if (i <= 0) return r;else if (i < 18) k = 1;else if (i < 48) k = 3;else if (i < 144) k = 4;else if (i < 768) k = 5;else k = 6;\n\n\t  // precomputation\n\t  var g = new Array(),\n\t      n = 3,\n\t      k1 = k - 1,\n\t      km = (1 << k) - 1;\n\t  g[1] = z.convert(this);\n\t  if (k > 1) {\n\t    var g2 = nbi();\n\t    z.sqrTo(g[1], g2);\n\t    while (n <= km) {\n\t      g[n] = nbi();\n\t      z.mulTo(g2, g[n - 2], g[n]);\n\t      n += 2;\n\t    }\n\t  }\n\n\t  var j = e.t - 1,\n\t      w,\n\t      is1 = true,\n\t      r2 = nbi(),\n\t      t;\n\t  i = nbits(e[j]) - 1;\n\t  while (j >= 0) {\n\t    if (i >= k1) w = e[j] >> i - k1 & km;else {\n\t      w = (e[j] & (1 << i + 1) - 1) << k1 - i;\n\t      if (j > 0) w |= e[j - 1] >> this.DB + i - k1;\n\t    }\n\n\t    n = k;\n\t    while ((w & 1) == 0) {\n\t      w >>= 1;\n\t      --n;\n\t    }\n\t    if ((i -= n) < 0) {\n\t      i += this.DB;\n\t      --j;\n\t    }\n\t    if (is1) {\n\t      // ret == 1, don't bother squaring or multiplying it\n\t      g[w].copyTo(r);\n\t      is1 = false;\n\t    } else {\n\t      while (n > 1) {\n\t        z.sqrTo(r, r2);\n\t        z.sqrTo(r2, r);\n\t        n -= 2;\n\t      }\n\t      if (n > 0) z.sqrTo(r, r2);else {\n\t        t = r;\n\t        r = r2;\n\t        r2 = t;\n\t      }\n\t      z.mulTo(r2, g[w], r);\n\t    }\n\n\t    while (j >= 0 && (e[j] & 1 << i) == 0) {\n\t      z.sqrTo(r, r2);\n\t      t = r;\n\t      r = r2;\n\t      r2 = t;\n\t      if (--i < 0) {\n\t        i = this.DB - 1;\n\t        --j;\n\t      }\n\t    }\n\t  }\n\t  var result = z.revert(r);\n\t  callback(null, result);\n\t  return result;\n\t}\n\n\t// protected\n\tBigInteger.prototype.copyTo = bnpCopyTo;\n\tBigInteger.prototype.fromInt = bnpFromInt;\n\tBigInteger.prototype.fromString = bnpFromString;\n\tBigInteger.prototype.clamp = bnpClamp;\n\tBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n\tBigInteger.prototype.drShiftTo = bnpDRShiftTo;\n\tBigInteger.prototype.lShiftTo = bnpLShiftTo;\n\tBigInteger.prototype.rShiftTo = bnpRShiftTo;\n\tBigInteger.prototype.subTo = bnpSubTo;\n\tBigInteger.prototype.multiplyTo = bnpMultiplyTo;\n\tBigInteger.prototype.squareTo = bnpSquareTo;\n\tBigInteger.prototype.divRemTo = bnpDivRemTo;\n\tBigInteger.prototype.invDigit = bnpInvDigit;\n\tBigInteger.prototype.addTo = bnpAddTo;\n\n\t// public\n\tBigInteger.prototype.toString = bnToString;\n\tBigInteger.prototype.negate = bnNegate;\n\tBigInteger.prototype.abs = bnAbs;\n\tBigInteger.prototype.compareTo = bnCompareTo;\n\tBigInteger.prototype.bitLength = bnBitLength;\n\tBigInteger.prototype.mod = bnMod;\n\tBigInteger.prototype.equals = bnEquals;\n\tBigInteger.prototype.add = bnAdd;\n\tBigInteger.prototype.subtract = bnSubtract;\n\tBigInteger.prototype.multiply = bnMultiply;\n\tBigInteger.prototype.divide = bnDivide;\n\tBigInteger.prototype.modPow = bnModPow;\n\n\t// \"constants\"\n\tBigInteger.ZERO = nbv(0);\n\tBigInteger.ONE = nbv(1);\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _CognitoJwtToken2 = __webpack_require__(6);\n\n\tvar _CognitoJwtToken3 = _interopRequireDefault(_CognitoJwtToken2);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\tfunction _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; }\n\n\tfunction _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; } /*\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2016 Amazon.com,\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Inc. or its affiliates. All Rights Reserved.\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Licensed under the Amazon Software License (the \"License\").\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * You may not use this file except in compliance with the\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * License. A copy of the License is located at\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *     http://aws.amazon.com/asl/\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * or in the \"license\" file accompanying this file. This file is\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CONDITIONS OF ANY KIND, express or implied. See the License\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * for the specific language governing permissions and\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * limitations under the License.\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */\n\n\t/** @class */\n\tvar CognitoAccessToken = function (_CognitoJwtToken) {\n\t  _inherits(CognitoAccessToken, _CognitoJwtToken);\n\n\t  /**\n\t   * Constructs a new CognitoAccessToken object\n\t   * @param {string=} AccessToken The JWT access token.\n\t   */\n\t  function CognitoAccessToken() {\n\t    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t        AccessToken = _ref.AccessToken;\n\n\t    _classCallCheck(this, CognitoAccessToken);\n\n\t    return _possibleConstructorReturn(this, _CognitoJwtToken.call(this, AccessToken || ''));\n\t  }\n\n\t  return CognitoAccessToken;\n\t}(_CognitoJwtToken3.default);\n\n\texports.default = CognitoAccessToken;\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _CognitoJwtToken2 = __webpack_require__(6);\n\n\tvar _CognitoJwtToken3 = _interopRequireDefault(_CognitoJwtToken2);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\tfunction _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; }\n\n\tfunction _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; } /*!\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2016 Amazon.com,\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Inc. or its affiliates. All Rights Reserved.\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Licensed under the Amazon Software License (the \"License\").\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * You may not use this file except in compliance with the\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * License. A copy of the License is located at\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *     http://aws.amazon.com/asl/\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * or in the \"license\" file accompanying this file. This file is\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CONDITIONS OF ANY KIND, express or implied. See the License\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * for the specific language governing permissions and\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * limitations under the License.\n\t                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */\n\n\t/** @class */\n\tvar CognitoIdToken = function (_CognitoJwtToken) {\n\t  _inherits(CognitoIdToken, _CognitoJwtToken);\n\n\t  /**\n\t   * Constructs a new CognitoIdToken object\n\t   * @param {string=} IdToken The JWT Id token\n\t   */\n\t  function CognitoIdToken() {\n\t    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t        IdToken = _ref.IdToken;\n\n\t    _classCallCheck(this, CognitoIdToken);\n\n\t    return _possibleConstructorReturn(this, _CognitoJwtToken.call(this, IdToken || ''));\n\t  }\n\n\t  return CognitoIdToken;\n\t}(_CognitoJwtToken3.default);\n\n\texports.default = CognitoIdToken;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _global = __webpack_require__(1);\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n\t                                                                                                                                                           * Copyright 2016 Amazon.com,\n\t                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n\t                                                                                                                                                           * You may not use this file except in compliance with the\n\t                                                                                                                                                           * License. A copy of the License is located at\n\t                                                                                                                                                           *\n\t                                                                                                                                                           *     http://aws.amazon.com/asl/\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n\t                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n\t                                                                                                                                                           * for the specific language governing permissions and\n\t                                                                                                                                                           * limitations under the License.\n\t                                                                                                                                                           */\n\n\t/** @class */\n\tvar CognitoJwtToken = function () {\n\t  /**\n\t   * Constructs a new CognitoJwtToken object\n\t   * @param {string=} token The JWT token.\n\t   */\n\t  function CognitoJwtToken(token) {\n\t    _classCallCheck(this, CognitoJwtToken);\n\n\t    // Assign object\n\t    this.jwtToken = token || '';\n\t    this.payload = this.decodePayload();\n\t  }\n\n\t  /**\n\t   * @returns {string} the record's token.\n\t   */\n\n\n\t  CognitoJwtToken.prototype.getJwtToken = function getJwtToken() {\n\t    return this.jwtToken;\n\t  };\n\n\t  /**\n\t   * @returns {int} the token's expiration (exp member).\n\t   */\n\n\n\t  CognitoJwtToken.prototype.getExpiration = function getExpiration() {\n\t    return this.payload.exp;\n\t  };\n\n\t  /**\n\t   * @returns {int} the token's \"issued at\" (iat member).\n\t   */\n\n\n\t  CognitoJwtToken.prototype.getIssuedAt = function getIssuedAt() {\n\t    return this.payload.iat;\n\t  };\n\n\t  /**\n\t   * @returns {object} the token's payload.\n\t   */\n\n\n\t  CognitoJwtToken.prototype.decodePayload = function decodePayload() {\n\t    var payload = this.jwtToken.split('.')[1];\n\t    try {\n\t      return JSON.parse(_global.util.base64.decode(payload).toString('utf8'));\n\t    } catch (err) {\n\t      return {};\n\t    }\n\t  };\n\n\t  return CognitoJwtToken;\n\t}();\n\n\texports.default = CognitoJwtToken;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t *     http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\n\t/** @class */\n\tvar CognitoRefreshToken = function () {\n\t  /**\n\t   * Constructs a new CognitoRefreshToken object\n\t   * @param {string=} RefreshToken The JWT refresh token.\n\t   */\n\t  function CognitoRefreshToken() {\n\t    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t        RefreshToken = _ref.RefreshToken;\n\n\t    _classCallCheck(this, CognitoRefreshToken);\n\n\t    // Assign object\n\t    this.token = RefreshToken || '';\n\t  }\n\n\t  /**\n\t   * @returns {string} the record's token.\n\t   */\n\n\n\t  CognitoRefreshToken.prototype.getToken = function getToken() {\n\t    return this.token;\n\t  };\n\n\t  return CognitoRefreshToken;\n\t}();\n\n\texports.default = CognitoRefreshToken;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _global = __webpack_require__(1);\n\n\tvar _BigInteger = __webpack_require__(3);\n\n\tvar _BigInteger2 = _interopRequireDefault(_BigInteger);\n\n\tvar _AuthenticationHelper = __webpack_require__(2);\n\n\tvar _AuthenticationHelper2 = _interopRequireDefault(_AuthenticationHelper);\n\n\tvar _CognitoAccessToken = __webpack_require__(4);\n\n\tvar _CognitoAccessToken2 = _interopRequireDefault(_CognitoAccessToken);\n\n\tvar _CognitoIdToken = __webpack_require__(5);\n\n\tvar _CognitoIdToken2 = _interopRequireDefault(_CognitoIdToken);\n\n\tvar _CognitoRefreshToken = __webpack_require__(7);\n\n\tvar _CognitoRefreshToken2 = _interopRequireDefault(_CognitoRefreshToken);\n\n\tvar _CognitoUserSession = __webpack_require__(10);\n\n\tvar _CognitoUserSession2 = _interopRequireDefault(_CognitoUserSession);\n\n\tvar _DateHelper = __webpack_require__(11);\n\n\tvar _DateHelper2 = _interopRequireDefault(_DateHelper);\n\n\tvar _CognitoUserAttribute = __webpack_require__(9);\n\n\tvar _CognitoUserAttribute2 = _interopRequireDefault(_CognitoUserAttribute);\n\n\tvar _StorageHelper = __webpack_require__(12);\n\n\tvar _StorageHelper2 = _interopRequireDefault(_StorageHelper);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n\t                                                                                                                                                           * Copyright 2016 Amazon.com,\n\t                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n\t                                                                                                                                                           * You may not use this file except in compliance with the\n\t                                                                                                                                                           * License. A copy of the License is located at\n\t                                                                                                                                                           *\n\t                                                                                                                                                           *     http://aws.amazon.com/asl/\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n\t                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n\t                                                                                                                                                           * for the specific language governing permissions and\n\t                                                                                                                                                           * limitations under the License.\n\t                                                                                                                                                           */\n\n\t/**\n\t * @callback nodeCallback\n\t * @template T result\n\t * @param {*} err The operation failure reason, or null.\n\t * @param {T} result The operation result.\n\t */\n\n\t/**\n\t * @callback onFailure\n\t * @param {*} err Failure reason.\n\t */\n\n\t/**\n\t * @callback onSuccess\n\t * @template T result\n\t * @param {T} result The operation result.\n\t */\n\n\t/**\n\t * @callback mfaRequired\n\t * @param {*} details MFA challenge details.\n\t */\n\n\t/**\n\t * @callback customChallenge\n\t * @param {*} details Custom challenge details.\n\t */\n\n\t/**\n\t * @callback inputVerificationCode\n\t * @param {*} data Server response.\n\t */\n\n\t/**\n\t * @callback authSuccess\n\t * @param {CognitoUserSession} session The new session.\n\t * @param {bool=} userConfirmationNecessary User must be confirmed.\n\t */\n\n\t/** @class */\n\tvar CognitoUser = function () {\n\t  /**\n\t   * Constructs a new CognitoUser object\n\t   * @param {object} data Creation options\n\t   * @param {string} data.Username The user's username.\n\t   * @param {CognitoUserPool} data.Pool Pool containing the user.\n\t   * @param {object} data.Storage Optional storage object.\n\t   */\n\t  function CognitoUser(data) {\n\t    _classCallCheck(this, CognitoUser);\n\n\t    if (data == null || data.Username == null || data.Pool == null) {\n\t      throw new Error('Username and pool information are required.');\n\t    }\n\n\t    this.username = data.Username || '';\n\t    this.pool = data.Pool;\n\t    this.Session = null;\n\n\t    this.client = data.Pool.client;\n\n\t    this.signInUserSession = null;\n\t    this.authenticationFlowType = 'USER_SRP_AUTH';\n\n\t    this.storage = data.Storage || new _StorageHelper2.default().getStorage();\n\t  }\n\n\t  /**\n\t   * Sets the session for this user\n\t   * @param {CognitoUserSession} signInUserSession the session\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.setSignInUserSession = function setSignInUserSession(signInUserSession) {\n\t    this.clearCachedTokens();\n\t    this.signInUserSession = signInUserSession;\n\t    this.cacheTokens();\n\t  };\n\n\t  /**\n\t   * @returns {CognitoUserSession} the current session for this user\n\t   */\n\n\n\t  CognitoUser.prototype.getSignInUserSession = function getSignInUserSession() {\n\t    return this.signInUserSession;\n\t  };\n\n\t  /**\n\t   * @returns {string} the user's username\n\t   */\n\n\n\t  CognitoUser.prototype.getUsername = function getUsername() {\n\t    return this.username;\n\t  };\n\n\t  /**\n\t   * @returns {String} the authentication flow type\n\t   */\n\n\n\t  CognitoUser.prototype.getAuthenticationFlowType = function getAuthenticationFlowType() {\n\t    return this.authenticationFlowType;\n\t  };\n\n\t  /**\n\t   * sets authentication flow type\n\t   * @param {string} authenticationFlowType New value.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.setAuthenticationFlowType = function setAuthenticationFlowType(authenticationFlowType) {\n\t    this.authenticationFlowType = authenticationFlowType;\n\t  };\n\n\t  /**\n\t   * This is used for authenticating the user through the custom authentication flow.\n\t   * @param {AuthenticationDetails} authDetails Contains the authentication data\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {customChallenge} callback.customChallenge Custom challenge\n\t   *        response required to continue.\n\t   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.initiateAuth = function initiateAuth(authDetails, callback) {\n\t    var _this = this;\n\n\t    var authParameters = authDetails.getAuthParameters();\n\t    authParameters.USERNAME = this.username;\n\n\t    var jsonReq = {\n\t      AuthFlow: 'CUSTOM_AUTH',\n\t      ClientId: this.pool.getClientId(),\n\t      AuthParameters: authParameters,\n\t      ClientMetadata: authDetails.getValidationData()\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      var challengeName = data.ChallengeName;\n\t      var challengeParameters = data.ChallengeParameters;\n\n\t      if (challengeName === 'CUSTOM_CHALLENGE') {\n\t        _this.Session = data.Session;\n\t        return callback.customChallenge(challengeParameters);\n\t      }\n\t      _this.signInUserSession = _this.getCognitoUserSession(data.AuthenticationResult);\n\t      _this.cacheTokens();\n\t      return callback.onSuccess(_this.signInUserSession);\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used for authenticating the user. it calls the AuthenticationHelper for SRP related\n\t   * stuff\n\t   * @param {AuthenticationDetails} authDetails Contains the authentication data\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {newPasswordRequired} callback.newPasswordRequired new\n\t   *        password and any required attributes are required to continue\n\t   * @param {mfaRequired} callback.mfaRequired MFA code\n\t   *        required to continue.\n\t   * @param {customChallenge} callback.customChallenge Custom challenge\n\t   *        response required to continue.\n\t   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.authenticateUser = function authenticateUser(authDetails, callback) {\n\t    var _this2 = this;\n\n\t    var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n\t    var dateHelper = new _DateHelper2.default();\n\n\t    var serverBValue = void 0;\n\t    var salt = void 0;\n\t    var authParameters = {};\n\n\t    if (this.deviceKey != null) {\n\t      authParameters.DEVICE_KEY = this.deviceKey;\n\t    }\n\n\t    authParameters.USERNAME = this.username;\n\t    authenticationHelper.getLargeAValue(function (errOnAValue, aValue) {\n\t      // getLargeAValue callback start\n\t      if (errOnAValue) {\n\t        callback.onFailure(errOnAValue);\n\t      }\n\n\t      authParameters.SRP_A = aValue.toString(16);\n\n\t      if (_this2.authenticationFlowType === 'CUSTOM_AUTH') {\n\t        authParameters.CHALLENGE_NAME = 'SRP_A';\n\t      }\n\n\t      var jsonReq = {\n\t        AuthFlow: _this2.authenticationFlowType,\n\t        ClientId: _this2.pool.getClientId(),\n\t        AuthParameters: authParameters,\n\t        ClientMetadata: authDetails.getValidationData()\n\t      };\n\t      if (_this2.getUserContextData(_this2.username)) {\n\t        jsonReq.UserContextData = _this2.getUserContextData(_this2.username);\n\t      }\n\n\t      _this2.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, data) {\n\t        if (err) {\n\t          return callback.onFailure(err);\n\t        }\n\n\t        var challengeParameters = data.ChallengeParameters;\n\n\t        _this2.username = challengeParameters.USER_ID_FOR_SRP;\n\t        serverBValue = new _BigInteger2.default(challengeParameters.SRP_B, 16);\n\t        salt = new _BigInteger2.default(challengeParameters.SALT, 16);\n\t        _this2.getCachedDeviceKeyAndPassword();\n\n\t        authenticationHelper.getPasswordAuthenticationKey(_this2.username, authDetails.getPassword(), serverBValue, salt, function (errOnHkdf, hkdf) {\n\t          // getPasswordAuthenticationKey callback start\n\t          if (errOnHkdf) {\n\t            callback.onFailure(errOnHkdf);\n\t          }\n\n\t          var dateNow = dateHelper.getNowString();\n\n\t          var signatureString = _global.util.crypto.hmac(hkdf, _global.util.buffer.concat([new _global.util.Buffer(_this2.pool.getUserPoolId().split('_')[1], 'utf8'), new _global.util.Buffer(_this2.username, 'utf8'), new _global.util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'), new _global.util.Buffer(dateNow, 'utf8')]), 'base64', 'sha256');\n\n\t          var challengeResponses = {};\n\n\t          challengeResponses.USERNAME = _this2.username;\n\t          challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n\t          challengeResponses.TIMESTAMP = dateNow;\n\t          challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n\t          if (_this2.deviceKey != null) {\n\t            challengeResponses.DEVICE_KEY = _this2.deviceKey;\n\t          }\n\n\t          var respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n\t            return _this2.client.makeUnauthenticatedRequest('respondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n\t              if (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n\t                challengeResponses.DEVICE_KEY = null;\n\t                _this2.deviceKey = null;\n\t                _this2.randomPassword = null;\n\t                _this2.deviceGroupKey = null;\n\t                _this2.clearCachedDeviceKeyAndPassword();\n\t                return respondToAuthChallenge(challenge, challengeCallback);\n\t              }\n\t              return challengeCallback(errChallenge, dataChallenge);\n\t            });\n\t          };\n\n\t          var jsonReqResp = {\n\t            ChallengeName: 'PASSWORD_VERIFIER',\n\t            ClientId: _this2.pool.getClientId(),\n\t            ChallengeResponses: challengeResponses,\n\t            Session: data.Session\n\t          };\n\t          if (_this2.getUserContextData()) {\n\t            jsonReqResp.UserContextData = _this2.getUserContextData();\n\t          }\n\t          respondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n\t            if (errAuthenticate) {\n\t              return callback.onFailure(errAuthenticate);\n\t            }\n\n\t            var challengeName = dataAuthenticate.ChallengeName;\n\t            if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n\t              _this2.Session = dataAuthenticate.Session;\n\t              var userAttributes = null;\n\t              var rawRequiredAttributes = null;\n\t              var requiredAttributes = [];\n\t              var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n\t              if (dataAuthenticate.ChallengeParameters) {\n\t                userAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n\t                rawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n\t              }\n\n\t              if (rawRequiredAttributes) {\n\t                for (var i = 0; i < rawRequiredAttributes.length; i++) {\n\t                  requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n\t                }\n\t              }\n\t              return callback.newPasswordRequired(userAttributes, requiredAttributes);\n\t            }\n\t            return _this2.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n\t          });\n\t          return undefined;\n\t          // getPasswordAuthenticationKey callback end\n\t        });\n\t        return undefined;\n\t      });\n\t      // getLargeAValue callback end\n\t    });\n\t  };\n\n\t  /**\n\t  * PRIVATE ONLY: This is an internal only method and should not\n\t  * be directly called by the consumers.\n\t  * @param {object} dataAuthenticate authentication data\n\t  * @param {object} authenticationHelper helper created\n\t  * @param {callback} callback passed on from caller\n\t  * @returns {void}\n\t  */\n\n\n\t  CognitoUser.prototype.authenticateUserInternal = function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n\t    var _this3 = this;\n\n\t    var challengeName = dataAuthenticate.ChallengeName;\n\t    var challengeParameters = dataAuthenticate.ChallengeParameters;\n\n\t    if (challengeName === 'SMS_MFA') {\n\t      this.Session = dataAuthenticate.Session;\n\t      return callback.mfaRequired(challengeName, challengeParameters);\n\t    }\n\n\t    if (challengeName === 'SELECT_MFA_TYPE') {\n\t      this.Session = dataAuthenticate.Session;\n\t      return callback.selectMFAType(challengeName, challengeParameters);\n\t    }\n\n\t    if (challengeName === 'MFA_SETUP') {\n\t      this.Session = dataAuthenticate.Session;\n\t      return callback.mfaSetup(challengeName, challengeParameters);\n\t    }\n\n\t    if (challengeName === 'SOFTWARE_TOKEN_MFA') {\n\t      this.Session = dataAuthenticate.Session;\n\t      return callback.totpRequired(challengeName, challengeParameters);\n\t    }\n\n\t    if (challengeName === 'CUSTOM_CHALLENGE') {\n\t      this.Session = dataAuthenticate.Session;\n\t      return callback.customChallenge(challengeParameters);\n\t    }\n\n\t    if (challengeName === 'DEVICE_SRP_AUTH') {\n\t      this.getDeviceResponse(callback);\n\t      return undefined;\n\t    }\n\n\t    this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t    this.cacheTokens();\n\n\t    var newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n\t    if (newDeviceMetadata == null) {\n\t      return callback.onSuccess(this.signInUserSession);\n\t    }\n\n\t    authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n\t      if (errGenHash) {\n\t        return callback.onFailure(errGenHash);\n\t      }\n\n\t      var deviceSecretVerifierConfig = {\n\t        Salt: new _global.util.Buffer(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n\t        PasswordVerifier: new _global.util.Buffer(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n\t      };\n\n\t      _this3.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n\t      _this3.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n\t      _this3.randomPassword = authenticationHelper.getRandomPassword();\n\n\t      _this3.client.makeUnauthenticatedRequest('confirmDevice', {\n\t        DeviceKey: newDeviceMetadata.DeviceKey,\n\t        AccessToken: _this3.signInUserSession.getAccessToken().getJwtToken(),\n\t        DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n\t        DeviceName: navigator.userAgent\n\t      }, function (errConfirm, dataConfirm) {\n\t        if (errConfirm) {\n\t          return callback.onFailure(errConfirm);\n\t        }\n\n\t        _this3.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\t        _this3.cacheDeviceKeyAndPassword();\n\t        if (dataConfirm.UserConfirmationNecessary === true) {\n\t          return callback.onSuccess(_this3.signInUserSession, dataConfirm.UserConfirmationNecessary);\n\t        }\n\t        return callback.onSuccess(_this3.signInUserSession);\n\t      });\n\t      return undefined;\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t  * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n\t  * Pass the new password with any new user attributes to be updated.\n\t  * User attribute keys must be of format userAttributes.<attribute_name>.\n\t  * @param {string} newPassword new password for this user\n\t  * @param {object} requiredAttributeData map with values for all required attributes\n\t  * @param {object} callback Result callback map.\n\t  * @param {onFailure} callback.onFailure Called on any error.\n\t  * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n\t  * @param {customChallenge} callback.customChallenge Custom challenge\n\t  *         response required to continue.\n\t  * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t  * @returns {void}\n\t  */\n\n\n\t  CognitoUser.prototype.completeNewPasswordChallenge = function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback) {\n\t    var _this4 = this;\n\n\t    if (!newPassword) {\n\t      return callback.onFailure(new Error('New password is required.'));\n\t    }\n\t    var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n\t    var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n\t    var finalUserAttributes = {};\n\t    if (requiredAttributeData) {\n\t      Object.keys(requiredAttributeData).forEach(function (key) {\n\t        finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n\t      });\n\t    }\n\n\t    finalUserAttributes.NEW_PASSWORD = newPassword;\n\t    finalUserAttributes.USERNAME = this.username;\n\t    var jsonReq = {\n\t      ChallengeName: 'NEW_PASSWORD_REQUIRED',\n\t      ClientId: this.pool.getClientId(),\n\t      ChallengeResponses: finalUserAttributes,\n\t      Session: this.Session\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {\n\t      if (errAuthenticate) {\n\t        return callback.onFailure(errAuthenticate);\n\t      }\n\t      return _this4.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to get a session using device authentication. It is called at the end of user\n\t   * authentication\n\t   *\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t   * @returns {void}\n\t   * @private\n\t   */\n\n\n\t  CognitoUser.prototype.getDeviceResponse = function getDeviceResponse(callback) {\n\t    var _this5 = this;\n\n\t    var authenticationHelper = new _AuthenticationHelper2.default(this.deviceGroupKey);\n\t    var dateHelper = new _DateHelper2.default();\n\n\t    var authParameters = {};\n\n\t    authParameters.USERNAME = this.username;\n\t    authParameters.DEVICE_KEY = this.deviceKey;\n\t    authenticationHelper.getLargeAValue(function (errAValue, aValue) {\n\t      // getLargeAValue callback start\n\t      if (errAValue) {\n\t        callback.onFailure(errAValue);\n\t      }\n\n\t      authParameters.SRP_A = aValue.toString(16);\n\n\t      var jsonReq = {\n\t        ChallengeName: 'DEVICE_SRP_AUTH',\n\t        ClientId: _this5.pool.getClientId(),\n\t        ChallengeResponses: authParameters\n\t      };\n\t      if (_this5.getUserContextData()) {\n\t        jsonReq.UserContextData = _this5.getUserContextData();\n\t      }\n\t      _this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {\n\t        if (err) {\n\t          return callback.onFailure(err);\n\t        }\n\n\t        var challengeParameters = data.ChallengeParameters;\n\n\t        var serverBValue = new _BigInteger2.default(challengeParameters.SRP_B, 16);\n\t        var salt = new _BigInteger2.default(challengeParameters.SALT, 16);\n\n\t        authenticationHelper.getPasswordAuthenticationKey(_this5.deviceKey, _this5.randomPassword, serverBValue, salt, function (errHkdf, hkdf) {\n\t          // getPasswordAuthenticationKey callback start\n\t          if (errHkdf) {\n\t            return callback.onFailure(errHkdf);\n\t          }\n\n\t          var dateNow = dateHelper.getNowString();\n\n\t          var signatureString = _global.util.crypto.hmac(hkdf, _global.util.buffer.concat([new _global.util.Buffer(_this5.deviceGroupKey, 'utf8'), new _global.util.Buffer(_this5.deviceKey, 'utf8'), new _global.util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'), new _global.util.Buffer(dateNow, 'utf8')]), 'base64', 'sha256');\n\n\t          var challengeResponses = {};\n\n\t          challengeResponses.USERNAME = _this5.username;\n\t          challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n\t          challengeResponses.TIMESTAMP = dateNow;\n\t          challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\t          challengeResponses.DEVICE_KEY = _this5.deviceKey;\n\n\t          var jsonReqResp = {\n\t            ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n\t            ClientId: _this5.pool.getClientId(),\n\t            ChallengeResponses: challengeResponses,\n\t            Session: data.Session\n\t          };\n\t          if (_this5.getUserContextData()) {\n\t            jsonReqResp.UserContextData = _this5.getUserContextData();\n\t          }\n\n\t          _this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n\t            if (errAuthenticate) {\n\t              return callback.onFailure(errAuthenticate);\n\t            }\n\n\t            _this5.signInUserSession = _this5.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t            _this5.cacheTokens();\n\n\t            return callback.onSuccess(_this5.signInUserSession);\n\t          });\n\t          return undefined;\n\t          // getPasswordAuthenticationKey callback end\n\t        });\n\t        return undefined;\n\t      });\n\t      // getLargeAValue callback end\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used for a certain user to confirm the registration by using a confirmation code\n\t   * @param {string} confirmationCode Code entered by user.\n\t   * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback) {\n\t    var jsonReq = {\n\t      ClientId: this.pool.getClientId(),\n\t      ConfirmationCode: confirmationCode,\n\t      Username: this.username,\n\t      ForceAliasCreation: forceAliasCreation\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\t    this.client.makeUnauthenticatedRequest('confirmSignUp', jsonReq, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used by the user once he has the responses to a custom challenge\n\t   * @param {string} answerChallenge The custom challange answer.\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {customChallenge} callback.customChallenge\n\t   *    Custom challenge response required to continue.\n\t   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.sendCustomChallengeAnswer = function sendCustomChallengeAnswer(answerChallenge, callback) {\n\t    var _this6 = this;\n\n\t    var challengeResponses = {};\n\t    challengeResponses.USERNAME = this.username;\n\t    challengeResponses.ANSWER = answerChallenge;\n\n\t    var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n\t    this.getCachedDeviceKeyAndPassword();\n\t    if (this.deviceKey != null) {\n\t      challengeResponses.DEVICE_KEY = this.deviceKey;\n\t    }\n\n\t    var jsonReq = {\n\t      ChallengeName: 'CUSTOM_CHALLENGE',\n\t      ChallengeResponses: challengeResponses,\n\t      ClientId: this.pool.getClientId(),\n\t      Session: this.Session\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\t    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\n\t      return _this6.authenticateUserInternal(data, authenticationHelper, callback);\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used by the user once he has an MFA code\n\t   * @param {string} confirmationCode The MFA code entered by the user.\n\t   * @param {object} callback Result callback map.\n\t   * @param {string} mfaType The mfa we are replying to.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.sendMFACode = function sendMFACode(confirmationCode, callback, mfaType) {\n\t    var _this7 = this;\n\n\t    var challengeResponses = {};\n\t    challengeResponses.USERNAME = this.username;\n\t    challengeResponses.SMS_MFA_CODE = confirmationCode;\n\t    var mfaTypeSelection = mfaType || 'SMS_MFA';\n\t    if (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n\t      challengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n\t    }\n\n\t    if (this.deviceKey != null) {\n\t      challengeResponses.DEVICE_KEY = this.deviceKey;\n\t    }\n\n\t    var jsonReq = {\n\t      ChallengeName: mfaTypeSelection,\n\t      ChallengeResponses: challengeResponses,\n\t      ClientId: this.pool.getClientId(),\n\t      Session: this.Session\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\n\t      var challengeName = dataAuthenticate.ChallengeName;\n\n\t      if (challengeName === 'DEVICE_SRP_AUTH') {\n\t        _this7.getDeviceResponse(callback);\n\t        return undefined;\n\t      }\n\n\t      _this7.signInUserSession = _this7.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t      _this7.cacheTokens();\n\n\t      if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n\t        return callback.onSuccess(_this7.signInUserSession);\n\t      }\n\n\t      var authenticationHelper = new _AuthenticationHelper2.default(_this7.pool.getUserPoolId().split('_')[1]);\n\t      authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n\t        if (errGenHash) {\n\t          return callback.onFailure(errGenHash);\n\t        }\n\n\t        var deviceSecretVerifierConfig = {\n\t          Salt: new _global.util.Buffer(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n\t          PasswordVerifier: new _global.util.Buffer(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n\t        };\n\n\t        _this7.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n\t        _this7.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n\t        _this7.randomPassword = authenticationHelper.getRandomPassword();\n\n\t        _this7.client.makeUnauthenticatedRequest('confirmDevice', {\n\t          DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n\t          AccessToken: _this7.signInUserSession.getAccessToken().getJwtToken(),\n\t          DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n\t          DeviceName: navigator.userAgent\n\t        }, function (errConfirm, dataConfirm) {\n\t          if (errConfirm) {\n\t            return callback.onFailure(errConfirm);\n\t          }\n\n\t          _this7.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\t          _this7.cacheDeviceKeyAndPassword();\n\t          if (dataConfirm.UserConfirmationNecessary === true) {\n\t            return callback.onSuccess(_this7.signInUserSession, dataConfirm.UserConfirmationNecessary);\n\t          }\n\t          return callback.onSuccess(_this7.signInUserSession);\n\t        });\n\t        return undefined;\n\t      });\n\t      return undefined;\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to change the current password\n\t   * @param {string} oldUserPassword The current password.\n\t   * @param {string} newUserPassword The requested new password.\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.changePassword = function changePassword(oldUserPassword, newUserPassword, callback) {\n\t    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('changePassword', {\n\t      PreviousPassword: oldUserPassword,\n\t      ProposedPassword: newUserPassword,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to enable MFA for himself\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.enableMFA = function enableMFA(callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    var mfaOptions = [];\n\t    var mfaEnabled = {\n\t      DeliveryMedium: 'SMS',\n\t      AttributeName: 'phone_number'\n\t    };\n\t    mfaOptions.push(mfaEnabled);\n\n\t    this.client.makeUnauthenticatedRequest('setUserSettings', {\n\t      MFAOptions: mfaOptions,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to enable MFA for himself\n\t   * @param {string[]} smsMfaSettings the sms mfa settings\n\t   * @param {string[]} softwareTokenMfaSettings the software token mfa settings\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.setUserMfaPreference = function setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('setUserMFAPreference', {\n\t      SMSMfaSettings: smsMfaSettings,\n\t      SoftwareTokenMfaSettings: softwareTokenMfaSettings,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to disable MFA for himself\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.disableMFA = function disableMFA(callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    var mfaOptions = [];\n\n\t    this.client.makeUnauthenticatedRequest('setUserSettings', {\n\t      MFAOptions: mfaOptions,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to delete himself\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.deleteUser = function deleteUser(callback) {\n\t    var _this8 = this;\n\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('deleteUser', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      _this8.clearCachedTokens();\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n\t   */\n\t  /**\n\t   * This is used by an authenticated user to change a list of attributes\n\t   * @param {AttributeArg[]} attributes A list of the new user attributes.\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.updateAttributes = function updateAttributes(attributes, callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('updateUserAttributes', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t      UserAttributes: attributes\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to get a list of attributes\n\t   * @param {nodeCallback<CognitoUserAttribute[]>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getUserAttributes = function getUserAttributes(callback) {\n\t    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('getUser', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err, userData) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\n\t      var attributeList = [];\n\n\t      for (var i = 0; i < userData.UserAttributes.length; i++) {\n\t        var attribute = {\n\t          Name: userData.UserAttributes[i].Name,\n\t          Value: userData.UserAttributes[i].Value\n\t        };\n\t        var userAttribute = new _CognitoUserAttribute2.default(attribute);\n\t        attributeList.push(userAttribute);\n\t      }\n\n\t      return callback(null, attributeList);\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to get the MFAOptions\n\t   * @param {nodeCallback<MFAOptions>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getMFAOptions = function getMFAOptions(callback) {\n\t    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('getUser', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err, userData) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\n\t      return callback(null, userData.MFAOptions);\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated user to delete a list of attributes\n\t   * @param {string[]} attributeList Names of the attributes to delete.\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.deleteAttributes = function deleteAttributes(attributeList, callback) {\n\t    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t      return callback(new Error('User is not authenticated'), null);\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('deleteUserAttributes', {\n\t      UserAttributeNames: attributeList,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, 'SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used by a user to resend a confirmation code\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.resendConfirmationCode = function resendConfirmationCode(callback) {\n\t    var jsonReq = {\n\t      ClientId: this.pool.getClientId(),\n\t      Username: this.username\n\t    };\n\n\t    this.client.makeUnauthenticatedRequest('resendConfirmationCode', jsonReq, function (err, result) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\t      return callback(null, result);\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used to get a session, either from the session object\n\t   * or from  the local storage, or by using a refresh token\n\t   *\n\t   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getSession = function getSession(callback) {\n\t    if (this.username == null) {\n\t      return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n\t    }\n\n\t    if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n\t      return callback(null, this.signInUserSession);\n\t    }\n\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t    var idTokenKey = keyPrefix + '.idToken';\n\t    var accessTokenKey = keyPrefix + '.accessToken';\n\t    var refreshTokenKey = keyPrefix + '.refreshToken';\n\t    var clockDriftKey = keyPrefix + '.clockDrift';\n\n\t    if (this.storage.getItem(idTokenKey)) {\n\t      var idToken = new _CognitoIdToken2.default({\n\t        IdToken: this.storage.getItem(idTokenKey)\n\t      });\n\t      var accessToken = new _CognitoAccessToken2.default({\n\t        AccessToken: this.storage.getItem(accessTokenKey)\n\t      });\n\t      var refreshToken = new _CognitoRefreshToken2.default({\n\t        RefreshToken: this.storage.getItem(refreshTokenKey)\n\t      });\n\t      var clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n\n\t      var sessionData = {\n\t        IdToken: idToken,\n\t        AccessToken: accessToken,\n\t        RefreshToken: refreshToken,\n\t        ClockDrift: clockDrift\n\t      };\n\t      var cachedSession = new _CognitoUserSession2.default(sessionData);\n\t      if (cachedSession.isValid()) {\n\t        this.signInUserSession = cachedSession;\n\t        return callback(null, this.signInUserSession);\n\t      }\n\n\t      if (refreshToken.getToken() == null) {\n\t        return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n\t      }\n\n\t      this.refreshSession(refreshToken, callback);\n\t    } else {\n\t      callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n\t    }\n\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This uses the refreshToken to retrieve a new session\n\t   * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n\t   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.refreshSession = function refreshSession(refreshToken, callback) {\n\t    var _this9 = this;\n\n\t    var authParameters = {};\n\t    authParameters.REFRESH_TOKEN = refreshToken.getToken();\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t    var lastUserKey = keyPrefix + '.LastAuthUser';\n\n\t    if (this.storage.getItem(lastUserKey)) {\n\t      this.username = this.storage.getItem(lastUserKey);\n\t      var deviceKeyKey = keyPrefix + '.' + this.username + '.deviceKey';\n\t      this.deviceKey = this.storage.getItem(deviceKeyKey);\n\t      authParameters.DEVICE_KEY = this.deviceKey;\n\t    }\n\n\t    var jsonReq = {\n\t      ClientId: this.pool.getClientId(),\n\t      AuthFlow: 'REFRESH_TOKEN_AUTH',\n\t      AuthParameters: authParameters\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\t    this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, authResult) {\n\t      if (err) {\n\t        if (err.code === 'NotAuthorizedException') {\n\t          _this9.clearCachedTokens();\n\t        }\n\t        return callback(err, null);\n\t      }\n\t      if (authResult) {\n\t        var authenticationResult = authResult.AuthenticationResult;\n\t        if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n\t          authenticationResult.RefreshToken = refreshToken.getToken();\n\t        }\n\t        _this9.signInUserSession = _this9.getCognitoUserSession(authenticationResult);\n\t        _this9.cacheTokens();\n\t        return callback(null, _this9.signInUserSession);\n\t      }\n\t      return undefined;\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used to save the session tokens to local storage\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.cacheTokens = function cacheTokens() {\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t    var idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n\t    var accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n\t    var refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n\t    var clockDriftKey = keyPrefix + '.' + this.username + '.clockDrift';\n\t    var lastUserKey = keyPrefix + '.LastAuthUser';\n\n\t    this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n\t    this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n\t    this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n\t    this.storage.setItem(clockDriftKey, '' + this.signInUserSession.getClockDrift());\n\t    this.storage.setItem(lastUserKey, this.username);\n\t  };\n\n\t  /**\n\t   * This is used to cache the device key and device group and device password\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.cacheDeviceKeyAndPassword = function cacheDeviceKeyAndPassword() {\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t    var deviceKeyKey = keyPrefix + '.deviceKey';\n\t    var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t    var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n\t    this.storage.setItem(deviceKeyKey, this.deviceKey);\n\t    this.storage.setItem(randomPasswordKey, this.randomPassword);\n\t    this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n\t  };\n\n\t  /**\n\t   * This is used to get current device key and device group and device password\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getCachedDeviceKeyAndPassword = function getCachedDeviceKeyAndPassword() {\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t    var deviceKeyKey = keyPrefix + '.deviceKey';\n\t    var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t    var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n\t    if (this.storage.getItem(deviceKeyKey)) {\n\t      this.deviceKey = this.storage.getItem(deviceKeyKey);\n\t      this.randomPassword = this.storage.getItem(randomPasswordKey);\n\t      this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n\t    }\n\t  };\n\n\t  /**\n\t   * This is used to clear the device key info from local storage\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.clearCachedDeviceKeyAndPassword = function clearCachedDeviceKeyAndPassword() {\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t    var deviceKeyKey = keyPrefix + '.deviceKey';\n\t    var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t    var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n\t    this.storage.removeItem(deviceKeyKey);\n\t    this.storage.removeItem(randomPasswordKey);\n\t    this.storage.removeItem(deviceGroupKeyKey);\n\t  };\n\n\t  /**\n\t   * This is used to clear the session tokens from local storage\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.clearCachedTokens = function clearCachedTokens() {\n\t    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t    var idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n\t    var accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n\t    var refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n\t    var lastUserKey = keyPrefix + '.LastAuthUser';\n\n\t    this.storage.removeItem(idTokenKey);\n\t    this.storage.removeItem(accessTokenKey);\n\t    this.storage.removeItem(refreshTokenKey);\n\t    this.storage.removeItem(lastUserKey);\n\t  };\n\n\t  /**\n\t   * This is used to build a user session from tokens retrieved in the authentication result\n\t   * @param {object} authResult Successful auth response from server.\n\t   * @returns {CognitoUserSession} The new user session.\n\t   * @private\n\t   */\n\n\n\t  CognitoUser.prototype.getCognitoUserSession = function getCognitoUserSession(authResult) {\n\t    var idToken = new _CognitoIdToken2.default(authResult);\n\t    var accessToken = new _CognitoAccessToken2.default(authResult);\n\t    var refreshToken = new _CognitoRefreshToken2.default(authResult);\n\n\t    var sessionData = {\n\t      IdToken: idToken,\n\t      AccessToken: accessToken,\n\t      RefreshToken: refreshToken\n\t    };\n\n\t    return new _CognitoUserSession2.default(sessionData);\n\t  };\n\n\t  /**\n\t   * This is used to initiate a forgot password request\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {inputVerificationCode?} callback.inputVerificationCode\n\t   *    Optional callback raised instead of onSuccess with response data.\n\t   * @param {onSuccess} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.forgotPassword = function forgotPassword(callback) {\n\t    var jsonReq = {\n\t      ClientId: this.pool.getClientId(),\n\t      Username: this.username\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\t    this.client.makeUnauthenticatedRequest('forgotPassword', jsonReq, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      if (typeof callback.inputVerificationCode === 'function') {\n\t        return callback.inputVerificationCode(data);\n\t      }\n\t      return callback.onSuccess(data);\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used to confirm a new password using a confirmationCode\n\t   * @param {string} confirmationCode Code entered by user.\n\t   * @param {string} newPassword Confirm new password.\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<void>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback) {\n\t    var jsonReq = {\n\t      ClientId: this.pool.getClientId(),\n\t      Username: this.username,\n\t      ConfirmationCode: confirmationCode,\n\t      Password: newPassword\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\t    this.client.makeUnauthenticatedRequest('confirmForgotPassword', jsonReq, function (err) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess();\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used to initiate an attribute confirmation request\n\t   * @param {string} attributeName User attribute that needs confirmation.\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getAttributeVerificationCode = function getAttributeVerificationCode(attributeName, callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('getUserAttributeVerificationCode', {\n\t      AttributeName: attributeName,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      if (typeof callback.inputVerificationCode === 'function') {\n\t        return callback.inputVerificationCode(data);\n\t      }\n\t      return callback.onSuccess();\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to confirm an attribute using a confirmation code\n\t   * @param {string} attributeName Attribute being confirmed.\n\t   * @param {string} confirmationCode Code entered by user.\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<string>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.verifyAttribute = function verifyAttribute(attributeName, confirmationCode, callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('verifyUserAttribute', {\n\t      AttributeName: attributeName,\n\t      Code: confirmationCode,\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess('SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to get the device information using the current device key\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getDevice = function getDevice(callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('getDevice', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t      DeviceKey: this.deviceKey\n\t    }, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess(data);\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to forget a specific device\n\t   * @param {string} deviceKey Device key.\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<string>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.forgetSpecificDevice = function forgetSpecificDevice(deviceKey, callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('forgetDevice', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t      DeviceKey: deviceKey\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess('SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to forget the current device\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<string>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.forgetDevice = function forgetDevice(callback) {\n\t    var _this10 = this;\n\n\t    this.forgetSpecificDevice(this.deviceKey, {\n\t      onFailure: callback.onFailure,\n\t      onSuccess: function onSuccess(result) {\n\t        _this10.deviceKey = null;\n\t        _this10.deviceGroupKey = null;\n\t        _this10.randomPassword = null;\n\t        _this10.clearCachedDeviceKeyAndPassword();\n\t        return callback.onSuccess(result);\n\t      }\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used to set the device status as remembered\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<string>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.setDeviceStatusRemembered = function setDeviceStatusRemembered(callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t      DeviceKey: this.deviceKey,\n\t      DeviceRememberedStatus: 'remembered'\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess('SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to set the device status as not remembered\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<string>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.setDeviceStatusNotRemembered = function setDeviceStatusNotRemembered(callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t      DeviceKey: this.deviceKey,\n\t      DeviceRememberedStatus: 'not_remembered'\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess('SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to list all devices for a user\n\t   *\n\t   * @param {int} limit the number of devices returned in a call\n\t   * @param {string} paginationToken the pagination token in case any was returned before\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.listDevices = function listDevices(limit, paginationToken, callback) {\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('listDevices', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t      Limit: limit,\n\t      PaginationToken: paginationToken\n\t    }, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      return callback.onSuccess(data);\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used to globally revoke all tokens issued to a user\n\t   * @param {object} callback Result callback map.\n\t   * @param {onFailure} callback.onFailure Called on any error.\n\t   * @param {onSuccess<string>} callback.onSuccess Called on success.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.globalSignOut = function globalSignOut(callback) {\n\t    var _this11 = this;\n\n\t    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t      return callback.onFailure(new Error('User is not authenticated'));\n\t    }\n\n\t    this.client.makeUnauthenticatedRequest('globalSignOut', {\n\t      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t    }, function (err) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      _this11.clearCachedTokens();\n\t      return callback.onSuccess('SUCCESS');\n\t    });\n\t    return undefined;\n\t  };\n\n\t  /**\n\t   * This is used for the user to signOut of the application and clear the cached tokens.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.signOut = function signOut() {\n\t    this.signInUserSession = null;\n\t    this.clearCachedTokens();\n\t  };\n\n\t  /**\n\t   * This is used by a user trying to select a given MFA\n\t   * @param {string} answerChallenge the mfa the user wants\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.sendMFASelectionAnswer = function sendMFASelectionAnswer(answerChallenge, callback) {\n\t    var _this12 = this;\n\n\t    var challengeResponses = {};\n\t    challengeResponses.USERNAME = this.username;\n\t    challengeResponses.ANSWER = answerChallenge;\n\n\t    var jsonReq = {\n\t      ChallengeName: 'SELECT_MFA_TYPE',\n\t      ChallengeResponses: challengeResponses,\n\t      ClientId: this.pool.getClientId(),\n\t      Session: this.Session\n\t    };\n\t    if (this.getUserContextData()) {\n\t      jsonReq.UserContextData = this.getUserContextData();\n\t    }\n\t    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {\n\t      if (err) {\n\t        return callback.onFailure(err);\n\t      }\n\t      _this12.Session = data.Session;\n\t      if (answerChallenge === 'SMS_MFA') {\n\t        return callback.mfaRequired(data.challengeName, data.challengeParameters);\n\t      }\n\t      if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n\t        return callback.totpRequired(data.challengeName, data.challengeParameters);\n\t      }\n\t      return undefined;\n\t    });\n\t  };\n\n\t  /**\n\t   * This returns the user context data for advanced security feature.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.getUserContextData = function getUserContextData() {\n\t    var pool = this.pool;\n\t    return pool.getUserContextData(this.username);\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.associateSoftwareToken = function associateSoftwareToken(callback) {\n\t    var _this13 = this;\n\n\t    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t      this.client.makeUnauthenticatedRequest('associateSoftwareToken', {\n\t        Session: this.Session\n\t      }, function (err, data) {\n\t        if (err) {\n\t          return callback.onFailure(err);\n\t        }\n\t        _this13.Session = data.Session;\n\t        return callback.associateSecretCode(data.SecretCode);\n\t      });\n\t    } else {\n\t      this.client.makeUnauthenticatedRequest('associateSoftwareToken', {\n\t        AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t      }, function (err, data) {\n\t        if (err) {\n\t          return callback.onFailure(err);\n\t        }\n\t        return callback.associateSecretCode(data.SecretCode);\n\t      });\n\t    }\n\t  };\n\n\t  /**\n\t   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n\t   * @param {string} totpCode The MFA code entered by the user.\n\t   * @param {string} friendlyDeviceName The device name we are assigning to the device.\n\t   * @param {nodeCallback<string>} callback Called on success or error.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUser.prototype.verifySoftwareToken = function verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n\t    var _this14 = this;\n\n\t    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t      this.client.makeUnauthenticatedRequest('verifySoftwareToken', {\n\t        Session: this.Session,\n\t        UserCode: totpCode,\n\t        FriendlyDeviceName: friendlyDeviceName\n\t      }, function (err, data) {\n\t        if (err) {\n\t          return callback.onFailure(err);\n\t        }\n\t        _this14.Session = data.Session;\n\t        var challengeResponses = {};\n\t        challengeResponses.USERNAME = _this14.username;\n\t        var jsonReq = {\n\t          ChallengeName: 'MFA_SETUP',\n\t          ClientId: _this14.pool.getClientId(),\n\t          ChallengeResponses: challengeResponses,\n\t          Session: _this14.Session\n\t        };\n\t        if (_this14.getUserContextData()) {\n\t          jsonReq.UserContextData = _this14.getUserContextData();\n\t        }\n\t        _this14.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {\n\t          if (errRespond) {\n\t            return callback.onFailure(errRespond);\n\t          }\n\t          _this14.signInUserSession = _this14.getCognitoUserSession(dataRespond.AuthenticationResult);\n\t          _this14.cacheTokens();\n\t          return callback.onSuccess(_this14.signInUserSession);\n\t        });\n\t        return undefined;\n\t      });\n\t    } else {\n\t      this.client.makeUnauthenticatedRequest('verifySoftwareToken', {\n\t        AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t        UserCode: totpCode,\n\t        FriendlyDeviceName: friendlyDeviceName\n\t      }, function (err, data) {\n\t        if (err) {\n\t          return callback.onFailure(err);\n\t        }\n\t        return callback(null, data);\n\t      });\n\t    }\n\t  };\n\n\t  return CognitoUser;\n\t}();\n\n\texports.default = CognitoUser;\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t *     http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\n\t/** @class */\n\tvar CognitoUserAttribute = function () {\n\t  /**\n\t   * Constructs a new CognitoUserAttribute object\n\t   * @param {string=} Name The record's name\n\t   * @param {string=} Value The record's value\n\t   */\n\t  function CognitoUserAttribute() {\n\t    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t        Name = _ref.Name,\n\t        Value = _ref.Value;\n\n\t    _classCallCheck(this, CognitoUserAttribute);\n\n\t    this.Name = Name || '';\n\t    this.Value = Value || '';\n\t  }\n\n\t  /**\n\t   * @returns {string} the record's value.\n\t   */\n\n\n\t  CognitoUserAttribute.prototype.getValue = function getValue() {\n\t    return this.Value;\n\t  };\n\n\t  /**\n\t   * Sets the record's value.\n\t   * @param {string} value The new value.\n\t   * @returns {CognitoUserAttribute} The record for method chaining.\n\t   */\n\n\n\t  CognitoUserAttribute.prototype.setValue = function setValue(value) {\n\t    this.Value = value;\n\t    return this;\n\t  };\n\n\t  /**\n\t   * @returns {string} the record's name.\n\t   */\n\n\n\t  CognitoUserAttribute.prototype.getName = function getName() {\n\t    return this.Name;\n\t  };\n\n\t  /**\n\t   * Sets the record's name\n\t   * @param {string} name The new name.\n\t   * @returns {CognitoUserAttribute} The record for method chaining.\n\t   */\n\n\n\t  CognitoUserAttribute.prototype.setName = function setName(name) {\n\t    this.Name = name;\n\t    return this;\n\t  };\n\n\t  /**\n\t   * @returns {string} a string representation of the record.\n\t   */\n\n\n\t  CognitoUserAttribute.prototype.toString = function toString() {\n\t    return JSON.stringify(this);\n\t  };\n\n\t  /**\n\t   * @returns {object} a flat object representing the record.\n\t   */\n\n\n\t  CognitoUserAttribute.prototype.toJSON = function toJSON() {\n\t    return {\n\t      Name: this.Name,\n\t      Value: this.Value\n\t    };\n\t  };\n\n\t  return CognitoUserAttribute;\n\t}();\n\n\texports.default = CognitoUserAttribute;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t *     http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\n\t/** @class */\n\tvar CognitoUserSession = function () {\n\t  /**\n\t   * Constructs a new CognitoUserSession object\n\t   * @param {CognitoIdToken} IdToken The session's Id token.\n\t   * @param {CognitoRefreshToken=} RefreshToken The session's refresh token.\n\t   * @param {CognitoAccessToken} AccessToken The session's access token.\n\t   * @param {int} ClockDrift The saved computer's clock drift or undefined to force calculation.\n\t   */\n\t  function CognitoUserSession() {\n\t    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t        IdToken = _ref.IdToken,\n\t        RefreshToken = _ref.RefreshToken,\n\t        AccessToken = _ref.AccessToken,\n\t        ClockDrift = _ref.ClockDrift;\n\n\t    _classCallCheck(this, CognitoUserSession);\n\n\t    if (AccessToken == null || IdToken == null) {\n\t      throw new Error('Id token and Access Token must be present.');\n\t    }\n\n\t    this.idToken = IdToken;\n\t    this.refreshToken = RefreshToken;\n\t    this.accessToken = AccessToken;\n\t    this.clockDrift = ClockDrift === undefined ? this.calculateClockDrift() : ClockDrift;\n\t  }\n\n\t  /**\n\t   * @returns {CognitoIdToken} the session's Id token\n\t   */\n\n\n\t  CognitoUserSession.prototype.getIdToken = function getIdToken() {\n\t    return this.idToken;\n\t  };\n\n\t  /**\n\t   * @returns {CognitoRefreshToken} the session's refresh token\n\t   */\n\n\n\t  CognitoUserSession.prototype.getRefreshToken = function getRefreshToken() {\n\t    return this.refreshToken;\n\t  };\n\n\t  /**\n\t   * @returns {CognitoAccessToken} the session's access token\n\t   */\n\n\n\t  CognitoUserSession.prototype.getAccessToken = function getAccessToken() {\n\t    return this.accessToken;\n\t  };\n\n\t  /**\n\t   * @returns {int} the session's clock drift\n\t   */\n\n\n\t  CognitoUserSession.prototype.getClockDrift = function getClockDrift() {\n\t    return this.clockDrift;\n\t  };\n\n\t  /**\n\t   * @returns {int} the computer's clock drift\n\t   */\n\n\n\t  CognitoUserSession.prototype.calculateClockDrift = function calculateClockDrift() {\n\t    var now = Math.floor(new Date() / 1000);\n\t    var iat = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt());\n\n\t    return now - iat;\n\t  };\n\n\t  /**\n\t   * Checks to see if the session is still valid based on session expiry information found\n\t   * in tokens and the current time (adjusted with clock drift)\n\t   * @returns {boolean} if the session is still valid\n\t   */\n\n\n\t  CognitoUserSession.prototype.isValid = function isValid() {\n\t    var now = Math.floor(new Date() / 1000);\n\t    var adjusted = now - this.clockDrift;\n\n\t    return adjusted < this.accessToken.getExpiration() && adjusted < this.idToken.getExpiration();\n\t  };\n\n\t  return CognitoUserSession;\n\t}();\n\n\texports.default = CognitoUserSession;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t *     http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\n\tvar monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\tvar weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n\t/** @class */\n\n\tvar DateHelper = function () {\n\t  function DateHelper() {\n\t    _classCallCheck(this, DateHelper);\n\t  }\n\n\t  /**\n\t   * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n\t   */\n\t  DateHelper.prototype.getNowString = function getNowString() {\n\t    var now = new Date();\n\n\t    var weekDay = weekNames[now.getUTCDay()];\n\t    var month = monthNames[now.getUTCMonth()];\n\t    var day = now.getUTCDate();\n\n\t    var hours = now.getUTCHours();\n\t    if (hours < 10) {\n\t      hours = '0' + hours;\n\t    }\n\n\t    var minutes = now.getUTCMinutes();\n\t    if (minutes < 10) {\n\t      minutes = '0' + minutes;\n\t    }\n\n\t    var seconds = now.getUTCSeconds();\n\t    if (seconds < 10) {\n\t      seconds = '0' + seconds;\n\t    }\n\n\t    var year = now.getUTCFullYear();\n\n\t    // ddd MMM D HH:mm:ss UTC YYYY\n\t    var dateNow = weekDay + ' ' + month + ' ' + day + ' ' + hours + ':' + minutes + ':' + seconds + ' UTC ' + year;\n\n\t    return dateNow;\n\t  };\n\n\t  return DateHelper;\n\t}();\n\n\texports.default = DateHelper;\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t *     http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\n\tvar dataMemory = {};\n\n\t/** @class */\n\n\tvar MemoryStorage = function () {\n\t  function MemoryStorage() {\n\t    _classCallCheck(this, MemoryStorage);\n\t  }\n\n\t  /**\n\t   * This is used to set a specific item in storage\n\t   * @param {string} key - the key for the item\n\t   * @param {object} value - the value\n\t   * @returns {string} value that was set\n\t   */\n\t  MemoryStorage.setItem = function setItem(key, value) {\n\t    dataMemory[key] = value;\n\t    return dataMemory[key];\n\t  };\n\n\t  /**\n\t   * This is used to get a specific key from storage\n\t   * @param {string} key - the key for the item\n\t   * This is used to clear the storage\n\t   * @returns {string} the data item\n\t   */\n\n\n\t  MemoryStorage.getItem = function getItem(key) {\n\t    return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n\t  };\n\n\t  /**\n\t   * This is used to remove an item from storage\n\t   * @param {string} key - the key being set\n\t   * @returns {string} value - value that was deleted\n\t   */\n\n\n\t  MemoryStorage.removeItem = function removeItem(key) {\n\t    return delete dataMemory[key];\n\t  };\n\n\t  /**\n\t   * This is used to clear the storage\n\t   * @returns {string} nothing\n\t   */\n\n\n\t  MemoryStorage.clear = function clear() {\n\t    dataMemory = {};\n\t    return dataMemory;\n\t  };\n\n\t  return MemoryStorage;\n\t}();\n\n\t/** @class */\n\n\n\tvar StorageHelper = function () {\n\n\t  /**\n\t   * This is used to get a storage object\n\t   * @returns {object} the storage\n\t   */\n\t  function StorageHelper() {\n\t    _classCallCheck(this, StorageHelper);\n\n\t    try {\n\t      this.storageWindow = window.localStorage;\n\t      this.storageWindow.setItem('aws.cognito.test-ls', 1);\n\t      this.storageWindow.removeItem('aws.cognito.test-ls');\n\t    } catch (exception) {\n\t      this.storageWindow = MemoryStorage;\n\t    }\n\t  }\n\n\t  /**\n\t   * This is used to return the storage\n\t   * @returns {object} the storage\n\t   */\n\n\n\t  StorageHelper.prototype.getStorage = function getStorage() {\n\t    return this.storageWindow;\n\t  };\n\n\t  return StorageHelper;\n\t}();\n\n\texports.default = StorageHelper;\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_13__;\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports) {\n\n\t\"use strict\";\n\n\texports.__esModule = true;\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t *     http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\n\t/** @class */\n\tvar AuthenticationDetails = function () {\n\t  /**\n\t   * Constructs a new AuthenticationDetails object\n\t   * @param {object=} data Creation options.\n\t   * @param {string} data.Username User being authenticated.\n\t   * @param {string} data.Password Plain-text password to authenticate with.\n\t   * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.\n\t   * @param {(AttributeArg[])?} data.AuthParamaters Authentication paramaters for custom auth.\n\t   */\n\t  function AuthenticationDetails(data) {\n\t    _classCallCheck(this, AuthenticationDetails);\n\n\t    var _ref = data || {},\n\t        ValidationData = _ref.ValidationData,\n\t        Username = _ref.Username,\n\t        Password = _ref.Password,\n\t        AuthParameters = _ref.AuthParameters;\n\n\t    this.validationData = ValidationData || [];\n\t    this.authParameters = AuthParameters || [];\n\t    this.username = Username;\n\t    this.password = Password;\n\t  }\n\n\t  /**\n\t   * @returns {string} the record's username\n\t   */\n\n\n\t  AuthenticationDetails.prototype.getUsername = function getUsername() {\n\t    return this.username;\n\t  };\n\n\t  /**\n\t   * @returns {string} the record's password\n\t   */\n\n\n\t  AuthenticationDetails.prototype.getPassword = function getPassword() {\n\t    return this.password;\n\t  };\n\n\t  /**\n\t   * @returns {Array} the record's validationData\n\t   */\n\n\n\t  AuthenticationDetails.prototype.getValidationData = function getValidationData() {\n\t    return this.validationData;\n\t  };\n\n\t  /**\n\t   * @returns {Array} the record's authParameters\n\t   */\n\n\n\t  AuthenticationDetails.prototype.getAuthParameters = function getAuthParameters() {\n\t    return this.authParameters;\n\t  };\n\n\t  return AuthenticationDetails;\n\t}();\n\n\texports.default = AuthenticationDetails;\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _cognitoidentityserviceprovider = __webpack_require__(13);\n\n\tvar _cognitoidentityserviceprovider2 = _interopRequireDefault(_cognitoidentityserviceprovider);\n\n\tvar _CognitoUser = __webpack_require__(8);\n\n\tvar _CognitoUser2 = _interopRequireDefault(_CognitoUser);\n\n\tvar _StorageHelper = __webpack_require__(12);\n\n\tvar _StorageHelper2 = _interopRequireDefault(_StorageHelper);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n\t                                                                                                                                                           * Copyright 2016 Amazon.com,\n\t                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n\t                                                                                                                                                           * You may not use this file except in compliance with the\n\t                                                                                                                                                           * License. A copy of the License is located at\n\t                                                                                                                                                           *\n\t                                                                                                                                                           *     http://aws.amazon.com/asl/\n\t                                                                                                                                                           *\n\t                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n\t                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n\t                                                                                                                                                           * for the specific language governing permissions and\n\t                                                                                                                                                           * limitations under the License.\n\t                                                                                                                                                           */\n\n\t/** @class */\n\tvar CognitoUserPool = function () {\n\t  /**\n\t   * Constructs a new CognitoUserPool object\n\t   * @param {object} data Creation options.\n\t   * @param {string} data.UserPoolId Cognito user pool id.\n\t   * @param {string} data.ClientId User pool application client id.\n\t   * @param {object} data.Storage Optional storage object.\n\t   * @param {boolean} data.AdvancedSecurityDataCollectionFlag Optional:\n\t   *        boolean flag indicating if the data collection is enabled\n\t   *        to support cognito advanced security features. By default, this\n\t   *        flag is set to true.\n\t   */\n\t  function CognitoUserPool(data) {\n\t    _classCallCheck(this, CognitoUserPool);\n\n\t    var _ref = data || {},\n\t        UserPoolId = _ref.UserPoolId,\n\t        ClientId = _ref.ClientId,\n\t        endpoint = _ref.endpoint,\n\t        AdvancedSecurityDataCollectionFlag = _ref.AdvancedSecurityDataCollectionFlag;\n\n\t    if (!UserPoolId || !ClientId) {\n\t      throw new Error('Both UserPoolId and ClientId are required.');\n\t    }\n\t    if (!/^[\\w-]+_.+$/.test(UserPoolId)) {\n\t      throw new Error('Invalid UserPoolId format.');\n\t    }\n\t    var region = UserPoolId.split('_')[0];\n\n\t    this.userPoolId = UserPoolId;\n\t    this.clientId = ClientId;\n\n\t    this.client = new _cognitoidentityserviceprovider2.default({\n\t      apiVersion: '2016-04-19',\n\t      region: region,\n\t      endpoint: endpoint\n\t    });\n\n\t    /**\n\t     * By default, AdvancedSecurityDataCollectionFlag is set to true,\n\t     * if no input value is provided.\n\t     */\n\t    this.advancedSecurityDataCollectionFlag = AdvancedSecurityDataCollectionFlag !== false;\n\n\t    this.storage = data.Storage || new _StorageHelper2.default().getStorage();\n\t  }\n\n\t  /**\n\t   * @returns {string} the user pool id\n\t   */\n\n\n\t  CognitoUserPool.prototype.getUserPoolId = function getUserPoolId() {\n\t    return this.userPoolId;\n\t  };\n\n\t  /**\n\t   * @returns {string} the client id\n\t   */\n\n\n\t  CognitoUserPool.prototype.getClientId = function getClientId() {\n\t    return this.clientId;\n\t  };\n\n\t  /**\n\t   * @typedef {object} SignUpResult\n\t   * @property {CognitoUser} user New user.\n\t   * @property {bool} userConfirmed If the user is already confirmed.\n\t   */\n\t  /**\n\t   * method for signing up a user\n\t   * @param {string} username User's username.\n\t   * @param {string} password Plain-text initial password entered by user.\n\t   * @param {(AttributeArg[])=} userAttributes New user attributes.\n\t   * @param {(AttributeArg[])=} validationData Application metadata.\n\t   * @param {nodeCallback<SignUpResult>} callback Called on error or with the new user.\n\t   * @returns {void}\n\t   */\n\n\n\t  CognitoUserPool.prototype.signUp = function signUp(username, password, userAttributes, validationData, callback) {\n\t    var _this = this;\n\n\t    var jsonReq = {\n\t      ClientId: this.clientId,\n\t      Username: username,\n\t      Password: password,\n\t      UserAttributes: userAttributes,\n\t      ValidationData: validationData\n\t    };\n\t    if (this.getUserContextData(username)) {\n\t      jsonReq.UserContextData = this.getUserContextData(username);\n\t    }\n\t    this.client.makeUnauthenticatedRequest('signUp', jsonReq, function (err, data) {\n\t      if (err) {\n\t        return callback(err, null);\n\t      }\n\n\t      var cognitoUser = {\n\t        Username: username,\n\t        Pool: _this,\n\t        Storage: _this.storage\n\t      };\n\n\t      var returnData = {\n\t        user: new _CognitoUser2.default(cognitoUser),\n\t        userConfirmed: data.UserConfirmed,\n\t        userSub: data.UserSub\n\t      };\n\n\t      return callback(null, returnData);\n\t    });\n\t  };\n\n\t  /**\n\t   * method for getting the current user of the application from the local storage\n\t   *\n\t   * @returns {CognitoUser} the user retrieved from storage\n\t   */\n\n\n\t  CognitoUserPool.prototype.getCurrentUser = function getCurrentUser() {\n\t    var lastUserKey = 'CognitoIdentityServiceProvider.' + this.clientId + '.LastAuthUser';\n\n\t    var lastAuthUser = this.storage.getItem(lastUserKey);\n\t    if (lastAuthUser) {\n\t      var cognitoUser = {\n\t        Username: lastAuthUser,\n\t        Pool: this,\n\t        Storage: this.storage\n\t      };\n\n\t      return new _CognitoUser2.default(cognitoUser);\n\t    }\n\n\t    return null;\n\t  };\n\n\t  /**\n\t   * This method returns the encoded data string used for cognito advanced security feature.\n\t   * This would be generated only when developer has included the JS used for collecting the\n\t   * data on their client. Please refer to documentation to know more about using AdvancedSecurity\n\t   * features\n\t   * @param {string} username the username for the context data\n\t   * @returns {string} the user context data\n\t   **/\n\n\n\t  CognitoUserPool.prototype.getUserContextData = function getUserContextData(username) {\n\t    if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {\n\t      return undefined;\n\t    }\n\t    /* eslint-disable */\n\t    var amazonCognitoAdvancedSecurityDataConst = AmazonCognitoAdvancedSecurityData;\n\t    /* eslint-enable */\n\n\t    if (this.advancedSecurityDataCollectionFlag) {\n\t      var advancedSecurityData = amazonCognitoAdvancedSecurityDataConst.getData(username, this.userPoolId, this.clientId);\n\t      if (advancedSecurityData) {\n\t        var userContextData = {\n\t          EncodedData: advancedSecurityData\n\t        };\n\t        return userContextData;\n\t      }\n\t    }\n\t    return {};\n\t  };\n\n\t  return CognitoUserPool;\n\t}();\n\n\texports.default = CognitoUserPool;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _jsCookie = __webpack_require__(18);\n\n\tvar Cookies = _interopRequireWildcard(_jsCookie);\n\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\t/** @class */\n\tvar CookieStorage = function () {\n\n\t  /**\n\t   * Constructs a new CookieStorage object\n\t   * @param {object} data Creation options.\n\t   * @param {string} data.domain Cookies domain (mandatory).\n\t   * @param {string} data.path Cookies path (default: '/')\n\t   * @param {integer} data.expires Cookie expiration (in days, default: 365)\n\t   * @param {boolean} data.secure Cookie secure flag (default: true)\n\t   */\n\t  function CookieStorage(data) {\n\t    _classCallCheck(this, CookieStorage);\n\n\t    this.domain = data.domain;\n\t    if (data.path) {\n\t      this.path = data.path;\n\t    } else {\n\t      this.path = '/';\n\t    }\n\t    if (Object.prototype.hasOwnProperty.call(data, 'expires')) {\n\t      this.expires = data.expires;\n\t    } else {\n\t      this.expires = 365;\n\t    }\n\t    if (Object.prototype.hasOwnProperty.call(data, 'secure')) {\n\t      this.secure = data.secure;\n\t    } else {\n\t      this.secure = true;\n\t    }\n\t  }\n\n\t  /**\n\t   * This is used to set a specific item in storage\n\t   * @param {string} key - the key for the item\n\t   * @param {object} value - the value\n\t   * @returns {string} value that was set\n\t   */\n\n\n\t  CookieStorage.prototype.setItem = function setItem(key, value) {\n\t    Cookies.set(key, value, {\n\t      path: this.path,\n\t      expires: this.expires,\n\t      domain: this.domain,\n\t      secure: this.secure\n\t    });\n\t    return Cookies.get(key);\n\t  };\n\n\t  /**\n\t   * This is used to get a specific key from storage\n\t   * @param {string} key - the key for the item\n\t   * This is used to clear the storage\n\t   * @returns {string} the data item\n\t   */\n\n\n\t  CookieStorage.prototype.getItem = function getItem(key) {\n\t    return Cookies.get(key);\n\t  };\n\n\t  /**\n\t   * This is used to remove an item from storage\n\t   * @param {string} key - the key being set\n\t   * @returns {string} value - value that was deleted\n\t   */\n\n\n\t  CookieStorage.prototype.removeItem = function removeItem(key) {\n\t    return Cookies.remove(key, {\n\t      path: this.path,\n\t      domain: this.domain,\n\t      secure: this.secure\n\t    });\n\t  };\n\n\t  /**\n\t   * This is used to clear the storage\n\t   * @returns {string} nothing\n\t   */\n\n\n\t  CookieStorage.prototype.clear = function clear() {\n\t    var cookies = Cookies.get();\n\t    var index = void 0;\n\t    for (index = 0; index < cookies.length; ++index) {\n\t      Cookies.remove(cookies[index]);\n\t    }\n\t    return {};\n\t  };\n\n\t  return CookieStorage;\n\t}();\n\n\texports.default = CookieStorage;\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.__esModule = true;\n\n\tvar _AuthenticationDetails = __webpack_require__(14);\n\n\tObject.defineProperty(exports, 'AuthenticationDetails', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_AuthenticationDetails).default;\n\t  }\n\t});\n\n\tvar _AuthenticationHelper = __webpack_require__(2);\n\n\tObject.defineProperty(exports, 'AuthenticationHelper', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_AuthenticationHelper).default;\n\t  }\n\t});\n\n\tvar _CognitoAccessToken = __webpack_require__(4);\n\n\tObject.defineProperty(exports, 'CognitoAccessToken', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoAccessToken).default;\n\t  }\n\t});\n\n\tvar _CognitoIdToken = __webpack_require__(5);\n\n\tObject.defineProperty(exports, 'CognitoIdToken', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoIdToken).default;\n\t  }\n\t});\n\n\tvar _CognitoRefreshToken = __webpack_require__(7);\n\n\tObject.defineProperty(exports, 'CognitoRefreshToken', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoRefreshToken).default;\n\t  }\n\t});\n\n\tvar _CognitoUser = __webpack_require__(8);\n\n\tObject.defineProperty(exports, 'CognitoUser', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoUser).default;\n\t  }\n\t});\n\n\tvar _CognitoUserAttribute = __webpack_require__(9);\n\n\tObject.defineProperty(exports, 'CognitoUserAttribute', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoUserAttribute).default;\n\t  }\n\t});\n\n\tvar _CognitoUserPool = __webpack_require__(15);\n\n\tObject.defineProperty(exports, 'CognitoUserPool', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoUserPool).default;\n\t  }\n\t});\n\n\tvar _CognitoUserSession = __webpack_require__(10);\n\n\tObject.defineProperty(exports, 'CognitoUserSession', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CognitoUserSession).default;\n\t  }\n\t});\n\n\tvar _CookieStorage = __webpack_require__(16);\n\n\tObject.defineProperty(exports, 'CookieStorage', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_CookieStorage).default;\n\t  }\n\t});\n\n\tvar _DateHelper = __webpack_require__(11);\n\n\tObject.defineProperty(exports, 'DateHelper', {\n\t  enumerable: true,\n\t  get: function get() {\n\t    return _interopRequireDefault(_DateHelper).default;\n\t  }\n\t});\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\t// The version of crypto-browserify included by aws-sdk only\n\t// checks for window.crypto, not window.msCrypto as used by\n\t// IE 11 – so we set it explicitly here\n\tif (typeof window !== 'undefined' && !window.crypto && window.msCrypto) {\n\t  window.crypto = window.msCrypto;\n\t}\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n\t * JavaScript Cookie v2.2.0\n\t * https://github.com/js-cookie/js-cookie\n\t *\n\t * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n\t * Released under the MIT license\n\t */\n\t;(function (factory) {\n\t\tvar registeredInModuleLoader = false;\n\t\tif (true) {\n\t\t\t!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\t\tregisteredInModuleLoader = true;\n\t\t}\n\t\tif (true) {\n\t\t\tmodule.exports = factory();\n\t\t\tregisteredInModuleLoader = true;\n\t\t}\n\t\tif (!registeredInModuleLoader) {\n\t\t\tvar OldCookies = window.Cookies;\n\t\t\tvar api = window.Cookies = factory();\n\t\t\tapi.noConflict = function () {\n\t\t\t\twindow.Cookies = OldCookies;\n\t\t\t\treturn api;\n\t\t\t};\n\t\t}\n\t}(function () {\n\t\tfunction extend () {\n\t\t\tvar i = 0;\n\t\t\tvar result = {};\n\t\t\tfor (; i < arguments.length; i++) {\n\t\t\t\tvar attributes = arguments[ i ];\n\t\t\t\tfor (var key in attributes) {\n\t\t\t\t\tresult[key] = attributes[key];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tfunction init (converter) {\n\t\t\tfunction api (key, value, attributes) {\n\t\t\t\tvar result;\n\t\t\t\tif (typeof document === 'undefined') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Write\n\n\t\t\t\tif (arguments.length > 1) {\n\t\t\t\t\tattributes = extend({\n\t\t\t\t\t\tpath: '/'\n\t\t\t\t\t}, api.defaults, attributes);\n\n\t\t\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\t\t\tvar expires = new Date();\n\t\t\t\t\t\texpires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);\n\t\t\t\t\t\tattributes.expires = expires;\n\t\t\t\t\t}\n\n\t\t\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresult = JSON.stringify(value);\n\t\t\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\t\t\tvalue = result;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {}\n\n\t\t\t\t\tif (!converter.write) {\n\t\t\t\t\t\tvalue = encodeURIComponent(String(value))\n\t\t\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = converter.write(value, key);\n\t\t\t\t\t}\n\n\t\t\t\t\tkey = encodeURIComponent(String(key));\n\t\t\t\t\tkey = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);\n\t\t\t\t\tkey = key.replace(/[\\(\\)]/g, escape);\n\n\t\t\t\t\tvar stringifiedAttributes = '';\n\n\t\t\t\t\tfor (var attributeName in attributes) {\n\t\t\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName];\n\t\t\t\t\t}\n\t\t\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t\t\t}\n\n\t\t\t\t// Read\n\n\t\t\t\tif (!key) {\n\t\t\t\t\tresult = {};\n\t\t\t\t}\n\n\t\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t\t// in case there are no cookies at all. Also prevents odd result when\n\t\t\t\t// calling \"get()\"\n\t\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\t\tvar rdecode = /(%[0-9A-Z]{2})+/g;\n\t\t\t\tvar i = 0;\n\n\t\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\t\tif (!this.json && cookie.charAt(0) === '\"') {\n\t\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar name = parts[0].replace(rdecode, decodeURIComponent);\n\t\t\t\t\t\tcookie = converter.read ?\n\t\t\t\t\t\t\tconverter.read(cookie, name) : converter(cookie, name) ||\n\t\t\t\t\t\t\tcookie.replace(rdecode, decodeURIComponent);\n\n\t\t\t\t\t\tif (this.json) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\t\tresult = cookie;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!key) {\n\t\t\t\t\t\t\tresult[name] = cookie;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {}\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tapi.set = api;\n\t\t\tapi.get = function (key) {\n\t\t\t\treturn api.call(api, key);\n\t\t\t};\n\t\t\tapi.getJSON = function () {\n\t\t\t\treturn api.apply({\n\t\t\t\t\tjson: true\n\t\t\t\t}, [].slice.call(arguments));\n\t\t\t};\n\t\t\tapi.defaults = {};\n\n\t\t\tapi.remove = function (key, attributes) {\n\t\t\t\tapi(key, '', extend(attributes, {\n\t\t\t\t\texpires: -1\n\t\t\t\t}));\n\t\t\t};\n\n\t\t\tapi.withConverter = init;\n\n\t\t\treturn api;\n\t\t}\n\n\t\treturn init(function () {});\n\t}));\n\n\n/***/ })\n/******/ ])\n});\n;"
  },
  {
    "path": "dist/aws-cognito-sdk.js",
    "content": "// AWS SDK for JavaScript v2.6.4\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// License at https://sdk.amazonaws.com/js/BUNDLE_LICENSE.txt\n(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error(\"Cannot find module '\"+o+\"'\")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\nmodule.exports={\n  \"version\": \"2.0\",\n  \"metadata\": {\n    \"apiVersion\": \"2014-06-30\",\n    \"endpointPrefix\": \"cognito-identity\",\n    \"jsonVersion\": \"1.1\",\n    \"protocol\": \"json\",\n    \"serviceFullName\": \"Amazon Cognito Identity\",\n    \"signatureVersion\": \"v4\",\n    \"targetPrefix\": \"AWSCognitoIdentityService\"\n  },\n  \"operations\": {\n    \"CreateIdentityPool\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolName\",\n          \"AllowUnauthenticatedIdentities\"\n        ],\n        \"members\": {\n          \"IdentityPoolName\": {},\n          \"AllowUnauthenticatedIdentities\": {\n            \"type\": \"boolean\"\n          },\n          \"SupportedLoginProviders\": {\n            \"shape\": \"S4\"\n          },\n          \"DeveloperProviderName\": {},\n          \"OpenIdConnectProviderARNs\": {\n            \"shape\": \"S8\"\n          },\n          \"CognitoIdentityProviders\": {\n            \"shape\": \"Sa\"\n          },\n          \"SamlProviderARNs\": {\n            \"shape\": \"Se\"\n          }\n        }\n      },\n      \"output\": {\n        \"shape\": \"Sf\"\n      }\n    },\n    \"DeleteIdentities\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityIdsToDelete\"\n        ],\n        \"members\": {\n          \"IdentityIdsToDelete\": {\n            \"type\": \"list\",\n            \"member\": {}\n          }\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"UnprocessedIdentityIds\": {\n            \"type\": \"list\",\n            \"member\": {\n              \"type\": \"structure\",\n              \"members\": {\n                \"IdentityId\": {},\n                \"ErrorCode\": {}\n              }\n            }\n          }\n        }\n      }\n    },\n    \"DeleteIdentityPool\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {}\n        }\n      }\n    },\n    \"DescribeIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityId\"\n        ],\n        \"members\": {\n          \"IdentityId\": {}\n        }\n      },\n      \"output\": {\n        \"shape\": \"Sq\"\n      }\n    },\n    \"DescribeIdentityPool\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {}\n        }\n      },\n      \"output\": {\n        \"shape\": \"Sf\"\n      }\n    },\n    \"GetCredentialsForIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityId\"\n        ],\n        \"members\": {\n          \"IdentityId\": {},\n          \"Logins\": {\n            \"shape\": \"Sv\"\n          },\n          \"CustomRoleArn\": {}\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityId\": {},\n          \"Credentials\": {\n            \"type\": \"structure\",\n            \"members\": {\n              \"AccessKeyId\": {},\n              \"SecretKey\": {},\n              \"SessionToken\": {},\n              \"Expiration\": {\n                \"type\": \"timestamp\"\n              }\n            }\n          }\n        }\n      }\n    },\n    \"GetId\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\"\n        ],\n        \"members\": {\n          \"AccountId\": {},\n          \"IdentityPoolId\": {},\n          \"Logins\": {\n            \"shape\": \"Sv\"\n          }\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityId\": {}\n        }\n      }\n    },\n    \"GetIdentityPoolRoles\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {}\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityPoolId\": {},\n          \"Roles\": {\n            \"shape\": \"S17\"\n          }\n        }\n      }\n    },\n    \"GetOpenIdToken\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityId\"\n        ],\n        \"members\": {\n          \"IdentityId\": {},\n          \"Logins\": {\n            \"shape\": \"Sv\"\n          }\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityId\": {},\n          \"Token\": {}\n        }\n      }\n    },\n    \"GetOpenIdTokenForDeveloperIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\",\n          \"Logins\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {},\n          \"IdentityId\": {},\n          \"Logins\": {\n            \"shape\": \"Sv\"\n          },\n          \"TokenDuration\": {\n            \"type\": \"long\"\n          }\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityId\": {},\n          \"Token\": {}\n        }\n      }\n    },\n    \"ListIdentities\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\",\n          \"MaxResults\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {},\n          \"MaxResults\": {\n            \"type\": \"integer\"\n          },\n          \"NextToken\": {},\n          \"HideDisabled\": {\n            \"type\": \"boolean\"\n          }\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityPoolId\": {},\n          \"Identities\": {\n            \"type\": \"list\",\n            \"member\": {\n              \"shape\": \"Sq\"\n            }\n          },\n          \"NextToken\": {}\n        }\n      }\n    },\n    \"ListIdentityPools\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"MaxResults\"\n        ],\n        \"members\": {\n          \"MaxResults\": {\n            \"type\": \"integer\"\n          },\n          \"NextToken\": {}\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityPools\": {\n            \"type\": \"list\",\n            \"member\": {\n              \"type\": \"structure\",\n              \"members\": {\n                \"IdentityPoolId\": {},\n                \"IdentityPoolName\": {}\n              }\n            }\n          },\n          \"NextToken\": {}\n        }\n      }\n    },\n    \"LookupDeveloperIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {},\n          \"IdentityId\": {},\n          \"DeveloperUserIdentifier\": {},\n          \"MaxResults\": {\n            \"type\": \"integer\"\n          },\n          \"NextToken\": {}\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityId\": {},\n          \"DeveloperUserIdentifierList\": {\n            \"type\": \"list\",\n            \"member\": {}\n          },\n          \"NextToken\": {}\n        }\n      }\n    },\n    \"MergeDeveloperIdentities\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"SourceUserIdentifier\",\n          \"DestinationUserIdentifier\",\n          \"DeveloperProviderName\",\n          \"IdentityPoolId\"\n        ],\n        \"members\": {\n          \"SourceUserIdentifier\": {},\n          \"DestinationUserIdentifier\": {},\n          \"DeveloperProviderName\": {},\n          \"IdentityPoolId\": {}\n        }\n      },\n      \"output\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"IdentityId\": {}\n        }\n      }\n    },\n    \"SetIdentityPoolRoles\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityPoolId\",\n          \"Roles\"\n        ],\n        \"members\": {\n          \"IdentityPoolId\": {},\n          \"Roles\": {\n            \"shape\": \"S17\"\n          }\n        }\n      }\n    },\n    \"UnlinkDeveloperIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityId\",\n          \"IdentityPoolId\",\n          \"DeveloperProviderName\",\n          \"DeveloperUserIdentifier\"\n        ],\n        \"members\": {\n          \"IdentityId\": {},\n          \"IdentityPoolId\": {},\n          \"DeveloperProviderName\": {},\n          \"DeveloperUserIdentifier\": {}\n        }\n      }\n    },\n    \"UnlinkIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"IdentityId\",\n          \"Logins\",\n          \"LoginsToRemove\"\n        ],\n        \"members\": {\n          \"IdentityId\": {},\n          \"Logins\": {\n            \"shape\": \"Sv\"\n          },\n          \"LoginsToRemove\": {\n            \"shape\": \"Sr\"\n          }\n        }\n      }\n    },\n    \"UpdateIdentityPool\": {\n      \"input\": {\n        \"shape\": \"Sf\"\n      },\n      \"output\": {\n        \"shape\": \"Sf\"\n      }\n    }\n  },\n  \"shapes\": {\n    \"S4\": {\n      \"type\": \"map\",\n      \"key\": {},\n      \"value\": {}\n    },\n    \"S8\": {\n      \"type\": \"list\",\n      \"member\": {}\n    },\n    \"Sa\": {\n      \"type\": \"list\",\n      \"member\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"ProviderName\": {},\n          \"ClientId\": {}\n        }\n      }\n    },\n    \"Se\": {\n      \"type\": \"list\",\n      \"member\": {}\n    },\n    \"Sf\": {\n      \"type\": \"structure\",\n      \"required\": [\n        \"IdentityPoolId\",\n        \"IdentityPoolName\",\n        \"AllowUnauthenticatedIdentities\"\n      ],\n      \"members\": {\n        \"IdentityPoolId\": {},\n        \"IdentityPoolName\": {},\n        \"AllowUnauthenticatedIdentities\": {\n          \"type\": \"boolean\"\n        },\n        \"SupportedLoginProviders\": {\n          \"shape\": \"S4\"\n        },\n        \"DeveloperProviderName\": {},\n        \"OpenIdConnectProviderARNs\": {\n          \"shape\": \"S8\"\n        },\n        \"CognitoIdentityProviders\": {\n          \"shape\": \"Sa\"\n        },\n        \"SamlProviderARNs\": {\n          \"shape\": \"Se\"\n        }\n      }\n    },\n    \"Sq\": {\n      \"type\": \"structure\",\n      \"members\": {\n        \"IdentityId\": {},\n        \"Logins\": {\n          \"shape\": \"Sr\"\n        },\n        \"CreationDate\": {\n          \"type\": \"timestamp\"\n        },\n        \"LastModifiedDate\": {\n          \"type\": \"timestamp\"\n        }\n      }\n    },\n    \"Sr\": {\n      \"type\": \"list\",\n      \"member\": {}\n    },\n    \"Sv\": {\n      \"type\": \"map\",\n      \"key\": {},\n      \"value\": {}\n    },\n    \"S17\": {\n      \"type\": \"map\",\n      \"key\": {},\n      \"value\": {}\n    }\n  }\n}\n},{}],2:[function(require,module,exports){\nmodule.exports={\n  \"version\":\"2.0\",\n  \"metadata\":{\n    \"apiVersion\":\"2016-04-18\",\n    \"endpointPrefix\":\"cognito-idp\",\n    \"jsonVersion\":\"1.1\",\n    \"protocol\":\"json\",\n    \"serviceFullName\":\"Amazon Cognito Identity Provider\",\n    \"signatureVersion\":\"v4\",\n    \"targetPrefix\":\"AWSCognitoIdentityProviderService\"\n  },\n  \"operations\":{\n    \"AddCustomAttributes\":{\n      \"name\":\"AddCustomAttributes\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AddCustomAttributesRequest\"},\n      \"output\":{\"shape\":\"AddCustomAttributesResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserImportInProgressException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Adds additional user attributes to the user pool schema.</p>\"\n    },\n    \"AdminAddUserToGroup\":{\n      \"name\":\"AdminAddUserToGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminAddUserToGroupRequest\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Adds the specified user to the specified group.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminConfirmSignUp\":{\n      \"name\":\"AdminConfirmSignUp\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminConfirmSignUpRequest\"},\n      \"output\":{\"shape\":\"AdminConfirmSignUpResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyFailedAttemptsException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Confirms user registration as an admin without using a confirmation code. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminCreateUser\":{\n      \"name\":\"AdminCreateUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminCreateUserRequest\"},\n      \"output\":{\"shape\":\"AdminCreateUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UsernameExistsException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"PreconditionNotMetException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UnsupportedUserStateException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Creates a new user in the specified user pool and sends a welcome message via email or phone (SMS). This message is based on a template that you configured in your call to CreateUserPool or UpdateUserPool. This template includes your custom sign-up instructions and placeholders for user name and temporary password.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminDeleteUser\":{\n      \"name\":\"AdminDeleteUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminDeleteUserRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Deletes a user as an administrator. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminDeleteUserAttributes\":{\n      \"name\":\"AdminDeleteUserAttributes\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminDeleteUserAttributesRequest\"},\n      \"output\":{\"shape\":\"AdminDeleteUserAttributesResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Deletes the user attributes in a user pool as an administrator. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminDisableProviderForUser\":{\n      \"name\":\"AdminDisableProviderForUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminDisableProviderForUserRequest\"},\n      \"output\":{\"shape\":\"AdminDisableProviderForUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"AdminDisableUser\":{\n      \"name\":\"AdminDisableUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminDisableUserRequest\"},\n      \"output\":{\"shape\":\"AdminDisableUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Disables the specified user as an administrator. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminEnableUser\":{\n      \"name\":\"AdminEnableUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminEnableUserRequest\"},\n      \"output\":{\"shape\":\"AdminEnableUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Enables the specified user as an administrator. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminForgetDevice\":{\n      \"name\":\"AdminForgetDevice\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminForgetDeviceRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Forgets the device, as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminGetDevice\":{\n      \"name\":\"AdminGetDevice\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminGetDeviceRequest\"},\n      \"output\":{\"shape\":\"AdminGetDeviceResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"NotAuthorizedException\"}\n      ],\n      \"documentation\":\"<p>Gets the device, as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminGetUser\":{\n      \"name\":\"AdminGetUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminGetUserRequest\"},\n      \"output\":{\"shape\":\"AdminGetUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the specified user by user name in a user pool as an administrator. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminInitiateAuth\":{\n      \"name\":\"AdminInitiateAuth\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminInitiateAuthRequest\"},\n      \"output\":{\"shape\":\"AdminInitiateAuthResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"MFAMethodNotFoundException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"}\n      ],\n      \"documentation\":\"<p>Initiates the authentication flow, as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminLinkProviderForUser\":{\n      \"name\":\"AdminLinkProviderForUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminLinkProviderForUserRequest\"},\n      \"output\":{\"shape\":\"AdminLinkProviderForUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"AdminListDevices\":{\n      \"name\":\"AdminListDevices\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminListDevicesRequest\"},\n      \"output\":{\"shape\":\"AdminListDevicesResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"NotAuthorizedException\"}\n      ],\n      \"documentation\":\"<p>Lists devices, as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminListGroupsForUser\":{\n      \"name\":\"AdminListGroupsForUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminListGroupsForUserRequest\"},\n      \"output\":{\"shape\":\"AdminListGroupsForUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the groups that the user belongs to.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminListUserAuthEvents\":{\n      \"name\":\"AdminListUserAuthEvents\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminListUserAuthEventsRequest\"},\n      \"output\":{\"shape\":\"AdminListUserAuthEventsResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserPoolAddOnNotEnabledException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"AdminRemoveUserFromGroup\":{\n      \"name\":\"AdminRemoveUserFromGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminRemoveUserFromGroupRequest\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Removes the specified user from the specified group.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminResetUserPassword\":{\n      \"name\":\"AdminResetUserPassword\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminResetUserPasswordRequest\"},\n      \"output\":{\"shape\":\"AdminResetUserPasswordResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Resets the specified user's password in a user pool as an administrator. Works on any user.</p> <p>When a developer calls this API, the current password is invalidated, so it must be changed. If a user tries to sign in after the API is called, the app will get a PasswordResetRequiredException exception back and should direct the user down the flow to reset the password, which is the same as the forgot password flow. In addition, if the user pool has phone verification selected and a verified phone number exists for the user, or if email verification is selected and a verified email exists for the user, calling this API will also result in sending a message to the end user with the code to change their password.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminRespondToAuthChallenge\":{\n      \"name\":\"AdminRespondToAuthChallenge\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminRespondToAuthChallengeRequest\"},\n      \"output\":{\"shape\":\"AdminRespondToAuthChallengeResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"MFAMethodNotFoundException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"SoftwareTokenMFANotFoundException\"}\n      ],\n      \"documentation\":\"<p>Responds to an authentication challenge, as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminSetUserMFAPreference\":{\n      \"name\":\"AdminSetUserMFAPreference\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminSetUserMFAPreferenceRequest\"},\n      \"output\":{\"shape\":\"AdminSetUserMFAPreferenceResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"AdminSetUserSettings\":{\n      \"name\":\"AdminSetUserSettings\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminSetUserSettingsRequest\"},\n      \"output\":{\"shape\":\"AdminSetUserSettingsResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Sets all the user settings for a specified user name. Works on any user.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminUpdateAuthEventFeedback\":{\n      \"name\":\"AdminUpdateAuthEventFeedback\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminUpdateAuthEventFeedbackRequest\"},\n      \"output\":{\"shape\":\"AdminUpdateAuthEventFeedbackResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserPoolAddOnNotEnabledException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"AdminUpdateDeviceStatus\":{\n      \"name\":\"AdminUpdateDeviceStatus\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminUpdateDeviceStatusRequest\"},\n      \"output\":{\"shape\":\"AdminUpdateDeviceStatusResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Updates the device status as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminUpdateUserAttributes\":{\n      \"name\":\"AdminUpdateUserAttributes\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminUpdateUserAttributesRequest\"},\n      \"output\":{\"shape\":\"AdminUpdateUserAttributesResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Updates the specified user's attributes, including developer attributes, as an administrator. Works on any user.</p> <p>In addition to updating user attributes, this API can also be used to mark phone and email as verified.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AdminUserGlobalSignOut\":{\n      \"name\":\"AdminUserGlobalSignOut\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AdminUserGlobalSignOutRequest\"},\n      \"output\":{\"shape\":\"AdminUserGlobalSignOutResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Signs out users from all devices, as an administrator.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"AssociateSoftwareToken\":{\n      \"name\":\"AssociateSoftwareToken\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AssociateSoftwareTokenRequest\"},\n      \"output\":{\"shape\":\"AssociateSoftwareTokenResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"SoftwareTokenMFANotFoundException\"}\n      ]\n    },\n    \"Authenticate\":{\n      \"name\":\"Authenticate\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"AuthenticateRequest\"},\n      \"output\":{\"shape\":\"AuthenticateResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"MFAMethodNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>The second step in the authentication flow of Secure Remote Password protocol (SRP) for authenticating a user to get ID, access and refresh tokens. To learn more about the first step, see <a href=\\\"API_GetAuthenticationDetails.html\\\">GetAuthenticationDetails</a>.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"ChangePassword\":{\n      \"name\":\"ChangePassword\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ChangePasswordRequest\"},\n      \"output\":{\"shape\":\"ChangePasswordResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Changes the password for a specified user in a user pool.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"ConfirmDevice\":{\n      \"name\":\"ConfirmDevice\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ConfirmDeviceRequest\"},\n      \"output\":{\"shape\":\"ConfirmDeviceResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"UsernameExistsException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Confirms tracking of the device. This API call is the call that begins device tracking.</p>\"\n    },\n    \"ConfirmForgotPassword\":{\n      \"name\":\"ConfirmForgotPassword\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ConfirmForgotPasswordRequest\"},\n      \"output\":{\"shape\":\"ConfirmForgotPasswordResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"TooManyFailedAttemptsException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Allows a user to enter a confirmation code to reset a forgotten password.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"ConfirmSignUp\":{\n      \"name\":\"ConfirmSignUp\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ConfirmSignUpRequest\"},\n      \"output\":{\"shape\":\"ConfirmSignUpResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyFailedAttemptsException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Confirms registration of a user and handles the existing alias from a previous user.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"CreateGroup\":{\n      \"name\":\"CreateGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateGroupRequest\"},\n      \"output\":{\"shape\":\"CreateGroupResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"GroupExistsException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Creates a new group in the specified user pool.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"CreateIdentityProvider\":{\n      \"name\":\"CreateIdentityProvider\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateIdentityProviderRequest\"},\n      \"output\":{\"shape\":\"CreateIdentityProviderResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"DuplicateProviderException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"CreateResourceServer\":{\n      \"name\":\"CreateResourceServer\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateResourceServerRequest\"},\n      \"output\":{\"shape\":\"CreateResourceServerResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"CreateUserImportJob\":{\n      \"name\":\"CreateUserImportJob\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateUserImportJobRequest\"},\n      \"output\":{\"shape\":\"CreateUserImportJobResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PreconditionNotMetException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Creates the user import job.</p>\"\n    },\n    \"CreateUserPool\":{\n      \"name\":\"CreateUserPool\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateUserPoolRequest\"},\n      \"output\":{\"shape\":\"CreateUserPoolResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserPoolTaggingException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Creates a new Amazon Cognito user pool and sets the password policy for the pool.</p>\"\n    },\n    \"CreateUserPoolClient\":{\n      \"name\":\"CreateUserPoolClient\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateUserPoolClientRequest\"},\n      \"output\":{\"shape\":\"CreateUserPoolClientResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"ScopeDoesNotExistException\"},\n        {\"shape\":\"InvalidOAuthFlowException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Creates the user pool client.</p>\"\n    },\n    \"CreateUserPoolDomain\":{\n      \"name\":\"CreateUserPoolDomain\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"CreateUserPoolDomainRequest\"},\n      \"output\":{\"shape\":\"CreateUserPoolDomainResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DeleteGroup\":{\n      \"name\":\"DeleteGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteGroupRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Deletes a group. Currently only groups with no members can be deleted.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"DeleteIdentityProvider\":{\n      \"name\":\"DeleteIdentityProvider\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteIdentityProviderRequest\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnsupportedIdentityProviderException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DeleteResourceServer\":{\n      \"name\":\"DeleteResourceServer\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteResourceServerRequest\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DeleteUser\":{\n      \"name\":\"DeleteUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteUserRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Allows a user to delete one's self.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"DeleteUserAttributes\":{\n      \"name\":\"DeleteUserAttributes\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteUserAttributesRequest\"},\n      \"output\":{\"shape\":\"DeleteUserAttributesResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Deletes the attributes for a user.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"DeleteUserPool\":{\n      \"name\":\"DeleteUserPool\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteUserPoolRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserImportInProgressException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Deletes the specified Amazon Cognito user pool.</p>\"\n    },\n    \"DeleteUserPoolClient\":{\n      \"name\":\"DeleteUserPoolClient\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteUserPoolClientRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Allows the developer to delete the user pool client.</p>\"\n    },\n    \"DeleteUserPoolDomain\":{\n      \"name\":\"DeleteUserPoolDomain\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DeleteUserPoolDomainRequest\"},\n      \"output\":{\"shape\":\"DeleteUserPoolDomainResponse\"},\n      \"errors\":[\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DescribeIdentityProvider\":{\n      \"name\":\"DescribeIdentityProvider\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeIdentityProviderRequest\"},\n      \"output\":{\"shape\":\"DescribeIdentityProviderResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DescribeResourceServer\":{\n      \"name\":\"DescribeResourceServer\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeResourceServerRequest\"},\n      \"output\":{\"shape\":\"DescribeResourceServerResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DescribeRiskConfiguration\":{\n      \"name\":\"DescribeRiskConfiguration\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeRiskConfigurationRequest\"},\n      \"output\":{\"shape\":\"DescribeRiskConfigurationResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserPoolAddOnNotEnabledException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"DescribeUserImportJob\":{\n      \"name\":\"DescribeUserImportJob\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeUserImportJobRequest\"},\n      \"output\":{\"shape\":\"DescribeUserImportJobResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Describes the user import job.</p>\"\n    },\n    \"DescribeUserPool\":{\n      \"name\":\"DescribeUserPool\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeUserPoolRequest\"},\n      \"output\":{\"shape\":\"DescribeUserPoolResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserPoolTaggingException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Returns the configuration information and metadata of the specified user pool.</p>\"\n    },\n    \"DescribeUserPoolClient\":{\n      \"name\":\"DescribeUserPoolClient\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeUserPoolClientRequest\"},\n      \"output\":{\"shape\":\"DescribeUserPoolClientResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Client method for returning the configuration information and metadata of the specified user pool client.</p>\"\n    },\n    \"DescribeUserPoolDomain\":{\n      \"name\":\"DescribeUserPoolDomain\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"DescribeUserPoolDomainRequest\"},\n      \"output\":{\"shape\":\"DescribeUserPoolDomainResponse\"},\n      \"errors\":[\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"EnhanceAuth\":{\n      \"name\":\"EnhanceAuth\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"EnhanceAuthRequest\"},\n      \"output\":{\"shape\":\"EnhanceAuthResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Grants the ability to supply a multi-factor authentication (MFA) token for an MFA-enabled user to get the ID, access, and refresh tokens.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"ForgetDevice\":{\n      \"name\":\"ForgetDevice\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ForgetDeviceRequest\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Forgets the specified device.</p>\"\n    },\n    \"ForgotPassword\":{\n      \"name\":\"ForgotPassword\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ForgotPasswordRequest\"},\n      \"output\":{\"shape\":\"ForgotPasswordResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Calling this API causes a message to be sent to the end user with a confirmation code that is required to change the user's password. For the <code>Username</code> parameter, you can use the username or user alias. If a verified phone number exists for the user, the confirmation code is sent to the phone number. Otherwise, if a verified email exists, the confirmation code is sent to the email. If neither a verified phone number nor a verified email exists, <code>InvalidParameterException</code> is thrown. To use the confirmation code for resetting the password, call <a href=\\\"API_ConfirmForgotPassword.html\\\">ConfirmForgotPassword</a>.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"GetAuthenticationDetails\":{\n      \"name\":\"GetAuthenticationDetails\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetAuthenticationDetailsRequest\"},\n      \"output\":{\"shape\":\"GetAuthenticationDetailsResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>First step of the Secure Remote Password protocol (SRP) auth flow to authenticate a user. To learn about the second step, see <a href=\\\"API_Authenticate.html\\\">Authenticate</a>.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"GetCSVHeader\":{\n      \"name\":\"GetCSVHeader\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetCSVHeaderRequest\"},\n      \"output\":{\"shape\":\"GetCSVHeaderResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the header information for the .csv file to be used as input for the user import job.</p>\"\n    },\n    \"GetDevice\":{\n      \"name\":\"GetDevice\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetDeviceRequest\"},\n      \"output\":{\"shape\":\"GetDeviceResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the device.</p>\"\n    },\n    \"GetGroup\":{\n      \"name\":\"GetGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetGroupRequest\"},\n      \"output\":{\"shape\":\"GetGroupResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets a group.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"GetIdentityProviderByIdentifier\":{\n      \"name\":\"GetIdentityProviderByIdentifier\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetIdentityProviderByIdentifierRequest\"},\n      \"output\":{\"shape\":\"GetIdentityProviderByIdentifierResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"GetJWKS\":{\n      \"name\":\"GetJWKS\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetJWKSRequest\"},\n      \"output\":{\"shape\":\"GetJWKSResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the JSON Web keys for the specified user pool.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"GetOpenIdConfiguration\":{\n      \"name\":\"GetOpenIdConfiguration\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetOpenIdConfigurationRequest\"},\n      \"output\":{\"shape\":\"GetOpenIdConfigurationResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the OpenId configuration information for the specified user pool.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"GetSigningCertificate\":{\n      \"name\":\"GetSigningCertificate\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetSigningCertificateRequest\"},\n      \"output\":{\"shape\":\"GetSigningCertificateResponse\"},\n      \"errors\":[\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"ResourceNotFoundException\"}\n      ]\n    },\n    \"GetUICustomization\":{\n      \"name\":\"GetUICustomization\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetUICustomizationRequest\"},\n      \"output\":{\"shape\":\"GetUICustomizationResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"GetUser\":{\n      \"name\":\"GetUser\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetUserRequest\"},\n      \"output\":{\"shape\":\"GetUserResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the user attributes and metadata for a user.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"GetUserAttributeVerificationCode\":{\n      \"name\":\"GetUserAttributeVerificationCode\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetUserAttributeVerificationCodeRequest\"},\n      \"output\":{\"shape\":\"GetUserAttributeVerificationCodeResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Gets the user attribute verification code for the specified attribute name.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"GetUserPoolMfaConfig\":{\n      \"name\":\"GetUserPoolMfaConfig\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetUserPoolMfaConfigRequest\"},\n      \"output\":{\"shape\":\"GetUserPoolMfaConfigResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"GetUserPoolUIConfiguration\":{\n      \"name\":\"GetUserPoolUIConfiguration\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GetUserPoolUIConfigurationRequest\"},\n      \"output\":{\"shape\":\"GetUserPoolUIConfigurationResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"GlobalSignOut\":{\n      \"name\":\"GlobalSignOut\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"GlobalSignOutRequest\"},\n      \"output\":{\"shape\":\"GlobalSignOutResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Signs out users from all devices.</p>\"\n    },\n    \"InitiateAuth\":{\n      \"name\":\"InitiateAuth\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"InitiateAuthRequest\"},\n      \"output\":{\"shape\":\"InitiateAuthResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Initiates the authentication flow.</p>\"\n    },\n    \"ListDevices\":{\n      \"name\":\"ListDevices\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListDevicesRequest\"},\n      \"output\":{\"shape\":\"ListDevicesResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the devices.</p>\"\n    },\n    \"ListGroups\":{\n      \"name\":\"ListGroups\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListGroupsRequest\"},\n      \"output\":{\"shape\":\"ListGroupsResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the groups associated with a user pool.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"ListIdentityProviders\":{\n      \"name\":\"ListIdentityProviders\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListIdentityProvidersRequest\"},\n      \"output\":{\"shape\":\"ListIdentityProvidersResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"ListResourceServers\":{\n      \"name\":\"ListResourceServers\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListResourceServersRequest\"},\n      \"output\":{\"shape\":\"ListResourceServersResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"ListUserImportJobs\":{\n      \"name\":\"ListUserImportJobs\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListUserImportJobsRequest\"},\n      \"output\":{\"shape\":\"ListUserImportJobsResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the user import jobs.</p>\"\n    },\n    \"ListUserPoolClients\":{\n      \"name\":\"ListUserPoolClients\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListUserPoolClientsRequest\"},\n      \"output\":{\"shape\":\"ListUserPoolClientsResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the clients that have been created for the specified user pool.</p>\"\n    },\n    \"ListUserPools\":{\n      \"name\":\"ListUserPools\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListUserPoolsRequest\"},\n      \"output\":{\"shape\":\"ListUserPoolsResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the user pools associated with an AWS account.</p>\"\n    },\n    \"ListUsers\":{\n      \"name\":\"ListUsers\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListUsersRequest\"},\n      \"output\":{\"shape\":\"ListUsersResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the users in the Amazon Cognito user pool.</p>\"\n    },\n    \"ListUsersInGroup\":{\n      \"name\":\"ListUsersInGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ListUsersInGroupRequest\"},\n      \"output\":{\"shape\":\"ListUsersInGroupResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Lists the users in the specified group.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"RefreshTokens\":{\n      \"name\":\"RefreshTokens\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"RefreshTokensRequest\"},\n      \"output\":{\"shape\":\"RefreshTokensResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Refreshes the tokens for the specified client ID.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"ResendConfirmationCode\":{\n      \"name\":\"ResendConfirmationCode\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"ResendConfirmationCodeRequest\"},\n      \"output\":{\"shape\":\"ResendConfirmationCodeResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Resends the confirmation (for confirmation of registration) to a specific user in the user pool.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"RespondToAuthChallenge\":{\n      \"name\":\"RespondToAuthChallenge\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"RespondToAuthChallengeRequest\"},\n      \"output\":{\"shape\":\"RespondToAuthChallengeResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"MFAMethodNotFoundException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"SoftwareTokenMFANotFoundException\"}\n      ],\n      \"documentation\":\"<p>Responds to the authentication challenge.</p>\"\n    },\n    \"SetRiskConfiguration\":{\n      \"name\":\"SetRiskConfiguration\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SetRiskConfigurationRequest\"},\n      \"output\":{\"shape\":\"SetRiskConfigurationResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserPoolAddOnNotEnabledException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"SetUICustomization\":{\n      \"name\":\"SetUICustomization\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SetUICustomizationRequest\"},\n      \"output\":{\"shape\":\"SetUICustomizationResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"SetUserMFAPreference\":{\n      \"name\":\"SetUserMFAPreference\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SetUserMFAPreferenceRequest\"},\n      \"output\":{\"shape\":\"SetUserMFAPreferenceResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"SetUserPoolMfaConfig\":{\n      \"name\":\"SetUserPoolMfaConfig\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SetUserPoolMfaConfigRequest\"},\n      \"output\":{\"shape\":\"SetUserPoolMfaConfigResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"SetUserPoolUIConfiguration\":{\n      \"name\":\"SetUserPoolUIConfiguration\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SetUserPoolUIConfigurationRequest\"},\n      \"output\":{\"shape\":\"SetUserPoolUIConfigurationResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"SetUserSettings\":{\n      \"name\":\"SetUserSettings\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SetUserSettingsRequest\"},\n      \"output\":{\"shape\":\"SetUserSettingsResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Sets the user settings like multi-factor authentication (MFA). If MFA is to be removed for a particular attribute pass the attribute with code delivery as null. If null list is passed, all MFA options are removed.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"SignUp\":{\n      \"name\":\"SignUp\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"SignUpRequest\"},\n      \"output\":{\"shape\":\"SignUpResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidPasswordException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"UsernameExistsException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"}\n      ],\n      \"documentation\":\"<p>Registers the user in the specified user pool and creates a user name, password, and user attributes.</p>\",\n      \"authtype\":\"none\"\n    },\n    \"StartUserImportJob\":{\n      \"name\":\"StartUserImportJob\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"StartUserImportJobRequest\"},\n      \"output\":{\"shape\":\"StartUserImportJobResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"PreconditionNotMetException\"},\n        {\"shape\":\"NotAuthorizedException\"}\n      ],\n      \"documentation\":\"<p>Starts the user import.</p>\"\n    },\n    \"StopUserImportJob\":{\n      \"name\":\"StopUserImportJob\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"StopUserImportJobRequest\"},\n      \"output\":{\"shape\":\"StopUserImportJobResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"PreconditionNotMetException\"},\n        {\"shape\":\"NotAuthorizedException\"}\n      ],\n      \"documentation\":\"<p>Stops the user import job.</p>\"\n    },\n    \"UpdateAuthEventFeedback\":{\n      \"name\":\"UpdateAuthEventFeedback\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateAuthEventFeedbackRequest\"},\n      \"output\":{\"shape\":\"UpdateAuthEventFeedbackResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserPoolAddOnNotEnabledException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"UpdateDeviceStatus\":{\n      \"name\":\"UpdateDeviceStatus\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateDeviceStatusRequest\"},\n      \"output\":{\"shape\":\"UpdateDeviceStatusResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Updates the device status.</p>\"\n    },\n    \"UpdateGroup\":{\n      \"name\":\"UpdateGroup\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateGroupRequest\"},\n      \"output\":{\"shape\":\"UpdateGroupResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Updates the specified group with the specified attributes.</p> <p>Requires developer credentials.</p>\"\n    },\n    \"UpdateIdentityProvider\":{\n      \"name\":\"UpdateIdentityProvider\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateIdentityProviderRequest\"},\n      \"output\":{\"shape\":\"UpdateIdentityProviderResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"UnsupportedIdentityProviderException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"UpdateResourceServer\":{\n      \"name\":\"UpdateResourceServer\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateResourceServerRequest\"},\n      \"output\":{\"shape\":\"UpdateResourceServerResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ]\n    },\n    \"UpdateUserAttributes\":{\n      \"name\":\"UpdateUserAttributes\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateUserAttributesRequest\"},\n      \"output\":{\"shape\":\"UpdateUserAttributesResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UnexpectedLambdaException\"},\n        {\"shape\":\"UserLambdaValidationException\"},\n        {\"shape\":\"InvalidLambdaResponseException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"AliasExistsException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"},\n        {\"shape\":\"CodeDeliveryFailureException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Allows a user to update a specific attribute (one at a time).</p>\",\n      \"authtype\":\"none\"\n    },\n    \"UpdateUserPool\":{\n      \"name\":\"UpdateUserPool\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateUserPoolRequest\"},\n      \"output\":{\"shape\":\"UpdateUserPoolResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ConcurrentModificationException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"UserImportInProgressException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"InvalidSmsRoleAccessPolicyException\"},\n        {\"shape\":\"InvalidSmsRoleTrustRelationshipException\"},\n        {\"shape\":\"UserPoolTaggingException\"},\n        {\"shape\":\"InvalidEmailRoleAccessPolicyException\"}\n      ],\n      \"documentation\":\"<p>Updates the specified user pool with the specified attributes.</p>\"\n    },\n    \"UpdateUserPoolClient\":{\n      \"name\":\"UpdateUserPoolClient\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"UpdateUserPoolClientRequest\"},\n      \"output\":{\"shape\":\"UpdateUserPoolClientResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"ScopeDoesNotExistException\"},\n        {\"shape\":\"InvalidOAuthFlowException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Allows the developer to update the specified user pool client and password policy.</p>\"\n    },\n    \"VerifySoftwareToken\":{\n      \"name\":\"VerifySoftwareToken\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"VerifySoftwareTokenRequest\"},\n      \"output\":{\"shape\":\"VerifySoftwareTokenResponse\"},\n      \"errors\":[\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidUserPoolConfigurationException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"},\n        {\"shape\":\"EnableSoftwareTokenMFAException\"},\n        {\"shape\":\"SoftwareTokenMFANotFoundException\"},\n        {\"shape\":\"CodeMismatchException\"}\n      ]\n    },\n    \"VerifyUserAttribute\":{\n      \"name\":\"VerifyUserAttribute\",\n      \"http\":{\n        \"method\":\"POST\",\n        \"requestUri\":\"/\"\n      },\n      \"input\":{\"shape\":\"VerifyUserAttributeRequest\"},\n      \"output\":{\"shape\":\"VerifyUserAttributeResponse\"},\n      \"errors\":[\n        {\"shape\":\"ResourceNotFoundException\"},\n        {\"shape\":\"InvalidParameterException\"},\n        {\"shape\":\"CodeMismatchException\"},\n        {\"shape\":\"ExpiredCodeException\"},\n        {\"shape\":\"NotAuthorizedException\"},\n        {\"shape\":\"TooManyRequestsException\"},\n        {\"shape\":\"LimitExceededException\"},\n        {\"shape\":\"PasswordResetRequiredException\"},\n        {\"shape\":\"UserNotFoundException\"},\n        {\"shape\":\"UserNotConfirmedException\"},\n        {\"shape\":\"InternalErrorException\"}\n      ],\n      \"documentation\":\"<p>Verifies the specified user attributes in the user pool.</p>\",\n      \"authtype\":\"none\"\n    }\n  },\n  \"shapes\":{\n    \"AValueHexStringType\":{\n      \"type\":\"string\",\n      \"max\":1024,\n      \"min\":1,\n      \"pattern\":\"^[0-9a-fA-F]+$\"\n    },\n    \"AWSAccountIdType\":{\"type\":\"string\"},\n    \"AccountTakeoverActionNotifyType\":{\"type\":\"boolean\"},\n    \"AccountTakeoverActionType\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Notify\",\n        \"EventAction\"\n      ],\n      \"members\":{\n        \"Notify\":{\"shape\":\"AccountTakeoverActionNotifyType\"},\n        \"EventAction\":{\"shape\":\"AccountTakeoverEventActionType\"}\n      }\n    },\n    \"AccountTakeoverActionsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"LowAction\":{\"shape\":\"AccountTakeoverActionType\"},\n        \"MediumAction\":{\"shape\":\"AccountTakeoverActionType\"},\n        \"HighAction\":{\"shape\":\"AccountTakeoverActionType\"}\n      }\n    },\n    \"AccountTakeoverEventActionType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"BLOCK\",\n        \"MFA_IF_CONFIGURED\",\n        \"MFA_REQUIRED\",\n        \"NO_ACTION\"\n      ]\n    },\n    \"AccountTakeoverRiskConfigurationType\":{\n      \"type\":\"structure\",\n      \"required\":[\"Actions\"],\n      \"members\":{\n        \"NotifyConfiguration\":{\"shape\":\"NotifyConfigurationType\"},\n        \"Actions\":{\"shape\":\"AccountTakeoverActionsType\"}\n      }\n    },\n    \"AddCustomAttributesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"CustomAttributes\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to add custom attributes.</p>\"\n        },\n        \"CustomAttributes\":{\n          \"shape\":\"CustomAttributesListType\",\n          \"documentation\":\"<p>An array of custom attributes, such as Mutable and Name.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to add custom attributes.</p>\"\n    },\n    \"AddCustomAttributesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server for the request to add custom attributes.</p>\"\n    },\n    \"AdminAddUserToGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"GroupName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The username for the user.</p>\"\n        },\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The group name.</p>\"\n        }\n      }\n    },\n    \"AdminConfirmSignUpRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for which you want to confirm user registration.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name for which you want to confirm user registration.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to confirm user registration.</p>\"\n    },\n    \"AdminConfirmSignUpResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server for the request to confirm registration.</p>\"\n    },\n    \"AdminCreateUserConfigType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AllowAdminCreateUserOnly\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Set to True if only the administrator is allowed to create user profiles. Set to False if users can sign themselves up via an app.</p>\"\n        },\n        \"UnusedAccountValidityDays\":{\n          \"shape\":\"AdminCreateUserUnusedAccountValidityDaysType\",\n          \"documentation\":\"<p>The user account expiration limit, in days, after which the account is no longer usable. To reset the account after that time limit, you must call AdminCreateUser again, specifying \\\"RESEND\\\" for the MessageAction parameter. The default value for this parameter is 7.</p>\"\n        },\n        \"InviteMessageTemplate\":{\n          \"shape\":\"MessageTemplateType\",\n          \"documentation\":\"<p>The message template to be used for the welcome message to new users.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The type of configuration for creating a new user profile.</p>\"\n    },\n    \"AdminCreateUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where the user will be created.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.</p>\"\n        },\n        \"UserAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>An array of name-value pairs that contain user attributes and attribute values to be set for the user to be created. You can create a user without specifying any attributes other than Username. However, any attributes that you specify as required (in CreateUserPool or in the <b>Attributes</b> tab of the console) must be supplied either by you (in your call to AdminCreateUser) or by the user (when he or she signs up in response to your welcome message).</p> <p>To send a message inviting the user to sign up, you must specify the user's email address or phone number. This can be done in your call to AdminCreateUser or in the <b>Users</b> tab of the Amazon Cognito console for managing your user pools.</p> <p>In your call to AdminCreateUser, you can set the email_verified attribute to True, and you can set the phone_number_verified attribute to True. (You also do this by calling <a href=\\\"API_AdminUpdateUserAttributes.html\\\">AdminUpdateUserAttributes</a>.)</p> <ul> <li> <p> <b>email</b>: The email address of the user to whom the message that contains the code and username will be sent. Required if the email_verified attribute is set to True, or if \\\"EMAIL\\\" is specified in the DesiredDeliveryMediums parameter.</p> </li> <li> <p> <b>phone_number</b>: The phone number of the user to whom the message that contains the code and username will be sent. Required if the phone_number_verified attribute is set to True, or if \\\"SMS\\\" is specified in the DesiredDeliveryMediums parameter.</p> </li> </ul>\"\n        },\n        \"ValidationData\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. For example, you might choose to allow or disallow user sign-up based on the user's domain.</p> <p>To configure custom validation, you must create a Pre Sign-up Lambda trigger for the user pool as described in the Amazon Cognito Developer Guide. The Lambda trigger receives the validation data and uses it in the validation process.</p> <p>The user's validation data is not persisted.</p>\"\n        },\n        \"TemporaryPassword\":{\n          \"shape\":\"PasswordType\",\n          \"documentation\":\"<p>The user's temporary password. This password must conform to the password policy that you specified when you created the user pool.</p> <p>The temporary password is valid only once. To complete the Admin Create User flow, the user must enter the temporary password in the sign-in page along with a new password to be used in all future sign-ins.</p> <p>This parameter is not required. If you do not specify a value, Amazon Cognito generates one for you.</p> <p>The temporary password can only be used until the user account expiration limit that you specified when you created the user pool. To reset the account after that time limit, you must call AdminCreateUser again, specifying \\\"RESEND\\\" for the MessageAction parameter.</p>\"\n        },\n        \"ForceAliasCreation\":{\n          \"shape\":\"ForceAliasCreation\",\n          \"documentation\":\"<p>This parameter is only used if the phone_number_verified or email_verified attribute is set to True. Otherwise, it is ignored.</p> <p>If this parameter is set to True and the phone number or email address specified in the UserAttributes parameter already exists as an alias with a different user, the API call will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias.</p> <p>If this parameter is set to False, the API throws an AliasExistsException error if the alias already exists. The default value is False.</p>\"\n        },\n        \"MessageAction\":{\n          \"shape\":\"MessageActionType\",\n          \"documentation\":\"<p>Set to \\\"RESEND\\\" to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set to \\\"SUPPRESS\\\" to suppress sending the message. Only one value can be specified.</p>\"\n        },\n        \"DesiredDeliveryMediums\":{\n          \"shape\":\"DeliveryMediumListType\",\n          \"documentation\":\"<p>Specify \\\"EMAIL\\\" if email will be used to send the welcome message. Specify \\\"SMS\\\" if the phone number will be used. The default value is \\\"SMS\\\". More than one value can be specified.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to create a user in the specified user pool.</p>\"\n    },\n    \"AdminCreateUserResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"User\":{\n          \"shape\":\"UserType\",\n          \"documentation\":\"<p>The user returned in the request to create a new user.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to create the user.</p>\"\n    },\n    \"AdminCreateUserUnusedAccountValidityDaysType\":{\n      \"type\":\"integer\",\n      \"max\":365,\n      \"min\":0\n    },\n    \"AdminDeleteUserAttributesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"UserAttributeNames\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to delete user attributes.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user from which you would like to delete attributes.</p>\"\n        },\n        \"UserAttributeNames\":{\n          \"shape\":\"AttributeNameListType\",\n          \"documentation\":\"<p>An array of strings representing the user attribute names you wish to delete.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to delete user attributes as an administrator.</p>\"\n    },\n    \"AdminDeleteUserAttributesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response received from the server for a request to delete user attributes.</p>\"\n    },\n    \"AdminDeleteUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to delete the user.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to delete.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to delete a user as an administrator.</p>\"\n    },\n    \"AdminDisableProviderForUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"User\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"StringType\"},\n        \"User\":{\"shape\":\"ProviderUserIdentifierType\"}\n      }\n    },\n    \"AdminDisableProviderForUserResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"AdminDisableUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to disable the user.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to disable.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to disable any user as an administrator.</p>\"\n    },\n    \"AdminDisableUserResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response received from the server to disable the user as an administrator.</p>\"\n    },\n    \"AdminEnableUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to enable the user.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to enable.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request that enables the user as an administrator.</p>\"\n    },\n    \"AdminEnableUserResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server for the request to enable a user as an administrator.</p>\"\n    },\n    \"AdminForgetDeviceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"DeviceKey\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name.</p>\"\n        },\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Sends the forgot device request, as an administrator.</p>\"\n    },\n    \"AdminGetDeviceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"DeviceKey\",\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get the device, as an administrator.</p>\"\n    },\n    \"AdminGetDeviceResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"Device\"],\n      \"members\":{\n        \"Device\":{\n          \"shape\":\"DeviceType\",\n          \"documentation\":\"<p>The device.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Gets the device response, as an administrator.</p>\"\n    },\n    \"AdminGetUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to get information about the user.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to retrieve.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get the specified user as an administrator.</p>\"\n    },\n    \"AdminGetUserResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"Username\"],\n      \"members\":{\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user about whom you are receiving information.</p>\"\n        },\n        \"UserAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>An array of name-value pairs representing user attributes.</p>\"\n        },\n        \"UserCreateDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date the user was created.</p>\"\n        },\n        \"UserLastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date the user was last modified.</p>\"\n        },\n        \"Enabled\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Indicates that the status is enabled.</p>\"\n        },\n        \"UserStatus\":{\n          \"shape\":\"UserStatusType\",\n          \"documentation\":\"<p>The user status. Can be one of the following:</p> <ul> <li> <p>UNCONFIRMED - User has been created but not confirmed.</p> </li> <li> <p>CONFIRMED - User has been confirmed.</p> </li> <li> <p>ARCHIVED - User is no longer active.</p> </li> <li> <p>COMPROMISED - User is disabled due to a potential security threat.</p> </li> <li> <p>UNKNOWN - User status is not known.</p> </li> </ul>\"\n        },\n        \"MFAOptions\":{\n          \"shape\":\"MFAOptionListType\",\n          \"documentation\":\"<p>Specifies the options for MFA (e.g., email or phone number).</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server from the request to get the specified user as an administrator.</p>\"\n    },\n    \"AdminInitiateAuthRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ClientId\",\n        \"AuthFlow\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The ID of the Amazon Cognito user pool.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The app client ID.</p>\"\n        },\n        \"AuthFlow\":{\n          \"shape\":\"AuthFlowType\",\n          \"documentation\":\"<p>The authentication flow for this call to execute. The API action will depend on this value. For example:</p> <ul> <li> <p> <code>REFRESH_TOKEN_AUTH</code> will take in a valid refresh token and return new tokens.</p> </li> <li> <p> <code>USER_SRP_AUTH</code> will take in <code>USERNAME</code> and <code>SRPA</code> and return the SRP variables to be used for next challenge execution.</p> </li> </ul> <p>Valid values include:</p> <ul> <li> <p> <code>USER_SRP_AUTH</code>: Authentication flow for the Secure Remote Password (SRP) protocol.</p> </li> <li> <p> <code>REFRESH_TOKEN_AUTH</code>/<code>REFRESH_TOKEN</code>: Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.</p> </li> <li> <p> <code>CUSTOM_AUTH</code>: Custom authentication flow.</p> </li> <li> <p> <code>ADMIN_NO_SRP_AUTH</code>: Non-SRP authentication flow; you can pass in the USERNAME and PASSWORD directly if the flow is enabled for calling the app client.</p> </li> </ul>\"\n        },\n        \"AuthParameters\":{\n          \"shape\":\"AuthParametersType\",\n          \"documentation\":\"<p>The authentication parameters. These are inputs corresponding to the <code>AuthFlow</code> that you are invoking. The required values depend on the value of <code>AuthFlow</code>:</p> <ul> <li> <p>For <code>USER_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SRPA</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code> </p> </li> <li> <p>For <code>REFRESH_TOKEN_AUTH/REFRESH_TOKEN</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>REFRESH_TOKEN</code> (required), <code>DEVICE_KEY</code> </p> </li> <li> <p>For <code>ADMIN_NO_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>PASSWORD</code> (required), <code>DEVICE_KEY</code> </p> </li> <li> <p>For <code>CUSTOM_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>DEVICE_KEY</code> </p> </li> </ul>\"\n        },\n        \"ClientMetadata\":{\n          \"shape\":\"ClientMetadataType\",\n          \"documentation\":\"<p>This is a random key-value pair map which can contain any key and will be passed to your PreAuthentication Lambda trigger as-is. It can be used to implement additional validations around authentication.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"ContextData\":{\"shape\":\"ContextDataType\"}\n      },\n      \"documentation\":\"<p>Initiates the authorization request, as an administrator.</p>\"\n    },\n    \"AdminInitiateAuthResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ChallengeName\":{\n          \"shape\":\"ChallengeNameType\",\n          \"documentation\":\"<p>The name of the challenge which you are responding to with this call. This is returned to you in the <code>AdminInitiateAuth</code> response if you need to pass another challenge.</p> <ul> <li> <p> <code>SMS_MFA</code>: Next challenge is to supply an <code>SMS_MFA_CODE</code>, delivered via SMS.</p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: Next challenge is to supply <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, and <code>TIMESTAMP</code> after the client-side SRP calculations.</p> </li> <li> <p> <code>CUSTOM_CHALLENGE</code>: This is returned if your custom authentication flow determines that the user should pass another challenge before tokens are issued.</p> </li> <li> <p> <code>DEVICE_SRP_AUTH</code>: If device tracking was enabled on your user pool and the previous challenges were passed, this challenge is returned so that Amazon Cognito can start tracking this device.</p> </li> <li> <p> <code>DEVICE_PASSWORD_VERIFIER</code>: Similar to <code>PASSWORD_VERIFIER</code>, but for devices only.</p> </li> <li> <p> <code>ADMIN_NO_SRP_AUTH</code>: This is returned if you need to authenticate with <code>USERNAME</code> and <code>PASSWORD</code> directly. An app client must be enabled to use this flow.</p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: For users which are required to change their passwords after successful first login. This challenge should be passed with <code>NEW_PASSWORD</code> and any other required attributes.</p> </li> </ul>\"\n        },\n        \"Session\":{\n          \"shape\":\"SessionType\",\n          \"documentation\":\"<p>The session which should be passed both ways in challenge-response calls to the service. If <code>AdminInitiateAuth</code> or <code>AdminRespondToAuthChallenge</code> API call determines that the caller needs to go through another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next <code>AdminRespondToAuthChallenge</code> API call.</p>\"\n        },\n        \"ChallengeParameters\":{\n          \"shape\":\"ChallengeParametersType\",\n          \"documentation\":\"<p>The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you need to pass another challenge. The responses in this parameter should be used to compute inputs to the next call (<code>AdminRespondToAuthChallenge</code>). </p> <p>All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable).</p> <p>The value of the <code>USER_IF_FOR_SRP</code> attribute will be the user's actual username, not an alias (such as email address or phone number), even if you specified an alias in your call to <code>AdminInitiateAuth</code>. This is because, in the <code>AdminRespondToAuthChallenge</code> API <code>ChallengeResponses</code>, the <code>USERNAME</code> attribute cannot be an alias.</p>\"\n        },\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The result of the authentication response. This is only returned if the caller does not need to pass another challenge. If the caller does need to pass another challenge before it gets tokens, <code>ChallengeName</code>, <code>ChallengeParameters</code>, and <code>Session</code> are returned.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Initiates the authentication response, as an administrator.</p>\"\n    },\n    \"AdminLinkProviderForUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"DestinationUser\",\n        \"SourceUser\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"StringType\"},\n        \"DestinationUser\":{\"shape\":\"ProviderUserIdentifierType\"},\n        \"SourceUser\":{\"shape\":\"ProviderUserIdentifierType\"}\n      }\n    },\n    \"AdminLinkProviderForUserResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"AdminListDevicesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name.</p>\"\n        },\n        \"Limit\":{\n          \"shape\":\"QueryLimitType\",\n          \"documentation\":\"<p>The limit of the devices request.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"SearchPaginationTokenType\",\n          \"documentation\":\"<p>The pagination token.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to list devices, as an administrator.</p>\"\n    },\n    \"AdminListDevicesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Devices\":{\n          \"shape\":\"DeviceListType\",\n          \"documentation\":\"<p>The devices in the list of devices response.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"SearchPaginationTokenType\",\n          \"documentation\":\"<p>The pagination token.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Lists the device's response, as an administrator.</p>\"\n    },\n    \"AdminListGroupsForUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Username\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The username for the user.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Limit\":{\n          \"shape\":\"QueryLimitType\",\n          \"documentation\":\"<p>The limit of the request to list groups.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      }\n    },\n    \"AdminListGroupsForUserResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Groups\":{\n          \"shape\":\"GroupListType\",\n          \"documentation\":\"<p>The groups that the user belongs to.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      }\n    },\n    \"AdminListUserAuthEventsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Username\":{\"shape\":\"UsernameType\"},\n        \"MaxResults\":{\"shape\":\"QueryLimitType\"},\n        \"NextToken\":{\"shape\":\"PaginationKey\"}\n      }\n    },\n    \"AdminListUserAuthEventsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AuthEvents\":{\"shape\":\"AuthEventsType\"},\n        \"NextToken\":{\"shape\":\"PaginationKey\"}\n      }\n    },\n    \"AdminRemoveUserFromGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"GroupName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The username for the user.</p>\"\n        },\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The group name.</p>\"\n        }\n      }\n    },\n    \"AdminResetUserPasswordRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to reset the user's password.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user whose password you wish to reset.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to reset a user's password as an administrator.</p>\"\n    },\n    \"AdminResetUserPasswordResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server to reset a user password as an administrator.</p>\"\n    },\n    \"AdminRespondToAuthChallengeRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ClientId\",\n        \"ChallengeName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The ID of the Amazon Cognito user pool.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The app client ID.</p>\"\n        },\n        \"ChallengeName\":{\n          \"shape\":\"ChallengeNameType\",\n          \"documentation\":\"<p>The challenge name. For more information, see <a href=\\\"API_AdminInitiateAuth.html\\\">AdminInitiateAuth</a>.</p>\"\n        },\n        \"ChallengeResponses\":{\n          \"shape\":\"ChallengeResponsesType\",\n          \"documentation\":\"<p>The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example:</p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret).</p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret).</p> </li> <li> <p> <code>ADMIN_NO_SRP_AUTH</code>: <code>PASSWORD</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> </ul> <p>The value of the <code>USERNAME</code> attribute must be the user's actual username, not an alias (such as email address or phone number). To make this easier, the <code>AdminInitiateAuth</code> response includes the actual username value in the <code>USERNAMEUSER_ID_FOR_SRP</code> attribute, even if you specified an alias in your call to <code>AdminInitiateAuth</code>.</p>\"\n        },\n        \"Session\":{\n          \"shape\":\"SessionType\",\n          \"documentation\":\"<p>The session which should be passed both ways in challenge-response calls to the service. If <code>InitiateAuth</code> or <code>RespondToAuthChallenge</code> API call determines that the caller needs to go through another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next <code>RespondToAuthChallenge</code> API call.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"ContextData\":{\"shape\":\"ContextDataType\"}\n      },\n      \"documentation\":\"<p>The request to respond to the authentication challenge, as an administrator.</p>\"\n    },\n    \"AdminRespondToAuthChallengeResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ChallengeName\":{\n          \"shape\":\"ChallengeNameType\",\n          \"documentation\":\"<p>The name of the challenge. For more information, see <a href=\\\"API_AdminInitiateAuth.html\\\">AdminInitiateAuth</a>.</p>\"\n        },\n        \"Session\":{\n          \"shape\":\"SessionType\",\n          \"documentation\":\"<p>The session which should be passed both ways in challenge-response calls to the service. If <code>InitiateAuth</code> or <code>RespondToAuthChallenge</code> API call determines that the caller needs to go through another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next <code>RespondToAuthChallenge</code> API call.</p>\"\n        },\n        \"ChallengeParameters\":{\n          \"shape\":\"ChallengeParametersType\",\n          \"documentation\":\"<p>The challenge parameters. For more information, see <a href=\\\"API_AdminInitiateAuth.html\\\">AdminInitiateAuth</a>.</p>\"\n        },\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The result returned by the server in response to the authentication request.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Responds to the authentication challenge, as an administrator.</p>\"\n    },\n    \"AdminSetUserMFAPreferenceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Username\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"SMSMfaSettings\":{\"shape\":\"SMSMfaSettingsType\"},\n        \"SoftwareTokenMfaSettings\":{\"shape\":\"SoftwareTokenMfaSettingsType\"},\n        \"Username\":{\"shape\":\"UsernameType\"},\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"}\n      }\n    },\n    \"AdminSetUserMFAPreferenceResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"AdminSetUserSettingsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"MFAOptions\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to set the user's settings, such as MFA options.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user for whom you wish to set user settings.</p>\"\n        },\n        \"MFAOptions\":{\n          \"shape\":\"MFAOptionListType\",\n          \"documentation\":\"<p>Specifies the options for MFA (e.g., email or phone number).</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to set user settings as an administrator.</p>\"\n    },\n    \"AdminSetUserSettingsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server to set user settings as an administrator.</p>\"\n    },\n    \"AdminUpdateAuthEventFeedbackRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"EventId\",\n        \"FeedbackValue\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Username\":{\"shape\":\"UsernameType\"},\n        \"EventId\":{\"shape\":\"EventIdType\"},\n        \"FeedbackValue\":{\"shape\":\"FeedbackValueType\"}\n      }\n    },\n    \"AdminUpdateAuthEventFeedbackResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"AdminUpdateDeviceStatusRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"DeviceKey\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID&gt;</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name.</p>\"\n        },\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"DeviceRememberedStatus\":{\n          \"shape\":\"DeviceRememberedStatusType\",\n          \"documentation\":\"<p>The status indicating whether a device has been remembered or not.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The request to update the device status, as an administrator.</p>\"\n    },\n    \"AdminUpdateDeviceStatusResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The status response from the request to update the device, as an administrator.</p>\"\n    },\n    \"AdminUpdateUserAttributesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"UserAttributes\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to update user attributes.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user for whom you want to update user attributes.</p>\"\n        },\n        \"UserAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>An array of name-value pairs representing user attributes.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to update the user's attributes as an administrator.</p>\"\n    },\n    \"AdminUpdateUserAttributesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server for the request to update user attributes as an administrator.</p>\"\n    },\n    \"AdminUserGlobalSignOutRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The request to sign out of all devices, as an administrator.</p>\"\n    },\n    \"AdminUserGlobalSignOutResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The global sign-out response, as an administrator.</p>\"\n    },\n    \"AdvancedSecurityModeType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"OFF\",\n        \"AUDIT\",\n        \"ENFORCED\"\n      ]\n    },\n    \"AliasAttributeType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"phone_number\",\n        \"email\",\n        \"preferred_username\"\n      ]\n    },\n    \"AliasAttributesListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"AliasAttributeType\"}\n    },\n    \"AliasExistsException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message sent to the user when an alias exists.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a user tries to confirm the account with an email or phone number that has already been supplied as an alias from a different account. This exception tells user that an account with this email or phone already exists.</p>\",\n      \"exception\":true\n    },\n    \"AnalyticsConfigurationType\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ApplicationId\",\n        \"RoleArn\",\n        \"ExternalId\"\n      ],\n      \"members\":{\n        \"ApplicationId\":{\"shape\":\"HexStringType\"},\n        \"RoleArn\":{\"shape\":\"ArnType\"},\n        \"ExternalId\":{\"shape\":\"StringType\"},\n        \"UserDataShared\":{\"shape\":\"BooleanType\"}\n      }\n    },\n    \"AnalyticsMetadataType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AnalyticsEndpointId\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"ArnType\":{\n      \"type\":\"string\",\n      \"max\":2048,\n      \"min\":20,\n      \"pattern\":\"arn:[\\\\w+=/,.@-]+:[\\\\w+=/,.@-]+:([\\\\w+=/,.@-]*)?:[0-9]+:[\\\\w+=/,.@-]+(:[\\\\w+=/,.@-]+)?(:[\\\\w+=/,.@-]+)?\"\n    },\n    \"AssociateSoftwareTokenRequest\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AccessToken\":{\"shape\":\"TokenModelType\"},\n        \"Session\":{\"shape\":\"SessionType\"}\n      }\n    },\n    \"AssociateSoftwareTokenResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SecretCode\":{\"shape\":\"SecretCodeType\"},\n        \"Session\":{\"shape\":\"SessionType\"}\n      }\n    },\n    \"AttributeDataType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"String\",\n        \"Number\",\n        \"DateTime\",\n        \"Boolean\"\n      ]\n    },\n    \"AttributeListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"AttributeType\"}\n    },\n    \"AttributeMappingKeyType\":{\n      \"type\":\"string\",\n      \"max\":32,\n      \"min\":1\n    },\n    \"AttributeMappingType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"AttributeMappingKeyType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"AttributeNameListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"AttributeNameType\"}\n    },\n    \"AttributeNameType\":{\n      \"type\":\"string\",\n      \"max\":32,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\"\n    },\n    \"AttributeType\":{\n      \"type\":\"structure\",\n      \"required\":[\"Name\"],\n      \"members\":{\n        \"Name\":{\n          \"shape\":\"AttributeNameType\",\n          \"documentation\":\"<p>The name of the attribute.</p>\"\n        },\n        \"Value\":{\n          \"shape\":\"AttributeValueType\",\n          \"documentation\":\"<p>The value of the attribute.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Specifies whether the attribute is standard or custom.</p>\"\n    },\n    \"AttributeValueType\":{\n      \"type\":\"string\",\n      \"max\":2048,\n      \"sensitive\":true\n    },\n    \"AuthEventType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"EventId\":{\"shape\":\"StringType\"},\n        \"EventType\":{\"shape\":\"EventType\"},\n        \"CreationDate\":{\"shape\":\"DateType\"},\n        \"EventResponse\":{\"shape\":\"EventResponseType\"},\n        \"EventRisk\":{\"shape\":\"EventRiskType\"},\n        \"ChallengeResponses\":{\"shape\":\"ChallengeResponseListType\"},\n        \"EventContextData\":{\"shape\":\"EventContextDataType\"},\n        \"EventFeedback\":{\"shape\":\"EventFeedbackType\"}\n      }\n    },\n    \"AuthEventsType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"AuthEventType\"}\n    },\n    \"AuthFlowType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"USER_SRP_AUTH\",\n        \"REFRESH_TOKEN_AUTH\",\n        \"REFRESH_TOKEN\",\n        \"CUSTOM_AUTH\",\n        \"ADMIN_NO_SRP_AUTH\"\n      ]\n    },\n    \"AuthParametersType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"AuthStateType\":{\n      \"type\":\"string\",\n      \"pattern\":\"[A-Za-z0-9-_+/=]+\",\n      \"sensitive\":true\n    },\n    \"AuthenticateRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\",\n        \"PasswordClaim\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to authenticate.</p>\"\n        },\n        \"PasswordClaim\":{\n          \"shape\":\"PasswordClaimType\",\n          \"documentation\":\"<p>The password claim of the authentication request.</p>\"\n        },\n        \"Timestamp\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The timestamp of the authentication request.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"}\n      },\n      \"documentation\":\"<p>Represents the request to authenticate.</p>\"\n    },\n    \"AuthenticateResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The result of the authentication response.</p>\"\n        },\n        \"AuthState\":{\n          \"shape\":\"AuthStateType\",\n          \"documentation\":\"<p>The authorization state of the authentication response.</p>\"\n        },\n        \"CodeDeliveryDetails\":{\n          \"shape\":\"CodeDeliveryDetailsType\",\n          \"documentation\":\"<p>The code delivery details returned by the server in the response to the authentication request.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the authentication response.</p>\"\n    },\n    \"AuthenticationResultType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token of the authentication result.</p>\"\n        },\n        \"ExpiresIn\":{\n          \"shape\":\"IntegerType\",\n          \"documentation\":\"<p>The expiration period of the authentication result.</p>\"\n        },\n        \"TokenType\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The token type of the authentication result.</p>\"\n        },\n        \"RefreshToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The refresh token of the authentication result.</p>\"\n        },\n        \"IdToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The ID token of the authentication result.</p>\"\n        },\n        \"NewDeviceMetadata\":{\n          \"shape\":\"NewDeviceMetadataType\",\n          \"documentation\":\"<p>The new device metadata from an authentication result.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The result type of the authentication result.</p>\"\n    },\n    \"BlobType\":{\"type\":\"blob\"},\n    \"BlockedIPRangeListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"StringType\"},\n      \"max\":20\n    },\n    \"BooleanType\":{\"type\":\"boolean\"},\n    \"BotActionType\":{\n      \"type\":\"structure\",\n      \"required\":[\"EventAction\"],\n      \"members\":{\n        \"EventAction\":{\"shape\":\"BotEventActionType\"}\n      }\n    },\n    \"BotActionsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"LowAction\":{\"shape\":\"BotActionType\"},\n        \"MediumAction\":{\"shape\":\"BotActionType\"},\n        \"HighAction\":{\"shape\":\"BotActionType\"}\n      }\n    },\n    \"BotEventActionType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"BLOCK\",\n        \"NO_ACTION\"\n      ]\n    },\n    \"BotRiskConfigurationType\":{\n      \"type\":\"structure\",\n      \"required\":[\"Actions\"],\n      \"members\":{\n        \"EventFilter\":{\"shape\":\"EventFiltersType\"},\n        \"Actions\":{\"shape\":\"BotActionsType\"}\n      }\n    },\n    \"CSSType\":{\"type\":\"string\"},\n    \"CSSVersionType\":{\"type\":\"string\"},\n    \"CallbackURLsListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"RedirectUrlType\"},\n      \"max\":100,\n      \"min\":0\n    },\n    \"ChallengeName\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Password\",\n        \"Mfa\"\n      ]\n    },\n    \"ChallengeNameType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"SMS_MFA\",\n        \"SOFTWARE_TOKEN_MFA\",\n        \"SELECT_MFA_TYPE\",\n        \"MFA_SETUP\",\n        \"PASSWORD_VERIFIER\",\n        \"CUSTOM_CHALLENGE\",\n        \"DEVICE_SRP_AUTH\",\n        \"DEVICE_PASSWORD_VERIFIER\",\n        \"ADMIN_NO_SRP_AUTH\",\n        \"NEW_PASSWORD_REQUIRED\"\n      ]\n    },\n    \"ChallengeParametersType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"ChallengeResponse\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Success\",\n        \"Failure\"\n      ]\n    },\n    \"ChallengeResponseListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ChallengeResponseType\"}\n    },\n    \"ChallengeResponseType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ChallengeName\":{\"shape\":\"ChallengeName\"},\n        \"ChallengeResponse\":{\"shape\":\"ChallengeResponse\"}\n      }\n    },\n    \"ChallengeResponsesType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"ChangePasswordRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"PreviousPassword\",\n        \"ProposedPassword\",\n        \"AccessToken\"\n      ],\n      \"members\":{\n        \"PreviousPassword\":{\n          \"shape\":\"PasswordType\",\n          \"documentation\":\"<p>The old password in the change password request.</p>\"\n        },\n        \"ProposedPassword\":{\n          \"shape\":\"PasswordType\",\n          \"documentation\":\"<p>The new password in the change password request.</p>\"\n        },\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token in the change password request.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to change a user password.</p>\"\n    },\n    \"ChangePasswordResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The response from the server to the change password request.</p>\"\n    },\n    \"ClientIdType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\w+]+\",\n      \"sensitive\":true\n    },\n    \"ClientMetadataType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"ClientNameType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\w\\\\s+=,.@-]+\"\n    },\n    \"ClientPermissionListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ClientPermissionType\"}\n    },\n    \"ClientPermissionType\":{\n      \"type\":\"string\",\n      \"max\":2048,\n      \"min\":1\n    },\n    \"ClientSecretType\":{\n      \"type\":\"string\",\n      \"max\":64,\n      \"min\":1,\n      \"pattern\":\"[\\\\w+]+\",\n      \"sensitive\":true\n    },\n    \"CodeDeliveryDetailsListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"CodeDeliveryDetailsType\"}\n    },\n    \"CodeDeliveryDetailsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Destination\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The destination for the code delivery details.</p>\"\n        },\n        \"DeliveryMedium\":{\n          \"shape\":\"DeliveryMediumType\",\n          \"documentation\":\"<p>The delivery medium (email message or phone number).</p>\"\n        },\n        \"AttributeName\":{\n          \"shape\":\"AttributeNameType\",\n          \"documentation\":\"<p>The name of the attribute in the code delivery details type.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The type of code delivery details being returned from the server.</p>\"\n    },\n    \"CodeDeliveryFailureException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message sent when a verification code fails to deliver successfully.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a verification code fails to deliver successfully.</p>\",\n      \"exception\":true\n    },\n    \"CodeMismatchException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message provided when the code mismatch exception is thrown.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown if the provided code does not match what the server was expecting.</p>\",\n      \"exception\":true\n    },\n    \"CompletionMessageType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\w]+\"\n    },\n    \"CompromisedCredentialsActionsType\":{\n      \"type\":\"structure\",\n      \"required\":[\"EventAction\"],\n      \"members\":{\n        \"EventAction\":{\"shape\":\"CompromisedCredentialsEventActionType\"}\n      }\n    },\n    \"CompromisedCredentialsEventActionType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"BLOCK\",\n        \"NO_ACTION\"\n      ]\n    },\n    \"CompromisedCredentialsRiskConfigurationType\":{\n      \"type\":\"structure\",\n      \"required\":[\"Actions\"],\n      \"members\":{\n        \"EventFilter\":{\"shape\":\"EventFiltersType\"},\n        \"Actions\":{\"shape\":\"CompromisedCredentialsActionsType\"}\n      }\n    },\n    \"ConcurrentModificationException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message provided when the concurrent exception is thrown.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown if two or more modifications are happening concurrently.</p>\",\n      \"exception\":true\n    },\n    \"ConfirmDeviceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"AccessToken\",\n        \"DeviceKey\"\n      ],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token.</p>\"\n        },\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"DeviceSecretVerifierConfig\":{\n          \"shape\":\"DeviceSecretVerifierConfigType\",\n          \"documentation\":\"<p>The configuration of the device secret verifier.</p>\"\n        },\n        \"DeviceName\":{\n          \"shape\":\"DeviceNameType\",\n          \"documentation\":\"<p>The device name.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Confirms the device request.</p>\"\n    },\n    \"ConfirmDeviceResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserConfirmationNecessary\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Indicates whether the user confirmation is necessary to confirm the device response.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Confirms the device response.</p>\"\n    },\n    \"ConfirmForgotPasswordRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\",\n        \"ConfirmationCode\",\n        \"Password\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user for whom you want to enter a code to retrieve a forgotten password.</p>\"\n        },\n        \"ConfirmationCode\":{\n          \"shape\":\"ConfirmationCodeType\",\n          \"documentation\":\"<p>The confirmation code sent by a user's request to retrieve a forgotten password. For more information, see <a href=\\\"API_ForgotPassword.html\\\">ForgotPassword</a> </p>\"\n        },\n        \"Password\":{\n          \"shape\":\"PasswordType\",\n          \"documentation\":\"<p>The password sent by a user's request to retrieve a forgotten password.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"}\n      },\n      \"documentation\":\"<p>The request representing the confirmation for a password reset.</p>\"\n    },\n    \"ConfirmForgotPasswordResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The response from the server that results from a user's request to retrieve a forgotten password.</p>\"\n    },\n    \"ConfirmSignUpRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\",\n        \"ConfirmationCode\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user whose registration you wish to confirm.</p>\"\n        },\n        \"ConfirmationCode\":{\n          \"shape\":\"ConfirmationCodeType\",\n          \"documentation\":\"<p>The confirmation code sent by a user's request to confirm registration.</p>\"\n        },\n        \"ForceAliasCreation\":{\n          \"shape\":\"ForceAliasCreation\",\n          \"documentation\":\"<p>Boolean to be specified to force user confirmation irrespective of existing alias. By default set to False. If this parameter is set to True and the phone number/email used for sign up confirmation already exists as an alias with a different user, the API call will migrate the alias from the previous user to the newly created user being confirmed. If set to False, the API will throw an <b>AliasExistsException</b> error.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"}\n      },\n      \"documentation\":\"<p>Represents the request to confirm registration of a user.</p>\"\n    },\n    \"ConfirmSignUpResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server for the registration confirmation.</p>\"\n    },\n    \"ConfirmationCodeType\":{\n      \"type\":\"string\",\n      \"max\":2048,\n      \"min\":1,\n      \"pattern\":\"[\\\\S]+\"\n    },\n    \"ContextDataType\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"IpAddress\",\n        \"ServerName\",\n        \"ServerPath\",\n        \"HttpHeaders\",\n        \"EncodedData\"\n      ],\n      \"members\":{\n        \"IpAddress\":{\"shape\":\"StringType\"},\n        \"ServerName\":{\"shape\":\"StringType\"},\n        \"ServerPath\":{\"shape\":\"StringType\"},\n        \"HttpHeaders\":{\"shape\":\"HttpHeaderList\"},\n        \"EncodedData\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"CreateGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"GroupName\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The name of the group. Must be unique.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Description\":{\n          \"shape\":\"DescriptionType\",\n          \"documentation\":\"<p>A string containing the description of the group.</p>\"\n        },\n        \"RoleArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The role ARN for the group.</p>\"\n        },\n        \"Precedence\":{\n          \"shape\":\"PrecedenceType\",\n          \"documentation\":\"<p>A nonnegative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower <code>Precedence</code> values take precedence over groups with higher or null <code>Precedence</code> values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN will be used in the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims in the user's tokens.</p> <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim is not set in users' tokens.</p> <p>The default <code>Precedence</code> value is null.</p>\"\n        }\n      }\n    },\n    \"CreateGroupResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Group\":{\n          \"shape\":\"GroupType\",\n          \"documentation\":\"<p>The group object for the group.</p>\"\n        }\n      }\n    },\n    \"CreateIdentityProviderRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ProviderName\",\n        \"ProviderType\",\n        \"ProviderDetails\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ProviderName\":{\"shape\":\"ProviderNameTypeV1\"},\n        \"ProviderType\":{\"shape\":\"IdentityProviderTypeType\"},\n        \"ProviderDetails\":{\"shape\":\"ProviderDetailsType\"},\n        \"AttributeMapping\":{\"shape\":\"AttributeMappingType\"},\n        \"IdpIdentifiers\":{\"shape\":\"IdpIdentifiersListType\"}\n      }\n    },\n    \"CreateIdentityProviderResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"IdentityProvider\"],\n      \"members\":{\n        \"IdentityProvider\":{\"shape\":\"IdentityProviderType\"}\n      }\n    },\n    \"CreateResourceServerRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Identifier\",\n        \"Name\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Identifier\":{\"shape\":\"ResourceServerIdentifierType\"},\n        \"Name\":{\"shape\":\"ResourceServerNameType\"},\n        \"Scopes\":{\"shape\":\"ResourceServerScopeListType\"}\n      }\n    },\n    \"CreateResourceServerResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"ResourceServer\"],\n      \"members\":{\n        \"ResourceServer\":{\"shape\":\"ResourceServerType\"}\n      }\n    },\n    \"CreateUserImportJobRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"JobName\",\n        \"UserPoolId\",\n        \"CloudWatchLogsRoleArn\"\n      ],\n      \"members\":{\n        \"JobName\":{\n          \"shape\":\"UserImportJobNameType\",\n          \"documentation\":\"<p>The job name for the user import job.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are being imported into.</p>\"\n        },\n        \"CloudWatchLogsRoleArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The role ARN for the Amazon CloudWatch Logging role for the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to create the user import job.</p>\"\n    },\n    \"CreateUserImportJobResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserImportJob\":{\n          \"shape\":\"UserImportJobType\",\n          \"documentation\":\"<p>The job object that represents the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to create the user import job.</p>\"\n    },\n    \"CreateUserPoolClientRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ClientName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to create a user pool client.</p>\"\n        },\n        \"ClientName\":{\n          \"shape\":\"ClientNameType\",\n          \"documentation\":\"<p>The client name for the user pool client you would like to create.</p>\"\n        },\n        \"GenerateSecret\":{\n          \"shape\":\"GenerateSecret\",\n          \"documentation\":\"<p>Boolean to specify whether you want to generate a secret for the user pool client being created.</p>\"\n        },\n        \"RefreshTokenValidity\":{\n          \"shape\":\"RefreshTokenValidityType\",\n          \"documentation\":\"<p>The time limit, in days, after which the refresh token is no longer valid and cannot be used.</p>\"\n        },\n        \"ReadAttributes\":{\n          \"shape\":\"ClientPermissionListType\",\n          \"documentation\":\"<p>The read attributes.</p>\"\n        },\n        \"WriteAttributes\":{\n          \"shape\":\"ClientPermissionListType\",\n          \"documentation\":\"<p>The write attributes.</p>\"\n        },\n        \"ExplicitAuthFlows\":{\n          \"shape\":\"ExplicitAuthFlowsListType\",\n          \"documentation\":\"<p>The explicit authentication flows.</p>\"\n        },\n        \"SupportedIdentityProviders\":{\"shape\":\"SupportedIdentityProvidersListType\"},\n        \"CallbackURLs\":{\"shape\":\"CallbackURLsListType\"},\n        \"LogoutURLs\":{\"shape\":\"LogoutURLsListType\"},\n        \"DefaultRedirectURI\":{\"shape\":\"RedirectUrlType\"},\n        \"AllowedOAuthFlows\":{\"shape\":\"OAuthFlowsType\"},\n        \"AllowedOAuthScopes\":{\"shape\":\"ScopeListType\"},\n        \"AllowedOAuthFlowsUserPoolClient\":{\"shape\":\"BooleanType\"},\n        \"AnalyticsConfiguration\":{\"shape\":\"AnalyticsConfigurationType\"}\n      },\n      \"documentation\":\"<p>Represents the request to create a user pool client.</p>\"\n    },\n    \"CreateUserPoolClientResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolClient\":{\n          \"shape\":\"UserPoolClientType\",\n          \"documentation\":\"<p>The user pool client that was just created.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to create a user pool client.</p>\"\n    },\n    \"CreateUserPoolDomainRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Domain\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"Domain\":{\"shape\":\"DomainType\"},\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"}\n      }\n    },\n    \"CreateUserPoolDomainResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"CreateUserPoolRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"PoolName\"],\n      \"members\":{\n        \"PoolName\":{\n          \"shape\":\"UserPoolNameType\",\n          \"documentation\":\"<p>A string used to name the user pool.</p>\"\n        },\n        \"Policies\":{\n          \"shape\":\"UserPoolPolicyType\",\n          \"documentation\":\"<p>The policies associated with the new user pool.</p>\"\n        },\n        \"LambdaConfig\":{\n          \"shape\":\"LambdaConfigType\",\n          \"documentation\":\"<p>The Lambda trigger configuration information for the new user pool.</p>\"\n        },\n        \"AutoVerifiedAttributes\":{\n          \"shape\":\"VerifiedAttributesListType\",\n          \"documentation\":\"<p>The attributes to be auto-verified. Possible values: <b>email</b>, <b>phone_number</b>.</p>\"\n        },\n        \"AliasAttributes\":{\n          \"shape\":\"AliasAttributesListType\",\n          \"documentation\":\"<p>Attributes supported as an alias for this user pool. Possible values: <b>phone_number</b>, <b>email</b>, or <b>preferred_username</b>.</p>\"\n        },\n        \"UsernameAttributes\":{\"shape\":\"UsernameAttributesListType\"},\n        \"SmsVerificationMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>A string representing the SMS verification message.</p>\"\n        },\n        \"EmailVerificationMessage\":{\n          \"shape\":\"EmailVerificationMessageType\",\n          \"documentation\":\"<p>A string representing the email verification message.</p>\"\n        },\n        \"EmailVerificationSubject\":{\n          \"shape\":\"EmailVerificationSubjectType\",\n          \"documentation\":\"<p>A string representing the email verification subject.</p>\"\n        },\n        \"VerificationMessageTemplate\":{\"shape\":\"VerificationMessageTemplateType\"},\n        \"SmsAuthenticationMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>A string representing the SMS authentication message.</p>\"\n        },\n        \"MfaConfiguration\":{\n          \"shape\":\"UserPoolMfaType\",\n          \"documentation\":\"<p>Specifies MFA configuration details.</p>\"\n        },\n        \"DeviceConfiguration\":{\n          \"shape\":\"DeviceConfigurationType\",\n          \"documentation\":\"<p>The device configuration.</p>\"\n        },\n        \"EmailConfiguration\":{\n          \"shape\":\"EmailConfigurationType\",\n          \"documentation\":\"<p>The email configuration.</p>\"\n        },\n        \"SmsConfiguration\":{\n          \"shape\":\"SmsConfigurationType\",\n          \"documentation\":\"<p>The SMS configuration.</p>\"\n        },\n        \"UserPoolTags\":{\n          \"shape\":\"UserPoolTagsType\",\n          \"documentation\":\"<p>The cost allocation tags for the user pool. For more information, see <a href=\\\"http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-cost-allocation-tagging.html\\\">Adding Cost Allocation Tags to Your User Pool</a> </p>\"\n        },\n        \"AdminCreateUserConfig\":{\n          \"shape\":\"AdminCreateUserConfigType\",\n          \"documentation\":\"<p>The configuration for AdminCreateUser requests.</p>\"\n        },\n        \"Schema\":{\n          \"shape\":\"SchemaAttributesListType\",\n          \"documentation\":\"<p>An array of schema attributes for the new user pool. These attributes can be standard or custom attributes.</p>\"\n        },\n        \"UserPoolAddOns\":{\"shape\":\"UserPoolAddOnsType\"}\n      },\n      \"documentation\":\"<p>Represents the request to create a user pool.</p>\"\n    },\n    \"CreateUserPoolResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPool\":{\n          \"shape\":\"UserPoolType\",\n          \"documentation\":\"<p>A container for the user pool details.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server for the request to create a user pool.</p>\"\n    },\n    \"CustomAttributeNameType\":{\n      \"type\":\"string\",\n      \"max\":20,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\"\n    },\n    \"CustomAttributesListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"SchemaAttributeType\"},\n      \"max\":25,\n      \"min\":1\n    },\n    \"DateType\":{\"type\":\"timestamp\"},\n    \"DefaultEmailOptionType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"CONFIRM_WITH_LINK\",\n        \"CONFIRM_WITH_CODE\"\n      ]\n    },\n    \"DeleteGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"GroupName\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The name of the group.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        }\n      }\n    },\n    \"DeleteIdentityProviderRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ProviderName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ProviderName\":{\"shape\":\"ProviderNameType\"}\n      }\n    },\n    \"DeleteResourceServerRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Identifier\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Identifier\":{\"shape\":\"ResourceServerIdentifierType\"}\n      }\n    },\n    \"DeleteUserAttributesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserAttributeNames\",\n        \"AccessToken\"\n      ],\n      \"members\":{\n        \"UserAttributeNames\":{\n          \"shape\":\"AttributeNameListType\",\n          \"documentation\":\"<p>An array of strings representing the user attribute names you wish to delete.</p>\"\n        },\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token used in the request to delete user attributes.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to delete user attributes.</p>\"\n    },\n    \"DeleteUserAttributesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server to delete user attributes.</p>\"\n    },\n    \"DeleteUserPoolClientRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ClientId\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to delete the client.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to delete a user pool client.</p>\"\n    },\n    \"DeleteUserPoolDomainRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Domain\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"Domain\":{\"shape\":\"DomainType\"},\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"}\n      }\n    },\n    \"DeleteUserPoolDomainResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"DeleteUserPoolRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool you want to delete.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to delete a user pool.</p>\"\n    },\n    \"DeleteUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"AccessToken\"],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token from a request to delete a user.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to delete a user.</p>\"\n    },\n    \"DeliveryMediumListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"DeliveryMediumType\"}\n    },\n    \"DeliveryMediumType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"SMS\",\n        \"EMAIL\"\n      ]\n    },\n    \"DescribeIdentityProviderRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ProviderName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ProviderName\":{\"shape\":\"ProviderNameType\"}\n      }\n    },\n    \"DescribeIdentityProviderResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"IdentityProvider\"],\n      \"members\":{\n        \"IdentityProvider\":{\"shape\":\"IdentityProviderType\"}\n      }\n    },\n    \"DescribeResourceServerRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Identifier\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Identifier\":{\"shape\":\"ResourceServerIdentifierType\"}\n      }\n    },\n    \"DescribeResourceServerResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"ResourceServer\"],\n      \"members\":{\n        \"ResourceServer\":{\"shape\":\"ResourceServerType\"}\n      }\n    },\n    \"DescribeRiskConfigurationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ClientId\":{\"shape\":\"ClientIdType\"}\n      }\n    },\n    \"DescribeRiskConfigurationResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"RiskConfiguration\"],\n      \"members\":{\n        \"RiskConfiguration\":{\"shape\":\"RiskConfigurationType\"}\n      }\n    },\n    \"DescribeUserImportJobRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"JobId\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are being imported into.</p>\"\n        },\n        \"JobId\":{\n          \"shape\":\"UserImportJobIdType\",\n          \"documentation\":\"<p>The job ID for the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to describe the user import job.</p>\"\n    },\n    \"DescribeUserImportJobResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserImportJob\":{\n          \"shape\":\"UserImportJobType\",\n          \"documentation\":\"<p>The job object that represents the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to describe the user import job.</p>\"\n    },\n    \"DescribeUserPoolClientRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ClientId\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool you want to describe.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to describe a user pool client.</p>\"\n    },\n    \"DescribeUserPoolClientResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolClient\":{\n          \"shape\":\"UserPoolClientType\",\n          \"documentation\":\"<p>The user pool client from a server response to describe the user pool client.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server from a request to describe the user pool client.</p>\"\n    },\n    \"DescribeUserPoolDomainRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"Domain\"],\n      \"members\":{\n        \"Domain\":{\"shape\":\"DomainType\"}\n      }\n    },\n    \"DescribeUserPoolDomainResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"DomainDescription\":{\"shape\":\"DomainDescriptionType\"}\n      }\n    },\n    \"DescribeUserPoolRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool you want to describe.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to describe the user pool.</p>\"\n    },\n    \"DescribeUserPoolResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPool\":{\n          \"shape\":\"UserPoolType\",\n          \"documentation\":\"<p>The container of metadata returned by the server to describe the pool.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response to describe the user pool.</p>\"\n    },\n    \"DescriptionType\":{\n      \"type\":\"string\",\n      \"max\":2048\n    },\n    \"DeviceConfigurationType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ChallengeRequiredOnNewDevice\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Indicates whether a challenge is required on a new device. Only applicable to a new device.</p>\"\n        },\n        \"DeviceOnlyRememberedOnUserPrompt\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>If true, a device is only remembered on user prompt.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The type of configuration for the user pool's device tracking.</p>\"\n    },\n    \"DeviceKeyType\":{\n      \"type\":\"string\",\n      \"max\":55,\n      \"min\":1,\n      \"pattern\":\"[\\\\w-]+_[0-9a-f-]+\"\n    },\n    \"DeviceListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"DeviceType\"}\n    },\n    \"DeviceNameType\":{\n      \"type\":\"string\",\n      \"max\":1024,\n      \"min\":1\n    },\n    \"DeviceRememberedStatusType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"remembered\",\n        \"not_remembered\"\n      ]\n    },\n    \"DeviceSecretVerifierConfigType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"PasswordVerifier\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The password verifier.</p>\"\n        },\n        \"Salt\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The salt.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The device verifier against which it will be authenticated.</p>\"\n    },\n    \"DeviceType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"DeviceAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>The device attributes.</p>\"\n        },\n        \"DeviceCreateDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The creation date of the device.</p>\"\n        },\n        \"DeviceLastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The last modified date of the device.</p>\"\n        },\n        \"DeviceLastAuthenticatedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date in which the device was last authenticated.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The device type.</p>\"\n    },\n    \"DomainDescriptionType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"AWSAccountId\":{\"shape\":\"AWSAccountIdType\"},\n        \"Domain\":{\"shape\":\"DomainType\"},\n        \"S3Bucket\":{\"shape\":\"S3BucketType\"},\n        \"CloudFrontDistribution\":{\"shape\":\"ArnType\"},\n        \"Version\":{\"shape\":\"DomainVersionType\"},\n        \"Status\":{\"shape\":\"DomainStatusType\"}\n      }\n    },\n    \"DomainStatusType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"CREATING\",\n        \"DELETING\",\n        \"UPDATING\",\n        \"ACTIVE\",\n        \"FAILED\"\n      ]\n    },\n    \"DomainType\":{\n      \"type\":\"string\",\n      \"max\":63,\n      \"min\":1,\n      \"pattern\":\"^[a-z0-9](?:[a-z0-9\\\\-]{0,61}[a-z0-9])?$\"\n    },\n    \"DomainVersionType\":{\n      \"type\":\"string\",\n      \"max\":20,\n      \"min\":1\n    },\n    \"DuplicateProviderException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"EmailAddressType\":{\n      \"type\":\"string\",\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+@[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\"\n    },\n    \"EmailConfigurationType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SourceArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The Amazon Resource Name (ARN) of the email source.</p>\"\n        },\n        \"ReplyToEmailAddress\":{\n          \"shape\":\"EmailAddressType\",\n          \"documentation\":\"<p>The REPLY-TO email address.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The email configuration type.</p>\"\n    },\n    \"EmailNotificationBodyType\":{\n      \"type\":\"string\",\n      \"max\":20000,\n      \"min\":6,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s*]+\"\n    },\n    \"EmailNotificationSubjectType\":{\n      \"type\":\"string\",\n      \"max\":140,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s]+\"\n    },\n    \"EmailVerificationMessageByLinkType\":{\n      \"type\":\"string\",\n      \"max\":20000,\n      \"min\":6,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s*]*\\\\{##[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s*]*##\\\\}[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s*]*\"\n    },\n    \"EmailVerificationMessageType\":{\n      \"type\":\"string\",\n      \"max\":20000,\n      \"min\":6,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s*]*\\\\{####\\\\}[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s*]*\"\n    },\n    \"EmailVerificationSubjectByLinkType\":{\n      \"type\":\"string\",\n      \"max\":140,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s]+\"\n    },\n    \"EmailVerificationSubjectType\":{\n      \"type\":\"string\",\n      \"max\":140,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}\\\\s]+\"\n    },\n    \"EnableSoftwareTokenMFAException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"EnhanceAuthRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\",\n        \"AuthState\",\n        \"Code\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user for whom you wish to enhance authentication.</p>\"\n        },\n        \"AuthState\":{\n          \"shape\":\"AuthStateType\",\n          \"documentation\":\"<p>The authentication state.</p>\"\n        },\n        \"Code\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The code returned from the enhanced authentication request.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"}\n      },\n      \"documentation\":\"<p>Represents the request by the developer to enhance the authentication on a user pool.</p>\"\n    },\n    \"EnhanceAuthResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The authentication result from the enhanced authentication response.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the enhanced authentication request.</p>\"\n    },\n    \"EventContextDataType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"IpAddress\":{\"shape\":\"StringType\"},\n        \"DeviceName\":{\"shape\":\"StringType\"},\n        \"Timezone\":{\"shape\":\"StringType\"},\n        \"City\":{\"shape\":\"StringType\"},\n        \"Country\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"EventFeedbackType\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"FeedbackValue\",\n        \"Provider\"\n      ],\n      \"members\":{\n        \"FeedbackValue\":{\"shape\":\"FeedbackValueType\"},\n        \"Provider\":{\"shape\":\"StringType\"},\n        \"FeedbackDate\":{\"shape\":\"DateType\"}\n      }\n    },\n    \"EventFilterType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"SIGN_IN\",\n        \"FORGOT_PASSWORD\",\n        \"ALL\"\n      ]\n    },\n    \"EventFiltersType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"EventFilterType\"}\n    },\n    \"EventIdType\":{\n      \"type\":\"string\",\n      \"max\":50,\n      \"min\":1,\n      \"pattern\":\"[\\\\w+-]+\"\n    },\n    \"EventResponseType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Success\",\n        \"Failure\"\n      ]\n    },\n    \"EventRiskType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"RiskDecision\":{\"shape\":\"RiskDecisionType\"},\n        \"RiskLevel\":{\"shape\":\"RiskLevelType\"}\n      }\n    },\n    \"EventType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"SignIn\",\n        \"SignUp\",\n        \"ForgotPassword\"\n      ]\n    },\n    \"ExpiredCodeException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the expired code exception is thrown.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown if a code has expired.</p>\",\n      \"exception\":true\n    },\n    \"ExplicitAuthFlowsListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ExplicitAuthFlowsType\"}\n    },\n    \"ExplicitAuthFlowsType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"ADMIN_NO_SRP_AUTH\",\n        \"CUSTOM_AUTH_FLOW_ONLY\"\n      ]\n    },\n    \"FeedbackValueType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Bad\",\n        \"Good\"\n      ]\n    },\n    \"ForceAliasCreation\":{\"type\":\"boolean\"},\n    \"ForgetDeviceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"DeviceKey\"],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token for the forgotten device request.</p>\"\n        },\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to forget the device.</p>\"\n    },\n    \"ForgotPasswordRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"},\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user for whom you want to enter a code to reset a forgotten password.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"}\n      },\n      \"documentation\":\"<p>Represents the request to reset a user's password.</p>\"\n    },\n    \"ForgotPasswordResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"CodeDeliveryDetails\":{\n          \"shape\":\"CodeDeliveryDetailsType\",\n          \"documentation\":\"<p>The code delivery details returned by the server in response to the request to reset a password.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Respresents the response from the server regarding the request to reset a password.</p>\"\n    },\n    \"GenerateSecret\":{\"type\":\"boolean\"},\n    \"GetAuthenticationDetailsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\",\n        \"SrpA\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user for whom you wish to retrieve authentication details.</p>\"\n        },\n        \"SrpA\":{\n          \"shape\":\"AValueHexStringType\",\n          \"documentation\":\"<p>The Secure Remote Password protocol (SRP) key. For more information, see <a href=\\\"https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol\\\">Secure Remote Password Protocol</a>.</p>\"\n        },\n        \"ValidationData\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>The validation data of the request to get authentication details.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"}\n      },\n      \"documentation\":\"<p>Represents the user's request to get authentication details.</p>\"\n    },\n    \"GetAuthenticationDetailsResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Salt\",\n        \"SrpB\",\n        \"SecretBlock\"\n      ],\n      \"members\":{\n        \"Salt\":{\n          \"shape\":\"HexStringType\",\n          \"documentation\":\"<p>A salt that gets returned by the response from the server to get authentication details. For more information, see <a href=\\\"https://en.wikipedia.org/wiki/Salt_%28cryptography%29\\\">Salt cryptography</a>.</p>\"\n        },\n        \"SrpB\":{\n          \"shape\":\"HexStringType\",\n          \"documentation\":\"<p>The Secure Remote Password protocol (SRP) key. For more information, see <a href=\\\"https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol\\\">Secure Remote Password Protocol</a>.</p>\"\n        },\n        \"SecretBlock\":{\n          \"shape\":\"BlobType\",\n          \"documentation\":\"<p>A blob that blocks the secret hash in the get authentication details response.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The resolved username for a possible alias in the input username parameter.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to get authentication details.</p>\"\n    },\n    \"GetCSVHeaderRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are to be imported into.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get the header information for the .csv file for the user import job.</p>\"\n    },\n    \"GetCSVHeaderResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are to be imported into.</p>\"\n        },\n        \"CSVHeader\":{\n          \"shape\":\"ListOfStringTypes\",\n          \"documentation\":\"<p>The header information for the .csv file for the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to get the header information for the .csv file for the user import job.</p>\"\n    },\n    \"GetDeviceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"DeviceKey\"],\n      \"members\":{\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get the device.</p>\"\n    },\n    \"GetDeviceResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"Device\"],\n      \"members\":{\n        \"Device\":{\n          \"shape\":\"DeviceType\",\n          \"documentation\":\"<p>The device.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Gets the device response.</p>\"\n    },\n    \"GetGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"GroupName\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The name of the group.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        }\n      }\n    },\n    \"GetGroupResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Group\":{\n          \"shape\":\"GroupType\",\n          \"documentation\":\"<p>The group object for the group.</p>\"\n        }\n      }\n    },\n    \"GetIdentityProviderByIdentifierRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"IdpIdentifier\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"IdpIdentifier\":{\"shape\":\"IdpIdentifierType\"}\n      }\n    },\n    \"GetIdentityProviderByIdentifierResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"IdentityProvider\"],\n      \"members\":{\n        \"IdentityProvider\":{\"shape\":\"IdentityProviderType\"}\n      }\n    },\n    \"GetJWKSRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to get JSON Web keys.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get JSON Web keys.</p>\"\n    },\n    \"GetJWKSResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"keys\":{\n          \"shape\":\"KeyListType\",\n          \"documentation\":\"<p>The keys in a get JSON Web keys response.</p>\"\n        },\n        \"cacheControl\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The value of the <code>Cache-Control</code> HTTP header field for the JSON Web keys response. For more information on <code>cacheControl</code>, see <a href=\\\"https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9\\\">https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9</a>.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to get JSON Web keys.</p>\"\n    },\n    \"GetOpenIdConfigurationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to get Open ID configuration information.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get the Open ID configuration.</p>\"\n    },\n    \"GetOpenIdConfigurationResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"issuer\":{\n          \"shape\":\"openIdUrlType\",\n          \"documentation\":\"<p>The issuer of the Open ID configuration response.</p>\"\n        },\n        \"jwks_uri\":{\n          \"shape\":\"openIdUrlType\",\n          \"documentation\":\"<p>The URI of the JSON Web keys in the server response to get Open ID configuration information.</p>\"\n        },\n        \"authorization_endpoint\":{\n          \"shape\":\"openIdUrlType\",\n          \"documentation\":\"<p>The authorization endpoint returned by the server response to get the Open ID configuration information.</p>\"\n        },\n        \"subject_types_supported\":{\n          \"shape\":\"openIdListType\",\n          \"documentation\":\"<p>The subject types supported returned by the server response to get the Open ID configuration information.</p>\"\n        },\n        \"response_types_supported\":{\n          \"shape\":\"openIdListType\",\n          \"documentation\":\"<p>The response types supported returned by the server response to get the Open ID configuration information.</p>\"\n        },\n        \"id_token_signing_alg_values_supported\":{\n          \"shape\":\"openIdListType\",\n          \"documentation\":\"<p>The token-signing algorithm values supported returned by the server response to get the Open ID configuration information.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to get the Open ID configuration information.</p>\"\n    },\n    \"GetSigningCertificateRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"}\n      }\n    },\n    \"GetSigningCertificateResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Certificate\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"GetUICustomizationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ClientId\":{\"shape\":\"ClientIdType\"}\n      }\n    },\n    \"GetUICustomizationResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"UICustomization\"],\n      \"members\":{\n        \"UICustomization\":{\"shape\":\"UICustomizationType\"}\n      }\n    },\n    \"GetUserAttributeVerificationCodeRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"AccessToken\",\n        \"AttributeName\"\n      ],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token returned by the server response to get the user attribute verification code.</p>\"\n        },\n        \"AttributeName\":{\n          \"shape\":\"AttributeNameType\",\n          \"documentation\":\"<p>The attribute name returned by the server response to get the user attribute verification code.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get user attribute verification.</p>\"\n    },\n    \"GetUserAttributeVerificationCodeResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"CodeDeliveryDetails\":{\n          \"shape\":\"CodeDeliveryDetailsType\",\n          \"documentation\":\"<p>The code delivery details returned by the server in response to the request to get the user attribute verification code.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The verification code response returned by the server response to get the user attribute verification code.</p>\"\n    },\n    \"GetUserPoolMfaConfigRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"}\n      }\n    },\n    \"GetUserPoolMfaConfigResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SmsMfaConfiguration\":{\"shape\":\"SmsMfaConfigType\"},\n        \"SoftwareTokenMfaConfiguration\":{\"shape\":\"SoftwareTokenMfaConfigType\"},\n        \"MfaConfiguration\":{\"shape\":\"UserPoolMfaType\"}\n      }\n    },\n    \"GetUserPoolUIConfigurationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"}\n      }\n    },\n    \"GetUserPoolUIConfigurationResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolUIConfiguration\"],\n      \"members\":{\n        \"UserPoolUIConfiguration\":{\"shape\":\"UserPoolUIConfigurationType\"}\n      }\n    },\n    \"GetUserRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"AccessToken\"],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token returned by the server response to get information about the user.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to get information about the user.</p>\"\n    },\n    \"GetUserResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"Username\",\n        \"UserAttributes\"\n      ],\n      \"members\":{\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to retrieve from the get user request.</p>\"\n        },\n        \"UserAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>An array of name-value pairs representing user attributes.</p>\"\n        },\n        \"MFAOptions\":{\n          \"shape\":\"MFAOptionListType\",\n          \"documentation\":\"<p>Specifies the options for MFA (e.g., email or phone number).</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server from the request to get information about the user.</p>\"\n    },\n    \"GlobalSignOutRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"AccessToken\"],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to sign out all devices.</p>\"\n    },\n    \"GlobalSignOutResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The response to the request to sign out all devices.</p>\"\n    },\n    \"GroupExistsException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"documentation\":\"<p>This exception is thrown when Amazon Cognito encounters a group that already exists in the user pool.</p>\",\n      \"exception\":true\n    },\n    \"GroupListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"GroupType\"}\n    },\n    \"GroupNameType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\"\n    },\n    \"GroupType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The name of the group.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Description\":{\n          \"shape\":\"DescriptionType\",\n          \"documentation\":\"<p>A string containing the description of the group.</p>\"\n        },\n        \"RoleArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The role ARN for the group.</p>\"\n        },\n        \"Precedence\":{\n          \"shape\":\"PrecedenceType\",\n          \"documentation\":\"<p>A nonnegative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. If a user belongs to two or more groups, it is the group with the highest precedence whose role ARN will be used in the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims in the user's tokens. Groups with higher <code>Precedence</code> values take precedence over groups with lower <code>Precedence</code> values or with null <code>Precedence</code> values.</p> <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim is not set in users' tokens.</p> <p>The default <code>Precedence</code> value is null.</p>\"\n        },\n        \"LastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date the group was last modified.</p>\"\n        },\n        \"CreationDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date the group was created.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The group type.</p>\"\n    },\n    \"HexStringType\":{\n      \"type\":\"string\",\n      \"pattern\":\"^[0-9a-fA-F]+$\"\n    },\n    \"HttpHeader\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"headerName\":{\"shape\":\"StringType\"},\n        \"headerValue\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"HttpHeaderList\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"HttpHeader\"}\n    },\n    \"IdentityProviderType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ProviderName\":{\"shape\":\"ProviderNameType\"},\n        \"ProviderType\":{\"shape\":\"IdentityProviderTypeType\"},\n        \"ProviderDetails\":{\"shape\":\"ProviderDetailsType\"},\n        \"AttributeMapping\":{\"shape\":\"AttributeMappingType\"},\n        \"IdpIdentifiers\":{\"shape\":\"IdpIdentifiersListType\"},\n        \"LastModifiedDate\":{\"shape\":\"DateType\"},\n        \"CreationDate\":{\"shape\":\"DateType\"}\n      }\n    },\n    \"IdentityProviderTypeType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"SAML\",\n        \"Facebook\",\n        \"Google\",\n        \"LoginWithAmazon\",\n        \"ActiveDirectory\"\n      ]\n    },\n    \"IdpIdentifierType\":{\n      \"type\":\"string\",\n      \"max\":40,\n      \"min\":1,\n      \"pattern\":\"[\\\\w\\\\s+=.@-]+\"\n    },\n    \"IdpIdentifiersListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"IdpIdentifierType\"},\n      \"max\":50,\n      \"min\":0\n    },\n    \"ImageFileType\":{\"type\":\"blob\"},\n    \"ImageUrlType\":{\"type\":\"string\"},\n    \"InitiateAuthRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"AuthFlow\",\n        \"ClientId\"\n      ],\n      \"members\":{\n        \"AuthFlow\":{\n          \"shape\":\"AuthFlowType\",\n          \"documentation\":\"<p>The authentication flow for this call to execute. The API action will depend on this value. For example: </p> <ul> <li> <p> <code>REFRESH_TOKEN_AUTH</code> will take in a valid refresh token and return new tokens.</p> </li> <li> <p> <code>USER_SRP_AUTH</code> will take in USERNAME and SRPA and return the SRP variables to be used for next challenge execution.</p> </li> </ul> <p>Valid values include:</p> <ul> <li> <p> <code>USER_SRP_AUTH</code>: Authentication flow for the Secure Remote Password (SRP) protocol.</p> </li> <li> <p> <code>REFRESH_TOKEN_AUTH</code>/<code>REFRESH_TOKEN</code>: Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.</p> </li> <li> <p> <code>CUSTOM_AUTH</code>: Custom authentication flow.</p> </li> </ul> <p> <code>ADMIN_NO_SRP_AUTH</code> is not a valid value.</p>\"\n        },\n        \"AuthParameters\":{\n          \"shape\":\"AuthParametersType\",\n          \"documentation\":\"<p>The authentication parameters. These are inputs corresponding to the <code>AuthFlow</code> that you are invoking. The required values depend on the value of <code>AuthFlow</code>:</p> <ul> <li> <p>For <code>USER_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SRPA</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code> </p> </li> <li> <p>For <code>REFRESH_TOKEN_AUTH/REFRESH_TOKEN</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>REFRESH_TOKEN</code> (required), <code>DEVICE_KEY</code> </p> </li> <li> <p>For <code>CUSTOM_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>DEVICE_KEY</code> </p> </li> </ul>\"\n        },\n        \"ClientMetadata\":{\n          \"shape\":\"ClientMetadataType\",\n          \"documentation\":\"<p>This is a random key-value pair map which can contain any key and will be passed to your PreAuthentication Lambda trigger as-is. It can be used to implement additional validations around authentication.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The app client ID.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"}\n      },\n      \"documentation\":\"<p>Initiates the authentication request.</p>\"\n    },\n    \"InitiateAuthResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ChallengeName\":{\n          \"shape\":\"ChallengeNameType\",\n          \"documentation\":\"<p>The name of the challenge which you are responding to with this call. This is returned to you in the <code>AdminInitiateAuth</code> response if you need to pass another challenge.</p> <p>Valid values include the following. Note that all of these challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable) in the parameters.</p> <ul> <li> <p> <code>SMS_MFA</code>: Next challenge is to supply an <code>SMS_MFA_CODE</code>, delivered via SMS.</p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: Next challenge is to supply <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, and <code>TIMESTAMP</code> after the client-side SRP calculations.</p> </li> <li> <p> <code>CUSTOM_CHALLENGE</code>: This is returned if your custom authentication flow determines that the user should pass another challenge before tokens are issued.</p> </li> <li> <p> <code>DEVICE_SRP_AUTH</code>: If device tracking was enabled on your user pool and the previous challenges were passed, this challenge is returned so that Amazon Cognito can start tracking this device.</p> </li> <li> <p> <code>DEVICE_PASSWORD_VERIFIER</code>: Similar to <code>PASSWORD_VERIFIER</code>, but for devices only.</p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: For users which are required to change their passwords after successful first login. This challenge should be passed with <code>NEW_PASSWORD</code> and any other required attributes.</p> </li> </ul>\"\n        },\n        \"Session\":{\n          \"shape\":\"SessionType\",\n          \"documentation\":\"<p>The session which should be passed both ways in challenge-response calls to the service. If <code>InitiateAuth</code> or <code>RespondToAuthChallenge</code> API call determines that the caller needs to go through another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next <code>RespondToAuthChallenge</code> API call.</p>\"\n        },\n        \"ChallengeParameters\":{\n          \"shape\":\"ChallengeParametersType\",\n          \"documentation\":\"<p>The challenge parameters. These are returned to you in the <code>InitiateAuth</code> response if you need to pass another challenge. The responses in this parameter should be used to compute inputs to the next call (<code>RespondToAuthChallenge</code>). </p> <p>All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable).</p>\"\n        },\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The result of the authentication response. This is only returned if the caller does not need to pass another challenge. If the caller does need to pass another challenge before it gets tokens, <code>ChallengeName</code>, <code>ChallengeParameters</code>, and <code>Session</code> are returned.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Initiates the authentication response.</p>\"\n    },\n    \"IntegerType\":{\"type\":\"integer\"},\n    \"InternalErrorException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when Amazon Cognito throws an internal error exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when Amazon Cognito encounters an internal error.</p>\",\n      \"exception\":true,\n      \"fault\":true\n    },\n    \"InvalidEmailRoleAccessPolicyException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when you have an unverified email address or the identity policy is not set on an email address that Amazon Cognito can access.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when Amazon Cognito is not allowed to use your email identity. HTTP status code: 400.</p>\",\n      \"exception\":true\n    },\n    \"InvalidLambdaResponseException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service throws an invalid AWS Lambda response exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when the Amazon Cognito service encounters an invalid AWS Lambda response.</p>\",\n      \"exception\":true\n    },\n    \"InvalidOAuthFlowException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"InvalidParameterException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service throws an invalid parameter exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when the Amazon Cognito service encounters an invalid parameter.</p>\",\n      \"exception\":true\n    },\n    \"InvalidPasswordException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service throws an invalid user password exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when the Amazon Cognito service encounters an invalid password.</p>\",\n      \"exception\":true\n    },\n    \"InvalidSmsRoleAccessPolicyException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message retuned when the invalid SMS role access policy exception is thrown.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is returned when the role provided for SMS configuration does not have permission to publish using Amazon SNS.</p>\",\n      \"exception\":true\n    },\n    \"InvalidSmsRoleTrustRelationshipException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the role trust relationship for the SMS message is invalid.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when the trust relationship is invalid for the role provided for SMS configuration. This can happen if you do not trust <b>cognito-idp.amazonaws.com</b> or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.</p>\",\n      \"exception\":true\n    },\n    \"InvalidUserPoolConfigurationException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the user pool configuration is invalid.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when the user pool configuration is invalid.</p>\",\n      \"exception\":true\n    },\n    \"KeyListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"KeyType\"}\n    },\n    \"KeyType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"kty\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>A \\\"kty\\\" key type parameter. For more information, see <a href=\\\"http://self-issued.info/docs/draft-ietf-jose-json-web-key.html\\\">JSON Web Key (JWK) Format</a>.</p>\"\n        },\n        \"alg\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>A \\\"kty\\\" (Key Type) parameter. For more information, see <a href=\\\"http://self-issued.info/docs/draft-ietf-jose-json-web-key.html#ktyDef\\\">\\\"kty\\\" (Key Type) Parameter</a>.</p>\"\n        },\n        \"use\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>A \\\"use\\\" (Public Key Use) parameter. For more information, see <a href=\\\"http://self-issued.info/docs/draft-ietf-jose-json-web-key.html#useDef\\\">\\\"use\\\" (Public Key Use) Parameter</a>.</p>\"\n        },\n        \"kid\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>A \\\"kid\\\" (Key ID) parameter. For more information, see <a href=\\\"http://self-issued.info/docs/draft-ietf-jose-json-web-key.html#kidDef\\\">\\\"kid\\\" (Key ID) Parameter</a>.</p>\"\n        },\n        \"n\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>An \\\"n\\\" parameter.</p>\"\n        },\n        \"e\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>An \\\"e\\\" parameter.</p>\"\n        }\n      },\n      \"documentation\":\"<p>A JSON Web Key key type in <a href=\\\"http://self-issued.info/docs/draft-ietf-jose-json-web-key.html#rfc.section.4\\\">JSON Web Key (JWK) Format</a>.</p>\"\n    },\n    \"LambdaConfigType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"PreSignUp\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>A pre-registration AWS Lambda trigger.</p>\"\n        },\n        \"CustomMessage\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>A custom Message AWS Lambda trigger.</p>\"\n        },\n        \"PostConfirmation\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>A post-confirmation AWS Lambda trigger.</p>\"\n        },\n        \"PreAuthentication\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>A pre-authentication AWS Lambda trigger.</p>\"\n        },\n        \"PostAuthentication\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>A post-authentication AWS Lambda trigger.</p>\"\n        },\n        \"DefineAuthChallenge\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>Defines the authentication challenge.</p>\"\n        },\n        \"CreateAuthChallenge\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>Creates an authentication challenge.</p>\"\n        },\n        \"VerifyAuthChallengeResponse\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>Verifies the authentication challenge response.</p>\"\n        },\n        \"PreTokenGeneration\":{\"shape\":\"ArnType\"}\n      },\n      \"documentation\":\"<p>Specifies the type of configuration for AWS Lambda triggers.</p>\"\n    },\n    \"LimitExceededException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when Amazon Cognito throws a limit exceeded exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a user exceeds the limit for a requested AWS resource.</p>\",\n      \"exception\":true\n    },\n    \"ListDevicesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"AccessToken\"],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access tokens for the request to list devices.</p>\"\n        },\n        \"Limit\":{\n          \"shape\":\"QueryLimitType\",\n          \"documentation\":\"<p>The limit of the device request.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"SearchPaginationTokenType\",\n          \"documentation\":\"<p>The pagination token for the list request.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to list the devices.</p>\"\n    },\n    \"ListDevicesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Devices\":{\n          \"shape\":\"DeviceListType\",\n          \"documentation\":\"<p>The devices returned in the list devices response.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"SearchPaginationTokenType\",\n          \"documentation\":\"<p>The pagination token for the list device response.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response to list devices.</p>\"\n    },\n    \"ListGroupsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Limit\":{\n          \"shape\":\"QueryLimitType\",\n          \"documentation\":\"<p>The limit of the request to list groups.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      }\n    },\n    \"ListGroupsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Groups\":{\n          \"shape\":\"GroupListType\",\n          \"documentation\":\"<p>The group objects for the groups.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      }\n    },\n    \"ListIdentityProvidersRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"MaxResults\":{\"shape\":\"ListProvidersLimitType\"},\n        \"NextToken\":{\"shape\":\"PaginationKeyType\"}\n      }\n    },\n    \"ListIdentityProvidersResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"Providers\"],\n      \"members\":{\n        \"Providers\":{\"shape\":\"ProvidersListType\"},\n        \"NextToken\":{\"shape\":\"PaginationKeyType\"}\n      }\n    },\n    \"ListOfStringTypes\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"StringType\"}\n    },\n    \"ListProvidersLimitType\":{\n      \"type\":\"integer\",\n      \"max\":60,\n      \"min\":1\n    },\n    \"ListResourceServersLimitType\":{\n      \"type\":\"integer\",\n      \"max\":50,\n      \"min\":1\n    },\n    \"ListResourceServersRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"MaxResults\":{\"shape\":\"ListResourceServersLimitType\"},\n        \"NextToken\":{\"shape\":\"PaginationKeyType\"}\n      }\n    },\n    \"ListResourceServersResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"ResourceServers\"],\n      \"members\":{\n        \"ResourceServers\":{\"shape\":\"ResourceServersListType\"},\n        \"NextToken\":{\"shape\":\"PaginationKeyType\"}\n      }\n    },\n    \"ListUserImportJobsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"MaxResults\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are being imported into.</p>\"\n        },\n        \"MaxResults\":{\n          \"shape\":\"PoolQueryLimitType\",\n          \"documentation\":\"<p>The maximum number of import jobs you want the request to return.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"PaginationKeyType\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to ListUserImportJobs, which can be used to return the next set of import jobs in the list.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to list the user import jobs.</p>\"\n    },\n    \"ListUserImportJobsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserImportJobs\":{\n          \"shape\":\"UserImportJobsListType\",\n          \"documentation\":\"<p>The user import jobs.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"PaginationKeyType\",\n          \"documentation\":\"<p>An identifier that can be used to return the next set of user import jobs in the list.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to list the user import jobs.</p>\"\n    },\n    \"ListUserPoolClientsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to list user pool clients.</p>\"\n        },\n        \"MaxResults\":{\n          \"shape\":\"QueryLimit\",\n          \"documentation\":\"<p>The maximum number of results you want the request to return when listing the user pool clients.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to list the user pool clients.</p>\"\n    },\n    \"ListUserPoolClientsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolClients\":{\n          \"shape\":\"UserPoolClientListType\",\n          \"documentation\":\"<p>The user pool clients in the response that lists user pool clients.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server that lists user pool clients.</p>\"\n    },\n    \"ListUserPoolsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"MaxResults\"],\n      \"members\":{\n        \"NextToken\":{\n          \"shape\":\"PaginationKeyType\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        },\n        \"MaxResults\":{\n          \"shape\":\"PoolQueryLimitType\",\n          \"documentation\":\"<p>The maximum number of results you want the request to return when listing the user pools.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to list user pools.</p>\"\n    },\n    \"ListUserPoolsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPools\":{\n          \"shape\":\"UserPoolListType\",\n          \"documentation\":\"<p>The user pools from the response to list users.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKeyType\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response to list user pools.</p>\"\n    },\n    \"ListUsersInGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"GroupName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The name of the group.</p>\"\n        },\n        \"Limit\":{\n          \"shape\":\"QueryLimitType\",\n          \"documentation\":\"<p>The limit of the request to list users.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      }\n    },\n    \"ListUsersInGroupResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Users\":{\n          \"shape\":\"UsersListType\",\n          \"documentation\":\"<p>The users returned in the request to list users.</p>\"\n        },\n        \"NextToken\":{\n          \"shape\":\"PaginationKey\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      }\n    },\n    \"ListUsersRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool on which the search should be performed.</p>\"\n        },\n        \"AttributesToGet\":{\n          \"shape\":\"SearchedAttributeNamesListType\",\n          \"documentation\":\"<p>An array of strings, where each string is the name of a user attribute to be returned for each user in the search results. If the array is empty, all attributes are returned.</p>\"\n        },\n        \"Limit\":{\n          \"shape\":\"QueryLimitType\",\n          \"documentation\":\"<p>Maximum number of users to be returned.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"SearchPaginationTokenType\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        },\n        \"Filter\":{\n          \"shape\":\"UserFilterType\",\n          \"documentation\":\"<p>A filter string of the form \\\"<i>AttributeName</i> <i>Filter-Type</i> \\\"<i>AttributeValue</i>\\\"\\\". Quotation marks within the filter string must be escaped using the backslash (\\\\) character. For example, \\\"<code>family_name</code> = \\\\\\\"Reddy\\\\\\\"\\\".</p> <ul> <li> <p> <i>AttributeName</i>: The name of the attribute to search for. You can only search for one attribute at a time.</p> </li> <li> <p> <i>Filter-Type</i>: For an exact match, use =, for example, \\\"<code>given_name</code> = \\\\\\\"Jon\\\\\\\"\\\". For a prefix (\\\"starts with\\\") match, use ^=, for example, \\\"<code>given_name</code> ^= \\\\\\\"Jon\\\\\\\"\\\". </p> </li> <li> <p> <i>AttributeValue</i>: The attribute value that must be matched for each user.</p> </li> </ul> <p>If the filter string is empty, <code>ListUsers</code> returns all users in the user pool.</p> <p>You can only search for the following standard attributes:</p> <ul> <li> <p> <code>username</code> (case-sensitive)</p> </li> <li> <p> <code>email</code> </p> </li> <li> <p> <code>phone_number</code> </p> </li> <li> <p> <code>name</code> </p> </li> <li> <p> <code>given_name</code> </p> </li> <li> <p> <code>family_name</code> </p> </li> <li> <p> <code>preferred_username</code> </p> </li> <li> <p> <code>cognito:user_status</code> (called <b>Enabled</b> in the Console) (case-sensitive)</p> </li> <li> <p> <code>status</code> (case-insensitive)</p> </li> </ul> <p>Custom attributes are not searchable.</p> <p>For more information, see <a href=\\\"http://docs.aws.amazon.com/cognito/latest/developerguide/how-to-manage-user-accounts.html#cognito-user-pools-searching-for-users-using-listusers-api\\\">Searching for Users Using the ListUsers API</a> and <a href=\\\"http://docs.aws.amazon.com/cognito/latest/developerguide/how-to-manage-user-accounts.html#cognito-user-pools-searching-for-users-listusers-api-examples\\\">Examples of Using the ListUsers API</a> in the <i>Amazon Cognito Developer Guide</i>.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to list users.</p>\"\n    },\n    \"ListUsersResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Users\":{\n          \"shape\":\"UsersListType\",\n          \"documentation\":\"<p>The users returned in the request to list users.</p>\"\n        },\n        \"PaginationToken\":{\n          \"shape\":\"SearchPaginationTokenType\",\n          \"documentation\":\"<p>An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The response from the request to list users.</p>\"\n    },\n    \"LogoutURLsListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"RedirectUrlType\"},\n      \"max\":100,\n      \"min\":0\n    },\n    \"LongType\":{\"type\":\"long\"},\n    \"MFAMethodNotFoundException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when Amazon Cognito throws an MFA method not found exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when Amazon Cognito cannot find a multi-factor authentication (MFA) method.</p>\",\n      \"exception\":true\n    },\n    \"MFAOptionListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"MFAOptionType\"}\n    },\n    \"MFAOptionType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"DeliveryMedium\":{\n          \"shape\":\"DeliveryMediumType\",\n          \"documentation\":\"<p>The delivery medium (email message or SMS message) to send the MFA code.</p>\"\n        },\n        \"AttributeName\":{\n          \"shape\":\"AttributeNameType\",\n          \"documentation\":\"<p>The attribute name of the MFA option type.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Specifies the different settings for multi-factor authentication (MFA).</p>\"\n    },\n    \"MessageActionType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"RESEND\",\n        \"SUPPRESS\"\n      ]\n    },\n    \"MessageTemplateType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SMSMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>The message template for SMS messages.</p>\"\n        },\n        \"EmailMessage\":{\n          \"shape\":\"EmailVerificationMessageType\",\n          \"documentation\":\"<p>The message template for email messages.</p>\"\n        },\n        \"EmailSubject\":{\n          \"shape\":\"EmailVerificationSubjectType\",\n          \"documentation\":\"<p>The subject line for email messages.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The message template structure.</p>\"\n    },\n    \"MessageType\":{\"type\":\"string\"},\n    \"NewDeviceMetadataType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"DeviceGroupKey\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The device group key.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The new device metadata type.</p>\"\n    },\n    \"NotAuthorizedException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service returns a not authorized exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception gets thrown when a user is not authorized.</p>\",\n      \"exception\":true\n    },\n    \"NotifyConfigurationType\":{\n      \"type\":\"structure\",\n      \"required\":[\"SourceArn\"],\n      \"members\":{\n        \"From\":{\"shape\":\"StringType\"},\n        \"ReplyTo\":{\"shape\":\"StringType\"},\n        \"SourceArn\":{\"shape\":\"ArnType\"},\n        \"BlockEmail\":{\"shape\":\"NotifyEmailType\"},\n        \"NoActionEmail\":{\"shape\":\"NotifyEmailType\"},\n        \"MfaEmail\":{\"shape\":\"NotifyEmailType\"}\n      }\n    },\n    \"NotifyEmailType\":{\n      \"type\":\"structure\",\n      \"required\":[\"Subject\"],\n      \"members\":{\n        \"Subject\":{\"shape\":\"EmailNotificationSubjectType\"},\n        \"HtmlBody\":{\"shape\":\"EmailNotificationBodyType\"},\n        \"TextBody\":{\"shape\":\"EmailNotificationBodyType\"}\n      }\n    },\n    \"NumberAttributeConstraintsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"MinValue\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The minimum value of an attribute that is of the number data type.</p>\"\n        },\n        \"MaxValue\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The maximum value of an attribute that is of the number data type.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The minimum and maximum value of an attribute that is of the number data type.</p>\"\n    },\n    \"OAuthFlowType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"code\",\n        \"implicit\",\n        \"client_credentials\"\n      ]\n    },\n    \"OAuthFlowsType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"OAuthFlowType\"},\n      \"max\":3,\n      \"min\":0\n    },\n    \"PaginationKey\":{\n      \"type\":\"string\",\n      \"min\":1,\n      \"pattern\":\"[\\\\S]+\"\n    },\n    \"PaginationKeyType\":{\n      \"type\":\"string\",\n      \"min\":1,\n      \"pattern\":\"[\\\\S]+\"\n    },\n    \"PasswordClaimType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SecretBlock\":{\n          \"shape\":\"BlobType\",\n          \"documentation\":\"<p>A secret block claim type for a password.</p>\"\n        },\n        \"Signature\":{\n          \"shape\":\"BlobType\",\n          \"documentation\":\"<p>A signature claim type for a password.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The claim type of a password.</p>\",\n      \"sensitive\":true\n    },\n    \"PasswordPolicyMinLengthType\":{\n      \"type\":\"integer\",\n      \"max\":99,\n      \"min\":6\n    },\n    \"PasswordPolicyType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"MinimumLength\":{\n          \"shape\":\"PasswordPolicyMinLengthType\",\n          \"documentation\":\"<p>The minimum length of the password policy that you have set. Cannot be less than 6.</p>\"\n        },\n        \"RequireUppercase\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>In the password policy that you have set, refers to whether you have required users to use at least one uppercase letter in their password.</p>\"\n        },\n        \"RequireLowercase\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>In the password policy that you have set, refers to whether you have required users to use at least one lowercase letter in their password.</p>\"\n        },\n        \"RequireNumbers\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>In the password policy that you have set, refers to whether you have required users to use at least one number in their password.</p>\"\n        },\n        \"RequireSymbols\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>In the password policy that you have set, refers to whether you have required users to use at least one symbol in their password.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The password policy type.</p>\"\n    },\n    \"PasswordResetRequiredException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when a password reset is required.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a password reset is required.</p>\",\n      \"exception\":true\n    },\n    \"PasswordType\":{\n      \"type\":\"string\",\n      \"max\":256,\n      \"min\":6,\n      \"pattern\":\"[\\\\S]+\",\n      \"sensitive\":true\n    },\n    \"PoolQueryLimitType\":{\n      \"type\":\"integer\",\n      \"max\":60,\n      \"min\":1\n    },\n    \"PreSignedUrlType\":{\n      \"type\":\"string\",\n      \"max\":2048,\n      \"min\":0\n    },\n    \"PrecedenceType\":{\n      \"type\":\"integer\",\n      \"min\":0\n    },\n    \"PreconditionNotMetException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when a precondition is not met.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a precondition is not met.</p>\",\n      \"exception\":true\n    },\n    \"ProviderDescription\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ProviderName\":{\"shape\":\"ProviderNameType\"},\n        \"ProviderType\":{\"shape\":\"IdentityProviderTypeType\"},\n        \"LastModifiedDate\":{\"shape\":\"DateType\"},\n        \"CreationDate\":{\"shape\":\"DateType\"}\n      }\n    },\n    \"ProviderDetailsType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"ProviderNameType\":{\n      \"type\":\"string\",\n      \"max\":32,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\"\n    },\n    \"ProviderNameTypeV1\":{\n      \"type\":\"string\",\n      \"max\":32,\n      \"min\":1,\n      \"pattern\":\"[^_][\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}][^_]+\"\n    },\n    \"ProviderUserIdentifierType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ProviderName\":{\"shape\":\"ProviderNameType\"},\n        \"ProviderAttributeName\":{\"shape\":\"StringType\"},\n        \"ProviderAttributeValue\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"ProvidersListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ProviderDescription\"},\n      \"max\":50,\n      \"min\":0\n    },\n    \"QueryLimit\":{\n      \"type\":\"integer\",\n      \"max\":60,\n      \"min\":1\n    },\n    \"QueryLimitType\":{\n      \"type\":\"integer\",\n      \"max\":60,\n      \"min\":0\n    },\n    \"RedirectUrlType\":{\n      \"type\":\"string\",\n      \"max\":1024,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\"\n    },\n    \"RefreshTokenValidityType\":{\n      \"type\":\"integer\",\n      \"max\":3650,\n      \"min\":0\n    },\n    \"RefreshTokensRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"RefreshToken\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"ClientSecret\":{\n          \"shape\":\"ClientSecretType\",\n          \"documentation\":\"<p>The client secret for a user's request to refresh tokens.</p>\"\n        },\n        \"RefreshToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The refresh token for a user's request to refresh tokens.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"}\n      },\n      \"documentation\":\"<p>Represents the request to refresh tokens.</p>\"\n    },\n    \"RefreshTokensResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The authentication result from the server's response to the request to refresh tokens.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server when the user wants to refresh tokens.</p>\"\n    },\n    \"ResendConfirmationCodeRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"},\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user to whom you wish to resend a confirmation code.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"}\n      },\n      \"documentation\":\"<p>Represents the request to resend the confirmation code.</p>\"\n    },\n    \"ResendConfirmationCodeResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"CodeDeliveryDetails\":{\n          \"shape\":\"CodeDeliveryDetailsType\",\n          \"documentation\":\"<p>The code delivery details returned by the server in response to the request to resend the confirmation code.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The response from the server when the Amazon Cognito Your User Pools service makes the request to resend a confirmation code.</p>\"\n    },\n    \"ResourceNotFoundException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service returns a resource not found exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when the Amazon Cognito service cannot find the requested resource.</p>\",\n      \"exception\":true\n    },\n    \"ResourceServerIdentifierType\":{\n      \"type\":\"string\",\n      \"max\":256,\n      \"min\":1,\n      \"pattern\":\"[\\\\x21\\\\x23-\\\\x5B\\\\x5D-\\\\x7E]+\"\n    },\n    \"ResourceServerNameType\":{\n      \"type\":\"string\",\n      \"max\":256,\n      \"min\":1,\n      \"pattern\":\"[\\\\w\\\\s+=,.@-]+\"\n    },\n    \"ResourceServerScopeDescriptionType\":{\n      \"type\":\"string\",\n      \"max\":256,\n      \"min\":1\n    },\n    \"ResourceServerScopeListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ResourceServerScopeType\"},\n      \"max\":25\n    },\n    \"ResourceServerScopeNameType\":{\n      \"type\":\"string\",\n      \"max\":256,\n      \"min\":1,\n      \"pattern\":\"[\\\\x21\\\\x23-\\\\x2E\\\\x30-\\\\x5B\\\\x5D-\\\\x7E]+\"\n    },\n    \"ResourceServerScopeType\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ScopeName\",\n        \"ScopeDescription\"\n      ],\n      \"members\":{\n        \"ScopeName\":{\"shape\":\"ResourceServerScopeNameType\"},\n        \"ScopeDescription\":{\"shape\":\"ResourceServerScopeDescriptionType\"}\n      }\n    },\n    \"ResourceServerType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Identifier\":{\"shape\":\"ResourceServerIdentifierType\"},\n        \"Name\":{\"shape\":\"ResourceServerNameType\"},\n        \"Scopes\":{\"shape\":\"ResourceServerScopeListType\"}\n      }\n    },\n    \"ResourceServersListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ResourceServerType\"}\n    },\n    \"RespondToAuthChallengeRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"ChallengeName\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The app client ID.</p>\"\n        },\n        \"ChallengeName\":{\n          \"shape\":\"ChallengeNameType\",\n          \"documentation\":\"<p>The challenge name. For more information, see <a href=\\\"API_InitiateAuth.html\\\">InitiateAuth</a>.</p> <p> <code>ADMIN_NO_SRP_AUTH</code> is not a valid value.</p>\"\n        },\n        \"Session\":{\n          \"shape\":\"SessionType\",\n          \"documentation\":\"<p>The session which should be passed both ways in challenge-response calls to the service. If <code>InitiateAuth</code> or <code>RespondToAuthChallenge</code> API call determines that the caller needs to go through another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next <code>RespondToAuthChallenge</code> API call.</p>\"\n        },\n        \"ChallengeResponses\":{\n          \"shape\":\"ChallengeResponsesType\",\n          \"documentation\":\"<p>The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example:</p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret).</p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret).</p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> </ul>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"}\n      },\n      \"documentation\":\"<p>The request to respond to an authentication challenge.</p>\"\n    },\n    \"RespondToAuthChallengeResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ChallengeName\":{\n          \"shape\":\"ChallengeNameType\",\n          \"documentation\":\"<p>The challenge name. For more information, see <a href=\\\"API_InitiateAuth.html\\\">InitiateAuth</a>.</p>\"\n        },\n        \"Session\":{\n          \"shape\":\"SessionType\",\n          \"documentation\":\"<p>The session which should be passed both ways in challenge-response calls to the service. If <code>InitiateAuth</code> or <code>RespondToAuthChallenge</code> API call determines that the caller needs to go through another challenge, they return a session with other challenge parameters. This session should be passed as it is to the next <code>RespondToAuthChallenge</code> API call.</p>\"\n        },\n        \"ChallengeParameters\":{\n          \"shape\":\"ChallengeParametersType\",\n          \"documentation\":\"<p>The challenge parameters. For more information, see <a href=\\\"API_InitiateAuth.html\\\">InitiateAuth</a>.</p>\"\n        },\n        \"AuthenticationResult\":{\n          \"shape\":\"AuthenticationResultType\",\n          \"documentation\":\"<p>The result returned by the server in response to the request to respond to the authentication challenge.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The response to respond to the authentication challenge.</p>\"\n    },\n    \"RiskConfigurationType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ClientId\":{\"shape\":\"ClientIdType\"},\n        \"CompromisedCredentialsRiskConfiguration\":{\"shape\":\"CompromisedCredentialsRiskConfigurationType\"},\n        \"BotRiskConfiguration\":{\"shape\":\"BotRiskConfigurationType\"},\n        \"AccountTakeoverRiskConfiguration\":{\"shape\":\"AccountTakeoverRiskConfigurationType\"},\n        \"RiskExceptionConfiguration\":{\"shape\":\"RiskExceptionConfigurationType\"},\n        \"LastModifiedDate\":{\"shape\":\"DateType\"}\n      }\n    },\n    \"RiskDecisionType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"NoRisk\",\n        \"Bot\",\n        \"AccountTakeover\"\n      ]\n    },\n    \"RiskExceptionConfigurationType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"BlockedIPRangeList\":{\"shape\":\"BlockedIPRangeListType\"},\n        \"SkippedIPRangeList\":{\"shape\":\"SkippedIPRangeListType\"}\n      }\n    },\n    \"RiskLevelType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Low\",\n        \"Medium\",\n        \"High\"\n      ]\n    },\n    \"S3BucketType\":{\n      \"type\":\"string\",\n      \"max\":1024,\n      \"min\":3,\n      \"pattern\":\"^[0-9A-Za-z\\\\.\\\\-_]*(?<!\\\\.)$\"\n    },\n    \"SMSMfaSettingsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Enabled\":{\"shape\":\"BooleanType\"},\n        \"PreferredMfa\":{\"shape\":\"BooleanType\"}\n      }\n    },\n    \"SchemaAttributeType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Name\":{\n          \"shape\":\"CustomAttributeNameType\",\n          \"documentation\":\"<p>A schema attribute of the name type.</p>\"\n        },\n        \"AttributeDataType\":{\n          \"shape\":\"AttributeDataType\",\n          \"documentation\":\"<p>The attribute data type.</p>\"\n        },\n        \"DeveloperOnlyAttribute\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Specifies whether the attribute type is developer only.</p>\",\n          \"box\":true\n        },\n        \"Mutable\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Specifies whether the attribute can be changed once it has been created.</p>\",\n          \"box\":true\n        },\n        \"Required\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Specifies whether a user pool attribute is required. If the attribute is required and the user does not provide a value, registration or sign-in will fail.</p>\",\n          \"box\":true\n        },\n        \"NumberAttributeConstraints\":{\n          \"shape\":\"NumberAttributeConstraintsType\",\n          \"documentation\":\"<p>Specifies the constraints for an attribute of the number type.</p>\"\n        },\n        \"StringAttributeConstraints\":{\n          \"shape\":\"StringAttributeConstraintsType\",\n          \"documentation\":\"<p>Specifies the constraints for an attribute of the string type.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Contains information about the schema attribute.</p>\"\n    },\n    \"SchemaAttributesListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"SchemaAttributeType\"},\n      \"max\":50,\n      \"min\":1\n    },\n    \"ScopeDoesNotExistException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"ScopeListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ScopeType\"},\n      \"max\":25\n    },\n    \"ScopeType\":{\n      \"type\":\"string\",\n      \"max\":256,\n      \"min\":1,\n      \"pattern\":\"[\\\\x21\\\\x23-\\\\x5B\\\\x5D-\\\\x7E]+\"\n    },\n    \"SearchPaginationTokenType\":{\n      \"type\":\"string\",\n      \"min\":1,\n      \"pattern\":\"[\\\\S]+\"\n    },\n    \"SearchedAttributeNamesListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"AttributeNameType\"}\n    },\n    \"SecretCodeType\":{\n      \"type\":\"string\",\n      \"min\":16,\n      \"pattern\":\"[A-Za-z0-9]+\",\n      \"sensitive\":true\n    },\n    \"SecretHashType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\w+=/]+\",\n      \"sensitive\":true\n    },\n    \"SessionType\":{\n      \"type\":\"string\",\n      \"max\":2048,\n      \"min\":20\n    },\n    \"SetRiskConfigurationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ClientId\":{\"shape\":\"ClientIdType\"},\n        \"CompromisedCredentialsRiskConfiguration\":{\"shape\":\"CompromisedCredentialsRiskConfigurationType\"},\n        \"BotRiskConfiguration\":{\"shape\":\"BotRiskConfigurationType\"},\n        \"AccountTakeoverRiskConfiguration\":{\"shape\":\"AccountTakeoverRiskConfigurationType\"},\n        \"RiskExceptionConfiguration\":{\"shape\":\"RiskExceptionConfigurationType\"}\n      }\n    },\n    \"SetRiskConfigurationResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"RiskConfiguration\"],\n      \"members\":{\n        \"RiskConfiguration\":{\"shape\":\"RiskConfigurationType\"}\n      }\n    },\n    \"SetUICustomizationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ClientId\":{\"shape\":\"ClientIdType\"},\n        \"CSS\":{\"shape\":\"CSSType\"},\n        \"ImageFile\":{\"shape\":\"ImageFileType\"}\n      }\n    },\n    \"SetUICustomizationResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"UICustomization\"],\n      \"members\":{\n        \"UICustomization\":{\"shape\":\"UICustomizationType\"}\n      }\n    },\n    \"SetUserMFAPreferenceRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"AccessToken\"],\n      \"members\":{\n        \"SMSMfaSettings\":{\"shape\":\"SMSMfaSettingsType\"},\n        \"SoftwareTokenMfaSettings\":{\"shape\":\"SoftwareTokenMfaSettingsType\"},\n        \"AccessToken\":{\"shape\":\"TokenModelType\"}\n      }\n    },\n    \"SetUserMFAPreferenceResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"SetUserPoolMfaConfigRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"SmsMfaConfiguration\":{\"shape\":\"SmsMfaConfigType\"},\n        \"SoftwareTokenMfaConfiguration\":{\"shape\":\"SoftwareTokenMfaConfigType\"},\n        \"MfaConfiguration\":{\"shape\":\"UserPoolMfaType\"}\n      }\n    },\n    \"SetUserPoolMfaConfigResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SmsMfaConfiguration\":{\"shape\":\"SmsMfaConfigType\"},\n        \"SoftwareTokenMfaConfiguration\":{\"shape\":\"SoftwareTokenMfaConfigType\"},\n        \"MfaConfiguration\":{\"shape\":\"UserPoolMfaType\"}\n      }\n    },\n    \"SetUserPoolUIConfigurationRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Details\":{\"shape\":\"UIDetailsMapType\"}\n      }\n    },\n    \"SetUserPoolUIConfigurationResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolUIConfiguration\"],\n      \"members\":{\n        \"UserPoolUIConfiguration\":{\"shape\":\"UserPoolUIConfigurationType\"}\n      }\n    },\n    \"SetUserSettingsRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"AccessToken\",\n        \"MFAOptions\"\n      ],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token for the set user settings request.</p>\"\n        },\n        \"MFAOptions\":{\n          \"shape\":\"MFAOptionListType\",\n          \"documentation\":\"<p>Specifies the options for MFA (e.g., email or phone number).</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to set user settings.</p>\"\n    },\n    \"SetUserSettingsResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The response from the server for a set user settings request.</p>\"\n    },\n    \"SignUpRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"ClientId\",\n        \"Username\",\n        \"Password\"\n      ],\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"SecretHash\":{\n          \"shape\":\"SecretHashType\",\n          \"documentation\":\"<p>A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.</p>\"\n        },\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to register.</p>\"\n        },\n        \"Password\":{\n          \"shape\":\"PasswordType\",\n          \"documentation\":\"<p>The password of the user you wish to register.</p>\"\n        },\n        \"UserAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>An array of name-value pairs representing user attributes.</p>\"\n        },\n        \"ValidationData\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>The validation data in the request to register a user.</p>\"\n        },\n        \"AnalyticsMetadata\":{\"shape\":\"AnalyticsMetadataType\"},\n        \"UserContextData\":{\"shape\":\"UserContextDataType\"}\n      },\n      \"documentation\":\"<p>Represents the request to register a user.</p>\"\n    },\n    \"SignUpResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserConfirmed\",\n        \"UserSub\"\n      ],\n      \"members\":{\n        \"UserConfirmed\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>A response from the server indicating that a user registration has been confirmed.</p>\"\n        },\n        \"CodeDeliveryDetails\":{\n          \"shape\":\"CodeDeliveryDetailsType\",\n          \"documentation\":\"<p>The code delivery details returned by the server response to the user registration request.</p>\"\n        },\n        \"UserSub\":{\"shape\":\"StringType\"}\n      },\n      \"documentation\":\"<p>The response from the server for a registration request.</p>\"\n    },\n    \"SkippedIPRangeListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"StringType\"},\n      \"max\":20\n    },\n    \"SmsConfigurationType\":{\n      \"type\":\"structure\",\n      \"required\":[\"SnsCallerArn\"],\n      \"members\":{\n        \"SnsCallerArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) caller.</p>\"\n        },\n        \"ExternalId\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The external ID.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The SMS configuration type.</p>\"\n    },\n    \"SmsMfaConfigType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SmsAuthenticationMessage\":{\"shape\":\"SmsVerificationMessageType\"},\n        \"SmsConfiguration\":{\"shape\":\"SmsConfigurationType\"}\n      }\n    },\n    \"SmsVerificationMessageType\":{\n      \"type\":\"string\",\n      \"max\":140,\n      \"min\":6,\n      \"pattern\":\".*\\\\{####\\\\}.*\"\n    },\n    \"SoftwareTokenMFANotFoundException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"SoftwareTokenMFAUserCodeType\":{\n      \"type\":\"string\",\n      \"max\":6,\n      \"min\":6,\n      \"pattern\":\"[0-9]+\"\n    },\n    \"SoftwareTokenMfaConfigType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Enabled\":{\"shape\":\"BooleanType\"}\n      }\n    },\n    \"SoftwareTokenMfaSettingsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Enabled\":{\"shape\":\"BooleanType\"},\n        \"PreferredMfa\":{\"shape\":\"BooleanType\"}\n      }\n    },\n    \"StartUserImportJobRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"JobId\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are being imported into.</p>\"\n        },\n        \"JobId\":{\n          \"shape\":\"UserImportJobIdType\",\n          \"documentation\":\"<p>The job ID for the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to start the user import job.</p>\"\n    },\n    \"StartUserImportJobResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserImportJob\":{\n          \"shape\":\"UserImportJobType\",\n          \"documentation\":\"<p>The job object that represents the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to start the user import job.</p>\"\n    },\n    \"StatusType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Enabled\",\n        \"Disabled\"\n      ]\n    },\n    \"StopUserImportJobRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"JobId\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are being imported into.</p>\"\n        },\n        \"JobId\":{\n          \"shape\":\"UserImportJobIdType\",\n          \"documentation\":\"<p>The job ID for the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to stop the user import job.</p>\"\n    },\n    \"StopUserImportJobResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserImportJob\":{\n          \"shape\":\"UserImportJobType\",\n          \"documentation\":\"<p>The job object that represents the user import job.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to stop the user import job.</p>\"\n    },\n    \"StringAttributeConstraintsType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"MinLength\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The minimum length of an attribute value of the string type.</p>\"\n        },\n        \"MaxLength\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The maximum length of an attribute value of the string type.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The type of constraints associated with an attribute of the string type.</p>\"\n    },\n    \"StringType\":{\"type\":\"string\"},\n    \"SupportedIdentityProvidersListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"ProviderNameType\"}\n    },\n    \"TokenModelType\":{\n      \"type\":\"string\",\n      \"pattern\":\"[A-Za-z0-9-_=.]+\",\n      \"sensitive\":true\n    },\n    \"TooManyFailedAttemptsException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service returns a too many failed attempts exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception gets thrown when the user has made too many failed attempts for a given action (e.g., sign in).</p>\",\n      \"exception\":true\n    },\n    \"TooManyRequestsException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service returns a too many requests exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception gets thrown when the user has made too many requests for a given operation.</p>\",\n      \"exception\":true\n    },\n    \"UICustomizationType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ClientId\":{\"shape\":\"ClientIdType\"},\n        \"ImageUrl\":{\"shape\":\"ImageUrlType\"},\n        \"CSS\":{\"shape\":\"CSSType\"},\n        \"CSSVersion\":{\"shape\":\"CSSVersionType\"},\n        \"LastModifiedDate\":{\"shape\":\"DateType\"},\n        \"CreationDate\":{\"shape\":\"DateType\"}\n      }\n    },\n    \"UIDetailsMapType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"UnexpectedLambdaException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service returns an unexpected AWS Lambda exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception gets thrown when the Amazon Cognito service encounters an unexpected exception with the AWS Lambda service.</p>\",\n      \"exception\":true\n    },\n    \"UnsupportedIdentityProviderException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"UnsupportedUserStateException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the user is in an unsupported state.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The request failed because the user is in an unsupported state.</p>\",\n      \"exception\":true\n    },\n    \"UpdateAuthEventFeedbackRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Username\",\n        \"EventId\",\n        \"FeedbackToken\",\n        \"FeedbackValue\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Username\":{\"shape\":\"UsernameType\"},\n        \"EventId\":{\"shape\":\"EventIdType\"},\n        \"FeedbackToken\":{\"shape\":\"TokenModelType\"},\n        \"FeedbackValue\":{\"shape\":\"FeedbackValueType\"}\n      }\n    },\n    \"UpdateAuthEventFeedbackResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      }\n    },\n    \"UpdateDeviceStatusRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"AccessToken\",\n        \"DeviceKey\"\n      ],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token.</p>\"\n        },\n        \"DeviceKey\":{\n          \"shape\":\"DeviceKeyType\",\n          \"documentation\":\"<p>The device key.</p>\"\n        },\n        \"DeviceRememberedStatus\":{\n          \"shape\":\"DeviceRememberedStatusType\",\n          \"documentation\":\"<p>The status of whether a device is remembered.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to update the device status.</p>\"\n    },\n    \"UpdateDeviceStatusResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>The response to the request to update the device status.</p>\"\n    },\n    \"UpdateGroupRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"GroupName\",\n        \"UserPoolId\"\n      ],\n      \"members\":{\n        \"GroupName\":{\n          \"shape\":\"GroupNameType\",\n          \"documentation\":\"<p>The name of the group.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool.</p>\"\n        },\n        \"Description\":{\n          \"shape\":\"DescriptionType\",\n          \"documentation\":\"<p>A string containing the new description of the group.</p>\"\n        },\n        \"RoleArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The new role ARN for the group. This is used for setting the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims in the token.</p>\"\n        },\n        \"Precedence\":{\n          \"shape\":\"PrecedenceType\",\n          \"documentation\":\"<p>The new precedence value for the group. For more information about this parameter, see <a href=\\\"API_CreateGroup.html\\\">CreateGroup</a>.</p>\"\n        }\n      }\n    },\n    \"UpdateGroupResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Group\":{\n          \"shape\":\"GroupType\",\n          \"documentation\":\"<p>The group object for the group.</p>\"\n        }\n      }\n    },\n    \"UpdateIdentityProviderRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ProviderName\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"ProviderName\":{\"shape\":\"ProviderNameType\"},\n        \"ProviderDetails\":{\"shape\":\"ProviderDetailsType\"},\n        \"AttributeMapping\":{\"shape\":\"AttributeMappingType\"},\n        \"IdpIdentifiers\":{\"shape\":\"IdpIdentifiersListType\"}\n      }\n    },\n    \"UpdateIdentityProviderResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"IdentityProvider\"],\n      \"members\":{\n        \"IdentityProvider\":{\"shape\":\"IdentityProviderType\"}\n      }\n    },\n    \"UpdateResourceServerRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"Identifier\",\n        \"Name\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Identifier\":{\"shape\":\"ResourceServerIdentifierType\"},\n        \"Name\":{\"shape\":\"ResourceServerNameType\"},\n        \"Scopes\":{\"shape\":\"ResourceServerScopeListType\"}\n      }\n    },\n    \"UpdateResourceServerResponse\":{\n      \"type\":\"structure\",\n      \"required\":[\"ResourceServer\"],\n      \"members\":{\n        \"ResourceServer\":{\"shape\":\"ResourceServerType\"}\n      }\n    },\n    \"UpdateUserAttributesRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserAttributes\",\n        \"AccessToken\"\n      ],\n      \"members\":{\n        \"UserAttributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>An array of name-value pairs representing user attributes.</p>\"\n        },\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>The access token for the request to update user attributes.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to update user attributes.</p>\"\n    },\n    \"UpdateUserAttributesResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"CodeDeliveryDetailsList\":{\n          \"shape\":\"CodeDeliveryDetailsListType\",\n          \"documentation\":\"<p>The code delivery details list from the server for the request to update user attributes.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server for the request to update user attributes.</p>\"\n    },\n    \"UpdateUserPoolClientRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"UserPoolId\",\n        \"ClientId\"\n      ],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to update the user pool client.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"ClientName\":{\n          \"shape\":\"ClientNameType\",\n          \"documentation\":\"<p>The client name from the update user pool client request.</p>\"\n        },\n        \"RefreshTokenValidity\":{\n          \"shape\":\"RefreshTokenValidityType\",\n          \"documentation\":\"<p>The time limit, in days, after which the refresh token is no longer valid and cannot be used.</p>\"\n        },\n        \"ReadAttributes\":{\n          \"shape\":\"ClientPermissionListType\",\n          \"documentation\":\"<p>The read-only attributes of the user pool.</p>\"\n        },\n        \"WriteAttributes\":{\n          \"shape\":\"ClientPermissionListType\",\n          \"documentation\":\"<p>The writeable attributes of the user pool.</p>\"\n        },\n        \"ExplicitAuthFlows\":{\n          \"shape\":\"ExplicitAuthFlowsListType\",\n          \"documentation\":\"<p>Explicit authentication flows.</p>\"\n        },\n        \"SupportedIdentityProviders\":{\"shape\":\"SupportedIdentityProvidersListType\"},\n        \"CallbackURLs\":{\"shape\":\"CallbackURLsListType\"},\n        \"LogoutURLs\":{\"shape\":\"LogoutURLsListType\"},\n        \"DefaultRedirectURI\":{\"shape\":\"RedirectUrlType\"},\n        \"AllowedOAuthFlows\":{\"shape\":\"OAuthFlowsType\"},\n        \"AllowedOAuthScopes\":{\"shape\":\"ScopeListType\"},\n        \"AllowedOAuthFlowsUserPoolClient\":{\"shape\":\"BooleanType\"},\n        \"AnalyticsConfiguration\":{\"shape\":\"AnalyticsConfigurationType\"}\n      },\n      \"documentation\":\"<p>Represents the request to update the user pool client.</p>\"\n    },\n    \"UpdateUserPoolClientResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolClient\":{\n          \"shape\":\"UserPoolClientType\",\n          \"documentation\":\"<p>The user pool client value from the response from the server when an update user pool client request is made.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the response from the server to the request to update the user pool client.</p>\"\n    },\n    \"UpdateUserPoolRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserPoolId\"],\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool you want to update.</p>\"\n        },\n        \"Policies\":{\n          \"shape\":\"UserPoolPolicyType\",\n          \"documentation\":\"<p>A container with the policies you wish to update in a user pool.</p>\"\n        },\n        \"LambdaConfig\":{\n          \"shape\":\"LambdaConfigType\",\n          \"documentation\":\"<p>The AWS Lambda configuration information from the request to update the user pool.</p>\"\n        },\n        \"AutoVerifiedAttributes\":{\n          \"shape\":\"VerifiedAttributesListType\",\n          \"documentation\":\"<p>The attributes that are automatically verified when the Amazon Cognito service makes a request to update user pools.</p>\"\n        },\n        \"SmsVerificationMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>A container with information about the SMS verification message.</p>\"\n        },\n        \"EmailVerificationMessage\":{\n          \"shape\":\"EmailVerificationMessageType\",\n          \"documentation\":\"<p>The contents of the email verification message.</p>\"\n        },\n        \"EmailVerificationSubject\":{\n          \"shape\":\"EmailVerificationSubjectType\",\n          \"documentation\":\"<p>The subject of the email verification message.</p>\"\n        },\n        \"VerificationMessageTemplate\":{\"shape\":\"VerificationMessageTemplateType\"},\n        \"SmsAuthenticationMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>The contents of the SMS authentication message.</p>\"\n        },\n        \"MfaConfiguration\":{\n          \"shape\":\"UserPoolMfaType\",\n          \"documentation\":\"<p>Can be one of the following values:</p> <ul> <li> <p> <code>OFF</code> - MFA tokens are not required and cannot be specified during user registration.</p> </li> <li> <p> <code>ON</code> - MFA tokens are required for all user registrations. You can only specify required when you are initially creating a user pool.</p> </li> <li> <p> <code>OPTIONAL</code> - Users have the option when registering to create an MFA token.</p> </li> </ul>\"\n        },\n        \"DeviceConfiguration\":{\n          \"shape\":\"DeviceConfigurationType\",\n          \"documentation\":\"<p>Device configuration.</p>\"\n        },\n        \"EmailConfiguration\":{\n          \"shape\":\"EmailConfigurationType\",\n          \"documentation\":\"<p>Email configuration.</p>\"\n        },\n        \"SmsConfiguration\":{\n          \"shape\":\"SmsConfigurationType\",\n          \"documentation\":\"<p>SMS configuration.</p>\"\n        },\n        \"UserPoolTags\":{\n          \"shape\":\"UserPoolTagsType\",\n          \"documentation\":\"<p>The cost allocation tags for the user pool. For more information, see <a href=\\\"http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-cost-allocation-tagging.html\\\">Adding Cost Allocation Tags to Your User Pool</a> </p>\"\n        },\n        \"AdminCreateUserConfig\":{\n          \"shape\":\"AdminCreateUserConfigType\",\n          \"documentation\":\"<p>The configuration for AdminCreateUser requests.</p>\"\n        },\n        \"UserPoolAddOns\":{\"shape\":\"UserPoolAddOnsType\"}\n      },\n      \"documentation\":\"<p>Represents the request to update the user pool.</p>\"\n    },\n    \"UpdateUserPoolResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>Represents the response from the server when you make a request to update the user pool.</p>\"\n    },\n    \"UserContextDataType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"encodedData\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"UserFilterType\":{\n      \"type\":\"string\",\n      \"max\":256\n    },\n    \"UserImportInProgressException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the user pool has an import job running.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when you are trying to modify a user pool while a user import job is in progress for that pool.</p>\",\n      \"exception\":true\n    },\n    \"UserImportJobIdType\":{\n      \"type\":\"string\",\n      \"max\":55,\n      \"min\":1,\n      \"pattern\":\"import-[0-9a-zA-Z-]+\"\n    },\n    \"UserImportJobNameType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\w\\\\s+=,.@-]+\"\n    },\n    \"UserImportJobStatusType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"Created\",\n        \"Pending\",\n        \"InProgress\",\n        \"Stopping\",\n        \"Expired\",\n        \"Stopped\",\n        \"Failed\",\n        \"Succeeded\"\n      ]\n    },\n    \"UserImportJobType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"JobName\":{\n          \"shape\":\"UserImportJobNameType\",\n          \"documentation\":\"<p>The job name for the user import job.</p>\"\n        },\n        \"JobId\":{\n          \"shape\":\"UserImportJobIdType\",\n          \"documentation\":\"<p>The job ID for the user import job.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool that the users are being imported into.</p>\"\n        },\n        \"PreSignedUrl\":{\n          \"shape\":\"PreSignedUrlType\",\n          \"documentation\":\"<p>The pre-signed URL to be used to upload the .csv file.</p>\"\n        },\n        \"CreationDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date when the user import job was created.</p>\"\n        },\n        \"StartDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date when the user import job was started.</p>\"\n        },\n        \"CompletionDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The date when the user import job was completed.</p>\"\n        },\n        \"Status\":{\n          \"shape\":\"UserImportJobStatusType\",\n          \"documentation\":\"<p>The status of the user import job. One of the following:</p> <ul> <li> <p>Created - The job was created but not started.</p> </li> <li> <p>Pending - A transition state. You have started the job, but it has not begun importing users yet.</p> </li> <li> <p>InProgress - The job has started, and users are being imported.</p> </li> <li> <p>Stopping - You have stopped the job, but the job has not stopped importing users yet.</p> </li> <li> <p>Stopped - You have stopped the job, and the job has stopped importing users.</p> </li> <li> <p>Succeeded - The job has completed successfully.</p> </li> <li> <p>Failed - The job has stopped due to an error.</p> </li> <li> <p>Expired - You created a job, but did not start the job within 24-48 hours. All data associated with the job was deleted, and the job cannot be started.</p> </li> </ul>\"\n        },\n        \"CloudWatchLogsRoleArn\":{\n          \"shape\":\"ArnType\",\n          \"documentation\":\"<p>The role ARN for the Amazon CloudWatch Logging role for the user import job. For more information, see \\\"Creating the CloudWatch Logs IAM Role\\\" in the Amazon Cognito Developer Guide.</p>\"\n        },\n        \"ImportedUsers\":{\n          \"shape\":\"LongType\",\n          \"documentation\":\"<p>The number of users that were successfully imported.</p>\"\n        },\n        \"SkippedUsers\":{\n          \"shape\":\"LongType\",\n          \"documentation\":\"<p>The number of users that were skipped.</p>\"\n        },\n        \"FailedUsers\":{\n          \"shape\":\"LongType\",\n          \"documentation\":\"<p>The number of users that could not be imported.</p>\"\n        },\n        \"CompletionMessage\":{\n          \"shape\":\"CompletionMessageType\",\n          \"documentation\":\"<p>The message returned when the user import job is completed.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The user import job type.</p>\"\n    },\n    \"UserImportJobsListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"UserImportJobType\"},\n      \"max\":50,\n      \"min\":1\n    },\n    \"UserLambdaValidationException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when the Amazon Cognito service returns a user validation exception with the AWS Lambda service.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception gets thrown when the Amazon Cognito service encounters a user validation exception with the AWS Lambda service.</p>\",\n      \"exception\":true\n    },\n    \"UserNotConfirmedException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when a user is not confirmed successfully.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a user is not confirmed successfully.</p>\",\n      \"exception\":true\n    },\n    \"UserNotFoundException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when a user is not found.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when a user is not found.</p>\",\n      \"exception\":true\n    },\n    \"UserPoolAddOnNotEnabledException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"exception\":true\n    },\n    \"UserPoolAddOnsType\":{\n      \"type\":\"structure\",\n      \"required\":[\"AdvancedSecurityMode\"],\n      \"members\":{\n        \"AdvancedSecurityMode\":{\"shape\":\"AdvancedSecurityModeType\"}\n      }\n    },\n    \"UserPoolClientDescription\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool where you want to describe the user pool client.</p>\"\n        },\n        \"ClientName\":{\n          \"shape\":\"ClientNameType\",\n          \"documentation\":\"<p>The client name from the user pool client description.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The description of the user pool client.</p>\"\n    },\n    \"UserPoolClientListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"UserPoolClientDescription\"}\n    },\n    \"UserPoolClientType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The user pool ID for the user pool client.</p>\"\n        },\n        \"ClientName\":{\n          \"shape\":\"ClientNameType\",\n          \"documentation\":\"<p>The client name from the user pool request of the client type.</p>\"\n        },\n        \"ClientId\":{\n          \"shape\":\"ClientIdType\",\n          \"documentation\":\"<p>The ID of the client associated with the user pool.</p>\"\n        },\n        \"ClientSecret\":{\n          \"shape\":\"ClientSecretType\",\n          \"documentation\":\"<p>The client secret from the user pool request of the client type.</p>\"\n        },\n        \"LastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The last modified date from the user pool request of the client type.</p>\"\n        },\n        \"CreationDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The creation date from the user pool request of the client type.</p>\"\n        },\n        \"RefreshTokenValidity\":{\n          \"shape\":\"RefreshTokenValidityType\",\n          \"documentation\":\"<p>The time limit, in days, after which the refresh token is no longer valid and cannot be used.</p>\"\n        },\n        \"ReadAttributes\":{\n          \"shape\":\"ClientPermissionListType\",\n          \"documentation\":\"<p>The Read-only attributes.</p>\"\n        },\n        \"WriteAttributes\":{\n          \"shape\":\"ClientPermissionListType\",\n          \"documentation\":\"<p>The writeable attributes.</p>\"\n        },\n        \"ExplicitAuthFlows\":{\n          \"shape\":\"ExplicitAuthFlowsListType\",\n          \"documentation\":\"<p>The explicit authentication flows.</p>\"\n        },\n        \"SupportedIdentityProviders\":{\"shape\":\"SupportedIdentityProvidersListType\"},\n        \"CallbackURLs\":{\"shape\":\"CallbackURLsListType\"},\n        \"LogoutURLs\":{\"shape\":\"LogoutURLsListType\"},\n        \"DefaultRedirectURI\":{\"shape\":\"RedirectUrlType\"},\n        \"AllowedOAuthFlows\":{\"shape\":\"OAuthFlowsType\"},\n        \"AllowedOAuthScopes\":{\"shape\":\"ScopeListType\"},\n        \"AllowedOAuthFlowsUserPoolClient\":{\n          \"shape\":\"BooleanType\",\n          \"box\":true\n        },\n        \"AnalyticsConfiguration\":{\"shape\":\"AnalyticsConfigurationType\"}\n      },\n      \"documentation\":\"<p>A user pool of the client type.</p>\"\n    },\n    \"UserPoolDescriptionType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Id\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The ID in a user pool description.</p>\"\n        },\n        \"Name\":{\n          \"shape\":\"UserPoolNameType\",\n          \"documentation\":\"<p>The name in a user pool description.</p>\"\n        },\n        \"LambdaConfig\":{\n          \"shape\":\"LambdaConfigType\",\n          \"documentation\":\"<p>The AWS Lambda configuration information in a user pool description.</p>\"\n        },\n        \"Status\":{\n          \"shape\":\"StatusType\",\n          \"documentation\":\"<p>The user pool status in a user pool description.</p>\"\n        },\n        \"LastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The last modified date in a user pool description.</p>\"\n        },\n        \"CreationDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The creation date in a user pool description.</p>\"\n        }\n      },\n      \"documentation\":\"<p>A user pool description.</p>\"\n    },\n    \"UserPoolIdType\":{\n      \"type\":\"string\",\n      \"max\":55,\n      \"min\":1,\n      \"pattern\":\"[\\\\w-]+_[0-9a-zA-Z]+\"\n    },\n    \"UserPoolListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"UserPoolDescriptionType\"}\n    },\n    \"UserPoolMfaType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"OFF\",\n        \"ON\",\n        \"OPTIONAL\"\n      ]\n    },\n    \"UserPoolNameType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\w\\\\s+=,.@-]+\"\n    },\n    \"UserPoolPolicyType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"PasswordPolicy\":{\n          \"shape\":\"PasswordPolicyType\",\n          \"documentation\":\"<p>A container with information about the user pool password policy.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The type of policy in a user pool.</p>\"\n    },\n    \"UserPoolTaggingException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\"shape\":\"MessageType\"}\n      },\n      \"documentation\":\"<p>This exception gets thrown when a user pool tag cannot be set or updated.</p>\",\n      \"exception\":true\n    },\n    \"UserPoolTagsType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"StringType\"}\n    },\n    \"UserPoolType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Id\":{\n          \"shape\":\"UserPoolIdType\",\n          \"documentation\":\"<p>The ID of the user pool.</p>\"\n        },\n        \"Name\":{\n          \"shape\":\"UserPoolNameType\",\n          \"documentation\":\"<p>The name of the user pool.</p>\"\n        },\n        \"Policies\":{\n          \"shape\":\"UserPoolPolicyType\",\n          \"documentation\":\"<p>A container describing the policies associated with a user pool.</p>\"\n        },\n        \"LambdaConfig\":{\n          \"shape\":\"LambdaConfigType\",\n          \"documentation\":\"<p>A container describing the AWS Lambda triggers associated with a user pool.</p>\"\n        },\n        \"Status\":{\n          \"shape\":\"StatusType\",\n          \"documentation\":\"<p>The status of a user pool.</p>\"\n        },\n        \"LastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The last modified date of a user pool.</p>\"\n        },\n        \"CreationDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The creation date of a user pool.</p>\"\n        },\n        \"SchemaAttributes\":{\n          \"shape\":\"SchemaAttributesListType\",\n          \"documentation\":\"<p>A container with the schema attributes of a user pool.</p>\"\n        },\n        \"AutoVerifiedAttributes\":{\n          \"shape\":\"VerifiedAttributesListType\",\n          \"documentation\":\"<p>Specifies the attributes that are auto-verified in a user pool.</p>\"\n        },\n        \"AliasAttributes\":{\n          \"shape\":\"AliasAttributesListType\",\n          \"documentation\":\"<p>Specifies the attributes that are aliased in a user pool.</p>\"\n        },\n        \"UsernameAttributes\":{\"shape\":\"UsernameAttributesListType\"},\n        \"SmsVerificationMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>The contents of the SMS verification message.</p>\"\n        },\n        \"EmailVerificationMessage\":{\n          \"shape\":\"EmailVerificationMessageType\",\n          \"documentation\":\"<p>The contents of the email verification message.</p>\"\n        },\n        \"EmailVerificationSubject\":{\n          \"shape\":\"EmailVerificationSubjectType\",\n          \"documentation\":\"<p>The subject of the email verification message.</p>\"\n        },\n        \"VerificationMessageTemplate\":{\"shape\":\"VerificationMessageTemplateType\"},\n        \"SmsAuthenticationMessage\":{\n          \"shape\":\"SmsVerificationMessageType\",\n          \"documentation\":\"<p>The contents of the SMS authentication message.</p>\"\n        },\n        \"MfaConfiguration\":{\n          \"shape\":\"UserPoolMfaType\",\n          \"documentation\":\"<p>Can be one of the following values:</p> <ul> <li> <p> <code>OFF</code> - MFA tokens are not required and cannot be specified during user registration.</p> </li> <li> <p> <code>ON</code> - MFA tokens are required for all user registrations. You can only specify required when you are initially creating a user pool.</p> </li> <li> <p> <code>OPTIONAL</code> - Users have the option when registering to create an MFA token.</p> </li> </ul>\"\n        },\n        \"DeviceConfiguration\":{\n          \"shape\":\"DeviceConfigurationType\",\n          \"documentation\":\"<p>The device configuration.</p>\"\n        },\n        \"EstimatedNumberOfUsers\":{\n          \"shape\":\"IntegerType\",\n          \"documentation\":\"<p>A number estimating the size of the user pool.</p>\"\n        },\n        \"EmailConfiguration\":{\n          \"shape\":\"EmailConfigurationType\",\n          \"documentation\":\"<p>The email configuration.</p>\"\n        },\n        \"SmsConfiguration\":{\n          \"shape\":\"SmsConfigurationType\",\n          \"documentation\":\"<p>The SMS configuration.</p>\"\n        },\n        \"UserPoolTags\":{\n          \"shape\":\"UserPoolTagsType\",\n          \"documentation\":\"<p>The cost allocation tags for the user pool. For more information, see <a href=\\\"http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-cost-allocation-tagging.html\\\">Adding Cost Allocation Tags to Your User Pool</a> </p>\"\n        },\n        \"SmsConfigurationFailure\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The reason why the SMS configuration cannot send the message(s) to your users.</p>\"\n        },\n        \"EmailConfigurationFailure\":{\n          \"shape\":\"StringType\",\n          \"documentation\":\"<p>The reason why the email configuration cannot send the messages to your users.</p>\"\n        },\n        \"AdminCreateUserConfig\":{\n          \"shape\":\"AdminCreateUserConfigType\",\n          \"documentation\":\"<p>The configuration for AdminCreateUser requests.</p>\"\n        },\n        \"UserPoolAddOns\":{\"shape\":\"UserPoolAddOnsType\"}\n      },\n      \"documentation\":\"<p>A container with information about the user pool type.</p>\"\n    },\n    \"UserPoolUIConfigurationType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"UserPoolId\":{\"shape\":\"UserPoolIdType\"},\n        \"Details\":{\"shape\":\"UserPoolUIDetailsType\"},\n        \"LastModifiedDate\":{\"shape\":\"DateType\"},\n        \"CreationDate\":{\"shape\":\"DateType\"}\n      }\n    },\n    \"UserPoolUIDetailsType\":{\n      \"type\":\"map\",\n      \"key\":{\"shape\":\"StringType\"},\n      \"value\":{\"shape\":\"UIDetailsMapType\"}\n    },\n    \"UserStatusType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"UNCONFIRMED\",\n        \"CONFIRMED\",\n        \"ARCHIVED\",\n        \"COMPROMISED\",\n        \"UNKNOWN\",\n        \"RESET_REQUIRED\",\n        \"FORCE_CHANGE_PASSWORD\"\n      ]\n    },\n    \"UserType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Username\":{\n          \"shape\":\"UsernameType\",\n          \"documentation\":\"<p>The user name of the user you wish to describe.</p>\"\n        },\n        \"Attributes\":{\n          \"shape\":\"AttributeListType\",\n          \"documentation\":\"<p>A container with information about the user type attributes.</p>\"\n        },\n        \"UserCreateDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The creation date of the user.</p>\"\n        },\n        \"UserLastModifiedDate\":{\n          \"shape\":\"DateType\",\n          \"documentation\":\"<p>The last modified date of the user.</p>\"\n        },\n        \"Enabled\":{\n          \"shape\":\"BooleanType\",\n          \"documentation\":\"<p>Specifies whether the user is enabled.</p>\"\n        },\n        \"UserStatus\":{\n          \"shape\":\"UserStatusType\",\n          \"documentation\":\"<p>The user status. Can be one of the following:</p> <ul> <li> <p>UNCONFIRMED - User has been created but not confirmed.</p> </li> <li> <p>CONFIRMED - User has been confirmed.</p> </li> <li> <p>ARCHIVED - User is no longer active.</p> </li> <li> <p>COMPROMISED - User is disabled due to a potential security threat.</p> </li> <li> <p>UNKNOWN - User status is not known.</p> </li> </ul>\"\n        },\n        \"MFAOptions\":{\n          \"shape\":\"MFAOptionListType\",\n          \"documentation\":\"<p>The MFA options for the user.</p>\"\n        }\n      },\n      \"documentation\":\"<p>The user type.</p>\"\n    },\n    \"UsernameAttributeType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"phone_number\",\n        \"email\"\n      ]\n    },\n    \"UsernameAttributesListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"UsernameAttributeType\"}\n    },\n    \"UsernameExistsException\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"message\":{\n          \"shape\":\"MessageType\",\n          \"documentation\":\"<p>The message returned when Amazon Cognito throws a user name exists exception.</p>\"\n        }\n      },\n      \"documentation\":\"<p>This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.</p>\",\n      \"exception\":true\n    },\n    \"UsernameType\":{\n      \"type\":\"string\",\n      \"max\":128,\n      \"min\":1,\n      \"pattern\":\"[\\\\p{L}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}]+\",\n      \"sensitive\":true\n    },\n    \"UsersListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"UserType\"}\n    },\n    \"VerificationMessageTemplateType\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"SmsMessage\":{\"shape\":\"SmsVerificationMessageType\"},\n        \"EmailMessage\":{\"shape\":\"EmailVerificationMessageType\"},\n        \"EmailSubject\":{\"shape\":\"EmailVerificationSubjectType\"},\n        \"EmailMessageByLink\":{\"shape\":\"EmailVerificationMessageByLinkType\"},\n        \"EmailSubjectByLink\":{\"shape\":\"EmailVerificationSubjectByLinkType\"},\n        \"DefaultEmailOption\":{\"shape\":\"DefaultEmailOptionType\"}\n      }\n    },\n    \"VerifiedAttributeType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"phone_number\",\n        \"email\"\n      ]\n    },\n    \"VerifiedAttributesListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"VerifiedAttributeType\"}\n    },\n    \"VerifySoftwareTokenRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\"UserCode\"],\n      \"members\":{\n        \"AccessToken\":{\"shape\":\"TokenModelType\"},\n        \"Session\":{\"shape\":\"SessionType\"},\n        \"UserCode\":{\"shape\":\"SoftwareTokenMFAUserCodeType\"},\n        \"FriendlyDeviceName\":{\"shape\":\"StringType\"}\n      }\n    },\n    \"VerifySoftwareTokenResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n        \"Status\":{\"shape\":\"VerifySoftwareTokenResponseType\"},\n        \"Session\":{\"shape\":\"SessionType\"}\n      }\n    },\n    \"VerifySoftwareTokenResponseType\":{\n      \"type\":\"string\",\n      \"enum\":[\n        \"SUCCESS\",\n        \"ERROR\"\n      ]\n    },\n    \"VerifyUserAttributeRequest\":{\n      \"type\":\"structure\",\n      \"required\":[\n        \"AccessToken\",\n        \"AttributeName\",\n        \"Code\"\n      ],\n      \"members\":{\n        \"AccessToken\":{\n          \"shape\":\"TokenModelType\",\n          \"documentation\":\"<p>Represents the access token of the request to verify user attributes.</p>\"\n        },\n        \"AttributeName\":{\n          \"shape\":\"AttributeNameType\",\n          \"documentation\":\"<p>The attribute name in the request to verify user attributes.</p>\"\n        },\n        \"Code\":{\n          \"shape\":\"ConfirmationCodeType\",\n          \"documentation\":\"<p>The verification code in the request to verify user attributes.</p>\"\n        }\n      },\n      \"documentation\":\"<p>Represents the request to verify user attributes.</p>\"\n    },\n    \"VerifyUserAttributeResponse\":{\n      \"type\":\"structure\",\n      \"members\":{\n      },\n      \"documentation\":\"<p>A container representing the response from the server from the request to verify user attributes.</p>\"\n    },\n    \"openIdListType\":{\n      \"type\":\"list\",\n      \"member\":{\"shape\":\"StringType\"}\n    },\n    \"openIdUrlType\":{\n      \"type\":\"string\",\n      \"max\":150,\n      \"min\":1,\n      \"pattern\":\"https://cognito-idp\\\\.amazonaws\\\\.com/[\\\\w\\\\._/-]\"\n    }\n  },\n  \"documentation\":\"<p>Using the Amazon Cognito Your User Pools API, you can create a user pool to manage directories and users. You can authenticate a user to obtain tokens related to user identity and access policies.</p> <p>This API reference provides information about user pools in Amazon Cognito Your User Pools.</p> <p>For more information, see the Amazon Cognito Documentation.</p>\"\n}\n},{}],3:[function(require,module,exports){\nmodule.exports={\n  \"acm\": {\n    \"name\": \"ACM\",\n    \"cors\": true\n  },\n  \"apigateway\": {\n    \"name\": \"APIGateway\",\n    \"cors\": true\n  },\n  \"applicationautoscaling\": {\n    \"prefix\": \"application-autoscaling\",\n    \"name\": \"ApplicationAutoScaling\",\n    \"cors\": true\n  },\n  \"autoscaling\": {\n    \"name\": \"AutoScaling\",\n    \"cors\": true\n  },\n  \"cloudformation\": {\n    \"name\": \"CloudFormation\",\n    \"cors\": true\n  },\n  \"cloudfront\": {\n    \"name\": \"CloudFront\",\n    \"versions\": [\"2013-05-12*\", \"2013-11-11*\", \"2014-05-31*\", \"2014-10-21*\", \"2014-11-06*\", \"2015-04-17*\", \"2015-07-27*\", \"2015-09-17*\", \"2016-01-13*\", \"2016-01-28*\", \"2016-08-01*\", \"2016-08-20*\"],\n    \"cors\": true\n  },\n  \"cloudhsm\": {\n    \"name\": \"CloudHSM\",\n    \"cors\": true\n  },\n  \"cloudsearch\": {\n    \"name\": \"CloudSearch\"\n  },\n  \"cloudsearchdomain\": {\n    \"name\": \"CloudSearchDomain\"\n  },\n  \"cloudtrail\": {\n    \"name\": \"CloudTrail\",\n    \"cors\": true\n  },\n  \"cloudwatch\": {\n    \"prefix\": \"monitoring\",\n    \"name\": \"CloudWatch\",\n    \"cors\": true\n  },\n  \"cloudwatchevents\": {\n    \"prefix\": \"events\",\n    \"name\": \"CloudWatchEvents\",\n    \"versions\": [\"2014-02-03*\"],\n    \"cors\": true\n  },\n  \"cloudwatchlogs\": {\n    \"prefix\": \"logs\",\n    \"name\": \"CloudWatchLogs\",\n    \"cors\": true\n  },\n  \"codecommit\": {\n    \"name\": \"CodeCommit\",\n    \"cors\": true\n  },\n  \"codedeploy\": {\n    \"name\": \"CodeDeploy\",\n    \"cors\": true\n  },\n  \"codepipeline\": {\n    \"name\": \"CodePipeline\",\n    \"cors\": true\n  },\n  \"cognitoidentity\": {\n    \"prefix\": \"cognito-identity\",\n    \"name\": \"CognitoIdentity\",\n    \"cors\": true\n  },\n  \"cognitoidentityserviceprovider\": {\n    \"prefix\": \"cognito-idp\",\n    \"name\": \"CognitoIdentityServiceProvider\",\n    \"cors\": true\n  },\n  \"cognitosync\": {\n    \"prefix\": \"cognito-sync\",\n    \"name\": \"CognitoSync\",\n    \"cors\": true\n  },\n  \"configservice\": {\n    \"prefix\": \"config\",\n    \"name\": \"ConfigService\",\n    \"cors\": true\n  },\n  \"datapipeline\": {\n    \"name\": \"DataPipeline\"\n  },\n  \"devicefarm\": {\n    \"name\": \"DeviceFarm\",\n    \"cors\": true\n  },\n  \"directconnect\": {\n    \"name\": \"DirectConnect\",\n    \"cors\": true\n  },\n  \"directoryservice\": {\n    \"prefix\": \"ds\",\n    \"name\": \"DirectoryService\"\n  },\n  \"discovery\": {\n    \"name\": \"Discovery\"\n  },\n  \"dms\": {\n    \"name\": \"DMS\"\n  },\n  \"dynamodb\": {\n    \"name\": \"DynamoDB\",\n    \"cors\": true\n  },\n  \"dynamodbstreams\": {\n    \"prefix\": \"streams.dynamodb\",\n    \"name\": \"DynamoDBStreams\",\n    \"cors\": true\n  },\n  \"ec2\": {\n    \"name\": \"EC2\",\n    \"versions\": [\"2013-06-15*\", \"2013-10-15*\", \"2014-02-01*\", \"2014-05-01*\", \"2014-06-15*\", \"2014-09-01*\", \"2014-10-01*\", \"2015-03-01*\", \"2015-04-15*\", \"2015-10-01*\"],\n    \"cors\": true\n  },\n  \"ecr\": {\n    \"name\": \"ECR\",\n    \"cors\": true\n  },\n  \"ecs\": {\n    \"name\": \"ECS\",\n    \"cors\": true\n  },\n  \"efs\": {\n    \"prefix\": \"elasticfilesystem\",\n    \"name\": \"EFS\"\n  },\n  \"elasticache\": {\n    \"name\": \"ElastiCache\",\n    \"versions\": [\"2012-11-15*\", \"2014-03-24*\", \"2014-07-15*\", \"2014-09-30*\"],\n    \"cors\": true\n  },\n  \"elasticbeanstalk\": {\n    \"name\": \"ElasticBeanstalk\",\n    \"cors\": true\n  },\n  \"elb\": {\n    \"prefix\": \"elasticloadbalancing\",\n    \"name\": \"ELB\",\n    \"cors\": true\n  },\n  \"elbv2\": {\n    \"prefix\": \"elasticloadbalancingv2\",\n    \"name\": \"ELBv2\",\n    \"cors\": true\n  },\n  \"emr\": {\n    \"prefix\": \"elasticmapreduce\",\n    \"name\": \"EMR\",\n    \"cors\": true\n  },\n  \"es\": {\n    \"name\": \"ES\"\n  },\n  \"elastictranscoder\": {\n    \"name\": \"ElasticTranscoder\",\n    \"cors\": true\n  },\n  \"firehose\": {\n    \"name\": \"Firehose\",\n    \"cors\": true\n  },\n  \"gamelift\": {\n    \"name\": \"GameLift\",\n    \"cors\": true\n  },\n  \"glacier\": {\n    \"name\": \"Glacier\"\n  },\n  \"iam\": {\n    \"name\": \"IAM\"\n  },\n  \"importexport\": {\n    \"name\": \"ImportExport\"\n  },\n  \"inspector\": {\n    \"name\": \"Inspector\",\n    \"versions\": [\"2015-08-18*\"],\n    \"cors\": true\n  },\n  \"iot\": {\n    \"name\": \"Iot\",\n    \"cors\": true\n  },\n  \"iotdata\": {\n    \"prefix\": \"iot-data\",\n    \"name\": \"IotData\",\n    \"cors\": true\n  },\n  \"kinesis\": {\n    \"name\": \"Kinesis\",\n    \"cors\": true\n  },\n  \"kinesisanalytics\": {\n    \"name\": \"KinesisAnalytics\"\n  },\n  \"kms\": {\n    \"name\": \"KMS\",\n    \"cors\": true\n  },\n  \"lambda\": {\n    \"name\": \"Lambda\",\n    \"cors\": true\n  },\n  \"machinelearning\": {\n    \"name\": \"MachineLearning\",\n    \"cors\": true\n  },\n  \"marketplacecommerceanalytics\": {\n    \"name\": \"MarketplaceCommerceAnalytics\",\n    \"cors\": true\n  },\n  \"marketplacemetering\": {\n      \"prefix\": \"meteringmarketplace\",\n      \"name\": \"MarketplaceMetering\"\n  },\n  \"mobileanalytics\": {\n    \"name\": \"MobileAnalytics\",\n    \"cors\": true\n  },\n  \"opsworks\": {\n    \"name\": \"OpsWorks\",\n    \"cors\": true\n  },\n  \"rds\": {\n    \"name\": \"RDS\",\n    \"versions\": [\"2014-09-01*\"],\n    \"cors\": true\n  },\n  \"redshift\": {\n    \"name\": \"Redshift\",\n    \"cors\": true\n  },\n  \"route53\": {\n    \"name\": \"Route53\",\n    \"cors\": true\n  },\n  \"route53domains\": {\n    \"name\": \"Route53Domains\",\n    \"cors\": true\n  },\n  \"s3\": {\n    \"name\": \"S3\",\n    \"dualstackAvailable\": true,\n    \"cors\": true\n  },\n  \"servicecatalog\": {\n    \"name\": \"ServiceCatalog\",\n    \"cors\": true\n  },\n  \"ses\": {\n    \"prefix\": \"email\",\n    \"name\": \"SES\",\n    \"cors\": true\n  },\n  \"simpledb\": {\n    \"prefix\": \"sdb\",\n    \"name\": \"SimpleDB\"\n  },\n  \"snowball\": {\n    \"name\": \"Snowball\"\n  },\n  \"sns\": {\n    \"name\": \"SNS\",\n    \"cors\": true\n  },\n  \"sqs\": {\n    \"name\": \"SQS\",\n    \"cors\": true\n  },\n  \"ssm\": {\n    \"name\": \"SSM\",\n    \"cors\": true\n  },\n  \"storagegateway\": {\n    \"name\": \"StorageGateway\",\n    \"cors\": true\n  },\n  \"sts\": {\n    \"name\": \"STS\",\n    \"cors\": true\n  },\n  \"support\": {\n    \"name\": \"Support\"\n  },\n  \"swf\": {\n    \"name\": \"SWF\"\n  },\n  \"waf\": {\n    \"name\": \"WAF\",\n    \"cors\": true\n  },\n  \"workspaces\": {\n    \"name\": \"WorkSpaces\"\n  }\n}\n\n},{}],4:[function(require,module,exports){\nmodule.exports={\n  \"version\": \"2.0\",\n  \"metadata\": {\n    \"apiVersion\": \"2011-06-15\",\n    \"endpointPrefix\": \"sts\",\n    \"globalEndpoint\": \"sts.amazonaws.com\",\n    \"protocol\": \"query\",\n    \"serviceAbbreviation\": \"AWS STS\",\n    \"serviceFullName\": \"AWS Security Token Service\",\n    \"signatureVersion\": \"v4\",\n    \"xmlNamespace\": \"https://sts.amazonaws.com/doc/2011-06-15/\"\n  },\n  \"operations\": {\n    \"AssumeRole\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"RoleArn\",\n          \"RoleSessionName\"\n        ],\n        \"members\": {\n          \"RoleArn\": {},\n          \"RoleSessionName\": {},\n          \"Policy\": {},\n          \"DurationSeconds\": {\n            \"type\": \"integer\"\n          },\n          \"ExternalId\": {},\n          \"SerialNumber\": {},\n          \"TokenCode\": {}\n        }\n      },\n      \"output\": {\n        \"resultWrapper\": \"AssumeRoleResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"Credentials\": {\n            \"shape\": \"Sa\"\n          },\n          \"AssumedRoleUser\": {\n            \"shape\": \"Sf\"\n          },\n          \"PackedPolicySize\": {\n            \"type\": \"integer\"\n          }\n        }\n      }\n    },\n    \"AssumeRoleWithSAML\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"RoleArn\",\n          \"PrincipalArn\",\n          \"SAMLAssertion\"\n        ],\n        \"members\": {\n          \"RoleArn\": {},\n          \"PrincipalArn\": {},\n          \"SAMLAssertion\": {},\n          \"Policy\": {},\n          \"DurationSeconds\": {\n            \"type\": \"integer\"\n          }\n        }\n      },\n      \"output\": {\n        \"resultWrapper\": \"AssumeRoleWithSAMLResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"Credentials\": {\n            \"shape\": \"Sa\"\n          },\n          \"AssumedRoleUser\": {\n            \"shape\": \"Sf\"\n          },\n          \"PackedPolicySize\": {\n            \"type\": \"integer\"\n          },\n          \"Subject\": {},\n          \"SubjectType\": {},\n          \"Issuer\": {},\n          \"Audience\": {},\n          \"NameQualifier\": {}\n        }\n      }\n    },\n    \"AssumeRoleWithWebIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"RoleArn\",\n          \"RoleSessionName\",\n          \"WebIdentityToken\"\n        ],\n        \"members\": {\n          \"RoleArn\": {},\n          \"RoleSessionName\": {},\n          \"WebIdentityToken\": {},\n          \"ProviderId\": {},\n          \"Policy\": {},\n          \"DurationSeconds\": {\n            \"type\": \"integer\"\n          }\n        }\n      },\n      \"output\": {\n        \"resultWrapper\": \"AssumeRoleWithWebIdentityResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"Credentials\": {\n            \"shape\": \"Sa\"\n          },\n          \"SubjectFromWebIdentityToken\": {},\n          \"AssumedRoleUser\": {\n            \"shape\": \"Sf\"\n          },\n          \"PackedPolicySize\": {\n            \"type\": \"integer\"\n          },\n          \"Provider\": {},\n          \"Audience\": {}\n        }\n      }\n    },\n    \"DecodeAuthorizationMessage\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"EncodedMessage\"\n        ],\n        \"members\": {\n          \"EncodedMessage\": {}\n        }\n      },\n      \"output\": {\n        \"resultWrapper\": \"DecodeAuthorizationMessageResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"DecodedMessage\": {}\n        }\n      }\n    },\n    \"GetCallerIdentity\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"members\": {}\n      },\n      \"output\": {\n        \"resultWrapper\": \"GetCallerIdentityResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"UserId\": {},\n          \"Account\": {},\n          \"Arn\": {}\n        }\n      }\n    },\n    \"GetFederationToken\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"required\": [\n          \"Name\"\n        ],\n        \"members\": {\n          \"Name\": {},\n          \"Policy\": {},\n          \"DurationSeconds\": {\n            \"type\": \"integer\"\n          }\n        }\n      },\n      \"output\": {\n        \"resultWrapper\": \"GetFederationTokenResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"Credentials\": {\n            \"shape\": \"Sa\"\n          },\n          \"FederatedUser\": {\n            \"type\": \"structure\",\n            \"required\": [\n              \"FederatedUserId\",\n              \"Arn\"\n            ],\n            \"members\": {\n              \"FederatedUserId\": {},\n              \"Arn\": {}\n            }\n          },\n          \"PackedPolicySize\": {\n            \"type\": \"integer\"\n          }\n        }\n      }\n    },\n    \"GetSessionToken\": {\n      \"input\": {\n        \"type\": \"structure\",\n        \"members\": {\n          \"DurationSeconds\": {\n            \"type\": \"integer\"\n          },\n          \"SerialNumber\": {},\n          \"TokenCode\": {}\n        }\n      },\n      \"output\": {\n        \"resultWrapper\": \"GetSessionTokenResult\",\n        \"type\": \"structure\",\n        \"members\": {\n          \"Credentials\": {\n            \"shape\": \"Sa\"\n          }\n        }\n      }\n    }\n  },\n  \"shapes\": {\n    \"Sa\": {\n      \"type\": \"structure\",\n      \"required\": [\n        \"AccessKeyId\",\n        \"SecretAccessKey\",\n        \"SessionToken\",\n        \"Expiration\"\n      ],\n      \"members\": {\n        \"AccessKeyId\": {},\n        \"SecretAccessKey\": {},\n        \"SessionToken\": {},\n        \"Expiration\": {\n          \"type\": \"timestamp\"\n        }\n      }\n    },\n    \"Sf\": {\n      \"type\": \"structure\",\n      \"required\": [\n        \"AssumedRoleId\",\n        \"Arn\"\n      ],\n      \"members\": {\n        \"AssumedRoleId\": {},\n        \"Arn\": {}\n      }\n    }\n  }\n}\n},{}],5:[function(require,module,exports){\nrequire('../lib/node_loader');\nvar AWS = require('../lib/core');\nvar Service = require('../lib/service');\nvar apiLoader = require('../lib/api_loader');\n\napiLoader.services['cognitoidentity'] = {};\nAWS.CognitoIdentity = Service.defineService('cognitoidentity', ['2014-06-30']);\nrequire('../lib/services/cognitoidentity');\nObject.defineProperty(apiLoader.services['cognitoidentity'], '2014-06-30', {\n  get: function get() {\n    var model = require('../apis/cognito-identity-2014-06-30.min.json');\n    return model;\n  },\n  enumerable: true,\n  configurable: true\n});\n\nmodule.exports = AWS.CognitoIdentity;\n\n},{\"../apis/cognito-identity-2014-06-30.min.json\":1,\"../lib/api_loader\":7,\"../lib/core\":11,\"../lib/node_loader\":9,\"../lib/service\":42,\"../lib/services/cognitoidentity\":43}],6:[function(require,module,exports){\nrequire('../lib/node_loader');\nvar AWS = require('../lib/core');\nvar Service = require('../lib/service');\nvar apiLoader = require('../lib/api_loader');\n\napiLoader.services['sts'] = {};\nAWS.STS = Service.defineService('sts', ['2011-06-15']);\nrequire('../lib/services/sts');\nObject.defineProperty(apiLoader.services['sts'], '2011-06-15', {\n  get: function get() {\n    var model = require('../apis/sts-2011-06-15.min.json');\n    return model;\n  },\n  enumerable: true,\n  configurable: true\n});\n\nmodule.exports = AWS.STS;\n\n},{\"../apis/sts-2011-06-15.min.json\":4,\"../lib/api_loader\":7,\"../lib/core\":11,\"../lib/node_loader\":9,\"../lib/service\":42,\"../lib/services/sts\":44}],7:[function(require,module,exports){\nvar AWS = require('./core');\n\nAWS.apiLoader = function(svc, version) {\n  if (!AWS.apiLoader.services.hasOwnProperty(svc)) {\n    throw new Error('InvalidService: Failed to load api for ' + svc);\n  }\n  return AWS.apiLoader.services[svc][version];\n};\n\nAWS.apiLoader.services = {};\n\nmodule.exports = AWS.apiLoader;\n},{\"./core\":11}],8:[function(require,module,exports){\nrequire('./browser_loader');\n\nvar AWS = require('./core');\n\nif (typeof window !== 'undefined') window.AWSCognito = AWS;\nif (typeof module !== 'undefined') module.exports = AWS;\nif (typeof self !== 'undefined') self.AWSCognito = AWS;\n\nif (!Object.prototype.hasOwnProperty.call(AWS, 'CognitoIdentityServiceProvider')) {\n  AWS.apiLoader.services['cognitoidentityserviceprovider'] = {};\n  AWS.CognitoIdentityServiceProvider = AWS.Service.defineService('cognitoidentityserviceprovider', [ '2016-04-18' ]);\n}\nAWS.apiLoader.services['cognitoidentityserviceprovider']['2016-04-18'] = require('../apis/cognito-idp-2016-04-18.min');\n\nif (!Object.prototype.hasOwnProperty.call(AWS, 'STS')) {\n  AWS.apiLoader.services['sts'] = {};\n  AWS.STS = AWS.Service.defineService('sts', [ '2011-06-15' ]);\n  require('./services/sts');\n}\nAWS.apiLoader.services['sts']['2011-06-15'] = require('../apis/sts-2011-06-15.min');\n\n\n},{\"../apis/cognito-idp-2016-04-18.min\":2,\"../apis/sts-2011-06-15.min\":4,\"./browser_loader\":9,\"./core\":11,\"./services/sts\":44}],9:[function(require,module,exports){\n(function (process){\nvar util = require('./util');\n\nutil.crypto.lib = require('crypto-browserify');\nutil.Buffer = require('buffer/').Buffer;\nutil.url = require('url/');\nutil.querystring = require('querystring/');\n\nvar AWS = require('./core');\n\nrequire('./api_loader');\n\nAWS.XML.Parser = require('./xml/browser_parser');\n\nrequire('./http/xhr');\n\nif (typeof process === 'undefined') {\n  process = {\n    browser: true\n  };\n}\n}).call(this,require(\"FWaASH\"))\n},{\"./api_loader\":7,\"./core\":11,\"./http/xhr\":20,\"./util\":53,\"./xml/browser_parser\":54,\"FWaASH\":62,\"buffer/\":69,\"crypto-browserify\":74,\"querystring/\":82,\"url/\":83}],10:[function(require,module,exports){\nvar AWS = require('./core');\nrequire('./credentials');\nrequire('./credentials/credential_provider_chain');\n\n\nAWS.Config = AWS.util.inherit({\n\n\n\n  constructor: function Config(options) {\n    if (options === undefined) options = {};\n    options = this.extractCredentials(options);\n\n    AWS.util.each.call(this, this.keys, function (key, value) {\n      this.set(key, options[key], value);\n    });\n  },\n\n\n\n\n  getCredentials: function getCredentials(callback) {\n    var self = this;\n\n    function finish(err) {\n      callback(err, err ? null : self.credentials);\n    }\n\n    function credError(msg, err) {\n      return new AWS.util.error(err || new Error(), {\n        code: 'CredentialsError', message: msg\n      });\n    }\n\n    function getAsyncCredentials() {\n      self.credentials.get(function(err) {\n        if (err) {\n          var msg = 'Could not load credentials from ' +\n            self.credentials.constructor.name;\n          err = credError(msg, err);\n        }\n        finish(err);\n      });\n    }\n\n    function getStaticCredentials() {\n      var err = null;\n      if (!self.credentials.accessKeyId || !self.credentials.secretAccessKey) {\n        err = credError('Missing credentials');\n      }\n      finish(err);\n    }\n\n    if (self.credentials) {\n      if (typeof self.credentials.get === 'function') {\n        getAsyncCredentials();\n      } else { // static credentials\n        getStaticCredentials();\n      }\n    } else if (self.credentialProvider) {\n      self.credentialProvider.resolve(function(err, creds) {\n        if (err) {\n          err = credError('Could not load credentials from any providers', err);\n        }\n        self.credentials = creds;\n        finish(err);\n      });\n    } else {\n      finish(credError('No credentials to load'));\n    }\n  },\n\n\n\n\n  update: function update(options, allowUnknownKeys) {\n    allowUnknownKeys = allowUnknownKeys || false;\n    options = this.extractCredentials(options);\n    AWS.util.each.call(this, options, function (key, value) {\n      if (allowUnknownKeys || Object.prototype.hasOwnProperty.call(this.keys, key) ||\n          AWS.Service.hasService(key)) {\n        this.set(key, value);\n      }\n    });\n  },\n\n\n  loadFromPath: function loadFromPath(path) {\n    this.clear();\n\n    var options = JSON.parse(AWS.util.readFileSync(path));\n    var fileSystemCreds = new AWS.FileSystemCredentials(path);\n    var chain = new AWS.CredentialProviderChain();\n    chain.providers.unshift(fileSystemCreds);\n    chain.resolve(function (err, creds) {\n      if (err) throw err;\n      else options.credentials = creds;\n    });\n\n    this.constructor(options);\n\n    return this;\n  },\n\n\n  clear: function clear() {\n\n    AWS.util.each.call(this, this.keys, function (key) {\n      delete this[key];\n    });\n\n    this.set('credentials', undefined);\n    this.set('credentialProvider', undefined);\n  },\n\n\n  set: function set(property, value, defaultValue) {\n    if (value === undefined) {\n      if (defaultValue === undefined) {\n        defaultValue = this.keys[property];\n      }\n      if (typeof defaultValue === 'function') {\n        this[property] = defaultValue.call(this);\n      } else {\n        this[property] = defaultValue;\n      }\n    } else if (property === 'httpOptions' && this[property]) {\n      this[property] = AWS.util.merge(this[property], value);\n    } else {\n      this[property] = value;\n    }\n  },\n\n\n  keys: {\n    credentials: null,\n    credentialProvider: null,\n    region: null,\n    logger: null,\n    apiVersions: {},\n    apiVersion: null,\n    endpoint: undefined,\n    httpOptions: {\n      timeout: 120000\n    },\n    maxRetries: undefined,\n    maxRedirects: 10,\n    paramValidation: true,\n    sslEnabled: true,\n    s3ForcePathStyle: false,\n    s3BucketEndpoint: false,\n    s3DisableBodySigning: true,\n    computeChecksums: true,\n    convertResponseTypes: true,\n    correctClockSkew: false,\n    customUserAgent: null,\n    dynamoDbCrc32: true,\n    systemClockOffset: 0,\n    signatureVersion: null,\n    signatureCache: true,\n    retryDelayOptions: {\n      base: 100\n    },\n    useAccelerateEndpoint: false\n  },\n\n\n  extractCredentials: function extractCredentials(options) {\n    if (options.accessKeyId && options.secretAccessKey) {\n      options = AWS.util.copy(options);\n      options.credentials = new AWS.Credentials(options);\n    }\n    return options;\n  },\n\n\n  setPromisesDependency: function setPromisesDependency(dep) {\n    AWS.util.addPromisesToRequests(AWS.Request, dep);\n  }\n});\n\n\nAWS.config = new AWS.Config();\n\n},{\"./core\":11,\"./credentials\":12,\"./credentials/credential_provider_chain\":14}],11:[function(require,module,exports){\n\nvar AWS = { util: require('./util') };\n\n\nvar _hidden = {}; _hidden.toString(); // hack to parse macro\n\nmodule.exports = AWS;\n\nAWS.util.update(AWS, {\n\n\n  VERSION: '2.6.4',\n\n\n  Signers: {},\n\n\n  Protocol: {\n    Json: require('./protocol/json'),\n    Query: require('./protocol/query'),\n    Rest: require('./protocol/rest'),\n    RestJson: require('./protocol/rest_json'),\n    RestXml: require('./protocol/rest_xml')\n  },\n\n\n  XML: {\n    Builder: require('./xml/builder'),\n    Parser: null // conditionally set based on environment\n  },\n\n\n  JSON: {\n    Builder: require('./json/builder'),\n    Parser: require('./json/parser')\n  },\n\n\n  Model: {\n    Api: require('./model/api'),\n    Operation: require('./model/operation'),\n    Shape: require('./model/shape'),\n    Paginator: require('./model/paginator'),\n    ResourceWaiter: require('./model/resource_waiter')\n  },\n\n  util: require('./util'),\n\n\n  apiLoader: function() { throw new Error('No API loader set'); }\n});\n\nrequire('./service');\n\nrequire('./credentials');\nrequire('./credentials/credential_provider_chain');\nrequire('./credentials/temporary_credentials');\nrequire('./credentials/web_identity_credentials');\nrequire('./credentials/cognito_identity_credentials');\nrequire('./credentials/saml_credentials');\n\nrequire('./config');\nrequire('./http');\nrequire('./sequential_executor');\nrequire('./event_listeners');\nrequire('./request');\nrequire('./response');\nrequire('./resource_waiter');\nrequire('./signers/request_signer');\nrequire('./param_validator');\n\n\nAWS.events = new AWS.SequentialExecutor();\n\n},{\"./config\":10,\"./credentials\":12,\"./credentials/cognito_identity_credentials\":13,\"./credentials/credential_provider_chain\":14,\"./credentials/saml_credentials\":15,\"./credentials/temporary_credentials\":16,\"./credentials/web_identity_credentials\":17,\"./event_listeners\":18,\"./http\":19,\"./json/builder\":21,\"./json/parser\":22,\"./model/api\":23,\"./model/operation\":25,\"./model/paginator\":26,\"./model/resource_waiter\":27,\"./model/shape\":28,\"./param_validator\":29,\"./protocol/json\":30,\"./protocol/query\":31,\"./protocol/rest\":32,\"./protocol/rest_json\":33,\"./protocol/rest_xml\":34,\"./request\":38,\"./resource_waiter\":39,\"./response\":40,\"./sequential_executor\":41,\"./service\":42,\"./signers/request_signer\":46,\"./util\":53,\"./xml/builder\":55}],12:[function(require,module,exports){\nvar AWS = require('./core');\n\n\nAWS.Credentials = AWS.util.inherit({\n\n  constructor: function Credentials() {\n    AWS.util.hideProperties(this, ['secretAccessKey']);\n\n    this.expired = false;\n    this.expireTime = null;\n    if (arguments.length === 1 && typeof arguments[0] === 'object') {\n      var creds = arguments[0].credentials || arguments[0];\n      this.accessKeyId = creds.accessKeyId;\n      this.secretAccessKey = creds.secretAccessKey;\n      this.sessionToken = creds.sessionToken;\n    } else {\n      this.accessKeyId = arguments[0];\n      this.secretAccessKey = arguments[1];\n      this.sessionToken = arguments[2];\n    }\n  },\n\n\n  expiryWindow: 15,\n\n\n  needsRefresh: function needsRefresh() {\n    var currentTime = AWS.util.date.getDate().getTime();\n    var adjustedTime = new Date(currentTime + this.expiryWindow * 1000);\n\n    if (this.expireTime && adjustedTime > this.expireTime) {\n      return true;\n    } else {\n      return this.expired || !this.accessKeyId || !this.secretAccessKey;\n    }\n  },\n\n\n  get: function get(callback) {\n    var self = this;\n    if (this.needsRefresh()) {\n      this.refresh(function(err) {\n        if (!err) self.expired = false; // reset expired flag\n        if (callback) callback(err);\n      });\n    } else if (callback) {\n      callback();\n    }\n  },\n\n\n  refresh: function refresh(callback) {\n    this.expired = false;\n    callback();\n  }\n});\n\n},{\"./core\":11}],13:[function(require,module,exports){\nvar AWS = require('../core');\nvar CognitoIdentity = require('../../clients/cognitoidentity');\nvar STS = require('../../clients/sts');\n\n\nAWS.CognitoIdentityCredentials = AWS.util.inherit(AWS.Credentials, {\n\n  localStorageKey: {\n    id: 'aws.cognito.identity-id.',\n    providers: 'aws.cognito.identity-providers.'\n  },\n\n\n  constructor: function CognitoIdentityCredentials(params) {\n    AWS.Credentials.call(this);\n    this.expired = true;\n    this.params = params;\n    this.data = null;\n    this.identityId = null;\n    this.loadCachedId();\n  },\n\n\n  refresh: function refresh(callback) {\n    var self = this;\n    self.createClients();\n    self.data = null;\n    self.identityId = null;\n    self.getId(function(err) {\n      if (!err) {\n        if (!self.params.RoleArn) {\n          self.getCredentialsForIdentity(callback);\n        } else {\n          self.getCredentialsFromSTS(callback);\n        }\n      } else {\n        self.clearIdOnNotAuthorized(err);\n        callback(err);\n      }\n    });\n  },\n\n\n  clearCachedId: function clearCache() {\n    this.identityId = null;\n    delete this.params.IdentityId;\n\n    var poolId = this.params.IdentityPoolId;\n    var loginId = this.params.LoginId || '';\n    delete this.storage[this.localStorageKey.id + poolId + loginId];\n    delete this.storage[this.localStorageKey.providers + poolId + loginId];\n  },\n\n\n  clearIdOnNotAuthorized: function clearIdOnNotAuthorized(err) {\n    var self = this;\n    if (err.code == 'NotAuthorizedException') {\n      self.clearCachedId();\n    }\n  },\n\n\n  getId: function getId(callback) {\n    var self = this;\n    if (typeof self.params.IdentityId === 'string') {\n      return callback(null, self.params.IdentityId);\n    }\n\n    self.cognito.getId(function(err, data) {\n      if (!err && data.IdentityId) {\n        self.params.IdentityId = data.IdentityId;\n        callback(null, data.IdentityId);\n      } else {\n        callback(err);\n      }\n    });\n  },\n\n\n\n  loadCredentials: function loadCredentials(data, credentials) {\n    if (!data || !credentials) return;\n    credentials.expired = false;\n    credentials.accessKeyId = data.Credentials.AccessKeyId;\n    credentials.secretAccessKey = data.Credentials.SecretKey;\n    credentials.sessionToken = data.Credentials.SessionToken;\n    credentials.expireTime = data.Credentials.Expiration;\n  },\n\n\n  getCredentialsForIdentity: function getCredentialsForIdentity(callback) {\n    var self = this;\n    self.cognito.getCredentialsForIdentity(function(err, data) {\n      if (!err) {\n        self.cacheId(data);\n        self.data = data;\n        self.loadCredentials(self.data, self);\n      } else {\n        self.clearIdOnNotAuthorized(err);\n      }\n      callback(err);\n    });\n  },\n\n\n  getCredentialsFromSTS: function getCredentialsFromSTS(callback) {\n    var self = this;\n    self.cognito.getOpenIdToken(function(err, data) {\n      if (!err) {\n        self.cacheId(data);\n        self.params.WebIdentityToken = data.Token;\n        self.webIdentityCredentials.refresh(function(webErr) {\n          if (!webErr) {\n            self.data = self.webIdentityCredentials.data;\n            self.sts.credentialsFrom(self.data, self);\n          }\n          callback(webErr);\n        });\n      } else {\n        self.clearIdOnNotAuthorized(err);\n        callback(err);\n      }\n    });\n  },\n\n\n  loadCachedId: function loadCachedId() {\n    var self = this;\n\n    if (AWS.util.isBrowser() && !self.params.IdentityId) {\n      var id = self.getStorage('id');\n      if (id && self.params.Logins) {\n        var actualProviders = Object.keys(self.params.Logins);\n        var cachedProviders =\n          (self.getStorage('providers') || '').split(',');\n\n        var intersect = cachedProviders.filter(function(n) {\n          return actualProviders.indexOf(n) !== -1;\n        });\n        if (intersect.length !== 0) {\n          self.params.IdentityId = id;\n        }\n      } else if (id) {\n        self.params.IdentityId = id;\n      }\n    }\n  },\n\n\n  createClients: function() {\n    this.webIdentityCredentials = this.webIdentityCredentials ||\n      new AWS.WebIdentityCredentials(this.params);\n    this.cognito = this.cognito ||\n      new CognitoIdentity({params: this.params});\n    this.sts = this.sts || new STS();\n  },\n\n\n  cacheId: function cacheId(data) {\n    this.identityId = data.IdentityId;\n    this.params.IdentityId = this.identityId;\n\n    if (AWS.util.isBrowser()) {\n      this.setStorage('id', data.IdentityId);\n\n      if (this.params.Logins) {\n        this.setStorage('providers', Object.keys(this.params.Logins).join(','));\n      }\n    }\n  },\n\n\n  getStorage: function getStorage(key) {\n    return this.storage[this.localStorageKey[key] + this.params.IdentityPoolId + (this.params.LoginId || '')];\n  },\n\n\n  setStorage: function setStorage(key, val) {\n    try {\n      this.storage[this.localStorageKey[key] + this.params.IdentityPoolId + (this.params.LoginId || '')] = val;\n    } catch (_) {}\n  },\n\n\n  storage: (function() {\n    try {\n      window.localStorage.setItem('aws.test-storage', 'foobar');\n      window.localStorage.removeItem('aws.test-storage');\n\n      return AWS.util.isBrowser() ? window.localStorage : {};\n    } catch (_) {\n      return {};\n    }\n  })()\n});\n\n},{\"../../clients/cognitoidentity\":5,\"../../clients/sts\":6,\"../core\":11}],14:[function(require,module,exports){\nvar AWS = require('../core');\n\n\nAWS.CredentialProviderChain = AWS.util.inherit(AWS.Credentials, {\n\n\n  constructor: function CredentialProviderChain(providers) {\n    if (providers) {\n      this.providers = providers;\n    } else {\n      this.providers = AWS.CredentialProviderChain.defaultProviders.slice(0);\n    }\n  },\n\n\n  resolve: function resolve(callback) {\n    if (this.providers.length === 0) {\n      callback(new Error('No providers'));\n      return this;\n    }\n\n    var index = 0;\n    var providers = this.providers.slice(0);\n\n    function resolveNext(err, creds) {\n      if ((!err && creds) || index === providers.length) {\n        callback(err, creds);\n        return;\n      }\n\n      var provider = providers[index++];\n      if (typeof provider === 'function') {\n        creds = provider.call();\n      } else {\n        creds = provider;\n      }\n\n      if (creds.get) {\n        creds.get(function(getErr) {\n          resolveNext(getErr, getErr ? null : creds);\n        });\n      } else {\n        resolveNext(null, creds);\n      }\n    }\n\n    resolveNext();\n    return this;\n  }\n\n});\n\n\nAWS.CredentialProviderChain.defaultProviders = [];\n\n},{\"../core\":11}],15:[function(require,module,exports){\nvar AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n\nAWS.SAMLCredentials = AWS.util.inherit(AWS.Credentials, {\n\n  constructor: function SAMLCredentials(params) {\n    AWS.Credentials.call(this);\n    this.expired = true;\n    this.params = params;\n  },\n\n\n  refresh: function refresh(callback) {\n    var self = this;\n    self.createClients();\n    if (!callback) callback = function(err) { if (err) throw err; };\n\n    self.service.assumeRoleWithSAML(function (err, data) {\n      if (!err) {\n        self.service.credentialsFrom(data, self);\n      }\n      callback(err);\n    });\n  },\n\n\n  createClients: function() {\n    this.service = this.service || new STS({params: this.params});\n  }\n\n});\n\n},{\"../../clients/sts\":6,\"../core\":11}],16:[function(require,module,exports){\nvar AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n\nAWS.TemporaryCredentials = AWS.util.inherit(AWS.Credentials, {\n\n  constructor: function TemporaryCredentials(params) {\n    AWS.Credentials.call(this);\n    this.loadMasterCredentials();\n    this.expired = true;\n\n    this.params = params || {};\n    if (this.params.RoleArn) {\n      this.params.RoleSessionName =\n        this.params.RoleSessionName || 'temporary-credentials';\n    }\n  },\n\n\n  refresh: function refresh(callback) {\n    var self = this;\n    self.createClients();\n    if (!callback) callback = function(err) { if (err) throw err; };\n\n    self.service.config.credentials = self.masterCredentials;\n    var operation = self.params.RoleArn ?\n      self.service.assumeRole : self.service.getSessionToken;\n    operation.call(self.service, function (err, data) {\n      if (!err) {\n        self.service.credentialsFrom(data, self);\n      }\n      callback(err);\n    });\n  },\n\n\n  loadMasterCredentials: function loadMasterCredentials() {\n    this.masterCredentials = AWS.config.credentials;\n    while (this.masterCredentials.masterCredentials) {\n      this.masterCredentials = this.masterCredentials.masterCredentials;\n    }\n  },\n\n\n  createClients: function() {\n    this.service = this.service || new STS({params: this.params});\n  }\n\n});\n\n},{\"../../clients/sts\":6,\"../core\":11}],17:[function(require,module,exports){\nvar AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n\nAWS.WebIdentityCredentials = AWS.util.inherit(AWS.Credentials, {\n\n  constructor: function WebIdentityCredentials(params) {\n    AWS.Credentials.call(this);\n    this.expired = true;\n    this.params = params;\n    this.params.RoleSessionName = this.params.RoleSessionName || 'web-identity';\n    this.data = null;\n  },\n\n\n  refresh: function refresh(callback) {\n    var self = this;\n    self.createClients();\n    if (!callback) callback = function(err) { if (err) throw err; };\n\n    self.service.assumeRoleWithWebIdentity(function (err, data) {\n      self.data = null;\n      if (!err) {\n        self.data = data;\n        self.service.credentialsFrom(data, self);\n      }\n      callback(err);\n    });\n  },\n\n\n  createClients: function() {\n    this.service = this.service || new STS({params: this.params});\n  }\n\n});\n\n},{\"../../clients/sts\":6,\"../core\":11}],18:[function(require,module,exports){\nvar AWS = require('./core');\nvar SequentialExecutor = require('./sequential_executor');\n\n\nAWS.EventListeners = {\n\n  Core: {} /* doc hack */\n};\n\nAWS.EventListeners = {\n  Core: new SequentialExecutor().addNamedListeners(function(add, addAsync) {\n    addAsync('VALIDATE_CREDENTIALS', 'validate',\n        function VALIDATE_CREDENTIALS(req, done) {\n      if (!req.service.api.signatureVersion) return done(); // none\n      req.service.config.getCredentials(function(err) {\n        if (err) {\n          req.response.error = AWS.util.error(err,\n            {code: 'CredentialsError', message: 'Missing credentials in config'});\n        }\n        done();\n      });\n    });\n\n    add('VALIDATE_REGION', 'validate', function VALIDATE_REGION(req) {\n      if (!req.service.config.region && !req.service.isGlobalEndpoint) {\n        req.response.error = AWS.util.error(new Error(),\n          {code: 'ConfigError', message: 'Missing region in config'});\n      }\n    });\n\n    add('VALIDATE_PARAMETERS', 'validate', function VALIDATE_PARAMETERS(req) {\n      var rules = req.service.api.operations[req.operation].input;\n      var validation = req.service.config.paramValidation;\n      new AWS.ParamValidator(validation).validate(rules, req.params);\n    });\n\n    addAsync('COMPUTE_SHA256', 'afterBuild', function COMPUTE_SHA256(req, done) {\n      req.haltHandlersOnError();\n      if (!req.service.api.signatureVersion) return done(); // none\n      if (req.service.getSignerClass(req) === AWS.Signers.V4) {\n        var body = req.httpRequest.body || '';\n        AWS.util.computeSha256(body, function(err, sha) {\n          if (err) {\n            done(err);\n          }\n          else {\n            req.httpRequest.headers['X-Amz-Content-Sha256'] = sha;\n            done();\n          }\n        });\n      } else {\n        done();\n      }\n    });\n\n    add('SET_CONTENT_LENGTH', 'afterBuild', function SET_CONTENT_LENGTH(req) {\n      if (req.httpRequest.headers['Content-Length'] === undefined) {\n        var length = AWS.util.string.byteLength(req.httpRequest.body);\n        req.httpRequest.headers['Content-Length'] = length;\n      }\n    });\n\n    add('SET_HTTP_HOST', 'afterBuild', function SET_HTTP_HOST(req) {\n      req.httpRequest.headers['Host'] = req.httpRequest.endpoint.host;\n    });\n\n    add('RESTART', 'restart', function RESTART() {\n      var err = this.response.error;\n      if (!err || !err.retryable) return;\n\n      this.httpRequest = new AWS.HttpRequest(\n        this.service.endpoint,\n        this.service.region\n      );\n\n      if (this.response.retryCount < this.service.config.maxRetries) {\n        this.response.retryCount++;\n      } else {\n        this.response.error = null;\n      }\n    });\n\n    addAsync('SIGN', 'sign', function SIGN(req, done) {\n      var service = req.service;\n      if (!service.api.signatureVersion) return done(); // none\n\n      service.config.getCredentials(function (err, credentials) {\n        if (err) {\n          req.response.error = err;\n          return done();\n        }\n\n        try {\n          var date = AWS.util.date.getDate();\n          var SignerClass = service.getSignerClass(req);\n          var signer = new SignerClass(req.httpRequest,\n            service.api.signingName || service.api.endpointPrefix,\n           service.config.signatureCache);\n          signer.setServiceClientId(service._clientId);\n\n          delete req.httpRequest.headers['Authorization'];\n          delete req.httpRequest.headers['Date'];\n          delete req.httpRequest.headers['X-Amz-Date'];\n\n          signer.addAuthorization(credentials, date);\n          req.signedAt = date;\n        } catch (e) {\n          req.response.error = e;\n        }\n        done();\n      });\n    });\n\n    add('VALIDATE_RESPONSE', 'validateResponse', function VALIDATE_RESPONSE(resp) {\n      if (this.service.successfulResponse(resp, this)) {\n        resp.data = {};\n        resp.error = null;\n      } else {\n        resp.data = null;\n        resp.error = AWS.util.error(new Error(),\n          {code: 'UnknownError', message: 'An unknown error occurred.'});\n      }\n    });\n\n    addAsync('SEND', 'send', function SEND(resp, done) {\n      resp.httpResponse._abortCallback = done;\n      resp.error = null;\n      resp.data = null;\n\n      function callback(httpResp) {\n        resp.httpResponse.stream = httpResp;\n\n        httpResp.on('headers', function onHeaders(statusCode, headers) {\n          resp.request.emit('httpHeaders', [statusCode, headers, resp]);\n\n          if (!resp.httpResponse.streaming) {\n            if (AWS.HttpClient.streamsApiVersion === 2) { // streams2 API check\n              httpResp.on('readable', function onReadable() {\n                var data = httpResp.read();\n                if (data !== null) {\n                  resp.request.emit('httpData', [data, resp]);\n                }\n              });\n            } else { // legacy streams API\n              httpResp.on('data', function onData(data) {\n                resp.request.emit('httpData', [data, resp]);\n              });\n            }\n          }\n        });\n\n        httpResp.on('end', function onEnd() {\n          resp.request.emit('httpDone');\n          done();\n        });\n      }\n\n      function progress(httpResp) {\n        httpResp.on('sendProgress', function onSendProgress(value) {\n          resp.request.emit('httpUploadProgress', [value, resp]);\n        });\n\n        httpResp.on('receiveProgress', function onReceiveProgress(value) {\n          resp.request.emit('httpDownloadProgress', [value, resp]);\n        });\n      }\n\n      function error(err) {\n        resp.error = AWS.util.error(err, {\n          code: 'NetworkingError',\n          region: resp.request.httpRequest.region,\n          hostname: resp.request.httpRequest.endpoint.hostname,\n          retryable: true\n        });\n        resp.request.emit('httpError', [resp.error, resp], function() {\n          done();\n        });\n      }\n\n      function executeSend() {\n        var http = AWS.HttpClient.getInstance();\n        var httpOptions = resp.request.service.config.httpOptions || {};\n        try {\n          var stream = http.handleRequest(resp.request.httpRequest, httpOptions,\n                                          callback, error);\n          progress(stream);\n        } catch (err) {\n          error(err);\n        }\n      }\n\n      var timeDiff = (AWS.util.date.getDate() - this.signedAt) / 1000;\n      if (timeDiff >= 60 * 10) { // if we signed 10min ago, re-sign\n        this.emit('sign', [this], function(err) {\n          if (err) done(err);\n          else executeSend();\n        });\n      } else {\n        executeSend();\n      }\n    });\n\n    add('HTTP_HEADERS', 'httpHeaders',\n        function HTTP_HEADERS(statusCode, headers, resp) {\n      resp.httpResponse.statusCode = statusCode;\n      resp.httpResponse.headers = headers;\n      resp.httpResponse.body = new AWS.util.Buffer('');\n      resp.httpResponse.buffers = [];\n      resp.httpResponse.numBytes = 0;\n      var dateHeader = headers.date || headers.Date;\n      if (dateHeader) {\n        var serverTime = Date.parse(dateHeader);\n        if (resp.request.service.config.correctClockSkew\n            && AWS.util.isClockSkewed(serverTime)) {\n          AWS.util.applyClockOffset(serverTime);\n        }\n      }\n    });\n\n    add('HTTP_DATA', 'httpData', function HTTP_DATA(chunk, resp) {\n      if (chunk) {\n        if (AWS.util.isNode()) {\n          resp.httpResponse.numBytes += chunk.length;\n\n          var total = resp.httpResponse.headers['content-length'];\n          var progress = { loaded: resp.httpResponse.numBytes, total: total };\n          resp.request.emit('httpDownloadProgress', [progress, resp]);\n        }\n\n        resp.httpResponse.buffers.push(new AWS.util.Buffer(chunk));\n      }\n    });\n\n    add('HTTP_DONE', 'httpDone', function HTTP_DONE(resp) {\n      if (resp.httpResponse.buffers && resp.httpResponse.buffers.length > 0) {\n        var body = AWS.util.buffer.concat(resp.httpResponse.buffers);\n        resp.httpResponse.body = body;\n      }\n      delete resp.httpResponse.numBytes;\n      delete resp.httpResponse.buffers;\n    });\n\n    add('FINALIZE_ERROR', 'retry', function FINALIZE_ERROR(resp) {\n      if (resp.httpResponse.statusCode) {\n        resp.error.statusCode = resp.httpResponse.statusCode;\n        if (resp.error.retryable === undefined) {\n          resp.error.retryable = this.service.retryableError(resp.error, this);\n        }\n      }\n    });\n\n    add('INVALIDATE_CREDENTIALS', 'retry', function INVALIDATE_CREDENTIALS(resp) {\n      if (!resp.error) return;\n      switch (resp.error.code) {\n        case 'RequestExpired': // EC2 only\n        case 'ExpiredTokenException':\n        case 'ExpiredToken':\n          resp.error.retryable = true;\n          resp.request.service.config.credentials.expired = true;\n      }\n    });\n\n    add('EXPIRED_SIGNATURE', 'retry', function EXPIRED_SIGNATURE(resp) {\n      var err = resp.error;\n      if (!err) return;\n      if (typeof err.code === 'string' && typeof err.message === 'string') {\n        if (err.code.match(/Signature/) && err.message.match(/expired/)) {\n          resp.error.retryable = true;\n        }\n      }\n    });\n\n    add('CLOCK_SKEWED', 'retry', function CLOCK_SKEWED(resp) {\n      if (!resp.error) return;\n      if (this.service.clockSkewError(resp.error)\n          && this.service.config.correctClockSkew\n          && AWS.config.isClockSkewed) {\n        resp.error.retryable = true;\n      }\n    });\n\n    add('REDIRECT', 'retry', function REDIRECT(resp) {\n      if (resp.error && resp.error.statusCode >= 300 &&\n          resp.error.statusCode < 400 && resp.httpResponse.headers['location']) {\n        this.httpRequest.endpoint =\n          new AWS.Endpoint(resp.httpResponse.headers['location']);\n        this.httpRequest.headers['Host'] = this.httpRequest.endpoint.host;\n        resp.error.redirect = true;\n        resp.error.retryable = true;\n      }\n    });\n\n    add('RETRY_CHECK', 'retry', function RETRY_CHECK(resp) {\n      if (resp.error) {\n        if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {\n          resp.error.retryDelay = 0;\n        } else if (resp.retryCount < resp.maxRetries) {\n          resp.error.retryDelay = this.service.retryDelays(resp.retryCount) || 0;\n        }\n      }\n    });\n\n    addAsync('RESET_RETRY_STATE', 'afterRetry', function RESET_RETRY_STATE(resp, done) {\n      var delay, willRetry = false;\n\n      if (resp.error) {\n        delay = resp.error.retryDelay || 0;\n        if (resp.error.retryable && resp.retryCount < resp.maxRetries) {\n          resp.retryCount++;\n          willRetry = true;\n        } else if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {\n          resp.redirectCount++;\n          willRetry = true;\n        }\n      }\n\n      if (willRetry) {\n        resp.error = null;\n        setTimeout(done, delay);\n      } else {\n        done();\n      }\n    });\n  }),\n\n  CorePost: new SequentialExecutor().addNamedListeners(function(add) {\n    add('EXTRACT_REQUEST_ID', 'extractData', AWS.util.extractRequestId);\n    add('EXTRACT_REQUEST_ID', 'extractError', AWS.util.extractRequestId);\n\n    add('ENOTFOUND_ERROR', 'httpError', function ENOTFOUND_ERROR(err) {\n      if (err.code === 'NetworkingError' && err.errno === 'ENOTFOUND') {\n        var message = 'Inaccessible host: `' + err.hostname +\n          '\\'. This service may not be available in the `' + err.region +\n          '\\' region.';\n        this.response.error = AWS.util.error(new Error(message), {\n          code: 'UnknownEndpoint',\n          region: err.region,\n          hostname: err.hostname,\n          retryable: true,\n          originalError: err\n        });\n      }\n    });\n  }),\n\n  Logger: new SequentialExecutor().addNamedListeners(function(add) {\n    add('LOG_REQUEST', 'complete', function LOG_REQUEST(resp) {\n      var req = resp.request;\n      var logger = req.service.config.logger;\n      if (!logger) return;\n\n      function buildMessage() {\n        var time = AWS.util.date.getDate().getTime();\n        var delta = (time - req.startTime.getTime()) / 1000;\n        var ansi = logger.isTTY ? true : false;\n        var status = resp.httpResponse.statusCode;\n        var params = require('util').inspect(req.params, true, null);\n\n        var message = '';\n        if (ansi) message += '\\x1B[33m';\n        message += '[AWS ' + req.service.serviceIdentifier + ' ' + status;\n        message += ' ' + delta.toString() + 's ' + resp.retryCount + ' retries]';\n        if (ansi) message += '\\x1B[0;1m';\n        message += ' ' + AWS.util.string.lowerFirst(req.operation);\n        message += '(' + params + ')';\n        if (ansi) message += '\\x1B[0m';\n        return message;\n      }\n\n      var line = buildMessage();\n      if (typeof logger.log === 'function') {\n        logger.log(line);\n      } else if (typeof logger.write === 'function') {\n        logger.write(line + '\\n');\n      }\n    });\n  }),\n\n  Json: new SequentialExecutor().addNamedListeners(function(add) {\n    var svc = require('./protocol/json');\n    add('BUILD', 'build', svc.buildRequest);\n    add('EXTRACT_DATA', 'extractData', svc.extractData);\n    add('EXTRACT_ERROR', 'extractError', svc.extractError);\n  }),\n\n  Rest: new SequentialExecutor().addNamedListeners(function(add) {\n    var svc = require('./protocol/rest');\n    add('BUILD', 'build', svc.buildRequest);\n    add('EXTRACT_DATA', 'extractData', svc.extractData);\n    add('EXTRACT_ERROR', 'extractError', svc.extractError);\n  }),\n\n  RestJson: new SequentialExecutor().addNamedListeners(function(add) {\n    var svc = require('./protocol/rest_json');\n    add('BUILD', 'build', svc.buildRequest);\n    add('EXTRACT_DATA', 'extractData', svc.extractData);\n    add('EXTRACT_ERROR', 'extractError', svc.extractError);\n  }),\n\n  RestXml: new SequentialExecutor().addNamedListeners(function(add) {\n    var svc = require('./protocol/rest_xml');\n    add('BUILD', 'build', svc.buildRequest);\n    add('EXTRACT_DATA', 'extractData', svc.extractData);\n    add('EXTRACT_ERROR', 'extractError', svc.extractError);\n  }),\n\n  Query: new SequentialExecutor().addNamedListeners(function(add) {\n    var svc = require('./protocol/query');\n    add('BUILD', 'build', svc.buildRequest);\n    add('EXTRACT_DATA', 'extractData', svc.extractData);\n    add('EXTRACT_ERROR', 'extractError', svc.extractError);\n  })\n};\n\n},{\"./core\":11,\"./protocol/json\":30,\"./protocol/query\":31,\"./protocol/rest\":32,\"./protocol/rest_json\":33,\"./protocol/rest_xml\":34,\"./sequential_executor\":41,\"util\":68}],19:[function(require,module,exports){\nvar AWS = require('./core');\nvar inherit = AWS.util.inherit;\n\n\nAWS.Endpoint = inherit({\n\n\n  constructor: function Endpoint(endpoint, config) {\n    AWS.util.hideProperties(this, ['slashes', 'auth', 'hash', 'search', 'query']);\n\n    if (typeof endpoint === 'undefined' || endpoint === null) {\n      throw new Error('Invalid endpoint: ' + endpoint);\n    } else if (typeof endpoint !== 'string') {\n      return AWS.util.copy(endpoint);\n    }\n\n    if (!endpoint.match(/^http/)) {\n      var useSSL = config && config.sslEnabled !== undefined ?\n        config.sslEnabled : AWS.config.sslEnabled;\n      endpoint = (useSSL ? 'https' : 'http') + '://' + endpoint;\n    }\n\n    AWS.util.update(this, AWS.util.urlParse(endpoint));\n\n    if (this.port) {\n      this.port = parseInt(this.port, 10);\n    } else {\n      this.port = this.protocol === 'https:' ? 443 : 80;\n    }\n  }\n\n});\n\n\nAWS.HttpRequest = inherit({\n\n\n  constructor: function HttpRequest(endpoint, region, customUserAgent) {\n    endpoint = new AWS.Endpoint(endpoint);\n    this.method = 'POST';\n    this.path = endpoint.path || '/';\n    this.headers = {};\n    this.body = '';\n    this.endpoint = endpoint;\n    this.region = region;\n    this.setUserAgent(customUserAgent);\n  },\n\n\n  setUserAgent: function setUserAgent(customUserAgent) {\n    var prefix = AWS.util.isBrowser() ? 'X-Amz-' : '';\n    var customSuffix = '';\n    if (typeof customUserAgent === 'string' && customUserAgent) {\n      customSuffix += ' ' + customUserAgent;\n    }\n    this.headers[prefix + 'User-Agent'] = AWS.util.userAgent() + customSuffix;\n  },\n\n\n  pathname: function pathname() {\n    return this.path.split('?', 1)[0];\n  },\n\n\n  search: function search() {\n    var query = this.path.split('?', 2)[1];\n    if (query) {\n      query = AWS.util.queryStringParse(query);\n      return AWS.util.queryParamsToString(query);\n    }\n    return '';\n  }\n\n});\n\n\nAWS.HttpResponse = inherit({\n\n\n  constructor: function HttpResponse() {\n    this.statusCode = undefined;\n    this.headers = {};\n    this.body = undefined;\n    this.streaming = false;\n    this.stream = null;\n  },\n\n\n  createUnbufferedStream: function createUnbufferedStream() {\n    this.streaming = true;\n    return this.stream;\n  }\n});\n\n\nAWS.HttpClient = inherit({});\n\n\nAWS.HttpClient.getInstance = function getInstance() {\n  if (this.singleton === undefined) {\n    this.singleton = new this();\n  }\n  return this.singleton;\n};\n\n},{\"./core\":11}],20:[function(require,module,exports){\nvar AWS = require('../core');\nvar EventEmitter = require('events').EventEmitter;\nrequire('../http');\n\n\nAWS.XHRClient = AWS.util.inherit({\n  handleRequest: function handleRequest(httpRequest, httpOptions, callback, errCallback) {\n    var self = this;\n    var endpoint = httpRequest.endpoint;\n    var emitter = new EventEmitter();\n    var href = endpoint.protocol + '//' + endpoint.hostname;\n    if (endpoint.port !== 80 && endpoint.port !== 443) {\n      href += ':' + endpoint.port;\n    }\n    href += httpRequest.path;\n\n    var xhr = new XMLHttpRequest(), headersEmitted = false;\n    httpRequest.stream = xhr;\n\n    xhr.addEventListener('readystatechange', function() {\n      try {\n        if (xhr.status === 0) return; // 0 code is invalid\n      } catch (e) { return; }\n\n      if (this.readyState >= this.HEADERS_RECEIVED && !headersEmitted) {\n        try { xhr.responseType = 'arraybuffer'; } catch (e) {}\n        emitter.statusCode = xhr.status;\n        emitter.headers = self.parseHeaders(xhr.getAllResponseHeaders());\n        emitter.emit('headers', emitter.statusCode, emitter.headers);\n        headersEmitted = true;\n      }\n      if (this.readyState === this.DONE) {\n        self.finishRequest(xhr, emitter);\n      }\n    }, false);\n    xhr.upload.addEventListener('progress', function (evt) {\n      emitter.emit('sendProgress', evt);\n    });\n    xhr.addEventListener('progress', function (evt) {\n      emitter.emit('receiveProgress', evt);\n    }, false);\n    xhr.addEventListener('timeout', function () {\n      errCallback(AWS.util.error(new Error('Timeout'), {code: 'TimeoutError'}));\n    }, false);\n    xhr.addEventListener('error', function () {\n      errCallback(AWS.util.error(new Error('Network Failure'), {\n        code: 'NetworkingError'\n      }));\n    }, false);\n\n    callback(emitter);\n    xhr.open(httpRequest.method, href, httpOptions.xhrAsync !== false);\n    AWS.util.each(httpRequest.headers, function (key, value) {\n      if (key !== 'Content-Length' && key !== 'User-Agent' && key !== 'Host') {\n        xhr.setRequestHeader(key, value);\n      }\n    });\n\n    if (httpOptions.timeout && httpOptions.xhrAsync !== false) {\n      xhr.timeout = httpOptions.timeout;\n    }\n\n    if (httpOptions.xhrWithCredentials) {\n      xhr.withCredentials = true;\n    }\n\n    try {\n      xhr.send(httpRequest.body);\n    } catch (err) {\n      if (httpRequest.body && typeof httpRequest.body.buffer === 'object') {\n        xhr.send(httpRequest.body.buffer); // send ArrayBuffer directly\n      } else {\n        throw err;\n      }\n    }\n\n    return emitter;\n  },\n\n  parseHeaders: function parseHeaders(rawHeaders) {\n    var headers = {};\n    AWS.util.arrayEach(rawHeaders.split(/\\r?\\n/), function (line) {\n      var key = line.split(':', 1)[0];\n      var value = line.substring(key.length + 2);\n      if (key.length > 0) headers[key.toLowerCase()] = value;\n    });\n    return headers;\n  },\n\n  finishRequest: function finishRequest(xhr, emitter) {\n    var buffer;\n    if (xhr.responseType === 'arraybuffer' && xhr.response) {\n      var ab = xhr.response;\n      buffer = new AWS.util.Buffer(ab.byteLength);\n      var view = new Uint8Array(ab);\n      for (var i = 0; i < buffer.length; ++i) {\n        buffer[i] = view[i];\n      }\n    }\n\n    try {\n      if (!buffer && typeof xhr.responseText === 'string') {\n        buffer = new AWS.util.Buffer(xhr.responseText);\n      }\n    } catch (e) {}\n\n    if (buffer) emitter.emit('data', buffer);\n    emitter.emit('end');\n  }\n});\n\n\nAWS.HttpClient.prototype = AWS.XHRClient.prototype;\n\n\nAWS.HttpClient.streamsApiVersion = 1;\n\n},{\"../core\":11,\"../http\":19,\"events\":60}],21:[function(require,module,exports){\nvar util = require('../util');\n\nfunction JsonBuilder() { }\n\nJsonBuilder.prototype.build = function(value, shape) {\n  return JSON.stringify(translate(value, shape));\n};\n\nfunction translate(value, shape) {\n  if (!shape || value === undefined || value === null) return undefined;\n\n  switch (shape.type) {\n    case 'structure': return translateStructure(value, shape);\n    case 'map': return translateMap(value, shape);\n    case 'list': return translateList(value, shape);\n    default: return translateScalar(value, shape);\n  }\n}\n\nfunction translateStructure(structure, shape) {\n  var struct = {};\n  util.each(structure, function(name, value) {\n    var memberShape = shape.members[name];\n    if (memberShape) {\n      if (memberShape.location !== 'body') return;\n      var locationName = memberShape.isLocationName ? memberShape.name : name;\n      var result = translate(value, memberShape);\n      if (result !== undefined) struct[locationName] = result;\n    }\n  });\n  return struct;\n}\n\nfunction translateList(list, shape) {\n  var out = [];\n  util.arrayEach(list, function(value) {\n    var result = translate(value, shape.member);\n    if (result !== undefined) out.push(result);\n  });\n  return out;\n}\n\nfunction translateMap(map, shape) {\n  var out = {};\n  util.each(map, function(key, value) {\n    var result = translate(value, shape.value);\n    if (result !== undefined) out[key] = result;\n  });\n  return out;\n}\n\nfunction translateScalar(value, shape) {\n  return shape.toWireFormat(value);\n}\n\nmodule.exports = JsonBuilder;\n\n},{\"../util\":53}],22:[function(require,module,exports){\nvar util = require('../util');\n\nfunction JsonParser() { }\n\nJsonParser.prototype.parse = function(value, shape) {\n  return translate(JSON.parse(value), shape);\n};\n\nfunction translate(value, shape) {\n  if (!shape || value === undefined) return undefined;\n\n  switch (shape.type) {\n    case 'structure': return translateStructure(value, shape);\n    case 'map': return translateMap(value, shape);\n    case 'list': return translateList(value, shape);\n    default: return translateScalar(value, shape);\n  }\n}\n\nfunction translateStructure(structure, shape) {\n  if (structure == null) return undefined;\n\n  var struct = {};\n  var shapeMembers = shape.members;\n  util.each(shapeMembers, function(name, memberShape) {\n    var locationName = memberShape.isLocationName ? memberShape.name : name;\n    if (Object.prototype.hasOwnProperty.call(structure, locationName)) {\n      var value = structure[locationName];\n      var result = translate(value, memberShape);\n      if (result !== undefined) struct[name] = result;\n    }\n  });\n  return struct;\n}\n\nfunction translateList(list, shape) {\n  if (list == null) return undefined;\n\n  var out = [];\n  util.arrayEach(list, function(value) {\n    var result = translate(value, shape.member);\n    if (result === undefined) out.push(null);\n    else out.push(result);\n  });\n  return out;\n}\n\nfunction translateMap(map, shape) {\n  if (map == null) return undefined;\n\n  var out = {};\n  util.each(map, function(key, value) {\n    var result = translate(value, shape.value);\n    if (result === undefined) out[key] = null;\n    else out[key] = result;\n  });\n  return out;\n}\n\nfunction translateScalar(value, shape) {\n  return shape.toType(value);\n}\n\nmodule.exports = JsonParser;\n\n},{\"../util\":53}],23:[function(require,module,exports){\nvar Collection = require('./collection');\nvar Operation = require('./operation');\nvar Shape = require('./shape');\nvar Paginator = require('./paginator');\nvar ResourceWaiter = require('./resource_waiter');\n\nvar util = require('../util');\nvar property = util.property;\nvar memoizedProperty = util.memoizedProperty;\n\nfunction Api(api, options) {\n  api = api || {};\n  options = options || {};\n  options.api = this;\n\n  api.metadata = api.metadata || {};\n\n  property(this, 'isApi', true, false);\n  property(this, 'apiVersion', api.metadata.apiVersion);\n  property(this, 'endpointPrefix', api.metadata.endpointPrefix);\n  property(this, 'signingName', api.metadata.signingName);\n  property(this, 'globalEndpoint', api.metadata.globalEndpoint);\n  property(this, 'signatureVersion', api.metadata.signatureVersion);\n  property(this, 'jsonVersion', api.metadata.jsonVersion);\n  property(this, 'targetPrefix', api.metadata.targetPrefix);\n  property(this, 'protocol', api.metadata.protocol);\n  property(this, 'timestampFormat', api.metadata.timestampFormat);\n  property(this, 'xmlNamespaceUri', api.metadata.xmlNamespace);\n  property(this, 'abbreviation', api.metadata.serviceAbbreviation);\n  property(this, 'fullName', api.metadata.serviceFullName);\n\n  memoizedProperty(this, 'className', function() {\n    var name = api.metadata.serviceAbbreviation || api.metadata.serviceFullName;\n    if (!name) return null;\n\n    name = name.replace(/^Amazon|AWS\\s*|\\(.*|\\s+|\\W+/g, '');\n    if (name === 'ElasticLoadBalancing') name = 'ELB';\n    return name;\n  });\n\n  property(this, 'operations', new Collection(api.operations, options, function(name, operation) {\n    return new Operation(name, operation, options);\n  }, util.string.lowerFirst));\n\n  property(this, 'shapes', new Collection(api.shapes, options, function(name, shape) {\n    return Shape.create(shape, options);\n  }));\n\n  property(this, 'paginators', new Collection(api.paginators, options, function(name, paginator) {\n    return new Paginator(name, paginator, options);\n  }));\n\n  property(this, 'waiters', new Collection(api.waiters, options, function(name, waiter) {\n    return new ResourceWaiter(name, waiter, options);\n  }, util.string.lowerFirst));\n\n  if (options.documentation) {\n    property(this, 'documentation', api.documentation);\n    property(this, 'documentationUrl', api.documentationUrl);\n  }\n}\n\nmodule.exports = Api;\n\n},{\"../util\":53,\"./collection\":24,\"./operation\":25,\"./paginator\":26,\"./resource_waiter\":27,\"./shape\":28}],24:[function(require,module,exports){\nvar memoizedProperty = require('../util').memoizedProperty;\n\nfunction memoize(name, value, fn, nameTr) {\n  memoizedProperty(this, nameTr(name), function() {\n    return fn(name, value);\n  });\n}\n\nfunction Collection(iterable, options, fn, nameTr) {\n  nameTr = nameTr || String;\n  var self = this;\n\n  for (var id in iterable) {\n    if (Object.prototype.hasOwnProperty.call(iterable, id)) {\n      memoize.call(self, id, iterable[id], fn, nameTr);\n    }\n  }\n}\n\nmodule.exports = Collection;\n\n},{\"../util\":53}],25:[function(require,module,exports){\nvar Shape = require('./shape');\n\nvar util = require('../util');\nvar property = util.property;\nvar memoizedProperty = util.memoizedProperty;\n\nfunction Operation(name, operation, options) {\n  options = options || {};\n\n  property(this, 'name', operation.name || name);\n  property(this, 'api', options.api, false);\n\n  operation.http = operation.http || {};\n  property(this, 'httpMethod', operation.http.method || 'POST');\n  property(this, 'httpPath', operation.http.requestUri || '/');\n  property(this, 'authtype', operation.authtype || '');\n\n  memoizedProperty(this, 'input', function() {\n    if (!operation.input) {\n      return new Shape.create({type: 'structure'}, options);\n    }\n    return Shape.create(operation.input, options);\n  });\n\n  memoizedProperty(this, 'output', function() {\n    if (!operation.output) {\n      return new Shape.create({type: 'structure'}, options);\n    }\n    return Shape.create(operation.output, options);\n  });\n\n  memoizedProperty(this, 'errors', function() {\n    var list = [];\n    if (!operation.errors) return null;\n\n    for (var i = 0; i < operation.errors.length; i++) {\n      list.push(Shape.create(operation.errors[i], options));\n    }\n\n    return list;\n  });\n\n  memoizedProperty(this, 'paginator', function() {\n    return options.api.paginators[name];\n  });\n\n  if (options.documentation) {\n    property(this, 'documentation', operation.documentation);\n    property(this, 'documentationUrl', operation.documentationUrl);\n  }\n}\n\nmodule.exports = Operation;\n\n},{\"../util\":53,\"./shape\":28}],26:[function(require,module,exports){\nvar property = require('../util').property;\n\nfunction Paginator(name, paginator) {\n  property(this, 'inputToken', paginator.input_token);\n  property(this, 'limitKey', paginator.limit_key);\n  property(this, 'moreResults', paginator.more_results);\n  property(this, 'outputToken', paginator.output_token);\n  property(this, 'resultKey', paginator.result_key);\n}\n\nmodule.exports = Paginator;\n\n},{\"../util\":53}],27:[function(require,module,exports){\nvar util = require('../util');\nvar property = util.property;\n\nfunction ResourceWaiter(name, waiter, options) {\n  options = options || {};\n  property(this, 'name', name);\n  property(this, 'api', options.api, false);\n\n  if (waiter.operation) {\n    property(this, 'operation', util.string.lowerFirst(waiter.operation));\n  }\n\n  var self = this;\n  var keys = [\n    'type',\n    'description',\n    'delay',\n    'maxAttempts',\n    'acceptors'\n  ];\n\n  keys.forEach(function(key) {\n    var value = waiter[key];\n    if (value) {\n      property(self, key, value);\n    }\n  });\n}\n\nmodule.exports = ResourceWaiter;\n\n},{\"../util\":53}],28:[function(require,module,exports){\nvar Collection = require('./collection');\n\nvar util = require('../util');\n\nfunction property(obj, name, value) {\n  if (value !== null && value !== undefined) {\n    util.property.apply(this, arguments);\n  }\n}\n\nfunction memoizedProperty(obj, name) {\n  if (!obj.constructor.prototype[name]) {\n    util.memoizedProperty.apply(this, arguments);\n  }\n}\n\nfunction Shape(shape, options, memberName) {\n  options = options || {};\n\n  property(this, 'shape', shape.shape);\n  property(this, 'api', options.api, false);\n  property(this, 'type', shape.type);\n  property(this, 'enum', shape.enum);\n  property(this, 'min', shape.min);\n  property(this, 'max', shape.max);\n  property(this, 'pattern', shape.pattern);\n  property(this, 'location', shape.location || this.location || 'body');\n  property(this, 'name', this.name || shape.xmlName || shape.queryName ||\n    shape.locationName || memberName);\n  property(this, 'isStreaming', shape.streaming || this.isStreaming || false);\n  property(this, 'isComposite', shape.isComposite || false);\n  property(this, 'isShape', true, false);\n  property(this, 'isQueryName', shape.queryName ? true : false, false);\n  property(this, 'isLocationName', shape.locationName ? true : false, false);\n\n  if (options.documentation) {\n    property(this, 'documentation', shape.documentation);\n    property(this, 'documentationUrl', shape.documentationUrl);\n  }\n\n  if (shape.xmlAttribute) {\n    property(this, 'isXmlAttribute', shape.xmlAttribute || false);\n  }\n\n  property(this, 'defaultValue', null);\n  this.toWireFormat = function(value) {\n    if (value === null || value === undefined) return '';\n    return value;\n  };\n  this.toType = function(value) { return value; };\n}\n\n\nShape.normalizedTypes = {\n  character: 'string',\n  double: 'float',\n  long: 'integer',\n  short: 'integer',\n  biginteger: 'integer',\n  bigdecimal: 'float',\n  blob: 'binary'\n};\n\n\nShape.types = {\n  'structure': StructureShape,\n  'list': ListShape,\n  'map': MapShape,\n  'boolean': BooleanShape,\n  'timestamp': TimestampShape,\n  'float': FloatShape,\n  'integer': IntegerShape,\n  'string': StringShape,\n  'base64': Base64Shape,\n  'binary': BinaryShape\n};\n\nShape.resolve = function resolve(shape, options) {\n  if (shape.shape) {\n    var refShape = options.api.shapes[shape.shape];\n    if (!refShape) {\n      throw new Error('Cannot find shape reference: ' + shape.shape);\n    }\n\n    return refShape;\n  } else {\n    return null;\n  }\n};\n\nShape.create = function create(shape, options, memberName) {\n  if (shape.isShape) return shape;\n\n  var refShape = Shape.resolve(shape, options);\n  if (refShape) {\n    var filteredKeys = Object.keys(shape);\n    if (!options.documentation) {\n      filteredKeys = filteredKeys.filter(function(name) {\n        return !name.match(/documentation/);\n      });\n    }\n    if (filteredKeys === ['shape']) { // no inline customizations\n      return refShape;\n    }\n\n    var InlineShape = function() {\n      refShape.constructor.call(this, shape, options, memberName);\n    };\n    InlineShape.prototype = refShape;\n    return new InlineShape();\n  } else {\n    if (!shape.type) {\n      if (shape.members) shape.type = 'structure';\n      else if (shape.member) shape.type = 'list';\n      else if (shape.key) shape.type = 'map';\n      else shape.type = 'string';\n    }\n\n    var origType = shape.type;\n    if (Shape.normalizedTypes[shape.type]) {\n      shape.type = Shape.normalizedTypes[shape.type];\n    }\n\n    if (Shape.types[shape.type]) {\n      return new Shape.types[shape.type](shape, options, memberName);\n    } else {\n      throw new Error('Unrecognized shape type: ' + origType);\n    }\n  }\n};\n\nfunction CompositeShape(shape) {\n  Shape.apply(this, arguments);\n  property(this, 'isComposite', true);\n\n  if (shape.flattened) {\n    property(this, 'flattened', shape.flattened || false);\n  }\n}\n\nfunction StructureShape(shape, options) {\n  var requiredMap = null, firstInit = !this.isShape;\n\n  CompositeShape.apply(this, arguments);\n\n  if (firstInit) {\n    property(this, 'defaultValue', function() { return {}; });\n    property(this, 'members', {});\n    property(this, 'memberNames', []);\n    property(this, 'required', []);\n    property(this, 'isRequired', function() { return false; });\n  }\n\n  if (shape.members) {\n    property(this, 'members', new Collection(shape.members, options, function(name, member) {\n      return Shape.create(member, options, name);\n    }));\n    memoizedProperty(this, 'memberNames', function() {\n      return shape.xmlOrder || Object.keys(shape.members);\n    });\n  }\n\n  if (shape.required) {\n    property(this, 'required', shape.required);\n    property(this, 'isRequired', function(name) {\n      if (!requiredMap) {\n        requiredMap = {};\n        for (var i = 0; i < shape.required.length; i++) {\n          requiredMap[shape.required[i]] = true;\n        }\n      }\n\n      return requiredMap[name];\n    }, false, true);\n  }\n\n  property(this, 'resultWrapper', shape.resultWrapper || null);\n\n  if (shape.payload) {\n    property(this, 'payload', shape.payload);\n  }\n\n  if (typeof shape.xmlNamespace === 'string') {\n    property(this, 'xmlNamespaceUri', shape.xmlNamespace);\n  } else if (typeof shape.xmlNamespace === 'object') {\n    property(this, 'xmlNamespacePrefix', shape.xmlNamespace.prefix);\n    property(this, 'xmlNamespaceUri', shape.xmlNamespace.uri);\n  }\n}\n\nfunction ListShape(shape, options) {\n  var self = this, firstInit = !this.isShape;\n  CompositeShape.apply(this, arguments);\n\n  if (firstInit) {\n    property(this, 'defaultValue', function() { return []; });\n  }\n\n  if (shape.member) {\n    memoizedProperty(this, 'member', function() {\n      return Shape.create(shape.member, options);\n    });\n  }\n\n  if (this.flattened) {\n    var oldName = this.name;\n    memoizedProperty(this, 'name', function() {\n      return self.member.name || oldName;\n    });\n  }\n}\n\nfunction MapShape(shape, options) {\n  var firstInit = !this.isShape;\n  CompositeShape.apply(this, arguments);\n\n  if (firstInit) {\n    property(this, 'defaultValue', function() { return {}; });\n    property(this, 'key', Shape.create({type: 'string'}, options));\n    property(this, 'value', Shape.create({type: 'string'}, options));\n  }\n\n  if (shape.key) {\n    memoizedProperty(this, 'key', function() {\n      return Shape.create(shape.key, options);\n    });\n  }\n  if (shape.value) {\n    memoizedProperty(this, 'value', function() {\n      return Shape.create(shape.value, options);\n    });\n  }\n}\n\nfunction TimestampShape(shape) {\n  var self = this;\n  Shape.apply(this, arguments);\n\n  if (this.location === 'header') {\n    property(this, 'timestampFormat', 'rfc822');\n  } else if (shape.timestampFormat) {\n    property(this, 'timestampFormat', shape.timestampFormat);\n  } else if (this.api) {\n    if (this.api.timestampFormat) {\n      property(this, 'timestampFormat', this.api.timestampFormat);\n    } else {\n      switch (this.api.protocol) {\n        case 'json':\n        case 'rest-json':\n          property(this, 'timestampFormat', 'unixTimestamp');\n          break;\n        case 'rest-xml':\n        case 'query':\n        case 'ec2':\n          property(this, 'timestampFormat', 'iso8601');\n          break;\n      }\n    }\n  }\n\n  this.toType = function(value) {\n    if (value === null || value === undefined) return null;\n    if (typeof value.toUTCString === 'function') return value;\n    return typeof value === 'string' || typeof value === 'number' ?\n           util.date.parseTimestamp(value) : null;\n  };\n\n  this.toWireFormat = function(value) {\n    return util.date.format(value, self.timestampFormat);\n  };\n}\n\nfunction StringShape() {\n  Shape.apply(this, arguments);\n\n  if (this.api) {\n    switch (this.api.protocol) {\n      case 'rest-xml':\n      case 'query':\n      case 'ec2':\n        this.toType = function(value) { return value || ''; };\n    }\n  }\n}\n\nfunction FloatShape() {\n  Shape.apply(this, arguments);\n\n  this.toType = function(value) {\n    if (value === null || value === undefined) return null;\n    return parseFloat(value);\n  };\n  this.toWireFormat = this.toType;\n}\n\nfunction IntegerShape() {\n  Shape.apply(this, arguments);\n\n  this.toType = function(value) {\n    if (value === null || value === undefined) return null;\n    return parseInt(value, 10);\n  };\n  this.toWireFormat = this.toType;\n}\n\nfunction BinaryShape() {\n  Shape.apply(this, arguments);\n  this.toType = util.base64.decode;\n  this.toWireFormat = util.base64.encode;\n}\n\nfunction Base64Shape() {\n  BinaryShape.apply(this, arguments);\n}\n\nfunction BooleanShape() {\n  Shape.apply(this, arguments);\n\n  this.toType = function(value) {\n    if (typeof value === 'boolean') return value;\n    if (value === null || value === undefined) return null;\n    return value === 'true';\n  };\n}\n\n\nShape.shapes = {\n  StructureShape: StructureShape,\n  ListShape: ListShape,\n  MapShape: MapShape,\n  StringShape: StringShape,\n  BooleanShape: BooleanShape,\n  Base64Shape: Base64Shape\n};\n\nmodule.exports = Shape;\n\n},{\"../util\":53,\"./collection\":24}],29:[function(require,module,exports){\nvar AWS = require('./core');\n\n\nAWS.ParamValidator = AWS.util.inherit({\n\n  constructor: function ParamValidator(validation) {\n    if (validation === true || validation === undefined) {\n      validation = {'min': true};\n    }\n    this.validation = validation;\n  },\n\n  validate: function validate(shape, params, context) {\n    this.errors = [];\n    this.validateMember(shape, params || {}, context || 'params');\n\n    if (this.errors.length > 1) {\n      var msg = this.errors.join('\\n* ');\n      msg = 'There were ' + this.errors.length +\n        ' validation errors:\\n* ' + msg;\n      throw AWS.util.error(new Error(msg),\n        {code: 'MultipleValidationErrors', errors: this.errors});\n    } else if (this.errors.length === 1) {\n      throw this.errors[0];\n    } else {\n      return true;\n    }\n  },\n\n  fail: function fail(code, message) {\n    this.errors.push(AWS.util.error(new Error(message), {code: code}));\n  },\n\n  validateStructure: function validateStructure(shape, params, context) {\n    this.validateType(params, context, ['object'], 'structure');\n\n    var paramName;\n    for (var i = 0; shape.required && i < shape.required.length; i++) {\n      paramName = shape.required[i];\n      var value = params[paramName];\n      if (value === undefined || value === null) {\n        this.fail('MissingRequiredParameter',\n          'Missing required key \\'' + paramName + '\\' in ' + context);\n      }\n    }\n\n    for (paramName in params) {\n      if (!Object.prototype.hasOwnProperty.call(params, paramName)) continue;\n\n      var paramValue = params[paramName],\n          memberShape = shape.members[paramName];\n\n      if (memberShape !== undefined) {\n        var memberContext = [context, paramName].join('.');\n        this.validateMember(memberShape, paramValue, memberContext);\n      } else {\n        this.fail('UnexpectedParameter',\n          'Unexpected key \\'' + paramName + '\\' found in ' + context);\n      }\n    }\n\n    return true;\n  },\n\n  validateMember: function validateMember(shape, param, context) {\n    switch (shape.type) {\n      case 'structure':\n        return this.validateStructure(shape, param, context);\n      case 'list':\n        return this.validateList(shape, param, context);\n      case 'map':\n        return this.validateMap(shape, param, context);\n      default:\n        return this.validateScalar(shape, param, context);\n    }\n  },\n\n  validateList: function validateList(shape, params, context) {\n    if (this.validateType(params, context, [Array])) {\n      this.validateRange(shape, params.length, context, 'list member count');\n      for (var i = 0; i < params.length; i++) {\n        this.validateMember(shape.member, params[i], context + '[' + i + ']');\n      }\n    }\n  },\n\n  validateMap: function validateMap(shape, params, context) {\n    if (this.validateType(params, context, ['object'], 'map')) {\n      var mapCount = 0;\n      for (var param in params) {\n        if (!Object.prototype.hasOwnProperty.call(params, param)) continue;\n        this.validateMember(shape.key, param,\n                            context + '[key=\\'' + param + '\\']')\n        this.validateMember(shape.value, params[param],\n                            context + '[\\'' + param + '\\']');\n        mapCount++;\n      }\n      this.validateRange(shape, mapCount, context, 'map member count');\n    }\n  },\n\n  validateScalar: function validateScalar(shape, value, context) {\n    switch (shape.type) {\n      case null:\n      case undefined:\n      case 'string':\n        return this.validateString(shape, value, context);\n      case 'base64':\n      case 'binary':\n        return this.validatePayload(value, context);\n      case 'integer':\n      case 'float':\n        return this.validateNumber(shape, value, context);\n      case 'boolean':\n        return this.validateType(value, context, ['boolean']);\n      case 'timestamp':\n        return this.validateType(value, context, [Date,\n          /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$/, 'number'],\n          'Date object, ISO-8601 string, or a UNIX timestamp');\n      default:\n        return this.fail('UnkownType', 'Unhandled type ' +\n                         shape.type + ' for ' + context);\n    }\n  },\n\n  validateString: function validateString(shape, value, context) {\n    if (this.validateType(value, context, ['string'])) {\n      this.validateEnum(shape, value, context);\n      this.validateRange(shape, value.length, context, 'string length');\n      this.validatePattern(shape, value, context);\n    }\n  },\n\n  validatePattern: function validatePattern(shape, value, context) {\n    if (this.validation['pattern'] && shape['pattern'] !== undefined) {\n      if (!(new RegExp(shape['pattern'])).test(value)) {\n        this.fail('PatternMatchError', 'Provided value \"' + value + '\" '\n          + 'does not match regex pattern /' + shape['pattern'] + '/ for '\n          + context);\n      }\n    }\n  },\n\n  validateRange: function validateRange(shape, value, context, descriptor) {\n    if (this.validation['min']) {\n      if (shape['min'] !== undefined && value < shape['min']) {\n        this.fail('MinRangeError', 'Expected ' + descriptor + ' >= '\n          + shape['min'] + ', but found ' + value + ' for ' + context);\n      }\n    }\n    if (this.validation['max']) {\n      if (shape['max'] !== undefined && value > shape['max']) {\n        this.fail('MaxRangeError', 'Expected ' + descriptor + ' <= '\n          + shape['max'] + ', but found ' + value + ' for ' + context);\n      }\n    }\n  },\n\n  validateEnum: function validateRange(shape, value, context) {\n    if (this.validation['enum'] && shape['enum'] !== undefined) {\n      if (shape['enum'].indexOf(value) === -1) {\n        this.fail('EnumError', 'Found string value of ' + value + ', but '\n          + 'expected ' + shape['enum'].join('|') + ' for ' + context);\n      }\n    }\n  },\n\n  validateType: function validateType(value, context, acceptedTypes, type) {\n    if (value === null || value === undefined) return false;\n\n    var foundInvalidType = false;\n    for (var i = 0; i < acceptedTypes.length; i++) {\n      if (typeof acceptedTypes[i] === 'string') {\n        if (typeof value === acceptedTypes[i]) return true;\n      } else if (acceptedTypes[i] instanceof RegExp) {\n        if ((value || '').toString().match(acceptedTypes[i])) return true;\n      } else {\n        if (value instanceof acceptedTypes[i]) return true;\n        if (AWS.util.isType(value, acceptedTypes[i])) return true;\n        if (!type && !foundInvalidType) acceptedTypes = acceptedTypes.slice();\n        acceptedTypes[i] = AWS.util.typeName(acceptedTypes[i]);\n      }\n      foundInvalidType = true;\n    }\n\n    var acceptedType = type;\n    if (!acceptedType) {\n      acceptedType = acceptedTypes.join(', ').replace(/,([^,]+)$/, ', or$1');\n    }\n\n    var vowel = acceptedType.match(/^[aeiou]/i) ? 'n' : '';\n    this.fail('InvalidParameterType', 'Expected ' + context + ' to be a' +\n              vowel + ' ' + acceptedType);\n    return false;\n  },\n\n  validateNumber: function validateNumber(shape, value, context) {\n    if (value === null || value === undefined) return;\n    if (typeof value === 'string') {\n      var castedValue = parseFloat(value);\n      if (castedValue.toString() === value) value = castedValue;\n    }\n    if (this.validateType(value, context, ['number'])) {\n      this.validateRange(shape, value, context, 'numeric value');\n    }\n  },\n\n  validatePayload: function validatePayload(value, context) {\n    if (value === null || value === undefined) return;\n    if (typeof value === 'string') return;\n    if (value && typeof value.byteLength === 'number') return; // typed arrays\n    if (AWS.util.isNode()) { // special check for buffer/stream in Node.js\n      var Stream = AWS.util.stream.Stream;\n      if (AWS.util.Buffer.isBuffer(value) || value instanceof Stream) return;\n    }\n\n    var types = ['Buffer', 'Stream', 'File', 'Blob', 'ArrayBuffer', 'DataView'];\n    if (value) {\n      for (var i = 0; i < types.length; i++) {\n        if (AWS.util.isType(value, types[i])) return;\n        if (AWS.util.typeName(value.constructor) === types[i]) return;\n      }\n    }\n\n    this.fail('InvalidParameterType', 'Expected ' + context + ' to be a ' +\n      'string, Buffer, Stream, Blob, or typed array object');\n  }\n});\n\n},{\"./core\":11}],30:[function(require,module,exports){\nvar util = require('../util');\nvar JsonBuilder = require('../json/builder');\nvar JsonParser = require('../json/parser');\n\nfunction buildRequest(req) {\n  var httpRequest = req.httpRequest;\n  var api = req.service.api;\n  var target = api.targetPrefix + '.' + api.operations[req.operation].name;\n  var version = api.jsonVersion || '1.0';\n  var input = api.operations[req.operation].input;\n  var builder = new JsonBuilder();\n\n  if (version === 1) version = '1.0';\n  httpRequest.body = builder.build(req.params || {}, input);\n  httpRequest.headers['Content-Type'] = 'application/x-amz-json-' + version;\n  httpRequest.headers['X-Amz-Target'] = target;\n}\n\nfunction extractError(resp) {\n  var error = {};\n  var httpResponse = resp.httpResponse;\n\n  error.code = httpResponse.headers['x-amzn-errortype'] || 'UnknownError';\n  if (typeof error.code === 'string') {\n    error.code = error.code.split(':')[0];\n  }\n\n  if (httpResponse.body.length > 0) {\n    var e = JSON.parse(httpResponse.body.toString());\n    if (e.__type || e.code) {\n      error.code = (e.__type || e.code).split('#').pop();\n    }\n    if (error.code === 'RequestEntityTooLarge') {\n      error.message = 'Request body must be less than 1 MB';\n    } else {\n      error.message = (e.message || e.Message || null);\n    }\n  } else {\n    error.statusCode = httpResponse.statusCode;\n    error.message = httpResponse.statusCode.toString();\n  }\n\n  resp.error = util.error(new Error(), error);\n}\n\nfunction extractData(resp) {\n  var body = resp.httpResponse.body.toString() || '{}';\n  if (resp.request.service.config.convertResponseTypes === false) {\n    resp.data = JSON.parse(body);\n  } else {\n    var operation = resp.request.service.api.operations[resp.request.operation];\n    var shape = operation.output || {};\n    var parser = new JsonParser();\n    resp.data = parser.parse(body, shape);\n  }\n}\n\nmodule.exports = {\n  buildRequest: buildRequest,\n  extractError: extractError,\n  extractData: extractData\n};\n\n},{\"../json/builder\":21,\"../json/parser\":22,\"../util\":53}],31:[function(require,module,exports){\nvar AWS = require('../core');\nvar util = require('../util');\nvar QueryParamSerializer = require('../query/query_param_serializer');\nvar Shape = require('../model/shape');\n\nfunction buildRequest(req) {\n  var operation = req.service.api.operations[req.operation];\n  var httpRequest = req.httpRequest;\n  httpRequest.headers['Content-Type'] =\n    'application/x-www-form-urlencoded; charset=utf-8';\n  httpRequest.params = {\n    Version: req.service.api.apiVersion,\n    Action: operation.name\n  };\n\n  var builder = new QueryParamSerializer();\n  builder.serialize(req.params, operation.input, function(name, value) {\n    httpRequest.params[name] = value;\n  });\n  httpRequest.body = util.queryParamsToString(httpRequest.params);\n}\n\nfunction extractError(resp) {\n  var data, body = resp.httpResponse.body.toString();\n  if (body.match('<UnknownOperationException')) {\n    data = {\n      Code: 'UnknownOperation',\n      Message: 'Unknown operation ' + resp.request.operation\n    };\n  } else {\n    data = new AWS.XML.Parser().parse(body);\n  }\n\n  if (data.requestId && !resp.requestId) resp.requestId = data.requestId;\n  if (data.Errors) data = data.Errors;\n  if (data.Error) data = data.Error;\n  if (data.Code) {\n    resp.error = util.error(new Error(), {\n      code: data.Code,\n      message: data.Message\n    });\n  } else {\n    resp.error = util.error(new Error(), {\n      code: resp.httpResponse.statusCode,\n      message: null\n    });\n  }\n}\n\nfunction extractData(resp) {\n  var req = resp.request;\n  var operation = req.service.api.operations[req.operation];\n  var shape = operation.output || {};\n  var origRules = shape;\n\n  if (origRules.resultWrapper) {\n    var tmp = Shape.create({type: 'structure'});\n    tmp.members[origRules.resultWrapper] = shape;\n    tmp.memberNames = [origRules.resultWrapper];\n    util.property(shape, 'name', shape.resultWrapper);\n    shape = tmp;\n  }\n\n  var parser = new AWS.XML.Parser();\n\n  if (shape && shape.members && !shape.members._XAMZRequestId) {\n    var requestIdShape = Shape.create(\n      { type: 'string' },\n      { api: { protocol: 'query' } },\n      'requestId'\n    );\n    shape.members._XAMZRequestId = requestIdShape;\n  }\n\n  var data = parser.parse(resp.httpResponse.body.toString(), shape);\n  resp.requestId = data._XAMZRequestId || data.requestId;\n\n  if (data._XAMZRequestId) delete data._XAMZRequestId;\n\n  if (origRules.resultWrapper) {\n    if (data[origRules.resultWrapper]) {\n      util.update(data, data[origRules.resultWrapper]);\n      delete data[origRules.resultWrapper];\n    }\n  }\n\n  resp.data = data;\n}\n\nmodule.exports = {\n  buildRequest: buildRequest,\n  extractError: extractError,\n  extractData: extractData\n};\n\n},{\"../core\":11,\"../model/shape\":28,\"../query/query_param_serializer\":35,\"../util\":53}],32:[function(require,module,exports){\nvar util = require('../util');\n\nfunction populateMethod(req) {\n  req.httpRequest.method = req.service.api.operations[req.operation].httpMethod;\n}\n\nfunction populateURI(req) {\n  var operation = req.service.api.operations[req.operation];\n  var input = operation.input;\n  var uri = [req.httpRequest.endpoint.path, operation.httpPath].join('/');\n  uri = uri.replace(/\\/+/g, '/');\n\n  var queryString = {}, queryStringSet = false;\n  util.each(input.members, function (name, member) {\n    var paramValue = req.params[name];\n    if (paramValue === null || paramValue === undefined) return;\n    if (member.location === 'uri') {\n      var regex = new RegExp('\\\\{' + member.name + '(\\\\+)?\\\\}');\n      uri = uri.replace(regex, function(_, plus) {\n        var fn = plus ? util.uriEscapePath : util.uriEscape;\n        return fn(String(paramValue));\n      });\n    } else if (member.location === 'querystring') {\n      queryStringSet = true;\n\n      if (member.type === 'list') {\n        queryString[member.name] = paramValue.map(function(val) {\n          return util.uriEscape(String(val));\n        });\n      } else if (member.type === 'map') {\n        util.each(paramValue, function(key, value) {\n          if (Array.isArray(value)) {\n            queryString[key] = value.map(function(val) {\n              return util.uriEscape(String(val));\n            });\n          } else {\n            queryString[key] = util.uriEscape(String(value));\n          }\n        });\n      } else {\n        queryString[member.name] = util.uriEscape(String(paramValue));\n      }\n    }\n  });\n\n  if (queryStringSet) {\n    uri += (uri.indexOf('?') >= 0 ? '&' : '?');\n    var parts = [];\n    util.arrayEach(Object.keys(queryString).sort(), function(key) {\n      if (!Array.isArray(queryString[key])) {\n        queryString[key] = [queryString[key]];\n      }\n      for (var i = 0; i < queryString[key].length; i++) {\n        parts.push(util.uriEscape(String(key)) + '=' + queryString[key][i]);\n      }\n    });\n    uri += parts.join('&');\n  }\n\n  req.httpRequest.path = uri;\n}\n\nfunction populateHeaders(req) {\n  var operation = req.service.api.operations[req.operation];\n  util.each(operation.input.members, function (name, member) {\n    var value = req.params[name];\n    if (value === null || value === undefined) return;\n\n    if (member.location === 'headers' && member.type === 'map') {\n      util.each(value, function(key, memberValue) {\n        req.httpRequest.headers[member.name + key] = memberValue;\n      });\n    } else if (member.location === 'header') {\n      value = member.toWireFormat(value).toString();\n      req.httpRequest.headers[member.name] = value;\n    }\n  });\n}\n\nfunction buildRequest(req) {\n  populateMethod(req);\n  populateURI(req);\n  populateHeaders(req);\n}\n\nfunction extractError() {\n}\n\nfunction extractData(resp) {\n  var req = resp.request;\n  var data = {};\n  var r = resp.httpResponse;\n  var operation = req.service.api.operations[req.operation];\n  var output = operation.output;\n\n  var headers = {};\n  util.each(r.headers, function (k, v) {\n    headers[k.toLowerCase()] = v;\n  });\n\n  util.each(output.members, function(name, member) {\n    var header = (member.name || name).toLowerCase();\n    if (member.location === 'headers' && member.type === 'map') {\n      data[name] = {};\n      var location = member.isLocationName ? member.name : '';\n      var pattern = new RegExp('^' + location + '(.+)', 'i');\n      util.each(r.headers, function (k, v) {\n        var result = k.match(pattern);\n        if (result !== null) {\n          data[name][result[1]] = v;\n        }\n      });\n    } else if (member.location === 'header') {\n      if (headers[header] !== undefined) {\n        data[name] = headers[header];\n      }\n    } else if (member.location === 'statusCode') {\n      data[name] = parseInt(r.statusCode, 10);\n    }\n  });\n\n  resp.data = data;\n}\n\nmodule.exports = {\n  buildRequest: buildRequest,\n  extractError: extractError,\n  extractData: extractData\n};\n\n},{\"../util\":53}],33:[function(require,module,exports){\nvar util = require('../util');\nvar Rest = require('./rest');\nvar Json = require('./json');\nvar JsonBuilder = require('../json/builder');\nvar JsonParser = require('../json/parser');\n\nfunction populateBody(req) {\n  var builder = new JsonBuilder();\n  var input = req.service.api.operations[req.operation].input;\n\n  if (input.payload) {\n    var params = {};\n    var payloadShape = input.members[input.payload];\n    params = req.params[input.payload];\n    if (params === undefined) return;\n\n    if (payloadShape.type === 'structure') {\n      req.httpRequest.body = builder.build(params, payloadShape);\n    } else { // non-JSON payload\n      req.httpRequest.body = params;\n    }\n  } else {\n    req.httpRequest.body = builder.build(req.params, input);\n  }\n}\n\nfunction buildRequest(req) {\n  Rest.buildRequest(req);\n\n  if (['GET', 'HEAD', 'DELETE'].indexOf(req.httpRequest.method) < 0) {\n    populateBody(req);\n  }\n}\n\nfunction extractError(resp) {\n  Json.extractError(resp);\n}\n\nfunction extractData(resp) {\n  Rest.extractData(resp);\n\n  var req = resp.request;\n  var rules = req.service.api.operations[req.operation].output || {};\n  if (rules.payload) {\n    var payloadMember = rules.members[rules.payload];\n    var body = resp.httpResponse.body;\n    if (payloadMember.isStreaming) {\n      resp.data[rules.payload] = body;\n    } else if (payloadMember.type === 'structure' || payloadMember.type === 'list') {\n      var parser = new JsonParser();\n      resp.data[rules.payload] = parser.parse(body, payloadMember);\n    } else {\n      resp.data[rules.payload] = body.toString();\n    }\n  } else {\n    var data = resp.data;\n    Json.extractData(resp);\n    resp.data = util.merge(data, resp.data);\n  }\n}\n\nmodule.exports = {\n  buildRequest: buildRequest,\n  extractError: extractError,\n  extractData: extractData\n};\n\n},{\"../json/builder\":21,\"../json/parser\":22,\"../util\":53,\"./json\":30,\"./rest\":32}],34:[function(require,module,exports){\nvar AWS = require('../core');\nvar util = require('../util');\nvar Rest = require('./rest');\n\nfunction populateBody(req) {\n  var input = req.service.api.operations[req.operation].input;\n  var builder = new AWS.XML.Builder();\n  var params = req.params;\n\n  var payload = input.payload;\n  if (payload) {\n    var payloadMember = input.members[payload];\n    params = params[payload];\n    if (params === undefined) return;\n\n    if (payloadMember.type === 'structure') {\n      var rootElement = payloadMember.name;\n      req.httpRequest.body = builder.toXML(params, payloadMember, rootElement, true);\n    } else { // non-xml payload\n      req.httpRequest.body = params;\n    }\n  } else {\n    req.httpRequest.body = builder.toXML(params, input, input.name ||\n      input.shape || util.string.upperFirst(req.operation) + 'Request');\n  }\n}\n\nfunction buildRequest(req) {\n  Rest.buildRequest(req);\n\n  if (['GET', 'HEAD'].indexOf(req.httpRequest.method) < 0) {\n    populateBody(req);\n  }\n}\n\nfunction extractError(resp) {\n  Rest.extractError(resp);\n\n  var data = new AWS.XML.Parser().parse(resp.httpResponse.body.toString());\n  if (data.Errors) data = data.Errors;\n  if (data.Error) data = data.Error;\n  if (data.Code) {\n    resp.error = util.error(new Error(), {\n      code: data.Code,\n      message: data.Message\n    });\n  } else {\n    resp.error = util.error(new Error(), {\n      code: resp.httpResponse.statusCode,\n      message: null\n    });\n  }\n}\n\nfunction extractData(resp) {\n  Rest.extractData(resp);\n\n  var parser;\n  var req = resp.request;\n  var body = resp.httpResponse.body;\n  var operation = req.service.api.operations[req.operation];\n  var output = operation.output;\n\n  var payload = output.payload;\n  if (payload) {\n    var payloadMember = output.members[payload];\n    if (payloadMember.isStreaming) {\n      resp.data[payload] = body;\n    } else if (payloadMember.type === 'structure') {\n      parser = new AWS.XML.Parser();\n      resp.data[payload] = parser.parse(body.toString(), payloadMember);\n    } else {\n      resp.data[payload] = body.toString();\n    }\n  } else if (body.length > 0) {\n    parser = new AWS.XML.Parser();\n    var data = parser.parse(body.toString(), output);\n    util.update(resp.data, data);\n  }\n}\n\nmodule.exports = {\n  buildRequest: buildRequest,\n  extractError: extractError,\n  extractData: extractData\n};\n\n},{\"../core\":11,\"../util\":53,\"./rest\":32}],35:[function(require,module,exports){\nvar util = require('../util');\n\nfunction QueryParamSerializer() {\n}\n\nQueryParamSerializer.prototype.serialize = function(params, shape, fn) {\n  serializeStructure('', params, shape, fn);\n};\n\nfunction ucfirst(shape) {\n  if (shape.isQueryName || shape.api.protocol !== 'ec2') {\n    return shape.name;\n  } else {\n    return shape.name[0].toUpperCase() + shape.name.substr(1);\n  }\n}\n\nfunction serializeStructure(prefix, struct, rules, fn) {\n  util.each(rules.members, function(name, member) {\n    var value = struct[name];\n    if (value === null || value === undefined) return;\n\n    var memberName = ucfirst(member);\n    memberName = prefix ? prefix + '.' + memberName : memberName;\n    serializeMember(memberName, value, member, fn);\n  });\n}\n\nfunction serializeMap(name, map, rules, fn) {\n  var i = 1;\n  util.each(map, function (key, value) {\n    var prefix = rules.flattened ? '.' : '.entry.';\n    var position = prefix + (i++) + '.';\n    var keyName = position + (rules.key.name || 'key');\n    var valueName = position + (rules.value.name || 'value');\n    serializeMember(name + keyName, key, rules.key, fn);\n    serializeMember(name + valueName, value, rules.value, fn);\n  });\n}\n\nfunction serializeList(name, list, rules, fn) {\n  var memberRules = rules.member || {};\n\n  if (list.length === 0) {\n    fn.call(this, name, null);\n    return;\n  }\n\n  util.arrayEach(list, function (v, n) {\n    var suffix = '.' + (n + 1);\n    if (rules.api.protocol === 'ec2') {\n      suffix = suffix + ''; // make linter happy\n    } else if (rules.flattened) {\n      if (memberRules.name) {\n        var parts = name.split('.');\n        parts.pop();\n        parts.push(ucfirst(memberRules));\n        name = parts.join('.');\n      }\n    } else {\n      suffix = '.member' + suffix;\n    }\n    serializeMember(name + suffix, v, memberRules, fn);\n  });\n}\n\nfunction serializeMember(name, value, rules, fn) {\n  if (value === null || value === undefined) return;\n  if (rules.type === 'structure') {\n    serializeStructure(name, value, rules, fn);\n  } else if (rules.type === 'list') {\n    serializeList(name, value, rules, fn);\n  } else if (rules.type === 'map') {\n    serializeMap(name, value, rules, fn);\n  } else {\n    fn(name, rules.toWireFormat(value).toString());\n  }\n}\n\nmodule.exports = QueryParamSerializer;\n\n},{\"../util\":53}],36:[function(require,module,exports){\nvar util = require('./util');\nvar regionConfig = require('./region_config.json');\n\nfunction generateRegionPrefix(region) {\n  if (!region) return null;\n\n  var parts = region.split('-');\n  if (parts.length < 3) return null;\n  return parts.slice(0, parts.length - 2).join('-') + '-*';\n}\n\nfunction derivedKeys(service) {\n  var region = service.config.region;\n  var regionPrefix = generateRegionPrefix(region);\n  var endpointPrefix = service.api.endpointPrefix;\n\n  return [\n    [region, endpointPrefix],\n    [regionPrefix, endpointPrefix],\n    [region, '*'],\n    [regionPrefix, '*'],\n    ['*', endpointPrefix],\n    ['*', '*']\n  ].map(function(item) {\n    return item[0] && item[1] ? item.join('/') : null;\n  });\n}\n\nfunction applyConfig(service, config) {\n  util.each(config, function(key, value) {\n    if (key === 'globalEndpoint') return;\n    if (service.config[key] === undefined || service.config[key] === null) {\n      service.config[key] = value;\n    }\n  });\n}\n\nfunction configureEndpoint(service) {\n  var keys = derivedKeys(service);\n  for (var i = 0; i < keys.length; i++) {\n    var key = keys[i];\n    if (!key) continue;\n\n    if (Object.prototype.hasOwnProperty.call(regionConfig.rules, key)) {\n      var config = regionConfig.rules[key];\n      if (typeof config === 'string') {\n        config = regionConfig.patterns[config];\n      }\n\n      if (service.config.useDualstack && util.isDualstackAvailable(service)) {\n        config = util.copy(config);\n        config.endpoint = '{service}.dualstack.{region}.amazonaws.com';\n      }\n\n      service.isGlobalEndpoint = !!config.globalEndpoint;\n\n      if (!config.signatureVersion) config.signatureVersion = 'v4';\n\n      applyConfig(service, config);\n      return;\n    }\n  }\n}\n\nmodule.exports = configureEndpoint;\n\n},{\"./region_config.json\":37,\"./util\":53}],37:[function(require,module,exports){\nmodule.exports={\n  \"rules\": {\n    \"*/*\": {\n      \"endpoint\": \"{service}.{region}.amazonaws.com\"\n    },\n    \"cn-*/*\": {\n      \"endpoint\": \"{service}.{region}.amazonaws.com.cn\"\n    },\n    \"*/cloudfront\": \"globalSSL\",\n    \"*/iam\": \"globalSSL\",\n    \"*/sts\": \"globalSSL\",\n    \"*/importexport\": {\n      \"endpoint\": \"{service}.amazonaws.com\",\n      \"signatureVersion\": \"v2\",\n      \"globalEndpoint\": true\n    },\n    \"*/route53\": {\n      \"endpoint\": \"https://{service}.amazonaws.com\",\n      \"signatureVersion\": \"v3https\",\n      \"globalEndpoint\": true\n    },\n    \"*/waf\": \"globalSSL\",\n    \"us-gov-*/iam\": \"globalGovCloud\",\n    \"us-gov-*/sts\": {\n      \"endpoint\": \"{service}.{region}.amazonaws.com\"\n    },\n    \"us-gov-west-1/s3\": \"s3dash\",\n    \"us-west-1/s3\": \"s3dash\",\n    \"us-west-2/s3\": \"s3dash\",\n    \"eu-west-1/s3\": \"s3dash\",\n    \"ap-southeast-1/s3\": \"s3dash\",\n    \"ap-southeast-2/s3\": \"s3dash\",\n    \"ap-northeast-1/s3\": \"s3dash\",\n    \"sa-east-1/s3\": \"s3dash\",\n    \"us-east-1/s3\": {\n      \"endpoint\": \"{service}.amazonaws.com\",\n      \"signatureVersion\": \"s3\"\n    },\n    \"us-east-1/sdb\": {\n      \"endpoint\": \"{service}.amazonaws.com\",\n      \"signatureVersion\": \"v2\"\n    },\n    \"*/sdb\": {\n      \"endpoint\": \"{service}.{region}.amazonaws.com\",\n      \"signatureVersion\": \"v2\"\n    }\n  },\n\n  \"patterns\": {\n    \"globalSSL\": {\n      \"endpoint\": \"https://{service}.amazonaws.com\",\n      \"globalEndpoint\": true\n    },\n    \"globalGovCloud\": {\n      \"endpoint\": \"{service}.us-gov.amazonaws.com\"\n    },\n    \"s3dash\": {\n      \"endpoint\": \"{service}-{region}.amazonaws.com\",\n      \"signatureVersion\": \"s3\"\n    }\n  }\n}\n\n},{}],38:[function(require,module,exports){\n(function (process){\nvar AWS = require('./core');\nvar AcceptorStateMachine = require('./state_machine');\nvar inherit = AWS.util.inherit;\nvar domain = AWS.util.domain;\nvar jmespath = require('jmespath');\n\n\nvar hardErrorStates = {success: 1, error: 1, complete: 1};\n\nfunction isTerminalState(machine) {\n  return Object.prototype.hasOwnProperty.call(hardErrorStates, machine._asm.currentState);\n}\n\nvar fsm = new AcceptorStateMachine();\nfsm.setupStates = function() {\n  var transition = function(_, done) {\n    var self = this;\n    self._haltHandlersOnError = false;\n\n    self.emit(self._asm.currentState, function(err) {\n      if (err) {\n        if (isTerminalState(self)) {\n          if (domain && self.domain instanceof domain.Domain) {\n            err.domainEmitter = self;\n            err.domain = self.domain;\n            err.domainThrown = false;\n            self.domain.emit('error', err);\n          } else {\n            throw err;\n          }\n        } else {\n          self.response.error = err;\n          done(err);\n        }\n      } else {\n        done(self.response.error);\n      }\n    });\n\n  };\n\n  this.addState('validate', 'build', 'error', transition);\n  this.addState('build', 'afterBuild', 'restart', transition);\n  this.addState('afterBuild', 'sign', 'restart', transition);\n  this.addState('sign', 'send', 'retry', transition);\n  this.addState('retry', 'afterRetry', 'afterRetry', transition);\n  this.addState('afterRetry', 'sign', 'error', transition);\n  this.addState('send', 'validateResponse', 'retry', transition);\n  this.addState('validateResponse', 'extractData', 'extractError', transition);\n  this.addState('extractError', 'extractData', 'retry', transition);\n  this.addState('extractData', 'success', 'retry', transition);\n  this.addState('restart', 'build', 'error', transition);\n  this.addState('success', 'complete', 'complete', transition);\n  this.addState('error', 'complete', 'complete', transition);\n  this.addState('complete', null, null, transition);\n};\nfsm.setupStates();\n\n\nAWS.Request = inherit({\n\n\n  constructor: function Request(service, operation, params) {\n    var endpoint = service.endpoint;\n    var region = service.config.region;\n    var customUserAgent = service.config.customUserAgent;\n\n    if (service.isGlobalEndpoint) region = 'us-east-1';\n\n    this.domain = domain && domain.active;\n    this.service = service;\n    this.operation = operation;\n    this.params = params || {};\n    this.httpRequest = new AWS.HttpRequest(endpoint, region, customUserAgent);\n    this.startTime = AWS.util.date.getDate();\n\n    this.response = new AWS.Response(this);\n    this._asm = new AcceptorStateMachine(fsm.states, 'validate');\n    this._haltHandlersOnError = false;\n\n    AWS.SequentialExecutor.call(this);\n    this.emit = this.emitEvent;\n  },\n\n\n\n\n  send: function send(callback) {\n    if (callback) {\n      this.on('complete', function (resp) {\n        callback.call(resp, resp.error, resp.data);\n      });\n    }\n    this.runTo();\n\n    return this.response;\n  },\n\n\n\n\n  build: function build(callback) {\n    return this.runTo('send', callback);\n  },\n\n\n  runTo: function runTo(state, done) {\n    this._asm.runTo(state, done, this);\n    return this;\n  },\n\n\n  abort: function abort() {\n    this.removeAllListeners('validateResponse');\n    this.removeAllListeners('extractError');\n    this.on('validateResponse', function addAbortedError(resp) {\n      resp.error = AWS.util.error(new Error('Request aborted by user'), {\n         code: 'RequestAbortedError', retryable: false\n      });\n    });\n\n    if (this.httpRequest.stream) { // abort HTTP stream\n      this.httpRequest.stream.abort();\n      if (this.httpRequest._abortCallback) {\n         this.httpRequest._abortCallback();\n      } else {\n        this.removeAllListeners('send'); // haven't sent yet, so let's not\n      }\n    }\n\n    return this;\n  },\n\n\n  eachPage: function eachPage(callback) {\n    callback = AWS.util.fn.makeAsync(callback, 3);\n\n    function wrappedCallback(response) {\n      callback.call(response, response.error, response.data, function (result) {\n        if (result === false) return;\n\n        if (response.hasNextPage()) {\n          response.nextPage().on('complete', wrappedCallback).send();\n        } else {\n          callback.call(response, null, null, AWS.util.fn.noop);\n        }\n      });\n    }\n\n    this.on('complete', wrappedCallback).send();\n  },\n\n\n  eachItem: function eachItem(callback) {\n    var self = this;\n    function wrappedCallback(err, data) {\n      if (err) return callback(err, null);\n      if (data === null) return callback(null, null);\n\n      var config = self.service.paginationConfig(self.operation);\n      var resultKey = config.resultKey;\n      if (Array.isArray(resultKey)) resultKey = resultKey[0];\n      var items = jmespath.search(data, resultKey);\n      var continueIteration = true;\n      AWS.util.arrayEach(items, function(item) {\n        continueIteration = callback(null, item);\n        if (continueIteration === false) {\n          return AWS.util.abort;\n        }\n      });\n      return continueIteration;\n    }\n\n    this.eachPage(wrappedCallback);\n  },\n\n\n  isPageable: function isPageable() {\n    return this.service.paginationConfig(this.operation) ? true : false;\n  },\n\n\n  createReadStream: function createReadStream() {\n    var streams = AWS.util.stream;\n    var req = this;\n    var stream = null;\n\n    if (AWS.HttpClient.streamsApiVersion === 2) {\n      stream = new streams.PassThrough();\n      req.send();\n    } else {\n      stream = new streams.Stream();\n      stream.readable = true;\n\n      stream.sent = false;\n      stream.on('newListener', function(event) {\n        if (!stream.sent && event === 'data') {\n          stream.sent = true;\n          process.nextTick(function() { req.send(); });\n        }\n      });\n    }\n\n    this.on('httpHeaders', function streamHeaders(statusCode, headers, resp) {\n      if (statusCode < 300) {\n        req.removeListener('httpData', AWS.EventListeners.Core.HTTP_DATA);\n        req.removeListener('httpError', AWS.EventListeners.Core.HTTP_ERROR);\n        req.on('httpError', function streamHttpError(error) {\n          resp.error = error;\n          resp.error.retryable = false;\n        });\n\n        var shouldCheckContentLength = false;\n        var expectedLen;\n        if (req.httpRequest.method !== 'HEAD') {\n          expectedLen = parseInt(headers['content-length'], 10);\n        }\n        if (expectedLen !== undefined && !isNaN(expectedLen) && expectedLen >= 0) {\n          shouldCheckContentLength = true;\n          var receivedLen = 0;\n        }\n\n        var checkContentLengthAndEmit = function checkContentLengthAndEmit() {\n          if (shouldCheckContentLength && receivedLen !== expectedLen) {\n            stream.emit('error', AWS.util.error(\n              new Error('Stream content length mismatch. Received ' +\n                receivedLen + ' of ' + expectedLen + ' bytes.'),\n              { code: 'StreamContentLengthMismatch' }\n            ));\n          } else if (AWS.HttpClient.streamsApiVersion === 2) {\n            stream.end();\n          } else {\n            stream.emit('end')\n          }\n        }\n\n        var httpStream = resp.httpResponse.createUnbufferedStream();\n\n        if (AWS.HttpClient.streamsApiVersion === 2) {\n          if (shouldCheckContentLength) {\n            var lengthAccumulator = new streams.PassThrough();\n            lengthAccumulator._write = function(chunk) {\n              if (chunk && chunk.length) {\n                receivedLen += chunk.length;\n              }\n              return streams.PassThrough.prototype._write.apply(this, arguments);\n            };\n\n            lengthAccumulator.on('end', checkContentLengthAndEmit);\n            httpStream.pipe(lengthAccumulator).pipe(stream, { end: false });\n          } else {\n            httpStream.pipe(stream);\n          }\n        } else {\n\n          if (shouldCheckContentLength) {\n            httpStream.on('data', function(arg) {\n              if (arg && arg.length) {\n                receivedLen += arg.length;\n              }\n            });\n          }\n\n          httpStream.on('data', function(arg) {\n            stream.emit('data', arg);\n          });\n          httpStream.on('end', checkContentLengthAndEmit);\n        }\n\n        httpStream.on('error', function(err) {\n          shouldCheckContentLength = false;\n          stream.emit('error', err);\n        });\n      }\n    });\n\n    this.on('error', function(err) {\n      stream.emit('error', err);\n    });\n\n    return stream;\n  },\n\n\n  emitEvent: function emit(eventName, args, done) {\n    if (typeof args === 'function') { done = args; args = null; }\n    if (!done) done = function() { };\n    if (!args) args = this.eventParameters(eventName, this.response);\n\n    var origEmit = AWS.SequentialExecutor.prototype.emit;\n    origEmit.call(this, eventName, args, function (err) {\n      if (err) this.response.error = err;\n      done.call(this, err);\n    });\n  },\n\n\n  eventParameters: function eventParameters(eventName) {\n    switch (eventName) {\n      case 'restart':\n      case 'validate':\n      case 'sign':\n      case 'build':\n      case 'afterValidate':\n      case 'afterBuild':\n        return [this];\n      case 'error':\n        return [this.response.error, this.response];\n      default:\n        return [this.response];\n    }\n  },\n\n\n  presign: function presign(expires, callback) {\n    if (!callback && typeof expires === 'function') {\n      callback = expires;\n      expires = null;\n    }\n    return new AWS.Signers.Presign().sign(this.toGet(), expires, callback);\n  },\n\n\n  isPresigned: function isPresigned() {\n    return Object.prototype.hasOwnProperty.call(this.httpRequest.headers, 'presigned-expires');\n  },\n\n\n  toUnauthenticated: function toUnauthenticated() {\n    this.removeListener('validate', AWS.EventListeners.Core.VALIDATE_CREDENTIALS);\n    this.removeListener('sign', AWS.EventListeners.Core.SIGN);\n    return this;\n  },\n\n\n  toGet: function toGet() {\n    if (this.service.api.protocol === 'query' ||\n        this.service.api.protocol === 'ec2') {\n      this.removeListener('build', this.buildAsGet);\n      this.addListener('build', this.buildAsGet);\n    }\n    return this;\n  },\n\n\n  buildAsGet: function buildAsGet(request) {\n    request.httpRequest.method = 'GET';\n    request.httpRequest.path = request.service.endpoint.path +\n                               '?' + request.httpRequest.body;\n    request.httpRequest.body = '';\n\n    delete request.httpRequest.headers['Content-Length'];\n    delete request.httpRequest.headers['Content-Type'];\n  },\n\n\n  haltHandlersOnError: function haltHandlersOnError() {\n    this._haltHandlersOnError = true;\n  }\n});\n\nAWS.util.addPromisesToRequests(AWS.Request);\n\nAWS.util.mixin(AWS.Request, AWS.SequentialExecutor);\n\n}).call(this,require(\"FWaASH\"))\n},{\"./core\":11,\"./state_machine\":52,\"FWaASH\":62,\"jmespath\":79}],39:[function(require,module,exports){\n\n\nvar AWS = require('./core');\nvar inherit = AWS.util.inherit;\nvar jmespath = require('jmespath');\n\n\nfunction CHECK_ACCEPTORS(resp) {\n  var waiter = resp.request._waiter;\n  var acceptors = waiter.config.acceptors;\n  var acceptorMatched = false;\n  var state = 'retry';\n\n  acceptors.forEach(function(acceptor) {\n    if (!acceptorMatched) {\n      var matcher = waiter.matchers[acceptor.matcher];\n      if (matcher && matcher(resp, acceptor.expected, acceptor.argument)) {\n        acceptorMatched = true;\n        state = acceptor.state;\n      }\n    }\n  });\n\n  if (!acceptorMatched && resp.error) state = 'failure';\n\n  if (state === 'success') {\n    waiter.setSuccess(resp);\n  } else {\n    waiter.setError(resp, state === 'retry');\n  }\n}\n\n\nAWS.ResourceWaiter = inherit({\n\n  constructor: function constructor(service, state) {\n    this.service = service;\n    this.state = state;\n    this.loadWaiterConfig(this.state);\n  },\n\n  service: null,\n\n  state: null,\n\n  config: null,\n\n  matchers: {\n    path: function(resp, expected, argument) {\n      var result = jmespath.search(resp.data, argument);\n      return jmespath.strictDeepEqual(result,expected);\n    },\n\n    pathAll: function(resp, expected, argument) {\n      var results = jmespath.search(resp.data, argument);\n      if (!Array.isArray(results)) results = [results];\n      var numResults = results.length;\n      if (!numResults) return false;\n      for (var ind = 0 ; ind < numResults; ind++) {\n        if (!jmespath.strictDeepEqual(results[ind], expected)) {\n          return false;\n        }\n      }\n      return true;\n    },\n\n    pathAny: function(resp, expected, argument) {\n      var results = jmespath.search(resp.data, argument);\n      if (!Array.isArray(results)) results = [results];\n      var numResults = results.length;\n      for (var ind = 0 ; ind < numResults; ind++) {\n        if (jmespath.strictDeepEqual(results[ind], expected)) {\n          return true;\n        }\n      }\n      return false;\n    },\n\n    status: function(resp, expected) {\n      var statusCode = resp.httpResponse.statusCode;\n      return (typeof statusCode === 'number') && (statusCode === expected);\n    },\n\n    error: function(resp, expected) {\n      if (typeof expected === 'string' && resp.error) {\n        return expected === resp.error.code;\n      }\n      return expected === !!resp.error;\n    }\n  },\n\n  listeners: new AWS.SequentialExecutor().addNamedListeners(function(add) {\n    add('RETRY_CHECK', 'retry', function(resp) {\n      var waiter = resp.request._waiter;\n      if (resp.error && resp.error.code === 'ResourceNotReady') {\n        resp.error.retryDelay = (waiter.config.delay || 0) * 1000;\n      }\n    });\n\n    add('CHECK_OUTPUT', 'extractData', CHECK_ACCEPTORS);\n\n    add('CHECK_ERROR', 'extractError', CHECK_ACCEPTORS);\n  }),\n\n\n  wait: function wait(params, callback) {\n    if (typeof params === 'function') {\n      callback = params; params = undefined;\n    }\n\n    var request = this.service.makeRequest(this.config.operation, params);\n    request._waiter = this;\n    request.response.maxRetries = this.config.maxAttempts;\n    request.addListeners(this.listeners);\n\n    if (callback) request.send(callback);\n    return request;\n  },\n\n  setSuccess: function setSuccess(resp) {\n    resp.error = null;\n    resp.data = resp.data || {};\n    resp.request.removeAllListeners('extractData');\n  },\n\n  setError: function setError(resp, retryable) {\n    resp.data = null;\n    resp.error = AWS.util.error(resp.error || new Error(), {\n      code: 'ResourceNotReady',\n      message: 'Resource is not in the state ' + this.state,\n      retryable: retryable\n    });\n  },\n\n\n  loadWaiterConfig: function loadWaiterConfig(state) {\n    if (!this.service.api.waiters[state]) {\n      throw new AWS.util.error(new Error(), {\n        code: 'StateNotFoundError',\n        message: 'State ' + state + ' not found.'\n      });\n    }\n\n    this.config = this.service.api.waiters[state];\n  }\n});\n\n},{\"./core\":11,\"jmespath\":79}],40:[function(require,module,exports){\nvar AWS = require('./core');\nvar inherit = AWS.util.inherit;\nvar jmespath = require('jmespath');\n\n\nAWS.Response = inherit({\n\n\n  constructor: function Response(request) {\n    this.request = request;\n    this.data = null;\n    this.error = null;\n    this.retryCount = 0;\n    this.redirectCount = 0;\n    this.httpResponse = new AWS.HttpResponse();\n    if (request) {\n      this.maxRetries = request.service.numRetries();\n      this.maxRedirects = request.service.config.maxRedirects;\n    }\n  },\n\n\n  nextPage: function nextPage(callback) {\n    var config;\n    var service = this.request.service;\n    var operation = this.request.operation;\n    try {\n      config = service.paginationConfig(operation, true);\n    } catch (e) { this.error = e; }\n\n    if (!this.hasNextPage()) {\n      if (callback) callback(this.error, null);\n      else if (this.error) throw this.error;\n      return null;\n    }\n\n    var params = AWS.util.copy(this.request.params);\n    if (!this.nextPageTokens) {\n      return callback ? callback(null, null) : null;\n    } else {\n      var inputTokens = config.inputToken;\n      if (typeof inputTokens === 'string') inputTokens = [inputTokens];\n      for (var i = 0; i < inputTokens.length; i++) {\n        params[inputTokens[i]] = this.nextPageTokens[i];\n      }\n      return service.makeRequest(this.request.operation, params, callback);\n    }\n  },\n\n\n  hasNextPage: function hasNextPage() {\n    this.cacheNextPageTokens();\n    if (this.nextPageTokens) return true;\n    if (this.nextPageTokens === undefined) return undefined;\n    else return false;\n  },\n\n\n  cacheNextPageTokens: function cacheNextPageTokens() {\n    if (Object.prototype.hasOwnProperty.call(this, 'nextPageTokens')) return this.nextPageTokens;\n    this.nextPageTokens = undefined;\n\n    var config = this.request.service.paginationConfig(this.request.operation);\n    if (!config) return this.nextPageTokens;\n\n    this.nextPageTokens = null;\n    if (config.moreResults) {\n      if (!jmespath.search(this.data, config.moreResults)) {\n        return this.nextPageTokens;\n      }\n    }\n\n    var exprs = config.outputToken;\n    if (typeof exprs === 'string') exprs = [exprs];\n    AWS.util.arrayEach.call(this, exprs, function (expr) {\n      var output = jmespath.search(this.data, expr);\n      if (output) {\n        this.nextPageTokens = this.nextPageTokens || [];\n        this.nextPageTokens.push(output);\n      }\n    });\n\n    return this.nextPageTokens;\n  }\n\n});\n\n},{\"./core\":11,\"jmespath\":79}],41:[function(require,module,exports){\nvar AWS = require('./core');\n\n\nAWS.SequentialExecutor = AWS.util.inherit({\n\n  constructor: function SequentialExecutor() {\n    this._events = {};\n  },\n\n\n  listeners: function listeners(eventName) {\n    return this._events[eventName] ? this._events[eventName].slice(0) : [];\n  },\n\n  on: function on(eventName, listener) {\n    if (this._events[eventName]) {\n      this._events[eventName].push(listener);\n    } else {\n      this._events[eventName] = [listener];\n    }\n    return this;\n  },\n\n\n  onAsync: function onAsync(eventName, listener) {\n    listener._isAsync = true;\n    return this.on(eventName, listener);\n  },\n\n  removeListener: function removeListener(eventName, listener) {\n    var listeners = this._events[eventName];\n    if (listeners) {\n      var length = listeners.length;\n      var position = -1;\n      for (var i = 0; i < length; ++i) {\n        if (listeners[i] === listener) {\n          position = i;\n        }\n      }\n      if (position > -1) {\n        listeners.splice(position, 1);\n      }\n    }\n    return this;\n  },\n\n  removeAllListeners: function removeAllListeners(eventName) {\n    if (eventName) {\n      delete this._events[eventName];\n    } else {\n      this._events = {};\n    }\n    return this;\n  },\n\n\n  emit: function emit(eventName, eventArgs, doneCallback) {\n    if (!doneCallback) doneCallback = function() { };\n    var listeners = this.listeners(eventName);\n    var count = listeners.length;\n    this.callListeners(listeners, eventArgs, doneCallback);\n    return count > 0;\n  },\n\n\n  callListeners: function callListeners(listeners, args, doneCallback, prevError) {\n    var self = this;\n    var error = prevError || null;\n\n    function callNextListener(err) {\n      if (err) {\n        error = AWS.util.error(error || new Error(), err);\n        if (self._haltHandlersOnError) {\n          return doneCallback.call(self, error);\n        }\n      }\n      self.callListeners(listeners, args, doneCallback, error);\n    }\n\n    while (listeners.length > 0) {\n      var listener = listeners.shift();\n      if (listener._isAsync) { // asynchronous listener\n        listener.apply(self, args.concat([callNextListener]));\n        return; // stop here, callNextListener will continue\n      } else { // synchronous listener\n        try {\n          listener.apply(self, args);\n        } catch (err) {\n          error = AWS.util.error(error || new Error(), err);\n        }\n        if (error && self._haltHandlersOnError) {\n          doneCallback.call(self, error);\n          return;\n        }\n      }\n    }\n    doneCallback.call(self, error);\n  },\n\n\n  addListeners: function addListeners(listeners) {\n    var self = this;\n\n    if (listeners._events) listeners = listeners._events;\n\n    AWS.util.each(listeners, function(event, callbacks) {\n      if (typeof callbacks === 'function') callbacks = [callbacks];\n      AWS.util.arrayEach(callbacks, function(callback) {\n        self.on(event, callback);\n      });\n    });\n\n    return self;\n  },\n\n\n  addNamedListener: function addNamedListener(name, eventName, callback) {\n    this[name] = callback;\n    this.addListener(eventName, callback);\n    return this;\n  },\n\n\n  addNamedAsyncListener: function addNamedAsyncListener(name, eventName, callback) {\n    callback._isAsync = true;\n    return this.addNamedListener(name, eventName, callback);\n  },\n\n\n  addNamedListeners: function addNamedListeners(callback) {\n    var self = this;\n    callback(\n      function() {\n        self.addNamedListener.apply(self, arguments);\n      },\n      function() {\n        self.addNamedAsyncListener.apply(self, arguments);\n      }\n    );\n    return this;\n  }\n});\n\n\nAWS.SequentialExecutor.prototype.addListener = AWS.SequentialExecutor.prototype.on;\n\nmodule.exports = AWS.SequentialExecutor;\n\n},{\"./core\":11}],42:[function(require,module,exports){\nvar AWS = require('./core');\nvar Api = require('./model/api');\nvar regionConfig = require('./region_config');\nvar inherit = AWS.util.inherit;\nvar clientCount = 0;\n\n\nAWS.Service = inherit({\n\n  constructor: function Service(config) {\n    if (!this.loadServiceClass) {\n      throw AWS.util.error(new Error(),\n        'Service must be constructed with `new\\' operator');\n    }\n    var ServiceClass = this.loadServiceClass(config || {});\n    if (ServiceClass) {\n      var originalConfig = AWS.util.copy(config);\n      var svc = new ServiceClass(config);\n      Object.defineProperty(svc, '_originalConfig', {\n        get: function() { return originalConfig; },\n        enumerable: false,\n        configurable: true\n      });\n      svc._clientId = ++clientCount;\n      return svc;\n    }\n    this.initialize(config);\n  },\n\n\n  initialize: function initialize(config) {\n    var svcConfig = AWS.config[this.serviceIdentifier];\n\n    this.config = new AWS.Config(AWS.config);\n    if (svcConfig) this.config.update(svcConfig, true);\n    if (config) this.config.update(config, true);\n\n    this.validateService();\n    if (!this.config.endpoint) regionConfig(this);\n\n    this.config.endpoint = this.endpointFromTemplate(this.config.endpoint);\n    this.setEndpoint(this.config.endpoint);\n  },\n\n\n  validateService: function validateService() {\n  },\n\n\n  loadServiceClass: function loadServiceClass(serviceConfig) {\n    var config = serviceConfig;\n    if (!AWS.util.isEmpty(this.api)) {\n      return null;\n    } else if (config.apiConfig) {\n      return AWS.Service.defineServiceApi(this.constructor, config.apiConfig);\n    } else if (!this.constructor.services) {\n      return null;\n    } else {\n      config = new AWS.Config(AWS.config);\n      config.update(serviceConfig, true);\n      var version = config.apiVersions[this.constructor.serviceIdentifier];\n      version = version || config.apiVersion;\n      return this.getLatestServiceClass(version);\n    }\n  },\n\n\n  getLatestServiceClass: function getLatestServiceClass(version) {\n    version = this.getLatestServiceVersion(version);\n    if (this.constructor.services[version] === null) {\n      AWS.Service.defineServiceApi(this.constructor, version);\n    }\n\n    return this.constructor.services[version];\n  },\n\n\n  getLatestServiceVersion: function getLatestServiceVersion(version) {\n    if (!this.constructor.services || this.constructor.services.length === 0) {\n      throw new Error('No services defined on ' +\n                      this.constructor.serviceIdentifier);\n    }\n\n    if (!version) {\n      version = 'latest';\n    } else if (AWS.util.isType(version, Date)) {\n      version = AWS.util.date.iso8601(version).split('T')[0];\n    }\n\n    if (Object.hasOwnProperty(this.constructor.services, version)) {\n      return version;\n    }\n\n    var keys = Object.keys(this.constructor.services).sort();\n    var selectedVersion = null;\n    for (var i = keys.length - 1; i >= 0; i--) {\n      if (keys[i][keys[i].length - 1] !== '*') {\n        selectedVersion = keys[i];\n      }\n      if (keys[i].substr(0, 10) <= version) {\n        return selectedVersion;\n      }\n    }\n\n    throw new Error('Could not find ' + this.constructor.serviceIdentifier +\n                    ' API to satisfy version constraint `' + version + '\\'');\n  },\n\n\n  api: {},\n\n\n  defaultRetryCount: 3,\n\n\n  makeRequest: function makeRequest(operation, params, callback) {\n    if (typeof params === 'function') {\n      callback = params;\n      params = null;\n    }\n\n    params = params || {};\n    if (this.config.params) { // copy only toplevel bound params\n      var rules = this.api.operations[operation];\n      if (rules) {\n        params = AWS.util.copy(params);\n        AWS.util.each(this.config.params, function(key, value) {\n          if (rules.input.members[key]) {\n            if (params[key] === undefined || params[key] === null) {\n              params[key] = value;\n            }\n          }\n        });\n      }\n    }\n\n    var request = new AWS.Request(this, operation, params);\n    this.addAllRequestListeners(request);\n\n    if (callback) request.send(callback);\n    return request;\n  },\n\n\n  makeUnauthenticatedRequest: function makeUnauthenticatedRequest(operation, params, callback) {\n    if (typeof params === 'function') {\n      callback = params;\n      params = {};\n    }\n\n    var request = this.makeRequest(operation, params).toUnauthenticated();\n    return callback ? request.send(callback) : request;\n  },\n\n\n  waitFor: function waitFor(state, params, callback) {\n    var waiter = new AWS.ResourceWaiter(this, state);\n    return waiter.wait(params, callback);\n  },\n\n\n  addAllRequestListeners: function addAllRequestListeners(request) {\n    var list = [AWS.events, AWS.EventListeners.Core, this.serviceInterface(),\n                AWS.EventListeners.CorePost];\n    for (var i = 0; i < list.length; i++) {\n      if (list[i]) request.addListeners(list[i]);\n    }\n\n    if (!this.config.paramValidation) {\n      request.removeListener('validate',\n        AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n    }\n\n    if (this.config.logger) { // add logging events\n      request.addListeners(AWS.EventListeners.Logger);\n    }\n\n    this.setupRequestListeners(request);\n  },\n\n\n  setupRequestListeners: function setupRequestListeners() {\n  },\n\n\n  getSignerClass: function getSignerClass() {\n    var version;\n    if (this.config.signatureVersion) {\n      version = this.config.signatureVersion;\n    } else {\n      version = this.api.signatureVersion;\n    }\n    return AWS.Signers.RequestSigner.getVersion(version);\n  },\n\n\n  serviceInterface: function serviceInterface() {\n    switch (this.api.protocol) {\n      case 'ec2': return AWS.EventListeners.Query;\n      case 'query': return AWS.EventListeners.Query;\n      case 'json': return AWS.EventListeners.Json;\n      case 'rest-json': return AWS.EventListeners.RestJson;\n      case 'rest-xml': return AWS.EventListeners.RestXml;\n    }\n    if (this.api.protocol) {\n      throw new Error('Invalid service `protocol\\' ' +\n        this.api.protocol + ' in API config');\n    }\n  },\n\n\n  successfulResponse: function successfulResponse(resp) {\n    return resp.httpResponse.statusCode < 300;\n  },\n\n\n  numRetries: function numRetries() {\n    if (this.config.maxRetries !== undefined) {\n      return this.config.maxRetries;\n    } else {\n      return this.defaultRetryCount;\n    }\n  },\n\n\n  retryDelays: function retryDelays(retryCount) {\n    return AWS.util.calculateRetryDelay(retryCount, this.config.retryDelayOptions);\n  },\n\n\n  retryableError: function retryableError(error) {\n    if (this.networkingError(error)) return true;\n    if (this.expiredCredentialsError(error)) return true;\n    if (this.throttledError(error)) return true;\n    if (error.statusCode >= 500) return true;\n    return false;\n  },\n\n\n  networkingError: function networkingError(error) {\n    return error.code === 'NetworkingError';\n  },\n\n\n  expiredCredentialsError: function expiredCredentialsError(error) {\n    return (error.code === 'ExpiredTokenException');\n  },\n\n\n  clockSkewError: function clockSkewError(error) {\n    switch (error.code) {\n      case 'RequestTimeTooSkewed':\n      case 'RequestExpired':\n      case 'InvalidSignatureException':\n      case 'SignatureDoesNotMatch':\n      case 'AuthFailure':\n      case 'RequestInTheFuture':\n        return true;\n      default: return false;\n    }\n  },\n\n\n  throttledError: function throttledError(error) {\n    switch (error.code) {\n      case 'ProvisionedThroughputExceededException':\n      case 'Throttling':\n      case 'ThrottlingException':\n      case 'RequestLimitExceeded':\n      case 'RequestThrottled':\n        return true;\n      default:\n        return false;\n    }\n  },\n\n\n  endpointFromTemplate: function endpointFromTemplate(endpoint) {\n    if (typeof endpoint !== 'string') return endpoint;\n\n    var e = endpoint;\n    e = e.replace(/\\{service\\}/g, this.api.endpointPrefix);\n    e = e.replace(/\\{region\\}/g, this.config.region);\n    e = e.replace(/\\{scheme\\}/g, this.config.sslEnabled ? 'https' : 'http');\n    return e;\n  },\n\n\n  setEndpoint: function setEndpoint(endpoint) {\n    this.endpoint = new AWS.Endpoint(endpoint, this.config);\n  },\n\n\n  paginationConfig: function paginationConfig(operation, throwException) {\n    var paginator = this.api.operations[operation].paginator;\n    if (!paginator) {\n      if (throwException) {\n        var e = new Error();\n        throw AWS.util.error(e, 'No pagination configuration for ' + operation);\n      }\n      return null;\n    }\n\n    return paginator;\n  }\n});\n\nAWS.util.update(AWS.Service, {\n\n\n  defineMethods: function defineMethods(svc) {\n    AWS.util.each(svc.prototype.api.operations, function iterator(method) {\n      if (svc.prototype[method]) return;\n      var operation = svc.prototype.api.operations[method];\n      if (operation.authtype === 'none') {\n        svc.prototype[method] = function (params, callback) {\n          return this.makeUnauthenticatedRequest(method, params, callback);\n        };\n      } else {\n        svc.prototype[method] = function (params, callback) {\n          return this.makeRequest(method, params, callback);\n        };\n      }\n    });\n  },\n\n\n  defineService: function defineService(serviceIdentifier, versions, features) {\n    AWS.Service._serviceMap[serviceIdentifier] = true;\n    if (!Array.isArray(versions)) {\n      features = versions;\n      versions = [];\n    }\n\n    var svc = inherit(AWS.Service, features || {});\n\n    if (typeof serviceIdentifier === 'string') {\n      AWS.Service.addVersions(svc, versions);\n\n      var identifier = svc.serviceIdentifier || serviceIdentifier;\n      svc.serviceIdentifier = identifier;\n    } else { // defineService called with an API\n      svc.prototype.api = serviceIdentifier;\n      AWS.Service.defineMethods(svc);\n    }\n\n    return svc;\n  },\n\n\n  addVersions: function addVersions(svc, versions) {\n    if (!Array.isArray(versions)) versions = [versions];\n\n    svc.services = svc.services || {};\n    for (var i = 0; i < versions.length; i++) {\n      if (svc.services[versions[i]] === undefined) {\n        svc.services[versions[i]] = null;\n      }\n    }\n\n    svc.apiVersions = Object.keys(svc.services).sort();\n  },\n\n\n  defineServiceApi: function defineServiceApi(superclass, version, apiConfig) {\n    var svc = inherit(superclass, {\n      serviceIdentifier: superclass.serviceIdentifier\n    });\n\n    function setApi(api) {\n      if (api.isApi) {\n        svc.prototype.api = api;\n      } else {\n        svc.prototype.api = new Api(api);\n      }\n    }\n\n    if (typeof version === 'string') {\n      if (apiConfig) {\n        setApi(apiConfig);\n      } else {\n        try {\n          setApi(AWS.apiLoader(superclass.serviceIdentifier, version));\n        } catch (err) {\n          throw AWS.util.error(err, {\n            message: 'Could not find API configuration ' +\n              superclass.serviceIdentifier + '-' + version\n          });\n        }\n      }\n      if (!Object.prototype.hasOwnProperty.call(superclass.services, version)) {\n        superclass.apiVersions = superclass.apiVersions.concat(version).sort();\n      }\n      superclass.services[version] = svc;\n    } else {\n      setApi(version);\n    }\n\n    AWS.Service.defineMethods(svc);\n    return svc;\n  },\n\n\n  hasService: function(identifier) {\n    return Object.prototype.hasOwnProperty.call(AWS.Service._serviceMap, identifier);\n  },\n\n\n  _serviceMap: {}\n});\n\nmodule.exports = AWS.Service;\n},{\"./core\":11,\"./model/api\":23,\"./region_config\":36}],43:[function(require,module,exports){\nvar AWS = require('../core');\n\nAWS.util.update(AWS.CognitoIdentity.prototype, {\n  getOpenIdToken: function getOpenIdToken(params, callback) {\n    return this.makeUnauthenticatedRequest('getOpenIdToken', params, callback);\n  },\n\n  getId: function getId(params, callback) {\n    return this.makeUnauthenticatedRequest('getId', params, callback);\n  },\n\n  getCredentialsForIdentity: function getCredentialsForIdentity(params, callback) {\n    return this.makeUnauthenticatedRequest('getCredentialsForIdentity', params, callback);\n  }\n});\n\n},{\"../core\":11}],44:[function(require,module,exports){\nvar AWS = require('../core');\n\nAWS.util.update(AWS.STS.prototype, {\n\n  credentialsFrom: function credentialsFrom(data, credentials) {\n    if (!data) return null;\n    if (!credentials) credentials = new AWS.TemporaryCredentials();\n    credentials.expired = false;\n    credentials.accessKeyId = data.Credentials.AccessKeyId;\n    credentials.secretAccessKey = data.Credentials.SecretAccessKey;\n    credentials.sessionToken = data.Credentials.SessionToken;\n    credentials.expireTime = data.Credentials.Expiration;\n    return credentials;\n  },\n\n  assumeRoleWithWebIdentity: function assumeRoleWithWebIdentity(params, callback) {\n    return this.makeUnauthenticatedRequest('assumeRoleWithWebIdentity', params, callback);\n  },\n\n  assumeRoleWithSAML: function assumeRoleWithSAML(params, callback) {\n    return this.makeUnauthenticatedRequest('assumeRoleWithSAML', params, callback);\n  }\n});\n\n},{\"../core\":11}],45:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n\nvar expiresHeader = 'presigned-expires';\n\n\nfunction signedUrlBuilder(request) {\n  var expires = request.httpRequest.headers[expiresHeader];\n  var signerClass = request.service.getSignerClass(request);\n\n  delete request.httpRequest.headers['User-Agent'];\n  delete request.httpRequest.headers['X-Amz-User-Agent'];\n\n  if (signerClass === AWS.Signers.V4) {\n    if (expires > 604800) { // one week expiry is invalid\n      var message = 'Presigning does not support expiry time greater ' +\n                    'than a week with SigV4 signing.';\n      throw AWS.util.error(new Error(), {\n        code: 'InvalidExpiryTime', message: message, retryable: false\n      });\n    }\n    request.httpRequest.headers[expiresHeader] = expires;\n  } else if (signerClass === AWS.Signers.S3) {\n    request.httpRequest.headers[expiresHeader] = parseInt(\n      AWS.util.date.unixTimestamp() + expires, 10).toString();\n  } else {\n    throw AWS.util.error(new Error(), {\n      message: 'Presigning only supports S3 or SigV4 signing.',\n      code: 'UnsupportedSigner', retryable: false\n    });\n  }\n}\n\n\nfunction signedUrlSigner(request) {\n  var endpoint = request.httpRequest.endpoint;\n  var parsedUrl = AWS.util.urlParse(request.httpRequest.path);\n  var queryParams = {};\n\n  if (parsedUrl.search) {\n    queryParams = AWS.util.queryStringParse(parsedUrl.search.substr(1));\n  }\n\n  AWS.util.each(request.httpRequest.headers, function (key, value) {\n    if (key === expiresHeader) key = 'Expires';\n    if (key.indexOf('x-amz-meta-') === 0) {\n      delete queryParams[key];\n      key = key.toLowerCase();\n    }\n    queryParams[key] = value;\n  });\n  delete request.httpRequest.headers[expiresHeader];\n\n  var auth = queryParams['Authorization'].split(' ');\n  if (auth[0] === 'AWS') {\n    auth = auth[1].split(':');\n    queryParams['AWSAccessKeyId'] = auth[0];\n    queryParams['Signature'] = auth[1];\n  } else if (auth[0] === 'AWS4-HMAC-SHA256') { // SigV4 signing\n    auth.shift();\n    var rest = auth.join(' ');\n    var signature = rest.match(/Signature=(.*?)(?:,|\\s|\\r?\\n|$)/)[1];\n    queryParams['X-Amz-Signature'] = signature;\n    delete queryParams['Expires'];\n  }\n  delete queryParams['Authorization'];\n  delete queryParams['Host'];\n\n  endpoint.pathname = parsedUrl.pathname;\n  endpoint.search = AWS.util.queryParamsToString(queryParams);\n}\n\n\nAWS.Signers.Presign = inherit({\n\n  sign: function sign(request, expireTime, callback) {\n    request.httpRequest.headers[expiresHeader] = expireTime || 3600;\n    request.on('build', signedUrlBuilder);\n    request.on('sign', signedUrlSigner);\n    request.removeListener('afterBuild',\n      AWS.EventListeners.Core.SET_CONTENT_LENGTH);\n    request.removeListener('afterBuild',\n      AWS.EventListeners.Core.COMPUTE_SHA256);\n\n    request.emit('beforePresign', [request]);\n\n    if (callback) {\n      request.build(function() {\n        if (this.response.error) callback(this.response.error);\n        else {\n          callback(null, AWS.util.urlFormat(request.httpRequest.endpoint));\n        }\n      });\n    } else {\n      request.build();\n      if (request.response.error) throw request.response.error;\n      return AWS.util.urlFormat(request.httpRequest.endpoint);\n    }\n  }\n});\n\nmodule.exports = AWS.Signers.Presign;\n\n},{\"../core\":11}],46:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n\nAWS.Signers.RequestSigner = inherit({\n  constructor: function RequestSigner(request) {\n    this.request = request;\n  },\n\n  setServiceClientId: function setServiceClientId(id) {\n    this.serviceClientId = id;\n  },\n\n  getServiceClientId: function getServiceClientId() {\n    return this.serviceClientId;\n  }\n});\n\nAWS.Signers.RequestSigner.getVersion = function getVersion(version) {\n  switch (version) {\n    case 'v2': return AWS.Signers.V2;\n    case 'v3': return AWS.Signers.V3;\n    case 'v4': return AWS.Signers.V4;\n    case 's3': return AWS.Signers.S3;\n    case 'v3https': return AWS.Signers.V3Https;\n  }\n  throw new Error('Unknown signing version ' + version);\n};\n\nrequire('./v2');\nrequire('./v3');\nrequire('./v3https');\nrequire('./v4');\nrequire('./s3');\nrequire('./presign');\n\n},{\"../core\":11,\"./presign\":45,\"./s3\":47,\"./v2\":48,\"./v3\":49,\"./v3https\":50,\"./v4\":51}],47:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n\nAWS.Signers.S3 = inherit(AWS.Signers.RequestSigner, {\n\n  subResources: {\n    'acl': 1,\n    'accelerate': 1,\n    'cors': 1,\n    'lifecycle': 1,\n    'delete': 1,\n    'location': 1,\n    'logging': 1,\n    'notification': 1,\n    'partNumber': 1,\n    'policy': 1,\n    'requestPayment': 1,\n    'replication': 1,\n    'restore': 1,\n    'tagging': 1,\n    'torrent': 1,\n    'uploadId': 1,\n    'uploads': 1,\n    'versionId': 1,\n    'versioning': 1,\n    'versions': 1,\n    'website': 1\n  },\n\n  responseHeaders: {\n    'response-content-type': 1,\n    'response-content-language': 1,\n    'response-expires': 1,\n    'response-cache-control': 1,\n    'response-content-disposition': 1,\n    'response-content-encoding': 1\n  },\n\n  addAuthorization: function addAuthorization(credentials, date) {\n    if (!this.request.headers['presigned-expires']) {\n      this.request.headers['X-Amz-Date'] = AWS.util.date.rfc822(date);\n    }\n\n    if (credentials.sessionToken) {\n      this.request.headers['x-amz-security-token'] = credentials.sessionToken;\n    }\n\n    var signature = this.sign(credentials.secretAccessKey, this.stringToSign());\n    var auth = 'AWS ' + credentials.accessKeyId + ':' + signature;\n\n    this.request.headers['Authorization'] = auth;\n  },\n\n  stringToSign: function stringToSign() {\n    var r = this.request;\n\n    var parts = [];\n    parts.push(r.method);\n    parts.push(r.headers['Content-MD5'] || '');\n    parts.push(r.headers['Content-Type'] || '');\n\n    parts.push(r.headers['presigned-expires'] || '');\n\n    var headers = this.canonicalizedAmzHeaders();\n    if (headers) parts.push(headers);\n    parts.push(this.canonicalizedResource());\n\n    return parts.join('\\n');\n\n  },\n\n  canonicalizedAmzHeaders: function canonicalizedAmzHeaders() {\n\n    var amzHeaders = [];\n\n    AWS.util.each(this.request.headers, function (name) {\n      if (name.match(/^x-amz-/i))\n        amzHeaders.push(name);\n    });\n\n    amzHeaders.sort(function (a, b) {\n      return a.toLowerCase() < b.toLowerCase() ? -1 : 1;\n    });\n\n    var parts = [];\n    AWS.util.arrayEach.call(this, amzHeaders, function (name) {\n      parts.push(name.toLowerCase() + ':' + String(this.request.headers[name]));\n    });\n\n    return parts.join('\\n');\n\n  },\n\n  canonicalizedResource: function canonicalizedResource() {\n\n    var r = this.request;\n\n    var parts = r.path.split('?');\n    var path = parts[0];\n    var querystring = parts[1];\n\n    var resource = '';\n\n    if (r.virtualHostedBucket)\n      resource += '/' + r.virtualHostedBucket;\n\n    resource += path;\n\n    if (querystring) {\n\n      var resources = [];\n\n      AWS.util.arrayEach.call(this, querystring.split('&'), function (param) {\n        var name = param.split('=')[0];\n        var value = param.split('=')[1];\n        if (this.subResources[name] || this.responseHeaders[name]) {\n          var subresource = { name: name };\n          if (value !== undefined) {\n            if (this.subResources[name]) {\n              subresource.value = value;\n            } else {\n              subresource.value = decodeURIComponent(value);\n            }\n          }\n          resources.push(subresource);\n        }\n      });\n\n      resources.sort(function (a, b) { return a.name < b.name ? -1 : 1; });\n\n      if (resources.length) {\n\n        querystring = [];\n        AWS.util.arrayEach(resources, function (res) {\n          if (res.value === undefined) {\n            querystring.push(res.name);\n          } else {\n            querystring.push(res.name + '=' + res.value);\n          }\n        });\n\n        resource += '?' + querystring.join('&');\n      }\n\n    }\n\n    return resource;\n\n  },\n\n  sign: function sign(secret, string) {\n    return AWS.util.crypto.hmac(secret, string, 'base64', 'sha1');\n  }\n});\n\nmodule.exports = AWS.Signers.S3;\n\n},{\"../core\":11}],48:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n\nAWS.Signers.V2 = inherit(AWS.Signers.RequestSigner, {\n  addAuthorization: function addAuthorization(credentials, date) {\n\n    if (!date) date = AWS.util.date.getDate();\n\n    var r = this.request;\n\n    r.params.Timestamp = AWS.util.date.iso8601(date);\n    r.params.SignatureVersion = '2';\n    r.params.SignatureMethod = 'HmacSHA256';\n    r.params.AWSAccessKeyId = credentials.accessKeyId;\n\n    if (credentials.sessionToken) {\n      r.params.SecurityToken = credentials.sessionToken;\n    }\n\n    delete r.params.Signature; // delete old Signature for re-signing\n    r.params.Signature = this.signature(credentials);\n\n    r.body = AWS.util.queryParamsToString(r.params);\n    r.headers['Content-Length'] = r.body.length;\n  },\n\n  signature: function signature(credentials) {\n    return AWS.util.crypto.hmac(credentials.secretAccessKey, this.stringToSign(), 'base64');\n  },\n\n  stringToSign: function stringToSign() {\n    var parts = [];\n    parts.push(this.request.method);\n    parts.push(this.request.endpoint.host.toLowerCase());\n    parts.push(this.request.pathname());\n    parts.push(AWS.util.queryParamsToString(this.request.params));\n    return parts.join('\\n');\n  }\n\n});\n\nmodule.exports = AWS.Signers.V2;\n\n},{\"../core\":11}],49:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n\nAWS.Signers.V3 = inherit(AWS.Signers.RequestSigner, {\n  addAuthorization: function addAuthorization(credentials, date) {\n\n    var datetime = AWS.util.date.rfc822(date);\n\n    this.request.headers['X-Amz-Date'] = datetime;\n\n    if (credentials.sessionToken) {\n      this.request.headers['x-amz-security-token'] = credentials.sessionToken;\n    }\n\n    this.request.headers['X-Amzn-Authorization'] =\n      this.authorization(credentials, datetime);\n\n  },\n\n  authorization: function authorization(credentials) {\n    return 'AWS3 ' +\n      'AWSAccessKeyId=' + credentials.accessKeyId + ',' +\n      'Algorithm=HmacSHA256,' +\n      'SignedHeaders=' + this.signedHeaders() + ',' +\n      'Signature=' + this.signature(credentials);\n  },\n\n  signedHeaders: function signedHeaders() {\n    var headers = [];\n    AWS.util.arrayEach(this.headersToSign(), function iterator(h) {\n      headers.push(h.toLowerCase());\n    });\n    return headers.sort().join(';');\n  },\n\n  canonicalHeaders: function canonicalHeaders() {\n    var headers = this.request.headers;\n    var parts = [];\n    AWS.util.arrayEach(this.headersToSign(), function iterator(h) {\n      parts.push(h.toLowerCase().trim() + ':' + String(headers[h]).trim());\n    });\n    return parts.sort().join('\\n') + '\\n';\n  },\n\n  headersToSign: function headersToSign() {\n    var headers = [];\n    AWS.util.each(this.request.headers, function iterator(k) {\n      if (k === 'Host' || k === 'Content-Encoding' || k.match(/^X-Amz/i)) {\n        headers.push(k);\n      }\n    });\n    return headers;\n  },\n\n  signature: function signature(credentials) {\n    return AWS.util.crypto.hmac(credentials.secretAccessKey, this.stringToSign(), 'base64');\n  },\n\n  stringToSign: function stringToSign() {\n    var parts = [];\n    parts.push(this.request.method);\n    parts.push('/');\n    parts.push('');\n    parts.push(this.canonicalHeaders());\n    parts.push(this.request.body);\n    return AWS.util.crypto.sha256(parts.join('\\n'));\n  }\n\n});\n\nmodule.exports = AWS.Signers.V3;\n\n},{\"../core\":11}],50:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\nrequire('./v3');\n\n\nAWS.Signers.V3Https = inherit(AWS.Signers.V3, {\n  authorization: function authorization(credentials) {\n    return 'AWS3-HTTPS ' +\n      'AWSAccessKeyId=' + credentials.accessKeyId + ',' +\n      'Algorithm=HmacSHA256,' +\n      'Signature=' + this.signature(credentials);\n  },\n\n  stringToSign: function stringToSign() {\n    return this.request.headers['X-Amz-Date'];\n  }\n});\n\nmodule.exports = AWS.Signers.V3Https;\n\n},{\"../core\":11,\"./v3\":49}],51:[function(require,module,exports){\nvar AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n\nvar cachedSecret = {};\n\n\nvar cacheQueue = [];\n\n\nvar maxCacheEntries = 50;\n\n\nvar expiresHeader = 'presigned-expires';\n\n\nAWS.Signers.V4 = inherit(AWS.Signers.RequestSigner, {\n  constructor: function V4(request, serviceName, signatureCache) {\n    AWS.Signers.RequestSigner.call(this, request);\n    this.serviceName = serviceName;\n    this.signatureCache = signatureCache;\n  },\n\n  algorithm: 'AWS4-HMAC-SHA256',\n\n  addAuthorization: function addAuthorization(credentials, date) {\n    var datetime = AWS.util.date.iso8601(date).replace(/[:\\-]|\\.\\d{3}/g, '');\n\n    if (this.isPresigned()) {\n      this.updateForPresigned(credentials, datetime);\n    } else {\n      this.addHeaders(credentials, datetime);\n    }\n\n    this.request.headers['Authorization'] =\n      this.authorization(credentials, datetime);\n  },\n\n  addHeaders: function addHeaders(credentials, datetime) {\n    this.request.headers['X-Amz-Date'] = datetime;\n    if (credentials.sessionToken) {\n      this.request.headers['x-amz-security-token'] = credentials.sessionToken;\n    }\n  },\n\n  updateForPresigned: function updateForPresigned(credentials, datetime) {\n    var credString = this.credentialString(datetime);\n    var qs = {\n      'X-Amz-Date': datetime,\n      'X-Amz-Algorithm': this.algorithm,\n      'X-Amz-Credential': credentials.accessKeyId + '/' + credString,\n      'X-Amz-Expires': this.request.headers[expiresHeader],\n      'X-Amz-SignedHeaders': this.signedHeaders()\n    };\n\n    if (credentials.sessionToken) {\n      qs['X-Amz-Security-Token'] = credentials.sessionToken;\n    }\n\n    if (this.request.headers['Content-Type']) {\n      qs['Content-Type'] = this.request.headers['Content-Type'];\n    }\n    if (this.request.headers['Content-MD5']) {\n      qs['Content-MD5'] = this.request.headers['Content-MD5'];\n    }\n    if (this.request.headers['Cache-Control']) {\n      qs['Cache-Control'] = this.request.headers['Cache-Control'];\n    }\n\n    AWS.util.each.call(this, this.request.headers, function(key, value) {\n      if (key === expiresHeader) return;\n      if (this.isSignableHeader(key)) {\n        var lowerKey = key.toLowerCase();\n        if (lowerKey.indexOf('x-amz-meta-') === 0) {\n          qs[lowerKey] = value;\n        } else if (lowerKey.indexOf('x-amz-') === 0) {\n          qs[key] = value;\n        }\n      }\n    });\n\n    var sep = this.request.path.indexOf('?') >= 0 ? '&' : '?';\n    this.request.path += sep + AWS.util.queryParamsToString(qs);\n  },\n\n  authorization: function authorization(credentials, datetime) {\n    var parts = [];\n    var credString = this.credentialString(datetime);\n    parts.push(this.algorithm + ' Credential=' +\n      credentials.accessKeyId + '/' + credString);\n    parts.push('SignedHeaders=' + this.signedHeaders());\n    parts.push('Signature=' + this.signature(credentials, datetime));\n    return parts.join(', ');\n  },\n\n  signature: function signature(credentials, datetime) {\n    var cache = null;\n    var cacheIdentifier = this.serviceName + (this.getServiceClientId() ? '_' + this.getServiceClientId() : '');\n    if (this.signatureCache) {\n      var cache = cachedSecret[cacheIdentifier];\n      if (!cache) {\n        cacheQueue.push(cacheIdentifier);\n        if (cacheQueue.length > maxCacheEntries) {\n          delete cachedSecret[cacheQueue.shift()];\n        }\n      }\n\n    }\n    var date = datetime.substr(0, 8);\n\n    if (!cache ||\n        cache.akid !== credentials.accessKeyId ||\n        cache.region !== this.request.region ||\n        cache.date !== date) {\n\n      var kSecret = credentials.secretAccessKey;\n      var kDate = AWS.util.crypto.hmac('AWS4' + kSecret, date, 'buffer');\n      var kRegion = AWS.util.crypto.hmac(kDate, this.request.region, 'buffer');\n      var kService = AWS.util.crypto.hmac(kRegion, this.serviceName, 'buffer');\n      var kCredentials = AWS.util.crypto.hmac(kService, 'aws4_request', 'buffer');\n\n      if (!this.signatureCache) {\n        return AWS.util.crypto.hmac(kCredentials, this.stringToSign(datetime), 'hex');\n      }\n\n      cachedSecret[cacheIdentifier] = {\n        region: this.request.region, date: date,\n        key: kCredentials, akid: credentials.accessKeyId\n      };\n    }\n\n    var key = cachedSecret[cacheIdentifier].key;\n    return AWS.util.crypto.hmac(key, this.stringToSign(datetime), 'hex');\n  },\n\n  stringToSign: function stringToSign(datetime) {\n    var parts = [];\n    parts.push('AWS4-HMAC-SHA256');\n    parts.push(datetime);\n    parts.push(this.credentialString(datetime));\n    parts.push(this.hexEncodedHash(this.canonicalString()));\n    return parts.join('\\n');\n  },\n\n  canonicalString: function canonicalString() {\n    var parts = [], pathname = this.request.pathname();\n    if (this.serviceName !== 's3') pathname = AWS.util.uriEscapePath(pathname);\n\n    parts.push(this.request.method);\n    parts.push(pathname);\n    parts.push(this.request.search());\n    parts.push(this.canonicalHeaders() + '\\n');\n    parts.push(this.signedHeaders());\n    parts.push(this.hexEncodedBodyHash());\n    return parts.join('\\n');\n  },\n\n  canonicalHeaders: function canonicalHeaders() {\n    var headers = [];\n    AWS.util.each.call(this, this.request.headers, function (key, item) {\n      headers.push([key, item]);\n    });\n    headers.sort(function (a, b) {\n      return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1;\n    });\n    var parts = [];\n    AWS.util.arrayEach.call(this, headers, function (item) {\n      var key = item[0].toLowerCase();\n      if (this.isSignableHeader(key)) {\n        parts.push(key + ':' +\n          this.canonicalHeaderValues(item[1].toString()));\n      }\n    });\n    return parts.join('\\n');\n  },\n\n  canonicalHeaderValues: function canonicalHeaderValues(values) {\n    return values.replace(/\\s+/g, ' ').replace(/^\\s+|\\s+$/g, '');\n  },\n\n  signedHeaders: function signedHeaders() {\n    var keys = [];\n    AWS.util.each.call(this, this.request.headers, function (key) {\n      key = key.toLowerCase();\n      if (this.isSignableHeader(key)) keys.push(key);\n    });\n    return keys.sort().join(';');\n  },\n\n  credentialString: function credentialString(datetime) {\n    var parts = [];\n    parts.push(datetime.substr(0, 8));\n    parts.push(this.request.region);\n    parts.push(this.serviceName);\n    parts.push('aws4_request');\n    return parts.join('/');\n  },\n\n  hexEncodedHash: function hash(string) {\n    return AWS.util.crypto.sha256(string, 'hex');\n  },\n\n  hexEncodedBodyHash: function hexEncodedBodyHash() {\n    if (this.isPresigned() && this.serviceName === 's3' && !this.request.body) {\n      return 'UNSIGNED-PAYLOAD';\n    } else if (this.request.headers['X-Amz-Content-Sha256']) {\n      return this.request.headers['X-Amz-Content-Sha256'];\n    } else {\n      return this.hexEncodedHash(this.request.body || '');\n    }\n  },\n\n  unsignableHeaders: ['authorization', 'content-type', 'content-length',\n                      'user-agent', expiresHeader, 'expect'],\n\n  isSignableHeader: function isSignableHeader(key) {\n    if (key.toLowerCase().indexOf('x-amz-') === 0) return true;\n    return this.unsignableHeaders.indexOf(key) < 0;\n  },\n\n  isPresigned: function isPresigned() {\n    return this.request.headers[expiresHeader] ? true : false;\n  }\n\n});\n\nmodule.exports = AWS.Signers.V4;\n\n},{\"../core\":11}],52:[function(require,module,exports){\nfunction AcceptorStateMachine(states, state) {\n  this.currentState = state || null;\n  this.states = states || {};\n}\n\nAcceptorStateMachine.prototype.runTo = function runTo(finalState, done, bindObject, inputError) {\n  if (typeof finalState === 'function') {\n    inputError = bindObject; bindObject = done;\n    done = finalState; finalState = null;\n  }\n\n  var self = this;\n  var state = self.states[self.currentState];\n  state.fn.call(bindObject || self, inputError, function(err) {\n    if (err) {\n      if (state.fail) self.currentState = state.fail;\n      else return done ? done.call(bindObject, err) : null;\n    } else {\n      if (state.accept) self.currentState = state.accept;\n      else return done ? done.call(bindObject) : null;\n    }\n    if (self.currentState === finalState) {\n      return done ? done.call(bindObject, err) : null;\n    }\n\n    self.runTo(finalState, done, bindObject, err);\n  });\n};\n\nAcceptorStateMachine.prototype.addState = function addState(name, acceptState, failState, fn) {\n  if (typeof acceptState === 'function') {\n    fn = acceptState; acceptState = null; failState = null;\n  } else if (typeof failState === 'function') {\n    fn = failState; failState = null;\n  }\n\n  if (!this.currentState) this.currentState = name;\n  this.states[name] = { accept: acceptState, fail: failState, fn: fn };\n  return this;\n};\n\nmodule.exports = AcceptorStateMachine;\n\n},{}],53:[function(require,module,exports){\n(function (process){\n\nvar AWS;\n\n\nvar util = {\n  engine: function engine() {\n    if (util.isBrowser() && typeof navigator !== 'undefined') {\n      return navigator.userAgent;\n    } else {\n      return process.platform + '/' + process.version;\n    }\n  },\n\n  userAgent: function userAgent() {\n    var name = util.isBrowser() ? 'js' : 'nodejs';\n    var agent = 'aws-sdk-' + name + '/' + require('./core').VERSION;\n    if (name === 'nodejs') agent += ' ' + util.engine();\n    return agent;\n  },\n\n  isBrowser: function isBrowser() { return process && process.browser; },\n  isNode: function isNode() { return !util.isBrowser(); },\n  uriEscape: function uriEscape(string) {\n    var output = encodeURIComponent(string);\n    output = output.replace(/[^A-Za-z0-9_.~\\-%]+/g, escape);\n\n    output = output.replace(/[*]/g, function(ch) {\n      return '%' + ch.charCodeAt(0).toString(16).toUpperCase();\n    });\n\n    return output;\n  },\n\n  uriEscapePath: function uriEscapePath(string) {\n    var parts = [];\n    util.arrayEach(string.split('/'), function (part) {\n      parts.push(util.uriEscape(part));\n    });\n    return parts.join('/');\n  },\n\n  urlParse: function urlParse(url) {\n    return util.url.parse(url);\n  },\n\n  urlFormat: function urlFormat(url) {\n    return util.url.format(url);\n  },\n\n  queryStringParse: function queryStringParse(qs) {\n    return util.querystring.parse(qs);\n  },\n\n  queryParamsToString: function queryParamsToString(params) {\n    var items = [];\n    var escape = util.uriEscape;\n    var sortedKeys = Object.keys(params).sort();\n\n    util.arrayEach(sortedKeys, function(name) {\n      var value = params[name];\n      var ename = escape(name);\n      var result = ename + '=';\n      if (Array.isArray(value)) {\n        var vals = [];\n        util.arrayEach(value, function(item) { vals.push(escape(item)); });\n        result = ename + '=' + vals.sort().join('&' + ename + '=');\n      } else if (value !== undefined && value !== null) {\n        result = ename + '=' + escape(value);\n      }\n      items.push(result);\n    });\n\n    return items.join('&');\n  },\n\n  readFileSync: function readFileSync(path) {\n    if (util.isBrowser()) return null;\n    return require('fs').readFileSync(path, 'utf-8');\n  },\n\n  base64: {\n\n    encode: function encode64(string) {\n      return new util.Buffer(string).toString('base64');\n    },\n\n    decode: function decode64(string) {\n      return new util.Buffer(string, 'base64');\n    }\n\n  },\n\n  buffer: {\n    toStream: function toStream(buffer) {\n      if (!util.Buffer.isBuffer(buffer)) buffer = new util.Buffer(buffer);\n\n      var readable = new (util.stream.Readable)();\n      var pos = 0;\n      readable._read = function(size) {\n        if (pos >= buffer.length) return readable.push(null);\n\n        var end = pos + size;\n        if (end > buffer.length) end = buffer.length;\n        readable.push(buffer.slice(pos, end));\n        pos = end;\n      };\n\n      return readable;\n    },\n\n\n    concat: function(buffers) {\n      var length = 0,\n          offset = 0,\n          buffer = null, i;\n\n      for (i = 0; i < buffers.length; i++) {\n        length += buffers[i].length;\n      }\n\n      buffer = new util.Buffer(length);\n\n      for (i = 0; i < buffers.length; i++) {\n        buffers[i].copy(buffer, offset);\n        offset += buffers[i].length;\n      }\n\n      return buffer;\n    }\n  },\n\n  string: {\n    byteLength: function byteLength(string) {\n      if (string === null || string === undefined) return 0;\n      if (typeof string === 'string') string = new util.Buffer(string);\n\n      if (typeof string.byteLength === 'number') {\n        return string.byteLength;\n      } else if (typeof string.length === 'number') {\n        return string.length;\n      } else if (typeof string.size === 'number') {\n        return string.size;\n      } else if (typeof string.path === 'string') {\n        return require('fs').lstatSync(string.path).size;\n      } else {\n        throw util.error(new Error('Cannot determine length of ' + string),\n          { object: string });\n      }\n    },\n\n    upperFirst: function upperFirst(string) {\n      return string[0].toUpperCase() + string.substr(1);\n    },\n\n    lowerFirst: function lowerFirst(string) {\n      return string[0].toLowerCase() + string.substr(1);\n    }\n  },\n\n  ini: {\n    parse: function string(ini) {\n      var currentSection, map = {};\n      util.arrayEach(ini.split(/\\r?\\n/), function(line) {\n        line = line.split(/(^|\\s)[;#]/)[0]; // remove comments\n        var section = line.match(/^\\s*\\[([^\\[\\]]+)\\]\\s*$/);\n        if (section) {\n          currentSection = section[1];\n        } else if (currentSection) {\n          var item = line.match(/^\\s*(.+?)\\s*=\\s*(.+?)\\s*$/);\n          if (item) {\n            map[currentSection] = map[currentSection] || {};\n            map[currentSection][item[1]] = item[2];\n          }\n        }\n      });\n\n      return map;\n    }\n  },\n\n  fn: {\n    noop: function() {},\n\n\n    makeAsync: function makeAsync(fn, expectedArgs) {\n      if (expectedArgs && expectedArgs <= fn.length) {\n        return fn;\n      }\n\n      return function() {\n        var args = Array.prototype.slice.call(arguments, 0);\n        var callback = args.pop();\n        var result = fn.apply(null, args);\n        callback(result);\n      };\n    }\n  },\n\n\n  date: {\n\n\n    getDate: function getDate() {\n      if (!AWS) AWS = require('./core');\n      if (AWS.config.systemClockOffset) { // use offset when non-zero\n        return new Date(new Date().getTime() + AWS.config.systemClockOffset);\n      } else {\n        return new Date();\n      }\n    },\n\n\n    iso8601: function iso8601(date) {\n      if (date === undefined) { date = util.date.getDate(); }\n      return date.toISOString().replace(/\\.\\d{3}Z$/, 'Z');\n    },\n\n\n    rfc822: function rfc822(date) {\n      if (date === undefined) { date = util.date.getDate(); }\n      return date.toUTCString();\n    },\n\n\n    unixTimestamp: function unixTimestamp(date) {\n      if (date === undefined) { date = util.date.getDate(); }\n      return date.getTime() / 1000;\n    },\n\n\n    from: function format(date) {\n      if (typeof date === 'number') {\n        return new Date(date * 1000); // unix timestamp\n      } else {\n        return new Date(date);\n      }\n    },\n\n\n    format: function format(date, formatter) {\n      if (!formatter) formatter = 'iso8601';\n      return util.date[formatter](util.date.from(date));\n    },\n\n    parseTimestamp: function parseTimestamp(value) {\n      if (typeof value === 'number') { // unix timestamp (number)\n        return new Date(value * 1000);\n      } else if (value.match(/^\\d+$/)) { // unix timestamp\n        return new Date(value * 1000);\n      } else if (value.match(/^\\d{4}/)) { // iso8601\n        return new Date(value);\n      } else if (value.match(/^\\w{3},/)) { // rfc822\n        return new Date(value);\n      } else {\n        throw util.error(\n          new Error('unhandled timestamp format: ' + value),\n          {code: 'TimestampParserError'});\n      }\n    }\n\n  },\n\n  crypto: {\n    crc32Table: [\n     0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419,\n     0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4,\n     0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07,\n     0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,\n     0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856,\n     0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,\n     0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,\n     0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,\n     0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,\n     0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A,\n     0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599,\n     0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,\n     0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190,\n     0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,\n     0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E,\n     0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,\n     0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED,\n     0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,\n     0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3,\n     0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,\n     0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A,\n     0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,\n     0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010,\n     0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,\n     0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17,\n     0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6,\n     0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,\n     0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,\n     0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344,\n     0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,\n     0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A,\n     0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,\n     0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1,\n     0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C,\n     0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,\n     0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,\n     0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE,\n     0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,\n     0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C,\n     0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,\n     0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B,\n     0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,\n     0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1,\n     0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,\n     0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,\n     0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,\n     0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66,\n     0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,\n     0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605,\n     0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8,\n     0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B,\n     0x2D02EF8D],\n\n    crc32: function crc32(data) {\n      var tbl = util.crypto.crc32Table;\n      var crc = 0 ^ -1;\n\n      if (typeof data === 'string') {\n        data = new util.Buffer(data);\n      }\n\n      for (var i = 0; i < data.length; i++) {\n        var code = data.readUInt8(i);\n        crc = (crc >>> 8) ^ tbl[(crc ^ code) & 0xFF];\n      }\n      return (crc ^ -1) >>> 0;\n    },\n\n    hmac: function hmac(key, string, digest, fn) {\n      if (!digest) digest = 'binary';\n      if (digest === 'buffer') { digest = undefined; }\n      if (!fn) fn = 'sha256';\n      if (typeof string === 'string') string = new util.Buffer(string);\n      return util.crypto.lib.createHmac(fn, key).update(string).digest(digest);\n    },\n\n    md5: function md5(data, digest, callback) {\n      return util.crypto.hash('md5', data, digest, callback);\n    },\n\n    sha256: function sha256(data, digest, callback) {\n      return util.crypto.hash('sha256', data, digest, callback);\n    },\n\n    hash: function(algorithm, data, digest, callback) {\n      var hash = util.crypto.createHash(algorithm);\n      if (!digest) { digest = 'binary'; }\n      if (digest === 'buffer') { digest = undefined; }\n      if (typeof data === 'string') data = new util.Buffer(data);\n      var sliceFn = util.arraySliceFn(data);\n      var isBuffer = util.Buffer.isBuffer(data);\n      if (util.isBrowser() && typeof ArrayBuffer !== 'undefined' && data && data.buffer instanceof ArrayBuffer) isBuffer = true;\n\n      if (callback && typeof data === 'object' &&\n          typeof data.on === 'function' && !isBuffer) {\n        data.on('data', function(chunk) { hash.update(chunk); });\n        data.on('error', function(err) { callback(err); });\n        data.on('end', function() { callback(null, hash.digest(digest)); });\n      } else if (callback && sliceFn && !isBuffer &&\n                 typeof FileReader !== 'undefined') {\n        var index = 0, size = 1024 * 512;\n        var reader = new FileReader();\n        reader.onerror = function() {\n          callback(new Error('Failed to read data.'));\n        };\n        reader.onload = function() {\n          var buf = new util.Buffer(new Uint8Array(reader.result));\n          hash.update(buf);\n          index += buf.length;\n          reader._continueReading();\n        };\n        reader._continueReading = function() {\n          if (index >= data.size) {\n            callback(null, hash.digest(digest));\n            return;\n          }\n\n          var back = index + size;\n          if (back > data.size) back = data.size;\n          reader.readAsArrayBuffer(sliceFn.call(data, index, back));\n        };\n\n        reader._continueReading();\n      } else {\n        if (util.isBrowser() && typeof data === 'object' && !isBuffer) {\n          data = new util.Buffer(new Uint8Array(data));\n        }\n        var out = hash.update(data).digest(digest);\n        if (callback) callback(null, out);\n        return out;\n      }\n    },\n\n    toHex: function toHex(data) {\n      var out = [];\n      for (var i = 0; i < data.length; i++) {\n        out.push(('0' + data.charCodeAt(i).toString(16)).substr(-2, 2));\n      }\n      return out.join('');\n    },\n\n    createHash: function createHash(algorithm) {\n      return util.crypto.lib.createHash(algorithm);\n    }\n\n  },\n\n\n\n\n  abort: {},\n\n  each: function each(object, iterFunction) {\n    for (var key in object) {\n      if (Object.prototype.hasOwnProperty.call(object, key)) {\n        var ret = iterFunction.call(this, key, object[key]);\n        if (ret === util.abort) break;\n      }\n    }\n  },\n\n  arrayEach: function arrayEach(array, iterFunction) {\n    for (var idx in array) {\n      if (Object.prototype.hasOwnProperty.call(array, idx)) {\n        var ret = iterFunction.call(this, array[idx], parseInt(idx, 10));\n        if (ret === util.abort) break;\n      }\n    }\n  },\n\n  update: function update(obj1, obj2) {\n    util.each(obj2, function iterator(key, item) {\n      obj1[key] = item;\n    });\n    return obj1;\n  },\n\n  merge: function merge(obj1, obj2) {\n    return util.update(util.copy(obj1), obj2);\n  },\n\n  copy: function copy(object) {\n    if (object === null || object === undefined) return object;\n    var dupe = {};\n    for (var key in object) {\n      dupe[key] = object[key];\n    }\n    return dupe;\n  },\n\n  isEmpty: function isEmpty(obj) {\n    for (var prop in obj) {\n      if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n        return false;\n      }\n    }\n    return true;\n  },\n\n  arraySliceFn: function arraySliceFn(obj) {\n    var fn = obj.slice || obj.webkitSlice || obj.mozSlice;\n    return typeof fn === 'function' ? fn : null;\n  },\n\n  isType: function isType(obj, type) {\n    if (typeof type === 'function') type = util.typeName(type);\n    return Object.prototype.toString.call(obj) === '[object ' + type + ']';\n  },\n\n  typeName: function typeName(type) {\n    if (Object.prototype.hasOwnProperty.call(type, 'name')) return type.name;\n    var str = type.toString();\n    var match = str.match(/^\\s*function (.+)\\(/);\n    return match ? match[1] : str;\n  },\n\n  error: function error(err, options) {\n    var originalError = null;\n    if (typeof err.message === 'string' && err.message !== '') {\n      if (typeof options === 'string' || (options && options.message)) {\n        originalError = util.copy(err);\n        originalError.message = err.message;\n      }\n    }\n    err.message = err.message || null;\n\n    if (typeof options === 'string') {\n      err.message = options;\n    } else if (typeof options === 'object' && options !== null) {\n      util.update(err, options);\n      if (options.message)\n        err.message = options.message;\n      if (options.code || options.name)\n        err.code = options.code || options.name;\n      if (options.stack)\n        err.stack = options.stack;\n    }\n\n    if (typeof Object.defineProperty === 'function') {\n      Object.defineProperty(err, 'name', {writable: true, enumerable: false});\n      Object.defineProperty(err, 'message', {enumerable: true});\n    }\n\n    err.name = options && options.name || err.name || err.code || 'Error';\n    err.time = new Date();\n\n    if (originalError) err.originalError = originalError;\n\n    return err;\n  },\n\n\n  inherit: function inherit(klass, features) {\n    var newObject = null;\n    if (features === undefined) {\n      features = klass;\n      klass = Object;\n      newObject = {};\n    } else {\n      var ctor = function ConstructorWrapper() {};\n      ctor.prototype = klass.prototype;\n      newObject = new ctor();\n    }\n\n    if (features.constructor === Object) {\n      features.constructor = function() {\n        if (klass !== Object) {\n          return klass.apply(this, arguments);\n        }\n      };\n    }\n\n    features.constructor.prototype = newObject;\n    util.update(features.constructor.prototype, features);\n    features.constructor.__super__ = klass;\n    return features.constructor;\n  },\n\n\n  mixin: function mixin() {\n    var klass = arguments[0];\n    for (var i = 1; i < arguments.length; i++) {\n      for (var prop in arguments[i].prototype) {\n        var fn = arguments[i].prototype[prop];\n        if (prop !== 'constructor') {\n          klass.prototype[prop] = fn;\n        }\n      }\n    }\n    return klass;\n  },\n\n\n  hideProperties: function hideProperties(obj, props) {\n    if (typeof Object.defineProperty !== 'function') return;\n\n    util.arrayEach(props, function (key) {\n      Object.defineProperty(obj, key, {\n        enumerable: false, writable: true, configurable: true });\n    });\n  },\n\n\n  property: function property(obj, name, value, enumerable, isValue) {\n    var opts = {\n      configurable: true,\n      enumerable: enumerable !== undefined ? enumerable : true\n    };\n    if (typeof value === 'function' && !isValue) {\n      opts.get = value;\n    }\n    else {\n      opts.value = value; opts.writable = true;\n    }\n\n    Object.defineProperty(obj, name, opts);\n  },\n\n\n  memoizedProperty: function memoizedProperty(obj, name, get, enumerable) {\n    var cachedValue = null;\n\n    util.property(obj, name, function() {\n      if (cachedValue === null) {\n        cachedValue = get();\n      }\n      return cachedValue;\n    }, enumerable);\n  },\n\n\n  hoistPayloadMember: function hoistPayloadMember(resp) {\n    var req = resp.request;\n    var operation = req.operation;\n    var output = req.service.api.operations[operation].output;\n    if (output.payload) {\n      var payloadMember = output.members[output.payload];\n      var responsePayload = resp.data[output.payload];\n      if (payloadMember.type === 'structure') {\n        util.each(responsePayload, function(key, value) {\n          util.property(resp.data, key, value, false);\n        });\n      }\n    }\n  },\n\n\n  computeSha256: function computeSha256(body, done) {\n    if (util.isNode()) {\n      var Stream = util.stream.Stream;\n      var fs = require('fs');\n      if (body instanceof Stream) {\n        if (typeof body.path === 'string') { // assume file object\n          var settings = {};\n          if (typeof body.start === 'number') {\n            settings.start = body.start;\n          }\n          if (typeof body.end === 'number') {\n            settings.end = body.end;\n          }\n          body = fs.createReadStream(body.path, settings);\n        } else { // TODO support other stream types\n          return done(new Error('Non-file stream objects are ' +\n                                'not supported with SigV4'));\n        }\n      }\n    }\n\n    util.crypto.sha256(body, 'hex', function(err, sha) {\n      if (err) done(err);\n      else done(null, sha);\n    });\n  },\n\n\n  isClockSkewed: function isClockSkewed(serverTime) {\n    if (serverTime) {\n      util.property(AWS.config, 'isClockSkewed',\n        Math.abs(new Date().getTime() - serverTime) >= 300000, false);\n      return AWS.config.isClockSkewed;\n    }\n  },\n\n  applyClockOffset: function applyClockOffset(serverTime) {\n    if (serverTime)\n      AWS.config.systemClockOffset = serverTime - new Date().getTime();\n  },\n\n\n  extractRequestId: function extractRequestId(resp) {\n    var requestId = resp.httpResponse.headers['x-amz-request-id'] ||\n                     resp.httpResponse.headers['x-amzn-requestid'];\n\n    if (!requestId && resp.data && resp.data.ResponseMetadata) {\n      requestId = resp.data.ResponseMetadata.RequestId;\n    }\n\n    if (requestId) {\n      resp.requestId = requestId;\n    }\n\n    if (resp.error) {\n      resp.error.requestId = requestId;\n    }\n  },\n\n\n  addPromisesToRequests: function addPromisesToRequests(constructor, PromiseDependency) {\n    PromiseDependency = PromiseDependency || null;\n    if (!PromiseDependency && typeof Promise !== 'undefined') {\n      PromiseDependency = Promise;\n    }\n    if (typeof PromiseDependency !== 'function') {\n      delete constructor.prototype.promise;\n      return;\n    }\n    constructor.prototype.promise = function promise() {\n      var self = this;\n      return new PromiseDependency(function(resolve, reject) {\n        self.on('complete', function(resp) {\n          if (resp.error) {\n            reject(resp.error);\n          } else {\n            resolve(resp.data);\n          }\n        });\n        self.runTo();\n      });\n    }\n  },\n\n\n  isDualstackAvailable: function isDualstackAvailable(service) {\n    if (!service) return false;\n    var metadata = require('../apis/metadata.json');\n    if (typeof service !== 'string') service = service.serviceIdentifier;\n    if (typeof service !== 'string' || !metadata.hasOwnProperty(service)) return false;\n    return !!metadata[service].dualstackAvailable;\n  },\n\n\n  calculateRetryDelay: function calculateRetryDelay(retryCount, retryDelayOptions) {\n    if (!retryDelayOptions) retryDelayOptions = {};\n    var customBackoff = retryDelayOptions.customBackoff || null;\n    if (typeof customBackoff === 'function') {\n      return customBackoff(retryCount);\n    }\n    var base = retryDelayOptions.base || 100;\n    var delay = Math.random() * (Math.pow(2, retryCount) * base);\n    return delay;\n  },\n\n\n  handleRequestWithRetries: function handleRequestWithRetries(httpRequest, options, cb) {\n    if (!options) options = {};\n    var http = AWS.HttpClient.getInstance();\n    var httpOptions = options.httpOptions || {};\n    var retryCount = 0;\n\n    var errCallback = function(err) {\n      var maxRetries = options.maxRetries || 0;\n      if (err && err.code === 'TimeoutError') err.retryable = true;\n      if (err && err.retryable && retryCount < maxRetries) {\n        retryCount++;\n        var delay = util.calculateRetryDelay(retryCount, options.retryDelayOptions);\n        setTimeout(sendRequest, delay + (err.retryAfter || 0));\n      } else {\n        cb(err);\n      }\n    };\n\n    var sendRequest = function() {\n      var data = '';\n      http.handleRequest(httpRequest, httpOptions, function(httpResponse) {\n        httpResponse.on('data', function(chunk) { data += chunk.toString(); });\n        httpResponse.on('end', function() {\n          var statusCode = httpResponse.statusCode;\n          if (statusCode < 300) {\n            cb(null, data);\n          } else {\n            var retryAfter = parseInt(httpResponse.headers['retry-after'], 10) * 1000 || 0;\n            var err = util.error(new Error(),\n              { retryable: statusCode >= 500 || statusCode === 429 }\n            );\n            if (retryAfter && err.retryable) err.retryAfter = retryAfter;\n            errCallback(err);\n          }\n        });\n      }, errCallback);\n    };\n\n    process.nextTick(sendRequest);\n  }\n\n};\n\nmodule.exports = util;\n\n}).call(this,require(\"FWaASH\"))\n},{\"../apis/metadata.json\":3,\"./core\":11,\"FWaASH\":62,\"fs\":56}],54:[function(require,module,exports){\nvar util = require('../util');\nvar Shape = require('../model/shape');\n\nfunction DomXmlParser() { }\n\nDomXmlParser.prototype.parse = function(xml, shape) {\n  if (xml.replace(/^\\s+/, '') === '') return {};\n\n  var result, error;\n  try {\n    if (window.DOMParser) {\n      try {\n        var parser = new DOMParser();\n        result = parser.parseFromString(xml, 'text/xml');\n      } catch (syntaxError) {\n        throw util.error(new Error('Parse error in document'),\n          {\n            originalError: syntaxError,\n            code: 'XMLParserError',\n            retryable: true\n          });\n      }\n\n      if (result.documentElement === null) {\n        throw util.error(new Error('Cannot parse empty document.'),\n          {\n            code: 'XMLParserError',\n            retryable: true\n          });\n      }\n\n      var isError = result.getElementsByTagName('parsererror')[0];\n      if (isError && (isError.parentNode === result ||\n          isError.parentNode.nodeName === 'body' ||\n          isError.parentNode.parentNode === result ||\n          isError.parentNode.parentNode.nodeName === 'body')) {\n        var errorElement = isError.getElementsByTagName('div')[0] || isError;\n        throw util.error(new Error(errorElement.textContent || 'Parser error in document'),\n          {\n            code: 'XMLParserError',\n            retryable: true\n          });\n      }\n    } else if (window.ActiveXObject) {\n      result = new window.ActiveXObject('Microsoft.XMLDOM');\n      result.async = false;\n\n      if (!result.loadXML(xml)) {\n        throw util.error(new Error('Parse error in document'),\n          {\n            code: 'XMLParserError',\n            retryable: true\n          });\n      }\n    } else {\n      throw new Error('Cannot load XML parser');\n    }\n  } catch (e) {\n    error = e;\n  }\n\n  if (result && result.documentElement && !error) {\n    var data = parseXml(result.documentElement, shape);\n    var metadata = result.getElementsByTagName('ResponseMetadata')[0];\n    if (metadata) {\n      data.ResponseMetadata = parseXml(metadata, {});\n    }\n    return data;\n  } else if (error) {\n    throw util.error(error || new Error(), {code: 'XMLParserError', retryable: true});\n  } else { // empty xml document\n    return {};\n  }\n};\n\nfunction parseXml(xml, shape) {\n  if (!shape) shape = {};\n  switch (shape.type) {\n    case 'structure': return parseStructure(xml, shape);\n    case 'map': return parseMap(xml, shape);\n    case 'list': return parseList(xml, shape);\n    case undefined: case null: return parseUnknown(xml);\n    default: return parseScalar(xml, shape);\n  }\n}\n\nfunction parseStructure(xml, shape) {\n  var data = {};\n  if (xml === null) return data;\n\n  util.each(shape.members, function(memberName, memberShape) {\n    if (memberShape.isXmlAttribute) {\n      if (Object.prototype.hasOwnProperty.call(xml.attributes, memberShape.name)) {\n        var value = xml.attributes[memberShape.name].value;\n        data[memberName] = parseXml({textContent: value}, memberShape);\n      }\n    } else {\n      var xmlChild = memberShape.flattened ? xml :\n        xml.getElementsByTagName(memberShape.name)[0];\n      if (xmlChild) {\n        data[memberName] = parseXml(xmlChild, memberShape);\n      } else if (!memberShape.flattened && memberShape.type === 'list') {\n        data[memberName] = memberShape.defaultValue;\n      }\n    }\n  });\n\n  return data;\n}\n\nfunction parseMap(xml, shape) {\n  var data = {};\n  var xmlKey = shape.key.name || 'key';\n  var xmlValue = shape.value.name || 'value';\n  var tagName = shape.flattened ? shape.name : 'entry';\n\n  var child = xml.firstElementChild;\n  while (child) {\n    if (child.nodeName === tagName) {\n      var key = child.getElementsByTagName(xmlKey)[0].textContent;\n      var value = child.getElementsByTagName(xmlValue)[0];\n      data[key] = parseXml(value, shape.value);\n    }\n    child = child.nextElementSibling;\n  }\n  return data;\n}\n\nfunction parseList(xml, shape) {\n  var data = [];\n  var tagName = shape.flattened ? shape.name : (shape.member.name || 'member');\n\n  var child = xml.firstElementChild;\n  while (child) {\n    if (child.nodeName === tagName) {\n      data.push(parseXml(child, shape.member));\n    }\n    child = child.nextElementSibling;\n  }\n  return data;\n}\n\nfunction parseScalar(xml, shape) {\n  if (xml.getAttribute) {\n    var encoding = xml.getAttribute('encoding');\n    if (encoding === 'base64') {\n      shape = new Shape.create({type: encoding});\n    }\n  }\n\n  var text = xml.textContent;\n  if (text === '') text = null;\n  if (typeof shape.toType === 'function') {\n    return shape.toType(text);\n  } else {\n    return text;\n  }\n}\n\nfunction parseUnknown(xml) {\n  if (xml === undefined || xml === null) return '';\n\n  if (!xml.firstElementChild) {\n    if (xml.parentNode.parentNode === null) return {};\n    if (xml.childNodes.length === 0) return '';\n    else return xml.textContent;\n  }\n\n  var shape = {type: 'structure', members: {}};\n  var child = xml.firstElementChild;\n  while (child) {\n    var tag = child.nodeName;\n    if (Object.prototype.hasOwnProperty.call(shape.members, tag)) {\n      shape.members[tag].type = 'list';\n    } else {\n      shape.members[tag] = {name: tag};\n    }\n    child = child.nextElementSibling;\n  }\n  return parseStructure(xml, shape);\n}\n\nmodule.exports = DomXmlParser;\n\n},{\"../model/shape\":28,\"../util\":53}],55:[function(require,module,exports){\nvar util = require('../util');\nvar builder = require('xmlbuilder');\n\nfunction XmlBuilder() { }\n\nXmlBuilder.prototype.toXML = function(params, shape, rootElement, noEmpty) {\n  var xml = builder.create(rootElement);\n  applyNamespaces(xml, shape);\n  serialize(xml, params, shape);\n  return xml.children.length > 0 || noEmpty ? xml.root().toString() : '';\n};\n\nfunction serialize(xml, value, shape) {\n  switch (shape.type) {\n    case 'structure': return serializeStructure(xml, value, shape);\n    case 'map': return serializeMap(xml, value, shape);\n    case 'list': return serializeList(xml, value, shape);\n    default: return serializeScalar(xml, value, shape);\n  }\n}\n\nfunction serializeStructure(xml, params, shape) {\n  util.arrayEach(shape.memberNames, function(memberName) {\n    var memberShape = shape.members[memberName];\n    if (memberShape.location !== 'body') return;\n\n    var value = params[memberName];\n    var name = memberShape.name;\n    if (value !== undefined && value !== null) {\n      if (memberShape.isXmlAttribute) {\n        xml.att(name, value);\n      } else if (memberShape.flattened) {\n        serialize(xml, value, memberShape);\n      } else {\n        var element = xml.ele(name);\n        applyNamespaces(element, memberShape);\n        serialize(element, value, memberShape);\n      }\n    }\n  });\n}\n\nfunction serializeMap(xml, map, shape) {\n  var xmlKey = shape.key.name || 'key';\n  var xmlValue = shape.value.name || 'value';\n\n  util.each(map, function(key, value) {\n    var entry = xml.ele(shape.flattened ? shape.name : 'entry');\n    serialize(entry.ele(xmlKey), key, shape.key);\n    serialize(entry.ele(xmlValue), value, shape.value);\n  });\n}\n\nfunction serializeList(xml, list, shape) {\n  if (shape.flattened) {\n    util.arrayEach(list, function(value) {\n      var name = shape.member.name || shape.name;\n      var element = xml.ele(name);\n      serialize(element, value, shape.member);\n    });\n  } else {\n    util.arrayEach(list, function(value) {\n      var name = shape.member.name || 'member';\n      var element = xml.ele(name);\n      serialize(element, value, shape.member);\n    });\n  }\n}\n\nfunction serializeScalar(xml, value, shape) {\n  xml.txt(shape.toWireFormat(value));\n}\n\nfunction applyNamespaces(xml, shape) {\n  var uri, prefix = 'xmlns';\n  if (shape.xmlNamespaceUri) {\n    uri = shape.xmlNamespaceUri;\n    if (shape.xmlNamespacePrefix) prefix += ':' + shape.xmlNamespacePrefix;\n  } else if (xml.isRoot && shape.api.xmlNamespaceUri) {\n    uri = shape.api.xmlNamespaceUri;\n  }\n\n  if (uri) xml.att(prefix, uri);\n}\n\nmodule.exports = XmlBuilder;\n\n},{\"../util\":53,\"xmlbuilder\":100}],56:[function(require,module,exports){\n\n},{}],57:[function(require,module,exports){\n\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = Buffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192\n\n\nBuffer._useTypedArrays = (function () {\n  try {\n    var buf = new ArrayBuffer(0)\n    var arr = new Uint8Array(buf)\n    arr.foo = function () { return 42 }\n    return 42 === arr.foo() &&\n        typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray`\n  } catch (e) {\n    return false\n  }\n})()\n\n\nfunction Buffer (subject, encoding, noZero) {\n  if (!(this instanceof Buffer))\n    return new Buffer(subject, encoding, noZero)\n\n  var type = typeof subject\n\n  if (encoding === 'base64' && type === 'string') {\n    subject = stringtrim(subject)\n    while (subject.length % 4 !== 0) {\n      subject = subject + '='\n    }\n  }\n\n  var length\n  if (type === 'number')\n    length = coerce(subject)\n  else if (type === 'string')\n    length = Buffer.byteLength(subject, encoding)\n  else if (type === 'object')\n    length = coerce(subject.length) // assume that object is array-like\n  else\n    throw new Error('First argument needs to be a number, array or string.')\n\n  var buf\n  if (Buffer._useTypedArrays) {\n    buf = Buffer._augment(new Uint8Array(length))\n  } else {\n    buf = this\n    buf.length = length\n    buf._isBuffer = true\n  }\n\n  var i\n  if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') {\n    buf._set(subject)\n  } else if (isArrayish(subject)) {\n    for (i = 0; i < length; i++) {\n      if (Buffer.isBuffer(subject))\n        buf[i] = subject.readUInt8(i)\n      else\n        buf[i] = subject[i]\n    }\n  } else if (type === 'string') {\n    buf.write(subject, 0, encoding)\n  } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) {\n    for (i = 0; i < length; i++) {\n      buf[i] = 0\n    }\n  }\n\n  return buf\n}\n\n\nBuffer.isEncoding = function (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.isBuffer = function (b) {\n  return !!(b !== null && b !== undefined && b._isBuffer)\n}\n\nBuffer.byteLength = function (str, encoding) {\n  var ret\n  str = str + ''\n  switch (encoding || 'utf8') {\n    case 'hex':\n      ret = str.length / 2\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = utf8ToBytes(str).length\n      break\n    case 'ascii':\n    case 'binary':\n    case 'raw':\n      ret = str.length\n      break\n    case 'base64':\n      ret = base64ToBytes(str).length\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = str.length * 2\n      break\n    default:\n      throw new Error('Unknown encoding')\n  }\n  return ret\n}\n\nBuffer.concat = function (list, totalLength) {\n  assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\\n' +\n      'list should be an Array.')\n\n  if (list.length === 0) {\n    return new Buffer(0)\n  } else if (list.length === 1) {\n    return list[0]\n  }\n\n  var i\n  if (typeof totalLength !== 'number') {\n    totalLength = 0\n    for (i = 0; i < list.length; i++) {\n      totalLength += list[i].length\n    }\n  }\n\n  var buf = new Buffer(totalLength)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var item = list[i]\n    item.copy(buf, pos)\n    pos += item.length\n  }\n  return buf\n}\n\n\nfunction _hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  var strLen = string.length\n  assert(strLen % 2 === 0, 'Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var byte = parseInt(string.substr(i * 2, 2), 16)\n    assert(!isNaN(byte), 'Invalid hex string')\n    buf[offset + i] = byte\n  }\n  Buffer._charsWritten = i * 2\n  return i\n}\n\nfunction _utf8Write (buf, string, offset, length) {\n  var charsWritten = Buffer._charsWritten =\n    blitBuffer(utf8ToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction _asciiWrite (buf, string, offset, length) {\n  var charsWritten = Buffer._charsWritten =\n    blitBuffer(asciiToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction _binaryWrite (buf, string, offset, length) {\n  return _asciiWrite(buf, string, offset, length)\n}\n\nfunction _base64Write (buf, string, offset, length) {\n  var charsWritten = Buffer._charsWritten =\n    blitBuffer(base64ToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nfunction _utf16leWrite (buf, string, offset, length) {\n  var charsWritten = Buffer._charsWritten =\n    blitBuffer(utf16leToBytes(string), buf, offset, length)\n  return charsWritten\n}\n\nBuffer.prototype.write = function (string, offset, length, encoding) {\n  if (isFinite(offset)) {\n    if (!isFinite(length)) {\n      encoding = length\n      length = undefined\n    }\n  } else {  // legacy\n    var swap = encoding\n    encoding = offset\n    offset = length\n    length = swap\n  }\n\n  offset = Number(offset) || 0\n  var remaining = this.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n  encoding = String(encoding || 'utf8').toLowerCase()\n\n  var ret\n  switch (encoding) {\n    case 'hex':\n      ret = _hexWrite(this, string, offset, length)\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = _utf8Write(this, string, offset, length)\n      break\n    case 'ascii':\n      ret = _asciiWrite(this, string, offset, length)\n      break\n    case 'binary':\n      ret = _binaryWrite(this, string, offset, length)\n      break\n    case 'base64':\n      ret = _base64Write(this, string, offset, length)\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = _utf16leWrite(this, string, offset, length)\n      break\n    default:\n      throw new Error('Unknown encoding')\n  }\n  return ret\n}\n\nBuffer.prototype.toString = function (encoding, start, end) {\n  var self = this\n\n  encoding = String(encoding || 'utf8').toLowerCase()\n  start = Number(start) || 0\n  end = (end !== undefined)\n    ? Number(end)\n    : end = self.length\n\n  if (end === start)\n    return ''\n\n  var ret\n  switch (encoding) {\n    case 'hex':\n      ret = _hexSlice(self, start, end)\n      break\n    case 'utf8':\n    case 'utf-8':\n      ret = _utf8Slice(self, start, end)\n      break\n    case 'ascii':\n      ret = _asciiSlice(self, start, end)\n      break\n    case 'binary':\n      ret = _binarySlice(self, start, end)\n      break\n    case 'base64':\n      ret = _base64Slice(self, start, end)\n      break\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      ret = _utf16leSlice(self, start, end)\n      break\n    default:\n      throw new Error('Unknown encoding')\n  }\n  return ret\n}\n\nBuffer.prototype.toJSON = function () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nBuffer.prototype.copy = function (target, target_start, start, end) {\n  var source = this\n\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (!target_start) target_start = 0\n\n  if (end === start) return\n  if (target.length === 0 || source.length === 0) return\n\n  assert(end >= start, 'sourceEnd < sourceStart')\n  assert(target_start >= 0 && target_start < target.length,\n      'targetStart out of bounds')\n  assert(start >= 0 && start < source.length, 'sourceStart out of bounds')\n  assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds')\n\n  if (end > this.length)\n    end = this.length\n  if (target.length - target_start < end - start)\n    end = target.length - target_start + start\n\n  var len = end - start\n\n  if (len < 100 || !Buffer._useTypedArrays) {\n    for (var i = 0; i < len; i++)\n      target[i + target_start] = this[i + start]\n  } else {\n    target._set(this.subarray(start, start + len), target_start)\n  }\n}\n\nfunction _base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction _utf8Slice (buf, start, end) {\n  var res = ''\n  var tmp = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    if (buf[i] <= 0x7F) {\n      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\n      tmp = ''\n    } else {\n      tmp += '%' + buf[i].toString(16)\n    }\n  }\n\n  return res + decodeUtf8Char(tmp)\n}\n\nfunction _asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++)\n    ret += String.fromCharCode(buf[i])\n  return ret\n}\n\nfunction _binarySlice (buf, start, end) {\n  return _asciiSlice(buf, start, end)\n}\n\nfunction _hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction _utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i+1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function (start, end) {\n  var len = this.length\n  start = clamp(start, len, 0)\n  end = clamp(end, len, len)\n\n  if (Buffer._useTypedArrays) {\n    return Buffer._augment(this.subarray(start, end))\n  } else {\n    var sliceLen = end - start\n    var newBuf = new Buffer(sliceLen, undefined, true)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n    return newBuf\n  }\n}\n\nBuffer.prototype.get = function (offset) {\n  console.log('.get() is deprecated. Access using array indexes instead.')\n  return this.readUInt8(offset)\n}\n\nBuffer.prototype.set = function (v, offset) {\n  console.log('.set() is deprecated. Access using array indexes instead.')\n  return this.writeUInt8(v, offset)\n}\n\nBuffer.prototype.readUInt8 = function (offset, noAssert) {\n  if (!noAssert) {\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset < this.length, 'Trying to read beyond buffer length')\n  }\n\n  if (offset >= this.length)\n    return\n\n  return this[offset]\n}\n\nfunction _readUInt16 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val\n  if (littleEndian) {\n    val = buf[offset]\n    if (offset + 1 < len)\n      val |= buf[offset + 1] << 8\n  } else {\n    val = buf[offset] << 8\n    if (offset + 1 < len)\n      val |= buf[offset + 1]\n  }\n  return val\n}\n\nBuffer.prototype.readUInt16LE = function (offset, noAssert) {\n  return _readUInt16(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readUInt16BE = function (offset, noAssert) {\n  return _readUInt16(this, offset, false, noAssert)\n}\n\nfunction _readUInt32 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val\n  if (littleEndian) {\n    if (offset + 2 < len)\n      val = buf[offset + 2] << 16\n    if (offset + 1 < len)\n      val |= buf[offset + 1] << 8\n    val |= buf[offset]\n    if (offset + 3 < len)\n      val = val + (buf[offset + 3] << 24 >>> 0)\n  } else {\n    if (offset + 1 < len)\n      val = buf[offset + 1] << 16\n    if (offset + 2 < len)\n      val |= buf[offset + 2] << 8\n    if (offset + 3 < len)\n      val |= buf[offset + 3]\n    val = val + (buf[offset] << 24 >>> 0)\n  }\n  return val\n}\n\nBuffer.prototype.readUInt32LE = function (offset, noAssert) {\n  return _readUInt32(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readUInt32BE = function (offset, noAssert) {\n  return _readUInt32(this, offset, false, noAssert)\n}\n\nBuffer.prototype.readInt8 = function (offset, noAssert) {\n  if (!noAssert) {\n    assert(offset !== undefined && offset !== null,\n        'missing offset')\n    assert(offset < this.length, 'Trying to read beyond buffer length')\n  }\n\n  if (offset >= this.length)\n    return\n\n  var neg = this[offset] & 0x80\n  if (neg)\n    return (0xff - this[offset] + 1) * -1\n  else\n    return this[offset]\n}\n\nfunction _readInt16 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val = _readUInt16(buf, offset, littleEndian, true)\n  var neg = val & 0x8000\n  if (neg)\n    return (0xffff - val + 1) * -1\n  else\n    return val\n}\n\nBuffer.prototype.readInt16LE = function (offset, noAssert) {\n  return _readInt16(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readInt16BE = function (offset, noAssert) {\n  return _readInt16(this, offset, false, noAssert)\n}\n\nfunction _readInt32 (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  var val = _readUInt32(buf, offset, littleEndian, true)\n  var neg = val & 0x80000000\n  if (neg)\n    return (0xffffffff - val + 1) * -1\n  else\n    return val\n}\n\nBuffer.prototype.readInt32LE = function (offset, noAssert) {\n  return _readInt32(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readInt32BE = function (offset, noAssert) {\n  return _readInt32(this, offset, false, noAssert)\n}\n\nfunction _readFloat (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  return ieee754.read(buf, offset, littleEndian, 23, 4)\n}\n\nBuffer.prototype.readFloatLE = function (offset, noAssert) {\n  return _readFloat(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readFloatBE = function (offset, noAssert) {\n  return _readFloat(this, offset, false, noAssert)\n}\n\nfunction _readDouble (buf, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')\n  }\n\n  return ieee754.read(buf, offset, littleEndian, 52, 8)\n}\n\nBuffer.prototype.readDoubleLE = function (offset, noAssert) {\n  return _readDouble(this, offset, true, noAssert)\n}\n\nBuffer.prototype.readDoubleBE = function (offset, noAssert) {\n  return _readDouble(this, offset, false, noAssert)\n}\n\nBuffer.prototype.writeUInt8 = function (value, offset, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset < this.length, 'trying to write beyond buffer length')\n    verifuint(value, 0xff)\n  }\n\n  if (offset >= this.length) return\n\n  this[offset] = value\n}\n\nfunction _writeUInt16 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'trying to write beyond buffer length')\n    verifuint(value, 0xffff)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {\n    buf[offset + i] =\n        (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n            (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function (value, offset, noAssert) {\n  _writeUInt16(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeUInt16BE = function (value, offset, noAssert) {\n  _writeUInt16(this, value, offset, false, noAssert)\n}\n\nfunction _writeUInt32 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'trying to write beyond buffer length')\n    verifuint(value, 0xffffffff)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {\n    buf[offset + i] =\n        (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function (value, offset, noAssert) {\n  _writeUInt32(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeUInt32BE = function (value, offset, noAssert) {\n  _writeUInt32(this, value, offset, false, noAssert)\n}\n\nBuffer.prototype.writeInt8 = function (value, offset, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset < this.length, 'Trying to write beyond buffer length')\n    verifsint(value, 0x7f, -0x80)\n  }\n\n  if (offset >= this.length)\n    return\n\n  if (value >= 0)\n    this.writeUInt8(value, offset, noAssert)\n  else\n    this.writeUInt8(0xff + value + 1, offset, noAssert)\n}\n\nfunction _writeInt16 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 1 < buf.length, 'Trying to write beyond buffer length')\n    verifsint(value, 0x7fff, -0x8000)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  if (value >= 0)\n    _writeUInt16(buf, value, offset, littleEndian, noAssert)\n  else\n    _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)\n}\n\nBuffer.prototype.writeInt16LE = function (value, offset, noAssert) {\n  _writeInt16(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeInt16BE = function (value, offset, noAssert) {\n  _writeInt16(this, value, offset, false, noAssert)\n}\n\nfunction _writeInt32 (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')\n    verifsint(value, 0x7fffffff, -0x80000000)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  if (value >= 0)\n    _writeUInt32(buf, value, offset, littleEndian, noAssert)\n  else\n    _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)\n}\n\nBuffer.prototype.writeInt32LE = function (value, offset, noAssert) {\n  _writeInt32(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeInt32BE = function (value, offset, noAssert) {\n  _writeInt32(this, value, offset, false, noAssert)\n}\n\nfunction _writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')\n    verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n}\n\nBuffer.prototype.writeFloatLE = function (value, offset, noAssert) {\n  _writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function (value, offset, noAssert) {\n  _writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction _writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    assert(value !== undefined && value !== null, 'missing value')\n    assert(typeof littleEndian === 'boolean', 'missing or invalid endian')\n    assert(offset !== undefined && offset !== null, 'missing offset')\n    assert(offset + 7 < buf.length,\n        'Trying to write beyond buffer length')\n    verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n\n  var len = buf.length\n  if (offset >= len)\n    return\n\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n}\n\nBuffer.prototype.writeDoubleLE = function (value, offset, noAssert) {\n  _writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function (value, offset, noAssert) {\n  _writeDouble(this, value, offset, false, noAssert)\n}\n\nBuffer.prototype.fill = function (value, start, end) {\n  if (!value) value = 0\n  if (!start) start = 0\n  if (!end) end = this.length\n\n  if (typeof value === 'string') {\n    value = value.charCodeAt(0)\n  }\n\n  assert(typeof value === 'number' && !isNaN(value), 'value is not a number')\n  assert(end >= start, 'end < start')\n\n  if (end === start) return\n  if (this.length === 0) return\n\n  assert(start >= 0 && start < this.length, 'start out of bounds')\n  assert(end >= 0 && end <= this.length, 'end out of bounds')\n\n  for (var i = start; i < end; i++) {\n    this[i] = value\n  }\n}\n\nBuffer.prototype.inspect = function () {\n  var out = []\n  var len = this.length\n  for (var i = 0; i < len; i++) {\n    out[i] = toHex(this[i])\n    if (i === exports.INSPECT_MAX_BYTES) {\n      out[i + 1] = '...'\n      break\n    }\n  }\n  return '<Buffer ' + out.join(' ') + '>'\n}\n\n\nBuffer.prototype.toArrayBuffer = function () {\n  if (typeof Uint8Array !== 'undefined') {\n    if (Buffer._useTypedArrays) {\n      return (new Buffer(this)).buffer\n    } else {\n      var buf = new Uint8Array(this.length)\n      for (var i = 0, len = buf.length; i < len; i += 1)\n        buf[i] = this[i]\n      return buf.buffer\n    }\n  } else {\n    throw new Error('Buffer.toArrayBuffer not supported in this browser')\n  }\n}\n\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nvar BP = Buffer.prototype\n\n\nBuffer._augment = function (arr) {\n  arr._isBuffer = true\n\n  arr._get = arr.get\n  arr._set = arr.set\n\n  arr.get = BP.get\n  arr.set = BP.set\n\n  arr.write = BP.write\n  arr.toString = BP.toString\n  arr.toLocaleString = BP.toString\n  arr.toJSON = BP.toJSON\n  arr.copy = BP.copy\n  arr.slice = BP.slice\n  arr.readUInt8 = BP.readUInt8\n  arr.readUInt16LE = BP.readUInt16LE\n  arr.readUInt16BE = BP.readUInt16BE\n  arr.readUInt32LE = BP.readUInt32LE\n  arr.readUInt32BE = BP.readUInt32BE\n  arr.readInt8 = BP.readInt8\n  arr.readInt16LE = BP.readInt16LE\n  arr.readInt16BE = BP.readInt16BE\n  arr.readInt32LE = BP.readInt32LE\n  arr.readInt32BE = BP.readInt32BE\n  arr.readFloatLE = BP.readFloatLE\n  arr.readFloatBE = BP.readFloatBE\n  arr.readDoubleLE = BP.readDoubleLE\n  arr.readDoubleBE = BP.readDoubleBE\n  arr.writeUInt8 = BP.writeUInt8\n  arr.writeUInt16LE = BP.writeUInt16LE\n  arr.writeUInt16BE = BP.writeUInt16BE\n  arr.writeUInt32LE = BP.writeUInt32LE\n  arr.writeUInt32BE = BP.writeUInt32BE\n  arr.writeInt8 = BP.writeInt8\n  arr.writeInt16LE = BP.writeInt16LE\n  arr.writeInt16BE = BP.writeInt16BE\n  arr.writeInt32LE = BP.writeInt32LE\n  arr.writeInt32BE = BP.writeInt32BE\n  arr.writeFloatLE = BP.writeFloatLE\n  arr.writeFloatBE = BP.writeFloatBE\n  arr.writeDoubleLE = BP.writeDoubleLE\n  arr.writeDoubleBE = BP.writeDoubleBE\n  arr.fill = BP.fill\n  arr.inspect = BP.inspect\n  arr.toArrayBuffer = BP.toArrayBuffer\n\n  return arr\n}\n\nfunction clamp (index, len, defaultValue) {\n  if (typeof index !== 'number') return defaultValue\n  index = ~~index;  // Coerce to integer.\n  if (index >= len) return len\n  if (index >= 0) return index\n  index += len\n  if (index >= 0) return index\n  return 0\n}\n\nfunction coerce (length) {\n  length = ~~Math.ceil(+length)\n  return length < 0 ? 0 : length\n}\n\nfunction isArray (subject) {\n  return (Array.isArray || function (subject) {\n    return Object.prototype.toString.call(subject) === '[object Array]'\n  })(subject)\n}\n\nfunction isArrayish (subject) {\n  return isArray(subject) || Buffer.isBuffer(subject) ||\n      subject && typeof subject === 'object' &&\n      typeof subject.length === 'number'\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    var b = str.charCodeAt(i)\n    if (b <= 0x7F)\n      byteArray.push(str.charCodeAt(i))\n    else {\n      var start = i\n      if (b >= 0xD800 && b <= 0xDFFF) i++\n      var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')\n      for (var j = 0; j < h.length; j++)\n        byteArray.push(parseInt(h[j], 16))\n    }\n  }\n  return byteArray\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(str)\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  var pos\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length))\n      break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\nfunction decodeUtf8Char (str) {\n  try {\n    return decodeURIComponent(str)\n  } catch (err) {\n    return String.fromCharCode(0xFFFD) // UTF 8 invalid char\n  }\n}\n\n\nfunction verifuint (value, max) {\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\n  assert(value >= 0, 'specified a negative value for writing an unsigned value')\n  assert(value <= max, 'value is larger than maximum value for type')\n  assert(Math.floor(value) === value, 'value has a fractional component')\n}\n\nfunction verifsint (value, max, min) {\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\n  assert(value <= max, 'value larger than maximum allowed value')\n  assert(value >= min, 'value smaller than minimum allowed value')\n  assert(Math.floor(value) === value, 'value has a fractional component')\n}\n\nfunction verifIEEE754 (value, max, min) {\n  assert(typeof value === 'number', 'cannot write a non-number as a number')\n  assert(value <= max, 'value larger than maximum allowed value')\n  assert(value >= min, 'value smaller than minimum allowed value')\n}\n\nfunction assert (test, message) {\n  if (!test) throw new Error(message || 'Failed assertion')\n}\n\n},{\"base64-js\":58,\"ieee754\":59}],58:[function(require,module,exports){\nvar lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n  var Arr = (typeof Uint8Array !== 'undefined')\n    ? Uint8Array\n    : Array\n\n\tvar PLUS   = '+'.charCodeAt(0)\n\tvar SLASH  = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER  = 'a'.charCodeAt(0)\n\tvar UPPER  = 'A'.charCodeAt(0)\n\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\n\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS ||\n\t\t    code === PLUS_URL_SAFE)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH ||\n\t\t    code === SLASH_URL_SAFE)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n\n},{}],59:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n  var e, m\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var nBits = -7\n  var i = isLE ? (nBytes - 1) : 0\n  var d = isLE ? -1 : 1\n  var s = buffer[offset + i]\n\n  i += d\n\n  e = s & ((1 << (-nBits)) - 1)\n  s >>= (-nBits)\n  nBits += eLen\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  m = e & ((1 << (-nBits)) - 1)\n  e >>= (-nBits)\n  nBits += mLen\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  if (e === 0) {\n    e = 1 - eBias\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\n  } else {\n    m = m + Math.pow(2, mLen)\n    e = e - eBias\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n  var i = isLE ? 0 : (nBytes - 1)\n  var d = isLE ? 1 : -1\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n  value = Math.abs(value)\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0\n    e = eMax\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2)\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--\n      c *= 2\n    }\n    if (e + eBias >= 1) {\n      value += rt / c\n    } else {\n      value += rt * Math.pow(2, 1 - eBias)\n    }\n    if (value * c >= 2) {\n      e++\n      c /= 2\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0\n      e = eMax\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen)\n      e = e + eBias\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n      e = 0\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n  e = (e << mLen) | m\n  eLen += mLen\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n  buffer[offset + i - d] |= s * 128\n}\n\n},{}],60:[function(require,module,exports){\n\nfunction EventEmitter() {\n  this._events = this._events || {};\n  this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\nEventEmitter.defaultMaxListeners = 10;\n\nEventEmitter.prototype.setMaxListeners = function(n) {\n  if (!isNumber(n) || n < 0 || isNaN(n))\n    throw TypeError('n must be a positive number');\n  this._maxListeners = n;\n  return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n  var er, handler, len, args, i, listeners;\n\n  if (!this._events)\n    this._events = {};\n\n  if (type === 'error') {\n    if (!this._events.error ||\n        (isObject(this._events.error) && !this._events.error.length)) {\n      er = arguments[1];\n      if (er instanceof Error) {\n        throw er; // Unhandled 'error' event\n      }\n      throw TypeError('Uncaught, unspecified \"error\" event.');\n    }\n  }\n\n  handler = this._events[type];\n\n  if (isUndefined(handler))\n    return false;\n\n  if (isFunction(handler)) {\n    switch (arguments.length) {\n      case 1:\n        handler.call(this);\n        break;\n      case 2:\n        handler.call(this, arguments[1]);\n        break;\n      case 3:\n        handler.call(this, arguments[1], arguments[2]);\n        break;\n      default:\n        len = arguments.length;\n        args = new Array(len - 1);\n        for (i = 1; i < len; i++)\n          args[i - 1] = arguments[i];\n        handler.apply(this, args);\n    }\n  } else if (isObject(handler)) {\n    len = arguments.length;\n    args = new Array(len - 1);\n    for (i = 1; i < len; i++)\n      args[i - 1] = arguments[i];\n\n    listeners = handler.slice();\n    len = listeners.length;\n    for (i = 0; i < len; i++)\n      listeners[i].apply(this, args);\n  }\n\n  return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n  var m;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events)\n    this._events = {};\n\n  if (this._events.newListener)\n    this.emit('newListener', type,\n              isFunction(listener.listener) ?\n              listener.listener : listener);\n\n  if (!this._events[type])\n    this._events[type] = listener;\n  else if (isObject(this._events[type]))\n    this._events[type].push(listener);\n  else\n    this._events[type] = [this._events[type], listener];\n\n  if (isObject(this._events[type]) && !this._events[type].warned) {\n    var m;\n    if (!isUndefined(this._maxListeners)) {\n      m = this._maxListeners;\n    } else {\n      m = EventEmitter.defaultMaxListeners;\n    }\n\n    if (m && m > 0 && this._events[type].length > m) {\n      this._events[type].warned = true;\n      console.error('(node) warning: possible EventEmitter memory ' +\n                    'leak detected. %d listeners added. ' +\n                    'Use emitter.setMaxListeners() to increase limit.',\n                    this._events[type].length);\n      if (typeof console.trace === 'function') {\n        console.trace();\n      }\n    }\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  var fired = false;\n\n  function g() {\n    this.removeListener(type, g);\n\n    if (!fired) {\n      fired = true;\n      listener.apply(this, arguments);\n    }\n  }\n\n  g.listener = listener;\n  this.on(type, g);\n\n  return this;\n};\n\nEventEmitter.prototype.removeListener = function(type, listener) {\n  var list, position, length, i;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events || !this._events[type])\n    return this;\n\n  list = this._events[type];\n  length = list.length;\n  position = -1;\n\n  if (list === listener ||\n      (isFunction(list.listener) && list.listener === listener)) {\n    delete this._events[type];\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n\n  } else if (isObject(list)) {\n    for (i = length; i-- > 0;) {\n      if (list[i] === listener ||\n          (list[i].listener && list[i].listener === listener)) {\n        position = i;\n        break;\n      }\n    }\n\n    if (position < 0)\n      return this;\n\n    if (list.length === 1) {\n      list.length = 0;\n      delete this._events[type];\n    } else {\n      list.splice(position, 1);\n    }\n\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n  var key, listeners;\n\n  if (!this._events)\n    return this;\n\n  if (!this._events.removeListener) {\n    if (arguments.length === 0)\n      this._events = {};\n    else if (this._events[type])\n      delete this._events[type];\n    return this;\n  }\n\n  if (arguments.length === 0) {\n    for (key in this._events) {\n      if (key === 'removeListener') continue;\n      this.removeAllListeners(key);\n    }\n    this.removeAllListeners('removeListener');\n    this._events = {};\n    return this;\n  }\n\n  listeners = this._events[type];\n\n  if (isFunction(listeners)) {\n    this.removeListener(type, listeners);\n  } else {\n    while (listeners.length)\n      this.removeListener(type, listeners[listeners.length - 1]);\n  }\n  delete this._events[type];\n\n  return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n  var ret;\n  if (!this._events || !this._events[type])\n    ret = [];\n  else if (isFunction(this._events[type]))\n    ret = [this._events[type]];\n  else\n    ret = this._events[type].slice();\n  return ret;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n  var ret;\n  if (!emitter._events || !emitter._events[type])\n    ret = 0;\n  else if (isFunction(emitter._events[type]))\n    ret = 1;\n  else\n    ret = emitter._events[type].length;\n  return ret;\n};\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\n\n},{}],61:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    ctor.prototype = Object.create(superCtor.prototype, {\n      constructor: {\n        value: ctor,\n        enumerable: false,\n        writable: true,\n        configurable: true\n      }\n    });\n  };\n} else {\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    var TempCtor = function () {}\n    TempCtor.prototype = superCtor.prototype\n    ctor.prototype = new TempCtor()\n    ctor.prototype.constructor = ctor\n  }\n}\n\n},{}],62:[function(require,module,exports){\n\nvar process = module.exports = {};\n\nprocess.nextTick = (function () {\n    var canSetImmediate = typeof window !== 'undefined'\n    && window.setImmediate;\n    var canPost = typeof window !== 'undefined'\n    && window.postMessage && window.addEventListener\n    ;\n\n    if (canSetImmediate) {\n        return function (f) { return window.setImmediate(f) };\n    }\n\n    if (canPost) {\n        var queue = [];\n        window.addEventListener('message', function (ev) {\n            var source = ev.source;\n            if ((source === window || source === null) && ev.data === 'process-tick') {\n                ev.stopPropagation();\n                if (queue.length > 0) {\n                    var fn = queue.shift();\n                    fn();\n                }\n            }\n        }, true);\n\n        return function nextTick(fn) {\n            queue.push(fn);\n            window.postMessage('process-tick', '*');\n        };\n    }\n\n    return function nextTick(fn) {\n        setTimeout(fn, 0);\n    };\n})();\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n}\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\n\n},{}],63:[function(require,module,exports){\n(function (global){\n\n;(function(root) {\n\n\n\tvar freeExports = typeof exports == 'object' && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\n\tvar punycode,\n\n\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /\\x2E|\\u3002|\\uFF0E|\\uFF61/g, // RFC 3490 separators\n\n\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\n\tkey;\n\n\n\n\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\twhile (length--) {\n\t\t\tarray[length] = fn(array[length]);\n\t\t}\n\t\treturn array;\n\t}\n\n\n\tfunction mapDomain(string, fn) {\n\t\treturn map(string.split(regexSeparators), fn).join('.');\n\t}\n\n\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t    counter = 0,\n\t\t    length = string.length,\n\t\t    value,\n\t\t    extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\n\tfunction digitToBasic(digit, flag) {\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\n\tfunction decode(input) {\n\t\tvar output = [],\n\t\t    inputLength = input.length,\n\t\t    out,\n\t\t    i = 0,\n\t\t    n = initialN,\n\t\t    bias = initialBias,\n\t\t    basic,\n\t\t    j,\n\t\t    index,\n\t\t    oldi,\n\t\t    w,\n\t\t    k,\n\t\t    digit,\n\t\t    t,\n\n\t\t    baseMinusT;\n\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\n\tfunction encode(input) {\n\t\tvar n,\n\t\t    delta,\n\t\t    handledCPCount,\n\t\t    basicLength,\n\t\t    bias,\n\t\t    j,\n\t\t    m,\n\t\t    q,\n\t\t    k,\n\t\t    t,\n\t\t    currentValue,\n\t\t    output = [],\n\n\t\t    inputLength,\n\n\t\t    handledCPCountPlusOne,\n\t\t    baseMinusT,\n\t\t    qMinusT;\n\n\t\tinput = ucs2decode(input);\n\n\t\tinputLength = input.length;\n\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\n\tfunction toUnicode(domain) {\n\t\treturn mapDomain(domain, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\n\tfunction toASCII(domain) {\n\t\treturn mapDomain(domain, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\n\n\n\tpunycode = {\n\n\t\t'version': '1.2.4',\n\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],64:[function(require,module,exports){\n\n'use strict';\n\nfunction hasOwnProperty(obj, prop) {\n  return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n  sep = sep || '&';\n  eq = eq || '=';\n  var obj = {};\n\n  if (typeof qs !== 'string' || qs.length === 0) {\n    return obj;\n  }\n\n  var regexp = /\\+/g;\n  qs = qs.split(sep);\n\n  var maxKeys = 1000;\n  if (options && typeof options.maxKeys === 'number') {\n    maxKeys = options.maxKeys;\n  }\n\n  var len = qs.length;\n  if (maxKeys > 0 && len > maxKeys) {\n    len = maxKeys;\n  }\n\n  for (var i = 0; i < len; ++i) {\n    var x = qs[i].replace(regexp, '%20'),\n        idx = x.indexOf(eq),\n        kstr, vstr, k, v;\n\n    if (idx >= 0) {\n      kstr = x.substr(0, idx);\n      vstr = x.substr(idx + 1);\n    } else {\n      kstr = x;\n      vstr = '';\n    }\n\n    k = decodeURIComponent(kstr);\n    v = decodeURIComponent(vstr);\n\n    if (!hasOwnProperty(obj, k)) {\n      obj[k] = v;\n    } else if (isArray(obj[k])) {\n      obj[k].push(v);\n    } else {\n      obj[k] = [obj[k], v];\n    }\n  }\n\n  return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n  return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\n},{}],65:[function(require,module,exports){\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n  switch (typeof v) {\n    case 'string':\n      return v;\n\n    case 'boolean':\n      return v ? 'true' : 'false';\n\n    case 'number':\n      return isFinite(v) ? v : '';\n\n    default:\n      return '';\n  }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n  sep = sep || '&';\n  eq = eq || '=';\n  if (obj === null) {\n    obj = undefined;\n  }\n\n  if (typeof obj === 'object') {\n    return map(objectKeys(obj), function(k) {\n      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n      if (isArray(obj[k])) {\n        return obj[k].map(function(v) {\n          return ks + encodeURIComponent(stringifyPrimitive(v));\n        }).join(sep);\n      } else {\n        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n      }\n    }).join(sep);\n\n  }\n\n  if (!name) return '';\n  return encodeURIComponent(stringifyPrimitive(name)) + eq +\n         encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n  return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n  if (xs.map) return xs.map(f);\n  var res = [];\n  for (var i = 0; i < xs.length; i++) {\n    res.push(f(xs[i], i));\n  }\n  return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n  var res = [];\n  for (var key in obj) {\n    if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n  }\n  return res;\n};\n\n},{}],66:[function(require,module,exports){\n'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n\n},{\"./decode\":64,\"./encode\":65}],67:[function(require,module,exports){\nmodule.exports = function isBuffer(arg) {\n  return arg && typeof arg === 'object'\n    && typeof arg.copy === 'function'\n    && typeof arg.fill === 'function'\n    && typeof arg.readUInt8 === 'function';\n}\n},{}],68:[function(require,module,exports){\n(function (process,global){\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n  if (!isString(f)) {\n    var objects = [];\n    for (var i = 0; i < arguments.length; i++) {\n      objects.push(inspect(arguments[i]));\n    }\n    return objects.join(' ');\n  }\n\n  var i = 1;\n  var args = arguments;\n  var len = args.length;\n  var str = String(f).replace(formatRegExp, function(x) {\n    if (x === '%') return '%';\n    if (i >= len) return x;\n    switch (x) {\n      case '%s': return String(args[i++]);\n      case '%d': return Number(args[i++]);\n      case '%j':\n        try {\n          return JSON.stringify(args[i++]);\n        } catch (_) {\n          return '[Circular]';\n        }\n      default:\n        return x;\n    }\n  });\n  for (var x = args[i]; i < len; x = args[++i]) {\n    if (isNull(x) || !isObject(x)) {\n      str += ' ' + x;\n    } else {\n      str += ' ' + inspect(x);\n    }\n  }\n  return str;\n};\n\n\nexports.deprecate = function(fn, msg) {\n  if (isUndefined(global.process)) {\n    return function() {\n      return exports.deprecate(fn, msg).apply(this, arguments);\n    };\n  }\n\n  if (process.noDeprecation === true) {\n    return fn;\n  }\n\n  var warned = false;\n  function deprecated() {\n    if (!warned) {\n      if (process.throwDeprecation) {\n        throw new Error(msg);\n      } else if (process.traceDeprecation) {\n        console.trace(msg);\n      } else {\n        console.error(msg);\n      }\n      warned = true;\n    }\n    return fn.apply(this, arguments);\n  }\n\n  return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n  if (isUndefined(debugEnviron))\n    debugEnviron = process.env.NODE_DEBUG || '';\n  set = set.toUpperCase();\n  if (!debugs[set]) {\n    if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n      var pid = process.pid;\n      debugs[set] = function() {\n        var msg = exports.format.apply(exports, arguments);\n        console.error('%s %d: %s', set, pid, msg);\n      };\n    } else {\n      debugs[set] = function() {};\n    }\n  }\n  return debugs[set];\n};\n\n\n\n\nfunction inspect(obj, opts) {\n  var ctx = {\n    seen: [],\n    stylize: stylizeNoColor\n  };\n  if (arguments.length >= 3) ctx.depth = arguments[2];\n  if (arguments.length >= 4) ctx.colors = arguments[3];\n  if (isBoolean(opts)) {\n    ctx.showHidden = opts;\n  } else if (opts) {\n    exports._extend(ctx, opts);\n  }\n  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n  if (isUndefined(ctx.depth)) ctx.depth = 2;\n  if (isUndefined(ctx.colors)) ctx.colors = false;\n  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n  if (ctx.colors) ctx.stylize = stylizeWithColor;\n  return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\ninspect.colors = {\n  'bold' : [1, 22],\n  'italic' : [3, 23],\n  'underline' : [4, 24],\n  'inverse' : [7, 27],\n  'white' : [37, 39],\n  'grey' : [90, 39],\n  'black' : [30, 39],\n  'blue' : [34, 39],\n  'cyan' : [36, 39],\n  'green' : [32, 39],\n  'magenta' : [35, 39],\n  'red' : [31, 39],\n  'yellow' : [33, 39]\n};\n\ninspect.styles = {\n  'special': 'cyan',\n  'number': 'yellow',\n  'boolean': 'yellow',\n  'undefined': 'grey',\n  'null': 'bold',\n  'string': 'green',\n  'date': 'magenta',\n  'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n  var style = inspect.styles[styleType];\n\n  if (style) {\n    return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n           '\\u001b[' + inspect.colors[style][1] + 'm';\n  } else {\n    return str;\n  }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n  return str;\n}\n\n\nfunction arrayToHash(array) {\n  var hash = {};\n\n  array.forEach(function(val, idx) {\n    hash[val] = true;\n  });\n\n  return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n  if (ctx.customInspect &&\n      value &&\n      isFunction(value.inspect) &&\n      value.inspect !== exports.inspect &&\n      !(value.constructor && value.constructor.prototype === value)) {\n    var ret = value.inspect(recurseTimes, ctx);\n    if (!isString(ret)) {\n      ret = formatValue(ctx, ret, recurseTimes);\n    }\n    return ret;\n  }\n\n  var primitive = formatPrimitive(ctx, value);\n  if (primitive) {\n    return primitive;\n  }\n\n  var keys = Object.keys(value);\n  var visibleKeys = arrayToHash(keys);\n\n  if (ctx.showHidden) {\n    keys = Object.getOwnPropertyNames(value);\n  }\n\n  if (isError(value)\n      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n    return formatError(value);\n  }\n\n  if (keys.length === 0) {\n    if (isFunction(value)) {\n      var name = value.name ? ': ' + value.name : '';\n      return ctx.stylize('[Function' + name + ']', 'special');\n    }\n    if (isRegExp(value)) {\n      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n    }\n    if (isDate(value)) {\n      return ctx.stylize(Date.prototype.toString.call(value), 'date');\n    }\n    if (isError(value)) {\n      return formatError(value);\n    }\n  }\n\n  var base = '', array = false, braces = ['{', '}'];\n\n  if (isArray(value)) {\n    array = true;\n    braces = ['[', ']'];\n  }\n\n  if (isFunction(value)) {\n    var n = value.name ? ': ' + value.name : '';\n    base = ' [Function' + n + ']';\n  }\n\n  if (isRegExp(value)) {\n    base = ' ' + RegExp.prototype.toString.call(value);\n  }\n\n  if (isDate(value)) {\n    base = ' ' + Date.prototype.toUTCString.call(value);\n  }\n\n  if (isError(value)) {\n    base = ' ' + formatError(value);\n  }\n\n  if (keys.length === 0 && (!array || value.length == 0)) {\n    return braces[0] + base + braces[1];\n  }\n\n  if (recurseTimes < 0) {\n    if (isRegExp(value)) {\n      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n    } else {\n      return ctx.stylize('[Object]', 'special');\n    }\n  }\n\n  ctx.seen.push(value);\n\n  var output;\n  if (array) {\n    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n  } else {\n    output = keys.map(function(key) {\n      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n    });\n  }\n\n  ctx.seen.pop();\n\n  return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n  if (isUndefined(value))\n    return ctx.stylize('undefined', 'undefined');\n  if (isString(value)) {\n    var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n                                             .replace(/'/g, \"\\\\'\")\n                                             .replace(/\\\\\"/g, '\"') + '\\'';\n    return ctx.stylize(simple, 'string');\n  }\n  if (isNumber(value))\n    return ctx.stylize('' + value, 'number');\n  if (isBoolean(value))\n    return ctx.stylize('' + value, 'boolean');\n  if (isNull(value))\n    return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n  return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n  var output = [];\n  for (var i = 0, l = value.length; i < l; ++i) {\n    if (hasOwnProperty(value, String(i))) {\n      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n          String(i), true));\n    } else {\n      output.push('');\n    }\n  }\n  keys.forEach(function(key) {\n    if (!key.match(/^\\d+$/)) {\n      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n          key, true));\n    }\n  });\n  return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n  var name, str, desc;\n  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n  if (desc.get) {\n    if (desc.set) {\n      str = ctx.stylize('[Getter/Setter]', 'special');\n    } else {\n      str = ctx.stylize('[Getter]', 'special');\n    }\n  } else {\n    if (desc.set) {\n      str = ctx.stylize('[Setter]', 'special');\n    }\n  }\n  if (!hasOwnProperty(visibleKeys, key)) {\n    name = '[' + key + ']';\n  }\n  if (!str) {\n    if (ctx.seen.indexOf(desc.value) < 0) {\n      if (isNull(recurseTimes)) {\n        str = formatValue(ctx, desc.value, null);\n      } else {\n        str = formatValue(ctx, desc.value, recurseTimes - 1);\n      }\n      if (str.indexOf('\\n') > -1) {\n        if (array) {\n          str = str.split('\\n').map(function(line) {\n            return '  ' + line;\n          }).join('\\n').substr(2);\n        } else {\n          str = '\\n' + str.split('\\n').map(function(line) {\n            return '   ' + line;\n          }).join('\\n');\n        }\n      }\n    } else {\n      str = ctx.stylize('[Circular]', 'special');\n    }\n  }\n  if (isUndefined(name)) {\n    if (array && key.match(/^\\d+$/)) {\n      return str;\n    }\n    name = JSON.stringify('' + key);\n    if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n      name = name.substr(1, name.length - 2);\n      name = ctx.stylize(name, 'name');\n    } else {\n      name = name.replace(/'/g, \"\\\\'\")\n                 .replace(/\\\\\"/g, '\"')\n                 .replace(/(^\"|\"$)/g, \"'\");\n      name = ctx.stylize(name, 'string');\n    }\n  }\n\n  return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n  var numLinesEst = 0;\n  var length = output.reduce(function(prev, cur) {\n    numLinesEst++;\n    if (cur.indexOf('\\n') >= 0) numLinesEst++;\n    return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n  }, 0);\n\n  if (length > 60) {\n    return braces[0] +\n           (base === '' ? '' : base + '\\n ') +\n           ' ' +\n           output.join(',\\n  ') +\n           ' ' +\n           braces[1];\n  }\n\n  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\nfunction isArray(ar) {\n  return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n  return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n  return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n  return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n  return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n  return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n  return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n  return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n  return isObject(e) &&\n      (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n  return arg === null ||\n         typeof arg === 'boolean' ||\n         typeof arg === 'number' ||\n         typeof arg === 'string' ||\n         typeof arg === 'symbol' ||  // ES6 symbol\n         typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n  return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n  return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n              'Oct', 'Nov', 'Dec'];\n\nfunction timestamp() {\n  var d = new Date();\n  var time = [pad(d.getHours()),\n              pad(d.getMinutes()),\n              pad(d.getSeconds())].join(':');\n  return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\nexports.log = function() {\n  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n  if (!add || !isObject(add)) return origin;\n\n  var keys = Object.keys(add);\n  var i = keys.length;\n  while (i--) {\n    origin[keys[i]] = add[keys[i]];\n  }\n  return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n  return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n}).call(this,require(\"FWaASH\"),typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./support/isBuffer\":67,\"FWaASH\":62,\"inherits\":61}],69:[function(require,module,exports){\n(function (global){\n\n\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n  ? global.TYPED_ARRAY_SUPPORT\n  : typedArraySupport()\n\n\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n  try {\n    var arr = new Uint8Array(1)\n    arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n    return arr.foo() === 42 && // typed array instances can be augmented\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n}\n\nfunction kMaxLength () {\n  return Buffer.TYPED_ARRAY_SUPPORT\n    ? 0x7fffffff\n    : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n  if (kMaxLength() < length) {\n    throw new RangeError('Invalid typed array length')\n  }\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    that = new Uint8Array(length)\n    that.__proto__ = Buffer.prototype\n  } else {\n    if (that === null) {\n      that = new Buffer(length)\n    }\n    that.length = length\n  }\n\n  return that\n}\n\n\n\nfunction Buffer (arg, encodingOrOffset, length) {\n  if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n    return new Buffer(arg, encodingOrOffset, length)\n  }\n\n  if (typeof arg === 'number') {\n    if (typeof encodingOrOffset === 'string') {\n      throw new Error(\n        'If encoding is specified then the first argument must be a string'\n      )\n    }\n    return allocUnsafe(this, arg)\n  }\n  return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nBuffer._augment = function (arr) {\n  arr.__proto__ = Buffer.prototype\n  return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n  if (typeof value === 'number') {\n    throw new TypeError('\"value\" argument must not be a number')\n  }\n\n  if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n    return fromArrayBuffer(that, value, encodingOrOffset, length)\n  }\n\n  if (typeof value === 'string') {\n    return fromString(that, value, encodingOrOffset)\n  }\n\n  return fromObject(that, value)\n}\n\n\nBuffer.from = function (value, encodingOrOffset, length) {\n  return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n  Buffer.prototype.__proto__ = Uint8Array.prototype\n  Buffer.__proto__ = Uint8Array\n  if (typeof Symbol !== 'undefined' && Symbol.species &&\n      Buffer[Symbol.species] === Buffer) {\n    Object.defineProperty(Buffer, Symbol.species, {\n      value: null,\n      configurable: true\n    })\n  }\n}\n\nfunction assertSize (size) {\n  if (typeof size !== 'number') {\n    throw new TypeError('\"size\" argument must be a number')\n  } else if (size < 0) {\n    throw new RangeError('\"size\" argument must not be negative')\n  }\n}\n\nfunction alloc (that, size, fill, encoding) {\n  assertSize(size)\n  if (size <= 0) {\n    return createBuffer(that, size)\n  }\n  if (fill !== undefined) {\n    return typeof encoding === 'string'\n      ? createBuffer(that, size).fill(fill, encoding)\n      : createBuffer(that, size).fill(fill)\n  }\n  return createBuffer(that, size)\n}\n\n\nBuffer.alloc = function (size, fill, encoding) {\n  return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n  assertSize(size)\n  that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < size; ++i) {\n      that[i] = 0\n    }\n  }\n  return that\n}\n\n\nBuffer.allocUnsafe = function (size) {\n  return allocUnsafe(null, size)\n}\n\nBuffer.allocUnsafeSlow = function (size) {\n  return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n  if (typeof encoding !== 'string' || encoding === '') {\n    encoding = 'utf8'\n  }\n\n  if (!Buffer.isEncoding(encoding)) {\n    throw new TypeError('\"encoding\" must be a valid string encoding')\n  }\n\n  var length = byteLength(string, encoding) | 0\n  that = createBuffer(that, length)\n\n  var actual = that.write(string, encoding)\n\n  if (actual !== length) {\n    that = that.slice(0, actual)\n  }\n\n  return that\n}\n\nfunction fromArrayLike (that, array) {\n  var length = array.length < 0 ? 0 : checked(array.length) | 0\n  that = createBuffer(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n  array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n  if (byteOffset < 0 || array.byteLength < byteOffset) {\n    throw new RangeError('\\'offset\\' is out of bounds')\n  }\n\n  if (array.byteLength < byteOffset + (length || 0)) {\n    throw new RangeError('\\'length\\' is out of bounds')\n  }\n\n  if (byteOffset === undefined && length === undefined) {\n    array = new Uint8Array(array)\n  } else if (length === undefined) {\n    array = new Uint8Array(array, byteOffset)\n  } else {\n    array = new Uint8Array(array, byteOffset, length)\n  }\n\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    that = array\n    that.__proto__ = Buffer.prototype\n  } else {\n    that = fromArrayLike(that, array)\n  }\n  return that\n}\n\nfunction fromObject (that, obj) {\n  if (Buffer.isBuffer(obj)) {\n    var len = checked(obj.length) | 0\n    that = createBuffer(that, len)\n\n    if (that.length === 0) {\n      return that\n    }\n\n    obj.copy(that, 0, 0, len)\n    return that\n  }\n\n  if (obj) {\n    if ((typeof ArrayBuffer !== 'undefined' &&\n        obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n      if (typeof obj.length !== 'number' || isnan(obj.length)) {\n        return createBuffer(that, 0)\n      }\n      return fromArrayLike(that, obj)\n    }\n\n    if (obj.type === 'Buffer' && isArray(obj.data)) {\n      return fromArrayLike(that, obj.data)\n    }\n  }\n\n  throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n  if (length >= kMaxLength()) {\n    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n                         'size: 0x' + kMaxLength().toString(16) + ' bytes')\n  }\n  return length | 0\n}\n\nfunction SlowBuffer (length) {\n  if (+length != length) { // eslint-disable-line eqeqeq\n    length = 0\n  }\n  return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n    throw new TypeError('Arguments must be Buffers')\n  }\n\n  if (a === b) return 0\n\n  var x = a.length\n  var y = b.length\n\n  for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n    if (a[i] !== b[i]) {\n      x = a[i]\n      y = b[i]\n      break\n    }\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'latin1':\n    case 'binary':\n    case 'base64':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.concat = function concat (list, length) {\n  if (!isArray(list)) {\n    throw new TypeError('\"list\" argument must be an Array of Buffers')\n  }\n\n  if (list.length === 0) {\n    return Buffer.alloc(0)\n  }\n\n  var i\n  if (length === undefined) {\n    length = 0\n    for (i = 0; i < list.length; ++i) {\n      length += list[i].length\n    }\n  }\n\n  var buffer = Buffer.allocUnsafe(length)\n  var pos = 0\n  for (i = 0; i < list.length; ++i) {\n    var buf = list[i]\n    if (!Buffer.isBuffer(buf)) {\n      throw new TypeError('\"list\" argument must be an Array of Buffers')\n    }\n    buf.copy(buffer, pos)\n    pos += buf.length\n  }\n  return buffer\n}\n\nfunction byteLength (string, encoding) {\n  if (Buffer.isBuffer(string)) {\n    return string.length\n  }\n  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n      (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n    return string.byteLength\n  }\n  if (typeof string !== 'string') {\n    string = '' + string\n  }\n\n  var len = string.length\n  if (len === 0) return 0\n\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'ascii':\n      case 'latin1':\n      case 'binary':\n        return len\n      case 'utf8':\n      case 'utf-8':\n      case undefined:\n        return utf8ToBytes(string).length\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return len * 2\n      case 'hex':\n        return len >>> 1\n      case 'base64':\n        return base64ToBytes(string).length\n      default:\n        if (loweredCase) return utf8ToBytes(string).length // assume utf8\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n  var loweredCase = false\n\n\n  if (start === undefined || start < 0) {\n    start = 0\n  }\n  if (start > this.length) {\n    return ''\n  }\n\n  if (end === undefined || end > this.length) {\n    end = this.length\n  }\n\n  if (end <= 0) {\n    return ''\n  }\n\n  end >>>= 0\n  start >>>= 0\n\n  if (end <= start) {\n    return ''\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  while (true) {\n    switch (encoding) {\n      case 'hex':\n        return hexSlice(this, start, end)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Slice(this, start, end)\n\n      case 'ascii':\n        return asciiSlice(this, start, end)\n\n      case 'latin1':\n      case 'binary':\n        return latin1Slice(this, start, end)\n\n      case 'base64':\n        return base64Slice(this, start, end)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return utf16leSlice(this, start, end)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = (encoding + '').toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n  var i = b[n]\n  b[n] = b[m]\n  b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n  var len = this.length\n  if (len % 2 !== 0) {\n    throw new RangeError('Buffer size must be a multiple of 16-bits')\n  }\n  for (var i = 0; i < len; i += 2) {\n    swap(this, i, i + 1)\n  }\n  return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n  var len = this.length\n  if (len % 4 !== 0) {\n    throw new RangeError('Buffer size must be a multiple of 32-bits')\n  }\n  for (var i = 0; i < len; i += 4) {\n    swap(this, i, i + 3)\n    swap(this, i + 1, i + 2)\n  }\n  return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n  var len = this.length\n  if (len % 8 !== 0) {\n    throw new RangeError('Buffer size must be a multiple of 64-bits')\n  }\n  for (var i = 0; i < len; i += 8) {\n    swap(this, i, i + 7)\n    swap(this, i + 1, i + 6)\n    swap(this, i + 2, i + 5)\n    swap(this, i + 3, i + 4)\n  }\n  return this\n}\n\nBuffer.prototype.toString = function toString () {\n  var length = this.length | 0\n  if (length === 0) return ''\n  if (arguments.length === 0) return utf8Slice(this, 0, length)\n  return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return true\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n  var str = ''\n  var max = exports.INSPECT_MAX_BYTES\n  if (this.length > 0) {\n    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n    if (this.length > max) str += ' ... '\n  }\n  return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n  if (!Buffer.isBuffer(target)) {\n    throw new TypeError('Argument must be a Buffer')\n  }\n\n  if (start === undefined) {\n    start = 0\n  }\n  if (end === undefined) {\n    end = target ? target.length : 0\n  }\n  if (thisStart === undefined) {\n    thisStart = 0\n  }\n  if (thisEnd === undefined) {\n    thisEnd = this.length\n  }\n\n  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n    throw new RangeError('out of range index')\n  }\n\n  if (thisStart >= thisEnd && start >= end) {\n    return 0\n  }\n  if (thisStart >= thisEnd) {\n    return -1\n  }\n  if (start >= end) {\n    return 1\n  }\n\n  start >>>= 0\n  end >>>= 0\n  thisStart >>>= 0\n  thisEnd >>>= 0\n\n  if (this === target) return 0\n\n  var x = thisEnd - thisStart\n  var y = end - start\n  var len = Math.min(x, y)\n\n  var thisCopy = this.slice(thisStart, thisEnd)\n  var targetCopy = target.slice(start, end)\n\n  for (var i = 0; i < len; ++i) {\n    if (thisCopy[i] !== targetCopy[i]) {\n      x = thisCopy[i]\n      y = targetCopy[i]\n      break\n    }\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n  if (buffer.length === 0) return -1\n\n  if (typeof byteOffset === 'string') {\n    encoding = byteOffset\n    byteOffset = 0\n  } else if (byteOffset > 0x7fffffff) {\n    byteOffset = 0x7fffffff\n  } else if (byteOffset < -0x80000000) {\n    byteOffset = -0x80000000\n  }\n  byteOffset = +byteOffset  // Coerce to Number.\n  if (isNaN(byteOffset)) {\n    byteOffset = dir ? 0 : (buffer.length - 1)\n  }\n\n  if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n  if (byteOffset >= buffer.length) {\n    if (dir) return -1\n    else byteOffset = buffer.length - 1\n  } else if (byteOffset < 0) {\n    if (dir) byteOffset = 0\n    else return -1\n  }\n\n  if (typeof val === 'string') {\n    val = Buffer.from(val, encoding)\n  }\n\n  if (Buffer.isBuffer(val)) {\n    if (val.length === 0) {\n      return -1\n    }\n    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n  } else if (typeof val === 'number') {\n    val = val & 0xFF // Search for a byte value [0-255]\n    if (Buffer.TYPED_ARRAY_SUPPORT &&\n        typeof Uint8Array.prototype.indexOf === 'function') {\n      if (dir) {\n        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n      } else {\n        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n      }\n    }\n    return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n  }\n\n  throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n  var indexSize = 1\n  var arrLength = arr.length\n  var valLength = val.length\n\n  if (encoding !== undefined) {\n    encoding = String(encoding).toLowerCase()\n    if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n        encoding === 'utf16le' || encoding === 'utf-16le') {\n      if (arr.length < 2 || val.length < 2) {\n        return -1\n      }\n      indexSize = 2\n      arrLength /= 2\n      valLength /= 2\n      byteOffset /= 2\n    }\n  }\n\n  function read (buf, i) {\n    if (indexSize === 1) {\n      return buf[i]\n    } else {\n      return buf.readUInt16BE(i * indexSize)\n    }\n  }\n\n  var i\n  if (dir) {\n    var foundIndex = -1\n    for (i = byteOffset; i < arrLength; i++) {\n      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n        if (foundIndex === -1) foundIndex = i\n        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n      } else {\n        if (foundIndex !== -1) i -= i - foundIndex\n        foundIndex = -1\n      }\n    }\n  } else {\n    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n    for (i = byteOffset; i >= 0; i--) {\n      var found = true\n      for (var j = 0; j < valLength; j++) {\n        if (read(arr, i + j) !== read(val, j)) {\n          found = false\n          break\n        }\n      }\n      if (found) return i\n    }\n  }\n\n  return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n  return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n  return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n  return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  var strLen = string.length\n  if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; ++i) {\n    var parsed = parseInt(string.substr(i * 2, 2), 16)\n    if (isNaN(parsed)) return i\n    buf[offset + i] = parsed\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n  if (offset === undefined) {\n    encoding = 'utf8'\n    length = this.length\n    offset = 0\n  } else if (length === undefined && typeof offset === 'string') {\n    encoding = offset\n    length = this.length\n    offset = 0\n  } else if (isFinite(offset)) {\n    offset = offset | 0\n    if (isFinite(length)) {\n      length = length | 0\n      if (encoding === undefined) encoding = 'utf8'\n    } else {\n      encoding = length\n      length = undefined\n    }\n  } else {\n    throw new Error(\n      'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n    )\n  }\n\n  var remaining = this.length - offset\n  if (length === undefined || length > remaining) length = remaining\n\n  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n    throw new RangeError('Attempt to write outside buffer bounds')\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'hex':\n        return hexWrite(this, string, offset, length)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Write(this, string, offset, length)\n\n      case 'ascii':\n        return asciiWrite(this, string, offset, length)\n\n      case 'latin1':\n      case 'binary':\n        return latin1Write(this, string, offset, length)\n\n      case 'base64':\n        return base64Write(this, string, offset, length)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return ucs2Write(this, string, offset, length)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  end = Math.min(buf.length, end)\n  var res = []\n\n  var i = start\n  while (i < end) {\n    var firstByte = buf[i]\n    var codePoint = null\n    var bytesPerSequence = (firstByte > 0xEF) ? 4\n      : (firstByte > 0xDF) ? 3\n      : (firstByte > 0xBF) ? 2\n      : 1\n\n    if (i + bytesPerSequence <= end) {\n      var secondByte, thirdByte, fourthByte, tempCodePoint\n\n      switch (bytesPerSequence) {\n        case 1:\n          if (firstByte < 0x80) {\n            codePoint = firstByte\n          }\n          break\n        case 2:\n          secondByte = buf[i + 1]\n          if ((secondByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n            if (tempCodePoint > 0x7F) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 3:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 4:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          fourthByte = buf[i + 3]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n              codePoint = tempCodePoint\n            }\n          }\n      }\n    }\n\n    if (codePoint === null) {\n      codePoint = 0xFFFD\n      bytesPerSequence = 1\n    } else if (codePoint > 0xFFFF) {\n      codePoint -= 0x10000\n      res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n      codePoint = 0xDC00 | codePoint & 0x3FF\n    }\n\n    res.push(codePoint)\n    i += bytesPerSequence\n  }\n\n  return decodeCodePointsArray(res)\n}\n\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n  var len = codePoints.length\n  if (len <= MAX_ARGUMENTS_LENGTH) {\n    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n  }\n\n  var res = ''\n  var i = 0\n  while (i < len) {\n    res += String.fromCharCode.apply(\n      String,\n      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n    )\n  }\n  return res\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; ++i) {\n    ret += String.fromCharCode(buf[i] & 0x7F)\n  }\n  return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; ++i) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; ++i) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len\n    if (start < 0) start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0) end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start) end = start\n\n  var newBuf\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    newBuf = this.subarray(start, end)\n    newBuf.__proto__ = Buffer.prototype\n  } else {\n    var sliceLen = end - start\n    newBuf = new Buffer(sliceLen, undefined)\n    for (var i = 0; i < sliceLen; ++i) {\n      newBuf[i] = this[i + start]\n    }\n  }\n\n  return newBuf\n}\n\n\nfunction checkOffset (offset, ext, length) {\n  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    checkOffset(offset, byteLength, this.length)\n  }\n\n  var val = this[offset + --byteLength]\n  var mul = 1\n  while (byteLength > 0 && (mul *= 0x100)) {\n    val += this[offset + --byteLength] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return ((this[offset]) |\n      (this[offset + 1] << 8) |\n      (this[offset + 2] << 16)) +\n      (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] * 0x1000000) +\n    ((this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var i = byteLength\n  var mul = 1\n  var val = this[offset + --i]\n  while (i > 0 && (mul *= 0x100)) {\n    val += this[offset + --i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  if (!(this[offset] & 0x80)) return (this[offset])\n  return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset] | (this[offset + 1] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset + 1] | (this[offset] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset]) |\n    (this[offset + 1] << 8) |\n    (this[offset + 2] << 16) |\n    (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] << 24) |\n    (this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n  if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n  if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    var maxBytes = Math.pow(2, 8 * byteLength) - 1\n    checkInt(this, value, offset, byteLength, maxBytes, 0)\n  }\n\n  var mul = 1\n  var i = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    var maxBytes = Math.pow(2, 8 * byteLength) - 1\n    checkInt(this, value, offset, byteLength, maxBytes, 0)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n      (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffffffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset + 3] = (value >>> 24)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 1] = (value >>> 8)\n    this[offset] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = 0\n  var mul = 1\n  var sub = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n      sub = 1\n    }\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  var sub = 0\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n      sub = 1\n    }\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  if (value < 0) value = 0xff + value + 1\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 3] = (value >>> 24)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (value < 0) value = 0xffffffff + value + 1\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n  if (offset + ext > buf.length) throw new RangeError('Index out of range')\n  if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (targetStart >= target.length) targetStart = target.length\n  if (!targetStart) targetStart = 0\n  if (end > 0 && end < start) end = start\n\n  if (end === start) return 0\n  if (target.length === 0 || this.length === 0) return 0\n\n  if (targetStart < 0) {\n    throw new RangeError('targetStart out of bounds')\n  }\n  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n  if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n  if (end > this.length) end = this.length\n  if (target.length - targetStart < end - start) {\n    end = target.length - targetStart + start\n  }\n\n  var len = end - start\n  var i\n\n  if (this === target && start < targetStart && targetStart < end) {\n    for (i = len - 1; i >= 0; --i) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n    for (i = 0; i < len; ++i) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else {\n    Uint8Array.prototype.set.call(\n      target,\n      this.subarray(start, start + len),\n      targetStart\n    )\n  }\n\n  return len\n}\n\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n  if (typeof val === 'string') {\n    if (typeof start === 'string') {\n      encoding = start\n      start = 0\n      end = this.length\n    } else if (typeof end === 'string') {\n      encoding = end\n      end = this.length\n    }\n    if (val.length === 1) {\n      var code = val.charCodeAt(0)\n      if (code < 256) {\n        val = code\n      }\n    }\n    if (encoding !== undefined && typeof encoding !== 'string') {\n      throw new TypeError('encoding must be a string')\n    }\n    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n      throw new TypeError('Unknown encoding: ' + encoding)\n    }\n  } else if (typeof val === 'number') {\n    val = val & 255\n  }\n\n  if (start < 0 || this.length < start || this.length < end) {\n    throw new RangeError('Out of range index')\n  }\n\n  if (end <= start) {\n    return this\n  }\n\n  start = start >>> 0\n  end = end === undefined ? this.length : end >>> 0\n\n  if (!val) val = 0\n\n  var i\n  if (typeof val === 'number') {\n    for (i = start; i < end; ++i) {\n      this[i] = val\n    }\n  } else {\n    var bytes = Buffer.isBuffer(val)\n      ? val\n      : utf8ToBytes(new Buffer(val, encoding).toString())\n    var len = bytes.length\n    for (i = 0; i < end - start; ++i) {\n      this[i + start] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  if (str.length < 2) return ''\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n  units = units || Infinity\n  var codePoint\n  var length = string.length\n  var leadSurrogate = null\n  var bytes = []\n\n  for (var i = 0; i < length; ++i) {\n    codePoint = string.charCodeAt(i)\n\n    if (codePoint > 0xD7FF && codePoint < 0xE000) {\n      if (!leadSurrogate) {\n        if (codePoint > 0xDBFF) {\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else if (i + 1 === length) {\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        }\n\n        leadSurrogate = codePoint\n\n        continue\n      }\n\n      if (codePoint < 0xDC00) {\n        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n        leadSurrogate = codePoint\n        continue\n      }\n\n      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n    } else if (leadSurrogate) {\n      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n    }\n\n    leadSurrogate = null\n\n    if (codePoint < 0x80) {\n      if ((units -= 1) < 0) break\n      bytes.push(codePoint)\n    } else if (codePoint < 0x800) {\n      if ((units -= 2) < 0) break\n      bytes.push(\n        codePoint >> 0x6 | 0xC0,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x10000) {\n      if ((units -= 3) < 0) break\n      bytes.push(\n        codePoint >> 0xC | 0xE0,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x110000) {\n      if ((units -= 4) < 0) break\n      bytes.push(\n        codePoint >> 0x12 | 0xF0,\n        codePoint >> 0xC & 0x3F | 0x80,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else {\n      throw new Error('Invalid code point')\n    }\n  }\n\n  return bytes\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; ++i) {\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; ++i) {\n    if ((units -= 2) < 0) break\n\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; ++i) {\n    if ((i + offset >= dst.length) || (i >= src.length)) break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\nfunction isnan (val) {\n  return val !== val // eslint-disable-line no-self-compare\n}\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"base64-js\":70,\"ieee754\":71,\"isarray\":72}],70:[function(require,module,exports){\n'use strict'\n\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nfunction init () {\n  var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n  for (var i = 0, len = code.length; i < len; ++i) {\n    lookup[i] = code[i]\n    revLookup[code.charCodeAt(i)] = i\n  }\n\n  revLookup['-'.charCodeAt(0)] = 62\n  revLookup['_'.charCodeAt(0)] = 63\n}\n\ninit()\n\nfunction toByteArray (b64) {\n  var i, j, l, tmp, placeHolders, arr\n  var len = b64.length\n\n  if (len % 4 > 0) {\n    throw new Error('Invalid string. Length must be a multiple of 4')\n  }\n\n  placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n\n  arr = new Arr(len * 3 / 4 - placeHolders)\n\n  l = placeHolders > 0 ? len - 4 : len\n\n  var L = 0\n\n  for (i = 0, j = 0; i < l; i += 4, j += 3) {\n    tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n    arr[L++] = (tmp >> 16) & 0xFF\n    arr[L++] = (tmp >> 8) & 0xFF\n    arr[L++] = tmp & 0xFF\n  }\n\n  if (placeHolders === 2) {\n    tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n    arr[L++] = tmp & 0xFF\n  } else if (placeHolders === 1) {\n    tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n    arr[L++] = (tmp >> 8) & 0xFF\n    arr[L++] = tmp & 0xFF\n  }\n\n  return arr\n}\n\nfunction tripletToBase64 (num) {\n  return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n  var tmp\n  var output = []\n  for (var i = start; i < end; i += 3) {\n    tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n    output.push(tripletToBase64(tmp))\n  }\n  return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n  var tmp\n  var len = uint8.length\n  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n  var output = ''\n  var parts = []\n  var maxChunkLength = 16383 // must be multiple of 3\n\n  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n    parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n  }\n\n  if (extraBytes === 1) {\n    tmp = uint8[len - 1]\n    output += lookup[tmp >> 2]\n    output += lookup[(tmp << 4) & 0x3F]\n    output += '=='\n  } else if (extraBytes === 2) {\n    tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n    output += lookup[tmp >> 10]\n    output += lookup[(tmp >> 4) & 0x3F]\n    output += lookup[(tmp << 2) & 0x3F]\n    output += '='\n  }\n\n  parts.push(output)\n\n  return parts.join('')\n}\n\n},{}],71:[function(require,module,exports){\nmodule.exports=require(59)\n},{}],72:[function(require,module,exports){\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n  return toString.call(arr) == '[object Array]';\n};\n\n},{}],73:[function(require,module,exports){\nvar Buffer = require('buffer').Buffer;\nvar intSize = 4;\nvar zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);\nvar chrsz = 8;\n\nfunction toArray(buf, bigEndian) {\n  if ((buf.length % intSize) !== 0) {\n    var len = buf.length + (intSize - (buf.length % intSize));\n    buf = Buffer.concat([buf, zeroBuffer], len);\n  }\n\n  var arr = [];\n  var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;\n  for (var i = 0; i < buf.length; i += intSize) {\n    arr.push(fn.call(buf, i));\n  }\n  return arr;\n}\n\nfunction toBuffer(arr, size, bigEndian) {\n  var buf = new Buffer(size);\n  var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;\n  for (var i = 0; i < arr.length; i++) {\n    fn.call(buf, arr[i], i * 4, true);\n  }\n  return buf;\n}\n\nfunction hash(buf, fn, hashSize, bigEndian) {\n  if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);\n  var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);\n  return toBuffer(arr, hashSize, bigEndian);\n}\n\nmodule.exports = { hash: hash };\n\n},{\"buffer\":57}],74:[function(require,module,exports){\nvar Buffer = require('buffer').Buffer\nvar sha = require('./sha')\nvar sha256 = require('./sha256')\nvar rng = require('./rng')\nvar md5 = require('./md5')\n\nvar algorithms = {\n  sha1: sha,\n  sha256: sha256,\n  md5: md5\n}\n\nvar blocksize = 64\nvar zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0)\nfunction hmac(fn, key, data) {\n  if(!Buffer.isBuffer(key)) key = new Buffer(key)\n  if(!Buffer.isBuffer(data)) data = new Buffer(data)\n\n  if(key.length > blocksize) {\n    key = fn(key)\n  } else if(key.length < blocksize) {\n    key = Buffer.concat([key, zeroBuffer], blocksize)\n  }\n\n  var ipad = new Buffer(blocksize), opad = new Buffer(blocksize)\n  for(var i = 0; i < blocksize; i++) {\n    ipad[i] = key[i] ^ 0x36\n    opad[i] = key[i] ^ 0x5C\n  }\n\n  var hash = fn(Buffer.concat([ipad, data]))\n  return fn(Buffer.concat([opad, hash]))\n}\n\nfunction hash(alg, key) {\n  alg = alg || 'sha1'\n  var fn = algorithms[alg]\n  var bufs = []\n  var length = 0\n  if(!fn) error('algorithm:', alg, 'is not yet supported')\n  return {\n    update: function (data) {\n      if(!Buffer.isBuffer(data)) data = new Buffer(data)\n        \n      bufs.push(data)\n      length += data.length\n      return this\n    },\n    digest: function (enc) {\n      var buf = Buffer.concat(bufs)\n      var r = key ? hmac(fn, key, buf) : fn(buf)\n      bufs = null\n      return enc ? r.toString(enc) : r\n    }\n  }\n}\n\nfunction error () {\n  var m = [].slice.call(arguments).join(' ')\n  throw new Error([\n    m,\n    'we accept pull requests',\n    'http://github.com/dominictarr/crypto-browserify'\n    ].join('\\n'))\n}\n\nexports.createHash = function (alg) { return hash(alg) }\nexports.createHmac = function (alg, key) { return hash(alg, key) }\nexports.randomBytes = function(size, callback) {\n  if (callback && callback.call) {\n    try {\n      callback.call(this, undefined, new Buffer(rng(size)))\n    } catch (err) { callback(err) }\n  } else {\n    return new Buffer(rng(size))\n  }\n}\n\nfunction each(a, f) {\n  for(var i in a)\n    f(a[i], i)\n}\n\neach(['createCredentials'\n, 'createCipher'\n, 'createCipheriv'\n, 'createDecipher'\n, 'createDecipheriv'\n, 'createSign'\n, 'createVerify'\n, 'createDiffieHellman'\n, 'pbkdf2'], function (name) {\n  exports[name] = function () {\n    error('sorry,', name, 'is not implemented yet')\n  }\n})\n\n},{\"./md5\":75,\"./rng\":76,\"./sha\":77,\"./sha256\":78,\"buffer\":57}],75:[function(require,module,exports){\n\n\nvar helpers = require('./helpers');\n\n\nfunction md5_vm_test()\n{\n  return hex_md5(\"abc\") == \"900150983cd24fb0d6963f7d28e17f72\";\n}\n\n\nfunction core_md5(x, len)\n{\n\n  x[len >> 5] |= 0x80 << ((len) % 32);\n  x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n  var a =  1732584193;\n  var b = -271733879;\n  var c = -1732584194;\n  var d =  271733878;\n\n  for(var i = 0; i < x.length; i += 16)\n  {\n    var olda = a;\n    var oldb = b;\n    var oldc = c;\n    var oldd = d;\n\n    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);\n    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);\n    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);\n    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);\n    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);\n    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);\n    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);\n    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);\n    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);\n    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);\n    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);\n    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);\n    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);\n    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);\n    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);\n    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);\n\n    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);\n    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);\n    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);\n    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);\n    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);\n    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);\n    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);\n    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);\n    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);\n    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);\n    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);\n    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);\n    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);\n    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);\n    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);\n    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);\n\n    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);\n    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);\n    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);\n    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);\n    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);\n    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);\n    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);\n    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);\n    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);\n    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);\n    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);\n    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);\n    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);\n    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);\n    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);\n    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);\n\n    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);\n    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);\n    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);\n    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);\n    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);\n    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);\n    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);\n    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);\n    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);\n    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);\n    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);\n    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);\n    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);\n    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);\n    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);\n    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);\n\n    a = safe_add(a, olda);\n    b = safe_add(b, oldb);\n    c = safe_add(c, oldc);\n    d = safe_add(d, oldd);\n  }\n  return Array(a, b, c, d);\n\n}\n\n\nfunction md5_cmn(q, a, b, x, s, t)\n{\n  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);\n}\nfunction md5_ff(a, b, c, d, x, s, t)\n{\n  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);\n}\nfunction md5_gg(a, b, c, d, x, s, t)\n{\n  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);\n}\nfunction md5_hh(a, b, c, d, x, s, t)\n{\n  return md5_cmn(b ^ c ^ d, a, b, x, s, t);\n}\nfunction md5_ii(a, b, c, d, x, s, t)\n{\n  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);\n}\n\n\nfunction safe_add(x, y)\n{\n  var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n  return (msw << 16) | (lsw & 0xFFFF);\n}\n\n\nfunction bit_rol(num, cnt)\n{\n  return (num << cnt) | (num >>> (32 - cnt));\n}\n\nmodule.exports = function md5(buf) {\n  return helpers.hash(buf, core_md5, 16);\n};\n\n},{\"./helpers\":73}],76:[function(require,module,exports){\n(function() {\n  var _global = this;\n\n  var mathRNG, whatwgRNG;\n\n  mathRNG = function(size) {\n    var bytes = new Array(size);\n    var r;\n\n    for (var i = 0, r; i < size; i++) {\n      if ((i & 0x03) == 0) r = Math.random() * 0x100000000;\n      bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;\n    }\n\n    return bytes;\n  }\n\n  if (_global.crypto && crypto.getRandomValues) {\n    whatwgRNG = function(size) {\n      var bytes = new Uint8Array(size);\n      crypto.getRandomValues(bytes);\n      return bytes;\n    }\n  }\n\n  module.exports = whatwgRNG || mathRNG;\n\n}())\n\n},{}],77:[function(require,module,exports){\n\n\nvar helpers = require('./helpers');\n\n\nfunction core_sha1(x, len)\n{\n\n  x[len >> 5] |= 0x80 << (24 - len % 32);\n  x[((len + 64 >> 9) << 4) + 15] = len;\n\n  var w = Array(80);\n  var a =  1732584193;\n  var b = -271733879;\n  var c = -1732584194;\n  var d =  271733878;\n  var e = -1009589776;\n\n  for(var i = 0; i < x.length; i += 16)\n  {\n    var olda = a;\n    var oldb = b;\n    var oldc = c;\n    var oldd = d;\n    var olde = e;\n\n    for(var j = 0; j < 80; j++)\n    {\n      if(j < 16) w[j] = x[i + j];\n      else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);\n      var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n                       safe_add(safe_add(e, w[j]), sha1_kt(j)));\n      e = d;\n      d = c;\n      c = rol(b, 30);\n      b = a;\n      a = t;\n    }\n\n    a = safe_add(a, olda);\n    b = safe_add(b, oldb);\n    c = safe_add(c, oldc);\n    d = safe_add(d, oldd);\n    e = safe_add(e, olde);\n  }\n  return Array(a, b, c, d, e);\n\n}\n\n\nfunction sha1_ft(t, b, c, d)\n{\n  if(t < 20) return (b & c) | ((~b) & d);\n  if(t < 40) return b ^ c ^ d;\n  if(t < 60) return (b & c) | (b & d) | (c & d);\n  return b ^ c ^ d;\n}\n\n\nfunction sha1_kt(t)\n{\n  return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :\n         (t < 60) ? -1894007588 : -899497514;\n}\n\n\nfunction safe_add(x, y)\n{\n  var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n  return (msw << 16) | (lsw & 0xFFFF);\n}\n\n\nfunction rol(num, cnt)\n{\n  return (num << cnt) | (num >>> (32 - cnt));\n}\n\nmodule.exports = function sha1(buf) {\n  return helpers.hash(buf, core_sha1, 20, true);\n};\n\n},{\"./helpers\":73}],78:[function(require,module,exports){\n\n\n\nvar helpers = require('./helpers');\n\nvar safe_add = function(x, y) {\n  var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n  return (msw << 16) | (lsw & 0xFFFF);\n};\n\nvar S = function(X, n) {\n  return (X >>> n) | (X << (32 - n));\n};\n\nvar R = function(X, n) {\n  return (X >>> n);\n};\n\nvar Ch = function(x, y, z) {\n  return ((x & y) ^ ((~x) & z));\n};\n\nvar Maj = function(x, y, z) {\n  return ((x & y) ^ (x & z) ^ (y & z));\n};\n\nvar Sigma0256 = function(x) {\n  return (S(x, 2) ^ S(x, 13) ^ S(x, 22));\n};\n\nvar Sigma1256 = function(x) {\n  return (S(x, 6) ^ S(x, 11) ^ S(x, 25));\n};\n\nvar Gamma0256 = function(x) {\n  return (S(x, 7) ^ S(x, 18) ^ R(x, 3));\n};\n\nvar Gamma1256 = function(x) {\n  return (S(x, 17) ^ S(x, 19) ^ R(x, 10));\n};\n\nvar core_sha256 = function(m, l) {\n  var K = new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2);\n  var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);\n    var W = new Array(64);\n    var a, b, c, d, e, f, g, h, i, j;\n    var T1, T2;\n\n  m[l >> 5] |= 0x80 << (24 - l % 32);\n  m[((l + 64 >> 9) << 4) + 15] = l;\n  for (var i = 0; i < m.length; i += 16) {\n    a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7];\n    for (var j = 0; j < 64; j++) {\n      if (j < 16) {\n        W[j] = m[j + i];\n      } else {\n        W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);\n      }\n      T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);\n      T2 = safe_add(Sigma0256(a), Maj(a, b, c));\n      h = g; g = f; f = e; e = safe_add(d, T1); d = c; c = b; b = a; a = safe_add(T1, T2);\n    }\n    HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]); HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]);\n    HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]); HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]);\n  }\n  return HASH;\n};\n\nmodule.exports = function sha256(buf) {\n  return helpers.hash(buf, core_sha256, 32, true);\n};\n\n},{\"./helpers\":73}],79:[function(require,module,exports){\n(function(exports) {\n  \"use strict\";\n\n  function isArray(obj) {\n    if (obj !== null) {\n      return Object.prototype.toString.call(obj) === \"[object Array]\";\n    } else {\n      return false;\n    }\n  }\n\n  function isObject(obj) {\n    if (obj !== null) {\n      return Object.prototype.toString.call(obj) === \"[object Object]\";\n    } else {\n      return false;\n    }\n  }\n\n  function strictDeepEqual(first, second) {\n    if (first === second) {\n      return true;\n    }\n\n    var firstType = Object.prototype.toString.call(first);\n    if (firstType !== Object.prototype.toString.call(second)) {\n      return false;\n    }\n    if (isArray(first) === true) {\n      if (first.length !== second.length) {\n        return false;\n      }\n      for (var i = 0; i < first.length; i++) {\n        if (strictDeepEqual(first[i], second[i]) === false) {\n          return false;\n        }\n      }\n      return true;\n    }\n    if (isObject(first) === true) {\n      var keysSeen = {};\n      for (var key in first) {\n        if (hasOwnProperty.call(first, key)) {\n          if (strictDeepEqual(first[key], second[key]) === false) {\n            return false;\n          }\n          keysSeen[key] = true;\n        }\n      }\n      for (var key2 in second) {\n        if (hasOwnProperty.call(second, key2)) {\n          if (keysSeen[key2] !== true) {\n            return false;\n          }\n        }\n      }\n      return true;\n    }\n    return false;\n  }\n\n  function isFalse(obj) {\n\n    if (obj === \"\" || obj === false || obj === null) {\n        return true;\n    } else if (isArray(obj) && obj.length === 0) {\n        return true;\n    } else if (isObject(obj)) {\n        for (var key in obj) {\n            if (obj.hasOwnProperty(key)) {\n              return false;\n            }\n        }\n        return true;\n    } else {\n        return false;\n    }\n  }\n\n  function objValues(obj) {\n    var keys = Object.keys(obj);\n    var values = [];\n    for (var i = 0; i < keys.length; i++) {\n      values.push(obj[keys[i]]);\n    }\n    return values;\n  }\n\n  function merge(a, b) {\n      var merged = {};\n      for (var key in a) {\n          merged[key] = a[key];\n      }\n      for (var key2 in b) {\n          merged[key2] = b[key2];\n      }\n      return merged;\n  }\n\n  var trimLeft;\n  if (typeof String.prototype.trimLeft === \"function\") {\n    trimLeft = function(str) {\n      return str.trimLeft();\n    };\n  } else {\n    trimLeft = function(str) {\n      return str.match(/^\\s*(.*)/)[1];\n    };\n  }\n\n  var TYPE_NUMBER = 0;\n  var TYPE_ANY = 1;\n  var TYPE_STRING = 2;\n  var TYPE_ARRAY = 3;\n  var TYPE_OBJECT = 4;\n  var TYPE_BOOLEAN = 5;\n  var TYPE_EXPREF = 6;\n  var TYPE_NULL = 7;\n  var TYPE_ARRAY_NUMBER = 8;\n  var TYPE_ARRAY_STRING = 9;\n\n  var TOK_EOF = \"EOF\";\n  var TOK_UNQUOTEDIDENTIFIER = \"UnquotedIdentifier\";\n  var TOK_QUOTEDIDENTIFIER = \"QuotedIdentifier\";\n  var TOK_RBRACKET = \"Rbracket\";\n  var TOK_RPAREN = \"Rparen\";\n  var TOK_COMMA = \"Comma\";\n  var TOK_COLON = \"Colon\";\n  var TOK_RBRACE = \"Rbrace\";\n  var TOK_NUMBER = \"Number\";\n  var TOK_CURRENT = \"Current\";\n  var TOK_EXPREF = \"Expref\";\n  var TOK_PIPE = \"Pipe\";\n  var TOK_OR = \"Or\";\n  var TOK_AND = \"And\";\n  var TOK_EQ = \"EQ\";\n  var TOK_GT = \"GT\";\n  var TOK_LT = \"LT\";\n  var TOK_GTE = \"GTE\";\n  var TOK_LTE = \"LTE\";\n  var TOK_NE = \"NE\";\n  var TOK_FLATTEN = \"Flatten\";\n  var TOK_STAR = \"Star\";\n  var TOK_FILTER = \"Filter\";\n  var TOK_DOT = \"Dot\";\n  var TOK_NOT = \"Not\";\n  var TOK_LBRACE = \"Lbrace\";\n  var TOK_LBRACKET = \"Lbracket\";\n  var TOK_LPAREN= \"Lparen\";\n  var TOK_LITERAL= \"Literal\";\n\n\n  var basicTokens = {\n    \".\": TOK_DOT,\n    \"*\": TOK_STAR,\n    \",\": TOK_COMMA,\n    \":\": TOK_COLON,\n    \"{\": TOK_LBRACE,\n    \"}\": TOK_RBRACE,\n    \"]\": TOK_RBRACKET,\n    \"(\": TOK_LPAREN,\n    \")\": TOK_RPAREN,\n    \"@\": TOK_CURRENT\n  };\n\n  var operatorStartToken = {\n      \"<\": true,\n      \">\": true,\n      \"=\": true,\n      \"!\": true\n  };\n\n  var skipChars = {\n      \" \": true,\n      \"\\t\": true,\n      \"\\n\": true\n  };\n\n\n  function isAlpha(ch) {\n      return (ch >= \"a\" && ch <= \"z\") ||\n             (ch >= \"A\" && ch <= \"Z\") ||\n             ch === \"_\";\n  }\n\n  function isNum(ch) {\n      return (ch >= \"0\" && ch <= \"9\") ||\n             ch === \"-\";\n  }\n  function isAlphaNum(ch) {\n      return (ch >= \"a\" && ch <= \"z\") ||\n             (ch >= \"A\" && ch <= \"Z\") ||\n             (ch >= \"0\" && ch <= \"9\") ||\n             ch === \"_\";\n  }\n\n  function Lexer() {\n  }\n  Lexer.prototype = {\n      tokenize: function(stream) {\n          var tokens = [];\n          this._current = 0;\n          var start;\n          var identifier;\n          var token;\n          while (this._current < stream.length) {\n              if (isAlpha(stream[this._current])) {\n                  start = this._current;\n                  identifier = this._consumeUnquotedIdentifier(stream);\n                  tokens.push({type: TOK_UNQUOTEDIDENTIFIER,\n                               value: identifier,\n                               start: start});\n              } else if (basicTokens[stream[this._current]] !== undefined) {\n                  tokens.push({type: basicTokens[stream[this._current]],\n                              value: stream[this._current],\n                              start: this._current});\n                  this._current++;\n              } else if (isNum(stream[this._current])) {\n                  token = this._consumeNumber(stream);\n                  tokens.push(token);\n              } else if (stream[this._current] === \"[\") {\n                  token = this._consumeLBracket(stream);\n                  tokens.push(token);\n              } else if (stream[this._current] === \"\\\"\") {\n                  start = this._current;\n                  identifier = this._consumeQuotedIdentifier(stream);\n                  tokens.push({type: TOK_QUOTEDIDENTIFIER,\n                               value: identifier,\n                               start: start});\n              } else if (stream[this._current] === \"'\") {\n                  start = this._current;\n                  identifier = this._consumeRawStringLiteral(stream);\n                  tokens.push({type: TOK_LITERAL,\n                               value: identifier,\n                               start: start});\n              } else if (stream[this._current] === \"`\") {\n                  start = this._current;\n                  var literal = this._consumeLiteral(stream);\n                  tokens.push({type: TOK_LITERAL,\n                               value: literal,\n                               start: start});\n              } else if (operatorStartToken[stream[this._current]] !== undefined) {\n                  tokens.push(this._consumeOperator(stream));\n              } else if (skipChars[stream[this._current]] !== undefined) {\n                  this._current++;\n              } else if (stream[this._current] === \"&\") {\n                  start = this._current;\n                  this._current++;\n                  if (stream[this._current] === \"&\") {\n                      this._current++;\n                      tokens.push({type: TOK_AND, value: \"&&\", start: start});\n                  } else {\n                      tokens.push({type: TOK_EXPREF, value: \"&\", start: start});\n                  }\n              } else if (stream[this._current] === \"|\") {\n                  start = this._current;\n                  this._current++;\n                  if (stream[this._current] === \"|\") {\n                      this._current++;\n                      tokens.push({type: TOK_OR, value: \"||\", start: start});\n                  } else {\n                      tokens.push({type: TOK_PIPE, value: \"|\", start: start});\n                  }\n              } else {\n                  var error = new Error(\"Unknown character:\" + stream[this._current]);\n                  error.name = \"LexerError\";\n                  throw error;\n              }\n          }\n          return tokens;\n      },\n\n      _consumeUnquotedIdentifier: function(stream) {\n          var start = this._current;\n          this._current++;\n          while (this._current < stream.length && isAlphaNum(stream[this._current])) {\n              this._current++;\n          }\n          return stream.slice(start, this._current);\n      },\n\n      _consumeQuotedIdentifier: function(stream) {\n          var start = this._current;\n          this._current++;\n          var maxLength = stream.length;\n          while (stream[this._current] !== \"\\\"\" && this._current < maxLength) {\n              var current = this._current;\n              if (stream[current] === \"\\\\\" && (stream[current + 1] === \"\\\\\" ||\n                                               stream[current + 1] === \"\\\"\")) {\n                  current += 2;\n              } else {\n                  current++;\n              }\n              this._current = current;\n          }\n          this._current++;\n          return JSON.parse(stream.slice(start, this._current));\n      },\n\n      _consumeRawStringLiteral: function(stream) {\n          var start = this._current;\n          this._current++;\n          var maxLength = stream.length;\n          while (stream[this._current] !== \"'\" && this._current < maxLength) {\n              var current = this._current;\n              if (stream[current] === \"\\\\\" && (stream[current + 1] === \"\\\\\" ||\n                                               stream[current + 1] === \"'\")) {\n                  current += 2;\n              } else {\n                  current++;\n              }\n              this._current = current;\n          }\n          this._current++;\n          var literal = stream.slice(start + 1, this._current - 1);\n          return literal.replace(\"\\\\'\", \"'\");\n      },\n\n      _consumeNumber: function(stream) {\n          var start = this._current;\n          this._current++;\n          var maxLength = stream.length;\n          while (isNum(stream[this._current]) && this._current < maxLength) {\n              this._current++;\n          }\n          var value = parseInt(stream.slice(start, this._current));\n          return {type: TOK_NUMBER, value: value, start: start};\n      },\n\n      _consumeLBracket: function(stream) {\n          var start = this._current;\n          this._current++;\n          if (stream[this._current] === \"?\") {\n              this._current++;\n              return {type: TOK_FILTER, value: \"[?\", start: start};\n          } else if (stream[this._current] === \"]\") {\n              this._current++;\n              return {type: TOK_FLATTEN, value: \"[]\", start: start};\n          } else {\n              return {type: TOK_LBRACKET, value: \"[\", start: start};\n          }\n      },\n\n      _consumeOperator: function(stream) {\n          var start = this._current;\n          var startingChar = stream[start];\n          this._current++;\n          if (startingChar === \"!\") {\n              if (stream[this._current] === \"=\") {\n                  this._current++;\n                  return {type: TOK_NE, value: \"!=\", start: start};\n              } else {\n                return {type: TOK_NOT, value: \"!\", start: start};\n              }\n          } else if (startingChar === \"<\") {\n              if (stream[this._current] === \"=\") {\n                  this._current++;\n                  return {type: TOK_LTE, value: \"<=\", start: start};\n              } else {\n                  return {type: TOK_LT, value: \"<\", start: start};\n              }\n          } else if (startingChar === \">\") {\n              if (stream[this._current] === \"=\") {\n                  this._current++;\n                  return {type: TOK_GTE, value: \">=\", start: start};\n              } else {\n                  return {type: TOK_GT, value: \">\", start: start};\n              }\n          } else if (startingChar === \"=\") {\n              if (stream[this._current] === \"=\") {\n                  this._current++;\n                  return {type: TOK_EQ, value: \"==\", start: start};\n              }\n          }\n      },\n\n      _consumeLiteral: function(stream) {\n          this._current++;\n          var start = this._current;\n          var maxLength = stream.length;\n          var literal;\n          while(stream[this._current] !== \"`\" && this._current < maxLength) {\n              var current = this._current;\n              if (stream[current] === \"\\\\\" && (stream[current + 1] === \"\\\\\" ||\n                                               stream[current + 1] === \"`\")) {\n                  current += 2;\n              } else {\n                  current++;\n              }\n              this._current = current;\n          }\n          var literalString = trimLeft(stream.slice(start, this._current));\n          literalString = literalString.replace(\"\\\\`\", \"`\");\n          if (this._looksLikeJSON(literalString)) {\n              literal = JSON.parse(literalString);\n          } else {\n              literal = JSON.parse(\"\\\"\" + literalString + \"\\\"\");\n          }\n          this._current++;\n          return literal;\n      },\n\n      _looksLikeJSON: function(literalString) {\n          var startingChars = \"[{\\\"\";\n          var jsonLiterals = [\"true\", \"false\", \"null\"];\n          var numberLooking = \"-0123456789\";\n\n          if (literalString === \"\") {\n              return false;\n          } else if (startingChars.indexOf(literalString[0]) >= 0) {\n              return true;\n          } else if (jsonLiterals.indexOf(literalString) >= 0) {\n              return true;\n          } else if (numberLooking.indexOf(literalString[0]) >= 0) {\n              try {\n                  JSON.parse(literalString);\n                  return true;\n              } catch (ex) {\n                  return false;\n              }\n          } else {\n              return false;\n          }\n      }\n  };\n\n      var bindingPower = {};\n      bindingPower[TOK_EOF] = 0;\n      bindingPower[TOK_UNQUOTEDIDENTIFIER] = 0;\n      bindingPower[TOK_QUOTEDIDENTIFIER] = 0;\n      bindingPower[TOK_RBRACKET] = 0;\n      bindingPower[TOK_RPAREN] = 0;\n      bindingPower[TOK_COMMA] = 0;\n      bindingPower[TOK_RBRACE] = 0;\n      bindingPower[TOK_NUMBER] = 0;\n      bindingPower[TOK_CURRENT] = 0;\n      bindingPower[TOK_EXPREF] = 0;\n      bindingPower[TOK_PIPE] = 1;\n      bindingPower[TOK_OR] = 2;\n      bindingPower[TOK_AND] = 3;\n      bindingPower[TOK_EQ] = 5;\n      bindingPower[TOK_GT] = 5;\n      bindingPower[TOK_LT] = 5;\n      bindingPower[TOK_GTE] = 5;\n      bindingPower[TOK_LTE] = 5;\n      bindingPower[TOK_NE] = 5;\n      bindingPower[TOK_FLATTEN] = 9;\n      bindingPower[TOK_STAR] = 20;\n      bindingPower[TOK_FILTER] = 21;\n      bindingPower[TOK_DOT] = 40;\n      bindingPower[TOK_NOT] = 45;\n      bindingPower[TOK_LBRACE] = 50;\n      bindingPower[TOK_LBRACKET] = 55;\n      bindingPower[TOK_LPAREN] = 60;\n\n  function Parser() {\n  }\n\n  Parser.prototype = {\n      parse: function(expression) {\n          this._loadTokens(expression);\n          this.index = 0;\n          var ast = this.expression(0);\n          if (this._lookahead(0) !== TOK_EOF) {\n              var t = this._lookaheadToken(0);\n              var error = new Error(\n                  \"Unexpected token type: \" + t.type + \", value: \" + t.value);\n              error.name = \"ParserError\";\n              throw error;\n          }\n          return ast;\n      },\n\n      _loadTokens: function(expression) {\n          var lexer = new Lexer();\n          var tokens = lexer.tokenize(expression);\n          tokens.push({type: TOK_EOF, value: \"\", start: expression.length});\n          this.tokens = tokens;\n      },\n\n      expression: function(rbp) {\n          var leftToken = this._lookaheadToken(0);\n          this._advance();\n          var left = this.nud(leftToken);\n          var currentToken = this._lookahead(0);\n          while (rbp < bindingPower[currentToken]) {\n              this._advance();\n              left = this.led(currentToken, left);\n              currentToken = this._lookahead(0);\n          }\n          return left;\n      },\n\n      _lookahead: function(number) {\n          return this.tokens[this.index + number].type;\n      },\n\n      _lookaheadToken: function(number) {\n          return this.tokens[this.index + number];\n      },\n\n      _advance: function() {\n          this.index++;\n      },\n\n      nud: function(token) {\n        var left;\n        var right;\n        var expression;\n        switch (token.type) {\n          case TOK_LITERAL:\n            return {type: \"Literal\", value: token.value};\n          case TOK_UNQUOTEDIDENTIFIER:\n            return {type: \"Field\", name: token.value};\n          case TOK_QUOTEDIDENTIFIER:\n            var node = {type: \"Field\", name: token.value};\n            if (this._lookahead(0) === TOK_LPAREN) {\n                throw new Error(\"Quoted identifier not allowed for function names.\");\n            } else {\n                return node;\n            }\n            break;\n          case TOK_NOT:\n            right = this.expression(bindingPower.Not);\n            return {type: \"NotExpression\", children: [right]};\n          case TOK_STAR:\n            left = {type: \"Identity\"};\n            right = null;\n            if (this._lookahead(0) === TOK_RBRACKET) {\n                right = {type: \"Identity\"};\n            } else {\n                right = this._parseProjectionRHS(bindingPower.Star);\n            }\n            return {type: \"ValueProjection\", children: [left, right]};\n          case TOK_FILTER:\n            return this.led(token.type, {type: \"Identity\"});\n          case TOK_LBRACE:\n            return this._parseMultiselectHash();\n          case TOK_FLATTEN:\n            left = {type: TOK_FLATTEN, children: [{type: \"Identity\"}]};\n            right = this._parseProjectionRHS(bindingPower.Flatten);\n            return {type: \"Projection\", children: [left, right]};\n          case TOK_LBRACKET:\n            if (this._lookahead(0) === TOK_NUMBER || this._lookahead(0) === TOK_COLON) {\n                right = this._parseIndexExpression();\n                return this._projectIfSlice({type: \"Identity\"}, right);\n            } else if (this._lookahead(0) === TOK_STAR &&\n                       this._lookahead(1) === TOK_RBRACKET) {\n                this._advance();\n                this._advance();\n                right = this._parseProjectionRHS(bindingPower.Star);\n                return {type: \"Projection\",\n                        children: [{type: \"Identity\"}, right]};\n            } else {\n                return this._parseMultiselectList();\n            }\n            break;\n          case TOK_CURRENT:\n            return {type: TOK_CURRENT};\n          case TOK_EXPREF:\n            expression = this.expression(bindingPower.Expref);\n            return {type: \"ExpressionReference\", children: [expression]};\n          case TOK_LPAREN:\n            var args = [];\n            while (this._lookahead(0) !== TOK_RPAREN) {\n              if (this._lookahead(0) === TOK_CURRENT) {\n                expression = {type: TOK_CURRENT};\n                this._advance();\n              } else {\n                expression = this.expression(0);\n              }\n              args.push(expression);\n            }\n            this._match(TOK_RPAREN);\n            return args[0];\n          default:\n            this._errorToken(token);\n        }\n      },\n\n      led: function(tokenName, left) {\n        var right;\n        switch(tokenName) {\n          case TOK_DOT:\n            var rbp = bindingPower.Dot;\n            if (this._lookahead(0) !== TOK_STAR) {\n                right = this._parseDotRHS(rbp);\n                return {type: \"Subexpression\", children: [left, right]};\n            } else {\n                this._advance();\n                right = this._parseProjectionRHS(rbp);\n                return {type: \"ValueProjection\", children: [left, right]};\n            }\n            break;\n          case TOK_PIPE:\n            right = this.expression(bindingPower.Pipe);\n            return {type: TOK_PIPE, children: [left, right]};\n          case TOK_OR:\n            right = this.expression(bindingPower.Or);\n            return {type: \"OrExpression\", children: [left, right]};\n          case TOK_AND:\n            right = this.expression(bindingPower.And);\n            return {type: \"AndExpression\", children: [left, right]};\n          case TOK_LPAREN:\n            var name = left.name;\n            var args = [];\n            var expression, node;\n            while (this._lookahead(0) !== TOK_RPAREN) {\n              if (this._lookahead(0) === TOK_CURRENT) {\n                expression = {type: TOK_CURRENT};\n                this._advance();\n              } else {\n                expression = this.expression(0);\n              }\n              if (this._lookahead(0) === TOK_COMMA) {\n                this._match(TOK_COMMA);\n              }\n              args.push(expression);\n            }\n            this._match(TOK_RPAREN);\n            node = {type: \"Function\", name: name, children: args};\n            return node;\n          case TOK_FILTER:\n            var condition = this.expression(0);\n            this._match(TOK_RBRACKET);\n            if (this._lookahead(0) === TOK_FLATTEN) {\n              right = {type: \"Identity\"};\n            } else {\n              right = this._parseProjectionRHS(bindingPower.Filter);\n            }\n            return {type: \"FilterProjection\", children: [left, right, condition]};\n          case TOK_FLATTEN:\n            var leftNode = {type: TOK_FLATTEN, children: [left]};\n            var rightNode = this._parseProjectionRHS(bindingPower.Flatten);\n            return {type: \"Projection\", children: [leftNode, rightNode]};\n          case TOK_EQ:\n          case TOK_NE:\n          case TOK_GT:\n          case TOK_GTE:\n          case TOK_LT:\n          case TOK_LTE:\n            return this._parseComparator(left, tokenName);\n          case TOK_LBRACKET:\n            var token = this._lookaheadToken(0);\n            if (token.type === TOK_NUMBER || token.type === TOK_COLON) {\n                right = this._parseIndexExpression();\n                return this._projectIfSlice(left, right);\n            } else {\n                this._match(TOK_STAR);\n                this._match(TOK_RBRACKET);\n                right = this._parseProjectionRHS(bindingPower.Star);\n                return {type: \"Projection\", children: [left, right]};\n            }\n            break;\n          default:\n            this._errorToken(this._lookaheadToken(0));\n        }\n      },\n\n      _match: function(tokenType) {\n          if (this._lookahead(0) === tokenType) {\n              this._advance();\n          } else {\n              var t = this._lookaheadToken(0);\n              var error = new Error(\"Expected \" + tokenType + \", got: \" + t.type);\n              error.name = \"ParserError\";\n              throw error;\n          }\n      },\n\n      _errorToken: function(token) {\n          var error = new Error(\"Invalid token (\" +\n                                token.type + \"): \\\"\" +\n                                token.value + \"\\\"\");\n          error.name = \"ParserError\";\n          throw error;\n      },\n\n\n      _parseIndexExpression: function() {\n          if (this._lookahead(0) === TOK_COLON || this._lookahead(1) === TOK_COLON) {\n              return this._parseSliceExpression();\n          } else {\n              var node = {\n                  type: \"Index\",\n                  value: this._lookaheadToken(0).value};\n              this._advance();\n              this._match(TOK_RBRACKET);\n              return node;\n          }\n      },\n\n      _projectIfSlice: function(left, right) {\n          var indexExpr = {type: \"IndexExpression\", children: [left, right]};\n          if (right.type === \"Slice\") {\n              return {\n                  type: \"Projection\",\n                  children: [indexExpr, this._parseProjectionRHS(bindingPower.Star)]\n              };\n          } else {\n              return indexExpr;\n          }\n      },\n\n      _parseSliceExpression: function() {\n          var parts = [null, null, null];\n          var index = 0;\n          var currentToken = this._lookahead(0);\n          while (currentToken !== TOK_RBRACKET && index < 3) {\n              if (currentToken === TOK_COLON) {\n                  index++;\n                  this._advance();\n              } else if (currentToken === TOK_NUMBER) {\n                  parts[index] = this._lookaheadToken(0).value;\n                  this._advance();\n              } else {\n                  var t = this._lookahead(0);\n                  var error = new Error(\"Syntax error, unexpected token: \" +\n                                        t.value + \"(\" + t.type + \")\");\n                  error.name = \"Parsererror\";\n                  throw error;\n              }\n              currentToken = this._lookahead(0);\n          }\n          this._match(TOK_RBRACKET);\n          return {\n              type: \"Slice\",\n              children: parts\n          };\n      },\n\n      _parseComparator: function(left, comparator) {\n        var right = this.expression(bindingPower[comparator]);\n        return {type: \"Comparator\", name: comparator, children: [left, right]};\n      },\n\n      _parseDotRHS: function(rbp) {\n          var lookahead = this._lookahead(0);\n          var exprTokens = [TOK_UNQUOTEDIDENTIFIER, TOK_QUOTEDIDENTIFIER, TOK_STAR];\n          if (exprTokens.indexOf(lookahead) >= 0) {\n              return this.expression(rbp);\n          } else if (lookahead === TOK_LBRACKET) {\n              this._match(TOK_LBRACKET);\n              return this._parseMultiselectList();\n          } else if (lookahead === TOK_LBRACE) {\n              this._match(TOK_LBRACE);\n              return this._parseMultiselectHash();\n          }\n      },\n\n      _parseProjectionRHS: function(rbp) {\n          var right;\n          if (bindingPower[this._lookahead(0)] < 10) {\n              right = {type: \"Identity\"};\n          } else if (this._lookahead(0) === TOK_LBRACKET) {\n              right = this.expression(rbp);\n          } else if (this._lookahead(0) === TOK_FILTER) {\n              right = this.expression(rbp);\n          } else if (this._lookahead(0) === TOK_DOT) {\n              this._match(TOK_DOT);\n              right = this._parseDotRHS(rbp);\n          } else {\n              var t = this._lookaheadToken(0);\n              var error = new Error(\"Sytanx error, unexpected token: \" +\n                                    t.value + \"(\" + t.type + \")\");\n              error.name = \"ParserError\";\n              throw error;\n          }\n          return right;\n      },\n\n      _parseMultiselectList: function() {\n          var expressions = [];\n          while (this._lookahead(0) !== TOK_RBRACKET) {\n              var expression = this.expression(0);\n              expressions.push(expression);\n              if (this._lookahead(0) === TOK_COMMA) {\n                  this._match(TOK_COMMA);\n                  if (this._lookahead(0) === TOK_RBRACKET) {\n                    throw new Error(\"Unexpected token Rbracket\");\n                  }\n              }\n          }\n          this._match(TOK_RBRACKET);\n          return {type: \"MultiSelectList\", children: expressions};\n      },\n\n      _parseMultiselectHash: function() {\n        var pairs = [];\n        var identifierTypes = [TOK_UNQUOTEDIDENTIFIER, TOK_QUOTEDIDENTIFIER];\n        var keyToken, keyName, value, node;\n        for (;;) {\n          keyToken = this._lookaheadToken(0);\n          if (identifierTypes.indexOf(keyToken.type) < 0) {\n            throw new Error(\"Expecting an identifier token, got: \" +\n                            keyToken.type);\n          }\n          keyName = keyToken.value;\n          this._advance();\n          this._match(TOK_COLON);\n          value = this.expression(0);\n          node = {type: \"KeyValuePair\", name: keyName, value: value};\n          pairs.push(node);\n          if (this._lookahead(0) === TOK_COMMA) {\n            this._match(TOK_COMMA);\n          } else if (this._lookahead(0) === TOK_RBRACE) {\n            this._match(TOK_RBRACE);\n            break;\n          }\n        }\n        return {type: \"MultiSelectHash\", children: pairs};\n      }\n  };\n\n\n  function TreeInterpreter(runtime) {\n    this.runtime = runtime;\n  }\n\n  TreeInterpreter.prototype = {\n      search: function(node, value) {\n          return this.visit(node, value);\n      },\n\n      visit: function(node, value) {\n          var matched, current, result, first, second, field, left, right, collected, i;\n          switch (node.type) {\n            case \"Field\":\n              if (value === null ) {\n                  return null;\n              } else if (isObject(value)) {\n                  field = value[node.name];\n                  if (field === undefined) {\n                      return null;\n                  } else {\n                      return field;\n                  }\n              } else {\n                return null;\n              }\n              break;\n            case \"Subexpression\":\n              result = this.visit(node.children[0], value);\n              for (i = 1; i < node.children.length; i++) {\n                  result = this.visit(node.children[1], result);\n                  if (result === null) {\n                      return null;\n                  }\n              }\n              return result;\n            case \"IndexExpression\":\n              left = this.visit(node.children[0], value);\n              right = this.visit(node.children[1], left);\n              return right;\n            case \"Index\":\n              if (!isArray(value)) {\n                return null;\n              }\n              var index = node.value;\n              if (index < 0) {\n                index = value.length + index;\n              }\n              result = value[index];\n              if (result === undefined) {\n                result = null;\n              }\n              return result;\n            case \"Slice\":\n              if (!isArray(value)) {\n                return null;\n              }\n              var sliceParams = node.children.slice(0);\n              var computed = this.computeSliceParams(value.length, sliceParams);\n              var start = computed[0];\n              var stop = computed[1];\n              var step = computed[2];\n              result = [];\n              if (step > 0) {\n                  for (i = start; i < stop; i += step) {\n                      result.push(value[i]);\n                  }\n              } else {\n                  for (i = start; i > stop; i += step) {\n                      result.push(value[i]);\n                  }\n              }\n              return result;\n            case \"Projection\":\n              var base = this.visit(node.children[0], value);\n              if (!isArray(base)) {\n                return null;\n              }\n              collected = [];\n              for (i = 0; i < base.length; i++) {\n                current = this.visit(node.children[1], base[i]);\n                if (current !== null) {\n                  collected.push(current);\n                }\n              }\n              return collected;\n            case \"ValueProjection\":\n              base = this.visit(node.children[0], value);\n              if (!isObject(base)) {\n                return null;\n              }\n              collected = [];\n              var values = objValues(base);\n              for (i = 0; i < values.length; i++) {\n                current = this.visit(node.children[1], values[i]);\n                if (current !== null) {\n                  collected.push(current);\n                }\n              }\n              return collected;\n            case \"FilterProjection\":\n              base = this.visit(node.children[0], value);\n              if (!isArray(base)) {\n                return null;\n              }\n              var filtered = [];\n              var finalResults = [];\n              for (i = 0; i < base.length; i++) {\n                matched = this.visit(node.children[2], base[i]);\n                if (!isFalse(matched)) {\n                  filtered.push(base[i]);\n                }\n              }\n              for (var j = 0; j < filtered.length; j++) {\n                current = this.visit(node.children[1], filtered[j]);\n                if (current !== null) {\n                  finalResults.push(current);\n                }\n              }\n              return finalResults;\n            case \"Comparator\":\n              first = this.visit(node.children[0], value);\n              second = this.visit(node.children[1], value);\n              switch(node.name) {\n                case TOK_EQ:\n                  result = strictDeepEqual(first, second);\n                  break;\n                case TOK_NE:\n                  result = !strictDeepEqual(first, second);\n                  break;\n                case TOK_GT:\n                  result = first > second;\n                  break;\n                case TOK_GTE:\n                  result = first >= second;\n                  break;\n                case TOK_LT:\n                  result = first < second;\n                  break;\n                case TOK_LTE:\n                  result = first <= second;\n                  break;\n                default:\n                  throw new Error(\"Unknown comparator: \" + node.name);\n              }\n              return result;\n            case TOK_FLATTEN:\n              var original = this.visit(node.children[0], value);\n              if (!isArray(original)) {\n                return null;\n              }\n              var merged = [];\n              for (i = 0; i < original.length; i++) {\n                current = original[i];\n                if (isArray(current)) {\n                  merged.push.apply(merged, current);\n                } else {\n                  merged.push(current);\n                }\n              }\n              return merged;\n            case \"Identity\":\n              return value;\n            case \"MultiSelectList\":\n              if (value === null) {\n                return null;\n              }\n              collected = [];\n              for (i = 0; i < node.children.length; i++) {\n                  collected.push(this.visit(node.children[i], value));\n              }\n              return collected;\n            case \"MultiSelectHash\":\n              if (value === null) {\n                return null;\n              }\n              collected = {};\n              var child;\n              for (i = 0; i < node.children.length; i++) {\n                child = node.children[i];\n                collected[child.name] = this.visit(child.value, value);\n              }\n              return collected;\n            case \"OrExpression\":\n              matched = this.visit(node.children[0], value);\n              if (isFalse(matched)) {\n                  matched = this.visit(node.children[1], value);\n              }\n              return matched;\n            case \"AndExpression\":\n              first = this.visit(node.children[0], value);\n\n              if (isFalse(first) === true) {\n                return first;\n              }\n              return this.visit(node.children[1], value);\n            case \"NotExpression\":\n              first = this.visit(node.children[0], value);\n              return isFalse(first);\n            case \"Literal\":\n              return node.value;\n            case TOK_PIPE:\n              left = this.visit(node.children[0], value);\n              return this.visit(node.children[1], left);\n            case TOK_CURRENT:\n              return value;\n            case \"Function\":\n              var resolvedArgs = [];\n              for (i = 0; i < node.children.length; i++) {\n                  resolvedArgs.push(this.visit(node.children[i], value));\n              }\n              return this.runtime.callFunction(node.name, resolvedArgs);\n            case \"ExpressionReference\":\n              var refNode = node.children[0];\n              refNode.jmespathType = TOK_EXPREF;\n              return refNode;\n            default:\n              throw new Error(\"Unknown node type: \" + node.type);\n          }\n      },\n\n      computeSliceParams: function(arrayLength, sliceParams) {\n        var start = sliceParams[0];\n        var stop = sliceParams[1];\n        var step = sliceParams[2];\n        var computed = [null, null, null];\n        if (step === null) {\n          step = 1;\n        } else if (step === 0) {\n          var error = new Error(\"Invalid slice, step cannot be 0\");\n          error.name = \"RuntimeError\";\n          throw error;\n        }\n        var stepValueNegative = step < 0 ? true : false;\n\n        if (start === null) {\n            start = stepValueNegative ? arrayLength - 1 : 0;\n        } else {\n            start = this.capSliceRange(arrayLength, start, step);\n        }\n\n        if (stop === null) {\n            stop = stepValueNegative ? -1 : arrayLength;\n        } else {\n            stop = this.capSliceRange(arrayLength, stop, step);\n        }\n        computed[0] = start;\n        computed[1] = stop;\n        computed[2] = step;\n        return computed;\n      },\n\n      capSliceRange: function(arrayLength, actualValue, step) {\n          if (actualValue < 0) {\n              actualValue += arrayLength;\n              if (actualValue < 0) {\n                  actualValue = step < 0 ? -1 : 0;\n              }\n          } else if (actualValue >= arrayLength) {\n              actualValue = step < 0 ? arrayLength - 1 : arrayLength;\n          }\n          return actualValue;\n      }\n\n  };\n\n  function Runtime(interpreter) {\n    this._interpreter = interpreter;\n    this.functionTable = {\n        abs: {_func: this._functionAbs, _signature: [{types: [TYPE_NUMBER]}]},\n        avg: {_func: this._functionAvg, _signature: [{types: [TYPE_ARRAY_NUMBER]}]},\n        ceil: {_func: this._functionCeil, _signature: [{types: [TYPE_NUMBER]}]},\n        contains: {\n            _func: this._functionContains,\n            _signature: [{types: [TYPE_STRING, TYPE_ARRAY]},\n                        {types: [TYPE_ANY]}]},\n        \"ends_with\": {\n            _func: this._functionEndsWith,\n            _signature: [{types: [TYPE_STRING]}, {types: [TYPE_STRING]}]},\n        floor: {_func: this._functionFloor, _signature: [{types: [TYPE_NUMBER]}]},\n        length: {\n            _func: this._functionLength,\n            _signature: [{types: [TYPE_STRING, TYPE_ARRAY, TYPE_OBJECT]}]},\n        map: {\n            _func: this._functionMap,\n            _signature: [{types: [TYPE_EXPREF]}, {types: [TYPE_ARRAY]}]},\n        max: {\n            _func: this._functionMax,\n            _signature: [{types: [TYPE_ARRAY_NUMBER, TYPE_ARRAY_STRING]}]},\n        \"merge\": {\n            _func: this._functionMerge,\n            _signature: [{types: [TYPE_OBJECT], variadic: true}]\n        },\n        \"max_by\": {\n          _func: this._functionMaxBy,\n          _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]\n        },\n        sum: {_func: this._functionSum, _signature: [{types: [TYPE_ARRAY_NUMBER]}]},\n        \"starts_with\": {\n            _func: this._functionStartsWith,\n            _signature: [{types: [TYPE_STRING]}, {types: [TYPE_STRING]}]},\n        min: {\n            _func: this._functionMin,\n            _signature: [{types: [TYPE_ARRAY_NUMBER, TYPE_ARRAY_STRING]}]},\n        \"min_by\": {\n          _func: this._functionMinBy,\n          _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]\n        },\n        type: {_func: this._functionType, _signature: [{types: [TYPE_ANY]}]},\n        keys: {_func: this._functionKeys, _signature: [{types: [TYPE_OBJECT]}]},\n        values: {_func: this._functionValues, _signature: [{types: [TYPE_OBJECT]}]},\n        sort: {_func: this._functionSort, _signature: [{types: [TYPE_ARRAY_STRING, TYPE_ARRAY_NUMBER]}]},\n        \"sort_by\": {\n          _func: this._functionSortBy,\n          _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]\n        },\n        join: {\n            _func: this._functionJoin,\n            _signature: [\n                {types: [TYPE_STRING]},\n                {types: [TYPE_ARRAY_STRING]}\n            ]\n        },\n        reverse: {\n            _func: this._functionReverse,\n            _signature: [{types: [TYPE_STRING, TYPE_ARRAY]}]},\n        \"to_array\": {_func: this._functionToArray, _signature: [{types: [TYPE_ANY]}]},\n        \"to_string\": {_func: this._functionToString, _signature: [{types: [TYPE_ANY]}]},\n        \"to_number\": {_func: this._functionToNumber, _signature: [{types: [TYPE_ANY]}]},\n        \"not_null\": {\n            _func: this._functionNotNull,\n            _signature: [{types: [TYPE_ANY], variadic: true}]\n        }\n    };\n  }\n\n  Runtime.prototype = {\n    callFunction: function(name, resolvedArgs) {\n      var functionEntry = this.functionTable[name];\n      if (functionEntry === undefined) {\n          throw new Error(\"Unknown function: \" + name + \"()\");\n      }\n      this._validateArgs(name, resolvedArgs, functionEntry._signature);\n      return functionEntry._func.call(this, resolvedArgs);\n    },\n\n    _validateArgs: function(name, args, signature) {\n        var pluralized;\n        if (signature[signature.length - 1].variadic) {\n            if (args.length < signature.length) {\n                pluralized = signature.length === 1 ? \" argument\" : \" arguments\";\n                throw new Error(\"ArgumentError: \" + name + \"() \" +\n                                \"takes at least\" + signature.length + pluralized +\n                                \" but received \" + args.length);\n            }\n        } else if (args.length !== signature.length) {\n            pluralized = signature.length === 1 ? \" argument\" : \" arguments\";\n            throw new Error(\"ArgumentError: \" + name + \"() \" +\n                            \"takes \" + signature.length + pluralized +\n                            \" but received \" + args.length);\n        }\n        var currentSpec;\n        var actualType;\n        var typeMatched;\n        for (var i = 0; i < signature.length; i++) {\n            typeMatched = false;\n            currentSpec = signature[i].types;\n            actualType = this._getTypeName(args[i]);\n            for (var j = 0; j < currentSpec.length; j++) {\n                if (this._typeMatches(actualType, currentSpec[j], args[i])) {\n                    typeMatched = true;\n                    break;\n                }\n            }\n            if (!typeMatched) {\n                throw new Error(\"TypeError: \" + name + \"() \" +\n                                \"expected argument \" + (i + 1) +\n                                \" to be type \" + currentSpec +\n                                \" but received type \" + actualType +\n                                \" instead.\");\n            }\n        }\n    },\n\n    _typeMatches: function(actual, expected, argValue) {\n        if (expected === TYPE_ANY) {\n            return true;\n        }\n        if (expected === TYPE_ARRAY_STRING ||\n            expected === TYPE_ARRAY_NUMBER ||\n            expected === TYPE_ARRAY) {\n            if (expected === TYPE_ARRAY) {\n                return actual === TYPE_ARRAY;\n            } else if (actual === TYPE_ARRAY) {\n                var subtype;\n                if (expected === TYPE_ARRAY_NUMBER) {\n                  subtype = TYPE_NUMBER;\n                } else if (expected === TYPE_ARRAY_STRING) {\n                  subtype = TYPE_STRING;\n                }\n                for (var i = 0; i < argValue.length; i++) {\n                    if (!this._typeMatches(\n                            this._getTypeName(argValue[i]), subtype,\n                                             argValue[i])) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        } else {\n            return actual === expected;\n        }\n    },\n    _getTypeName: function(obj) {\n        switch (Object.prototype.toString.call(obj)) {\n            case \"[object String]\":\n              return TYPE_STRING;\n            case \"[object Number]\":\n              return TYPE_NUMBER;\n            case \"[object Array]\":\n              return TYPE_ARRAY;\n            case \"[object Boolean]\":\n              return TYPE_BOOLEAN;\n            case \"[object Null]\":\n              return TYPE_NULL;\n            case \"[object Object]\":\n              if (obj.jmespathType === TOK_EXPREF) {\n                return TYPE_EXPREF;\n              } else {\n                return TYPE_OBJECT;\n              }\n        }\n    },\n\n    _functionStartsWith: function(resolvedArgs) {\n        return resolvedArgs[0].lastIndexOf(resolvedArgs[1]) === 0;\n    },\n\n    _functionEndsWith: function(resolvedArgs) {\n        var searchStr = resolvedArgs[0];\n        var suffix = resolvedArgs[1];\n        return searchStr.indexOf(suffix, searchStr.length - suffix.length) !== -1;\n    },\n\n    _functionReverse: function(resolvedArgs) {\n        var typeName = this._getTypeName(resolvedArgs[0]);\n        if (typeName === TYPE_STRING) {\n          var originalStr = resolvedArgs[0];\n          var reversedStr = \"\";\n          for (var i = originalStr.length - 1; i >= 0; i--) {\n              reversedStr += originalStr[i];\n          }\n          return reversedStr;\n        } else {\n          var reversedArray = resolvedArgs[0].slice(0);\n          reversedArray.reverse();\n          return reversedArray;\n        }\n    },\n\n    _functionAbs: function(resolvedArgs) {\n      return Math.abs(resolvedArgs[0]);\n    },\n\n    _functionCeil: function(resolvedArgs) {\n        return Math.ceil(resolvedArgs[0]);\n    },\n\n    _functionAvg: function(resolvedArgs) {\n        var sum = 0;\n        var inputArray = resolvedArgs[0];\n        for (var i = 0; i < inputArray.length; i++) {\n            sum += inputArray[i];\n        }\n        return sum / inputArray.length;\n    },\n\n    _functionContains: function(resolvedArgs) {\n        return resolvedArgs[0].indexOf(resolvedArgs[1]) >= 0;\n    },\n\n    _functionFloor: function(resolvedArgs) {\n        return Math.floor(resolvedArgs[0]);\n    },\n\n    _functionLength: function(resolvedArgs) {\n       if (!isObject(resolvedArgs[0])) {\n         return resolvedArgs[0].length;\n       } else {\n         return Object.keys(resolvedArgs[0]).length;\n       }\n    },\n\n    _functionMap: function(resolvedArgs) {\n      var mapped = [];\n      var interpreter = this._interpreter;\n      var exprefNode = resolvedArgs[0];\n      var elements = resolvedArgs[1];\n      for (var i = 0; i < elements.length; i++) {\n          mapped.push(interpreter.visit(exprefNode, elements[i]));\n      }\n      return mapped;\n    },\n\n    _functionMerge: function(resolvedArgs) {\n      var merged = {};\n      for (var i = 0; i < resolvedArgs.length; i++) {\n        var current = resolvedArgs[i];\n        for (var key in current) {\n          merged[key] = current[key];\n        }\n      }\n      return merged;\n    },\n\n    _functionMax: function(resolvedArgs) {\n      if (resolvedArgs[0].length > 0) {\n        var typeName = this._getTypeName(resolvedArgs[0][0]);\n        if (typeName === TYPE_NUMBER) {\n          return Math.max.apply(Math, resolvedArgs[0]);\n        } else {\n          var elements = resolvedArgs[0];\n          var maxElement = elements[0];\n          for (var i = 1; i < elements.length; i++) {\n              if (maxElement.localeCompare(elements[i]) < 0) {\n                  maxElement = elements[i];\n              }\n          }\n          return maxElement;\n        }\n      } else {\n          return null;\n      }\n    },\n\n    _functionMin: function(resolvedArgs) {\n      if (resolvedArgs[0].length > 0) {\n        var typeName = this._getTypeName(resolvedArgs[0][0]);\n        if (typeName === TYPE_NUMBER) {\n          return Math.min.apply(Math, resolvedArgs[0]);\n        } else {\n          var elements = resolvedArgs[0];\n          var minElement = elements[0];\n          for (var i = 1; i < elements.length; i++) {\n              if (elements[i].localeCompare(minElement) < 0) {\n                  minElement = elements[i];\n              }\n          }\n          return minElement;\n        }\n      } else {\n        return null;\n      }\n    },\n\n    _functionSum: function(resolvedArgs) {\n      var sum = 0;\n      var listToSum = resolvedArgs[0];\n      for (var i = 0; i < listToSum.length; i++) {\n        sum += listToSum[i];\n      }\n      return sum;\n    },\n\n    _functionType: function(resolvedArgs) {\n        switch (this._getTypeName(resolvedArgs[0])) {\n          case TYPE_NUMBER:\n            return \"number\";\n          case TYPE_STRING:\n            return \"string\";\n          case TYPE_ARRAY:\n            return \"array\";\n          case TYPE_OBJECT:\n            return \"object\";\n          case TYPE_BOOLEAN:\n            return \"boolean\";\n          case TYPE_EXPREF:\n            return \"expref\";\n          case TYPE_NULL:\n            return \"null\";\n        }\n    },\n\n    _functionKeys: function(resolvedArgs) {\n        return Object.keys(resolvedArgs[0]);\n    },\n\n    _functionValues: function(resolvedArgs) {\n        var obj = resolvedArgs[0];\n        var keys = Object.keys(obj);\n        var values = [];\n        for (var i = 0; i < keys.length; i++) {\n            values.push(obj[keys[i]]);\n        }\n        return values;\n    },\n\n    _functionJoin: function(resolvedArgs) {\n        var joinChar = resolvedArgs[0];\n        var listJoin = resolvedArgs[1];\n        return listJoin.join(joinChar);\n    },\n\n    _functionToArray: function(resolvedArgs) {\n        if (this._getTypeName(resolvedArgs[0]) === TYPE_ARRAY) {\n            return resolvedArgs[0];\n        } else {\n            return [resolvedArgs[0]];\n        }\n    },\n\n    _functionToString: function(resolvedArgs) {\n        if (this._getTypeName(resolvedArgs[0]) === TYPE_STRING) {\n            return resolvedArgs[0];\n        } else {\n            return JSON.stringify(resolvedArgs[0]);\n        }\n    },\n\n    _functionToNumber: function(resolvedArgs) {\n        var typeName = this._getTypeName(resolvedArgs[0]);\n        var convertedValue;\n        if (typeName === TYPE_NUMBER) {\n            return resolvedArgs[0];\n        } else if (typeName === TYPE_STRING) {\n            convertedValue = +resolvedArgs[0];\n            if (!isNaN(convertedValue)) {\n                return convertedValue;\n            }\n        }\n        return null;\n    },\n\n    _functionNotNull: function(resolvedArgs) {\n        for (var i = 0; i < resolvedArgs.length; i++) {\n            if (this._getTypeName(resolvedArgs[i]) !== TYPE_NULL) {\n                return resolvedArgs[i];\n            }\n        }\n        return null;\n    },\n\n    _functionSort: function(resolvedArgs) {\n        var sortedArray = resolvedArgs[0].slice(0);\n        sortedArray.sort();\n        return sortedArray;\n    },\n\n    _functionSortBy: function(resolvedArgs) {\n        var sortedArray = resolvedArgs[0].slice(0);\n        if (sortedArray.length === 0) {\n            return sortedArray;\n        }\n        var interpreter = this._interpreter;\n        var exprefNode = resolvedArgs[1];\n        var requiredType = this._getTypeName(\n            interpreter.visit(exprefNode, sortedArray[0]));\n        if ([TYPE_NUMBER, TYPE_STRING].indexOf(requiredType) < 0) {\n            throw new Error(\"TypeError\");\n        }\n        var that = this;\n        var decorated = [];\n        for (var i = 0; i < sortedArray.length; i++) {\n          decorated.push([i, sortedArray[i]]);\n        }\n        decorated.sort(function(a, b) {\n          var exprA = interpreter.visit(exprefNode, a[1]);\n          var exprB = interpreter.visit(exprefNode, b[1]);\n          if (that._getTypeName(exprA) !== requiredType) {\n              throw new Error(\n                  \"TypeError: expected \" + requiredType + \", received \" +\n                  that._getTypeName(exprA));\n          } else if (that._getTypeName(exprB) !== requiredType) {\n              throw new Error(\n                  \"TypeError: expected \" + requiredType + \", received \" +\n                  that._getTypeName(exprB));\n          }\n          if (exprA > exprB) {\n            return 1;\n          } else if (exprA < exprB) {\n            return -1;\n          } else {\n            return a[0] - b[0];\n          }\n        });\n        for (var j = 0; j < decorated.length; j++) {\n          sortedArray[j] = decorated[j][1];\n        }\n        return sortedArray;\n    },\n\n    _functionMaxBy: function(resolvedArgs) {\n      var exprefNode = resolvedArgs[1];\n      var resolvedArray = resolvedArgs[0];\n      var keyFunction = this.createKeyFunction(exprefNode, [TYPE_NUMBER, TYPE_STRING]);\n      var maxNumber = -Infinity;\n      var maxRecord;\n      var current;\n      for (var i = 0; i < resolvedArray.length; i++) {\n        current = keyFunction(resolvedArray[i]);\n        if (current > maxNumber) {\n          maxNumber = current;\n          maxRecord = resolvedArray[i];\n        }\n      }\n      return maxRecord;\n    },\n\n    _functionMinBy: function(resolvedArgs) {\n      var exprefNode = resolvedArgs[1];\n      var resolvedArray = resolvedArgs[0];\n      var keyFunction = this.createKeyFunction(exprefNode, [TYPE_NUMBER, TYPE_STRING]);\n      var minNumber = Infinity;\n      var minRecord;\n      var current;\n      for (var i = 0; i < resolvedArray.length; i++) {\n        current = keyFunction(resolvedArray[i]);\n        if (current < minNumber) {\n          minNumber = current;\n          minRecord = resolvedArray[i];\n        }\n      }\n      return minRecord;\n    },\n\n    createKeyFunction: function(exprefNode, allowedTypes) {\n      var that = this;\n      var interpreter = this._interpreter;\n      var keyFunc = function(x) {\n        var current = interpreter.visit(exprefNode, x);\n        if (allowedTypes.indexOf(that._getTypeName(current)) < 0) {\n          var msg = \"TypeError: expected one of \" + allowedTypes +\n                    \", received \" + that._getTypeName(current);\n          throw new Error(msg);\n        }\n        return current;\n      };\n      return keyFunc;\n    }\n\n  };\n\n  function compile(stream) {\n    var parser = new Parser();\n    var ast = parser.parse(stream);\n    return ast;\n  }\n\n  function tokenize(stream) {\n      var lexer = new Lexer();\n      return lexer.tokenize(stream);\n  }\n\n  function search(data, expression) {\n      var parser = new Parser();\n      var runtime = new Runtime();\n      var interpreter = new TreeInterpreter(runtime);\n      runtime._interpreter = interpreter;\n      var node = parser.parse(expression);\n      return interpreter.search(node, data);\n  }\n\n  exports.tokenize = tokenize;\n  exports.compile = compile;\n  exports.search = search;\n  exports.strictDeepEqual = strictDeepEqual;\n})(typeof exports === \"undefined\" ? this.jmespath = {} : exports);\n\n},{}],80:[function(require,module,exports){\n\n'use strict';\n\nfunction hasOwnProperty(obj, prop) {\n  return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n  sep = sep || '&';\n  eq = eq || '=';\n  var obj = {};\n\n  if (typeof qs !== 'string' || qs.length === 0) {\n    return obj;\n  }\n\n  var regexp = /\\+/g;\n  qs = qs.split(sep);\n\n  var maxKeys = 1000;\n  if (options && typeof options.maxKeys === 'number') {\n    maxKeys = options.maxKeys;\n  }\n\n  var len = qs.length;\n  if (maxKeys > 0 && len > maxKeys) {\n    len = maxKeys;\n  }\n\n  for (var i = 0; i < len; ++i) {\n    var x = qs[i].replace(regexp, '%20'),\n        idx = x.indexOf(eq),\n        kstr, vstr, k, v;\n\n    if (idx >= 0) {\n      kstr = x.substr(0, idx);\n      vstr = x.substr(idx + 1);\n    } else {\n      kstr = x;\n      vstr = '';\n    }\n\n    k = decodeURIComponent(kstr);\n    v = decodeURIComponent(vstr);\n\n    if (!hasOwnProperty(obj, k)) {\n      obj[k] = v;\n    } else if (Array.isArray(obj[k])) {\n      obj[k].push(v);\n    } else {\n      obj[k] = [obj[k], v];\n    }\n  }\n\n  return obj;\n};\n\n},{}],81:[function(require,module,exports){\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n  switch (typeof v) {\n    case 'string':\n      return v;\n\n    case 'boolean':\n      return v ? 'true' : 'false';\n\n    case 'number':\n      return isFinite(v) ? v : '';\n\n    default:\n      return '';\n  }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n  sep = sep || '&';\n  eq = eq || '=';\n  if (obj === null) {\n    obj = undefined;\n  }\n\n  if (typeof obj === 'object') {\n    return Object.keys(obj).map(function(k) {\n      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n      if (Array.isArray(obj[k])) {\n        return obj[k].map(function(v) {\n          return ks + encodeURIComponent(stringifyPrimitive(v));\n        }).join(sep);\n      } else {\n        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n      }\n    }).join(sep);\n\n  }\n\n  if (!name) return '';\n  return encodeURIComponent(stringifyPrimitive(name)) + eq +\n         encodeURIComponent(stringifyPrimitive(obj));\n};\n\n},{}],82:[function(require,module,exports){\narguments[4][66][0].apply(exports,arguments)\n},{\"./decode\":80,\"./encode\":81}],83:[function(require,module,exports){\n\nvar punycode = require('punycode');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n  this.protocol = null;\n  this.slashes = null;\n  this.auth = null;\n  this.host = null;\n  this.port = null;\n  this.hostname = null;\n  this.hash = null;\n  this.search = null;\n  this.query = null;\n  this.pathname = null;\n  this.path = null;\n  this.href = null;\n}\n\n\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n    portPattern = /:[0-9]*$/,\n\n    delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n    unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n    autoEscape = ['\\''].concat(unwise),\n    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n    hostEndingChars = ['/', '?', '#'],\n    hostnameMaxLen = 255,\n    hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/,\n    hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/,\n    unsafeProtocol = {\n      'javascript': true,\n      'javascript:': true\n    },\n    hostlessProtocol = {\n      'javascript': true,\n      'javascript:': true\n    },\n    slashedProtocol = {\n      'http': true,\n      'https': true,\n      'ftp': true,\n      'gopher': true,\n      'file': true,\n      'http:': true,\n      'https:': true,\n      'ftp:': true,\n      'gopher:': true,\n      'file:': true\n    },\n    querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n  if (url && isObject(url) && url instanceof Url) return url;\n\n  var u = new Url;\n  u.parse(url, parseQueryString, slashesDenoteHost);\n  return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n  if (!isString(url)) {\n    throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n  }\n\n  var rest = url;\n\n  rest = rest.trim();\n\n  var proto = protocolPattern.exec(rest);\n  if (proto) {\n    proto = proto[0];\n    var lowerProto = proto.toLowerCase();\n    this.protocol = lowerProto;\n    rest = rest.substr(proto.length);\n  }\n\n  if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n    var slashes = rest.substr(0, 2) === '//';\n    if (slashes && !(proto && hostlessProtocol[proto])) {\n      rest = rest.substr(2);\n      this.slashes = true;\n    }\n  }\n\n  if (!hostlessProtocol[proto] &&\n      (slashes || (proto && !slashedProtocol[proto]))) {\n\n\n\n    var hostEnd = -1;\n    for (var i = 0; i < hostEndingChars.length; i++) {\n      var hec = rest.indexOf(hostEndingChars[i]);\n      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n        hostEnd = hec;\n    }\n\n    var auth, atSign;\n    if (hostEnd === -1) {\n      atSign = rest.lastIndexOf('@');\n    } else {\n      atSign = rest.lastIndexOf('@', hostEnd);\n    }\n\n    if (atSign !== -1) {\n      auth = rest.slice(0, atSign);\n      rest = rest.slice(atSign + 1);\n      this.auth = decodeURIComponent(auth);\n    }\n\n    hostEnd = -1;\n    for (var i = 0; i < nonHostChars.length; i++) {\n      var hec = rest.indexOf(nonHostChars[i]);\n      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n        hostEnd = hec;\n    }\n    if (hostEnd === -1)\n      hostEnd = rest.length;\n\n    this.host = rest.slice(0, hostEnd);\n    rest = rest.slice(hostEnd);\n\n    this.parseHost();\n\n    this.hostname = this.hostname || '';\n\n    var ipv6Hostname = this.hostname[0] === '[' &&\n        this.hostname[this.hostname.length - 1] === ']';\n\n    if (!ipv6Hostname) {\n      var hostparts = this.hostname.split(/\\./);\n      for (var i = 0, l = hostparts.length; i < l; i++) {\n        var part = hostparts[i];\n        if (!part) continue;\n        if (!part.match(hostnamePartPattern)) {\n          var newpart = '';\n          for (var j = 0, k = part.length; j < k; j++) {\n            if (part.charCodeAt(j) > 127) {\n              newpart += 'x';\n            } else {\n              newpart += part[j];\n            }\n          }\n          if (!newpart.match(hostnamePartPattern)) {\n            var validParts = hostparts.slice(0, i);\n            var notHost = hostparts.slice(i + 1);\n            var bit = part.match(hostnamePartStart);\n            if (bit) {\n              validParts.push(bit[1]);\n              notHost.unshift(bit[2]);\n            }\n            if (notHost.length) {\n              rest = '/' + notHost.join('.') + rest;\n            }\n            this.hostname = validParts.join('.');\n            break;\n          }\n        }\n      }\n    }\n\n    if (this.hostname.length > hostnameMaxLen) {\n      this.hostname = '';\n    } else {\n      this.hostname = this.hostname.toLowerCase();\n    }\n\n    if (!ipv6Hostname) {\n      var domainArray = this.hostname.split('.');\n      var newOut = [];\n      for (var i = 0; i < domainArray.length; ++i) {\n        var s = domainArray[i];\n        newOut.push(s.match(/[^A-Za-z0-9_-]/) ?\n            'xn--' + punycode.encode(s) : s);\n      }\n      this.hostname = newOut.join('.');\n    }\n\n    var p = this.port ? ':' + this.port : '';\n    var h = this.hostname || '';\n    this.host = h + p;\n    this.href += this.host;\n\n    if (ipv6Hostname) {\n      this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n      if (rest[0] !== '/') {\n        rest = '/' + rest;\n      }\n    }\n  }\n\n  if (!unsafeProtocol[lowerProto]) {\n\n    for (var i = 0, l = autoEscape.length; i < l; i++) {\n      var ae = autoEscape[i];\n      var esc = encodeURIComponent(ae);\n      if (esc === ae) {\n        esc = escape(ae);\n      }\n      rest = rest.split(ae).join(esc);\n    }\n  }\n\n\n  var hash = rest.indexOf('#');\n  if (hash !== -1) {\n    this.hash = rest.substr(hash);\n    rest = rest.slice(0, hash);\n  }\n  var qm = rest.indexOf('?');\n  if (qm !== -1) {\n    this.search = rest.substr(qm);\n    this.query = rest.substr(qm + 1);\n    if (parseQueryString) {\n      this.query = querystring.parse(this.query);\n    }\n    rest = rest.slice(0, qm);\n  } else if (parseQueryString) {\n    this.search = '';\n    this.query = {};\n  }\n  if (rest) this.pathname = rest;\n  if (slashedProtocol[lowerProto] &&\n      this.hostname && !this.pathname) {\n    this.pathname = '/';\n  }\n\n  if (this.pathname || this.search) {\n    var p = this.pathname || '';\n    var s = this.search || '';\n    this.path = p + s;\n  }\n\n  this.href = this.format();\n  return this;\n};\n\nfunction urlFormat(obj) {\n  if (isString(obj)) obj = urlParse(obj);\n  if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n  return obj.format();\n}\n\nUrl.prototype.format = function() {\n  var auth = this.auth || '';\n  if (auth) {\n    auth = encodeURIComponent(auth);\n    auth = auth.replace(/%3A/i, ':');\n    auth += '@';\n  }\n\n  var protocol = this.protocol || '',\n      pathname = this.pathname || '',\n      hash = this.hash || '',\n      host = false,\n      query = '';\n\n  if (this.host) {\n    host = auth + this.host;\n  } else if (this.hostname) {\n    host = auth + (this.hostname.indexOf(':') === -1 ?\n        this.hostname :\n        '[' + this.hostname + ']');\n    if (this.port) {\n      host += ':' + this.port;\n    }\n  }\n\n  if (this.query &&\n      isObject(this.query) &&\n      Object.keys(this.query).length) {\n    query = querystring.stringify(this.query);\n  }\n\n  var search = this.search || (query && ('?' + query)) || '';\n\n  if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n  if (this.slashes ||\n      (!protocol || slashedProtocol[protocol]) && host !== false) {\n    host = '//' + (host || '');\n    if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n  } else if (!host) {\n    host = '';\n  }\n\n  if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n  if (search && search.charAt(0) !== '?') search = '?' + search;\n\n  pathname = pathname.replace(/[?#]/g, function(match) {\n    return encodeURIComponent(match);\n  });\n  search = search.replace('#', '%23');\n\n  return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n  return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n  return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n  if (!source) return relative;\n  return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n  if (isString(relative)) {\n    var rel = new Url();\n    rel.parse(relative, false, true);\n    relative = rel;\n  }\n\n  var result = new Url();\n  Object.keys(this).forEach(function(k) {\n    result[k] = this[k];\n  }, this);\n\n  result.hash = relative.hash;\n\n  if (relative.href === '') {\n    result.href = result.format();\n    return result;\n  }\n\n  if (relative.slashes && !relative.protocol) {\n    Object.keys(relative).forEach(function(k) {\n      if (k !== 'protocol')\n        result[k] = relative[k];\n    });\n\n    if (slashedProtocol[result.protocol] &&\n        result.hostname && !result.pathname) {\n      result.path = result.pathname = '/';\n    }\n\n    result.href = result.format();\n    return result;\n  }\n\n  if (relative.protocol && relative.protocol !== result.protocol) {\n    if (!slashedProtocol[relative.protocol]) {\n      Object.keys(relative).forEach(function(k) {\n        result[k] = relative[k];\n      });\n      result.href = result.format();\n      return result;\n    }\n\n    result.protocol = relative.protocol;\n    if (!relative.host && !hostlessProtocol[relative.protocol]) {\n      var relPath = (relative.pathname || '').split('/');\n      while (relPath.length && !(relative.host = relPath.shift()));\n      if (!relative.host) relative.host = '';\n      if (!relative.hostname) relative.hostname = '';\n      if (relPath[0] !== '') relPath.unshift('');\n      if (relPath.length < 2) relPath.unshift('');\n      result.pathname = relPath.join('/');\n    } else {\n      result.pathname = relative.pathname;\n    }\n    result.search = relative.search;\n    result.query = relative.query;\n    result.host = relative.host || '';\n    result.auth = relative.auth;\n    result.hostname = relative.hostname || relative.host;\n    result.port = relative.port;\n    if (result.pathname || result.search) {\n      var p = result.pathname || '';\n      var s = result.search || '';\n      result.path = p + s;\n    }\n    result.slashes = result.slashes || relative.slashes;\n    result.href = result.format();\n    return result;\n  }\n\n  var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n      isRelAbs = (\n          relative.host ||\n          relative.pathname && relative.pathname.charAt(0) === '/'\n      ),\n      mustEndAbs = (isRelAbs || isSourceAbs ||\n                    (result.host && relative.pathname)),\n      removeAllDots = mustEndAbs,\n      srcPath = result.pathname && result.pathname.split('/') || [],\n      relPath = relative.pathname && relative.pathname.split('/') || [],\n      psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n  if (psychotic) {\n    result.hostname = '';\n    result.port = null;\n    if (result.host) {\n      if (srcPath[0] === '') srcPath[0] = result.host;\n      else srcPath.unshift(result.host);\n    }\n    result.host = '';\n    if (relative.protocol) {\n      relative.hostname = null;\n      relative.port = null;\n      if (relative.host) {\n        if (relPath[0] === '') relPath[0] = relative.host;\n        else relPath.unshift(relative.host);\n      }\n      relative.host = null;\n    }\n    mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n  }\n\n  if (isRelAbs) {\n    result.host = (relative.host || relative.host === '') ?\n                  relative.host : result.host;\n    result.hostname = (relative.hostname || relative.hostname === '') ?\n                      relative.hostname : result.hostname;\n    result.search = relative.search;\n    result.query = relative.query;\n    srcPath = relPath;\n  } else if (relPath.length) {\n    if (!srcPath) srcPath = [];\n    srcPath.pop();\n    srcPath = srcPath.concat(relPath);\n    result.search = relative.search;\n    result.query = relative.query;\n  } else if (!isNullOrUndefined(relative.search)) {\n    if (psychotic) {\n      result.hostname = result.host = srcPath.shift();\n      var authInHost = result.host && result.host.indexOf('@') > 0 ?\n                       result.host.split('@') : false;\n      if (authInHost) {\n        result.auth = authInHost.shift();\n        result.host = result.hostname = authInHost.shift();\n      }\n    }\n    result.search = relative.search;\n    result.query = relative.query;\n    if (!isNull(result.pathname) || !isNull(result.search)) {\n      result.path = (result.pathname ? result.pathname : '') +\n                    (result.search ? result.search : '');\n    }\n    result.href = result.format();\n    return result;\n  }\n\n  if (!srcPath.length) {\n    result.pathname = null;\n    if (result.search) {\n      result.path = '/' + result.search;\n    } else {\n      result.path = null;\n    }\n    result.href = result.format();\n    return result;\n  }\n\n  var last = srcPath.slice(-1)[0];\n  var hasTrailingSlash = (\n      (result.host || relative.host) && (last === '.' || last === '..') ||\n      last === '');\n\n  var up = 0;\n  for (var i = srcPath.length; i >= 0; i--) {\n    last = srcPath[i];\n    if (last == '.') {\n      srcPath.splice(i, 1);\n    } else if (last === '..') {\n      srcPath.splice(i, 1);\n      up++;\n    } else if (up) {\n      srcPath.splice(i, 1);\n      up--;\n    }\n  }\n\n  if (!mustEndAbs && !removeAllDots) {\n    for (; up--; up) {\n      srcPath.unshift('..');\n    }\n  }\n\n  if (mustEndAbs && srcPath[0] !== '' &&\n      (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n    srcPath.unshift('');\n  }\n\n  if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n    srcPath.push('');\n  }\n\n  var isAbsolute = srcPath[0] === '' ||\n      (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n  if (psychotic) {\n    result.hostname = result.host = isAbsolute ? '' :\n                                    srcPath.length ? srcPath.shift() : '';\n    var authInHost = result.host && result.host.indexOf('@') > 0 ?\n                     result.host.split('@') : false;\n    if (authInHost) {\n      result.auth = authInHost.shift();\n      result.host = result.hostname = authInHost.shift();\n    }\n  }\n\n  mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n  if (mustEndAbs && !isAbsolute) {\n    srcPath.unshift('');\n  }\n\n  if (!srcPath.length) {\n    result.pathname = null;\n    result.path = null;\n  } else {\n    result.pathname = srcPath.join('/');\n  }\n\n  if (!isNull(result.pathname) || !isNull(result.search)) {\n    result.path = (result.pathname ? result.pathname : '') +\n                  (result.search ? result.search : '');\n  }\n  result.auth = relative.auth || result.auth;\n  result.slashes = result.slashes || relative.slashes;\n  result.href = result.format();\n  return result;\n};\n\nUrl.prototype.parseHost = function() {\n  var host = this.host;\n  var port = portPattern.exec(host);\n  if (port) {\n    port = port[0];\n    if (port !== ':') {\n      this.port = port.substr(1);\n    }\n    host = host.substr(0, host.length - port.length);\n  }\n  if (host) this.hostname = host;\n};\n\nfunction isString(arg) {\n  return typeof arg === \"string\";\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isNull(arg) {\n  return arg === null;\n}\nfunction isNullOrUndefined(arg) {\n  return  arg == null;\n}\n\n},{\"punycode\":63,\"querystring\":66}],84:[function(require,module,exports){\n(function() {\n  var XMLAttribute, create;\n\n  create = require('lodash/object/create');\n\n  module.exports = XMLAttribute = (function() {\n    function XMLAttribute(parent, name, value) {\n      this.stringify = parent.stringify;\n      if (name == null) {\n        throw new Error(\"Missing attribute name of element \" + parent.name);\n      }\n      if (value == null) {\n        throw new Error(\"Missing attribute value for attribute \" + name + \" of element \" + parent.name);\n      }\n      this.name = this.stringify.attName(name);\n      this.value = this.stringify.attValue(value);\n    }\n\n    XMLAttribute.prototype.clone = function() {\n      return create(XMLAttribute.prototype, this);\n    };\n\n    XMLAttribute.prototype.toString = function(options, level) {\n      return ' ' + this.name + '=\"' + this.value + '\"';\n    };\n\n    return XMLAttribute;\n\n  })();\n\n}).call(this);\n\n},{\"lodash/object/create\":143}],85:[function(require,module,exports){\n(function() {\n  var XMLBuilder, XMLDeclaration, XMLDocType, XMLElement, XMLStringifier;\n\n  XMLStringifier = require('./XMLStringifier');\n\n  XMLDeclaration = require('./XMLDeclaration');\n\n  XMLDocType = require('./XMLDocType');\n\n  XMLElement = require('./XMLElement');\n\n  module.exports = XMLBuilder = (function() {\n    function XMLBuilder(name, options) {\n      var root, temp;\n      if (name == null) {\n        throw new Error(\"Root element needs a name\");\n      }\n      if (options == null) {\n        options = {};\n      }\n      this.options = options;\n      this.stringify = new XMLStringifier(options);\n      temp = new XMLElement(this, 'doc');\n      root = temp.element(name);\n      root.isRoot = true;\n      root.documentObject = this;\n      this.rootObject = root;\n      if (!options.headless) {\n        root.declaration(options);\n        if ((options.pubID != null) || (options.sysID != null)) {\n          root.doctype(options);\n        }\n      }\n    }\n\n    XMLBuilder.prototype.root = function() {\n      return this.rootObject;\n    };\n\n    XMLBuilder.prototype.end = function(options) {\n      return this.toString(options);\n    };\n\n    XMLBuilder.prototype.toString = function(options) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      r = '';\n      if (this.xmldec != null) {\n        r += this.xmldec.toString(options);\n      }\n      if (this.doctype != null) {\n        r += this.doctype.toString(options);\n      }\n      r += this.rootObject.toString(options);\n      if (pretty && r.slice(-newline.length) === newline) {\n        r = r.slice(0, -newline.length);\n      }\n      return r;\n    };\n\n    return XMLBuilder;\n\n  })();\n\n}).call(this);\n\n},{\"./XMLDeclaration\":92,\"./XMLDocType\":93,\"./XMLElement\":94,\"./XMLStringifier\":98}],86:[function(require,module,exports){\n(function() {\n  var XMLCData, XMLNode, create,\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n    hasProp = {}.hasOwnProperty;\n\n  create = require('lodash/object/create');\n\n  XMLNode = require('./XMLNode');\n\n  module.exports = XMLCData = (function(superClass) {\n    extend(XMLCData, superClass);\n\n    function XMLCData(parent, text) {\n      XMLCData.__super__.constructor.call(this, parent);\n      if (text == null) {\n        throw new Error(\"Missing CDATA text\");\n      }\n      this.text = this.stringify.cdata(text);\n    }\n\n    XMLCData.prototype.clone = function() {\n      return create(XMLCData.prototype, this);\n    };\n\n    XMLCData.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<![CDATA[' + this.text + ']]>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLCData;\n\n  })(XMLNode);\n\n}).call(this);\n\n},{\"./XMLNode\":95,\"lodash/object/create\":143}],87:[function(require,module,exports){\n(function() {\n  var XMLComment, XMLNode, create,\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n    hasProp = {}.hasOwnProperty;\n\n  create = require('lodash/object/create');\n\n  XMLNode = require('./XMLNode');\n\n  module.exports = XMLComment = (function(superClass) {\n    extend(XMLComment, superClass);\n\n    function XMLComment(parent, text) {\n      XMLComment.__super__.constructor.call(this, parent);\n      if (text == null) {\n        throw new Error(\"Missing comment text\");\n      }\n      this.text = this.stringify.comment(text);\n    }\n\n    XMLComment.prototype.clone = function() {\n      return create(XMLComment.prototype, this);\n    };\n\n    XMLComment.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<!-- ' + this.text + ' -->';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLComment;\n\n  })(XMLNode);\n\n}).call(this);\n\n},{\"./XMLNode\":95,\"lodash/object/create\":143}],88:[function(require,module,exports){\n(function() {\n  var XMLDTDAttList, create;\n\n  create = require('lodash/object/create');\n\n  module.exports = XMLDTDAttList = (function() {\n    function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n      this.stringify = parent.stringify;\n      if (elementName == null) {\n        throw new Error(\"Missing DTD element name\");\n      }\n      if (attributeName == null) {\n        throw new Error(\"Missing DTD attribute name\");\n      }\n      if (!attributeType) {\n        throw new Error(\"Missing DTD attribute type\");\n      }\n      if (!defaultValueType) {\n        throw new Error(\"Missing DTD attribute default\");\n      }\n      if (defaultValueType.indexOf('#') !== 0) {\n        defaultValueType = '#' + defaultValueType;\n      }\n      if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {\n        throw new Error(\"Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT\");\n      }\n      if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {\n        throw new Error(\"Default value only applies to #FIXED or #DEFAULT\");\n      }\n      this.elementName = this.stringify.eleName(elementName);\n      this.attributeName = this.stringify.attName(attributeName);\n      this.attributeType = this.stringify.dtdAttType(attributeType);\n      this.defaultValue = this.stringify.dtdAttDefault(defaultValue);\n      this.defaultValueType = defaultValueType;\n    }\n\n    XMLDTDAttList.prototype.clone = function() {\n      return create(XMLDTDAttList.prototype, this);\n    };\n\n    XMLDTDAttList.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<!ATTLIST ' + this.elementName + ' ' + this.attributeName + ' ' + this.attributeType;\n      if (this.defaultValueType !== '#DEFAULT') {\n        r += ' ' + this.defaultValueType;\n      }\n      if (this.defaultValue) {\n        r += ' \"' + this.defaultValue + '\"';\n      }\n      r += '>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLDTDAttList;\n\n  })();\n\n}).call(this);\n\n},{\"lodash/object/create\":143}],89:[function(require,module,exports){\n(function() {\n  var XMLDTDElement, create, isArray;\n\n  create = require('lodash/object/create');\n\n  isArray = require('lodash/lang/isArray');\n\n  module.exports = XMLDTDElement = (function() {\n    function XMLDTDElement(parent, name, value) {\n      this.stringify = parent.stringify;\n      if (name == null) {\n        throw new Error(\"Missing DTD element name\");\n      }\n      if (!value) {\n        value = '(#PCDATA)';\n      }\n      if (isArray(value)) {\n        value = '(' + value.join(',') + ')';\n      }\n      this.name = this.stringify.eleName(name);\n      this.value = this.stringify.dtdElementValue(value);\n    }\n\n    XMLDTDElement.prototype.clone = function() {\n      return create(XMLDTDElement.prototype, this);\n    };\n\n    XMLDTDElement.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<!ELEMENT ' + this.name + ' ' + this.value + '>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLDTDElement;\n\n  })();\n\n}).call(this);\n\n},{\"lodash/lang/isArray\":135,\"lodash/object/create\":143}],90:[function(require,module,exports){\n(function() {\n  var XMLDTDEntity, create, isObject;\n\n  create = require('lodash/object/create');\n\n  isObject = require('lodash/lang/isObject');\n\n  module.exports = XMLDTDEntity = (function() {\n    function XMLDTDEntity(parent, pe, name, value) {\n      this.stringify = parent.stringify;\n      if (name == null) {\n        throw new Error(\"Missing entity name\");\n      }\n      if (value == null) {\n        throw new Error(\"Missing entity value\");\n      }\n      this.pe = !!pe;\n      this.name = this.stringify.eleName(name);\n      if (!isObject(value)) {\n        this.value = this.stringify.dtdEntityValue(value);\n      } else {\n        if (!value.pubID && !value.sysID) {\n          throw new Error(\"Public and/or system identifiers are required for an external entity\");\n        }\n        if (value.pubID && !value.sysID) {\n          throw new Error(\"System identifier is required for a public external entity\");\n        }\n        if (value.pubID != null) {\n          this.pubID = this.stringify.dtdPubID(value.pubID);\n        }\n        if (value.sysID != null) {\n          this.sysID = this.stringify.dtdSysID(value.sysID);\n        }\n        if (value.nData != null) {\n          this.nData = this.stringify.dtdNData(value.nData);\n        }\n        if (this.pe && this.nData) {\n          throw new Error(\"Notation declaration is not allowed in a parameter entity\");\n        }\n      }\n    }\n\n    XMLDTDEntity.prototype.clone = function() {\n      return create(XMLDTDEntity.prototype, this);\n    };\n\n    XMLDTDEntity.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<!ENTITY';\n      if (this.pe) {\n        r += ' %';\n      }\n      r += ' ' + this.name;\n      if (this.value) {\n        r += ' \"' + this.value + '\"';\n      } else {\n        if (this.pubID && this.sysID) {\n          r += ' PUBLIC \"' + this.pubID + '\" \"' + this.sysID + '\"';\n        } else if (this.sysID) {\n          r += ' SYSTEM \"' + this.sysID + '\"';\n        }\n        if (this.nData) {\n          r += ' NDATA ' + this.nData;\n        }\n      }\n      r += '>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLDTDEntity;\n\n  })();\n\n}).call(this);\n\n},{\"lodash/lang/isObject\":139,\"lodash/object/create\":143}],91:[function(require,module,exports){\n(function() {\n  var XMLDTDNotation, create;\n\n  create = require('lodash/object/create');\n\n  module.exports = XMLDTDNotation = (function() {\n    function XMLDTDNotation(parent, name, value) {\n      this.stringify = parent.stringify;\n      if (name == null) {\n        throw new Error(\"Missing notation name\");\n      }\n      if (!value.pubID && !value.sysID) {\n        throw new Error(\"Public or system identifiers are required for an external entity\");\n      }\n      this.name = this.stringify.eleName(name);\n      if (value.pubID != null) {\n        this.pubID = this.stringify.dtdPubID(value.pubID);\n      }\n      if (value.sysID != null) {\n        this.sysID = this.stringify.dtdSysID(value.sysID);\n      }\n    }\n\n    XMLDTDNotation.prototype.clone = function() {\n      return create(XMLDTDNotation.prototype, this);\n    };\n\n    XMLDTDNotation.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<!NOTATION ' + this.name;\n      if (this.pubID && this.sysID) {\n        r += ' PUBLIC \"' + this.pubID + '\" \"' + this.sysID + '\"';\n      } else if (this.pubID) {\n        r += ' PUBLIC \"' + this.pubID + '\"';\n      } else if (this.sysID) {\n        r += ' SYSTEM \"' + this.sysID + '\"';\n      }\n      r += '>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLDTDNotation;\n\n  })();\n\n}).call(this);\n\n},{\"lodash/object/create\":143}],92:[function(require,module,exports){\n(function() {\n  var XMLDeclaration, XMLNode, create, isObject,\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n    hasProp = {}.hasOwnProperty;\n\n  create = require('lodash/object/create');\n\n  isObject = require('lodash/lang/isObject');\n\n  XMLNode = require('./XMLNode');\n\n  module.exports = XMLDeclaration = (function(superClass) {\n    extend(XMLDeclaration, superClass);\n\n    function XMLDeclaration(parent, version, encoding, standalone) {\n      var ref;\n      XMLDeclaration.__super__.constructor.call(this, parent);\n      if (isObject(version)) {\n        ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;\n      }\n      if (!version) {\n        version = '1.0';\n      }\n      if (version != null) {\n        this.version = this.stringify.xmlVersion(version);\n      }\n      if (encoding != null) {\n        this.encoding = this.stringify.xmlEncoding(encoding);\n      }\n      if (standalone != null) {\n        this.standalone = this.stringify.xmlStandalone(standalone);\n      }\n    }\n\n    XMLDeclaration.prototype.clone = function() {\n      return create(XMLDeclaration.prototype, this);\n    };\n\n    XMLDeclaration.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<?xml';\n      if (this.version != null) {\n        r += ' version=\"' + this.version + '\"';\n      }\n      if (this.encoding != null) {\n        r += ' encoding=\"' + this.encoding + '\"';\n      }\n      if (this.standalone != null) {\n        r += ' standalone=\"' + this.standalone + '\"';\n      }\n      r += '?>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLDeclaration;\n\n  })(XMLNode);\n\n}).call(this);\n\n},{\"./XMLNode\":95,\"lodash/lang/isObject\":139,\"lodash/object/create\":143}],93:[function(require,module,exports){\n(function() {\n  var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLProcessingInstruction, create, isObject;\n\n  create = require('lodash/object/create');\n\n  isObject = require('lodash/lang/isObject');\n\n  XMLCData = require('./XMLCData');\n\n  XMLComment = require('./XMLComment');\n\n  XMLDTDAttList = require('./XMLDTDAttList');\n\n  XMLDTDEntity = require('./XMLDTDEntity');\n\n  XMLDTDElement = require('./XMLDTDElement');\n\n  XMLDTDNotation = require('./XMLDTDNotation');\n\n  XMLProcessingInstruction = require('./XMLProcessingInstruction');\n\n  module.exports = XMLDocType = (function() {\n    function XMLDocType(parent, pubID, sysID) {\n      var ref, ref1;\n      this.documentObject = parent;\n      this.stringify = this.documentObject.stringify;\n      this.children = [];\n      if (isObject(pubID)) {\n        ref = pubID, pubID = ref.pubID, sysID = ref.sysID;\n      }\n      if (sysID == null) {\n        ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];\n      }\n      if (pubID != null) {\n        this.pubID = this.stringify.dtdPubID(pubID);\n      }\n      if (sysID != null) {\n        this.sysID = this.stringify.dtdSysID(sysID);\n      }\n    }\n\n    XMLDocType.prototype.clone = function() {\n      return create(XMLDocType.prototype, this);\n    };\n\n    XMLDocType.prototype.element = function(name, value) {\n      var child;\n      child = new XMLDTDElement(this, name, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n      var child;\n      child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.entity = function(name, value) {\n      var child;\n      child = new XMLDTDEntity(this, false, name, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.pEntity = function(name, value) {\n      var child;\n      child = new XMLDTDEntity(this, true, name, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.notation = function(name, value) {\n      var child;\n      child = new XMLDTDNotation(this, name, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.cdata = function(value) {\n      var child;\n      child = new XMLCData(this, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.comment = function(value) {\n      var child;\n      child = new XMLComment(this, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.instruction = function(target, value) {\n      var child;\n      child = new XMLProcessingInstruction(this, target, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLDocType.prototype.root = function() {\n      return this.documentObject.root();\n    };\n\n    XMLDocType.prototype.document = function() {\n      return this.documentObject;\n    };\n\n    XMLDocType.prototype.toString = function(options, level) {\n      var child, i, indent, len, newline, offset, pretty, r, ref, ref1, ref2, ref3, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<!DOCTYPE ' + this.root().name;\n      if (this.pubID && this.sysID) {\n        r += ' PUBLIC \"' + this.pubID + '\" \"' + this.sysID + '\"';\n      } else if (this.sysID) {\n        r += ' SYSTEM \"' + this.sysID + '\"';\n      }\n      if (this.children.length > 0) {\n        r += ' [';\n        if (pretty) {\n          r += newline;\n        }\n        ref3 = this.children;\n        for (i = 0, len = ref3.length; i < len; i++) {\n          child = ref3[i];\n          r += child.toString(options, level + 1);\n        }\n        r += ']';\n      }\n      r += '>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    XMLDocType.prototype.ele = function(name, value) {\n      return this.element(name, value);\n    };\n\n    XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n      return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n    };\n\n    XMLDocType.prototype.ent = function(name, value) {\n      return this.entity(name, value);\n    };\n\n    XMLDocType.prototype.pent = function(name, value) {\n      return this.pEntity(name, value);\n    };\n\n    XMLDocType.prototype.not = function(name, value) {\n      return this.notation(name, value);\n    };\n\n    XMLDocType.prototype.dat = function(value) {\n      return this.cdata(value);\n    };\n\n    XMLDocType.prototype.com = function(value) {\n      return this.comment(value);\n    };\n\n    XMLDocType.prototype.ins = function(target, value) {\n      return this.instruction(target, value);\n    };\n\n    XMLDocType.prototype.up = function() {\n      return this.root();\n    };\n\n    XMLDocType.prototype.doc = function() {\n      return this.document();\n    };\n\n    return XMLDocType;\n\n  })();\n\n}).call(this);\n\n},{\"./XMLCData\":86,\"./XMLComment\":87,\"./XMLDTDAttList\":88,\"./XMLDTDElement\":89,\"./XMLDTDEntity\":90,\"./XMLDTDNotation\":91,\"./XMLProcessingInstruction\":96,\"lodash/lang/isObject\":139,\"lodash/object/create\":143}],94:[function(require,module,exports){\n(function() {\n  var XMLAttribute, XMLElement, XMLNode, XMLProcessingInstruction, create, every, isArray, isFunction, isObject,\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n    hasProp = {}.hasOwnProperty;\n\n  create = require('lodash/object/create');\n\n  isObject = require('lodash/lang/isObject');\n\n  isArray = require('lodash/lang/isArray');\n\n  isFunction = require('lodash/lang/isFunction');\n\n  every = require('lodash/collection/every');\n\n  XMLNode = require('./XMLNode');\n\n  XMLAttribute = require('./XMLAttribute');\n\n  XMLProcessingInstruction = require('./XMLProcessingInstruction');\n\n  module.exports = XMLElement = (function(superClass) {\n    extend(XMLElement, superClass);\n\n    function XMLElement(parent, name, attributes) {\n      XMLElement.__super__.constructor.call(this, parent);\n      if (name == null) {\n        throw new Error(\"Missing element name\");\n      }\n      this.name = this.stringify.eleName(name);\n      this.children = [];\n      this.instructions = [];\n      this.attributes = {};\n      if (attributes != null) {\n        this.attribute(attributes);\n      }\n    }\n\n    XMLElement.prototype.clone = function() {\n      var att, attName, clonedSelf, i, len, pi, ref, ref1;\n      clonedSelf = create(XMLElement.prototype, this);\n      if (clonedSelf.isRoot) {\n        clonedSelf.documentObject = null;\n      }\n      clonedSelf.attributes = {};\n      ref = this.attributes;\n      for (attName in ref) {\n        if (!hasProp.call(ref, attName)) continue;\n        att = ref[attName];\n        clonedSelf.attributes[attName] = att.clone();\n      }\n      clonedSelf.instructions = [];\n      ref1 = this.instructions;\n      for (i = 0, len = ref1.length; i < len; i++) {\n        pi = ref1[i];\n        clonedSelf.instructions.push(pi.clone());\n      }\n      clonedSelf.children = [];\n      this.children.forEach(function(child) {\n        var clonedChild;\n        clonedChild = child.clone();\n        clonedChild.parent = clonedSelf;\n        return clonedSelf.children.push(clonedChild);\n      });\n      return clonedSelf;\n    };\n\n    XMLElement.prototype.attribute = function(name, value) {\n      var attName, attValue;\n      if (name != null) {\n        name = name.valueOf();\n      }\n      if (isObject(name)) {\n        for (attName in name) {\n          if (!hasProp.call(name, attName)) continue;\n          attValue = name[attName];\n          this.attribute(attName, attValue);\n        }\n      } else {\n        if (isFunction(value)) {\n          value = value.apply();\n        }\n        if (!this.options.skipNullAttributes || (value != null)) {\n          this.attributes[name] = new XMLAttribute(this, name, value);\n        }\n      }\n      return this;\n    };\n\n    XMLElement.prototype.removeAttribute = function(name) {\n      var attName, i, len;\n      if (name == null) {\n        throw new Error(\"Missing attribute name\");\n      }\n      name = name.valueOf();\n      if (isArray(name)) {\n        for (i = 0, len = name.length; i < len; i++) {\n          attName = name[i];\n          delete this.attributes[attName];\n        }\n      } else {\n        delete this.attributes[name];\n      }\n      return this;\n    };\n\n    XMLElement.prototype.instruction = function(target, value) {\n      var i, insTarget, insValue, instruction, len;\n      if (target != null) {\n        target = target.valueOf();\n      }\n      if (value != null) {\n        value = value.valueOf();\n      }\n      if (isArray(target)) {\n        for (i = 0, len = target.length; i < len; i++) {\n          insTarget = target[i];\n          this.instruction(insTarget);\n        }\n      } else if (isObject(target)) {\n        for (insTarget in target) {\n          if (!hasProp.call(target, insTarget)) continue;\n          insValue = target[insTarget];\n          this.instruction(insTarget, insValue);\n        }\n      } else {\n        if (isFunction(value)) {\n          value = value.apply();\n        }\n        instruction = new XMLProcessingInstruction(this, target, value);\n        this.instructions.push(instruction);\n      }\n      return this;\n    };\n\n    XMLElement.prototype.toString = function(options, level) {\n      var att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      ref3 = this.instructions;\n      for (i = 0, len = ref3.length; i < len; i++) {\n        instruction = ref3[i];\n        r += instruction.toString(options, level + 1);\n      }\n      if (pretty) {\n        r += space;\n      }\n      r += '<' + this.name;\n      ref4 = this.attributes;\n      for (name in ref4) {\n        if (!hasProp.call(ref4, name)) continue;\n        att = ref4[name];\n        r += att.toString(options);\n      }\n      if (this.children.length === 0 || every(this.children, function(e) {\n        return e.value === '';\n      })) {\n        r += '/>';\n        if (pretty) {\n          r += newline;\n        }\n      } else if (pretty && this.children.length === 1 && (this.children[0].value != null)) {\n        r += '>';\n        r += this.children[0].value;\n        r += '</' + this.name + '>';\n        r += newline;\n      } else {\n        r += '>';\n        if (pretty) {\n          r += newline;\n        }\n        ref5 = this.children;\n        for (j = 0, len1 = ref5.length; j < len1; j++) {\n          child = ref5[j];\n          r += child.toString(options, level + 1);\n        }\n        if (pretty) {\n          r += space;\n        }\n        r += '</' + this.name + '>';\n        if (pretty) {\n          r += newline;\n        }\n      }\n      return r;\n    };\n\n    XMLElement.prototype.att = function(name, value) {\n      return this.attribute(name, value);\n    };\n\n    XMLElement.prototype.ins = function(target, value) {\n      return this.instruction(target, value);\n    };\n\n    XMLElement.prototype.a = function(name, value) {\n      return this.attribute(name, value);\n    };\n\n    XMLElement.prototype.i = function(target, value) {\n      return this.instruction(target, value);\n    };\n\n    return XMLElement;\n\n  })(XMLNode);\n\n}).call(this);\n\n},{\"./XMLAttribute\":84,\"./XMLNode\":95,\"./XMLProcessingInstruction\":96,\"lodash/collection/every\":101,\"lodash/lang/isArray\":135,\"lodash/lang/isFunction\":137,\"lodash/lang/isObject\":139,\"lodash/object/create\":143}],95:[function(require,module,exports){\n(function() {\n  var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLRaw, XMLText, isArray, isEmpty, isFunction, isObject,\n    hasProp = {}.hasOwnProperty;\n\n  isObject = require('lodash/lang/isObject');\n\n  isArray = require('lodash/lang/isArray');\n\n  isFunction = require('lodash/lang/isFunction');\n\n  isEmpty = require('lodash/lang/isEmpty');\n\n  XMLElement = null;\n\n  XMLCData = null;\n\n  XMLComment = null;\n\n  XMLDeclaration = null;\n\n  XMLDocType = null;\n\n  XMLRaw = null;\n\n  XMLText = null;\n\n  module.exports = XMLNode = (function() {\n    function XMLNode(parent) {\n      this.parent = parent;\n      this.options = this.parent.options;\n      this.stringify = this.parent.stringify;\n      if (XMLElement === null) {\n        XMLElement = require('./XMLElement');\n        XMLCData = require('./XMLCData');\n        XMLComment = require('./XMLComment');\n        XMLDeclaration = require('./XMLDeclaration');\n        XMLDocType = require('./XMLDocType');\n        XMLRaw = require('./XMLRaw');\n        XMLText = require('./XMLText');\n      }\n    }\n\n    XMLNode.prototype.clone = function() {\n      throw new Error(\"Cannot clone generic XMLNode\");\n    };\n\n    XMLNode.prototype.element = function(name, attributes, text) {\n      var item, j, key, lastChild, len, ref, val;\n      lastChild = null;\n      if (attributes == null) {\n        attributes = {};\n      }\n      attributes = attributes.valueOf();\n      if (!isObject(attributes)) {\n        ref = [attributes, text], text = ref[0], attributes = ref[1];\n      }\n      if (name != null) {\n        name = name.valueOf();\n      }\n      if (isArray(name)) {\n        for (j = 0, len = name.length; j < len; j++) {\n          item = name[j];\n          lastChild = this.element(item);\n        }\n      } else if (isFunction(name)) {\n        lastChild = this.element(name.apply());\n      } else if (isObject(name)) {\n        for (key in name) {\n          if (!hasProp.call(name, key)) continue;\n          val = name[key];\n          if (isFunction(val)) {\n            val = val.apply();\n          }\n          if ((isObject(val)) && (isEmpty(val))) {\n            val = null;\n          }\n          if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {\n            lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);\n          } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && key.indexOf(this.stringify.convertPIKey) === 0) {\n            lastChild = this.instruction(key.substr(this.stringify.convertPIKey.length), val);\n          } else if (isObject(val)) {\n            if (!this.options.ignoreDecorators && this.stringify.convertListKey && key.indexOf(this.stringify.convertListKey) === 0 && isArray(val)) {\n              lastChild = this.element(val);\n            } else {\n              lastChild = this.element(key);\n              lastChild.element(val);\n            }\n          } else {\n            lastChild = this.element(key, val);\n          }\n        }\n      } else {\n        if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {\n          lastChild = this.text(text);\n        } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {\n          lastChild = this.cdata(text);\n        } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {\n          lastChild = this.comment(text);\n        } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {\n          lastChild = this.raw(text);\n        } else {\n          lastChild = this.node(name, attributes, text);\n        }\n      }\n      if (lastChild == null) {\n        throw new Error(\"Could not create any elements with: \" + name);\n      }\n      return lastChild;\n    };\n\n    XMLNode.prototype.insertBefore = function(name, attributes, text) {\n      var child, i, removed;\n      if (this.isRoot) {\n        throw new Error(\"Cannot insert elements at root level\");\n      }\n      i = this.parent.children.indexOf(this);\n      removed = this.parent.children.splice(i);\n      child = this.parent.element(name, attributes, text);\n      Array.prototype.push.apply(this.parent.children, removed);\n      return child;\n    };\n\n    XMLNode.prototype.insertAfter = function(name, attributes, text) {\n      var child, i, removed;\n      if (this.isRoot) {\n        throw new Error(\"Cannot insert elements at root level\");\n      }\n      i = this.parent.children.indexOf(this);\n      removed = this.parent.children.splice(i + 1);\n      child = this.parent.element(name, attributes, text);\n      Array.prototype.push.apply(this.parent.children, removed);\n      return child;\n    };\n\n    XMLNode.prototype.remove = function() {\n      var i, ref;\n      if (this.isRoot) {\n        throw new Error(\"Cannot remove the root element\");\n      }\n      i = this.parent.children.indexOf(this);\n      [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref = [])), ref;\n      return this.parent;\n    };\n\n    XMLNode.prototype.node = function(name, attributes, text) {\n      var child, ref;\n      if (name != null) {\n        name = name.valueOf();\n      }\n      if (attributes == null) {\n        attributes = {};\n      }\n      attributes = attributes.valueOf();\n      if (!isObject(attributes)) {\n        ref = [attributes, text], text = ref[0], attributes = ref[1];\n      }\n      child = new XMLElement(this, name, attributes);\n      if (text != null) {\n        child.text(text);\n      }\n      this.children.push(child);\n      return child;\n    };\n\n    XMLNode.prototype.text = function(value) {\n      var child;\n      child = new XMLText(this, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLNode.prototype.cdata = function(value) {\n      var child;\n      child = new XMLCData(this, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLNode.prototype.comment = function(value) {\n      var child;\n      child = new XMLComment(this, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLNode.prototype.raw = function(value) {\n      var child;\n      child = new XMLRaw(this, value);\n      this.children.push(child);\n      return this;\n    };\n\n    XMLNode.prototype.declaration = function(version, encoding, standalone) {\n      var doc, xmldec;\n      doc = this.document();\n      xmldec = new XMLDeclaration(doc, version, encoding, standalone);\n      doc.xmldec = xmldec;\n      return doc.root();\n    };\n\n    XMLNode.prototype.doctype = function(pubID, sysID) {\n      var doc, doctype;\n      doc = this.document();\n      doctype = new XMLDocType(doc, pubID, sysID);\n      doc.doctype = doctype;\n      return doctype;\n    };\n\n    XMLNode.prototype.up = function() {\n      if (this.isRoot) {\n        throw new Error(\"The root node has no parent. Use doc() if you need to get the document object.\");\n      }\n      return this.parent;\n    };\n\n    XMLNode.prototype.root = function() {\n      var child;\n      if (this.isRoot) {\n        return this;\n      }\n      child = this.parent;\n      while (!child.isRoot) {\n        child = child.parent;\n      }\n      return child;\n    };\n\n    XMLNode.prototype.document = function() {\n      return this.root().documentObject;\n    };\n\n    XMLNode.prototype.end = function(options) {\n      return this.document().toString(options);\n    };\n\n    XMLNode.prototype.prev = function() {\n      var i;\n      if (this.isRoot) {\n        throw new Error(\"Root node has no siblings\");\n      }\n      i = this.parent.children.indexOf(this);\n      if (i < 1) {\n        throw new Error(\"Already at the first node\");\n      }\n      return this.parent.children[i - 1];\n    };\n\n    XMLNode.prototype.next = function() {\n      var i;\n      if (this.isRoot) {\n        throw new Error(\"Root node has no siblings\");\n      }\n      i = this.parent.children.indexOf(this);\n      if (i === -1 || i === this.parent.children.length - 1) {\n        throw new Error(\"Already at the last node\");\n      }\n      return this.parent.children[i + 1];\n    };\n\n    XMLNode.prototype.importXMLBuilder = function(xmlbuilder) {\n      var clonedRoot;\n      clonedRoot = xmlbuilder.root().clone();\n      clonedRoot.parent = this;\n      clonedRoot.isRoot = false;\n      this.children.push(clonedRoot);\n      return this;\n    };\n\n    XMLNode.prototype.ele = function(name, attributes, text) {\n      return this.element(name, attributes, text);\n    };\n\n    XMLNode.prototype.nod = function(name, attributes, text) {\n      return this.node(name, attributes, text);\n    };\n\n    XMLNode.prototype.txt = function(value) {\n      return this.text(value);\n    };\n\n    XMLNode.prototype.dat = function(value) {\n      return this.cdata(value);\n    };\n\n    XMLNode.prototype.com = function(value) {\n      return this.comment(value);\n    };\n\n    XMLNode.prototype.doc = function() {\n      return this.document();\n    };\n\n    XMLNode.prototype.dec = function(version, encoding, standalone) {\n      return this.declaration(version, encoding, standalone);\n    };\n\n    XMLNode.prototype.dtd = function(pubID, sysID) {\n      return this.doctype(pubID, sysID);\n    };\n\n    XMLNode.prototype.e = function(name, attributes, text) {\n      return this.element(name, attributes, text);\n    };\n\n    XMLNode.prototype.n = function(name, attributes, text) {\n      return this.node(name, attributes, text);\n    };\n\n    XMLNode.prototype.t = function(value) {\n      return this.text(value);\n    };\n\n    XMLNode.prototype.d = function(value) {\n      return this.cdata(value);\n    };\n\n    XMLNode.prototype.c = function(value) {\n      return this.comment(value);\n    };\n\n    XMLNode.prototype.r = function(value) {\n      return this.raw(value);\n    };\n\n    XMLNode.prototype.u = function() {\n      return this.up();\n    };\n\n    return XMLNode;\n\n  })();\n\n}).call(this);\n\n},{\"./XMLCData\":86,\"./XMLComment\":87,\"./XMLDeclaration\":92,\"./XMLDocType\":93,\"./XMLElement\":94,\"./XMLRaw\":97,\"./XMLText\":99,\"lodash/lang/isArray\":135,\"lodash/lang/isEmpty\":136,\"lodash/lang/isFunction\":137,\"lodash/lang/isObject\":139}],96:[function(require,module,exports){\n(function() {\n  var XMLProcessingInstruction, create;\n\n  create = require('lodash/object/create');\n\n  module.exports = XMLProcessingInstruction = (function() {\n    function XMLProcessingInstruction(parent, target, value) {\n      this.stringify = parent.stringify;\n      if (target == null) {\n        throw new Error(\"Missing instruction target\");\n      }\n      this.target = this.stringify.insTarget(target);\n      if (value) {\n        this.value = this.stringify.insValue(value);\n      }\n    }\n\n    XMLProcessingInstruction.prototype.clone = function() {\n      return create(XMLProcessingInstruction.prototype, this);\n    };\n\n    XMLProcessingInstruction.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += '<?';\n      r += this.target;\n      if (this.value) {\n        r += ' ' + this.value;\n      }\n      r += '?>';\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLProcessingInstruction;\n\n  })();\n\n}).call(this);\n\n},{\"lodash/object/create\":143}],97:[function(require,module,exports){\n(function() {\n  var XMLNode, XMLRaw, create,\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n    hasProp = {}.hasOwnProperty;\n\n  create = require('lodash/object/create');\n\n  XMLNode = require('./XMLNode');\n\n  module.exports = XMLRaw = (function(superClass) {\n    extend(XMLRaw, superClass);\n\n    function XMLRaw(parent, text) {\n      XMLRaw.__super__.constructor.call(this, parent);\n      if (text == null) {\n        throw new Error(\"Missing raw text\");\n      }\n      this.value = this.stringify.raw(text);\n    }\n\n    XMLRaw.prototype.clone = function() {\n      return create(XMLRaw.prototype, this);\n    };\n\n    XMLRaw.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += this.value;\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLRaw;\n\n  })(XMLNode);\n\n}).call(this);\n\n},{\"./XMLNode\":95,\"lodash/object/create\":143}],98:[function(require,module,exports){\n(function() {\n  var XMLStringifier,\n    bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n    hasProp = {}.hasOwnProperty;\n\n  module.exports = XMLStringifier = (function() {\n    function XMLStringifier(options) {\n      this.assertLegalChar = bind(this.assertLegalChar, this);\n      var key, ref, value;\n      this.allowSurrogateChars = options != null ? options.allowSurrogateChars : void 0;\n      ref = (options != null ? options.stringify : void 0) || {};\n      for (key in ref) {\n        if (!hasProp.call(ref, key)) continue;\n        value = ref[key];\n        this[key] = value;\n      }\n    }\n\n    XMLStringifier.prototype.eleName = function(val) {\n      val = '' + val || '';\n      return this.assertLegalChar(val);\n    };\n\n    XMLStringifier.prototype.eleText = function(val) {\n      val = '' + val || '';\n      return this.assertLegalChar(this.elEscape(val));\n    };\n\n    XMLStringifier.prototype.cdata = function(val) {\n      val = '' + val || '';\n      if (val.match(/]]>/)) {\n        throw new Error(\"Invalid CDATA text: \" + val);\n      }\n      return this.assertLegalChar(val);\n    };\n\n    XMLStringifier.prototype.comment = function(val) {\n      val = '' + val || '';\n      if (val.match(/--/)) {\n        throw new Error(\"Comment text cannot contain double-hypen: \" + val);\n      }\n      return this.assertLegalChar(val);\n    };\n\n    XMLStringifier.prototype.raw = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.attName = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.attValue = function(val) {\n      val = '' + val || '';\n      return this.attEscape(val);\n    };\n\n    XMLStringifier.prototype.insTarget = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.insValue = function(val) {\n      val = '' + val || '';\n      if (val.match(/\\?>/)) {\n        throw new Error(\"Invalid processing instruction value: \" + val);\n      }\n      return val;\n    };\n\n    XMLStringifier.prototype.xmlVersion = function(val) {\n      val = '' + val || '';\n      if (!val.match(/1\\.[0-9]+/)) {\n        throw new Error(\"Invalid version number: \" + val);\n      }\n      return val;\n    };\n\n    XMLStringifier.prototype.xmlEncoding = function(val) {\n      val = '' + val || '';\n      if (!val.match(/[A-Za-z](?:[A-Za-z0-9._-]|-)*/)) {\n        throw new Error(\"Invalid encoding: \" + val);\n      }\n      return val;\n    };\n\n    XMLStringifier.prototype.xmlStandalone = function(val) {\n      if (val) {\n        return \"yes\";\n      } else {\n        return \"no\";\n      }\n    };\n\n    XMLStringifier.prototype.dtdPubID = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.dtdSysID = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.dtdElementValue = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.dtdAttType = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.dtdAttDefault = function(val) {\n      if (val != null) {\n        return '' + val || '';\n      } else {\n        return val;\n      }\n    };\n\n    XMLStringifier.prototype.dtdEntityValue = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.dtdNData = function(val) {\n      return '' + val || '';\n    };\n\n    XMLStringifier.prototype.convertAttKey = '@';\n\n    XMLStringifier.prototype.convertPIKey = '?';\n\n    XMLStringifier.prototype.convertTextKey = '#text';\n\n    XMLStringifier.prototype.convertCDataKey = '#cdata';\n\n    XMLStringifier.prototype.convertCommentKey = '#comment';\n\n    XMLStringifier.prototype.convertRawKey = '#raw';\n\n    XMLStringifier.prototype.convertListKey = '#list';\n\n    XMLStringifier.prototype.assertLegalChar = function(str) {\n      var chars, chr;\n      if (this.allowSurrogateChars) {\n        chars = /[\\u0000-\\u0008\\u000B-\\u000C\\u000E-\\u001F\\uFFFE-\\uFFFF]/;\n      } else {\n        chars = /[\\u0000-\\u0008\\u000B-\\u000C\\u000E-\\u001F\\uD800-\\uDFFF\\uFFFE-\\uFFFF]/;\n      }\n      chr = str.match(chars);\n      if (chr) {\n        throw new Error(\"Invalid character (\" + chr + \") in string: \" + str + \" at index \" + chr.index);\n      }\n      return str;\n    };\n\n    XMLStringifier.prototype.elEscape = function(str) {\n      return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\\r/g, '&#xD;');\n    };\n\n    XMLStringifier.prototype.attEscape = function(str) {\n      return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\"/g, '&quot;').replace(/\\t/g, '&#x9;').replace(/\\n/g, '&#xA;').replace(/\\r/g, '&#xD;');\n    };\n\n    return XMLStringifier;\n\n  })();\n\n}).call(this);\n\n},{}],99:[function(require,module,exports){\n(function() {\n  var XMLNode, XMLText, create,\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n    hasProp = {}.hasOwnProperty;\n\n  create = require('lodash/object/create');\n\n  XMLNode = require('./XMLNode');\n\n  module.exports = XMLText = (function(superClass) {\n    extend(XMLText, superClass);\n\n    function XMLText(parent, text) {\n      XMLText.__super__.constructor.call(this, parent);\n      if (text == null) {\n        throw new Error(\"Missing element text\");\n      }\n      this.value = this.stringify.eleText(text);\n    }\n\n    XMLText.prototype.clone = function() {\n      return create(XMLText.prototype, this);\n    };\n\n    XMLText.prototype.toString = function(options, level) {\n      var indent, newline, offset, pretty, r, ref, ref1, ref2, space;\n      pretty = (options != null ? options.pretty : void 0) || false;\n      indent = (ref = options != null ? options.indent : void 0) != null ? ref : '  ';\n      offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;\n      newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\\n';\n      level || (level = 0);\n      space = new Array(level + offset + 1).join(indent);\n      r = '';\n      if (pretty) {\n        r += space;\n      }\n      r += this.value;\n      if (pretty) {\n        r += newline;\n      }\n      return r;\n    };\n\n    return XMLText;\n\n  })(XMLNode);\n\n}).call(this);\n\n},{\"./XMLNode\":95,\"lodash/object/create\":143}],100:[function(require,module,exports){\n(function() {\n  var XMLBuilder, assign;\n\n  assign = require('lodash/object/assign');\n\n  XMLBuilder = require('./XMLBuilder');\n\n  module.exports.create = function(name, xmldec, doctype, options) {\n    options = assign({}, xmldec, doctype, options);\n    return new XMLBuilder(name, options).root();\n  };\n\n}).call(this);\n\n},{\"./XMLBuilder\":85,\"lodash/object/assign\":142}],101:[function(require,module,exports){\nvar arrayEvery = require('../internal/arrayEvery'),\n    baseCallback = require('../internal/baseCallback'),\n    baseEvery = require('../internal/baseEvery'),\n    isArray = require('../lang/isArray');\n\n\nfunction every(collection, predicate, thisArg) {\n  var func = isArray(collection) ? arrayEvery : baseEvery;\n  if (typeof predicate != 'function' || typeof thisArg != 'undefined') {\n    predicate = baseCallback(predicate, thisArg, 3);\n  }\n  return func(collection, predicate);\n}\n\nmodule.exports = every;\n\n},{\"../internal/arrayEvery\":102,\"../internal/baseCallback\":104,\"../internal/baseEvery\":108,\"../lang/isArray\":135}],102:[function(require,module,exports){\n\nfunction arrayEvery(array, predicate) {\n  var index = -1,\n      length = array.length;\n\n  while (++index < length) {\n    if (!predicate(array[index], index, array)) {\n      return false;\n    }\n  }\n  return true;\n}\n\nmodule.exports = arrayEvery;\n\n},{}],103:[function(require,module,exports){\nvar baseCopy = require('./baseCopy'),\n    keys = require('../object/keys');\n\n\nfunction baseAssign(object, source, customizer) {\n  var props = keys(source);\n  if (!customizer) {\n    return baseCopy(source, object, props);\n  }\n  var index = -1,\n      length = props.length;\n\n  while (++index < length) {\n    var key = props[index],\n        value = object[key],\n        result = customizer(value, source[key], key, object, source);\n\n    if ((result === result ? (result !== value) : (value === value)) ||\n        (typeof value == 'undefined' && !(key in object))) {\n      object[key] = result;\n    }\n  }\n  return object;\n}\n\nmodule.exports = baseAssign;\n\n},{\"../object/keys\":144,\"./baseCopy\":105}],104:[function(require,module,exports){\nvar baseMatches = require('./baseMatches'),\n    baseMatchesProperty = require('./baseMatchesProperty'),\n    baseProperty = require('./baseProperty'),\n    bindCallback = require('./bindCallback'),\n    identity = require('../utility/identity'),\n    isBindable = require('./isBindable');\n\n\nfunction baseCallback(func, thisArg, argCount) {\n  var type = typeof func;\n  if (type == 'function') {\n    return (typeof thisArg != 'undefined' && isBindable(func))\n      ? bindCallback(func, thisArg, argCount)\n      : func;\n  }\n  if (func == null) {\n    return identity;\n  }\n  if (type == 'object') {\n    return baseMatches(func);\n  }\n  return typeof thisArg == 'undefined'\n    ? baseProperty(func + '')\n    : baseMatchesProperty(func + '', thisArg);\n}\n\nmodule.exports = baseCallback;\n\n},{\"../utility/identity\":148,\"./baseMatches\":115,\"./baseMatchesProperty\":116,\"./baseProperty\":117,\"./bindCallback\":120,\"./isBindable\":125}],105:[function(require,module,exports){\n\nfunction baseCopy(source, object, props) {\n  if (!props) {\n    props = object;\n    object = {};\n  }\n  var index = -1,\n      length = props.length;\n\n  while (++index < length) {\n    var key = props[index];\n    object[key] = source[key];\n  }\n  return object;\n}\n\nmodule.exports = baseCopy;\n\n},{}],106:[function(require,module,exports){\n(function (global){\nvar isObject = require('../lang/isObject');\n\n\nvar baseCreate = (function() {\n  function Object() {}\n  return function(prototype) {\n    if (isObject(prototype)) {\n      Object.prototype = prototype;\n      var result = new Object;\n      Object.prototype = null;\n    }\n    return result || global.Object();\n  };\n}());\n\nmodule.exports = baseCreate;\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../lang/isObject\":139}],107:[function(require,module,exports){\nvar baseForOwn = require('./baseForOwn'),\n    isLength = require('./isLength'),\n    toObject = require('./toObject');\n\n\nfunction baseEach(collection, iteratee) {\n  var length = collection ? collection.length : 0;\n  if (!isLength(length)) {\n    return baseForOwn(collection, iteratee);\n  }\n  var index = -1,\n      iterable = toObject(collection);\n\n  while (++index < length) {\n    if (iteratee(iterable[index], index, iterable) === false) {\n      break;\n    }\n  }\n  return collection;\n}\n\nmodule.exports = baseEach;\n\n},{\"./baseForOwn\":110,\"./isLength\":128,\"./toObject\":133}],108:[function(require,module,exports){\nvar baseEach = require('./baseEach');\n\n\nfunction baseEvery(collection, predicate) {\n  var result = true;\n  baseEach(collection, function(value, index, collection) {\n    result = !!predicate(value, index, collection);\n    return result;\n  });\n  return result;\n}\n\nmodule.exports = baseEvery;\n\n},{\"./baseEach\":107}],109:[function(require,module,exports){\nvar toObject = require('./toObject');\n\n\nfunction baseFor(object, iteratee, keysFunc) {\n  var index = -1,\n      iterable = toObject(object),\n      props = keysFunc(object),\n      length = props.length;\n\n  while (++index < length) {\n    var key = props[index];\n    if (iteratee(iterable[key], key, iterable) === false) {\n      break;\n    }\n  }\n  return object;\n}\n\nmodule.exports = baseFor;\n\n},{\"./toObject\":133}],110:[function(require,module,exports){\nvar baseFor = require('./baseFor'),\n    keys = require('../object/keys');\n\n\nfunction baseForOwn(object, iteratee) {\n  return baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n\n},{\"../object/keys\":144,\"./baseFor\":109}],111:[function(require,module,exports){\nvar baseIsEqualDeep = require('./baseIsEqualDeep');\n\n\nfunction baseIsEqual(value, other, customizer, isWhere, stackA, stackB) {\n  if (value === other) {\n    return value !== 0 || (1 / value == 1 / other);\n  }\n  var valType = typeof value,\n      othType = typeof other;\n\n  if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') ||\n      value == null || other == null) {\n    return value !== value && other !== other;\n  }\n  return baseIsEqualDeep(value, other, baseIsEqual, customizer, isWhere, stackA, stackB);\n}\n\nmodule.exports = baseIsEqual;\n\n},{\"./baseIsEqualDeep\":112}],112:[function(require,module,exports){\nvar equalArrays = require('./equalArrays'),\n    equalByTag = require('./equalByTag'),\n    equalObjects = require('./equalObjects'),\n    isArray = require('../lang/isArray'),\n    isTypedArray = require('../lang/isTypedArray');\n\n\nvar argsTag = '[object Arguments]',\n    arrayTag = '[object Array]',\n    objectTag = '[object Object]';\n\n\nvar objectProto = Object.prototype;\n\n\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\nvar objToString = objectProto.toString;\n\n\nfunction baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) {\n  var objIsArr = isArray(object),\n      othIsArr = isArray(other),\n      objTag = arrayTag,\n      othTag = arrayTag;\n\n  if (!objIsArr) {\n    objTag = objToString.call(object);\n    if (objTag == argsTag) {\n      objTag = objectTag;\n    } else if (objTag != objectTag) {\n      objIsArr = isTypedArray(object);\n    }\n  }\n  if (!othIsArr) {\n    othTag = objToString.call(other);\n    if (othTag == argsTag) {\n      othTag = objectTag;\n    } else if (othTag != objectTag) {\n      othIsArr = isTypedArray(other);\n    }\n  }\n  var objIsObj = objTag == objectTag,\n      othIsObj = othTag == objectTag,\n      isSameTag = objTag == othTag;\n\n  if (isSameTag && !(objIsArr || objIsObj)) {\n    return equalByTag(object, other, objTag);\n  }\n  var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n      othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n  if (valWrapped || othWrapped) {\n    return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isWhere, stackA, stackB);\n  }\n  if (!isSameTag) {\n    return false;\n  }\n  stackA || (stackA = []);\n  stackB || (stackB = []);\n\n  var length = stackA.length;\n  while (length--) {\n    if (stackA[length] == object) {\n      return stackB[length] == other;\n    }\n  }\n  stackA.push(object);\n  stackB.push(other);\n\n  var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB);\n\n  stackA.pop();\n  stackB.pop();\n\n  return result;\n}\n\nmodule.exports = baseIsEqualDeep;\n\n},{\"../lang/isArray\":135,\"../lang/isTypedArray\":141,\"./equalArrays\":122,\"./equalByTag\":123,\"./equalObjects\":124}],113:[function(require,module,exports){\n\nfunction baseIsFunction(value) {\n  return typeof value == 'function' || false;\n}\n\nmodule.exports = baseIsFunction;\n\n},{}],114:[function(require,module,exports){\nvar baseIsEqual = require('./baseIsEqual');\n\n\nvar objectProto = Object.prototype;\n\n\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\nfunction baseIsMatch(object, props, values, strictCompareFlags, customizer) {\n  var length = props.length;\n  if (object == null) {\n    return !length;\n  }\n  var index = -1,\n      noCustomizer = !customizer;\n\n  while (++index < length) {\n    if ((noCustomizer && strictCompareFlags[index])\n          ? values[index] !== object[props[index]]\n          : !hasOwnProperty.call(object, props[index])\n        ) {\n      return false;\n    }\n  }\n  index = -1;\n  while (++index < length) {\n    var key = props[index];\n    if (noCustomizer && strictCompareFlags[index]) {\n      var result = hasOwnProperty.call(object, key);\n    } else {\n      var objValue = object[key],\n          srcValue = values[index];\n\n      result = customizer ? customizer(objValue, srcValue, key) : undefined;\n      if (typeof result == 'undefined') {\n        result = baseIsEqual(srcValue, objValue, customizer, true);\n      }\n    }\n    if (!result) {\n      return false;\n    }\n  }\n  return true;\n}\n\nmodule.exports = baseIsMatch;\n\n},{\"./baseIsEqual\":111}],115:[function(require,module,exports){\nvar baseIsMatch = require('./baseIsMatch'),\n    isStrictComparable = require('./isStrictComparable'),\n    keys = require('../object/keys');\n\n\nvar objectProto = Object.prototype;\n\n\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\nfunction baseMatches(source) {\n  var props = keys(source),\n      length = props.length;\n\n  if (length == 1) {\n    var key = props[0],\n        value = source[key];\n\n    if (isStrictComparable(value)) {\n      return function(object) {\n        return object != null && object[key] === value && hasOwnProperty.call(object, key);\n      };\n    }\n  }\n  var values = Array(length),\n      strictCompareFlags = Array(length);\n\n  while (length--) {\n    value = source[props[length]];\n    values[length] = value;\n    strictCompareFlags[length] = isStrictComparable(value);\n  }\n  return function(object) {\n    return baseIsMatch(object, props, values, strictCompareFlags);\n  };\n}\n\nmodule.exports = baseMatches;\n\n},{\"../object/keys\":144,\"./baseIsMatch\":114,\"./isStrictComparable\":130}],116:[function(require,module,exports){\nvar baseIsEqual = require('./baseIsEqual'),\n    isStrictComparable = require('./isStrictComparable');\n\n\nfunction baseMatchesProperty(key, value) {\n  if (isStrictComparable(value)) {\n    return function(object) {\n      return object != null && object[key] === value;\n    };\n  }\n  return function(object) {\n    return object != null && baseIsEqual(value, object[key], null, true);\n  };\n}\n\nmodule.exports = baseMatchesProperty;\n\n},{\"./baseIsEqual\":111,\"./isStrictComparable\":130}],117:[function(require,module,exports){\n\nfunction baseProperty(key) {\n  return function(object) {\n    return object == null ? undefined : object[key];\n  };\n}\n\nmodule.exports = baseProperty;\n\n},{}],118:[function(require,module,exports){\nvar identity = require('../utility/identity'),\n    metaMap = require('./metaMap');\n\n\nvar baseSetData = !metaMap ? identity : function(func, data) {\n  metaMap.set(func, data);\n  return func;\n};\n\nmodule.exports = baseSetData;\n\n},{\"../utility/identity\":148,\"./metaMap\":131}],119:[function(require,module,exports){\n\nfunction baseToString(value) {\n  if (typeof value == 'string') {\n    return value;\n  }\n  return value == null ? '' : (value + '');\n}\n\nmodule.exports = baseToString;\n\n},{}],120:[function(require,module,exports){\nvar identity = require('../utility/identity');\n\n\nfunction bindCallback(func, thisArg, argCount) {\n  if (typeof func != 'function') {\n    return identity;\n  }\n  if (typeof thisArg == 'undefined') {\n    return func;\n  }\n  switch (argCount) {\n    case 1: return function(value) {\n      return func.call(thisArg, value);\n    };\n    case 3: return function(value, index, collection) {\n      return func.call(thisArg, value, index, collection);\n    };\n    case 4: return function(accumulator, value, index, collection) {\n      return func.call(thisArg, accumulator, value, index, collection);\n    };\n    case 5: return function(value, other, key, object, source) {\n      return func.call(thisArg, value, other, key, object, source);\n    };\n  }\n  return function() {\n    return func.apply(thisArg, arguments);\n  };\n}\n\nmodule.exports = bindCallback;\n\n},{\"../utility/identity\":148}],121:[function(require,module,exports){\nvar bindCallback = require('./bindCallback'),\n    isIterateeCall = require('./isIterateeCall');\n\n\nfunction createAssigner(assigner) {\n  return function() {\n    var args = arguments,\n        length = args.length,\n        object = args[0];\n\n    if (length < 2 || object == null) {\n      return object;\n    }\n    var customizer = args[length - 2],\n        thisArg = args[length - 1],\n        guard = args[3];\n\n    if (length > 3 && typeof customizer == 'function') {\n      customizer = bindCallback(customizer, thisArg, 5);\n      length -= 2;\n    } else {\n      customizer = (length > 2 && typeof thisArg == 'function') ? thisArg : null;\n      length -= (customizer ? 1 : 0);\n    }\n    if (guard && isIterateeCall(args[1], args[2], guard)) {\n      customizer = length == 3 ? null : customizer;\n      length = 2;\n    }\n    var index = 0;\n    while (++index < length) {\n      var source = args[index];\n      if (source) {\n        assigner(object, source, customizer);\n      }\n    }\n    return object;\n  };\n}\n\nmodule.exports = createAssigner;\n\n},{\"./bindCallback\":120,\"./isIterateeCall\":127}],122:[function(require,module,exports){\n\nfunction equalArrays(array, other, equalFunc, customizer, isWhere, stackA, stackB) {\n  var index = -1,\n      arrLength = array.length,\n      othLength = other.length,\n      result = true;\n\n  if (arrLength != othLength && !(isWhere && othLength > arrLength)) {\n    return false;\n  }\n  while (result && ++index < arrLength) {\n    var arrValue = array[index],\n        othValue = other[index];\n\n    result = undefined;\n    if (customizer) {\n      result = isWhere\n        ? customizer(othValue, arrValue, index)\n        : customizer(arrValue, othValue, index);\n    }\n    if (typeof result == 'undefined') {\n      if (isWhere) {\n        var othIndex = othLength;\n        while (othIndex--) {\n          othValue = other[othIndex];\n          result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB);\n          if (result) {\n            break;\n          }\n        }\n      } else {\n        result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB);\n      }\n    }\n  }\n  return !!result;\n}\n\nmodule.exports = equalArrays;\n\n},{}],123:[function(require,module,exports){\n\nvar boolTag = '[object Boolean]',\n    dateTag = '[object Date]',\n    errorTag = '[object Error]',\n    numberTag = '[object Number]',\n    regexpTag = '[object RegExp]',\n    stringTag = '[object String]';\n\n\nfunction equalByTag(object, other, tag) {\n  switch (tag) {\n    case boolTag:\n    case dateTag:\n      return +object == +other;\n\n    case errorTag:\n      return object.name == other.name && object.message == other.message;\n\n    case numberTag:\n      return (object != +object)\n        ? other != +other\n        : (object == 0 ? ((1 / object) == (1 / other)) : object == +other);\n\n    case regexpTag:\n    case stringTag:\n      return object == (other + '');\n  }\n  return false;\n}\n\nmodule.exports = equalByTag;\n\n},{}],124:[function(require,module,exports){\nvar keys = require('../object/keys');\n\n\nvar objectProto = Object.prototype;\n\n\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\nfunction equalObjects(object, other, equalFunc, customizer, isWhere, stackA, stackB) {\n  var objProps = keys(object),\n      objLength = objProps.length,\n      othProps = keys(other),\n      othLength = othProps.length;\n\n  if (objLength != othLength && !isWhere) {\n    return false;\n  }\n  var hasCtor,\n      index = -1;\n\n  while (++index < objLength) {\n    var key = objProps[index],\n        result = hasOwnProperty.call(other, key);\n\n    if (result) {\n      var objValue = object[key],\n          othValue = other[key];\n\n      result = undefined;\n      if (customizer) {\n        result = isWhere\n          ? customizer(othValue, objValue, key)\n          : customizer(objValue, othValue, key);\n      }\n      if (typeof result == 'undefined') {\n        result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB);\n      }\n    }\n    if (!result) {\n      return false;\n    }\n    hasCtor || (hasCtor = key == 'constructor');\n  }\n  if (!hasCtor) {\n    var objCtor = object.constructor,\n        othCtor = other.constructor;\n\n    if (objCtor != othCtor &&\n        ('constructor' in object && 'constructor' in other) &&\n        !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n          typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n      return false;\n    }\n  }\n  return true;\n}\n\nmodule.exports = equalObjects;\n\n},{\"../object/keys\":144}],125:[function(require,module,exports){\nvar baseSetData = require('./baseSetData'),\n    isNative = require('../lang/isNative'),\n    support = require('../support');\n\n\nvar reFuncName = /^\\s*function[ \\n\\r\\t]+\\w/;\n\n\nvar reThis = /\\bthis\\b/;\n\n\nvar fnToString = Function.prototype.toString;\n\n\nfunction isBindable(func) {\n  var result = !(support.funcNames ? func.name : support.funcDecomp);\n\n  if (!result) {\n    var source = fnToString.call(func);\n    if (!support.funcNames) {\n      result = !reFuncName.test(source);\n    }\n    if (!result) {\n      result = reThis.test(source) || isNative(func);\n      baseSetData(func, result);\n    }\n  }\n  return result;\n}\n\nmodule.exports = isBindable;\n\n},{\"../lang/isNative\":138,\"../support\":147,\"./baseSetData\":118}],126:[function(require,module,exports){\n\nvar MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\n\n\nfunction isIndex(value, length) {\n  value = +value;\n  length = length == null ? MAX_SAFE_INTEGER : length;\n  return value > -1 && value % 1 == 0 && value < length;\n}\n\nmodule.exports = isIndex;\n\n},{}],127:[function(require,module,exports){\nvar isIndex = require('./isIndex'),\n    isLength = require('./isLength'),\n    isObject = require('../lang/isObject');\n\n\nfunction isIterateeCall(value, index, object) {\n  if (!isObject(object)) {\n    return false;\n  }\n  var type = typeof index;\n  if (type == 'number') {\n    var length = object.length,\n        prereq = isLength(length) && isIndex(index, length);\n  } else {\n    prereq = type == 'string' && index in object;\n  }\n  if (prereq) {\n    var other = object[index];\n    return value === value ? (value === other) : (other !== other);\n  }\n  return false;\n}\n\nmodule.exports = isIterateeCall;\n\n},{\"../lang/isObject\":139,\"./isIndex\":126,\"./isLength\":128}],128:[function(require,module,exports){\n\nvar MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;\n\n\nfunction isLength(value) {\n  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n},{}],129:[function(require,module,exports){\n\nfunction isObjectLike(value) {\n  return (value && typeof value == 'object') || false;\n}\n\nmodule.exports = isObjectLike;\n\n},{}],130:[function(require,module,exports){\nvar isObject = require('../lang/isObject');\n\n\nfunction isStrictComparable(value) {\n  return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value));\n}\n\nmodule.exports = isStrictComparable;\n\n},{\"../lang/isObject\":139}],131:[function(require,module,exports){\n(function (global){\nvar isNative = require('../lang/isNative');\n\n\nvar WeakMap = isNative(WeakMap = global.WeakMap) && WeakMap;\n\n\nvar metaMap = WeakMap && new WeakMap;\n\nmodule.exports = metaMap;\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../lang/isNative\":138}],132:[function(require,module,exports){\nvar isArguments = require('../lang/isArguments'),\n    isArray = require('../lang/isArray'),\n    isIndex = require('./isIndex'),\n    isLength = require('./isLength'),\n    keysIn = require('../object/keysIn'),\n    support = require('../support');\n\n\nvar objectProto = Object.prototype;\n\n\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\nfunction shimKeys(object) {\n  var props = keysIn(object),\n      propsLength = props.length,\n      length = propsLength && object.length;\n\n  var allowIndexes = length && isLength(length) &&\n    (isArray(object) || (support.nonEnumArgs && isArguments(object)));\n\n  var index = -1,\n      result = [];\n\n  while (++index < propsLength) {\n    var key = props[index];\n    if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\nmodule.exports = shimKeys;\n\n},{\"../lang/isArguments\":134,\"../lang/isArray\":135,\"../object/keysIn\":145,\"../support\":147,\"./isIndex\":126,\"./isLength\":128}],133:[function(require,module,exports){\nvar isObject = require('../lang/isObject');\n\n\nfunction toObject(value) {\n  return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n\n},{\"../lang/isObject\":139}],134:[function(require,module,exports){\nvar isLength = require('../internal/isLength'),\n    isObjectLike = require('../internal/isObjectLike');\n\n\nvar argsTag = '[object Arguments]';\n\n\nvar objectProto = Object.prototype;\n\n\nvar objToString = objectProto.toString;\n\n\nfunction isArguments(value) {\n  var length = isObjectLike(value) ? value.length : undefined;\n  return (isLength(length) && objToString.call(value) == argsTag) || false;\n}\n\nmodule.exports = isArguments;\n\n},{\"../internal/isLength\":128,\"../internal/isObjectLike\":129}],135:[function(require,module,exports){\nvar isLength = require('../internal/isLength'),\n    isNative = require('./isNative'),\n    isObjectLike = require('../internal/isObjectLike');\n\n\nvar arrayTag = '[object Array]';\n\n\nvar objectProto = Object.prototype;\n\n\nvar objToString = objectProto.toString;\n\n\nvar nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray;\n\n\nvar isArray = nativeIsArray || function(value) {\n  return (isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag) || false;\n};\n\nmodule.exports = isArray;\n\n},{\"../internal/isLength\":128,\"../internal/isObjectLike\":129,\"./isNative\":138}],136:[function(require,module,exports){\nvar isArguments = require('./isArguments'),\n    isArray = require('./isArray'),\n    isFunction = require('./isFunction'),\n    isLength = require('../internal/isLength'),\n    isObjectLike = require('../internal/isObjectLike'),\n    isString = require('./isString'),\n    keys = require('../object/keys');\n\n\nfunction isEmpty(value) {\n  if (value == null) {\n    return true;\n  }\n  var length = value.length;\n  if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) ||\n      (isObjectLike(value) && isFunction(value.splice)))) {\n    return !length;\n  }\n  return !keys(value).length;\n}\n\nmodule.exports = isEmpty;\n\n},{\"../internal/isLength\":128,\"../internal/isObjectLike\":129,\"../object/keys\":144,\"./isArguments\":134,\"./isArray\":135,\"./isFunction\":137,\"./isString\":140}],137:[function(require,module,exports){\n(function (global){\nvar baseIsFunction = require('../internal/baseIsFunction'),\n    isNative = require('./isNative');\n\n\nvar funcTag = '[object Function]';\n\n\nvar objectProto = Object.prototype;\n\n\nvar objToString = objectProto.toString;\n\n\nvar Uint8Array = isNative(Uint8Array = global.Uint8Array) && Uint8Array;\n\n\nvar isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) {\n  return objToString.call(value) == funcTag;\n};\n\nmodule.exports = isFunction;\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../internal/baseIsFunction\":113,\"./isNative\":138}],138:[function(require,module,exports){\nvar escapeRegExp = require('../string/escapeRegExp'),\n    isObjectLike = require('../internal/isObjectLike');\n\n\nvar funcTag = '[object Function]';\n\n\nvar reHostCtor = /^\\[object .+?Constructor\\]$/;\n\n\nvar objectProto = Object.prototype;\n\n\nvar fnToString = Function.prototype.toString;\n\n\nvar objToString = objectProto.toString;\n\n\nvar reNative = RegExp('^' +\n  escapeRegExp(objToString)\n  .replace(/toString|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n\nfunction isNative(value) {\n  if (value == null) {\n    return false;\n  }\n  if (objToString.call(value) == funcTag) {\n    return reNative.test(fnToString.call(value));\n  }\n  return (isObjectLike(value) && reHostCtor.test(value)) || false;\n}\n\nmodule.exports = isNative;\n\n},{\"../internal/isObjectLike\":129,\"../string/escapeRegExp\":146}],139:[function(require,module,exports){\n\nfunction isObject(value) {\n  var type = typeof value;\n  return type == 'function' || (value && type == 'object') || false;\n}\n\nmodule.exports = isObject;\n\n},{}],140:[function(require,module,exports){\nvar isObjectLike = require('../internal/isObjectLike');\n\n\nvar stringTag = '[object String]';\n\n\nvar objectProto = Object.prototype;\n\n\nvar objToString = objectProto.toString;\n\n\nfunction isString(value) {\n  return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag) || false;\n}\n\nmodule.exports = isString;\n\n},{\"../internal/isObjectLike\":129}],141:[function(require,module,exports){\nvar isLength = require('../internal/isLength'),\n    isObjectLike = require('../internal/isObjectLike');\n\n\nvar argsTag = '[object Arguments]',\n    arrayTag = '[object Array]',\n    boolTag = '[object Boolean]',\n    dateTag = '[object Date]',\n    errorTag = '[object Error]',\n    funcTag = '[object Function]',\n    mapTag = '[object Map]',\n    numberTag = '[object Number]',\n    objectTag = '[object Object]',\n    regexpTag = '[object RegExp]',\n    setTag = '[object Set]',\n    stringTag = '[object String]',\n    weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n    float32Tag = '[object Float32Array]',\n    float64Tag = '[object Float64Array]',\n    int8Tag = '[object Int8Array]',\n    int16Tag = '[object Int16Array]',\n    int32Tag = '[object Int32Array]',\n    uint8Tag = '[object Uint8Array]',\n    uint8ClampedTag = '[object Uint8ClampedArray]',\n    uint16Tag = '[object Uint16Array]',\n    uint32Tag = '[object Uint32Array]';\n\n\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n\nvar objectProto = Object.prototype;\n\n\nvar objToString = objectProto.toString;\n\n\nfunction isTypedArray(value) {\n  return (isObjectLike(value) && isLength(value.length) && typedArrayTags[objToString.call(value)]) || false;\n}\n\nmodule.exports = isTypedArray;\n\n},{\"../internal/isLength\":128,\"../internal/isObjectLike\":129}],142:[function(require,module,exports){\nvar baseAssign = require('../internal/baseAssign'),\n    createAssigner = require('../internal/createAssigner');\n\n\nvar assign = createAssigner(baseAssign);\n\nmodule.exports = assign;\n\n},{\"../internal/baseAssign\":103,\"../internal/createAssigner\":121}],143:[function(require,module,exports){\nvar baseCopy = require('../internal/baseCopy'),\n    baseCreate = require('../internal/baseCreate'),\n    isIterateeCall = require('../internal/isIterateeCall'),\n    keys = require('./keys');\n\n\nfunction create(prototype, properties, guard) {\n  var result = baseCreate(prototype);\n  if (guard && isIterateeCall(prototype, properties, guard)) {\n    properties = null;\n  }\n  return properties ? baseCopy(properties, result, keys(properties)) : result;\n}\n\nmodule.exports = create;\n\n},{\"../internal/baseCopy\":105,\"../internal/baseCreate\":106,\"../internal/isIterateeCall\":127,\"./keys\":144}],144:[function(require,module,exports){\nvar isLength = require('../internal/isLength'),\n    isNative = require('../lang/isNative'),\n    isObject = require('../lang/isObject'),\n    shimKeys = require('../internal/shimKeys');\n\n\nvar nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys;\n\n\nvar keys = !nativeKeys ? shimKeys : function(object) {\n  if (object) {\n    var Ctor = object.constructor,\n        length = object.length;\n  }\n  if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n      (typeof object != 'function' && (length && isLength(length)))) {\n    return shimKeys(object);\n  }\n  return isObject(object) ? nativeKeys(object) : [];\n};\n\nmodule.exports = keys;\n\n},{\"../internal/isLength\":128,\"../internal/shimKeys\":132,\"../lang/isNative\":138,\"../lang/isObject\":139}],145:[function(require,module,exports){\nvar isArguments = require('../lang/isArguments'),\n    isArray = require('../lang/isArray'),\n    isIndex = require('../internal/isIndex'),\n    isLength = require('../internal/isLength'),\n    isObject = require('../lang/isObject'),\n    support = require('../support');\n\n\nvar objectProto = Object.prototype;\n\n\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\nfunction keysIn(object) {\n  if (object == null) {\n    return [];\n  }\n  if (!isObject(object)) {\n    object = Object(object);\n  }\n  var length = object.length;\n  length = (length && isLength(length) &&\n    (isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0;\n\n  var Ctor = object.constructor,\n      index = -1,\n      isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n      result = Array(length),\n      skipIndexes = length > 0;\n\n  while (++index < length) {\n    result[index] = (index + '');\n  }\n  for (var key in object) {\n    if (!(skipIndexes && isIndex(key, length)) &&\n        !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\nmodule.exports = keysIn;\n\n},{\"../internal/isIndex\":126,\"../internal/isLength\":128,\"../lang/isArguments\":134,\"../lang/isArray\":135,\"../lang/isObject\":139,\"../support\":147}],146:[function(require,module,exports){\nvar baseToString = require('../internal/baseToString');\n\n\nvar reRegExpChars = /[.*+?^${}()|[\\]\\/\\\\]/g,\n    reHasRegExpChars = RegExp(reRegExpChars.source);\n\n\nfunction escapeRegExp(string) {\n  string = baseToString(string);\n  return (string && reHasRegExpChars.test(string))\n    ? string.replace(reRegExpChars, '\\\\$&')\n    : string;\n}\n\nmodule.exports = escapeRegExp;\n\n},{\"../internal/baseToString\":119}],147:[function(require,module,exports){\n(function (global){\nvar isNative = require('./lang/isNative');\n\n\nvar reThis = /\\bthis\\b/;\n\n\nvar objectProto = Object.prototype;\n\n\nvar document = (document = global.window) && document.document;\n\n\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n\nvar support = {};\n\n(function(x) {\n\n\n  support.funcDecomp = !isNative(global.WinRTError) && reThis.test(function() { return this; });\n\n\n  support.funcNames = typeof Function.name == 'string';\n\n\n  try {\n    support.dom = document.createDocumentFragment().nodeType === 11;\n  } catch(e) {\n    support.dom = false;\n  }\n\n\n  try {\n    support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1);\n  } catch(e) {\n    support.nonEnumArgs = true;\n  }\n}(0, 0));\n\nmodule.exports = support;\n\n}).call(this,typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./lang/isNative\":138}],148:[function(require,module,exports){\n\nfunction identity(value) {\n  return value;\n}\n\nmodule.exports = identity;\n\n},{}]},{},[8])\n\n"
  },
  {
    "path": "enhance-rn.js",
    "content": "import AWS from 'aws-sdk/global';\nimport { NativeModules } from 'react-native';\nimport * as enhancements from './src';\n\nimport BigInteger from './src/BigInteger';\n\nexport * from './src';\n\n\nconst { RNAWSCognito } = NativeModules;\n\nObject.keys(enhancements).forEach(key => {\n  AWS.CognitoIdentityServiceProvider[key] = enhancements[key];\n});\n\nBigInteger.prototype.modPow = function nativeModPow(e, m, callback) {\n  RNAWSCognito.computeModPow({\n    target: this.toString(16),\n    value: e.toString(16),\n    modifier: m.toString(16),\n  }, (err, result) => {\n    if (err) {\n      return callback(new Error(err), null);\n    }\n    const bigIntResult = new BigInteger(result, 16);\n    return callback(null, bigIntResult);\n  });\n};\n\nenhancements.AuthenticationHelper.prototype.calculateS =\nfunction nativeComputeS(xValue, serverBValue, callback) {\n  RNAWSCognito.computeS({\n    g: this.g.toString(16),\n    x: xValue.toString(16),\n    k: this.k.toString(16),\n    a: this.smallAValue.toString(16),\n    b: serverBValue.toString(16),\n    u: this.UValue.toString(16),\n  }, (err, result) => {\n    if (err) {\n      return callback(new Error(err), null);\n    }\n    const bigIntResult = new BigInteger(result, 16);\n    return callback(null, bigIntResult);\n  });\n  return undefined;\n};\n\nconst libraryVersion = '1.0';\nconst libraryName = 'aws-amplify';\nconst originalUserAgent = AWS.util.userAgent;\nif (originalUserAgent) {\n  AWS.util.userAgent = function newUserAgent() {\n    return `${libraryName}/${libraryVersion} ${originalUserAgent()}`;\n  };\n} else {\n  const previousUserAgent = AWS.config.customUserAgent || '';\n  AWS.config.update({ customUserAgent: `${libraryName}/${libraryVersion} ${previousUserAgent}` });\n}\n"
  },
  {
    "path": "enhance.js",
    "content": "import CognitoIdentityServiceProvider from 'aws-sdk/clients/cognitoidentityserviceprovider';\nimport * as enhancements from './src';\n\nexport * from './src';\n\nObject.keys(enhancements).forEach(key => {\n  CognitoIdentityServiceProvider[key] = enhancements[key];\n});\n"
  },
  {
    "path": "examples/babel-webpack/.babelrc",
    "content": "{\n  \"presets\": [\n    \"es2015\",\n    \"stage-0\",\n    \"react\"\n  ]\n}\n"
  },
  {
    "path": "examples/babel-webpack/.editorconfig",
    "content": "root = true\n\n[*]\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\ncharset = utf-8\n\nindent_style = space\nindent_size = 2"
  },
  {
    "path": "examples/babel-webpack/README.md",
    "content": "# Babel webpack example\n\nTo run the example first setup your AWS configuration.\n\n```js\n// src/config.js\nexport default {\n  region: '',\n  IdentityPoolId: '',\n  UserPoolId: '',\n  ClientId: '',\n}\n```\n\nNow, you are ready to build this example.\n\n```\nnpm install\nnpm run build\n```\n\nOpen browser to try this example.\n\n```\nopen index.html\n```\n"
  },
  {
    "path": "examples/babel-webpack/index.html",
    "content": "<html>\n  <body>\n    <h1>Sign up</h1>\n    <div id=\"app\"></div>\n    <script src=\"dist/main.bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/babel-webpack/package.json",
    "content": "{\n  \"name\": \"babel-webpack\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Babel webpack example \",\n  \"scripts\": {\n    \"build\": \"webpack\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.17.0\",\n    \"babel-loader\": \"^6.2.5\",\n    \"babel-preset-es2015\": \"^6.16.0\",\n    \"babel-preset-react\": \"^6.16.0\",\n    \"babel-preset-stage-0\": \"^6.16.0\",\n    \"babel-register\": \"^6.16.3\",\n    \"json-loader\": \"^0.5.4\",\n    \"webpack\": \"^1.13.2\"\n  },\n  \"dependencies\": {\n    \"amazon-cognito-identity-js\": \"^1.5.0\",\n    \"react\": \"^15.3.2\",\n    \"react-dom\": \"^15.3.2\"\n  }\n}\n"
  },
  {
    "path": "examples/babel-webpack/src/config.js",
    "content": "export default {\n  region: '',\n  IdentityPoolId: '',\n  UserPoolId: '',\n  ClientId: '',\n}\n"
  },
  {
    "path": "examples/babel-webpack/src/main.jsx",
    "content": "import {Config, CognitoIdentityCredentials} from \"aws-sdk\";\nimport {\n  CognitoUserPool,\n  CognitoUserAttribute\n} from \"amazon-cognito-identity-js\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport appConfig from \"./config\";\n\nConfig.region = appConfig.region;\nConfig.credentials = new CognitoIdentityCredentials({\n  IdentityPoolId: appConfig.IdentityPoolId\n});\n\nconst userPool = new CognitoUserPool({\n  UserPoolId: appConfig.UserPoolId,\n  ClientId: appConfig.ClientId,\n});\n\nclass SignUpForm extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      email: '',\n      password: '',\n    };\n  }\n\n  handleEmailChange(e) {\n    this.setState({email: e.target.value});\n  }\n\n  handlePasswordChange(e) {\n    this.setState({password: e.target.value});\n  }\n\n  handleSubmit(e) {\n    e.preventDefault();\n    const email = this.state.email.trim();\n    const password = this.state.password.trim();\n    const attributeList = [\n      new CognitoUserAttribute({\n        Name: 'email',\n        Value: email,\n      })\n    ];\n    userPool.signUp(email, password, attributeList, null, (err, result) => {\n      if (err) {\n        console.log(err);\n        return;\n      }\n      console.log('user name is ' + result.user.getUsername());\n      console.log('call result: ' + result);\n    });\n  }\n\n  render() {\n    return (\n      <form onSubmit={this.handleSubmit.bind(this)}>\n        <input type=\"text\"\n               value={this.state.email}\n               placeholder=\"Email\"\n               onChange={this.handleEmailChange.bind(this)}/>\n        <input type=\"password\"\n               value={this.state.password}\n               placeholder=\"Password\"\n               onChange={this.handlePasswordChange.bind(this)}/>\n        <input type=\"submit\"/>\n      </form>\n    );\n  }\n}\n\nReactDOM.render(<SignUpForm />, document.getElementById('app'));\n\n"
  },
  {
    "path": "examples/babel-webpack/webpack.config.babel.js",
    "content": "export default {\n  resolve: {\n    extensions: ['', '.js', 'jsx'],\n  },\n  devtool: \"cheap-eval-source-map\",\n  entry: ['./src/main.jsx'],\n  output: {\n    path: 'dist',\n    filename: 'main.bundle.js'\n  },\n  module: {\n    loaders: [\n      {\n        test: /\\.jsx?$/,\n        loader: 'babel',\n        exclude: /node_modules/,\n        query: {\n          cacheDirectory: true,\n        }\n      },\n      {\n        test: /\\.json$/,\n        loader: 'json'\n      }\n    ]\n  }\n};\n"
  },
  {
    "path": "index.d.ts",
    "content": "declare module \"amazon-cognito-identity-js\" {\n\n    import * as AWS from \"aws-sdk\";\n\n    export type NodeCallback<E,T> = (err?: E, result?: T) => void;\n\n    export interface IAuthenticationDetailsData {\n        Username: string;\n        Password: string;\n    }\n\n    export class AuthenticationDetails {\n        constructor(data: IAuthenticationDetailsData);\n\n        public getUsername(): string;\n        public getPassword(): string;\n        public getValidationData(): any[];\n    }\n\n    export interface ICognitoStorage {\n        setItem(key: string, value: string): void;\n        getItem(key: string): string;\n        removeItem(key: string): void;\n        clear(): void;\n    }\n\n    export interface ICognitoUserData {\n        Username: string;\n        Pool: CognitoUserPool;\n        Storage?: ICognitoStorage;\n    }\n\n    export class CognitoUser {\n        constructor(data: ICognitoUserData);\n\n        public setSignInUserSession(signInUserSession: CognitoUserSession): void;\n        public getSignInUserSession(): CognitoUserSession | null;\n        public getUsername(): string;\n\n        public getAuthenticationFlowType(): string;\n        public setAuthenticationFlowType(authenticationFlowType: string): string;\n\n        public getSession(callback: Function): any;\n        public refreshSession(refreshToken: CognitoRefreshToken, callback: NodeCallback<any, any>): void;\n        public authenticateUser(authenticationDetails: AuthenticationDetails,\n                                callbacks: {\n                                    onSuccess: (session: CognitoUserSession, userConfirmationNecessary?: boolean) => void,\n                                    onFailure: (err: any) => void,\n                                    newPasswordRequired?: (userAttributes: any, requiredAttributes: any) => void,\n                                    mfaRequired?: (challengeName: any, challengeParameters: any) => void,\n                                    customChallenge?: (challengeParameters: any) => void\n                                }): void;\n        public confirmRegistration(code: string, forceAliasCreation: boolean, callback: NodeCallback<any, any>): void;\n        public sendCustomChallengeAnswer(answerChallenge: any, callback:NodeCallback<any, any>):void;\n        public resendConfirmationCode(callback: NodeCallback<Error, \"SUCCESS\">): void;\n        public changePassword(oldPassword: string, newPassword: string, callback: NodeCallback<Error, \"SUCCESS\">): void;\n        public forgotPassword(callbacks: { onSuccess: (data: any) => void, onFailure: (err: Error) => void, inputVerificationCode?: (data: any) => void }): void;\n        public confirmPassword(verificationCode: string, newPassword: string, callbacks: { onSuccess: () => void, onFailure: (err: Error) => void }): void;\n        public setDeviceStatusRemembered(callbacks: { onSuccess: (success: string) => void, onFailure: (err: any) => void }): void;\n        public setDeviceStatusNotRemembered(callbacks: { onSuccess: (success: string) => void, onFailure: (err: any) => void }): void;\n        public getDevice(callbacks: {onSuccess: (success: string) => void, onFailure: (err: Error) => void}): any;\n        public sendMFACode(confirmationCode: string, callbacks: { onSuccess: (session: CognitoUserSession) => void, onFailure: (err: any) => void }): void;\n        public completeNewPasswordChallenge(newPassword: string,\n                                            requiredAttributeData: any,\n                                            callbacks: {\n                                                onSuccess: (session: CognitoUserSession) => void,\n                                                onFailure: (err: any) => void,\n                                                mfaRequired?: (challengeName: any, challengeParameters: any) => void,\n                                                customChallenge?: (challengeParameters: any) => void\n                                            }): void;\n        public signOut(): void;\n        public globalSignOut(callbacks: { onSuccess: (msg: string) => void, onFailure: (err: Error) => void }): void;\n        public verifyAttribute(attributeName: string, confirmationCode: string, callbacks: { onSuccess: (success: string) => void, onFailure: (err: Error) => void }): void;\n        public getUserAttributes(callback: NodeCallback<Error, CognitoUserAttribute[]>): void;\n        public updateAttributes(attributes: ICognitoUserAttributeData[], callback: NodeCallback<Error,string>): void;\n        public deleteAttributes(attributeList: string[], callback: NodeCallback<Error, string>): void;\n        public getAttributeVerificationCode(name: string, callback: { onSuccess: () => void, onFailure: (err: Error) => void, inputVerificationCode: (data: string) => void | null }): void;\n        public deleteUser(callback: NodeCallback<Error, string>): void;\n        public enableMFA(callback: NodeCallback<Error, string>): void;\n        public disableMFA(callback: NodeCallback<Error, string>): void;\n        public getMFAOptions(callback: NodeCallback<Error, MFAOption[]>): void;\n    }\n\n    export interface MFAOption {\n        DeliveryMedium: \"SMS\" |\"EMAIL\";\n        AttributeName: string;\n    }\n\n    export interface ICognitoUserAttributeData {\n        Name: string;\n        Value: string;\n    }\n\n    export class CognitoUserAttribute {\n        constructor(data: ICognitoUserAttributeData);\n\n        public getValue(): string;\n        public setValue(value: string): CognitoUserAttribute;\n        public getName(): string;\n        public setName(name: string): CognitoUserAttribute;\n        public toString(): string;\n        public toJSON(): Object;\n    }\n\n    export interface ISignUpResult {\n        user: CognitoUser;\n        userConfirmed: boolean;\n        userSub: string;\n    }\n\n    export interface ICognitoUserPoolData {\n        UserPoolId: string;\n        ClientId: string;\n        endpoint?: string;\n        Storage?: ICognitoStorage;\n    }\n\n    export class CognitoUserPool {\n        constructor(data: ICognitoUserPoolData);\n\n        public getUserPoolId(): string;\n        public getClientId(): string;\n\n        public signUp(username: string, password: string, userAttributes: CognitoUserAttribute[], validationData: CognitoUserAttribute[], callback: NodeCallback<Error,ISignUpResult>): void;\n\n        public getCurrentUser(): CognitoUser | null;\n    }\n\n    export interface ICognitoUserSessionData {\n        IdToken: CognitoIdToken;\n        AccessToken: CognitoAccessToken;\n        RefreshToken?: CognitoRefreshToken;\n    }\n\n    export class CognitoUserSession {\n        constructor(data: ICognitoUserSessionData);\n\n        public getIdToken(): CognitoIdToken;\n        public getRefreshToken(): CognitoRefreshToken;\n        public getAccessToken(): CognitoAccessToken;\n        public isValid(): boolean;\n    }\n\n    export class CognitoIdentityServiceProvider {\n        public config: AWS.CognitoIdentityServiceProvider.Types.ClientConfiguration;\n    }\n\n    export class CognitoAccessToken {\n        constructor({ AccessToken }: { AccessToken: string });\n\n        public getJwtToken(): string;\n        public getExpiration(): number;\n    }\n\n    export class CognitoIdToken {\n        constructor({ IdToken }: { IdToken: string });\n\n        public getJwtToken(): string;\n        public getExpiration(): number;\n    }\n\n    export class CognitoRefreshToken {\n        constructor({ RefreshToken }: { RefreshToken: string });\n\n        public getToken(): string;\n    }\n\n    export interface ICookieStorageData {\n        domain: string;\n        path?: string;\n        expires?: number;\n        secure?: boolean;\n    }\n    export class CookieStorage implements ICognitoStorage {\n        constructor(data: ICookieStorageData);\n        setItem(key: string, value: string): void;\n        getItem(key: string): string;\n        removeItem(key: string): void;\n        clear(): void;\n    }\n}\n"
  },
  {
    "path": "ios/JKBigInteger/JKBigDecimal.h",
    "content": "//\n//  JKBigDecimal.h\n//  JKBigInteger\n//\n//  Created by Midfar Sun on 5/4/15.\n//  Copyright (c) 2015 Midfar Sun. All rights reserved.\n//\n\n// Licensed under the MIT License\n\n#import <Foundation/Foundation.h>\n#import \"JKBigInteger.h\"\n\n@interface JKBigDecimal : NSObject <NSCoding>\n\n@property(nonatomic, retain)JKBigInteger *bigInteger;\n@property(nonatomic, assign)NSUInteger figure;//小数位数\n\n+ (id)decimalWithString:(NSString *)string;\n- (id)initWithString:(NSString *)string;\n\n- (id)add:(JKBigDecimal *)bigDecimal;\n- (id)subtract:(JKBigDecimal *)bigDecimal;\n- (id)multiply:(JKBigDecimal *)bigDecimal;\n- (id)divide:(JKBigDecimal *)bigDecimal;\n\n- (id)remainder:(JKBigDecimal *)bigInteger;\n//- (NSArray *)divideAndRemainder:(JKBigDecimal *)bigInteger;\n\n- (NSComparisonResult) compare:(JKBigDecimal *)other;\n- (id)pow:(unsigned int)exponent;\n\n- (id)negate;\n- (id)abs;\n\n- (NSString *)stringValue;\n\n- (NSString *)description;\n\n@end\n"
  },
  {
    "path": "ios/JKBigInteger/JKBigDecimal.m",
    "content": "//\n//  JKBigDecimal.m\n//  JKBigInteger\n//\n//  Created by Midfar Sun on 5/4/15.\n//  Copyright (c) 2015 Midfar Sun. All rights reserved.\n//\n\n// Licensed under the MIT License\n\n#import \"JKBigDecimal.h\"\n\n@implementation JKBigDecimal\n@synthesize bigInteger, figure;\n\n- (id)init\n{\n    return [self initWithString:@\"0\"];\n}\n\n- (id)initWithString:(NSString *)string\n{\n    self = [super init];\n    if (self) {\n        figure = 0;\n        if ([string containsString:@\".\"]) {\n            NSRange range = [string rangeOfString:@\".\"];\n            figure = string.length-range.location-range.length;\n            string = [string stringByReplacingCharactersInRange:range withString:@\"\"];\n        }\n        bigInteger = [[JKBigInteger alloc] initWithString:string];\n    }\n    return self;\n}\n\n+ (id)decimalWithString:(NSString *)string\n{\n    return [[JKBigDecimal alloc] initWithString:string];\n}\n\n-(id)initWithBigInteger:(JKBigInteger *)i figure:(NSInteger)f\n{\n    self = [super init];\n    if (self) {\n        bigInteger = i;\n        figure = f;\n    }\n    return self;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)decoder\n{\n    self = [super init];\n    if (self) {\n        bigInteger = [[JKBigInteger alloc] initWithCoder:decoder];\n        figure = [decoder decodeInt32ForKey:@\"JKBigDecimalFigure\"];\n    }\n    return self;\n}\n-(void)encodeWithCoder:(NSCoder *)encoder\n{\n    [bigInteger encodeWithCoder:encoder];\n    [encoder encodeInteger:figure forKey:@\"JKBigDecimalFigure\"];\n}\n\n- (id)add:(JKBigDecimal *)bigDecimal\n{\n    NSInteger maxFigure = 0;\n    if (figure>=bigDecimal.figure) {\n        maxFigure = figure;\n        NSInteger exponent = maxFigure-bigDecimal.figure;\n        JKBigInteger *mInteger = [[JKBigInteger alloc] initWithString:@\"10\"];\n        JKBigInteger *newInteger = [mInteger pow:(unsigned int)exponent];\n        bigDecimal.bigInteger = [bigDecimal.bigInteger multiply:newInteger];\n        bigDecimal.figure = maxFigure;\n        \n    }else{\n        maxFigure = bigDecimal.figure;\n        NSInteger exponent = maxFigure-figure;\n        JKBigInteger *mInteger = [[JKBigInteger alloc] initWithString:@\"10\"];\n        JKBigInteger *newInteger = [mInteger pow:(unsigned int)exponent];\n        bigInteger = [bigInteger multiply:newInteger];\n        figure = maxFigure;\n        \n    }\n    JKBigInteger *newBigInteger = [bigInteger add:bigDecimal.bigInteger];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:maxFigure];\n    return newBigDecimal;\n}\n\n- (id)subtract:(JKBigDecimal *)bigDecimal\n{\n    NSInteger maxFigure = 0;\n    if (figure>=bigDecimal.figure) {\n        maxFigure = figure;\n        NSInteger exponent = maxFigure-bigDecimal.figure;\n        JKBigInteger *mInteger = [[JKBigInteger alloc] initWithString:@\"10\"];\n        JKBigInteger *newInteger = [mInteger pow:(unsigned int)exponent];\n        bigDecimal.bigInteger = [bigDecimal.bigInteger multiply:newInteger];\n        bigDecimal.figure = maxFigure;\n        \n    }else{\n        maxFigure = bigDecimal.figure;\n        NSInteger exponent = maxFigure-figure;\n        JKBigInteger *mInteger = [[JKBigInteger alloc] initWithString:@\"10\"];\n        JKBigInteger *newInteger = [mInteger pow:(unsigned int)exponent];\n        bigInteger = [bigDecimal.bigInteger multiply:newInteger];\n        figure = maxFigure;\n        \n    }\n    JKBigInteger *newBigInteger = [bigInteger subtract:bigDecimal.bigInteger];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:maxFigure];\n    return newBigDecimal;\n}\n\n- (id)multiply:(JKBigDecimal *)bigDecimal\n{\n    NSInteger totalFigure = figure+bigDecimal.figure;\n    JKBigInteger *newBigInteger = [bigInteger multiply:bigDecimal.bigInteger];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:totalFigure];\n    return newBigDecimal;\n}\n\n- (id)divide:(JKBigDecimal *)bigDecimal\n{\n    NSInteger totalFigure = figure-bigDecimal.figure;\n    if (totalFigure<0) {\n        NSInteger exponent = -totalFigure;\n        totalFigure=0;\n        JKBigInteger *mInteger = [[JKBigInteger alloc] initWithString:@\"10\"];\n        JKBigInteger *newInteger = [mInteger pow:(unsigned int)exponent];\n        bigInteger = [bigInteger multiply:newInteger];\n    }\n    JKBigInteger *newBigInteger = [bigInteger divide:bigDecimal.bigInteger];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:totalFigure];\n    return newBigDecimal;\n}\n\n- (id)remainder:(JKBigDecimal *)bigDecimal\n{\n    NSInteger totalFigure = figure-bigDecimal.figure;\n    if (totalFigure<0) {\n        NSInteger exponent = -totalFigure;\n        totalFigure=0;\n        JKBigInteger *mInteger = [[JKBigInteger alloc] initWithString:@\"10\"];\n        JKBigInteger *newInteger = [mInteger pow:(unsigned int)exponent];\n        bigInteger = [bigInteger multiply:newInteger];\n    }\n    JKBigInteger *newBigInteger = [bigInteger remainder:bigDecimal.bigInteger];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:bigDecimal.figure];\n    return newBigDecimal;\n}\n\n//- (NSArray *)divideAndRemainder:(JKBigDecimal *)bigInteger\n//{\n//    \n//}\n\n-(NSComparisonResult) compare:(JKBigDecimal *)other {\n    JKBigDecimal *tens = [[JKBigDecimal alloc] initWithString:@\"10\"];\n    JKBigInteger *scaledNum;\n    JKBigInteger *scaledCompareTo;\n    \n    if (figure > other.figure){\n        tens = [tens pow:(int)figure];\n    } else {\n        tens = [tens pow:(int)other.figure];\n    }\n    //scale my value to integer value\n    scaledNum = [[JKBigInteger alloc] initWithString:[[self multiply:tens] stringValue]];\n    //scale other value to integer\n    scaledCompareTo = [[JKBigInteger alloc] initWithString:[[other multiply:tens] stringValue]];\n    NSComparisonResult compareBigInteger = [scaledNum compare:scaledCompareTo];\n    return compareBigInteger;\n}\n\n- (id)pow:(unsigned int)exponent\n{\n    NSInteger totalFigure = figure*exponent;\n    JKBigInteger *newBigInteger = [bigInteger pow:exponent];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:totalFigure];\n    return newBigDecimal;\n}\n\n- (id)negate\n{\n    JKBigInteger *newBigInteger = [bigInteger negate];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:figure];\n    return newBigDecimal;\n}\n\n- (id)abs\n{\n    JKBigInteger *newBigInteger = [bigInteger abs];\n    JKBigDecimal *newBigDecimal = [[JKBigDecimal alloc] initWithBigInteger:newBigInteger figure:figure];\n    return newBigDecimal;\n}\n\n- (NSString *)stringValue\n{\n    NSString *string = [bigInteger stringValue];\n    if (figure==0) {\n        return string;\n    }\n    NSMutableString *mString = [NSMutableString stringWithString:string];\n    NSInteger newFigure = string.length-figure;\n    while (newFigure<=0) {\n        [mString insertString:@\"0\" atIndex:0];\n        newFigure++;\n    }\n    [mString insertString:@\".\" atIndex:newFigure];\n    return mString;\n}\n\n- (NSString *)description\n{\n    return [self stringValue];\n}\n\n@end\n"
  },
  {
    "path": "ios/JKBigInteger/JKBigInteger.h",
    "content": "//\n//  JKBigInteger.h\n//  JKBigInteger\n//\n//  Created by Jānis Kiršteins on 5/21/13.\n//  Copyright (c) 2013 Jānis Kiršteins. All rights reserved.\n//\n\n// Licensed under the MIT License\n\n#import <Foundation/Foundation.h>\n#include \"tommath.h\"\n\n@interface JKBigInteger : NSObject <NSCoding>\n\n- (id)initWithValue:(mp_int *)value;\n- (mp_int *)value;\n\n- (id)initWithUnsignedLong:(unsigned long)ul;\n- (id)initWithString:(NSString *)string;\n- (id)initWithString:(NSString *)string andRadix:(int)radix;\n- (id)initWithCString:(char *)cString;\n- (id)initWithCString:(char *)cString andRadix:(int)radix;\n\n- (id)add:(JKBigInteger *)bigInteger;\n- (id)subtract:(JKBigInteger *)bigInteger;\n- (id)multiply:(JKBigInteger *)bigInteger;\n- (id)divide:(JKBigInteger *)bigInteger;\n\n- (id)remainder:(JKBigInteger *)bigInteger;\n- (NSArray *)divideAndRemainder:(JKBigInteger *)bigInteger;\n\n- (id)pow:(unsigned int)exponent;\n- (id)pow:(JKBigInteger*)exponent andMod:(JKBigInteger*)modulus;\n- (id)negate;\n- (id)abs;\n\n- (id)bitwiseXor:(JKBigInteger *)bigInteger;\n- (id)bitwiseOr:(JKBigInteger *)bigInteger;\n- (id)bitwiseAnd:(JKBigInteger *)bigInteger;\n- (id)shiftLeft:(unsigned int)n;\n- (id)shiftRight:(unsigned int)n;\n\n- (id)gcd:(JKBigInteger *)bigInteger;\n\n- (NSComparisonResult) compare:(JKBigInteger *)bigInteger;\n\n- (unsigned long)unsignedIntValue;\n- (NSString *)stringValue;\n- (NSString *)stringValueWithRadix:(int)radix;\n\n- (NSString *)description;\n\n- (unsigned int)countBytes;\n- (void)toByteArraySigned: (unsigned char*) byteArray;\n- (void)toByteArrayUnsigned: (unsigned char*) byteArray;\n\n@end\n"
  },
  {
    "path": "ios/JKBigInteger/JKBigInteger.m",
    "content": "//\n//  JKBigInteger.m\n//  JKBigInteger\n//\n//  Created by Jānis Kiršteins on 5/21/13.\n//  Copyright (c) 2013 Jānis Kiršteins. All rights reserved.\n//\n\n// Licensed under the MIT License\n\n#import \"JKBigInteger.h\"\n\n@implementation JKBigInteger {\n@private\n    mp_int m_value;\n}\n\n- (id)initWithValue:(mp_int *)value {\n\n    self = [super init];\n\t\n    if (self) {\n        mp_init_copy(&m_value, value);\n    }\n    \n    return self;\n}\n\n- (mp_int *)value {\n    return &m_value;\n}\n\n- (id)initWithUnsignedLong:(unsigned long)unsignedLong {\n\n    self = [super init];\n    \n    if (self) {\n        mp_set_int(&m_value, unsignedLong);\n    }\n    \n    return self;\n}\n\n- (id)init {\n    return [self initWithUnsignedLong:0];\n}\n\n- (id)initWithCString:(char *)cString andRadix:(int)radix {\n\n    if (radix < 2 || radix > 64) {\n        return nil;\n    }\n    \n    self = [super init];\n    \n    if (self) {\n        mp_init(&m_value);\n        int result;\n        result = mp_read_radix(&m_value, cString, radix);\n        \n        if (result != MP_OKAY) {\n            mp_clear(&m_value);\n            return nil;\n        }\n    }\n    \n    return self;\n}\n- (id)initWithCString:(char *)cString {\n    \n    int radix = 10;\n    return [self initWithCString:cString andRadix:radix];\n}\n\n- (id)initWithString:(NSString *)string andRadix:(int)radix {\n    return [self initWithCString:(char *)[string UTF8String] andRadix:radix];\n}\n\n- (id)initWithString:(NSString *)string {\n\n    int radix = 10;\n    return [self initWithCString:(char *)[string UTF8String] andRadix:radix];\n}\n\n- (id)initWithCoder:(NSCoder *)decoder {\n\n    self = [super init];\n    \n    if (self) {\n\t\tint sign = [decoder decodeInt32ForKey:@\"JKBigIntegerSign\"];\n\t\tint alloc = [decoder decodeInt32ForKey:@\"JKBigIntegerAlloc\"];\n\n\t\tmp_init_size(&m_value, alloc);\n\t\t\n\t\tNSData *data = (NSData *)[decoder decodeObjectForKey:@\"JKBigIntegerDP\"];\n        mp_digit *temp = (mp_digit *)[data bytes];\n        \n        for (unsigned int i = 0; i < alloc; ++i) {\n\t\t\tm_value.dp[i] = temp[i];\n\t\t}\n\t\t\n\t\tm_value.used = alloc;\n\t\tm_value.sign = sign;\n    }\n\n    return self;\n}\n- (void)encodeWithCoder:(NSCoder *)encoder {\n\n    mp_clamp(&m_value);\n\n    NSData *data = [NSData dataWithBytes:(const void *)m_value.dp\n                                  length:m_value.alloc * sizeof(mp_digit)];\n\n    [encoder encodeObject:data forKey:@\"JKBigIntegerDP\"];\n    [encoder encodeInteger:m_value.alloc forKey:@\"JKBigIntegerAlloc\"];\n    [encoder encodeInteger:m_value.sign forKey:@\"JKBigIntegerSign\"];\n}\n\n- (id)add:(JKBigInteger *)bigInteger {\n\n    mp_int sum;\n    mp_init(&sum);\n    \n    mp_add(&m_value, [bigInteger value], &sum);\n    \n    id newBigInteger = [[JKBigInteger alloc] initWithValue:&sum];\n    mp_clear(&sum);\n    \n    return newBigInteger;\n}\n\n- (id)subtract:(JKBigInteger *)bigInteger {\n\n    mp_int difference;\n    mp_init(&difference);\n    \n    mp_sub(&m_value, [bigInteger value], &difference);\n    \n    id newBigInteger = [[JKBigInteger alloc] initWithValue:&difference];\n    mp_clear(&difference);\n    \n    return newBigInteger;\n}\n\n- (id)multiply:(JKBigInteger *)bigInteger {\n\n    mp_int product;\n    mp_init(&product);\n    \n    mp_mul(&m_value, [bigInteger value], &product);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&product];\n    mp_clear(&product);\n    \n    return newBigInteger;\n}\n\n- (id)divide:(JKBigInteger *)bigInteger {\n\n    int result;\n    mp_int quotient;\n    mp_init(&quotient);\n    \n    result = mp_div(&m_value, [bigInteger value], &quotient, NULL);\n    if (result == MP_VAL) {\n        mp_clear(&quotient);\n        return nil;\n    }\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&quotient];\n    mp_clear(&quotient);\n    \n    return newBigInteger;\n}\n\n- (id)remainder:(JKBigInteger *)bigInteger {\n\n    int result;\n    mp_int remainder;\n    mp_init(&remainder);\n    \n    result = mp_div(&m_value, [bigInteger value], NULL, &remainder);\n    if (result == MP_VAL) {\n        mp_clear(&remainder);\n        return nil;\n    }\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&remainder];\n    mp_clear(&remainder);\n    \n    return newBigInteger;\n}\n\n- (NSArray *)divideAndRemainder:(JKBigInteger *)bigInteger {\n\n    int result;\n    mp_int quotient, remainder;\n    mp_init_multi(&quotient, &remainder, NULL);\n    \n    result = mp_div(&m_value, [bigInteger value], &quotient, &remainder);\n    if (result == MP_VAL) {\n        mp_clear_multi(&quotient, &remainder, NULL);\n        return nil;\n    }\n    \n    JKBigInteger *quotientBigInteger = [[JKBigInteger alloc] initWithValue:&quotient];\n    JKBigInteger *remainderBigInteger = [[JKBigInteger alloc] initWithValue:&remainder];\n    mp_clear_multi(&quotient, &remainder, NULL);\n    \n    return @[quotientBigInteger, remainderBigInteger];\n}\n\n- (id)pow:(unsigned int)exponent {\n\n    int result;\n    mp_int power;\n    mp_init(&power);\n    \n    result = mp_expt_d(&m_value, (mp_digit)exponent, &power);\n    if (result == MP_VAL) {\n        mp_clear(&power);\n        return nil;\n    }\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&power];\n    mp_clear(&power);\n    \n    return newBigInteger;\n}\n\n- (id)pow:(JKBigInteger*)exponent andMod: (JKBigInteger*)modulus {\n\n    int result;\n    mp_int output;\n    mp_init(&output);\n    \n    result = mp_exptmod(&m_value, &exponent->m_value, &modulus->m_value, &output);\n    if (result == MP_VAL) {\n        mp_clear(&output);\n        return nil;\n    }\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&output];\n    mp_clear(&output);\n    \n    return newBigInteger;\n}\n\n- (id)negate {\n\n    mp_int negate;\n    mp_init(&negate);\n    mp_neg(&m_value, &negate);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&negate];\n    mp_clear(&negate);\n    \n    return newBigInteger;\n}\n\n- (id)abs {\n\n    mp_int absolute;\n    mp_init(&absolute);\n    mp_abs(&m_value, &absolute);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&absolute];\n    mp_clear(&absolute);\n    \n    return newBigInteger;\n}\n\n- (id)bitwiseXor:(JKBigInteger *)bigInteger {\n\n    mp_int xor;\n    mp_init(&xor);\n    mp_xor(&m_value, [bigInteger value], &xor);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&xor];\n    mp_clear(&xor);\n    \n    return newBigInteger;\n}\n\n- (id)bitwiseOr:(JKBigInteger *)bigInteger {\n\n    mp_int or;\n    mp_init(&or);\n    mp_or(&m_value, [bigInteger value], &or);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&or];\n    mp_clear(&or);\n    \n    return newBigInteger;\n}\n\n- (id)bitwiseAnd:(JKBigInteger *)bigInteger {\n\n    mp_int and;\n    mp_init(&and);\n    mp_and(&m_value, [bigInteger value], &and);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&and];\n    mp_clear(&and);\n    \n    return newBigInteger;\n}\n\n- (id)shiftLeft:(unsigned int)n {\n\n    mp_int lShift;\n    mp_init(&lShift);\n\tmp_mul_2d(&m_value, n, &lShift);\n\t\n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&lShift];\n    mp_clear(&lShift);\n    \n    return newBigInteger;\n}\n\n- (id)shiftRight:(unsigned int)n {\n\n    mp_int rShift;\n    mp_init(&rShift);\n    mp_div_2d(&m_value, n, &rShift, NULL);\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&rShift];\n    mp_clear(&rShift);\n    \n    return newBigInteger;\n}\n- (id)gcd:(JKBigInteger *)bigInteger {\n\n    int result;\n    mp_int gcd;\n    mp_init(&gcd);\n    \n    result = mp_gcd(&m_value, [bigInteger value], &gcd);\n    if (result == MP_VAL) {\n        mp_clear(&gcd);\n        return nil;\n    }\n    \n    JKBigInteger *newBigInteger = [[JKBigInteger alloc] initWithValue:&gcd];\n    mp_clear(&gcd);\n    \n    return newBigInteger;\n}\n\n- (NSComparisonResult) compare:(JKBigInteger *)bigInteger {\n\n    NSComparisonResult comparisonResult;\n    comparisonResult = mp_cmp([bigInteger value], &m_value);\n    \n    switch (comparisonResult) {\n        case MP_GT:\n            return NSOrderedAscending;\n        case MP_EQ:\n            return NSOrderedSame;\n        case MP_LT:\n            return NSOrderedDescending;\n        default:\n            return 0;\n    }\n}\n\n- (unsigned long)unsignedIntValue {\n    return mp_get_int(&m_value);\n}\n\n- (NSString *)stringValue {\n\n    int radix = 10;\n    return [self stringValueWithRadix:radix];\n}\n\n- (NSString *)stringValueWithRadix:(int)radix {\n\n    int stringSize;\n    mp_radix_size(&m_value, radix, &stringSize);\n    char cString[stringSize];\n    mp_toradix(&m_value, cString, radix);\n    \n    for (int i = 0; i < stringSize; ++i) {\n        cString[i] = (char)tolower(cString[i]);\n    }\n    \n    return [NSString stringWithUTF8String:cString];\n}\n\n- (NSString *)description {\n    return [self stringValue];\n}\n\n- (void)dealloc {\n    mp_clear(&m_value);\n}\n\n/* Returns the number of bytes required to store this JKBigInteger as binary */\n- (unsigned int)countBytes {\n    return (unsigned int) mp_unsigned_bin_size(&m_value);\n}\n\n/* Retrieves the signed [big endian] format of this JKBigInteger */\n- (void)toByteArraySigned: (unsigned char*) byteArray {\n    mp_to_signed_bin(&m_value, byteArray);\n}\n\n/* Retrieves the unsigned [big endian] format of this JKBigInteger */\n- (void)toByteArrayUnsigned: (unsigned char*) byteArray {\n    mp_to_unsigned_bin(&m_value, byteArray);\n}\n\n@end\n"
  },
  {
    "path": "ios/JKBigInteger/LibTomMath/tommath.c",
    "content": "#include \"tommath.h\"\n\n#ifdef BN_S_MP_MUL_DIGS_C\n/* LibTomMath, multiple-precision integer library -- Tom St Denis\n *\n * LibTomMath is a library that provides multiple-precision\n * integer arithmetic as well as number theoretic functionality.\n *\n * The library was designed directly after the MPI library by\n * Michael Fromberger but has been written from scratch with\n * additional optimizations in place.\n *\n * The library is free for all purposes without any express\n * guarantee it works.\n *\n * Tom St Denis, tomstdenis@gmail.com, http://libtom.org\n */\n\n/* multiplies |a| * |b| and only computes upto digs digits of result\n * HAC pp. 595, Algorithm 14.12  Modified so you can control how \n * many digits of output are created.\n */\nint s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)\n{\n  mp_int  t;\n  int     res, pa, pb, ix, iy;\n  mp_digit u;\n  mp_word r;\n  mp_digit tmpx, *tmpt, *tmpy;\n\n  /* can we use the fast multiplier? */\n  if (((digs) < MP_WARRAY) &&\n      MIN (a->used, b->used) < \n          (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {\n    return fast_s_mp_mul_digs (a, b, c, digs);\n  }\n\n  if ((res = mp_init_size (&t, digs)) != MP_OKAY) {\n    return res;\n  }\n  t.used = digs;\n\n  /* compute the digits of the product directly */\n  pa = a->used;\n  for (ix = 0; ix < pa; ix++) {\n    /* set the carry to zero */\n    u = 0;\n\n    /* limit ourselves to making digs digits of output */\n    pb = MIN (b->used, digs - ix);\n\n    /* setup some aliases */\n    /* copy of the digit from a used within the nested loop */\n    tmpx = a->dp[ix];\n    \n    /* an alias for the destination shifted ix places */\n    tmpt = t.dp + ix;\n    \n    /* an alias for the digits of b */\n    tmpy = b->dp;\n\n    /* compute the columns of the output and propagate the carry */\n    for (iy = 0; iy < pb; iy++) {\n      /* compute the column as a mp_word */\n      r       = ((mp_word)*tmpt) +\n                ((mp_word)tmpx) * ((mp_word)*tmpy++) +\n                ((mp_word) u);\n\n      /* the new column is the lower part of the result */\n      *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));\n\n      /* get the carry word from the result */\n      u       = (mp_digit) (r >> ((mp_word) DIGIT_BIT));\n    }\n    /* set carry if it is placed below digs */\n    if (ix + iy < digs) {\n      *tmpt = u;\n    }\n  }\n\n  mp_clamp (&t);\n  mp_exch (&t, c);\n\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_TO_UNSIGNED_BIN_N_C\n\n/* store in unsigned [big endian] format */\nint mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen)\n{\n   if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) {\n      return MP_VAL;\n   }\n   *outlen = mp_unsigned_bin_size(a);\n   return mp_to_unsigned_bin(a, b);\n}\n#endif\n\n#ifdef BN_MP_EXPT_D_C\n\n/* calculate c = a**b  using a square-multiply algorithm */\nint mp_expt_d (mp_int * a, mp_digit b, mp_int * c)\n{\n  int     res, x;\n  mp_int  g;\n\n  if ((res = mp_init_copy (&g, a)) != MP_OKAY) {\n    return res;\n  }\n\n  /* set initial result */\n  mp_set (c, 1);\n\n  for (x = 0; x < (int) DIGIT_BIT; x++) {\n    /* square */\n    if ((res = mp_sqr (c, c)) != MP_OKAY) {\n      mp_clear (&g);\n      return res;\n    }\n\n    /* if the bit is set multiply */\n    if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) {\n      if ((res = mp_mul (c, &g, c)) != MP_OKAY) {\n         mp_clear (&g);\n         return res;\n      }\n    }\n\n    /* shift to next bit */\n    b <<= 1;\n  }\n\n  mp_clear (&g);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_SET_INT_C\n\n/* set a 32-bit const */\nint mp_set_int (mp_int * a, unsigned long b)\n{\n  int     x, res;\n\n  mp_zero (a);\n  \n  /* set four bits at a time */\n  for (x = 0; x < 8; x++) {\n    /* shift the number up four bits */\n    if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) {\n      return res;\n    }\n\n    /* OR in the top four bits of the source */\n    a->dp[0] |= (b >> 28) & 15;\n\n    /* shift the source up to the next four bits */\n    b <<= 4;\n\n    /* ensure that digits are not clamped off */\n    a->used += 1;\n  }\n  mp_clamp (a);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_ADD_C\n\n/* high level addition (handles signs) */\nint mp_add (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     sa, sb, res;\n\n  /* get sign of both inputs */\n  sa = a->sign;\n  sb = b->sign;\n\n  /* handle two cases, not four */\n  if (sa == sb) {\n    /* both positive or both negative */\n    /* add their magnitudes, copy the sign */\n    c->sign = sa;\n    res = s_mp_add (a, b, c);\n  } else {\n    /* one positive, the other negative */\n    /* subtract the one with the greater magnitude from */\n    /* the one of the lesser magnitude.  The result gets */\n    /* the sign of the one with the greater magnitude. */\n    if (mp_cmp_mag (a, b) == MP_LT) {\n      c->sign = sb;\n      res = s_mp_sub (b, a, c);\n    } else {\n      c->sign = sa;\n      res = s_mp_sub (a, b, c);\n    }\n  }\n  return res;\n}\n\n#endif\n\n#ifdef BN_MP_INIT_C\n\n/* init a new mp_int */\nint mp_init (mp_int * a)\n{\n  int i;\n\n  /* allocate memory required and clear it */\n  a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC);\n  if (a->dp == NULL) {\n    return MP_MEM;\n  }\n\n  /* set the digits to zero */\n  for (i = 0; i < MP_PREC; i++) {\n      a->dp[i] = 0;\n  }\n\n  /* set the used to zero, allocated digits to the default precision\n   * and sign to positive */\n  a->used  = 0;\n  a->alloc = MP_PREC;\n  a->sign  = MP_ZPOS;\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_CNT_LSB_C\n\nstatic const int lnz[16] = { \n   4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0\n};\n\n/* Counts the number of lsbs which are zero before the first zero bit */\nint mp_cnt_lsb(mp_int *a)\n{\n   int x;\n   mp_digit q, qq;\n\n   /* easy out */\n   if (mp_iszero(a) == 1) {\n      return 0;\n   }\n\n   /* scan lower digits until non-zero */\n   for (x = 0; x < a->used && a->dp[x] == 0; x++);\n   q = a->dp[x];\n   x *= DIGIT_BIT;\n\n   /* now scan this digit until a 1 is found */\n   if ((q & 1) == 0) {\n      do {\n         qq  = q & 15;\n         x  += lnz[qq];\n         q >>= 4;\n      } while (qq == 0);\n   }\n   return x;\n}\n\n#endif\n\n#ifdef BN_MP_TOOM_SQR_C\n\n/* squaring using Toom-Cook 3-way algorithm */\nint\nmp_toom_sqr(mp_int *a, mp_int *b)\n{\n    mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2;\n    int res, B;\n\n    /* init temps */\n    if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) {\n       return res;\n    }\n\n    /* B */\n    B = a->used / 3;\n\n    /* a = a2 * B**2 + a1 * B + a0 */\n    if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    if ((res = mp_copy(a, &a1)) != MP_OKAY) {\n       goto ERR;\n    }\n    mp_rshd(&a1, B);\n    mp_mod_2d(&a1, DIGIT_BIT * B, &a1);\n\n    if ((res = mp_copy(a, &a2)) != MP_OKAY) {\n       goto ERR;\n    }\n    mp_rshd(&a2, B*2);\n\n    /* w0 = a0*a0 */\n    if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    /* w4 = a2 * a2 */\n    if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    /* w1 = (a2 + 2(a1 + 2a0))**2 */\n    if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    /* w3 = (a0 + 2(a1 + 2a2))**2 */\n    if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) {\n       goto ERR;\n    }\n\n\n    /* w2 = (a2 + a1 + a0)**2 */\n    if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    /* now solve the matrix\n\n       0  0  0  0  1\n       1  2  4  8  16\n       1  1  1  1  1\n       16 8  4  2  1\n       1  0  0  0  0\n\n       using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication.\n     */\n\n     /* r1 - r4 */\n     if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - r0 */\n     if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1/2 */\n     if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3/2 */\n     if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r2 - r0 - r4 */\n     if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1 - r2 */\n     if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - r2 */\n     if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1 - 8r0 */\n     if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - 8r4 */\n     if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* 3r2 - r1 - r3 */\n     if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1 - r2 */\n     if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - r2 */\n     if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1/3 */\n     if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3/3 */\n     if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) {\n        goto ERR;\n     }\n\n     /* at this point shift W[n] by B*n */\n     if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) {\n        goto ERR;\n     }\n\n     if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) {\n        goto ERR;\n     }\n\nERR:\n     mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL);\n     return res;\n}\n\n#endif\n\n#ifdef BN_MP_FREAD_C\n\n/* read a bigint from a file stream in ASCII */\nint mp_fread(mp_int *a, int radix, FILE *stream)\n{\n   int err, ch, neg, y;\n   \n   /* clear a */\n   mp_zero(a);\n   \n   /* if first digit is - then set negative */\n   ch = fgetc(stream);\n   if (ch == '-') {\n      neg = MP_NEG;\n      ch = fgetc(stream);\n   } else {\n      neg = MP_ZPOS;\n   }\n   \n   for (;;) {\n      /* find y in the radix map */\n      for (y = 0; y < radix; y++) {\n          if (mp_s_rmap[y] == ch) {\n             break;\n          }\n      }\n      if (y == radix) {\n         break;\n      }\n      \n      /* shift up and add */\n      if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) {\n         return err;\n      }\n      if ((err = mp_add_d(a, y, a)) != MP_OKAY) {\n         return err;\n      }\n      \n      ch = fgetc(stream);\n   }\n   if (mp_cmp_d(a, 0) != MP_EQ) {\n      a->sign = neg;\n   }\n   \n   return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_DIV_3_C\n\n/* divide by three (based on routine from MPI and the GMP manual) */\nint\nmp_div_3 (mp_int * a, mp_int *c, mp_digit * d)\n{\n  mp_int   q;\n  mp_word  w, t;\n  mp_digit b;\n  int      res, ix;\n  \n  /* b = 2**DIGIT_BIT / 3 */\n  b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3);\n\n  if ((res = mp_init_size(&q, a->used)) != MP_OKAY) {\n     return res;\n  }\n  \n  q.used = a->used;\n  q.sign = a->sign;\n  w = 0;\n  for (ix = a->used - 1; ix >= 0; ix--) {\n     w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]);\n\n     if (w >= 3) {\n        /* multiply w by [1/3] */\n        t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT);\n\n        /* now subtract 3 * [w/3] from w, to get the remainder */\n        w -= t+t+t;\n\n        /* fixup the remainder as required since\n         * the optimization is not exact.\n         */\n        while (w >= 3) {\n           t += 1;\n           w -= 3;\n        }\n      } else {\n        t = 0;\n      }\n      q.dp[ix] = (mp_digit)t;\n  }\n\n  /* [optional] store the remainder */\n  if (d != NULL) {\n     *d = (mp_digit)w;\n  }\n\n  /* [optional] store the quotient */\n  if (c != NULL) {\n     mp_clamp(&q);\n     mp_exch(&q, c);\n  }\n  mp_clear(&q);\n  \n  return res;\n}\n\n#endif\n\n#ifdef BN_MP_LCM_C\n\n/* computes least common multiple as |a*b|/(a, b) */\nint mp_lcm (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     res;\n  mp_int  t1, t2;\n\n\n  if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) {\n    return res;\n  }\n\n  /* t1 = get the GCD of the two inputs */\n  if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) {\n    goto LBL_T;\n  }\n\n  /* divide the smallest by the GCD */\n  if (mp_cmp_mag(a, b) == MP_LT) {\n     /* store quotient in t2 such that t2 * b is the LCM */\n     if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) {\n        goto LBL_T;\n     }\n     res = mp_mul(b, &t2, c);\n  } else {\n     /* store quotient in t2 such that t2 * a is the LCM */\n     if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) {\n        goto LBL_T;\n     }\n     res = mp_mul(a, &t2, c);\n  }\n\n  /* fix the sign to positive */\n  c->sign = MP_ZPOS;\n\nLBL_T:\n  mp_clear_multi (&t1, &t2, NULL);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_REDUCE_IS_2K_C\n\n/* determines if mp_reduce_2k can be used */\nint mp_reduce_is_2k(mp_int *a)\n{\n   int ix, iy, iw;\n   mp_digit iz;\n   \n   if (a->used == 0) {\n      return MP_NO;\n   } else if (a->used == 1) {\n      return MP_YES;\n   } else if (a->used > 1) {\n      iy = mp_count_bits(a);\n      iz = 1;\n      iw = 1;\n    \n      /* Test every bit from the second digit up, must be 1 */\n      for (ix = DIGIT_BIT; ix < iy; ix++) {\n          if ((a->dp[iw] & iz) == 0) {\n             return MP_NO;\n          }\n          iz <<= 1;\n          if (iz > (mp_digit)MP_MASK) {\n             ++iw;\n             iz = 1;\n          }\n      }\n   }\n   return MP_YES;\n}\n\n#endif\n\n#ifdef BNCORE_C\n\n/* Known optimal configurations\n\n CPU                    /Compiler     /MUL CUTOFF/SQR CUTOFF\n-------------------------------------------------------------\n Intel P4 Northwood     /GCC v3.4.1   /        88/       128/LTM 0.32 ;-)\n AMD Athlon64           /GCC v3.4.4   /        80/       120/LTM 0.35\n \n*/\n\nint     KARATSUBA_MUL_CUTOFF = 80,      /* Min. number of digits before Karatsuba multiplication is used. */\n        KARATSUBA_SQR_CUTOFF = 120,     /* Min. number of digits before Karatsuba squaring is used. */\n        \n        TOOM_MUL_CUTOFF      = 350,      /* no optimal values of these are known yet so set em high */\n        TOOM_SQR_CUTOFF      = 400; \n#endif\n\n#ifdef BN_MP_MOD_2D_C\n\n/* calc a value mod 2**b */\nint\nmp_mod_2d (mp_int * a, int b, mp_int * c)\n{\n  int     x, res;\n\n  /* if b is <= 0 then zero the int */\n  if (b <= 0) {\n    mp_zero (c);\n    return MP_OKAY;\n  }\n\n  /* if the modulus is larger than the value than return */\n  if (b >= (int) (a->used * DIGIT_BIT)) {\n    res = mp_copy (a, c);\n    return res;\n  }\n\n  /* copy */\n  if ((res = mp_copy (a, c)) != MP_OKAY) {\n    return res;\n  }\n\n  /* zero digits above the last digit of the modulus */\n  for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) {\n    c->dp[x] = 0;\n  }\n  /* clear the digit that is not completely outside/inside the modulus */\n  c->dp[b / DIGIT_BIT] &=\n    (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1));\n  mp_clamp (c);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_N_ROOT_C\n\n/* find the n'th root of an integer \n *\n * Result found such that (c)**b <= a and (c+1)**b > a \n *\n * This algorithm uses Newton's approximation \n * x[i+1] = x[i] - f(x[i])/f'(x[i]) \n * which will find the root in log(N) time where \n * each step involves a fair bit.  This is not meant to \n * find huge roots [square and cube, etc].\n */\nint mp_n_root (mp_int * a, mp_digit b, mp_int * c)\n{\n  mp_int  t1, t2, t3;\n  int     res, neg;\n\n  /* input must be positive if b is even */\n  if ((b & 1) == 0 && a->sign == MP_NEG) {\n    return MP_VAL;\n  }\n\n  if ((res = mp_init (&t1)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_init (&t2)) != MP_OKAY) {\n    goto LBL_T1;\n  }\n\n  if ((res = mp_init (&t3)) != MP_OKAY) {\n    goto LBL_T2;\n  }\n\n  /* if a is negative fudge the sign but keep track */\n  neg     = a->sign;\n  a->sign = MP_ZPOS;\n\n  /* t2 = 2 */\n  mp_set (&t2, 2);\n\n  do {\n    /* t1 = t2 */\n    if ((res = mp_copy (&t2, &t1)) != MP_OKAY) {\n      goto LBL_T3;\n    }\n\n    /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */\n    \n    /* t3 = t1**(b-1) */\n    if ((res = mp_expt_d (&t1, b - 1, &t3)) != MP_OKAY) {   \n      goto LBL_T3;\n    }\n\n    /* numerator */\n    /* t2 = t1**b */\n    if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) {    \n      goto LBL_T3;\n    }\n\n    /* t2 = t1**b - a */\n    if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) {  \n      goto LBL_T3;\n    }\n\n    /* denominator */\n    /* t3 = t1**(b-1) * b  */\n    if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) {    \n      goto LBL_T3;\n    }\n\n    /* t3 = (t1**b - a)/(b * t1**(b-1)) */\n    if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) {  \n      goto LBL_T3;\n    }\n\n    if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) {\n      goto LBL_T3;\n    }\n  }  while (mp_cmp (&t1, &t2) != MP_EQ);\n\n  /* result can be off by a few so check */\n  for (;;) {\n    if ((res = mp_expt_d (&t1, b, &t2)) != MP_OKAY) {\n      goto LBL_T3;\n    }\n\n    if (mp_cmp (&t2, a) == MP_GT) {\n      if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) {\n         goto LBL_T3;\n      }\n    } else {\n      break;\n    }\n  }\n\n  /* reset the sign of a first */\n  a->sign = neg;\n\n  /* set the result */\n  mp_exch (&t1, c);\n\n  /* set the sign of the result */\n  c->sign = neg;\n\n  res = MP_OKAY;\n\nLBL_T3:mp_clear (&t3);\nLBL_T2:mp_clear (&t2);\nLBL_T1:mp_clear (&t1);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_MULMOD_C\n\n/* d = a * b (mod c) */\nint mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)\n{\n  int     res;\n  mp_int  t;\n\n  if ((res = mp_init (&t)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_mul (a, b, &t)) != MP_OKAY) {\n    mp_clear (&t);\n    return res;\n  }\n  res = mp_mod (&t, c, d);\n  mp_clear (&t);\n  return res;\n}\n#endif\n\n#ifdef BN_ERROR_C\n\nstatic const struct {\n     int code;\n     char *msg;\n} msgs[] = {\n     { MP_OKAY, \"Successful\" },\n     { MP_MEM,  \"Out of heap\" },\n     { MP_VAL,  \"Value out of range\" }\n};\n\n/* return a char * string for a given code */\nchar *mp_error_to_string(int code)\n{\n   int x;\n\n   /* scan the lookup table for the given message */\n   for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) {\n       if (msgs[x].code == code) {\n          return msgs[x].msg;\n       }\n   }\n\n   /* generic reply for invalid code */\n   return \"Invalid error code\";\n}\n\n#endif\n\n#ifdef BN_MP_REDUCE_C\n\n/* reduces x mod m, assumes 0 < x < m**2, mu is \n * precomputed via mp_reduce_setup.\n * From HAC pp.604 Algorithm 14.42\n */\nint mp_reduce (mp_int * x, mp_int * m, mp_int * mu)\n{\n  mp_int  q;\n  int     res, um = m->used;\n\n  /* q = x */\n  if ((res = mp_init_copy (&q, x)) != MP_OKAY) {\n    return res;\n  }\n\n  /* q1 = x / b**(k-1)  */\n  mp_rshd (&q, um - 1);         \n\n  /* according to HAC this optimization is ok */\n  if (((unsigned long) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) {\n    if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) {\n      goto CLEANUP;\n    }\n  } else {\n#ifdef BN_S_MP_MUL_HIGH_DIGS_C\n    if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {\n      goto CLEANUP;\n    }\n#elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C)\n    if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {\n      goto CLEANUP;\n    }\n#else \n    { \n      res = MP_VAL;\n      goto CLEANUP;\n    }\n#endif\n  }\n\n  /* q3 = q2 / b**(k+1) */\n  mp_rshd (&q, um + 1);         \n\n  /* x = x mod b**(k+1), quick (no division) */\n  if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) {\n    goto CLEANUP;\n  }\n\n  /* q = q * m mod b**(k+1), quick (no division) */\n  if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) {\n    goto CLEANUP;\n  }\n\n  /* x = x - q */\n  if ((res = mp_sub (x, &q, x)) != MP_OKAY) {\n    goto CLEANUP;\n  }\n\n  /* If x < 0, add b**(k+1) to it */\n  if (mp_cmp_d (x, 0) == MP_LT) {\n    mp_set (&q, 1);\n    if ((res = mp_lshd (&q, um + 1)) != MP_OKAY)\n      goto CLEANUP;\n    if ((res = mp_add (x, &q, x)) != MP_OKAY)\n      goto CLEANUP;\n  }\n\n  /* Back off if it's too big */\n  while (mp_cmp (x, m) != MP_LT) {\n    if ((res = s_mp_sub (x, m, x)) != MP_OKAY) {\n      goto CLEANUP;\n    }\n  }\n  \nCLEANUP:\n  mp_clear (&q);\n\n  return res;\n}\n#endif\n\n#ifdef BN_MP_KARATSUBA_SQR_C\n\n/* Karatsuba squaring, computes b = a*a using three \n * half size squarings\n *\n * See comments of karatsuba_mul for details.  It \n * is essentially the same algorithm but merely \n * tuned to perform recursive squarings.\n */\nint mp_karatsuba_sqr (mp_int * a, mp_int * b)\n{\n  mp_int  x0, x1, t1, t2, x0x0, x1x1;\n  int     B, err;\n\n  err = MP_MEM;\n\n  /* min # of digits */\n  B = a->used;\n\n  /* now divide in two */\n  B = B >> 1;\n\n  /* init copy all the temps */\n  if (mp_init_size (&x0, B) != MP_OKAY)\n    goto ERR;\n  if (mp_init_size (&x1, a->used - B) != MP_OKAY)\n    goto X0;\n\n  /* init temps */\n  if (mp_init_size (&t1, a->used * 2) != MP_OKAY)\n    goto X1;\n  if (mp_init_size (&t2, a->used * 2) != MP_OKAY)\n    goto T1;\n  if (mp_init_size (&x0x0, B * 2) != MP_OKAY)\n    goto T2;\n  if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY)\n    goto X0X0;\n\n  {\n    register int x;\n    register mp_digit *dst, *src;\n\n    src = a->dp;\n\n    /* now shift the digits */\n    dst = x0.dp;\n    for (x = 0; x < B; x++) {\n      *dst++ = *src++;\n    }\n\n    dst = x1.dp;\n    for (x = B; x < a->used; x++) {\n      *dst++ = *src++;\n    }\n  }\n\n  x0.used = B;\n  x1.used = a->used - B;\n\n  mp_clamp (&x0);\n\n  /* now calc the products x0*x0 and x1*x1 */\n  if (mp_sqr (&x0, &x0x0) != MP_OKAY)\n    goto X1X1;           /* x0x0 = x0*x0 */\n  if (mp_sqr (&x1, &x1x1) != MP_OKAY)\n    goto X1X1;           /* x1x1 = x1*x1 */\n\n  /* now calc (x1+x0)**2 */\n  if (s_mp_add (&x1, &x0, &t1) != MP_OKAY)\n    goto X1X1;           /* t1 = x1 - x0 */\n  if (mp_sqr (&t1, &t1) != MP_OKAY)\n    goto X1X1;           /* t1 = (x1 - x0) * (x1 - x0) */\n\n  /* add x0y0 */\n  if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY)\n    goto X1X1;           /* t2 = x0x0 + x1x1 */\n  if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY)\n    goto X1X1;           /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */\n\n  /* shift by B */\n  if (mp_lshd (&t1, B) != MP_OKAY)\n    goto X1X1;           /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<<B */\n  if (mp_lshd (&x1x1, B * 2) != MP_OKAY)\n    goto X1X1;           /* x1x1 = x1x1 << 2*B */\n\n  if (mp_add (&x0x0, &t1, &t1) != MP_OKAY)\n    goto X1X1;           /* t1 = x0x0 + t1 */\n  if (mp_add (&t1, &x1x1, b) != MP_OKAY)\n    goto X1X1;           /* t1 = x0x0 + t1 + x1x1 */\n\n  err = MP_OKAY;\n\nX1X1:mp_clear (&x1x1);\nX0X0:mp_clear (&x0x0);\nT2:mp_clear (&t2);\nT1:mp_clear (&t1);\nX1:mp_clear (&x1);\nX0:mp_clear (&x0);\nERR:\n  return err;\n}\n#endif\n\n#ifdef BN_MP_PRIME_IS_DIVISIBLE_C\n\n/* determines if an integers is divisible by one \n * of the first PRIME_SIZE primes or not\n *\n * sets result to 0 if not, 1 if yes\n */\nint mp_prime_is_divisible (mp_int * a, int *result)\n{\n  int     err, ix;\n  mp_digit res;\n\n  /* default to not */\n  *result = MP_NO;\n\n  for (ix = 0; ix < PRIME_SIZE; ix++) {\n    /* what is a mod LBL_prime_tab[ix] */\n    if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) {\n      return err;\n    }\n\n    /* is the residue zero? */\n    if (res == 0) {\n      *result = MP_YES;\n      return MP_OKAY;\n    }\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_ZERO_C\n\n/* set to zero */\nvoid mp_zero (mp_int * a)\n{\n  int       n;\n  mp_digit *tmp;\n\n  a->sign = MP_ZPOS;\n  a->used = 0;\n\n  tmp = a->dp;\n  for (n = 0; n < a->alloc; n++) {\n     *tmp++ = 0;\n  }\n}\n#endif\n\n#ifdef BN_MP_TORADIX_C\n\n/* stores a bignum as a ASCII string in a given radix (2..64) */\nint mp_toradix (mp_int * a, char *str, int radix)\n{\n  int     res, digs;\n  mp_int  t;\n  mp_digit d;\n  char   *_s = str;\n\n  /* check range of the radix */\n  if (radix < 2 || radix > 64) {\n    return MP_VAL;\n  }\n\n  /* quick out if its zero */\n  if (mp_iszero(a) == 1) {\n     *str++ = '0';\n     *str = '\\0';\n     return MP_OKAY;\n  }\n\n  if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n    return res;\n  }\n\n  /* if it is negative output a - */\n  if (t.sign == MP_NEG) {\n    ++_s;\n    *str++ = '-';\n    t.sign = MP_ZPOS;\n  }\n\n  digs = 0;\n  while (mp_iszero (&t) == 0) {\n    if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {\n      mp_clear (&t);\n      return res;\n    }\n    *str++ = mp_s_rmap[d];\n    ++digs;\n  }\n\n  /* reverse the digits of the string.  In this case _s points\n   * to the first digit [exluding the sign] of the number]\n   */\n  bn_reverse ((unsigned char *)_s, digs);\n\n  /* append a NULL so the string is properly terminated */\n  *str = '\\0';\n\n  mp_clear (&t);\n  return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_DIV_D_C\n\nstatic int s_is_power_of_two(mp_digit b, int *p)\n{\n   int x;\n\n   /* fast return if no power of two */\n   if ((b==0) || (b & (b-1))) {\n      return 0;\n   }\n\n   for (x = 0; x < DIGIT_BIT; x++) {\n      if (b == (((mp_digit)1)<<x)) {\n         *p = x;\n         return 1;\n      }\n   }\n   return 0;\n}\n\n/* single digit division (based on routine from MPI) */\nint mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)\n{\n  mp_int  q;\n  mp_word w;\n  mp_digit t;\n  int     res, ix;\n\n  /* cannot divide by zero */\n  if (b == 0) {\n     return MP_VAL;\n  }\n\n  /* quick outs */\n  if (b == 1 || mp_iszero(a) == 1) {\n     if (d != NULL) {\n        *d = 0;\n     }\n     if (c != NULL) {\n        return mp_copy(a, c);\n     }\n     return MP_OKAY;\n  }\n\n  /* power of two ? */\n  if (s_is_power_of_two(b, &ix) == 1) {\n     if (d != NULL) {\n        *d = a->dp[0] & ((((mp_digit)1)<<ix) - 1);\n     }\n     if (c != NULL) {\n        return mp_div_2d(a, ix, c, NULL);\n     }\n     return MP_OKAY;\n  }\n\n#ifdef BN_MP_DIV_3_C\n  /* three? */\n  if (b == 3) {\n     return mp_div_3(a, c, d);\n  }\n#endif\n\n  /* no easy answer [c'est la vie].  Just division */\n  if ((res = mp_init_size(&q, a->used)) != MP_OKAY) {\n     return res;\n  }\n  \n  q.used = a->used;\n  q.sign = a->sign;\n  w = 0;\n  for (ix = a->used - 1; ix >= 0; ix--) {\n     w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]);\n     \n     if (w >= b) {\n        t = (mp_digit)(w / b);\n        w -= ((mp_word)t) * ((mp_word)b);\n      } else {\n        t = 0;\n      }\n      q.dp[ix] = (mp_digit)t;\n  }\n  \n  if (d != NULL) {\n     *d = (mp_digit)w;\n  }\n  \n  if (c != NULL) {\n     mp_clamp(&q);\n     mp_exch(&q, c);\n  }\n  mp_clear(&q);\n  \n  return res;\n}\n\n#endif\n\n#ifdef BN_MP_SUB_C\n\n/* high level subtraction (handles signs) */\nint\nmp_sub (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     sa, sb, res;\n\n  sa = a->sign;\n  sb = b->sign;\n\n  if (sa != sb) {\n    /* subtract a negative from a positive, OR */\n    /* subtract a positive from a negative. */\n    /* In either case, ADD their magnitudes, */\n    /* and use the sign of the first number. */\n    c->sign = sa;\n    res = s_mp_add (a, b, c);\n  } else {\n    /* subtract a positive from a positive, OR */\n    /* subtract a negative from a negative. */\n    /* First, take the difference between their */\n    /* magnitudes, then... */\n    if (mp_cmp_mag (a, b) != MP_LT) {\n      /* Copy the sign from the first */\n      c->sign = sa;\n      /* The first has a larger or equal magnitude */\n      res = s_mp_sub (a, b, c);\n    } else {\n      /* The result has the *opposite* sign from */\n      /* the first number. */\n      c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS;\n      /* The second has a larger magnitude */\n      res = s_mp_sub (b, a, c);\n    }\n  }\n  return res;\n}\n\n#endif\n\n#ifdef BN_MP_INIT_SIZE_C\n\n/* init an mp_init for a given size */\nint mp_init_size (mp_int * a, int size)\n{\n  int x;\n\n  /* pad size so there are always extra digits */\n  size += (MP_PREC * 2) - (size % MP_PREC);\t\n  \n  /* alloc mem */\n  a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size);\n  if (a->dp == NULL) {\n    return MP_MEM;\n  }\n\n  /* set the members */\n  a->used  = 0;\n  a->alloc = size;\n  a->sign  = MP_ZPOS;\n\n  /* zero the digits */\n  for (x = 0; x < size; x++) {\n      a->dp[x] = 0;\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_PRIME_NEXT_PRIME_C\n\n/* finds the next prime after the number \"a\" using \"t\" trials\n * of Miller-Rabin.\n *\n * bbs_style = 1 means the prime must be congruent to 3 mod 4\n */\nint mp_prime_next_prime(mp_int *a, int t, int bbs_style)\n{\n   int      err, res = 0, x, y;\n   mp_digit res_tab[PRIME_SIZE], step, kstep;\n   mp_int   b;\n\n   /* ensure t is valid */\n   if (t <= 0 || t > PRIME_SIZE) {\n      return MP_VAL;\n   }\n\n   /* force positive */\n   a->sign = MP_ZPOS;\n\n   /* simple algo if a is less than the largest prime in the table */\n   if (mp_cmp_d(a, ltm_prime_tab[PRIME_SIZE-1]) == MP_LT) {\n      /* find which prime it is bigger than */\n      for (x = PRIME_SIZE - 2; x >= 0; x--) {\n          if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) {\n             if (bbs_style == 1) {\n                /* ok we found a prime smaller or\n                 * equal [so the next is larger]\n                 *\n                 * however, the prime must be\n                 * congruent to 3 mod 4\n                 */\n                if ((ltm_prime_tab[x + 1] & 3) != 3) {\n                   /* scan upwards for a prime congruent to 3 mod 4 */\n                   for (y = x + 1; y < PRIME_SIZE; y++) {\n                       if ((ltm_prime_tab[y] & 3) == 3) {\n                          mp_set(a, ltm_prime_tab[y]);\n                          return MP_OKAY;\n                       }\n                   }\n                }\n             } else {\n                mp_set(a, ltm_prime_tab[x + 1]);\n                return MP_OKAY;\n             }\n          }\n      }\n      /* at this point a maybe 1 */\n      if (mp_cmp_d(a, 1) == MP_EQ) {\n         mp_set(a, 2);\n         return MP_OKAY;\n      }\n      /* fall through to the sieve */\n   }\n\n   /* generate a prime congruent to 3 mod 4 or 1/3 mod 4? */\n   if (bbs_style == 1) {\n      kstep   = 4;\n   } else {\n      kstep   = 2;\n   }\n\n   /* at this point we will use a combination of a sieve and Miller-Rabin */\n\n   if (bbs_style == 1) {\n      /* if a mod 4 != 3 subtract the correct value to make it so */\n      if ((a->dp[0] & 3) != 3) {\n         if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; };\n      }\n   } else {\n      if (mp_iseven(a) == 1) {\n         /* force odd */\n         if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) {\n            return err;\n         }\n      }\n   }\n\n   /* generate the restable */\n   for (x = 1; x < PRIME_SIZE; x++) {\n      if ((err = mp_mod_d(a, ltm_prime_tab[x], res_tab + x)) != MP_OKAY) {\n         return err;\n      }\n   }\n\n   /* init temp used for Miller-Rabin Testing */\n   if ((err = mp_init(&b)) != MP_OKAY) {\n      return err;\n   }\n\n   for (;;) {\n      /* skip to the next non-trivially divisible candidate */\n      step = 0;\n      do {\n         /* y == 1 if any residue was zero [e.g. cannot be prime] */\n         y     =  0;\n\n         /* increase step to next candidate */\n         step += kstep;\n\n         /* compute the new residue without using division */\n         for (x = 1; x < PRIME_SIZE; x++) {\n             /* add the step to each residue */\n             res_tab[x] += kstep;\n\n             /* subtract the modulus [instead of using division] */\n             if (res_tab[x] >= ltm_prime_tab[x]) {\n                res_tab[x]  -= ltm_prime_tab[x];\n             }\n\n             /* set flag if zero */\n             if (res_tab[x] == 0) {\n                y = 1;\n             }\n         }\n      } while (y == 1 && step < ((((mp_digit)1)<<DIGIT_BIT) - kstep));\n\n      /* add the step */\n      if ((err = mp_add_d(a, step, a)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n\n      /* if didn't pass sieve and step == MAX then skip test */\n      if (y == 1 && step >= ((((mp_digit)1)<<DIGIT_BIT) - kstep)) {\n         continue;\n      }\n\n      /* is this prime? */\n      for (x = 0; x < t; x++) {\n          mp_set(&b, ltm_prime_tab[x]);\n          if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {\n             goto LBL_ERR;\n          }\n          if (res == MP_NO) {\n             break;\n          }\n      }\n\n      if (res == MP_YES) {\n         break;\n      }\n   }\n\n   err = MP_OKAY;\nLBL_ERR:\n   mp_clear(&b);\n   return err;\n}\n\n#endif\n\n#ifdef BN_MP_INVMOD_C\n\n/* hac 14.61, pp608 */\nint mp_invmod (mp_int * a, mp_int * b, mp_int * c)\n{\n  /* b cannot be negative */\n  if (b->sign == MP_NEG || mp_iszero(b) == 1) {\n    return MP_VAL;\n  }\n\n#ifdef BN_FAST_MP_INVMOD_C\n  /* if the modulus is odd we can use a faster routine instead */\n  if (mp_isodd (b) == 1) {\n    return fast_mp_invmod (a, b, c);\n  }\n#endif\n\n#ifdef BN_MP_INVMOD_SLOW_C\n  return mp_invmod_slow(a, b, c);\n#endif\n\n  return MP_VAL;\n}\n#endif\n\n#ifdef BN_MP_DIV_2_C\n\n/* b = a/2 */\nint mp_div_2(mp_int * a, mp_int * b)\n{\n  int     x, res, oldused;\n\n  /* copy */\n  if (b->alloc < a->used) {\n    if ((res = mp_grow (b, a->used)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  oldused = b->used;\n  b->used = a->used;\n  {\n    register mp_digit r, rr, *tmpa, *tmpb;\n\n    /* source alias */\n    tmpa = a->dp + b->used - 1;\n\n    /* dest alias */\n    tmpb = b->dp + b->used - 1;\n\n    /* carry */\n    r = 0;\n    for (x = b->used - 1; x >= 0; x--) {\n      /* get the carry for the next iteration */\n      rr = *tmpa & 1;\n\n      /* shift the current digit, add in carry and store */\n      *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1));\n\n      /* forward carry to next iteration */\n      r = rr;\n    }\n\n    /* zero excess digits */\n    tmpb = b->dp + b->used;\n    for (x = b->used; x < oldused; x++) {\n      *tmpb++ = 0;\n    }\n  }\n  b->sign = a->sign;\n  mp_clamp (b);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_INIT_MULTI_C\n\n#include <stdarg.h>\n\nint mp_init_multi(mp_int *mp, ...) \n{\n    mp_err res = MP_OKAY;      /* Assume ok until proven otherwise */\n    int n = 0;                 /* Number of ok inits */\n    mp_int* cur_arg = mp;\n    va_list args;\n\n    va_start(args, mp);        /* init args to next argument from caller */\n    while (cur_arg != NULL) {\n        if (mp_init(cur_arg) != MP_OKAY) {\n            /* Oops - error! Back-track and mp_clear what we already\n               succeeded in init-ing, then return error.\n            */\n            va_list clean_args;\n            \n            /* end the current list */\n            va_end(args);\n            \n            /* now start cleaning up */            \n            cur_arg = mp;\n            va_start(clean_args, mp);\n            while (n--) {\n                mp_clear(cur_arg);\n                cur_arg = va_arg(clean_args, mp_int*);\n            }\n            va_end(clean_args);\n            res = MP_MEM;\n            break;\n        }\n        n++;\n        cur_arg = va_arg(args, mp_int*);\n    }\n    va_end(args);\n    return res;                /* Assumed ok, if error flagged above. */\n}\n\n#endif\n\n#ifdef BN_MP_READ_UNSIGNED_BIN_C\n\n/* reads a unsigned char array, assumes the msb is stored first [big endian] */\nint mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)\n{\n  int     res;\n\n  /* make sure there are at least two digits */\n  if (a->alloc < 2) {\n     if ((res = mp_grow(a, 2)) != MP_OKAY) {\n        return res;\n     }\n  }\n\n  /* zero the int */\n  mp_zero (a);\n\n  /* read the bytes in */\n  while (c-- > 0) {\n    if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) {\n      return res;\n    }\n\n#ifndef MP_8BIT\n      a->dp[0] |= *b++;\n      a->used += 1;\n#else\n      a->dp[0] = (*b & MP_MASK);\n      a->dp[1] |= ((*b++ >> 7U) & 1);\n      a->used += 2;\n#endif\n  }\n  mp_clamp (a);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_KARATSUBA_MUL_C\n\n/* c = |a| * |b| using Karatsuba Multiplication using \n * three half size multiplications\n *\n * Let B represent the radix [e.g. 2**DIGIT_BIT] and \n * let n represent half of the number of digits in \n * the min(a,b)\n *\n * a = a1 * B**n + a0\n * b = b1 * B**n + b0\n *\n * Then, a * b => \n   a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0\n *\n * Note that a1b1 and a0b0 are used twice and only need to be \n * computed once.  So in total three half size (half # of \n * digit) multiplications are performed, a0b0, a1b1 and \n * (a1+b1)(a0+b0)\n *\n * Note that a multiplication of half the digits requires\n * 1/4th the number of single precision multiplications so in \n * total after one call 25% of the single precision multiplications \n * are saved.  Note also that the call to mp_mul can end up back \n * in this function if the a0, a1, b0, or b1 are above the threshold.  \n * This is known as divide-and-conquer and leads to the famous \n * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than \n * the standard O(N**2) that the baseline/comba methods use.  \n * Generally though the overhead of this method doesn't pay off \n * until a certain size (N ~ 80) is reached.\n */\nint mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c)\n{\n  mp_int  x0, x1, y0, y1, t1, x0y0, x1y1;\n  int     B, err;\n\n  /* default the return code to an error */\n  err = MP_MEM;\n\n  /* min # of digits */\n  B = MIN (a->used, b->used);\n\n  /* now divide in two */\n  B = B >> 1;\n\n  /* init copy all the temps */\n  if (mp_init_size (&x0, B) != MP_OKAY)\n    goto ERR;\n  if (mp_init_size (&x1, a->used - B) != MP_OKAY)\n    goto X0;\n  if (mp_init_size (&y0, B) != MP_OKAY)\n    goto X1;\n  if (mp_init_size (&y1, b->used - B) != MP_OKAY)\n    goto Y0;\n\n  /* init temps */\n  if (mp_init_size (&t1, B * 2) != MP_OKAY)\n    goto Y1;\n  if (mp_init_size (&x0y0, B * 2) != MP_OKAY)\n    goto T1;\n  if (mp_init_size (&x1y1, B * 2) != MP_OKAY)\n    goto X0Y0;\n\n  /* now shift the digits */\n  x0.used = y0.used = B;\n  x1.used = a->used - B;\n  y1.used = b->used - B;\n\n  {\n    register int x;\n    register mp_digit *tmpa, *tmpb, *tmpx, *tmpy;\n\n    /* we copy the digits directly instead of using higher level functions\n     * since we also need to shift the digits\n     */\n    tmpa = a->dp;\n    tmpb = b->dp;\n\n    tmpx = x0.dp;\n    tmpy = y0.dp;\n    for (x = 0; x < B; x++) {\n      *tmpx++ = *tmpa++;\n      *tmpy++ = *tmpb++;\n    }\n\n    tmpx = x1.dp;\n    for (x = B; x < a->used; x++) {\n      *tmpx++ = *tmpa++;\n    }\n\n    tmpy = y1.dp;\n    for (x = B; x < b->used; x++) {\n      *tmpy++ = *tmpb++;\n    }\n  }\n\n  /* only need to clamp the lower words since by definition the \n   * upper words x1/y1 must have a known number of digits\n   */\n  mp_clamp (&x0);\n  mp_clamp (&y0);\n\n  /* now calc the products x0y0 and x1y1 */\n  /* after this x0 is no longer required, free temp [x0==t2]! */\n  if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY)  \n    goto X1Y1;          /* x0y0 = x0*y0 */\n  if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY)\n    goto X1Y1;          /* x1y1 = x1*y1 */\n\n  /* now calc x1+x0 and y1+y0 */\n  if (s_mp_add (&x1, &x0, &t1) != MP_OKAY)\n    goto X1Y1;          /* t1 = x1 - x0 */\n  if (s_mp_add (&y1, &y0, &x0) != MP_OKAY)\n    goto X1Y1;          /* t2 = y1 - y0 */\n  if (mp_mul (&t1, &x0, &t1) != MP_OKAY)\n    goto X1Y1;          /* t1 = (x1 + x0) * (y1 + y0) */\n\n  /* add x0y0 */\n  if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY)\n    goto X1Y1;          /* t2 = x0y0 + x1y1 */\n  if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY)\n    goto X1Y1;          /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */\n\n  /* shift by B */\n  if (mp_lshd (&t1, B) != MP_OKAY)\n    goto X1Y1;          /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<<B */\n  if (mp_lshd (&x1y1, B * 2) != MP_OKAY)\n    goto X1Y1;          /* x1y1 = x1y1 << 2*B */\n\n  if (mp_add (&x0y0, &t1, &t1) != MP_OKAY)\n    goto X1Y1;          /* t1 = x0y0 + t1 */\n  if (mp_add (&t1, &x1y1, c) != MP_OKAY)\n    goto X1Y1;          /* t1 = x0y0 + t1 + x1y1 */\n\n  /* Algorithm succeeded set the return code to MP_OKAY */\n  err = MP_OKAY;\n\nX1Y1:mp_clear (&x1y1);\nX0Y0:mp_clear (&x0y0);\nT1:mp_clear (&t1);\nY1:mp_clear (&y1);\nY0:mp_clear (&y0);\nX1:mp_clear (&x1);\nX0:mp_clear (&x0);\nERR:\n  return err;\n}\n#endif\n\n#ifdef BN_MP_MUL_2_C\n\n/* b = a*2 */\nint mp_mul_2(mp_int * a, mp_int * b)\n{\n  int     x, res, oldused;\n\n  /* grow to accomodate result */\n  if (b->alloc < a->used + 1) {\n    if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  oldused = b->used;\n  b->used = a->used;\n\n  {\n    register mp_digit r, rr, *tmpa, *tmpb;\n\n    /* alias for source */\n    tmpa = a->dp;\n    \n    /* alias for dest */\n    tmpb = b->dp;\n\n    /* carry */\n    r = 0;\n    for (x = 0; x < a->used; x++) {\n    \n      /* get what will be the *next* carry bit from the \n       * MSB of the current digit \n       */\n      rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1));\n      \n      /* now shift up this digit, add in the carry [from the previous] */\n      *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK;\n      \n      /* copy the carry that would be from the source \n       * digit into the next iteration \n       */\n      r = rr;\n    }\n\n    /* new leading digit? */\n    if (r != 0) {\n      /* add a MSB which is always 1 at this point */\n      *tmpb = 1;\n      ++(b->used);\n    }\n\n    /* now zero any excess digits on the destination \n     * that we didn't write to \n     */\n    tmpb = b->dp + b->used;\n    for (x = b->used; x < oldused; x++) {\n      *tmpb++ = 0;\n    }\n  }\n  b->sign = a->sign;\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_AND_C\n\n/* AND two ints together */\nint\nmp_and (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     res, ix, px;\n  mp_int  t, *x;\n\n  if (a->used > b->used) {\n    if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n      return res;\n    }\n    px = b->used;\n    x = b;\n  } else {\n    if ((res = mp_init_copy (&t, b)) != MP_OKAY) {\n      return res;\n    }\n    px = a->used;\n    x = a;\n  }\n\n  for (ix = 0; ix < px; ix++) {\n    t.dp[ix] &= x->dp[ix];\n  }\n\n  /* zero digits above the last from the smallest mp_int */\n  for (; ix < t.used; ix++) {\n    t.dp[ix] = 0;\n  }\n\n  mp_clamp (&t);\n  mp_exch (c, &t);\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_REVERSE_C\n\n/* reverse an array, used for radix code */\nvoid\nbn_reverse (unsigned char *s, int len)\n{\n  int     ix, iy;\n  unsigned char t;\n\n  ix = 0;\n  iy = len - 1;\n  while (ix < iy) {\n    t     = s[ix];\n    s[ix] = s[iy];\n    s[iy] = t;\n    ++ix;\n    --iy;\n  }\n}\n#endif\n\n#ifdef BN_MP_PRIME_RABIN_MILLER_TRIALS_C\n\nstatic const struct {\n   int k, t;\n} sizes[] = {\n{   128,    28 },\n{   256,    16 },\n{   384,    10 },\n{   512,     7 },\n{   640,     6 },\n{   768,     5 },\n{   896,     4 },\n{  1024,     4 }\n};\n\n/* returns # of RM trials required for a given bit size */\nint mp_prime_rabin_miller_trials(int size)\n{\n   int x;\n\n   for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) {\n       if (sizes[x].k == size) {\n          return sizes[x].t;\n       } else if (sizes[x].k > size) {\n          return (x == 0) ? sizes[0].t : sizes[x - 1].t;\n       }\n   }\n   return sizes[x-1].t + 1;\n}\n\n\n#endif\n\n#ifdef BN_MP_INIT_COPY_C\n\n/* creates \"a\" then copies b into it */\nint mp_init_copy (mp_int * a, mp_int * b)\n{\n  int     res;\n\n  if ((res = mp_init (a)) != MP_OKAY) {\n    return res;\n  }\n  return mp_copy (b, a);\n}\n#endif\n\n#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C\n\n/* computes xR**-1 == x (mod N) via Montgomery Reduction\n *\n * This is an optimized implementation of montgomery_reduce\n * which uses the comba method to quickly calculate the columns of the\n * reduction.\n *\n * Based on Algorithm 14.32 on pp.601 of HAC.\n*/\nint fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)\n{\n  int     ix, res, olduse;\n\tmp_word W[MP_WARRAY] = {};\n\n  /* get old used count */\n  olduse = x->used;\n\n  /* grow a as required */\n  if (x->alloc < n->used + 1) {\n    if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* first we have to get the digits of the input into\n   * an array of double precision words W[...]\n   */\n  {\n    register mp_word *_W;\n    register mp_digit *tmpx;\n\n    /* alias for the W[] array */\n    _W   = W;\n\n    /* alias for the digits of  x*/\n    tmpx = x->dp;\n\n    /* copy the digits of a into W[0..a->used-1] */\n    for (ix = 0; ix < x->used; ix++) {\n      *_W++ = *tmpx++;\n    }\n\n    /* zero the high words of W[a->used..m->used*2] */\n    for (; ix < n->used * 2 + 1; ix++) {\n      *_W++ = 0;\n    }\n  }\n\n  /* now we proceed to zero successive digits\n   * from the least significant upwards\n   */\n  for (ix = 0; ix < n->used; ix++) {\n    /* mu = ai * m' mod b\n     *\n     * We avoid a double precision multiplication (which isn't required)\n     * by casting the value down to a mp_digit.  Note this requires\n     * that W[ix-1] have  the carry cleared (see after the inner loop)\n     */\n    register mp_digit mu;\n    mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK);\n\n    /* a = a + mu * m * b**i\n     *\n     * This is computed in place and on the fly.  The multiplication\n     * by b**i is handled by offseting which columns the results\n     * are added to.\n     *\n     * Note the comba method normally doesn't handle carries in the\n     * inner loop In this case we fix the carry from the previous\n     * column since the Montgomery reduction requires digits of the\n     * result (so far) [see above] to work.  This is\n     * handled by fixing up one carry after the inner loop.  The\n     * carry fixups are done in order so after these loops the\n     * first m->used words of W[] have the carries fixed\n     */\n    {\n      register int iy;\n      register mp_digit *tmpn;\n      register mp_word *_W;\n\n      /* alias for the digits of the modulus */\n      tmpn = n->dp;\n\n      /* Alias for the columns set by an offset of ix */\n      _W = W + ix;\n\n      /* inner loop */\n      for (iy = 0; iy < n->used; iy++) {\n          *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++);\n      }\n    }\n\n    /* now fix carry for next digit, W[ix+1] */\n    W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT);\n  }\n\n  /* now we have to propagate the carries and\n   * shift the words downward [all those least\n   * significant digits we zeroed].\n   */\n  {\n    register mp_digit *tmpx;\n    register mp_word *_W, *_W1;\n\n    /* nox fix rest of carries */\n\n    /* alias for current word */\n    _W1 = W + ix;\n\n    /* alias for next word, where the carry goes */\n    _W = W + ++ix;\n\n    for (; ix <= n->used * 2 + 1; ix++) {\n      *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT);\n    }\n\n    /* copy out, A = A/b**n\n     *\n     * The result is A/b**n but instead of converting from an\n     * array of mp_word to mp_digit than calling mp_rshd\n     * we just copy them in the right order\n     */\n\n    /* alias for destination word */\n    tmpx = x->dp;\n\n    /* alias for shifted double precision result */\n    _W = W + n->used;\n\n    for (ix = 0; ix < n->used + 1; ix++) {\n      *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK));\n    }\n\n    /* zero oldused digits, if the input a was larger than\n     * m->used+1 we'll have to clear the digits\n     */\n    for (; ix < olduse; ix++) {\n      *tmpx++ = 0;\n    }\n  }\n\n  /* set the max used and clamp */\n  x->used = n->used + 1;\n  mp_clamp (x);\n\n  /* if A >= m then A = A - m */\n  if (mp_cmp_mag (x, n) != MP_LT) {\n    return s_mp_sub (x, n, x);\n  }\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_LSHD_C\n\n/* shift left a certain amount of digits */\nint mp_lshd (mp_int * a, int b)\n{\n  int     x, res;\n\n  /* if its less than zero return */\n  if (b <= 0) {\n    return MP_OKAY;\n  }\n\n  /* grow to fit the new digits */\n  if (a->alloc < a->used + b) {\n     if ((res = mp_grow (a, a->used + b)) != MP_OKAY) {\n       return res;\n     }\n  }\n\n  {\n    register mp_digit *top, *bottom;\n\n    /* increment the used by the shift amount then copy upwards */\n    a->used += b;\n\n    /* top */\n    top = a->dp + a->used - 1;\n\n    /* base */\n    bottom = a->dp + a->used - 1 - b;\n\n    /* much like mp_rshd this is implemented using a sliding window\n     * except the window goes the otherway around.  Copying from\n     * the bottom to the top.  see bn_mp_rshd.c for more info.\n     */\n    for (x = a->used - 1; x >= b; x--) {\n      *top-- = *bottom--;\n    }\n\n    /* zero the lower digits */\n    top = a->dp;\n    for (x = 0; x < b; x++) {\n      *top++ = 0;\n    }\n  }\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_CMP_C\n\n/* compare two ints (signed)*/\nint\nmp_cmp (mp_int * a, mp_int * b)\n{\n  /* compare based on sign */\n  if (a->sign != b->sign) {\n     if (a->sign == MP_NEG) {\n        return MP_LT;\n     } else {\n        return MP_GT;\n     }\n  }\n  \n  /* compare digits */\n  if (a->sign == MP_NEG) {\n     /* if negative compare opposite direction */\n     return mp_cmp_mag(b, a);\n  } else {\n     return mp_cmp_mag(a, b);\n  }\n}\n#endif\n\n#ifdef BN_MP_COUNT_BITS_C\n\n/* returns the number of bits in an int */\nint\nmp_count_bits (mp_int * a)\n{\n  int     r;\n  mp_digit q;\n\n  /* shortcut */\n  if (a->used == 0) {\n    return 0;\n  }\n\n  /* get number of digits and add that */\n  r = (a->used - 1) * DIGIT_BIT;\n  \n  /* take the last digit and count the bits in it */\n  q = a->dp[a->used - 1];\n  while (q > ((mp_digit) 0)) {\n    ++r;\n    q >>= ((mp_digit) 1);\n  }\n  return r;\n}\n#endif\n\n#ifdef BN_MP_OR_C\n\n/* OR two ints together */\nint mp_or (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     res, ix, px;\n  mp_int  t, *x;\n\n  if (a->used > b->used) {\n    if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n      return res;\n    }\n    px = b->used;\n    x = b;\n  } else {\n    if ((res = mp_init_copy (&t, b)) != MP_OKAY) {\n      return res;\n    }\n    px = a->used;\n    x = a;\n  }\n\n  for (ix = 0; ix < px; ix++) {\n    t.dp[ix] |= x->dp[ix];\n  }\n  mp_clamp (&t);\n  mp_exch (c, &t);\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_EXTEUCLID_C\n\n/* Extended euclidean algorithm of (a, b) produces \n   a*u1 + b*u2 = u3\n */\nint mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3)\n{\n   mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp;\n   int err;\n\n   if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) {\n      return err;\n   }\n\n   /* initialize, (u1,u2,u3) = (1,0,a) */\n   mp_set(&u1, 1);\n   if ((err = mp_copy(a, &u3)) != MP_OKAY)                                        { goto _ERR; }\n\n   /* initialize, (v1,v2,v3) = (0,1,b) */\n   mp_set(&v2, 1);\n   if ((err = mp_copy(b, &v3)) != MP_OKAY)                                        { goto _ERR; }\n\n   /* loop while v3 != 0 */\n   while (mp_iszero(&v3) == MP_NO) {\n       /* q = u3/v3 */\n       if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY)                         { goto _ERR; }\n\n       /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */\n       if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY)                              { goto _ERR; }\n       if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY)                             { goto _ERR; }\n       if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY)                              { goto _ERR; }\n       if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY)                             { goto _ERR; }\n       if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY)                              { goto _ERR; }\n       if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY)                             { goto _ERR; }\n\n       /* (u1,u2,u3) = (v1,v2,v3) */\n       if ((err = mp_copy(&v1, &u1)) != MP_OKAY)                                  { goto _ERR; }\n       if ((err = mp_copy(&v2, &u2)) != MP_OKAY)                                  { goto _ERR; }\n       if ((err = mp_copy(&v3, &u3)) != MP_OKAY)                                  { goto _ERR; }\n\n       /* (v1,v2,v3) = (t1,t2,t3) */\n       if ((err = mp_copy(&t1, &v1)) != MP_OKAY)                                  { goto _ERR; }\n       if ((err = mp_copy(&t2, &v2)) != MP_OKAY)                                  { goto _ERR; }\n       if ((err = mp_copy(&t3, &v3)) != MP_OKAY)                                  { goto _ERR; }\n   }\n\n   /* make sure U3 >= 0 */\n   if (u3.sign == MP_NEG) {\n      mp_neg(&u1, &u1);\n      mp_neg(&u2, &u2);\n      mp_neg(&u3, &u3);\n   }\n\n   /* copy result out */\n   if (U1 != NULL) { mp_exch(U1, &u1); }\n   if (U2 != NULL) { mp_exch(U2, &u2); }\n   if (U3 != NULL) { mp_exch(U3, &u3); }\n\n   err = MP_OKAY;\n_ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL);\n   return err;\n}\n#endif\n\n#ifdef BN_MP_PRIME_RANDOM_EX_C\n\n/* makes a truly random prime of a given size (bits),\n *\n * Flags are as follows:\n * \n *   LTM_PRIME_BBS      - make prime congruent to 3 mod 4\n *   LTM_PRIME_SAFE     - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS)\n *   LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero\n *   LTM_PRIME_2MSB_ON  - make the 2nd highest bit one\n *\n * You have to supply a callback which fills in a buffer with random bytes.  \"dat\" is a parameter you can\n * have passed to the callback (e.g. a state or something).  This function doesn't use \"dat\" itself\n * so it can be NULL\n *\n */\n\n/* This is possibly the mother of all prime generation functions, muahahahahaha! */\nint mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat)\n{\n   unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb;\n   int res, err, bsize, maskOR_msb_offset;\n\n   /* sanity check the input */\n   if (size <= 1 || t <= 0) {\n      return MP_VAL;\n   }\n\n   /* LTM_PRIME_SAFE implies LTM_PRIME_BBS */\n   if (flags & LTM_PRIME_SAFE) {\n      flags |= LTM_PRIME_BBS;\n   }\n\n   /* calc the byte size */\n   bsize = (size>>3) + ((size&7)?1:0);\n\n   /* we need a buffer of bsize bytes */\n   tmp = OPT_CAST(unsigned char) XMALLOC(bsize);\n   if (tmp == NULL) {\n      return MP_MEM;\n   }\n\n   /* calc the maskAND value for the MSbyte*/\n   maskAND = ((size&7) == 0) ? 0xFF : (0xFF >> (8 - (size & 7)));\n\n   /* calc the maskOR_msb */\n   maskOR_msb        = 0;\n   maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0;\n   if (flags & LTM_PRIME_2MSB_ON) {\n      maskOR_msb       |= 0x80 >> ((9 - size) & 7);\n   }  \n\n   /* get the maskOR_lsb */\n   maskOR_lsb         = 1;\n   if (flags & LTM_PRIME_BBS) {\n      maskOR_lsb     |= 3;\n   }\n\n   do {\n      /* read the bytes */\n      if (cb(tmp, bsize, dat) != bsize) {\n         err = MP_VAL;\n         goto error;\n      }\n \n      /* work over the MSbyte */\n      tmp[0]    &= maskAND;\n      tmp[0]    |= 1 << ((size - 1) & 7);\n\n      /* mix in the maskORs */\n      tmp[maskOR_msb_offset]   |= maskOR_msb;\n      tmp[bsize-1]             |= maskOR_lsb;\n\n      /* read it in */\n      if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY)     { goto error; }\n\n      /* is it prime? */\n      if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY)           { goto error; }\n      if (res == MP_NO) {  \n         continue;\n      }\n\n      if (flags & LTM_PRIME_SAFE) {\n         /* see if (a-1)/2 is prime */\n         if ((err = mp_sub_d(a, 1, a)) != MP_OKAY)                    { goto error; }\n         if ((err = mp_div_2(a, a)) != MP_OKAY)                       { goto error; }\n \n         /* is it prime? */\n         if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY)        { goto error; }\n      }\n   } while (res == MP_NO);\n\n   if (flags & LTM_PRIME_SAFE) {\n      /* restore a to the original value */\n      if ((err = mp_mul_2(a, a)) != MP_OKAY)                          { goto error; }\n      if ((err = mp_add_d(a, 1, a)) != MP_OKAY)                       { goto error; }\n   }\n\n   err = MP_OKAY;\nerror:\n   XFREE(tmp);\n   return err;\n}\n\n\n#endif\n\n#ifdef BN_MP_JACOBI_C\n\n/* computes the jacobi c = (a | n) (or Legendre if n is prime)\n * HAC pp. 73 Algorithm 2.149\n */\nint mp_jacobi (mp_int * a, mp_int * p, int *c)\n{\n  mp_int  a1, p1;\n  int     k, s, r, res;\n  mp_digit residue;\n\n  /* if p <= 0 return MP_VAL */\n  if (mp_cmp_d(p, 0) != MP_GT) {\n     return MP_VAL;\n  }\n\n  /* step 1.  if a == 0, return 0 */\n  if (mp_iszero (a) == 1) {\n    *c = 0;\n    return MP_OKAY;\n  }\n\n  /* step 2.  if a == 1, return 1 */\n  if (mp_cmp_d (a, 1) == MP_EQ) {\n    *c = 1;\n    return MP_OKAY;\n  }\n\n  /* default */\n  s = 0;\n\n  /* step 3.  write a = a1 * 2**k  */\n  if ((res = mp_init_copy (&a1, a)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_init (&p1)) != MP_OKAY) {\n    goto LBL_A1;\n  }\n\n  /* divide out larger power of two */\n  k = mp_cnt_lsb(&a1);\n  if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) {\n     goto LBL_P1;\n  }\n\n  /* step 4.  if e is even set s=1 */\n  if ((k & 1) == 0) {\n    s = 1;\n  } else {\n    /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */\n    residue = p->dp[0] & 7;\n\n    if (residue == 1 || residue == 7) {\n      s = 1;\n    } else if (residue == 3 || residue == 5) {\n      s = -1;\n    }\n  }\n\n  /* step 5.  if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */\n  if ( ((p->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) {\n    s = -s;\n  }\n\n  /* if a1 == 1 we're done */\n  if (mp_cmp_d (&a1, 1) == MP_EQ) {\n    *c = s;\n  } else {\n    /* n1 = n mod a1 */\n    if ((res = mp_mod (p, &a1, &p1)) != MP_OKAY) {\n      goto LBL_P1;\n    }\n    if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) {\n      goto LBL_P1;\n    }\n    *c = s * r;\n  }\n\n  /* done */\n  res = MP_OKAY;\nLBL_P1:mp_clear (&p1);\nLBL_A1:mp_clear (&a1);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_RADIX_SIZE_C\n\n/* returns size of ASCII reprensentation */\nint mp_radix_size (mp_int * a, int radix, int *size)\n{\n  int     res, digs;\n  mp_int  t;\n  mp_digit d;\n\n  *size = 0;\n\n  /* special case for binary */\n  if (radix == 2) {\n    *size = mp_count_bits (a) + (a->sign == MP_NEG ? 1 : 0) + 1;\n    return MP_OKAY;\n  }\n\n  /* make sure the radix is in range */\n  if (radix < 2 || radix > 64) {\n    return MP_VAL;\n  }\n\n  if (mp_iszero(a) == MP_YES) {\n    *size = 2;\n    return MP_OKAY;\n  }\n\n  /* digs is the digit count */\n  digs = 0;\n\n  /* if it's negative add one for the sign */\n  if (a->sign == MP_NEG) {\n    ++digs;\n  }\n\n  /* init a copy of the input */\n  if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n    return res;\n  }\n\n  /* force temp to positive */\n  t.sign = MP_ZPOS; \n\n  /* fetch out all of the digits */\n  while (mp_iszero (&t) == MP_NO) {\n    if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {\n      mp_clear (&t);\n      return res;\n    }\n    ++digs;\n  }\n  mp_clear (&t);\n\n  /* return digs + 1, the 1 is for the NULL byte that would be required. */\n  *size = digs + 1;\n  return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_RSHD_C\n\n/* shift right a certain amount of digits */\nvoid mp_rshd (mp_int * a, int b)\n{\n  int     x;\n\n  /* if b <= 0 then ignore it */\n  if (b <= 0) {\n    return;\n  }\n\n  /* if b > used then simply zero it and return */\n  if (a->used <= b) {\n    mp_zero (a);\n    return;\n  }\n\n  {\n    register mp_digit *bottom, *top;\n\n    /* shift the digits down */\n\n    /* bottom */\n    bottom = a->dp;\n\n    /* top [offset into digits] */\n    top = a->dp + b;\n\n    /* this is implemented as a sliding window where \n     * the window is b-digits long and digits from \n     * the top of the window are copied to the bottom\n     *\n     * e.g.\n\n     b-2 | b-1 | b0 | b1 | b2 | ... | bb |   ---->\n                 /\\                   |      ---->\n                  \\-------------------/      ---->\n     */\n    for (x = 0; x < (a->used - b); x++) {\n      *bottom++ = *top++;\n    }\n\n    /* zero the top digits */\n    for (; x < a->used; x++) {\n      *bottom++ = 0;\n    }\n  }\n  \n  /* remove excess digits */\n  a->used -= b;\n}\n#endif\n\n#ifdef BN_MP_MUL_D_C\n\n/* multiply by a digit */\nint\nmp_mul_d (mp_int * a, mp_digit b, mp_int * c)\n{\n  mp_digit u, *tmpa, *tmpc;\n  mp_word  r;\n  int      ix, res, olduse;\n\n  /* make sure c is big enough to hold a*b */\n  if (c->alloc < a->used + 1) {\n    if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* get the original destinations used count */\n  olduse = c->used;\n\n  /* set the sign */\n  c->sign = a->sign;\n\n  /* alias for a->dp [source] */\n  tmpa = a->dp;\n\n  /* alias for c->dp [dest] */\n  tmpc = c->dp;\n\n  /* zero carry */\n  u = 0;\n\n  /* compute columns */\n  for (ix = 0; ix < a->used; ix++) {\n    /* compute product and carry sum for this term */\n    r       = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b);\n\n    /* mask off higher bits to get a single digit */\n    *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK));\n\n    /* send carry into next iteration */\n    u       = (mp_digit) (r >> ((mp_word) DIGIT_BIT));\n  }\n\n  /* store final carry [if any] and increment ix offset  */\n  *tmpc++ = u;\n  ++ix;\n\n  /* now zero digits above the top */\n  while (ix++ < olduse) {\n     *tmpc++ = 0;\n  }\n\n  /* set used count */\n  c->used = a->used + 1;\n  mp_clamp(c);\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_MONTGOMERY_REDUCE_C\n\n/* computes xR**-1 == x (mod N) via Montgomery Reduction */\nint\nmp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)\n{\n  int     ix, res, digs;\n  mp_digit mu;\n\n  /* can the fast reduction [comba] method be used?\n   *\n   * Note that unlike in mul you're safely allowed *less*\n   * than the available columns [255 per default] since carries\n   * are fixed up in the inner loop.\n   */\n  digs = n->used * 2 + 1;\n  if ((digs < MP_WARRAY) &&\n      n->used <\n      (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {\n    return fast_mp_montgomery_reduce (x, n, rho);\n  }\n\n  /* grow the input as required */\n  if (x->alloc < digs) {\n    if ((res = mp_grow (x, digs)) != MP_OKAY) {\n      return res;\n    }\n  }\n  x->used = digs;\n\n  for (ix = 0; ix < n->used; ix++) {\n    /* mu = ai * rho mod b\n     *\n     * The value of rho must be precalculated via\n     * montgomery_setup() such that\n     * it equals -1/n0 mod b this allows the\n     * following inner loop to reduce the\n     * input one digit at a time\n     */\n    mu = (mp_digit) (((mp_word)x->dp[ix]) * ((mp_word)rho) & MP_MASK);\n\n    /* a = a + mu * m * b**i */\n    {\n      register int iy;\n      register mp_digit *tmpn, *tmpx, u;\n      register mp_word r;\n\n      /* alias for digits of the modulus */\n      tmpn = n->dp;\n\n      /* alias for the digits of x [the input] */\n      tmpx = x->dp + ix;\n\n      /* set the carry to zero */\n      u = 0;\n\n      /* Multiply and add in place */\n      for (iy = 0; iy < n->used; iy++) {\n        /* compute product and sum */\n        r       = ((mp_word)mu) * ((mp_word)*tmpn++) +\n                  ((mp_word) u) + ((mp_word) * tmpx);\n\n        /* get carry */\n        u       = (mp_digit)(r >> ((mp_word) DIGIT_BIT));\n\n        /* fix digit */\n        *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK));\n      }\n      /* At this point the ix'th digit of x should be zero */\n\n\n      /* propagate carries upwards as required*/\n      while (u) {\n        *tmpx   += u;\n        u        = *tmpx >> DIGIT_BIT;\n        *tmpx++ &= MP_MASK;\n      }\n    }\n  }\n\n  /* at this point the n.used'th least\n   * significant digits of x are all zero\n   * which means we can shift x to the\n   * right by n.used digits and the\n   * residue is unchanged.\n   */\n\n  /* x = x/b**n.used */\n  mp_clamp(x);\n  mp_rshd (x, n->used);\n\n  /* if x >= n then x = x - n */\n  if (mp_cmp_mag (x, n) != MP_LT) {\n    return s_mp_sub (x, n, x);\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_S_MP_EXPTMOD_C\n\n#ifdef MP_LOW_MEM\n   #define TAB_SIZE 32\n#else\n   #define TAB_SIZE 256\n#endif\n\nint s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode)\n{\n  mp_int  M[TAB_SIZE], res, mu;\n  mp_digit buf;\n  int     err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize;\n  int (*redux)(mp_int*,mp_int*,mp_int*);\n\n  /* find window size */\n  x = mp_count_bits (X);\n  if (x <= 7) {\n    winsize = 2;\n  } else if (x <= 36) {\n    winsize = 3;\n  } else if (x <= 140) {\n    winsize = 4;\n  } else if (x <= 450) {\n    winsize = 5;\n  } else if (x <= 1303) {\n    winsize = 6;\n  } else if (x <= 3529) {\n    winsize = 7;\n  } else {\n    winsize = 8;\n  }\n\n#ifdef MP_LOW_MEM\n    if (winsize > 5) {\n       winsize = 5;\n    }\n#endif\n\n  /* init M array */\n  /* init first cell */\n  if ((err = mp_init(&M[1])) != MP_OKAY) {\n     return err; \n  }\n\n  /* now init the second half of the array */\n  for (x = 1<<(winsize-1); x < (1 << winsize); x++) {\n    if ((err = mp_init(&M[x])) != MP_OKAY) {\n      for (y = 1<<(winsize-1); y < x; y++) {\n        mp_clear (&M[y]);\n      }\n      mp_clear(&M[1]);\n      return err;\n    }\n  }\n\n  /* create mu, used for Barrett reduction */\n  if ((err = mp_init (&mu)) != MP_OKAY) {\n    goto LBL_M;\n  }\n  \n  if (redmode == 0) {\n     if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) {\n        goto LBL_MU;\n     }\n     redux = mp_reduce;\n  } else {\n     if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) {\n        goto LBL_MU;\n     }\n     redux = mp_reduce_2k_l;\n  }    \n\n  /* create M table\n   *\n   * The M table contains powers of the base, \n   * e.g. M[x] = G**x mod P\n   *\n   * The first half of the table is not \n   * computed though accept for M[0] and M[1]\n   */\n  if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) {\n    goto LBL_MU;\n  }\n\n  /* compute the value at M[1<<(winsize-1)] by squaring \n   * M[1] (winsize-1) times \n   */\n  if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {\n    goto LBL_MU;\n  }\n\n  for (x = 0; x < (winsize - 1); x++) {\n    /* square it */\n    if ((err = mp_sqr (&M[1 << (winsize - 1)], \n                       &M[1 << (winsize - 1)])) != MP_OKAY) {\n      goto LBL_MU;\n    }\n\n    /* reduce modulo P */\n    if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) {\n      goto LBL_MU;\n    }\n  }\n\n  /* create upper table, that is M[x] = M[x-1] * M[1] (mod P)\n   * for x = (2**(winsize - 1) + 1) to (2**winsize - 1)\n   */\n  for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) {\n    if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) {\n      goto LBL_MU;\n    }\n    if ((err = redux (&M[x], P, &mu)) != MP_OKAY) {\n      goto LBL_MU;\n    }\n  }\n\n  /* setup result */\n  if ((err = mp_init (&res)) != MP_OKAY) {\n    goto LBL_MU;\n  }\n  mp_set (&res, 1);\n\n  /* set initial mode and bit cnt */\n  mode   = 0;\n  bitcnt = 1;\n  buf    = 0;\n  digidx = X->used - 1;\n  bitcpy = 0;\n  bitbuf = 0;\n\n  for (;;) {\n    /* grab next digit as required */\n    if (--bitcnt == 0) {\n      /* if digidx == -1 we are out of digits */\n      if (digidx == -1) {\n        break;\n      }\n      /* read next digit and reset the bitcnt */\n      buf    = X->dp[digidx--];\n      bitcnt = (int) DIGIT_BIT;\n    }\n\n    /* grab the next msb from the exponent */\n    y     = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1;\n    buf <<= (mp_digit)1;\n\n    /* if the bit is zero and mode == 0 then we ignore it\n     * These represent the leading zero bits before the first 1 bit\n     * in the exponent.  Technically this opt is not required but it\n     * does lower the # of trivial squaring/reductions used\n     */\n    if (mode == 0 && y == 0) {\n      continue;\n    }\n\n    /* if the bit is zero and mode == 1 then we square */\n    if (mode == 1 && y == 0) {\n      if ((err = mp_sqr (&res, &res)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      if ((err = redux (&res, P, &mu)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      continue;\n    }\n\n    /* else we add it to the window */\n    bitbuf |= (y << (winsize - ++bitcpy));\n    mode    = 2;\n\n    if (bitcpy == winsize) {\n      /* ok window is filled so square as required and multiply  */\n      /* square first */\n      for (x = 0; x < winsize; x++) {\n        if ((err = mp_sqr (&res, &res)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n        if ((err = redux (&res, P, &mu)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n      }\n\n      /* then multiply */\n      if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      if ((err = redux (&res, P, &mu)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n\n      /* empty window and reset */\n      bitcpy = 0;\n      bitbuf = 0;\n      mode   = 1;\n    }\n  }\n\n  /* if bits remain then square/multiply */\n  if (mode == 2 && bitcpy > 0) {\n    /* square then multiply if the bit is set */\n    for (x = 0; x < bitcpy; x++) {\n      if ((err = mp_sqr (&res, &res)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      if ((err = redux (&res, P, &mu)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n\n      bitbuf <<= 1;\n      if ((bitbuf & (1 << winsize)) != 0) {\n        /* then multiply */\n        if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n        if ((err = redux (&res, P, &mu)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n      }\n    }\n  }\n\n  mp_exch (&res, Y);\n  err = MP_OKAY;\nLBL_RES:mp_clear (&res);\nLBL_MU:mp_clear (&mu);\nLBL_M:\n  mp_clear(&M[1]);\n  for (x = 1<<(winsize-1); x < (1 << winsize); x++) {\n    mp_clear (&M[x]);\n  }\n  return err;\n}\n#endif\n\n#ifdef BN_MP_SUB_D_C\n\n/* single digit subtraction */\nint\nmp_sub_d (mp_int * a, mp_digit b, mp_int * c)\n{\n  mp_digit *tmpa, *tmpc, mu;\n  int       res, ix, oldused;\n\n  /* grow c as required */\n  if (c->alloc < a->used + 1) {\n     if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) {\n        return res;\n     }\n  }\n\n  /* if a is negative just do an unsigned\n   * addition [with fudged signs]\n   */\n  if (a->sign == MP_NEG) {\n     a->sign = MP_ZPOS;\n     res     = mp_add_d(a, b, c);\n     a->sign = c->sign = MP_NEG;\n\n     /* clamp */\n     mp_clamp(c);\n\n     return res;\n  }\n\n  /* setup regs */\n  oldused = c->used;\n  tmpa    = a->dp;\n  tmpc    = c->dp;\n\n  /* if a <= b simply fix the single digit */\n  if ((a->used == 1 && a->dp[0] <= b) || a->used == 0) {\n     if (a->used == 1) {\n        *tmpc++ = b - *tmpa;\n     } else {\n        *tmpc++ = b;\n     }\n     ix      = 1;\n\n     /* negative/1digit */\n     c->sign = MP_NEG;\n     c->used = 1;\n  } else {\n     /* positive/size */\n     c->sign = MP_ZPOS;\n     c->used = a->used;\n\n     /* subtract first digit */\n     *tmpc    = *tmpa++ - b;\n     mu       = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1);\n     *tmpc++ &= MP_MASK;\n\n     /* handle rest of the digits */\n     for (ix = 1; ix < a->used; ix++) {\n        *tmpc    = *tmpa++ - mu;\n        mu       = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1);\n        *tmpc++ &= MP_MASK;\n     }\n  }\n\n  /* zero excess digits */\n  while (ix++ < oldused) {\n     *tmpc++ = 0;\n  }\n  mp_clamp(c);\n  return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_DIV_2D_C\n\n/* shift right by a certain bit count (store quotient in c, optional remainder in d) */\nint mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)\n{\n  mp_digit D, r, rr;\n  int     x, res;\n  mp_int  t;\n\n\n  /* if the shift count is <= 0 then we do no work */\n  if (b <= 0) {\n    res = mp_copy (a, c);\n    if (d != NULL) {\n      mp_zero (d);\n    }\n    return res;\n  }\n\n  if ((res = mp_init (&t)) != MP_OKAY) {\n    return res;\n  }\n\n  /* get the remainder */\n  if (d != NULL) {\n    if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) {\n      mp_clear (&t);\n      return res;\n    }\n  }\n\n  /* copy */\n  if ((res = mp_copy (a, c)) != MP_OKAY) {\n    mp_clear (&t);\n    return res;\n  }\n\n  /* shift by as many digits in the bit count */\n  if (b >= (int)DIGIT_BIT) {\n    mp_rshd (c, b / DIGIT_BIT);\n  }\n\n  /* shift any bit count < DIGIT_BIT */\n  D = (mp_digit) (b % DIGIT_BIT);\n  if (D != 0) {\n    register mp_digit *tmpc, mask, shift;\n\n    /* mask */\n    mask = (((mp_digit)1) << D) - 1;\n\n    /* shift for lsb */\n    shift = DIGIT_BIT - D;\n\n    /* alias */\n    tmpc = c->dp + (c->used - 1);\n\n    /* carry */\n    r = 0;\n    for (x = c->used - 1; x >= 0; x--) {\n      /* get the lower  bits of this word in a temp */\n      rr = *tmpc & mask;\n\n      /* shift the current word and mix in the carry bits from the previous word */\n      *tmpc = (*tmpc >> D) | (r << shift);\n      --tmpc;\n\n      /* set the carry to the carry bits of the current word found above */\n      r = rr;\n    }\n  }\n  mp_clamp (c);\n  if (d != NULL) {\n    mp_exch (&t, d);\n  }\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_ADD_D_C\n\n/* single digit addition */\nint\nmp_add_d (mp_int * a, mp_digit b, mp_int * c)\n{\n  int     res, ix, oldused;\n  mp_digit *tmpa, *tmpc, mu;\n\n  /* grow c as required */\n  if (c->alloc < a->used + 1) {\n     if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) {\n        return res;\n     }\n  }\n\n  /* if a is negative and |a| >= b, call c = |a| - b */\n  if (a->sign == MP_NEG && (a->used > 1 || a->dp[0] >= b)) {\n     /* temporarily fix sign of a */\n     a->sign = MP_ZPOS;\n\n     /* c = |a| - b */\n     res = mp_sub_d(a, b, c);\n\n     /* fix sign  */\n     a->sign = c->sign = MP_NEG;\n\n     /* clamp */\n     mp_clamp(c);\n\n     return res;\n  }\n\n  /* old number of used digits in c */\n  oldused = c->used;\n\n  /* sign always positive */\n  c->sign = MP_ZPOS;\n\n  /* source alias */\n  tmpa    = a->dp;\n\n  /* destination alias */\n  tmpc    = c->dp;\n\n  /* if a is positive */\n  if (a->sign == MP_ZPOS) {\n     /* add digit, after this we're propagating\n      * the carry.\n      */\n     *tmpc   = *tmpa++ + b;\n     mu      = *tmpc >> DIGIT_BIT;\n     *tmpc++ &= MP_MASK;\n\n     /* now handle rest of the digits */\n     for (ix = 1; ix < a->used; ix++) {\n        *tmpc   = *tmpa++ + mu;\n        mu      = *tmpc >> DIGIT_BIT;\n        *tmpc++ &= MP_MASK;\n     }\n     /* set final carry */\n     ix++;\n     *tmpc++  = mu;\n\n     /* setup size */\n     c->used = a->used + 1;\n  } else {\n     /* a was negative and |a| < b */\n     c->used  = 1;\n\n     /* the result is a single digit */\n     if (a->used == 1) {\n        *tmpc++  =  b - a->dp[0];\n     } else {\n        *tmpc++  =  b;\n     }\n\n     /* setup count so the clearing of oldused\n      * can fall through correctly\n      */\n     ix       = 1;\n  }\n\n  /* now zero to oldused */\n  while (ix++ < oldused) {\n     *tmpc++ = 0;\n  }\n  mp_clamp(c);\n\n  return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_SQR_C\n\n/* computes b = a*a */\nint\nmp_sqr (mp_int * a, mp_int * b)\n{\n  int     res;\n\n#ifdef BN_MP_TOOM_SQR_C\n  /* use Toom-Cook? */\n  if (a->used >= TOOM_SQR_CUTOFF) {\n    res = mp_toom_sqr(a, b);\n  /* Karatsuba? */\n  } else \n#endif\n#ifdef BN_MP_KARATSUBA_SQR_C\nif (a->used >= KARATSUBA_SQR_CUTOFF) {\n    res = mp_karatsuba_sqr (a, b);\n  } else \n#endif\n  {\n#ifdef BN_FAST_S_MP_SQR_C\n    /* can we use the fast comba multiplier? */\n    if ((a->used * 2 + 1) < MP_WARRAY && \n         a->used < \n         (1 << (sizeof(mp_word) * CHAR_BIT - 2*DIGIT_BIT - 1))) {\n      res = fast_s_mp_sqr (a, b);\n    } else\n#endif\n#ifdef BN_S_MP_SQR_C\n      res = s_mp_sqr (a, b);\n#else\n      res = MP_VAL;\n#endif\n  }\n  b->sign = MP_ZPOS;\n  return res;\n}\n#endif\n\n#ifdef BN_MP_GROW_C\n\n/* grow as required */\nint mp_grow (mp_int * a, int size)\n{\n  int     i;\n  mp_digit *tmp;\n\n  /* if the alloc size is smaller alloc more ram */\n  if (a->alloc < size) {\n    /* ensure there are always at least MP_PREC digits extra on top */\n    size += (MP_PREC * 2) - (size % MP_PREC);\n\n    /* reallocate the array a->dp\n     *\n     * We store the return in a temporary variable\n     * in case the operation failed we don't want\n     * to overwrite the dp member of a.\n     */\n    tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size);\n    if (tmp == NULL) {\n      /* reallocation failed but \"a\" is still valid [can be freed] */\n      return MP_MEM;\n    }\n\n    /* reallocation succeeded so set a->dp */\n    a->dp = tmp;\n\n    /* zero excess digits */\n    i        = a->alloc;\n    a->alloc = size;\n    for (; i < a->alloc; i++) {\n      a->dp[i] = 0;\n    }\n  }\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_MUL_2D_C\n\n/* shift left by a certain bit count */\nint mp_mul_2d (mp_int * a, int b, mp_int * c)\n{\n  mp_digit d;\n  int      res;\n\n  /* copy */\n  if (a != c) {\n     if ((res = mp_copy (a, c)) != MP_OKAY) {\n       return res;\n     }\n  }\n\n  if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) {\n     if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) {\n       return res;\n     }\n  }\n\n  /* shift by as many digits in the bit count */\n  if (b >= (int)DIGIT_BIT) {\n    if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* shift any bit count < DIGIT_BIT */\n  d = (mp_digit) (b % DIGIT_BIT);\n  if (d != 0) {\n    register mp_digit *tmpc, shift, mask, r, rr;\n    register int x;\n\n    /* bitmask for carries */\n    mask = (((mp_digit)1) << d) - 1;\n\n    /* shift for msbs */\n    shift = DIGIT_BIT - d;\n\n    /* alias */\n    tmpc = c->dp;\n\n    /* carry */\n    r    = 0;\n    for (x = 0; x < c->used; x++) {\n      /* get the higher bits of the current word */\n      rr = (*tmpc >> shift) & mask;\n\n      /* shift the current word and OR in the carry */\n      *tmpc = ((*tmpc << d) | r) & MP_MASK;\n      ++tmpc;\n\n      /* set the carry to the carry bits of the current word */\n      r = rr;\n    }\n    \n    /* set final carry */\n    if (r != 0) {\n       c->dp[(c->used)++] = r;\n    }\n  }\n  mp_clamp (c);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_CMP_D_C\n\n/* compare a digit */\nint mp_cmp_d(mp_int * a, mp_digit b)\n{\n  /* compare based on sign */\n  if (a->sign == MP_NEG) {\n    return MP_LT;\n  }\n\n  /* compare based on magnitude */\n  if (a->used > 1) {\n    return MP_GT;\n  }\n\n  /* compare the only digit of a to b */\n  if (a->dp[0] > b) {\n    return MP_GT;\n  } else if (a->dp[0] < b) {\n    return MP_LT;\n  } else {\n    return MP_EQ;\n  }\n}\n#endif\n\n#ifdef BN_MP_CMP_MAG_C\n\n/* compare maginitude of two ints (unsigned) */\nint mp_cmp_mag (mp_int * a, mp_int * b)\n{\n  int     n;\n  mp_digit *tmpa, *tmpb;\n\n  /* compare based on # of non-zero digits */\n  if (a->used > b->used) {\n    return MP_GT;\n  }\n  \n  if (a->used < b->used) {\n    return MP_LT;\n  }\n\n  /* alias for a */\n  tmpa = a->dp + (a->used - 1);\n\n  /* alias for b */\n  tmpb = b->dp + (a->used - 1);\n\n  /* compare based on digits  */\n  for (n = 0; n < a->used; ++n, --tmpa, --tmpb) {\n    if (*tmpa > *tmpb) {\n      return MP_GT;\n    }\n\n    if (*tmpa < *tmpb) {\n      return MP_LT;\n    }\n  }\n  return MP_EQ;\n}\n#endif\n\n#ifdef BN_MP_CLEAR_C\n\n/* clear one (frees)  */\nvoid\nmp_clear (mp_int * a)\n{\n  int i;\n\n  /* only do anything if a hasn't been freed previously */\n  if (a->dp != NULL) {\n    /* first zero the digits */\n    for (i = 0; i < a->used; i++) {\n        a->dp[i] = 0;\n    }\n\n    /* free ram */\n    XFREE(a->dp);\n\n    /* reset members to make debugging easier */\n    a->dp    = NULL;\n    a->alloc = a->used = 0;\n    a->sign  = MP_ZPOS;\n  }\n}\n#endif\n\n#ifdef BN_MP_INVMOD_SLOW_C\n\n/* hac 14.61, pp608 */\nint mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c)\n{\n  mp_int  x, y, u, v, A, B, C, D;\n  int     res;\n\n  /* b cannot be negative */\n  if (b->sign == MP_NEG || mp_iszero(b) == 1) {\n    return MP_VAL;\n  }\n\n  /* init temps */\n  if ((res = mp_init_multi(&x, &y, &u, &v, \n                           &A, &B, &C, &D, NULL)) != MP_OKAY) {\n     return res;\n  }\n\n  /* x = a, y = b */\n  if ((res = mp_mod(a, b, &x)) != MP_OKAY) {\n      goto LBL_ERR;\n  }\n  if ((res = mp_copy (b, &y)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n\n  /* 2. [modified] if x,y are both even then return an error! */\n  if (mp_iseven (&x) == 1 && mp_iseven (&y) == 1) {\n    res = MP_VAL;\n    goto LBL_ERR;\n  }\n\n  /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */\n  if ((res = mp_copy (&x, &u)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n  if ((res = mp_copy (&y, &v)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n  mp_set (&A, 1);\n  mp_set (&D, 1);\n\ntop:\n  /* 4.  while u is even do */\n  while (mp_iseven (&u) == 1) {\n    /* 4.1 u = u/2 */\n    if ((res = mp_div_2 (&u, &u)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n    /* 4.2 if A or B is odd then */\n    if (mp_isodd (&A) == 1 || mp_isodd (&B) == 1) {\n      /* A = (A+y)/2, B = (B-x)/2 */\n      if ((res = mp_add (&A, &y, &A)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n      if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n    }\n    /* A = A/2, B = B/2 */\n    if ((res = mp_div_2 (&A, &A)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n    if ((res = mp_div_2 (&B, &B)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n\n  /* 5.  while v is even do */\n  while (mp_iseven (&v) == 1) {\n    /* 5.1 v = v/2 */\n    if ((res = mp_div_2 (&v, &v)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n    /* 5.2 if C or D is odd then */\n    if (mp_isodd (&C) == 1 || mp_isodd (&D) == 1) {\n      /* C = (C+y)/2, D = (D-x)/2 */\n      if ((res = mp_add (&C, &y, &C)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n      if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n    }\n    /* C = C/2, D = D/2 */\n    if ((res = mp_div_2 (&C, &C)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n    if ((res = mp_div_2 (&D, &D)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n\n  /* 6.  if u >= v then */\n  if (mp_cmp (&u, &v) != MP_LT) {\n    /* u = u - v, A = A - C, B = B - D */\n    if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n\n    if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n\n    if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  } else {\n    /* v - v - u, C = C - A, D = D - B */\n    if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n\n    if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n\n    if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n\n  /* if not zero goto step 4 */\n  if (mp_iszero (&u) == 0)\n    goto top;\n\n  /* now a = C, b = D, gcd == g*v */\n\n  /* if v != 1 then there is no inverse */\n  if (mp_cmp_d (&v, 1) != MP_EQ) {\n    res = MP_VAL;\n    goto LBL_ERR;\n  }\n\n  /* if its too low */\n  while (mp_cmp_d(&C, 0) == MP_LT) {\n      if ((res = mp_add(&C, b, &C)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n  }\n  \n  /* too big */\n  while (mp_cmp_mag(&C, b) != MP_LT) {\n      if ((res = mp_sub(&C, b, &C)) != MP_OKAY) {\n         goto LBL_ERR;\n      }\n  }\n  \n  /* C is now the inverse */\n  mp_exch (&C, c);\n  res = MP_OKAY;\nLBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_DIV_C\n\n#ifdef BN_MP_DIV_SMALL\n\n/* slower bit-bang division... also smaller */\nint mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d)\n{\n   mp_int ta, tb, tq, q;\n   int    res, n, n2;\n\n  /* is divisor zero ? */\n  if (mp_iszero (b) == 1) {\n    return MP_VAL;\n  }\n\n  /* if a < b then q=0, r = a */\n  if (mp_cmp_mag (a, b) == MP_LT) {\n    if (d != NULL) {\n      res = mp_copy (a, d);\n    } else {\n      res = MP_OKAY;\n    }\n    if (c != NULL) {\n      mp_zero (c);\n    }\n    return res;\n  }\n\t\n  /* init our temps */\n  if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL) != MP_OKAY)) {\n     return res;\n  }\n\n\n  mp_set(&tq, 1);\n  n = mp_count_bits(a) - mp_count_bits(b);\n  if (((res = mp_abs(a, &ta)) != MP_OKAY) ||\n      ((res = mp_abs(b, &tb)) != MP_OKAY) || \n      ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) ||\n      ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) {\n      goto LBL_ERR;\n  }\n\n  while (n-- >= 0) {\n     if (mp_cmp(&tb, &ta) != MP_GT) {\n        if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) ||\n            ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) {\n           goto LBL_ERR;\n        }\n     }\n     if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) ||\n         ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) {\n           goto LBL_ERR;\n     }\n  }\n\n  /* now q == quotient and ta == remainder */\n  n  = a->sign;\n  n2 = (a->sign == b->sign ? MP_ZPOS : MP_NEG);\n  if (c != NULL) {\n     mp_exch(c, &q);\n     c->sign  = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2;\n  }\n  if (d != NULL) {\n     mp_exch(d, &ta);\n     d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n;\n  }\nLBL_ERR:\n   mp_clear_multi(&ta, &tb, &tq, &q, NULL);\n   return res;\n}\n\n#else\n\n/* integer signed division. \n * c*b + d == a [e.g. a/b, c=quotient, d=remainder]\n * HAC pp.598 Algorithm 14.20\n *\n * Note that the description in HAC is horribly \n * incomplete.  For example, it doesn't consider \n * the case where digits are removed from 'x' in \n * the inner loop.  It also doesn't consider the \n * case that y has fewer than three digits, etc..\n *\n * The overall algorithm is as described as \n * 14.20 from HAC but fixed to treat these cases.\n*/\nint mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d)\n{\n  mp_int  q, x, y, t1, t2;\n  int     res, n, t, i, norm, neg;\n\n  /* is divisor zero ? */\n  if (mp_iszero (b) == 1) {\n    return MP_VAL;\n  }\n\n  /* if a < b then q=0, r = a */\n  if (mp_cmp_mag (a, b) == MP_LT) {\n    if (d != NULL) {\n      res = mp_copy (a, d);\n    } else {\n      res = MP_OKAY;\n    }\n    if (c != NULL) {\n      mp_zero (c);\n    }\n    return res;\n  }\n\n  if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) {\n    return res;\n  }\n  q.used = a->used + 2;\n\n  if ((res = mp_init (&t1)) != MP_OKAY) {\n    goto LBL_Q;\n  }\n\n  if ((res = mp_init (&t2)) != MP_OKAY) {\n    goto LBL_T1;\n  }\n\n  if ((res = mp_init_copy (&x, a)) != MP_OKAY) {\n    goto LBL_T2;\n  }\n\n  if ((res = mp_init_copy (&y, b)) != MP_OKAY) {\n    goto LBL_X;\n  }\n\n  /* fix the sign */\n  neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG;\n  x.sign = y.sign = MP_ZPOS;\n\n  /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */\n  norm = mp_count_bits(&y) % DIGIT_BIT;\n  if (norm < (int)(DIGIT_BIT-1)) {\n     norm = (DIGIT_BIT-1) - norm;\n     if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) {\n       goto LBL_Y;\n     }\n     if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) {\n       goto LBL_Y;\n     }\n  } else {\n     norm = 0;\n  }\n\n  /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */\n  n = x.used - 1;\n  t = y.used - 1;\n\n  /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */\n  if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */\n    goto LBL_Y;\n  }\n\n  while (mp_cmp (&x, &y) != MP_LT) {\n    ++(q.dp[n - t]);\n    if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) {\n      goto LBL_Y;\n    }\n  }\n\n  /* reset y by shifting it back down */\n  mp_rshd (&y, n - t);\n\n  /* step 3. for i from n down to (t + 1) */\n  for (i = n; i >= (t + 1); i--) {\n    if (i > x.used) {\n      continue;\n    }\n\n    /* step 3.1 if xi == yt then set q{i-t-1} to b-1, \n     * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */\n    if (x.dp[i] == y.dp[t]) {\n      q.dp[i - t - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1);\n    } else {\n      mp_word tmp;\n      tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT);\n      tmp |= ((mp_word) x.dp[i - 1]);\n      tmp /= ((mp_word) y.dp[t]);\n      if (tmp > (mp_word) MP_MASK)\n        tmp = MP_MASK;\n      q.dp[i - t - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK));\n    }\n\n    /* while (q{i-t-1} * (yt * b + y{t-1})) > \n             xi * b**2 + xi-1 * b + xi-2 \n     \n       do q{i-t-1} -= 1; \n    */\n    q.dp[i - t - 1] = (q.dp[i - t - 1] + 1) & MP_MASK;\n    do {\n      q.dp[i - t - 1] = (q.dp[i - t - 1] - 1) & MP_MASK;\n\n      /* find left hand */\n      mp_zero (&t1);\n      t1.dp[0] = (t - 1 < 0) ? 0 : y.dp[t - 1];\n      t1.dp[1] = y.dp[t];\n      t1.used = 2;\n      if ((res = mp_mul_d (&t1, q.dp[i - t - 1], &t1)) != MP_OKAY) {\n        goto LBL_Y;\n      }\n\n      /* find right hand */\n      t2.dp[0] = (i - 2 < 0) ? 0 : x.dp[i - 2];\n      t2.dp[1] = (i - 1 < 0) ? 0 : x.dp[i - 1];\n      t2.dp[2] = x.dp[i];\n      t2.used = 3;\n    } while (mp_cmp_mag(&t1, &t2) == MP_GT);\n\n    /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */\n    if ((res = mp_mul_d (&y, q.dp[i - t - 1], &t1)) != MP_OKAY) {\n      goto LBL_Y;\n    }\n\n    if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) {\n      goto LBL_Y;\n    }\n\n    if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) {\n      goto LBL_Y;\n    }\n\n    /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */\n    if (x.sign == MP_NEG) {\n      if ((res = mp_copy (&y, &t1)) != MP_OKAY) {\n        goto LBL_Y;\n      }\n      if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) {\n        goto LBL_Y;\n      }\n      if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) {\n        goto LBL_Y;\n      }\n\n      q.dp[i - t - 1] = (q.dp[i - t - 1] - 1UL) & MP_MASK;\n    }\n  }\n\n  /* now q is the quotient and x is the remainder \n   * [which we have to normalize] \n   */\n  \n  /* get sign before writing to c */\n  x.sign = x.used == 0 ? MP_ZPOS : a->sign;\n\n  if (c != NULL) {\n    mp_clamp (&q);\n    mp_exch (&q, c);\n    c->sign = neg;\n  }\n\n  if (d != NULL) {\n    mp_div_2d (&x, norm, &x, NULL);\n    mp_exch (&x, d);\n  }\n\n  res = MP_OKAY;\n\nLBL_Y:mp_clear (&y);\nLBL_X:mp_clear (&x);\nLBL_T2:mp_clear (&t2);\nLBL_T1:mp_clear (&t1);\nLBL_Q:mp_clear (&q);\n  return res;\n}\n\n#endif\n\n#endif\n\n#ifdef BN_MP_REDUCE_2K_SETUP_L_C\n\n/* determines the setup value */\nint mp_reduce_2k_setup_l(mp_int *a, mp_int *d)\n{\n   int    res;\n   mp_int tmp;\n   \n   if ((res = mp_init(&tmp)) != MP_OKAY) {\n      return res;\n   }\n   \n   if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) {\n      goto ERR;\n   }\n   \n   if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) {\n      goto ERR;\n   }\n   \nERR:\n   mp_clear(&tmp);\n   return res;\n}\n#endif\n\n#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C\n\n/*\n * shifts with subtractions when the result is greater than b.\n *\n * The method is slightly modified to shift B unconditionally upto just under\n * the leading bit of b.  This saves alot of multiple precision shifting.\n */\nint mp_montgomery_calc_normalization (mp_int * a, mp_int * b)\n{\n  int     x, bits, res;\n\n  /* how many bits of last digit does b use */\n  bits = mp_count_bits (b) % DIGIT_BIT;\n\n  if (b->used > 1) {\n     if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) {\n        return res;\n     }\n  } else {\n     mp_set(a, 1);\n     bits = 1;\n  }\n\n\n  /* now compute C = A * B mod b */\n  for (x = bits - 1; x < (int)DIGIT_BIT; x++) {\n    if ((res = mp_mul_2 (a, a)) != MP_OKAY) {\n      return res;\n    }\n    if (mp_cmp_mag (a, b) != MP_LT) {\n      if ((res = s_mp_sub (a, b, a)) != MP_OKAY) {\n        return res;\n      }\n    }\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_READ_SIGNED_BIN_C\n\n\n/* read signed bin, big endian, first byte is 0==positive or 1==negative */\nint mp_read_signed_bin (mp_int * a, const unsigned char *b, int c)\n{\n  int     res;\n\n  /* read magnitude */\n  if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) {\n    return res;\n  }\n\n  /* first byte is 0 for positive, non-zero for negative */\n  if (b[0] == 0) {\n     a->sign = MP_ZPOS;\n  } else {\n     a->sign = MP_NEG;\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_XOR_C\n\n/* XOR two ints together */\nint\nmp_xor (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     res, ix, px;\n  mp_int  t, *x;\n\n  if (a->used > b->used) {\n    if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n      return res;\n    }\n    px = b->used;\n    x = b;\n  } else {\n    if ((res = mp_init_copy (&t, b)) != MP_OKAY) {\n      return res;\n    }\n    px = a->used;\n    x = a;\n  }\n\n  for (ix = 0; ix < px; ix++) {\n     t.dp[ix] ^= x->dp[ix];\n  }\n  mp_clamp (&t);\n  mp_exch (c, &t);\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_EXPTMOD_C\n\n/* this is a shell function that calls either the normal or Montgomery\n * exptmod functions.  Originally the call to the montgomery code was\n * embedded in the normal function but that wasted alot of stack space\n * for nothing (since 99% of the time the Montgomery code would be called)\n */\nint mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)\n{\n  int dr;\n\n  /* modulus P must be positive */\n  if (P->sign == MP_NEG) {\n     return MP_VAL;\n  }\n\n  /* if exponent X is negative we have to recurse */\n  if (X->sign == MP_NEG) {\n#ifdef BN_MP_INVMOD_C\n     mp_int tmpG, tmpX;\n     int err;\n\n     /* first compute 1/G mod P */\n     if ((err = mp_init(&tmpG)) != MP_OKAY) {\n        return err;\n     }\n     if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) {\n        mp_clear(&tmpG);\n        return err;\n     }\n\n     /* now get |X| */\n     if ((err = mp_init(&tmpX)) != MP_OKAY) {\n        mp_clear(&tmpG);\n        return err;\n     }\n     if ((err = mp_abs(X, &tmpX)) != MP_OKAY) {\n        mp_clear_multi(&tmpG, &tmpX, NULL);\n        return err;\n     }\n\n     /* and now compute (1/G)**|X| instead of G**X [X < 0] */\n     err = mp_exptmod(&tmpG, &tmpX, P, Y);\n     mp_clear_multi(&tmpG, &tmpX, NULL);\n     return err;\n#else \n     /* no invmod */\n     return MP_VAL;\n#endif\n  }\n\n/* modified diminished radix reduction */\n#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C)\n  if (mp_reduce_is_2k_l(P) == MP_YES) {\n     return s_mp_exptmod(G, X, P, Y, 1);\n  }\n#endif\n\n#ifdef BN_MP_DR_IS_MODULUS_C\n  /* is it a DR modulus? */\n  dr = mp_dr_is_modulus(P);\n#else\n  /* default to no */\n  dr = 0;\n#endif\n\n#ifdef BN_MP_REDUCE_IS_2K_C\n  /* if not, is it a unrestricted DR modulus? */\n  if (dr == 0) {\n     dr = mp_reduce_is_2k(P) << 1;\n  }\n#endif\n    \n  /* if the modulus is odd or dr != 0 use the montgomery method */\n#ifdef BN_MP_EXPTMOD_FAST_C\n  if (mp_isodd (P) == 1 || dr !=  0) {\n    return mp_exptmod_fast (G, X, P, Y, dr);\n  } else {\n#endif\n#ifdef BN_S_MP_EXPTMOD_C\n    /* otherwise use the generic Barrett reduction technique */\n    return s_mp_exptmod (G, X, P, Y, 0);\n#else\n    /* no exptmod for evens */\n    return MP_VAL;\n#endif\n#ifdef BN_MP_EXPTMOD_FAST_C\n  }\n#endif\n}\n\n#endif\n\n#ifdef BN_MP_PRIME_IS_PRIME_C\n\n/* performs a variable number of rounds of Miller-Rabin\n *\n * Probability of error after t rounds is no more than\n\n *\n * Sets result to 1 if probably prime, 0 otherwise\n */\nint mp_prime_is_prime (mp_int * a, int t, int *result)\n{\n  mp_int  b;\n  int     ix, err, res;\n\n  /* default to no */\n  *result = MP_NO;\n\n  /* valid value of t? */\n  if (t <= 0 || t > PRIME_SIZE) {\n    return MP_VAL;\n  }\n\n  /* is the input equal to one of the primes in the table? */\n  for (ix = 0; ix < PRIME_SIZE; ix++) {\n      if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) {\n         *result = 1;\n         return MP_OKAY;\n      }\n  }\n\n  /* first perform trial division */\n  if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) {\n    return err;\n  }\n\n  /* return if it was trivially divisible */\n  if (res == MP_YES) {\n    return MP_OKAY;\n  }\n\n  /* now perform the miller-rabin rounds */\n  if ((err = mp_init (&b)) != MP_OKAY) {\n    return err;\n  }\n\n  for (ix = 0; ix < t; ix++) {\n    /* set the prime */\n    mp_set (&b, ltm_prime_tab[ix]);\n\n    if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) {\n      goto LBL_B;\n    }\n\n    if (res == MP_NO) {\n      goto LBL_B;\n    }\n  }\n\n  /* passed the test */\n  *result = MP_YES;\nLBL_B:mp_clear (&b);\n  return err;\n}\n#endif\n\n#ifdef BN_MP_REDUCE_2K_L_C\n\n/* reduces a modulo n where n is of the form 2**p - d \n   This differs from reduce_2k since \"d\" can be larger\n   than a single digit.\n*/\nint mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d)\n{\n   mp_int q;\n   int    p, res;\n   \n   if ((res = mp_init(&q)) != MP_OKAY) {\n      return res;\n   }\n   \n   p = mp_count_bits(n);    \ntop:\n   /* q = a/2**p, a = a mod 2**p */\n   if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) {\n      goto ERR;\n   }\n   \n   /* q = q * d */\n   if ((res = mp_mul(&q, d, &q)) != MP_OKAY) { \n      goto ERR;\n   }\n   \n   /* a = a + q */\n   if ((res = s_mp_add(a, &q, a)) != MP_OKAY) {\n      goto ERR;\n   }\n   \n   if (mp_cmp_mag(a, n) != MP_LT) {\n      s_mp_sub(a, n, a);\n      goto top;\n   }\n   \nERR:\n   mp_clear(&q);\n   return res;\n}\n\n#endif\n\n#ifdef BN_MP_EXPTMOD_FAST_C\n\n/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85\n *\n * Uses a left-to-right k-ary sliding window to compute the modular exponentiation.\n * The value of k changes based on the size of the exponent.\n *\n * Uses Montgomery or Diminished Radix reduction [whichever appropriate]\n */\n\n#ifdef MP_LOW_MEM\n   #define TAB_SIZE 32\n#else\n   #define TAB_SIZE 256\n#endif\n\nint mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode)\n{\n  mp_int  M[TAB_SIZE], res;\n  mp_digit buf, mp;\n  int     err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize;\n\n  /* use a pointer to the reduction algorithm.  This allows us to use\n   * one of many reduction algorithms without modding the guts of\n   * the code with if statements everywhere.\n   */\n  int     (*redux)(mp_int*,mp_int*,mp_digit);\n\n  /* find window size */\n  x = mp_count_bits (X);\n  if (x <= 7) {\n    winsize = 2;\n  } else if (x <= 36) {\n    winsize = 3;\n  } else if (x <= 140) {\n    winsize = 4;\n  } else if (x <= 450) {\n    winsize = 5;\n  } else if (x <= 1303) {\n    winsize = 6;\n  } else if (x <= 3529) {\n    winsize = 7;\n  } else {\n    winsize = 8;\n  }\n\n#ifdef MP_LOW_MEM\n  if (winsize > 5) {\n     winsize = 5;\n  }\n#endif\n\n  /* init M array */\n  /* init first cell */\n  if ((err = mp_init(&M[1])) != MP_OKAY) {\n     return err;\n  }\n\n  /* now init the second half of the array */\n  for (x = 1<<(winsize-1); x < (1 << winsize); x++) {\n    if ((err = mp_init(&M[x])) != MP_OKAY) {\n      for (y = 1<<(winsize-1); y < x; y++) {\n        mp_clear (&M[y]);\n      }\n      mp_clear(&M[1]);\n      return err;\n    }\n  }\n\n  /* determine and setup reduction code */\n  if (redmode == 0) {\n#ifdef BN_MP_MONTGOMERY_SETUP_C     \n     /* now setup montgomery  */\n     if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) {\n        goto LBL_M;\n     }\n#else\n     err = MP_VAL;\n     goto LBL_M;\n#endif\n\n     /* automatically pick the comba one if available (saves quite a few calls/ifs) */\n#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C\n     if (((P->used * 2 + 1) < MP_WARRAY) &&\n          P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {\n        redux = fast_mp_montgomery_reduce;\n     } else \n#endif\n     {\n#ifdef BN_MP_MONTGOMERY_REDUCE_C\n        /* use slower baseline Montgomery method */\n        redux = mp_montgomery_reduce;\n#else\n        err = MP_VAL;\n        goto LBL_M;\n#endif\n     }\n  } else if (redmode == 1) {\n#if defined(BN_MP_DR_SETUP_C) && defined(BN_MP_DR_REDUCE_C)\n     /* setup DR reduction for moduli of the form B**k - b */\n     mp_dr_setup(P, &mp);\n     redux = mp_dr_reduce;\n#else\n     err = MP_VAL;\n     goto LBL_M;\n#endif\n  } else {\n#if defined(BN_MP_REDUCE_2K_SETUP_C) && defined(BN_MP_REDUCE_2K_C)\n     /* setup DR reduction for moduli of the form 2**k - b */\n     if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) {\n        goto LBL_M;\n     }\n     redux = mp_reduce_2k;\n#else\n     err = MP_VAL;\n     goto LBL_M;\n#endif\n  }\n\n  /* setup result */\n  if ((err = mp_init (&res)) != MP_OKAY) {\n    goto LBL_M;\n  }\n\n  /* create M table\n   *\n\n   *\n   * The first half of the table is not computed though accept for M[0] and M[1]\n   */\n\n  if (redmode == 0) {\n#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C\n     /* now we need R mod m */\n     if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) {\n       goto LBL_RES;\n     }\n#else \n     err = MP_VAL;\n     goto LBL_RES;\n#endif\n\n     /* now set M[1] to G * R mod m */\n     if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) {\n       goto LBL_RES;\n     }\n  } else {\n     mp_set(&res, 1);\n     if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) {\n        goto LBL_RES;\n     }\n  }\n\n  /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */\n  if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {\n    goto LBL_RES;\n  }\n\n  for (x = 0; x < (winsize - 1); x++) {\n    if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) {\n      goto LBL_RES;\n    }\n    if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) {\n      goto LBL_RES;\n    }\n  }\n\n  /* create upper table */\n  for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) {\n    if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) {\n      goto LBL_RES;\n    }\n    if ((err = redux (&M[x], P, mp)) != MP_OKAY) {\n      goto LBL_RES;\n    }\n  }\n\n  /* set initial mode and bit cnt */\n  mode   = 0;\n  bitcnt = 1;\n  buf    = 0;\n  digidx = X->used - 1;\n  bitcpy = 0;\n  bitbuf = 0;\n\n  for (;;) {\n    /* grab next digit as required */\n    if (--bitcnt == 0) {\n      /* if digidx == -1 we are out of digits so break */\n      if (digidx == -1) {\n        break;\n      }\n      /* read next digit and reset bitcnt */\n      buf    = X->dp[digidx--];\n      bitcnt = (int)DIGIT_BIT;\n    }\n\n    /* grab the next msb from the exponent */\n    y     = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1;\n    buf <<= (mp_digit)1;\n\n    /* if the bit is zero and mode == 0 then we ignore it\n     * These represent the leading zero bits before the first 1 bit\n     * in the exponent.  Technically this opt is not required but it\n     * does lower the # of trivial squaring/reductions used\n     */\n    if (mode == 0 && y == 0) {\n      continue;\n    }\n\n    /* if the bit is zero and mode == 1 then we square */\n    if (mode == 1 && y == 0) {\n      if ((err = mp_sqr (&res, &res)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      if ((err = redux (&res, P, mp)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      continue;\n    }\n\n    /* else we add it to the window */\n    bitbuf |= (y << (winsize - ++bitcpy));\n    mode    = 2;\n\n    if (bitcpy == winsize) {\n      /* ok window is filled so square as required and multiply  */\n      /* square first */\n      for (x = 0; x < winsize; x++) {\n        if ((err = mp_sqr (&res, &res)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n        if ((err = redux (&res, P, mp)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n      }\n\n      /* then multiply */\n      if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      if ((err = redux (&res, P, mp)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n\n      /* empty window and reset */\n      bitcpy = 0;\n      bitbuf = 0;\n      mode   = 1;\n    }\n  }\n\n  /* if bits remain then square/multiply */\n  if (mode == 2 && bitcpy > 0) {\n    /* square then multiply if the bit is set */\n    for (x = 0; x < bitcpy; x++) {\n      if ((err = mp_sqr (&res, &res)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n      if ((err = redux (&res, P, mp)) != MP_OKAY) {\n        goto LBL_RES;\n      }\n\n      /* get next bit of the window */\n      bitbuf <<= 1;\n      if ((bitbuf & (1 << winsize)) != 0) {\n        /* then multiply */\n        if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n        if ((err = redux (&res, P, mp)) != MP_OKAY) {\n          goto LBL_RES;\n        }\n      }\n    }\n  }\n\n  if (redmode == 0) {\n     /* fixup result if Montgomery reduction is used\n      * recall that any value in a Montgomery system is\n      * actually multiplied by R mod n.  So we have\n      * to reduce one more time to cancel out the factor\n      * of R.\n      */\n     if ((err = redux(&res, P, mp)) != MP_OKAY) {\n       goto LBL_RES;\n     }\n  }\n\n  /* swap res with Y */\n  mp_exch (&res, Y);\n  err = MP_OKAY;\nLBL_RES:mp_clear (&res);\nLBL_M:\n  mp_clear(&M[1]);\n  for (x = 1<<(winsize-1); x < (1 << winsize); x++) {\n    mp_clear (&M[x]);\n  }\n  return err;\n}\n#endif\n\n#ifdef BN_S_MP_ADD_C\n\n/* low level addition, based on HAC pp.594, Algorithm 14.7 */\nint\ns_mp_add (mp_int * a, mp_int * b, mp_int * c)\n{\n  mp_int *x;\n  int     olduse, res, min, max;\n\n  /* find sizes, we let |a| <= |b| which means we have to sort\n   * them.  \"x\" will point to the input with the most digits\n   */\n  if (a->used > b->used) {\n    min = b->used;\n    max = a->used;\n    x = a;\n  } else {\n    min = a->used;\n    max = b->used;\n    x = b;\n  }\n\n  /* init result */\n  if (c->alloc < max + 1) {\n    if ((res = mp_grow (c, max + 1)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* get old used digit count and set new one */\n  olduse = c->used;\n  c->used = max + 1;\n\n  {\n    register mp_digit u, *tmpa, *tmpb, *tmpc;\n    register int i;\n\n    /* alias for digit pointers */\n\n    /* first input */\n    tmpa = a->dp;\n\n    /* second input */\n    tmpb = b->dp;\n\n    /* destination */\n    tmpc = c->dp;\n\n    /* zero the carry */\n    u = 0;\n    for (i = 0; i < min; i++) {\n      /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */\n      *tmpc = *tmpa++ + *tmpb++ + u;\n\n      /* U = carry bit of T[i] */\n      u = *tmpc >> ((mp_digit)DIGIT_BIT);\n\n      /* take away carry bit from T[i] */\n      *tmpc++ &= MP_MASK;\n    }\n\n    /* now copy higher words if any, that is in A+B \n     * if A or B has more digits add those in \n     */\n    if (min != max) {\n      for (; i < max; i++) {\n        /* T[i] = X[i] + U */\n        *tmpc = x->dp[i] + u;\n\n        /* U = carry bit of T[i] */\n        u = *tmpc >> ((mp_digit)DIGIT_BIT);\n\n        /* take away carry bit from T[i] */\n        *tmpc++ &= MP_MASK;\n      }\n    }\n\n    /* add carry */\n    *tmpc++ = u;\n\n    /* clear digits above oldused */\n    for (i = c->used; i < olduse; i++) {\n      *tmpc++ = 0;\n    }\n  }\n\n  mp_clamp (c);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_PRIME_FERMAT_C\n\n/* performs one Fermat test.\n * \n * If \"a\" were prime then b**a == b (mod a) since the order of\n * the multiplicative sub-group would be phi(a) = a-1.  That means\n * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a).\n *\n * Sets result to 1 if the congruence holds, or zero otherwise.\n */\nint mp_prime_fermat (mp_int * a, mp_int * b, int *result)\n{\n  mp_int  t;\n  int     err;\n\n  /* default to composite  */\n  *result = MP_NO;\n\n  /* ensure b > 1 */\n  if (mp_cmp_d(b, 1) != MP_GT) {\n     return MP_VAL;\n  }\n\n  /* init t */\n  if ((err = mp_init (&t)) != MP_OKAY) {\n    return err;\n  }\n\n  /* compute t = b**a mod a */\n  if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) {\n    goto LBL_T;\n  }\n\n  /* is it equal to b? */\n  if (mp_cmp (&t, b) == MP_EQ) {\n    *result = MP_YES;\n  }\n\n  err = MP_OKAY;\nLBL_T:mp_clear (&t);\n  return err;\n}\n#endif\n\n#ifdef BN_MP_ABS_C\n\n/* b = |a| \n *\n * Simple function copies the input and fixes the sign to positive\n */\nint\nmp_abs (mp_int * a, mp_int * b)\n{\n  int     res;\n\n  /* copy a to b */\n  if (a != b) {\n     if ((res = mp_copy (a, b)) != MP_OKAY) {\n       return res;\n     }\n  }\n\n  /* force the sign of b to positive */\n  b->sign = MP_ZPOS;\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_CLAMP_C\n\n/* trim unused digits \n *\n * This is used to ensure that leading zero digits are\n * trimed and the leading \"used\" digit will be non-zero\n * Typically very fast.  Also fixes the sign if there\n * are no more leading digits\n */\nvoid\nmp_clamp (mp_int * a)\n{\n  /* decrease used while the most significant digit is\n   * zero.\n   */\n  while (a->used > 0 && a->dp[a->used - 1] == 0) {\n    --(a->used);\n  }\n\n  /* reset the sign flag if used == 0 */\n  if (a->used == 0) {\n    a->sign = MP_ZPOS;\n  }\n}\n#endif\n\n/* $Source$ */\n/* $Revision: 0.41 $ */\n/* $Date: 2007-04-18 09:58:18 +0000 $ */\n\n#ifdef BN_MP_SIGNED_BIN_SIZE_C\n\n/* get the size for an signed equivalent */\nint mp_signed_bin_size (mp_int * a)\n{\n  return 1 + mp_unsigned_bin_size (a);\n}\n#endif\n\n#ifdef BN_MP_SQRT_C\n\n/* this function is less generic than mp_n_root, simpler and faster */\nint mp_sqrt(mp_int *arg, mp_int *ret) \n{\n  int res;\n  mp_int t1,t2;\n\n  /* must be positive */\n  if (arg->sign == MP_NEG) {\n    return MP_VAL;\n  }\n\n  /* easy out */\n  if (mp_iszero(arg) == MP_YES) {\n    mp_zero(ret);\n    return MP_OKAY;\n  }\n\n  if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_init(&t2)) != MP_OKAY) {\n    goto E2;\n  }\n\n  /* First approx. (not very bad for large arg) */\n  mp_rshd (&t1,t1.used/2);\n\n  /* t1 > 0  */ \n  if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) {\n    goto E1;\n  }\n  if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) {\n    goto E1;\n  }\n  if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) {\n    goto E1;\n  }\n  /* And now t1 > sqrt(arg) */\n  do { \n    if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) {\n      goto E1;\n    }\n    if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) {\n      goto E1;\n    }\n    if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) {\n      goto E1;\n    }\n    /* t1 >= sqrt(arg) >= t2 at this point */\n  } while (mp_cmp_mag(&t1,&t2) == MP_GT);\n\n  mp_exch(&t1,ret);\n\nE1: mp_clear(&t2);\nE2: mp_clear(&t1);\n  return res;\n}\n\n#endif\n\n#ifdef BN_MP_MONTGOMERY_SETUP_C\n\n/* setups the montgomery reduction stuff */\nint\nmp_montgomery_setup (mp_int * n, mp_digit * rho)\n{\n  mp_digit x, b;\n\n/* fast inversion mod 2**k\n *\n * Based on the fact that\n *\n * XA = 1 (mod 2**n)  =>  (X(2-XA)) A = 1 (mod 2**2n)\n *                    =>  2*X*A - X*X*A*A = 1\n *                    =>  2*(1) - (1)     = 1\n */\n  b = n->dp[0];\n\n  if ((b & 1) == 0) {\n    return MP_VAL;\n  }\n\n  x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */\n  x *= 2 - b * x;               /* here x*a==1 mod 2**8 */\n#if !defined(MP_8BIT)\n  x *= 2 - b * x;               /* here x*a==1 mod 2**16 */\n#endif\n#if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT))\n  x *= 2 - b * x;               /* here x*a==1 mod 2**32 */\n#endif\n#ifdef MP_64BIT\n  x *= 2 - b * x;               /* here x*a==1 mod 2**64 */\n#endif\n\n  /* rho = -1/m mod b */\n  *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_FWRITE_C\n\nint mp_fwrite(mp_int *a, int radix, FILE *stream)\n{\n   char *buf = NULL;\n   int err = 0, len = 0, x = 0;\n   \n   if ((err = mp_radix_size(a, radix, &len)) != MP_OKAY) {\n      return err;\n   }\n\n   buf = OPT_CAST(char) XMALLOC (len);\n   if (buf == NULL) {\n      return MP_MEM;\n   }\n   \n   if ((err = mp_toradix(a, buf, radix)) != MP_OKAY) {\n      XFREE (buf);\n      return err;\n   }\n   \n   for (x = 0; x < len; x++) {\n       if (fputc(buf[x], stream) == EOF) {\n          XFREE (buf);\n          return MP_VAL;\n       }\n   }\n   \n   XFREE (buf);\n   return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_EXCH_C\n\n/* swap the elements of two integers, for cases where you can't simply swap the \n * mp_int pointers around\n */\nvoid\nmp_exch (mp_int * a, mp_int * b)\n{\n  mp_int  t;\n\n  t  = *a;\n  *a = *b;\n  *b = t;\n}\n#endif\n\n#ifdef BN_PRIME_TAB_C\n\nconst mp_digit ltm_prime_tab[] = {\n  0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013,\n  0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035,\n  0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059,\n  0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F,\n#ifndef MP_8BIT\n  0x0083,\n  0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD,\n  0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF,\n  0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107,\n  0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137,\n\n  0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167,\n  0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199,\n  0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9,\n  0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7,\n  0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239,\n  0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265,\n  0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293,\n  0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF,\n\n  0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301,\n  0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B,\n  0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371,\n  0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD,\n  0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5,\n  0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419,\n  0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449,\n  0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B,\n\n  0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7,\n  0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503,\n  0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529,\n  0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F,\n  0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3,\n  0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7,\n  0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623,\n  0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653\n#endif\n};\n#endif\n\n#ifdef BN_MP_INIT_SET_C\n\n/* initialize and set a digit */\nint mp_init_set (mp_int * a, mp_digit b)\n{\n  int err;\n  if ((err = mp_init(a)) != MP_OKAY) {\n     return err;\n  }\n  mp_set(a, b);\n  return err;\n}\n#endif\n\n#ifdef BN_MP_GET_INT_C\n\n/* get the lower 32-bits of an mp_int */\nunsigned long mp_get_int(mp_int * a) \n{\n  int i;\n  unsigned long res;\n\n  if (a->used == 0) {\n     return 0;\n  }\n\n  /* get number of digits of the lsb we have to read */\n  i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1;\n\n  /* get most significant digit of result */\n  res = DIGIT(a,i);\n   \n  while (--i >= 0) {\n    res = (res << DIGIT_BIT) | DIGIT(a,i);\n  }\n\n  /* force result to 32-bits always so it is consistent on non 32-bit platforms */\n  return res & 0xFFFFFFFFUL;\n}\n#endif\n\n#ifdef BN_MP_MUL_C\n\n/* high level multiplication (handles sign) */\nint mp_mul (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     res, neg;\n  neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG;\n\n  /* use Toom-Cook? */\n#ifdef BN_MP_TOOM_MUL_C\n  if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) {\n    res = mp_toom_mul(a, b, c);\n  } else \n#endif\n#ifdef BN_MP_KARATSUBA_MUL_C\n  /* use Karatsuba? */\n  if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) {\n    res = mp_karatsuba_mul (a, b, c);\n  } else \n#endif\n  {\n    /* can we use the fast multiplier?\n     *\n     * The fast multiplier can be used if the output will \n     * have less than MP_WARRAY digits and the number of \n     * digits won't affect carry propagation\n     */\n    int     digs = a->used + b->used + 1;\n\n#ifdef BN_FAST_S_MP_MUL_DIGS_C\n    if ((digs < MP_WARRAY) &&\n        MIN(a->used, b->used) <= \n        (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {\n      res = fast_s_mp_mul_digs (a, b, c, digs);\n    } else \n#endif\n#ifdef BN_S_MP_MUL_DIGS_C\n      res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */\n#else\n      res = MP_VAL;\n#endif\n\n  }\n  c->sign = (c->used > 0) ? neg : MP_ZPOS;\n  return res;\n}\n#endif\n\n#ifdef BN_MP_SQRMOD_C\n\n/* c = a * a (mod b) */\nint\nmp_sqrmod (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     res;\n  mp_int  t;\n\n  if ((res = mp_init (&t)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_sqr (a, &t)) != MP_OKAY) {\n    mp_clear (&t);\n    return res;\n  }\n  res = mp_mod (&t, b, c);\n  mp_clear (&t);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_TO_UNSIGNED_BIN_C\n\n/* store in unsigned [big endian] format */\nint mp_to_unsigned_bin (mp_int * a, unsigned char *b)\n{\n  int     x, res;\n  mp_int  t;\n\n  if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n    return res;\n  }\n\n  x = 0;\n  while (mp_iszero (&t) == 0) {\n#ifndef MP_8BIT\n      b[x++] = (unsigned char) (t.dp[0] & 255);\n#else\n      b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7));\n#endif\n    if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {\n      mp_clear (&t);\n      return res;\n    }\n  }\n  bn_reverse (b, x);\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_S_MP_SQR_C\n\n/* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */\nint s_mp_sqr (mp_int * a, mp_int * b)\n{\n  mp_int  t;\n  int     res, ix, iy, pa;\n  mp_word r;\n  mp_digit u, tmpx, *tmpt;\n\n  pa = a->used;\n  if ((res = mp_init_size (&t, 2*pa + 1)) != MP_OKAY) {\n    return res;\n  }\n\n  /* default used is maximum possible size */\n  t.used = 2*pa + 1;\n\n  for (ix = 0; ix < pa; ix++) {\n    /* first calculate the digit at 2*ix */\n    /* calculate double precision result */\n    r = ((mp_word) t.dp[2*ix]) +\n        ((mp_word)a->dp[ix])*((mp_word)a->dp[ix]);\n\n    /* store lower part in result */\n    t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK));\n\n    /* get the carry */\n    u           = (mp_digit)(r >> ((mp_word) DIGIT_BIT));\n\n    /* left hand side of A[ix] * A[iy] */\n    tmpx        = a->dp[ix];\n\n    /* alias for where to store the results */\n    tmpt        = t.dp + (2*ix + 1);\n    \n    for (iy = ix + 1; iy < pa; iy++) {\n      /* first calculate the product */\n      r       = ((mp_word)tmpx) * ((mp_word)a->dp[iy]);\n\n      /* now calculate the double precision result, note we use\n       * addition instead of *2 since it's easier to optimize\n       */\n      r       = ((mp_word) *tmpt) + r + r + ((mp_word) u);\n\n      /* store lower part */\n      *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));\n\n      /* get carry */\n      u       = (mp_digit)(r >> ((mp_word) DIGIT_BIT));\n    }\n    /* propagate upwards */\n    while (u != ((mp_digit) 0)) {\n      r       = ((mp_word) *tmpt) + ((mp_word) u);\n      *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));\n      u       = (mp_digit)(r >> ((mp_word) DIGIT_BIT));\n    }\n  }\n\n  mp_clamp (&t);\n  mp_exch (&t, b);\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_NEG_C\n\n/* b = -a */\nint mp_neg (mp_int * a, mp_int * b)\n{\n  int     res;\n  if (a != b) {\n     if ((res = mp_copy (a, b)) != MP_OKAY) {\n        return res;\n     }\n  }\n\n  if (mp_iszero(b) != MP_YES) {\n     b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS;\n  } else {\n     b->sign = MP_ZPOS;\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_RADIX_SMAP_C\n\n/* chars used in radix conversions */\nconst char *mp_s_rmap = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/\";\n#endif\n\n#ifdef BN_FAST_S_MP_MUL_DIGS_C\n\n/* Fast (comba) multiplier\n *\n * This is the fast column-array [comba] multiplier.  It is \n * designed to compute the columns of the product first \n * then handle the carries afterwards.  This has the effect \n * of making the nested loops that compute the columns very\n * simple and schedulable on super-scalar processors.\n *\n * This has been modified to produce a variable number of \n * digits of output so if say only a half-product is required \n * you don't have to compute the upper half (a feature \n * required for fast Barrett reduction).\n *\n * Based on Algorithm 14.12 on pp.595 of HAC.\n *\n */\nint fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)\n{\n  int     olduse, res, pa, ix, iz;\n\tmp_digit W[MP_WARRAY] = {};\n  register mp_word  _W;\n\n  /* grow the destination as required */\n  if (c->alloc < digs) {\n    if ((res = mp_grow (c, digs)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* number of output digits to produce */\n  pa = MIN(digs, a->used + b->used);\n\n  /* clear the carry */\n  _W = 0;\n  for (ix = 0; ix < pa; ix++) { \n      int      tx, ty;\n      int      iy;\n      mp_digit *tmpx, *tmpy;\n\n      /* get offsets into the two bignums */\n      ty = MIN(b->used-1, ix);\n      tx = ix - ty;\n\n      /* setup temp aliases */\n      tmpx = a->dp + tx;\n      tmpy = b->dp + ty;\n\n      /* this is the number of times the loop will iterrate, essentially \n         while (tx++ < a->used && ty-- >= 0) { ... }\n       */\n      iy = MIN(a->used-tx, ty+1);\n\n      /* execute loop */\n      for (iz = 0; iz < iy; ++iz) {\n         _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--);\n\n      }\n\n      /* store term */\n      W[ix] = ((mp_digit)_W) & MP_MASK;\n\n      /* make next carry */\n      _W = _W >> ((mp_word)DIGIT_BIT);\n }\n\n  /* setup dest */\n  olduse  = c->used;\n  c->used = pa;\n\n  {\n    register mp_digit *tmpc;\n    tmpc = c->dp;\n    for (ix = 0; ix < pa+1; ix++) {\n      /* now extract the previous digit [below the carry] */\n      *tmpc++ = W[ix];\n    }\n\n    /* clear unused digits [that existed in the old copy of c] */\n    for (; ix < olduse; ix++) {\n      *tmpc++ = 0;\n    }\n  }\n  mp_clamp (c);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C\n\n/* this is a modified version of fast_s_mul_digs that only produces\n * output digits *above* digs.  See the comments for fast_s_mul_digs\n * to see how it works.\n *\n * This is used in the Barrett reduction since for one of the multiplications\n * only the higher digits were needed.  This essentially halves the work.\n *\n * Based on Algorithm 14.12 on pp.595 of HAC.\n */\nint fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)\n{\n  int     olduse, res, pa, ix, iz;\n  mp_digit W[MP_WARRAY];\n  mp_word  _W;\n\n  /* grow the destination as required */\n  pa = a->used + b->used;\n  if (c->alloc < pa) {\n    if ((res = mp_grow (c, pa)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* number of output digits to produce */\n  pa = a->used + b->used;\n  _W = 0;\n  for (ix = digs; ix < pa; ix++) { \n      int      tx, ty, iy;\n      mp_digit *tmpx, *tmpy;\n\n      /* get offsets into the two bignums */\n      ty = MIN(b->used-1, ix);\n      tx = ix - ty;\n\n      /* setup temp aliases */\n      tmpx = a->dp + tx;\n      tmpy = b->dp + ty;\n\n      /* this is the number of times the loop will iterrate, essentially its \n         while (tx++ < a->used && ty-- >= 0) { ... }\n       */\n      iy = MIN(a->used-tx, ty+1);\n\n      /* execute loop */\n      for (iz = 0; iz < iy; iz++) {\n         _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--);\n      }\n\n      /* store term */\n      W[ix] = ((mp_digit)_W) & MP_MASK;\n\n      /* make next carry */\n      _W = _W >> ((mp_word)DIGIT_BIT);\n  }\n  \n  /* setup dest */\n  olduse  = c->used;\n  c->used = pa;\n\n  {\n    register mp_digit *tmpc;\n\n    tmpc = c->dp + digs;\n    for (ix = digs; ix < pa; ix++) {\n      /* now extract the previous digit [below the carry] */\n      *tmpc++ = W[ix];\n    }\n\n    /* clear unused digits [that existed in the old copy of c] */\n    for (; ix < olduse; ix++) {\n      *tmpc++ = 0;\n    }\n  }\n  mp_clamp (c);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_REDUCE_2K_C\n\n/* reduces a modulo n where n is of the form 2**p - d */\nint mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d)\n{\n   mp_int q;\n   int    p, res;\n   \n   if ((res = mp_init(&q)) != MP_OKAY) {\n      return res;\n   }\n   \n   p = mp_count_bits(n);    \ntop:\n   /* q = a/2**p, a = a mod 2**p */\n   if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) {\n      goto ERR;\n   }\n   \n   if (d != 1) {\n      /* q = q * d */\n      if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) { \n         goto ERR;\n      }\n   }\n   \n   /* a = a + q */\n   if ((res = s_mp_add(a, &q, a)) != MP_OKAY) {\n      goto ERR;\n   }\n   \n   if (mp_cmp_mag(a, n) != MP_LT) {\n      s_mp_sub(a, n, a);\n      goto top;\n   }\n   \nERR:\n   mp_clear(&q);\n   return res;\n}\n\n#endif\n\n#ifdef BN_MP_SET_C\n\n/* set to a digit */\nvoid mp_set (mp_int * a, mp_digit b)\n{\n  mp_zero (a);\n  a->dp[0] = b & MP_MASK;\n  a->used  = (a->dp[0] != 0) ? 1 : 0;\n}\n#endif\n\n#ifdef BN_MP_MOD_D_C\n\nint\nmp_mod_d (mp_int * a, mp_digit b, mp_digit * c)\n{\n  return mp_div_d(a, b, NULL, c);\n}\n#endif\n\n#ifdef BN_MP_COPY_C\n\n/* copy, b = a */\nint\nmp_copy (mp_int * a, mp_int * b)\n{\n  int     res, n;\n\n  /* if dst == src do nothing */\n  if (a == b) {\n    return MP_OKAY;\n  }\n\n  /* grow dest */\n  if (b->alloc < a->used) {\n     if ((res = mp_grow (b, a->used)) != MP_OKAY) {\n        return res;\n     }\n  }\n\n  /* zero b and copy the parameters over */\n  {\n    register mp_digit *tmpa, *tmpb;\n\n    /* pointer aliases */\n\n    /* source */\n    tmpa = a->dp;\n\n    /* destination */\n    tmpb = b->dp;\n\n    /* copy all the digits */\n    for (n = 0; n < a->used; n++) {\n      *tmpb++ = *tmpa++;\n    }\n\n    /* clear high digits */\n    for (; n < b->used; n++) {\n      *tmpb++ = 0;\n    }\n  }\n\n  /* copy used count and sign */\n  b->used = a->used;\n  b->sign = a->sign;\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_TO_SIGNED_BIN_N_C\n\n/* store in signed [big endian] format */\nint mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen)\n{\n   if (*outlen < (unsigned long)mp_signed_bin_size(a)) {\n      return MP_VAL;\n   }\n   *outlen = mp_signed_bin_size(a);\n   return mp_to_signed_bin(a, b);\n}\n#endif\n\n#ifdef BN_FAST_S_MP_SQR_C\n\n/* the jist of squaring...\n * you do like mult except the offset of the tmpx [one that \n * starts closer to zero] can't equal the offset of tmpy.  \n * So basically you set up iy like before then you min it with\n * (ty-tx) so that it never happens.  You double all those \n * you add in the inner loop\n\nAfter that loop you do the squares and add them in.\n*/\n\nint fast_s_mp_sqr (mp_int * a, mp_int * b)\n{\n  int       olduse, res, pa, ix, iz;\n  mp_digit   W[MP_WARRAY], *tmpx;\n  mp_word   W1;\n\n  /* grow the destination as required */\n  pa = a->used + a->used;\n  if (b->alloc < pa) {\n    if ((res = mp_grow (b, pa)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  /* number of output digits to produce */\n  W1 = 0;\n  for (ix = 0; ix < pa; ix++) { \n      int      tx, ty, iy;\n      mp_word  _W;\n      mp_digit *tmpy;\n\n      /* clear counter */\n      _W = 0;\n\n      /* get offsets into the two bignums */\n      ty = MIN(a->used-1, ix);\n      tx = ix - ty;\n\n      /* setup temp aliases */\n      tmpx = a->dp + tx;\n      tmpy = a->dp + ty;\n\n      /* this is the number of times the loop will iterrate, essentially\n         while (tx++ < a->used && ty-- >= 0) { ... }\n       */\n      iy = MIN(a->used-tx, ty+1);\n\n      /* now for squaring tx can never equal ty \n       * we halve the distance since they approach at a rate of 2x\n       * and we have to round because odd cases need to be executed\n       */\n      iy = MIN(iy, (ty-tx+1)>>1);\n\n      /* execute loop */\n      for (iz = 0; iz < iy; iz++) {\n         _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--);\n      }\n\n      /* double the inner product and add carry */\n      _W = _W + _W + W1;\n\n      /* even columns have the square term in them */\n      if ((ix&1) == 0) {\n         _W += ((mp_word)a->dp[ix>>1])*((mp_word)a->dp[ix>>1]);\n      }\n\n      /* store it */\n      W[ix] = (mp_digit)(_W & MP_MASK);\n\n      /* make next carry */\n      W1 = _W >> ((mp_word)DIGIT_BIT);\n  }\n\n  /* setup dest */\n  olduse  = b->used;\n  b->used = a->used+a->used;\n\n  {\n    mp_digit *tmpb;\n    tmpb = b->dp;\n    for (ix = 0; ix < pa; ix++) {\n      *tmpb++ = W[ix] & MP_MASK;\n    }\n\n    /* clear unused digits [that existed in the old copy of c] */\n    for (; ix < olduse; ix++) {\n      *tmpb++ = 0;\n    }\n  }\n  mp_clamp (b);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_SHRINK_C\n\n/* shrink a bignum */\nint mp_shrink (mp_int * a)\n{\n  mp_digit *tmp;\n  int used = 1;\n  \n  if(a->used > 0)\n    used = a->used;\n  \n  if (a->alloc != used) {\n    if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) {\n      return MP_MEM;\n    }\n    a->dp    = tmp;\n    a->alloc = used;\n  }\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_2EXPT_C\n\n/* computes a = 2**b \n *\n * Simple algorithm which zeroes the int, grows it then just sets one bit\n * as required.\n */\nint\nmp_2expt (mp_int * a, int b)\n{\n  int     res;\n\n  /* zero a as per default */\n  mp_zero (a);\n\n  /* grow a to accomodate the single bit */\n  if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) {\n    return res;\n  }\n\n  /* set the used count of where the bit will go */\n  a->used = b / DIGIT_BIT + 1;\n\n  /* put the single bit in its place */\n  a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT);\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_DR_REDUCE_C\n\n/* reduce \"x\" in place modulo \"n\" using the Diminished Radix algorithm.\n *\n * Based on algorithm from the paper\n *\n * \"Generating Efficient Primes for Discrete Log Cryptosystems\"\n *                 Chae Hoon Lim, Pil Joong Lee,\n *          POSTECH Information Research Laboratories\n *\n * The modulus must be of a special format [see manual]\n *\n * Has been modified to use algorithm 7.10 from the LTM book instead\n *\n * Input x must be in the range 0 <= x <= (n-1)**2\n */\nint\nmp_dr_reduce (mp_int * x, mp_int * n, mp_digit k)\n{\n  int      err, i, m;\n  mp_word  r;\n  mp_digit mu, *tmpx1, *tmpx2;\n\n  /* m = digits in modulus */\n  m = n->used;\n\n  /* ensure that \"x\" has at least 2m digits */\n  if (x->alloc < m + m) {\n    if ((err = mp_grow (x, m + m)) != MP_OKAY) {\n      return err;\n    }\n  }\n\n/* top of loop, this is where the code resumes if\n * another reduction pass is required.\n */\ntop:\n  /* aliases for digits */\n  /* alias for lower half of x */\n  tmpx1 = x->dp;\n\n  /* alias for upper half of x, or x/B**m */\n  tmpx2 = x->dp + m;\n\n  /* set carry to zero */\n  mu = 0;\n\n  /* compute (x mod B**m) + k * [x/B**m] inline and inplace */\n  for (i = 0; i < m; i++) {\n      r         = ((mp_word)*tmpx2++) * ((mp_word)k) + *tmpx1 + mu;\n      *tmpx1++  = (mp_digit)(r & MP_MASK);\n      mu        = (mp_digit)(r >> ((mp_word)DIGIT_BIT));\n  }\n\n  /* set final carry */\n  *tmpx1++ = mu;\n\n  /* zero words above m */\n  for (i = m + 1; i < x->used; i++) {\n      *tmpx1++ = 0;\n  }\n\n  /* clamp, sub and return */\n  mp_clamp (x);\n\n  /* if x >= n then subtract and reduce again\n   * Each successive \"recursion\" makes the input smaller and smaller.\n   */\n  if (mp_cmp_mag (x, n) != MP_LT) {\n    s_mp_sub(x, n, x);\n    goto top;\n  }\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_TORADIX_N_C\n\n/* stores a bignum as a ASCII string in a given radix (2..64) \n *\n * Stores upto maxlen-1 chars and always a NULL byte \n */\nint mp_toradix_n(mp_int * a, char *str, int radix, int maxlen)\n{\n  int     res, digs;\n  mp_int  t;\n  mp_digit d;\n  char   *_s = str;\n\n  /* check range of the maxlen, radix */\n  if (maxlen < 2 || radix < 2 || radix > 64) {\n    return MP_VAL;\n  }\n\n  /* quick out if its zero */\n  if (mp_iszero(a) == MP_YES) {\n     *str++ = '0';\n     *str = '\\0';\n     return MP_OKAY;\n  }\n\n  if ((res = mp_init_copy (&t, a)) != MP_OKAY) {\n    return res;\n  }\n\n  /* if it is negative output a - */\n  if (t.sign == MP_NEG) {\n    /* we have to reverse our digits later... but not the - sign!! */\n    ++_s;\n\n    /* store the flag and mark the number as positive */\n    *str++ = '-';\n    t.sign = MP_ZPOS;\n \n    /* subtract a char */\n    --maxlen;\n  }\n\n  digs = 0;\n  while (mp_iszero (&t) == 0) {\n    if (--maxlen < 1) {\n       /* no more room */\n       break;\n    }\n    if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {\n      mp_clear (&t);\n      return res;\n    }\n    *str++ = mp_s_rmap[d];\n    ++digs;\n  }\n\n  /* reverse the digits of the string.  In this case _s points\n   * to the first digit [exluding the sign] of the number\n   */\n  bn_reverse ((unsigned char *)_s, digs);\n\n  /* append a NULL so the string is properly terminated */\n  *str = '\\0';\n\n  mp_clear (&t);\n  return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_PRIME_MILLER_RABIN_C\n\n/* Miller-Rabin test of \"a\" to the base of \"b\" as described in \n * HAC pp. 139 Algorithm 4.24\n *\n * Sets result to 0 if definitely composite or 1 if probably prime.\n * Randomly the chance of error is no more than 1/4 and often \n * very much lower.\n */\nint mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result)\n{\n  mp_int  n1, y, r;\n  int     s, j, err;\n\n  /* default */\n  *result = MP_NO;\n\n  /* ensure b > 1 */\n  if (mp_cmp_d(b, 1) != MP_GT) {\n     return MP_VAL;\n  }     \n\n  /* get n1 = a - 1 */\n  if ((err = mp_init_copy (&n1, a)) != MP_OKAY) {\n    return err;\n  }\n  if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) {\n    goto LBL_N1;\n  }\n\n  /* set 2**s * r = n1 */\n  if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) {\n    goto LBL_N1;\n  }\n\n  /* count the number of least significant bits\n   * which are zero\n   */\n  s = mp_cnt_lsb(&r);\n\n  /* now divide n - 1 by 2**s */\n  if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) {\n    goto LBL_R;\n  }\n\n  /* compute y = b**r mod a */\n  if ((err = mp_init (&y)) != MP_OKAY) {\n    goto LBL_R;\n  }\n  if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) {\n    goto LBL_Y;\n  }\n\n  /* if y != 1 and y != n1 do */\n  if (mp_cmp_d (&y, 1) != MP_EQ && mp_cmp (&y, &n1) != MP_EQ) {\n    j = 1;\n    /* while j <= s-1 and y != n1 */\n    while ((j <= (s - 1)) && mp_cmp (&y, &n1) != MP_EQ) {\n      if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) {\n         goto LBL_Y;\n      }\n\n      /* if y == 1 then composite */\n      if (mp_cmp_d (&y, 1) == MP_EQ) {\n         goto LBL_Y;\n      }\n\n      ++j;\n    }\n\n    /* if y != n1 then composite */\n    if (mp_cmp (&y, &n1) != MP_EQ) {\n      goto LBL_Y;\n    }\n  }\n\n  /* probably prime now */\n  *result = MP_YES;\nLBL_Y:mp_clear (&y);\nLBL_R:mp_clear (&r);\nLBL_N1:mp_clear (&n1);\n  return err;\n}\n#endif\n\n#ifdef BN_MP_REDUCE_IS_2K_L_C\n\n/* determines if reduce_2k_l can be used */\nint mp_reduce_is_2k_l(mp_int *a)\n{\n   int ix, iy;\n   \n   if (a->used == 0) {\n      return MP_NO;\n   } else if (a->used == 1) {\n      return MP_YES;\n   } else if (a->used > 1) {\n      /* if more than half of the digits are -1 we're sold */\n      for (iy = ix = 0; ix < a->used; ix++) {\n          if (a->dp[ix] == MP_MASK) {\n              ++iy;\n          }\n      }\n      return (iy >= (a->used/2)) ? MP_YES : MP_NO;\n      \n   }\n   return MP_NO;\n}\n\n#endif\n\n#ifdef BN_MP_DR_SETUP_C\n\n/* determines the setup value */\nvoid mp_dr_setup(mp_int *a, mp_digit *d)\n{\n   /* the casts are required if DIGIT_BIT is one less than\n    * the number of bits in a mp_digit [e.g. DIGIT_BIT==31]\n    */\n   *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - \n        ((mp_word)a->dp[0]));\n}\n\n#endif\n\n#ifdef BN_MP_REDUCE_2K_SETUP_C\n\n/* determines the setup value */\nint mp_reduce_2k_setup(mp_int *a, mp_digit *d)\n{\n   int res, p;\n   mp_int tmp;\n   \n   if ((res = mp_init(&tmp)) != MP_OKAY) {\n      return res;\n   }\n   \n   p = mp_count_bits(a);\n   if ((res = mp_2expt(&tmp, p)) != MP_OKAY) {\n      mp_clear(&tmp);\n      return res;\n   }\n   \n   if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) {\n      mp_clear(&tmp);\n      return res;\n   }\n   \n   *d = tmp.dp[0];\n   mp_clear(&tmp);\n   return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_REDUCE_SETUP_C\n\n/* pre-calculate the value required for Barrett reduction\n * For a given modulus \"b\" it calulates the value required in \"a\"\n */\nint mp_reduce_setup (mp_int * a, mp_int * b)\n{\n  int     res;\n  \n  if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) {\n    return res;\n  }\n  return mp_div (a, b, a, NULL);\n}\n#endif\n\n#ifdef BN_MP_GCD_C\n\n/* Greatest Common Divisor using the binary method */\nint mp_gcd (mp_int * a, mp_int * b, mp_int * c)\n{\n  mp_int  u, v;\n  int     k, u_lsb, v_lsb, res;\n\n  /* either zero than gcd is the largest */\n  if (mp_iszero (a) == MP_YES) {\n    return mp_abs (b, c);\n  }\n  if (mp_iszero (b) == MP_YES) {\n    return mp_abs (a, c);\n  }\n\n  /* get copies of a and b we can modify */\n  if ((res = mp_init_copy (&u, a)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_init_copy (&v, b)) != MP_OKAY) {\n    goto LBL_U;\n  }\n\n  /* must be positive for the remainder of the algorithm */\n  u.sign = v.sign = MP_ZPOS;\n\n  /* B1.  Find the common power of two for u and v */\n  u_lsb = mp_cnt_lsb(&u);\n  v_lsb = mp_cnt_lsb(&v);\n  k     = MIN(u_lsb, v_lsb);\n\n  if (k > 0) {\n     /* divide the power of two out */\n     if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) {\n        goto LBL_V;\n     }\n\n     if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) {\n        goto LBL_V;\n     }\n  }\n\n  /* divide any remaining factors of two out */\n  if (u_lsb != k) {\n     if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) {\n        goto LBL_V;\n     }\n  }\n\n  if (v_lsb != k) {\n     if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) {\n        goto LBL_V;\n     }\n  }\n\n  while (mp_iszero(&v) == 0) {\n     /* make sure v is the largest */\n     if (mp_cmp_mag(&u, &v) == MP_GT) {\n        /* swap u and v to make sure v is >= u */\n        mp_exch(&u, &v);\n     }\n     \n     /* subtract smallest from largest */\n     if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) {\n        goto LBL_V;\n     }\n     \n     /* Divide out all factors of two */\n     if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) {\n        goto LBL_V;\n     } \n  } \n\n  /* multiply by 2**k which we divided out at the beginning */\n  if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) {\n     goto LBL_V;\n  }\n  c->sign = MP_ZPOS;\n  res = MP_OKAY;\nLBL_V:mp_clear (&u);\nLBL_U:mp_clear (&v);\n  return res;\n}\n#endif\n\n#ifdef BN_S_MP_SUB_C\n\n/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */\nint\ns_mp_sub (mp_int * a, mp_int * b, mp_int * c)\n{\n  int     olduse, res, min, max;\n\n  /* find sizes */\n  min = b->used;\n  max = a->used;\n\n  /* init result */\n  if (c->alloc < max) {\n    if ((res = mp_grow (c, max)) != MP_OKAY) {\n      return res;\n    }\n  }\n  olduse = c->used;\n  c->used = max;\n\n  {\n    register mp_digit u, *tmpa, *tmpb, *tmpc;\n    register int i;\n\n    /* alias for digit pointers */\n    tmpa = a->dp;\n    tmpb = b->dp;\n    tmpc = c->dp;\n\n    /* set carry to zero */\n    u = 0;\n    for (i = 0; i < min; i++) {\n      /* T[i] = A[i] - B[i] - U */\n      *tmpc = *tmpa++ - *tmpb++ - u;\n\n      /* U = carry bit of T[i]\n       * Note this saves performing an AND operation since\n       * if a carry does occur it will propagate all the way to the\n       * MSB.  As a result a single shift is enough to get the carry\n       */\n      u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1));\n\n      /* Clear carry from T[i] */\n      *tmpc++ &= MP_MASK;\n    }\n\n    /* now copy higher words if any, e.g. if A has more digits than B  */\n    for (; i < max; i++) {\n      /* T[i] = A[i] - U */\n      *tmpc = *tmpa++ - u;\n\n      /* U = carry bit of T[i] */\n      u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1));\n\n      /* Clear carry from T[i] */\n      *tmpc++ &= MP_MASK;\n    }\n\n    /* clear digits above used (since we may not have grown result above) */\n    for (i = c->used; i < olduse; i++) {\n      *tmpc++ = 0;\n    }\n  }\n\n  mp_clamp (c);\n  return MP_OKAY;\n}\n\n#endif\n\n#ifdef BN_MP_TOOM_MUL_C\n\n/* multiplication using the Toom-Cook 3-way algorithm \n *\n * Much more complicated than Karatsuba but has a lower \n * asymptotic running time of O(N**1.464).  This algorithm is \n * only particularly useful on VERY large inputs \n * (we're talking 1000s of digits here...).\n*/\nint mp_toom_mul(mp_int *a, mp_int *b, mp_int *c)\n{\n    mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2;\n    int res, B;\n        \n    /* init temps */\n    if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, \n                             &a0, &a1, &a2, &b0, &b1, \n                             &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) {\n       return res;\n    }\n    \n    /* B */\n    B = MIN(a->used, b->used) / 3;\n    \n    /* a = a2 * B**2 + a1 * B + a0 */\n    if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    if ((res = mp_copy(a, &a1)) != MP_OKAY) {\n       goto ERR;\n    }\n    mp_rshd(&a1, B);\n    mp_mod_2d(&a1, DIGIT_BIT * B, &a1);\n\n    if ((res = mp_copy(a, &a2)) != MP_OKAY) {\n       goto ERR;\n    }\n    mp_rshd(&a2, B*2);\n    \n    /* b = b2 * B**2 + b1 * B + b0 */\n    if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) {\n       goto ERR;\n    }\n\n    if ((res = mp_copy(b, &b1)) != MP_OKAY) {\n       goto ERR;\n    }\n    mp_rshd(&b1, B);\n    mp_mod_2d(&b1, DIGIT_BIT * B, &b1);\n\n    if ((res = mp_copy(b, &b2)) != MP_OKAY) {\n       goto ERR;\n    }\n    mp_rshd(&b2, B*2);\n    \n    /* w0 = a0*b0 */\n    if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    /* w4 = a2 * b2 */\n    if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */\n    if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */\n    if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n\n    /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */\n    if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) {\n       goto ERR;\n    }\n    if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) {\n       goto ERR;\n    }\n    \n    /* now solve the matrix \n    \n       0  0  0  0  1\n       1  2  4  8  16\n       1  1  1  1  1\n       16 8  4  2  1\n       1  0  0  0  0\n       \n       using 12 subtractions, 4 shifts, \n              2 small divisions and 1 small multiplication \n     */\n     \n     /* r1 - r4 */\n     if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - r0 */\n     if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1/2 */\n     if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3/2 */\n     if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r2 - r0 - r4 */\n     if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1 - r2 */\n     if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - r2 */\n     if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1 - 8r0 */\n     if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - 8r4 */\n     if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* 3r2 - r1 - r3 */\n     if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1 - r2 */\n     if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3 - r2 */\n     if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r1/3 */\n     if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) {\n        goto ERR;\n     }\n     /* r3/3 */\n     if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) {\n        goto ERR;\n     }\n     \n     /* at this point shift W[n] by B*n */\n     if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) {\n        goto ERR;\n     }     \n     \n     if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) {\n        goto ERR;\n     }\n     if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) {\n        goto ERR;\n     }     \n     \nERR:\n     mp_clear_multi(&w0, &w1, &w2, &w3, &w4, \n                    &a0, &a1, &a2, &b0, &b1, \n                    &b2, &tmp1, &tmp2, NULL);\n     return res;\n}     \n     \n#endif\n\n#ifdef BN_MP_INIT_SET_INT_C\n\n/* initialize and set a digit */\nint mp_init_set_int (mp_int * a, unsigned long b)\n{\n  int err;\n  if ((err = mp_init(a)) != MP_OKAY) {\n     return err;\n  }\n  return mp_set_int(a, b);\n}\n#endif\n\n#ifdef BN_FAST_MP_INVMOD_C\n\n/* computes the modular inverse via binary extended euclidean algorithm, \n * that is c = 1/a mod b \n *\n * Based on slow invmod except this is optimized for the case where b is \n * odd as per HAC Note 14.64 on pp. 610\n */\nint fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c)\n{\n  mp_int  x, y, u, v, B, D;\n  int     res, neg;\n\n  /* 2. [modified] b must be odd   */\n  if (mp_iseven (b) == 1) {\n    return MP_VAL;\n  }\n\n  /* init all our temps */\n  if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) {\n     return res;\n  }\n\n  /* x == modulus, y == value to invert */\n  if ((res = mp_copy (b, &x)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n\n  /* we need y = |a| */\n  if ((res = mp_mod (a, b, &y)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n\n  /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */\n  if ((res = mp_copy (&x, &u)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n  if ((res = mp_copy (&y, &v)) != MP_OKAY) {\n    goto LBL_ERR;\n  }\n  mp_set (&D, 1);\n\ntop:\n  /* 4.  while u is even do */\n  while (mp_iseven (&u) == 1) {\n    /* 4.1 u = u/2 */\n    if ((res = mp_div_2 (&u, &u)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n    /* 4.2 if B is odd then */\n    if (mp_isodd (&B) == 1) {\n      if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) {\n        goto LBL_ERR;\n      }\n    }\n    /* B = B/2 */\n    if ((res = mp_div_2 (&B, &B)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n\n  /* 5.  while v is even do */\n  while (mp_iseven (&v) == 1) {\n    /* 5.1 v = v/2 */\n    if ((res = mp_div_2 (&v, &v)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n    /* 5.2 if D is odd then */\n    if (mp_isodd (&D) == 1) {\n      /* D = (D-x)/2 */\n      if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) {\n        goto LBL_ERR;\n      }\n    }\n    /* D = D/2 */\n    if ((res = mp_div_2 (&D, &D)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n\n  /* 6.  if u >= v then */\n  if (mp_cmp (&u, &v) != MP_LT) {\n    /* u = u - v, B = B - D */\n    if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n\n    if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  } else {\n    /* v - v - u, D = D - B */\n    if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n\n    if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n\n  /* if not zero goto step 4 */\n  if (mp_iszero (&u) == 0) {\n    goto top;\n  }\n\n  /* now a = C, b = D, gcd == g*v */\n\n  /* if v != 1 then there is no inverse */\n  if (mp_cmp_d (&v, 1) != MP_EQ) {\n    res = MP_VAL;\n    goto LBL_ERR;\n  }\n\n  /* b is now the inverse */\n  neg = a->sign;\n  while (D.sign == MP_NEG) {\n    if ((res = mp_add (&D, b, &D)) != MP_OKAY) {\n      goto LBL_ERR;\n    }\n  }\n  mp_exch (&D, c);\n  c->sign = neg;\n  res = MP_OKAY;\n\nLBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_TO_SIGNED_BIN_C\n\n/* store in signed [big endian] format */\nint mp_to_signed_bin (mp_int * a, unsigned char *b)\n{\n  int     res;\n\n  if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) {\n    return res;\n  }\n  b[0] = (unsigned char) ((a->sign == MP_ZPOS) ? 0 : 1);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_MOD_C\n\n/* c = a mod b, 0 <= c < b */\nint\nmp_mod (mp_int * a, mp_int * b, mp_int * c)\n{\n  mp_int  t;\n  int     res;\n\n  if ((res = mp_init (&t)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) {\n    mp_clear (&t);\n    return res;\n  }\n\n  if (t.sign != b->sign) {\n    res = mp_add (b, &t, c);\n  } else {\n    res = MP_OKAY;\n    mp_exch (&t, c);\n  }\n\n  mp_clear (&t);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_DR_IS_MODULUS_C\n\n/* determines if a number is a valid DR modulus */\nint mp_dr_is_modulus(mp_int *a)\n{\n   int ix;\n\n   /* must be at least two digits */\n   if (a->used < 2) {\n      return 0;\n   }\n\n   /* must be of the form b**k - a [a <= b] so all\n    * but the first digit must be equal to -1 (mod b).\n    */\n   for (ix = 1; ix < a->used; ix++) {\n       if (a->dp[ix] != MP_MASK) {\n          return 0;\n       }\n   }\n   return 1;\n}\n\n#endif\n\n#ifdef BN_MP_IS_SQUARE_C\n\n/* Check if remainders are possible squares - fast exclude non-squares */\nstatic const char rem_128[128] = {\n 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,\n 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1\n};\n\nstatic const char rem_105[105] = {\n 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,\n 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1,\n 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,\n 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,\n 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1,\n 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1\n};\n\n/* Store non-zero to ret if arg is square, and zero if not */\nint mp_is_square(mp_int *arg,int *ret) \n{\n  int           res;\n  mp_digit      c;\n  mp_int        t;\n  unsigned long r;\n\n  /* Default to Non-square :) */\n  *ret = MP_NO; \n\n  if (arg->sign == MP_NEG) {\n    return MP_VAL;\n  }\n\n  /* digits used?  (TSD) */\n  if (arg->used == 0) {\n     return MP_OKAY;\n  }\n\n  /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */\n  if (rem_128[127 & DIGIT(arg,0)] == 1) {\n     return MP_OKAY;\n  }\n\n  /* Next check mod 105 (3*5*7) */\n  if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) {\n     return res;\n  }\n  if (rem_105[c] == 1) {\n     return MP_OKAY;\n  }\n\n\n  if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) {\n     return res;\n  }\n  if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) {\n     goto ERR;\n  }\n  r = mp_get_int(&t);\n  /* Check for other prime modules, note it's not an ERROR but we must\n   * free \"t\" so the easiest way is to goto ERR.  We know that res\n   * is already equal to MP_OKAY from the mp_mod call \n   */ \n  if ( (1L<<(r%11)) & 0x5C4L )             goto ERR;\n  if ( (1L<<(r%13)) & 0x9E4L )             goto ERR;\n  if ( (1L<<(r%17)) & 0x5CE8L )            goto ERR;\n  if ( (1L<<(r%19)) & 0x4F50CL )           goto ERR;\n  if ( (1L<<(r%23)) & 0x7ACCA0L )          goto ERR;\n  if ( (1L<<(r%29)) & 0xC2EDD0CL )         goto ERR;\n  if ( (1L<<(r%31)) & 0x6DE2B848L )        goto ERR;\n\n  /* Final check - is sqr(sqrt(arg)) == arg ? */\n  if ((res = mp_sqrt(arg,&t)) != MP_OKAY) {\n     goto ERR;\n  }\n  if ((res = mp_sqr(&t,&t)) != MP_OKAY) {\n     goto ERR;\n  }\n\n  *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO;\nERR:mp_clear(&t);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_SUBMOD_C\n\n/* d = a - b (mod c) */\nint\nmp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)\n{\n  int     res;\n  mp_int  t;\n\n\n  if ((res = mp_init (&t)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_sub (a, b, &t)) != MP_OKAY) {\n    mp_clear (&t);\n    return res;\n  }\n  res = mp_mod (&t, c, d);\n  mp_clear (&t);\n  return res;\n}\n#endif\n\n#ifdef BN_MP_RAND_C\n\n/* makes a pseudo-random int of a given size */\nint\nmp_rand (mp_int * a, int digits)\n{\n  int     res;\n  mp_digit d;\n\n  mp_zero (a);\n  if (digits <= 0) {\n    return MP_OKAY;\n  }\n\n  /* first place a random non-zero digit */\n  do {\n    d = ((mp_digit) abs (rand ())) & MP_MASK;\n  } while (d == 0);\n\n  if ((res = mp_add_d (a, d, a)) != MP_OKAY) {\n    return res;\n  }\n\n  while (--digits > 0) {\n    if ((res = mp_lshd (a, 1)) != MP_OKAY) {\n      return res;\n    }\n\n    if ((res = mp_add_d (a, ((mp_digit) abs (rand ())), a)) != MP_OKAY) {\n      return res;\n    }\n  }\n\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_READ_RADIX_C\n\n/* read a string [ASCII] in a given radix */\nint mp_read_radix (mp_int * a, const char *str, int radix)\n{\n  int     y, res, neg;\n  char    ch;\n\n  /* zero the digit bignum */\n  mp_zero(a);\n\n  /* make sure the radix is ok */\n  if (radix < 2 || radix > 64) {\n    return MP_VAL;\n  }\n\n  /* if the leading digit is a \n   * minus set the sign to negative. \n   */\n  if (*str == '-') {\n    ++str;\n    neg = MP_NEG;\n  } else {\n    neg = MP_ZPOS;\n  }\n\n  /* set the integer to the default of zero */\n  mp_zero (a);\n  \n  /* process each digit of the string */\n  while (*str) {\n    /* if the radix < 36 the conversion is case insensitive\n     * this allows numbers like 1AB and 1ab to represent the same  value\n     * [e.g. in hex]\n     */\n    ch = (char) ((radix < 36) ? toupper (*str) : *str);\n    for (y = 0; y < 64; y++) {\n      if (ch == mp_s_rmap[y]) {\n         break;\n      }\n    }\n\n    /* if the char was found in the map \n     * and is less than the given radix add it\n     * to the number, otherwise exit the loop. \n     */\n    if (y < radix) {\n      if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) {\n         return res;\n      }\n      if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) {\n         return res;\n      }\n    } else {\n      break;\n    }\n    ++str;\n  }\n  \n  /* set the sign only if a != 0 */\n  if (mp_iszero(a) != 1) {\n     a->sign = neg;\n  }\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_CLEAR_MULTI_C\n\n#include <stdarg.h>\n\nvoid mp_clear_multi(mp_int *mp, ...) \n{\n    mp_int* next_mp = mp;\n    va_list args;\n    va_start(args, mp);\n    while (next_mp != NULL) {\n        mp_clear(next_mp);\n        next_mp = va_arg(args, mp_int*);\n    }\n    va_end(args);\n}\n#endif\n\n#ifdef BN_MP_ADDMOD_C\n\n/* d = a + b (mod c) */\nint\nmp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)\n{\n  int     res;\n  mp_int  t;\n\n  if ((res = mp_init (&t)) != MP_OKAY) {\n    return res;\n  }\n\n  if ((res = mp_add (a, b, &t)) != MP_OKAY) {\n    mp_clear (&t);\n    return res;\n  }\n  res = mp_mod (&t, c, d);\n  mp_clear (&t);\n  return res;\n}\n#endif\n\n#ifdef BN_S_MP_MUL_HIGH_DIGS_C\n\n/* multiplies |a| * |b| and does not compute the lower digs digits\n * [meant to get the higher part of the product]\n */\nint\ns_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)\n{\n  mp_int  t;\n  int     res, pa, pb, ix, iy;\n  mp_digit u;\n  mp_word r;\n  mp_digit tmpx, *tmpt, *tmpy;\n\n  /* can we use the fast multiplier? */\n#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C\n  if (((a->used + b->used + 1) < MP_WARRAY)\n      && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {\n    return fast_s_mp_mul_high_digs (a, b, c, digs);\n  }\n#endif\n\n  if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) {\n    return res;\n  }\n  t.used = a->used + b->used + 1;\n\n  pa = a->used;\n  pb = b->used;\n  for (ix = 0; ix < pa; ix++) {\n    /* clear the carry */\n    u = 0;\n\n    /* left hand side of A[ix] * B[iy] */\n    tmpx = a->dp[ix];\n\n    /* alias to the address of where the digits will be stored */\n    tmpt = &(t.dp[digs]);\n\n    /* alias for where to read the right hand side from */\n    tmpy = b->dp + (digs - ix);\n\n    for (iy = digs - ix; iy < pb; iy++) {\n      /* calculate the double precision result */\n      r       = ((mp_word)*tmpt) +\n                ((mp_word)tmpx) * ((mp_word)*tmpy++) +\n                ((mp_word) u);\n\n      /* get the lower part */\n      *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));\n\n      /* carry the carry */\n      u       = (mp_digit) (r >> ((mp_word) DIGIT_BIT));\n    }\n    *tmpt = u;\n  }\n  mp_clamp (&t);\n  mp_exch (&t, c);\n  mp_clear (&t);\n  return MP_OKAY;\n}\n#endif\n\n#ifdef BN_MP_UNSIGNED_BIN_SIZE_C\n\n/* get the size for an unsigned equivalent */\nint mp_unsigned_bin_size (mp_int * a)\n{\n  int     size = mp_count_bits (a);\n  return (size / 8 + ((size & 7) != 0 ? 1 : 0));\n}\n#endif"
  },
  {
    "path": "ios/JKBigInteger/LibTomMath/tommath.h",
    "content": "/* LibTomMath, multiple-precision integer library -- Tom St Denis\n *\n * LibTomMath is a library that provides multiple-precision\n * integer arithmetic as well as number theoretic functionality.\n *\n * The library was designed directly after the MPI library by\n * Michael Fromberger but has been written from scratch with\n * additional optimizations in place.\n *\n * The library is free for all purposes without any express\n * guarantee it works.\n *\n * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com\n */\n#ifndef BN_H_\n#define BN_H_\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <limits.h>\n\n#include \"tommath_class.h\"\n\n#ifndef MIN\n   #define MIN(x,y) ((x)<(y)?(x):(y))\n#endif\n\n#ifndef MAX\n   #define MAX(x,y) ((x)>(y)?(x):(y))\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n\n/* C++ compilers don't like assigning void * to mp_digit * */\n#define  OPT_CAST(x)  (x *)\n\n#else\n\n/* C on the other hand doesn't care */\n#define  OPT_CAST(x)\n\n#endif\n\n\n/* detect 64-bit mode if possible */\n#if defined(__x86_64__) \n   #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))\n      #define MP_64BIT\n   #endif\n#endif\n\n/* some default configurations.\n *\n * A \"mp_digit\" must be able to hold DIGIT_BIT + 1 bits\n * A \"mp_word\" must be able to hold 2*DIGIT_BIT + 1 bits\n *\n * At the very least a mp_digit must be able to hold 7 bits\n * [any size beyond that is ok provided it doesn't overflow the data type]\n */\n#ifdef MP_8BIT\n   typedef unsigned char      mp_digit;\n   typedef unsigned short     mp_word;\n#elif defined(MP_16BIT)\n   typedef unsigned short     mp_digit;\n   typedef unsigned long      mp_word;\n#elif defined(MP_64BIT)\n   /* for GCC only on supported platforms */\n#ifndef CRYPT\n   typedef unsigned long long ulong64;\n   typedef signed long long   long64;\n#endif\n\n   typedef unsigned long      mp_digit;\n   typedef unsigned long      mp_word __attribute__ ((mode(TI)));\n\n   #define DIGIT_BIT          60\n#else\n   /* this is the default case, 28-bit digits */\n   \n   /* this is to make porting into LibTomCrypt easier :-) */\n#ifndef CRYPT\n   #if defined(_MSC_VER) || defined(__BORLANDC__) \n      typedef unsigned __int64   ulong64;\n      typedef signed __int64     long64;\n   #else\n      typedef unsigned long long ulong64;\n      typedef signed long long   long64;\n   #endif\n#endif\n\n   typedef unsigned long      mp_digit;\n   typedef ulong64            mp_word;\n\n#ifdef MP_31BIT   \n   /* this is an extension that uses 31-bit digits */\n   #define DIGIT_BIT          31\n#else\n   /* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */\n   #define DIGIT_BIT          28\n   #define MP_28BIT\n#endif   \n#endif\n\n/* define heap macros */\n#ifndef CRYPT\n   /* default to libc stuff */\n   #ifndef XMALLOC \n       #define XMALLOC  malloc\n       #define XFREE    free\n       #define XREALLOC realloc\n       #define XCALLOC  calloc\n   #else\n      /* prototypes for our heap functions */\n      extern void *XMALLOC(size_t n);\n      extern void *XREALLOC(void *p, size_t n);\n      extern void *XCALLOC(size_t n, size_t s);\n      extern void XFREE(void *p);\n   #endif\n#endif\n\n\n/* otherwise the bits per digit is calculated automatically from the size of a mp_digit */\n#ifndef DIGIT_BIT\n   #define DIGIT_BIT     ((int)((CHAR_BIT * sizeof(mp_digit) - 1)))  /* bits per digit */\n#endif\n\n#define MP_DIGIT_BIT     DIGIT_BIT\n#define MP_MASK          ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))\n#define MP_DIGIT_MAX     MP_MASK\n\n/* equalities */\n#define MP_LT        -1   /* less than */\n#define MP_EQ         0   /* equal to */\n#define MP_GT         1   /* greater than */\n\n#define MP_ZPOS       0   /* positive integer */\n#define MP_NEG        1   /* negative */\n\n#define MP_OKAY       0   /* ok result */\n#define MP_MEM        -2  /* out of mem */\n#define MP_VAL        -3  /* invalid input */\n#define MP_RANGE      MP_VAL\n\n#define MP_YES        1   /* yes response */\n#define MP_NO         0   /* no response */\n\n/* Primality generation flags */\n#define LTM_PRIME_BBS      0x0001 /* BBS style prime */\n#define LTM_PRIME_SAFE     0x0002 /* Safe prime (p-1)/2 == prime */\n#define LTM_PRIME_2MSB_ON  0x0008 /* force 2nd MSB to 1 */\n\ntypedef int           mp_err;\n\n/* you'll have to tune these... */\nextern int KARATSUBA_MUL_CUTOFF,\n           KARATSUBA_SQR_CUTOFF,\n           TOOM_MUL_CUTOFF,\n           TOOM_SQR_CUTOFF;\n\n/* define this to use lower memory usage routines (exptmods mostly) */\n/* #define MP_LOW_MEM */\n\n/* default precision */\n#ifndef MP_PREC\n   #ifndef MP_LOW_MEM\n      #define MP_PREC                 32     /* default digits of precision */\n   #else\n      #define MP_PREC                 8      /* default digits of precision */\n   #endif   \n#endif\n\n/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */\n#define MP_WARRAY               (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))\n\n/* the infamous mp_int structure */\ntypedef struct  {\n    int used, alloc, sign;\n    mp_digit *dp;\n} mp_int;\n\n/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */\ntypedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);\n\n\n#define USED(m)    ((m)->used)\n#define DIGIT(m,k) ((m)->dp[(k)])\n#define SIGN(m)    ((m)->sign)\n\n/* error code to char* string */\nchar *mp_error_to_string(int code);\n\n/* ---> init and deinit bignum functions <--- */\n/* init a bignum */\nint mp_init(mp_int *a);\n\n/* free a bignum */\nvoid mp_clear(mp_int *a);\n\n/* init a null terminated series of arguments */\nint mp_init_multi(mp_int *mp, ...);\n\n/* clear a null terminated series of arguments */\nvoid mp_clear_multi(mp_int *mp, ...);\n\n/* exchange two ints */\nvoid mp_exch(mp_int *a, mp_int *b);\n\n/* shrink ram required for a bignum */\nint mp_shrink(mp_int *a);\n\n/* grow an int to a given size */\nint mp_grow(mp_int *a, int size);\n\n/* init to a given number of digits */\nint mp_init_size(mp_int *a, int size);\n\n/* ---> Basic Manipulations <--- */\n#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)\n#define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)\n#define mp_isodd(a)  (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)\n\n/* set to zero */\nvoid mp_zero(mp_int *a);\n\n/* set to a digit */\nvoid mp_set(mp_int *a, mp_digit b);\n\n/* set a 32-bit const */\nint mp_set_int(mp_int *a, unsigned long b);\n\n/* get a 32-bit value */\nunsigned long mp_get_int(mp_int * a);\n\n/* initialize and set a digit */\nint mp_init_set (mp_int * a, mp_digit b);\n\n/* initialize and set 32-bit value */\nint mp_init_set_int (mp_int * a, unsigned long b);\n\n/* copy, b = a */\nint mp_copy(mp_int *a, mp_int *b);\n\n/* inits and copies, a = b */\nint mp_init_copy(mp_int *a, mp_int *b);\n\n/* trim unused digits */\nvoid mp_clamp(mp_int *a);\n\n/* ---> digit manipulation <--- */\n\n/* right shift by \"b\" digits */\nvoid mp_rshd(mp_int *a, int b);\n\n/* left shift by \"b\" digits */\nint mp_lshd(mp_int *a, int b);\n\n/* c = a / 2**b */\nint mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d);\n\n/* b = a/2 */\nint mp_div_2(mp_int *a, mp_int *b);\n\n/* c = a * 2**b */\nint mp_mul_2d(mp_int *a, int b, mp_int *c);\n\n/* b = a*2 */\nint mp_mul_2(mp_int *a, mp_int *b);\n\n/* c = a mod 2**d */\nint mp_mod_2d(mp_int *a, int b, mp_int *c);\n\n/* computes a = 2**b */\nint mp_2expt(mp_int *a, int b);\n\n/* Counts the number of lsbs which are zero before the first zero bit */\nint mp_cnt_lsb(mp_int *a);\n\n/* I Love Earth! */\n\n/* makes a pseudo-random int of a given size */\nint mp_rand(mp_int *a, int digits);\n\n/* ---> binary operations <--- */\n/* c = a XOR b  */\nint mp_xor(mp_int *a, mp_int *b, mp_int *c);\n\n/* c = a OR b */\nint mp_or(mp_int *a, mp_int *b, mp_int *c);\n\n/* c = a AND b */\nint mp_and(mp_int *a, mp_int *b, mp_int *c);\n\n/* ---> Basic arithmetic <--- */\n\n/* b = -a */\nint mp_neg(mp_int *a, mp_int *b);\n\n/* b = |a| */\nint mp_abs(mp_int *a, mp_int *b);\n\n/* compare a to b */\nint mp_cmp(mp_int *a, mp_int *b);\n\n/* compare |a| to |b| */\nint mp_cmp_mag(mp_int *a, mp_int *b);\n\n/* c = a + b */\nint mp_add(mp_int *a, mp_int *b, mp_int *c);\n\n/* c = a - b */\nint mp_sub(mp_int *a, mp_int *b, mp_int *c);\n\n/* c = a * b */\nint mp_mul(mp_int *a, mp_int *b, mp_int *c);\n\n/* b = a*a  */\nint mp_sqr(mp_int *a, mp_int *b);\n\n/* a/b => cb + d == a */\nint mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d);\n\n/* c = a mod b, 0 <= c < b  */\nint mp_mod(mp_int *a, mp_int *b, mp_int *c);\n\n/* ---> single digit functions <--- */\n\n/* compare against a single digit */\nint mp_cmp_d(mp_int *a, mp_digit b);\n\n/* c = a + b */\nint mp_add_d(mp_int *a, mp_digit b, mp_int *c);\n\n/* c = a - b */\nint mp_sub_d(mp_int *a, mp_digit b, mp_int *c);\n\n/* c = a * b */\nint mp_mul_d(mp_int *a, mp_digit b, mp_int *c);\n\n/* a/b => cb + d == a */\nint mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d);\n\n/* a/3 => 3c + d == a */\nint mp_div_3(mp_int *a, mp_int *c, mp_digit *d);\n\n/* c = a**b */\nint mp_expt_d(mp_int *a, mp_digit b, mp_int *c);\n\n/* c = a mod b, 0 <= c < b  */\nint mp_mod_d(mp_int *a, mp_digit b, mp_digit *c);\n\n/* ---> number theory <--- */\n\n/* d = a + b (mod c) */\nint mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);\n\n/* d = a - b (mod c) */\nint mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);\n\n/* d = a * b (mod c) */\nint mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);\n\n/* c = a * a (mod b) */\nint mp_sqrmod(mp_int *a, mp_int *b, mp_int *c);\n\n/* c = 1/a (mod b) */\nint mp_invmod(mp_int *a, mp_int *b, mp_int *c);\n\n/* c = (a, b) */\nint mp_gcd(mp_int *a, mp_int *b, mp_int *c);\n\n/* produces value such that U1*a + U2*b = U3 */\nint mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3);\n\n/* c = [a, b] or (a*b)/(a, b) */\nint mp_lcm(mp_int *a, mp_int *b, mp_int *c);\n\n/* finds one of the b'th root of a, such that |c|**b <= |a|\n *\n * returns error if a < 0 and b is even\n */\nint mp_n_root(mp_int *a, mp_digit b, mp_int *c);\n\n/* special sqrt algo */\nint mp_sqrt(mp_int *arg, mp_int *ret);\n\n/* is number a square? */\nint mp_is_square(mp_int *arg, int *ret);\n\n/* computes the jacobi c = (a | n) (or Legendre if b is prime)  */\nint mp_jacobi(mp_int *a, mp_int *n, int *c);\n\n/* used to setup the Barrett reduction for a given modulus b */\nint mp_reduce_setup(mp_int *a, mp_int *b);\n\n/* Barrett Reduction, computes a (mod b) with a precomputed value c\n *\n * Assumes that 0 < a <= b*b, note if 0 > a > -(b*b) then you can merely\n * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code].\n */\nint mp_reduce(mp_int *a, mp_int *b, mp_int *c);\n\n/* setups the montgomery reduction */\nint mp_montgomery_setup(mp_int *a, mp_digit *mp);\n\n/* computes a = B**n mod b without division or multiplication useful for\n * normalizing numbers in a Montgomery system.\n */\nint mp_montgomery_calc_normalization(mp_int *a, mp_int *b);\n\n/* computes x/R == x (mod N) via Montgomery Reduction */\nint mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp);\n\n/* returns 1 if a is a valid DR modulus */\nint mp_dr_is_modulus(mp_int *a);\n\n/* sets the value of \"d\" required for mp_dr_reduce */\nvoid mp_dr_setup(mp_int *a, mp_digit *d);\n\n/* reduces a modulo b using the Diminished Radix method */\nint mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp);\n\n/* returns true if a can be reduced with mp_reduce_2k */\nint mp_reduce_is_2k(mp_int *a);\n\n/* determines k value for 2k reduction */\nint mp_reduce_2k_setup(mp_int *a, mp_digit *d);\n\n/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */\nint mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d);\n\n/* returns true if a can be reduced with mp_reduce_2k_l */\nint mp_reduce_is_2k_l(mp_int *a);\n\n/* determines k value for 2k reduction */\nint mp_reduce_2k_setup_l(mp_int *a, mp_int *d);\n\n/* reduces a modulo b where b is of the form 2**p - k [0 <= a] */\nint mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d);\n\n/* d = a**b (mod c) */\nint mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);\n\n/* ---> Primes <--- */\n\n/* number of primes */\n#ifdef MP_8BIT\n   #define PRIME_SIZE      31\n#else\n   #define PRIME_SIZE      256\n#endif\n\n/* table of first PRIME_SIZE primes */\nextern const mp_digit ltm_prime_tab[];\n\n/* result=1 if a is divisible by one of the first PRIME_SIZE primes */\nint mp_prime_is_divisible(mp_int *a, int *result);\n\n/* performs one Fermat test of \"a\" using base \"b\".\n * Sets result to 0 if composite or 1 if probable prime\n */\nint mp_prime_fermat(mp_int *a, mp_int *b, int *result);\n\n/* performs one Miller-Rabin test of \"a\" using base \"b\".\n * Sets result to 0 if composite or 1 if probable prime\n */\nint mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result);\n\n/* This gives [for a given bit size] the number of trials required\n * such that Miller-Rabin gives a prob of failure lower than 2^-96 \n */\nint mp_prime_rabin_miller_trials(int size);\n\n/* performs t rounds of Miller-Rabin on \"a\" using the first\n * t prime bases.  Also performs an initial sieve of trial\n * division.  Determines if \"a\" is prime with probability\n * of error no more than (1/4)**t.\n *\n * Sets result to 1 if probably prime, 0 otherwise\n */\nint mp_prime_is_prime(mp_int *a, int t, int *result);\n\n/* finds the next prime after the number \"a\" using \"t\" trials\n * of Miller-Rabin.\n *\n * bbs_style = 1 means the prime must be congruent to 3 mod 4\n */\nint mp_prime_next_prime(mp_int *a, int t, int bbs_style);\n\n/* makes a truly random prime of a given size (bytes),\n * call with bbs = 1 if you want it to be congruent to 3 mod 4 \n *\n * You have to supply a callback which fills in a buffer with random bytes.  \"dat\" is a parameter you can\n * have passed to the callback (e.g. a state or something).  This function doesn't use \"dat\" itself\n * so it can be NULL\n *\n * The prime generated will be larger than 2^(8*size).\n */\n#define mp_prime_random(a, t, size, bbs, cb, dat) mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)\n\n/* makes a truly random prime of a given size (bits),\n *\n * Flags are as follows:\n * \n *   LTM_PRIME_BBS      - make prime congruent to 3 mod 4\n *   LTM_PRIME_SAFE     - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS)\n *   LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero\n *   LTM_PRIME_2MSB_ON  - make the 2nd highest bit one\n *\n * You have to supply a callback which fills in a buffer with random bytes.  \"dat\" is a parameter you can\n * have passed to the callback (e.g. a state or something).  This function doesn't use \"dat\" itself\n * so it can be NULL\n *\n */\nint mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat);\n\n/* ---> radix conversion <--- */\nint mp_count_bits(mp_int *a);\n\nint mp_unsigned_bin_size(mp_int *a);\nint mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c);\nint mp_to_unsigned_bin(mp_int *a, unsigned char *b);\nint mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen);\n\nint mp_signed_bin_size(mp_int *a);\nint mp_read_signed_bin(mp_int *a, const unsigned char *b, int c);\nint mp_to_signed_bin(mp_int *a,  unsigned char *b);\nint mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen);\n\nint mp_read_radix(mp_int *a, const char *str, int radix);\nint mp_toradix(mp_int *a, char *str, int radix);\nint mp_toradix_n(mp_int * a, char *str, int radix, int maxlen);\nint mp_radix_size(mp_int *a, int radix, int *size);\n\nint mp_fread(mp_int *a, int radix, FILE *stream);\nint mp_fwrite(mp_int *a, int radix, FILE *stream);\n\n#define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len))\n#define mp_raw_size(mp)           mp_signed_bin_size(mp)\n#define mp_toraw(mp, str)         mp_to_signed_bin((mp), (str))\n#define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len))\n#define mp_mag_size(mp)           mp_unsigned_bin_size(mp)\n#define mp_tomag(mp, str)         mp_to_unsigned_bin((mp), (str))\n\n#define mp_tobinary(M, S)  mp_toradix((M), (S), 2)\n#define mp_tooctal(M, S)   mp_toradix((M), (S), 8)\n#define mp_todecimal(M, S) mp_toradix((M), (S), 10)\n#define mp_tohex(M, S)     mp_toradix((M), (S), 16)\n\n/* lowlevel functions, do not call! */\nint s_mp_add(mp_int *a, mp_int *b, mp_int *c);\nint s_mp_sub(mp_int *a, mp_int *b, mp_int *c);\n#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)\nint fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs);\nint s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs);\nint fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs);\nint s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs);\nint fast_s_mp_sqr(mp_int *a, mp_int *b);\nint s_mp_sqr(mp_int *a, mp_int *b);\nint mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c);\nint mp_toom_mul(mp_int *a, mp_int *b, mp_int *c);\nint mp_karatsuba_sqr(mp_int *a, mp_int *b);\nint mp_toom_sqr(mp_int *a, mp_int *b);\nint fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c);\nint mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c);\nint fast_mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp);\nint mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int mode);\nint s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int mode);\nvoid bn_reverse(unsigned char *s, int len);\n\nextern const char *mp_s_rmap;\n\n#ifdef __cplusplus\n   }\n#endif\n\n#endif\n\n\n/* $Source$ */\n/* $Revision: 0.39 $ */\n/* $Date: 2006-04-06 19:49:59 +0000 $ */\n"
  },
  {
    "path": "ios/JKBigInteger/LibTomMath/tommath_class.h",
    "content": "#if !(defined(LTM1) && defined(LTM2) && defined(LTM3))\n#if defined(LTM2)\n#define LTM3\n#endif\n#if defined(LTM1)\n#define LTM2\n#endif\n#define LTM1\n\n#if defined(LTM_ALL)\n#define BN_ERROR_C\n#define BN_FAST_MP_INVMOD_C\n#define BN_FAST_MP_MONTGOMERY_REDUCE_C\n#define BN_FAST_S_MP_MUL_DIGS_C\n#define BN_FAST_S_MP_MUL_HIGH_DIGS_C\n#define BN_FAST_S_MP_SQR_C\n#define BN_MP_2EXPT_C\n#define BN_MP_ABS_C\n#define BN_MP_ADD_C\n#define BN_MP_ADD_D_C\n#define BN_MP_ADDMOD_C\n#define BN_MP_AND_C\n#define BN_MP_CLAMP_C\n#define BN_MP_CLEAR_C\n#define BN_MP_CLEAR_MULTI_C\n#define BN_MP_CMP_C\n#define BN_MP_CMP_D_C\n#define BN_MP_CMP_MAG_C\n#define BN_MP_CNT_LSB_C\n#define BN_MP_COPY_C\n#define BN_MP_COUNT_BITS_C\n#define BN_MP_DIV_C\n#define BN_MP_DIV_2_C\n#define BN_MP_DIV_2D_C\n#define BN_MP_DIV_3_C\n#define BN_MP_DIV_D_C\n#define BN_MP_DR_IS_MODULUS_C\n#define BN_MP_DR_REDUCE_C\n#define BN_MP_DR_SETUP_C\n#define BN_MP_EXCH_C\n#define BN_MP_EXPT_D_C\n#define BN_MP_EXPTMOD_C\n#define BN_MP_EXPTMOD_FAST_C\n#define BN_MP_EXTEUCLID_C\n#define BN_MP_FREAD_C\n#define BN_MP_FWRITE_C\n#define BN_MP_GCD_C\n#define BN_MP_GET_INT_C\n#define BN_MP_GROW_C\n#define BN_MP_INIT_C\n#define BN_MP_INIT_COPY_C\n#define BN_MP_INIT_MULTI_C\n#define BN_MP_INIT_SET_C\n#define BN_MP_INIT_SET_INT_C\n#define BN_MP_INIT_SIZE_C\n#define BN_MP_INVMOD_C\n#define BN_MP_INVMOD_SLOW_C\n#define BN_MP_IS_SQUARE_C\n#define BN_MP_JACOBI_C\n#define BN_MP_KARATSUBA_MUL_C\n#define BN_MP_KARATSUBA_SQR_C\n#define BN_MP_LCM_C\n#define BN_MP_LSHD_C\n#define BN_MP_MOD_C\n#define BN_MP_MOD_2D_C\n#define BN_MP_MOD_D_C\n#define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C\n#define BN_MP_MONTGOMERY_REDUCE_C\n#define BN_MP_MONTGOMERY_SETUP_C\n#define BN_MP_MUL_C\n#define BN_MP_MUL_2_C\n#define BN_MP_MUL_2D_C\n#define BN_MP_MUL_D_C\n#define BN_MP_MULMOD_C\n#define BN_MP_N_ROOT_C\n#define BN_MP_NEG_C\n#define BN_MP_OR_C\n#define BN_MP_PRIME_FERMAT_C\n#define BN_MP_PRIME_IS_DIVISIBLE_C\n#define BN_MP_PRIME_IS_PRIME_C\n#define BN_MP_PRIME_MILLER_RABIN_C\n#define BN_MP_PRIME_NEXT_PRIME_C\n#define BN_MP_PRIME_RABIN_MILLER_TRIALS_C\n#define BN_MP_PRIME_RANDOM_EX_C\n#define BN_MP_RADIX_SIZE_C\n#define BN_MP_RADIX_SMAP_C\n#define BN_MP_RAND_C\n#define BN_MP_READ_RADIX_C\n#define BN_MP_READ_SIGNED_BIN_C\n#define BN_MP_READ_UNSIGNED_BIN_C\n#define BN_MP_REDUCE_C\n#define BN_MP_REDUCE_2K_C\n#define BN_MP_REDUCE_2K_L_C\n#define BN_MP_REDUCE_2K_SETUP_C\n#define BN_MP_REDUCE_2K_SETUP_L_C\n#define BN_MP_REDUCE_IS_2K_C\n#define BN_MP_REDUCE_IS_2K_L_C\n#define BN_MP_REDUCE_SETUP_C\n#define BN_MP_RSHD_C\n#define BN_MP_SET_C\n#define BN_MP_SET_INT_C\n#define BN_MP_SHRINK_C\n#define BN_MP_SIGNED_BIN_SIZE_C\n#define BN_MP_SQR_C\n#define BN_MP_SQRMOD_C\n#define BN_MP_SQRT_C\n#define BN_MP_SUB_C\n#define BN_MP_SUB_D_C\n#define BN_MP_SUBMOD_C\n#define BN_MP_TO_SIGNED_BIN_C\n#define BN_MP_TO_SIGNED_BIN_N_C\n#define BN_MP_TO_UNSIGNED_BIN_C\n#define BN_MP_TO_UNSIGNED_BIN_N_C\n#define BN_MP_TOOM_MUL_C\n#define BN_MP_TOOM_SQR_C\n#define BN_MP_TORADIX_C\n#define BN_MP_TORADIX_N_C\n#define BN_MP_UNSIGNED_BIN_SIZE_C\n#define BN_MP_XOR_C\n#define BN_MP_ZERO_C\n#define BN_PRIME_TAB_C\n#define BN_REVERSE_C\n#define BN_S_MP_ADD_C\n#define BN_S_MP_EXPTMOD_C\n#define BN_S_MP_MUL_DIGS_C\n#define BN_S_MP_MUL_HIGH_DIGS_C\n#define BN_S_MP_SQR_C\n#define BN_S_MP_SUB_C\n#define BNCORE_C\n#endif\n\n#if defined(BN_ERROR_C)\n   #define BN_MP_ERROR_TO_STRING_C\n#endif\n\n#if defined(BN_FAST_MP_INVMOD_C)\n   #define BN_MP_ISEVEN_C\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_COPY_C\n   #define BN_MP_MOD_C\n   #define BN_MP_SET_C\n   #define BN_MP_DIV_2_C\n   #define BN_MP_ISODD_C\n   #define BN_MP_SUB_C\n   #define BN_MP_CMP_C\n   #define BN_MP_ISZERO_C\n   #define BN_MP_CMP_D_C\n   #define BN_MP_ADD_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_MULTI_C\n#endif\n\n#if defined(BN_FAST_MP_MONTGOMERY_REDUCE_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_FAST_S_MP_MUL_DIGS_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_FAST_S_MP_SQR_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_2EXPT_C)\n   #define BN_MP_ZERO_C\n   #define BN_MP_GROW_C\n#endif\n\n#if defined(BN_MP_ABS_C)\n   #define BN_MP_COPY_C\n#endif\n\n#if defined(BN_MP_ADD_C)\n   #define BN_S_MP_ADD_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_MP_ADD_D_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_SUB_D_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_ADDMOD_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_ADD_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_MOD_C\n#endif\n\n#if defined(BN_MP_AND_C)\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_CLAMP_C)\n#endif\n\n#if defined(BN_MP_CLEAR_C)\n#endif\n\n#if defined(BN_MP_CLEAR_MULTI_C)\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_CMP_C)\n   #define BN_MP_CMP_MAG_C\n#endif\n\n#if defined(BN_MP_CMP_D_C)\n#endif\n\n#if defined(BN_MP_CMP_MAG_C)\n#endif\n\n#if defined(BN_MP_CNT_LSB_C)\n   #define BN_MP_ISZERO_C\n#endif\n\n#if defined(BN_MP_COPY_C)\n   #define BN_MP_GROW_C\n#endif\n\n#if defined(BN_MP_COUNT_BITS_C)\n#endif\n\n#if defined(BN_MP_DIV_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_MP_COPY_C\n   #define BN_MP_ZERO_C\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_SET_C\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_ABS_C\n   #define BN_MP_MUL_2D_C\n   #define BN_MP_CMP_C\n   #define BN_MP_SUB_C\n   #define BN_MP_ADD_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_MULTI_C\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_INIT_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_MUL_D_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_DIV_2_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_DIV_2D_C)\n   #define BN_MP_COPY_C\n   #define BN_MP_ZERO_C\n   #define BN_MP_INIT_C\n   #define BN_MP_MOD_2D_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n#endif\n\n#if defined(BN_MP_DIV_3_C)\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_DIV_D_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_COPY_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_DIV_3_C\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_DR_IS_MODULUS_C)\n#endif\n\n#if defined(BN_MP_DR_REDUCE_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_MP_DR_SETUP_C)\n#endif\n\n#if defined(BN_MP_EXCH_C)\n#endif\n\n#if defined(BN_MP_EXPT_D_C)\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_SET_C\n   #define BN_MP_SQR_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_MUL_C\n#endif\n\n#if defined(BN_MP_EXPTMOD_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_INVMOD_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_ABS_C\n   #define BN_MP_CLEAR_MULTI_C\n   #define BN_MP_REDUCE_IS_2K_L_C\n   #define BN_S_MP_EXPTMOD_C\n   #define BN_MP_DR_IS_MODULUS_C\n   #define BN_MP_REDUCE_IS_2K_C\n   #define BN_MP_ISODD_C\n   #define BN_MP_EXPTMOD_FAST_C\n#endif\n\n#if defined(BN_MP_EXPTMOD_FAST_C)\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_INIT_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_MONTGOMERY_SETUP_C\n   #define BN_FAST_MP_MONTGOMERY_REDUCE_C\n   #define BN_MP_MONTGOMERY_REDUCE_C\n   #define BN_MP_DR_SETUP_C\n   #define BN_MP_DR_REDUCE_C\n   #define BN_MP_REDUCE_2K_SETUP_C\n   #define BN_MP_REDUCE_2K_C\n   #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C\n   #define BN_MP_MULMOD_C\n   #define BN_MP_SET_C\n   #define BN_MP_MOD_C\n   #define BN_MP_COPY_C\n   #define BN_MP_SQR_C\n   #define BN_MP_MUL_C\n   #define BN_MP_EXCH_C\n#endif\n\n#if defined(BN_MP_EXTEUCLID_C)\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_SET_C\n   #define BN_MP_COPY_C\n   #define BN_MP_ISZERO_C\n   #define BN_MP_DIV_C\n   #define BN_MP_MUL_C\n   #define BN_MP_SUB_C\n   #define BN_MP_NEG_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_MULTI_C\n#endif\n\n#if defined(BN_MP_FREAD_C)\n   #define BN_MP_ZERO_C\n   #define BN_MP_S_RMAP_C\n   #define BN_MP_MUL_D_C\n   #define BN_MP_ADD_D_C\n   #define BN_MP_CMP_D_C\n#endif\n\n#if defined(BN_MP_FWRITE_C)\n   #define BN_MP_RADIX_SIZE_C\n   #define BN_MP_TORADIX_C\n#endif\n\n#if defined(BN_MP_GCD_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_ABS_C\n   #define BN_MP_ZERO_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_CNT_LSB_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_MP_EXCH_C\n   #define BN_S_MP_SUB_C\n   #define BN_MP_MUL_2D_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_GET_INT_C)\n#endif\n\n#if defined(BN_MP_GROW_C)\n#endif\n\n#if defined(BN_MP_INIT_C)\n#endif\n\n#if defined(BN_MP_INIT_COPY_C)\n   #define BN_MP_COPY_C\n#endif\n\n#if defined(BN_MP_INIT_MULTI_C)\n   #define BN_MP_ERR_C\n   #define BN_MP_INIT_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_INIT_SET_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_SET_C\n#endif\n\n#if defined(BN_MP_INIT_SET_INT_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_SET_INT_C\n#endif\n\n#if defined(BN_MP_INIT_SIZE_C)\n   #define BN_MP_INIT_C\n#endif\n\n#if defined(BN_MP_INVMOD_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_ISODD_C\n   #define BN_FAST_MP_INVMOD_C\n   #define BN_MP_INVMOD_SLOW_C\n#endif\n\n#if defined(BN_MP_INVMOD_SLOW_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_MOD_C\n   #define BN_MP_COPY_C\n   #define BN_MP_ISEVEN_C\n   #define BN_MP_SET_C\n   #define BN_MP_DIV_2_C\n   #define BN_MP_ISODD_C\n   #define BN_MP_ADD_C\n   #define BN_MP_SUB_C\n   #define BN_MP_CMP_C\n   #define BN_MP_CMP_D_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_MULTI_C\n#endif\n\n#if defined(BN_MP_IS_SQUARE_C)\n   #define BN_MP_MOD_D_C\n   #define BN_MP_INIT_SET_INT_C\n   #define BN_MP_MOD_C\n   #define BN_MP_GET_INT_C\n   #define BN_MP_SQRT_C\n   #define BN_MP_SQR_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_JACOBI_C)\n   #define BN_MP_CMP_D_C\n   #define BN_MP_ISZERO_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_CNT_LSB_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_MOD_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_KARATSUBA_MUL_C)\n   #define BN_MP_MUL_C\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_SUB_C\n   #define BN_MP_ADD_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_KARATSUBA_SQR_C)\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_SQR_C\n   #define BN_MP_SUB_C\n   #define BN_S_MP_ADD_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_ADD_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_LCM_C)\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_GCD_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_MP_DIV_C\n   #define BN_MP_MUL_C\n   #define BN_MP_CLEAR_MULTI_C\n#endif\n\n#if defined(BN_MP_LSHD_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_RSHD_C\n#endif\n\n#if defined(BN_MP_MOD_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_DIV_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_ADD_C\n   #define BN_MP_EXCH_C\n#endif\n\n#if defined(BN_MP_MOD_2D_C)\n   #define BN_MP_ZERO_C\n   #define BN_MP_COPY_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_MOD_D_C)\n   #define BN_MP_DIV_D_C\n#endif\n\n#if defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C)\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_2EXPT_C\n   #define BN_MP_SET_C\n   #define BN_MP_MUL_2_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_MP_MONTGOMERY_REDUCE_C)\n   #define BN_FAST_MP_MONTGOMERY_REDUCE_C\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_MP_MONTGOMERY_SETUP_C)\n#endif\n\n#if defined(BN_MP_MUL_C)\n   #define BN_MP_TOOM_MUL_C\n   #define BN_MP_KARATSUBA_MUL_C\n   #define BN_FAST_S_MP_MUL_DIGS_C\n   #define BN_S_MP_MUL_C\n   #define BN_S_MP_MUL_DIGS_C\n#endif\n\n#if defined(BN_MP_MUL_2_C)\n   #define BN_MP_GROW_C\n#endif\n\n#if defined(BN_MP_MUL_2D_C)\n   #define BN_MP_COPY_C\n   #define BN_MP_GROW_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_MUL_D_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_MULMOD_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_MUL_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_MOD_C\n#endif\n\n#if defined(BN_MP_N_ROOT_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_SET_C\n   #define BN_MP_COPY_C\n   #define BN_MP_EXPT_D_C\n   #define BN_MP_MUL_C\n   #define BN_MP_SUB_C\n   #define BN_MP_MUL_D_C\n   #define BN_MP_DIV_C\n   #define BN_MP_CMP_C\n   #define BN_MP_SUB_D_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_NEG_C)\n   #define BN_MP_COPY_C\n   #define BN_MP_ISZERO_C\n#endif\n\n#if defined(BN_MP_OR_C)\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_PRIME_FERMAT_C)\n   #define BN_MP_CMP_D_C\n   #define BN_MP_INIT_C\n   #define BN_MP_EXPTMOD_C\n   #define BN_MP_CMP_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_PRIME_IS_DIVISIBLE_C)\n   #define BN_MP_MOD_D_C\n#endif\n\n#if defined(BN_MP_PRIME_IS_PRIME_C)\n   #define BN_MP_CMP_D_C\n   #define BN_MP_PRIME_IS_DIVISIBLE_C\n   #define BN_MP_INIT_C\n   #define BN_MP_SET_C\n   #define BN_MP_PRIME_MILLER_RABIN_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_PRIME_MILLER_RABIN_C)\n   #define BN_MP_CMP_D_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_SUB_D_C\n   #define BN_MP_CNT_LSB_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_EXPTMOD_C\n   #define BN_MP_CMP_C\n   #define BN_MP_SQRMOD_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_PRIME_NEXT_PRIME_C)\n   #define BN_MP_CMP_D_C\n   #define BN_MP_SET_C\n   #define BN_MP_SUB_D_C\n   #define BN_MP_ISEVEN_C\n   #define BN_MP_MOD_D_C\n   #define BN_MP_INIT_C\n   #define BN_MP_ADD_D_C\n   #define BN_MP_PRIME_MILLER_RABIN_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C)\n#endif\n\n#if defined(BN_MP_PRIME_RANDOM_EX_C)\n   #define BN_MP_READ_UNSIGNED_BIN_C\n   #define BN_MP_PRIME_IS_PRIME_C\n   #define BN_MP_SUB_D_C\n   #define BN_MP_DIV_2_C\n   #define BN_MP_MUL_2_C\n   #define BN_MP_ADD_D_C\n#endif\n\n#if defined(BN_MP_RADIX_SIZE_C)\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_ISZERO_C\n   #define BN_MP_DIV_D_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_RADIX_SMAP_C)\n   #define BN_MP_S_RMAP_C\n#endif\n\n#if defined(BN_MP_RAND_C)\n   #define BN_MP_ZERO_C\n   #define BN_MP_ADD_D_C\n   #define BN_MP_LSHD_C\n#endif\n\n#if defined(BN_MP_READ_RADIX_C)\n   #define BN_MP_ZERO_C\n   #define BN_MP_S_RMAP_C\n   #define BN_MP_RADIX_SMAP_C\n   #define BN_MP_MUL_D_C\n   #define BN_MP_ADD_D_C\n   #define BN_MP_ISZERO_C\n#endif\n\n#if defined(BN_MP_READ_SIGNED_BIN_C)\n   #define BN_MP_READ_UNSIGNED_BIN_C\n#endif\n\n#if defined(BN_MP_READ_UNSIGNED_BIN_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_ZERO_C\n   #define BN_MP_MUL_2D_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_REDUCE_C)\n   #define BN_MP_REDUCE_SETUP_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_MUL_C\n   #define BN_S_MP_MUL_HIGH_DIGS_C\n   #define BN_FAST_S_MP_MUL_HIGH_DIGS_C\n   #define BN_MP_MOD_2D_C\n   #define BN_S_MP_MUL_DIGS_C\n   #define BN_MP_SUB_C\n   #define BN_MP_CMP_D_C\n   #define BN_MP_SET_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_ADD_C\n   #define BN_MP_CMP_C\n   #define BN_S_MP_SUB_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_REDUCE_2K_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_MUL_D_C\n   #define BN_S_MP_ADD_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_REDUCE_2K_L_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_MUL_C\n   #define BN_S_MP_ADD_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_REDUCE_2K_SETUP_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_2EXPT_C\n   #define BN_MP_CLEAR_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_MP_REDUCE_2K_SETUP_L_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_2EXPT_C\n   #define BN_MP_COUNT_BITS_C\n   #define BN_S_MP_SUB_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_REDUCE_IS_2K_C)\n   #define BN_MP_REDUCE_2K_C\n   #define BN_MP_COUNT_BITS_C\n#endif\n\n#if defined(BN_MP_REDUCE_IS_2K_L_C)\n#endif\n\n#if defined(BN_MP_REDUCE_SETUP_C)\n   #define BN_MP_2EXPT_C\n   #define BN_MP_DIV_C\n#endif\n\n#if defined(BN_MP_RSHD_C)\n   #define BN_MP_ZERO_C\n#endif\n\n#if defined(BN_MP_SET_C)\n   #define BN_MP_ZERO_C\n#endif\n\n#if defined(BN_MP_SET_INT_C)\n   #define BN_MP_ZERO_C\n   #define BN_MP_MUL_2D_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_SHRINK_C)\n#endif\n\n#if defined(BN_MP_SIGNED_BIN_SIZE_C)\n   #define BN_MP_UNSIGNED_BIN_SIZE_C\n#endif\n\n#if defined(BN_MP_SQR_C)\n   #define BN_MP_TOOM_SQR_C\n   #define BN_MP_KARATSUBA_SQR_C\n   #define BN_FAST_S_MP_SQR_C\n   #define BN_S_MP_SQR_C\n#endif\n\n#if defined(BN_MP_SQRMOD_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_SQR_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_MOD_C\n#endif\n\n#if defined(BN_MP_SQRT_C)\n   #define BN_MP_N_ROOT_C\n   #define BN_MP_ISZERO_C\n   #define BN_MP_ZERO_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_DIV_C\n   #define BN_MP_ADD_C\n   #define BN_MP_DIV_2_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_SUB_C)\n   #define BN_S_MP_ADD_C\n   #define BN_MP_CMP_MAG_C\n   #define BN_S_MP_SUB_C\n#endif\n\n#if defined(BN_MP_SUB_D_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_ADD_D_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_MP_SUBMOD_C)\n   #define BN_MP_INIT_C\n   #define BN_MP_SUB_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_MOD_C\n#endif\n\n#if defined(BN_MP_TO_SIGNED_BIN_C)\n   #define BN_MP_TO_UNSIGNED_BIN_C\n#endif\n\n#if defined(BN_MP_TO_SIGNED_BIN_N_C)\n   #define BN_MP_SIGNED_BIN_SIZE_C\n   #define BN_MP_TO_SIGNED_BIN_C\n#endif\n\n#if defined(BN_MP_TO_UNSIGNED_BIN_C)\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_ISZERO_C\n   #define BN_MP_DIV_2D_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_TO_UNSIGNED_BIN_N_C)\n   #define BN_MP_UNSIGNED_BIN_SIZE_C\n   #define BN_MP_TO_UNSIGNED_BIN_C\n#endif\n\n#if defined(BN_MP_TOOM_MUL_C)\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_MOD_2D_C\n   #define BN_MP_COPY_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_MUL_C\n   #define BN_MP_MUL_2_C\n   #define BN_MP_ADD_C\n   #define BN_MP_SUB_C\n   #define BN_MP_DIV_2_C\n   #define BN_MP_MUL_2D_C\n   #define BN_MP_MUL_D_C\n   #define BN_MP_DIV_3_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_CLEAR_MULTI_C\n#endif\n\n#if defined(BN_MP_TOOM_SQR_C)\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_MOD_2D_C\n   #define BN_MP_COPY_C\n   #define BN_MP_RSHD_C\n   #define BN_MP_SQR_C\n   #define BN_MP_MUL_2_C\n   #define BN_MP_ADD_C\n   #define BN_MP_SUB_C\n   #define BN_MP_DIV_2_C\n   #define BN_MP_MUL_2D_C\n   #define BN_MP_MUL_D_C\n   #define BN_MP_DIV_3_C\n   #define BN_MP_LSHD_C\n   #define BN_MP_CLEAR_MULTI_C\n#endif\n\n#if defined(BN_MP_TORADIX_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_DIV_D_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_S_RMAP_C\n#endif\n\n#if defined(BN_MP_TORADIX_N_C)\n   #define BN_MP_ISZERO_C\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_DIV_D_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_S_RMAP_C\n#endif\n\n#if defined(BN_MP_UNSIGNED_BIN_SIZE_C)\n   #define BN_MP_COUNT_BITS_C\n#endif\n\n#if defined(BN_MP_XOR_C)\n   #define BN_MP_INIT_COPY_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_MP_ZERO_C)\n#endif\n\n#if defined(BN_PRIME_TAB_C)\n#endif\n\n#if defined(BN_REVERSE_C)\n#endif\n\n#if defined(BN_S_MP_ADD_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BN_S_MP_EXPTMOD_C)\n   #define BN_MP_COUNT_BITS_C\n   #define BN_MP_INIT_C\n   #define BN_MP_CLEAR_C\n   #define BN_MP_REDUCE_SETUP_C\n   #define BN_MP_REDUCE_C\n   #define BN_MP_REDUCE_2K_SETUP_L_C\n   #define BN_MP_REDUCE_2K_L_C\n   #define BN_MP_MOD_C\n   #define BN_MP_COPY_C\n   #define BN_MP_SQR_C\n   #define BN_MP_MUL_C\n   #define BN_MP_SET_C\n   #define BN_MP_EXCH_C\n#endif\n\n#if defined(BN_S_MP_MUL_DIGS_C)\n   #define BN_FAST_S_MP_MUL_DIGS_C\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_S_MP_MUL_HIGH_DIGS_C)\n   #define BN_FAST_S_MP_MUL_HIGH_DIGS_C\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_S_MP_SQR_C)\n   #define BN_MP_INIT_SIZE_C\n   #define BN_MP_CLAMP_C\n   #define BN_MP_EXCH_C\n   #define BN_MP_CLEAR_C\n#endif\n\n#if defined(BN_S_MP_SUB_C)\n   #define BN_MP_GROW_C\n   #define BN_MP_CLAMP_C\n#endif\n\n#if defined(BNCORE_C)\n#endif\n\n#ifdef LTM3\n#define LTM_LAST\n#endif\n#include \"tommath_superclass.h\"\n#include \"tommath_class.h\"\n#else\n#define LTM_LAST\n#endif\n\n/* $Source$ */\n/* $Revision: 0.36 $ */\n/* $Date: 2005-08-01 16:37:28 +0000 $ */\n"
  },
  {
    "path": "ios/JKBigInteger/LibTomMath/tommath_superclass.h",
    "content": "/* super class file for PK algos */\n\n/* default ... include all MPI */\n#define LTM_ALL\n\n/* RSA only (does not support DH/DSA/ECC) */\n/* #define SC_RSA_1 */\n\n/* For reference.... On an Athlon64 optimizing for speed...\n\n   LTM's mpi.o with all functions [striped] is 142KiB in size.\n\n*/\n\n/* Works for RSA only, mpi.o is 68KiB */\n#ifdef SC_RSA_1\n   #define BN_MP_SHRINK_C\n   #define BN_MP_LCM_C\n   #define BN_MP_PRIME_RANDOM_EX_C\n   #define BN_MP_INVMOD_C\n   #define BN_MP_GCD_C\n   #define BN_MP_MOD_C\n   #define BN_MP_MULMOD_C\n   #define BN_MP_ADDMOD_C\n   #define BN_MP_EXPTMOD_C\n   #define BN_MP_SET_INT_C\n   #define BN_MP_INIT_MULTI_C\n   #define BN_MP_CLEAR_MULTI_C\n   #define BN_MP_UNSIGNED_BIN_SIZE_C\n   #define BN_MP_TO_UNSIGNED_BIN_C\n   #define BN_MP_MOD_D_C\n   #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C\n   #define BN_REVERSE_C\n   #define BN_PRIME_TAB_C\n\n   /* other modifiers */\n   #define BN_MP_DIV_SMALL                    /* Slower division, not critical */\n\n   /* here we are on the last pass so we turn things off.  The functions classes are still there\n    * but we remove them specifically from the build.  This also invokes tweaks in functions\n    * like removing support for even moduli, etc...\n    */\n#ifdef LTM_LAST\n   #undef  BN_MP_TOOM_MUL_C\n   #undef  BN_MP_TOOM_SQR_C\n   #undef  BN_MP_KARATSUBA_MUL_C\n   #undef  BN_MP_KARATSUBA_SQR_C\n   #undef  BN_MP_REDUCE_C\n   #undef  BN_MP_REDUCE_SETUP_C\n   #undef  BN_MP_DR_IS_MODULUS_C\n   #undef  BN_MP_DR_SETUP_C\n   #undef  BN_MP_DR_REDUCE_C\n   #undef  BN_MP_REDUCE_IS_2K_C\n   #undef  BN_MP_REDUCE_2K_SETUP_C\n   #undef  BN_MP_REDUCE_2K_C\n   #undef  BN_S_MP_EXPTMOD_C\n   #undef  BN_MP_DIV_3_C\n   #undef  BN_S_MP_MUL_HIGH_DIGS_C\n   #undef  BN_FAST_S_MP_MUL_HIGH_DIGS_C\n   #undef  BN_FAST_MP_INVMOD_C\n\n   /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold\n    * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] \n    * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without\n    * trouble.  \n    */\n   #undef  BN_S_MP_MUL_DIGS_C\n   #undef  BN_S_MP_SQR_C\n   #undef  BN_MP_MONTGOMERY_REDUCE_C\n#endif\n\n#endif\n\n/* $Source$ */\n/* $Revision: 0.36 $ */\n/* $Date: 2005-08-01 16:37:28 +0000 $ */\n"
  },
  {
    "path": "ios/RNAWSCognito.h",
    "content": "#if __has_include(\"RCTBridgeModule.h\")\n#import \"RCTBridgeModule.h\"\n#else\n#import <React/RCTBridgeModule.h>\n#endif\n\n#if __has_include(\"RCTLog.h\")\n#import \"RCTLog.h\"\n#else\n#import <React/RCTLog.h>\n#endif\n\n#if __has_include(\"RCTUtils.h\")\n#import \"RCTUtils.h\"\n#else\n#import <React/RCTUtils.h>\n#endif\n\n#import \"JKBigInteger.h\"\n\n@interface RNAWSCognito : NSObject <RCTBridgeModule>\n\n@end\n"
  },
  {
    "path": "ios/RNAWSCognito.m",
    "content": "#import \"RNAWSCognito.h\"\n\nstatic NSString* N_IN_HEX = @\"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF\";\n\n@implementation RNAWSCognito\n\n- (dispatch_queue_t)methodQueue {\n    return dispatch_get_main_queue();\n}\nRCT_EXPORT_MODULE()\n\nRCT_EXPORT_METHOD(computeModPow:(NSDictionary *)values\n                  callback:(RCTResponseSenderBlock)callback) {\n    JKBigInteger *target = [[JKBigInteger alloc] initWithString:values[@\"target\"] andRadix:16];\n    JKBigInteger *value = [[JKBigInteger alloc] initWithString:values[@\"value\"] andRadix:16];\n    JKBigInteger *modifier = [[JKBigInteger alloc] initWithString:values[@\"modifier\"] andRadix:16];\n    JKBigInteger *result = [target pow:value andMod:modifier];\n    if (result) {\n        callback(@[[NSNull null], [result stringValueWithRadix:16]]);\n    } else {\n        callback(@[@[RCTMakeError(@\"computeModPow error\", nil, nil)], [NSNull null]]);\n    }\n}\n\nRCT_EXPORT_METHOD(computeS:(NSDictionary *)values\n                  callback:(RCTResponseSenderBlock)callback) {\n    JKBigInteger *N = [[JKBigInteger alloc] initWithString:N_IN_HEX andRadix:16];\n    JKBigInteger *g = [[JKBigInteger alloc] initWithString:values[@\"g\"] andRadix:16];\n    JKBigInteger *x = [[JKBigInteger alloc] initWithString:values[@\"x\"] andRadix:16];\n    JKBigInteger *k = [[JKBigInteger alloc] initWithString:values[@\"k\"] andRadix:16];\n    JKBigInteger *a = [[JKBigInteger alloc] initWithString:values[@\"a\"] andRadix:16];\n    JKBigInteger *b = [[JKBigInteger alloc] initWithString:values[@\"b\"] andRadix:16];\n    JKBigInteger *u = [[JKBigInteger alloc] initWithString:values[@\"u\"] andRadix:16];\n    JKBigInteger *exp = [a add:[u multiply:x]];\n    JKBigInteger *base = [b subtract:[k multiply:[g pow:x andMod:N]]];\n    base = [self mod:base divisor:N];\n    JKBigInteger *result = [base pow:exp andMod:N];\n    result = [self mod:result divisor:N];\n    if (result) {\n        callback(@[[NSNull null], [result stringValueWithRadix:16]]);\n    } else {\n        callback(@[@[RCTMakeError(@\"computeS error\", nil, nil)], [NSNull null]]);\n    }\n}\n\n- (JKBigInteger*) mod:(JKBigInteger*)dividend divisor:(JKBigInteger*) divisor {\n    return [[divisor add:[dividend remainder:divisor]] remainder:divisor];\n}\n\n@end\n"
  },
  {
    "path": "ios/RNAWSCognito.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\tB3E7B58A1CC2AC0600A0062D /* RNAWSCognito.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNAWSCognito.m */; };\n\t\tE2C4A2A31EAEEA5500F05BD3 /* JKBigDecimal.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C4A29B1EAEEA5500F05BD3 /* JKBigDecimal.m */; };\n\t\tE2C4A2A41EAEEA5500F05BD3 /* JKBigInteger.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C4A29D1EAEEA5500F05BD3 /* JKBigInteger.m */; };\n\t\tE2C4A2A51EAEEA5500F05BD3 /* tommath.c in Sources */ = {isa = PBXBuildFile; fileRef = E2C4A29F1EAEEA5500F05BD3 /* tommath.c */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t58B511D91A9E6C8500147676 /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"include/$(PRODUCT_NAME)\";\n\t\t\tdstSubfolderSpec = 16;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t134814201AA4EA6300B7C361 /* libRNAWSCognito.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNAWSCognito.a; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tB3E7B5881CC2AC0600A0062D /* RNAWSCognito.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNAWSCognito.h; sourceTree = \"<group>\"; };\n\t\tB3E7B5891CC2AC0600A0062D /* RNAWSCognito.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNAWSCognito.m; sourceTree = \"<group>\"; };\n\t\tE2C4A29A1EAEEA5500F05BD3 /* JKBigDecimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JKBigDecimal.h; sourceTree = \"<group>\"; };\n\t\tE2C4A29B1EAEEA5500F05BD3 /* JKBigDecimal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JKBigDecimal.m; sourceTree = \"<group>\"; };\n\t\tE2C4A29C1EAEEA5500F05BD3 /* JKBigInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JKBigInteger.h; sourceTree = \"<group>\"; };\n\t\tE2C4A29D1EAEEA5500F05BD3 /* JKBigInteger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JKBigInteger.m; sourceTree = \"<group>\"; };\n\t\tE2C4A29F1EAEEA5500F05BD3 /* tommath.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tommath.c; sourceTree = \"<group>\"; };\n\t\tE2C4A2A01EAEEA5500F05BD3 /* tommath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath.h; sourceTree = \"<group>\"; };\n\t\tE2C4A2A11EAEEA5500F05BD3 /* tommath_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath_class.h; sourceTree = \"<group>\"; };\n\t\tE2C4A2A21EAEEA5500F05BD3 /* tommath_superclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tommath_superclass.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t58B511D81A9E6C8500147676 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t134814211AA4EA7D00B7C361 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t134814201AA4EA6300B7C361 /* libRNAWSCognito.a */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t58B511D21A9E6C8500147676 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE2C4A2991EAEEA5500F05BD3 /* JKBigInteger */,\n\t\t\t\tB3E7B5881CC2AC0600A0062D /* RNAWSCognito.h */,\n\t\t\t\tB3E7B5891CC2AC0600A0062D /* RNAWSCognito.m */,\n\t\t\t\t134814211AA4EA7D00B7C361 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE2C4A2991EAEEA5500F05BD3 /* JKBigInteger */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE2C4A29A1EAEEA5500F05BD3 /* JKBigDecimal.h */,\n\t\t\t\tE2C4A29B1EAEEA5500F05BD3 /* JKBigDecimal.m */,\n\t\t\t\tE2C4A29C1EAEEA5500F05BD3 /* JKBigInteger.h */,\n\t\t\t\tE2C4A29D1EAEEA5500F05BD3 /* JKBigInteger.m */,\n\t\t\t\tE2C4A29E1EAEEA5500F05BD3 /* LibTomMath */,\n\t\t\t);\n\t\t\tpath = JKBigInteger;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE2C4A29E1EAEEA5500F05BD3 /* LibTomMath */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE2C4A29F1EAEEA5500F05BD3 /* tommath.c */,\n\t\t\t\tE2C4A2A01EAEEA5500F05BD3 /* tommath.h */,\n\t\t\t\tE2C4A2A11EAEEA5500F05BD3 /* tommath_class.h */,\n\t\t\t\tE2C4A2A21EAEEA5500F05BD3 /* tommath_superclass.h */,\n\t\t\t);\n\t\t\tpath = LibTomMath;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t58B511DA1A9E6C8500147676 /* RNAWSCognito */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \"RNAWSCognito\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t58B511D71A9E6C8500147676 /* Sources */,\n\t\t\t\t58B511D81A9E6C8500147676 /* Frameworks */,\n\t\t\t\t58B511D91A9E6C8500147676 /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = RNAWSCognito;\n\t\t\tproductName = RCTDataManager;\n\t\t\tproductReference = 134814201AA4EA6300B7C361 /* libRNAWSCognito.a */;\n\t\t\tproductType = \"com.apple.product-type.library.static\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t58B511D31A9E6C8500147676 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 0830;\n\t\t\t\tORGANIZATIONNAME = Facebook;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t58B511DA1A9E6C8500147676 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 6.1.1;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \"RNAWSCognito\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 58B511D21A9E6C8500147676;\n\t\t\tproductRefGroup = 58B511D21A9E6C8500147676;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t58B511DA1A9E6C8500147676 /* RNAWSCognito */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t58B511D71A9E6C8500147676 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE2C4A2A51EAEEA5500F05BD3 /* tommath.c in Sources */,\n\t\t\t\tB3E7B58A1CC2AC0600A0062D /* RNAWSCognito.m in Sources */,\n\t\t\t\tE2C4A2A41EAEEA5500F05BD3 /* JKBigInteger.m in Sources */,\n\t\t\t\tE2C4A2A31EAEEA5500F05BD3 /* JKBigDecimal.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t58B511ED1A9E6C8500147676 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t58B511EE1A9E6C8500147676 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t58B511F01A9E6C8500147676 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,\n\t\t\t\t\t\"$(SRCROOT)/../node_modules/react-native/React/**\",\n\t\t\t\t);\n\t\t\t\tLIBRARY_SEARCH_PATHS = \"$(inherited)\";\n\t\t\t\tOTHER_LDFLAGS = \"-ObjC\";\n\t\t\t\tPRODUCT_NAME = RNAWSCognito;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t58B511F11A9E6C8500147676 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tHEADER_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,\n\t\t\t\t\t\"$(SRCROOT)/../node_modules/react-native/React/**\",\n\t\t\t\t);\n\t\t\t\tLIBRARY_SEARCH_PATHS = \"$(inherited)\";\n\t\t\t\tOTHER_LDFLAGS = \"-ObjC\";\n\t\t\t\tPRODUCT_NAME = RNAWSCognito;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \"RNAWSCognito\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t58B511ED1A9E6C8500147676 /* Debug */,\n\t\t\t\t58B511EE1A9E6C8500147676 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \"RNAWSCognito\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t58B511F01A9E6C8500147676 /* Debug */,\n\t\t\t\t58B511F11A9E6C8500147676 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 58B511D31A9E6C8500147676 /* Project object */;\n}\n"
  },
  {
    "path": "ios/RNAWSCognito.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "lib/AuthenticationDetails.js",
    "content": "\"use strict\";\n\nexports.__esModule = true;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar AuthenticationDetails = function () {\n  /**\n   * Constructs a new AuthenticationDetails object\n   * @param {object=} data Creation options.\n   * @param {string} data.Username User being authenticated.\n   * @param {string} data.Password Plain-text password to authenticate with.\n   * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.\n   * @param {(AttributeArg[])?} data.AuthParamaters Authentication paramaters for custom auth.\n   */\n  function AuthenticationDetails(data) {\n    _classCallCheck(this, AuthenticationDetails);\n\n    var _ref = data || {},\n        ValidationData = _ref.ValidationData,\n        Username = _ref.Username,\n        Password = _ref.Password,\n        AuthParameters = _ref.AuthParameters;\n\n    this.validationData = ValidationData || [];\n    this.authParameters = AuthParameters || [];\n    this.username = Username;\n    this.password = Password;\n  }\n\n  /**\n   * @returns {string} the record's username\n   */\n\n\n  AuthenticationDetails.prototype.getUsername = function getUsername() {\n    return this.username;\n  };\n\n  /**\n   * @returns {string} the record's password\n   */\n\n\n  AuthenticationDetails.prototype.getPassword = function getPassword() {\n    return this.password;\n  };\n\n  /**\n   * @returns {Array} the record's validationData\n   */\n\n\n  AuthenticationDetails.prototype.getValidationData = function getValidationData() {\n    return this.validationData;\n  };\n\n  /**\n   * @returns {Array} the record's authParameters\n   */\n\n\n  AuthenticationDetails.prototype.getAuthParameters = function getAuthParameters() {\n    return this.authParameters;\n  };\n\n  return AuthenticationDetails;\n}();\n\nexports.default = AuthenticationDetails;"
  },
  {
    "path": "lib/AuthenticationHelper.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _global = require('aws-sdk/global');\n\nvar _BigInteger = require('./BigInteger');\n\nvar _BigInteger2 = _interopRequireDefault(_BigInteger);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n                                                                                                                                                           * Copyright 2016 Amazon.com,\n                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                           *\n                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                           * You may not use this file except in compliance with the\n                                                                                                                                                           * License. A copy of the License is located at\n                                                                                                                                                           *\n                                                                                                                                                           *     http://aws.amazon.com/asl/\n                                                                                                                                                           *\n                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                           * for the specific language governing permissions and\n                                                                                                                                                           * limitations under the License.\n                                                                                                                                                           */\n\nvar initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD' + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245' + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D' + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F' + '83655D23DCA3AD961C62F356208552BB9ED529077096966D' + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9' + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510' + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64' + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B' + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C' + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\n\nvar newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n\n/** @class */\n\nvar AuthenticationHelper = function () {\n  /**\n   * Constructs a new AuthenticationHelper object\n   * @param {string} PoolName Cognito user pool name.\n   */\n  function AuthenticationHelper(PoolName) {\n    _classCallCheck(this, AuthenticationHelper);\n\n    this.N = new _BigInteger2.default(initN, 16);\n    this.g = new _BigInteger2.default('2', 16);\n    this.k = new _BigInteger2.default(this.hexHash('00' + this.N.toString(16) + '0' + this.g.toString(16)), 16);\n\n    this.smallAValue = this.generateRandomSmallA();\n    this.getLargeAValue(function () {});\n\n    this.infoBits = new _global.util.Buffer('Caldera Derived Key', 'utf8');\n\n    this.poolName = PoolName;\n  }\n\n  /**\n   * @returns {BigInteger} small A, a random number\n   */\n\n\n  AuthenticationHelper.prototype.getSmallAValue = function getSmallAValue() {\n    return this.smallAValue;\n  };\n\n  /**\n   * @param {nodeCallback<BigInteger>} callback Called with (err, largeAValue)\n   * @returns {void}\n   */\n\n\n  AuthenticationHelper.prototype.getLargeAValue = function getLargeAValue(callback) {\n    var _this = this;\n\n    if (this.largeAValue) {\n      callback(null, this.largeAValue);\n    } else {\n      this.calculateA(this.smallAValue, function (err, largeAValue) {\n        if (err) {\n          callback(err, null);\n        }\n\n        _this.largeAValue = largeAValue;\n        callback(null, _this.largeAValue);\n      });\n    }\n  };\n\n  /**\n   * helper function to generate a random big integer\n   * @returns {BigInteger} a random value.\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.generateRandomSmallA = function generateRandomSmallA() {\n    var hexRandom = _global.util.crypto.lib.randomBytes(128).toString('hex');\n\n    var randomBigInt = new _BigInteger2.default(hexRandom, 16);\n    var smallABigInt = randomBigInt.mod(this.N);\n\n    return smallABigInt;\n  };\n\n  /**\n   * helper function to generate a random string\n   * @returns {string} a random value.\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.generateRandomString = function generateRandomString() {\n    return _global.util.crypto.lib.randomBytes(40).toString('base64');\n  };\n\n  /**\n   * @returns {string} Generated random value included in password hash.\n   */\n\n\n  AuthenticationHelper.prototype.getRandomPassword = function getRandomPassword() {\n    return this.randomPassword;\n  };\n\n  /**\n   * @returns {string} Generated random value included in devices hash.\n   */\n\n\n  AuthenticationHelper.prototype.getSaltDevices = function getSaltDevices() {\n    return this.SaltToHashDevices;\n  };\n\n  /**\n   * @returns {string} Value used to verify devices.\n   */\n\n\n  AuthenticationHelper.prototype.getVerifierDevices = function getVerifierDevices() {\n    return this.verifierDevices;\n  };\n\n  /**\n   * Generate salts and compute verifier.\n   * @param {string} deviceGroupKey Devices to generate verifier for.\n   * @param {string} username User to generate verifier for.\n   * @param {nodeCallback<null>} callback Called with (err, null)\n   * @returns {void}\n   */\n\n\n  AuthenticationHelper.prototype.generateHashDevice = function generateHashDevice(deviceGroupKey, username, callback) {\n    var _this2 = this;\n\n    this.randomPassword = this.generateRandomString();\n    var combinedString = '' + deviceGroupKey + username + ':' + this.randomPassword;\n    var hashedString = this.hash(combinedString);\n\n    var hexRandom = _global.util.crypto.lib.randomBytes(16).toString('hex');\n    this.SaltToHashDevices = this.padHex(new _BigInteger2.default(hexRandom, 16));\n\n    this.g.modPow(new _BigInteger2.default(this.hexHash(this.SaltToHashDevices + hashedString), 16), this.N, function (err, verifierDevicesNotPadded) {\n      if (err) {\n        callback(err, null);\n      }\n\n      _this2.verifierDevices = _this2.padHex(verifierDevicesNotPadded);\n      callback(null, null);\n    });\n  };\n\n  /**\n   * Calculate the client's public value A = g^a%N\n   * with the generated random number a\n   * @param {BigInteger} a Randomly generated small A.\n   * @param {nodeCallback<BigInteger>} callback Called with (err, largeAValue)\n   * @returns {void}\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.calculateA = function calculateA(a, callback) {\n    var _this3 = this;\n\n    this.g.modPow(a, this.N, function (err, A) {\n      if (err) {\n        callback(err, null);\n      }\n\n      if (A.mod(_this3.N).equals(_BigInteger2.default.ZERO)) {\n        callback(new Error('Illegal paramater. A mod N cannot be 0.'), null);\n      }\n\n      callback(null, A);\n    });\n  };\n\n  /**\n   * Calculate the client's value U which is the hash of A and B\n   * @param {BigInteger} A Large A value.\n   * @param {BigInteger} B Server B value.\n   * @returns {BigInteger} Computed U value.\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.calculateU = function calculateU(A, B) {\n    this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n    var finalU = new _BigInteger2.default(this.UHexHash, 16);\n\n    return finalU;\n  };\n\n  /**\n   * Calculate a hash from a bitArray\n   * @param {Buffer} buf Value to hash.\n   * @returns {String} Hex-encoded hash.\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.hash = function hash(buf) {\n    var hashHex = _global.util.crypto.sha256(buf, 'hex');\n    return new Array(64 - hashHex.length).join('0') + hashHex;\n  };\n\n  /**\n   * Calculate a hash from a hex string\n   * @param {String} hexStr Value to hash.\n   * @returns {String} Hex-encoded hash.\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.hexHash = function hexHash(hexStr) {\n    return this.hash(new _global.util.Buffer(hexStr, 'hex'));\n  };\n\n  /**\n   * Standard hkdf algorithm\n   * @param {Buffer} ikm Input key material.\n   * @param {Buffer} salt Salt value.\n   * @returns {Buffer} Strong key material.\n   * @private\n   */\n\n\n  AuthenticationHelper.prototype.computehkdf = function computehkdf(ikm, salt) {\n    var prk = _global.util.crypto.hmac(salt, ikm, 'buffer', 'sha256');\n    var infoBitsUpdate = _global.util.buffer.concat([this.infoBits, new _global.util.Buffer(String.fromCharCode(1), 'utf8')]);\n    var hmac = _global.util.crypto.hmac(prk, infoBitsUpdate, 'buffer', 'sha256');\n    return hmac.slice(0, 16);\n  };\n\n  /**\n   * Calculates the final hkdf based on computed S value, and computed U value and the key\n   * @param {String} username Username.\n   * @param {String} password Password.\n   * @param {BigInteger} serverBValue Server B value.\n   * @param {BigInteger} salt Generated salt.\n   * @param {nodeCallback<Buffer>} callback Called with (err, hkdfValue)\n   * @returns {void}\n   */\n\n\n  AuthenticationHelper.prototype.getPasswordAuthenticationKey = function getPasswordAuthenticationKey(username, password, serverBValue, salt, callback) {\n    var _this4 = this;\n\n    if (serverBValue.mod(this.N).equals(_BigInteger2.default.ZERO)) {\n      throw new Error('B cannot be zero.');\n    }\n\n    this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n    if (this.UValue.equals(_BigInteger2.default.ZERO)) {\n      throw new Error('U cannot be zero.');\n    }\n\n    var usernamePassword = '' + this.poolName + username + ':' + password;\n    var usernamePasswordHash = this.hash(usernamePassword);\n\n    var xValue = new _BigInteger2.default(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n    this.calculateS(xValue, serverBValue, function (err, sValue) {\n      if (err) {\n        callback(err, null);\n      }\n\n      var hkdf = _this4.computehkdf(new _global.util.Buffer(_this4.padHex(sValue), 'hex'), new _global.util.Buffer(_this4.padHex(_this4.UValue.toString(16)), 'hex'));\n\n      callback(null, hkdf);\n    });\n  };\n\n  /**\n   * Calculates the S value used in getPasswordAuthenticationKey\n   * @param {BigInteger} xValue Salted password hash value.\n   * @param {BigInteger} serverBValue Server B value.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  AuthenticationHelper.prototype.calculateS = function calculateS(xValue, serverBValue, callback) {\n    var _this5 = this;\n\n    this.g.modPow(xValue, this.N, function (err, gModPowXN) {\n      if (err) {\n        callback(err, null);\n      }\n\n      var intValue2 = serverBValue.subtract(_this5.k.multiply(gModPowXN));\n      intValue2.modPow(_this5.smallAValue.add(_this5.UValue.multiply(xValue)), _this5.N, function (err2, result) {\n        if (err2) {\n          callback(err2, null);\n        }\n\n        callback(null, result.mod(_this5.N));\n      });\n    });\n  };\n\n  /**\n  * Return constant newPasswordRequiredChallengeUserAttributePrefix\n  * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n  */\n\n\n  AuthenticationHelper.prototype.getNewPasswordRequiredChallengeUserAttributePrefix = function getNewPasswordRequiredChallengeUserAttributePrefix() {\n    return newPasswordRequiredChallengeUserAttributePrefix;\n  };\n\n  /**\n   * Converts a BigInteger (or hex string) to hex format padded with zeroes for hashing\n   * @param {BigInteger|String} bigInt Number or string to pad.\n   * @returns {String} Padded hex string.\n   */\n\n\n  AuthenticationHelper.prototype.padHex = function padHex(bigInt) {\n    var hashStr = bigInt.toString(16);\n    if (hashStr.length % 2 === 1) {\n      hashStr = '0' + hashStr;\n    } else if ('89ABCDEFabcdef'.indexOf(hashStr[0]) !== -1) {\n      hashStr = '00' + hashStr;\n    }\n    return hashStr;\n  };\n\n  return AuthenticationHelper;\n}();\n\nexports.default = AuthenticationHelper;"
  },
  {
    "path": "lib/BigInteger.js",
    "content": "\"use strict\";\n\nexports.__esModule = true;\n// A small implementation of BigInteger based on http://www-cs-students.stanford.edu/~tjw/jsbn/\n//\n// All public methods have been removed except the following:\n//   new BigInteger(a, b) (only radix 2, 4, 8, 16 and 32 supported)\n//   toString (only radix 2, 4, 8, 16 and 32 supported)\n//   negate\n//   abs\n//   compareTo\n//   bitLength\n//   mod\n//   equals\n//   add\n//   subtract\n//   multiply\n//   divide\n//   modPow\n\nexports.default = BigInteger;\n\n/*\n * Copyright (c) 2003-2005  Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n\n// (public) Constructor\n\nfunction BigInteger(a, b) {\n  if (a != null) this.fromString(a, b);\n}\n\n// return new, unset BigInteger\nfunction nbi() {\n  return new BigInteger(null);\n}\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = (canary & 0xffffff) == 0xefcafe;\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n  while (--n >= 0) {\n    var v = x * this[i++] + w[j] + c;\n    c = Math.floor(v / 0x4000000);\n    w[j++] = v & 0x3ffffff;\n  }\n  return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n  var xl = x & 0x7fff,\n      xh = x >> 15;\n  while (--n >= 0) {\n    var l = this[i] & 0x7fff;\n    var h = this[i++] >> 15;\n    var m = xh * l + h * xl;\n    l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n    c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n    w[j++] = l & 0x3fffffff;\n  }\n  return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n  var xl = x & 0x3fff,\n      xh = x >> 14;\n  while (--n >= 0) {\n    var l = this[i] & 0x3fff;\n    var h = this[i++] >> 14;\n    var m = xh * l + h * xl;\n    l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n    c = (l >> 28) + (m >> 14) + xh * h;\n    w[j++] = l & 0xfffffff;\n  }\n  return c;\n}\nvar inBrowser = typeof navigator !== \"undefined\";\nif (inBrowser && j_lm && navigator.appName == \"Microsoft Internet Explorer\") {\n  BigInteger.prototype.am = am2;\n  dbits = 30;\n} else if (inBrowser && j_lm && navigator.appName != \"Netscape\") {\n  BigInteger.prototype.am = am1;\n  dbits = 26;\n} else {\n  // Mozilla/Netscape seems to prefer am3\n  BigInteger.prototype.am = am3;\n  dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = (1 << dbits) - 1;\nBigInteger.prototype.DV = 1 << dbits;\n\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n\n// Digit conversions\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nvar BI_RC = new Array();\nvar rr, vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv) {\n  BI_RC[rr++] = vv;\n}rr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n  BI_RC[rr++] = vv;\n}rr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n  BI_RC[rr++] = vv;\n}function int2char(n) {\n  return BI_RM.charAt(n);\n}\nfunction intAt(s, i) {\n  var c = BI_RC[s.charCodeAt(i)];\n  return c == null ? -1 : c;\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n  for (var i = this.t - 1; i >= 0; --i) {\n    r[i] = this[i];\n  }r.t = this.t;\n  r.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n  this.t = 1;\n  this.s = x < 0 ? -1 : 0;\n  if (x > 0) this[0] = x;else if (x < -1) this[0] = x + this.DV;else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n  var r = nbi();\n\n  r.fromInt(i);\n\n  return r;\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(s, b) {\n  var k;\n  if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error(\"Only radix 2, 4, 8, 16, 32 are supported\");\n  this.t = 0;\n  this.s = 0;\n  var i = s.length,\n      mi = false,\n      sh = 0;\n  while (--i >= 0) {\n    var x = intAt(s, i);\n    if (x < 0) {\n      if (s.charAt(i) == \"-\") mi = true;\n      continue;\n    }\n    mi = false;\n    if (sh == 0) this[this.t++] = x;else if (sh + k > this.DB) {\n      this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;\n      this[this.t++] = x >> this.DB - sh;\n    } else this[this.t - 1] |= x << sh;\n    sh += k;\n    if (sh >= this.DB) sh -= this.DB;\n  }\n  this.clamp();\n  if (mi) BigInteger.ZERO.subTo(this, this);\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n  var c = this.s & this.DM;\n  while (this.t > 0 && this[this.t - 1] == c) {\n    --this.t;\n  }\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n  if (this.s < 0) return \"-\" + this.negate().toString();\n  var k;\n  if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error(\"Only radix 2, 4, 8, 16, 32 are supported\");\n  var km = (1 << k) - 1,\n      d,\n      m = false,\n      r = \"\",\n      i = this.t;\n  var p = this.DB - i * this.DB % k;\n  if (i-- > 0) {\n    if (p < this.DB && (d = this[i] >> p) > 0) {\n      m = true;\n      r = int2char(d);\n    }\n    while (i >= 0) {\n      if (p < k) {\n        d = (this[i] & (1 << p) - 1) << k - p;\n        d |= this[--i] >> (p += this.DB - k);\n      } else {\n        d = this[i] >> (p -= k) & km;\n        if (p <= 0) {\n          p += this.DB;\n          --i;\n        }\n      }\n      if (d > 0) m = true;\n      if (m) r += int2char(d);\n    }\n  }\n  return m ? r : \"0\";\n}\n\n// (public) -this\nfunction bnNegate() {\n  var r = nbi();\n\n  BigInteger.ZERO.subTo(this, r);\n\n  return r;\n}\n\n// (public) |this|\nfunction bnAbs() {\n  return this.s < 0 ? this.negate() : this;\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n  var r = this.s - a.s;\n  if (r != 0) return r;\n  var i = this.t;\n  r = i - a.t;\n  if (r != 0) return this.s < 0 ? -r : r;\n  while (--i >= 0) {\n    if ((r = this[i] - a[i]) != 0) return r;\n  }return 0;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n  var r = 1,\n      t;\n  if ((t = x >>> 16) != 0) {\n    x = t;\n    r += 16;\n  }\n  if ((t = x >> 8) != 0) {\n    x = t;\n    r += 8;\n  }\n  if ((t = x >> 4) != 0) {\n    x = t;\n    r += 4;\n  }\n  if ((t = x >> 2) != 0) {\n    x = t;\n    r += 2;\n  }\n  if ((t = x >> 1) != 0) {\n    x = t;\n    r += 1;\n  }\n  return r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n  if (this.t <= 0) return 0;\n  return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n  var i;\n  for (i = this.t - 1; i >= 0; --i) {\n    r[i + n] = this[i];\n  }for (i = n - 1; i >= 0; --i) {\n    r[i] = 0;\n  }r.t = this.t + n;\n  r.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n  for (var i = n; i < this.t; ++i) {\n    r[i - n] = this[i];\n  }r.t = Math.max(this.t - n, 0);\n  r.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n  var bs = n % this.DB;\n  var cbs = this.DB - bs;\n  var bm = (1 << cbs) - 1;\n  var ds = Math.floor(n / this.DB),\n      c = this.s << bs & this.DM,\n      i;\n  for (i = this.t - 1; i >= 0; --i) {\n    r[i + ds + 1] = this[i] >> cbs | c;\n    c = (this[i] & bm) << bs;\n  }\n  for (i = ds - 1; i >= 0; --i) {\n    r[i] = 0;\n  }r[ds] = c;\n  r.t = this.t + ds + 1;\n  r.s = this.s;\n  r.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n  r.s = this.s;\n  var ds = Math.floor(n / this.DB);\n  if (ds >= this.t) {\n    r.t = 0;\n    return;\n  }\n  var bs = n % this.DB;\n  var cbs = this.DB - bs;\n  var bm = (1 << bs) - 1;\n  r[0] = this[ds] >> bs;\n  for (var i = ds + 1; i < this.t; ++i) {\n    r[i - ds - 1] |= (this[i] & bm) << cbs;\n    r[i - ds] = this[i] >> bs;\n  }\n  if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n  r.t = this.t - ds;\n  r.clamp();\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n  var i = 0,\n      c = 0,\n      m = Math.min(a.t, this.t);\n  while (i < m) {\n    c += this[i] - a[i];\n    r[i++] = c & this.DM;\n    c >>= this.DB;\n  }\n  if (a.t < this.t) {\n    c -= a.s;\n    while (i < this.t) {\n      c += this[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c += this.s;\n  } else {\n    c += this.s;\n    while (i < a.t) {\n      c -= a[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c -= a.s;\n  }\n  r.s = c < 0 ? -1 : 0;\n  if (c < -1) r[i++] = this.DV + c;else if (c > 0) r[i++] = c;\n  r.t = i;\n  r.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n  var x = this.abs(),\n      y = a.abs();\n  var i = x.t;\n  r.t = i + y.t;\n  while (--i >= 0) {\n    r[i] = 0;\n  }for (i = 0; i < y.t; ++i) {\n    r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n  }r.s = 0;\n  r.clamp();\n  if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n  var x = this.abs();\n  var i = r.t = 2 * x.t;\n  while (--i >= 0) {\n    r[i] = 0;\n  }for (i = 0; i < x.t - 1; ++i) {\n    var c = x.am(i, x[i], r, 2 * i, 0, 1);\n    if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n      r[i + x.t] -= x.DV;\n      r[i + x.t + 1] = 1;\n    }\n  }\n  if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n  r.s = 0;\n  r.clamp();\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m.  q or r may be null.\nfunction bnpDivRemTo(m, q, r) {\n  var pm = m.abs();\n  if (pm.t <= 0) return;\n  var pt = this.abs();\n  if (pt.t < pm.t) {\n    if (q != null) q.fromInt(0);\n    if (r != null) this.copyTo(r);\n    return;\n  }\n  if (r == null) r = nbi();\n  var y = nbi(),\n      ts = this.s,\n      ms = m.s;\n  var nsh = this.DB - nbits(pm[pm.t - 1]);\n  // normalize modulus\n  if (nsh > 0) {\n    pm.lShiftTo(nsh, y);\n    pt.lShiftTo(nsh, r);\n  } else {\n    pm.copyTo(y);\n    pt.copyTo(r);\n  }\n  var ys = y.t;\n  var y0 = y[ys - 1];\n  if (y0 == 0) return;\n  var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n  var d1 = this.FV / yt,\n      d2 = (1 << this.F1) / yt,\n      e = 1 << this.F2;\n  var i = r.t,\n      j = i - ys,\n      t = q == null ? nbi() : q;\n  y.dlShiftTo(j, t);\n  if (r.compareTo(t) >= 0) {\n    r[r.t++] = 1;\n    r.subTo(t, r);\n  }\n  BigInteger.ONE.dlShiftTo(ys, t);\n  t.subTo(y, y);\n  // \"negative\" y so we can replace sub with am later\n  while (y.t < ys) {\n    y[y.t++] = 0;\n  }while (--j >= 0) {\n    // Estimate quotient digit\n    var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n    if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n      // Try it out\n      y.dlShiftTo(j, t);\n      r.subTo(t, r);\n      while (r[i] < --qd) {\n        r.subTo(t, r);\n      }\n    }\n  }\n  if (q != null) {\n    r.drShiftTo(ys, q);\n    if (ts != ms) BigInteger.ZERO.subTo(q, q);\n  }\n  r.t = ys;\n  r.clamp();\n  if (nsh > 0) r.rShiftTo(nsh, r);\n  // Denormalize remainder\n  if (ts < 0) BigInteger.ZERO.subTo(r, r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n  var r = nbi();\n  this.abs().divRemTo(a, null, r);\n  if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n  return r;\n}\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n//         xy == 1 (mod m)\n//         xy =  1+km\n//   xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n  if (this.t < 1) return 0;\n  var x = this[0];\n  if ((x & 1) == 0) return 0;\n  var y = x & 3;\n  // y == 1/x mod 2^2\n  y = y * (2 - (x & 0xf) * y) & 0xf;\n  // y == 1/x mod 2^4\n  y = y * (2 - (x & 0xff) * y) & 0xff;\n  // y == 1/x mod 2^8\n  y = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff;\n  // y == 1/x mod 2^16\n  // last step - calculate inverse mod DV directly;\n  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n  y = y * (2 - x * y % this.DV) % this.DV;\n  // y == 1/x mod 2^dbits\n  // we really want the negative inverse, and -DV < y < DV\n  return y > 0 ? this.DV - y : -y;\n}\n\nfunction bnEquals(a) {\n  return this.compareTo(a) == 0;\n}\n\n// (protected) r = this + a\nfunction bnpAddTo(a, r) {\n  var i = 0,\n      c = 0,\n      m = Math.min(a.t, this.t);\n  while (i < m) {\n    c += this[i] + a[i];\n    r[i++] = c & this.DM;\n    c >>= this.DB;\n  }\n  if (a.t < this.t) {\n    c += a.s;\n    while (i < this.t) {\n      c += this[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c += this.s;\n  } else {\n    c += this.s;\n    while (i < a.t) {\n      c += a[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c += a.s;\n  }\n  r.s = c < 0 ? -1 : 0;\n  if (c > 0) r[i++] = c;else if (c < -1) r[i++] = this.DV + c;\n  r.t = i;\n  r.clamp();\n}\n\n// (public) this + a\nfunction bnAdd(a) {\n  var r = nbi();\n\n  this.addTo(a, r);\n\n  return r;\n}\n\n// (public) this - a\nfunction bnSubtract(a) {\n  var r = nbi();\n\n  this.subTo(a, r);\n\n  return r;\n}\n\n// (public) this * a\nfunction bnMultiply(a) {\n  var r = nbi();\n\n  this.multiplyTo(a, r);\n\n  return r;\n}\n\n// (public) this / a\nfunction bnDivide(a) {\n  var r = nbi();\n\n  this.divRemTo(a, r, null);\n\n  return r;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n  this.m = m;\n  this.mp = m.invDigit();\n  this.mpl = this.mp & 0x7fff;\n  this.mph = this.mp >> 15;\n  this.um = (1 << m.DB - 15) - 1;\n  this.mt2 = 2 * m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n  var r = nbi();\n  x.abs().dlShiftTo(this.m.t, r);\n  r.divRemTo(this.m, null, r);\n  if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n  return r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n  var r = nbi();\n  x.copyTo(r);\n  this.reduce(r);\n  return r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n  while (x.t <= this.mt2) {\n    // pad x so am has enough room later\n    x[x.t++] = 0;\n  }for (var i = 0; i < this.m.t; ++i) {\n    // faster way of calculating u0 = x[i]*mp mod DV\n    var j = x[i] & 0x7fff;\n    var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM;\n    // use am to combine the multiply-shift-add into one call\n    j = i + this.m.t;\n    x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n    // propagate carry\n    while (x[j] >= x.DV) {\n      x[j] -= x.DV;\n      x[++j]++;\n    }\n  }\n  x.clamp();\n  x.drShiftTo(this.m.t, x);\n  if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n  x.squareTo(r);\n\n  this.reduce(r);\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n  x.multiplyTo(y, r);\n\n  this.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (public) this^e % m (HAC 14.85)\nfunction bnModPow(e, m, callback) {\n  var i = e.bitLength(),\n      k,\n      r = nbv(1),\n      z = new Montgomery(m);\n  if (i <= 0) return r;else if (i < 18) k = 1;else if (i < 48) k = 3;else if (i < 144) k = 4;else if (i < 768) k = 5;else k = 6;\n\n  // precomputation\n  var g = new Array(),\n      n = 3,\n      k1 = k - 1,\n      km = (1 << k) - 1;\n  g[1] = z.convert(this);\n  if (k > 1) {\n    var g2 = nbi();\n    z.sqrTo(g[1], g2);\n    while (n <= km) {\n      g[n] = nbi();\n      z.mulTo(g2, g[n - 2], g[n]);\n      n += 2;\n    }\n  }\n\n  var j = e.t - 1,\n      w,\n      is1 = true,\n      r2 = nbi(),\n      t;\n  i = nbits(e[j]) - 1;\n  while (j >= 0) {\n    if (i >= k1) w = e[j] >> i - k1 & km;else {\n      w = (e[j] & (1 << i + 1) - 1) << k1 - i;\n      if (j > 0) w |= e[j - 1] >> this.DB + i - k1;\n    }\n\n    n = k;\n    while ((w & 1) == 0) {\n      w >>= 1;\n      --n;\n    }\n    if ((i -= n) < 0) {\n      i += this.DB;\n      --j;\n    }\n    if (is1) {\n      // ret == 1, don't bother squaring or multiplying it\n      g[w].copyTo(r);\n      is1 = false;\n    } else {\n      while (n > 1) {\n        z.sqrTo(r, r2);\n        z.sqrTo(r2, r);\n        n -= 2;\n      }\n      if (n > 0) z.sqrTo(r, r2);else {\n        t = r;\n        r = r2;\n        r2 = t;\n      }\n      z.mulTo(r2, g[w], r);\n    }\n\n    while (j >= 0 && (e[j] & 1 << i) == 0) {\n      z.sqrTo(r, r2);\n      t = r;\n      r = r2;\n      r2 = t;\n      if (--i < 0) {\n        i = this.DB - 1;\n        --j;\n      }\n    }\n  }\n  var result = z.revert(r);\n  callback(null, result);\n  return result;\n}\n\n// protected\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.addTo = bnpAddTo;\n\n// public\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.modPow = bnModPow;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);"
  },
  {
    "path": "lib/CognitoAccessToken.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _CognitoJwtToken2 = require('./CognitoJwtToken');\n\nvar _CognitoJwtToken3 = _interopRequireDefault(_CognitoJwtToken2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; } /*\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2016 Amazon.com,\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * You may not use this file except in compliance with the\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * License. A copy of the License is located at\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *     http://aws.amazon.com/asl/\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * for the specific language governing permissions and\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * limitations under the License.\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */\n\n/** @class */\nvar CognitoAccessToken = function (_CognitoJwtToken) {\n  _inherits(CognitoAccessToken, _CognitoJwtToken);\n\n  /**\n   * Constructs a new CognitoAccessToken object\n   * @param {string=} AccessToken The JWT access token.\n   */\n  function CognitoAccessToken() {\n    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n        AccessToken = _ref.AccessToken;\n\n    _classCallCheck(this, CognitoAccessToken);\n\n    return _possibleConstructorReturn(this, _CognitoJwtToken.call(this, AccessToken || ''));\n  }\n\n  return CognitoAccessToken;\n}(_CognitoJwtToken3.default);\n\nexports.default = CognitoAccessToken;"
  },
  {
    "path": "lib/CognitoIdToken.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _CognitoJwtToken2 = require('./CognitoJwtToken');\n\nvar _CognitoJwtToken3 = _interopRequireDefault(_CognitoJwtToken2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; } /*!\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2016 Amazon.com,\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * You may not use this file except in compliance with the\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * License. A copy of the License is located at\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *     http://aws.amazon.com/asl/\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * for the specific language governing permissions and\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * limitations under the License.\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */\n\n/** @class */\nvar CognitoIdToken = function (_CognitoJwtToken) {\n  _inherits(CognitoIdToken, _CognitoJwtToken);\n\n  /**\n   * Constructs a new CognitoIdToken object\n   * @param {string=} IdToken The JWT Id token\n   */\n  function CognitoIdToken() {\n    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n        IdToken = _ref.IdToken;\n\n    _classCallCheck(this, CognitoIdToken);\n\n    return _possibleConstructorReturn(this, _CognitoJwtToken.call(this, IdToken || ''));\n  }\n\n  return CognitoIdToken;\n}(_CognitoJwtToken3.default);\n\nexports.default = CognitoIdToken;"
  },
  {
    "path": "lib/CognitoJwtToken.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _global = require('aws-sdk/global');\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n                                                                                                                                                           * Copyright 2016 Amazon.com,\n                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                           *\n                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                           * You may not use this file except in compliance with the\n                                                                                                                                                           * License. A copy of the License is located at\n                                                                                                                                                           *\n                                                                                                                                                           *     http://aws.amazon.com/asl/\n                                                                                                                                                           *\n                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                           * for the specific language governing permissions and\n                                                                                                                                                           * limitations under the License.\n                                                                                                                                                           */\n\n/** @class */\nvar CognitoJwtToken = function () {\n  /**\n   * Constructs a new CognitoJwtToken object\n   * @param {string=} token The JWT token.\n   */\n  function CognitoJwtToken(token) {\n    _classCallCheck(this, CognitoJwtToken);\n\n    // Assign object\n    this.jwtToken = token || '';\n    this.payload = this.decodePayload();\n  }\n\n  /**\n   * @returns {string} the record's token.\n   */\n\n\n  CognitoJwtToken.prototype.getJwtToken = function getJwtToken() {\n    return this.jwtToken;\n  };\n\n  /**\n   * @returns {int} the token's expiration (exp member).\n   */\n\n\n  CognitoJwtToken.prototype.getExpiration = function getExpiration() {\n    return this.payload.exp;\n  };\n\n  /**\n   * @returns {int} the token's \"issued at\" (iat member).\n   */\n\n\n  CognitoJwtToken.prototype.getIssuedAt = function getIssuedAt() {\n    return this.payload.iat;\n  };\n\n  /**\n   * @returns {object} the token's payload.\n   */\n\n\n  CognitoJwtToken.prototype.decodePayload = function decodePayload() {\n    var payload = this.jwtToken.split('.')[1];\n    try {\n      return JSON.parse(_global.util.base64.decode(payload).toString('utf8'));\n    } catch (err) {\n      return {};\n    }\n  };\n\n  return CognitoJwtToken;\n}();\n\nexports.default = CognitoJwtToken;"
  },
  {
    "path": "lib/CognitoRefreshToken.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar CognitoRefreshToken = function () {\n  /**\n   * Constructs a new CognitoRefreshToken object\n   * @param {string=} RefreshToken The JWT refresh token.\n   */\n  function CognitoRefreshToken() {\n    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n        RefreshToken = _ref.RefreshToken;\n\n    _classCallCheck(this, CognitoRefreshToken);\n\n    // Assign object\n    this.token = RefreshToken || '';\n  }\n\n  /**\n   * @returns {string} the record's token.\n   */\n\n\n  CognitoRefreshToken.prototype.getToken = function getToken() {\n    return this.token;\n  };\n\n  return CognitoRefreshToken;\n}();\n\nexports.default = CognitoRefreshToken;"
  },
  {
    "path": "lib/CognitoUser.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _global = require('aws-sdk/global');\n\nvar _BigInteger = require('./BigInteger');\n\nvar _BigInteger2 = _interopRequireDefault(_BigInteger);\n\nvar _AuthenticationHelper = require('./AuthenticationHelper');\n\nvar _AuthenticationHelper2 = _interopRequireDefault(_AuthenticationHelper);\n\nvar _CognitoAccessToken = require('./CognitoAccessToken');\n\nvar _CognitoAccessToken2 = _interopRequireDefault(_CognitoAccessToken);\n\nvar _CognitoIdToken = require('./CognitoIdToken');\n\nvar _CognitoIdToken2 = _interopRequireDefault(_CognitoIdToken);\n\nvar _CognitoRefreshToken = require('./CognitoRefreshToken');\n\nvar _CognitoRefreshToken2 = _interopRequireDefault(_CognitoRefreshToken);\n\nvar _CognitoUserSession = require('./CognitoUserSession');\n\nvar _CognitoUserSession2 = _interopRequireDefault(_CognitoUserSession);\n\nvar _DateHelper = require('./DateHelper');\n\nvar _DateHelper2 = _interopRequireDefault(_DateHelper);\n\nvar _CognitoUserAttribute = require('./CognitoUserAttribute');\n\nvar _CognitoUserAttribute2 = _interopRequireDefault(_CognitoUserAttribute);\n\nvar _StorageHelper = require('./StorageHelper');\n\nvar _StorageHelper2 = _interopRequireDefault(_StorageHelper);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n                                                                                                                                                           * Copyright 2016 Amazon.com,\n                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                           *\n                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                           * You may not use this file except in compliance with the\n                                                                                                                                                           * License. A copy of the License is located at\n                                                                                                                                                           *\n                                                                                                                                                           *     http://aws.amazon.com/asl/\n                                                                                                                                                           *\n                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                           * for the specific language governing permissions and\n                                                                                                                                                           * limitations under the License.\n                                                                                                                                                           */\n\n/**\n * @callback nodeCallback\n * @template T result\n * @param {*} err The operation failure reason, or null.\n * @param {T} result The operation result.\n */\n\n/**\n * @callback onFailure\n * @param {*} err Failure reason.\n */\n\n/**\n * @callback onSuccess\n * @template T result\n * @param {T} result The operation result.\n */\n\n/**\n * @callback mfaRequired\n * @param {*} details MFA challenge details.\n */\n\n/**\n * @callback customChallenge\n * @param {*} details Custom challenge details.\n */\n\n/**\n * @callback inputVerificationCode\n * @param {*} data Server response.\n */\n\n/**\n * @callback authSuccess\n * @param {CognitoUserSession} session The new session.\n * @param {bool=} userConfirmationNecessary User must be confirmed.\n */\n\n/** @class */\nvar CognitoUser = function () {\n  /**\n   * Constructs a new CognitoUser object\n   * @param {object} data Creation options\n   * @param {string} data.Username The user's username.\n   * @param {CognitoUserPool} data.Pool Pool containing the user.\n   * @param {object} data.Storage Optional storage object.\n   */\n  function CognitoUser(data) {\n    _classCallCheck(this, CognitoUser);\n\n    if (data == null || data.Username == null || data.Pool == null) {\n      throw new Error('Username and pool information are required.');\n    }\n\n    this.username = data.Username || '';\n    this.pool = data.Pool;\n    this.Session = null;\n\n    this.client = data.Pool.client;\n\n    this.signInUserSession = null;\n    this.authenticationFlowType = 'USER_SRP_AUTH';\n\n    this.storage = data.Storage || new _StorageHelper2.default().getStorage();\n  }\n\n  /**\n   * Sets the session for this user\n   * @param {CognitoUserSession} signInUserSession the session\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.setSignInUserSession = function setSignInUserSession(signInUserSession) {\n    this.clearCachedTokens();\n    this.signInUserSession = signInUserSession;\n    this.cacheTokens();\n  };\n\n  /**\n   * @returns {CognitoUserSession} the current session for this user\n   */\n\n\n  CognitoUser.prototype.getSignInUserSession = function getSignInUserSession() {\n    return this.signInUserSession;\n  };\n\n  /**\n   * @returns {string} the user's username\n   */\n\n\n  CognitoUser.prototype.getUsername = function getUsername() {\n    return this.username;\n  };\n\n  /**\n   * @returns {String} the authentication flow type\n   */\n\n\n  CognitoUser.prototype.getAuthenticationFlowType = function getAuthenticationFlowType() {\n    return this.authenticationFlowType;\n  };\n\n  /**\n   * sets authentication flow type\n   * @param {string} authenticationFlowType New value.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.setAuthenticationFlowType = function setAuthenticationFlowType(authenticationFlowType) {\n    this.authenticationFlowType = authenticationFlowType;\n  };\n\n  /**\n   * This is used for authenticating the user through the custom authentication flow.\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.initiateAuth = function initiateAuth(authDetails, callback) {\n    var _this = this;\n\n    var authParameters = authDetails.getAuthParameters();\n    authParameters.USERNAME = this.username;\n\n    var jsonReq = {\n      AuthFlow: 'CUSTOM_AUTH',\n      ClientId: this.pool.getClientId(),\n      AuthParameters: authParameters,\n      ClientMetadata: authDetails.getValidationData()\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      var challengeName = data.ChallengeName;\n      var challengeParameters = data.ChallengeParameters;\n\n      if (challengeName === 'CUSTOM_CHALLENGE') {\n        _this.Session = data.Session;\n        return callback.customChallenge(challengeParameters);\n      }\n      _this.signInUserSession = _this.getCognitoUserSession(data.AuthenticationResult);\n      _this.cacheTokens();\n      return callback.onSuccess(_this.signInUserSession);\n    });\n  };\n\n  /**\n   * This is used for authenticating the user. it calls the AuthenticationHelper for SRP related\n   * stuff\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {newPasswordRequired} callback.newPasswordRequired new\n   *        password and any required attributes are required to continue\n   * @param {mfaRequired} callback.mfaRequired MFA code\n   *        required to continue.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.authenticateUser = function authenticateUser(authDetails, callback) {\n    var _this2 = this;\n\n    var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n    var dateHelper = new _DateHelper2.default();\n\n    var serverBValue = void 0;\n    var salt = void 0;\n    var authParameters = {};\n\n    if (this.deviceKey != null) {\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    authParameters.USERNAME = this.username;\n    authenticationHelper.getLargeAValue(function (errOnAValue, aValue) {\n      // getLargeAValue callback start\n      if (errOnAValue) {\n        callback.onFailure(errOnAValue);\n      }\n\n      authParameters.SRP_A = aValue.toString(16);\n\n      if (_this2.authenticationFlowType === 'CUSTOM_AUTH') {\n        authParameters.CHALLENGE_NAME = 'SRP_A';\n      }\n\n      var jsonReq = {\n        AuthFlow: _this2.authenticationFlowType,\n        ClientId: _this2.pool.getClientId(),\n        AuthParameters: authParameters,\n        ClientMetadata: authDetails.getValidationData()\n      };\n      if (_this2.getUserContextData(_this2.username)) {\n        jsonReq.UserContextData = _this2.getUserContextData(_this2.username);\n      }\n\n      _this2.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        var challengeParameters = data.ChallengeParameters;\n\n        _this2.username = challengeParameters.USER_ID_FOR_SRP;\n        serverBValue = new _BigInteger2.default(challengeParameters.SRP_B, 16);\n        salt = new _BigInteger2.default(challengeParameters.SALT, 16);\n        _this2.getCachedDeviceKeyAndPassword();\n\n        authenticationHelper.getPasswordAuthenticationKey(_this2.username, authDetails.getPassword(), serverBValue, salt, function (errOnHkdf, hkdf) {\n          // getPasswordAuthenticationKey callback start\n          if (errOnHkdf) {\n            callback.onFailure(errOnHkdf);\n          }\n\n          var dateNow = dateHelper.getNowString();\n\n          var signatureString = _global.util.crypto.hmac(hkdf, _global.util.buffer.concat([new _global.util.Buffer(_this2.pool.getUserPoolId().split('_')[1], 'utf8'), new _global.util.Buffer(_this2.username, 'utf8'), new _global.util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'), new _global.util.Buffer(dateNow, 'utf8')]), 'base64', 'sha256');\n\n          var challengeResponses = {};\n\n          challengeResponses.USERNAME = _this2.username;\n          challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n          challengeResponses.TIMESTAMP = dateNow;\n          challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n          if (_this2.deviceKey != null) {\n            challengeResponses.DEVICE_KEY = _this2.deviceKey;\n          }\n\n          var respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n            return _this2.client.makeUnauthenticatedRequest('respondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n              if (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n                challengeResponses.DEVICE_KEY = null;\n                _this2.deviceKey = null;\n                _this2.randomPassword = null;\n                _this2.deviceGroupKey = null;\n                _this2.clearCachedDeviceKeyAndPassword();\n                return respondToAuthChallenge(challenge, challengeCallback);\n              }\n              return challengeCallback(errChallenge, dataChallenge);\n            });\n          };\n\n          var jsonReqResp = {\n            ChallengeName: 'PASSWORD_VERIFIER',\n            ClientId: _this2.pool.getClientId(),\n            ChallengeResponses: challengeResponses,\n            Session: data.Session\n          };\n          if (_this2.getUserContextData()) {\n            jsonReqResp.UserContextData = _this2.getUserContextData();\n          }\n          respondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n            if (errAuthenticate) {\n              return callback.onFailure(errAuthenticate);\n            }\n\n            var challengeName = dataAuthenticate.ChallengeName;\n            if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n              _this2.Session = dataAuthenticate.Session;\n              var userAttributes = null;\n              var rawRequiredAttributes = null;\n              var requiredAttributes = [];\n              var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n              if (dataAuthenticate.ChallengeParameters) {\n                userAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n                rawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n              }\n\n              if (rawRequiredAttributes) {\n                for (var i = 0; i < rawRequiredAttributes.length; i++) {\n                  requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n                }\n              }\n              return callback.newPasswordRequired(userAttributes, requiredAttributes);\n            }\n            return _this2.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n          });\n          return undefined;\n          // getPasswordAuthenticationKey callback end\n        });\n        return undefined;\n      });\n      // getLargeAValue callback end\n    });\n  };\n\n  /**\n  * PRIVATE ONLY: This is an internal only method and should not\n  * be directly called by the consumers.\n  * @param {object} dataAuthenticate authentication data\n  * @param {object} authenticationHelper helper created\n  * @param {callback} callback passed on from caller\n  * @returns {void}\n  */\n\n\n  CognitoUser.prototype.authenticateUserInternal = function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n    var _this3 = this;\n\n    var challengeName = dataAuthenticate.ChallengeName;\n    var challengeParameters = dataAuthenticate.ChallengeParameters;\n\n    if (challengeName === 'SMS_MFA') {\n      this.Session = dataAuthenticate.Session;\n      return callback.mfaRequired(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'SELECT_MFA_TYPE') {\n      this.Session = dataAuthenticate.Session;\n      return callback.selectMFAType(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'MFA_SETUP') {\n      this.Session = dataAuthenticate.Session;\n      return callback.mfaSetup(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'SOFTWARE_TOKEN_MFA') {\n      this.Session = dataAuthenticate.Session;\n      return callback.totpRequired(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'CUSTOM_CHALLENGE') {\n      this.Session = dataAuthenticate.Session;\n      return callback.customChallenge(challengeParameters);\n    }\n\n    if (challengeName === 'DEVICE_SRP_AUTH') {\n      this.getDeviceResponse(callback);\n      return undefined;\n    }\n\n    this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n    this.cacheTokens();\n\n    var newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n    if (newDeviceMetadata == null) {\n      return callback.onSuccess(this.signInUserSession);\n    }\n\n    authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n      if (errGenHash) {\n        return callback.onFailure(errGenHash);\n      }\n\n      var deviceSecretVerifierConfig = {\n        Salt: new _global.util.Buffer(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n        PasswordVerifier: new _global.util.Buffer(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n      };\n\n      _this3.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n      _this3.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n      _this3.randomPassword = authenticationHelper.getRandomPassword();\n\n      _this3.client.makeUnauthenticatedRequest('confirmDevice', {\n        DeviceKey: newDeviceMetadata.DeviceKey,\n        AccessToken: _this3.signInUserSession.getAccessToken().getJwtToken(),\n        DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n        DeviceName: navigator.userAgent\n      }, function (errConfirm, dataConfirm) {\n        if (errConfirm) {\n          return callback.onFailure(errConfirm);\n        }\n\n        _this3.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n        _this3.cacheDeviceKeyAndPassword();\n        if (dataConfirm.UserConfirmationNecessary === true) {\n          return callback.onSuccess(_this3.signInUserSession, dataConfirm.UserConfirmationNecessary);\n        }\n        return callback.onSuccess(_this3.signInUserSession);\n      });\n      return undefined;\n    });\n    return undefined;\n  };\n\n  /**\n  * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n  * Pass the new password with any new user attributes to be updated.\n  * User attribute keys must be of format userAttributes.<attribute_name>.\n  * @param {string} newPassword new password for this user\n  * @param {object} requiredAttributeData map with values for all required attributes\n  * @param {object} callback Result callback map.\n  * @param {onFailure} callback.onFailure Called on any error.\n  * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n  * @param {customChallenge} callback.customChallenge Custom challenge\n  *         response required to continue.\n  * @param {authSuccess} callback.onSuccess Called on success with the new session.\n  * @returns {void}\n  */\n\n\n  CognitoUser.prototype.completeNewPasswordChallenge = function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback) {\n    var _this4 = this;\n\n    if (!newPassword) {\n      return callback.onFailure(new Error('New password is required.'));\n    }\n    var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n    var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n    var finalUserAttributes = {};\n    if (requiredAttributeData) {\n      Object.keys(requiredAttributeData).forEach(function (key) {\n        finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n      });\n    }\n\n    finalUserAttributes.NEW_PASSWORD = newPassword;\n    finalUserAttributes.USERNAME = this.username;\n    var jsonReq = {\n      ChallengeName: 'NEW_PASSWORD_REQUIRED',\n      ClientId: this.pool.getClientId(),\n      ChallengeResponses: finalUserAttributes,\n      Session: this.Session\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {\n      if (errAuthenticate) {\n        return callback.onFailure(errAuthenticate);\n      }\n      return _this4.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to get a session using device authentication. It is called at the end of user\n   * authentication\n   *\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   * @private\n   */\n\n\n  CognitoUser.prototype.getDeviceResponse = function getDeviceResponse(callback) {\n    var _this5 = this;\n\n    var authenticationHelper = new _AuthenticationHelper2.default(this.deviceGroupKey);\n    var dateHelper = new _DateHelper2.default();\n\n    var authParameters = {};\n\n    authParameters.USERNAME = this.username;\n    authParameters.DEVICE_KEY = this.deviceKey;\n    authenticationHelper.getLargeAValue(function (errAValue, aValue) {\n      // getLargeAValue callback start\n      if (errAValue) {\n        callback.onFailure(errAValue);\n      }\n\n      authParameters.SRP_A = aValue.toString(16);\n\n      var jsonReq = {\n        ChallengeName: 'DEVICE_SRP_AUTH',\n        ClientId: _this5.pool.getClientId(),\n        ChallengeResponses: authParameters\n      };\n      if (_this5.getUserContextData()) {\n        jsonReq.UserContextData = _this5.getUserContextData();\n      }\n      _this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        var challengeParameters = data.ChallengeParameters;\n\n        var serverBValue = new _BigInteger2.default(challengeParameters.SRP_B, 16);\n        var salt = new _BigInteger2.default(challengeParameters.SALT, 16);\n\n        authenticationHelper.getPasswordAuthenticationKey(_this5.deviceKey, _this5.randomPassword, serverBValue, salt, function (errHkdf, hkdf) {\n          // getPasswordAuthenticationKey callback start\n          if (errHkdf) {\n            return callback.onFailure(errHkdf);\n          }\n\n          var dateNow = dateHelper.getNowString();\n\n          var signatureString = _global.util.crypto.hmac(hkdf, _global.util.buffer.concat([new _global.util.Buffer(_this5.deviceGroupKey, 'utf8'), new _global.util.Buffer(_this5.deviceKey, 'utf8'), new _global.util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'), new _global.util.Buffer(dateNow, 'utf8')]), 'base64', 'sha256');\n\n          var challengeResponses = {};\n\n          challengeResponses.USERNAME = _this5.username;\n          challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n          challengeResponses.TIMESTAMP = dateNow;\n          challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n          challengeResponses.DEVICE_KEY = _this5.deviceKey;\n\n          var jsonReqResp = {\n            ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n            ClientId: _this5.pool.getClientId(),\n            ChallengeResponses: challengeResponses,\n            Session: data.Session\n          };\n          if (_this5.getUserContextData()) {\n            jsonReqResp.UserContextData = _this5.getUserContextData();\n          }\n\n          _this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n            if (errAuthenticate) {\n              return callback.onFailure(errAuthenticate);\n            }\n\n            _this5.signInUserSession = _this5.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n            _this5.cacheTokens();\n\n            return callback.onSuccess(_this5.signInUserSession);\n          });\n          return undefined;\n          // getPasswordAuthenticationKey callback end\n        });\n        return undefined;\n      });\n      // getLargeAValue callback end\n    });\n  };\n\n  /**\n   * This is used for a certain user to confirm the registration by using a confirmation code\n   * @param {string} confirmationCode Code entered by user.\n   * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      ConfirmationCode: confirmationCode,\n      Username: this.username,\n      ForceAliasCreation: forceAliasCreation\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('confirmSignUp', jsonReq, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n  };\n\n  /**\n   * This is used by the user once he has the responses to a custom challenge\n   * @param {string} answerChallenge The custom challange answer.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {customChallenge} callback.customChallenge\n   *    Custom challenge response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.sendCustomChallengeAnswer = function sendCustomChallengeAnswer(answerChallenge, callback) {\n    var _this6 = this;\n\n    var challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.ANSWER = answerChallenge;\n\n    var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n    this.getCachedDeviceKeyAndPassword();\n    if (this.deviceKey != null) {\n      challengeResponses.DEVICE_KEY = this.deviceKey;\n    }\n\n    var jsonReq = {\n      ChallengeName: 'CUSTOM_CHALLENGE',\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return _this6.authenticateUserInternal(data, authenticationHelper, callback);\n    });\n  };\n\n  /**\n   * This is used by the user once he has an MFA code\n   * @param {string} confirmationCode The MFA code entered by the user.\n   * @param {object} callback Result callback map.\n   * @param {string} mfaType The mfa we are replying to.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.sendMFACode = function sendMFACode(confirmationCode, callback, mfaType) {\n    var _this7 = this;\n\n    var challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.SMS_MFA_CODE = confirmationCode;\n    var mfaTypeSelection = mfaType || 'SMS_MFA';\n    if (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n      challengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n    }\n\n    if (this.deviceKey != null) {\n      challengeResponses.DEVICE_KEY = this.deviceKey;\n    }\n\n    var jsonReq = {\n      ChallengeName: mfaTypeSelection,\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      var challengeName = dataAuthenticate.ChallengeName;\n\n      if (challengeName === 'DEVICE_SRP_AUTH') {\n        _this7.getDeviceResponse(callback);\n        return undefined;\n      }\n\n      _this7.signInUserSession = _this7.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n      _this7.cacheTokens();\n\n      if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n        return callback.onSuccess(_this7.signInUserSession);\n      }\n\n      var authenticationHelper = new _AuthenticationHelper2.default(_this7.pool.getUserPoolId().split('_')[1]);\n      authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n        if (errGenHash) {\n          return callback.onFailure(errGenHash);\n        }\n\n        var deviceSecretVerifierConfig = {\n          Salt: new _global.util.Buffer(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n          PasswordVerifier: new _global.util.Buffer(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n        };\n\n        _this7.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n        _this7.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n        _this7.randomPassword = authenticationHelper.getRandomPassword();\n\n        _this7.client.makeUnauthenticatedRequest('confirmDevice', {\n          DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n          AccessToken: _this7.signInUserSession.getAccessToken().getJwtToken(),\n          DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n          DeviceName: navigator.userAgent\n        }, function (errConfirm, dataConfirm) {\n          if (errConfirm) {\n            return callback.onFailure(errConfirm);\n          }\n\n          _this7.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n          _this7.cacheDeviceKeyAndPassword();\n          if (dataConfirm.UserConfirmationNecessary === true) {\n            return callback.onSuccess(_this7.signInUserSession, dataConfirm.UserConfirmationNecessary);\n          }\n          return callback.onSuccess(_this7.signInUserSession);\n        });\n        return undefined;\n      });\n      return undefined;\n    });\n  };\n\n  /**\n   * This is used by an authenticated user to change the current password\n   * @param {string} oldUserPassword The current password.\n   * @param {string} newUserPassword The requested new password.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.changePassword = function changePassword(oldUserPassword, newUserPassword, callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('changePassword', {\n      PreviousPassword: oldUserPassword,\n      ProposedPassword: newUserPassword,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to enable MFA for himself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.enableMFA = function enableMFA(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    var mfaOptions = [];\n    var mfaEnabled = {\n      DeliveryMedium: 'SMS',\n      AttributeName: 'phone_number'\n    };\n    mfaOptions.push(mfaEnabled);\n\n    this.client.makeUnauthenticatedRequest('setUserSettings', {\n      MFAOptions: mfaOptions,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to enable MFA for himself\n   * @param {string[]} smsMfaSettings the sms mfa settings\n   * @param {string[]} softwareTokenMfaSettings the software token mfa settings\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.setUserMfaPreference = function setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('setUserMFAPreference', {\n      SMSMfaSettings: smsMfaSettings,\n      SoftwareTokenMfaSettings: softwareTokenMfaSettings,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to disable MFA for himself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.disableMFA = function disableMFA(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    var mfaOptions = [];\n\n    this.client.makeUnauthenticatedRequest('setUserSettings', {\n      MFAOptions: mfaOptions,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to delete himself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.deleteUser = function deleteUser(callback) {\n    var _this8 = this;\n\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('deleteUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      _this8.clearCachedTokens();\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n   */\n  /**\n   * This is used by an authenticated user to change a list of attributes\n   * @param {AttributeArg[]} attributes A list of the new user attributes.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.updateAttributes = function updateAttributes(attributes, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('updateUserAttributes', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      UserAttributes: attributes\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to get a list of attributes\n   * @param {nodeCallback<CognitoUserAttribute[]>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getUserAttributes = function getUserAttributes(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('getUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err, userData) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      var attributeList = [];\n\n      for (var i = 0; i < userData.UserAttributes.length; i++) {\n        var attribute = {\n          Name: userData.UserAttributes[i].Name,\n          Value: userData.UserAttributes[i].Value\n        };\n        var userAttribute = new _CognitoUserAttribute2.default(attribute);\n        attributeList.push(userAttribute);\n      }\n\n      return callback(null, attributeList);\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to get the MFAOptions\n   * @param {nodeCallback<MFAOptions>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getMFAOptions = function getMFAOptions(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('getUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err, userData) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, userData.MFAOptions);\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by an authenticated user to delete a list of attributes\n   * @param {string[]} attributeList Names of the attributes to delete.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.deleteAttributes = function deleteAttributes(attributeList, callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('deleteUserAttributes', {\n      UserAttributeNames: attributeList,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used by a user to resend a confirmation code\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.resendConfirmationCode = function resendConfirmationCode(callback) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username\n    };\n\n    this.client.makeUnauthenticatedRequest('resendConfirmationCode', jsonReq, function (err, result) {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, result);\n    });\n  };\n\n  /**\n   * This is used to get a session, either from the session object\n   * or from  the local storage, or by using a refresh token\n   *\n   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getSession = function getSession(callback) {\n    if (this.username == null) {\n      return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n    }\n\n    if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n      return callback(null, this.signInUserSession);\n    }\n\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n    var idTokenKey = keyPrefix + '.idToken';\n    var accessTokenKey = keyPrefix + '.accessToken';\n    var refreshTokenKey = keyPrefix + '.refreshToken';\n    var clockDriftKey = keyPrefix + '.clockDrift';\n\n    if (this.storage.getItem(idTokenKey)) {\n      var idToken = new _CognitoIdToken2.default({\n        IdToken: this.storage.getItem(idTokenKey)\n      });\n      var accessToken = new _CognitoAccessToken2.default({\n        AccessToken: this.storage.getItem(accessTokenKey)\n      });\n      var refreshToken = new _CognitoRefreshToken2.default({\n        RefreshToken: this.storage.getItem(refreshTokenKey)\n      });\n      var clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n\n      var sessionData = {\n        IdToken: idToken,\n        AccessToken: accessToken,\n        RefreshToken: refreshToken,\n        ClockDrift: clockDrift\n      };\n      var cachedSession = new _CognitoUserSession2.default(sessionData);\n      if (cachedSession.isValid()) {\n        this.signInUserSession = cachedSession;\n        return callback(null, this.signInUserSession);\n      }\n\n      if (refreshToken.getToken() == null) {\n        return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n      }\n\n      this.refreshSession(refreshToken, callback);\n    } else {\n      callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n    }\n\n    return undefined;\n  };\n\n  /**\n   * This uses the refreshToken to retrieve a new session\n   * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.refreshSession = function refreshSession(refreshToken, callback) {\n    var _this9 = this;\n\n    var authParameters = {};\n    authParameters.REFRESH_TOKEN = refreshToken.getToken();\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n    var lastUserKey = keyPrefix + '.LastAuthUser';\n\n    if (this.storage.getItem(lastUserKey)) {\n      this.username = this.storage.getItem(lastUserKey);\n      var deviceKeyKey = keyPrefix + '.' + this.username + '.deviceKey';\n      this.deviceKey = this.storage.getItem(deviceKeyKey);\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      AuthFlow: 'REFRESH_TOKEN_AUTH',\n      AuthParameters: authParameters\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, authResult) {\n      if (err) {\n        if (err.code === 'NotAuthorizedException') {\n          _this9.clearCachedTokens();\n        }\n        return callback(err, null);\n      }\n      if (authResult) {\n        var authenticationResult = authResult.AuthenticationResult;\n        if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n          authenticationResult.RefreshToken = refreshToken.getToken();\n        }\n        _this9.signInUserSession = _this9.getCognitoUserSession(authenticationResult);\n        _this9.cacheTokens();\n        return callback(null, _this9.signInUserSession);\n      }\n      return undefined;\n    });\n  };\n\n  /**\n   * This is used to save the session tokens to local storage\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.cacheTokens = function cacheTokens() {\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n    var idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n    var accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n    var refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n    var clockDriftKey = keyPrefix + '.' + this.username + '.clockDrift';\n    var lastUserKey = keyPrefix + '.LastAuthUser';\n\n    this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n    this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n    this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n    this.storage.setItem(clockDriftKey, '' + this.signInUserSession.getClockDrift());\n    this.storage.setItem(lastUserKey, this.username);\n  };\n\n  /**\n   * This is used to cache the device key and device group and device password\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.cacheDeviceKeyAndPassword = function cacheDeviceKeyAndPassword() {\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n    var deviceKeyKey = keyPrefix + '.deviceKey';\n    var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n    var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n    this.storage.setItem(deviceKeyKey, this.deviceKey);\n    this.storage.setItem(randomPasswordKey, this.randomPassword);\n    this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n  };\n\n  /**\n   * This is used to get current device key and device group and device password\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getCachedDeviceKeyAndPassword = function getCachedDeviceKeyAndPassword() {\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n    var deviceKeyKey = keyPrefix + '.deviceKey';\n    var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n    var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n    if (this.storage.getItem(deviceKeyKey)) {\n      this.deviceKey = this.storage.getItem(deviceKeyKey);\n      this.randomPassword = this.storage.getItem(randomPasswordKey);\n      this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n    }\n  };\n\n  /**\n   * This is used to clear the device key info from local storage\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.clearCachedDeviceKeyAndPassword = function clearCachedDeviceKeyAndPassword() {\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n    var deviceKeyKey = keyPrefix + '.deviceKey';\n    var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n    var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n    this.storage.removeItem(deviceKeyKey);\n    this.storage.removeItem(randomPasswordKey);\n    this.storage.removeItem(deviceGroupKeyKey);\n  };\n\n  /**\n   * This is used to clear the session tokens from local storage\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.clearCachedTokens = function clearCachedTokens() {\n    var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n    var idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n    var accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n    var refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n    var lastUserKey = keyPrefix + '.LastAuthUser';\n\n    this.storage.removeItem(idTokenKey);\n    this.storage.removeItem(accessTokenKey);\n    this.storage.removeItem(refreshTokenKey);\n    this.storage.removeItem(lastUserKey);\n  };\n\n  /**\n   * This is used to build a user session from tokens retrieved in the authentication result\n   * @param {object} authResult Successful auth response from server.\n   * @returns {CognitoUserSession} The new user session.\n   * @private\n   */\n\n\n  CognitoUser.prototype.getCognitoUserSession = function getCognitoUserSession(authResult) {\n    var idToken = new _CognitoIdToken2.default(authResult);\n    var accessToken = new _CognitoAccessToken2.default(authResult);\n    var refreshToken = new _CognitoRefreshToken2.default(authResult);\n\n    var sessionData = {\n      IdToken: idToken,\n      AccessToken: accessToken,\n      RefreshToken: refreshToken\n    };\n\n    return new _CognitoUserSession2.default(sessionData);\n  };\n\n  /**\n   * This is used to initiate a forgot password request\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {inputVerificationCode?} callback.inputVerificationCode\n   *    Optional callback raised instead of onSuccess with response data.\n   * @param {onSuccess} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.forgotPassword = function forgotPassword(callback) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('forgotPassword', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      if (typeof callback.inputVerificationCode === 'function') {\n        return callback.inputVerificationCode(data);\n      }\n      return callback.onSuccess(data);\n    });\n  };\n\n  /**\n   * This is used to confirm a new password using a confirmationCode\n   * @param {string} confirmationCode Code entered by user.\n   * @param {string} newPassword Confirm new password.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<void>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n      ConfirmationCode: confirmationCode,\n      Password: newPassword\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('confirmForgotPassword', jsonReq, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess();\n    });\n  };\n\n  /**\n   * This is used to initiate an attribute confirmation request\n   * @param {string} attributeName User attribute that needs confirmation.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getAttributeVerificationCode = function getAttributeVerificationCode(attributeName, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('getUserAttributeVerificationCode', {\n      AttributeName: attributeName,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      if (typeof callback.inputVerificationCode === 'function') {\n        return callback.inputVerificationCode(data);\n      }\n      return callback.onSuccess();\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to confirm an attribute using a confirmation code\n   * @param {string} attributeName Attribute being confirmed.\n   * @param {string} confirmationCode Code entered by user.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.verifyAttribute = function verifyAttribute(attributeName, confirmationCode, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('verifyUserAttribute', {\n      AttributeName: attributeName,\n      Code: confirmationCode,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to get the device information using the current device key\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getDevice = function getDevice(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('getDevice', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey\n    }, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess(data);\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to forget a specific device\n   * @param {string} deviceKey Device key.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.forgetSpecificDevice = function forgetSpecificDevice(deviceKey, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('forgetDevice', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: deviceKey\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to forget the current device\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.forgetDevice = function forgetDevice(callback) {\n    var _this10 = this;\n\n    this.forgetSpecificDevice(this.deviceKey, {\n      onFailure: callback.onFailure,\n      onSuccess: function onSuccess(result) {\n        _this10.deviceKey = null;\n        _this10.deviceGroupKey = null;\n        _this10.randomPassword = null;\n        _this10.clearCachedDeviceKeyAndPassword();\n        return callback.onSuccess(result);\n      }\n    });\n  };\n\n  /**\n   * This is used to set the device status as remembered\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.setDeviceStatusRemembered = function setDeviceStatusRemembered(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n      DeviceRememberedStatus: 'remembered'\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to set the device status as not remembered\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.setDeviceStatusNotRemembered = function setDeviceStatusNotRemembered(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n      DeviceRememberedStatus: 'not_remembered'\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to list all devices for a user\n   *\n   * @param {int} limit the number of devices returned in a call\n   * @param {string} paginationToken the pagination token in case any was returned before\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.listDevices = function listDevices(limit, paginationToken, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('listDevices', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      Limit: limit,\n      PaginationToken: paginationToken\n    }, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess(data);\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used to globally revoke all tokens issued to a user\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.globalSignOut = function globalSignOut(callback) {\n    var _this11 = this;\n\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('globalSignOut', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      _this11.clearCachedTokens();\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  };\n\n  /**\n   * This is used for the user to signOut of the application and clear the cached tokens.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.signOut = function signOut() {\n    this.signInUserSession = null;\n    this.clearCachedTokens();\n  };\n\n  /**\n   * This is used by a user trying to select a given MFA\n   * @param {string} answerChallenge the mfa the user wants\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.sendMFASelectionAnswer = function sendMFASelectionAnswer(answerChallenge, callback) {\n    var _this12 = this;\n\n    var challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.ANSWER = answerChallenge;\n\n    var jsonReq = {\n      ChallengeName: 'SELECT_MFA_TYPE',\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      _this12.Session = data.Session;\n      if (answerChallenge === 'SMS_MFA') {\n        return callback.mfaRequired(data.challengeName, data.challengeParameters);\n      }\n      if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n        return callback.totpRequired(data.challengeName, data.challengeParameters);\n      }\n      return undefined;\n    });\n  };\n\n  /**\n   * This returns the user context data for advanced security feature.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.getUserContextData = function getUserContextData() {\n    var pool = this.pool;\n    return pool.getUserContextData(this.username);\n  };\n\n  /**\n   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.associateSoftwareToken = function associateSoftwareToken(callback) {\n    var _this13 = this;\n\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.client.makeUnauthenticatedRequest('associateSoftwareToken', {\n        Session: this.Session\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        _this13.Session = data.Session;\n        return callback.associateSecretCode(data.SecretCode);\n      });\n    } else {\n      this.client.makeUnauthenticatedRequest('associateSoftwareToken', {\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        return callback.associateSecretCode(data.SecretCode);\n      });\n    }\n  };\n\n  /**\n   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n   * @param {string} totpCode The MFA code entered by the user.\n   * @param {string} friendlyDeviceName The device name we are assigning to the device.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n\n\n  CognitoUser.prototype.verifySoftwareToken = function verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n    var _this14 = this;\n\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.client.makeUnauthenticatedRequest('verifySoftwareToken', {\n        Session: this.Session,\n        UserCode: totpCode,\n        FriendlyDeviceName: friendlyDeviceName\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        _this14.Session = data.Session;\n        var challengeResponses = {};\n        challengeResponses.USERNAME = _this14.username;\n        var jsonReq = {\n          ChallengeName: 'MFA_SETUP',\n          ClientId: _this14.pool.getClientId(),\n          ChallengeResponses: challengeResponses,\n          Session: _this14.Session\n        };\n        if (_this14.getUserContextData()) {\n          jsonReq.UserContextData = _this14.getUserContextData();\n        }\n        _this14.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {\n          if (errRespond) {\n            return callback.onFailure(errRespond);\n          }\n          _this14.signInUserSession = _this14.getCognitoUserSession(dataRespond.AuthenticationResult);\n          _this14.cacheTokens();\n          return callback.onSuccess(_this14.signInUserSession);\n        });\n        return undefined;\n      });\n    } else {\n      this.client.makeUnauthenticatedRequest('verifySoftwareToken', {\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n        UserCode: totpCode,\n        FriendlyDeviceName: friendlyDeviceName\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        return callback(null, data);\n      });\n    }\n  };\n\n  return CognitoUser;\n}();\n\nexports.default = CognitoUser;"
  },
  {
    "path": "lib/CognitoUserAttribute.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar CognitoUserAttribute = function () {\n  /**\n   * Constructs a new CognitoUserAttribute object\n   * @param {string=} Name The record's name\n   * @param {string=} Value The record's value\n   */\n  function CognitoUserAttribute() {\n    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n        Name = _ref.Name,\n        Value = _ref.Value;\n\n    _classCallCheck(this, CognitoUserAttribute);\n\n    this.Name = Name || '';\n    this.Value = Value || '';\n  }\n\n  /**\n   * @returns {string} the record's value.\n   */\n\n\n  CognitoUserAttribute.prototype.getValue = function getValue() {\n    return this.Value;\n  };\n\n  /**\n   * Sets the record's value.\n   * @param {string} value The new value.\n   * @returns {CognitoUserAttribute} The record for method chaining.\n   */\n\n\n  CognitoUserAttribute.prototype.setValue = function setValue(value) {\n    this.Value = value;\n    return this;\n  };\n\n  /**\n   * @returns {string} the record's name.\n   */\n\n\n  CognitoUserAttribute.prototype.getName = function getName() {\n    return this.Name;\n  };\n\n  /**\n   * Sets the record's name\n   * @param {string} name The new name.\n   * @returns {CognitoUserAttribute} The record for method chaining.\n   */\n\n\n  CognitoUserAttribute.prototype.setName = function setName(name) {\n    this.Name = name;\n    return this;\n  };\n\n  /**\n   * @returns {string} a string representation of the record.\n   */\n\n\n  CognitoUserAttribute.prototype.toString = function toString() {\n    return JSON.stringify(this);\n  };\n\n  /**\n   * @returns {object} a flat object representing the record.\n   */\n\n\n  CognitoUserAttribute.prototype.toJSON = function toJSON() {\n    return {\n      Name: this.Name,\n      Value: this.Value\n    };\n  };\n\n  return CognitoUserAttribute;\n}();\n\nexports.default = CognitoUserAttribute;"
  },
  {
    "path": "lib/CognitoUserPool.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _cognitoidentityserviceprovider = require('aws-sdk/clients/cognitoidentityserviceprovider');\n\nvar _cognitoidentityserviceprovider2 = _interopRequireDefault(_cognitoidentityserviceprovider);\n\nvar _CognitoUser = require('./CognitoUser');\n\nvar _CognitoUser2 = _interopRequireDefault(_CognitoUser);\n\nvar _StorageHelper = require('./StorageHelper');\n\nvar _StorageHelper2 = _interopRequireDefault(_StorageHelper);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n                                                                                                                                                           * Copyright 2016 Amazon.com,\n                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                           *\n                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                           * You may not use this file except in compliance with the\n                                                                                                                                                           * License. A copy of the License is located at\n                                                                                                                                                           *\n                                                                                                                                                           *     http://aws.amazon.com/asl/\n                                                                                                                                                           *\n                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                           * for the specific language governing permissions and\n                                                                                                                                                           * limitations under the License.\n                                                                                                                                                           */\n\n/** @class */\nvar CognitoUserPool = function () {\n  /**\n   * Constructs a new CognitoUserPool object\n   * @param {object} data Creation options.\n   * @param {string} data.UserPoolId Cognito user pool id.\n   * @param {string} data.ClientId User pool application client id.\n   * @param {object} data.Storage Optional storage object.\n   * @param {boolean} data.AdvancedSecurityDataCollectionFlag Optional:\n   *        boolean flag indicating if the data collection is enabled\n   *        to support cognito advanced security features. By default, this\n   *        flag is set to true.\n   */\n  function CognitoUserPool(data) {\n    _classCallCheck(this, CognitoUserPool);\n\n    var _ref = data || {},\n        UserPoolId = _ref.UserPoolId,\n        ClientId = _ref.ClientId,\n        endpoint = _ref.endpoint,\n        AdvancedSecurityDataCollectionFlag = _ref.AdvancedSecurityDataCollectionFlag;\n\n    if (!UserPoolId || !ClientId) {\n      throw new Error('Both UserPoolId and ClientId are required.');\n    }\n    if (!/^[\\w-]+_.+$/.test(UserPoolId)) {\n      throw new Error('Invalid UserPoolId format.');\n    }\n    var region = UserPoolId.split('_')[0];\n\n    this.userPoolId = UserPoolId;\n    this.clientId = ClientId;\n\n    this.client = new _cognitoidentityserviceprovider2.default({\n      apiVersion: '2016-04-19',\n      region: region,\n      endpoint: endpoint\n    });\n\n    /**\n     * By default, AdvancedSecurityDataCollectionFlag is set to true,\n     * if no input value is provided.\n     */\n    this.advancedSecurityDataCollectionFlag = AdvancedSecurityDataCollectionFlag !== false;\n\n    this.storage = data.Storage || new _StorageHelper2.default().getStorage();\n  }\n\n  /**\n   * @returns {string} the user pool id\n   */\n\n\n  CognitoUserPool.prototype.getUserPoolId = function getUserPoolId() {\n    return this.userPoolId;\n  };\n\n  /**\n   * @returns {string} the client id\n   */\n\n\n  CognitoUserPool.prototype.getClientId = function getClientId() {\n    return this.clientId;\n  };\n\n  /**\n   * @typedef {object} SignUpResult\n   * @property {CognitoUser} user New user.\n   * @property {bool} userConfirmed If the user is already confirmed.\n   */\n  /**\n   * method for signing up a user\n   * @param {string} username User's username.\n   * @param {string} password Plain-text initial password entered by user.\n   * @param {(AttributeArg[])=} userAttributes New user attributes.\n   * @param {(AttributeArg[])=} validationData Application metadata.\n   * @param {nodeCallback<SignUpResult>} callback Called on error or with the new user.\n   * @returns {void}\n   */\n\n\n  CognitoUserPool.prototype.signUp = function signUp(username, password, userAttributes, validationData, callback) {\n    var _this = this;\n\n    var jsonReq = {\n      ClientId: this.clientId,\n      Username: username,\n      Password: password,\n      UserAttributes: userAttributes,\n      ValidationData: validationData\n    };\n    if (this.getUserContextData(username)) {\n      jsonReq.UserContextData = this.getUserContextData(username);\n    }\n    this.client.makeUnauthenticatedRequest('signUp', jsonReq, function (err, data) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      var cognitoUser = {\n        Username: username,\n        Pool: _this,\n        Storage: _this.storage\n      };\n\n      var returnData = {\n        user: new _CognitoUser2.default(cognitoUser),\n        userConfirmed: data.UserConfirmed,\n        userSub: data.UserSub\n      };\n\n      return callback(null, returnData);\n    });\n  };\n\n  /**\n   * method for getting the current user of the application from the local storage\n   *\n   * @returns {CognitoUser} the user retrieved from storage\n   */\n\n\n  CognitoUserPool.prototype.getCurrentUser = function getCurrentUser() {\n    var lastUserKey = 'CognitoIdentityServiceProvider.' + this.clientId + '.LastAuthUser';\n\n    var lastAuthUser = this.storage.getItem(lastUserKey);\n    if (lastAuthUser) {\n      var cognitoUser = {\n        Username: lastAuthUser,\n        Pool: this,\n        Storage: this.storage\n      };\n\n      return new _CognitoUser2.default(cognitoUser);\n    }\n\n    return null;\n  };\n\n  /**\n   * This method returns the encoded data string used for cognito advanced security feature.\n   * This would be generated only when developer has included the JS used for collecting the\n   * data on their client. Please refer to documentation to know more about using AdvancedSecurity\n   * features\n   * @param {string} username the username for the context data\n   * @returns {string} the user context data\n   **/\n\n\n  CognitoUserPool.prototype.getUserContextData = function getUserContextData(username) {\n    if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {\n      return undefined;\n    }\n    /* eslint-disable */\n    var amazonCognitoAdvancedSecurityDataConst = AmazonCognitoAdvancedSecurityData;\n    /* eslint-enable */\n\n    if (this.advancedSecurityDataCollectionFlag) {\n      var advancedSecurityData = amazonCognitoAdvancedSecurityDataConst.getData(username, this.userPoolId, this.clientId);\n      if (advancedSecurityData) {\n        var userContextData = {\n          EncodedData: advancedSecurityData\n        };\n        return userContextData;\n      }\n    }\n    return {};\n  };\n\n  return CognitoUserPool;\n}();\n\nexports.default = CognitoUserPool;"
  },
  {
    "path": "lib/CognitoUserSession.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar CognitoUserSession = function () {\n  /**\n   * Constructs a new CognitoUserSession object\n   * @param {CognitoIdToken} IdToken The session's Id token.\n   * @param {CognitoRefreshToken=} RefreshToken The session's refresh token.\n   * @param {CognitoAccessToken} AccessToken The session's access token.\n   * @param {int} ClockDrift The saved computer's clock drift or undefined to force calculation.\n   */\n  function CognitoUserSession() {\n    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n        IdToken = _ref.IdToken,\n        RefreshToken = _ref.RefreshToken,\n        AccessToken = _ref.AccessToken,\n        ClockDrift = _ref.ClockDrift;\n\n    _classCallCheck(this, CognitoUserSession);\n\n    if (AccessToken == null || IdToken == null) {\n      throw new Error('Id token and Access Token must be present.');\n    }\n\n    this.idToken = IdToken;\n    this.refreshToken = RefreshToken;\n    this.accessToken = AccessToken;\n    this.clockDrift = ClockDrift === undefined ? this.calculateClockDrift() : ClockDrift;\n  }\n\n  /**\n   * @returns {CognitoIdToken} the session's Id token\n   */\n\n\n  CognitoUserSession.prototype.getIdToken = function getIdToken() {\n    return this.idToken;\n  };\n\n  /**\n   * @returns {CognitoRefreshToken} the session's refresh token\n   */\n\n\n  CognitoUserSession.prototype.getRefreshToken = function getRefreshToken() {\n    return this.refreshToken;\n  };\n\n  /**\n   * @returns {CognitoAccessToken} the session's access token\n   */\n\n\n  CognitoUserSession.prototype.getAccessToken = function getAccessToken() {\n    return this.accessToken;\n  };\n\n  /**\n   * @returns {int} the session's clock drift\n   */\n\n\n  CognitoUserSession.prototype.getClockDrift = function getClockDrift() {\n    return this.clockDrift;\n  };\n\n  /**\n   * @returns {int} the computer's clock drift\n   */\n\n\n  CognitoUserSession.prototype.calculateClockDrift = function calculateClockDrift() {\n    var now = Math.floor(new Date() / 1000);\n    var iat = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt());\n\n    return now - iat;\n  };\n\n  /**\n   * Checks to see if the session is still valid based on session expiry information found\n   * in tokens and the current time (adjusted with clock drift)\n   * @returns {boolean} if the session is still valid\n   */\n\n\n  CognitoUserSession.prototype.isValid = function isValid() {\n    var now = Math.floor(new Date() / 1000);\n    var adjusted = now - this.clockDrift;\n\n    return adjusted < this.accessToken.getExpiration() && adjusted < this.idToken.getExpiration();\n  };\n\n  return CognitoUserSession;\n}();\n\nexports.default = CognitoUserSession;"
  },
  {
    "path": "lib/CookieStorage.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _jsCookie = require('js-cookie');\n\nvar Cookies = _interopRequireWildcard(_jsCookie);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/** @class */\nvar CookieStorage = function () {\n\n  /**\n   * Constructs a new CookieStorage object\n   * @param {object} data Creation options.\n   * @param {string} data.domain Cookies domain (mandatory).\n   * @param {string} data.path Cookies path (default: '/')\n   * @param {integer} data.expires Cookie expiration (in days, default: 365)\n   * @param {boolean} data.secure Cookie secure flag (default: true)\n   */\n  function CookieStorage(data) {\n    _classCallCheck(this, CookieStorage);\n\n    this.domain = data.domain;\n    if (data.path) {\n      this.path = data.path;\n    } else {\n      this.path = '/';\n    }\n    if (Object.prototype.hasOwnProperty.call(data, 'expires')) {\n      this.expires = data.expires;\n    } else {\n      this.expires = 365;\n    }\n    if (Object.prototype.hasOwnProperty.call(data, 'secure')) {\n      this.secure = data.secure;\n    } else {\n      this.secure = true;\n    }\n  }\n\n  /**\n   * This is used to set a specific item in storage\n   * @param {string} key - the key for the item\n   * @param {object} value - the value\n   * @returns {string} value that was set\n   */\n\n\n  CookieStorage.prototype.setItem = function setItem(key, value) {\n    Cookies.set(key, value, {\n      path: this.path,\n      expires: this.expires,\n      domain: this.domain,\n      secure: this.secure\n    });\n    return Cookies.get(key);\n  };\n\n  /**\n   * This is used to get a specific key from storage\n   * @param {string} key - the key for the item\n   * This is used to clear the storage\n   * @returns {string} the data item\n   */\n\n\n  CookieStorage.prototype.getItem = function getItem(key) {\n    return Cookies.get(key);\n  };\n\n  /**\n   * This is used to remove an item from storage\n   * @param {string} key - the key being set\n   * @returns {string} value - value that was deleted\n   */\n\n\n  CookieStorage.prototype.removeItem = function removeItem(key) {\n    return Cookies.remove(key, {\n      path: this.path,\n      domain: this.domain,\n      secure: this.secure\n    });\n  };\n\n  /**\n   * This is used to clear the storage\n   * @returns {string} nothing\n   */\n\n\n  CookieStorage.prototype.clear = function clear() {\n    var cookies = Cookies.get();\n    var index = void 0;\n    for (index = 0; index < cookies.length; ++index) {\n      Cookies.remove(cookies[index]);\n    }\n    return {};\n  };\n\n  return CookieStorage;\n}();\n\nexports.default = CookieStorage;"
  },
  {
    "path": "lib/DateHelper.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nvar weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n/** @class */\n\nvar DateHelper = function () {\n  function DateHelper() {\n    _classCallCheck(this, DateHelper);\n  }\n\n  /**\n   * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n   */\n  DateHelper.prototype.getNowString = function getNowString() {\n    var now = new Date();\n\n    var weekDay = weekNames[now.getUTCDay()];\n    var month = monthNames[now.getUTCMonth()];\n    var day = now.getUTCDate();\n\n    var hours = now.getUTCHours();\n    if (hours < 10) {\n      hours = '0' + hours;\n    }\n\n    var minutes = now.getUTCMinutes();\n    if (minutes < 10) {\n      minutes = '0' + minutes;\n    }\n\n    var seconds = now.getUTCSeconds();\n    if (seconds < 10) {\n      seconds = '0' + seconds;\n    }\n\n    var year = now.getUTCFullYear();\n\n    // ddd MMM D HH:mm:ss UTC YYYY\n    var dateNow = weekDay + ' ' + month + ' ' + day + ' ' + hours + ':' + minutes + ':' + seconds + ' UTC ' + year;\n\n    return dateNow;\n  };\n\n  return DateHelper;\n}();\n\nexports.default = DateHelper;"
  },
  {
    "path": "lib/StorageHelper-rn.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _reactNative = require('react-native');\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /*!\n                                                                                                                                                           * Copyright 2016 Amazon.com,\n                                                                                                                                                           * Inc. or its affiliates. All Rights Reserved.\n                                                                                                                                                           *\n                                                                                                                                                           * Licensed under the Amazon Software License (the \"License\").\n                                                                                                                                                           * You may not use this file except in compliance with the\n                                                                                                                                                           * License. A copy of the License is located at\n                                                                                                                                                           *\n                                                                                                                                                           *     http://aws.amazon.com/asl/\n                                                                                                                                                           *\n                                                                                                                                                           * or in the \"license\" file accompanying this file. This file is\n                                                                                                                                                           * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n                                                                                                                                                           * CONDITIONS OF ANY KIND, express or implied. See the License\n                                                                                                                                                           * for the specific language governing permissions and\n                                                                                                                                                           * limitations under the License.\n                                                                                                                                                           */\n\nvar MEMORY_KEY_PREFIX = '@MemoryStorage:';\nvar dataMemory = {};\n\n/** @class */\n\nvar MemoryStorage = function () {\n  function MemoryStorage() {\n    _classCallCheck(this, MemoryStorage);\n  }\n\n  /**\n   * This is used to set a specific item in storage\n   * @param {string} key - the key for the item\n   * @param {object} value - the value\n   * @returns {string} value that was set\n   */\n  MemoryStorage.setItem = function setItem(key, value) {\n    _reactNative.AsyncStorage.setItem(MEMORY_KEY_PREFIX + key, value);\n    dataMemory[key] = value;\n    return dataMemory[key];\n  };\n\n  /**\n   * This is used to get a specific key from storage\n   * @param {string} key - the key for the item\n   * This is used to clear the storage\n   * @returns {string} the data item\n   */\n\n\n  MemoryStorage.getItem = function getItem(key) {\n    return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n  };\n\n  /**\n   * This is used to remove an item from storage\n   * @param {string} key - the key being set\n   * @returns {string} value - value that was deleted\n   */\n\n\n  MemoryStorage.removeItem = function removeItem(key) {\n    _reactNative.AsyncStorage.removeItem(MEMORY_KEY_PREFIX + key);\n    return delete dataMemory[key];\n  };\n\n  /**\n   * This is used to clear the storage\n   * @returns {string} nothing\n   */\n\n\n  MemoryStorage.clear = function clear() {\n    dataMemory = {};\n    return dataMemory;\n  };\n\n  /**\n  * Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage\n  * @param {nodeCallback<string>} callback callback with (err, 'SUCCESS')\n  * @returns {void}\n  */\n\n\n  MemoryStorage.sync = function sync(callback) {\n    _reactNative.AsyncStorage.getAllKeys(function (errKeys, keys) {\n      if (errKeys) return callback(errKeys, null);\n      var memoryKeys = keys.filter(function (key) {\n        return key.startsWith(MEMORY_KEY_PREFIX);\n      });\n      _reactNative.AsyncStorage.multiGet(memoryKeys, function (err, stores) {\n        if (err) return callback(err, null);\n        stores.map(function (result, index, store) {\n          var key = store[index][0];\n          var value = store[index][1];\n          var memoryKey = key.replace(MEMORY_KEY_PREFIX, '');\n          dataMemory[memoryKey] = value;\n          return undefined;\n        });\n        callback(null, 'SUCCESS');\n        return undefined;\n      });\n      return undefined;\n    });\n  };\n\n  return MemoryStorage;\n}();\n\n/** @class */\n\n\nvar StorageHelper = function () {\n\n  /**\n   * This is used to get a storage object\n   * @returns {object} the storage\n   */\n  function StorageHelper() {\n    _classCallCheck(this, StorageHelper);\n\n    this.storageWindow = MemoryStorage;\n  }\n\n  /**\n   * This is used to return the storage\n   * @returns {object} the storage\n   */\n\n\n  StorageHelper.prototype.getStorage = function getStorage() {\n    return this.storageWindow;\n  };\n\n  return StorageHelper;\n}();\n\nexports.default = StorageHelper;"
  },
  {
    "path": "lib/StorageHelper.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar dataMemory = {};\n\n/** @class */\n\nvar MemoryStorage = function () {\n  function MemoryStorage() {\n    _classCallCheck(this, MemoryStorage);\n  }\n\n  /**\n   * This is used to set a specific item in storage\n   * @param {string} key - the key for the item\n   * @param {object} value - the value\n   * @returns {string} value that was set\n   */\n  MemoryStorage.setItem = function setItem(key, value) {\n    dataMemory[key] = value;\n    return dataMemory[key];\n  };\n\n  /**\n   * This is used to get a specific key from storage\n   * @param {string} key - the key for the item\n   * This is used to clear the storage\n   * @returns {string} the data item\n   */\n\n\n  MemoryStorage.getItem = function getItem(key) {\n    return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n  };\n\n  /**\n   * This is used to remove an item from storage\n   * @param {string} key - the key being set\n   * @returns {string} value - value that was deleted\n   */\n\n\n  MemoryStorage.removeItem = function removeItem(key) {\n    return delete dataMemory[key];\n  };\n\n  /**\n   * This is used to clear the storage\n   * @returns {string} nothing\n   */\n\n\n  MemoryStorage.clear = function clear() {\n    dataMemory = {};\n    return dataMemory;\n  };\n\n  return MemoryStorage;\n}();\n\n/** @class */\n\n\nvar StorageHelper = function () {\n\n  /**\n   * This is used to get a storage object\n   * @returns {object} the storage\n   */\n  function StorageHelper() {\n    _classCallCheck(this, StorageHelper);\n\n    try {\n      this.storageWindow = window.localStorage;\n      this.storageWindow.setItem('aws.cognito.test-ls', 1);\n      this.storageWindow.removeItem('aws.cognito.test-ls');\n    } catch (exception) {\n      this.storageWindow = MemoryStorage;\n    }\n  }\n\n  /**\n   * This is used to return the storage\n   * @returns {object} the storage\n   */\n\n\n  StorageHelper.prototype.getStorage = function getStorage() {\n    return this.storageWindow;\n  };\n\n  return StorageHelper;\n}();\n\nexports.default = StorageHelper;"
  },
  {
    "path": "lib/index.js",
    "content": "'use strict';\n\nexports.__esModule = true;\n\nvar _AuthenticationDetails = require('./AuthenticationDetails');\n\nObject.defineProperty(exports, 'AuthenticationDetails', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_AuthenticationDetails).default;\n  }\n});\n\nvar _AuthenticationHelper = require('./AuthenticationHelper');\n\nObject.defineProperty(exports, 'AuthenticationHelper', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_AuthenticationHelper).default;\n  }\n});\n\nvar _CognitoAccessToken = require('./CognitoAccessToken');\n\nObject.defineProperty(exports, 'CognitoAccessToken', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoAccessToken).default;\n  }\n});\n\nvar _CognitoIdToken = require('./CognitoIdToken');\n\nObject.defineProperty(exports, 'CognitoIdToken', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoIdToken).default;\n  }\n});\n\nvar _CognitoRefreshToken = require('./CognitoRefreshToken');\n\nObject.defineProperty(exports, 'CognitoRefreshToken', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoRefreshToken).default;\n  }\n});\n\nvar _CognitoUser = require('./CognitoUser');\n\nObject.defineProperty(exports, 'CognitoUser', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoUser).default;\n  }\n});\n\nvar _CognitoUserAttribute = require('./CognitoUserAttribute');\n\nObject.defineProperty(exports, 'CognitoUserAttribute', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoUserAttribute).default;\n  }\n});\n\nvar _CognitoUserPool = require('./CognitoUserPool');\n\nObject.defineProperty(exports, 'CognitoUserPool', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoUserPool).default;\n  }\n});\n\nvar _CognitoUserSession = require('./CognitoUserSession');\n\nObject.defineProperty(exports, 'CognitoUserSession', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CognitoUserSession).default;\n  }\n});\n\nvar _CookieStorage = require('./CookieStorage');\n\nObject.defineProperty(exports, 'CookieStorage', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_CookieStorage).default;\n  }\n});\n\nvar _DateHelper = require('./DateHelper');\n\nObject.defineProperty(exports, 'DateHelper', {\n  enumerable: true,\n  get: function get() {\n    return _interopRequireDefault(_DateHelper).default;\n  }\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// The version of crypto-browserify included by aws-sdk only\n// checks for window.crypto, not window.msCrypto as used by\n// IE 11 – so we set it explicitly here\nif (typeof window !== 'undefined' && !window.crypto && window.msCrypto) {\n  window.crypto = window.msCrypto;\n}"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"amazon-cognito-identity-js\",\n  \"description\": \"Amazon Cognito Identity Provider JavaScript SDK\",\n  \"version\": \"1.31.0\",\n  \"author\": {\n    \"name\": \"Amazon Web Services\",\n    \"email\": \"aws@amazon.com\",\n    \"url\": \"http://aws.amazon.com\"\n  },\n  \"homepage\": \"http://aws.amazon.com/cognito\",\n  \"contributors\": [\n    \"Simon Buchan with Skilitics\",\n    \"Jonathan Goldwasser\",\n    \"Matt Durant\",\n    \"John Ferlito\",\n    \"Michael Hart\",\n    \"Tylor Steinberger\",\n    \"Paul Watts\",\n    \"Gleb Promokhov\",\n    \"Min Bi\",\n    \"Chetan Mehta <chetam@amazon.com>\",\n    \"Ionut Trestian <trestian@amazon.com>\"\n  ],\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/aws/amazon-cognito-identity-js.git\"\n  },\n  \"license\": \"SEE LICENSE IN LICENSE.txt\",\n  \"licenses\": [\n    {\n      \"type\": \"Amazon Software License\",\n      \"url\": \"http://aws.amazon.com/asl\"\n    }\n  ],\n  \"keywords\": [\n    \"amazon\",\n    \"aws\",\n    \"cognito\",\n    \"identity\",\n    \"react-native\",\n    \"reactnative\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf lib es\",\n    \"build:commonjs\": \"cross-env BABEL_ENV=commonjs babel src --out-dir lib\",\n    \"build:es\": \"cross-env BABEL_ENV=es babel src --out-dir es\",\n    \"build:umd\": \"cross-env BABEL_ENV=commonjs NODE_ENV=development webpack dist/amazon-cognito-identity.js\",\n    \"build:umd:min\": \"cross-env BABEL_ENV=commonjs NODE_ENV=production webpack dist/amazon-cognito-identity.min.js\",\n    \"build\": \"npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min\",\n    \"doc\": \"jsdoc src -d docs\",\n    \"lint\": \"eslint src\",\n    \"lint2\": \"eslint enhance-rn.js\"\n  },\n  \"main\": \"lib/index.js\",\n  \"react-native\": {\n    \"lib/index.js\": \"./enhance-rn.js\",\n    \"./src/StorageHelper\": \"./src/StorageHelper-rn.js\"\n  },\n  \"module\": \"es/index.js\",\n  \"jsnext:main\": \"es/index.js\",\n  \"types\": \"./index.d.ts\",\n  \"dependencies\": {\n    \"aws-sdk\": \"2.177.0\",\n    \"js-cookie\": \"^2.1.4\"\n  },\n  \"devDependencies\": {\n    \"babel-cli\": \"^6.23.0\",\n    \"babel-core\": \"^6.13.2\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-plugin-transform-es2015-modules-commonjs\": \"^6.23.0\",\n    \"babel-preset-es2015\": \"^6.22.0\",\n    \"cross-env\": \"^3.1.4\",\n    \"eslint\": \"^3.19.0\",\n    \"eslint-config-airbnb-base\": \"^5.0.2\",\n    \"eslint-import-resolver-webpack\": \"^0.5.1\",\n    \"eslint-plugin-import\": \"^2.7.0\",\n    \"eslint-plugin-node\": \"^5.2.0\",\n    \"eslint-plugin-promise\": \"^3.6.0\",\n    \"eslint-plugin-standard\": \"^3.0.1\",\n    \"jsdoc\": \"^3.4.0\",\n    \"react\": \"^16.0.0-alpha.6\",\n    \"react-native\": \"^0.44.0\",\n    \"rimraf\": \"^2.5.4\",\n    \"webpack\": \"^1.13.1\"\n  }\n}\n"
  },
  {
    "path": "src/AuthenticationDetails.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nexport default class AuthenticationDetails {\n  /**\n   * Constructs a new AuthenticationDetails object\n   * @param {object=} data Creation options.\n   * @param {string} data.Username User being authenticated.\n   * @param {string} data.Password Plain-text password to authenticate with.\n   * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.\n   * @param {(AttributeArg[])?} data.AuthParamaters Authentication paramaters for custom auth.\n   */\n  constructor(data) {\n    const { ValidationData, Username, Password, AuthParameters } = data || {};\n    this.validationData = ValidationData || [];\n    this.authParameters = AuthParameters || [];\n    this.username = Username;\n    this.password = Password;\n  }\n\n  /**\n   * @returns {string} the record's username\n   */\n  getUsername() {\n    return this.username;\n  }\n\n  /**\n   * @returns {string} the record's password\n   */\n  getPassword() {\n    return this.password;\n  }\n\n  /**\n   * @returns {Array} the record's validationData\n   */\n  getValidationData() {\n    return this.validationData;\n  }\n\n  /**\n   * @returns {Array} the record's authParameters\n   */\n  getAuthParameters() {\n    return this.authParameters;\n  }\n}\n"
  },
  {
    "path": "src/AuthenticationHelper.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { util } from 'aws-sdk/global';\n\nimport BigInteger from './BigInteger';\n\nconst initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1'\n  + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD'\n  + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245'\n  + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED'\n  + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D'\n  + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F'\n  + '83655D23DCA3AD961C62F356208552BB9ED529077096966D'\n  + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B'\n  + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9'\n  + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510'\n  + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64'\n  + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7'\n  + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B'\n  + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C'\n  + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31'\n  + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\n\nconst newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n\n/** @class */\nexport default class AuthenticationHelper {\n  /**\n   * Constructs a new AuthenticationHelper object\n   * @param {string} PoolName Cognito user pool name.\n   */\n  constructor(PoolName) {\n    this.N = new BigInteger(initN, 16);\n    this.g = new BigInteger('2', 16);\n    this.k = new BigInteger(this.hexHash(`00${this.N.toString(16)}0${this.g.toString(16)}`), 16);\n\n    this.smallAValue = this.generateRandomSmallA();\n    this.getLargeAValue(() => {});\n\n    this.infoBits = new util.Buffer('Caldera Derived Key', 'utf8');\n\n    this.poolName = PoolName;\n  }\n\n  /**\n   * @returns {BigInteger} small A, a random number\n   */\n  getSmallAValue() {\n    return this.smallAValue;\n  }\n\n  /**\n   * @param {nodeCallback<BigInteger>} callback Called with (err, largeAValue)\n   * @returns {void}\n   */\n  getLargeAValue(callback) {\n    if (this.largeAValue) {\n      callback(null, this.largeAValue);\n    } else {\n      this.calculateA(this.smallAValue, (err, largeAValue) => {\n        if (err) {\n          callback(err, null);\n        }\n\n        this.largeAValue = largeAValue;\n        callback(null, this.largeAValue);\n      });\n    }\n  }\n\n  /**\n   * helper function to generate a random big integer\n   * @returns {BigInteger} a random value.\n   * @private\n   */\n  generateRandomSmallA() {\n    const hexRandom = util.crypto.lib.randomBytes(128).toString('hex');\n\n    const randomBigInt = new BigInteger(hexRandom, 16);\n    const smallABigInt = randomBigInt.mod(this.N);\n\n    return smallABigInt;\n  }\n\n  /**\n   * helper function to generate a random string\n   * @returns {string} a random value.\n   * @private\n   */\n  generateRandomString() {\n    return util.crypto.lib.randomBytes(40).toString('base64');\n  }\n\n  /**\n   * @returns {string} Generated random value included in password hash.\n   */\n  getRandomPassword() {\n    return this.randomPassword;\n  }\n\n  /**\n   * @returns {string} Generated random value included in devices hash.\n   */\n  getSaltDevices() {\n    return this.SaltToHashDevices;\n  }\n\n  /**\n   * @returns {string} Value used to verify devices.\n   */\n  getVerifierDevices() {\n    return this.verifierDevices;\n  }\n\n  /**\n   * Generate salts and compute verifier.\n   * @param {string} deviceGroupKey Devices to generate verifier for.\n   * @param {string} username User to generate verifier for.\n   * @param {nodeCallback<null>} callback Called with (err, null)\n   * @returns {void}\n   */\n  generateHashDevice(deviceGroupKey, username, callback) {\n    this.randomPassword = this.generateRandomString();\n    const combinedString = `${deviceGroupKey}${username}:${this.randomPassword}`;\n    const hashedString = this.hash(combinedString);\n\n    const hexRandom = util.crypto.lib.randomBytes(16).toString('hex');\n    this.SaltToHashDevices = this.padHex(new BigInteger(hexRandom, 16));\n\n    this.g.modPow(\n      new BigInteger(this.hexHash(this.SaltToHashDevices + hashedString), 16),\n      this.N,\n      (err, verifierDevicesNotPadded) => {\n        if (err) {\n          callback(err, null);\n        }\n\n        this.verifierDevices = this.padHex(verifierDevicesNotPadded);\n        callback(null, null);\n      });\n  }\n\n  /**\n   * Calculate the client's public value A = g^a%N\n   * with the generated random number a\n   * @param {BigInteger} a Randomly generated small A.\n   * @param {nodeCallback<BigInteger>} callback Called with (err, largeAValue)\n   * @returns {void}\n   * @private\n   */\n  calculateA(a, callback) {\n    this.g.modPow(a, this.N, (err, A) => {\n      if (err) {\n        callback(err, null);\n      }\n\n      if (A.mod(this.N).equals(BigInteger.ZERO)) {\n        callback(new Error('Illegal paramater. A mod N cannot be 0.'), null);\n      }\n\n      callback(null, A);\n    });\n  }\n\n  /**\n   * Calculate the client's value U which is the hash of A and B\n   * @param {BigInteger} A Large A value.\n   * @param {BigInteger} B Server B value.\n   * @returns {BigInteger} Computed U value.\n   * @private\n   */\n  calculateU(A, B) {\n    this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n    const finalU = new BigInteger(this.UHexHash, 16);\n\n    return finalU;\n  }\n\n  /**\n   * Calculate a hash from a bitArray\n   * @param {Buffer} buf Value to hash.\n   * @returns {String} Hex-encoded hash.\n   * @private\n   */\n  hash(buf) {\n    const hashHex = util.crypto.sha256(buf, 'hex');\n    return (new Array(64 - hashHex.length).join('0')) + hashHex;\n  }\n\n  /**\n   * Calculate a hash from a hex string\n   * @param {String} hexStr Value to hash.\n   * @returns {String} Hex-encoded hash.\n   * @private\n   */\n  hexHash(hexStr) {\n    return this.hash(new util.Buffer(hexStr, 'hex'));\n  }\n\n  /**\n   * Standard hkdf algorithm\n   * @param {Buffer} ikm Input key material.\n   * @param {Buffer} salt Salt value.\n   * @returns {Buffer} Strong key material.\n   * @private\n   */\n  computehkdf(ikm, salt) {\n    const prk = util.crypto.hmac(salt, ikm, 'buffer', 'sha256');\n    const infoBitsUpdate = util.buffer.concat([\n      this.infoBits,\n      new util.Buffer(String.fromCharCode(1), 'utf8'),\n    ]);\n    const hmac = util.crypto.hmac(prk, infoBitsUpdate, 'buffer', 'sha256');\n    return hmac.slice(0, 16);\n  }\n\n  /**\n   * Calculates the final hkdf based on computed S value, and computed U value and the key\n   * @param {String} username Username.\n   * @param {String} password Password.\n   * @param {BigInteger} serverBValue Server B value.\n   * @param {BigInteger} salt Generated salt.\n   * @param {nodeCallback<Buffer>} callback Called with (err, hkdfValue)\n   * @returns {void}\n   */\n  getPasswordAuthenticationKey(username, password, serverBValue, salt, callback) {\n    if (serverBValue.mod(this.N).equals(BigInteger.ZERO)) {\n      throw new Error('B cannot be zero.');\n    }\n\n    this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n    if (this.UValue.equals(BigInteger.ZERO)) {\n      throw new Error('U cannot be zero.');\n    }\n\n    const usernamePassword = `${this.poolName}${username}:${password}`;\n    const usernamePasswordHash = this.hash(usernamePassword);\n\n    const xValue = new BigInteger(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n    this.calculateS(xValue, serverBValue, (err, sValue) => {\n      if (err) {\n        callback(err, null);\n      }\n\n      const hkdf = this.computehkdf(\n        new util.Buffer(this.padHex(sValue), 'hex'),\n        new util.Buffer(this.padHex(this.UValue.toString(16)), 'hex'));\n\n      callback(null, hkdf);\n    });\n  }\n\n  /**\n   * Calculates the S value used in getPasswordAuthenticationKey\n   * @param {BigInteger} xValue Salted password hash value.\n   * @param {BigInteger} serverBValue Server B value.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  calculateS(xValue, serverBValue, callback) {\n    this.g.modPow(xValue, this.N, (err, gModPowXN) => {\n      if (err) {\n        callback(err, null);\n      }\n\n      const intValue2 = serverBValue.subtract(this.k.multiply(gModPowXN));\n      intValue2.modPow(\n        this.smallAValue.add(this.UValue.multiply(xValue)),\n        this.N,\n        (err2, result) => {\n          if (err2) {\n            callback(err2, null);\n          }\n\n          callback(null, result.mod(this.N));\n        }\n      );\n    });\n  }\n\n  /**\n  * Return constant newPasswordRequiredChallengeUserAttributePrefix\n  * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n  */\n  getNewPasswordRequiredChallengeUserAttributePrefix() {\n    return newPasswordRequiredChallengeUserAttributePrefix;\n  }\n\n  /**\n   * Converts a BigInteger (or hex string) to hex format padded with zeroes for hashing\n   * @param {BigInteger|String} bigInt Number or string to pad.\n   * @returns {String} Padded hex string.\n   */\n  padHex(bigInt) {\n    let hashStr = bigInt.toString(16);\n    if (hashStr.length % 2 === 1) {\n      hashStr = `0${hashStr}`;\n    } else if ('89ABCDEFabcdef'.indexOf(hashStr[0]) !== -1) {\n      hashStr = `00${hashStr}`;\n    }\n    return hashStr;\n  }\n}\n"
  },
  {
    "path": "src/BigInteger.js",
    "content": "// A small implementation of BigInteger based on http://www-cs-students.stanford.edu/~tjw/jsbn/\n//\n// All public methods have been removed except the following:\n//   new BigInteger(a, b) (only radix 2, 4, 8, 16 and 32 supported)\n//   toString (only radix 2, 4, 8, 16 and 32 supported)\n//   negate\n//   abs\n//   compareTo\n//   bitLength\n//   mod\n//   equals\n//   add\n//   subtract\n//   multiply\n//   divide\n//   modPow\n\nexport default BigInteger;\n\n/*\n * Copyright (c) 2003-2005  Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n\n// (public) Constructor\nfunction BigInteger(a, b) {\n  if (a != null) this.fromString(a, b);\n}\n\n// return new, unset BigInteger\nfunction nbi() {\n  return new BigInteger(null);\n}\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary&0xffffff)==0xefcafe);\n\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i,x,w,j,c,n) {\n  while(--n >= 0) {\n    var v = x*this[i++]+w[j]+c;\n    c = Math.floor(v/0x4000000);\n    w[j++] = v&0x3ffffff;\n  }\n  return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i,x,w,j,c,n) {\n  var xl = x&0x7fff, xh = x>>15;\n  while(--n >= 0) {\n    var l = this[i]&0x7fff;\n    var h = this[i++]>>15;\n    var m = xh*l+h*xl;\n    l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);\n    c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);\n    w[j++] = l&0x3fffffff;\n  }\n  return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i,x,w,j,c,n) {\n  var xl = x&0x3fff, xh = x>>14;\n  while(--n >= 0) {\n    var l = this[i]&0x3fff;\n    var h = this[i++]>>14;\n    var m = xh*l+h*xl;\n    l = xl*l+((m&0x3fff)<<14)+w[j]+c;\n    c = (l>>28)+(m>>14)+xh*h;\n    w[j++] = l&0xfffffff;\n  }\n  return c;\n}\nvar inBrowser = typeof navigator !== \"undefined\";\nif(inBrowser && j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n  BigInteger.prototype.am = am2;\n  dbits = 30;\n}\nelse if(inBrowser && j_lm && (navigator.appName != \"Netscape\")) {\n  BigInteger.prototype.am = am1;\n  dbits = 26;\n}\nelse { // Mozilla/Netscape seems to prefer am3\n  BigInteger.prototype.am = am3;\n  dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = (1 << dbits) - 1;\nBigInteger.prototype.DV = 1 << dbits;\n\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n\n// Digit conversions\nvar BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nvar BI_RC = new Array();\nvar rr, vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv)\n  BI_RC[rr++] = vv;\nrr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv)\n  BI_RC[rr++] = vv;\nrr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv)\n  BI_RC[rr++] = vv;\n\nfunction int2char(n) {\n  return BI_RM.charAt(n);\n}\nfunction intAt(s, i) {\n  var c = BI_RC[s.charCodeAt(i)];\n  return c == null ? -1 : c;\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n  for (var i = this.t - 1; i >= 0; --i)\n    r[i] = this[i];\n  r.t = this.t;\n  r.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n  this.t = 1;\n  this.s = x < 0 ? -1 : 0;\n  if (x > 0) this[0] = x;\n  else if (x < -1) this[0] = x + this.DV;\n  else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n  var r = nbi();\n\n  r.fromInt(i);\n\n  return r;\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(s, b) {\n  var k;\n  if (b == 16) k = 4;\n  else if (b == 8) k = 3;\n  else if (b == 2) k = 1;\n  else if (b == 32) k = 5;\n  else if (b == 4) k = 2;\n  else throw new Error(\"Only radix 2, 4, 8, 16, 32 are supported\");\n  this.t = 0;\n  this.s = 0;\n  var i = s.length, mi = false, sh = 0;\n  while (--i >= 0) {\n    var x = intAt(s, i);\n    if (x < 0) {\n      if (s.charAt(i) == \"-\") mi = true;\n      continue;\n    }\n    mi = false;\n    if (sh == 0) this[this.t++] = x;\n    else if (sh + k > this.DB) {\n      this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;\n      this[this.t++] = x >> this.DB - sh;\n    } else this[this.t - 1] |= x << sh;\n    sh += k;\n    if (sh >= this.DB) sh -= this.DB;\n  }\n  this.clamp();\n  if (mi) BigInteger.ZERO.subTo(this, this);\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n  var c = this.s & this.DM;\n  while (this.t > 0 && this[this.t - 1] == c)\n    --this.t;\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n  if (this.s < 0) return \"-\" + this.negate().toString();\n  var k;\n  if (b == 16) k = 4;\n  else if (b == 8) k = 3;\n  else if (b == 2) k = 1;\n  else if (b == 32) k = 5;\n  else if (b == 4) k = 2;\n  else throw new Error(\"Only radix 2, 4, 8, 16, 32 are supported\");\n  var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\n  var p = this.DB - i * this.DB % k;\n  if (i-- > 0) {\n    if (p < this.DB && (d = this[i] >> p) > 0) {\n      m = true;\n      r = int2char(d);\n    }\n    while (i >= 0) {\n      if (p < k) {\n        d = (this[i] & (1 << p) - 1) << k - p;\n        d |= this[--i] >> (p += this.DB - k);\n      } else {\n        d = this[i] >> (p -= k) & km;\n        if (p <= 0) {\n          p += this.DB;\n          --i;\n        }\n      }\n      if (d > 0) m = true;\n      if (m) r += int2char(d);\n    }\n  }\n  return m ? r : \"0\";\n}\n\n// (public) -this\nfunction bnNegate() {\n  var r = nbi();\n\n  BigInteger.ZERO.subTo(this, r);\n\n  return r;\n}\n\n// (public) |this|\nfunction bnAbs() {\n  return this.s < 0 ? this.negate() : this;\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n  var r = this.s - a.s;\n  if (r != 0) return r;\n  var i = this.t;\n  r = i - a.t;\n  if (r != 0) return this.s < 0 ? -r : r;\n  while (--i >= 0)\n    if ((r = this[i] - a[i]) != 0) return r;\n  return 0;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n  var r = 1, t;\n  if ((t = x >>> 16) != 0) {\n    x = t;\n    r += 16;\n  }\n  if ((t = x >> 8) != 0) {\n    x = t;\n    r += 8;\n  }\n  if ((t = x >> 4) != 0) {\n    x = t;\n    r += 4;\n  }\n  if ((t = x >> 2) != 0) {\n    x = t;\n    r += 2;\n  }\n  if ((t = x >> 1) != 0) {\n    x = t;\n    r += 1;\n  }\n  return r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n  if (this.t <= 0) return 0;\n  return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n  var i;\n  for (i = this.t - 1; i >= 0; --i)\n    r[i + n] = this[i];\n  for (i = n - 1; i >= 0; --i)\n    r[i] = 0;\n  r.t = this.t + n;\n  r.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n  for (var i = n; i < this.t; ++i)\n    r[i - n] = this[i];\n  r.t = Math.max(this.t - n, 0);\n  r.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n  var bs = n % this.DB;\n  var cbs = this.DB - bs;\n  var bm = (1 << cbs) - 1;\n  var ds = Math.floor(n / this.DB), c = this.s << bs & this.DM, i;\n  for (i = this.t - 1; i >= 0; --i) {\n    r[i + ds + 1] = this[i] >> cbs | c;\n    c = (this[i] & bm) << bs;\n  }\n  for (i = ds - 1; i >= 0; --i)\n    r[i] = 0;\n  r[ds] = c;\n  r.t = this.t + ds + 1;\n  r.s = this.s;\n  r.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n  r.s = this.s;\n  var ds = Math.floor(n / this.DB);\n  if (ds >= this.t) {\n    r.t = 0;\n    return;\n  }\n  var bs = n % this.DB;\n  var cbs = this.DB - bs;\n  var bm = (1 << bs) - 1;\n  r[0] = this[ds] >> bs;\n  for (var i = ds + 1; i < this.t; ++i) {\n    r[i - ds - 1] |= (this[i] & bm) << cbs;\n    r[i - ds] = this[i] >> bs;\n  }\n  if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n  r.t = this.t - ds;\n  r.clamp();\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n  var i = 0, c = 0, m = Math.min(a.t, this.t);\n  while (i < m) {\n    c += this[i] - a[i];\n    r[i++] = c & this.DM;\n    c >>= this.DB;\n  }\n  if (a.t < this.t) {\n    c -= a.s;\n    while (i < this.t) {\n      c += this[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c += this.s;\n  } else {\n    c += this.s;\n    while (i < a.t) {\n      c -= a[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c -= a.s;\n  }\n  r.s = c < 0 ? -1 : 0;\n  if (c < -1) r[i++] = this.DV + c;\n  else if (c > 0) r[i++] = c;\n  r.t = i;\n  r.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n  var x = this.abs(), y = a.abs();\n  var i = x.t;\n  r.t = i + y.t;\n  while (--i >= 0)\n    r[i] = 0;\n  for (i = 0; i < y.t; ++i)\n    r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n  r.s = 0;\n  r.clamp();\n  if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n  var x = this.abs();\n  var i = r.t = 2 * x.t;\n  while (--i >= 0)\n    r[i] = 0;\n  for (i = 0; i < x.t - 1; ++i) {\n    var c = x.am(i, x[i], r, 2 * i, 0, 1);\n    if (\n      (r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >=\n        x.DV\n    ) {\n      r[i + x.t] -= x.DV;\n      r[i + x.t + 1] = 1;\n    }\n  }\n  if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n  r.s = 0;\n  r.clamp();\n}\n\n// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m.  q or r may be null.\nfunction bnpDivRemTo(m, q, r) {\n  var pm = m.abs();\n  if (pm.t <= 0) return;\n  var pt = this.abs();\n  if (pt.t < pm.t) {\n    if (q != null) q.fromInt(0);\n    if (r != null) this.copyTo(r);\n    return;\n  }\n  if (r == null) r = nbi();\n  var y = nbi(), ts = this.s, ms = m.s;\n  var nsh = this.DB - nbits(pm[pm.t - 1]);\n  // normalize modulus\n  if (nsh > 0) {\n    pm.lShiftTo(nsh, y);\n    pt.lShiftTo(nsh, r);\n  } else {\n    pm.copyTo(y);\n    pt.copyTo(r);\n  }\n  var ys = y.t;\n  var y0 = y[ys - 1];\n  if (y0 == 0) return;\n  var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n  var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2;\n  var i = r.t, j = i - ys, t = q == null ? nbi() : q;\n  y.dlShiftTo(j, t);\n  if (r.compareTo(t) >= 0) {\n    r[r.t++] = 1;\n    r.subTo(t, r);\n  }\n  BigInteger.ONE.dlShiftTo(ys, t);\n  t.subTo(y, y);\n  // \"negative\" y so we can replace sub with am later\n  while (y.t < ys)\n    y[y.t++] = 0;\n  while (--j >= 0) {\n    // Estimate quotient digit\n    var qd = r[--i] == y0\n      ? this.DM\n      : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n    if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n      // Try it out\n      y.dlShiftTo(j, t);\n      r.subTo(t, r);\n      while (r[i] < --qd) r.subTo(t, r);\n    }\n  }\n  if (q != null) {\n    r.drShiftTo(ys, q);\n    if (ts != ms) BigInteger.ZERO.subTo(q, q);\n  }\n  r.t = ys;\n  r.clamp();\n  if (nsh > 0) r.rShiftTo(nsh, r);\n  // Denormalize remainder\n  if (ts < 0) BigInteger.ZERO.subTo(r, r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n  var r = nbi();\n  this.abs().divRemTo(a, null, r);\n  if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n  return r;\n}\n\n// (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n//         xy == 1 (mod m)\n//         xy =  1+km\n//   xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\nfunction bnpInvDigit() {\n  if (this.t < 1) return 0;\n  var x = this[0];\n  if ((x & 1) == 0) return 0;\n  var y = x & 3;\n  // y == 1/x mod 2^2\n  y = y * (2 - (x & 0xf) * y) & 0xf;\n  // y == 1/x mod 2^4\n  y = y * (2 - (x & 0xff) * y) & 0xff;\n  // y == 1/x mod 2^8\n  y = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff;\n  // y == 1/x mod 2^16\n  // last step - calculate inverse mod DV directly;\n  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n  y = y * (2 - x * y % this.DV) % this.DV;\n  // y == 1/x mod 2^dbits\n  // we really want the negative inverse, and -DV < y < DV\n  return y > 0 ? this.DV - y : -y;\n}\n\nfunction bnEquals(a) {\n  return this.compareTo(a) == 0;\n}\n\n// (protected) r = this + a\nfunction bnpAddTo(a, r) {\n  var i = 0, c = 0, m = Math.min(a.t, this.t);\n  while (i < m) {\n    c += this[i] + a[i];\n    r[i++] = c & this.DM;\n    c >>= this.DB;\n  }\n  if (a.t < this.t) {\n    c += a.s;\n    while (i < this.t) {\n      c += this[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c += this.s;\n  } else {\n    c += this.s;\n    while (i < a.t) {\n      c += a[i];\n      r[i++] = c & this.DM;\n      c >>= this.DB;\n    }\n    c += a.s;\n  }\n  r.s = c < 0 ? -1 : 0;\n  if (c > 0) r[i++] = c;\n  else if (c < -1) r[i++] = this.DV + c;\n  r.t = i;\n  r.clamp();\n}\n\n// (public) this + a\nfunction bnAdd(a) {\n  var r = nbi();\n\n  this.addTo(a, r);\n\n  return r;\n}\n\n// (public) this - a\nfunction bnSubtract(a) {\n  var r = nbi();\n\n  this.subTo(a, r);\n\n  return r;\n}\n\n// (public) this * a\nfunction bnMultiply(a) {\n  var r = nbi();\n\n  this.multiplyTo(a, r);\n\n  return r;\n}\n\n// (public) this / a\nfunction bnDivide(a) {\n  var r = nbi();\n\n  this.divRemTo(a, r, null);\n\n  return r;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n  this.m = m;\n  this.mp = m.invDigit();\n  this.mpl = this.mp & 0x7fff;\n  this.mph = this.mp >> 15;\n  this.um = (1 << m.DB - 15) - 1;\n  this.mt2 = 2 * m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n  var r = nbi();\n  x.abs().dlShiftTo(this.m.t, r);\n  r.divRemTo(this.m, null, r);\n  if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n  return r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n  var r = nbi();\n  x.copyTo(r);\n  this.reduce(r);\n  return r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n  while (x.t <= this.mt2)\n    // pad x so am has enough room later\n    x[x.t++] = 0;\n  for (var i = 0; i < this.m.t; ++i) {\n    // faster way of calculating u0 = x[i]*mp mod DV\n    var j = x[i] & 0x7fff;\n    var u0 = j * this.mpl +\n      ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) &\n      x.DM;\n    // use am to combine the multiply-shift-add into one call\n    j = i + this.m.t;\n    x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n    // propagate carry\n    while (x[j] >= x.DV) {\n      x[j] -= x.DV;\n      x[++j]++;\n    }\n  }\n  x.clamp();\n  x.drShiftTo(this.m.t, x);\n  if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n  x.squareTo(r);\n\n  this.reduce(r);\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n  x.multiplyTo(y, r);\n\n  this.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (public) this^e % m (HAC 14.85)\nfunction bnModPow(e, m, callback) {\n  var i = e.bitLength(), k, r = nbv(1), z = new Montgomery(m);\n  if (i <= 0) return r;\n  else if (i < 18) k = 1;\n  else if (i < 48) k = 3;\n  else if (i < 144) k = 4;\n  else if (i < 768) k = 5;\n  else k = 6;\n\n  // precomputation\n  var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\n  g[1] = z.convert(this);\n  if (k > 1) {\n    var g2 = nbi();\n    z.sqrTo(g[1], g2);\n    while (n <= km) {\n      g[n] = nbi();\n      z.mulTo(g2, g[n - 2], g[n]);\n      n += 2;\n    }\n  }\n\n  var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\n  i = nbits(e[j]) - 1;\n  while (j >= 0) {\n    if (i >= k1) w = e[j] >> i - k1 & km;\n    else {\n      w = (e[j] & (1 << i + 1) - 1) << k1 - i;\n      if (j > 0) w |= e[j - 1] >> this.DB + i - k1;\n    }\n\n    n = k;\n    while ((w & 1) == 0) {\n      w >>= 1;\n      --n;\n    }\n    if ((i -= n) < 0) {\n      i += this.DB;\n      --j;\n    }\n    if (is1) {\n      // ret == 1, don't bother squaring or multiplying it\n      g[w].copyTo(r);\n      is1 = false;\n    } else {\n      while (n > 1) {\n        z.sqrTo(r, r2);\n        z.sqrTo(r2, r);\n        n -= 2;\n      }\n      if (n > 0) z.sqrTo(r, r2);\n      else {\n        t = r;\n        r = r2;\n        r2 = t;\n      }\n      z.mulTo(r2, g[w], r);\n    }\n\n    while (j >= 0 && (e[j] & 1 << i) == 0) {\n      z.sqrTo(r, r2);\n      t = r;\n      r = r2;\n      r2 = t;\n      if (--i < 0) {\n        i = this.DB - 1;\n        --j;\n      }\n    }\n  }\n  var result = z.revert(r);\n  callback(null, result);\n  return result;\n}\n\n// protected\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.addTo = bnpAddTo;\n\n// public\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.modPow = bnModPow;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n\n"
  },
  {
    "path": "src/CognitoAccessToken.js",
    "content": "/*\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CognitoJwtToken from './CognitoJwtToken';\n\n/** @class */\nexport default class CognitoAccessToken extends CognitoJwtToken {\n  /**\n   * Constructs a new CognitoAccessToken object\n   * @param {string=} AccessToken The JWT access token.\n   */\n  constructor({ AccessToken } = {}) {\n    super(AccessToken || '');\n  }\n}\n"
  },
  {
    "path": "src/CognitoIdToken.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CognitoJwtToken from './CognitoJwtToken';\n\n/** @class */\nexport default class CognitoIdToken extends CognitoJwtToken {\n  /**\n   * Constructs a new CognitoIdToken object\n   * @param {string=} IdToken The JWT Id token\n   */\n  constructor({ IdToken } = {}) {\n    super(IdToken || '');\n  }\n}\n"
  },
  {
    "path": "src/CognitoJwtToken.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { util } from 'aws-sdk/global';\n\n/** @class */\nexport default class CognitoJwtToken {\n  /**\n   * Constructs a new CognitoJwtToken object\n   * @param {string=} token The JWT token.\n   */\n  constructor(token) {\n    // Assign object\n    this.jwtToken = token || '';\n    this.payload = this.decodePayload();\n  }\n\n  /**\n   * @returns {string} the record's token.\n   */\n  getJwtToken() {\n    return this.jwtToken;\n  }\n\n  /**\n   * @returns {int} the token's expiration (exp member).\n   */\n  getExpiration() {\n    return this.payload.exp;\n  }\n\n  /**\n   * @returns {int} the token's \"issued at\" (iat member).\n   */\n  getIssuedAt() {\n    return this.payload.iat;\n  }\n\n  /**\n   * @returns {object} the token's payload.\n   */\n  decodePayload() {\n    const payload = this.jwtToken.split('.')[1];\n    try {\n      return JSON.parse(util.base64.decode(payload).toString('utf8'));\n    } catch (err) {\n      return {};\n    }\n  }\n}\n"
  },
  {
    "path": "src/CognitoRefreshToken.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nexport default class CognitoRefreshToken {\n  /**\n   * Constructs a new CognitoRefreshToken object\n   * @param {string=} RefreshToken The JWT refresh token.\n   */\n  constructor({ RefreshToken } = {}) {\n    // Assign object\n    this.token = RefreshToken || '';\n  }\n\n  /**\n   * @returns {string} the record's token.\n   */\n  getToken() {\n    return this.token;\n  }\n}\n"
  },
  {
    "path": "src/CognitoUser.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { util } from 'aws-sdk/global';\n\nimport BigInteger from './BigInteger';\nimport AuthenticationHelper from './AuthenticationHelper';\nimport CognitoAccessToken from './CognitoAccessToken';\nimport CognitoIdToken from './CognitoIdToken';\nimport CognitoRefreshToken from './CognitoRefreshToken';\nimport CognitoUserSession from './CognitoUserSession';\nimport DateHelper from './DateHelper';\nimport CognitoUserAttribute from './CognitoUserAttribute';\nimport StorageHelper from './StorageHelper';\n\n/**\n * @callback nodeCallback\n * @template T result\n * @param {*} err The operation failure reason, or null.\n * @param {T} result The operation result.\n */\n\n/**\n * @callback onFailure\n * @param {*} err Failure reason.\n */\n\n/**\n * @callback onSuccess\n * @template T result\n * @param {T} result The operation result.\n */\n\n/**\n * @callback mfaRequired\n * @param {*} details MFA challenge details.\n */\n\n/**\n * @callback customChallenge\n * @param {*} details Custom challenge details.\n */\n\n/**\n * @callback inputVerificationCode\n * @param {*} data Server response.\n */\n\n/**\n * @callback authSuccess\n * @param {CognitoUserSession} session The new session.\n * @param {bool=} userConfirmationNecessary User must be confirmed.\n */\n\n\n/** @class */\nexport default class CognitoUser {\n  /**\n   * Constructs a new CognitoUser object\n   * @param {object} data Creation options\n   * @param {string} data.Username The user's username.\n   * @param {CognitoUserPool} data.Pool Pool containing the user.\n   * @param {object} data.Storage Optional storage object.\n   */\n  constructor(data) {\n    if (data == null || data.Username == null || data.Pool == null) {\n      throw new Error('Username and pool information are required.');\n    }\n\n    this.username = data.Username || '';\n    this.pool = data.Pool;\n    this.Session = null;\n\n    this.client = data.Pool.client;\n\n    this.signInUserSession = null;\n    this.authenticationFlowType = 'USER_SRP_AUTH';\n\n    this.storage = data.Storage || new StorageHelper().getStorage();\n  }\n\n  /**\n   * Sets the session for this user\n   * @param {CognitoUserSession} signInUserSession the session\n   * @returns {void}\n   */\n  setSignInUserSession(signInUserSession) {\n    this.clearCachedTokens();\n    this.signInUserSession = signInUserSession;\n    this.cacheTokens();\n  }\n\n  /**\n   * @returns {CognitoUserSession} the current session for this user\n   */\n  getSignInUserSession() {\n    return this.signInUserSession;\n  }\n\n  /**\n   * @returns {string} the user's username\n   */\n  getUsername() {\n    return this.username;\n  }\n\n  /**\n   * @returns {String} the authentication flow type\n   */\n  getAuthenticationFlowType() {\n    return this.authenticationFlowType;\n  }\n\n  /**\n   * sets authentication flow type\n   * @param {string} authenticationFlowType New value.\n   * @returns {void}\n   */\n  setAuthenticationFlowType(authenticationFlowType) {\n    this.authenticationFlowType = authenticationFlowType;\n  }\n\n\n  /**\n   * This is used for authenticating the user through the custom authentication flow.\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  initiateAuth(authDetails, callback) {\n    const authParameters = authDetails.getAuthParameters();\n    authParameters.USERNAME = this.username;\n\n    const jsonReq = {\n      AuthFlow: 'CUSTOM_AUTH',\n      ClientId: this.pool.getClientId(),\n      AuthParameters: authParameters,\n      ClientMetadata: authDetails.getValidationData(),\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      const challengeName = data.ChallengeName;\n      const challengeParameters = data.ChallengeParameters;\n\n      if (challengeName === 'CUSTOM_CHALLENGE') {\n        this.Session = data.Session;\n        return callback.customChallenge(challengeParameters);\n      }\n      this.signInUserSession = this.getCognitoUserSession(data.AuthenticationResult);\n      this.cacheTokens();\n      return callback.onSuccess(this.signInUserSession);\n    });\n  }\n\n  /**\n   * This is used for authenticating the user. it calls the AuthenticationHelper for SRP related\n   * stuff\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {newPasswordRequired} callback.newPasswordRequired new\n   *        password and any required attributes are required to continue\n   * @param {mfaRequired} callback.mfaRequired MFA code\n   *        required to continue.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  authenticateUser(authDetails, callback) {\n    const authenticationHelper = new AuthenticationHelper(\n      this.pool.getUserPoolId().split('_')[1]);\n    const dateHelper = new DateHelper();\n\n    let serverBValue;\n    let salt;\n    const authParameters = {};\n\n    if (this.deviceKey != null) {\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    authParameters.USERNAME = this.username;\n    authenticationHelper.getLargeAValue((errOnAValue, aValue) => {\n      // getLargeAValue callback start\n      if (errOnAValue) {\n        callback.onFailure(errOnAValue);\n      }\n\n      authParameters.SRP_A = aValue.toString(16);\n\n      if (this.authenticationFlowType === 'CUSTOM_AUTH') {\n        authParameters.CHALLENGE_NAME = 'SRP_A';\n      }\n\n      const jsonReq = {\n        AuthFlow: this.authenticationFlowType,\n        ClientId: this.pool.getClientId(),\n        AuthParameters: authParameters,\n        ClientMetadata: authDetails.getValidationData(),\n      };\n      if (this.getUserContextData(this.username)) {\n        jsonReq.UserContextData = this.getUserContextData(this.username);\n      }\n\n      this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, (err, data) => {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        const challengeParameters = data.ChallengeParameters;\n\n        this.username = challengeParameters.USER_ID_FOR_SRP;\n        serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n        salt = new BigInteger(challengeParameters.SALT, 16);\n        this.getCachedDeviceKeyAndPassword();\n\n        authenticationHelper.getPasswordAuthenticationKey(\n          this.username,\n          authDetails.getPassword(),\n          serverBValue,\n          salt,\n          (errOnHkdf, hkdf) => {\n            // getPasswordAuthenticationKey callback start\n            if (errOnHkdf) {\n              callback.onFailure(errOnHkdf);\n            }\n\n            const dateNow = dateHelper.getNowString();\n\n            const signatureString = util.crypto.hmac(hkdf, util.buffer.concat([\n              new util.Buffer(this.pool.getUserPoolId().split('_')[1], 'utf8'),\n              new util.Buffer(this.username, 'utf8'),\n              new util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'),\n              new util.Buffer(dateNow, 'utf8'),\n            ]), 'base64', 'sha256');\n\n            const challengeResponses = {};\n\n            challengeResponses.USERNAME = this.username;\n            challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n            challengeResponses.TIMESTAMP = dateNow;\n            challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n            if (this.deviceKey != null) {\n              challengeResponses.DEVICE_KEY = this.deviceKey;\n            }\n\n            const respondToAuthChallenge = (challenge, challengeCallback) =>\n              this.client.makeUnauthenticatedRequest('respondToAuthChallenge', challenge,\n                (errChallenge, dataChallenge) => {\n                  if (errChallenge && errChallenge.code === 'ResourceNotFoundException' &&\n                      errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n                    challengeResponses.DEVICE_KEY = null;\n                    this.deviceKey = null;\n                    this.randomPassword = null;\n                    this.deviceGroupKey = null;\n                    this.clearCachedDeviceKeyAndPassword();\n                    return respondToAuthChallenge(challenge, challengeCallback);\n                  }\n                  return challengeCallback(errChallenge, dataChallenge);\n                });\n\n            const jsonReqResp = {\n              ChallengeName: 'PASSWORD_VERIFIER',\n              ClientId: this.pool.getClientId(),\n              ChallengeResponses: challengeResponses,\n              Session: data.Session,\n            };\n            if (this.getUserContextData()) {\n              jsonReqResp.UserContextData = this.getUserContextData();\n            }\n            respondToAuthChallenge(jsonReqResp, (errAuthenticate, dataAuthenticate) => {\n              if (errAuthenticate) {\n                return callback.onFailure(errAuthenticate);\n              }\n\n              const challengeName = dataAuthenticate.ChallengeName;\n              if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n                this.Session = dataAuthenticate.Session;\n                let userAttributes = null;\n                let rawRequiredAttributes = null;\n                const requiredAttributes = [];\n                const userAttributesPrefix = authenticationHelper\n                  .getNewPasswordRequiredChallengeUserAttributePrefix();\n\n                if (dataAuthenticate.ChallengeParameters) {\n                  userAttributes = JSON.parse(\n                    dataAuthenticate.ChallengeParameters.userAttributes);\n                  rawRequiredAttributes = JSON.parse(\n                    dataAuthenticate.ChallengeParameters.requiredAttributes);\n                }\n\n                if (rawRequiredAttributes) {\n                  for (let i = 0; i < rawRequiredAttributes.length; i++) {\n                    requiredAttributes[i] = rawRequiredAttributes[i].substr(\n                      userAttributesPrefix.length\n                    );\n                  }\n                }\n                return callback.newPasswordRequired(userAttributes, requiredAttributes);\n              }\n              return this.authenticateUserInternal(\n                dataAuthenticate,\n                authenticationHelper,\n                callback\n              );\n            });\n            return undefined;\n          // getPasswordAuthenticationKey callback end\n          });\n        return undefined;\n      });\n      // getLargeAValue callback end\n    });\n  }\n\n  /**\n  * PRIVATE ONLY: This is an internal only method and should not\n  * be directly called by the consumers.\n  * @param {object} dataAuthenticate authentication data\n  * @param {object} authenticationHelper helper created\n  * @param {callback} callback passed on from caller\n  * @returns {void}\n  */\n  authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n    const challengeName = dataAuthenticate.ChallengeName;\n    const challengeParameters = dataAuthenticate.ChallengeParameters;\n\n    if (challengeName === 'SMS_MFA') {\n      this.Session = dataAuthenticate.Session;\n      return callback.mfaRequired(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'SELECT_MFA_TYPE') {\n      this.Session = dataAuthenticate.Session;\n      return callback.selectMFAType(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'MFA_SETUP') {\n      this.Session = dataAuthenticate.Session;\n      return callback.mfaSetup(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'SOFTWARE_TOKEN_MFA') {\n      this.Session = dataAuthenticate.Session;\n      return callback.totpRequired(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'CUSTOM_CHALLENGE') {\n      this.Session = dataAuthenticate.Session;\n      return callback.customChallenge(challengeParameters);\n    }\n\n    if (challengeName === 'DEVICE_SRP_AUTH') {\n      this.getDeviceResponse(callback);\n      return undefined;\n    }\n\n    this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n    this.cacheTokens();\n\n    const newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n    if (newDeviceMetadata == null) {\n      return callback.onSuccess(this.signInUserSession);\n    }\n\n    authenticationHelper.generateHashDevice(\n      dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,\n      dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n    (errGenHash) => {\n      if (errGenHash) {\n        return callback.onFailure(errGenHash);\n      }\n\n      const deviceSecretVerifierConfig = {\n        Salt: new util.Buffer(\n            authenticationHelper.getSaltDevices(), 'hex'\n          ).toString('base64'),\n        PasswordVerifier: new util.Buffer(\n            authenticationHelper.getVerifierDevices(), 'hex'\n          ).toString('base64'),\n      };\n\n      this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n      this.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n      this.randomPassword = authenticationHelper.getRandomPassword();\n\n      this.client.makeUnauthenticatedRequest('confirmDevice', {\n        DeviceKey: newDeviceMetadata.DeviceKey,\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n        DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n        DeviceName: navigator.userAgent,\n      }, (errConfirm, dataConfirm) => {\n        if (errConfirm) {\n          return callback.onFailure(errConfirm);\n        }\n\n        this.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n        this.cacheDeviceKeyAndPassword();\n        if (dataConfirm.UserConfirmationNecessary === true) {\n          return callback.onSuccess(\n            this.signInUserSession, dataConfirm.UserConfirmationNecessary);\n        }\n        return callback.onSuccess(this.signInUserSession);\n      });\n      return undefined;\n    });\n    return undefined;\n  }\n\n  /**\n  * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n  * Pass the new password with any new user attributes to be updated.\n  * User attribute keys must be of format userAttributes.<attribute_name>.\n  * @param {string} newPassword new password for this user\n  * @param {object} requiredAttributeData map with values for all required attributes\n  * @param {object} callback Result callback map.\n  * @param {onFailure} callback.onFailure Called on any error.\n  * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n  * @param {customChallenge} callback.customChallenge Custom challenge\n  *         response required to continue.\n  * @param {authSuccess} callback.onSuccess Called on success with the new session.\n  * @returns {void}\n  */\n  completeNewPasswordChallenge(newPassword, requiredAttributeData, callback) {\n    if (!newPassword) {\n      return callback.onFailure(new Error('New password is required.'));\n    }\n    const authenticationHelper = new AuthenticationHelper(\n      this.pool.getUserPoolId().split('_')[1]);\n    const userAttributesPrefix = authenticationHelper\n      .getNewPasswordRequiredChallengeUserAttributePrefix();\n\n    const finalUserAttributes = {};\n    if (requiredAttributeData) {\n      Object.keys(requiredAttributeData).forEach((key) => {\n        finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n      });\n    }\n\n    finalUserAttributes.NEW_PASSWORD = newPassword;\n    finalUserAttributes.USERNAME = this.username;\n    const jsonReq = {\n      ChallengeName: 'NEW_PASSWORD_REQUIRED',\n      ClientId: this.pool.getClientId(),\n      ChallengeResponses: finalUserAttributes,\n      Session: this.Session,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge',\n        jsonReq, (errAuthenticate, dataAuthenticate) => {\n          if (errAuthenticate) {\n            return callback.onFailure(errAuthenticate);\n          }\n          return this.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n        });\n    return undefined;\n  }\n\n  /**\n   * This is used to get a session using device authentication. It is called at the end of user\n   * authentication\n   *\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   * @private\n   */\n  getDeviceResponse(callback) {\n    const authenticationHelper = new AuthenticationHelper(\n      this.deviceGroupKey);\n    const dateHelper = new DateHelper();\n\n    const authParameters = {};\n\n    authParameters.USERNAME = this.username;\n    authParameters.DEVICE_KEY = this.deviceKey;\n    authenticationHelper.getLargeAValue((errAValue, aValue) => {\n      // getLargeAValue callback start\n      if (errAValue) {\n        callback.onFailure(errAValue);\n      }\n\n      authParameters.SRP_A = aValue.toString(16);\n\n      const jsonReq = {\n        ChallengeName: 'DEVICE_SRP_AUTH',\n        ClientId: this.pool.getClientId(),\n        ChallengeResponses: authParameters,\n      };\n      if (this.getUserContextData()) {\n        jsonReq.UserContextData = this.getUserContextData();\n      }\n      this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, (err, data) => {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        const challengeParameters = data.ChallengeParameters;\n\n        const serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n        const salt = new BigInteger(challengeParameters.SALT, 16);\n\n        authenticationHelper.getPasswordAuthenticationKey(\n          this.deviceKey,\n          this.randomPassword,\n          serverBValue,\n          salt,\n          (errHkdf, hkdf) => {\n            // getPasswordAuthenticationKey callback start\n            if (errHkdf) {\n              return callback.onFailure(errHkdf);\n            }\n\n            const dateNow = dateHelper.getNowString();\n\n            const signatureString = util.crypto.hmac(hkdf, util.buffer.concat([\n              new util.Buffer(this.deviceGroupKey, 'utf8'),\n              new util.Buffer(this.deviceKey, 'utf8'),\n              new util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'),\n              new util.Buffer(dateNow, 'utf8'),\n            ]), 'base64', 'sha256');\n\n            const challengeResponses = {};\n\n            challengeResponses.USERNAME = this.username;\n            challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n            challengeResponses.TIMESTAMP = dateNow;\n            challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n            challengeResponses.DEVICE_KEY = this.deviceKey;\n\n            const jsonReqResp = {\n              ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n              ClientId: this.pool.getClientId(),\n              ChallengeResponses: challengeResponses,\n              Session: data.Session,\n            };\n            if (this.getUserContextData()) {\n              jsonReqResp.UserContextData = this.getUserContextData();\n            }\n\n            this.client.makeUnauthenticatedRequest('respondToAuthChallenge',\n                jsonReqResp, (errAuthenticate, dataAuthenticate) => {\n                  if (errAuthenticate) {\n                    return callback.onFailure(errAuthenticate);\n                  }\n\n                  this.signInUserSession = this.getCognitoUserSession(\n                      dataAuthenticate.AuthenticationResult\n                  );\n                  this.cacheTokens();\n\n                  return callback.onSuccess(this.signInUserSession);\n                });\n            return undefined;\n            // getPasswordAuthenticationKey callback end\n          });\n        return undefined;\n      });\n      // getLargeAValue callback end\n    });\n  }\n\n  /**\n   * This is used for a certain user to confirm the registration by using a confirmation code\n   * @param {string} confirmationCode Code entered by user.\n   * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  confirmRegistration(confirmationCode, forceAliasCreation, callback) {\n    const jsonReq = {\n      ClientId: this.pool.getClientId(),\n      ConfirmationCode: confirmationCode,\n      Username: this.username,\n      ForceAliasCreation: forceAliasCreation,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('confirmSignUp', jsonReq, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n  }\n\n  /**\n   * This is used by the user once he has the responses to a custom challenge\n   * @param {string} answerChallenge The custom challange answer.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {customChallenge} callback.customChallenge\n   *    Custom challenge response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  sendCustomChallengeAnswer(answerChallenge, callback) {\n    const challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.ANSWER = answerChallenge;\n\n    const authenticationHelper = new AuthenticationHelper(\n      this.pool.getUserPoolId().split('_')[1]);\n    this.getCachedDeviceKeyAndPassword();\n    if (this.deviceKey != null) {\n      challengeResponses.DEVICE_KEY = this.deviceKey;\n    }\n\n    const jsonReq = {\n      ChallengeName: 'CUSTOM_CHALLENGE',\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return this.authenticateUserInternal(data, authenticationHelper, callback);\n    });\n  }\n\n  /**\n   * This is used by the user once he has an MFA code\n   * @param {string} confirmationCode The MFA code entered by the user.\n   * @param {object} callback Result callback map.\n   * @param {string} mfaType The mfa we are replying to.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  sendMFACode(confirmationCode, callback, mfaType) {\n    const challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.SMS_MFA_CODE = confirmationCode;\n    const mfaTypeSelection = mfaType || 'SMS_MFA';\n    if (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n      challengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n    }\n\n    if (this.deviceKey != null) {\n      challengeResponses.DEVICE_KEY = this.deviceKey;\n    }\n\n    const jsonReq = {\n      ChallengeName: mfaTypeSelection,\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge',\n        jsonReq, (err, dataAuthenticate) => {\n          if (err) {\n            return callback.onFailure(err);\n          }\n\n          const challengeName = dataAuthenticate.ChallengeName;\n\n          if (challengeName === 'DEVICE_SRP_AUTH') {\n            this.getDeviceResponse(callback);\n            return undefined;\n          }\n\n          this.signInUserSession =\n            this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n          this.cacheTokens();\n\n          if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n            return callback.onSuccess(this.signInUserSession);\n          }\n\n          const authenticationHelper = new AuthenticationHelper(\n          this.pool.getUserPoolId().split('_')[1]);\n          authenticationHelper.generateHashDevice(\n            dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,\n            dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n            (errGenHash) => {\n              if (errGenHash) {\n                return callback.onFailure(errGenHash);\n              }\n\n              const deviceSecretVerifierConfig = {\n                Salt: new util.Buffer(\n                    authenticationHelper.getSaltDevices(), 'hex'\n                  ).toString('base64'),\n                PasswordVerifier: new util.Buffer(\n                    authenticationHelper.getVerifierDevices(), 'hex'\n                  ).toString('base64'),\n              };\n\n              this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n              this.deviceGroupKey = dataAuthenticate.AuthenticationResult\n                .NewDeviceMetadata.DeviceGroupKey;\n              this.randomPassword = authenticationHelper.getRandomPassword();\n\n              this.client.makeUnauthenticatedRequest('confirmDevice', {\n                DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n                AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n                DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n                DeviceName: navigator.userAgent,\n              }, (errConfirm, dataConfirm) => {\n                if (errConfirm) {\n                  return callback.onFailure(errConfirm);\n                }\n\n                this.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n                this.cacheDeviceKeyAndPassword();\n                if (dataConfirm.UserConfirmationNecessary === true) {\n                  return callback.onSuccess(\n                    this.signInUserSession,\n                    dataConfirm.UserConfirmationNecessary);\n                }\n                return callback.onSuccess(this.signInUserSession);\n              });\n              return undefined;\n            });\n          return undefined;\n        });\n  }\n\n  /**\n   * This is used by an authenticated user to change the current password\n   * @param {string} oldUserPassword The current password.\n   * @param {string} newUserPassword The requested new password.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  changePassword(oldUserPassword, newUserPassword, callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('changePassword', {\n      PreviousPassword: oldUserPassword,\n      ProposedPassword: newUserPassword,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by an authenticated user to enable MFA for himself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  enableMFA(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    const mfaOptions = [];\n    const mfaEnabled = {\n      DeliveryMedium: 'SMS',\n      AttributeName: 'phone_number',\n    };\n    mfaOptions.push(mfaEnabled);\n\n    this.client.makeUnauthenticatedRequest('setUserSettings', {\n      MFAOptions: mfaOptions,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by an authenticated user to enable MFA for himself\n   * @param {string[]} smsMfaSettings the sms mfa settings\n   * @param {string[]} softwareTokenMfaSettings the software token mfa settings\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('setUserMFAPreference', {\n      SMSMfaSettings: smsMfaSettings,\n      SoftwareTokenMfaSettings: softwareTokenMfaSettings,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by an authenticated user to disable MFA for himself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  disableMFA(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    const mfaOptions = [];\n\n    this.client.makeUnauthenticatedRequest('setUserSettings', {\n      MFAOptions: mfaOptions,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n\n  /**\n   * This is used by an authenticated user to delete himself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  deleteUser(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('deleteUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      this.clearCachedTokens();\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n   */\n  /**\n   * This is used by an authenticated user to change a list of attributes\n   * @param {AttributeArg[]} attributes A list of the new user attributes.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  updateAttributes(attributes, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('updateUserAttributes', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      UserAttributes: attributes,\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by an authenticated user to get a list of attributes\n   * @param {nodeCallback<CognitoUserAttribute[]>} callback Called on success or error.\n   * @returns {void}\n   */\n  getUserAttributes(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('getUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, (err, userData) => {\n      if (err) {\n        return callback(err, null);\n      }\n\n      const attributeList = [];\n\n      for (let i = 0; i < userData.UserAttributes.length; i++) {\n        const attribute = {\n          Name: userData.UserAttributes[i].Name,\n          Value: userData.UserAttributes[i].Value,\n        };\n        const userAttribute = new CognitoUserAttribute(attribute);\n        attributeList.push(userAttribute);\n      }\n\n      return callback(null, attributeList);\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by an authenticated user to get the MFAOptions\n   * @param {nodeCallback<MFAOptions>} callback Called on success or error.\n   * @returns {void}\n   */\n  getMFAOptions(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('getUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, (err, userData) => {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, userData.MFAOptions);\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by an authenticated user to delete a list of attributes\n   * @param {string[]} attributeList Names of the attributes to delete.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  deleteAttributes(attributeList, callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.makeUnauthenticatedRequest('deleteUserAttributes', {\n      UserAttributeNames: attributeList,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used by a user to resend a confirmation code\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  resendConfirmationCode(callback) {\n    const jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n    };\n\n    this.client.makeUnauthenticatedRequest('resendConfirmationCode', jsonReq, (err, result) => {\n      if (err) {\n        return callback(err, null);\n      }\n      return callback(null, result);\n    });\n  }\n\n  /**\n   * This is used to get a session, either from the session object\n   * or from  the local storage, or by using a refresh token\n   *\n   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n   * @returns {void}\n   */\n  getSession(callback) {\n    if (this.username == null) {\n      return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n    }\n\n    if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n      return callback(null, this.signInUserSession);\n    }\n\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n    const idTokenKey = `${keyPrefix}.idToken`;\n    const accessTokenKey = `${keyPrefix}.accessToken`;\n    const refreshTokenKey = `${keyPrefix}.refreshToken`;\n    const clockDriftKey = `${keyPrefix}.clockDrift`;\n\n    if (this.storage.getItem(idTokenKey)) {\n      const idToken = new CognitoIdToken({\n        IdToken: this.storage.getItem(idTokenKey),\n      });\n      const accessToken = new CognitoAccessToken({\n        AccessToken: this.storage.getItem(accessTokenKey),\n      });\n      const refreshToken = new CognitoRefreshToken({\n        RefreshToken: this.storage.getItem(refreshTokenKey),\n      });\n      const clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n\n      const sessionData = {\n        IdToken: idToken,\n        AccessToken: accessToken,\n        RefreshToken: refreshToken,\n        ClockDrift: clockDrift,\n      };\n      const cachedSession = new CognitoUserSession(sessionData);\n      if (cachedSession.isValid()) {\n        this.signInUserSession = cachedSession;\n        return callback(null, this.signInUserSession);\n      }\n\n      if (refreshToken.getToken() == null) {\n        return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n      }\n\n      this.refreshSession(refreshToken, callback);\n    } else {\n      callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n    }\n\n    return undefined;\n  }\n\n\n  /**\n   * This uses the refreshToken to retrieve a new session\n   * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n   * @returns {void}\n   */\n  refreshSession(refreshToken, callback) {\n    const authParameters = {};\n    authParameters.REFRESH_TOKEN = refreshToken.getToken();\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}`;\n    const lastUserKey = `${keyPrefix}.LastAuthUser`;\n\n    if (this.storage.getItem(lastUserKey)) {\n      this.username = this.storage.getItem(lastUserKey);\n      const deviceKeyKey = `${keyPrefix}.${this.username}.deviceKey`;\n      this.deviceKey = this.storage.getItem(deviceKeyKey);\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    const jsonReq = {\n      ClientId: this.pool.getClientId(),\n      AuthFlow: 'REFRESH_TOKEN_AUTH',\n      AuthParameters: authParameters,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, (err, authResult) => {\n      if (err) {\n        if (err.code === 'NotAuthorizedException') {\n          this.clearCachedTokens();\n        }\n        return callback(err, null);\n      }\n      if (authResult) {\n        const authenticationResult = authResult.AuthenticationResult;\n        if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n          authenticationResult.RefreshToken = refreshToken.getToken();\n        }\n        this.signInUserSession = this.getCognitoUserSession(authenticationResult);\n        this.cacheTokens();\n        return callback(null, this.signInUserSession);\n      }\n      return undefined;\n    });\n  }\n\n  /**\n   * This is used to save the session tokens to local storage\n   * @returns {void}\n   */\n  cacheTokens() {\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}`;\n    const idTokenKey = `${keyPrefix}.${this.username}.idToken`;\n    const accessTokenKey = `${keyPrefix}.${this.username}.accessToken`;\n    const refreshTokenKey = `${keyPrefix}.${this.username}.refreshToken`;\n    const clockDriftKey = `${keyPrefix}.${this.username}.clockDrift`;\n    const lastUserKey = `${keyPrefix}.LastAuthUser`;\n\n    this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n    this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n    this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n    this.storage.setItem(clockDriftKey, `${this.signInUserSession.getClockDrift()}`);\n    this.storage.setItem(lastUserKey, this.username);\n  }\n\n  /**\n   * This is used to cache the device key and device group and device password\n   * @returns {void}\n   */\n  cacheDeviceKeyAndPassword() {\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n    const deviceKeyKey = `${keyPrefix}.deviceKey`;\n    const randomPasswordKey = `${keyPrefix}.randomPasswordKey`;\n    const deviceGroupKeyKey = `${keyPrefix}.deviceGroupKey`;\n\n    this.storage.setItem(deviceKeyKey, this.deviceKey);\n    this.storage.setItem(randomPasswordKey, this.randomPassword);\n    this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n  }\n\n  /**\n   * This is used to get current device key and device group and device password\n   * @returns {void}\n   */\n  getCachedDeviceKeyAndPassword() {\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n    const deviceKeyKey = `${keyPrefix}.deviceKey`;\n    const randomPasswordKey = `${keyPrefix}.randomPasswordKey`;\n    const deviceGroupKeyKey = `${keyPrefix}.deviceGroupKey`;\n\n    if (this.storage.getItem(deviceKeyKey)) {\n      this.deviceKey = this.storage.getItem(deviceKeyKey);\n      this.randomPassword = this.storage.getItem(randomPasswordKey);\n      this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n    }\n  }\n\n  /**\n   * This is used to clear the device key info from local storage\n   * @returns {void}\n   */\n  clearCachedDeviceKeyAndPassword() {\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n    const deviceKeyKey = `${keyPrefix}.deviceKey`;\n    const randomPasswordKey = `${keyPrefix}.randomPasswordKey`;\n    const deviceGroupKeyKey = `${keyPrefix}.deviceGroupKey`;\n\n    this.storage.removeItem(deviceKeyKey);\n    this.storage.removeItem(randomPasswordKey);\n    this.storage.removeItem(deviceGroupKeyKey);\n  }\n\n  /**\n   * This is used to clear the session tokens from local storage\n   * @returns {void}\n   */\n  clearCachedTokens() {\n    const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}`;\n    const idTokenKey = `${keyPrefix}.${this.username}.idToken`;\n    const accessTokenKey = `${keyPrefix}.${this.username}.accessToken`;\n    const refreshTokenKey = `${keyPrefix}.${this.username}.refreshToken`;\n    const lastUserKey = `${keyPrefix}.LastAuthUser`;\n\n    this.storage.removeItem(idTokenKey);\n    this.storage.removeItem(accessTokenKey);\n    this.storage.removeItem(refreshTokenKey);\n    this.storage.removeItem(lastUserKey);\n  }\n\n  /**\n   * This is used to build a user session from tokens retrieved in the authentication result\n   * @param {object} authResult Successful auth response from server.\n   * @returns {CognitoUserSession} The new user session.\n   * @private\n   */\n  getCognitoUserSession(authResult) {\n    const idToken = new CognitoIdToken(authResult);\n    const accessToken = new CognitoAccessToken(authResult);\n    const refreshToken = new CognitoRefreshToken(authResult);\n\n    const sessionData = {\n      IdToken: idToken,\n      AccessToken: accessToken,\n      RefreshToken: refreshToken,\n    };\n\n    return new CognitoUserSession(sessionData);\n  }\n\n  /**\n   * This is used to initiate a forgot password request\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {inputVerificationCode?} callback.inputVerificationCode\n   *    Optional callback raised instead of onSuccess with response data.\n   * @param {onSuccess} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  forgotPassword(callback) {\n    const jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('forgotPassword', jsonReq, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      if (typeof callback.inputVerificationCode === 'function') {\n        return callback.inputVerificationCode(data);\n      }\n      return callback.onSuccess(data);\n    });\n  }\n\n  /**\n   * This is used to confirm a new password using a confirmationCode\n   * @param {string} confirmationCode Code entered by user.\n   * @param {string} newPassword Confirm new password.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<void>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  confirmPassword(confirmationCode, newPassword, callback) {\n    const jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n      ConfirmationCode: confirmationCode,\n      Password: newPassword,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('confirmForgotPassword', jsonReq, err => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess();\n    });\n  }\n\n  /**\n   * This is used to initiate an attribute confirmation request\n   * @param {string} attributeName User attribute that needs confirmation.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n   * @returns {void}\n   */\n  getAttributeVerificationCode(attributeName, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('getUserAttributeVerificationCode', {\n      AttributeName: attributeName,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      if (typeof callback.inputVerificationCode === 'function') {\n        return callback.inputVerificationCode(data);\n      }\n      return callback.onSuccess();\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to confirm an attribute using a confirmation code\n   * @param {string} attributeName Attribute being confirmed.\n   * @param {string} confirmationCode Code entered by user.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  verifyAttribute(attributeName, confirmationCode, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('verifyUserAttribute', {\n      AttributeName: attributeName,\n      Code: confirmationCode,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to get the device information using the current device key\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n   * @returns {void}\n   */\n  getDevice(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('getDevice', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n    }, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess(data);\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to forget a specific device\n   * @param {string} deviceKey Device key.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  forgetSpecificDevice(deviceKey, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('forgetDevice', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: deviceKey,\n    }, err => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to forget the current device\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  forgetDevice(callback) {\n    this.forgetSpecificDevice(this.deviceKey, {\n      onFailure: callback.onFailure,\n      onSuccess: result => {\n        this.deviceKey = null;\n        this.deviceGroupKey = null;\n        this.randomPassword = null;\n        this.clearCachedDeviceKeyAndPassword();\n        return callback.onSuccess(result);\n      },\n    });\n  }\n\n  /**\n   * This is used to set the device status as remembered\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  setDeviceStatusRemembered(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n      DeviceRememberedStatus: 'remembered',\n    }, err => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to set the device status as not remembered\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  setDeviceStatusNotRemembered(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n      DeviceRememberedStatus: 'not_remembered',\n    }, err => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to list all devices for a user\n   *\n   * @param {int} limit the number of devices returned in a call\n   * @param {string} paginationToken the pagination token in case any was returned before\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n   * @returns {void}\n   */\n  listDevices(limit, paginationToken, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('listDevices', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      Limit: limit,\n      PaginationToken: paginationToken,\n    }, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      return callback.onSuccess(data);\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used to globally revoke all tokens issued to a user\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  globalSignOut(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.makeUnauthenticatedRequest('globalSignOut', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n    }, err => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      this.clearCachedTokens();\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n\n  /**\n   * This is used for the user to signOut of the application and clear the cached tokens.\n   * @returns {void}\n   */\n  signOut() {\n    this.signInUserSession = null;\n    this.clearCachedTokens();\n  }\n\n  /**\n   * This is used by a user trying to select a given MFA\n   * @param {string} answerChallenge the mfa the user wants\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  sendMFASelectionAnswer(answerChallenge, callback) {\n    const challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.ANSWER = answerChallenge;\n\n    const jsonReq = {\n      ChallengeName: 'SELECT_MFA_TYPE',\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session,\n    };\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n    this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, (err, data) => {\n      if (err) {\n        return callback.onFailure(err);\n      }\n      this.Session = data.Session;\n      if (answerChallenge === 'SMS_MFA') {\n        return callback.mfaRequired(data.challengeName, data.challengeParameters);\n      }\n      if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n        return callback.totpRequired(data.challengeName, data.challengeParameters);\n      }\n      return undefined;\n    });\n  }\n\n  /**\n   * This returns the user context data for advanced security feature.\n   * @returns {void}\n   */\n  getUserContextData() {\n    const pool = this.pool;\n    return pool.getUserContextData(this.username);\n  }\n\n  /**\n   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  associateSoftwareToken(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.client.makeUnauthenticatedRequest('associateSoftwareToken', {\n        Session: this.Session,\n      }, (err, data) => {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        this.Session = data.Session;\n        return callback.associateSecretCode(data.SecretCode);\n      });\n    } else {\n      this.client.makeUnauthenticatedRequest('associateSoftwareToken', {\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      }, (err, data) => {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        return callback.associateSecretCode(data.SecretCode);\n      });\n    }\n  }\n\n  /**\n   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n   * @param {string} totpCode The MFA code entered by the user.\n   * @param {string} friendlyDeviceName The device name we are assigning to the device.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.client.makeUnauthenticatedRequest('verifySoftwareToken', {\n        Session: this.Session,\n        UserCode: totpCode,\n        FriendlyDeviceName: friendlyDeviceName,\n      }, (err, data) => {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        this.Session = data.Session;\n        const challengeResponses = {};\n        challengeResponses.USERNAME = this.username;\n        const jsonReq = {\n          ChallengeName: 'MFA_SETUP',\n          ClientId: this.pool.getClientId(),\n          ChallengeResponses: challengeResponses,\n          Session: this.Session,\n        };\n        if (this.getUserContextData()) {\n          jsonReq.UserContextData = this.getUserContextData();\n        }\n        this.client.makeUnauthenticatedRequest('respondToAuthChallenge',\n            jsonReq, (errRespond, dataRespond) => {\n              if (errRespond) {\n                return callback.onFailure(errRespond);\n              }\n              this.signInUserSession = this.getCognitoUserSession(dataRespond.AuthenticationResult);\n              this.cacheTokens();\n              return callback.onSuccess(this.signInUserSession);\n            });\n        return undefined;\n      });\n    } else {\n      this.client.makeUnauthenticatedRequest('verifySoftwareToken', {\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n        UserCode: totpCode,\n        FriendlyDeviceName: friendlyDeviceName,\n      }, (err, data) => {\n        if (err) {\n          return callback.onFailure(err);\n        }\n        return callback.onSuccess(data);\n      });\n    }\n  }\n}\n"
  },
  {
    "path": "src/CognitoUserAttribute.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nexport default class CognitoUserAttribute {\n  /**\n   * Constructs a new CognitoUserAttribute object\n   * @param {string=} Name The record's name\n   * @param {string=} Value The record's value\n   */\n  constructor({ Name, Value } = {}) {\n    this.Name = Name || '';\n    this.Value = Value || '';\n  }\n\n  /**\n   * @returns {string} the record's value.\n   */\n  getValue() {\n    return this.Value;\n  }\n\n  /**\n   * Sets the record's value.\n   * @param {string} value The new value.\n   * @returns {CognitoUserAttribute} The record for method chaining.\n   */\n  setValue(value) {\n    this.Value = value;\n    return this;\n  }\n\n  /**\n   * @returns {string} the record's name.\n   */\n  getName() {\n    return this.Name;\n  }\n\n  /**\n   * Sets the record's name\n   * @param {string} name The new name.\n   * @returns {CognitoUserAttribute} The record for method chaining.\n   */\n  setName(name) {\n    this.Name = name;\n    return this;\n  }\n\n  /**\n   * @returns {string} a string representation of the record.\n   */\n  toString() {\n    return JSON.stringify(this);\n  }\n\n  /**\n   * @returns {object} a flat object representing the record.\n   */\n  toJSON() {\n    return {\n      Name: this.Name,\n      Value: this.Value,\n    };\n  }\n}\n"
  },
  {
    "path": "src/CognitoUserPool.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CognitoIdentityServiceProvider from 'aws-sdk/clients/cognitoidentityserviceprovider';\n\nimport CognitoUser from './CognitoUser';\nimport StorageHelper from './StorageHelper';\n\n/** @class */\nexport default class CognitoUserPool {\n  /**\n   * Constructs a new CognitoUserPool object\n   * @param {object} data Creation options.\n   * @param {string} data.UserPoolId Cognito user pool id.\n   * @param {string} data.ClientId User pool application client id.\n   * @param {object} data.Storage Optional storage object.\n   * @param {boolean} data.AdvancedSecurityDataCollectionFlag Optional:\n   *        boolean flag indicating if the data collection is enabled\n   *        to support cognito advanced security features. By default, this\n   *        flag is set to true.\n   */\n  constructor(data) {\n    const { UserPoolId, ClientId, endpoint, AdvancedSecurityDataCollectionFlag } = data || {};\n    if (!UserPoolId || !ClientId) {\n      throw new Error('Both UserPoolId and ClientId are required.');\n    }\n    if (!/^[\\w-]+_.+$/.test(UserPoolId)) {\n      throw new Error('Invalid UserPoolId format.');\n    }\n    const region = UserPoolId.split('_')[0];\n\n    this.userPoolId = UserPoolId;\n    this.clientId = ClientId;\n\n    this.client = new CognitoIdentityServiceProvider({\n      apiVersion: '2016-04-19',\n      region,\n      endpoint,\n    });\n\n    /**\n     * By default, AdvancedSecurityDataCollectionFlag is set to true,\n     * if no input value is provided.\n     */\n    this.advancedSecurityDataCollectionFlag = AdvancedSecurityDataCollectionFlag !== false;\n\n    this.storage = data.Storage || new StorageHelper().getStorage();\n  }\n\n  /**\n   * @returns {string} the user pool id\n   */\n  getUserPoolId() {\n    return this.userPoolId;\n  }\n\n  /**\n   * @returns {string} the client id\n   */\n  getClientId() {\n    return this.clientId;\n  }\n\n  /**\n   * @typedef {object} SignUpResult\n   * @property {CognitoUser} user New user.\n   * @property {bool} userConfirmed If the user is already confirmed.\n   */\n  /**\n   * method for signing up a user\n   * @param {string} username User's username.\n   * @param {string} password Plain-text initial password entered by user.\n   * @param {(AttributeArg[])=} userAttributes New user attributes.\n   * @param {(AttributeArg[])=} validationData Application metadata.\n   * @param {nodeCallback<SignUpResult>} callback Called on error or with the new user.\n   * @returns {void}\n   */\n  signUp(username, password, userAttributes, validationData, callback) {\n    const jsonReq = {\n      ClientId: this.clientId,\n      Username: username,\n      Password: password,\n      UserAttributes: userAttributes,\n      ValidationData: validationData,\n    };\n    if (this.getUserContextData(username)) {\n      jsonReq.UserContextData = this.getUserContextData(username);\n    }\n    this.client.makeUnauthenticatedRequest('signUp', jsonReq, (err, data) => {\n      if (err) {\n        return callback(err, null);\n      }\n\n      const cognitoUser = {\n        Username: username,\n        Pool: this,\n        Storage: this.storage,\n      };\n\n      const returnData = {\n        user: new CognitoUser(cognitoUser),\n        userConfirmed: data.UserConfirmed,\n        userSub: data.UserSub,\n      };\n\n      return callback(null, returnData);\n    });\n  }\n\n\n  /**\n   * method for getting the current user of the application from the local storage\n   *\n   * @returns {CognitoUser} the user retrieved from storage\n   */\n  getCurrentUser() {\n    const lastUserKey = `CognitoIdentityServiceProvider.${this.clientId}.LastAuthUser`;\n\n    const lastAuthUser = this.storage.getItem(lastUserKey);\n    if (lastAuthUser) {\n      const cognitoUser = {\n        Username: lastAuthUser,\n        Pool: this,\n        Storage: this.storage,\n      };\n\n      return new CognitoUser(cognitoUser);\n    }\n\n    return null;\n  }\n\n  /**\n   * This method returns the encoded data string used for cognito advanced security feature.\n   * This would be generated only when developer has included the JS used for collecting the\n   * data on their client. Please refer to documentation to know more about using AdvancedSecurity\n   * features\n   * @param {string} username the username for the context data\n   * @returns {string} the user context data\n   **/\n  getUserContextData(username) {\n    if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {\n      return undefined;\n    }\n    /* eslint-disable */\n    const amazonCognitoAdvancedSecurityDataConst = AmazonCognitoAdvancedSecurityData;\n    /* eslint-enable */\n\n    if (this.advancedSecurityDataCollectionFlag) {\n      const advancedSecurityData = amazonCognitoAdvancedSecurityDataConst.getData(username,\n          this.userPoolId, this.clientId);\n      if (advancedSecurityData) {\n        const userContextData = {\n          EncodedData: advancedSecurityData,\n        };\n        return userContextData;\n      }\n    }\n    return {};\n  }\n}\n"
  },
  {
    "path": "src/CognitoUserSession.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nexport default class CognitoUserSession {\n  /**\n   * Constructs a new CognitoUserSession object\n   * @param {CognitoIdToken} IdToken The session's Id token.\n   * @param {CognitoRefreshToken=} RefreshToken The session's refresh token.\n   * @param {CognitoAccessToken} AccessToken The session's access token.\n   * @param {int} ClockDrift The saved computer's clock drift or undefined to force calculation.\n   */\n  constructor({ IdToken, RefreshToken, AccessToken, ClockDrift } = {}) {\n    if (AccessToken == null || IdToken == null) {\n      throw new Error('Id token and Access Token must be present.');\n    }\n\n    this.idToken = IdToken;\n    this.refreshToken = RefreshToken;\n    this.accessToken = AccessToken;\n    this.clockDrift = ClockDrift === undefined ? this.calculateClockDrift() : ClockDrift;\n  }\n\n  /**\n   * @returns {CognitoIdToken} the session's Id token\n   */\n  getIdToken() {\n    return this.idToken;\n  }\n\n  /**\n   * @returns {CognitoRefreshToken} the session's refresh token\n   */\n  getRefreshToken() {\n    return this.refreshToken;\n  }\n\n  /**\n   * @returns {CognitoAccessToken} the session's access token\n   */\n  getAccessToken() {\n    return this.accessToken;\n  }\n\n  /**\n   * @returns {int} the session's clock drift\n   */\n  getClockDrift() {\n    return this.clockDrift;\n  }\n\n  /**\n   * @returns {int} the computer's clock drift\n   */\n  calculateClockDrift() {\n    const now = Math.floor(new Date() / 1000);\n    const iat = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt());\n\n    return now - iat;\n  }\n\n  /**\n   * Checks to see if the session is still valid based on session expiry information found\n   * in tokens and the current time (adjusted with clock drift)\n   * @returns {boolean} if the session is still valid\n   */\n  isValid() {\n    const now = Math.floor(new Date() / 1000);\n    const adjusted = now - this.clockDrift;\n\n    return adjusted < this.accessToken.getExpiration() && adjusted < this.idToken.getExpiration();\n  }\n}\n"
  },
  {
    "path": "src/CookieStorage.js",
    "content": "\nimport * as Cookies from 'js-cookie';\n\n/** @class */\nexport default class CookieStorage {\n\n  /**\n   * Constructs a new CookieStorage object\n   * @param {object} data Creation options.\n   * @param {string} data.domain Cookies domain (mandatory).\n   * @param {string} data.path Cookies path (default: '/')\n   * @param {integer} data.expires Cookie expiration (in days, default: 365)\n   * @param {boolean} data.secure Cookie secure flag (default: true)\n   */\n  constructor(data) {\n    this.domain = data.domain;\n    if (data.path) {\n      this.path = data.path;\n    } else {\n      this.path = '/';\n    }\n    if (Object.prototype.hasOwnProperty.call(data, 'expires')) {\n      this.expires = data.expires;\n    } else {\n      this.expires = 365;\n    }\n    if (Object.prototype.hasOwnProperty.call(data, 'secure')) {\n      this.secure = data.secure;\n    } else {\n      this.secure = true;\n    }\n  }\n\n  /**\n   * This is used to set a specific item in storage\n   * @param {string} key - the key for the item\n   * @param {object} value - the value\n   * @returns {string} value that was set\n   */\n  setItem(key, value) {\n    Cookies.set(key, value, {\n      path: this.path,\n      expires: this.expires,\n      domain: this.domain,\n      secure: this.secure,\n    }\n    );\n    return Cookies.get(key);\n  }\n\n  /**\n   * This is used to get a specific key from storage\n   * @param {string} key - the key for the item\n   * This is used to clear the storage\n   * @returns {string} the data item\n   */\n  getItem(key) {\n    return Cookies.get(key);\n  }\n\n  /**\n   * This is used to remove an item from storage\n   * @param {string} key - the key being set\n   * @returns {string} value - value that was deleted\n   */\n  removeItem(key) {\n    return Cookies.remove(key, {\n      path: this.path,\n      domain: this.domain,\n      secure: this.secure,\n    }\n    );\n  }\n\n  /**\n   * This is used to clear the storage\n   * @returns {string} nothing\n   */\n  clear() {\n    const cookies = Cookies.get();\n    let index;\n    for (index = 0; index < cookies.length; ++index) {\n      Cookies.remove(cookies[index]);\n    }\n    return {};\n  }\n}\n"
  },
  {
    "path": "src/DateHelper.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst monthNames =\n  ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nconst weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n/** @class */\nexport default class DateHelper {\n  /**\n   * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n   */\n  getNowString() {\n    const now = new Date();\n\n    const weekDay = weekNames[now.getUTCDay()];\n    const month = monthNames[now.getUTCMonth()];\n    const day = now.getUTCDate();\n\n    let hours = now.getUTCHours();\n    if (hours < 10) {\n      hours = `0${hours}`;\n    }\n\n    let minutes = now.getUTCMinutes();\n    if (minutes < 10) {\n      minutes = `0${minutes}`;\n    }\n\n    let seconds = now.getUTCSeconds();\n    if (seconds < 10) {\n      seconds = `0${seconds}`;\n    }\n\n    const year = now.getUTCFullYear();\n\n    // ddd MMM D HH:mm:ss UTC YYYY\n    const dateNow = `${weekDay} ${month} ${day} ${hours}:${minutes}:${seconds} UTC ${year}`;\n\n    return dateNow;\n  }\n}\n"
  },
  {
    "path": "src/StorageHelper-rn.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AsyncStorage } from 'react-native';\n\nconst MEMORY_KEY_PREFIX = '@MemoryStorage:';\nlet dataMemory = {};\n\n/** @class */\nclass MemoryStorage {\n\n  /**\n   * This is used to set a specific item in storage\n   * @param {string} key - the key for the item\n   * @param {object} value - the value\n   * @returns {string} value that was set\n   */\n  static setItem(key, value) {\n    AsyncStorage.setItem(MEMORY_KEY_PREFIX + key, value);\n    dataMemory[key] = value;\n    return dataMemory[key];\n  }\n\n  /**\n   * This is used to get a specific key from storage\n   * @param {string} key - the key for the item\n   * This is used to clear the storage\n   * @returns {string} the data item\n   */\n  static getItem(key) {\n    return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n  }\n\n  /**\n   * This is used to remove an item from storage\n   * @param {string} key - the key being set\n   * @returns {string} value - value that was deleted\n   */\n  static removeItem(key) {\n    AsyncStorage.removeItem(MEMORY_KEY_PREFIX + key);\n    return delete dataMemory[key];\n  }\n\n  /**\n   * This is used to clear the storage\n   * @returns {string} nothing\n   */\n  static clear() {\n    dataMemory = {};\n    return dataMemory;\n  }\n\n  /**\n  * Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage\n  * @param {nodeCallback<string>} callback callback with (err, 'SUCCESS')\n  * @returns {void}\n  */\n  static sync(callback) {\n    AsyncStorage.getAllKeys((errKeys, keys) => {\n      if (errKeys) return callback(errKeys, null);\n      const memoryKeys = keys.filter((key) => key.startsWith(MEMORY_KEY_PREFIX));\n      AsyncStorage.multiGet(memoryKeys, (err, stores) => {\n        if (err) return callback(err, null);\n        stores.map((result, index, store) => {\n          const key = store[index][0];\n          const value = store[index][1];\n          const memoryKey = key.replace(MEMORY_KEY_PREFIX, '');\n          dataMemory[memoryKey] = value;\n          return undefined;\n        });\n        callback(null, 'SUCCESS');\n        return undefined;\n      });\n      return undefined;\n    });\n  }\n}\n\n/** @class */\nexport default class StorageHelper {\n\n  /**\n   * This is used to get a storage object\n   * @returns {object} the storage\n   */\n  constructor() {\n    this.storageWindow = MemoryStorage;\n  }\n\n  /**\n   * This is used to return the storage\n   * @returns {object} the storage\n   */\n  getStorage() {\n    return this.storageWindow;\n  }\n}\n"
  },
  {
    "path": "src/StorageHelper.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet dataMemory = {};\n\n/** @class */\nclass MemoryStorage {\n\n  /**\n   * This is used to set a specific item in storage\n   * @param {string} key - the key for the item\n   * @param {object} value - the value\n   * @returns {string} value that was set\n   */\n  static setItem(key, value) {\n    dataMemory[key] = value;\n    return dataMemory[key];\n  }\n\n  /**\n   * This is used to get a specific key from storage\n   * @param {string} key - the key for the item\n   * This is used to clear the storage\n   * @returns {string} the data item\n   */\n  static getItem(key) {\n    return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n  }\n\n  /**\n   * This is used to remove an item from storage\n   * @param {string} key - the key being set\n   * @returns {string} value - value that was deleted\n   */\n  static removeItem(key) {\n    return delete dataMemory[key];\n  }\n\n  /**\n   * This is used to clear the storage\n   * @returns {string} nothing\n   */\n  static clear() {\n    dataMemory = {};\n    return dataMemory;\n  }\n}\n\n/** @class */\nexport default class StorageHelper {\n\n  /**\n   * This is used to get a storage object\n   * @returns {object} the storage\n   */\n  constructor() {\n    try {\n      this.storageWindow = window.localStorage;\n      this.storageWindow.setItem('aws.cognito.test-ls', 1);\n      this.storageWindow.removeItem('aws.cognito.test-ls');\n    } catch (exception) {\n      this.storageWindow = MemoryStorage;\n    }\n  }\n\n  /**\n   * This is used to return the storage\n   * @returns {object} the storage\n   */\n  getStorage() {\n    return this.storageWindow;\n  }\n}\n"
  },
  {
    "path": "src/index.js",
    "content": "/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { default as AuthenticationDetails } from './AuthenticationDetails';\nexport { default as AuthenticationHelper } from './AuthenticationHelper';\nexport { default as CognitoAccessToken } from './CognitoAccessToken';\nexport { default as CognitoIdToken } from './CognitoIdToken';\nexport { default as CognitoRefreshToken } from './CognitoRefreshToken';\nexport { default as CognitoUser } from './CognitoUser';\nexport { default as CognitoUserAttribute } from './CognitoUserAttribute';\nexport { default as CognitoUserPool } from './CognitoUserPool';\nexport { default as CognitoUserSession } from './CognitoUserSession';\nexport { default as CookieStorage } from './CookieStorage';\nexport { default as DateHelper } from './DateHelper';\n\n// The version of crypto-browserify included by aws-sdk only\n// checks for window.crypto, not window.msCrypto as used by\n// IE 11 – so we set it explicitly here\nif (typeof window !== 'undefined' && !window.crypto && window.msCrypto) {\n  window.crypto = window.msCrypto;\n}\n"
  },
  {
    "path": "webpack.config.js",
    "content": "/* eslint-disable */\nvar webpack = require('webpack');\n\nvar banner = '/*!\\n' +\n' * Copyright 2016 Amazon.com,\\n' +\n' * Inc. or its affiliates. All Rights Reserved.\\n' +\n' * \\n' +\n' * Licensed under the Amazon Software License (the \"License\").\\n' +\n' * You may not use this file except in compliance with the\\n' +\n' * License. A copy of the License is located at\\n' +\n' * \\n' +\n' *     http://aws.amazon.com/asl/\\n' +\n' * \\n' +\n' * or in the \"license\" file accompanying this file. This file is\\n' +\n' * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\\n' +\n' * CONDITIONS OF ANY KIND, express or implied. See the License\\n' +\n' * for the specific language governing permissions and\\n' +\n' * limitations under the License. \\n' +\n' */\\n\\n';\n\nvar config = {\n  entry: './enhance',\n  output: {\n    libraryTarget: 'umd',\n    library: 'AmazonCognitoIdentity'\n  },\n  externals: {\n    // This umd context config isn't in configuration documentation, but see example:\n    // https://github.com/webpack/webpack/tree/master/examples/externals\n    'aws-sdk/global': {\n      root: ['AWSCognito'],\n      commonjs2: 'aws-sdk/global',\n      commonjs: 'aws-sdk/global',\n      amd: 'aws-sdk/global'\n    },\n    'aws-sdk/clients/cognitoidentityserviceprovider': {\n      root: ['AWSCognito', 'CognitoIdentityServiceProvider'],\n      commonjs2: 'aws-sdk/clients/cognitoidentityserviceprovider',\n      commonjs: 'aws-sdk/clients/cognitoidentityserviceprovider',\n      amd: 'aws-sdk/clients/cognitoidentityserviceprovider'\n    },\n  },\n  plugins: [\n    new webpack.optimize.OccurrenceOrderPlugin(),\n    new webpack.BannerPlugin(banner, { raw: true })\n  ],\n  module: {\n    loaders: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        loader: 'babel',\n        query: {\n          cacheDirectory: './node_modules/.cache/babel'\n        }\n      }\n    ]\n  }\n};\n\nif (process.env.NODE_ENV === 'production') {\n  config.devtool = 'source-map';\n  config.plugins.push(\n    new webpack.optimize.UglifyJsPlugin({\n      compress: {\n        warnings: false\n      }\n    })\n  );\n}\n\nmodule.exports = config;\n"
  }
]