{"version":3,"sources":["webpack:///./node_modules/@aws-amplify/ui-components/dist/esm-es5/amplify-radio-button_3.entry.js","webpack:///./node_modules/@aws-amplify/ui-components/dist/esm-es5/auth-helpers-557b83fc.js","webpack:///./node_modules/@aws-amplify/ui-components/dist/esm-es5/amplify-authenticator.entry.js","webpack:///./node_modules/@aws-amplify/ui-components/dist/esm-es5/amplify-confirm-sign-in_7.entry.js"],"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","Symbol","iterator","this","n","v","op","TypeError","call","pop","length","push","amplifyRadioButtonCss","AmplifyRadioButton","hostRef","placeholder","checked","disabled","prototype","componentWillLoad","console","warn","render","class","Object","assign","type","name","onInput","handleInputChange","id","fieldId","inputProps","htmlFor","style","amplifyToastCss","AmplifyToast","message","onClick","handleClose","toSJISFunction","canPromise","CODEWORDS_COUNT","getSymbolSize","version","Error","getSymbolTotalCodewords","getBCHDigit","data","digit","setToSJISFunction","isKanjiModeEnabled","toSJIS","kanji","utils","createCommonjsModule","fn","basedir","module","path","exports","require","base","commonjsRequire","errorCorrectionLevel","fromString","string","lcStr","toLowerCase","L","M","Q","H","bit","isValid","level","from","defaultValue","BitBuffer","buffer","get","index","bufIndex","Math","floor","put","num","i","putBit","getLengthInBits","bitBuffer","BitMatrix","size","Uint8Array","reservedBit","set","row","col","reserved","xor","isReserved","bitMatrix","alignmentPattern","getRowColCoords","posCount","intervals","ceil","positions","reverse","getPositions","coords","pos","posLength","j","getSymbolSize$1","FINDER_PATTERN_SIZE","finderPattern","maskPattern","Patterns","PATTERN000","PATTERN001","PATTERN010","PATTERN011","PATTERN100","PATTERN101","PATTERN110","PATTERN111","PenaltyScores","N1","N2","N3","N4","getMaskAt","mask","isNaN","parseInt","undefined","getPenaltyN1","points","sameCountCol","sameCountRow","lastCol","lastRow","module_1","getPenaltyN2","last","getPenaltyN3","bitsCol","bitsRow","getPenaltyN4","darkCount","modulesCount","k","abs","applyMask","pattern","getBestMask","setupFormatFunc","numPatterns","keys","bestPattern","lowerPenalty","Infinity","p","penalty","EC_BLOCKS_TABLE","EC_CODEWORDS_TABLE","getBlocksCount","errorCorrectionLevel$1","getTotalCodewordsCount","errorCorrectionCode","EXP_TABLE","LOG_TABLE","x","log","exp","mul","galoisField","polynomial","p1","p2","coeff","mod","divident","divisor","offset","slice","generateECPolynomial","degree","poly","ReedSolomonEncoder","genPoly","initialize","encode","paddedData","remainder","start","buff","reedSolomonEncoder","versionCheck","numeric","alphanumeric","replace","byte","KANJI","RegExp","BYTE_KANJI","BYTE","NUMERIC","ALPHANUMERIC","TEST_KANJI","TEST_NUMERIC","TEST_ALPHANUMERIC","testKanji","str","test","testNumeric","testAlphanumeric","regex","mode","ccBits","MIXED","getCharCountIndicator","getBestModeForData","dataStr","toString","G18","G18_BCH","getBestVersionForDataLength","currentVersion","getCapacity","getReservedBitsCount","mode$1","getTotalBitsFromDataArray","segments","totalBits","forEach","reservedBits","getBitsLength","getBestVersionForMixedData","totalCodewords","ecTotalCodewords","dataTotalCodewordsBits","usableBits","getBestVersionForData","seg","ecl","Array","isArray","getLength","getEncodedBits","d","G15","G15_MASK","G15_BCH","formatInfo","NumericData","write","group","substr","remainingNum","numericData","ALPHA_NUM_CHARS","AlphanumericData","indexOf","alphanumericData","encodeUtf8","input","point","charCodeAt","second","ByteData","l","byteData","KanjiData","kanjiData","dijkstra_1","dijkstra","single_source_shortest_paths","graph","s","predecessors","costs","closest","u","cost_of_s_to_u","adjacent_nodes","cost_of_e","cost_of_s_to_u_plus_cost_of_e","cost_of_s_to_v","first_visit","open","PriorityQueue","make","empty","cost","hasOwnProperty","msg","join","extract_shortest_path_from_predecessor_list","nodes","find_path","opts","key","T","queue","sorter","default_sorter","a","b","item","sort","shift","getStringByteLength","unescape","encodeURIComponent","getSegments","exec","getSegmentsFromString","byteSegs","kanjiSegs","numSegs","alphaNumSegs","segs","concat","s1","s2","map","obj","getSegmentBitsLength","mergeSegments","reduce","acc","curr","prevSeg","buildNodes","buildGraph","table","prevNodeIds","nodeGroup","currentNodeIds","node","lastCount","prevNodeId","end","buildSingleSegment","modesHint","bestMode","fromArray","array","optimizedSegs","rawSplit","setupFinderPattern","matrix","r","c","setupTimingPattern","setupAlignmentPattern","setupVersionInfo","version$1","bits","setupFormatInfo","setupData","inc","bitIndex","byteIndex","dark","createData","remainingByte","createCodewords","dataTotalCodewords","ecTotalBlocks","blocksInGroup2","blocksInGroup1","totalCodewordsInGroup1","dataCodewordsInGroup1","dataCodewordsInGroup2","ecCount","rs","dcData","ecData","maxDataSize","dataSize","max","createSymbol","maskPattern$1","segments$1","estimatedVersion","rawSegments","bestVersion","dataBits","moduleCount","modules","bind","create","options","toSJISFunc","qrcode","utils$1","hex2rgba","hex","hexCode","split","hexValue","getOptions","color","margin","width","scale","light","rendererOpts","getScale","qrSize","getImageWidth","qrToImageData","imgData","qr","symbolSize","scaledMargin","palette","posDst","pxColor","iSrc","jSrc","canvas","clearCanvas","ctx","clearRect","height","getCanvasElement","document","createElement","qrData","canvasEl","getContext","image","createImageData","putImageData","renderToDataURL","toDataURL","quality","getColorAttrib","attrib","alpha","toFixed","svgCmd","cmd","qrToPath","moveBy","newRow","lineLength","cb","qrcodesize","bg","viewBox","svgTag","renderCanvas","renderFunc","text","args","arguments","argsNum","isLastArgCb","create$1","toCanvas","toString_1","browser","amplifyTotpSetupCss","logger","AmplifyTOTPSetup","class_1","autoFocus","handleAuthStateChange","headerText","TOTP_HEADER_TEXT","issuer","TOTP_ISSUER","handleComplete","onTOTPEvent","standalone","code","setupMessage","qrCodeInput","loading","_this","_a","removeHubListener","authState","TOTPSetup","setup","handleUserChange","disconnectedCallback","buildOtpAuthPath","user","secretKey","username","debug","handleTotpInputChange","event","target","generateQRCode","codeFromTotp","error_1","_b","qrCodeImageSource","encodedIssuer","error_2","associateSoftwareToken","setupTOTP","encodeURI","TOTP_SETUP_FAILURE","verifyTotpToken","error_3","preventDefault","setPreferredMFA","TOTP","TOTP_SUCCESS_MESSAGE","error","submitButtonText","TOTP_SUBMIT_BUTTON_TEXT","handleSubmit","src","alt","QR_CODE_ALT","TOTP_LABEL","defineProperty","enumerable","configurable","checkContact","newUser","verifiedContact","isCognitoUser","SignedIn","verified","unverified","VerifyContact","handleSignIn","password","usernameAlias","signIn","challengeName","SMSMFA","SoftwareTokenMFA","ConfirmSignIn","NewPasswordRequired","challengeParam","ResetPassword","MFASetup","CustomChallenge","trigger","CustomConfirmSignIn","ConfirmSignUp","ForgotPassword","EMPTY_PASSWORD","EMPTY_USERNAME","email","EMPTY_EMAIL","phone_number","EMPTY_PHONE","authSlotNames","SignIn","SignUp","Loading","amplifyAuthenticatorCss","AmplifyAuthenticator","initialAuthState","hideToast","toastMessage","handleExternalAuthEvent","payload","handleToastEvent","authData","onAuthStateChange","listen","checkUser","currentAuthenticatedUser","catch","nextAuthState","info","SignedOut","getAuthComponent","federated","getSlotWithAuthComponent","authComponent","slotName","slotIsEmpty","el","querySelector","remove","__spreadArrays","il","jl","AmplifyConfirmSignIn","confirm","CONFIRM_SMS_CODE","CONFIRM","defaultFormFields","required","handleCodeChange","formFields","mfaOption","SMS","userHandler","CONFIRM_TOTP_CODE","constructedFormFieldOptions","constructFormFieldOptions","mfaType","confirmSignIn","content","formField","secondaryFooterContent","variant","BACK_TO_SIGN_IN","AmplifyConfirmSignUp","class_2","confirmSignUp","CONFIRM_SIGN_UP_HEADER_TEXT","CONFIRM_SIGN_UP_SUBMIT_BUTTON_TEXT","newFormFields","phoneNumber","countryDialCodeValue","phoneNumberValue","formFieldsHandler","buildFormFields","userInput","_signUpAttrs","signUpAttrs","buildDefaultFormFields","handleFormFieldInputChange","autocomplete","CONFIRM_SIGN_UP_CODE_LABEL","CONFIRM_SIGN_UP_CODE_PLACEHOLDER","hint","CONFIRM_SIGN_UP_LOST_CODE","resendConfirmCode","CONFIRM_SIGN_UP_RESEND_CODE","newFields_1","field","newField","handleFormFieldInputWithCallback","fieldType","setFieldValue","dialCode","fnToCall","callback","getUsername","resendSignUp","trim","confirmSignUpResult","CONFIRM_SIGN_UP_FAILED","AmplifyForgotPassword","class_3","RESET_YOUR_PASSWORD","sendButtonText","SEND_CODE","SUBMIT","handleSend","send","submit","delivery","forgotPasswordAttrs","newFields_2","formAttributes","error_4","forgotPassword","NEW_PASSWORD_LABEL","NEW_PASSWORD_PLACEHOLDER","CodeDeliveryDetails","error_5","forgotPasswordSubmit","submitFn","testDataPrefix","logger$1","AmplifyRequireNewPassword","class_4","CHANGE_PASSWORD","CHANGE_PASSWORD_ACTION","completeNewPassword","Password","handlePasswordChange","requiredAttributes","setCurrentUser","handleRequiredAttributeInputChange","attribute","formatPhoneNumber","error_6","userRequiredAttributes","requiredAttributesMap_1","currentUser","composedInput","err","error_7","amplifySignInCss","AmplifySignIn","class_5","SIGN_IN_HEADER_TEXT","SIGN_IN_ACTION","hideSignUp","signInAttributes","formFieldInputs","FORGOT_PASSWORD_TEXT","RESET_PASSWORD_TEXT","newFields_3","slot","NO_ACCOUNT_TEXT","CREATE_ACCOUNT_TEXT","amplifySignUpCss","AmplifySignUp","class_6","signUp","handleSignUp","params","authSignUp","SIGN_UP_HEADER_TEXT","SIGN_UP_SUBMIT_BUTTON_TEXT","haveAccountText","SIGN_UP_HAVE_ACCOUNT_TEXT","signInText","SIGN_IN_TEXT","signUpAttributes","attributes","SIGN_UP_FAILED","assignPhoneNumberToSignUpAttributes","assignUserNameAliasToSignUpAttributes","assignFormInputToSignUpAttributes","validateSignUpAttributes","USERNAME_REMOVE_WHITESPACE","PASSWORD_REMOVE_WHITESPACE","error_8","userConfirmed","SIGN_UP_EMAIL_PLACEHOLDER","SIGN_UP_PASSWORD_PLACEHOLDER","SIGN_UP_USERNAME_PLACEHOLDER","newFields_4","logger$2","AmplifyVerifyContact","class_7","verifyAttr","verify","contact","attr","error_9","verifyCurrentUserAttributeSubmit","error_10","verifyCurrentUserAttribute","inputName","renderSubmit","CODE_PLAC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,CACnQ,YAAa,yCAGzBgsB,EAAQ9sB,UAAUI,OAAS,WACvB,IAAI8c,EAAQje,KACZ,OAAQ,cAAD,CAAG,OAAM,KAAM,eAAE,uBAAwB,CAAEqgB,aAAc,SAAUtB,GAAS,OAAOd,EAAMoC,aAAatB,IAAWzB,WAAY,OAAKzY,IAAI,OAAa+pB,4BAA6B5Q,QAAShe,KAAKge,QAAS+H,uBAAwB,eAAE,OAAQ,KAAM,eAAE,iBAAkB,CAAEC,QAAS,SAAU7jB,QAAS,WAAc,OAAO8b,EAAMZ,sBAAsB,OAAU4D,SAAUhD,EAAMS,OAAU,YAAa,4BAA8B,OAAK7Z,IAAI,OAAagqB,QAAS1O,iBAAkBngB,KAAK8tB,WACpd,OAAKjpB,IAAI,OAAaiqB,6BACtB,OAAKjqB,IAAI,OAAakqB,8BAAgC/uB,KAAK8tB,WAAa9tB,KAAKuuB,eAAiBvuB,KAAKyuB,kBAE1GZ,EA7H8B","file":"js/chunk-2fcde6e6.866028d5.js","sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { r as registerInstance, h, H as Host } from './index-83f2275b.js';\nimport { Logger, I18n } from '@aws-amplify/core';\nimport { M as MfaOption, A as AuthState } from './auth-types-78df304e.js';\nimport { Auth } from '@aws-amplify/auth';\nimport { T as Translations } from './Translations-108d469f.js';\nimport { N as NO_AUTH_MODULE_FOUND } from './constants-c8ecaa24.js';\nimport { d as dispatchAuthStateChangeEvent, o as onAuthUIStateChange, a as dispatchToastHubEvent } from './helpers-14fcb50c.js';\nimport { c as checkContact } from './auth-helpers-557b83fc.js';\nvar amplifyRadioButtonCss = \":host{--font-family:var(--amplify-font-family)}.radio-button{display:block;width:100%;padding:16px;font-size:var(--amplify-text-sm);font-family:var(--font-family)}.radio-button input{margin-right:12px}\";\nvar AmplifyRadioButton = /** @class */ (function () {\n function AmplifyRadioButton(hostRef) {\n registerInstance(this, hostRef);\n /** (Optional) The placeholder for the input element. Using hints is recommended, but placeholders can also be useful to convey information to users. */\n this.placeholder = '';\n /** If `true`, the radio button is selected. */\n this.checked = false;\n /** If `true`, the checkbox is disabled */\n this.disabled = false;\n }\n AmplifyRadioButton.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n };\n AmplifyRadioButton.prototype.render = function () {\n return (h(\"span\", { class: \"radio-button\" }, h(\"input\", Object.assign({ type: \"radio\", name: this.name, value: this.value, onInput: this.handleInputChange, placeholder: this.placeholder, id: this.fieldId, checked: this.checked, disabled: this.disabled }, this.inputProps)), h(\"amplify-label\", { htmlFor: this.fieldId }, this.label)));\n };\n return AmplifyRadioButton;\n}());\nAmplifyRadioButton.style = amplifyRadioButtonCss;\nvar amplifyToastCss = \":host{--background-color:var(--amplify-secondary-tint);--color:var(--amplify-white);--font-size:var(--amplify-text-sm);--font-family:var(--amplify-font-family);--close-icon-color:var(--amplify-white);--close-icon-hover:var(--amplify-red)}.toast-icon{padding-right:5px}.toast{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;position:absolute;top:0;left:0;width:100%;z-index:99;-webkit-box-shadow:0 0 5px 0 rgba(0, 0, 0, 0.3);box-shadow:0 0 5px 0 rgba(0, 0, 0, 0.3);padding:16px;background-color:var(--background-color);font-size:var(--font-size);color:var(--color);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:5px;font-family:var(--font-family)}.toast>span{margin-right:10px}.toast-close{margin-left:auto;-ms-flex-item-align:center;align-self:center;position:relative;width:18px;height:18px;overflow:hidden;cursor:pointer;background:transparent;border:none}.toast-close::before,.toast-close::after{content:\\\"\\\";position:absolute;height:2px;width:100%;top:50%;left:0;margin-top:-1px;background:var(--close-icon-color)}.toast-close:hover::before,.toast-close:hover::after{background:var(--close-icon-hover)}.toast-close::before{-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.toast-close::after{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}\";\nvar AmplifyToast = /** @class */ (function () {\n function AmplifyToast(hostRef) {\n registerInstance(this, hostRef);\n /** Message to be displayed inside the toast*/\n this.message = '';\n }\n /*\n TODO #170365145: Work on a helper function that will populate and\n update class colors for success / warning / failure messages\n */\n AmplifyToast.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n };\n AmplifyToast.prototype.render = function () {\n return (h(\"div\", { class: \"toast\" }, h(\"amplify-icon\", { class: \"toast-icon\", name: \"warning\" }), this.message ? h(\"span\", null, this.message) : null, h(\"slot\", null), h(\"button\", { class: \"toast-close\", onClick: this.handleClose })));\n };\n return AmplifyToast;\n}());\nAmplifyToast.style = amplifyToastCss;\n// can-promise has a crash in some versions of react native that dont have\n// standard global objects\n// https://github.com/soldair/node-qrcode/issues/157\nvar canPromise = function () {\n return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then;\n};\nvar toSJISFunction;\nvar CODEWORDS_COUNT = [\n 0,\n 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,\n 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,\n 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,\n 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706\n];\n/**\n * Returns the QR Code size for the specified version\n *\n * @param {Number} version QR Code version\n * @return {Number} size of QR code\n */\nvar getSymbolSize = function getSymbolSize(version) {\n if (!version)\n throw new Error('\"version\" cannot be null or undefined');\n if (version < 1 || version > 40)\n throw new Error('\"version\" should be in range from 1 to 40');\n return version * 4 + 17;\n};\n/**\n * Returns the total number of codewords used to store data and EC information.\n *\n * @param {Number} version QR Code version\n * @return {Number} Data length in bits\n */\nvar getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {\n return CODEWORDS_COUNT[version];\n};\n/**\n * Encode data with Bose-Chaudhuri-Hocquenghem\n *\n * @param {Number} data Value to encode\n * @return {Number} Encoded value\n */\nvar getBCHDigit = function (data) {\n var digit = 0;\n while (data !== 0) {\n digit++;\n data >>>= 1;\n }\n return digit;\n};\nvar setToSJISFunction = function setToSJISFunction(f) {\n if (typeof f !== 'function') {\n throw new Error('\"toSJISFunc\" is not a valid function.');\n }\n toSJISFunction = f;\n};\nvar isKanjiModeEnabled = function () {\n return typeof toSJISFunction !== 'undefined';\n};\nvar toSJIS = function toSJIS(kanji) {\n return toSJISFunction(kanji);\n};\nvar utils = {\n getSymbolSize: getSymbolSize,\n getSymbolTotalCodewords: getSymbolTotalCodewords,\n getBCHDigit: getBCHDigit,\n setToSJISFunction: setToSJISFunction,\n isKanjiModeEnabled: isKanjiModeEnabled,\n toSJIS: toSJIS\n};\nfunction createCommonjsModule(fn, basedir, module) {\n return module = {\n path: basedir,\n exports: {},\n require: function (path, base) {\n return commonjsRequire();\n }\n }, fn(module, module.exports), module.exports;\n}\nfunction commonjsRequire() {\n throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n}\nvar errorCorrectionLevel = createCommonjsModule(function (module, exports) {\n exports.L = { bit: 1 };\n exports.M = { bit: 0 };\n exports.Q = { bit: 3 };\n exports.H = { bit: 2 };\n function fromString(string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string');\n }\n var lcStr = string.toLowerCase();\n switch (lcStr) {\n case 'l':\n case 'low':\n return exports.L;\n case 'm':\n case 'medium':\n return exports.M;\n case 'q':\n case 'quartile':\n return exports.Q;\n case 'h':\n case 'high':\n return exports.H;\n default:\n throw new Error('Unknown EC Level: ' + string);\n }\n }\n exports.isValid = function isValid(level) {\n return level && typeof level.bit !== 'undefined' &&\n level.bit >= 0 && level.bit < 4;\n };\n exports.from = function from(value, defaultValue) {\n if (exports.isValid(value)) {\n return value;\n }\n try {\n return fromString(value);\n }\n catch (e) {\n return defaultValue;\n }\n };\n});\nfunction BitBuffer() {\n this.buffer = [];\n this.length = 0;\n}\nBitBuffer.prototype = {\n get: function (index) {\n var bufIndex = Math.floor(index / 8);\n return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1;\n },\n put: function (num, length) {\n for (var i = 0; i < length; i++) {\n this.putBit(((num >>> (length - i - 1)) & 1) === 1);\n }\n },\n getLengthInBits: function () {\n return this.length;\n },\n putBit: function (bit) {\n var bufIndex = Math.floor(this.length / 8);\n if (this.buffer.length <= bufIndex) {\n this.buffer.push(0);\n }\n if (bit) {\n this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));\n }\n this.length++;\n }\n};\nvar bitBuffer = BitBuffer;\n/**\n * Helper class to handle QR Code symbol modules\n *\n * @param {Number} size Symbol size\n */\nfunction BitMatrix(size) {\n if (!size || size < 1) {\n throw new Error('BitMatrix size must be defined and greater than 0');\n }\n this.size = size;\n this.data = new Uint8Array(size * size);\n this.reservedBit = new Uint8Array(size * size);\n}\n/**\n * Set bit value at specified location\n * If reserved flag is set, this bit will be ignored during masking process\n *\n * @param {Number} row\n * @param {Number} col\n * @param {Boolean} value\n * @param {Boolean} reserved\n */\nBitMatrix.prototype.set = function (row, col, value, reserved) {\n var index = row * this.size + col;\n this.data[index] = value;\n if (reserved)\n this.reservedBit[index] = true;\n};\n/**\n * Returns bit value at specified location\n *\n * @param {Number} row\n * @param {Number} col\n * @return {Boolean}\n */\nBitMatrix.prototype.get = function (row, col) {\n return this.data[row * this.size + col];\n};\n/**\n * Applies xor operator at specified location\n * (used during masking process)\n *\n * @param {Number} row\n * @param {Number} col\n * @param {Boolean} value\n */\nBitMatrix.prototype.xor = function (row, col, value) {\n this.data[row * this.size + col] ^= value;\n};\n/**\n * Check if bit at specified location is reserved\n *\n * @param {Number} row\n * @param {Number} col\n * @return {Boolean}\n */\nBitMatrix.prototype.isReserved = function (row, col) {\n return this.reservedBit[row * this.size + col];\n};\nvar bitMatrix = BitMatrix;\nvar alignmentPattern = createCommonjsModule(function (module, exports) {\n /**\n * Alignment pattern are fixed reference pattern in defined positions\n * in a matrix symbology, which enables the decode software to re-synchronise\n * the coordinate mapping of the image modules in the event of moderate amounts\n * of distortion of the image.\n *\n * Alignment patterns are present only in QR Code symbols of version 2 or larger\n * and their number depends on the symbol version.\n */\n var getSymbolSize = utils.getSymbolSize;\n /**\n * Calculate the row/column coordinates of the center module of each alignment pattern\n * for the specified QR Code version.\n *\n * The alignment patterns are positioned symmetrically on either side of the diagonal\n * running from the top left corner of the symbol to the bottom right corner.\n *\n * Since positions are simmetrical only half of the coordinates are returned.\n * Each item of the array will represent in turn the x and y coordinate.\n * @see {@link getPositions}\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinate\n */\n exports.getRowColCoords = function getRowColCoords(version) {\n if (version === 1)\n return [];\n var posCount = Math.floor(version / 7) + 2;\n var size = getSymbolSize(version);\n var intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;\n var positions = [size - 7]; // Last coord is always (size - 7)\n for (var i = 1; i < posCount - 1; i++) {\n positions[i] = positions[i - 1] - intervals;\n }\n positions.push(6); // First coord is always 6\n return positions.reverse();\n };\n /**\n * Returns an array containing the positions of each alignment pattern.\n * Each array's element represent the center point of the pattern as (x, y) coordinates\n *\n * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}\n * and filtering out the items that overlaps with finder pattern\n *\n * @example\n * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.\n * The alignment patterns, therefore, are to be centered on (row, column)\n * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).\n * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns\n * and are not therefore used for alignment patterns.\n *\n * let pos = getPositions(7)\n * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\n exports.getPositions = function getPositions(version) {\n var coords = [];\n var pos = exports.getRowColCoords(version);\n var posLength = pos.length;\n for (var i = 0; i < posLength; i++) {\n for (var j = 0; j < posLength; j++) {\n // Skip if position is occupied by finder patterns\n if ((i === 0 && j === 0) || // top-left\n (i === 0 && j === posLength - 1) || // bottom-left\n (i === posLength - 1 && j === 0)) { // top-right\n continue;\n }\n coords.push([pos[i], pos[j]]);\n }\n }\n return coords;\n };\n});\nvar getSymbolSize$1 = utils.getSymbolSize;\nvar FINDER_PATTERN_SIZE = 7;\n/**\n * Returns an array containing the positions of each finder pattern.\n * Each array's element represent the top-left point of the pattern as (x, y) coordinates\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nvar getPositions = function getPositions(version) {\n var size = getSymbolSize$1(version);\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ];\n};\nvar finderPattern = {\n getPositions: getPositions\n};\nvar maskPattern = createCommonjsModule(function (module, exports) {\n /**\n * Data mask pattern reference\n * @type {Object}\n */\n exports.Patterns = {\n PATTERN000: 0,\n PATTERN001: 1,\n PATTERN010: 2,\n PATTERN011: 3,\n PATTERN100: 4,\n PATTERN101: 5,\n PATTERN110: 6,\n PATTERN111: 7\n };\n /**\n * Weighted penalty scores for the undesirable features\n * @type {Object}\n */\n var PenaltyScores = {\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n };\n /**\n * Check if mask pattern value is valid\n *\n * @param {Number} mask Mask pattern\n * @return {Boolean} true if valid, false otherwise\n */\n exports.isValid = function isValid(mask) {\n return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7;\n };\n /**\n * Returns mask pattern from a value.\n * If value is not valid, returns undefined\n *\n * @param {Number|String} value Mask pattern value\n * @return {Number} Valid mask pattern or undefined\n */\n exports.from = function from(value) {\n return exports.isValid(value) ? parseInt(value, 10) : undefined;\n };\n /**\n * Find adjacent modules in row/column with the same color\n * and assign a penalty value.\n *\n * Points: N1 + i\n * i is the amount by which the number of adjacent modules of the same color exceeds 5\n */\n exports.getPenaltyN1 = function getPenaltyN1(data) {\n var size = data.size;\n var points = 0;\n var sameCountCol = 0;\n var sameCountRow = 0;\n var lastCol = null;\n var lastRow = null;\n for (var row = 0; row < size; row++) {\n sameCountCol = sameCountRow = 0;\n lastCol = lastRow = null;\n for (var col = 0; col < size; col++) {\n var module_1 = data.get(row, col);\n if (module_1 === lastCol) {\n sameCountCol++;\n }\n else {\n if (sameCountCol >= 5)\n points += PenaltyScores.N1 + (sameCountCol - 5);\n lastCol = module_1;\n sameCountCol = 1;\n }\n module_1 = data.get(col, row);\n if (module_1 === lastRow) {\n sameCountRow++;\n }\n else {\n if (sameCountRow >= 5)\n points += PenaltyScores.N1 + (sameCountRow - 5);\n lastRow = module_1;\n sameCountRow = 1;\n }\n }\n if (sameCountCol >= 5)\n points += PenaltyScores.N1 + (sameCountCol - 5);\n if (sameCountRow >= 5)\n points += PenaltyScores.N1 + (sameCountRow - 5);\n }\n return points;\n };\n /**\n * Find 2x2 blocks with the same color and assign a penalty value\n *\n * Points: N2 * (m - 1) * (n - 1)\n */\n exports.getPenaltyN2 = function getPenaltyN2(data) {\n var size = data.size;\n var points = 0;\n for (var row = 0; row < size - 1; row++) {\n for (var col = 0; col < size - 1; col++) {\n var last = data.get(row, col) +\n data.get(row, col + 1) +\n data.get(row + 1, col) +\n data.get(row + 1, col + 1);\n if (last === 4 || last === 0)\n points++;\n }\n }\n return points * PenaltyScores.N2;\n };\n /**\n * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,\n * preceded or followed by light area 4 modules wide\n *\n * Points: N3 * number of pattern found\n */\n exports.getPenaltyN3 = function getPenaltyN3(data) {\n var size = data.size;\n var points = 0;\n var bitsCol = 0;\n var bitsRow = 0;\n for (var row = 0; row < size; row++) {\n bitsCol = bitsRow = 0;\n for (var col = 0; col < size; col++) {\n bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col);\n if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D))\n points++;\n bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row);\n if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D))\n points++;\n }\n }\n return points * PenaltyScores.N3;\n };\n /**\n * Calculate proportion of dark modules in entire symbol\n *\n * Points: N4 * k\n *\n * k is the rating of the deviation of the proportion of dark modules\n * in the symbol from 50% in steps of 5%\n */\n exports.getPenaltyN4 = function getPenaltyN4(data) {\n var darkCount = 0;\n var modulesCount = data.data.length;\n for (var i = 0; i < modulesCount; i++)\n darkCount += data.data[i];\n var k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10);\n return k * PenaltyScores.N4;\n };\n /**\n * Return mask value at given position\n *\n * @param {Number} maskPattern Pattern reference value\n * @param {Number} i Row\n * @param {Number} j Column\n * @return {Boolean} Mask value\n */\n function getMaskAt(maskPattern, i, j) {\n switch (maskPattern) {\n case exports.Patterns.PATTERN000: return (i + j) % 2 === 0;\n case exports.Patterns.PATTERN001: return i % 2 === 0;\n case exports.Patterns.PATTERN010: return j % 3 === 0;\n case exports.Patterns.PATTERN011: return (i + j) % 3 === 0;\n case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;\n case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0;\n case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0;\n case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0;\n default: throw new Error('bad maskPattern:' + maskPattern);\n }\n }\n /**\n * Apply a mask pattern to a BitMatrix\n *\n * @param {Number} pattern Pattern reference number\n * @param {BitMatrix} data BitMatrix data\n */\n exports.applyMask = function applyMask(pattern, data) {\n var size = data.size;\n for (var col = 0; col < size; col++) {\n for (var row = 0; row < size; row++) {\n if (data.isReserved(row, col))\n continue;\n data.xor(row, col, getMaskAt(pattern, row, col));\n }\n }\n };\n /**\n * Returns the best mask pattern for data\n *\n * @param {BitMatrix} data\n * @return {Number} Mask pattern reference number\n */\n exports.getBestMask = function getBestMask(data, setupFormatFunc) {\n var numPatterns = Object.keys(exports.Patterns).length;\n var bestPattern = 0;\n var lowerPenalty = Infinity;\n for (var p = 0; p < numPatterns; p++) {\n setupFormatFunc(p);\n exports.applyMask(p, data);\n // Calculate penalty\n var penalty = exports.getPenaltyN1(data) +\n exports.getPenaltyN2(data) +\n exports.getPenaltyN3(data) +\n exports.getPenaltyN4(data);\n // Undo previously applied mask\n exports.applyMask(p, data);\n if (penalty < lowerPenalty) {\n lowerPenalty = penalty;\n bestPattern = p;\n }\n }\n return bestPattern;\n };\n});\nvar EC_BLOCKS_TABLE = [\n // L M Q H\n 1, 1, 1, 1,\n 1, 1, 1, 1,\n 1, 1, 2, 2,\n 1, 2, 2, 4,\n 1, 2, 4, 4,\n 2, 4, 4, 4,\n 2, 4, 6, 5,\n 2, 4, 6, 6,\n 2, 5, 8, 8,\n 4, 5, 8, 8,\n 4, 5, 8, 11,\n 4, 8, 10, 11,\n 4, 9, 12, 16,\n 4, 9, 16, 16,\n 6, 10, 12, 18,\n 6, 10, 17, 16,\n 6, 11, 16, 19,\n 6, 13, 18, 21,\n 7, 14, 21, 25,\n 8, 16, 20, 25,\n 8, 17, 23, 25,\n 9, 17, 23, 34,\n 9, 18, 25, 30,\n 10, 20, 27, 32,\n 12, 21, 29, 35,\n 12, 23, 34, 37,\n 12, 25, 34, 40,\n 13, 26, 35, 42,\n 14, 28, 38, 45,\n 15, 29, 40, 48,\n 16, 31, 43, 51,\n 17, 33, 45, 54,\n 18, 35, 48, 57,\n 19, 37, 51, 60,\n 19, 38, 53, 63,\n 20, 40, 56, 66,\n 21, 43, 59, 70,\n 22, 45, 62, 74,\n 24, 47, 65, 77,\n 25, 49, 68, 81\n];\nvar EC_CODEWORDS_TABLE = [\n // L M Q H\n 7, 10, 13, 17,\n 10, 16, 22, 28,\n 15, 26, 36, 44,\n 20, 36, 52, 64,\n 26, 48, 72, 88,\n 36, 64, 96, 112,\n 40, 72, 108, 130,\n 48, 88, 132, 156,\n 60, 110, 160, 192,\n 72, 130, 192, 224,\n 80, 150, 224, 264,\n 96, 176, 260, 308,\n 104, 198, 288, 352,\n 120, 216, 320, 384,\n 132, 240, 360, 432,\n 144, 280, 408, 480,\n 168, 308, 448, 532,\n 180, 338, 504, 588,\n 196, 364, 546, 650,\n 224, 416, 600, 700,\n 224, 442, 644, 750,\n 252, 476, 690, 816,\n 270, 504, 750, 900,\n 300, 560, 810, 960,\n 312, 588, 870, 1050,\n 336, 644, 952, 1110,\n 360, 700, 1020, 1200,\n 390, 728, 1050, 1260,\n 420, 784, 1140, 1350,\n 450, 812, 1200, 1440,\n 480, 868, 1290, 1530,\n 510, 924, 1350, 1620,\n 540, 980, 1440, 1710,\n 570, 1036, 1530, 1800,\n 570, 1064, 1590, 1890,\n 600, 1120, 1680, 1980,\n 630, 1204, 1770, 2100,\n 660, 1260, 1860, 2220,\n 720, 1316, 1950, 2310,\n 750, 1372, 2040, 2430\n];\n/**\n * Returns the number of error correction block that the QR Code should contain\n * for the specified version and error correction level.\n *\n * @param {Number} version QR Code version\n * @param {Number} errorCorrectionLevel Error correction level\n * @return {Number} Number of error correction blocks\n */\nvar getBlocksCount = function getBlocksCount(version, errorCorrectionLevel$1) {\n switch (errorCorrectionLevel$1) {\n case errorCorrectionLevel.L:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];\n case errorCorrectionLevel.M:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];\n case errorCorrectionLevel.Q:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];\n case errorCorrectionLevel.H:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];\n default:\n return undefined;\n }\n};\n/**\n * Returns the number of error correction codewords to use for the specified\n * version and error correction level.\n *\n * @param {Number} version QR Code version\n * @param {Number} errorCorrectionLevel Error correction level\n * @return {Number} Number of error correction codewords\n */\nvar getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel$1) {\n switch (errorCorrectionLevel$1) {\n case errorCorrectionLevel.L:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];\n case errorCorrectionLevel.M:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];\n case errorCorrectionLevel.Q:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];\n case errorCorrectionLevel.H:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];\n default:\n return undefined;\n }\n};\nvar errorCorrectionCode = {\n getBlocksCount: getBlocksCount,\n getTotalCodewordsCount: getTotalCodewordsCount\n};\nvar EXP_TABLE = new Uint8Array(512);\nvar LOG_TABLE = new Uint8Array(256);\n(function initTables() {\n var x = 1;\n for (var i = 0; i < 255; i++) {\n EXP_TABLE[i] = x;\n LOG_TABLE[x] = i;\n x <<= 1; // multiply by 2\n // The QR code specification says to use byte-wise modulo 100011101 arithmetic.\n // This means that when a number is 256 or larger, it should be XORed with 0x11D.\n if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)\n x ^= 0x11D;\n }\n }\n // Optimization: double the size of the anti-log table so that we don't need to mod 255 to\n // stay inside the bounds (because we will mainly use this table for the multiplication of\n // two GF numbers, no more).\n // @see {@link mul}\n for (var i = 255; i < 512; i++) {\n EXP_TABLE[i] = EXP_TABLE[i - 255];\n }\n}());\n/**\n * Returns log value of n inside Galois Field\n *\n * @param {Number} n\n * @return {Number}\n */\nvar log = function log(n) {\n if (n < 1)\n throw new Error('log(' + n + ')');\n return LOG_TABLE[n];\n};\n/**\n * Returns anti-log value of n inside Galois Field\n *\n * @param {Number} n\n * @return {Number}\n */\nvar exp = function exp(n) {\n return EXP_TABLE[n];\n};\n/**\n * Multiplies two number inside Galois Field\n *\n * @param {Number} x\n * @param {Number} y\n * @return {Number}\n */\nvar mul = function mul(x, y) {\n if (x === 0 || y === 0)\n return 0;\n // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized\n // @see {@link initTables}\n return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];\n};\nvar galoisField = {\n log: log,\n exp: exp,\n mul: mul\n};\nvar polynomial = createCommonjsModule(function (module, exports) {\n /**\n * Multiplies two polynomials inside Galois Field\n *\n * @param {Uint8Array} p1 Polynomial\n * @param {Uint8Array} p2 Polynomial\n * @return {Uint8Array} Product of p1 and p2\n */\n exports.mul = function mul(p1, p2) {\n var coeff = new Uint8Array(p1.length + p2.length - 1);\n for (var i = 0; i < p1.length; i++) {\n for (var j = 0; j < p2.length; j++) {\n coeff[i + j] ^= galoisField.mul(p1[i], p2[j]);\n }\n }\n return coeff;\n };\n /**\n * Calculate the remainder of polynomials division\n *\n * @param {Uint8Array} divident Polynomial\n * @param {Uint8Array} divisor Polynomial\n * @return {Uint8Array} Remainder\n */\n exports.mod = function mod(divident, divisor) {\n var result = new Uint8Array(divident);\n while ((result.length - divisor.length) >= 0) {\n var coeff = result[0];\n for (var i = 0; i < divisor.length; i++) {\n result[i] ^= galoisField.mul(divisor[i], coeff);\n }\n // remove all zeros from buffer head\n var offset = 0;\n while (offset < result.length && result[offset] === 0)\n offset++;\n result = result.slice(offset);\n }\n return result;\n };\n /**\n * Generate an irreducible generator polynomial of specified degree\n * (used by Reed-Solomon encoder)\n *\n * @param {Number} degree Degree of the generator polynomial\n * @return {Uint8Array} Buffer containing polynomial coefficients\n */\n exports.generateECPolynomial = function generateECPolynomial(degree) {\n var poly = new Uint8Array([1]);\n for (var i = 0; i < degree; i++) {\n poly = exports.mul(poly, new Uint8Array([1, galoisField.exp(i)]));\n }\n return poly;\n };\n});\nfunction ReedSolomonEncoder(degree) {\n this.genPoly = undefined;\n this.degree = degree;\n if (this.degree)\n this.initialize(this.degree);\n}\n/**\n * Initialize the encoder.\n * The input param should correspond to the number of error correction codewords.\n *\n * @param {Number} degree\n */\nReedSolomonEncoder.prototype.initialize = function initialize(degree) {\n // create an irreducible generator polynomial\n this.degree = degree;\n this.genPoly = polynomial.generateECPolynomial(this.degree);\n};\n/**\n * Encodes a chunk of data\n *\n * @param {Uint8Array} data Buffer containing input data\n * @return {Uint8Array} Buffer containing encoded data\n */\nReedSolomonEncoder.prototype.encode = function encode(data) {\n if (!this.genPoly) {\n throw new Error('Encoder not initialized');\n }\n // Calculate EC for this data block\n // extends data size to data+genPoly size\n var paddedData = new Uint8Array(data.length + this.degree);\n paddedData.set(data);\n // The error correction codewords are the remainder after dividing the data codewords\n // by a generator polynomial\n var remainder = polynomial.mod(paddedData, this.genPoly);\n // return EC data blocks (last n byte, where n is the degree of genPoly)\n // If coefficients number in remainder are less than genPoly degree,\n // pad with 0s to the left to reach the needed number of coefficients\n var start = this.degree - remainder.length;\n if (start > 0) {\n var buff = new Uint8Array(this.degree);\n buff.set(remainder, start);\n return buff;\n }\n return remainder;\n};\nvar reedSolomonEncoder = ReedSolomonEncoder;\n/**\n * Check if QR Code version is valid\n *\n * @param {Number} version QR Code version\n * @return {Boolean} true if valid version, false otherwise\n */\nvar isValid = function isValid(version) {\n return !isNaN(version) && version >= 1 && version <= 40;\n};\nvar versionCheck = {\n isValid: isValid\n};\nvar numeric = '[0-9]+';\nvar alphanumeric = '[A-Z $%*+\\\\-./:]+';\nvar kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +\n '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +\n '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +\n '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+';\nkanji = kanji.replace(/u/g, '\\\\u');\nvar byte = '(?:(?![A-Z0-9 $%*+\\\\-./:]|' + kanji + ')(?:.|[\\r\\n]))+';\nvar KANJI = new RegExp(kanji, 'g');\nvar BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\\\-./:]+', 'g');\nvar BYTE = new RegExp(byte, 'g');\nvar NUMERIC = new RegExp(numeric, 'g');\nvar ALPHANUMERIC = new RegExp(alphanumeric, 'g');\nvar TEST_KANJI = new RegExp('^' + kanji + '$');\nvar TEST_NUMERIC = new RegExp('^' + numeric + '$');\nvar TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\\\-./:]+$');\nvar testKanji = function testKanji(str) {\n return TEST_KANJI.test(str);\n};\nvar testNumeric = function testNumeric(str) {\n return TEST_NUMERIC.test(str);\n};\nvar testAlphanumeric = function testAlphanumeric(str) {\n return TEST_ALPHANUMERIC.test(str);\n};\nvar regex = {\n KANJI: KANJI,\n BYTE_KANJI: BYTE_KANJI,\n BYTE: BYTE,\n NUMERIC: NUMERIC,\n ALPHANUMERIC: ALPHANUMERIC,\n testKanji: testKanji,\n testNumeric: testNumeric,\n testAlphanumeric: testAlphanumeric\n};\nvar mode = createCommonjsModule(function (module, exports) {\n /**\n * Numeric mode encodes data from the decimal digit set (0 - 9)\n * (byte values 30HEX to 39HEX).\n * Normally, 3 data characters are represented by 10 bits.\n *\n * @type {Object}\n */\n exports.NUMERIC = {\n id: 'Numeric',\n bit: 1 << 0,\n ccBits: [10, 12, 14]\n };\n /**\n * Alphanumeric mode encodes data from a set of 45 characters,\n * i.e. 10 numeric digits (0 - 9),\n * 26 alphabetic characters (A - Z),\n * and 9 symbols (SP, $, %, *, +, -, ., /, :).\n * Normally, two input characters are represented by 11 bits.\n *\n * @type {Object}\n */\n exports.ALPHANUMERIC = {\n id: 'Alphanumeric',\n bit: 1 << 1,\n ccBits: [9, 11, 13]\n };\n /**\n * In byte mode, data is encoded at 8 bits per character.\n *\n * @type {Object}\n */\n exports.BYTE = {\n id: 'Byte',\n bit: 1 << 2,\n ccBits: [8, 16, 16]\n };\n /**\n * The Kanji mode efficiently encodes Kanji characters in accordance with\n * the Shift JIS system based on JIS X 0208.\n * The Shift JIS values are shifted from the JIS X 0208 values.\n * JIS X 0208 gives details of the shift coded representation.\n * Each two-byte character value is compacted to a 13-bit binary codeword.\n *\n * @type {Object}\n */\n exports.KANJI = {\n id: 'Kanji',\n bit: 1 << 3,\n ccBits: [8, 10, 12]\n };\n /**\n * Mixed mode will contain a sequences of data in a combination of any of\n * the modes described above\n *\n * @type {Object}\n */\n exports.MIXED = {\n bit: -1\n };\n /**\n * Returns the number of bits needed to store the data length\n * according to QR Code specifications.\n *\n * @param {Mode} mode Data mode\n * @param {Number} version QR Code version\n * @return {Number} Number of bits\n */\n exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {\n if (!mode.ccBits)\n throw new Error('Invalid mode: ' + mode);\n if (!versionCheck.isValid(version)) {\n throw new Error('Invalid version: ' + version);\n }\n if (version >= 1 && version < 10)\n return mode.ccBits[0];\n else if (version < 27)\n return mode.ccBits[1];\n return mode.ccBits[2];\n };\n /**\n * Returns the most efficient mode to store the specified data\n *\n * @param {String} dataStr Input data string\n * @return {Mode} Best mode\n */\n exports.getBestModeForData = function getBestModeForData(dataStr) {\n if (regex.testNumeric(dataStr))\n return exports.NUMERIC;\n else if (regex.testAlphanumeric(dataStr))\n return exports.ALPHANUMERIC;\n else if (regex.testKanji(dataStr))\n return exports.KANJI;\n else\n return exports.BYTE;\n };\n /**\n * Return mode name as string\n *\n * @param {Mode} mode Mode object\n * @returns {String} Mode name\n */\n exports.toString = function toString(mode) {\n if (mode && mode.id)\n return mode.id;\n throw new Error('Invalid mode');\n };\n /**\n * Check if input param is a valid mode object\n *\n * @param {Mode} mode Mode object\n * @returns {Boolean} True if valid mode, false otherwise\n */\n exports.isValid = function isValid(mode) {\n return mode && mode.bit && mode.ccBits;\n };\n /**\n * Get mode object from its name\n *\n * @param {String} string Mode name\n * @returns {Mode} Mode object\n */\n function fromString(string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string');\n }\n var lcStr = string.toLowerCase();\n switch (lcStr) {\n case 'numeric':\n return exports.NUMERIC;\n case 'alphanumeric':\n return exports.ALPHANUMERIC;\n case 'kanji':\n return exports.KANJI;\n case 'byte':\n return exports.BYTE;\n default:\n throw new Error('Unknown mode: ' + string);\n }\n }\n /**\n * Returns mode from a value.\n * If value is not a valid mode, returns defaultValue\n *\n * @param {Mode|String} value Encoding mode\n * @param {Mode} defaultValue Fallback value\n * @return {Mode} Encoding mode\n */\n exports.from = function from(value, defaultValue) {\n if (exports.isValid(value)) {\n return value;\n }\n try {\n return fromString(value);\n }\n catch (e) {\n return defaultValue;\n }\n };\n});\nvar version = createCommonjsModule(function (module, exports) {\n // Generator polynomial used to encode version information\n var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);\n var G18_BCH = utils.getBCHDigit(G18);\n function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {\n for (var currentVersion = 1; currentVersion <= 40; currentVersion++) {\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {\n return currentVersion;\n }\n }\n return undefined;\n }\n function getReservedBitsCount(mode$1, version) {\n // Character count indicator + mode indicator bits\n return mode.getCharCountIndicator(mode$1, version) + 4;\n }\n function getTotalBitsFromDataArray(segments, version) {\n var totalBits = 0;\n segments.forEach(function (data) {\n var reservedBits = getReservedBitsCount(data.mode, version);\n totalBits += reservedBits + data.getBitsLength();\n });\n return totalBits;\n }\n function getBestVersionForMixedData(segments, errorCorrectionLevel) {\n for (var currentVersion = 1; currentVersion <= 40; currentVersion++) {\n var length = getTotalBitsFromDataArray(segments, currentVersion);\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode.MIXED)) {\n return currentVersion;\n }\n }\n return undefined;\n }\n /**\n * Returns version number from a value.\n * If value is not a valid version, returns defaultValue\n *\n * @param {Number|String} value QR Code version\n * @param {Number} defaultValue Fallback value\n * @return {Number} QR Code version number\n */\n exports.from = function from(value, defaultValue) {\n if (versionCheck.isValid(value)) {\n return parseInt(value, 10);\n }\n return defaultValue;\n };\n /**\n * Returns how much data can be stored with the specified QR code version\n * and error correction level\n *\n * @param {Number} version QR Code version (1-40)\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} Quantity of storable data\n */\n exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode$1) {\n if (!versionCheck.isValid(version)) {\n throw new Error('Invalid QR Code version');\n }\n // Use Byte mode as default\n if (typeof mode$1 === 'undefined')\n mode$1 = mode.BYTE;\n // Total codewords for this QR code version (Data + Error correction)\n var totalCodewords = utils.getSymbolTotalCodewords(version);\n // Total number of error correction codewords\n var ecTotalCodewords = errorCorrectionCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n // Total number of data codewords\n var dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;\n if (mode$1 === mode.MIXED)\n return dataTotalCodewordsBits;\n var usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode$1, version);\n // Return max number of storable codewords\n switch (mode$1) {\n case mode.NUMERIC:\n return Math.floor((usableBits / 10) * 3);\n case mode.ALPHANUMERIC:\n return Math.floor((usableBits / 11) * 2);\n case mode.KANJI:\n return Math.floor(usableBits / 13);\n case mode.BYTE:\n default:\n return Math.floor(usableBits / 8);\n }\n };\n /**\n * Returns the minimum version needed to contain the amount of data\n *\n * @param {Segment} data Segment of data\n * @param {Number} [errorCorrectionLevel=H] Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} QR Code version\n */\n exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel$1) {\n var seg;\n var ecl = errorCorrectionLevel.from(errorCorrectionLevel$1, errorCorrectionLevel.M);\n if (Array.isArray(data)) {\n if (data.length > 1) {\n return getBestVersionForMixedData(data, ecl);\n }\n if (data.length === 0) {\n return 1;\n }\n seg = data[0];\n }\n else {\n seg = data;\n }\n return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);\n };\n /**\n * Returns version information with relative error correction bits\n *\n * The version information is included in QR Code symbols of version 7 or larger.\n * It consists of an 18-bit sequence containing 6 data bits,\n * with 12 error correction bits calculated using the (18, 6) Golay code.\n *\n * @param {Number} version QR Code version\n * @return {Number} Encoded version info bits\n */\n exports.getEncodedBits = function getEncodedBits(version) {\n if (!versionCheck.isValid(version) || version < 7) {\n throw new Error('Invalid QR Code version');\n }\n var d = version << 12;\n while (utils.getBCHDigit(d) - G18_BCH >= 0) {\n d ^= (G18 << (utils.getBCHDigit(d) - G18_BCH));\n }\n return (version << 12) | d;\n };\n});\nvar G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);\nvar G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);\nvar G15_BCH = utils.getBCHDigit(G15);\n/**\n * Returns format information with relative error correction bits\n *\n * The format information is a 15-bit sequence containing 5 data bits,\n * with 10 error correction bits calculated using the (15, 5) BCH code.\n *\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Number} mask Mask pattern\n * @return {Number} Encoded format information bits\n */\nvar getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {\n var data = ((errorCorrectionLevel.bit << 3) | mask);\n var d = data << 10;\n while (utils.getBCHDigit(d) - G15_BCH >= 0) {\n d ^= (G15 << (utils.getBCHDigit(d) - G15_BCH));\n }\n // xor final data with mask pattern in order to ensure that\n // no combination of Error Correction Level and data mask pattern\n // will result in an all-zero data string\n return ((data << 10) | d) ^ G15_MASK;\n};\nvar formatInfo = {\n getEncodedBits: getEncodedBits\n};\nfunction NumericData(data) {\n this.mode = mode.NUMERIC;\n this.data = data.toString();\n}\nNumericData.getBitsLength = function getBitsLength(length) {\n return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0);\n};\nNumericData.prototype.getLength = function getLength() {\n return this.data.length;\n};\nNumericData.prototype.getBitsLength = function getBitsLength() {\n return NumericData.getBitsLength(this.data.length);\n};\nNumericData.prototype.write = function write(bitBuffer) {\n var i, group, value;\n // The input data string is divided into groups of three digits,\n // and each group is converted to its 10-bit binary equivalent.\n for (i = 0; i + 3 <= this.data.length; i += 3) {\n group = this.data.substr(i, 3);\n value = parseInt(group, 10);\n bitBuffer.put(value, 10);\n }\n // If the number of input digits is not an exact multiple of three,\n // the final one or two digits are converted to 4 or 7 bits respectively.\n var remainingNum = this.data.length - i;\n if (remainingNum > 0) {\n group = this.data.substr(i);\n value = parseInt(group, 10);\n bitBuffer.put(value, remainingNum * 3 + 1);\n }\n};\nvar numericData = NumericData;\n/**\n * Array of characters available in alphanumeric mode\n *\n * As per QR Code specification, to each character\n * is assigned a value from 0 to 44 which in this case coincides\n * with the array index\n *\n * @type {Array}\n */\nvar ALPHA_NUM_CHARS = [\n '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',\n 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',\n ' ', '$', '%', '*', '+', '-', '.', '/', ':'\n];\nfunction AlphanumericData(data) {\n this.mode = mode.ALPHANUMERIC;\n this.data = data;\n}\nAlphanumericData.getBitsLength = function getBitsLength(length) {\n return 11 * Math.floor(length / 2) + 6 * (length % 2);\n};\nAlphanumericData.prototype.getLength = function getLength() {\n return this.data.length;\n};\nAlphanumericData.prototype.getBitsLength = function getBitsLength() {\n return AlphanumericData.getBitsLength(this.data.length);\n};\nAlphanumericData.prototype.write = function write(bitBuffer) {\n var i;\n // Input data characters are divided into groups of two characters\n // and encoded as 11-bit binary codes.\n for (i = 0; i + 2 <= this.data.length; i += 2) {\n // The character value of the first character is multiplied by 45\n var value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;\n // The character value of the second digit is added to the product\n value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);\n // The sum is then stored as 11-bit binary number\n bitBuffer.put(value, 11);\n }\n // If the number of input data characters is not a multiple of two,\n // the character value of the final character is encoded as a 6-bit binary number.\n if (this.data.length % 2) {\n bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);\n }\n};\nvar alphanumericData = AlphanumericData;\nvar encodeUtf8 = function encodeUtf8(input) {\n var result = [];\n var size = input.length;\n for (var index = 0; index < size; index++) {\n var point = input.charCodeAt(index);\n if (point >= 0xD800 && point <= 0xDBFF && size > index + 1) {\n var second = input.charCodeAt(index + 1);\n if (second >= 0xDC00 && second <= 0xDFFF) {\n // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n point = (point - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n index += 1;\n }\n }\n // US-ASCII\n if (point < 0x80) {\n result.push(point);\n continue;\n }\n // 2-byte UTF-8\n if (point < 0x800) {\n result.push((point >> 6) | 192);\n result.push((point & 63) | 128);\n continue;\n }\n // 3-byte UTF-8\n if (point < 0xD800 || (point >= 0xE000 && point < 0x10000)) {\n result.push((point >> 12) | 224);\n result.push(((point >> 6) & 63) | 128);\n result.push((point & 63) | 128);\n continue;\n }\n // 4-byte UTF-8\n if (point >= 0x10000 && point <= 0x10FFFF) {\n result.push((point >> 18) | 240);\n result.push(((point >> 12) & 63) | 128);\n result.push(((point >> 6) & 63) | 128);\n result.push((point & 63) | 128);\n continue;\n }\n // Invalid character\n result.push(0xEF, 0xBF, 0xBD);\n }\n return new Uint8Array(result).buffer;\n};\nfunction ByteData(data) {\n this.mode = mode.BYTE;\n if (typeof (data) === 'string') {\n data = encodeUtf8(data);\n }\n this.data = new Uint8Array(data);\n}\nByteData.getBitsLength = function getBitsLength(length) {\n return length * 8;\n};\nByteData.prototype.getLength = function getLength() {\n return this.data.length;\n};\nByteData.prototype.getBitsLength = function getBitsLength() {\n return ByteData.getBitsLength(this.data.length);\n};\nByteData.prototype.write = function (bitBuffer) {\n for (var i = 0, l = this.data.length; i < l; i++) {\n bitBuffer.put(this.data[i], 8);\n }\n};\nvar byteData = ByteData;\nfunction KanjiData(data) {\n this.mode = mode.KANJI;\n this.data = data;\n}\nKanjiData.getBitsLength = function getBitsLength(length) {\n return length * 13;\n};\nKanjiData.prototype.getLength = function getLength() {\n return this.data.length;\n};\nKanjiData.prototype.getBitsLength = function getBitsLength() {\n return KanjiData.getBitsLength(this.data.length);\n};\nKanjiData.prototype.write = function (bitBuffer) {\n var i;\n // In the Shift JIS system, Kanji characters are represented by a two byte combination.\n // These byte values are shifted from the JIS X 0208 values.\n // JIS X 0208 gives details of the shift coded representation.\n for (i = 0; i < this.data.length; i++) {\n var value = utils.toSJIS(this.data[i]);\n // For characters with Shift JIS values from 0x8140 to 0x9FFC:\n if (value >= 0x8140 && value <= 0x9FFC) {\n // Subtract 0x8140 from Shift JIS value\n value -= 0x8140;\n // For characters with Shift JIS values from 0xE040 to 0xEBBF\n }\n else if (value >= 0xE040 && value <= 0xEBBF) {\n // Subtract 0xC140 from Shift JIS value\n value -= 0xC140;\n }\n else {\n throw new Error('Invalid SJIS character: ' + this.data[i] + '\\n' +\n 'Make sure your charset is UTF-8');\n }\n // Multiply most significant byte of result by 0xC0\n // and add least significant byte to product\n value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff);\n // Convert result to a 13-bit binary string\n bitBuffer.put(value, 13);\n }\n};\nvar kanjiData = KanjiData;\nvar dijkstra_1 = createCommonjsModule(function (module) {\n /******************************************************************************\n * Created 2008-08-19.\n *\n * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.\n *\n * Copyright (C) 2008\n * Wyatt Baldwin \n * All rights reserved\n *\n * Licensed under the MIT license.\n *\n * http://www.opensource.org/licenses/mit-license.php\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *****************************************************************************/\n var dijkstra = {\n single_source_shortest_paths: function (graph, s, d) {\n // Predecessor map for each node that has been encountered.\n // node ID => predecessor node ID\n var predecessors = {};\n // Costs of shortest paths from s to all nodes encountered.\n // node ID => cost\n var costs = {};\n costs[s] = 0;\n // Costs of shortest paths from s to all nodes encountered; differs from\n // `costs` in that it provides easy access to the node that currently has\n // the known shortest path from s.\n // XXX: Do we actually need both `costs` and `open`?\n var open = dijkstra.PriorityQueue.make();\n open.push(s, 0);\n var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;\n while (!open.empty()) {\n // In the nodes remaining in graph that have a known cost from s,\n // find the node, u, that currently has the shortest path from s.\n closest = open.pop();\n u = closest.value;\n cost_of_s_to_u = closest.cost;\n // Get nodes adjacent to u...\n adjacent_nodes = graph[u] || {};\n // ...and explore the edges that connect u to those nodes, updating\n // the cost of the shortest paths to any or all of those nodes as\n // necessary. v is the node across the current edge from u.\n for (v in adjacent_nodes) {\n if (adjacent_nodes.hasOwnProperty(v)) {\n // Get the cost of the edge running from u to v.\n cost_of_e = adjacent_nodes[v];\n // Cost of s to u plus the cost of u to v across e--this is *a*\n // cost from s to v that may or may not be less than the current\n // known cost to v.\n cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;\n // If we haven't visited v yet OR if the current known cost from s to\n // v is greater than the new cost we just found (cost of s to u plus\n // cost of u to v across e), update v's cost in the cost list and\n // update v's predecessor in the predecessor list (it's now u).\n cost_of_s_to_v = costs[v];\n first_visit = (typeof costs[v] === 'undefined');\n if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {\n costs[v] = cost_of_s_to_u_plus_cost_of_e;\n open.push(v, cost_of_s_to_u_plus_cost_of_e);\n predecessors[v] = u;\n }\n }\n }\n }\n if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {\n var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');\n throw new Error(msg);\n }\n return predecessors;\n },\n extract_shortest_path_from_predecessor_list: function (predecessors, d) {\n var nodes = [];\n var u = d;\n while (u) {\n nodes.push(u);\n u = predecessors[u];\n }\n nodes.reverse();\n return nodes;\n },\n find_path: function (graph, s, d) {\n var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);\n return dijkstra.extract_shortest_path_from_predecessor_list(predecessors, d);\n },\n /**\n * A very naive priority queue implementation.\n */\n PriorityQueue: {\n make: function (opts) {\n var T = dijkstra.PriorityQueue, t = {}, key;\n opts = opts || {};\n for (key in T) {\n if (T.hasOwnProperty(key)) {\n t[key] = T[key];\n }\n }\n t.queue = [];\n t.sorter = opts.sorter || T.default_sorter;\n return t;\n },\n default_sorter: function (a, b) {\n return a.cost - b.cost;\n },\n /**\n * Add a new item to the queue and ensure the highest priority element\n * is at the front of the queue.\n */\n push: function (value, cost) {\n var item = { value: value, cost: cost };\n this.queue.push(item);\n this.queue.sort(this.sorter);\n },\n /**\n * Return the highest priority element in the queue.\n */\n pop: function () {\n return this.queue.shift();\n },\n empty: function () {\n return this.queue.length === 0;\n }\n }\n };\n // node.js module exports\n {\n module.exports = dijkstra;\n }\n});\nvar segments = createCommonjsModule(function (module, exports) {\n /**\n * Returns UTF8 byte length\n *\n * @param {String} str Input string\n * @return {Number} Number of byte\n */\n function getStringByteLength(str) {\n return unescape(encodeURIComponent(str)).length;\n }\n /**\n * Get a list of segments of the specified mode\n * from a string\n *\n * @param {Mode} mode Segment mode\n * @param {String} str String to process\n * @return {Array} Array of object with segments data\n */\n function getSegments(regex, mode, str) {\n var segments = [];\n var result;\n while ((result = regex.exec(str)) !== null) {\n segments.push({\n data: result[0],\n index: result.index,\n mode: mode,\n length: result[0].length\n });\n }\n return segments;\n }\n /**\n * Extracts a series of segments with the appropriate\n * modes from a string\n *\n * @param {String} dataStr Input string\n * @return {Array} Array of object with segments data\n */\n function getSegmentsFromString(dataStr) {\n var numSegs = getSegments(regex.NUMERIC, mode.NUMERIC, dataStr);\n var alphaNumSegs = getSegments(regex.ALPHANUMERIC, mode.ALPHANUMERIC, dataStr);\n var byteSegs;\n var kanjiSegs;\n if (utils.isKanjiModeEnabled()) {\n byteSegs = getSegments(regex.BYTE, mode.BYTE, dataStr);\n kanjiSegs = getSegments(regex.KANJI, mode.KANJI, dataStr);\n }\n else {\n byteSegs = getSegments(regex.BYTE_KANJI, mode.BYTE, dataStr);\n kanjiSegs = [];\n }\n var segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);\n return segs\n .sort(function (s1, s2) {\n return s1.index - s2.index;\n })\n .map(function (obj) {\n return {\n data: obj.data,\n mode: obj.mode,\n length: obj.length\n };\n });\n }\n /**\n * Returns how many bits are needed to encode a string of\n * specified length with the specified mode\n *\n * @param {Number} length String length\n * @param {Mode} mode Segment mode\n * @return {Number} Bit length\n */\n function getSegmentBitsLength(length, mode$1) {\n switch (mode$1) {\n case mode.NUMERIC:\n return numericData.getBitsLength(length);\n case mode.ALPHANUMERIC:\n return alphanumericData.getBitsLength(length);\n case mode.KANJI:\n return kanjiData.getBitsLength(length);\n case mode.BYTE:\n return byteData.getBitsLength(length);\n }\n }\n /**\n * Merges adjacent segments which have the same mode\n *\n * @param {Array} segs Array of object with segments data\n * @return {Array} Array of object with segments data\n */\n function mergeSegments(segs) {\n return segs.reduce(function (acc, curr) {\n var prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;\n if (prevSeg && prevSeg.mode === curr.mode) {\n acc[acc.length - 1].data += curr.data;\n return acc;\n }\n acc.push(curr);\n return acc;\n }, []);\n }\n /**\n * Generates a list of all possible nodes combination which\n * will be used to build a segments graph.\n *\n * Nodes are divided by groups. Each group will contain a list of all the modes\n * in which is possible to encode the given text.\n *\n * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.\n * The group for '12345' will contain then 3 objects, one for each\n * possible encoding mode.\n *\n * Each node represents a possible segment.\n *\n * @param {Array} segs Array of object with segments data\n * @return {Array} Array of object with segments data\n */\n function buildNodes(segs) {\n var nodes = [];\n for (var i = 0; i < segs.length; i++) {\n var seg = segs[i];\n switch (seg.mode) {\n case mode.NUMERIC:\n nodes.push([seg,\n { data: seg.data, mode: mode.ALPHANUMERIC, length: seg.length },\n { data: seg.data, mode: mode.BYTE, length: seg.length }\n ]);\n break;\n case mode.ALPHANUMERIC:\n nodes.push([seg,\n { data: seg.data, mode: mode.BYTE, length: seg.length }\n ]);\n break;\n case mode.KANJI:\n nodes.push([seg,\n { data: seg.data, mode: mode.BYTE, length: getStringByteLength(seg.data) }\n ]);\n break;\n case mode.BYTE:\n nodes.push([\n { data: seg.data, mode: mode.BYTE, length: getStringByteLength(seg.data) }\n ]);\n }\n }\n return nodes;\n }\n /**\n * Builds a graph from a list of nodes.\n * All segments in each node group will be connected with all the segments of\n * the next group and so on.\n *\n * At each connection will be assigned a weight depending on the\n * segment's byte length.\n *\n * @param {Array} nodes Array of object with segments data\n * @param {Number} version QR Code version\n * @return {Object} Graph of all possible segments\n */\n function buildGraph(nodes, version) {\n var table = {};\n var graph = { start: {} };\n var prevNodeIds = ['start'];\n for (var i = 0; i < nodes.length; i++) {\n var nodeGroup = nodes[i];\n var currentNodeIds = [];\n for (var j = 0; j < nodeGroup.length; j++) {\n var node = nodeGroup[j];\n var key = '' + i + j;\n currentNodeIds.push(key);\n table[key] = { node: node, lastCount: 0 };\n graph[key] = {};\n for (var n = 0; n < prevNodeIds.length; n++) {\n var prevNodeId = prevNodeIds[n];\n if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {\n graph[prevNodeId][key] =\n getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -\n getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);\n table[prevNodeId].lastCount += node.length;\n }\n else {\n if (table[prevNodeId])\n table[prevNodeId].lastCount = node.length;\n graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +\n 4 + mode.getCharCountIndicator(node.mode, version); // switch cost\n }\n }\n }\n prevNodeIds = currentNodeIds;\n }\n for (var n = 0; n < prevNodeIds.length; n++) {\n graph[prevNodeIds[n]].end = 0;\n }\n return { map: graph, table: table };\n }\n /**\n * Builds a segment from a specified data and mode.\n * If a mode is not specified, the more suitable will be used.\n *\n * @param {String} data Input data\n * @param {Mode | String} modesHint Data mode\n * @return {Segment} Segment\n */\n function buildSingleSegment(data, modesHint) {\n var mode$1;\n var bestMode = mode.getBestModeForData(data);\n mode$1 = mode.from(modesHint, bestMode);\n // Make sure data can be encoded\n if (mode$1 !== mode.BYTE && mode$1.bit < bestMode.bit) {\n throw new Error('\"' + data + '\"' +\n ' cannot be encoded with mode ' + mode.toString(mode$1) +\n '.\\n Suggested mode is: ' + mode.toString(bestMode));\n }\n // Use Mode.BYTE if Kanji support is disabled\n if (mode$1 === mode.KANJI && !utils.isKanjiModeEnabled()) {\n mode$1 = mode.BYTE;\n }\n switch (mode$1) {\n case mode.NUMERIC:\n return new numericData(data);\n case mode.ALPHANUMERIC:\n return new alphanumericData(data);\n case mode.KANJI:\n return new kanjiData(data);\n case mode.BYTE:\n return new byteData(data);\n }\n }\n /**\n * Builds a list of segments from an array.\n * Array can contain Strings or Objects with segment's info.\n *\n * For each item which is a string, will be generated a segment with the given\n * string and the more appropriate encoding mode.\n *\n * For each item which is an object, will be generated a segment with the given\n * data and mode.\n * Objects must contain at least the property \"data\".\n * If property \"mode\" is not present, the more suitable mode will be used.\n *\n * @param {Array} array Array of objects with segments data\n * @return {Array} Array of Segments\n */\n exports.fromArray = function fromArray(array) {\n return array.reduce(function (acc, seg) {\n if (typeof seg === 'string') {\n acc.push(buildSingleSegment(seg, null));\n }\n else if (seg.data) {\n acc.push(buildSingleSegment(seg.data, seg.mode));\n }\n return acc;\n }, []);\n };\n /**\n * Builds an optimized sequence of segments from a string,\n * which will produce the shortest possible bitstream.\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @return {Array} Array of segments\n */\n exports.fromString = function fromString(data, version) {\n var segs = getSegmentsFromString(data, utils.isKanjiModeEnabled());\n var nodes = buildNodes(segs);\n var graph = buildGraph(nodes, version);\n var path = dijkstra_1.find_path(graph.map, 'start', 'end');\n var optimizedSegs = [];\n for (var i = 1; i < path.length - 1; i++) {\n optimizedSegs.push(graph.table[path[i]].node);\n }\n return exports.fromArray(mergeSegments(optimizedSegs));\n };\n /**\n * Splits a string in various segments with the modes which\n * best represent their content.\n * The produced segments are far from being optimized.\n * The output of this function is only used to estimate a QR Code version\n * which may contain the data.\n *\n * @param {string} data Input string\n * @return {Array} Array of segments\n */\n exports.rawSplit = function rawSplit(data) {\n return exports.fromArray(getSegmentsFromString(data, utils.isKanjiModeEnabled()));\n };\n});\n/**\n * QRCode for JavaScript\n *\n * modified by Ryan Day for nodejs support\n * Copyright (c) 2011 Ryan Day\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/mit-license.php\n *\n//---------------------------------------------------------------------\n// QRCode for JavaScript\n//\n// Copyright (c) 2009 Kazuhiko Arase\n//\n// URL: http://www.d-project.com/\n//\n// Licensed under the MIT license:\n// http://www.opensource.org/licenses/mit-license.php\n//\n// The word \"QR Code\" is registered trademark of\n// DENSO WAVE INCORPORATED\n// http://www.denso-wave.com/qrcode/faqpatent-e.html\n//\n//---------------------------------------------------------------------\n*/\n/**\n * Add finder patterns bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupFinderPattern(matrix, version) {\n var size = matrix.size;\n var pos = finderPattern.getPositions(version);\n for (var i = 0; i < pos.length; i++) {\n var row = pos[i][0];\n var col = pos[i][1];\n for (var r = -1; r <= 7; r++) {\n if (row + r <= -1 || size <= row + r)\n continue;\n for (var c = -1; c <= 7; c++) {\n if (col + c <= -1 || size <= col + c)\n continue;\n if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||\n (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||\n (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {\n matrix.set(row + r, col + c, true, true);\n }\n else {\n matrix.set(row + r, col + c, false, true);\n }\n }\n }\n }\n}\n/**\n * Add timing pattern bits to matrix\n *\n * Note: this function must be called before {@link setupAlignmentPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n */\nfunction setupTimingPattern(matrix) {\n var size = matrix.size;\n for (var r = 8; r < size - 8; r++) {\n var value = r % 2 === 0;\n matrix.set(r, 6, value, true);\n matrix.set(6, r, value, true);\n }\n}\n/**\n * Add alignment patterns bits to matrix\n *\n * Note: this function must be called after {@link setupTimingPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupAlignmentPattern(matrix, version) {\n var pos = alignmentPattern.getPositions(version);\n for (var i = 0; i < pos.length; i++) {\n var row = pos[i][0];\n var col = pos[i][1];\n for (var r = -2; r <= 2; r++) {\n for (var c = -2; c <= 2; c++) {\n if (r === -2 || r === 2 || c === -2 || c === 2 ||\n (r === 0 && c === 0)) {\n matrix.set(row + r, col + c, true, true);\n }\n else {\n matrix.set(row + r, col + c, false, true);\n }\n }\n }\n }\n}\n/**\n * Add version info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupVersionInfo(matrix, version$1) {\n var size = matrix.size;\n var bits = version.getEncodedBits(version$1);\n var row, col, mod;\n for (var i = 0; i < 18; i++) {\n row = Math.floor(i / 3);\n col = i % 3 + size - 8 - 3;\n mod = ((bits >> i) & 1) === 1;\n matrix.set(row, col, mod, true);\n matrix.set(col, row, mod, true);\n }\n}\n/**\n * Add format info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {Number} maskPattern Mask pattern reference value\n */\nfunction setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {\n var size = matrix.size;\n var bits = formatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);\n var i, mod;\n for (i = 0; i < 15; i++) {\n mod = ((bits >> i) & 1) === 1;\n // vertical\n if (i < 6) {\n matrix.set(i, 8, mod, true);\n }\n else if (i < 8) {\n matrix.set(i + 1, 8, mod, true);\n }\n else {\n matrix.set(size - 15 + i, 8, mod, true);\n }\n // horizontal\n if (i < 8) {\n matrix.set(8, size - i - 1, mod, true);\n }\n else if (i < 9) {\n matrix.set(8, 15 - i - 1 + 1, mod, true);\n }\n else {\n matrix.set(8, 15 - i - 1, mod, true);\n }\n }\n // fixed module\n matrix.set(size - 8, 8, 1, true);\n}\n/**\n * Add encoded data bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Uint8Array} data Data codewords\n */\nfunction setupData(matrix, data) {\n var size = matrix.size;\n var inc = -1;\n var row = size - 1;\n var bitIndex = 7;\n var byteIndex = 0;\n for (var col = size - 1; col > 0; col -= 2) {\n if (col === 6)\n col--;\n while (true) {\n for (var c = 0; c < 2; c++) {\n if (!matrix.isReserved(row, col - c)) {\n var dark = false;\n if (byteIndex < data.length) {\n dark = (((data[byteIndex] >>> bitIndex) & 1) === 1);\n }\n matrix.set(row, col - c, dark);\n bitIndex--;\n if (bitIndex === -1) {\n byteIndex++;\n bitIndex = 7;\n }\n }\n }\n row += inc;\n if (row < 0 || size <= row) {\n row -= inc;\n inc = -inc;\n break;\n }\n }\n }\n}\n/**\n * Create encoded codewords from data input\n *\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {ByteData} data Data input\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createData(version, errorCorrectionLevel, segments) {\n // Prepare data buffer\n var buffer = new bitBuffer();\n segments.forEach(function (data) {\n // prefix data with mode indicator (4 bits)\n buffer.put(data.mode.bit, 4);\n // Prefix data with character count indicator.\n // The character count indicator is a string of bits that represents the\n // number of characters that are being encoded.\n // The character count indicator must be placed after the mode indicator\n // and must be a certain number of bits long, depending on the QR version\n // and data mode\n // @see {@link Mode.getCharCountIndicator}.\n buffer.put(data.getLength(), mode.getCharCountIndicator(data.mode, version));\n // add binary data sequence to buffer\n data.write(buffer);\n });\n // Calculate required number of bits\n var totalCodewords = utils.getSymbolTotalCodewords(version);\n var ecTotalCodewords = errorCorrectionCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n var dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;\n // Add a terminator.\n // If the bit string is shorter than the total number of required bits,\n // a terminator of up to four 0s must be added to the right side of the string.\n // If the bit string is more than four bits shorter than the required number of bits,\n // add four 0s to the end.\n if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {\n buffer.put(0, 4);\n }\n // If the bit string is fewer than four bits shorter, add only the number of 0s that\n // are needed to reach the required number of bits.\n // After adding the terminator, if the number of bits in the string is not a multiple of 8,\n // pad the string on the right with 0s to make the string's length a multiple of 8.\n while (buffer.getLengthInBits() % 8 !== 0) {\n buffer.putBit(0);\n }\n // Add pad bytes if the string is still shorter than the total number of required bits.\n // Extend the buffer to fill the data capacity of the symbol corresponding to\n // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)\n // and 00010001 (0x11) alternately.\n var remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;\n for (var i = 0; i < remainingByte; i++) {\n buffer.put(i % 2 ? 0x11 : 0xEC, 8);\n }\n return createCodewords(buffer, version, errorCorrectionLevel);\n}\n/**\n * Encode input data with Reed-Solomon and return codewords with\n * relative error correction bits\n *\n * @param {BitBuffer} bitBuffer Data to encode\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createCodewords(bitBuffer, version, errorCorrectionLevel) {\n // Total codewords for this QR code version (Data + Error correction)\n var totalCodewords = utils.getSymbolTotalCodewords(version);\n // Total number of error correction codewords\n var ecTotalCodewords = errorCorrectionCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n // Total number of data codewords\n var dataTotalCodewords = totalCodewords - ecTotalCodewords;\n // Total number of blocks\n var ecTotalBlocks = errorCorrectionCode.getBlocksCount(version, errorCorrectionLevel);\n // Calculate how many blocks each group should contain\n var blocksInGroup2 = totalCodewords % ecTotalBlocks;\n var blocksInGroup1 = ecTotalBlocks - blocksInGroup2;\n var totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);\n var dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);\n var dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;\n // Number of EC codewords is the same for both groups\n var ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;\n // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount\n var rs = new reedSolomonEncoder(ecCount);\n var offset = 0;\n var dcData = new Array(ecTotalBlocks);\n var ecData = new Array(ecTotalBlocks);\n var maxDataSize = 0;\n var buffer = new Uint8Array(bitBuffer.buffer);\n // Divide the buffer into the required number of blocks\n for (var b = 0; b < ecTotalBlocks; b++) {\n var dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;\n // extract a block of data from buffer\n dcData[b] = buffer.slice(offset, offset + dataSize);\n // Calculate EC codewords for this data block\n ecData[b] = rs.encode(dcData[b]);\n offset += dataSize;\n maxDataSize = Math.max(maxDataSize, dataSize);\n }\n // Create final data\n // Interleave the data and error correction codewords from each block\n var data = new Uint8Array(totalCodewords);\n var index = 0;\n var i, r;\n // Add data codewords\n for (i = 0; i < maxDataSize; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n if (i < dcData[r].length) {\n data[index++] = dcData[r][i];\n }\n }\n }\n // Apped EC codewords\n for (i = 0; i < ecCount; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n data[index++] = ecData[r][i];\n }\n }\n return data;\n}\n/**\n * Build QR Code symbol\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @param {ErrorCorretionLevel} errorCorrectionLevel Error level\n * @param {MaskPattern} maskPattern Mask pattern\n * @return {Object} Object containing symbol data\n */\nfunction createSymbol(data, version$1, errorCorrectionLevel, maskPattern$1) {\n var segments$1;\n if (Array.isArray(data)) {\n segments$1 = segments.fromArray(data);\n }\n else if (typeof data === 'string') {\n var estimatedVersion = version$1;\n if (!estimatedVersion) {\n var rawSegments = segments.rawSplit(data);\n // Estimate best version that can contain raw splitted segments\n estimatedVersion = version.getBestVersionForData(rawSegments, errorCorrectionLevel);\n }\n // Build optimized segments\n // If estimated version is undefined, try with the highest version\n segments$1 = segments.fromString(data, estimatedVersion || 40);\n }\n else {\n throw new Error('Invalid data');\n }\n // Get the min version that can contain data\n var bestVersion = version.getBestVersionForData(segments$1, errorCorrectionLevel);\n // If no version is found, data cannot be stored\n if (!bestVersion) {\n throw new Error('The amount of data is too big to be stored in a QR Code');\n }\n // If not specified, use min version as default\n if (!version$1) {\n version$1 = bestVersion;\n // Check if the specified version can contain the data\n }\n else if (version$1 < bestVersion) {\n throw new Error('\\n' +\n 'The chosen QR Code version cannot contain this amount of data.\\n' +\n 'Minimum version required to store current data is: ' + bestVersion + '.\\n');\n }\n var dataBits = createData(version$1, errorCorrectionLevel, segments$1);\n // Allocate matrix buffer\n var moduleCount = utils.getSymbolSize(version$1);\n var modules = new bitMatrix(moduleCount);\n // Add function modules\n setupFinderPattern(modules, version$1);\n setupTimingPattern(modules);\n setupAlignmentPattern(modules, version$1);\n // Add temporary dummy bits for format info just to set them as reserved.\n // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}\n // since the masking operation must be performed only on the encoding region.\n // These blocks will be replaced with correct values later in code.\n setupFormatInfo(modules, errorCorrectionLevel, 0);\n if (version$1 >= 7) {\n setupVersionInfo(modules, version$1);\n }\n // Add data codewords\n setupData(modules, dataBits);\n if (isNaN(maskPattern$1)) {\n // Find best mask pattern\n maskPattern$1 = maskPattern.getBestMask(modules, setupFormatInfo.bind(null, modules, errorCorrectionLevel));\n }\n // Apply mask pattern\n maskPattern.applyMask(maskPattern$1, modules);\n // Replace format info bits with correct values\n setupFormatInfo(modules, errorCorrectionLevel, maskPattern$1);\n return {\n modules: modules,\n version: version$1,\n errorCorrectionLevel: errorCorrectionLevel,\n maskPattern: maskPattern$1,\n segments: segments$1\n };\n}\n/**\n * QR Code\n *\n * @param {String | Array} data Input data\n * @param {Object} options Optional configurations\n * @param {Number} options.version QR Code version\n * @param {String} options.errorCorrectionLevel Error correction level\n * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis\n */\nvar create = function create(data, options) {\n if (typeof data === 'undefined' || data === '') {\n throw new Error('No input text');\n }\n var errorCorrectionLevel$1 = errorCorrectionLevel.M;\n var version$1;\n var mask;\n if (typeof options !== 'undefined') {\n // Use higher error correction level as default\n errorCorrectionLevel$1 = errorCorrectionLevel.from(options.errorCorrectionLevel, errorCorrectionLevel.M);\n version$1 = version.from(options.version);\n mask = maskPattern.from(options.maskPattern);\n if (options.toSJISFunc) {\n utils.setToSJISFunction(options.toSJISFunc);\n }\n }\n return createSymbol(data, version$1, errorCorrectionLevel$1, mask);\n};\nvar qrcode = {\n create: create\n};\nvar utils$1 = createCommonjsModule(function (module, exports) {\n function hex2rgba(hex) {\n if (typeof hex === 'number') {\n hex = hex.toString();\n }\n if (typeof hex !== 'string') {\n throw new Error('Color should be defined as hex string');\n }\n var hexCode = hex.slice().replace('#', '').split('');\n if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {\n throw new Error('Invalid hex color: ' + hex);\n }\n // Convert from short to long form (fff -> ffffff)\n if (hexCode.length === 3 || hexCode.length === 4) {\n hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {\n return [c, c];\n }));\n }\n // Add default alpha value\n if (hexCode.length === 6)\n hexCode.push('F', 'F');\n var hexValue = parseInt(hexCode.join(''), 16);\n return {\n r: (hexValue >> 24) & 255,\n g: (hexValue >> 16) & 255,\n b: (hexValue >> 8) & 255,\n a: hexValue & 255,\n hex: '#' + hexCode.slice(0, 6).join('')\n };\n }\n exports.getOptions = function getOptions(options) {\n if (!options)\n options = {};\n if (!options.color)\n options.color = {};\n var margin = typeof options.margin === 'undefined' ||\n options.margin === null ||\n options.margin < 0\n ? 4\n : options.margin;\n var width = options.width && options.width >= 21 ? options.width : undefined;\n var scale = options.scale || 4;\n return {\n width: width,\n scale: width ? 4 : scale,\n margin: margin,\n color: {\n dark: hex2rgba(options.color.dark || '#000000ff'),\n light: hex2rgba(options.color.light || '#ffffffff')\n },\n type: options.type,\n rendererOpts: options.rendererOpts || {}\n };\n };\n exports.getScale = function getScale(qrSize, opts) {\n return opts.width && opts.width >= qrSize + opts.margin * 2\n ? opts.width / (qrSize + opts.margin * 2)\n : opts.scale;\n };\n exports.getImageWidth = function getImageWidth(qrSize, opts) {\n var scale = exports.getScale(qrSize, opts);\n return Math.floor((qrSize + opts.margin * 2) * scale);\n };\n exports.qrToImageData = function qrToImageData(imgData, qr, opts) {\n var size = qr.modules.size;\n var data = qr.modules.data;\n var scale = exports.getScale(size, opts);\n var symbolSize = Math.floor((size + opts.margin * 2) * scale);\n var scaledMargin = opts.margin * scale;\n var palette = [opts.color.light, opts.color.dark];\n for (var i = 0; i < symbolSize; i++) {\n for (var j = 0; j < symbolSize; j++) {\n var posDst = (i * symbolSize + j) * 4;\n var pxColor = opts.color.light;\n if (i >= scaledMargin && j >= scaledMargin &&\n i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {\n var iSrc = Math.floor((i - scaledMargin) / scale);\n var jSrc = Math.floor((j - scaledMargin) / scale);\n pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];\n }\n imgData[posDst++] = pxColor.r;\n imgData[posDst++] = pxColor.g;\n imgData[posDst++] = pxColor.b;\n imgData[posDst] = pxColor.a;\n }\n }\n };\n});\nvar canvas = createCommonjsModule(function (module, exports) {\n function clearCanvas(ctx, canvas, size) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (!canvas.style)\n canvas.style = {};\n canvas.height = size;\n canvas.width = size;\n canvas.style.height = size + 'px';\n canvas.style.width = size + 'px';\n }\n function getCanvasElement() {\n try {\n return document.createElement('canvas');\n }\n catch (e) {\n throw new Error('You need to specify a canvas element');\n }\n }\n exports.render = function render(qrData, canvas, options) {\n var opts = options;\n var canvasEl = canvas;\n if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {\n opts = canvas;\n canvas = undefined;\n }\n if (!canvas) {\n canvasEl = getCanvasElement();\n }\n opts = utils$1.getOptions(opts);\n var size = utils$1.getImageWidth(qrData.modules.size, opts);\n var ctx = canvasEl.getContext('2d');\n var image = ctx.createImageData(size, size);\n utils$1.qrToImageData(image.data, qrData, opts);\n clearCanvas(ctx, canvasEl, size);\n ctx.putImageData(image, 0, 0);\n return canvasEl;\n };\n exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {\n var opts = options;\n if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {\n opts = canvas;\n canvas = undefined;\n }\n if (!opts)\n opts = {};\n var canvasEl = exports.render(qrData, canvas, opts);\n var type = opts.type || 'image/png';\n var rendererOpts = opts.rendererOpts || {};\n return canvasEl.toDataURL(type, rendererOpts.quality);\n };\n});\nfunction getColorAttrib(color, attrib) {\n var alpha = color.a / 255;\n var str = attrib + '=\"' + color.hex + '\"';\n return alpha < 1\n ? str + ' ' + attrib + '-opacity=\"' + alpha.toFixed(2).slice(1) + '\"'\n : str;\n}\nfunction svgCmd(cmd, x, y) {\n var str = cmd + x;\n if (typeof y !== 'undefined')\n str += ' ' + y;\n return str;\n}\nfunction qrToPath(data, size, margin) {\n var path = '';\n var moveBy = 0;\n var newRow = false;\n var lineLength = 0;\n for (var i = 0; i < data.length; i++) {\n var col = Math.floor(i % size);\n var row = Math.floor(i / size);\n if (!col && !newRow)\n newRow = true;\n if (data[i]) {\n lineLength++;\n if (!(i > 0 && col > 0 && data[i - 1])) {\n path += newRow\n ? svgCmd('M', col + margin, 0.5 + row + margin)\n : svgCmd('m', moveBy, 0);\n moveBy = 0;\n newRow = false;\n }\n if (!(col + 1 < size && data[i + 1])) {\n path += svgCmd('h', lineLength);\n lineLength = 0;\n }\n }\n else {\n moveBy++;\n }\n }\n return path;\n}\nvar render = function render(qrData, options, cb) {\n var opts = utils$1.getOptions(options);\n var size = qrData.modules.size;\n var data = qrData.modules.data;\n var qrcodesize = size + opts.margin * 2;\n var bg = !opts.color.light.a\n ? ''\n : '';\n var path = '';\n var viewBox = 'viewBox=\"' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '\"';\n var width = !opts.width ? '' : 'width=\"' + opts.width + '\" height=\"' + opts.width + '\" ';\n var svgTag = '' + bg + path + '\\n';\n if (typeof cb === 'function') {\n cb(null, svgTag);\n }\n return svgTag;\n};\nvar svgTag = {\n render: render\n};\nfunction renderCanvas(renderFunc, canvas, text, opts, cb) {\n var args = [].slice.call(arguments, 1);\n var argsNum = args.length;\n var isLastArgCb = typeof args[argsNum - 1] === 'function';\n if (!isLastArgCb && !canPromise()) {\n throw new Error('Callback required as last argument');\n }\n if (isLastArgCb) {\n if (argsNum < 2) {\n throw new Error('Too few arguments provided');\n }\n if (argsNum === 2) {\n cb = text;\n text = canvas;\n canvas = opts = undefined;\n }\n else if (argsNum === 3) {\n if (canvas.getContext && typeof cb === 'undefined') {\n cb = opts;\n opts = undefined;\n }\n else {\n cb = opts;\n opts = text;\n text = canvas;\n canvas = undefined;\n }\n }\n }\n else {\n if (argsNum < 1) {\n throw new Error('Too few arguments provided');\n }\n if (argsNum === 1) {\n text = canvas;\n canvas = opts = undefined;\n }\n else if (argsNum === 2 && !canvas.getContext) {\n opts = text;\n text = canvas;\n canvas = undefined;\n }\n return new Promise(function (resolve, reject) {\n try {\n var data = qrcode.create(text, opts);\n resolve(renderFunc(data, canvas, opts));\n }\n catch (e) {\n reject(e);\n }\n });\n }\n try {\n var data = qrcode.create(text, opts);\n cb(null, renderFunc(data, canvas, opts));\n }\n catch (e) {\n cb(e);\n }\n}\nvar create$1 = qrcode.create;\nvar toCanvas = renderCanvas.bind(null, canvas.render);\nvar toDataURL = renderCanvas.bind(null, canvas.renderToDataURL);\n// only svg for now.\nvar toString_1 = renderCanvas.bind(null, function (data, _, opts) {\n return svgTag.render(data, opts);\n});\nvar browser = {\n create: create$1,\n toCanvas: toCanvas,\n toDataURL: toDataURL,\n toString: toString_1\n};\nvar amplifyTotpSetupCss = \".totp-setup{text-align:center;margin-bottom:30px}.totp-setup img{height:128px;width:128px}\";\nvar logger = new Logger('TOTP');\nvar AmplifyTOTPSetup = /** @class */ (function () {\n function class_1(hostRef) {\n registerInstance(this, hostRef);\n this.inputProps = {\n autoFocus: true,\n };\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Used for header text in totp setup component */\n this.headerText = Translations.TOTP_HEADER_TEXT;\n /** Used for customizing the issuer string in the qr code image */\n this.issuer = Translations.TOTP_ISSUER;\n /** This is run after totp setup is complete. Useful if using this as standalone. */\n this.handleComplete = this.onTOTPEvent;\n /** Set this to true if this component is running outside the default `amplify-authenticator` usage */\n this.standalone = false;\n this.code = null;\n this.setupMessage = null;\n this.qrCodeInput = null;\n this.loading = false;\n }\n class_1.prototype.componentWillLoad = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n /**\n * If this component is being used internally by the authenticator, we want to re-run\n * setup only when the current auth state is `AuthState.TOTPSetup`.\n *\n * Ideally, we would only run the setup once when the component is mounted. This is not possible\n * due to a bug with slots -- a slotted component will run its `componentWillLoad` lifecycle before\n * it is even rendered. So instead we watch for authstate changes and run setup conditionally.\n */\n if (!this.standalone) {\n this.removeHubListener = onAuthUIStateChange(function (authState) {\n if (authState === AuthState.TOTPSetup)\n _this.setup();\n });\n }\n return [4 /*yield*/, this.setup()];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * If this component is being used externally, we can use `@Watch` as normal.\n */\n class_1.prototype.handleUserChange = function () {\n this.standalone && this.setup();\n };\n class_1.prototype.disconnectedCallback = function () {\n this.removeHubListener && this.removeHubListener(); // stop listening to `onAuthUIStateChange`\n };\n class_1.prototype.buildOtpAuthPath = function (user, issuer, secretKey) {\n return \"otpauth://totp/\" + issuer + \":\" + user.username + \"?secret=\" + secretKey + \"&issuer=\" + issuer;\n };\n class_1.prototype.onTOTPEvent = function (user) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug('on totp event');\n return [4 /*yield*/, checkContact(user, this.handleAuthStateChange)];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.handleTotpInputChange = function (event) {\n this.setupMessage = null;\n this.qrCodeInput = event.target.value;\n };\n class_1.prototype.generateQRCode = function (codeFromTotp) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, error_1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n _a = this;\n return [4 /*yield*/, browser.toDataURL(codeFromTotp)];\n case 1:\n _a.qrCodeImageSource = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n error_1 = _b.sent();\n dispatchToastHubEvent(error_1);\n return [3 /*break*/, 3];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.setup = function () {\n return __awaiter(this, void 0, void 0, function () {\n var encodedIssuer, secretKey, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // ensure setup is only run once after totp setup is available\n if (this.code || this.loading) {\n logger.debug('setup was attempted while another is in progress, skipping setup.');\n return [2 /*return*/];\n }\n if (!this.user || !this.user.associateSoftwareToken) {\n logger.debug('setup was attempted with invalid `user`, skipping setup.', this.user);\n return [2 /*return*/];\n }\n if (!Auth || typeof Auth.setupTOTP !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.setupMessage = null;\n encodedIssuer = encodeURI(I18n.get(this.issuer));\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.setupTOTP(this.user)];\n case 2:\n secretKey = _a.sent();\n logger.debug('secret key', secretKey);\n this.code = this.buildOtpAuthPath(this.user, encodedIssuer, secretKey);\n this.generateQRCode(this.code);\n return [3 /*break*/, 5];\n case 3:\n error_2 = _a.sent();\n dispatchToastHubEvent(error_2);\n logger.debug(I18n.get(Translations.TOTP_SETUP_FAILURE), error_2);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.verifyTotpToken = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var user, error_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!this.qrCodeInput) {\n logger.debug('No TOTP Code provided');\n return [2 /*return*/];\n }\n user = this.user;\n if (!Auth ||\n typeof Auth.verifyTotpToken !== 'function' ||\n typeof Auth.setPreferredMFA !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 5, , 6]);\n return [4 /*yield*/, Auth.verifyTotpToken(user, this.qrCodeInput)];\n case 2:\n _a.sent();\n return [4 /*yield*/, Auth.setPreferredMFA(user, MfaOption.TOTP)];\n case 3:\n _a.sent();\n this.setupMessage = I18n.get(Translations.TOTP_SUCCESS_MESSAGE);\n logger.debug(I18n.get(Translations.TOTP_SUCCESS_MESSAGE));\n return [4 /*yield*/, this.handleComplete(user)];\n case 4:\n _a.sent();\n return [3 /*break*/, 6];\n case 5:\n error_3 = _a.sent();\n this.setupMessage = I18n.get(Translations.TOTP_SETUP_FAILURE);\n logger.error(error_3);\n return [3 /*break*/, 6];\n case 6: return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), submitButtonText: I18n.get(Translations.TOTP_SUBMIT_BUTTON_TEXT), handleSubmit: function (event) { return _this.verifyTotpToken(event); }, loading: this.loading }, h(\"div\", { class: \"totp-setup\" }, this.qrCodeImageSource && (h(\"img\", { src: this.qrCodeImageSource, alt: I18n.get(Translations.QR_CODE_ALT) })), h(\"amplify-form-field\", { label: I18n.get(Translations.TOTP_LABEL), inputProps: this.inputProps, fieldId: \"totpCode\", name: \"totpCode\", handleInputChange: function (event) { return _this.handleTotpInputChange(event); } })))));\n };\n Object.defineProperty(class_1, \"watchers\", {\n get: function () {\n return {\n \"user\": [\"handleUserChange\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_1;\n}());\nAmplifyTOTPSetup.style = amplifyTotpSetupCss;\nexport { AmplifyRadioButton as amplify_radio_button, AmplifyToast as amplify_toast, AmplifyTOTPSetup as amplify_totp_setup };\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { Logger, isEmpty } from '@aws-amplify/core';\nimport { A as AuthState, C as ChallengeName, U as UsernameAlias } from './auth-types-78df304e.js';\nimport { Auth, CognitoUser } from '@aws-amplify/auth';\nimport { T as Translations } from './Translations-108d469f.js';\nimport { N as NO_AUTH_MODULE_FOUND } from './constants-c8ecaa24.js';\nimport { a as dispatchToastHubEvent } from './helpers-14fcb50c.js';\nvar logger = new Logger('auth-helpers');\nfunction checkContact(user, handleAuthStateChange) {\n return __awaiter(this, void 0, void 0, function () {\n var data, newUser, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!Auth || typeof Auth.verifiedContact !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n // If `user` is a federated user, we shouldn't call `verifiedContact`\n // since `user` isn't `CognitoUser`\n if (!isCognitoUser(user)) {\n handleAuthStateChange(AuthState.SignedIn, user);\n return [2 /*return*/];\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, Auth.verifiedContact(user)];\n case 2:\n data = _a.sent();\n if (!isEmpty(data.verified) || isEmpty(data.unverified)) {\n handleAuthStateChange(AuthState.SignedIn, user);\n }\n else {\n newUser = Object.assign(user, data);\n handleAuthStateChange(AuthState.VerifyContact, newUser);\n }\n return [3 /*break*/, 4];\n case 3:\n error_1 = _a.sent();\n dispatchToastHubEvent(error_1);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n}\nvar handleSignIn = function (username, password, handleAuthStateChange, usernameAlias) { return __awaiter(void 0, void 0, void 0, function () {\n var user, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!Auth || typeof Auth.signIn !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 9, , 10]);\n return [4 /*yield*/, Auth.signIn(username, password)];\n case 2:\n user = _a.sent();\n logger.debug(user);\n if (!(user.challengeName === ChallengeName.SMSMFA ||\n user.challengeName === ChallengeName.SoftwareTokenMFA)) return [3 /*break*/, 3];\n logger.debug('confirm user with ' + user.challengeName);\n handleAuthStateChange(AuthState.ConfirmSignIn, user);\n return [3 /*break*/, 8];\n case 3:\n if (!(user.challengeName === ChallengeName.NewPasswordRequired)) return [3 /*break*/, 4];\n logger.debug('require new password', user.challengeParam);\n handleAuthStateChange(AuthState.ResetPassword, user);\n return [3 /*break*/, 8];\n case 4:\n if (!(user.challengeName === ChallengeName.MFASetup)) return [3 /*break*/, 5];\n logger.debug('TOTP setup', user.challengeParam);\n handleAuthStateChange(AuthState.TOTPSetup, user);\n return [3 /*break*/, 8];\n case 5:\n if (!(user.challengeName === ChallengeName.CustomChallenge &&\n user.challengeParam &&\n user.challengeParam.trigger === 'true')) return [3 /*break*/, 6];\n logger.debug('custom challenge', user.challengeParam);\n handleAuthStateChange(AuthState.CustomConfirmSignIn, user);\n return [3 /*break*/, 8];\n case 6: return [4 /*yield*/, checkContact(user, handleAuthStateChange)];\n case 7:\n _a.sent();\n _a.label = 8;\n case 8: return [3 /*break*/, 10];\n case 9:\n error_2 = _a.sent();\n if (error_2.code === 'UserNotConfirmedException') {\n logger.debug('the user is not confirmed');\n handleAuthStateChange(AuthState.ConfirmSignUp, { username: username });\n }\n else if (error_2.code === 'PasswordResetRequiredException') {\n logger.debug('the user requires a new password');\n handleAuthStateChange(AuthState.ForgotPassword, { username: username });\n }\n else if (error_2.code === 'InvalidParameterException' && password === '') {\n logger.debug('Password cannot be empty');\n error_2.message = Translations.EMPTY_PASSWORD;\n }\n else if (error_2.message === Translations.EMPTY_USERNAME) {\n if (usernameAlias === UsernameAlias.email) {\n error_2.message = Translations.EMPTY_EMAIL;\n }\n if (usernameAlias === UsernameAlias.phone_number) {\n error_2.message = Translations.EMPTY_PHONE;\n }\n }\n dispatchToastHubEvent(error_2);\n return [3 /*break*/, 10];\n case 10: return [2 /*return*/];\n }\n });\n}); };\nvar isCognitoUser = function (user) {\n return user instanceof CognitoUser;\n};\nexport { checkContact as c, handleSignIn as h };\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar _a;\nimport { r as registerInstance, h, H as Host, g as getElement } from './index-83f2275b.js';\nimport { Logger, Hub } from '@aws-amplify/core';\nimport { A as AuthState } from './auth-types-78df304e.js';\nimport { appendToCognitoUserAgent, Auth } from '@aws-amplify/auth';\nimport './Translations-108d469f.js';\nimport { T as TOAST_AUTH_ERROR_EVENT, U as UI_AUTH_CHANNEL, A as AUTH_CHANNEL, N as NO_AUTH_MODULE_FOUND } from './constants-c8ecaa24.js';\nimport { d as dispatchAuthStateChangeEvent, o as onAuthUIStateChange } from './helpers-14fcb50c.js';\nimport { c as checkContact } from './auth-helpers-557b83fc.js';\nvar authSlotNames = (_a = {},\n _a[AuthState.SignIn] = 'sign-in',\n _a[AuthState.ConfirmSignIn] = 'confirm-sign-in',\n _a[AuthState.SignUp] = 'sign-up',\n _a[AuthState.ConfirmSignUp] = 'confirm-sign-up',\n _a[AuthState.ForgotPassword] = 'forgot-password',\n _a[AuthState.ResetPassword] = 'require-new-password',\n _a[AuthState.VerifyContact] = 'verify-contact',\n _a[AuthState.TOTPSetup] = 'totp-setup',\n _a[AuthState.Loading] = 'loading',\n _a);\nvar amplifyAuthenticatorCss = \":host{--background-color:var(--amplify-background-color);--width:28.75rem;--min-width:20rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--box-shadow:1px 1px 4px 0 rgba(0, 0, 0, 0.15);--border-radius:6px;--padding:35px 40px;--margin-bottom:20px;--container-height:100vh;--container-display:flex;--container-justify:center;--container-align:center}.auth-container{display:var(--container-display);-ms-flex-pack:var(--container-justify);justify-content:var(--container-justify);-ms-flex-align:var(--container-align);align-items:var(--container-align);min-height:var(--container-height)}\";\nvar logger = new Logger('Authenticator');\nvar AmplifyAuthenticator = /** @class */ (function () {\n function class_1(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Initial starting state of the Authenticator component. E.g. If `signup` is passed the default component is set to AmplifySignUp */\n this.initialAuthState = AuthState.SignIn;\n /** Callback for Authenticator state machine changes */\n this.handleAuthStateChange = function () { };\n /** Hide amplify-toast for auth errors */\n this.hideToast = false;\n this.authState = AuthState.Loading;\n this.toastMessage = '';\n this.handleExternalAuthEvent = function (_a) {\n var payload = _a.payload;\n switch (payload.event) {\n case 'cognitoHostedUI':\n case 'signIn':\n checkContact(payload.data, dispatchAuthStateChangeEvent);\n break;\n case 'cognitoHostedUI_failure':\n case 'parsingUrl_failure':\n case 'signOut':\n case 'customGreetingSignOut':\n return dispatchAuthStateChangeEvent(_this.initialAuthState);\n }\n };\n this.handleToastEvent = function (_a) {\n var payload = _a.payload;\n switch (payload.event) {\n case TOAST_AUTH_ERROR_EVENT:\n if (payload.message)\n _this.toastMessage = payload.message;\n break;\n }\n };\n }\n class_1.prototype.componentWillLoad = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n onAuthUIStateChange(function (authState, authData) {\n _this.onAuthStateChange(authState, authData);\n _this.toastMessage = '';\n });\n if (!this.hideToast)\n Hub.listen(UI_AUTH_CHANNEL, this.handleToastEvent);\n Hub.listen(AUTH_CHANNEL, this.handleExternalAuthEvent);\n appendToCognitoUserAgent('amplify-authenticator');\n return [4 /*yield*/, this.checkUser()];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.checkUser = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (!Auth || typeof Auth.currentAuthenticatedUser !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n return [2 /*return*/, Auth.currentAuthenticatedUser()\n .then(function (user) {\n dispatchAuthStateChangeEvent(AuthState.SignedIn, user);\n })\n .catch(function () {\n dispatchAuthStateChangeEvent(_this.initialAuthState);\n })];\n });\n });\n };\n class_1.prototype.onAuthStateChange = function (nextAuthState, data) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (nextAuthState === undefined)\n return [2 /*return*/, logger.error('nextAuthState cannot be undefined')];\n logger.info('Inside onAuthStateChange Method current authState:', this.authState);\n if (nextAuthState === AuthState.SignedOut) {\n this.authState = this.initialAuthState;\n }\n else {\n this.authState = nextAuthState;\n }\n this.authData = data;\n if (this.authData)\n logger.log('Auth Data was set:', this.authData);\n if (this.authState === nextAuthState) {\n this.handleAuthStateChange(this.authState, this.authData);\n logger.info(\"authState has been updated to \" + this.authState);\n }\n return [2 /*return*/];\n });\n });\n };\n // Returns the auth component corresponding to the given authState.\n class_1.prototype.getAuthComponent = function (authState) {\n switch (authState) {\n case AuthState.SignIn:\n return (h(\"amplify-sign-in\", { federated: this.federated, usernameAlias: this.usernameAlias }));\n case AuthState.ConfirmSignIn:\n return h(\"amplify-confirm-sign-in\", { user: this.authData });\n case AuthState.SignUp:\n return h(\"amplify-sign-up\", { usernameAlias: this.usernameAlias });\n case AuthState.ConfirmSignUp:\n return (h(\"amplify-confirm-sign-up\", { user: this.authData, usernameAlias: this.usernameAlias }));\n case AuthState.ForgotPassword:\n return h(\"amplify-forgot-password\", { usernameAlias: this.usernameAlias });\n case AuthState.ResetPassword:\n return h(\"amplify-require-new-password\", { user: this.authData });\n case AuthState.VerifyContact:\n return h(\"amplify-verify-contact\", { user: this.authData });\n case AuthState.TOTPSetup:\n return h(\"amplify-totp-setup\", { user: this.authData });\n case AuthState.Loading:\n return h(\"div\", null, \"Loading...\");\n default:\n throw new Error(\"Unhandled auth state: \" + authState);\n }\n };\n // Returns a slot containing the Auth component corresponding to the given authState\n class_1.prototype.getSlotWithAuthComponent = function (authState) {\n var authComponent = this.getAuthComponent(authState);\n var slotName = authSlotNames[authState];\n var slotIsEmpty = this.el.querySelector(\"[slot=\\\"\" + slotName + \"\\\"]\") === null; // true if no element has been inserted to the slot\n /**\n * Connect the inner auth component to DOM only if the slot hasn't been overwritten. This prevents\n * the overwritten component from calling its lifecycle methods.\n */\n return h(\"slot\", { name: slotName }, slotIsEmpty && authComponent);\n };\n class_1.prototype.disconnectedCallback = function () {\n Hub.remove(AUTH_CHANNEL, this.handleExternalAuthEvent);\n if (!this.hideToast)\n Hub.remove(UI_AUTH_CHANNEL, this.handleToastEvent);\n return onAuthUIStateChange;\n };\n class_1.prototype.render = function () {\n var _this = this;\n return (h(Host, null, !this.hideToast && this.toastMessage && (h(\"amplify-toast\", { message: this.toastMessage, handleClose: function () {\n _this.toastMessage = '';\n }, \"data-test\": \"authenticator-error\" })), this.authState === AuthState.SignedIn ? ([h(\"slot\", { name: \"greetings\" }), h(\"slot\", null)]) : (h(\"div\", { class: \"auth-container\" }, this.getSlotWithAuthComponent(this.authState)))));\n };\n Object.defineProperty(class_1.prototype, \"el\", {\n get: function () { return getElement(this); },\n enumerable: false,\n configurable: true\n });\n return class_1;\n}());\nAmplifyAuthenticator.style = amplifyAuthenticatorCss;\nexport { AmplifyAuthenticator as amplify_authenticator };\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nimport { r as registerInstance, h, H as Host } from './index-83f2275b.js';\nimport { I18n, Logger, ConsoleLogger, isEmpty } from '@aws-amplify/core';\nimport { M as MfaOption, C as ChallengeName, A as AuthState, a as AuthFormField, U as UsernameAlias } from './auth-types-78df304e.js';\nimport { Auth } from '@aws-amplify/auth';\nimport { T as Translations } from './Translations-108d469f.js';\nimport { N as NO_AUTH_MODULE_FOUND, g as COUNTRY_DIAL_CODE_DEFAULT, b as PHONE_SUFFIX } from './constants-c8ecaa24.js';\nimport { d as dispatchAuthStateChangeEvent, a as dispatchToastHubEvent, c as checkUsernameAlias, i as isHintValid, h as handlePhoneNumberChange, b as composePhoneNumberInput, g as getRequiredAttributesMap } from './helpers-14fcb50c.js';\nimport { c as checkContact, h as handleSignIn } from './auth-helpers-557b83fc.js';\nvar AmplifyConfirmSignIn = /** @class */ (function () {\n function class_1(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when confirm sign in form is submitted */\n this.handleSubmit = function (event) { return _this.confirm(event); };\n /** Used for header text in confirm sign in component */\n this.headerText = Translations.CONFIRM_SMS_CODE;\n /** Used for the submit button text in confirm sign in component */\n this.submitButtonText = Translations.CONFIRM;\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Default form field */\n this.defaultFormFields = [\n {\n type: 'code',\n required: true,\n handleInputChange: function (event) { return _this.handleCodeChange(event); },\n },\n ];\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = this.defaultFormFields;\n /** The MFA option to confirm with */\n this.mfaOption = MfaOption.SMS;\n /* Whether or not the confirm-sign-in component is loading */\n this.loading = false;\n }\n class_1.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n this.setup();\n };\n class_1.prototype.userHandler = function () {\n this.setup();\n };\n class_1.prototype.setup = function () {\n if (this.user &&\n this.user['challengeName'] === ChallengeName.SoftwareTokenMFA) {\n this.mfaOption = MfaOption.TOTP;\n // If header text is using default use TOTP string\n if (this.headerText === Translations.CONFIRM_SMS_CODE) {\n this.headerText = Translations.CONFIRM_TOTP_CODE;\n }\n }\n this.constructedFormFieldOptions = this.constructFormFieldOptions(this.formFields);\n };\n class_1.prototype.handleCodeChange = function (event) {\n this.code = event.target.value;\n };\n class_1.prototype.confirm = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var mfaType, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n mfaType = this.user['challengeName'] === ChallengeName.SoftwareTokenMFA\n ? ChallengeName.SoftwareTokenMFA\n : null;\n if (!Auth || typeof Auth.confirmSignIn !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, 5, 6]);\n return [4 /*yield*/, Auth.confirmSignIn(this.user, this.code, mfaType)];\n case 2:\n _a.sent();\n return [4 /*yield*/, checkContact(this.user, this.handleAuthStateChange)];\n case 3:\n _a.sent();\n return [3 /*break*/, 6];\n case 4:\n error_1 = _a.sent();\n dispatchToastHubEvent(error_1);\n return [3 /*break*/, 6];\n case 5:\n this.loading = false;\n return [7 /*endfinally*/];\n case 6: return [2 /*return*/];\n }\n });\n });\n };\n class_1.prototype.constructFormFieldOptions = function (formFields) {\n var _this = this;\n var content = [];\n if (formFields === undefined)\n return undefined;\n if (formFields.length <= 0)\n return this.defaultFormFields;\n formFields.forEach(function (formField) {\n if (typeof formField === 'string' || formField.type !== 'code') {\n // This is either a `string`, and/or a custom field that isn't `code`. Pass this directly.\n content.push(formField);\n }\n else {\n // This is a code input field. Attach input handler.\n content.push(Object.assign({ handleInputChange: function (event) { return _this.handleCodeChange(event); } }, formField));\n }\n });\n return content;\n };\n class_1.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, submitButtonText: I18n.get(this.submitButtonText), loading: this.loading, secondaryFooterContent: h(\"span\", null, h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); } }, I18n.get(Translations.BACK_TO_SIGN_IN))) }, h(\"amplify-auth-fields\", { formFields: this.constructedFormFieldOptions }))));\n };\n Object.defineProperty(class_1, \"watchers\", {\n get: function () {\n return {\n \"user\": [\"userHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_1;\n}());\nvar AmplifyConfirmSignUp = /** @class */ (function () {\n function class_2(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when sign up form is submitted */\n this.handleSubmit = function (event) { return _this.confirmSignUp(event); };\n /** Used for header text in confirm sign up component */\n this.headerText = Translations.CONFIRM_SIGN_UP_HEADER_TEXT;\n /** Used for the submit button text in confirm sign up component */\n this.submitButtonText = Translations.CONFIRM_SIGN_UP_SUBMIT_BUTTON_TEXT;\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = [];\n /** Auth state change handler for this components\n * e.g. SignIn -> 'Create Account' link -> SignUp\n */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n this.loading = false;\n this.newFormFields = [];\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n }\n class_2.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n this.setup();\n };\n class_2.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_2.prototype.userHandler = function () {\n this.setup();\n };\n class_2.prototype.setup = function () {\n // TODO: Use optional chaining instead\n this.userInput = this.user && this.user.username;\n this._signUpAttrs = this.user && this.user.signUpAttrs;\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_2.prototype.buildDefaultFormFields = function () {\n var _this = this;\n this.newFormFields = [\n {\n type: \"\" + this.usernameAlias,\n required: true,\n handleInputChange: this.handleFormFieldInputChange(\"\" + this.usernameAlias),\n value: this.userInput,\n disabled: this.userInput ? true : false,\n inputProps: { autocomplete: 'username' },\n },\n {\n type: 'code',\n label: I18n.get(Translations.CONFIRM_SIGN_UP_CODE_LABEL),\n placeholder: I18n.get(Translations.CONFIRM_SIGN_UP_CODE_PLACEHOLDER),\n required: true,\n hint: (h(\"div\", null, I18n.get(Translations.CONFIRM_SIGN_UP_LOST_CODE), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.resendConfirmCode(); } }, I18n.get(Translations.CONFIRM_SIGN_UP_RESEND_CODE)))),\n handleInputChange: this.handleFormFieldInputChange('code'),\n },\n ];\n };\n class_2.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_1 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n if (newField.type === 'code') {\n newField['hint'] = isHintValid(newField) ? (h(\"div\", null, I18n.get(Translations.CONFIRM_SIGN_UP_LOST_CODE), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.resendConfirmCode(); } }, I18n.get(Translations.CONFIRM_SIGN_UP_RESEND_CODE)))) : (newField['hint']);\n }\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n newFields_1.push(newField);\n });\n this.newFormFields = newFields_1;\n }\n };\n class_2.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n case 'email':\n return function (event) { return (_this.userInput = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n case 'code':\n return function (event) { return (_this.code = event.target.value); };\n default:\n return;\n }\n };\n class_2.prototype.setFieldValue = function (field) {\n switch (field.type) {\n case 'username':\n case 'email':\n if (field.value === undefined) {\n this.userInput = '';\n }\n else {\n this.userInput = field.value;\n }\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n }\n };\n class_2.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n /**\n * Returns the username of the user to confirm. If a valid `user.username` has been passed as a prop, we return that.\n * Otherwise, we return the `userInput` on the form.\n */\n class_2.prototype.getUsername = function () {\n if (this.user && this.user.username)\n return this.user.username;\n switch (this.usernameAlias) {\n case 'username':\n case 'email':\n return this.userInput;\n case 'phone_number':\n return composePhoneNumberInput(this.phoneNumber);\n }\n };\n class_2.prototype.resendConfirmCode = function () {\n return __awaiter(this, void 0, void 0, function () {\n var username, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.resendSignUp !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n username = this.getUsername();\n if (!username)\n throw new Error(Translations.EMPTY_USERNAME);\n return [4 /*yield*/, Auth.resendSignUp(username.trim())];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n error_2 = _a.sent();\n dispatchToastHubEvent(error_2);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n // TODO: Add validation\n // TODO: Prefix\n class_2.prototype.confirmSignUp = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var username, confirmSignUpResult, error_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.confirmSignUp !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 6, 7, 8]);\n username = this.getUsername();\n if (!username)\n throw new Error(Translations.EMPTY_USERNAME);\n username = username.trim();\n return [4 /*yield*/, Auth.confirmSignUp(username, this.code)];\n case 2:\n confirmSignUpResult = _a.sent();\n if (!confirmSignUpResult) {\n throw new Error(I18n.get(Translations.CONFIRM_SIGN_UP_FAILED));\n }\n if (!(this._signUpAttrs &&\n this._signUpAttrs.password &&\n this._signUpAttrs.password !== '')) return [3 /*break*/, 4];\n // Auto sign in user if password is available from previous workflow\n return [4 /*yield*/, handleSignIn(username, this._signUpAttrs.password, this.handleAuthStateChange)];\n case 3:\n // Auto sign in user if password is available from previous workflow\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n this.handleAuthStateChange(AuthState.SignIn);\n _a.label = 5;\n case 5: return [3 /*break*/, 8];\n case 6:\n error_3 = _a.sent();\n dispatchToastHubEvent(error_3);\n return [3 /*break*/, 8];\n case 7:\n this.loading = false;\n return [7 /*endfinally*/];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n class_2.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), submitButtonText: I18n.get(this.submitButtonText), handleSubmit: this.handleSubmit, loading: this.loading, secondaryFooterContent: h(\"div\", null, h(\"span\", null, h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); } }, I18n.get(Translations.BACK_TO_SIGN_IN)))) }, h(\"amplify-auth-fields\", { formFields: this.newFormFields }))));\n };\n Object.defineProperty(class_2, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"],\n \"user\": [\"userHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_2;\n}());\nvar logger = new Logger('ForgotPassword');\nvar AmplifyForgotPassword = /** @class */ (function () {\n function class_3(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** The header text of the forgot password section */\n this.headerText = Translations.RESET_YOUR_PASSWORD;\n /** The text displayed inside of the send code button for the form */\n this.sendButtonText = Translations.SEND_CODE;\n /** The text displayed inside of the submit button for the form */\n this.submitButtonText = Translations.SUBMIT;\n /** The form fields displayed inside of the forgot password form */\n this.formFields = [];\n /** The function called when making a request to reset password */\n this.handleSend = function (event) { return _this.send(event); };\n /** The function called when submitting a new password */\n this.handleSubmit = function (event) { return _this.submit(event); };\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n this.delivery = null;\n this.loading = false;\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n this.newFormFields = [];\n this.forgotPasswordAttrs = {\n userInput: '',\n password: '',\n code: '',\n };\n }\n class_3.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_3.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_3.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_2 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n newFields_2.push(newField);\n });\n this.newFormFields = newFields_2;\n }\n };\n class_3.prototype.buildDefaultFormFields = function () {\n switch (this.usernameAlias) {\n case 'email':\n this.newFormFields = [\n {\n type: 'email',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'forgot-password-email-input',\n },\n },\n ];\n break;\n case 'phone_number':\n this.newFormFields = [\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'forgot-password-phone-number-input',\n },\n },\n ];\n break;\n case 'username':\n default:\n this.newFormFields = [\n {\n type: 'username',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('username'),\n inputProps: {\n 'data-test': 'forgot-password-username-input',\n },\n },\n ];\n break;\n }\n };\n class_3.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n case 'email':\n return function (event) { return (_this.forgotPasswordAttrs.userInput = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n case 'password':\n case 'code':\n return function (event) { return (_this.forgotPasswordAttrs[fieldType] = event.target.value); };\n default:\n return;\n }\n };\n class_3.prototype.setFieldValue = function (field, formAttributes) {\n switch (field.type) {\n case 'username':\n case 'email':\n if (field.value === undefined) {\n formAttributes.userInput = '';\n }\n else {\n formAttributes.userInput = field.value;\n }\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n case 'password':\n case 'code':\n if (field.value === undefined) {\n formAttributes[field.type] = '';\n }\n else {\n formAttributes[field.type] = field.value;\n }\n break;\n }\n };\n class_3.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n class_3.prototype.send = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var data, error_4;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.forgotPassword !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n switch (this.usernameAlias) {\n case 'phone_number':\n try {\n this.forgotPasswordAttrs.userInput = composePhoneNumberInput(this.phoneNumber);\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n break;\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.forgotPassword(this.forgotPasswordAttrs.userInput.trim())];\n case 2:\n data = _a.sent();\n logger.debug(data);\n this.newFormFields = [\n {\n type: 'code',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('code'),\n inputProps: {\n 'data-test': 'forgot-password-code-input',\n },\n },\n {\n type: 'password',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n label: I18n.get(Translations.NEW_PASSWORD_LABEL),\n placeholder: I18n.get(Translations.NEW_PASSWORD_PLACEHOLDER),\n },\n ];\n this.delivery = data.CodeDeliveryDetails;\n return [3 /*break*/, 5];\n case 3:\n error_4 = _a.sent();\n dispatchToastHubEvent(error_4);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_3.prototype.submit = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, userInput, code, password, data, error_5;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.forgotPasswordSubmit !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, 4, 5]);\n _a = this.forgotPasswordAttrs, userInput = _a.userInput, code = _a.code, password = _a.password;\n return [4 /*yield*/, Auth.forgotPasswordSubmit(userInput.trim(), code, password)];\n case 2:\n data = _b.sent();\n logger.debug(data);\n this.handleAuthStateChange(AuthState.SignIn);\n this.delivery = null;\n return [3 /*break*/, 5];\n case 3:\n error_5 = _b.sent();\n dispatchToastHubEvent(error_5);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_3.prototype.render = function () {\n var _this = this;\n var submitFn = this.delivery\n ? function (event) { return _this.handleSubmit(event); }\n : function (event) { return _this.handleSend(event); };\n var submitButtonText = this.delivery\n ? this.submitButtonText\n : this.sendButtonText;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: submitFn, loading: this.loading, secondaryFooterContent: h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); }, \"data-test\": \"forgot-password-back-to-sign-in-link\" }, I18n.get(Translations.BACK_TO_SIGN_IN)), testDataPrefix: 'forgot-password', submitButtonText: I18n.get(submitButtonText) }, h(\"amplify-auth-fields\", { formFields: this.newFormFields }))));\n };\n Object.defineProperty(class_3, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_3;\n}());\nvar logger$1 = new ConsoleLogger('amplify-require-new-password');\nvar AmplifyRequireNewPassword = /** @class */ (function () {\n function class_4(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** The header text of the forgot password section */\n this.headerText = Translations.CHANGE_PASSWORD;\n /** The text displayed inside of the submit button for the form */\n this.submitButtonText = Translations.CHANGE_PASSWORD_ACTION;\n /** The function called when submitting a new password */\n this.handleSubmit = function (event) { return _this.completeNewPassword(event); };\n /** Auth state change handler for this component */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** The form fields displayed inside of the forgot password form */\n this.formFields = [\n {\n type: AuthFormField.Password,\n required: true,\n handleInputChange: function (event) { return _this.handlePasswordChange(event); },\n label: I18n.get(Translations.NEW_PASSWORD_LABEL),\n placeholder: I18n.get(Translations.NEW_PASSWORD_PLACEHOLDER),\n inputProps: {\n 'data-test': 'require-new-password-password-input',\n },\n },\n ];\n this.loading = false;\n this.requiredAttributes = {};\n this.newFormFields = this.formFields;\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: ' ',\n };\n }\n class_4.prototype.userHandler = function () {\n this.setCurrentUser();\n };\n class_4.prototype.handleRequiredAttributeInputChange = function (attribute, event) {\n if (attribute === 'phone_number') {\n this.formatPhoneNumber(event);\n }\n else {\n this.requiredAttributes[attribute] = event.target.value;\n }\n };\n class_4.prototype.setCurrentUser = function () {\n return __awaiter(this, void 0, void 0, function () {\n var user, error_6, userRequiredAttributes, requiredAttributesMap_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this.user) return [3 /*break*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, Auth.currentAuthenticatedUser()];\n case 2:\n user = _a.sent();\n if (user)\n this.currentUser = user;\n return [3 /*break*/, 4];\n case 3:\n error_6 = _a.sent();\n dispatchToastHubEvent(error_6);\n return [3 /*break*/, 4];\n case 4: return [3 /*break*/, 6];\n case 5:\n this.currentUser = this.user;\n _a.label = 6;\n case 6:\n if (this.currentUser &&\n this.currentUser.challengeParam &&\n this.currentUser.challengeParam.requiredAttributes) {\n userRequiredAttributes = this.currentUser.challengeParam\n .requiredAttributes;\n requiredAttributesMap_1 = getRequiredAttributesMap();\n userRequiredAttributes.forEach(function (attribute) {\n var formField = {\n type: attribute,\n required: true,\n label: requiredAttributesMap_1[attribute].label,\n placeholder: requiredAttributesMap_1[attribute].placeholder,\n handleInputChange: function (event) { return _this.handleRequiredAttributeInputChange(attribute, event); },\n inputProps: {\n 'data-test': \"require-new-password-\" + attribute + \"-input\",\n },\n };\n _this.newFormFields = __spreadArrays(_this.newFormFields, [formField]);\n });\n }\n return [2 /*return*/];\n }\n });\n });\n };\n class_4.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n return this.setCurrentUser();\n };\n class_4.prototype.handlePasswordChange = function (event) {\n this.password = event.target.value;\n };\n class_4.prototype.formatPhoneNumber = function (event) {\n handlePhoneNumberChange(event, this.phoneNumber);\n /**\n * composePhoneNumberInput will throw an error if the phoneNumberValue it receives\n * is empty. Adding a check here to try and make sure that doesn't happen...but will\n * wrap it in a try/catch block just in case as well\n */\n try {\n if (event.target.name === PHONE_SUFFIX &&\n this.phoneNumber.phoneNumberValue) {\n var composedInput = composePhoneNumberInput(this.phoneNumber);\n this.requiredAttributes['phone_number'] = composedInput;\n }\n }\n catch (err) {\n logger$1.error(\"error in phone number field - \" + err);\n }\n };\n class_4.prototype.completeNewPassword = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var user, _a, error_7;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.completeNewPassword !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 8, 9, 10]);\n return [4 /*yield*/, Auth.completeNewPassword(this.currentUser, this.password, this.requiredAttributes)];\n case 2:\n user = _b.sent();\n logger$1.debug('complete new password', user);\n _a = user.challengeName;\n switch (_a) {\n case ChallengeName.SMSMFA: return [3 /*break*/, 3];\n case ChallengeName.MFASetup: return [3 /*break*/, 4];\n }\n return [3 /*break*/, 5];\n case 3:\n this.handleAuthStateChange(AuthState.ConfirmSignIn, user);\n return [3 /*break*/, 7];\n case 4:\n logger$1.debug('TOTP setup', user.challengeParam);\n this.handleAuthStateChange(AuthState.TOTPSetup, user);\n return [3 /*break*/, 7];\n case 5: return [4 /*yield*/, checkContact(user, this.handleAuthStateChange)];\n case 6:\n _b.sent();\n _b.label = 7;\n case 7: return [3 /*break*/, 10];\n case 8:\n error_7 = _b.sent();\n dispatchToastHubEvent(error_7);\n return [3 /*break*/, 10];\n case 9:\n this.loading = false;\n return [7 /*endfinally*/];\n case 10: return [2 /*return*/];\n }\n });\n });\n };\n class_4.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, loading: this.loading, secondaryFooterContent: h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); } }, I18n.get(Translations.BACK_TO_SIGN_IN)), submitButtonText: I18n.get(this.submitButtonText) }, h(\"amplify-auth-fields\", { formFields: this.newFormFields }))));\n };\n Object.defineProperty(class_4, \"watchers\", {\n get: function () {\n return {\n \"user\": [\"userHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_4;\n}());\nvar amplifySignInCss = \":host{--footer-size:var(--amplify-text-sm);--footer-color:var(--amplify-grey);--footer-font-family:var(--amplify-font-family);--font-weight:var(--amplify-font-weight)}.sign-in-form-footer{font-family:var(--footer-font-family);font-size:var(--footer-size);color:var(--footer-color);font-weight:--font-weight;display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.sign-in-form-footer amplify-button{margin-bottom:0.625rem}@media (min-width: 672px){.sign-in-form-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline}.sign-in-form-footer amplify-button{margin-bottom:0}}.sign-in-form-footer *+*{margin-bottom:15px}.full-width-footer-content{width:100%}\";\nvar AmplifySignIn = /** @class */ (function () {\n function class_5(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when sign in form is submitted */\n this.handleSubmit = function (event) { return _this.signIn(event); };\n /** Used for header text in sign in component */\n this.headerText = Translations.SIGN_IN_HEADER_TEXT;\n /** Used for the submit button text in sign in component */\n this.submitButtonText = Translations.SIGN_IN_ACTION;\n /** Auth state change handler for this component */\n // prettier-ignore\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = [];\n /** Hides the sign up link */\n this.hideSignUp = false;\n this.newFormFields = [];\n /* Whether or not the sign-in component is loading */\n this.loading = false;\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n this.signInAttributes = {\n userInput: '',\n password: '',\n };\n }\n class_5.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_5.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_5.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n case 'email':\n return function (event) { return (_this.signInAttributes.userInput = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n case 'password':\n return function (event) { return (_this.signInAttributes.password = event.target.value); };\n default:\n return function () { };\n }\n };\n class_5.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n class_5.prototype.signIn = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var username;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // avoid submitting the form\n if (event) {\n event.preventDefault();\n }\n this.loading = true;\n switch (this.usernameAlias) {\n case 'phone_number':\n try {\n this.signInAttributes.userInput = composePhoneNumberInput(this.phoneNumber);\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n }\n username = this.signInAttributes.userInput.trim();\n return [4 /*yield*/, handleSignIn(username, this.signInAttributes.password, this.handleAuthStateChange, this.usernameAlias)];\n case 1:\n _a.sent();\n this.loading = false;\n return [2 /*return*/];\n }\n });\n });\n };\n class_5.prototype.buildDefaultFormFields = function () {\n var _this = this;\n var formFieldInputs = [];\n switch (this.usernameAlias) {\n case 'email':\n formFieldInputs.push({\n type: 'email',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-in-email-input',\n autocomplete: 'username',\n },\n });\n break;\n case 'phone_number':\n formFieldInputs.push({\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-in-phone-number-input',\n autocomplete: 'username',\n },\n });\n break;\n case 'username':\n default:\n formFieldInputs.push({\n type: 'username',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('username'),\n inputProps: {\n 'data-test': 'sign-in-username-input',\n autocomplete: 'username',\n },\n });\n break;\n }\n formFieldInputs.push({\n type: 'password',\n hint: (h(\"div\", null, I18n.get(Translations.FORGOT_PASSWORD_TEXT), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.ForgotPassword); }, \"data-test\": \"sign-in-forgot-password-link\" }, I18n.get(Translations.RESET_PASSWORD_TEXT)))),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-in-password-input',\n },\n });\n this.newFormFields = __spreadArrays(formFieldInputs);\n };\n class_5.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_3 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n // TODO: handle hint better\n if (newField.type === 'password') {\n newField['hint'] = isHintValid(newField) ? (h(\"div\", null, I18n.get(Translations.FORGOT_PASSWORD_TEXT), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.ForgotPassword); }, \"data-test\": \"sign-in-forgot-password-link\" }, I18n.get(Translations.RESET_PASSWORD_TEXT)))) : (newField['hint']);\n }\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n _this.setFieldValue(newField, _this.signInAttributes);\n newFields_3.push(newField);\n });\n this.newFormFields = newFields_3;\n }\n };\n class_5.prototype.setFieldValue = function (field, formAttributes) {\n switch (field.type) {\n case 'username':\n case 'email':\n if (field.value === undefined) {\n formAttributes.userInput = '';\n }\n else {\n formAttributes.userInput = field.value;\n }\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n case 'password':\n if (field.value === undefined) {\n formAttributes.password = '';\n }\n else {\n formAttributes.password = field.value;\n }\n break;\n }\n };\n class_5.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, testDataPrefix: 'sign-in' }, h(\"div\", { slot: \"subtitle\" }, h(\"slot\", { name: \"header-subtitle\" })), h(\"slot\", { name: \"federated-buttons\" }, h(\"amplify-federated-buttons\", { handleAuthStateChange: this.handleAuthStateChange, federated: this.federated })), !isEmpty(this.federated) && h(\"amplify-strike\", null, \"or\"), h(\"amplify-auth-fields\", { formFields: this.newFormFields }), h(\"div\", { slot: \"amplify-form-section-footer\", class: \"sign-in-form-footer\" }, h(\"slot\", { name: \"footer\" }, !this.hideSignUp && (h(\"slot\", { name: \"secondary-footer-content\" }, h(\"span\", null, I18n.get(Translations.NO_ACCOUNT_TEXT), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignUp); }, \"data-test\": \"sign-in-create-account-link\" }, I18n.get(Translations.CREATE_ACCOUNT_TEXT))))), h(\"div\", { class: this.hideSignUp ? 'full-width-footer-content' : '' }, h(\"slot\", { name: \"primary-footer-content\" }, h(\"amplify-button\", { type: \"submit\", disabled: this.loading, \"data-test\": \"sign-in-sign-in-button\" }, this.loading ? (h(\"amplify-loading-spinner\", null)) : (h(\"span\", null, I18n.get(this.submitButtonText)))))))))));\n };\n Object.defineProperty(class_5, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_5;\n}());\nAmplifySignIn.style = amplifySignInCss;\nvar amplifySignUpCss = \"amplify-sign-up{--footer-font-family:var(--amplify-font-family);--footer-font-size:var(--amplify-text-sm);--footer-color:var(--amplify-grey);--font-weight:var(--amplify-font-weight)}.sign-up-form-footer{font-family:var(--footer-font-family);font-size:var(--footer-font-size);color:var(--footer-color);font-weight:--font-weight;display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.sign-up-form-footer amplify-button{margin-bottom:0.625rem}@media (min-width: 672px){.sign-up-form-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline}.sign-up-form-footer amplify-button{margin-bottom:0}}.sign-up-form-footer *+*{margin-bottom:15px}\";\nvar AmplifySignUp = /** @class */ (function () {\n function class_6(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n /** Fires when sign up form is submitted */\n this.handleSubmit = function (event) { return _this.signUp(event); };\n /** Override for handling the Auth.SignUp API call */\n this.handleSignUp = function (params) { return _this.authSignUp(params); };\n /** Used for header text in sign up component */\n this.headerText = Translations.SIGN_UP_HEADER_TEXT;\n /** Used for the submit button text in sign up component */\n this.submitButtonText = Translations.SIGN_UP_SUBMIT_BUTTON_TEXT;\n /** Used for the submit button text in sign up component */\n this.haveAccountText = Translations.SIGN_UP_HAVE_ACCOUNT_TEXT;\n /** Text used for the sign in hyperlink */\n this.signInText = Translations.SIGN_IN_TEXT;\n /**\n * Form fields allows you to utilize our pre-built components such as username field, code field, password field, email field, etc.\n * by passing an array of strings that you would like the order of the form to be in. If you need more customization, such as changing\n * text for a label or adjust a placeholder, you can follow the structure below in order to do just that.\n * ```\n * [\n * {\n * type: string,\n * label: string,\n * placeholder: string,\n * hint: string | Functional Component | null,\n * required: boolean\n * }\n * ]\n * ```\n */\n this.formFields = [];\n /** Auth state change handler for this component\n * e.g. SignIn -> 'Create Account' link -> SignUp\n */\n // prettier-ignore\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n /** Username Alias is used to setup authentication with `username`, `email` or `phone_number` */\n this.usernameAlias = 'username';\n // private userInput: string | PhoneNumberInterface;\n this.newFormFields = [];\n this.phoneNumber = {\n countryDialCodeValue: COUNTRY_DIAL_CODE_DEFAULT,\n phoneNumberValue: null,\n };\n this.loading = false;\n this.signUpAttributes = {\n username: '',\n password: '',\n attributes: {},\n };\n }\n class_6.prototype.handleFormFieldInputChange = function (fieldType) {\n var _this = this;\n switch (fieldType) {\n case 'username':\n return function (event) { return (_this.signUpAttributes.username = event.target.value); };\n case 'password':\n return function (event) { return (_this.signUpAttributes.password = event.target.value); };\n case 'email':\n return function (event) { return (_this.signUpAttributes.attributes.email = event.target.value); };\n case 'phone_number':\n return function (event) { return handlePhoneNumberChange(event, _this.phoneNumber); };\n default:\n return function (event) { return (_this.signUpAttributes.attributes[fieldType] = event.target.value); };\n }\n };\n class_6.prototype.handleFormFieldInputWithCallback = function (event, field) {\n var fnToCall = field['handleInputChange']\n ? field['handleInputChange']\n : function (event, cb) {\n cb(event);\n };\n var callback = this.handleFormFieldInputChange(field.type);\n fnToCall(event, callback.bind(this));\n };\n class_6.prototype.authSignUp = function (params) {\n return __awaiter(this, void 0, void 0, function () {\n var data;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, Auth.signUp(params)];\n case 1:\n data = _a.sent();\n if (!data) {\n throw new Error(Translations.SIGN_UP_FAILED);\n }\n return [2 /*return*/, data];\n }\n });\n });\n };\n class_6.prototype.assignPhoneNumberToSignUpAttributes = function () {\n if (this.phoneNumber.phoneNumberValue) {\n try {\n this.signUpAttributes.attributes.phone_number = composePhoneNumberInput(this.phoneNumber);\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n }\n };\n class_6.prototype.assignUserNameAliasToSignUpAttributes = function () {\n switch (this.usernameAlias) {\n case 'email':\n case 'phone_number':\n this.signUpAttributes.username = this.signUpAttributes.attributes[this.usernameAlias];\n break;\n }\n };\n class_6.prototype.assignFormInputToSignUpAttributes = function () {\n this.assignPhoneNumberToSignUpAttributes();\n this.assignUserNameAliasToSignUpAttributes();\n };\n class_6.prototype.validateSignUpAttributes = function () {\n if (!this.signUpAttributes.username) {\n if (this.usernameAlias === UsernameAlias.email) {\n throw new Error(Translations.EMPTY_EMAIL);\n }\n else if (this.usernameAlias === UsernameAlias.phone_number) {\n throw new Error(Translations.EMPTY_PHONE);\n }\n else {\n throw new Error(Translations.EMPTY_USERNAME);\n }\n }\n if (this.signUpAttributes.username.indexOf(' ') >= 0) {\n throw new Error(Translations.USERNAME_REMOVE_WHITESPACE);\n }\n if (this.signUpAttributes.password !== this.signUpAttributes.password.trim()) {\n throw new Error(Translations.PASSWORD_REMOVE_WHITESPACE);\n }\n };\n // TODO: Add validation\n // TODO: Prefix\n class_6.prototype.signUp = function (event) {\n return __awaiter(this, void 0, void 0, function () {\n var data, signUpAttrs, error_8;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (event) {\n event.preventDefault();\n }\n if (!Auth || typeof Auth.signUp !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n this.assignFormInputToSignUpAttributes();\n _a.label = 1;\n case 1:\n _a.trys.push([1, 6, 7, 8]);\n this.validateSignUpAttributes();\n return [4 /*yield*/, this.handleSignUp(this.signUpAttributes)];\n case 2:\n data = _a.sent();\n if (!data.userConfirmed) return [3 /*break*/, 4];\n return [4 /*yield*/, handleSignIn(this.signUpAttributes.username, this.signUpAttributes.password, this.handleAuthStateChange)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n signUpAttrs = Object.assign({}, this.signUpAttributes);\n this.handleAuthStateChange(AuthState.ConfirmSignUp, Object.assign(Object.assign({}, data.user), { signUpAttrs: signUpAttrs }));\n _a.label = 5;\n case 5: return [3 /*break*/, 8];\n case 6:\n error_8 = _a.sent();\n dispatchToastHubEvent(error_8);\n return [3 /*break*/, 8];\n case 7:\n this.loading = false;\n return [7 /*endfinally*/];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n class_6.prototype.buildDefaultFormFields = function () {\n switch (this.usernameAlias) {\n case 'email':\n this.newFormFields = [\n {\n type: 'email',\n placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-up-email-input',\n autocomplete: 'username',\n },\n },\n {\n type: 'password',\n placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-up-password-input',\n autocomplete: 'new-password',\n },\n },\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-up-phone-number-input',\n autocomplete: 'tel-national',\n },\n },\n ];\n break;\n case 'phone_number':\n this.newFormFields = [\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-up-phone-number-input',\n autocomplete: 'username',\n },\n },\n {\n type: 'password',\n placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-up-password-input',\n autocomplete: 'new-password',\n },\n },\n {\n type: 'email',\n placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-up-email-input',\n autocomplete: 'email',\n },\n },\n ];\n break;\n case 'username':\n default:\n this.newFormFields = [\n {\n type: 'username',\n placeholder: I18n.get(Translations.SIGN_UP_USERNAME_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('username'),\n inputProps: {\n 'data-test': 'sign-up-username-input',\n autocomplete: 'username',\n },\n },\n {\n type: 'password',\n placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('password'),\n inputProps: {\n 'data-test': 'sign-up-password-input',\n autocomplete: 'new-password',\n },\n },\n {\n type: 'email',\n placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),\n required: true,\n handleInputChange: this.handleFormFieldInputChange('email'),\n inputProps: {\n 'data-test': 'sign-up-email-input',\n },\n },\n {\n type: 'phone_number',\n required: true,\n handleInputChange: this.handleFormFieldInputChange('phone_number'),\n inputProps: {\n 'data-test': 'sign-up-phone-number-input',\n },\n },\n ];\n break;\n }\n };\n class_6.prototype.buildFormFields = function () {\n var _this = this;\n if (this.formFields.length === 0) {\n this.buildDefaultFormFields();\n }\n else {\n var newFields_4 = [];\n this.formFields.forEach(function (field) {\n var newField = Object.assign({}, field);\n newField['handleInputChange'] = function (event) { return _this.handleFormFieldInputWithCallback(event, field); };\n _this.setFieldValue(field, _this.signUpAttributes);\n newFields_4.push(newField);\n });\n this.newFormFields = newFields_4;\n }\n };\n class_6.prototype.setFieldValue = function (field, formAttributes) {\n switch (field.type) {\n case 'username':\n if (field.value === undefined) {\n formAttributes.username = '';\n }\n else {\n formAttributes.username = field.value;\n }\n break;\n case 'password':\n if (field.value === undefined) {\n formAttributes.password = '';\n }\n else {\n formAttributes.password = field.value;\n }\n break;\n case 'email':\n formAttributes.attributes.email = field.value;\n break;\n case 'phone_number':\n if (field.dialCode) {\n this.phoneNumber.countryDialCodeValue = field.dialCode;\n }\n this.phoneNumber.phoneNumberValue = field.value;\n break;\n default:\n formAttributes.attributes[field.type] = field.value;\n break;\n }\n };\n class_6.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n checkUsernameAlias(this.usernameAlias);\n this.buildFormFields();\n };\n class_6.prototype.formFieldsHandler = function () {\n this.buildFormFields();\n };\n class_6.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { headerText: I18n.get(this.headerText), handleSubmit: this.handleSubmit, testDataPrefix: 'sign-up' }, h(\"div\", { slot: \"subtitle\" }, h(\"slot\", { name: \"header-subtitle\" })), h(\"amplify-auth-fields\", { formFields: this.newFormFields }), h(\"div\", { class: \"sign-up-form-footer\", slot: \"amplify-form-section-footer\" }, h(\"slot\", { name: \"footer\" }, h(\"slot\", { name: \"secondary-footer-content\" }, h(\"span\", null, I18n.get(this.haveAccountText), ' ', h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignIn); }, \"data-test\": \"sign-up-sign-in-link\" }, I18n.get(this.signInText)))), h(\"slot\", { name: \"primary-footer-content\" }, h(\"amplify-button\", { type: \"submit\", \"data-test\": \"sign-up-create-account-button\", disabled: this.loading }, this.loading ? (h(\"amplify-loading-spinner\", null)) : (h(\"span\", null, I18n.get(this.submitButtonText))))))))));\n };\n Object.defineProperty(class_6, \"watchers\", {\n get: function () {\n return {\n \"formFields\": [\"formFieldsHandler\"]\n };\n },\n enumerable: false,\n configurable: true\n });\n return class_6;\n}());\nAmplifySignUp.style = amplifySignUpCss;\nvar logger$2 = new Logger('AmplifyVerifyContact');\nvar AmplifyVerifyContact = /** @class */ (function () {\n function class_7(hostRef) {\n registerInstance(this, hostRef);\n /** Authentication state handler */\n this.handleAuthStateChange = dispatchAuthStateChangeEvent;\n this.loading = false;\n }\n class_7.prototype.componentWillLoad = function () {\n console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');\n };\n class_7.prototype.handleSubmit = function (event) {\n event.preventDefault();\n this.verifyAttr ? this.submit(this.code) : this.verify(this.contact);\n };\n class_7.prototype.submit = function (code) {\n return __awaiter(this, void 0, void 0, function () {\n var attr, data, error_9;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n attr = this.verifyAttr;\n if (!Auth || typeof Auth.verifyCurrentUserAttributeSubmit !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.verifyCurrentUserAttributeSubmit(attr, code)];\n case 2:\n data = _a.sent();\n logger$2.debug(data);\n this.handleAuthStateChange(AuthState.SignedIn, this.user);\n this.verifyAttr = null;\n return [3 /*break*/, 5];\n case 3:\n error_9 = _a.sent();\n dispatchToastHubEvent(error_9);\n logger$2.error(error_9);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_7.prototype.verify = function (contact) {\n return __awaiter(this, void 0, void 0, function () {\n var data, error_10;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!contact) {\n logger$2.error('Neither Email nor Phone Number selected');\n return [2 /*return*/];\n }\n if (!Auth || typeof Auth.verifyCurrentUserAttribute !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n this.loading = true;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, 4, 5]);\n return [4 /*yield*/, Auth.verifyCurrentUserAttribute(contact)];\n case 2:\n data = _a.sent();\n logger$2.debug(data);\n this.verifyAttr = contact;\n return [3 /*break*/, 5];\n case 3:\n error_10 = _a.sent();\n dispatchToastHubEvent(error_10);\n logger$2.error(error_10);\n return [3 /*break*/, 5];\n case 4:\n this.loading = false;\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n class_7.prototype.handleInputChange = function (event) {\n var inputName = event.target.name;\n if (inputName === 'code') {\n this.code = event.target.value;\n }\n else if (inputName === 'contact') {\n this.contact = event.target.value;\n }\n };\n class_7.prototype.renderSubmit = function () {\n var _this = this;\n return (h(\"div\", null, h(\"amplify-input\", { inputProps: {\n autocomplete: 'off',\n 'data-test': 'verify-contact-code-input',\n }, name: \"code\", placeholder: I18n.get(Translations.CODE_PLACEHOLDER), handleInputChange: function (event) { return _this.handleInputChange(event); } })));\n };\n class_7.prototype.renderVerify = function () {\n var _this = this;\n var user = this.user;\n if (!user) {\n logger$2.debug('No user to verify');\n return null;\n }\n var unverified = user.unverified;\n if (!unverified) {\n logger$2.debug('Unverified variable does not exist on user');\n return null;\n }\n var email = unverified.email, phone_number = unverified.phone_number;\n return (h(\"div\", null, email && (h(\"amplify-radio-button\", { label: I18n.get(Translations.VERIFY_CONTACT_EMAIL_LABEL), key: \"email\", name: \"contact\", value: \"email\", handleInputChange: function (event) { return _this.handleInputChange(event); }, inputProps: {\n 'data-test': 'verify-contact-email-radio',\n } })), phone_number && (h(\"amplify-radio-button\", { label: I18n.get(Translations.VERIFY_CONTACT_PHONE_LABEL), key: \"phone_number\", name: \"contact\", value: \"phone_number\", handleInputChange: function (event) { return _this.handleInputChange(event); }, inputProps: {\n 'data-test': 'verify-contact-phone-number-radio',\n } }))));\n };\n class_7.prototype.render = function () {\n var _this = this;\n return (h(Host, null, h(\"amplify-form-section\", { handleSubmit: function (event) { return _this.handleSubmit(event); }, headerText: I18n.get(Translations.VERIFY_CONTACT_HEADER_TEXT), loading: this.loading, secondaryFooterContent: h(\"span\", null, h(\"amplify-button\", { variant: \"anchor\", onClick: function () { return _this.handleAuthStateChange(AuthState.SignedIn, _this.user); }, \"data-test\": \"verify-contact-skip-link\" }, I18n.get(Translations.SKIP))), submitButtonText: this.verifyAttr\n ? I18n.get(Translations.VERIFY_CONTACT_SUBMIT_LABEL)\n : I18n.get(Translations.VERIFY_CONTACT_VERIFY_LABEL) }, this.verifyAttr ? this.renderSubmit() : this.renderVerify())));\n };\n return class_7;\n}());\nexport { AmplifyConfirmSignIn as amplify_confirm_sign_in, AmplifyConfirmSignUp as amplify_confirm_sign_up, AmplifyForgotPassword as amplify_forgot_password, AmplifyRequireNewPassword as amplify_require_new_password, AmplifySignIn as amplify_sign_in, AmplifySignUp as amplify_sign_up, AmplifyVerifyContact as amplify_verify_contact };\n"],"sourceRoot":""}