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AAA2J,EAIA,MAAAb,EAAA","sources":["webpack://@logos/commerceweb-frontend/./Scripts/site/clients/license-claim-client.js","webpack://@logos/commerceweb-frontend/./Scripts/site/components/license-claim/shared.less?f152","webpack://@logos/commerceweb-frontend/./Scripts/site/components/license-claim/shared.jsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/license-claim/send-button/index.jsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/license-claim/verification-code-request/index.jsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/license-claim/verification-code-request/index.less?4ca7","webpack://@logos/commerceweb-frontend/javascript/node_modules/classnames/bind.js","webpack://@logos/commerceweb-frontend/javascript/node_modules/@faithlife/command-sentence-control/dist/command-sentence.js"],"sourcesContent":["import { fetch } from './../util/fetch';\n\nexport default class LicenseClaimClient {\n\tstatic async sendLibraryClaimLink(sendLibraryClaimLinkUrl, request) {\n\t\tconst response = await fetch.postWithBody({\n\t\t\turl: sendLibraryClaimLinkUrl,\n\t\t\tbody: request,\n\t\t});\n\n\t\treturn await response.json();\n\t}\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"button\":\"shared--button--gSV9d btn btn-primary\",\"container\":\"shared--container--TWLgJ\",\"inputContainer\":\"shared--inputContainer--BxkyU\",\"inputBox\":\"shared--inputBox---a3o8\",\"inputButton\":\"shared--inputButton--sYYAi btn btn-secondary\",\"header\":\"shared--header--ob0CU\",\"subHeader\":\"shared--subHeader--JtCqo\",\"description\":\"shared--description--G4Zg1\",\"spinnerOverlay\":\"shared--spinnerOverlay--kH9I3\",\"logoContainer\":\"shared--logoContainer--K0Tjf\",\"logoSvg\":\"shared--logoSvg--E8SWV\",\"institutionSvg\":\"shared--institutionSvg--VtQNE\",\"institutionName\":\"shared--institutionName--xy7tV\",\"plus\":\"shared--plus--A0KGl\",\"errorInput\":\"shared--errorInput--dCFc4\",\"errorMessage\":\"shared--errorMessage--tofwC\"};","import React from 'react';\nimport { theme } from '@faithlife/styled-ui';\nimport { Plus } from '@faithlife/styled-ui/icons/12px';\nimport { CommandSentence } from '@faithlife/command-sentence-control';\nimport { useLocalization } from '../../localization';\nimport sharedStyles from './shared.less';\n\nexport const LogoHeader = ({ logosOrVerbum, institutionLogoUri, institutionName }) => {\n\tconst resources = useLocalization('CommerceWeb.Resources.LicenseClaim.LicenseClaim');\n\treturn (\n\t\t<div className={sharedStyles.logoContainer}>\n\t\t\t<img\n\t\t\t\tclassName={sharedStyles.logoSvg}\n\t\t\t\tsrc={\n\t\t\t\t\tlogosOrVerbum === 'Verbum'\n\t\t\t\t\t\t? 'https://files.logoscdn.com/v1/files/53603903/assets/12332695/content.svg?signature=YQUpVRlKc0ds48hPxgGWhDcgNRI'\n\t\t\t\t\t\t: 'https://files.logoscdn.com/v1/assets/14904106/optimized?share=OdlwiB5OxhoI1yI0'\n\t\t\t\t}\n\t\t\t\talt={logosOrVerbum === 'Verbum' ? resources.VerbumIcon : resources.LogosIcon}\n\t\t\t/>\n\t\t\t<Plus className={sharedStyles.plus} color={theme.colors.gray66} />\n\t\t\t{institutionLogoUri ? (\n\t\t\t\t<img className={sharedStyles.institutionSvg} src={institutionLogoUri} alt={resources.InstitutionIcon} />\n\t\t\t) : (\n\t\t\t\t<p className={sharedStyles.institutionName}>{institutionName}</p>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport const PageHeader = ({ logoHeader, logosOrVerbum, pageDescription, pageSubHeader, header, headingRef }) => {\n\tconst resources = useLocalization('CommerceWeb.Resources.LicenseClaim.LicenseClaim');\n\tconst descriptionComponent =\n\t\tpageDescription === undefined ? null : typeof pageDescription === 'string' ? (\n\t\t\t<p className={sharedStyles.description}>{pageDescription}</p>\n\t\t) : (\n\t\t\t<div className={sharedStyles.description}>{pageDescription}</div>\n\t\t);\n\treturn (\n\t\t<>\n\t\t\t{logoHeader === undefined ? null : logoHeader}\n\t\t\t<h1 ref={headingRef} className={sharedStyles.header}>\n\t\t\t\t{header ?? (\n\t\t\t\t\t<CommandSentence Container={React.Fragment} template={resources.PageHeader}>\n\t\t\t\t\t\t<CommandSentence.Field name=\"BRAND_NAME\">{logosOrVerbum}</CommandSentence.Field>\n\t\t\t\t\t</CommandSentence>\n\t\t\t\t)}\n\t\t\t</h1>\n\t\t\t{pageSubHeader === undefined ? null : <p className={sharedStyles.subHeader}>{pageSubHeader}</p>}\n\t\t\t{descriptionComponent}\n\t\t</>\n\t);\n};\n","import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport classNamesBind from 'classnames/bind';\nimport sharedStyles from '../shared.less';\n\nconst cx = classNamesBind.bind(sharedStyles);\n\nconst confirmationDisplayTimeMs = 3000;\n\nexport const SendButton = ({ isLoading, buttonText, loadingText, confirmationText, actionComplete, onClick }) => {\n\tconst [shouldShowConfirmation, setShouldShowConfirmation] = useState(false);\n\tconst confirmationEndTimeout = useRef(null);\n\n\tconst handleClick = () => {\n\t\tif (!isLoading) {\n\t\t\tonClick();\n\t\t}\n\t};\n\n\tconst handlePointerMove = useCallback(() => {\n\t\tif (confirmationEndTimeout.current) {\n\t\t\tclearTimeout(confirmationEndTimeout.current);\n\t\t}\n\t\tif (shouldShowConfirmation) {\n\t\t\tsetShouldShowConfirmation(false);\n\t\t}\n\t}, [shouldShowConfirmation]);\n\n\tuseEffect(() => {\n\t\tif (!actionComplete) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetShouldShowConfirmation(true);\n\t\tconfirmationEndTimeout.current = setTimeout(() => {\n\t\t\tsetShouldShowConfirmation(false);\n\t\t}, confirmationDisplayTimeMs);\n\n\t\treturn () => {\n\t\t\tif (confirmationEndTimeout.current) {\n\t\t\t\tclearTimeout(confirmationEndTimeout.current);\n\t\t\t}\n\t\t};\n\t}, [actionComplete]);\n\n\treturn (\n\t\t<button\n\t\t\tclassName={cx(sharedStyles.inputButton)}\n\t\t\tonClick={handleClick}\n\t\t\tdisabled={isLoading || shouldShowConfirmation}\n\t\t\tonPointerMove={handlePointerMove}\n\t\t>\n\t\t\t{isLoading ? loadingText : actionComplete ? (shouldShowConfirmation ? confirmationText : buttonText) : buttonText}\n\t\t</button>\n\t);\n};\n","import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Input, LoadingSpinner } from '@faithlife/styled-ui';\nimport classNamesBind from 'classnames/bind';\nimport { CommandSentence } from '@faithlife/command-sentence-control';\nimport { useLocalization } from '../../../localization';\nimport LicenseClaimClient from '../../../clients/license-claim-client';\nimport { validateEmailAddress } from '../../../util/email';\nimport sharedStyles from '../shared.less';\nimport { LogoHeader, PageHeader } from '../shared';\nimport { SendButton } from '../send-button';\nimport styles from './index.less';\n\nconst cx = classNamesBind.bind(sharedStyles);\n\nconst getInstitutionKindPossessive = (institutionKind, resources) => {\n\tswitch (institutionKind?.toLowerCase()) {\n\t\tcase 'academic':\n\t\t\treturn resources.AcademicInstitutionPossessive;\n\t\tcase 'church':\n\t\t\treturn resources.ChurchInstitutionPossessive;\n\t\tdefault:\n\t\t\treturn resources.OrganizationInstitutionPossessive;\n\t}\n};\n\nconst VerificationCodeRequest = ({\n\tinstitutionCode,\n\tinstitutionKind,\n\tinstitutionName,\n\tinstitutionLogoUri,\n\tisAcademicInstitution,\n\tlogosOrVerbum,\n\tinitialEmail,\n\troutes,\n\tverificationError: verificationErrorFromProps,\n}) => {\n\tconst resources = useLocalization('CommerceWeb.Resources.LicenseClaim.LicenseClaim');\n\tconst institutionKindPossessive = getInstitutionKindPossessive(institutionKind, resources);\n\tconst [email, setEmail] = useState(initialEmail ?? '');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [emailSentCount, setEmailSentCount] = useState(0);\n\tconst [isActionComplete, setIsActionComplete] = useState(false);\n\tconst [inputErrorMessage, setInputErrorMessage] = useState(null);\n\tconst [verificationError, setVerificationError] = useState(verificationErrorFromProps);\n\tconst headingRef = useRef(null);\n\n\tconst handleEmailChange = useCallback(\n\t\tevent => {\n\t\t\tsetEmail(event.target.value);\n\t\t\tif (verificationError) {\n\t\t\t\tsetVerificationError(null);\n\t\t\t}\n\t\t},\n\t\t[verificationError]\n\t);\n\n\tconst verificationErrorMessageTemplate = useMemo(() => {\n\t\tif (!verificationError) {\n\t\t\treturn null;\n\t\t}\n\n\t\tswitch (verificationError.toLowerCase()) {\n\t\t\tcase 'expired':\n\t\t\t\treturn resources.VerificationCodeExpired;\n\t\t\tcase 'redeemed':\n\t\t\t\treturn resources.VerificationCodeClaimed;\n\t\t\tcase 'invalid':\n\t\t\t\treturn resources.InvalidVerificationCode;\n\t\t\tdefault:\n\t\t\t\treturn resources.UnknownValidationError;\n\t\t}\n\t}, [resources, verificationError]);\n\n\tconst sendLibraryClaimLink = useCallback(async () => {\n\t\tsetIsActionComplete(false);\n\t\tsetIsLoading(true);\n\t\tsetInputErrorMessage(null);\n\n\t\tconst validationError = validateEmailAddress(email, resources.EmptyEmail, resources.InvalidEmail);\n\t\tif (validationError) {\n\t\t\tsetInputErrorMessage(validationError);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tconst libraryClaimLinkResult = await LicenseClaimClient.sendLibraryClaimLink(routes.SendLibraryClaimLinkUrl, {\n\t\t\t\t\temail: email,\n\t\t\t\t\tinstitutionCode: institutionCode,\n\t\t\t\t});\n\n\t\t\t\tif (!libraryClaimLinkResult?.success) {\n\t\t\t\t\tthrow new Error('Library claim link request failed.');\n\t\t\t\t}\n\n\t\t\t\tsetEmailSentCount(emailSentCount + 1);\n\t\t\t\tsetIsActionComplete(true);\n\t\t\t} catch {\n\t\t\t\tsetInputErrorMessage(resources.FailedToSendVerificationCode);\n\t\t\t}\n\t\t}\n\t\tsetIsLoading(false);\n\t}, [email, emailSentCount, institutionCode, resources, routes.SendLibraryClaimLinkUrl]);\n\n\tconst handleFormSubmitted = useCallback(\n\t\tasync event => {\n\t\t\tevent.preventDefault();\n\t\t\tawait sendLibraryClaimLink();\n\t\t},\n\t\t[sendLibraryClaimLink]\n\t);\n\n\tconst { firstBodyTemplate, secondBodyTemplate } = useMemo(() => {\n\t\tconst firstBodyTemplate = emailSentCount\n\t\t\t? resources.VerificationCodeValidationDescription\n\t\t\t: resources.PageDescription;\n\t\tconst secondBodyTemplate =\n\t\t\temailSentCount > 1\n\t\t\t\t? resources.VerificationCodeValidationResendDescription2\n\t\t\t\t: emailSentCount\n\t\t\t\t\t? resources.VerificationCodeValidationResendDescription\n\t\t\t\t\t: resources.EmailVerificationDescription;\n\n\t\treturn { firstBodyTemplate, secondBodyTemplate };\n\t}, [emailSentCount, resources]);\n\tconst headerTemplate =\n\t\temailSentCount > 1 ? resources.LinkResent : emailSentCount ? resources.AlmostDone : resources.PageHeader;\n\n\tuseLayoutEffect(() => {\n\t\tif (!emailSentCount || !headingRef.current) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { top, bottom } = headingRef.current.getBoundingClientRect();\n\t\tconst isHeadingVisible = top >= 0 && bottom <= window.innerHeight;\n\n\t\tif (!isHeadingVisible) {\n\t\t\theadingRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n\t\t}\n\t}, [emailSentCount]);\n\n\treturn (\n\t\t<>\n\t\t\t{isLoading && (\n\t\t\t\t<div aria-label={resources.LoadingAriaLabel} className={sharedStyles.spinnerOverlay}>\n\t\t\t\t\t<LoadingSpinner variant=\"medium\" />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className={sharedStyles.container}>\n\t\t\t\t<div className={sharedStyles.inputContainer}>\n\t\t\t\t\t<PageHeader\n\t\t\t\t\t\theadingRef={headingRef}\n\t\t\t\t\t\tlogoHeader={\n\t\t\t\t\t\t\t<LogoHeader\n\t\t\t\t\t\t\t\tinstitutionLogoUri={institutionLogoUri}\n\t\t\t\t\t\t\t\tlogosOrVerbum={logosOrVerbum}\n\t\t\t\t\t\t\t\tinstitutionName={institutionName}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t<CommandSentence key={headerTemplate} Container=\"span\" template={headerTemplate}>\n\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"BRAND_NAME\">{logosOrVerbum}</CommandSentence.Field>\n\t\t\t\t\t\t\t</CommandSentence>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpageDescription={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\tmarginBottom: '32px',\n\t\t\t\t\t\t\t\t\t\tlineHeight: '135%',\n\t\t\t\t\t\t\t\t\t\t...(emailSentCount ? { fontSize: '24px', lineHeight: '125%' } : {}),\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CommandSentence key={firstBodyTemplate} Container=\"span\" template={firstBodyTemplate}>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"INSTITUTION_KIND_POSSESSIVE\">\n\t\t\t\t\t\t\t\t\t\t\t{institutionKindPossessive}\n\t\t\t\t\t\t\t\t\t\t</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"BRAND_NAME\">{logosOrVerbum}</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"EMAIL_ADDRESS\">\n\t\t\t\t\t\t\t\t\t\t\t<strong>{email}</strong>\n\t\t\t\t\t\t\t\t\t\t</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t</CommandSentence>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div style={{ ...(emailSentCount ? {} : { fontSize: '24px', lineHeight: '125%' }) }}>\n\t\t\t\t\t\t\t\t\t<CommandSentence key={secondBodyTemplate} Container=\"span\" template={secondBodyTemplate}>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"INSTITUTION_NAME\">\n\t\t\t\t\t\t\t\t\t\t\t<strong>{institutionName}</strong>\n\t\t\t\t\t\t\t\t\t\t</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"BRAND_NAME\">{logosOrVerbum}</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"RESEND_BUTTON_TEXT\">{resources.ResendButton}</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"EMAIL_ADDRESS\">\n\t\t\t\t\t\t\t\t\t\t\t<strong>{email}</strong>\n\t\t\t\t\t\t\t\t\t\t</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t</CommandSentence>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlogosOrVerbum={logosOrVerbum}\n\t\t\t\t\t/>\n\t\t\t\t\t<form onSubmit={handleFormSubmitted}>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tclassName={cx(sharedStyles.inputBox, {\n\t\t\t\t\t\t\t\terrorInput: inputErrorMessage !== null,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tvariant=\"medium\"\n\t\t\t\t\t\t\ttype={emailSentCount ? 'hidden' : 'email'}\n\t\t\t\t\t\t\tvalue={email}\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\tisAcademicInstitution ? resources.AcademicEmailPlaceholder : resources.EnterpriseEmailPlaceholder\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={handleEmailChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{inputErrorMessage && <div className={sharedStyles.errorMessage}>{inputErrorMessage}</div>}\n\t\t\t\t\t\t{verificationErrorMessageTemplate && (\n\t\t\t\t\t\t\t<p className={cx(sharedStyles.errorMessage, styles.verificationError)}>\n\t\t\t\t\t\t\t\t<CommandSentence\n\t\t\t\t\t\t\t\t\tkey={verificationErrorMessageTemplate}\n\t\t\t\t\t\t\t\t\tContainer=\"span\"\n\t\t\t\t\t\t\t\t\ttemplate={verificationErrorMessageTemplate}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"INSTITUTION_NAME\">{institutionName}</CommandSentence.Field>\n\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"GET_MY_CODE_BUTTON_TEXT\">\n\t\t\t\t\t\t\t\t\t\t{resources.GetMyCodeButton}\n\t\t\t\t\t\t\t\t\t</CommandSentence.Field>\n\t\t\t\t\t\t\t\t</CommandSentence>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<SendButton\n\t\t\t\t\t\t\tbuttonText={emailSentCount ? resources.ResendButton : resources.GetMyCodeButton}\n\t\t\t\t\t\t\tactionComplete={isActionComplete}\n\t\t\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\t\t\tonClick={sendLibraryClaimLink}\n\t\t\t\t\t\t\tloadingText={resources.SendingCodeButtonText}\n\t\t\t\t\t\t\tconfirmationText={resources.SentCodeButtonText}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\nexport default VerificationCodeRequest;\n","// extracted by mini-css-extract-plugin\nexport default {\"verificationError\":\"index--verificationError--NJnxD\"};","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue.call(this, arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn this && this[arg] || arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(this, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, this && this[key] || key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import { jsx as u } from \"react/jsx-runtime\";\nimport { useMemo as c, Children as x, isValidElement as l } from \"react\";\nfunction m({ template: e, children: s, Container: n = \"div\", className: t }) {\n  const d = c(() => p(e), [e]), i = {};\n  return x.forEach(s || [], (r) => {\n    l(r) && r.type === f && r.props.name && (i[r.props.name] = r.props.children);\n  }), u(n, { className: t, children: d.map((r) => r.text || i[r.field]) });\n}\nm.Field = f;\nfunction f({ children: e }) {\n  return u(\"span\", { children: e });\n}\nconst o = /%([A-Z0-9_]+)%/g;\nfunction p(e) {\n  if (!e)\n    return [];\n  const s = [];\n  let n = 0;\n  for (let t = o.exec(e); t !== null; t = o.exec(e))\n    n !== t.index && s.push({ text: e.substr(n, t.index - n) }), n = o.lastIndex, s.push({ field: t[1] });\n  return n !== e.length && s.push({ text: e.substr(n, e.length - n) }), s;\n}\nexport {\n  m as CommandSentence\n};\n//# sourceMappingURL=command-sentence.js.map\n"],"names":["LicenseClaimClient","sendLibraryClaimLink","sendLibraryClaimLinkUrl","request","response","fetch","postWithBody","url","body","json","shared","button","container","inputContainer","inputBox","inputButton","header","subHeader","description","spinnerOverlay","logoContainer","logoSvg","institutionSvg","institutionName","plus","errorInput","errorMessage","LogoHeader","logosOrVerbum","institutionLogoUri","resources","useLocalization","React","className","sharedStyles","src","alt","VerbumIcon","LogosIcon","Plus","color","theme","colors","gray66","InstitutionIcon","PageHeader","logoHeader","pageDescription","pageSubHeader","headingRef","descriptionComponent","undefined","ref","CommandSentence","Container","template","Field","name","cx","classNamesBind","SendButton","isLoading","buttonText","loadingText","confirmationText","actionComplete","onClick","shouldShowConfirmation","setShouldShowConfirmation","useState","confirmationEndTimeout","useRef","handlePointerMove","useCallback","current","clearTimeout","useEffect","setTimeout","handleClick","disabled","onPointerMove","license_claim_verification_code_request","VerificationCodeRequest","institutionCode","institutionKind","isAcademicInstitution","initialEmail","routes","verificationError","verificationErrorFromProps","institutionKindPossessive","getInstitutionKindPossessive","toLowerCase","AcademicInstitutionPossessive","ChurchInstitutionPossessive","OrganizationInstitutionPossessive","email","setEmail","setIsLoading","emailSentCount","setEmailSentCount","isActionComplete","setIsActionComplete","inputErrorMessage","setInputErrorMessage","setVerificationError","handleEmailChange","event","target","value","verificationErrorMessageTemplate","useMemo","VerificationCodeExpired","VerificationCodeClaimed","InvalidVerificationCode","UnknownValidationError","async","validationError","validateEmailAddress","EmptyEmail","InvalidEmail","libraryClaimLinkResult","SendLibraryClaimLinkUrl","success","Error","FailedToSendVerificationCode","handleFormSubmitted","preventDefault","firstBodyTemplate","secondBodyTemplate","VerificationCodeValidationDescription","PageDescription","VerificationCodeValidationResendDescription2","VerificationCodeValidationResendDescription","EmailVerificationDescription","headerTemplate","LinkResent","AlmostDone","useLayoutEffect","top","bottom","getBoundingClientRect","window","innerHeight","scrollIntoView","behavior","block","LoadingAriaLabel","LoadingSpinner","variant","key","style","marginBottom","lineHeight","fontSize","ResendButton","onSubmit","Input","type","placeholder","AcademicEmailPlaceholder","EnterpriseEmailPlaceholder","onChange","GetMyCodeButton","SendingCodeButtonText","SentCodeButtonText","__WEBPACK_AMD_DEFINE_RESULT__","hasOwn","hasOwnProperty","classNames","classes","i","arguments","length","arg","appendClass","parseValue","call","this","Array","isArray","apply","toString","Object","prototype","includes","newClass","module","exports","default","m","e","children","s","n","t","d","react__WEBPACK_IMPORTED_MODULE_1__","o","exec","index","push","text","substr","lastIndex","field","p","Children","forEach","r","isValidElement","f","props","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","map"],"sourceRoot":""}