\n htmlButton.children.push({\n name: \"a\",\n attributes: {\n id: \"link\" + this[$uid],\n href,\n newWindow: jsURL.newWindow,\n class: [\"xfaLink\"],\n style: {},\n },\n children: [],\n });\n }\n\n return HTMLResult.success(htmlButton);\n }\n}\n\nclass Calculate extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"calculate\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.override = getStringOption(attributes.override, [\n \"disabled\",\n \"error\",\n \"ignore\",\n \"warning\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.message = null;\n this.script = null;\n }\n}\n\nclass Caption extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"caption\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.placement = getStringOption(attributes.placement, [\n \"left\",\n \"bottom\",\n \"inline\",\n \"right\",\n \"top\",\n ]);\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.reserve = Math.ceil(getMeasurement(attributes.reserve));\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.font = null;\n this.margin = null;\n this.para = null;\n this.value = null;\n }\n\n [$setValue](value) {\n _setValue(this, value);\n }\n\n [$getExtra](availableSpace) {\n if (!this[$extra]) {\n let { width, height } = availableSpace;\n switch (this.placement) {\n case \"left\":\n case \"right\":\n case \"inline\":\n width = this.reserve <= 0 ? width : this.reserve;\n break;\n case \"top\":\n case \"bottom\":\n height = this.reserve <= 0 ? height : this.reserve;\n break;\n }\n\n this[$extra] = layoutNode(this, { width, height });\n }\n return this[$extra];\n }\n\n [$toHTML](availableSpace) {\n // TODO: incomplete.\n if (!this.value) {\n return HTMLResult.EMPTY;\n }\n\n this[$pushPara]();\n const value = this.value[$toHTML](availableSpace).html;\n\n if (!value) {\n this[$popPara]();\n return HTMLResult.EMPTY;\n }\n\n const savedReserve = this.reserve;\n if (this.reserve <= 0) {\n const { w, h } = this[$getExtra](availableSpace);\n switch (this.placement) {\n case \"left\":\n case \"right\":\n case \"inline\":\n this.reserve = w;\n break;\n case \"top\":\n case \"bottom\":\n this.reserve = h;\n break;\n }\n }\n\n const children = [];\n if (typeof value === \"string\") {\n children.push({\n name: \"#text\",\n value,\n });\n } else {\n children.push(value);\n }\n\n const style = toStyle(this, \"font\", \"margin\", \"visibility\");\n switch (this.placement) {\n case \"left\":\n case \"right\":\n if (this.reserve > 0) {\n style.width = measureToString(this.reserve);\n }\n break;\n case \"top\":\n case \"bottom\":\n if (this.reserve > 0) {\n style.height = measureToString(this.reserve);\n }\n break;\n }\n\n setPara(this, null, value);\n this[$popPara]();\n\n this.reserve = savedReserve;\n\n return HTMLResult.success({\n name: \"div\",\n attributes: {\n style,\n class: [\"xfaCaption\"],\n },\n children,\n });\n }\n}\n\nclass Certificate extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"certificate\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Certificates extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"certificates\", /* hasChildren = */ true);\n this.credentialServerPolicy = getStringOption(\n attributes.credentialServerPolicy,\n [\"optional\", \"required\"]\n );\n this.id = attributes.id || \"\";\n this.url = attributes.url || \"\";\n this.urlPolicy = attributes.urlPolicy || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.encryption = null;\n this.issuers = null;\n this.keyUsage = null;\n this.oids = null;\n this.signing = null;\n this.subjectDNs = null;\n }\n}\n\nclass CheckButton extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"checkButton\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.mark = getStringOption(attributes.mark, [\n \"default\",\n \"check\",\n \"circle\",\n \"cross\",\n \"diamond\",\n \"square\",\n \"star\",\n ]);\n this.shape = getStringOption(attributes.shape, [\"square\", \"round\"]);\n this.size = getMeasurement(attributes.size, \"10pt\");\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.extras = null;\n this.margin = null;\n }\n\n [$toHTML](availableSpace) {\n // TODO: border, shape and mark.\n\n const style = toStyle(\"margin\");\n const size = measureToString(this.size);\n\n style.width = style.height = size;\n\n let type;\n let className;\n let groupId;\n const field = this[$getParent]()[$getParent]();\n const items =\n (field.items.children.length &&\n field.items.children[0][$toHTML]().html) ||\n [];\n const exportedValue = {\n on: (items[0] !== undefined ? items[0] : \"on\").toString(),\n off: (items[1] !== undefined ? items[1] : \"off\").toString(),\n };\n\n const value = field.value?.[$text]() || \"off\";\n const checked = value === exportedValue.on || undefined;\n const container = field[$getSubformParent]();\n const fieldId = field[$uid];\n let dataId;\n\n if (container instanceof ExclGroup) {\n groupId = container[$uid];\n type = \"radio\";\n className = \"xfaRadio\";\n dataId = container[$data]?.[$uid] || container[$uid];\n } else {\n type = \"checkbox\";\n className = \"xfaCheckbox\";\n dataId = field[$data]?.[$uid] || field[$uid];\n }\n\n const input = {\n name: \"input\",\n attributes: {\n class: [className],\n style,\n fieldId,\n dataId,\n type,\n checked,\n xfaOn: exportedValue.on,\n xfaOff: exportedValue.off,\n \"aria-label\": ariaLabel(field),\n \"aria-required\": false,\n },\n };\n\n if (groupId) {\n input.attributes.name = groupId;\n }\n\n if (isRequired(field)) {\n input.attributes[\"aria-required\"] = true;\n input.attributes.required = true;\n }\n\n return HTMLResult.success({\n name: \"label\",\n attributes: {\n class: [\"xfaLabel\"],\n },\n children: [input],\n });\n }\n}\n\nclass ChoiceList extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"choiceList\", /* hasChildren = */ true);\n this.commitOn = getStringOption(attributes.commitOn, [\"select\", \"exit\"]);\n this.id = attributes.id || \"\";\n this.open = getStringOption(attributes.open, [\n \"userControl\",\n \"always\",\n \"multiSelect\",\n \"onEntry\",\n ]);\n this.textEntry = getInteger({\n data: attributes.textEntry,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.extras = null;\n this.margin = null;\n }\n\n [$toHTML](availableSpace) {\n // TODO: incomplete.\n const style = toStyle(this, \"border\", \"margin\");\n const ui = this[$getParent]();\n const field = ui[$getParent]();\n const fontSize = field.font?.size || 10;\n const optionStyle = {\n fontSize: `calc(${fontSize}px * var(--scale-factor))`,\n };\n const children = [];\n\n if (field.items.children.length > 0) {\n const items = field.items;\n let displayedIndex = 0;\n let saveIndex = 0;\n if (items.children.length === 2) {\n displayedIndex = items.children[0].save;\n saveIndex = 1 - displayedIndex;\n }\n const displayed = items.children[displayedIndex][$toHTML]().html;\n const values = items.children[saveIndex][$toHTML]().html;\n\n let selected = false;\n const value = field.value?.[$text]() || \"\";\n for (let i = 0, ii = displayed.length; i < ii; i++) {\n const option = {\n name: \"option\",\n attributes: {\n value: values[i] || displayed[i],\n style: optionStyle,\n },\n value: displayed[i],\n };\n if (values[i] === value) {\n option.attributes.selected = selected = true;\n }\n children.push(option);\n }\n\n if (!selected) {\n children.splice(0, 0, {\n name: \"option\",\n attributes: {\n hidden: true,\n selected: true,\n },\n value: \" \",\n });\n }\n }\n\n const selectAttributes = {\n class: [\"xfaSelect\"],\n fieldId: field[$uid],\n dataId: field[$data]?.[$uid] || field[$uid],\n style,\n \"aria-label\": ariaLabel(field),\n \"aria-required\": false,\n };\n\n if (isRequired(field)) {\n selectAttributes[\"aria-required\"] = true;\n selectAttributes.required = true;\n }\n\n if (this.open === \"multiSelect\") {\n selectAttributes.multiple = true;\n }\n\n return HTMLResult.success({\n name: \"label\",\n attributes: {\n class: [\"xfaLabel\"],\n },\n children: [\n {\n name: \"select\",\n children,\n attributes: selectAttributes,\n },\n ],\n });\n }\n}\n\nclass Color extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"color\", /* hasChildren = */ true);\n this.cSpace = getStringOption(attributes.cSpace, [\"SRGB\"]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.value = attributes.value ? getColor(attributes.value) : \"\";\n this.extras = null;\n }\n\n [$hasSettableValue]() {\n return false;\n }\n\n [$toStyle]() {\n return this.value\n ? Util.makeHexColor(this.value.r, this.value.g, this.value.b)\n : null;\n }\n}\n\nclass Comb extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"comb\");\n this.id = attributes.id || \"\";\n this.numberOfCells = getInteger({\n data: attributes.numberOfCells,\n defaultValue: 0,\n validate: x => x >= 0,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Connect extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"connect\", /* hasChildren = */ true);\n this.connection = attributes.connection || \"\";\n this.id = attributes.id || \"\";\n this.ref = attributes.ref || \"\";\n this.usage = getStringOption(attributes.usage, [\n \"exportAndImport\",\n \"exportOnly\",\n \"importOnly\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.picture = null;\n }\n}\n\nclass ContentArea extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"contentArea\", /* hasChildren = */ true);\n this.h = getMeasurement(attributes.h);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.relevant = getRelevant(attributes.relevant);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.w = getMeasurement(attributes.w);\n this.x = getMeasurement(attributes.x, \"0pt\");\n this.y = getMeasurement(attributes.y, \"0pt\");\n this.desc = null;\n this.extras = null;\n }\n\n [$toHTML](availableSpace) {\n // TODO: incomplete.\n const left = measureToString(this.x);\n const top = measureToString(this.y);\n\n const style = {\n left,\n top,\n width: measureToString(this.w),\n height: measureToString(this.h),\n };\n\n const classNames = [\"xfaContentarea\"];\n\n if (isPrintOnly(this)) {\n classNames.push(\"xfaPrintOnly\");\n }\n\n return HTMLResult.success({\n name: \"div\",\n children: [],\n attributes: {\n style,\n class: classNames,\n id: this[$uid],\n },\n });\n }\n}\n\nclass Corner extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"corner\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.inverted = getInteger({\n data: attributes.inverted,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.join = getStringOption(attributes.join, [\"square\", \"round\"]);\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.radius = getMeasurement(attributes.radius);\n this.stroke = getStringOption(attributes.stroke, [\n \"solid\",\n \"dashDot\",\n \"dashDotDot\",\n \"dashed\",\n \"dotted\",\n \"embossed\",\n \"etched\",\n \"lowered\",\n \"raised\",\n ]);\n this.thickness = getMeasurement(attributes.thickness, \"0.5pt\");\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n }\n\n [$toStyle]() {\n // In using CSS it's only possible to handle radius\n // (at least with basic css).\n // Is there a real use (interest ?) of all these properties ?\n // Maybe it's possible to implement them using svg and border-image...\n // TODO: implement all the missing properties.\n const style = toStyle(this, \"visibility\");\n style.radius = measureToString(this.join === \"square\" ? 0 : this.radius);\n return style;\n }\n}\n\nclass DateElement extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"date\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n const date = this[$content].trim();\n this[$content] = date ? new Date(date) : null;\n }\n\n [$toHTML](availableSpace) {\n return valueToHtml(this[$content] ? this[$content].toString() : \"\");\n }\n}\n\nclass DateTime extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"dateTime\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n const date = this[$content].trim();\n this[$content] = date ? new Date(date) : null;\n }\n\n [$toHTML](availableSpace) {\n return valueToHtml(this[$content] ? this[$content].toString() : \"\");\n }\n}\n\nclass DateTimeEdit extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"dateTimeEdit\", /* hasChildren = */ true);\n this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, [\n \"auto\",\n \"off\",\n \"on\",\n ]);\n this.id = attributes.id || \"\";\n this.picker = getStringOption(attributes.picker, [\"host\", \"none\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.comb = null;\n this.extras = null;\n this.margin = null;\n }\n\n [$toHTML](availableSpace) {\n // TODO: incomplete.\n // When the picker is host we should use type=date for the input\n // but we need to put the buttons outside the text-field.\n const style = toStyle(this, \"border\", \"font\", \"margin\");\n const field = this[$getParent]()[$getParent]();\n const html = {\n name: \"input\",\n attributes: {\n type: \"text\",\n fieldId: field[$uid],\n dataId: field[$data]?.[$uid] || field[$uid],\n class: [\"xfaTextfield\"],\n style,\n \"aria-label\": ariaLabel(field),\n \"aria-required\": false,\n },\n };\n\n if (isRequired(field)) {\n html.attributes[\"aria-required\"] = true;\n html.attributes.required = true;\n }\n\n return HTMLResult.success({\n name: \"label\",\n attributes: {\n class: [\"xfaLabel\"],\n },\n children: [html],\n });\n }\n}\n\nclass Decimal extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"decimal\");\n this.fracDigits = getInteger({\n data: attributes.fracDigits,\n defaultValue: 2,\n validate: x => true,\n });\n this.id = attributes.id || \"\";\n this.leadDigits = getInteger({\n data: attributes.leadDigits,\n defaultValue: -1,\n validate: x => true,\n });\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n const number = parseFloat(this[$content].trim());\n this[$content] = isNaN(number) ? null : number;\n }\n\n [$toHTML](availableSpace) {\n return valueToHtml(\n this[$content] !== null ? this[$content].toString() : \"\"\n );\n }\n}\n\nclass DefaultUi extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"defaultUi\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n }\n}\n\nclass Desc extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"desc\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.boolean = new XFAObjectArray();\n this.date = new XFAObjectArray();\n this.dateTime = new XFAObjectArray();\n this.decimal = new XFAObjectArray();\n this.exData = new XFAObjectArray();\n this.float = new XFAObjectArray();\n this.image = new XFAObjectArray();\n this.integer = new XFAObjectArray();\n this.text = new XFAObjectArray();\n this.time = new XFAObjectArray();\n }\n}\n\nclass DigestMethod extends OptionObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"digestMethod\", [\n \"\",\n \"SHA1\",\n \"SHA256\",\n \"SHA512\",\n \"RIPEMD160\",\n ]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass DigestMethods extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"digestMethods\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.digestMethod = new XFAObjectArray();\n }\n}\n\nclass Draw extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"draw\", /* hasChildren = */ true);\n this.anchorType = getStringOption(attributes.anchorType, [\n \"topLeft\",\n \"bottomCenter\",\n \"bottomLeft\",\n \"bottomRight\",\n \"middleCenter\",\n \"middleLeft\",\n \"middleRight\",\n \"topCenter\",\n \"topRight\",\n ]);\n this.colSpan = getInteger({\n data: attributes.colSpan,\n defaultValue: 1,\n validate: n => n >= 1 || n === -1,\n });\n this.h = attributes.h ? getMeasurement(attributes.h) : \"\";\n this.hAlign = getStringOption(attributes.hAlign, [\n \"left\",\n \"center\",\n \"justify\",\n \"justifyAll\",\n \"radix\",\n \"right\",\n ]);\n this.id = attributes.id || \"\";\n this.locale = attributes.locale || \"\";\n this.maxH = getMeasurement(attributes.maxH, \"0pt\");\n this.maxW = getMeasurement(attributes.maxW, \"0pt\");\n this.minH = getMeasurement(attributes.minH, \"0pt\");\n this.minW = getMeasurement(attributes.minW, \"0pt\");\n this.name = attributes.name || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.rotate = getInteger({\n data: attributes.rotate,\n defaultValue: 0,\n validate: x => x % 90 === 0,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.w = attributes.w ? getMeasurement(attributes.w) : \"\";\n this.x = getMeasurement(attributes.x, \"0pt\");\n this.y = getMeasurement(attributes.y, \"0pt\");\n this.assist = null;\n this.border = null;\n this.caption = null;\n this.desc = null;\n this.extras = null;\n this.font = null;\n this.keep = null;\n this.margin = null;\n this.para = null;\n this.traversal = null;\n this.ui = null;\n this.value = null;\n this.setProperty = new XFAObjectArray();\n }\n\n [$setValue](value) {\n _setValue(this, value);\n }\n\n [$toHTML](availableSpace) {\n setTabIndex(this);\n\n if (this.presence === \"hidden\" || this.presence === \"inactive\") {\n return HTMLResult.EMPTY;\n }\n\n fixDimensions(this);\n this[$pushPara]();\n\n // If at least one dimension is missing and we've a text\n // then we can guess it in laying out the text.\n const savedW = this.w;\n const savedH = this.h;\n const { w, h, isBroken } = layoutNode(this, availableSpace);\n if (w && this.w === \"\") {\n // If the parent layout is lr-tb with a w=100 and we already have a child\n // which takes 90 on the current line.\n // If we have a text with a length (in px) equal to 100 then it'll be\n // splitted into almost 10 chunks: so it won't be nice.\n // So if we've potentially more width to provide in some parent containers\n // let's increase it to give a chance to have a better rendering.\n if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {\n this[$popPara]();\n return HTMLResult.FAILURE;\n }\n\n this.w = w;\n }\n if (h && this.h === \"\") {\n this.h = h;\n }\n\n setFirstUnsplittable(this);\n if (!checkDimensions(this, availableSpace)) {\n this.w = savedW;\n this.h = savedH;\n this[$popPara]();\n return HTMLResult.FAILURE;\n }\n unsetFirstUnsplittable(this);\n\n const style = toStyle(\n this,\n \"font\",\n \"hAlign\",\n \"dimensions\",\n \"position\",\n \"presence\",\n \"rotate\",\n \"anchorType\",\n \"border\",\n \"margin\"\n );\n\n setMinMaxDimensions(this, style);\n\n if (style.margin) {\n style.padding = style.margin;\n delete style.margin;\n }\n\n const classNames = [\"xfaDraw\"];\n if (this.font) {\n classNames.push(\"xfaFont\");\n }\n if (isPrintOnly(this)) {\n classNames.push(\"xfaPrintOnly\");\n }\n\n const attributes = {\n style,\n id: this[$uid],\n class: classNames,\n };\n\n if (this.name) {\n attributes.xfaName = this.name;\n }\n\n const html = {\n name: \"div\",\n attributes,\n children: [],\n };\n\n applyAssist(this, attributes);\n\n const bbox = computeBbox(this, html, availableSpace);\n\n const value = this.value ? this.value[$toHTML](availableSpace).html : null;\n if (value === null) {\n this.w = savedW;\n this.h = savedH;\n this[$popPara]();\n return HTMLResult.success(createWrapper(this, html), bbox);\n }\n\n html.children.push(value);\n setPara(this, style, value);\n\n this.w = savedW;\n this.h = savedH;\n\n this[$popPara]();\n return HTMLResult.success(createWrapper(this, html), bbox);\n }\n}\n\nclass Edge extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"edge\", /* hasChildren = */ true);\n this.cap = getStringOption(attributes.cap, [\"square\", \"butt\", \"round\"]);\n this.id = attributes.id || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.stroke = getStringOption(attributes.stroke, [\n \"solid\",\n \"dashDot\",\n \"dashDotDot\",\n \"dashed\",\n \"dotted\",\n \"embossed\",\n \"etched\",\n \"lowered\",\n \"raised\",\n ]);\n this.thickness = getMeasurement(attributes.thickness, \"0.5pt\");\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n }\n\n [$toStyle]() {\n // TODO: dashDot & dashDotDot.\n const style = toStyle(this, \"visibility\");\n Object.assign(style, {\n linecap: this.cap,\n width: measureToString(this.thickness),\n color: this.color ? this.color[$toStyle]() : \"#000000\",\n style: \"\",\n });\n\n if (this.presence !== \"visible\") {\n style.style = \"none\";\n } else {\n switch (this.stroke) {\n case \"solid\":\n style.style = \"solid\";\n break;\n case \"dashDot\":\n style.style = \"dashed\";\n break;\n case \"dashDotDot\":\n style.style = \"dashed\";\n break;\n case \"dashed\":\n style.style = \"dashed\";\n break;\n case \"dotted\":\n style.style = \"dotted\";\n break;\n case \"embossed\":\n style.style = \"ridge\";\n break;\n case \"etched\":\n style.style = \"groove\";\n break;\n case \"lowered\":\n style.style = \"inset\";\n break;\n case \"raised\":\n style.style = \"outset\";\n break;\n }\n }\n return style;\n }\n}\n\nclass Encoding extends OptionObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encoding\", [\n \"adbe.x509.rsa_sha1\",\n \"adbe.pkcs7.detached\",\n \"adbe.pkcs7.sha1\",\n ]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Encodings extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encodings\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.encoding = new XFAObjectArray();\n }\n}\n\nclass Encrypt extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encrypt\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.certificate = null;\n }\n}\n\nclass EncryptData extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encryptData\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.operation = getStringOption(attributes.operation, [\n \"encrypt\",\n \"decrypt\",\n ]);\n this.target = attributes.target || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.filter = null;\n this.manifest = null;\n }\n}\n\nclass Encryption extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encryption\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.certificate = new XFAObjectArray();\n }\n}\n\nclass EncryptionMethod extends OptionObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encryptionMethod\", [\n \"\",\n \"AES256-CBC\",\n \"TRIPLEDES-CBC\",\n \"AES128-CBC\",\n \"AES192-CBC\",\n ]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass EncryptionMethods extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"encryptionMethods\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.encryptionMethod = new XFAObjectArray();\n }\n}\n\nclass Event extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"event\", /* hasChildren = */ true);\n this.activity = getStringOption(attributes.activity, [\n \"click\",\n \"change\",\n \"docClose\",\n \"docReady\",\n \"enter\",\n \"exit\",\n \"full\",\n \"indexChange\",\n \"initialize\",\n \"mouseDown\",\n \"mouseEnter\",\n \"mouseExit\",\n \"mouseUp\",\n \"postExecute\",\n \"postOpen\",\n \"postPrint\",\n \"postSave\",\n \"postSign\",\n \"postSubmit\",\n \"preExecute\",\n \"preOpen\",\n \"prePrint\",\n \"preSave\",\n \"preSign\",\n \"preSubmit\",\n \"ready\",\n \"validationState\",\n ]);\n this.id = attributes.id || \"\";\n this.listen = getStringOption(attributes.listen, [\n \"refOnly\",\n \"refAndDescendents\",\n ]);\n this.name = attributes.name || \"\";\n this.ref = attributes.ref || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n\n // One-of properties\n this.encryptData = null;\n this.execute = null;\n this.script = null;\n this.signData = null;\n this.submit = null;\n }\n}\n\nclass ExData extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"exData\");\n this.contentType = attributes.contentType || \"\";\n this.href = attributes.href || \"\";\n this.id = attributes.id || \"\";\n this.maxLength = getInteger({\n data: attributes.maxLength,\n defaultValue: -1,\n validate: x => x >= -1,\n });\n this.name = attributes.name || \"\";\n this.rid = attributes.rid || \"\";\n this.transferEncoding = getStringOption(attributes.transferEncoding, [\n \"none\",\n \"base64\",\n \"package\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$isCDATAXml]() {\n return this.contentType === \"text/html\";\n }\n\n [$onChild](child) {\n if (\n this.contentType === \"text/html\" &&\n child[$namespaceId] === NamespaceIds.xhtml.id\n ) {\n this[$content] = child;\n return true;\n }\n\n if (this.contentType === \"text/xml\") {\n this[$content] = child;\n return true;\n }\n\n return false;\n }\n\n [$toHTML](availableSpace) {\n if (this.contentType !== \"text/html\" || !this[$content]) {\n // TODO: fix other cases.\n return HTMLResult.EMPTY;\n }\n\n return this[$content][$toHTML](availableSpace);\n }\n}\n\nclass ExObject extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"exObject\", /* hasChildren = */ true);\n this.archive = attributes.archive || \"\";\n this.classId = attributes.classId || \"\";\n this.codeBase = attributes.codeBase || \"\";\n this.codeType = attributes.codeType || \"\";\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.boolean = new XFAObjectArray();\n this.date = new XFAObjectArray();\n this.dateTime = new XFAObjectArray();\n this.decimal = new XFAObjectArray();\n this.exData = new XFAObjectArray();\n this.exObject = new XFAObjectArray();\n this.float = new XFAObjectArray();\n this.image = new XFAObjectArray();\n this.integer = new XFAObjectArray();\n this.text = new XFAObjectArray();\n this.time = new XFAObjectArray();\n }\n}\n\nclass ExclGroup extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"exclGroup\", /* hasChildren = */ true);\n this.access = getStringOption(attributes.access, [\n \"open\",\n \"nonInteractive\",\n \"protected\",\n \"readOnly\",\n ]);\n this.accessKey = attributes.accessKey || \"\";\n this.anchorType = getStringOption(attributes.anchorType, [\n \"topLeft\",\n \"bottomCenter\",\n \"bottomLeft\",\n \"bottomRight\",\n \"middleCenter\",\n \"middleLeft\",\n \"middleRight\",\n \"topCenter\",\n \"topRight\",\n ]);\n this.colSpan = getInteger({\n data: attributes.colSpan,\n defaultValue: 1,\n validate: n => n >= 1 || n === -1,\n });\n this.h = attributes.h ? getMeasurement(attributes.h) : \"\";\n this.hAlign = getStringOption(attributes.hAlign, [\n \"left\",\n \"center\",\n \"justify\",\n \"justifyAll\",\n \"radix\",\n \"right\",\n ]);\n this.id = attributes.id || \"\";\n this.layout = getStringOption(attributes.layout, [\n \"position\",\n \"lr-tb\",\n \"rl-row\",\n \"rl-tb\",\n \"row\",\n \"table\",\n \"tb\",\n ]);\n this.maxH = getMeasurement(attributes.maxH, \"0pt\");\n this.maxW = getMeasurement(attributes.maxW, \"0pt\");\n this.minH = getMeasurement(attributes.minH, \"0pt\");\n this.minW = getMeasurement(attributes.minW, \"0pt\");\n this.name = attributes.name || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.w = attributes.w ? getMeasurement(attributes.w) : \"\";\n this.x = getMeasurement(attributes.x, \"0pt\");\n this.y = getMeasurement(attributes.y, \"0pt\");\n this.assist = null;\n this.bind = null;\n this.border = null;\n this.calculate = null;\n this.caption = null;\n this.desc = null;\n this.extras = null;\n this.margin = null;\n this.para = null;\n this.traversal = null;\n this.validate = null;\n this.connect = new XFAObjectArray();\n this.event = new XFAObjectArray();\n this.field = new XFAObjectArray();\n this.setProperty = new XFAObjectArray();\n }\n\n [$isBindable]() {\n return true;\n }\n\n [$hasSettableValue]() {\n return true;\n }\n\n [$setValue](value) {\n for (const field of this.field.children) {\n if (!field.value) {\n const nodeValue = new Value({});\n field[$appendChild](nodeValue);\n field.value = nodeValue;\n }\n\n field.value[$setValue](value);\n }\n }\n\n [$isThereMoreWidth]() {\n return (\n (this.layout.endsWith(\"-tb\") &&\n this[$extra].attempt === 0 &&\n this[$extra].numberInLine > 0) ||\n this[$getParent]()[$isThereMoreWidth]()\n );\n }\n\n [$isSplittable]() {\n // We cannot cache the result here because the contentArea\n // can change.\n const parent = this[$getSubformParent]();\n if (!parent[$isSplittable]()) {\n return false;\n }\n\n if (this[$extra]._isSplittable !== undefined) {\n return this[$extra]._isSplittable;\n }\n\n if (this.layout === \"position\" || this.layout.includes(\"row\")) {\n this[$extra]._isSplittable = false;\n return false;\n }\n\n if (parent.layout?.endsWith(\"-tb\") && parent[$extra].numberInLine !== 0) {\n // See comment in Subform::[$isSplittable] for an explanation.\n return false;\n }\n\n this[$extra]._isSplittable = true;\n return true;\n }\n\n [$flushHTML]() {\n return flushHTML(this);\n }\n\n [$addHTML](html, bbox) {\n addHTML(this, html, bbox);\n }\n\n [$getAvailableSpace]() {\n return getAvailableSpace(this);\n }\n\n [$toHTML](availableSpace) {\n setTabIndex(this);\n if (\n this.presence === \"hidden\" ||\n this.presence === \"inactive\" ||\n this.h === 0 ||\n this.w === 0\n ) {\n return HTMLResult.EMPTY;\n }\n\n fixDimensions(this);\n\n const children = [];\n const attributes = {\n id: this[$uid],\n class: [],\n };\n\n setAccess(this, attributes.class);\n\n if (!this[$extra]) {\n this[$extra] = Object.create(null);\n }\n\n Object.assign(this[$extra], {\n children,\n attributes,\n attempt: 0,\n line: null,\n numberInLine: 0,\n availableSpace: {\n width: Math.min(this.w || Infinity, availableSpace.width),\n height: Math.min(this.h || Infinity, availableSpace.height),\n },\n width: 0,\n height: 0,\n prevHeight: 0,\n currentWidth: 0,\n });\n\n const isSplittable = this[$isSplittable]();\n if (!isSplittable) {\n setFirstUnsplittable(this);\n }\n\n if (!checkDimensions(this, availableSpace)) {\n return HTMLResult.FAILURE;\n }\n const filter = new Set([\"field\"]);\n\n if (this.layout.includes(\"row\")) {\n const columnWidths = this[$getSubformParent]().columnWidths;\n if (Array.isArray(columnWidths) && columnWidths.length > 0) {\n this[$extra].columnWidths = columnWidths;\n this[$extra].currentColumn = 0;\n }\n }\n\n const style = toStyle(\n this,\n \"anchorType\",\n \"dimensions\",\n \"position\",\n \"presence\",\n \"border\",\n \"margin\",\n \"hAlign\"\n );\n const classNames = [\"xfaExclgroup\"];\n const cl = layoutClass(this);\n if (cl) {\n classNames.push(cl);\n }\n\n if (isPrintOnly(this)) {\n classNames.push(\"xfaPrintOnly\");\n }\n\n attributes.style = style;\n attributes.class = classNames;\n\n if (this.name) {\n attributes.xfaName = this.name;\n }\n\n this[$pushPara]();\n const isLrTb = this.layout === \"lr-tb\" || this.layout === \"rl-tb\";\n const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;\n for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {\n if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {\n // If the layout is lr-tb then having attempt equals to\n // MAX_ATTEMPTS_FOR_LRTB_LAYOUT-1 means that we're trying to layout\n // on the next line so this on is empty.\n this[$extra].numberInLine = 0;\n }\n const result = this[$childrenToHTML]({\n filter,\n include: true,\n });\n if (result.success) {\n break;\n }\n if (result.isBreak()) {\n this[$popPara]();\n return result;\n }\n if (\n isLrTb &&\n this[$extra].attempt === 0 &&\n this[$extra].numberInLine === 0 &&\n !this[$getTemplateRoot]()[$extra].noLayoutFailure\n ) {\n // See comment in Subform::[$toHTML].\n this[$extra].attempt = maxRun;\n break;\n }\n }\n\n this[$popPara]();\n\n if (!isSplittable) {\n unsetFirstUnsplittable(this);\n }\n\n if (this[$extra].attempt === maxRun) {\n if (!isSplittable) {\n delete this[$extra];\n }\n return HTMLResult.FAILURE;\n }\n\n let marginH = 0;\n let marginV = 0;\n if (this.margin) {\n marginH = this.margin.leftInset + this.margin.rightInset;\n marginV = this.margin.topInset + this.margin.bottomInset;\n }\n\n const width = Math.max(this[$extra].width + marginH, this.w || 0);\n const height = Math.max(this[$extra].height + marginV, this.h || 0);\n const bbox = [this.x, this.y, width, height];\n\n if (this.w === \"\") {\n style.width = measureToString(width);\n }\n if (this.h === \"\") {\n style.height = measureToString(height);\n }\n\n const html = {\n name: \"div\",\n attributes,\n children,\n };\n\n applyAssist(this, attributes);\n\n delete this[$extra];\n\n return HTMLResult.success(createWrapper(this, html), bbox);\n }\n}\n\nclass Execute extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"execute\");\n this.connection = attributes.connection || \"\";\n this.executeType = getStringOption(attributes.executeType, [\n \"import\",\n \"remerge\",\n ]);\n this.id = attributes.id || \"\";\n this.runAt = getStringOption(attributes.runAt, [\n \"client\",\n \"both\",\n \"server\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Extras extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"extras\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.boolean = new XFAObjectArray();\n this.date = new XFAObjectArray();\n this.dateTime = new XFAObjectArray();\n this.decimal = new XFAObjectArray();\n this.exData = new XFAObjectArray();\n this.extras = new XFAObjectArray();\n this.float = new XFAObjectArray();\n this.image = new XFAObjectArray();\n this.integer = new XFAObjectArray();\n this.text = new XFAObjectArray();\n this.time = new XFAObjectArray();\n }\n\n // (Spec) The XFA template grammar defines the extras and desc elements,\n // which can be used to add human-readable or machine-readable\n // data to a template.\n}\n\nclass Field extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"field\", /* hasChildren = */ true);\n this.access = getStringOption(attributes.access, [\n \"open\",\n \"nonInteractive\",\n \"protected\",\n \"readOnly\",\n ]);\n this.accessKey = attributes.accessKey || \"\";\n this.anchorType = getStringOption(attributes.anchorType, [\n \"topLeft\",\n \"bottomCenter\",\n \"bottomLeft\",\n \"bottomRight\",\n \"middleCenter\",\n \"middleLeft\",\n \"middleRight\",\n \"topCenter\",\n \"topRight\",\n ]);\n this.colSpan = getInteger({\n data: attributes.colSpan,\n defaultValue: 1,\n validate: n => n >= 1 || n === -1,\n });\n this.h = attributes.h ? getMeasurement(attributes.h) : \"\";\n this.hAlign = getStringOption(attributes.hAlign, [\n \"left\",\n \"center\",\n \"justify\",\n \"justifyAll\",\n \"radix\",\n \"right\",\n ]);\n this.id = attributes.id || \"\";\n this.locale = attributes.locale || \"\";\n this.maxH = getMeasurement(attributes.maxH, \"0pt\");\n this.maxW = getMeasurement(attributes.maxW, \"0pt\");\n this.minH = getMeasurement(attributes.minH, \"0pt\");\n this.minW = getMeasurement(attributes.minW, \"0pt\");\n this.name = attributes.name || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.rotate = getInteger({\n data: attributes.rotate,\n defaultValue: 0,\n validate: x => x % 90 === 0,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.w = attributes.w ? getMeasurement(attributes.w) : \"\";\n this.x = getMeasurement(attributes.x, \"0pt\");\n this.y = getMeasurement(attributes.y, \"0pt\");\n this.assist = null;\n this.bind = null;\n this.border = null;\n this.calculate = null;\n this.caption = null;\n this.desc = null;\n this.extras = null;\n this.font = null;\n this.format = null;\n // For a choice list, one list is used to have display entries\n // and the other for the exported values\n this.items = new XFAObjectArray(2);\n this.keep = null;\n this.margin = null;\n this.para = null;\n this.traversal = null;\n this.ui = null;\n this.validate = null;\n this.value = null;\n this.bindItems = new XFAObjectArray();\n this.connect = new XFAObjectArray();\n this.event = new XFAObjectArray();\n this.setProperty = new XFAObjectArray();\n }\n\n [$isBindable]() {\n return true;\n }\n\n [$setValue](value) {\n _setValue(this, value);\n }\n\n [$toHTML](availableSpace) {\n setTabIndex(this);\n\n if (!this.ui) {\n // It's allowed to not have an ui, specs say:\n // If the UI element contains no children or is not present,\n // the application chooses a default user interface for the\n // container, based on the type of the container's content.\n\n this.ui = new Ui({});\n this.ui[$globalData] = this[$globalData];\n this[$appendChild](this.ui);\n let node;\n\n // The items element can have 2 element max and\n // according to the items specs it's likely a good\n // way to guess the correct ui type.\n switch (this.items.children.length) {\n case 0:\n node = new TextEdit({});\n this.ui.textEdit = node;\n break;\n case 1:\n node = new CheckButton({});\n this.ui.checkButton = node;\n break;\n case 2:\n node = new ChoiceList({});\n this.ui.choiceList = node;\n break;\n }\n this.ui[$appendChild](node);\n }\n\n if (\n !this.ui ||\n this.presence === \"hidden\" ||\n this.presence === \"inactive\" ||\n this.h === 0 ||\n this.w === 0\n ) {\n return HTMLResult.EMPTY;\n }\n\n if (this.caption) {\n // Maybe we already tried to layout this field with\n // another availableSpace, so to avoid to use the cached\n // value just delete it.\n delete this.caption[$extra];\n }\n\n this[$pushPara]();\n\n const caption = this.caption\n ? this.caption[$toHTML](availableSpace).html\n : null;\n const savedW = this.w;\n const savedH = this.h;\n let marginH = 0;\n let marginV = 0;\n if (this.margin) {\n marginH = this.margin.leftInset + this.margin.rightInset;\n marginV = this.margin.topInset + this.margin.bottomInset;\n }\n\n let borderDims = null;\n if (this.w === \"\" || this.h === \"\") {\n let width = null;\n let height = null;\n\n let uiW = 0;\n let uiH = 0;\n if (this.ui.checkButton) {\n uiW = uiH = this.ui.checkButton.size;\n } else {\n const { w, h } = layoutNode(this, availableSpace);\n if (w !== null) {\n uiW = w;\n uiH = h;\n } else {\n uiH = getMetrics(this.font, /* real = */ true).lineNoGap;\n }\n }\n\n borderDims = getBorderDims(this.ui[$getExtra]());\n uiW += borderDims.w;\n uiH += borderDims.h;\n\n if (this.caption) {\n const { w, h, isBroken } = this.caption[$getExtra](availableSpace);\n // See comment in Draw::[$toHTML] to have an explanation\n // about this line.\n if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {\n this[$popPara]();\n return HTMLResult.FAILURE;\n }\n\n width = w;\n height = h;\n\n switch (this.caption.placement) {\n case \"left\":\n case \"right\":\n case \"inline\":\n width += uiW;\n break;\n case \"top\":\n case \"bottom\":\n height += uiH;\n break;\n }\n } else {\n width = uiW;\n height = uiH;\n }\n\n if (width && this.w === \"\") {\n width += marginH;\n this.w = Math.min(\n this.maxW <= 0 ? Infinity : this.maxW,\n this.minW + 1 < width ? width : this.minW\n );\n }\n\n if (height && this.h === \"\") {\n height += marginV;\n this.h = Math.min(\n this.maxH <= 0 ? Infinity : this.maxH,\n this.minH + 1 < height ? height : this.minH\n );\n }\n }\n\n this[$popPara]();\n\n fixDimensions(this);\n\n setFirstUnsplittable(this);\n if (!checkDimensions(this, availableSpace)) {\n this.w = savedW;\n this.h = savedH;\n this[$popPara]();\n return HTMLResult.FAILURE;\n }\n unsetFirstUnsplittable(this);\n\n const style = toStyle(\n this,\n \"font\",\n \"dimensions\",\n \"position\",\n \"rotate\",\n \"anchorType\",\n \"presence\",\n \"margin\",\n \"hAlign\"\n );\n\n setMinMaxDimensions(this, style);\n\n const classNames = [\"xfaField\"];\n // If no font, font properties are inherited.\n if (this.font) {\n classNames.push(\"xfaFont\");\n }\n\n if (isPrintOnly(this)) {\n classNames.push(\"xfaPrintOnly\");\n }\n\n const attributes = {\n style,\n id: this[$uid],\n class: classNames,\n };\n\n if (style.margin) {\n style.padding = style.margin;\n delete style.margin;\n }\n\n setAccess(this, classNames);\n\n if (this.name) {\n attributes.xfaName = this.name;\n }\n\n const children = [];\n const html = {\n name: \"div\",\n attributes,\n children,\n };\n\n applyAssist(this, attributes);\n\n const borderStyle = this.border ? this.border[$toStyle]() : null;\n const bbox = computeBbox(this, html, availableSpace);\n const ui = this.ui[$toHTML]().html;\n if (!ui) {\n Object.assign(style, borderStyle);\n return HTMLResult.success(createWrapper(this, html), bbox);\n }\n\n if (this[$tabIndex]) {\n if (ui.children?.[0]) {\n ui.children[0].attributes.tabindex = this[$tabIndex];\n } else {\n ui.attributes.tabindex = this[$tabIndex];\n }\n }\n\n if (!ui.attributes.style) {\n ui.attributes.style = Object.create(null);\n }\n\n let aElement = null;\n\n if (this.ui.button) {\n if (ui.children.length === 1) {\n [aElement] = ui.children.splice(0, 1);\n }\n Object.assign(ui.attributes.style, borderStyle);\n } else {\n Object.assign(style, borderStyle);\n }\n\n children.push(ui);\n\n if (this.value) {\n if (this.ui.imageEdit) {\n ui.children.push(this.value[$toHTML]().html);\n } else if (!this.ui.button) {\n let value = \"\";\n if (this.value.exData) {\n value = this.value.exData[$text]();\n } else if (this.value.text) {\n value = this.value.text[$getExtra]();\n } else {\n const htmlValue = this.value[$toHTML]().html;\n if (htmlValue !== null) {\n value = htmlValue.children[0].value;\n }\n }\n if (this.ui.textEdit && this.value.text?.maxChars) {\n ui.children[0].attributes.maxLength = this.value.text.maxChars;\n }\n\n if (value) {\n if (this.ui.numericEdit) {\n value = parseFloat(value);\n value = isNaN(value) ? \"\" : value.toString();\n }\n\n if (ui.children[0].name === \"textarea\") {\n ui.children[0].attributes.textContent = value;\n } else {\n ui.children[0].attributes.value = value;\n }\n }\n }\n }\n\n if (!this.ui.imageEdit && ui.children?.[0] && this.h) {\n borderDims = borderDims || getBorderDims(this.ui[$getExtra]());\n\n let captionHeight = 0;\n if (this.caption && [\"top\", \"bottom\"].includes(this.caption.placement)) {\n captionHeight = this.caption.reserve;\n if (captionHeight <= 0) {\n captionHeight = this.caption[$getExtra](availableSpace).h;\n }\n const inputHeight = this.h - captionHeight - marginV - borderDims.h;\n ui.children[0].attributes.style.height = measureToString(inputHeight);\n } else {\n ui.children[0].attributes.style.height = \"100%\";\n }\n }\n\n if (aElement) {\n ui.children.push(aElement);\n }\n\n if (!caption) {\n if (ui.attributes.class) {\n // Even if no caption this class will help to center the ui.\n ui.attributes.class.push(\"xfaLeft\");\n }\n this.w = savedW;\n this.h = savedH;\n\n return HTMLResult.success(createWrapper(this, html), bbox);\n }\n\n if (this.ui.button) {\n if (style.padding) {\n delete style.padding;\n }\n if (caption.name === \"div\") {\n caption.name = \"span\";\n }\n ui.children.push(caption);\n return HTMLResult.success(html, bbox);\n } else if (this.ui.checkButton) {\n caption.attributes.class[0] = \"xfaCaptionForCheckButton\";\n }\n\n if (!ui.attributes.class) {\n ui.attributes.class = [];\n }\n\n ui.children.splice(0, 0, caption);\n\n switch (this.caption.placement) {\n case \"left\":\n ui.attributes.class.push(\"xfaLeft\");\n break;\n case \"right\":\n ui.attributes.class.push(\"xfaRight\");\n break;\n case \"top\":\n ui.attributes.class.push(\"xfaTop\");\n break;\n case \"bottom\":\n ui.attributes.class.push(\"xfaBottom\");\n break;\n case \"inline\":\n // TODO;\n ui.attributes.class.push(\"xfaLeft\");\n break;\n }\n\n this.w = savedW;\n this.h = savedH;\n return HTMLResult.success(createWrapper(this, html), bbox);\n }\n}\n\nclass Fill extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"fill\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n\n // One-of properties or none\n this.linear = null;\n this.pattern = null;\n this.radial = null;\n this.solid = null;\n this.stipple = null;\n }\n\n [$toStyle]() {\n const parent = this[$getParent]();\n const grandpa = parent[$getParent]();\n const ggrandpa = grandpa[$getParent]();\n const style = Object.create(null);\n\n // Use for color, i.e. #...\n let propName = \"color\";\n\n // Use for non-color, i.e. gradient, radial-gradient...\n let altPropName = propName;\n\n if (parent instanceof Border) {\n propName = \"background-color\";\n altPropName = \"background\";\n if (ggrandpa instanceof Ui) {\n // The default fill color is white.\n style.backgroundColor = \"white\";\n }\n }\n if (parent instanceof Rectangle || parent instanceof Arc) {\n propName = altPropName = \"fill\";\n style.fill = \"white\";\n }\n\n for (const name of Object.getOwnPropertyNames(this)) {\n if (name === \"extras\" || name === \"color\") {\n continue;\n }\n const obj = this[name];\n if (!(obj instanceof XFAObject)) {\n continue;\n }\n\n const color = obj[$toStyle](this.color);\n if (color) {\n style[color.startsWith(\"#\") ? propName : altPropName] = color;\n }\n return style;\n }\n\n if (this.color?.value) {\n const color = this.color[$toStyle]();\n style[color.startsWith(\"#\") ? propName : altPropName] = color;\n }\n\n return style;\n }\n}\n\nclass Filter extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"filter\", /* hasChildren = */ true);\n this.addRevocationInfo = getStringOption(attributes.addRevocationInfo, [\n \"\",\n \"required\",\n \"optional\",\n \"none\",\n ]);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.version = getInteger({\n data: this.version,\n defaultValue: 5,\n validate: x => x >= 1 && x <= 5,\n });\n this.appearanceFilter = null;\n this.certificates = null;\n this.digestMethods = null;\n this.encodings = null;\n this.encryptionMethods = null;\n this.handler = null;\n this.lockDocument = null;\n this.mdp = null;\n this.reasons = null;\n this.timeStamp = null;\n }\n}\n\nclass Float extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"float\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n const number = parseFloat(this[$content].trim());\n this[$content] = isNaN(number) ? null : number;\n }\n\n [$toHTML](availableSpace) {\n return valueToHtml(\n this[$content] !== null ? this[$content].toString() : \"\"\n );\n }\n}\n\nclass Font extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"font\", /* hasChildren = */ true);\n this.baselineShift = getMeasurement(attributes.baselineShift);\n this.fontHorizontalScale = getFloat({\n data: attributes.fontHorizontalScale,\n defaultValue: 100,\n validate: x => x >= 0,\n });\n this.fontVerticalScale = getFloat({\n data: attributes.fontVerticalScale,\n defaultValue: 100,\n validate: x => x >= 0,\n });\n this.id = attributes.id || \"\";\n this.kerningMode = getStringOption(attributes.kerningMode, [\n \"none\",\n \"pair\",\n ]);\n this.letterSpacing = getMeasurement(attributes.letterSpacing, \"0\");\n this.lineThrough = getInteger({\n data: attributes.lineThrough,\n defaultValue: 0,\n validate: x => x === 1 || x === 2,\n });\n this.lineThroughPeriod = getStringOption(attributes.lineThroughPeriod, [\n \"all\",\n \"word\",\n ]);\n this.overline = getInteger({\n data: attributes.overline,\n defaultValue: 0,\n validate: x => x === 1 || x === 2,\n });\n this.overlinePeriod = getStringOption(attributes.overlinePeriod, [\n \"all\",\n \"word\",\n ]);\n this.posture = getStringOption(attributes.posture, [\"normal\", \"italic\"]);\n this.size = getMeasurement(attributes.size, \"10pt\");\n this.typeface = attributes.typeface || \"Courier\";\n this.underline = getInteger({\n data: attributes.underline,\n defaultValue: 0,\n validate: x => x === 1 || x === 2,\n });\n this.underlinePeriod = getStringOption(attributes.underlinePeriod, [\n \"all\",\n \"word\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.weight = getStringOption(attributes.weight, [\"normal\", \"bold\"]);\n this.extras = null;\n this.fill = null;\n }\n\n [$clean](builder) {\n super[$clean](builder);\n this[$globalData].usedTypefaces.add(this.typeface);\n }\n\n [$toStyle]() {\n const style = toStyle(this, \"fill\");\n const color = style.color;\n if (color) {\n if (color === \"#000000\") {\n // Default font color.\n delete style.color;\n } else if (!color.startsWith(\"#\")) {\n // We've a gradient which is not possible for a font color\n // so use a workaround.\n style.background = color;\n style.backgroundClip = \"text\";\n style.color = \"transparent\";\n }\n }\n\n if (this.baselineShift) {\n style.verticalAlign = measureToString(this.baselineShift);\n }\n\n // TODO: fontHorizontalScale\n // TODO: fontVerticalScale\n\n style.fontKerning = this.kerningMode === \"none\" ? \"none\" : \"normal\";\n style.letterSpacing = measureToString(this.letterSpacing);\n\n if (this.lineThrough !== 0) {\n style.textDecoration = \"line-through\";\n if (this.lineThrough === 2) {\n style.textDecorationStyle = \"double\";\n }\n }\n\n // TODO: lineThroughPeriod\n\n if (this.overline !== 0) {\n style.textDecoration = \"overline\";\n if (this.overline === 2) {\n style.textDecorationStyle = \"double\";\n }\n }\n\n // TODO: overlinePeriod\n\n style.fontStyle = this.posture;\n style.fontSize = measureToString(0.99 * this.size);\n\n setFontFamily(this, this, this[$globalData].fontFinder, style);\n\n if (this.underline !== 0) {\n style.textDecoration = \"underline\";\n if (this.underline === 2) {\n style.textDecorationStyle = \"double\";\n }\n }\n\n // TODO: underlinePeriod\n\n style.fontWeight = this.weight;\n\n return style;\n }\n}\n\nclass Format extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"format\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.picture = null;\n }\n}\n\nclass Handler extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"handler\");\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Hyphenation extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"hyphenation\");\n this.excludeAllCaps = getInteger({\n data: attributes.excludeAllCaps,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.excludeInitialCap = getInteger({\n data: attributes.excludeInitialCap,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.hyphenate = getInteger({\n data: attributes.hyphenate,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.id = attributes.id || \"\";\n this.pushCharacterCount = getInteger({\n data: attributes.pushCharacterCount,\n defaultValue: 3,\n validate: x => x >= 0,\n });\n this.remainCharacterCount = getInteger({\n data: attributes.remainCharacterCount,\n defaultValue: 3,\n validate: x => x >= 0,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.wordCharacterCount = getInteger({\n data: attributes.wordCharacterCount,\n defaultValue: 7,\n validate: x => x >= 0,\n });\n }\n}\n\nclass Image extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"image\");\n this.aspect = getStringOption(attributes.aspect, [\n \"fit\",\n \"actual\",\n \"height\",\n \"none\",\n \"width\",\n ]);\n this.contentType = attributes.contentType || \"\";\n this.href = attributes.href || \"\";\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.transferEncoding = getStringOption(attributes.transferEncoding, [\n \"base64\",\n \"none\",\n \"package\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$toHTML]() {\n if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {\n return HTMLResult.EMPTY;\n }\n\n let buffer =\n this[$globalData].images && this[$globalData].images.get(this.href);\n if (!buffer && (this.href || !this[$content])) {\n // In general, we don't get remote data and use what we have\n // in the pdf itself, so no picture for non null href.\n return HTMLResult.EMPTY;\n }\n\n if (!buffer && this.transferEncoding === \"base64\") {\n buffer = stringToBytes(atob(this[$content]));\n }\n\n if (!buffer) {\n return HTMLResult.EMPTY;\n }\n\n if (!this.contentType) {\n for (const [header, type] of IMAGES_HEADERS) {\n if (\n buffer.length > header.length &&\n header.every((x, i) => x === buffer[i])\n ) {\n this.contentType = type;\n break;\n }\n }\n if (!this.contentType) {\n return HTMLResult.EMPTY;\n }\n }\n\n // TODO: Firefox doesn't support natively tiff (and tif) format.\n const blob = new Blob([buffer], { type: this.contentType });\n let style;\n switch (this.aspect) {\n case \"fit\":\n case \"actual\":\n // TODO: check what to do with actual.\n // Normally we should return {auto, auto} for it but\n // it implies some wrong rendering (see xfa_bug1716816.pdf).\n break;\n case \"height\":\n style = {\n height: \"100%\",\n objectFit: \"fill\",\n };\n break;\n case \"none\":\n style = {\n width: \"100%\",\n height: \"100%\",\n objectFit: \"fill\",\n };\n break;\n case \"width\":\n style = {\n width: \"100%\",\n objectFit: \"fill\",\n };\n break;\n }\n const parent = this[$getParent]();\n return HTMLResult.success({\n name: \"img\",\n attributes: {\n class: [\"xfaImage\"],\n style,\n src: URL.createObjectURL(blob),\n alt: parent ? ariaLabel(parent[$getParent]()) : null,\n },\n });\n }\n}\n\nclass ImageEdit extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"imageEdit\", /* hasChildren = */ true);\n this.data = getStringOption(attributes.data, [\"link\", \"embed\"]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.extras = null;\n this.margin = null;\n }\n\n [$toHTML](availableSpace) {\n if (this.data === \"embed\") {\n return HTMLResult.success({\n name: \"div\",\n children: [],\n attributes: {},\n });\n }\n\n return HTMLResult.EMPTY;\n }\n}\n\nclass Integer extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"integer\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n const number = parseInt(this[$content].trim(), 10);\n this[$content] = isNaN(number) ? null : number;\n }\n\n [$toHTML](availableSpace) {\n return valueToHtml(\n this[$content] !== null ? this[$content].toString() : \"\"\n );\n }\n}\n\nclass Issuers extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"issuers\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.certificate = new XFAObjectArray();\n }\n}\n\nclass Items extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"items\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.ref = attributes.ref || \"\";\n this.save = getInteger({\n data: attributes.save,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.boolean = new XFAObjectArray();\n this.date = new XFAObjectArray();\n this.dateTime = new XFAObjectArray();\n this.decimal = new XFAObjectArray();\n this.exData = new XFAObjectArray();\n this.float = new XFAObjectArray();\n this.image = new XFAObjectArray();\n this.integer = new XFAObjectArray();\n this.text = new XFAObjectArray();\n this.time = new XFAObjectArray();\n }\n\n [$toHTML]() {\n const output = [];\n for (const child of this[$getChildren]()) {\n output.push(child[$text]());\n }\n return HTMLResult.success(output);\n }\n}\n\nclass Keep extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"keep\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n const options = [\"none\", \"contentArea\", \"pageArea\"];\n this.intact = getStringOption(attributes.intact, options);\n this.next = getStringOption(attributes.next, options);\n this.previous = getStringOption(attributes.previous, options);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n }\n}\n\nclass KeyUsage extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"keyUsage\");\n const options = [\"\", \"yes\", \"no\"];\n this.crlSign = getStringOption(attributes.crlSign, options);\n this.dataEncipherment = getStringOption(\n attributes.dataEncipherment,\n options\n );\n this.decipherOnly = getStringOption(attributes.decipherOnly, options);\n this.digitalSignature = getStringOption(\n attributes.digitalSignature,\n options\n );\n this.encipherOnly = getStringOption(attributes.encipherOnly, options);\n this.id = attributes.id || \"\";\n this.keyAgreement = getStringOption(attributes.keyAgreement, options);\n this.keyCertSign = getStringOption(attributes.keyCertSign, options);\n this.keyEncipherment = getStringOption(attributes.keyEncipherment, options);\n this.nonRepudiation = getStringOption(attributes.nonRepudiation, options);\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Line extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"line\", /* hasChildren = */ true);\n this.hand = getStringOption(attributes.hand, [\"even\", \"left\", \"right\"]);\n this.id = attributes.id || \"\";\n this.slope = getStringOption(attributes.slope, [\"\\\\\", \"/\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.edge = null;\n }\n\n [$toHTML]() {\n const parent = this[$getParent]()[$getParent]();\n const edge = this.edge || new Edge({});\n const edgeStyle = edge[$toStyle]();\n const style = Object.create(null);\n const thickness = edge.presence === \"visible\" ? edge.thickness : 0;\n style.strokeWidth = measureToString(thickness);\n style.stroke = edgeStyle.color;\n let x1, y1, x2, y2;\n let width = \"100%\";\n let height = \"100%\";\n\n if (parent.w <= thickness) {\n [x1, y1, x2, y2] = [\"50%\", 0, \"50%\", \"100%\"];\n width = style.strokeWidth;\n } else if (parent.h <= thickness) {\n [x1, y1, x2, y2] = [0, \"50%\", \"100%\", \"50%\"];\n height = style.strokeWidth;\n } else if (this.slope === \"\\\\\") {\n [x1, y1, x2, y2] = [0, 0, \"100%\", \"100%\"];\n } else {\n [x1, y1, x2, y2] = [0, \"100%\", \"100%\", 0];\n }\n\n const line = {\n name: \"line\",\n attributes: {\n xmlns: SVG_NS,\n x1,\n y1,\n x2,\n y2,\n style,\n },\n };\n\n const svg = {\n name: \"svg\",\n children: [line],\n attributes: {\n xmlns: SVG_NS,\n width,\n height,\n style: {\n overflow: \"visible\",\n },\n },\n };\n\n if (hasMargin(parent)) {\n return HTMLResult.success({\n name: \"div\",\n attributes: {\n style: {\n display: \"inline\",\n width: \"100%\",\n height: \"100%\",\n },\n },\n children: [svg],\n });\n }\n\n svg.attributes.style.position = \"absolute\";\n return HTMLResult.success(svg);\n }\n}\n\nclass Linear extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"linear\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\n \"toRight\",\n \"toBottom\",\n \"toLeft\",\n \"toTop\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n }\n\n [$toStyle](startColor) {\n startColor = startColor ? startColor[$toStyle]() : \"#FFFFFF\";\n const transf = this.type.replace(/([RBLT])/, \" $1\").toLowerCase();\n const endColor = this.color ? this.color[$toStyle]() : \"#000000\";\n return `linear-gradient(${transf}, ${startColor}, ${endColor})`;\n }\n}\n\nclass LockDocument extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"lockDocument\");\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n this[$content] = getStringOption(this[$content], [\"auto\", \"0\", \"1\"]);\n }\n}\n\nclass Manifest extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"manifest\", /* hasChildren = */ true);\n this.action = getStringOption(attributes.action, [\n \"include\",\n \"all\",\n \"exclude\",\n ]);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.ref = new XFAObjectArray();\n }\n}\n\nclass Margin extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"margin\", /* hasChildren = */ true);\n this.bottomInset = getMeasurement(attributes.bottomInset, \"0\");\n this.id = attributes.id || \"\";\n this.leftInset = getMeasurement(attributes.leftInset, \"0\");\n this.rightInset = getMeasurement(attributes.rightInset, \"0\");\n this.topInset = getMeasurement(attributes.topInset, \"0\");\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n }\n\n [$toStyle]() {\n return {\n margin:\n measureToString(this.topInset) +\n \" \" +\n measureToString(this.rightInset) +\n \" \" +\n measureToString(this.bottomInset) +\n \" \" +\n measureToString(this.leftInset),\n };\n }\n}\n\nclass Mdp extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"mdp\");\n this.id = attributes.id || \"\";\n this.permissions = getInteger({\n data: attributes.permissions,\n defaultValue: 2,\n validate: x => x === 1 || x === 3,\n });\n this.signatureType = getStringOption(attributes.signatureType, [\n \"filler\",\n \"author\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Medium extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"medium\");\n this.id = attributes.id || \"\";\n this.imagingBBox = getBBox(attributes.imagingBBox);\n this.long = getMeasurement(attributes.long);\n this.orientation = getStringOption(attributes.orientation, [\n \"portrait\",\n \"landscape\",\n ]);\n this.short = getMeasurement(attributes.short);\n this.stock = attributes.stock || \"\";\n this.trayIn = getStringOption(attributes.trayIn, [\n \"auto\",\n \"delegate\",\n \"pageFront\",\n ]);\n this.trayOut = getStringOption(attributes.trayOut, [\"auto\", \"delegate\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Message extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"message\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.text = new XFAObjectArray();\n }\n}\n\nclass NumericEdit extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"numericEdit\", /* hasChildren = */ true);\n this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, [\n \"auto\",\n \"off\",\n \"on\",\n ]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.comb = null;\n this.extras = null;\n this.margin = null;\n }\n\n [$toHTML](availableSpace) {\n // TODO: incomplete.\n const style = toStyle(this, \"border\", \"font\", \"margin\");\n const field = this[$getParent]()[$getParent]();\n const html = {\n name: \"input\",\n attributes: {\n type: \"text\",\n fieldId: field[$uid],\n dataId: field[$data]?.[$uid] || field[$uid],\n class: [\"xfaTextfield\"],\n style,\n \"aria-label\": ariaLabel(field),\n \"aria-required\": false,\n },\n };\n\n if (isRequired(field)) {\n html.attributes[\"aria-required\"] = true;\n html.attributes.required = true;\n }\n\n return HTMLResult.success({\n name: \"label\",\n attributes: {\n class: [\"xfaLabel\"],\n },\n children: [html],\n });\n }\n}\n\nclass Occur extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"occur\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.initial =\n attributes.initial !== \"\"\n ? getInteger({\n data: attributes.initial,\n defaultValue: \"\",\n validate: x => true,\n })\n : \"\";\n this.max =\n attributes.max !== \"\"\n ? getInteger({\n data: attributes.max,\n defaultValue: 1,\n validate: x => true,\n })\n : \"\";\n this.min =\n attributes.min !== \"\"\n ? getInteger({\n data: attributes.min,\n defaultValue: 1,\n validate: x => true,\n })\n : \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n }\n\n [$clean]() {\n const parent = this[$getParent]();\n const originalMin = this.min;\n\n if (this.min === \"\") {\n this.min =\n parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;\n }\n if (this.max === \"\") {\n if (originalMin === \"\") {\n this.max =\n parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;\n } else {\n this.max = this.min;\n }\n }\n\n if (this.max !== -1 && this.max < this.min) {\n this.max = this.min;\n }\n\n if (this.initial === \"\") {\n this.initial = parent instanceof Template ? 1 : this.min;\n }\n }\n}\n\nclass Oid extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"oid\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Oids extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"oids\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.oid = new XFAObjectArray();\n }\n}\n\nclass Overflow extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"overflow\");\n this.id = attributes.id || \"\";\n this.leader = attributes.leader || \"\";\n this.target = attributes.target || \"\";\n this.trailer = attributes.trailer || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$getExtra]() {\n if (!this[$extra]) {\n const parent = this[$getParent]();\n const root = this[$getTemplateRoot]();\n const target = root[$searchNode](this.target, parent);\n const leader = root[$searchNode](this.leader, parent);\n const trailer = root[$searchNode](this.trailer, parent);\n this[$extra] = {\n target: target?.[0] || null,\n leader: leader?.[0] || null,\n trailer: trailer?.[0] || null,\n addLeader: false,\n addTrailer: false,\n };\n }\n return this[$extra];\n }\n}\n\nclass PageArea extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"pageArea\", /* hasChildren = */ true);\n this.blankOrNotBlank = getStringOption(attributes.blankOrNotBlank, [\n \"any\",\n \"blank\",\n \"notBlank\",\n ]);\n this.id = attributes.id || \"\";\n this.initialNumber = getInteger({\n data: attributes.initialNumber,\n defaultValue: 1,\n validate: x => true,\n });\n this.name = attributes.name || \"\";\n this.numbered = getInteger({\n data: attributes.numbered,\n defaultValue: 1,\n validate: x => true,\n });\n this.oddOrEven = getStringOption(attributes.oddOrEven, [\n \"any\",\n \"even\",\n \"odd\",\n ]);\n this.pagePosition = getStringOption(attributes.pagePosition, [\n \"any\",\n \"first\",\n \"last\",\n \"only\",\n \"rest\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.desc = null;\n this.extras = null;\n this.medium = null;\n this.occur = null;\n this.area = new XFAObjectArray();\n this.contentArea = new XFAObjectArray();\n this.draw = new XFAObjectArray();\n this.exclGroup = new XFAObjectArray();\n this.field = new XFAObjectArray();\n this.subform = new XFAObjectArray();\n }\n\n [$isUsable]() {\n if (!this[$extra]) {\n this[$extra] = {\n numberOfUse: 0,\n };\n return true;\n }\n return (\n !this.occur ||\n this.occur.max === -1 ||\n this[$extra].numberOfUse < this.occur.max\n );\n }\n\n [$cleanPage]() {\n delete this[$extra];\n }\n\n [$getNextPage]() {\n if (!this[$extra]) {\n this[$extra] = {\n numberOfUse: 0,\n };\n }\n\n const parent = this[$getParent]();\n if (parent.relation === \"orderedOccurrence\") {\n if (this[$isUsable]()) {\n this[$extra].numberOfUse += 1;\n return this;\n }\n }\n\n return parent[$getNextPage]();\n }\n\n [$getAvailableSpace]() {\n return this[$extra].space || { width: 0, height: 0 };\n }\n\n [$toHTML]() {\n // TODO: incomplete.\n if (!this[$extra]) {\n this[$extra] = {\n numberOfUse: 1,\n };\n }\n\n const children = [];\n this[$extra].children = children;\n\n const style = Object.create(null);\n if (this.medium && this.medium.short && this.medium.long) {\n style.width = measureToString(this.medium.short);\n style.height = measureToString(this.medium.long);\n this[$extra].space = {\n width: this.medium.short,\n height: this.medium.long,\n };\n if (this.medium.orientation === \"landscape\") {\n const x = style.width;\n style.width = style.height;\n style.height = x;\n this[$extra].space = {\n width: this.medium.long,\n height: this.medium.short,\n };\n }\n } else {\n warn(\"XFA - No medium specified in pageArea: please file a bug.\");\n }\n\n this[$childrenToHTML]({\n filter: new Set([\"area\", \"draw\", \"field\", \"subform\"]),\n include: true,\n });\n\n // contentarea must be the last container to be sure it is\n // on top of the others.\n this[$childrenToHTML]({\n filter: new Set([\"contentArea\"]),\n include: true,\n });\n\n return HTMLResult.success({\n name: \"div\",\n children,\n attributes: {\n class: [\"xfaPage\"],\n id: this[$uid],\n style,\n xfaName: this.name,\n },\n });\n }\n}\n\nclass PageSet extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"pageSet\", /* hasChildren = */ true);\n this.duplexImposition = getStringOption(attributes.duplexImposition, [\n \"longEdge\",\n \"shortEdge\",\n ]);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.relation = getStringOption(attributes.relation, [\n \"orderedOccurrence\",\n \"duplexPaginated\",\n \"simplexPaginated\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.occur = null;\n this.pageArea = new XFAObjectArray();\n this.pageSet = new XFAObjectArray();\n }\n\n [$cleanPage]() {\n for (const page of this.pageArea.children) {\n page[$cleanPage]();\n }\n for (const page of this.pageSet.children) {\n page[$cleanPage]();\n }\n }\n\n [$isUsable]() {\n return (\n !this.occur ||\n this.occur.max === -1 ||\n this[$extra].numberOfUse < this.occur.max\n );\n }\n\n [$getNextPage]() {\n if (!this[$extra]) {\n this[$extra] = {\n numberOfUse: 1,\n pageIndex: -1,\n pageSetIndex: -1,\n };\n }\n\n if (this.relation === \"orderedOccurrence\") {\n if (this[$extra].pageIndex + 1 < this.pageArea.children.length) {\n this[$extra].pageIndex += 1;\n const pageArea = this.pageArea.children[this[$extra].pageIndex];\n return pageArea[$getNextPage]();\n }\n\n if (this[$extra].pageSetIndex + 1 < this.pageSet.children.length) {\n this[$extra].pageSetIndex += 1;\n return this.pageSet.children[this[$extra].pageSetIndex][$getNextPage]();\n }\n\n if (this[$isUsable]()) {\n this[$extra].numberOfUse += 1;\n this[$extra].pageIndex = -1;\n this[$extra].pageSetIndex = -1;\n return this[$getNextPage]();\n }\n\n const parent = this[$getParent]();\n if (parent instanceof PageSet) {\n return parent[$getNextPage]();\n }\n\n this[$cleanPage]();\n return this[$getNextPage]();\n }\n const pageNumber = this[$getTemplateRoot]()[$extra].pageNumber;\n const parity = pageNumber % 2 === 0 ? \"even\" : \"odd\";\n const position = pageNumber === 0 ? \"first\" : \"rest\";\n\n let page = this.pageArea.children.find(\n p => p.oddOrEven === parity && p.pagePosition === position\n );\n if (page) {\n return page;\n }\n\n page = this.pageArea.children.find(\n p => p.oddOrEven === \"any\" && p.pagePosition === position\n );\n if (page) {\n return page;\n }\n\n page = this.pageArea.children.find(\n p => p.oddOrEven === \"any\" && p.pagePosition === \"any\"\n );\n if (page) {\n return page;\n }\n\n return this.pageArea.children[0];\n }\n}\n\nclass Para extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"para\", /* hasChildren = */ true);\n this.hAlign = getStringOption(attributes.hAlign, [\n \"left\",\n \"center\",\n \"justify\",\n \"justifyAll\",\n \"radix\",\n \"right\",\n ]);\n this.id = attributes.id || \"\";\n this.lineHeight = attributes.lineHeight\n ? getMeasurement(attributes.lineHeight, \"0pt\")\n : \"\";\n this.marginLeft = attributes.marginLeft\n ? getMeasurement(attributes.marginLeft, \"0pt\")\n : \"\";\n this.marginRight = attributes.marginRight\n ? getMeasurement(attributes.marginRight, \"0pt\")\n : \"\";\n this.orphans = getInteger({\n data: attributes.orphans,\n defaultValue: 0,\n validate: x => x >= 0,\n });\n this.preserve = attributes.preserve || \"\";\n this.radixOffset = attributes.radixOffset\n ? getMeasurement(attributes.radixOffset, \"0pt\")\n : \"\";\n this.spaceAbove = attributes.spaceAbove\n ? getMeasurement(attributes.spaceAbove, \"0pt\")\n : \"\";\n this.spaceBelow = attributes.spaceBelow\n ? getMeasurement(attributes.spaceBelow, \"0pt\")\n : \"\";\n this.tabDefault = attributes.tabDefault\n ? getMeasurement(this.tabDefault)\n : \"\";\n this.tabStops = (attributes.tabStops || \"\")\n .trim()\n .split(/\\s+/)\n .map((x, i) => (i % 2 === 1 ? getMeasurement(x) : x));\n this.textIndent = attributes.textIndent\n ? getMeasurement(attributes.textIndent, \"0pt\")\n : \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.vAlign = getStringOption(attributes.vAlign, [\n \"top\",\n \"bottom\",\n \"middle\",\n ]);\n this.widows = getInteger({\n data: attributes.widows,\n defaultValue: 0,\n validate: x => x >= 0,\n });\n this.hyphenation = null;\n }\n\n [$toStyle]() {\n const style = toStyle(this, \"hAlign\");\n if (this.marginLeft !== \"\") {\n style.paddingLeft = measureToString(this.marginLeft);\n }\n if (this.marginRight !== \"\") {\n style.paddingight = measureToString(this.marginRight);\n }\n if (this.spaceAbove !== \"\") {\n style.paddingTop = measureToString(this.spaceAbove);\n }\n if (this.spaceBelow !== \"\") {\n style.paddingBottom = measureToString(this.spaceBelow);\n }\n if (this.textIndent !== \"\") {\n style.textIndent = measureToString(this.textIndent);\n fixTextIndent(style);\n }\n\n if (this.lineHeight > 0) {\n style.lineHeight = measureToString(this.lineHeight);\n }\n\n if (this.tabDefault !== \"\") {\n style.tabSize = measureToString(this.tabDefault);\n }\n\n if (this.tabStops.length > 0) {\n // TODO\n }\n\n if (this.hyphenatation) {\n Object.assign(style, this.hyphenatation[$toStyle]());\n }\n\n return style;\n }\n}\n\nclass PasswordEdit extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"passwordEdit\", /* hasChildren = */ true);\n this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, [\n \"auto\",\n \"off\",\n \"on\",\n ]);\n this.id = attributes.id || \"\";\n this.passwordChar = attributes.passwordChar || \"*\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.extras = null;\n this.margin = null;\n }\n}\n\nclass Pattern extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"pattern\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\n \"crossHatch\",\n \"crossDiagonal\",\n \"diagonalLeft\",\n \"diagonalRight\",\n \"horizontal\",\n \"vertical\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n }\n\n [$toStyle](startColor) {\n startColor = startColor ? startColor[$toStyle]() : \"#FFFFFF\";\n const endColor = this.color ? this.color[$toStyle]() : \"#000000\";\n const width = 5;\n const cmd = \"repeating-linear-gradient\";\n const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${\n 2 * width\n }px`;\n switch (this.type) {\n case \"crossHatch\":\n return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;\n case \"crossDiagonal\":\n return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;\n case \"diagonalLeft\":\n return `${cmd}(45deg,${colors})`;\n case \"diagonalRight\":\n return `${cmd}(-45deg,${colors})`;\n case \"horizontal\":\n return `${cmd}(to top,${colors})`;\n case \"vertical\":\n return `${cmd}(to right,${colors})`;\n }\n\n return \"\";\n }\n}\n\nclass Picture extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"picture\");\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Proto extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"proto\", /* hasChildren = */ true);\n this.appearanceFilter = new XFAObjectArray();\n this.arc = new XFAObjectArray();\n this.area = new XFAObjectArray();\n this.assist = new XFAObjectArray();\n this.barcode = new XFAObjectArray();\n this.bindItems = new XFAObjectArray();\n this.bookend = new XFAObjectArray();\n this.boolean = new XFAObjectArray();\n this.border = new XFAObjectArray();\n this.break = new XFAObjectArray();\n this.breakAfter = new XFAObjectArray();\n this.breakBefore = new XFAObjectArray();\n this.button = new XFAObjectArray();\n this.calculate = new XFAObjectArray();\n this.caption = new XFAObjectArray();\n this.certificate = new XFAObjectArray();\n this.certificates = new XFAObjectArray();\n this.checkButton = new XFAObjectArray();\n this.choiceList = new XFAObjectArray();\n this.color = new XFAObjectArray();\n this.comb = new XFAObjectArray();\n this.connect = new XFAObjectArray();\n this.contentArea = new XFAObjectArray();\n this.corner = new XFAObjectArray();\n this.date = new XFAObjectArray();\n this.dateTime = new XFAObjectArray();\n this.dateTimeEdit = new XFAObjectArray();\n this.decimal = new XFAObjectArray();\n this.defaultUi = new XFAObjectArray();\n this.desc = new XFAObjectArray();\n this.digestMethod = new XFAObjectArray();\n this.digestMethods = new XFAObjectArray();\n this.draw = new XFAObjectArray();\n this.edge = new XFAObjectArray();\n this.encoding = new XFAObjectArray();\n this.encodings = new XFAObjectArray();\n this.encrypt = new XFAObjectArray();\n this.encryptData = new XFAObjectArray();\n this.encryption = new XFAObjectArray();\n this.encryptionMethod = new XFAObjectArray();\n this.encryptionMethods = new XFAObjectArray();\n this.event = new XFAObjectArray();\n this.exData = new XFAObjectArray();\n this.exObject = new XFAObjectArray();\n this.exclGroup = new XFAObjectArray();\n this.execute = new XFAObjectArray();\n this.extras = new XFAObjectArray();\n this.field = new XFAObjectArray();\n this.fill = new XFAObjectArray();\n this.filter = new XFAObjectArray();\n this.float = new XFAObjectArray();\n this.font = new XFAObjectArray();\n this.format = new XFAObjectArray();\n this.handler = new XFAObjectArray();\n this.hyphenation = new XFAObjectArray();\n this.image = new XFAObjectArray();\n this.imageEdit = new XFAObjectArray();\n this.integer = new XFAObjectArray();\n this.issuers = new XFAObjectArray();\n this.items = new XFAObjectArray();\n this.keep = new XFAObjectArray();\n this.keyUsage = new XFAObjectArray();\n this.line = new XFAObjectArray();\n this.linear = new XFAObjectArray();\n this.lockDocument = new XFAObjectArray();\n this.manifest = new XFAObjectArray();\n this.margin = new XFAObjectArray();\n this.mdp = new XFAObjectArray();\n this.medium = new XFAObjectArray();\n this.message = new XFAObjectArray();\n this.numericEdit = new XFAObjectArray();\n this.occur = new XFAObjectArray();\n this.oid = new XFAObjectArray();\n this.oids = new XFAObjectArray();\n this.overflow = new XFAObjectArray();\n this.pageArea = new XFAObjectArray();\n this.pageSet = new XFAObjectArray();\n this.para = new XFAObjectArray();\n this.passwordEdit = new XFAObjectArray();\n this.pattern = new XFAObjectArray();\n this.picture = new XFAObjectArray();\n this.radial = new XFAObjectArray();\n this.reason = new XFAObjectArray();\n this.reasons = new XFAObjectArray();\n this.rectangle = new XFAObjectArray();\n this.ref = new XFAObjectArray();\n this.script = new XFAObjectArray();\n this.setProperty = new XFAObjectArray();\n this.signData = new XFAObjectArray();\n this.signature = new XFAObjectArray();\n this.signing = new XFAObjectArray();\n this.solid = new XFAObjectArray();\n this.speak = new XFAObjectArray();\n this.stipple = new XFAObjectArray();\n this.subform = new XFAObjectArray();\n this.subformSet = new XFAObjectArray();\n this.subjectDN = new XFAObjectArray();\n this.subjectDNs = new XFAObjectArray();\n this.submit = new XFAObjectArray();\n this.text = new XFAObjectArray();\n this.textEdit = new XFAObjectArray();\n this.time = new XFAObjectArray();\n this.timeStamp = new XFAObjectArray();\n this.toolTip = new XFAObjectArray();\n this.traversal = new XFAObjectArray();\n this.traverse = new XFAObjectArray();\n this.ui = new XFAObjectArray();\n this.validate = new XFAObjectArray();\n this.value = new XFAObjectArray();\n this.variables = new XFAObjectArray();\n }\n}\n\nclass Radial extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"radial\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"toEdge\", \"toCenter\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n }\n\n [$toStyle](startColor) {\n startColor = startColor ? startColor[$toStyle]() : \"#FFFFFF\";\n const endColor = this.color ? this.color[$toStyle]() : \"#000000\";\n const colors =\n this.type === \"toEdge\"\n ? `${startColor},${endColor}`\n : `${endColor},${startColor}`;\n return `radial-gradient(circle at center, ${colors})`;\n }\n}\n\nclass Reason extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"reason\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Reasons extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"reasons\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.reason = new XFAObjectArray();\n }\n}\n\nclass Rectangle extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"rectangle\", /* hasChildren = */ true);\n this.hand = getStringOption(attributes.hand, [\"even\", \"left\", \"right\"]);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.corner = new XFAObjectArray(4);\n this.edge = new XFAObjectArray(4);\n this.fill = null;\n }\n\n [$toHTML]() {\n const edge = this.edge.children.length\n ? this.edge.children[0]\n : new Edge({});\n const edgeStyle = edge[$toStyle]();\n const style = Object.create(null);\n if (this.fill?.presence === \"visible\") {\n Object.assign(style, this.fill[$toStyle]());\n } else {\n style.fill = \"transparent\";\n }\n style.strokeWidth = measureToString(\n edge.presence === \"visible\" ? edge.thickness : 0\n );\n style.stroke = edgeStyle.color;\n\n const corner = this.corner.children.length\n ? this.corner.children[0]\n : new Corner({});\n const cornerStyle = corner[$toStyle]();\n\n const rect = {\n name: \"rect\",\n attributes: {\n xmlns: SVG_NS,\n width: \"100%\",\n height: \"100%\",\n x: 0,\n y: 0,\n rx: cornerStyle.radius,\n ry: cornerStyle.radius,\n style,\n },\n };\n\n const svg = {\n name: \"svg\",\n children: [rect],\n attributes: {\n xmlns: SVG_NS,\n style: {\n overflow: \"visible\",\n },\n width: \"100%\",\n height: \"100%\",\n },\n };\n\n const parent = this[$getParent]()[$getParent]();\n if (hasMargin(parent)) {\n return HTMLResult.success({\n name: \"div\",\n attributes: {\n style: {\n display: \"inline\",\n width: \"100%\",\n height: \"100%\",\n },\n },\n children: [svg],\n });\n }\n\n svg.attributes.style.position = \"absolute\";\n return HTMLResult.success(svg);\n }\n}\n\nclass RefElement extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"ref\");\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Script extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"script\");\n this.binding = attributes.binding || \"\";\n this.contentType = attributes.contentType || \"\";\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.runAt = getStringOption(attributes.runAt, [\n \"client\",\n \"both\",\n \"server\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass SetProperty extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"setProperty\");\n this.connection = attributes.connection || \"\";\n this.ref = attributes.ref || \"\";\n this.target = attributes.target || \"\";\n }\n}\n\nclass SignData extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"signData\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.operation = getStringOption(attributes.operation, [\n \"sign\",\n \"clear\",\n \"verify\",\n ]);\n this.ref = attributes.ref || \"\";\n this.target = attributes.target || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.filter = null;\n this.manifest = null;\n }\n}\n\nclass Signature extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"signature\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"PDF1.3\", \"PDF1.6\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.border = null;\n this.extras = null;\n this.filter = null;\n this.manifest = null;\n this.margin = null;\n }\n}\n\nclass Signing extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"signing\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.certificate = new XFAObjectArray();\n }\n}\n\nclass Solid extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"solid\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n }\n\n [$toStyle](startColor) {\n return startColor ? startColor[$toStyle]() : \"#FFFFFF\";\n }\n}\n\nclass Speak extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"speak\");\n this.disable = getInteger({\n data: attributes.disable,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.id = attributes.id || \"\";\n this.priority = getStringOption(attributes.priority, [\n \"custom\",\n \"caption\",\n \"name\",\n \"toolTip\",\n ]);\n this.rid = attributes.rid || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Stipple extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"stipple\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.rate = getInteger({\n data: attributes.rate,\n defaultValue: 50,\n validate: x => x >= 0 && x <= 100,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.color = null;\n this.extras = null;\n }\n\n [$toStyle](bgColor) {\n const alpha = this.rate / 100;\n return Util.makeHexColor(\n Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha),\n Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha),\n Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha)\n );\n }\n}\n\nclass Subform extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"subform\", /* hasChildren = */ true);\n this.access = getStringOption(attributes.access, [\n \"open\",\n \"nonInteractive\",\n \"protected\",\n \"readOnly\",\n ]);\n this.allowMacro = getInteger({\n data: attributes.allowMacro,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.anchorType = getStringOption(attributes.anchorType, [\n \"topLeft\",\n \"bottomCenter\",\n \"bottomLeft\",\n \"bottomRight\",\n \"middleCenter\",\n \"middleLeft\",\n \"middleRight\",\n \"topCenter\",\n \"topRight\",\n ]);\n this.colSpan = getInteger({\n data: attributes.colSpan,\n defaultValue: 1,\n validate: n => n >= 1 || n === -1,\n });\n this.columnWidths = (attributes.columnWidths || \"\")\n .trim()\n .split(/\\s+/)\n .map(x => (x === \"-1\" ? -1 : getMeasurement(x)));\n this.h = attributes.h ? getMeasurement(attributes.h) : \"\";\n this.hAlign = getStringOption(attributes.hAlign, [\n \"left\",\n \"center\",\n \"justify\",\n \"justifyAll\",\n \"radix\",\n \"right\",\n ]);\n this.id = attributes.id || \"\";\n this.layout = getStringOption(attributes.layout, [\n \"position\",\n \"lr-tb\",\n \"rl-row\",\n \"rl-tb\",\n \"row\",\n \"table\",\n \"tb\",\n ]);\n this.locale = attributes.locale || \"\";\n this.maxH = getMeasurement(attributes.maxH, \"0pt\");\n this.maxW = getMeasurement(attributes.maxW, \"0pt\");\n this.mergeMode = getStringOption(attributes.mergeMode, [\n \"consumeData\",\n \"matchTemplate\",\n ]);\n this.minH = getMeasurement(attributes.minH, \"0pt\");\n this.minW = getMeasurement(attributes.minW, \"0pt\");\n this.name = attributes.name || \"\";\n this.presence = getStringOption(attributes.presence, [\n \"visible\",\n \"hidden\",\n \"inactive\",\n \"invisible\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.restoreState = getStringOption(attributes.restoreState, [\n \"manual\",\n \"auto\",\n ]);\n this.scope = getStringOption(attributes.scope, [\"name\", \"none\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.w = attributes.w ? getMeasurement(attributes.w) : \"\";\n this.x = getMeasurement(attributes.x, \"0pt\");\n this.y = getMeasurement(attributes.y, \"0pt\");\n this.assist = null;\n this.bind = null;\n this.bookend = null;\n this.border = null;\n this.break = null;\n this.calculate = null;\n this.desc = null;\n this.extras = null;\n this.keep = null;\n this.margin = null;\n this.occur = null;\n this.overflow = null;\n this.pageSet = null;\n this.para = null;\n this.traversal = null;\n this.validate = null;\n this.variables = null;\n this.area = new XFAObjectArray();\n this.breakAfter = new XFAObjectArray();\n this.breakBefore = new XFAObjectArray();\n this.connect = new XFAObjectArray();\n this.draw = new XFAObjectArray();\n this.event = new XFAObjectArray();\n this.exObject = new XFAObjectArray();\n this.exclGroup = new XFAObjectArray();\n this.field = new XFAObjectArray();\n this.proto = new XFAObjectArray();\n this.setProperty = new XFAObjectArray();\n this.subform = new XFAObjectArray();\n this.subformSet = new XFAObjectArray();\n }\n\n [$getSubformParent]() {\n const parent = this[$getParent]();\n if (parent instanceof SubformSet) {\n return parent[$getSubformParent]();\n }\n return parent;\n }\n\n [$isBindable]() {\n return true;\n }\n\n [$isThereMoreWidth]() {\n return (\n (this.layout.endsWith(\"-tb\") &&\n this[$extra].attempt === 0 &&\n this[$extra].numberInLine > 0) ||\n this[$getParent]()[$isThereMoreWidth]()\n );\n }\n\n *[$getContainedChildren]() {\n // This function is overriden in order to fake that subforms under\n // this set are in fact under parent subform.\n yield* getContainedChildren(this);\n }\n\n [$flushHTML]() {\n return flushHTML(this);\n }\n\n [$addHTML](html, bbox) {\n addHTML(this, html, bbox);\n }\n\n [$getAvailableSpace]() {\n return getAvailableSpace(this);\n }\n\n [$isSplittable]() {\n // We cannot cache the result here because the contentArea\n // can change.\n const parent = this[$getSubformParent]();\n if (!parent[$isSplittable]()) {\n return false;\n }\n\n if (this[$extra]._isSplittable !== undefined) {\n return this[$extra]._isSplittable;\n }\n\n if (this.layout === \"position\" || this.layout.includes(\"row\")) {\n this[$extra]._isSplittable = false;\n return false;\n }\n\n if (this.keep && this.keep.intact !== \"none\") {\n this[$extra]._isSplittable = false;\n return false;\n }\n\n if (parent.layout?.endsWith(\"-tb\") && parent[$extra].numberInLine !== 0) {\n // If parent can fit in w=100 and there's already an element which takes\n // 90 then we've 10 for this element. Suppose this element has a tb layout\n // and 5 elements have a width of 7 and the 6th has a width of 20:\n // then this element (and all its content) must move on the next line.\n // If this element is splittable then the first 5 children will stay\n // at the end of the line: we don't want that.\n return false;\n }\n\n this[$extra]._isSplittable = true;\n\n return true;\n }\n\n [$toHTML](availableSpace) {\n setTabIndex(this);\n\n if (this.break) {\n // break element is deprecated so plug it on one of its replacement\n // breakBefore or breakAfter.\n if (this.break.after !== \"auto\" || this.break.afterTarget !== \"\") {\n const node = new BreakAfter({\n targetType: this.break.after,\n target: this.break.afterTarget,\n startNew: this.break.startNew.toString(),\n });\n node[$globalData] = this[$globalData];\n this[$appendChild](node);\n this.breakAfter.push(node);\n }\n\n if (this.break.before !== \"auto\" || this.break.beforeTarget !== \"\") {\n const node = new BreakBefore({\n targetType: this.break.before,\n target: this.break.beforeTarget,\n startNew: this.break.startNew.toString(),\n });\n node[$globalData] = this[$globalData];\n this[$appendChild](node);\n this.breakBefore.push(node);\n }\n\n if (this.break.overflowTarget !== \"\") {\n const node = new Overflow({\n target: this.break.overflowTarget,\n leader: this.break.overflowLeader,\n trailer: this.break.overflowTrailer,\n });\n node[$globalData] = this[$globalData];\n this[$appendChild](node);\n this.overflow.push(node);\n }\n\n this[$removeChild](this.break);\n this.break = null;\n }\n\n if (this.presence === \"hidden\" || this.presence === \"inactive\") {\n return HTMLResult.EMPTY;\n }\n\n if (\n this.breakBefore.children.length > 1 ||\n this.breakAfter.children.length > 1\n ) {\n // Specs are always talking about the breakBefore element\n // and it doesn't really make sense to have several ones.\n warn(\n \"XFA - Several breakBefore or breakAfter in subforms: please file a bug.\"\n );\n }\n\n if (this.breakBefore.children.length >= 1) {\n const breakBefore = this.breakBefore.children[0];\n if (handleBreak(breakBefore)) {\n return HTMLResult.breakNode(breakBefore);\n }\n }\n\n if (this[$extra]?.afterBreakAfter) {\n return HTMLResult.EMPTY;\n }\n\n // TODO: incomplete.\n fixDimensions(this);\n const children = [];\n const attributes = {\n id: this[$uid],\n class: [],\n };\n\n setAccess(this, attributes.class);\n\n if (!this[$extra]) {\n this[$extra] = Object.create(null);\n }\n\n Object.assign(this[$extra], {\n children,\n line: null,\n attributes,\n attempt: 0,\n numberInLine: 0,\n availableSpace: {\n width: Math.min(this.w || Infinity, availableSpace.width),\n height: Math.min(this.h || Infinity, availableSpace.height),\n },\n width: 0,\n height: 0,\n prevHeight: 0,\n currentWidth: 0,\n });\n\n const root = this[$getTemplateRoot]();\n const savedNoLayoutFailure = root[$extra].noLayoutFailure;\n\n const isSplittable = this[$isSplittable]();\n if (!isSplittable) {\n setFirstUnsplittable(this);\n }\n\n if (!checkDimensions(this, availableSpace)) {\n return HTMLResult.FAILURE;\n }\n\n const filter = new Set([\n \"area\",\n \"draw\",\n \"exclGroup\",\n \"field\",\n \"subform\",\n \"subformSet\",\n ]);\n\n if (this.layout.includes(\"row\")) {\n const columnWidths = this[$getSubformParent]().columnWidths;\n if (Array.isArray(columnWidths) && columnWidths.length > 0) {\n this[$extra].columnWidths = columnWidths;\n this[$extra].currentColumn = 0;\n }\n }\n\n const style = toStyle(\n this,\n \"anchorType\",\n \"dimensions\",\n \"position\",\n \"presence\",\n \"border\",\n \"margin\",\n \"hAlign\"\n );\n const classNames = [\"xfaSubform\"];\n const cl = layoutClass(this);\n if (cl) {\n classNames.push(cl);\n }\n\n attributes.style = style;\n attributes.class = classNames;\n\n if (this.name) {\n attributes.xfaName = this.name;\n }\n\n if (this.overflow) {\n const overflowExtra = this.overflow[$getExtra]();\n if (overflowExtra.addLeader) {\n overflowExtra.addLeader = false;\n handleOverflow(this, overflowExtra.leader, availableSpace);\n }\n }\n\n this[$pushPara]();\n const isLrTb = this.layout === \"lr-tb\" || this.layout === \"rl-tb\";\n const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;\n for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {\n if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {\n // If the layout is lr-tb then having attempt equals to\n // MAX_ATTEMPTS_FOR_LRTB_LAYOUT-1 means that we're trying to layout\n // on the next line so this on is empty.\n this[$extra].numberInLine = 0;\n }\n const result = this[$childrenToHTML]({\n filter,\n include: true,\n });\n if (result.success) {\n break;\n }\n if (result.isBreak()) {\n this[$popPara]();\n return result;\n }\n if (\n isLrTb &&\n this[$extra].attempt === 0 &&\n this[$extra].numberInLine === 0 &&\n !root[$extra].noLayoutFailure\n ) {\n // We're failing to put the first element on the line so no\n // need to test on the next line.\n // The goal is not only to avoid some useless checks but to avoid\n // bugs too: if a descendant managed to put a node and failed\n // on the next one, going to the next step here will imply to\n // visit the descendant again, clear [$extra].children and restart\n // on the failing node, consequently the first node just disappears\n // because it has never been flushed.\n this[$extra].attempt = maxRun;\n break;\n }\n }\n\n this[$popPara]();\n if (!isSplittable) {\n unsetFirstUnsplittable(this);\n }\n root[$extra].noLayoutFailure = savedNoLayoutFailure;\n\n if (this[$extra].attempt === maxRun) {\n if (this.overflow) {\n this[$getTemplateRoot]()[$extra].overflowNode = this.overflow;\n }\n\n if (!isSplittable) {\n // Since a new try will happen in a new container with maybe\n // new dimensions, we invalidate already layed out components.\n delete this[$extra];\n }\n return HTMLResult.FAILURE;\n }\n\n if (this.overflow) {\n const overflowExtra = this.overflow[$getExtra]();\n if (overflowExtra.addTrailer) {\n overflowExtra.addTrailer = false;\n handleOverflow(this, overflowExtra.trailer, availableSpace);\n }\n }\n\n let marginH = 0;\n let marginV = 0;\n if (this.margin) {\n marginH = this.margin.leftInset + this.margin.rightInset;\n marginV = this.margin.topInset + this.margin.bottomInset;\n }\n\n const width = Math.max(this[$extra].width + marginH, this.w || 0);\n const height = Math.max(this[$extra].height + marginV, this.h || 0);\n const bbox = [this.x, this.y, width, height];\n\n if (this.w === \"\") {\n style.width = measureToString(width);\n }\n if (this.h === \"\") {\n style.height = measureToString(height);\n }\n\n if (\n (style.width === \"0px\" || style.height === \"0px\") &&\n children.length === 0\n ) {\n return HTMLResult.EMPTY;\n }\n\n const html = {\n name: \"div\",\n attributes,\n children,\n };\n\n applyAssist(this, attributes);\n\n const result = HTMLResult.success(createWrapper(this, html), bbox);\n\n if (this.breakAfter.children.length >= 1) {\n const breakAfter = this.breakAfter.children[0];\n if (handleBreak(breakAfter)) {\n this[$extra].afterBreakAfter = result;\n return HTMLResult.breakNode(breakAfter);\n }\n }\n\n delete this[$extra];\n\n return result;\n }\n}\n\nclass SubformSet extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"subformSet\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.relation = getStringOption(attributes.relation, [\n \"ordered\",\n \"choice\",\n \"unordered\",\n ]);\n this.relevant = getRelevant(attributes.relevant);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.bookend = null;\n this.break = null;\n this.desc = null;\n this.extras = null;\n this.occur = null;\n this.overflow = null;\n this.breakAfter = new XFAObjectArray();\n this.breakBefore = new XFAObjectArray();\n this.subform = new XFAObjectArray();\n this.subformSet = new XFAObjectArray();\n\n // TODO: need to handle break stuff and relation.\n }\n\n *[$getContainedChildren]() {\n // This function is overriden in order to fake that subforms under\n // this set are in fact under parent subform.\n yield* getContainedChildren(this);\n }\n\n [$getSubformParent]() {\n let parent = this[$getParent]();\n while (!(parent instanceof Subform)) {\n parent = parent[$getParent]();\n }\n return parent;\n }\n\n [$isBindable]() {\n return true;\n }\n}\n\nclass SubjectDN extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"subjectDN\");\n this.delimiter = attributes.delimiter || \",\";\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n this[$content] = new Map(\n this[$content].split(this.delimiter).map(kv => {\n kv = kv.split(\"=\", 2);\n kv[0] = kv[0].trim();\n return kv;\n })\n );\n }\n}\n\nclass SubjectDNs extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"subjectDNs\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.subjectDN = new XFAObjectArray();\n }\n}\n\nclass Submit extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"submit\", /* hasChildren = */ true);\n this.embedPDF = getInteger({\n data: attributes.embedPDF,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.format = getStringOption(attributes.format, [\n \"xdp\",\n \"formdata\",\n \"pdf\",\n \"urlencoded\",\n \"xfd\",\n \"xml\",\n ]);\n this.id = attributes.id || \"\";\n this.target = attributes.target || \"\";\n this.textEncoding = getKeyword({\n data: attributes.textEncoding\n ? attributes.textEncoding.toLowerCase()\n : \"\",\n defaultValue: \"\",\n validate: k =>\n [\n \"utf-8\",\n \"big-five\",\n \"fontspecific\",\n \"gbk\",\n \"gb-18030\",\n \"gb-2312\",\n \"ksc-5601\",\n \"none\",\n \"shift-jis\",\n \"ucs-2\",\n \"utf-16\",\n ].includes(k) || k.match(/iso-8859-\\d{2}/),\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.xdpContent = attributes.xdpContent || \"\";\n this.encrypt = null;\n this.encryptData = new XFAObjectArray();\n this.signData = new XFAObjectArray();\n }\n}\n\nclass Template extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"template\", /* hasChildren = */ true);\n this.baseProfile = getStringOption(attributes.baseProfile, [\n \"full\",\n \"interactiveForms\",\n ]);\n this.extras = null;\n\n // Spec is unclear:\n // A container element that describes a single subform capable of\n // enclosing other containers.\n // Can we have more than one subform ?\n this.subform = new XFAObjectArray();\n }\n\n [$finalize]() {\n if (this.subform.children.length === 0) {\n warn(\"XFA - No subforms in template node.\");\n }\n if (this.subform.children.length >= 2) {\n warn(\"XFA - Several subforms in template node: please file a bug.\");\n }\n this[$tabIndex] = DEFAULT_TAB_INDEX;\n }\n\n [$isSplittable]() {\n return true;\n }\n\n [$searchNode](expr, container) {\n if (expr.startsWith(\"#\")) {\n // This is an id.\n return [this[$ids].get(expr.slice(1))];\n }\n return searchNode(this, container, expr, true, true);\n }\n\n /**\n * This function is a generator because the conversion into\n * pages is done asynchronously and we want to save the state\n * of the function where we were in the previous iteration.\n */\n *[$toPages]() {\n if (!this.subform.children.length) {\n return HTMLResult.success({\n name: \"div\",\n children: [],\n });\n }\n this[$extra] = {\n overflowNode: null,\n firstUnsplittable: null,\n currentContentArea: null,\n currentPageArea: null,\n noLayoutFailure: false,\n pageNumber: 1,\n pagePosition: \"first\",\n oddOrEven: \"odd\",\n blankOrNotBlank: \"nonBlank\",\n paraStack: [],\n };\n\n const root = this.subform.children[0];\n root.pageSet[$cleanPage]();\n\n const pageAreas = root.pageSet.pageArea.children;\n const mainHtml = {\n name: \"div\",\n children: [],\n };\n\n let pageArea = null;\n let breakBefore = null;\n let breakBeforeTarget = null;\n if (root.breakBefore.children.length >= 1) {\n breakBefore = root.breakBefore.children[0];\n breakBeforeTarget = breakBefore.target;\n } else if (\n root.subform.children.length >= 1 &&\n root.subform.children[0].breakBefore.children.length >= 1\n ) {\n breakBefore = root.subform.children[0].breakBefore.children[0];\n breakBeforeTarget = breakBefore.target;\n } else if (root.break?.beforeTarget) {\n breakBefore = root.break;\n breakBeforeTarget = breakBefore.beforeTarget;\n } else if (\n root.subform.children.length >= 1 &&\n root.subform.children[0].break?.beforeTarget\n ) {\n breakBefore = root.subform.children[0].break;\n breakBeforeTarget = breakBefore.beforeTarget;\n }\n\n if (breakBefore) {\n const target = this[$searchNode](\n breakBeforeTarget,\n breakBefore[$getParent]()\n );\n if (target instanceof PageArea) {\n pageArea = target;\n // Consume breakBefore.\n breakBefore[$extra] = {};\n }\n }\n\n if (!pageArea) {\n pageArea = pageAreas[0];\n }\n\n pageArea[$extra] = {\n numberOfUse: 1,\n };\n\n const pageAreaParent = pageArea[$getParent]();\n pageAreaParent[$extra] = {\n numberOfUse: 1,\n pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),\n pageSetIndex: 0,\n };\n\n let targetPageArea;\n let leader = null;\n let trailer = null;\n let hasSomething = true;\n let hasSomethingCounter = 0;\n let startIndex = 0;\n\n while (true) {\n if (!hasSomething) {\n mainHtml.children.pop();\n // Nothing has been added in the previous page\n if (++hasSomethingCounter === MAX_EMPTY_PAGES) {\n warn(\"XFA - Something goes wrong: please file a bug.\");\n return mainHtml;\n }\n } else {\n hasSomethingCounter = 0;\n }\n\n targetPageArea = null;\n this[$extra].currentPageArea = pageArea;\n const page = pageArea[$toHTML]().html;\n mainHtml.children.push(page);\n\n if (leader) {\n this[$extra].noLayoutFailure = true;\n page.children.push(leader[$toHTML](pageArea[$extra].space).html);\n leader = null;\n }\n\n if (trailer) {\n this[$extra].noLayoutFailure = true;\n page.children.push(trailer[$toHTML](pageArea[$extra].space).html);\n trailer = null;\n }\n\n const contentAreas = pageArea.contentArea.children;\n const htmlContentAreas = page.children.filter(node =>\n node.attributes.class.includes(\"xfaContentarea\")\n );\n\n hasSomething = false;\n this[$extra].firstUnsplittable = null;\n this[$extra].noLayoutFailure = false;\n\n const flush = index => {\n const html = root[$flushHTML]();\n if (html) {\n hasSomething ||= html.children?.length > 0;\n htmlContentAreas[index].children.push(html);\n }\n };\n\n for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {\n const contentArea = (this[$extra].currentContentArea = contentAreas[i]);\n const space = { width: contentArea.w, height: contentArea.h };\n startIndex = 0;\n\n if (leader) {\n htmlContentAreas[i].children.push(leader[$toHTML](space).html);\n leader = null;\n }\n\n if (trailer) {\n htmlContentAreas[i].children.push(trailer[$toHTML](space).html);\n trailer = null;\n }\n\n const html = root[$toHTML](space);\n if (html.success) {\n if (html.html) {\n hasSomething ||= html.html.children?.length > 0;\n htmlContentAreas[i].children.push(html.html);\n } else if (!hasSomething && mainHtml.children.length > 1) {\n mainHtml.children.pop();\n }\n return mainHtml;\n }\n\n if (html.isBreak()) {\n const node = html.breakNode;\n flush(i);\n\n if (node.targetType === \"auto\") {\n continue;\n }\n\n if (node.leader) {\n leader = this[$searchNode](node.leader, node[$getParent]());\n leader = leader ? leader[0] : null;\n }\n\n if (node.trailer) {\n trailer = this[$searchNode](node.trailer, node[$getParent]());\n trailer = trailer ? trailer[0] : null;\n }\n\n if (node.targetType === \"pageArea\") {\n targetPageArea = node[$extra].target;\n i = Infinity;\n } else if (!node[$extra].target) {\n // We stay on the same page.\n i = node[$extra].index;\n } else {\n targetPageArea = node[$extra].target;\n startIndex = node[$extra].index + 1;\n i = Infinity;\n }\n\n continue;\n }\n\n if (this[$extra].overflowNode) {\n const node = this[$extra].overflowNode;\n this[$extra].overflowNode = null;\n\n const overflowExtra = node[$getExtra]();\n const target = overflowExtra.target;\n overflowExtra.addLeader = overflowExtra.leader !== null;\n overflowExtra.addTrailer = overflowExtra.trailer !== null;\n\n flush(i);\n\n const currentIndex = i;\n\n i = Infinity;\n if (target instanceof PageArea) {\n // We must stop the contentAreas filling and go to the next page.\n targetPageArea = target;\n } else if (target instanceof ContentArea) {\n const index = contentAreas.indexOf(target);\n if (index !== -1) {\n if (index > currentIndex) {\n // In the next loop iteration `i` will be incremented, note the\n // `continue` just below, hence we need to subtract one here.\n i = index - 1;\n } else {\n // The targetted contentArea has already been filled\n // so create a new page.\n startIndex = index;\n }\n } else {\n targetPageArea = target[$getParent]();\n startIndex = targetPageArea.contentArea.children.indexOf(target);\n }\n }\n continue;\n }\n\n flush(i);\n }\n\n this[$extra].pageNumber += 1;\n if (targetPageArea) {\n if (targetPageArea[$isUsable]()) {\n targetPageArea[$extra].numberOfUse += 1;\n } else {\n targetPageArea = null;\n }\n }\n pageArea = targetPageArea || pageArea[$getNextPage]();\n yield null;\n }\n }\n}\n\nclass Text extends ContentObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"text\");\n this.id = attributes.id || \"\";\n this.maxChars = getInteger({\n data: attributes.maxChars,\n defaultValue: 0,\n validate: x => x >= 0,\n });\n this.name = attributes.name || \"\";\n this.rid = attributes.rid || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$acceptWhitespace]() {\n return true;\n }\n\n [$onChild](child) {\n if (child[$namespaceId] === NamespaceIds.xhtml.id) {\n this[$content] = child;\n return true;\n }\n warn(`XFA - Invalid content in Text: ${child[$nodeName]}.`);\n return false;\n }\n\n [$onText](str) {\n if (this[$content] instanceof XFAObject) {\n return;\n }\n super[$onText](str);\n }\n\n [$finalize]() {\n if (typeof this[$content] === \"string\") {\n this[$content] = this[$content].replaceAll(\"\\r\\n\", \"\\n\");\n }\n }\n\n [$getExtra]() {\n if (typeof this[$content] === \"string\") {\n return this[$content]\n .split(/[\\u2029\\u2028\\n]/)\n .reduce((acc, line) => {\n if (line) {\n acc.push(line);\n }\n return acc;\n }, [])\n .join(\"\\n\");\n }\n return this[$content][$text]();\n }\n\n [$toHTML](availableSpace) {\n if (typeof this[$content] === \"string\") {\n // \\u2028 is a line separator.\n // \\u2029 is a paragraph separator.\n const html = valueToHtml(this[$content]).html;\n\n if (this[$content].includes(\"\\u2029\")) {\n // We've plain text containing a paragraph separator\n // so convert it into a set of .\n html.name = \"div\";\n html.children = [];\n this[$content]\n .split(\"\\u2029\")\n .map(para =>\n // Convert a paragraph into a set of (for lines)\n // separated by
.\n para.split(/[\\u2028\\n]/).reduce((acc, line) => {\n acc.push(\n {\n name: \"span\",\n value: line,\n },\n {\n name: \"br\",\n }\n );\n return acc;\n }, [])\n )\n .forEach(lines => {\n html.children.push({\n name: \"p\",\n children: lines,\n });\n });\n } else if (/[\\u2028\\n]/.test(this[$content])) {\n html.name = \"div\";\n html.children = [];\n // Convert plain text into a set of (for lines)\n // separated by
.\n this[$content].split(/[\\u2028\\n]/).forEach(line => {\n html.children.push(\n {\n name: \"span\",\n value: line,\n },\n {\n name: \"br\",\n }\n );\n });\n }\n\n return HTMLResult.success(html);\n }\n\n return this[$content][$toHTML](availableSpace);\n }\n}\n\nclass TextEdit extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"textEdit\", /* hasChildren = */ true);\n this.allowRichText = getInteger({\n data: attributes.allowRichText,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, [\n \"auto\",\n \"off\",\n \"on\",\n ]);\n this.id = attributes.id || \"\";\n this.multiLine = getInteger({\n data: attributes.multiLine,\n defaultValue: \"\",\n validate: x => x === 0 || x === 1,\n });\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.vScrollPolicy = getStringOption(attributes.vScrollPolicy, [\n \"auto\",\n \"off\",\n \"on\",\n ]);\n this.border = null;\n this.comb = null;\n this.extras = null;\n this.margin = null;\n }\n\n [$toHTML](availableSpace) {\n // TODO: incomplete.\n const style = toStyle(this, \"border\", \"font\", \"margin\");\n let html;\n const field = this[$getParent]()[$getParent]();\n if (this.multiLine === \"\") {\n this.multiLine = field instanceof Draw ? 1 : 0;\n }\n if (this.multiLine === 1) {\n html = {\n name: \"textarea\",\n attributes: {\n dataId: field[$data]?.[$uid] || field[$uid],\n fieldId: field[$uid],\n class: [\"xfaTextfield\"],\n style,\n \"aria-label\": ariaLabel(field),\n \"aria-required\": false,\n },\n };\n } else {\n html = {\n name: \"input\",\n attributes: {\n type: \"text\",\n dataId: field[$data]?.[$uid] || field[$uid],\n fieldId: field[$uid],\n class: [\"xfaTextfield\"],\n style,\n \"aria-label\": ariaLabel(field),\n \"aria-required\": false,\n },\n };\n }\n\n if (isRequired(field)) {\n html.attributes[\"aria-required\"] = true;\n html.attributes.required = true;\n }\n\n return HTMLResult.success({\n name: \"label\",\n attributes: {\n class: [\"xfaLabel\"],\n },\n children: [html],\n });\n }\n}\n\nclass Time extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"time\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n\n [$finalize]() {\n // TODO: need to handle the string as a time and not as a date.\n const date = this[$content].trim();\n this[$content] = date ? new Date(date) : null;\n }\n\n [$toHTML](availableSpace) {\n return valueToHtml(this[$content] ? this[$content].toString() : \"\");\n }\n}\n\nclass TimeStamp extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"timeStamp\");\n this.id = attributes.id || \"\";\n this.server = attributes.server || \"\";\n this.type = getStringOption(attributes.type, [\"optional\", \"required\"]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass ToolTip extends StringObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"toolTip\");\n this.id = attributes.id || \"\";\n this.rid = attributes.rid || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Traversal extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"traversal\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.traverse = new XFAObjectArray();\n }\n}\n\nclass Traverse extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"traverse\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.operation = getStringOption(attributes.operation, [\n \"next\",\n \"back\",\n \"down\",\n \"first\",\n \"left\",\n \"right\",\n \"up\",\n ]);\n this.ref = attributes.ref || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.script = null;\n }\n\n get name() {\n // SOM expression: see page 94\n return this.operation;\n }\n\n [$isTransparent]() {\n return false;\n }\n}\n\nclass Ui extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"ui\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.picture = null;\n\n // One-of properties\n this.barcode = null;\n this.button = null;\n this.checkButton = null;\n this.choiceList = null;\n this.dateTimeEdit = null;\n this.defaultUi = null;\n this.imageEdit = null;\n this.numericEdit = null;\n this.passwordEdit = null;\n this.signature = null;\n this.textEdit = null;\n }\n\n [$getExtra]() {\n if (this[$extra] === undefined) {\n for (const name of Object.getOwnPropertyNames(this)) {\n if (name === \"extras\" || name === \"picture\") {\n continue;\n }\n const obj = this[name];\n if (!(obj instanceof XFAObject)) {\n continue;\n }\n\n this[$extra] = obj;\n return obj;\n }\n this[$extra] = null;\n }\n return this[$extra];\n }\n\n [$toHTML](availableSpace) {\n // TODO: picture.\n const obj = this[$getExtra]();\n if (obj) {\n return obj[$toHTML](availableSpace);\n }\n return HTMLResult.EMPTY;\n }\n}\n\nclass Validate extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"validate\", /* hasChildren = */ true);\n this.formatTest = getStringOption(attributes.formatTest, [\n \"warning\",\n \"disabled\",\n \"error\",\n ]);\n this.id = attributes.id || \"\";\n this.nullTest = getStringOption(attributes.nullTest, [\n \"disabled\",\n \"error\",\n \"warning\",\n ]);\n this.scriptTest = getStringOption(attributes.scriptTest, [\n \"error\",\n \"disabled\",\n \"warning\",\n ]);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.extras = null;\n this.message = null;\n this.picture = null;\n this.script = null;\n }\n}\n\nclass Value extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"value\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.override = getInteger({\n data: attributes.override,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.relevant = getRelevant(attributes.relevant);\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n\n // One-of properties\n this.arc = null;\n this.boolean = null;\n this.date = null;\n this.dateTime = null;\n this.decimal = null;\n this.exData = null;\n this.float = null;\n this.image = null;\n this.integer = null;\n this.line = null;\n this.rectangle = null;\n this.text = null;\n this.time = null;\n }\n\n [$setValue](value) {\n const parent = this[$getParent]();\n if (parent instanceof Field) {\n if (parent.ui?.imageEdit) {\n if (!this.image) {\n this.image = new Image({});\n this[$appendChild](this.image);\n }\n this.image[$content] = value[$content];\n return;\n }\n }\n\n const valueName = value[$nodeName];\n if (this[valueName] !== null) {\n this[valueName][$content] = value[$content];\n return;\n }\n\n // Reset all the properties.\n for (const name of Object.getOwnPropertyNames(this)) {\n const obj = this[name];\n if (obj instanceof XFAObject) {\n this[name] = null;\n this[$removeChild](obj);\n }\n }\n\n this[value[$nodeName]] = value;\n this[$appendChild](value);\n }\n\n [$text]() {\n if (this.exData) {\n if (typeof this.exData[$content] === \"string\") {\n return this.exData[$content].trim();\n }\n return this.exData[$content][$text]().trim();\n }\n for (const name of Object.getOwnPropertyNames(this)) {\n if (name === \"image\") {\n continue;\n }\n const obj = this[name];\n if (obj instanceof XFAObject) {\n return (obj[$content] || \"\").toString().trim();\n }\n }\n return null;\n }\n\n [$toHTML](availableSpace) {\n for (const name of Object.getOwnPropertyNames(this)) {\n const obj = this[name];\n if (!(obj instanceof XFAObject)) {\n continue;\n }\n\n return obj[$toHTML](availableSpace);\n }\n\n return HTMLResult.EMPTY;\n }\n}\n\nclass Variables extends XFAObject {\n constructor(attributes) {\n super(TEMPLATE_NS_ID, \"variables\", /* hasChildren = */ true);\n this.id = attributes.id || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n this.boolean = new XFAObjectArray();\n this.date = new XFAObjectArray();\n this.dateTime = new XFAObjectArray();\n this.decimal = new XFAObjectArray();\n this.exData = new XFAObjectArray();\n this.float = new XFAObjectArray();\n this.image = new XFAObjectArray();\n this.integer = new XFAObjectArray();\n this.manifest = new XFAObjectArray();\n this.script = new XFAObjectArray();\n this.text = new XFAObjectArray();\n this.time = new XFAObjectArray();\n }\n\n [$isTransparent]() {\n return true;\n }\n}\n\nclass TemplateNamespace {\n static [$buildXFAObject](name, attributes) {\n if (TemplateNamespace.hasOwnProperty(name)) {\n const node = TemplateNamespace[name](attributes);\n node[$setSetAttributes](attributes);\n return node;\n }\n return undefined;\n }\n\n static appearanceFilter(attrs) {\n return new AppearanceFilter(attrs);\n }\n\n static arc(attrs) {\n return new Arc(attrs);\n }\n\n static area(attrs) {\n return new Area(attrs);\n }\n\n static assist(attrs) {\n return new Assist(attrs);\n }\n\n static barcode(attrs) {\n return new Barcode(attrs);\n }\n\n static bind(attrs) {\n return new Bind(attrs);\n }\n\n static bindItems(attrs) {\n return new BindItems(attrs);\n }\n\n static bookend(attrs) {\n return new Bookend(attrs);\n }\n\n static boolean(attrs) {\n return new BooleanElement(attrs);\n }\n\n static border(attrs) {\n return new Border(attrs);\n }\n\n static break(attrs) {\n return new Break(attrs);\n }\n\n static breakAfter(attrs) {\n return new BreakAfter(attrs);\n }\n\n static breakBefore(attrs) {\n return new BreakBefore(attrs);\n }\n\n static button(attrs) {\n return new Button(attrs);\n }\n\n static calculate(attrs) {\n return new Calculate(attrs);\n }\n\n static caption(attrs) {\n return new Caption(attrs);\n }\n\n static certificate(attrs) {\n return new Certificate(attrs);\n }\n\n static certificates(attrs) {\n return new Certificates(attrs);\n }\n\n static checkButton(attrs) {\n return new CheckButton(attrs);\n }\n\n static choiceList(attrs) {\n return new ChoiceList(attrs);\n }\n\n static color(attrs) {\n return new Color(attrs);\n }\n\n static comb(attrs) {\n return new Comb(attrs);\n }\n\n static connect(attrs) {\n return new Connect(attrs);\n }\n\n static contentArea(attrs) {\n return new ContentArea(attrs);\n }\n\n static corner(attrs) {\n return new Corner(attrs);\n }\n\n static date(attrs) {\n return new DateElement(attrs);\n }\n\n static dateTime(attrs) {\n return new DateTime(attrs);\n }\n\n static dateTimeEdit(attrs) {\n return new DateTimeEdit(attrs);\n }\n\n static decimal(attrs) {\n return new Decimal(attrs);\n }\n\n static defaultUi(attrs) {\n return new DefaultUi(attrs);\n }\n\n static desc(attrs) {\n return new Desc(attrs);\n }\n\n static digestMethod(attrs) {\n return new DigestMethod(attrs);\n }\n\n static digestMethods(attrs) {\n return new DigestMethods(attrs);\n }\n\n static draw(attrs) {\n return new Draw(attrs);\n }\n\n static edge(attrs) {\n return new Edge(attrs);\n }\n\n static encoding(attrs) {\n return new Encoding(attrs);\n }\n\n static encodings(attrs) {\n return new Encodings(attrs);\n }\n\n static encrypt(attrs) {\n return new Encrypt(attrs);\n }\n\n static encryptData(attrs) {\n return new EncryptData(attrs);\n }\n\n static encryption(attrs) {\n return new Encryption(attrs);\n }\n\n static encryptionMethod(attrs) {\n return new EncryptionMethod(attrs);\n }\n\n static encryptionMethods(attrs) {\n return new EncryptionMethods(attrs);\n }\n\n static event(attrs) {\n return new Event(attrs);\n }\n\n static exData(attrs) {\n return new ExData(attrs);\n }\n\n static exObject(attrs) {\n return new ExObject(attrs);\n }\n\n static exclGroup(attrs) {\n return new ExclGroup(attrs);\n }\n\n static execute(attrs) {\n return new Execute(attrs);\n }\n\n static extras(attrs) {\n return new Extras(attrs);\n }\n\n static field(attrs) {\n return new Field(attrs);\n }\n\n static fill(attrs) {\n return new Fill(attrs);\n }\n\n static filter(attrs) {\n return new Filter(attrs);\n }\n\n static float(attrs) {\n return new Float(attrs);\n }\n\n static font(attrs) {\n return new Font(attrs);\n }\n\n static format(attrs) {\n return new Format(attrs);\n }\n\n static handler(attrs) {\n return new Handler(attrs);\n }\n\n static hyphenation(attrs) {\n return new Hyphenation(attrs);\n }\n\n static image(attrs) {\n return new Image(attrs);\n }\n\n static imageEdit(attrs) {\n return new ImageEdit(attrs);\n }\n\n static integer(attrs) {\n return new Integer(attrs);\n }\n\n static issuers(attrs) {\n return new Issuers(attrs);\n }\n\n static items(attrs) {\n return new Items(attrs);\n }\n\n static keep(attrs) {\n return new Keep(attrs);\n }\n\n static keyUsage(attrs) {\n return new KeyUsage(attrs);\n }\n\n static line(attrs) {\n return new Line(attrs);\n }\n\n static linear(attrs) {\n return new Linear(attrs);\n }\n\n static lockDocument(attrs) {\n return new LockDocument(attrs);\n }\n\n static manifest(attrs) {\n return new Manifest(attrs);\n }\n\n static margin(attrs) {\n return new Margin(attrs);\n }\n\n static mdp(attrs) {\n return new Mdp(attrs);\n }\n\n static medium(attrs) {\n return new Medium(attrs);\n }\n\n static message(attrs) {\n return new Message(attrs);\n }\n\n static numericEdit(attrs) {\n return new NumericEdit(attrs);\n }\n\n static occur(attrs) {\n return new Occur(attrs);\n }\n\n static oid(attrs) {\n return new Oid(attrs);\n }\n\n static oids(attrs) {\n return new Oids(attrs);\n }\n\n static overflow(attrs) {\n return new Overflow(attrs);\n }\n\n static pageArea(attrs) {\n return new PageArea(attrs);\n }\n\n static pageSet(attrs) {\n return new PageSet(attrs);\n }\n\n static para(attrs) {\n return new Para(attrs);\n }\n\n static passwordEdit(attrs) {\n return new PasswordEdit(attrs);\n }\n\n static pattern(attrs) {\n return new Pattern(attrs);\n }\n\n static picture(attrs) {\n return new Picture(attrs);\n }\n\n static proto(attrs) {\n return new Proto(attrs);\n }\n\n static radial(attrs) {\n return new Radial(attrs);\n }\n\n static reason(attrs) {\n return new Reason(attrs);\n }\n\n static reasons(attrs) {\n return new Reasons(attrs);\n }\n\n static rectangle(attrs) {\n return new Rectangle(attrs);\n }\n\n static ref(attrs) {\n return new RefElement(attrs);\n }\n\n static script(attrs) {\n return new Script(attrs);\n }\n\n static setProperty(attrs) {\n return new SetProperty(attrs);\n }\n\n static signData(attrs) {\n return new SignData(attrs);\n }\n\n static signature(attrs) {\n return new Signature(attrs);\n }\n\n static signing(attrs) {\n return new Signing(attrs);\n }\n\n static solid(attrs) {\n return new Solid(attrs);\n }\n\n static speak(attrs) {\n return new Speak(attrs);\n }\n\n static stipple(attrs) {\n return new Stipple(attrs);\n }\n\n static subform(attrs) {\n return new Subform(attrs);\n }\n\n static subformSet(attrs) {\n return new SubformSet(attrs);\n }\n\n static subjectDN(attrs) {\n return new SubjectDN(attrs);\n }\n\n static subjectDNs(attrs) {\n return new SubjectDNs(attrs);\n }\n\n static submit(attrs) {\n return new Submit(attrs);\n }\n\n static template(attrs) {\n return new Template(attrs);\n }\n\n static text(attrs) {\n return new Text(attrs);\n }\n\n static textEdit(attrs) {\n return new TextEdit(attrs);\n }\n\n static time(attrs) {\n return new Time(attrs);\n }\n\n static timeStamp(attrs) {\n return new TimeStamp(attrs);\n }\n\n static toolTip(attrs) {\n return new ToolTip(attrs);\n }\n\n static traversal(attrs) {\n return new Traversal(attrs);\n }\n\n static traverse(attrs) {\n return new Traverse(attrs);\n }\n\n static ui(attrs) {\n return new Ui(attrs);\n }\n\n static validate(attrs) {\n return new Validate(attrs);\n }\n\n static value(attrs) {\n return new Value(attrs);\n }\n\n static variables(attrs) {\n return new Variables(attrs);\n }\n}\n\nexport {\n BindItems,\n Field,\n Items,\n SetProperty,\n Template,\n TemplateNamespace,\n Text,\n Value,\n};\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst $buildXFAObject = Symbol();\n\nconst NamespaceIds = {\n config: {\n id: 0,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xci/\"),\n },\n connectionSet: {\n id: 1,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xfa-connection-set/\"),\n },\n datasets: {\n id: 2,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xfa-data/\"),\n },\n form: {\n id: 3,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xfa-form/\"),\n },\n localeSet: {\n id: 4,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xfa-locale-set/\"),\n },\n pdf: {\n id: 5,\n check: ns => ns === \"http://ns.adobe.com/xdp/pdf/\",\n },\n signature: {\n id: 6,\n check: ns => ns === \"http://www.w3.org/2000/09/xmldsig#\",\n },\n sourceSet: {\n id: 7,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xfa-source-set/\"),\n },\n stylesheet: {\n id: 8,\n check: ns => ns === \"http://www.w3.org/1999/XSL/Transform\",\n },\n template: {\n id: 9,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xfa-template/\"),\n },\n xdc: {\n id: 10,\n check: ns => ns.startsWith(\"http://www.xfa.org/schema/xdc/\"),\n },\n xdp: {\n id: 11,\n check: ns => ns === \"http://ns.adobe.com/xdp/\",\n },\n xfdf: {\n id: 12,\n check: ns => ns === \"http://ns.adobe.com/xfdf/\",\n },\n xhtml: {\n id: 13,\n check: ns => ns === \"http://www.w3.org/1999/xhtml\",\n },\n xmpmeta: {\n id: 14,\n check: ns => ns === \"http://ns.adobe.com/xmpmeta/\",\n },\n};\n\nexport { $buildXFAObject, NamespaceIds };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $extra,\n $flushHTML,\n $getSubformParent,\n $getTemplateRoot,\n $isSplittable,\n $isThereMoreWidth,\n} from \"./symbol_utils.js\";\nimport { measureToString } from \"./html_utils.js\";\n\n// Subform and ExclGroup have a layout so they share these functions.\n\n/**\n * How layout works ?\n *\n * A container has an initial space (with a width and a height) to fit in,\n * which means that once all the children have been added then\n * the total width/height must be lower than the given ones in\n * the initial space.\n * So if the container has known dimensions and these ones are ok with the\n * space then continue else we return HTMLResult.FAILURE: it's up to the\n * parent to deal with this failure (e.g. if parent layout is lr-tb and\n * we fail to add a child at end of line (lr) then we try to add it on the\n * next line).\n * And then we run through the children, each child gets its initial space\n * in calling its parent $getAvailableSpace method\n * (see _filteredChildrenGenerator and $childrenToHTML in xfa_object.js)\n * then we try to layout child in its space. If everything is ok then we add\n * the result to its parent through $addHTML which will recompute the available\n * space in parent according to its layout property else we return\n * HTMLResult.Failure.\n * Before a failure some children may have been layed out: they've been saved in\n * [$extra].children and [$extra] has properties generator and failingNode\n * in order to save the state where we were before a failure.\n * This [$extra].children property is useful when a container has to be splited.\n * So if a container is unbreakable, we must delete its [$extra] property before\n * returning.\n */\n\nfunction createLine(node, children) {\n return {\n name: \"div\",\n attributes: {\n class: [node.layout === \"lr-tb\" ? \"xfaLr\" : \"xfaRl\"],\n },\n children,\n };\n}\n\nfunction flushHTML(node) {\n if (!node[$extra]) {\n return null;\n }\n\n const attributes = node[$extra].attributes;\n const html = {\n name: \"div\",\n attributes,\n children: node[$extra].children,\n };\n\n if (node[$extra].failingNode) {\n const htmlFromFailing = node[$extra].failingNode[$flushHTML]();\n if (htmlFromFailing) {\n if (node.layout.endsWith(\"-tb\")) {\n html.children.push(createLine(node, [htmlFromFailing]));\n } else {\n html.children.push(htmlFromFailing);\n }\n }\n }\n\n if (html.children.length === 0) {\n return null;\n }\n\n return html;\n}\n\nfunction addHTML(node, html, bbox) {\n const extra = node[$extra];\n const availableSpace = extra.availableSpace;\n\n const [x, y, w, h] = bbox;\n switch (node.layout) {\n case \"position\": {\n extra.width = Math.max(extra.width, x + w);\n extra.height = Math.max(extra.height, y + h);\n extra.children.push(html);\n break;\n }\n case \"lr-tb\":\n case \"rl-tb\":\n if (!extra.line || extra.attempt === 1) {\n extra.line = createLine(node, []);\n extra.children.push(extra.line);\n extra.numberInLine = 0;\n }\n\n extra.numberInLine += 1;\n extra.line.children.push(html);\n\n if (extra.attempt === 0) {\n // Add the element on the line\n extra.currentWidth += w;\n extra.height = Math.max(extra.height, extra.prevHeight + h);\n } else {\n extra.currentWidth = w;\n extra.prevHeight = extra.height;\n extra.height += h;\n\n // The element has been added on a new line so switch to line mode now.\n extra.attempt = 0;\n }\n extra.width = Math.max(extra.width, extra.currentWidth);\n break;\n case \"rl-row\":\n case \"row\": {\n extra.children.push(html);\n extra.width += w;\n extra.height = Math.max(extra.height, h);\n const height = measureToString(extra.height);\n for (const child of extra.children) {\n child.attributes.style.height = height;\n }\n break;\n }\n case \"table\": {\n extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));\n extra.height += h;\n extra.children.push(html);\n break;\n }\n case \"tb\": {\n // Even if the subform can possibly take all the available width,\n // we must compute the final width as it is in order to be able\n // for example to center the subform within its parent.\n extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));\n extra.height += h;\n extra.children.push(html);\n break;\n }\n }\n}\n\nfunction getAvailableSpace(node) {\n const availableSpace = node[$extra].availableSpace;\n const marginV = node.margin\n ? node.margin.topInset + node.margin.bottomInset\n : 0;\n const marginH = node.margin\n ? node.margin.leftInset + node.margin.rightInset\n : 0;\n\n switch (node.layout) {\n case \"lr-tb\":\n case \"rl-tb\":\n if (node[$extra].attempt === 0) {\n return {\n width: availableSpace.width - marginH - node[$extra].currentWidth,\n height: availableSpace.height - marginV - node[$extra].prevHeight,\n };\n }\n return {\n width: availableSpace.width - marginH,\n height: availableSpace.height - marginV - node[$extra].height,\n };\n case \"rl-row\":\n case \"row\":\n const width = node[$extra].columnWidths\n .slice(node[$extra].currentColumn)\n .reduce((a, x) => a + x);\n return { width, height: availableSpace.height - marginH };\n case \"table\":\n case \"tb\":\n return {\n width: availableSpace.width - marginH,\n height: availableSpace.height - marginV - node[$extra].height,\n };\n case \"position\":\n default:\n return availableSpace;\n }\n}\n\nfunction getTransformedBBox(node) {\n // Take into account rotation and anchor to get the real bounding box.\n let w = node.w === \"\" ? NaN : node.w;\n let h = node.h === \"\" ? NaN : node.h;\n let [centerX, centerY] = [0, 0];\n switch (node.anchorType || \"\") {\n case \"bottomCenter\":\n [centerX, centerY] = [w / 2, h];\n break;\n case \"bottomLeft\":\n [centerX, centerY] = [0, h];\n break;\n case \"bottomRight\":\n [centerX, centerY] = [w, h];\n break;\n case \"middleCenter\":\n [centerX, centerY] = [w / 2, h / 2];\n break;\n case \"middleLeft\":\n [centerX, centerY] = [0, h / 2];\n break;\n case \"middleRight\":\n [centerX, centerY] = [w, h / 2];\n break;\n case \"topCenter\":\n [centerX, centerY] = [w / 2, 0];\n break;\n case \"topRight\":\n [centerX, centerY] = [w, 0];\n break;\n }\n\n let x, y;\n switch (node.rotate || 0) {\n case 0:\n [x, y] = [-centerX, -centerY];\n break;\n case 90:\n [x, y] = [-centerY, centerX];\n [w, h] = [h, -w];\n break;\n case 180:\n [x, y] = [centerX, centerY];\n [w, h] = [-w, -h];\n break;\n case 270:\n [x, y] = [centerY, -centerX];\n [w, h] = [-h, w];\n break;\n }\n\n return [\n node.x + x + Math.min(0, w),\n node.y + y + Math.min(0, h),\n Math.abs(w),\n Math.abs(h),\n ];\n}\n\n/**\n * Returning true means that the node will be layed out\n * else the layout will go to its next step (changing of line\n * in case of lr-tb or changing content area...).\n */\nfunction checkDimensions(node, space) {\n if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) {\n return true;\n }\n\n if (node.w === 0 || node.h === 0) {\n return true;\n }\n\n const ERROR = 2;\n const parent = node[$getSubformParent]();\n const attempt = parent[$extra]?.attempt || 0;\n\n const [, y, w, h] = getTransformedBBox(node);\n switch (parent.layout) {\n case \"lr-tb\":\n case \"rl-tb\":\n if (attempt === 0) {\n // Try to put an element in the line.\n\n if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) {\n if (node.h !== \"\" && Math.round(h - space.height) > ERROR) {\n // Not enough height.\n return false;\n }\n\n if (node.w !== \"\") {\n if (Math.round(w - space.width) <= ERROR) {\n return true;\n }\n if (parent[$extra].numberInLine === 0) {\n return space.height > ERROR;\n }\n\n return false;\n }\n\n return space.width > ERROR;\n }\n\n // No layout failure.\n\n // Put the element on the line but we can fail\n // and then in the second step (next line) we'll accept.\n if (node.w !== \"\") {\n return Math.round(w - space.width) <= ERROR;\n }\n\n return space.width > ERROR;\n }\n\n // Second attempt: try to put the element on the next line.\n\n if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {\n // We cannot fail.\n return true;\n }\n\n if (node.h !== \"\" && Math.round(h - space.height) > ERROR) {\n return false;\n }\n\n if (node.w === \"\" || Math.round(w - space.width) <= ERROR) {\n return space.height > ERROR;\n }\n\n if (parent[$isThereMoreWidth]()) {\n return false;\n }\n\n return space.height > ERROR;\n case \"table\":\n case \"tb\":\n if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {\n return true;\n }\n\n // If the node has a height then check if it's fine with available height.\n // If the node is breakable then we can return true.\n if (node.h !== \"\" && !node[$isSplittable]()) {\n return Math.round(h - space.height) <= ERROR;\n }\n // Else wait and see: this node will be layed out itself\n // in the provided space and maybe a children won't fit.\n\n if (node.w === \"\" || Math.round(w - space.width) <= ERROR) {\n return space.height > ERROR;\n }\n\n if (parent[$isThereMoreWidth]()) {\n return false;\n }\n\n return space.height > ERROR;\n case \"position\":\n if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {\n return true;\n }\n\n if (node.h === \"\" || Math.round(h + y - space.height) <= ERROR) {\n return true;\n }\n\n const area = node[$getTemplateRoot]()[$extra].currentContentArea;\n return h + y > area.h;\n case \"rl-row\":\n case \"row\":\n if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {\n return true;\n }\n\n if (node.h !== \"\") {\n return Math.round(h - space.height) <= ERROR;\n }\n return true;\n default:\n // No layout, so accept everything.\n return true;\n }\n}\n\nexport { addHTML, checkDimensions, flushHTML, getAvailableSpace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $content,\n $extra,\n $getParent,\n $getSubformParent,\n $getTemplateRoot,\n $globalData,\n $nodeName,\n $pushGlyphs,\n $text,\n $toStyle,\n} from \"./symbol_utils.js\";\nimport { createValidAbsoluteUrl, warn } from \"../../shared/util.js\";\nimport { getMeasurement, stripQuotes } from \"./utils.js\";\nimport { selectFont } from \"./fonts.js\";\nimport { TextMeasure } from \"./text.js\";\nimport { XFAObject } from \"./xfa_object.js\";\n\nfunction measureToString(m) {\n if (typeof m === \"string\") {\n return \"0px\";\n }\n\n return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;\n}\n\nconst converters = {\n anchorType(node, style) {\n const parent = node[$getSubformParent]();\n if (!parent || (parent.layout && parent.layout !== \"position\")) {\n // anchorType is only used in a positioned layout.\n return;\n }\n\n if (!(\"transform\" in style)) {\n style.transform = \"\";\n }\n switch (node.anchorType) {\n case \"bottomCenter\":\n style.transform += \"translate(-50%, -100%)\";\n break;\n case \"bottomLeft\":\n style.transform += \"translate(0,-100%)\";\n break;\n case \"bottomRight\":\n style.transform += \"translate(-100%,-100%)\";\n break;\n case \"middleCenter\":\n style.transform += \"translate(-50%,-50%)\";\n break;\n case \"middleLeft\":\n style.transform += \"translate(0,-50%)\";\n break;\n case \"middleRight\":\n style.transform += \"translate(-100%,-50%)\";\n break;\n case \"topCenter\":\n style.transform += \"translate(-50%,0)\";\n break;\n case \"topRight\":\n style.transform += \"translate(-100%,0)\";\n break;\n }\n },\n dimensions(node, style) {\n const parent = node[$getSubformParent]();\n let width = node.w;\n const height = node.h;\n if (parent.layout?.includes(\"row\")) {\n const extra = parent[$extra];\n const colSpan = node.colSpan;\n let w;\n if (colSpan === -1) {\n w = extra.columnWidths\n .slice(extra.currentColumn)\n .reduce((a, x) => a + x, 0);\n extra.currentColumn = 0;\n } else {\n w = extra.columnWidths\n .slice(extra.currentColumn, extra.currentColumn + colSpan)\n .reduce((a, x) => a + x, 0);\n extra.currentColumn =\n (extra.currentColumn + node.colSpan) % extra.columnWidths.length;\n }\n\n if (!isNaN(w)) {\n width = node.w = w;\n }\n }\n\n style.width = width !== \"\" ? measureToString(width) : \"auto\";\n\n style.height = height !== \"\" ? measureToString(height) : \"auto\";\n },\n position(node, style) {\n const parent = node[$getSubformParent]();\n if (parent?.layout && parent.layout !== \"position\") {\n // IRL, we've some x/y in tb layout.\n // Specs say x/y is only used in positioned layout.\n return;\n }\n\n style.position = \"absolute\";\n style.left = measureToString(node.x);\n style.top = measureToString(node.y);\n },\n rotate(node, style) {\n if (node.rotate) {\n if (!(\"transform\" in style)) {\n style.transform = \"\";\n }\n style.transform += `rotate(-${node.rotate}deg)`;\n style.transformOrigin = \"top left\";\n }\n },\n presence(node, style) {\n switch (node.presence) {\n case \"invisible\":\n style.visibility = \"hidden\";\n break;\n case \"hidden\":\n case \"inactive\":\n style.display = \"none\";\n break;\n }\n },\n hAlign(node, style) {\n if (node[$nodeName] === \"para\") {\n switch (node.hAlign) {\n case \"justifyAll\":\n style.textAlign = \"justify-all\";\n break;\n case \"radix\":\n // TODO: implement this correctly !\n style.textAlign = \"left\";\n break;\n default:\n style.textAlign = node.hAlign;\n }\n } else {\n switch (node.hAlign) {\n case \"left\":\n style.alignSelf = \"start\";\n break;\n case \"center\":\n style.alignSelf = \"center\";\n break;\n case \"right\":\n style.alignSelf = \"end\";\n break;\n }\n }\n },\n margin(node, style) {\n if (node.margin) {\n style.margin = node.margin[$toStyle]().margin;\n }\n },\n};\n\nfunction setMinMaxDimensions(node, style) {\n const parent = node[$getSubformParent]();\n if (parent.layout === \"position\") {\n if (node.minW > 0) {\n style.minWidth = measureToString(node.minW);\n }\n if (node.maxW > 0) {\n style.maxWidth = measureToString(node.maxW);\n }\n if (node.minH > 0) {\n style.minHeight = measureToString(node.minH);\n }\n if (node.maxH > 0) {\n style.maxHeight = measureToString(node.maxH);\n }\n }\n}\n\nfunction layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {\n const measure = new TextMeasure(xfaFont, margin, lineHeight, fontFinder);\n if (typeof text === \"string\") {\n measure.addString(text);\n } else {\n text[$pushGlyphs](measure);\n }\n\n return measure.compute(width);\n}\n\nfunction layoutNode(node, availableSpace) {\n let height = null;\n let width = null;\n let isBroken = false;\n\n if ((!node.w || !node.h) && node.value) {\n let marginH = 0;\n let marginV = 0;\n if (node.margin) {\n marginH = node.margin.leftInset + node.margin.rightInset;\n marginV = node.margin.topInset + node.margin.bottomInset;\n }\n\n let lineHeight = null;\n let margin = null;\n if (node.para) {\n margin = Object.create(null);\n lineHeight = node.para.lineHeight === \"\" ? null : node.para.lineHeight;\n margin.top = node.para.spaceAbove === \"\" ? 0 : node.para.spaceAbove;\n margin.bottom = node.para.spaceBelow === \"\" ? 0 : node.para.spaceBelow;\n margin.left = node.para.marginLeft === \"\" ? 0 : node.para.marginLeft;\n margin.right = node.para.marginRight === \"\" ? 0 : node.para.marginRight;\n }\n\n let font = node.font;\n if (!font) {\n const root = node[$getTemplateRoot]();\n let parent = node[$getParent]();\n while (parent && parent !== root) {\n if (parent.font) {\n font = parent.font;\n break;\n }\n parent = parent[$getParent]();\n }\n }\n\n const maxWidth = (node.w || availableSpace.width) - marginH;\n const fontFinder = node[$globalData].fontFinder;\n if (\n node.value.exData &&\n node.value.exData[$content] &&\n node.value.exData.contentType === \"text/html\"\n ) {\n const res = layoutText(\n node.value.exData[$content],\n font,\n margin,\n lineHeight,\n fontFinder,\n maxWidth\n );\n width = res.width;\n height = res.height;\n isBroken = res.isBroken;\n } else {\n const text = node.value[$text]();\n if (text) {\n const res = layoutText(\n text,\n font,\n margin,\n lineHeight,\n fontFinder,\n maxWidth\n );\n width = res.width;\n height = res.height;\n isBroken = res.isBroken;\n }\n }\n\n if (width !== null && !node.w) {\n width += marginH;\n }\n\n if (height !== null && !node.h) {\n height += marginV;\n }\n }\n return { w: width, h: height, isBroken };\n}\n\nfunction computeBbox(node, html, availableSpace) {\n let bbox;\n if (node.w !== \"\" && node.h !== \"\") {\n bbox = [node.x, node.y, node.w, node.h];\n } else {\n if (!availableSpace) {\n return null;\n }\n let width = node.w;\n if (width === \"\") {\n if (node.maxW === 0) {\n const parent = node[$getSubformParent]();\n width = parent.layout === \"position\" && parent.w !== \"\" ? 0 : node.minW;\n } else {\n width = Math.min(node.maxW, availableSpace.width);\n }\n html.attributes.style.width = measureToString(width);\n }\n\n let height = node.h;\n if (height === \"\") {\n if (node.maxH === 0) {\n const parent = node[$getSubformParent]();\n height =\n parent.layout === \"position\" && parent.h !== \"\" ? 0 : node.minH;\n } else {\n height = Math.min(node.maxH, availableSpace.height);\n }\n html.attributes.style.height = measureToString(height);\n }\n\n bbox = [node.x, node.y, width, height];\n }\n return bbox;\n}\n\nfunction fixDimensions(node) {\n const parent = node[$getSubformParent]();\n if (parent.layout?.includes(\"row\")) {\n const extra = parent[$extra];\n const colSpan = node.colSpan;\n let width;\n if (colSpan === -1) {\n width = extra.columnWidths\n .slice(extra.currentColumn)\n .reduce((a, w) => a + w, 0);\n } else {\n width = extra.columnWidths\n .slice(extra.currentColumn, extra.currentColumn + colSpan)\n .reduce((a, w) => a + w, 0);\n }\n if (!isNaN(width)) {\n node.w = width;\n }\n }\n\n if (parent.layout && parent.layout !== \"position\") {\n // Useless in this context.\n node.x = node.y = 0;\n }\n\n if (node.layout === \"table\") {\n if (node.w === \"\" && Array.isArray(node.columnWidths)) {\n node.w = node.columnWidths.reduce((a, x) => a + x, 0);\n }\n }\n}\n\nfunction layoutClass(node) {\n switch (node.layout) {\n case \"position\":\n return \"xfaPosition\";\n case \"lr-tb\":\n return \"xfaLrTb\";\n case \"rl-row\":\n return \"xfaRlRow\";\n case \"rl-tb\":\n return \"xfaRlTb\";\n case \"row\":\n return \"xfaRow\";\n case \"table\":\n return \"xfaTable\";\n case \"tb\":\n return \"xfaTb\";\n default:\n return \"xfaPosition\";\n }\n}\n\nfunction toStyle(node, ...names) {\n const style = Object.create(null);\n for (const name of names) {\n const value = node[name];\n if (value === null) {\n continue;\n }\n if (converters.hasOwnProperty(name)) {\n converters[name](node, style);\n continue;\n }\n\n if (value instanceof XFAObject) {\n const newStyle = value[$toStyle]();\n if (newStyle) {\n Object.assign(style, newStyle);\n } else {\n warn(`(DEBUG) - XFA - style for ${name} not implemented yet`);\n }\n }\n }\n return style;\n}\n\nfunction createWrapper(node, html) {\n const { attributes } = html;\n const { style } = attributes;\n\n const wrapper = {\n name: \"div\",\n attributes: {\n class: [\"xfaWrapper\"],\n style: Object.create(null),\n },\n children: [],\n };\n\n attributes.class.push(\"xfaWrapped\");\n\n if (node.border) {\n const { widths, insets } = node.border[$extra];\n let width, height;\n let top = insets[0];\n let left = insets[3];\n const insetsH = insets[0] + insets[2];\n const insetsW = insets[1] + insets[3];\n switch (node.border.hand) {\n case \"even\":\n top -= widths[0] / 2;\n left -= widths[3] / 2;\n width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;\n height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;\n break;\n case \"left\":\n top -= widths[0];\n left -= widths[3];\n width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;\n height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;\n break;\n case \"right\":\n width = insetsW ? `calc(100% - ${insetsW}px)` : \"100%\";\n height = insetsH ? `calc(100% - ${insetsH}px)` : \"100%\";\n break;\n }\n const classNames = [\"xfaBorder\"];\n if (isPrintOnly(node.border)) {\n classNames.push(\"xfaPrintOnly\");\n }\n\n const border = {\n name: \"div\",\n attributes: {\n class: classNames,\n style: {\n top: `${top}px`,\n left: `${left}px`,\n width,\n height,\n },\n },\n children: [],\n };\n\n for (const key of [\n \"border\",\n \"borderWidth\",\n \"borderColor\",\n \"borderRadius\",\n \"borderStyle\",\n ]) {\n if (style[key] !== undefined) {\n border.attributes.style[key] = style[key];\n delete style[key];\n }\n }\n wrapper.children.push(border, html);\n } else {\n wrapper.children.push(html);\n }\n\n for (const key of [\n \"background\",\n \"backgroundClip\",\n \"top\",\n \"left\",\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\",\n \"transform\",\n \"transformOrigin\",\n \"visibility\",\n ]) {\n if (style[key] !== undefined) {\n wrapper.attributes.style[key] = style[key];\n delete style[key];\n }\n }\n\n wrapper.attributes.style.position =\n style.position === \"absolute\" ? \"absolute\" : \"relative\";\n delete style.position;\n\n if (style.alignSelf) {\n wrapper.attributes.style.alignSelf = style.alignSelf;\n delete style.alignSelf;\n }\n\n return wrapper;\n}\n\nfunction fixTextIndent(styles) {\n const indent = getMeasurement(styles.textIndent, \"0px\");\n if (indent >= 0) {\n return;\n }\n\n // If indent is negative then it's a hanging indent.\n const align = styles.textAlign === \"right\" ? \"right\" : \"left\";\n const name = \"padding\" + (align === \"left\" ? \"Left\" : \"Right\");\n const padding = getMeasurement(styles[name], \"0px\");\n styles[name] = `${padding - indent}px`;\n}\n\nfunction setAccess(node, classNames) {\n switch (node.access) {\n case \"nonInteractive\":\n classNames.push(\"xfaNonInteractive\");\n break;\n case \"readOnly\":\n classNames.push(\"xfaReadOnly\");\n break;\n case \"protected\":\n classNames.push(\"xfaDisabled\");\n break;\n }\n}\n\nfunction isPrintOnly(node) {\n return (\n node.relevant.length > 0 &&\n !node.relevant[0].excluded &&\n node.relevant[0].viewname === \"print\"\n );\n}\n\nfunction getCurrentPara(node) {\n const stack = node[$getTemplateRoot]()[$extra].paraStack;\n return stack.length ? stack.at(-1) : null;\n}\n\nfunction setPara(node, nodeStyle, value) {\n if (value.attributes.class?.includes(\"xfaRich\")) {\n if (nodeStyle) {\n if (node.h === \"\") {\n nodeStyle.height = \"auto\";\n }\n if (node.w === \"\") {\n nodeStyle.width = \"auto\";\n }\n }\n\n const para = getCurrentPara(node);\n if (para) {\n // By definition exData are external data so para\n // has no effect on it.\n const valueStyle = value.attributes.style;\n valueStyle.display = \"flex\";\n valueStyle.flexDirection = \"column\";\n switch (para.vAlign) {\n case \"top\":\n valueStyle.justifyContent = \"start\";\n break;\n case \"bottom\":\n valueStyle.justifyContent = \"end\";\n break;\n case \"middle\":\n valueStyle.justifyContent = \"center\";\n break;\n }\n\n const paraStyle = para[$toStyle]();\n for (const [key, val] of Object.entries(paraStyle)) {\n if (!(key in valueStyle)) {\n valueStyle[key] = val;\n }\n }\n }\n }\n}\n\nfunction setFontFamily(xfaFont, node, fontFinder, style) {\n if (!fontFinder) {\n // The font cannot be found in the pdf so use the default one.\n delete style.fontFamily;\n return;\n }\n\n const name = stripQuotes(xfaFont.typeface);\n style.fontFamily = `\"${name}\"`;\n\n const typeface = fontFinder.find(name);\n if (typeface) {\n const { fontFamily } = typeface.regular.cssFontInfo;\n if (fontFamily !== name) {\n style.fontFamily = `\"${fontFamily}\"`;\n }\n\n const para = getCurrentPara(node);\n if (para && para.lineHeight !== \"\") {\n return;\n }\n\n if (style.lineHeight) {\n // Already something so don't overwrite.\n return;\n }\n\n const pdfFont = selectFont(xfaFont, typeface);\n if (pdfFont) {\n style.lineHeight = Math.max(1.2, pdfFont.lineHeight);\n }\n }\n}\n\nfunction fixURL(str) {\n const absoluteUrl = createValidAbsoluteUrl(str, /* baseUrl = */ null, {\n addDefaultProtocol: true,\n tryConvertEncoding: true,\n });\n return absoluteUrl ? absoluteUrl.href : null;\n}\n\nexport {\n computeBbox,\n createWrapper,\n fixDimensions,\n fixTextIndent,\n fixURL,\n isPrintOnly,\n layoutClass,\n layoutNode,\n measureToString,\n setAccess,\n setFontFamily,\n setMinMaxDimensions,\n setPara,\n toStyle,\n};\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { shadow } from \"../../shared/util.js\";\n\nconst dimConverters = {\n pt: x => x,\n cm: x => (x / 2.54) * 72,\n mm: x => (x / (10 * 2.54)) * 72,\n in: x => x * 72,\n px: x => x,\n};\nconst measurementPattern = /([+-]?\\d+\\.?\\d*)(.*)/;\n\nfunction stripQuotes(str) {\n if (str.startsWith(\"'\") || str.startsWith('\"')) {\n return str.slice(1, -1);\n }\n return str;\n}\n\nfunction getInteger({ data, defaultValue, validate }) {\n if (!data) {\n return defaultValue;\n }\n data = data.trim();\n const n = parseInt(data, 10);\n if (!isNaN(n) && validate(n)) {\n return n;\n }\n return defaultValue;\n}\n\nfunction getFloat({ data, defaultValue, validate }) {\n if (!data) {\n return defaultValue;\n }\n data = data.trim();\n const n = parseFloat(data);\n if (!isNaN(n) && validate(n)) {\n return n;\n }\n return defaultValue;\n}\n\nfunction getKeyword({ data, defaultValue, validate }) {\n if (!data) {\n return defaultValue;\n }\n data = data.trim();\n if (validate(data)) {\n return data;\n }\n return defaultValue;\n}\n\nfunction getStringOption(data, options) {\n return getKeyword({\n data,\n defaultValue: options[0],\n validate: k => options.includes(k),\n });\n}\n\nfunction getMeasurement(str, def = \"0\") {\n def ||= \"0\";\n if (!str) {\n return getMeasurement(def);\n }\n const match = str.trim().match(measurementPattern);\n if (!match) {\n return getMeasurement(def);\n }\n const [, valueStr, unit] = match;\n const value = parseFloat(valueStr);\n if (isNaN(value)) {\n return getMeasurement(def);\n }\n\n if (value === 0) {\n return 0;\n }\n\n const conv = dimConverters[unit];\n if (conv) {\n return conv(value);\n }\n\n return value;\n}\n\nfunction getRatio(data) {\n if (!data) {\n return { num: 1, den: 1 };\n }\n const ratio = data\n .trim()\n .split(/\\s*:\\s*/)\n .map(x => parseFloat(x))\n .filter(x => !isNaN(x));\n if (ratio.length === 1) {\n ratio.push(1);\n }\n\n if (ratio.length === 0) {\n return { num: 1, den: 1 };\n }\n\n const [num, den] = ratio;\n return { num, den };\n}\n\nfunction getRelevant(data) {\n if (!data) {\n return [];\n }\n return data\n .trim()\n .split(/\\s+/)\n .map(e => {\n return {\n excluded: e[0] === \"-\",\n viewname: e.substring(1),\n };\n });\n}\n\nfunction getColor(data, def = [0, 0, 0]) {\n let [r, g, b] = def;\n if (!data) {\n return { r, g, b };\n }\n const color = data\n .trim()\n .split(/\\s*,\\s*/)\n .map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255))\n .map(c => (isNaN(c) ? 0 : c));\n\n if (color.length < 3) {\n return { r, g, b };\n }\n\n [r, g, b] = color;\n return { r, g, b };\n}\n\nfunction getBBox(data) {\n const def = -1;\n if (!data) {\n return { x: def, y: def, width: def, height: def };\n }\n const bbox = data\n .trim()\n .split(/\\s*,\\s*/)\n .map(m => getMeasurement(m, \"-1\"));\n if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {\n return { x: def, y: def, width: def, height: def };\n }\n\n const [x, y, width, height] = bbox;\n return { x, y, width, height };\n}\n\nclass HTMLResult {\n static get FAILURE() {\n return shadow(this, \"FAILURE\", new HTMLResult(false, null, null, null));\n }\n\n static get EMPTY() {\n return shadow(this, \"EMPTY\", new HTMLResult(true, null, null, null));\n }\n\n constructor(success, html, bbox, breakNode) {\n this.success = success;\n this.html = html;\n this.bbox = bbox;\n this.breakNode = breakNode;\n }\n\n isBreak() {\n return !!this.breakNode;\n }\n\n static breakNode(node) {\n return new HTMLResult(false, null, null, node);\n }\n\n static success(html, bbox = null) {\n return new HTMLResult(true, html, bbox, null);\n }\n}\n\nexport {\n getBBox,\n getColor,\n getFloat,\n getInteger,\n getKeyword,\n getMeasurement,\n getRatio,\n getRelevant,\n getStringOption,\n HTMLResult,\n stripQuotes,\n};\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $globalData } from \"./symbol_utils.js\";\nimport { stripQuotes } from \"./utils.js\";\nimport { warn } from \"../../shared/util.js\";\n\nclass FontFinder {\n constructor(pdfFonts) {\n this.fonts = new Map();\n this.cache = new Map();\n this.warned = new Set();\n this.defaultFont = null;\n this.add(pdfFonts);\n }\n\n add(pdfFonts, reallyMissingFonts = null) {\n for (const pdfFont of pdfFonts) {\n this.addPdfFont(pdfFont);\n }\n for (const pdfFont of this.fonts.values()) {\n if (!pdfFont.regular) {\n pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;\n }\n }\n\n if (!reallyMissingFonts || reallyMissingFonts.size === 0) {\n return;\n }\n const myriad = this.fonts.get(\"PdfJS-Fallback-PdfJS-XFA\");\n for (const missing of reallyMissingFonts) {\n this.fonts.set(missing, myriad);\n }\n }\n\n addPdfFont(pdfFont) {\n const cssFontInfo = pdfFont.cssFontInfo;\n const name = cssFontInfo.fontFamily;\n let font = this.fonts.get(name);\n if (!font) {\n font = Object.create(null);\n this.fonts.set(name, font);\n if (!this.defaultFont) {\n this.defaultFont = font;\n }\n }\n let property = \"\";\n const fontWeight = parseFloat(cssFontInfo.fontWeight);\n if (parseFloat(cssFontInfo.italicAngle) !== 0) {\n property = fontWeight >= 700 ? \"bolditalic\" : \"italic\";\n } else if (fontWeight >= 700) {\n property = \"bold\";\n }\n\n if (!property) {\n if (pdfFont.name.includes(\"Bold\") || pdfFont.psName?.includes(\"Bold\")) {\n property = \"bold\";\n }\n if (\n pdfFont.name.includes(\"Italic\") ||\n pdfFont.name.endsWith(\"It\") ||\n pdfFont.psName?.includes(\"Italic\") ||\n pdfFont.psName?.endsWith(\"It\")\n ) {\n property += \"italic\";\n }\n }\n\n if (!property) {\n property = \"regular\";\n }\n\n font[property] = pdfFont;\n }\n\n getDefault() {\n return this.defaultFont;\n }\n\n find(fontName, mustWarn = true) {\n let font = this.fonts.get(fontName) || this.cache.get(fontName);\n if (font) {\n return font;\n }\n\n const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;\n let name = fontName.replaceAll(pattern, \"\");\n font = this.fonts.get(name);\n if (font) {\n this.cache.set(fontName, font);\n return font;\n }\n name = name.toLowerCase();\n\n const maybe = [];\n for (const [family, pdfFont] of this.fonts.entries()) {\n if (family.replaceAll(pattern, \"\").toLowerCase().startsWith(name)) {\n maybe.push(pdfFont);\n }\n }\n\n if (maybe.length === 0) {\n for (const [, pdfFont] of this.fonts.entries()) {\n if (\n pdfFont.regular.name\n ?.replaceAll(pattern, \"\")\n .toLowerCase()\n .startsWith(name)\n ) {\n maybe.push(pdfFont);\n }\n }\n }\n\n if (maybe.length === 0) {\n name = name.replaceAll(/psmt|mt/gi, \"\");\n for (const [family, pdfFont] of this.fonts.entries()) {\n if (family.replaceAll(pattern, \"\").toLowerCase().startsWith(name)) {\n maybe.push(pdfFont);\n }\n }\n }\n\n if (maybe.length === 0) {\n for (const pdfFont of this.fonts.values()) {\n if (\n pdfFont.regular.name\n ?.replaceAll(pattern, \"\")\n .toLowerCase()\n .startsWith(name)\n ) {\n maybe.push(pdfFont);\n }\n }\n }\n\n if (maybe.length >= 1) {\n if (maybe.length !== 1 && mustWarn) {\n warn(`XFA - Too many choices to guess the correct font: ${fontName}`);\n }\n this.cache.set(fontName, maybe[0]);\n return maybe[0];\n }\n\n if (mustWarn && !this.warned.has(fontName)) {\n this.warned.add(fontName);\n warn(`XFA - Cannot find the font: ${fontName}`);\n }\n return null;\n }\n}\n\nfunction selectFont(xfaFont, typeface) {\n if (xfaFont.posture === \"italic\") {\n if (xfaFont.weight === \"bold\") {\n return typeface.bolditalic;\n }\n return typeface.italic;\n } else if (xfaFont.weight === \"bold\") {\n return typeface.bold;\n }\n\n return typeface.regular;\n}\n\nfunction getMetrics(xfaFont, real = false) {\n let pdfFont = null;\n if (xfaFont) {\n const name = stripQuotes(xfaFont.typeface);\n const typeface = xfaFont[$globalData].fontFinder.find(name);\n pdfFont = selectFont(xfaFont, typeface);\n }\n\n if (!pdfFont) {\n return {\n lineHeight: 12,\n lineGap: 2,\n lineNoGap: 10,\n };\n }\n\n const size = xfaFont.size || 10;\n const lineHeight = pdfFont.lineHeight\n ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight)\n : 1.2;\n const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;\n return {\n lineHeight: lineHeight * size,\n lineGap: lineGap * size,\n lineNoGap: Math.max(1, lineHeight - lineGap) * size,\n };\n}\n\nexport { FontFinder, getMetrics, selectFont };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { selectFont } from \"./fonts.js\";\n\nconst WIDTH_FACTOR = 1.02;\n\nclass FontInfo {\n constructor(xfaFont, margin, lineHeight, fontFinder) {\n this.lineHeight = lineHeight;\n this.paraMargin = margin || {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n\n if (!xfaFont) {\n [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);\n return;\n }\n\n this.xfaFont = {\n typeface: xfaFont.typeface,\n posture: xfaFont.posture,\n weight: xfaFont.weight,\n size: xfaFont.size,\n letterSpacing: xfaFont.letterSpacing,\n };\n const typeface = fontFinder.find(xfaFont.typeface);\n if (!typeface) {\n [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);\n return;\n }\n\n this.pdfFont = selectFont(xfaFont, typeface);\n\n if (!this.pdfFont) {\n [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);\n }\n }\n\n defaultFont(fontFinder) {\n // TODO: Add a default font based on Liberation.\n const font =\n fontFinder.find(\"Helvetica\", false) ||\n fontFinder.find(\"Myriad Pro\", false) ||\n fontFinder.find(\"Arial\", false) ||\n fontFinder.getDefault();\n if (font?.regular) {\n const pdfFont = font.regular;\n const info = pdfFont.cssFontInfo;\n const xfaFont = {\n typeface: info.fontFamily,\n posture: \"normal\",\n weight: \"normal\",\n size: 10,\n letterSpacing: 0,\n };\n return [pdfFont, xfaFont];\n }\n\n const xfaFont = {\n typeface: \"Courier\",\n posture: \"normal\",\n weight: \"normal\",\n size: 10,\n letterSpacing: 0,\n };\n return [null, xfaFont];\n }\n}\n\nclass FontSelector {\n constructor(\n defaultXfaFont,\n defaultParaMargin,\n defaultLineHeight,\n fontFinder\n ) {\n this.fontFinder = fontFinder;\n this.stack = [\n new FontInfo(\n defaultXfaFont,\n defaultParaMargin,\n defaultLineHeight,\n fontFinder\n ),\n ];\n }\n\n pushData(xfaFont, margin, lineHeight) {\n const lastFont = this.stack.at(-1);\n for (const name of [\n \"typeface\",\n \"posture\",\n \"weight\",\n \"size\",\n \"letterSpacing\",\n ]) {\n if (!xfaFont[name]) {\n xfaFont[name] = lastFont.xfaFont[name];\n }\n }\n\n for (const name of [\"top\", \"bottom\", \"left\", \"right\"]) {\n if (isNaN(margin[name])) {\n margin[name] = lastFont.paraMargin[name];\n }\n }\n\n const fontInfo = new FontInfo(\n xfaFont,\n margin,\n lineHeight || lastFont.lineHeight,\n this.fontFinder\n );\n if (!fontInfo.pdfFont) {\n fontInfo.pdfFont = lastFont.pdfFont;\n }\n\n this.stack.push(fontInfo);\n }\n\n popFont() {\n this.stack.pop();\n }\n\n topFont() {\n return this.stack.at(-1);\n }\n}\n\n/**\n * Compute a text area dimensions based on font metrics.\n */\nclass TextMeasure {\n constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {\n this.glyphs = [];\n this.fontSelector = new FontSelector(\n defaultXfaFont,\n defaultParaMargin,\n defaultLineHeight,\n fonts\n );\n this.extraHeight = 0;\n }\n\n pushData(xfaFont, margin, lineHeight) {\n this.fontSelector.pushData(xfaFont, margin, lineHeight);\n }\n\n popFont(xfaFont) {\n return this.fontSelector.popFont();\n }\n\n addPara() {\n const lastFont = this.fontSelector.topFont();\n this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;\n }\n\n addString(str) {\n if (!str) {\n return;\n }\n\n const lastFont = this.fontSelector.topFont();\n const fontSize = lastFont.xfaFont.size;\n if (lastFont.pdfFont) {\n const letterSpacing = lastFont.xfaFont.letterSpacing;\n const pdfFont = lastFont.pdfFont;\n const fontLineHeight = pdfFont.lineHeight || 1.2;\n const lineHeight =\n lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;\n const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;\n const noGap = fontLineHeight - lineGap;\n const firstLineHeight = Math.max(1, noGap) * fontSize;\n const scale = fontSize / 1000;\n const fallbackWidth =\n pdfFont.defaultWidth || pdfFont.charsToGlyphs(\" \")[0].width;\n\n for (const line of str.split(/[\\u2029\\n]/)) {\n const encodedLine = pdfFont.encodeString(line).join(\"\");\n const glyphs = pdfFont.charsToGlyphs(encodedLine);\n\n for (const glyph of glyphs) {\n const width = glyph.width || fallbackWidth;\n this.glyphs.push([\n width * scale + letterSpacing,\n lineHeight,\n firstLineHeight,\n glyph.unicode,\n false,\n ]);\n }\n\n this.glyphs.push([0, 0, 0, \"\\n\", true]);\n }\n this.glyphs.pop();\n return;\n }\n\n // When we have no font in the pdf, just use the font size as default width.\n for (const line of str.split(/[\\u2029\\n]/)) {\n for (const char of line.split(\"\")) {\n this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);\n }\n\n this.glyphs.push([0, 0, 0, \"\\n\", true]);\n }\n this.glyphs.pop();\n }\n\n compute(maxWidth) {\n let lastSpacePos = -1,\n lastSpaceWidth = 0,\n width = 0,\n height = 0,\n currentLineWidth = 0,\n currentLineHeight = 0;\n let isBroken = false;\n let isFirstLine = true;\n\n for (let i = 0, ii = this.glyphs.length; i < ii; i++) {\n const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] =\n this.glyphs[i];\n const isSpace = char === \" \";\n const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;\n if (isEOL) {\n width = Math.max(width, currentLineWidth);\n currentLineWidth = 0;\n height += currentLineHeight;\n currentLineHeight = glyphHeight;\n lastSpacePos = -1;\n lastSpaceWidth = 0;\n isFirstLine = false;\n continue;\n }\n\n if (isSpace) {\n if (currentLineWidth + glyphWidth > maxWidth) {\n // We can break here but the space is not taken into account.\n width = Math.max(width, currentLineWidth);\n currentLineWidth = 0;\n height += currentLineHeight;\n currentLineHeight = glyphHeight;\n lastSpacePos = -1;\n lastSpaceWidth = 0;\n isBroken = true;\n isFirstLine = false;\n } else {\n currentLineHeight = Math.max(glyphHeight, currentLineHeight);\n lastSpaceWidth = currentLineWidth;\n currentLineWidth += glyphWidth;\n lastSpacePos = i;\n }\n continue;\n }\n\n if (currentLineWidth + glyphWidth > maxWidth) {\n // We must break to the last white position (if available)\n height += currentLineHeight;\n currentLineHeight = glyphHeight;\n if (lastSpacePos !== -1) {\n i = lastSpacePos;\n width = Math.max(width, lastSpaceWidth);\n currentLineWidth = 0;\n lastSpacePos = -1;\n lastSpaceWidth = 0;\n } else {\n // Just break in the middle of the word\n width = Math.max(width, currentLineWidth);\n currentLineWidth = glyphWidth;\n }\n isBroken = true;\n isFirstLine = false;\n\n continue;\n }\n\n currentLineWidth += glyphWidth;\n currentLineHeight = Math.max(glyphHeight, currentLineHeight);\n }\n\n width = Math.max(width, currentLineWidth);\n height += currentLineHeight + this.extraHeight;\n\n return { width: WIDTH_FACTOR * width, height, isBroken };\n }\n}\n\nexport { TextMeasure };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $acceptWhitespace,\n $addHTML,\n $appendChild,\n $childrenToHTML,\n $clean,\n $cleanup,\n $clone,\n $consumed,\n $content,\n $dump,\n $extra,\n $finalize,\n $flushHTML,\n $getAttributeIt,\n $getAttributes,\n $getAvailableSpace,\n $getChildren,\n $getChildrenByClass,\n $getChildrenByName,\n $getChildrenByNameIt,\n $getContainedChildren,\n $getDataValue,\n $getParent,\n $getRealChildrenByNameIt,\n $getSubformParent,\n $getTemplateRoot,\n $globalData,\n $hasSettableValue,\n $indexOf,\n $insertAt,\n $isBindable,\n $isCDATAXml,\n $isDataValue,\n $isDescendent,\n $isNsAgnostic,\n $isSplittable,\n $isThereMoreWidth,\n $isTransparent,\n $lastAttribute,\n $namespaceId,\n $nodeName,\n $nsAttributes,\n $onChild,\n $onChildCheck,\n $onText,\n $popPara,\n $pushPara,\n $removeChild,\n $resolvePrototypes,\n $root,\n $setId,\n $setSetAttributes,\n $setValue,\n $text,\n $toHTML,\n $toString,\n $toStyle,\n $uid,\n} from \"./symbol_utils.js\";\nimport { getInteger, getKeyword, HTMLResult } from \"./utils.js\";\nimport { shadow, utf8StringToString, warn } from \"../../shared/util.js\";\nimport { encodeToXmlString } from \"../core_utils.js\";\nimport { NamespaceIds } from \"./namespaces.js\";\nimport { searchNode } from \"./som.js\";\n\nconst _applyPrototype = Symbol();\nconst _attributes = Symbol();\nconst _attributeNames = Symbol();\nconst _children = Symbol(\"_children\");\nconst _cloneAttribute = Symbol();\nconst _dataValue = Symbol();\nconst _defaultValue = Symbol();\nconst _filteredChildrenGenerator = Symbol();\nconst _getPrototype = Symbol();\nconst _getUnsetAttributes = Symbol();\nconst _hasChildren = Symbol();\nconst _max = Symbol();\nconst _options = Symbol();\nconst _parent = Symbol(\"parent\");\nconst _resolvePrototypesHelper = Symbol();\nconst _setAttributes = Symbol();\nconst _validator = Symbol();\n\nlet uid = 0;\n\nconst NS_DATASETS = NamespaceIds.datasets.id;\n\nclass XFAObject {\n constructor(nsId, name, hasChildren = false) {\n this[$namespaceId] = nsId;\n this[$nodeName] = name;\n this[_hasChildren] = hasChildren;\n this[_parent] = null;\n this[_children] = [];\n this[$uid] = `${name}${uid++}`;\n this[$globalData] = null;\n }\n\n get isXFAObject() {\n return true;\n }\n\n get isXFAObjectArray() {\n return false;\n }\n\n createNodes(path) {\n let root = this,\n node = null;\n for (const { name, index } of path) {\n for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) {\n const nsId =\n root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId];\n node = new XmlObject(nsId, name);\n root[$appendChild](node);\n }\n root = node;\n }\n return node;\n }\n\n [$onChild](child) {\n if (!this[_hasChildren] || !this[$onChildCheck](child)) {\n return false;\n }\n\n const name = child[$nodeName];\n const node = this[name];\n\n if (node instanceof XFAObjectArray) {\n if (node.push(child)) {\n this[$appendChild](child);\n return true;\n }\n } else {\n // IRL it's possible to already have a node.\n // So just replace it with the last version.\n if (node !== null) {\n this[$removeChild](node);\n }\n this[name] = child;\n this[$appendChild](child);\n return true;\n }\n\n let id = \"\";\n if (this.id) {\n id = ` (id: ${this.id})`;\n } else if (this.name) {\n id = ` (name: ${this.name} ${this.h.value})`;\n }\n warn(`XFA - node \"${this[$nodeName]}\"${id} has already enough \"${name}\"!`);\n return false;\n }\n\n [$onChildCheck](child) {\n return (\n this.hasOwnProperty(child[$nodeName]) &&\n child[$namespaceId] === this[$namespaceId]\n );\n }\n\n [$isNsAgnostic]() {\n return false;\n }\n\n [$acceptWhitespace]() {\n return false;\n }\n\n [$isCDATAXml]() {\n return false;\n }\n\n [$isBindable]() {\n return false;\n }\n\n [$popPara]() {\n if (this.para) {\n this[$getTemplateRoot]()[$extra].paraStack.pop();\n }\n }\n\n [$pushPara]() {\n this[$getTemplateRoot]()[$extra].paraStack.push(this.para);\n }\n\n [$setId](ids) {\n if (this.id && this[$namespaceId] === NamespaceIds.template.id) {\n ids.set(this.id, this);\n }\n }\n\n [$getTemplateRoot]() {\n return this[$globalData].template;\n }\n\n [$isSplittable]() {\n return false;\n }\n\n /**\n Return true if this node (typically a container)\n can provide more width during layout.\n The goal is to help to know what a descendant must\n do in case of horizontal overflow.\n */\n [$isThereMoreWidth]() {\n return false;\n }\n\n [$appendChild](child) {\n child[_parent] = this;\n this[_children].push(child);\n if (!child[$globalData] && this[$globalData]) {\n child[$globalData] = this[$globalData];\n }\n }\n\n [$removeChild](child) {\n const i = this[_children].indexOf(child);\n this[_children].splice(i, 1);\n }\n\n [$hasSettableValue]() {\n return this.hasOwnProperty(\"value\");\n }\n\n [$setValue](_) {}\n\n [$onText](_) {}\n\n [$finalize]() {}\n\n [$clean](builder) {\n delete this[_hasChildren];\n if (this[$cleanup]) {\n builder.clean(this[$cleanup]);\n delete this[$cleanup];\n }\n }\n\n [$indexOf](child) {\n return this[_children].indexOf(child);\n }\n\n [$insertAt](i, child) {\n child[_parent] = this;\n this[_children].splice(i, 0, child);\n if (!child[$globalData] && this[$globalData]) {\n child[$globalData] = this[$globalData];\n }\n }\n\n /**\n * If true the element is transparent when searching a node using\n * a SOM expression which means that looking for \"foo.bar\" in\n * <... name=\"foo\"><... name=\"bar\">...\n * is fine because toto and titi are transparent.\n */\n [$isTransparent]() {\n return !this.name;\n }\n\n [$lastAttribute]() {\n return \"\";\n }\n\n [$text]() {\n if (this[_children].length === 0) {\n return this[$content];\n }\n return this[_children].map(c => c[$text]()).join(\"\");\n }\n\n get [_attributeNames]() {\n // Lazily get attributes names\n const proto = Object.getPrototypeOf(this);\n if (!proto._attributes) {\n const attributes = (proto._attributes = new Set());\n for (const name of Object.getOwnPropertyNames(this)) {\n if (\n this[name] === null ||\n this[name] instanceof XFAObject ||\n this[name] instanceof XFAObjectArray\n ) {\n break;\n }\n attributes.add(name);\n }\n }\n return shadow(this, _attributeNames, proto._attributes);\n }\n\n [$isDescendent](parent) {\n let node = this;\n while (node) {\n if (node === parent) {\n return true;\n }\n node = node[$getParent]();\n }\n return false;\n }\n\n [$getParent]() {\n return this[_parent];\n }\n\n [$getSubformParent]() {\n return this[$getParent]();\n }\n\n [$getChildren](name = null) {\n if (!name) {\n return this[_children];\n }\n\n return this[name];\n }\n\n [$dump]() {\n const dumped = Object.create(null);\n if (this[$content]) {\n dumped.$content = this[$content];\n }\n\n for (const name of Object.getOwnPropertyNames(this)) {\n const value = this[name];\n if (value === null) {\n continue;\n }\n if (value instanceof XFAObject) {\n dumped[name] = value[$dump]();\n } else if (value instanceof XFAObjectArray) {\n if (!value.isEmpty()) {\n dumped[name] = value.dump();\n }\n } else {\n dumped[name] = value;\n }\n }\n\n return dumped;\n }\n\n [$toStyle]() {\n return null;\n }\n\n [$toHTML]() {\n return HTMLResult.EMPTY;\n }\n\n *[$getContainedChildren]() {\n // This function is overriden in Subform and SubformSet.\n for (const node of this[$getChildren]()) {\n yield node;\n }\n }\n\n *[_filteredChildrenGenerator](filter, include) {\n for (const node of this[$getContainedChildren]()) {\n if (!filter || include === filter.has(node[$nodeName])) {\n const availableSpace = this[$getAvailableSpace]();\n const res = node[$toHTML](availableSpace);\n if (!res.success) {\n this[$extra].failingNode = node;\n }\n yield res;\n }\n }\n }\n\n [$flushHTML]() {\n return null;\n }\n\n [$addHTML](html, bbox) {\n this[$extra].children.push(html);\n }\n\n [$getAvailableSpace]() {}\n\n [$childrenToHTML]({ filter = null, include = true }) {\n if (!this[$extra].generator) {\n this[$extra].generator = this[_filteredChildrenGenerator](\n filter,\n include\n );\n } else {\n const availableSpace = this[$getAvailableSpace]();\n const res = this[$extra].failingNode[$toHTML](availableSpace);\n if (!res.success) {\n return res;\n }\n if (res.html) {\n this[$addHTML](res.html, res.bbox);\n }\n delete this[$extra].failingNode;\n }\n\n while (true) {\n const gen = this[$extra].generator.next();\n if (gen.done) {\n break;\n }\n const res = gen.value;\n if (!res.success) {\n return res;\n }\n if (res.html) {\n this[$addHTML](res.html, res.bbox);\n }\n }\n\n this[$extra].generator = null;\n\n return HTMLResult.EMPTY;\n }\n\n [$setSetAttributes](attributes) {\n // Just keep set attributes because it can be used in a proto.\n this[_setAttributes] = new Set(Object.keys(attributes));\n }\n\n /**\n * Get attribute names which have been set in the proto but not in this.\n */\n [_getUnsetAttributes](protoAttributes) {\n const allAttr = this[_attributeNames];\n const setAttr = this[_setAttributes];\n return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));\n }\n\n /**\n * Update the node with properties coming from a prototype and apply\n * this function recursively to all children.\n */\n [$resolvePrototypes](ids, ancestors = new Set()) {\n for (const child of this[_children]) {\n child[_resolvePrototypesHelper](ids, ancestors);\n }\n }\n\n [_resolvePrototypesHelper](ids, ancestors) {\n const proto = this[_getPrototype](ids, ancestors);\n if (proto) {\n // _applyPrototype will apply $resolvePrototypes with correct ancestors\n // to avoid infinite loop.\n this[_applyPrototype](proto, ids, ancestors);\n } else {\n this[$resolvePrototypes](ids, ancestors);\n }\n }\n\n [_getPrototype](ids, ancestors) {\n const { use, usehref } = this;\n if (!use && !usehref) {\n return null;\n }\n\n let proto = null;\n let somExpression = null;\n let id = null;\n let ref = use;\n\n // If usehref and use are non-empty then use usehref.\n if (usehref) {\n ref = usehref;\n // Href can be one of the following:\n // - #ID\n // - URI#ID\n // - #som(expression)\n // - URI#som(expression)\n // - URI\n // For now we don't handle URI other than \".\" (current document).\n if (usehref.startsWith(\"#som(\") && usehref.endsWith(\")\")) {\n somExpression = usehref.slice(\"#som(\".length, -1);\n } else if (usehref.startsWith(\".#som(\") && usehref.endsWith(\")\")) {\n somExpression = usehref.slice(\".#som(\".length, -1);\n } else if (usehref.startsWith(\"#\")) {\n id = usehref.slice(1);\n } else if (usehref.startsWith(\".#\")) {\n id = usehref.slice(2);\n }\n } else if (use.startsWith(\"#\")) {\n id = use.slice(1);\n } else {\n somExpression = use;\n }\n\n this.use = this.usehref = \"\";\n if (id) {\n proto = ids.get(id);\n } else {\n proto = searchNode(\n ids.get($root),\n this,\n somExpression,\n true /* = dotDotAllowed */,\n false /* = useCache */\n );\n if (proto) {\n proto = proto[0];\n }\n }\n\n if (!proto) {\n warn(`XFA - Invalid prototype reference: ${ref}.`);\n return null;\n }\n\n if (proto[$nodeName] !== this[$nodeName]) {\n warn(\n `XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`\n );\n return null;\n }\n\n if (ancestors.has(proto)) {\n // We've a cycle so break it.\n warn(`XFA - Cycle detected in prototypes use.`);\n return null;\n }\n\n ancestors.add(proto);\n\n // The prototype can have a \"use\" attribute itself.\n const protoProto = proto[_getPrototype](ids, ancestors);\n if (protoProto) {\n proto[_applyPrototype](protoProto, ids, ancestors);\n }\n\n // The prototype can have a child which itself has a \"use\" property.\n proto[$resolvePrototypes](ids, ancestors);\n\n ancestors.delete(proto);\n\n return proto;\n }\n\n [_applyPrototype](proto, ids, ancestors) {\n if (ancestors.has(proto)) {\n // We've a cycle so break it.\n warn(`XFA - Cycle detected in prototypes use.`);\n return;\n }\n\n if (!this[$content] && proto[$content]) {\n this[$content] = proto[$content];\n }\n\n const newAncestors = new Set(ancestors);\n newAncestors.add(proto);\n\n for (const unsetAttrName of this[_getUnsetAttributes](\n proto[_setAttributes]\n )) {\n this[unsetAttrName] = proto[unsetAttrName];\n if (this[_setAttributes]) {\n this[_setAttributes].add(unsetAttrName);\n }\n }\n\n for (const name of Object.getOwnPropertyNames(this)) {\n if (this[_attributeNames].has(name)) {\n continue;\n }\n const value = this[name];\n const protoValue = proto[name];\n\n if (value instanceof XFAObjectArray) {\n for (const child of value[_children]) {\n child[_resolvePrototypesHelper](ids, ancestors);\n }\n\n for (\n let i = value[_children].length, ii = protoValue[_children].length;\n i < ii;\n i++\n ) {\n const child = proto[_children][i][$clone]();\n if (value.push(child)) {\n child[_parent] = this;\n this[_children].push(child);\n child[_resolvePrototypesHelper](ids, ancestors);\n } else {\n // No need to continue: other nodes will be rejected.\n break;\n }\n }\n continue;\n }\n\n if (value !== null) {\n value[$resolvePrototypes](ids, ancestors);\n if (protoValue) {\n // protoValue must be treated as a prototype for value.\n value[_applyPrototype](protoValue, ids, ancestors);\n }\n continue;\n }\n\n if (protoValue !== null) {\n const child = protoValue[$clone]();\n child[_parent] = this;\n this[name] = child;\n this[_children].push(child);\n child[_resolvePrototypesHelper](ids, ancestors);\n }\n }\n }\n\n static [_cloneAttribute](obj) {\n if (Array.isArray(obj)) {\n return obj.map(x => XFAObject[_cloneAttribute](x));\n }\n if (typeof obj === \"object\" && obj !== null) {\n return Object.assign({}, obj);\n }\n return obj;\n }\n\n [$clone]() {\n const clone = Object.create(Object.getPrototypeOf(this));\n for (const $symbol of Object.getOwnPropertySymbols(this)) {\n try {\n clone[$symbol] = this[$symbol];\n } catch {\n shadow(clone, $symbol, this[$symbol]);\n }\n }\n clone[$uid] = `${clone[$nodeName]}${uid++}`;\n clone[_children] = [];\n\n for (const name of Object.getOwnPropertyNames(this)) {\n if (this[_attributeNames].has(name)) {\n clone[name] = XFAObject[_cloneAttribute](this[name]);\n continue;\n }\n const value = this[name];\n clone[name] =\n value instanceof XFAObjectArray\n ? new XFAObjectArray(value[_max])\n : null;\n }\n\n for (const child of this[_children]) {\n const name = child[$nodeName];\n const clonedChild = child[$clone]();\n clone[_children].push(clonedChild);\n clonedChild[_parent] = clone;\n if (clone[name] === null) {\n clone[name] = clonedChild;\n } else {\n clone[name][_children].push(clonedChild);\n }\n }\n\n return clone;\n }\n\n [$getChildren](name = null) {\n if (!name) {\n return this[_children];\n }\n\n return this[_children].filter(c => c[$nodeName] === name);\n }\n\n [$getChildrenByClass](name) {\n return this[name];\n }\n\n [$getChildrenByName](name, allTransparent, first = true) {\n return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));\n }\n\n *[$getChildrenByNameIt](name, allTransparent, first = true) {\n if (name === \"parent\") {\n yield this[_parent];\n return;\n }\n\n for (const child of this[_children]) {\n if (child[$nodeName] === name) {\n yield child;\n }\n\n if (child.name === name) {\n yield child;\n }\n\n if (allTransparent || child[$isTransparent]()) {\n yield* child[$getChildrenByNameIt](name, allTransparent, false);\n }\n }\n\n if (first && this[_attributeNames].has(name)) {\n yield new XFAAttribute(this, name, this[name]);\n }\n }\n}\n\nclass XFAObjectArray {\n constructor(max = Infinity) {\n this[_max] = max;\n this[_children] = [];\n }\n\n get isXFAObject() {\n return false;\n }\n\n get isXFAObjectArray() {\n return true;\n }\n\n push(child) {\n const len = this[_children].length;\n if (len <= this[_max]) {\n this[_children].push(child);\n return true;\n }\n warn(\n `XFA - node \"${child[$nodeName]}\" accepts no more than ${this[_max]} children`\n );\n return false;\n }\n\n isEmpty() {\n return this[_children].length === 0;\n }\n\n dump() {\n return this[_children].length === 1\n ? this[_children][0][$dump]()\n : this[_children].map(x => x[$dump]());\n }\n\n [$clone]() {\n const clone = new XFAObjectArray(this[_max]);\n clone[_children] = this[_children].map(c => c[$clone]());\n return clone;\n }\n\n get children() {\n return this[_children];\n }\n\n clear() {\n this[_children].length = 0;\n }\n}\n\nclass XFAAttribute {\n constructor(node, name, value) {\n this[_parent] = node;\n this[$nodeName] = name;\n this[$content] = value;\n this[$consumed] = false;\n this[$uid] = `attribute${uid++}`;\n }\n\n [$getParent]() {\n return this[_parent];\n }\n\n [$isDataValue]() {\n return true;\n }\n\n [$getDataValue]() {\n return this[$content].trim();\n }\n\n [$setValue](value) {\n value = value.value || \"\";\n this[$content] = value.toString();\n }\n\n [$text]() {\n return this[$content];\n }\n\n [$isDescendent](parent) {\n return this[_parent] === parent || this[_parent][$isDescendent](parent);\n }\n}\n\nclass XmlObject extends XFAObject {\n constructor(nsId, name, attributes = {}) {\n super(nsId, name);\n this[$content] = \"\";\n this[_dataValue] = null;\n if (name !== \"#text\") {\n const map = new Map();\n this[_attributes] = map;\n for (const [attrName, value] of Object.entries(attributes)) {\n map.set(attrName, new XFAAttribute(this, attrName, value));\n }\n if (attributes.hasOwnProperty($nsAttributes)) {\n // XFA attributes.\n const dataNode = attributes[$nsAttributes].xfa.dataNode;\n if (dataNode !== undefined) {\n if (dataNode === \"dataGroup\") {\n this[_dataValue] = false;\n } else if (dataNode === \"dataValue\") {\n this[_dataValue] = true;\n }\n }\n }\n }\n this[$consumed] = false;\n }\n\n [$toString](buf) {\n const tagName = this[$nodeName];\n if (tagName === \"#text\") {\n buf.push(encodeToXmlString(this[$content]));\n return;\n }\n const utf8TagName = utf8StringToString(tagName);\n const prefix = this[$namespaceId] === NS_DATASETS ? \"xfa:\" : \"\";\n buf.push(`<${prefix}${utf8TagName}`);\n for (const [name, value] of this[_attributes].entries()) {\n const utf8Name = utf8StringToString(name);\n buf.push(` ${utf8Name}=\"${encodeToXmlString(value[$content])}\"`);\n }\n if (this[_dataValue] !== null) {\n if (this[_dataValue]) {\n buf.push(` xfa:dataNode=\"dataValue\"`);\n } else {\n buf.push(` xfa:dataNode=\"dataGroup\"`);\n }\n }\n if (!this[$content] && this[_children].length === 0) {\n buf.push(\"/>\");\n return;\n }\n\n buf.push(\">\");\n if (this[$content]) {\n if (typeof this[$content] === \"string\") {\n buf.push(encodeToXmlString(this[$content]));\n } else {\n this[$content][$toString](buf);\n }\n } else {\n for (const child of this[_children]) {\n child[$toString](buf);\n }\n }\n buf.push(`${prefix}${utf8TagName}>`);\n }\n\n [$onChild](child) {\n if (this[$content]) {\n const node = new XmlObject(this[$namespaceId], \"#text\");\n this[$appendChild](node);\n node[$content] = this[$content];\n this[$content] = \"\";\n }\n this[$appendChild](child);\n return true;\n }\n\n [$onText](str) {\n this[$content] += str;\n }\n\n [$finalize]() {\n if (this[$content] && this[_children].length > 0) {\n const node = new XmlObject(this[$namespaceId], \"#text\");\n this[$appendChild](node);\n node[$content] = this[$content];\n delete this[$content];\n }\n }\n\n [$toHTML]() {\n if (this[$nodeName] === \"#text\") {\n return HTMLResult.success({\n name: \"#text\",\n value: this[$content],\n });\n }\n\n return HTMLResult.EMPTY;\n }\n\n [$getChildren](name = null) {\n if (!name) {\n return this[_children];\n }\n\n return this[_children].filter(c => c[$nodeName] === name);\n }\n\n [$getAttributes]() {\n return this[_attributes];\n }\n\n [$getChildrenByClass](name) {\n const value = this[_attributes].get(name);\n if (value !== undefined) {\n return value;\n }\n return this[$getChildren](name);\n }\n\n *[$getChildrenByNameIt](name, allTransparent) {\n const value = this[_attributes].get(name);\n if (value) {\n yield value;\n }\n\n for (const child of this[_children]) {\n if (child[$nodeName] === name) {\n yield child;\n }\n\n if (allTransparent) {\n yield* child[$getChildrenByNameIt](name, allTransparent);\n }\n }\n }\n\n *[$getAttributeIt](name, skipConsumed) {\n const value = this[_attributes].get(name);\n if (value && (!skipConsumed || !value[$consumed])) {\n yield value;\n }\n for (const child of this[_children]) {\n yield* child[$getAttributeIt](name, skipConsumed);\n }\n }\n\n *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {\n for (const child of this[_children]) {\n if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {\n yield child;\n }\n\n if (allTransparent) {\n yield* child[$getRealChildrenByNameIt](\n name,\n allTransparent,\n skipConsumed\n );\n }\n }\n }\n\n [$isDataValue]() {\n if (this[_dataValue] === null) {\n return (\n this[_children].length === 0 ||\n this[_children][0][$namespaceId] === NamespaceIds.xhtml.id\n );\n }\n return this[_dataValue];\n }\n\n [$getDataValue]() {\n if (this[_dataValue] === null) {\n if (this[_children].length === 0) {\n return this[$content].trim();\n }\n if (this[_children][0][$namespaceId] === NamespaceIds.xhtml.id) {\n return this[_children][0][$text]().trim();\n }\n return null;\n }\n return this[$content].trim();\n }\n\n [$setValue](value) {\n value = value.value || \"\";\n this[$content] = value.toString();\n }\n\n [$dump](hasNS = false) {\n const dumped = Object.create(null);\n if (hasNS) {\n dumped.$ns = this[$namespaceId];\n }\n if (this[$content]) {\n dumped.$content = this[$content];\n }\n dumped.$name = this[$nodeName];\n\n dumped.children = [];\n for (const child of this[_children]) {\n dumped.children.push(child[$dump](hasNS));\n }\n\n dumped.attributes = Object.create(null);\n for (const [name, value] of this[_attributes]) {\n dumped.attributes[name] = value[$content];\n }\n\n return dumped;\n }\n}\n\nclass ContentObject extends XFAObject {\n constructor(nsId, name) {\n super(nsId, name);\n this[$content] = \"\";\n }\n\n [$onText](text) {\n this[$content] += text;\n }\n\n [$finalize]() {}\n}\n\nclass OptionObject extends ContentObject {\n constructor(nsId, name, options) {\n super(nsId, name);\n this[_options] = options;\n }\n\n [$finalize]() {\n this[$content] = getKeyword({\n data: this[$content],\n defaultValue: this[_options][0],\n validate: k => this[_options].includes(k),\n });\n }\n\n [$clean](builder) {\n super[$clean](builder);\n delete this[_options];\n }\n}\n\nclass StringObject extends ContentObject {\n [$finalize]() {\n this[$content] = this[$content].trim();\n }\n}\n\nclass IntegerObject extends ContentObject {\n constructor(nsId, name, defaultValue, validator) {\n super(nsId, name);\n this[_defaultValue] = defaultValue;\n this[_validator] = validator;\n }\n\n [$finalize]() {\n this[$content] = getInteger({\n data: this[$content],\n defaultValue: this[_defaultValue],\n validate: this[_validator],\n });\n }\n\n [$clean](builder) {\n super[$clean](builder);\n delete this[_defaultValue];\n delete this[_validator];\n }\n}\n\nclass Option01 extends IntegerObject {\n constructor(nsId, name) {\n super(nsId, name, 0, n => n === 1);\n }\n}\n\nclass Option10 extends IntegerObject {\n constructor(nsId, name) {\n super(nsId, name, 1, n => n === 0);\n }\n}\n\nexport {\n ContentObject,\n IntegerObject,\n Option01,\n Option10,\n OptionObject,\n StringObject,\n XFAAttribute,\n XFAObject,\n XFAObjectArray,\n XmlObject,\n};\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $getChildren,\n $getChildrenByClass,\n $getChildrenByName,\n $getParent,\n} from \"./symbol_utils.js\";\nimport { warn } from \"../../shared/util.js\";\n\nconst namePattern = /^[^.[]+/;\nconst indexPattern = /^[^\\]]+/;\nconst operators = {\n dot: 0,\n dotDot: 1,\n dotHash: 2,\n dotBracket: 3,\n dotParen: 4,\n};\n\nconst shortcuts = new Map([\n [\"$data\", (root, current) => (root.datasets ? root.datasets.data : root)],\n [\n \"$record\",\n (root, current) =>\n (root.datasets ? root.datasets.data : root)[$getChildren]()[0],\n ],\n [\"$template\", (root, current) => root.template],\n [\"$connectionSet\", (root, current) => root.connectionSet],\n [\"$form\", (root, current) => root.form],\n [\"$layout\", (root, current) => root.layout],\n [\"$host\", (root, current) => root.host],\n [\"$dataWindow\", (root, current) => root.dataWindow],\n [\"$event\", (root, current) => root.event],\n [\"!\", (root, current) => root.datasets],\n [\"$xfa\", (root, current) => root],\n [\"xfa\", (root, current) => root],\n [\"$\", (root, current) => current],\n]);\n\nconst somCache = new WeakMap();\n\nfunction parseIndex(index) {\n index = index.trim();\n if (index === \"*\") {\n return Infinity;\n }\n return parseInt(index, 10) || 0;\n}\n\n// For now expressions containing .[...] or .(...) are not\n// evaluated so don't parse them.\n// TODO: implement that stuff and the remove the noExpr param.\nfunction parseExpression(expr, dotDotAllowed, noExpr = true) {\n let match = expr.match(namePattern);\n if (!match) {\n return null;\n }\n\n let [name] = match;\n const parsed = [\n {\n name,\n cacheName: \".\" + name,\n index: 0,\n js: null,\n formCalc: null,\n operator: operators.dot,\n },\n ];\n\n let pos = name.length;\n\n while (pos < expr.length) {\n const spos = pos;\n const char = expr.charAt(pos++);\n if (char === \"[\") {\n match = expr.slice(pos).match(indexPattern);\n if (!match) {\n warn(\"XFA - Invalid index in SOM expression\");\n return null;\n }\n parsed.at(-1).index = parseIndex(match[0]);\n pos += match[0].length + 1;\n continue;\n }\n\n let operator;\n switch (expr.charAt(pos)) {\n case \".\":\n if (!dotDotAllowed) {\n return null;\n }\n pos++;\n operator = operators.dotDot;\n break;\n case \"#\":\n pos++;\n operator = operators.dotHash;\n break;\n case \"[\":\n if (noExpr) {\n warn(\n \"XFA - SOM expression contains a FormCalc subexpression which is not supported for now.\"\n );\n return null;\n }\n // TODO: FormCalc expression so need to use the parser\n operator = operators.dotBracket;\n break;\n case \"(\":\n if (noExpr) {\n warn(\n \"XFA - SOM expression contains a JavaScript subexpression which is not supported for now.\"\n );\n return null;\n }\n // TODO:\n // JavaScript expression: should be a boolean operation with a path\n // so maybe we can have our own parser for that stuff or\n // maybe use the formcalc one.\n operator = operators.dotParen;\n break;\n default:\n operator = operators.dot;\n break;\n }\n\n match = expr.slice(pos).match(namePattern);\n if (!match) {\n break;\n }\n\n [name] = match;\n pos += name.length;\n parsed.push({\n name,\n cacheName: expr.slice(spos, pos),\n operator,\n index: 0,\n js: null,\n formCalc: null,\n });\n }\n return parsed;\n}\n\nfunction searchNode(\n root,\n container,\n expr,\n dotDotAllowed = true,\n useCache = true\n) {\n const parsed = parseExpression(expr, dotDotAllowed);\n if (!parsed) {\n return null;\n }\n\n const fn = shortcuts.get(parsed[0].name);\n let i = 0;\n let isQualified;\n if (fn) {\n isQualified = true;\n root = [fn(root, container)];\n i = 1;\n } else {\n isQualified = container === null;\n root = [container || root];\n }\n\n for (let ii = parsed.length; i < ii; i++) {\n const { name, cacheName, operator, index } = parsed[i];\n const nodes = [];\n for (const node of root) {\n if (!node.isXFAObject) {\n continue;\n }\n\n let children, cached;\n\n if (useCache) {\n cached = somCache.get(node);\n if (!cached) {\n cached = new Map();\n somCache.set(node, cached);\n }\n children = cached.get(cacheName);\n }\n\n if (!children) {\n switch (operator) {\n case operators.dot:\n children = node[$getChildrenByName](name, false);\n break;\n case operators.dotDot:\n children = node[$getChildrenByName](name, true);\n break;\n case operators.dotHash:\n children = node[$getChildrenByClass](name);\n children = children.isXFAObjectArray\n ? children.children\n : [children];\n break;\n default:\n break;\n }\n if (useCache) {\n cached.set(cacheName, children);\n }\n }\n\n if (children.length > 0) {\n nodes.push(children);\n }\n }\n\n if (nodes.length === 0 && !isQualified && i === 0) {\n // We've an unqualified expression and we didn't find anything\n // so look at container and siblings of container and so on.\n // http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.364.2157&rep=rep1&type=pdf#page=114\n const parent = container[$getParent]();\n container = parent;\n if (!container) {\n return null;\n }\n i = -1;\n root = [container];\n continue;\n }\n\n root = isFinite(index)\n ? nodes.filter(node => index < node.length).map(node => node[index])\n : nodes.flat();\n }\n\n if (root.length === 0) {\n return null;\n }\n\n return root;\n}\n\nfunction createDataNode(root, container, expr) {\n const parsed = parseExpression(expr);\n if (!parsed) {\n return null;\n }\n\n if (parsed.some(x => x.operator === operators.dotDot)) {\n return null;\n }\n\n const fn = shortcuts.get(parsed[0].name);\n let i = 0;\n if (fn) {\n root = fn(root, container);\n i = 1;\n } else {\n root = container || root;\n }\n\n for (let ii = parsed.length; i < ii; i++) {\n const { name, operator, index } = parsed[i];\n if (!isFinite(index)) {\n parsed[i].index = 0;\n return root.createNodes(parsed.slice(i));\n }\n\n let children;\n switch (operator) {\n case operators.dot:\n children = root[$getChildrenByName](name, false);\n break;\n case operators.dotDot:\n children = root[$getChildrenByName](name, true);\n break;\n case operators.dotHash:\n children = root[$getChildrenByClass](name);\n children = children.isXFAObjectArray ? children.children : [children];\n break;\n default:\n break;\n }\n\n if (children.length === 0) {\n return root.createNodes(parsed.slice(i));\n }\n\n if (index < children.length) {\n const child = children[index];\n if (!child.isXFAObject) {\n warn(`XFA - Cannot create a node.`);\n return null;\n }\n root = child;\n } else {\n parsed[i].index = index - children.length;\n return root.createNodes(parsed.slice(i));\n }\n }\n return null;\n}\n\nexport { createDataNode, searchNode };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $getAttributes,\n $getChildren,\n $nodeName,\n $setValue,\n $toString,\n $uid,\n} from \"./symbol_utils.js\";\n\nclass DataHandler {\n constructor(root, data) {\n this.data = data;\n this.dataset = root.datasets || null;\n }\n\n serialize(storage) {\n const stack = [[-1, this.data[$getChildren]()]];\n\n while (stack.length > 0) {\n const last = stack.at(-1);\n const [i, children] = last;\n if (i + 1 === children.length) {\n stack.pop();\n continue;\n }\n\n const child = children[++last[0]];\n const storageEntry = storage.get(child[$uid]);\n if (storageEntry) {\n child[$setValue](storageEntry);\n } else {\n const attributes = child[$getAttributes]();\n for (const value of attributes.values()) {\n const entry = storage.get(value[$uid]);\n if (entry) {\n value[$setValue](entry);\n break;\n }\n }\n }\n\n const nodes = child[$getChildren]();\n if (nodes.length > 0) {\n stack.push([-1, nodes]);\n }\n }\n\n const buf = [\n ``,\n ];\n if (this.dataset) {\n // Dump nodes other than data: they can contains for example\n // some data for choice lists.\n for (const child of this.dataset[$getChildren]()) {\n if (child[$nodeName] !== \"data\") {\n child[$toString](buf);\n }\n }\n }\n this.data[$toString](buf);\n buf.push(\"\");\n\n return buf.join(\"\");\n }\n}\n\nexport { DataHandler };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $acceptWhitespace,\n $clean,\n $content,\n $finalize,\n $globalData,\n $isCDATAXml,\n $nsAttributes,\n $onChild,\n $onText,\n $setId,\n} from \"./symbol_utils.js\";\nimport { XMLParserBase, XMLParserErrorCode } from \"../xml_parser.js\";\nimport { Builder } from \"./builder.js\";\nimport { warn } from \"../../shared/util.js\";\n\nclass XFAParser extends XMLParserBase {\n constructor(rootNameSpace = null, richText = false) {\n super();\n this._builder = new Builder(rootNameSpace);\n this._stack = [];\n this._globalData = {\n usedTypefaces: new Set(),\n };\n this._ids = new Map();\n this._current = this._builder.buildRoot(this._ids);\n this._errorCode = XMLParserErrorCode.NoError;\n this._whiteRegex = /^\\s+$/;\n this._nbsps = /\\xa0+/g;\n this._richText = richText;\n }\n\n parse(data) {\n this.parseXml(data);\n\n if (this._errorCode !== XMLParserErrorCode.NoError) {\n return undefined;\n }\n\n this._current[$finalize]();\n\n return this._current.element;\n }\n\n onText(text) {\n // Normally by definition a   is unbreakable\n // but in real life Acrobat can break strings on  .\n text = text.replace(this._nbsps, match => match.slice(1) + \" \");\n if (this._richText || this._current[$acceptWhitespace]()) {\n this._current[$onText](text, this._richText);\n return;\n }\n\n if (this._whiteRegex.test(text)) {\n return;\n }\n this._current[$onText](text.trim());\n }\n\n onCdata(text) {\n this._current[$onText](text);\n }\n\n _mkAttributes(attributes, tagName) {\n // Transform attributes into an object and get out\n // namespaces information.\n let namespace = null;\n let prefixes = null;\n const attributeObj = Object.create({});\n for (const { name, value } of attributes) {\n if (name === \"xmlns\") {\n if (!namespace) {\n namespace = value;\n } else {\n warn(`XFA - multiple namespace definition in <${tagName}>`);\n }\n } else if (name.startsWith(\"xmlns:\")) {\n const prefix = name.substring(\"xmlns:\".length);\n if (!prefixes) {\n prefixes = [];\n }\n prefixes.push({ prefix, value });\n } else {\n const i = name.indexOf(\":\");\n if (i === -1) {\n attributeObj[name] = value;\n } else {\n // Attributes can have their own namespace.\n // For example in data, we can have \n let nsAttrs = attributeObj[$nsAttributes];\n if (!nsAttrs) {\n nsAttrs = attributeObj[$nsAttributes] = Object.create(null);\n }\n const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];\n const attrs = (nsAttrs[ns] ||= Object.create(null));\n attrs[attrName] = value;\n }\n }\n }\n\n return [namespace, prefixes, attributeObj];\n }\n\n _getNameAndPrefix(name, nsAgnostic) {\n const i = name.indexOf(\":\");\n if (i === -1) {\n return [name, null];\n }\n return [name.substring(i + 1), nsAgnostic ? \"\" : name.substring(0, i)];\n }\n\n onBeginElement(tagName, attributes, isEmpty) {\n const [namespace, prefixes, attributesObj] = this._mkAttributes(\n attributes,\n tagName\n );\n const [name, nsPrefix] = this._getNameAndPrefix(\n tagName,\n this._builder.isNsAgnostic()\n );\n const node = this._builder.build({\n nsPrefix,\n name,\n attributes: attributesObj,\n namespace,\n prefixes,\n });\n node[$globalData] = this._globalData;\n\n if (isEmpty) {\n // No children: just push the node into its parent.\n node[$finalize]();\n if (this._current[$onChild](node)) {\n node[$setId](this._ids);\n }\n node[$clean](this._builder);\n return;\n }\n\n this._stack.push(this._current);\n this._current = node;\n }\n\n onEndElement(name) {\n const node = this._current;\n if (node[$isCDATAXml]() && typeof node[$content] === \"string\") {\n const parser = new XFAParser();\n parser._globalData = this._globalData;\n const root = parser.parse(node[$content]);\n node[$content] = null;\n node[$onChild](root);\n }\n\n node[$finalize]();\n this._current = this._stack.pop();\n if (this._current[$onChild](node)) {\n node[$setId](this._ids);\n }\n node[$clean](this._builder);\n }\n\n onError(code) {\n this._errorCode = code;\n }\n}\n\nexport { XFAParser };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport {\n $cleanup,\n $finalize,\n $ids,\n $isNsAgnostic,\n $nsAttributes,\n $onChild,\n $resolvePrototypes,\n $root,\n} from \"./symbol_utils.js\";\nimport { NamespaceSetUp } from \"./setup.js\";\nimport { Template } from \"./template.js\";\nimport { UnknownNamespace } from \"./unknown.js\";\nimport { warn } from \"../../shared/util.js\";\nimport { XFAObject } from \"./xfa_object.js\";\n\nclass Root extends XFAObject {\n constructor(ids) {\n super(-1, \"root\", Object.create(null));\n this.element = null;\n this[$ids] = ids;\n }\n\n [$onChild](child) {\n this.element = child;\n return true;\n }\n\n [$finalize]() {\n super[$finalize]();\n if (this.element.template instanceof Template) {\n // Set the root element in $ids using a symbol in order\n // to avoid conflict with real IDs.\n this[$ids].set($root, this.element);\n\n this.element.template[$resolvePrototypes](this[$ids]);\n this.element.template[$ids] = this[$ids];\n }\n }\n}\n\nclass Empty extends XFAObject {\n constructor() {\n super(-1, \"\", Object.create(null));\n }\n\n [$onChild](_) {\n return false;\n }\n}\n\nclass Builder {\n constructor(rootNameSpace = null) {\n this._namespaceStack = [];\n this._nsAgnosticLevel = 0;\n\n // Each prefix has its own stack\n this._namespacePrefixes = new Map();\n this._namespaces = new Map();\n this._nextNsId = Math.max(\n ...Object.values(NamespaceIds).map(({ id }) => id)\n );\n this._currentNamespace =\n rootNameSpace || new UnknownNamespace(++this._nextNsId);\n }\n\n buildRoot(ids) {\n return new Root(ids);\n }\n\n build({ nsPrefix, name, attributes, namespace, prefixes }) {\n const hasNamespaceDef = namespace !== null;\n if (hasNamespaceDef) {\n // Define the current namespace to use.\n this._namespaceStack.push(this._currentNamespace);\n this._currentNamespace = this._searchNamespace(namespace);\n }\n\n if (prefixes) {\n // The xml node may have namespace prefix definitions\n this._addNamespacePrefix(prefixes);\n }\n\n if (attributes.hasOwnProperty($nsAttributes)) {\n // Only support xfa-data namespace.\n const dataTemplate = NamespaceSetUp.datasets;\n const nsAttrs = attributes[$nsAttributes];\n let xfaAttrs = null;\n for (const [ns, attrs] of Object.entries(nsAttrs)) {\n const nsToUse = this._getNamespaceToUse(ns);\n if (nsToUse === dataTemplate) {\n xfaAttrs = { xfa: attrs };\n break;\n }\n }\n if (xfaAttrs) {\n attributes[$nsAttributes] = xfaAttrs;\n } else {\n delete attributes[$nsAttributes];\n }\n }\n\n const namespaceToUse = this._getNamespaceToUse(nsPrefix);\n const node =\n namespaceToUse?.[$buildXFAObject](name, attributes) || new Empty();\n\n if (node[$isNsAgnostic]()) {\n this._nsAgnosticLevel++;\n }\n\n // In case the node has some namespace things,\n // we must pop the different stacks.\n if (hasNamespaceDef || prefixes || node[$isNsAgnostic]()) {\n node[$cleanup] = {\n hasNamespace: hasNamespaceDef,\n prefixes,\n nsAgnostic: node[$isNsAgnostic](),\n };\n }\n\n return node;\n }\n\n isNsAgnostic() {\n return this._nsAgnosticLevel > 0;\n }\n\n _searchNamespace(nsName) {\n let ns = this._namespaces.get(nsName);\n if (ns) {\n return ns;\n }\n for (const [name, { check }] of Object.entries(NamespaceIds)) {\n if (check(nsName)) {\n ns = NamespaceSetUp[name];\n if (ns) {\n this._namespaces.set(nsName, ns);\n return ns;\n }\n // The namespace is known but not handled.\n break;\n }\n }\n\n ns = new UnknownNamespace(++this._nextNsId);\n this._namespaces.set(nsName, ns);\n return ns;\n }\n\n _addNamespacePrefix(prefixes) {\n for (const { prefix, value } of prefixes) {\n const namespace = this._searchNamespace(value);\n let prefixStack = this._namespacePrefixes.get(prefix);\n if (!prefixStack) {\n prefixStack = [];\n this._namespacePrefixes.set(prefix, prefixStack);\n }\n prefixStack.push(namespace);\n }\n }\n\n _getNamespaceToUse(prefix) {\n if (!prefix) {\n return this._currentNamespace;\n }\n const prefixStack = this._namespacePrefixes.get(prefix);\n if (prefixStack?.length > 0) {\n return prefixStack.at(-1);\n }\n\n warn(`Unknown namespace prefix: ${prefix}.`);\n return null;\n }\n\n clean(data) {\n const { hasNamespace, prefixes, nsAgnostic } = data;\n if (hasNamespace) {\n this._currentNamespace = this._namespaceStack.pop();\n }\n if (prefixes) {\n prefixes.forEach(({ prefix }) => {\n this._namespacePrefixes.get(prefix).pop();\n });\n }\n if (nsAgnostic) {\n this._nsAgnosticLevel--;\n }\n }\n}\n\nexport { Builder };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConfigNamespace } from \"./config.js\";\nimport { ConnectionSetNamespace } from \"./connection_set.js\";\nimport { DatasetsNamespace } from \"./datasets.js\";\nimport { LocaleSetNamespace } from \"./locale_set.js\";\nimport { SignatureNamespace } from \"./signature.js\";\nimport { StylesheetNamespace } from \"./stylesheet.js\";\nimport { TemplateNamespace } from \"./template.js\";\nimport { XdpNamespace } from \"./xdp.js\";\nimport { XhtmlNamespace } from \"./xhtml.js\";\n\nconst NamespaceSetUp = {\n config: ConfigNamespace,\n connection: ConnectionSetNamespace,\n datasets: DatasetsNamespace,\n localeSet: LocaleSetNamespace,\n signature: SignatureNamespace,\n stylesheet: StylesheetNamespace,\n template: TemplateNamespace,\n xdp: XdpNamespace,\n xhtml: XhtmlNamespace,\n};\n\nexport { NamespaceSetUp };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport { $content, $finalize } from \"./symbol_utils.js\";\nimport {\n ContentObject,\n IntegerObject,\n Option01,\n Option10,\n OptionObject,\n StringObject,\n XFAObject,\n XFAObjectArray,\n} from \"./xfa_object.js\";\nimport { getInteger, getStringOption } from \"./utils.js\";\nimport { shadow, warn } from \"../../shared/util.js\";\n\nconst CONFIG_NS_ID = NamespaceIds.config.id;\n\nclass Acrobat extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"acrobat\", /* hasChildren = */ true);\n this.acrobat7 = null;\n this.autoSave = null;\n this.common = null;\n this.validate = null;\n this.validateApprovalSignatures = null;\n this.submitUrl = new XFAObjectArray();\n }\n}\n\nclass Acrobat7 extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"acrobat7\", /* hasChildren = */ true);\n this.dynamicRender = null;\n }\n}\n\nclass ADBE_JSConsole extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"ADBE_JSConsole\", [\"delegate\", \"Enable\", \"Disable\"]);\n }\n}\n\nclass ADBE_JSDebugger extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"ADBE_JSDebugger\", [\"delegate\", \"Enable\", \"Disable\"]);\n }\n}\n\nclass AddSilentPrint extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"addSilentPrint\");\n }\n}\n\nclass AddViewerPreferences extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"addViewerPreferences\");\n }\n}\n\nclass AdjustData extends Option10 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"adjustData\");\n }\n}\n\nclass AdobeExtensionLevel extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"adobeExtensionLevel\", 0, n => n >= 1 && n <= 8);\n }\n}\n\nclass Agent extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"agent\", /* hasChildren = */ true);\n this.name = attributes.name ? attributes.name.trim() : \"\";\n this.common = new XFAObjectArray();\n }\n}\n\nclass AlwaysEmbed extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"alwaysEmbed\");\n }\n}\n\nclass Amd extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"amd\");\n }\n}\n\nclass Area extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"area\");\n this.level = getInteger({\n data: attributes.level,\n defaultValue: 0,\n validate: n => n >= 1 && n <= 3,\n });\n this.name = getStringOption(attributes.name, [\n \"\",\n \"barcode\",\n \"coreinit\",\n \"deviceDriver\",\n \"font\",\n \"general\",\n \"layout\",\n \"merge\",\n \"script\",\n \"signature\",\n \"sourceSet\",\n \"templateCache\",\n ]);\n }\n}\n\nclass Attributes extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"attributes\", [\"preserve\", \"delegate\", \"ignore\"]);\n }\n}\n\nclass AutoSave extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"autoSave\", [\"disabled\", \"enabled\"]);\n }\n}\n\nclass Base extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"base\");\n }\n}\n\nclass BatchOutput extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"batchOutput\");\n this.format = getStringOption(attributes.format, [\n \"none\",\n \"concat\",\n \"zip\",\n \"zipCompress\",\n ]);\n }\n}\n\nclass BehaviorOverride extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"behaviorOverride\");\n }\n\n [$finalize]() {\n this[$content] = new Map(\n this[$content]\n .trim()\n .split(/\\s+/)\n .filter(x => x.includes(\":\"))\n .map(x => x.split(\":\", 2))\n );\n }\n}\n\nclass Cache extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"cache\", /* hasChildren = */ true);\n this.templateCache = null;\n }\n}\n\nclass Change extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"change\");\n }\n}\n\nclass Common extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"common\", /* hasChildren = */ true);\n this.data = null;\n this.locale = null;\n this.localeSet = null;\n this.messaging = null;\n this.suppressBanner = null;\n this.template = null;\n this.validationMessaging = null;\n this.versionControl = null;\n this.log = new XFAObjectArray();\n }\n}\n\nclass Compress extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"compress\");\n this.scope = getStringOption(attributes.scope, [\"imageOnly\", \"document\"]);\n }\n}\n\nclass CompressLogicalStructure extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"compressLogicalStructure\");\n }\n}\n\nclass CompressObjectStream extends Option10 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"compressObjectStream\");\n }\n}\n\nclass Compression extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"compression\", /* hasChildren = */ true);\n this.compressLogicalStructure = null;\n this.compressObjectStream = null;\n this.level = null;\n this.type = null;\n }\n}\n\nclass Config extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"config\", /* hasChildren = */ true);\n this.acrobat = null;\n this.present = null;\n this.trace = null;\n this.agent = new XFAObjectArray();\n }\n}\n\nclass Conformance extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"conformance\", [\"A\", \"B\"]);\n }\n}\n\nclass ContentCopy extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"contentCopy\");\n }\n}\n\nclass Copies extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"copies\", 1, n => n >= 1);\n }\n}\n\nclass Creator extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"creator\");\n }\n}\n\nclass CurrentPage extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"currentPage\", 0, n => n >= 0);\n }\n}\n\nclass Data extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"data\", /* hasChildren = */ true);\n this.adjustData = null;\n this.attributes = null;\n this.incrementalLoad = null;\n this.outputXSL = null;\n this.range = null;\n this.record = null;\n this.startNode = null;\n this.uri = null;\n this.window = null;\n this.xsl = null;\n this.excludeNS = new XFAObjectArray();\n this.transform = new XFAObjectArray();\n }\n}\n\nclass Debug extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"debug\", /* hasChildren = */ true);\n this.uri = null;\n }\n}\n\nclass DefaultTypeface extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"defaultTypeface\");\n this.writingScript = getStringOption(attributes.writingScript, [\n \"*\",\n \"Arabic\",\n \"Cyrillic\",\n \"EastEuropeanRoman\",\n \"Greek\",\n \"Hebrew\",\n \"Japanese\",\n \"Korean\",\n \"Roman\",\n \"SimplifiedChinese\",\n \"Thai\",\n \"TraditionalChinese\",\n \"Vietnamese\",\n ]);\n }\n}\n\nclass Destination extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"destination\", [\n \"pdf\",\n \"pcl\",\n \"ps\",\n \"webClient\",\n \"zpl\",\n ]);\n }\n}\n\nclass DocumentAssembly extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"documentAssembly\");\n }\n}\n\nclass Driver extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"driver\", /* hasChildren = */ true);\n this.name = attributes.name ? attributes.name.trim() : \"\";\n this.fontInfo = null;\n this.xdc = null;\n }\n}\n\nclass DuplexOption extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"duplexOption\", [\n \"simplex\",\n \"duplexFlipLongEdge\",\n \"duplexFlipShortEdge\",\n ]);\n }\n}\n\nclass DynamicRender extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"dynamicRender\", [\"forbidden\", \"required\"]);\n }\n}\n\nclass Embed extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"embed\");\n }\n}\n\nclass Encrypt extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"encrypt\");\n }\n}\n\nclass Encryption extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"encryption\", /* hasChildren = */ true);\n this.encrypt = null;\n this.encryptionLevel = null;\n this.permissions = null;\n }\n}\n\nclass EncryptionLevel extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"encryptionLevel\", [\"40bit\", \"128bit\"]);\n }\n}\n\nclass Enforce extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"enforce\");\n }\n}\n\nclass Equate extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"equate\");\n\n this.force = getInteger({\n data: attributes.force,\n defaultValue: 1,\n validate: n => n === 0,\n });\n\n this.from = attributes.from || \"\";\n this.to = attributes.to || \"\";\n }\n}\n\nclass EquateRange extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"equateRange\");\n\n this.from = attributes.from || \"\";\n this.to = attributes.to || \"\";\n this._unicodeRange = attributes.unicodeRange || \"\";\n }\n\n get unicodeRange() {\n const ranges = [];\n const unicodeRegex = /U\\+([0-9a-fA-F]+)/;\n const unicodeRange = this._unicodeRange;\n for (let range of unicodeRange\n .split(\",\")\n .map(x => x.trim())\n .filter(x => !!x)) {\n range = range.split(\"-\", 2).map(x => {\n const found = x.match(unicodeRegex);\n if (!found) {\n return 0;\n }\n return parseInt(found[1], 16);\n });\n if (range.length === 1) {\n range.push(range[0]);\n }\n ranges.push(range);\n }\n return shadow(this, \"unicodeRange\", ranges);\n }\n}\n\nclass Exclude extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"exclude\");\n }\n\n [$finalize]() {\n this[$content] = this[$content]\n .trim()\n .split(/\\s+/)\n .filter(\n x =>\n x &&\n [\n \"calculate\",\n \"close\",\n \"enter\",\n \"exit\",\n \"initialize\",\n \"ready\",\n \"validate\",\n ].includes(x)\n );\n }\n}\n\nclass ExcludeNS extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"excludeNS\");\n }\n}\n\nclass FlipLabel extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"flipLabel\", [\"usePrinterSetting\", \"on\", \"off\"]);\n }\n}\n\nclass FontInfo extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"fontInfo\", /* hasChildren = */ true);\n this.embed = null;\n this.map = null;\n this.subsetBelow = null;\n this.alwaysEmbed = new XFAObjectArray();\n this.defaultTypeface = new XFAObjectArray();\n this.neverEmbed = new XFAObjectArray();\n }\n}\n\nclass FormFieldFilling extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"formFieldFilling\");\n }\n}\n\nclass GroupParent extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"groupParent\");\n }\n}\n\nclass IfEmpty extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"ifEmpty\", [\n \"dataValue\",\n \"dataGroup\",\n \"ignore\",\n \"remove\",\n ]);\n }\n}\n\nclass IncludeXDPContent extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"includeXDPContent\");\n }\n}\n\nclass IncrementalLoad extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"incrementalLoad\", [\"none\", \"forwardOnly\"]);\n }\n}\n\nclass IncrementalMerge extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"incrementalMerge\");\n }\n}\n\nclass Interactive extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"interactive\");\n }\n}\n\nclass Jog extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"jog\", [\"usePrinterSetting\", \"none\", \"pageSet\"]);\n }\n}\n\nclass LabelPrinter extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"labelPrinter\", /* hasChildren = */ true);\n this.name = getStringOption(attributes.name, [\"zpl\", \"dpl\", \"ipl\", \"tcpl\"]);\n this.batchOutput = null;\n this.flipLabel = null;\n this.fontInfo = null;\n this.xdc = null;\n }\n}\n\nclass Layout extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"layout\", [\"paginate\", \"panel\"]);\n }\n}\n\nclass Level extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"level\", 0, n => n > 0);\n }\n}\n\nclass Linearized extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"linearized\");\n }\n}\n\nclass Locale extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"locale\");\n }\n}\n\nclass LocaleSet extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"localeSet\");\n }\n}\n\nclass Log extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"log\", /* hasChildren = */ true);\n this.mode = null;\n this.threshold = null;\n this.to = null;\n this.uri = null;\n }\n}\n\n// Renamed in MapElement to avoid confusion with usual js Map.\nclass MapElement extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"map\", /* hasChildren = */ true);\n this.equate = new XFAObjectArray();\n this.equateRange = new XFAObjectArray();\n }\n}\n\nclass MediumInfo extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"mediumInfo\", /* hasChildren = */ true);\n this.map = null;\n }\n}\n\nclass Message extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"message\", /* hasChildren = */ true);\n this.msgId = null;\n this.severity = null;\n }\n}\n\nclass Messaging extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"messaging\", /* hasChildren = */ true);\n this.message = new XFAObjectArray();\n }\n}\n\nclass Mode extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"mode\", [\"append\", \"overwrite\"]);\n }\n}\n\nclass ModifyAnnots extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"modifyAnnots\");\n }\n}\n\nclass MsgId extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"msgId\", 1, n => n >= 1);\n }\n}\n\nclass NameAttr extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"nameAttr\");\n }\n}\n\nclass NeverEmbed extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"neverEmbed\");\n }\n}\n\nclass NumberOfCopies extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"numberOfCopies\", null, n => n >= 2 && n <= 5);\n }\n}\n\nclass OpenAction extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"openAction\", /* hasChildren = */ true);\n this.destination = null;\n }\n}\n\nclass Output extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"output\", /* hasChildren = */ true);\n this.to = null;\n this.type = null;\n this.uri = null;\n }\n}\n\nclass OutputBin extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"outputBin\");\n }\n}\n\nclass OutputXSL extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"outputXSL\", /* hasChildren = */ true);\n this.uri = null;\n }\n}\n\nclass Overprint extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"overprint\", [\"none\", \"both\", \"draw\", \"field\"]);\n }\n}\n\nclass Packets extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"packets\");\n }\n\n [$finalize]() {\n if (this[$content] === \"*\") {\n return;\n }\n this[$content] = this[$content]\n .trim()\n .split(/\\s+/)\n .filter(x =>\n [\"config\", \"datasets\", \"template\", \"xfdf\", \"xslt\"].includes(x)\n );\n }\n}\n\nclass PageOffset extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pageOffset\");\n this.x = getInteger({\n data: attributes.x,\n defaultValue: \"useXDCSetting\",\n validate: n => true,\n });\n this.y = getInteger({\n data: attributes.y,\n defaultValue: \"useXDCSetting\",\n validate: n => true,\n });\n }\n}\n\nclass PageRange extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pageRange\");\n }\n\n [$finalize]() {\n const numbers = this[$content]\n .trim()\n .split(/\\s+/)\n .map(x => parseInt(x, 10));\n const ranges = [];\n for (let i = 0, ii = numbers.length; i < ii; i += 2) {\n ranges.push(numbers.slice(i, i + 2));\n }\n this[$content] = ranges;\n }\n}\n\nclass Pagination extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pagination\", [\n \"simplex\",\n \"duplexShortEdge\",\n \"duplexLongEdge\",\n ]);\n }\n}\n\nclass PaginationOverride extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"paginationOverride\", [\n \"none\",\n \"forceDuplex\",\n \"forceDuplexLongEdge\",\n \"forceDuplexShortEdge\",\n \"forceSimplex\",\n ]);\n }\n}\n\nclass Part extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"part\", 1, n => false);\n }\n}\n\nclass Pcl extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pcl\", /* hasChildren = */ true);\n this.name = attributes.name || \"\";\n this.batchOutput = null;\n this.fontInfo = null;\n this.jog = null;\n this.mediumInfo = null;\n this.outputBin = null;\n this.pageOffset = null;\n this.staple = null;\n this.xdc = null;\n }\n}\n\nclass Pdf extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pdf\", /* hasChildren = */ true);\n this.name = attributes.name || \"\";\n this.adobeExtensionLevel = null;\n this.batchOutput = null;\n this.compression = null;\n this.creator = null;\n this.encryption = null;\n this.fontInfo = null;\n this.interactive = null;\n this.linearized = null;\n this.openAction = null;\n this.pdfa = null;\n this.producer = null;\n this.renderPolicy = null;\n this.scriptModel = null;\n this.silentPrint = null;\n this.submitFormat = null;\n this.tagged = null;\n this.version = null;\n this.viewerPreferences = null;\n this.xdc = null;\n }\n}\n\nclass Pdfa extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pdfa\", /* hasChildren = */ true);\n this.amd = null;\n this.conformance = null;\n this.includeXDPContent = null;\n this.part = null;\n }\n}\n\nclass Permissions extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"permissions\", /* hasChildren = */ true);\n this.accessibleContent = null;\n this.change = null;\n this.contentCopy = null;\n this.documentAssembly = null;\n this.formFieldFilling = null;\n this.modifyAnnots = null;\n this.plaintextMetadata = null;\n this.print = null;\n this.printHighQuality = null;\n }\n}\n\nclass PickTrayByPDFSize extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"pickTrayByPDFSize\");\n }\n}\n\nclass Picture extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"picture\");\n }\n\n // TODO: check the validity of the picture clause.\n // See page 1150 in the spec.\n}\n\nclass PlaintextMetadata extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"plaintextMetadata\");\n }\n}\n\nclass Presence extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"presence\", [\n \"preserve\",\n \"dissolve\",\n \"dissolveStructure\",\n \"ignore\",\n \"remove\",\n ]);\n }\n}\n\nclass Present extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"present\", /* hasChildren = */ true);\n this.behaviorOverride = null;\n this.cache = null;\n this.common = null;\n this.copies = null;\n this.destination = null;\n this.incrementalMerge = null;\n this.layout = null;\n this.output = null;\n this.overprint = null;\n this.pagination = null;\n this.paginationOverride = null;\n this.script = null;\n this.validate = null;\n this.xdp = null;\n this.driver = new XFAObjectArray();\n this.labelPrinter = new XFAObjectArray();\n this.pcl = new XFAObjectArray();\n this.pdf = new XFAObjectArray();\n this.ps = new XFAObjectArray();\n this.submitUrl = new XFAObjectArray();\n this.webClient = new XFAObjectArray();\n this.zpl = new XFAObjectArray();\n }\n}\n\nclass Print extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"print\");\n }\n}\n\nclass PrintHighQuality extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"printHighQuality\");\n }\n}\n\nclass PrintScaling extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"printScaling\", [\"appdefault\", \"noScaling\"]);\n }\n}\n\nclass PrinterName extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"printerName\");\n }\n}\n\nclass Producer extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"producer\");\n }\n}\n\nclass Ps extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"ps\", /* hasChildren = */ true);\n this.name = attributes.name || \"\";\n this.batchOutput = null;\n this.fontInfo = null;\n this.jog = null;\n this.mediumInfo = null;\n this.outputBin = null;\n this.staple = null;\n this.xdc = null;\n }\n}\n\nclass Range extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"range\");\n }\n\n [$finalize]() {\n this[$content] = this[$content]\n .trim()\n .split(/\\s*,\\s*/, 2)\n .map(range => range.split(\"-\").map(x => parseInt(x.trim(), 10)))\n .filter(range => range.every(x => !isNaN(x)))\n .map(range => {\n if (range.length === 1) {\n range.push(range[0]);\n }\n return range;\n });\n }\n}\n\nclass Record extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"record\");\n }\n\n [$finalize]() {\n this[$content] = this[$content].trim();\n const n = parseInt(this[$content], 10);\n if (!isNaN(n) && n >= 0) {\n this[$content] = n;\n }\n }\n}\n\nclass Relevant extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"relevant\");\n }\n\n [$finalize]() {\n this[$content] = this[$content].trim().split(/\\s+/);\n }\n}\n\nclass Rename extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"rename\");\n }\n\n [$finalize]() {\n this[$content] = this[$content].trim();\n // String must be a XFA name: same as XML one except that there\n // is no colon.\n if (\n this[$content].toLowerCase().startsWith(\"xml\") ||\n new RegExp(\"[\\\\p{L}_][\\\\p{L}\\\\d._\\\\p{M}-]*\", \"u\").test(this[$content])\n ) {\n warn(\"XFA - Rename: invalid XFA name\");\n }\n }\n}\n\nclass RenderPolicy extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"renderPolicy\", [\"server\", \"client\"]);\n }\n}\n\nclass RunScripts extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"runScripts\", [\"both\", \"client\", \"none\", \"server\"]);\n }\n}\n\nclass Script extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"script\", /* hasChildren = */ true);\n this.currentPage = null;\n this.exclude = null;\n this.runScripts = null;\n }\n}\n\nclass ScriptModel extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"scriptModel\", [\"XFA\", \"none\"]);\n }\n}\n\nclass Severity extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"severity\", [\n \"ignore\",\n \"error\",\n \"information\",\n \"trace\",\n \"warning\",\n ]);\n }\n}\n\nclass SilentPrint extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"silentPrint\", /* hasChildren = */ true);\n this.addSilentPrint = null;\n this.printerName = null;\n }\n}\n\nclass Staple extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"staple\");\n this.mode = getStringOption(attributes.mode, [\n \"usePrinterSetting\",\n \"on\",\n \"off\",\n ]);\n }\n}\n\nclass StartNode extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"startNode\");\n }\n}\n\nclass StartPage extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"startPage\", 0, n => true);\n }\n}\n\nclass SubmitFormat extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"submitFormat\", [\n \"html\",\n \"delegate\",\n \"fdf\",\n \"xml\",\n \"pdf\",\n ]);\n }\n}\n\nclass SubmitUrl extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"submitUrl\");\n }\n}\n\nclass SubsetBelow extends IntegerObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"subsetBelow\", 100, n => n >= 0 && n <= 100);\n }\n}\n\nclass SuppressBanner extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"suppressBanner\");\n }\n}\n\nclass Tagged extends Option01 {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"tagged\");\n }\n}\n\nclass Template extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"template\", /* hasChildren = */ true);\n this.base = null;\n this.relevant = null;\n this.startPage = null;\n this.uri = null;\n this.xsl = null;\n }\n}\n\nclass Threshold extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"threshold\", [\n \"trace\",\n \"error\",\n \"information\",\n \"warning\",\n ]);\n }\n}\n\nclass To extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"to\", [\n \"null\",\n \"memory\",\n \"stderr\",\n \"stdout\",\n \"system\",\n \"uri\",\n ]);\n }\n}\n\nclass TemplateCache extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"templateCache\");\n this.maxEntries = getInteger({\n data: attributes.maxEntries,\n defaultValue: 5,\n validate: n => n >= 0,\n });\n }\n}\n\nclass Trace extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"trace\", /* hasChildren = */ true);\n this.area = new XFAObjectArray();\n }\n}\n\nclass Transform extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"transform\", /* hasChildren = */ true);\n this.groupParent = null;\n this.ifEmpty = null;\n this.nameAttr = null;\n this.picture = null;\n this.presence = null;\n this.rename = null;\n this.whitespace = null;\n }\n}\n\nclass Type extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"type\", [\n \"none\",\n \"ascii85\",\n \"asciiHex\",\n \"ccittfax\",\n \"flate\",\n \"lzw\",\n \"runLength\",\n \"native\",\n \"xdp\",\n \"mergedXDP\",\n ]);\n }\n}\n\nclass Uri extends StringObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"uri\");\n }\n}\n\nclass Validate extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"validate\", [\n \"preSubmit\",\n \"prePrint\",\n \"preExecute\",\n \"preSave\",\n ]);\n }\n}\n\nclass ValidateApprovalSignatures extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"validateApprovalSignatures\");\n }\n\n [$finalize]() {\n this[$content] = this[$content]\n .trim()\n .split(/\\s+/)\n .filter(x => [\"docReady\", \"postSign\"].includes(x));\n }\n}\n\nclass ValidationMessaging extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"validationMessaging\", [\n \"allMessagesIndividually\",\n \"allMessagesTogether\",\n \"firstMessageOnly\",\n \"noMessages\",\n ]);\n }\n}\n\nclass Version extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"version\", [\"1.7\", \"1.6\", \"1.5\", \"1.4\", \"1.3\", \"1.2\"]);\n }\n}\n\nclass VersionControl extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"VersionControl\");\n this.outputBelow = getStringOption(attributes.outputBelow, [\n \"warn\",\n \"error\",\n \"update\",\n ]);\n this.sourceAbove = getStringOption(attributes.sourceAbove, [\n \"warn\",\n \"error\",\n ]);\n this.sourceBelow = getStringOption(attributes.sourceBelow, [\n \"update\",\n \"maintain\",\n ]);\n }\n}\n\nclass ViewerPreferences extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"viewerPreferences\", /* hasChildren = */ true);\n this.ADBE_JSConsole = null;\n this.ADBE_JSDebugger = null;\n this.addViewerPreferences = null;\n this.duplexOption = null;\n this.enforce = null;\n this.numberOfCopies = null;\n this.pageRange = null;\n this.pickTrayByPDFSize = null;\n this.printScaling = null;\n }\n}\n\nclass WebClient extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"webClient\", /* hasChildren = */ true);\n this.name = attributes.name ? attributes.name.trim() : \"\";\n this.fontInfo = null;\n this.xdc = null;\n }\n}\n\nclass Whitespace extends OptionObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"whitespace\", [\n \"preserve\",\n \"ltrim\",\n \"normalize\",\n \"rtrim\",\n \"trim\",\n ]);\n }\n}\n\nclass Window extends ContentObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"window\");\n }\n\n [$finalize]() {\n const pair = this[$content]\n .trim()\n .split(/\\s*,\\s*/, 2)\n .map(x => parseInt(x, 10));\n if (pair.some(x => isNaN(x))) {\n this[$content] = [0, 0];\n return;\n }\n if (pair.length === 1) {\n pair.push(pair[0]);\n }\n this[$content] = pair;\n }\n}\n\nclass Xdc extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"xdc\", /* hasChildren = */ true);\n this.uri = new XFAObjectArray();\n this.xsl = new XFAObjectArray();\n }\n}\n\nclass Xdp extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"xdp\", /* hasChildren = */ true);\n this.packets = null;\n }\n}\n\nclass Xsl extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"xsl\", /* hasChildren = */ true);\n this.debug = null;\n this.uri = null;\n }\n}\n\nclass Zpl extends XFAObject {\n constructor(attributes) {\n super(CONFIG_NS_ID, \"zpl\", /* hasChildren = */ true);\n this.name = attributes.name ? attributes.name.trim() : \"\";\n this.batchOutput = null;\n this.flipLabel = null;\n this.fontInfo = null;\n this.xdc = null;\n }\n}\n\nclass ConfigNamespace {\n static [$buildXFAObject](name, attributes) {\n if (ConfigNamespace.hasOwnProperty(name)) {\n return ConfigNamespace[name](attributes);\n }\n return undefined;\n }\n\n static acrobat(attrs) {\n return new Acrobat(attrs);\n }\n\n static acrobat7(attrs) {\n return new Acrobat7(attrs);\n }\n\n static ADBE_JSConsole(attrs) {\n return new ADBE_JSConsole(attrs);\n }\n\n static ADBE_JSDebugger(attrs) {\n return new ADBE_JSDebugger(attrs);\n }\n\n static addSilentPrint(attrs) {\n return new AddSilentPrint(attrs);\n }\n\n static addViewerPreferences(attrs) {\n return new AddViewerPreferences(attrs);\n }\n\n static adjustData(attrs) {\n return new AdjustData(attrs);\n }\n\n static adobeExtensionLevel(attrs) {\n return new AdobeExtensionLevel(attrs);\n }\n\n static agent(attrs) {\n return new Agent(attrs);\n }\n\n static alwaysEmbed(attrs) {\n return new AlwaysEmbed(attrs);\n }\n\n static amd(attrs) {\n return new Amd(attrs);\n }\n\n static area(attrs) {\n return new Area(attrs);\n }\n\n static attributes(attrs) {\n return new Attributes(attrs);\n }\n\n static autoSave(attrs) {\n return new AutoSave(attrs);\n }\n\n static base(attrs) {\n return new Base(attrs);\n }\n\n static batchOutput(attrs) {\n return new BatchOutput(attrs);\n }\n\n static behaviorOverride(attrs) {\n return new BehaviorOverride(attrs);\n }\n\n static cache(attrs) {\n return new Cache(attrs);\n }\n\n static change(attrs) {\n return new Change(attrs);\n }\n\n static common(attrs) {\n return new Common(attrs);\n }\n\n static compress(attrs) {\n return new Compress(attrs);\n }\n\n static compressLogicalStructure(attrs) {\n return new CompressLogicalStructure(attrs);\n }\n\n static compressObjectStream(attrs) {\n return new CompressObjectStream(attrs);\n }\n\n static compression(attrs) {\n return new Compression(attrs);\n }\n\n static config(attrs) {\n return new Config(attrs);\n }\n\n static conformance(attrs) {\n return new Conformance(attrs);\n }\n\n static contentCopy(attrs) {\n return new ContentCopy(attrs);\n }\n\n static copies(attrs) {\n return new Copies(attrs);\n }\n\n static creator(attrs) {\n return new Creator(attrs);\n }\n\n static currentPage(attrs) {\n return new CurrentPage(attrs);\n }\n\n static data(attrs) {\n return new Data(attrs);\n }\n\n static debug(attrs) {\n return new Debug(attrs);\n }\n\n static defaultTypeface(attrs) {\n return new DefaultTypeface(attrs);\n }\n\n static destination(attrs) {\n return new Destination(attrs);\n }\n\n static documentAssembly(attrs) {\n return new DocumentAssembly(attrs);\n }\n\n static driver(attrs) {\n return new Driver(attrs);\n }\n\n static duplexOption(attrs) {\n return new DuplexOption(attrs);\n }\n\n static dynamicRender(attrs) {\n return new DynamicRender(attrs);\n }\n\n static embed(attrs) {\n return new Embed(attrs);\n }\n\n static encrypt(attrs) {\n return new Encrypt(attrs);\n }\n\n static encryption(attrs) {\n return new Encryption(attrs);\n }\n\n static encryptionLevel(attrs) {\n return new EncryptionLevel(attrs);\n }\n\n static enforce(attrs) {\n return new Enforce(attrs);\n }\n\n static equate(attrs) {\n return new Equate(attrs);\n }\n\n static equateRange(attrs) {\n return new EquateRange(attrs);\n }\n\n static exclude(attrs) {\n return new Exclude(attrs);\n }\n\n static excludeNS(attrs) {\n return new ExcludeNS(attrs);\n }\n\n static flipLabel(attrs) {\n return new FlipLabel(attrs);\n }\n\n static fontInfo(attrs) {\n return new FontInfo(attrs);\n }\n\n static formFieldFilling(attrs) {\n return new FormFieldFilling(attrs);\n }\n\n static groupParent(attrs) {\n return new GroupParent(attrs);\n }\n\n static ifEmpty(attrs) {\n return new IfEmpty(attrs);\n }\n\n static includeXDPContent(attrs) {\n return new IncludeXDPContent(attrs);\n }\n\n static incrementalLoad(attrs) {\n return new IncrementalLoad(attrs);\n }\n\n static incrementalMerge(attrs) {\n return new IncrementalMerge(attrs);\n }\n\n static interactive(attrs) {\n return new Interactive(attrs);\n }\n\n static jog(attrs) {\n return new Jog(attrs);\n }\n\n static labelPrinter(attrs) {\n return new LabelPrinter(attrs);\n }\n\n static layout(attrs) {\n return new Layout(attrs);\n }\n\n static level(attrs) {\n return new Level(attrs);\n }\n\n static linearized(attrs) {\n return new Linearized(attrs);\n }\n\n static locale(attrs) {\n return new Locale(attrs);\n }\n\n static localeSet(attrs) {\n return new LocaleSet(attrs);\n }\n\n static log(attrs) {\n return new Log(attrs);\n }\n\n static map(attrs) {\n return new MapElement(attrs);\n }\n\n static mediumInfo(attrs) {\n return new MediumInfo(attrs);\n }\n\n static message(attrs) {\n return new Message(attrs);\n }\n\n static messaging(attrs) {\n return new Messaging(attrs);\n }\n\n static mode(attrs) {\n return new Mode(attrs);\n }\n\n static modifyAnnots(attrs) {\n return new ModifyAnnots(attrs);\n }\n\n static msgId(attrs) {\n return new MsgId(attrs);\n }\n\n static nameAttr(attrs) {\n return new NameAttr(attrs);\n }\n\n static neverEmbed(attrs) {\n return new NeverEmbed(attrs);\n }\n\n static numberOfCopies(attrs) {\n return new NumberOfCopies(attrs);\n }\n\n static openAction(attrs) {\n return new OpenAction(attrs);\n }\n\n static output(attrs) {\n return new Output(attrs);\n }\n\n static outputBin(attrs) {\n return new OutputBin(attrs);\n }\n\n static outputXSL(attrs) {\n return new OutputXSL(attrs);\n }\n\n static overprint(attrs) {\n return new Overprint(attrs);\n }\n\n static packets(attrs) {\n return new Packets(attrs);\n }\n\n static pageOffset(attrs) {\n return new PageOffset(attrs);\n }\n\n static pageRange(attrs) {\n return new PageRange(attrs);\n }\n\n static pagination(attrs) {\n return new Pagination(attrs);\n }\n\n static paginationOverride(attrs) {\n return new PaginationOverride(attrs);\n }\n\n static part(attrs) {\n return new Part(attrs);\n }\n\n static pcl(attrs) {\n return new Pcl(attrs);\n }\n\n static pdf(attrs) {\n return new Pdf(attrs);\n }\n\n static pdfa(attrs) {\n return new Pdfa(attrs);\n }\n\n static permissions(attrs) {\n return new Permissions(attrs);\n }\n\n static pickTrayByPDFSize(attrs) {\n return new PickTrayByPDFSize(attrs);\n }\n\n static picture(attrs) {\n return new Picture(attrs);\n }\n\n static plaintextMetadata(attrs) {\n return new PlaintextMetadata(attrs);\n }\n\n static presence(attrs) {\n return new Presence(attrs);\n }\n\n static present(attrs) {\n return new Present(attrs);\n }\n\n static print(attrs) {\n return new Print(attrs);\n }\n\n static printHighQuality(attrs) {\n return new PrintHighQuality(attrs);\n }\n\n static printScaling(attrs) {\n return new PrintScaling(attrs);\n }\n\n static printerName(attrs) {\n return new PrinterName(attrs);\n }\n\n static producer(attrs) {\n return new Producer(attrs);\n }\n\n static ps(attrs) {\n return new Ps(attrs);\n }\n\n static range(attrs) {\n return new Range(attrs);\n }\n\n static record(attrs) {\n return new Record(attrs);\n }\n\n static relevant(attrs) {\n return new Relevant(attrs);\n }\n\n static rename(attrs) {\n return new Rename(attrs);\n }\n\n static renderPolicy(attrs) {\n return new RenderPolicy(attrs);\n }\n\n static runScripts(attrs) {\n return new RunScripts(attrs);\n }\n\n static script(attrs) {\n return new Script(attrs);\n }\n\n static scriptModel(attrs) {\n return new ScriptModel(attrs);\n }\n\n static severity(attrs) {\n return new Severity(attrs);\n }\n\n static silentPrint(attrs) {\n return new SilentPrint(attrs);\n }\n\n static staple(attrs) {\n return new Staple(attrs);\n }\n\n static startNode(attrs) {\n return new StartNode(attrs);\n }\n\n static startPage(attrs) {\n return new StartPage(attrs);\n }\n\n static submitFormat(attrs) {\n return new SubmitFormat(attrs);\n }\n\n static submitUrl(attrs) {\n return new SubmitUrl(attrs);\n }\n\n static subsetBelow(attrs) {\n return new SubsetBelow(attrs);\n }\n\n static suppressBanner(attrs) {\n return new SuppressBanner(attrs);\n }\n\n static tagged(attrs) {\n return new Tagged(attrs);\n }\n\n static template(attrs) {\n return new Template(attrs);\n }\n\n static templateCache(attrs) {\n return new TemplateCache(attrs);\n }\n\n static threshold(attrs) {\n return new Threshold(attrs);\n }\n\n static to(attrs) {\n return new To(attrs);\n }\n\n static trace(attrs) {\n return new Trace(attrs);\n }\n\n static transform(attrs) {\n return new Transform(attrs);\n }\n\n static type(attrs) {\n return new Type(attrs);\n }\n\n static uri(attrs) {\n return new Uri(attrs);\n }\n\n static validate(attrs) {\n return new Validate(attrs);\n }\n\n static validateApprovalSignatures(attrs) {\n return new ValidateApprovalSignatures(attrs);\n }\n\n static validationMessaging(attrs) {\n return new ValidationMessaging(attrs);\n }\n\n static version(attrs) {\n return new Version(attrs);\n }\n\n static versionControl(attrs) {\n return new VersionControl(attrs);\n }\n\n static viewerPreferences(attrs) {\n return new ViewerPreferences(attrs);\n }\n\n static webClient(attrs) {\n return new WebClient(attrs);\n }\n\n static whitespace(attrs) {\n return new Whitespace(attrs);\n }\n\n static window(attrs) {\n return new Window(attrs);\n }\n\n static xdc(attrs) {\n return new Xdc(attrs);\n }\n\n static xdp(attrs) {\n return new Xdp(attrs);\n }\n\n static xsl(attrs) {\n return new Xsl(attrs);\n }\n\n static zpl(attrs) {\n return new Zpl(attrs);\n }\n}\n\nexport { ConfigNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport { StringObject, XFAObject, XFAObjectArray } from \"./xfa_object.js\";\n\nconst CONNECTION_SET_NS_ID = NamespaceIds.connectionSet.id;\n\nclass ConnectionSet extends XFAObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"connectionSet\", /* hasChildren = */ true);\n this.wsdlConnection = new XFAObjectArray();\n this.xmlConnection = new XFAObjectArray();\n this.xsdConnection = new XFAObjectArray();\n }\n}\n\nclass EffectiveInputPolicy extends XFAObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"effectiveInputPolicy\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass EffectiveOutputPolicy extends XFAObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"effectiveOutputPolicy\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Operation extends StringObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"operation\");\n this.id = attributes.id || \"\";\n this.input = attributes.input || \"\";\n this.name = attributes.name || \"\";\n this.output = attributes.output || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass RootElement extends StringObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"rootElement\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass SoapAction extends StringObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"soapAction\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass SoapAddress extends StringObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"soapAddress\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass Uri extends StringObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"uri\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass WsdlAddress extends StringObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"wsdlAddress\");\n this.id = attributes.id || \"\";\n this.name = attributes.name || \"\";\n this.use = attributes.use || \"\";\n this.usehref = attributes.usehref || \"\";\n }\n}\n\nclass WsdlConnection extends XFAObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"wsdlConnection\", /* hasChildren = */ true);\n this.dataDescription = attributes.dataDescription || \"\";\n this.name = attributes.name || \"\";\n this.effectiveInputPolicy = null;\n this.effectiveOutputPolicy = null;\n this.operation = null;\n this.soapAction = null;\n this.soapAddress = null;\n this.wsdlAddress = null;\n }\n}\n\nclass XmlConnection extends XFAObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"xmlConnection\", /* hasChildren = */ true);\n this.dataDescription = attributes.dataDescription || \"\";\n this.name = attributes.name || \"\";\n this.uri = null;\n }\n}\n\nclass XsdConnection extends XFAObject {\n constructor(attributes) {\n super(CONNECTION_SET_NS_ID, \"xsdConnection\", /* hasChildren = */ true);\n this.dataDescription = attributes.dataDescription || \"\";\n this.name = attributes.name || \"\";\n this.rootElement = null;\n this.uri = null;\n }\n}\n\nclass ConnectionSetNamespace {\n static [$buildXFAObject](name, attributes) {\n if (ConnectionSetNamespace.hasOwnProperty(name)) {\n return ConnectionSetNamespace[name](attributes);\n }\n return undefined;\n }\n\n static connectionSet(attrs) {\n return new ConnectionSet(attrs);\n }\n\n static effectiveInputPolicy(attrs) {\n return new EffectiveInputPolicy(attrs);\n }\n\n static effectiveOutputPolicy(attrs) {\n return new EffectiveOutputPolicy(attrs);\n }\n\n static operation(attrs) {\n return new Operation(attrs);\n }\n\n static rootElement(attrs) {\n return new RootElement(attrs);\n }\n\n static soapAction(attrs) {\n return new SoapAction(attrs);\n }\n\n static soapAddress(attrs) {\n return new SoapAddress(attrs);\n }\n\n static uri(attrs) {\n return new Uri(attrs);\n }\n\n static wsdlAddress(attrs) {\n return new WsdlAddress(attrs);\n }\n\n static wsdlConnection(attrs) {\n return new WsdlConnection(attrs);\n }\n\n static xmlConnection(attrs) {\n return new XmlConnection(attrs);\n }\n\n static xsdConnection(attrs) {\n return new XsdConnection(attrs);\n }\n}\n\nexport { ConnectionSetNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $appendChild,\n $isNsAgnostic,\n $namespaceId,\n $nodeName,\n $onChild,\n} from \"./symbol_utils.js\";\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport { XFAObject, XmlObject } from \"./xfa_object.js\";\n\nconst DATASETS_NS_ID = NamespaceIds.datasets.id;\n\nclass Data extends XmlObject {\n constructor(attributes) {\n super(DATASETS_NS_ID, \"data\", attributes);\n }\n\n [$isNsAgnostic]() {\n return true;\n }\n}\n\nclass Datasets extends XFAObject {\n constructor(attributes) {\n super(DATASETS_NS_ID, \"datasets\", /* hasChildren = */ true);\n this.data = null;\n this.Signature = null;\n }\n\n [$onChild](child) {\n const name = child[$nodeName];\n if (\n (name === \"data\" && child[$namespaceId] === DATASETS_NS_ID) ||\n (name === \"Signature\" &&\n child[$namespaceId] === NamespaceIds.signature.id)\n ) {\n this[name] = child;\n }\n this[$appendChild](child);\n }\n}\n\nclass DatasetsNamespace {\n static [$buildXFAObject](name, attributes) {\n if (DatasetsNamespace.hasOwnProperty(name)) {\n return DatasetsNamespace[name](attributes);\n }\n return undefined;\n }\n\n static datasets(attributes) {\n return new Datasets(attributes);\n }\n\n static data(attributes) {\n return new Data(attributes);\n }\n}\n\nexport { DatasetsNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport {\n ContentObject,\n StringObject,\n XFAObject,\n XFAObjectArray,\n} from \"./xfa_object.js\";\nimport { getInteger, getStringOption } from \"./utils.js\";\n\nconst LOCALE_SET_NS_ID = NamespaceIds.localeSet.id;\n\nclass CalendarSymbols extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"calendarSymbols\", /* hasChildren = */ true);\n this.name = \"gregorian\";\n this.dayNames = new XFAObjectArray(2);\n this.eraNames = null;\n this.meridiemNames = null;\n this.monthNames = new XFAObjectArray(2);\n }\n}\n\nclass CurrencySymbol extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"currencySymbol\");\n this.name = getStringOption(attributes.name, [\n \"symbol\",\n \"isoname\",\n \"decimal\",\n ]);\n }\n}\n\nclass CurrencySymbols extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"currencySymbols\", /* hasChildren = */ true);\n this.currencySymbol = new XFAObjectArray(3);\n }\n}\n\nclass DatePattern extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"datePattern\");\n this.name = getStringOption(attributes.name, [\n \"full\",\n \"long\",\n \"med\",\n \"short\",\n ]);\n }\n}\n\nclass DatePatterns extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"datePatterns\", /* hasChildren = */ true);\n this.datePattern = new XFAObjectArray(4);\n }\n}\n\nclass DateTimeSymbols extends ContentObject {\n // TODO: spec unclear about the format of the array.\n\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"dateTimeSymbols\");\n }\n}\n\nclass Day extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"day\");\n }\n}\n\nclass DayNames extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"dayNames\", /* hasChildren = */ true);\n this.abbr = getInteger({\n data: attributes.abbr,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.day = new XFAObjectArray(7);\n }\n}\n\nclass Era extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"era\");\n }\n}\n\nclass EraNames extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"eraNames\", /* hasChildren = */ true);\n this.era = new XFAObjectArray(2);\n }\n}\n\nclass Locale extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"locale\", /* hasChildren = */ true);\n this.desc = attributes.desc || \"\";\n this.name = \"isoname\";\n this.calendarSymbols = null;\n this.currencySymbols = null;\n this.datePatterns = null;\n this.dateTimeSymbols = null;\n this.numberPatterns = null;\n this.numberSymbols = null;\n this.timePatterns = null;\n this.typeFaces = null;\n }\n}\n\nclass LocaleSet extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"localeSet\", /* hasChildren = */ true);\n this.locale = new XFAObjectArray();\n }\n}\n\nclass Meridiem extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"meridiem\");\n }\n}\n\nclass MeridiemNames extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"meridiemNames\", /* hasChildren = */ true);\n this.meridiem = new XFAObjectArray(2);\n }\n}\n\nclass Month extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"month\");\n }\n}\n\nclass MonthNames extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"monthNames\", /* hasChildren = */ true);\n this.abbr = getInteger({\n data: attributes.abbr,\n defaultValue: 0,\n validate: x => x === 1,\n });\n this.month = new XFAObjectArray(12);\n }\n}\n\nclass NumberPattern extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"numberPattern\");\n this.name = getStringOption(attributes.name, [\n \"full\",\n \"long\",\n \"med\",\n \"short\",\n ]);\n }\n}\n\nclass NumberPatterns extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"numberPatterns\", /* hasChildren = */ true);\n this.numberPattern = new XFAObjectArray(4);\n }\n}\n\nclass NumberSymbol extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"numberSymbol\");\n this.name = getStringOption(attributes.name, [\n \"decimal\",\n \"grouping\",\n \"percent\",\n \"minus\",\n \"zero\",\n ]);\n }\n}\n\nclass NumberSymbols extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"numberSymbols\", /* hasChildren = */ true);\n this.numberSymbol = new XFAObjectArray(5);\n }\n}\n\nclass TimePattern extends StringObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"timePattern\");\n this.name = getStringOption(attributes.name, [\n \"full\",\n \"long\",\n \"med\",\n \"short\",\n ]);\n }\n}\n\nclass TimePatterns extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"timePatterns\", /* hasChildren = */ true);\n this.timePattern = new XFAObjectArray(4);\n }\n}\n\nclass TypeFace extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"typeFace\", /* hasChildren = */ true);\n this.name = attributes.name | \"\";\n }\n}\n\nclass TypeFaces extends XFAObject {\n constructor(attributes) {\n super(LOCALE_SET_NS_ID, \"typeFaces\", /* hasChildren = */ true);\n this.typeFace = new XFAObjectArray();\n }\n}\n\nclass LocaleSetNamespace {\n static [$buildXFAObject](name, attributes) {\n if (LocaleSetNamespace.hasOwnProperty(name)) {\n return LocaleSetNamespace[name](attributes);\n }\n return undefined;\n }\n\n static calendarSymbols(attrs) {\n return new CalendarSymbols(attrs);\n }\n\n static currencySymbol(attrs) {\n return new CurrencySymbol(attrs);\n }\n\n static currencySymbols(attrs) {\n return new CurrencySymbols(attrs);\n }\n\n static datePattern(attrs) {\n return new DatePattern(attrs);\n }\n\n static datePatterns(attrs) {\n return new DatePatterns(attrs);\n }\n\n static dateTimeSymbols(attrs) {\n return new DateTimeSymbols(attrs);\n }\n\n static day(attrs) {\n return new Day(attrs);\n }\n\n static dayNames(attrs) {\n return new DayNames(attrs);\n }\n\n static era(attrs) {\n return new Era(attrs);\n }\n\n static eraNames(attrs) {\n return new EraNames(attrs);\n }\n\n static locale(attrs) {\n return new Locale(attrs);\n }\n\n static localeSet(attrs) {\n return new LocaleSet(attrs);\n }\n\n static meridiem(attrs) {\n return new Meridiem(attrs);\n }\n\n static meridiemNames(attrs) {\n return new MeridiemNames(attrs);\n }\n\n static month(attrs) {\n return new Month(attrs);\n }\n\n static monthNames(attrs) {\n return new MonthNames(attrs);\n }\n\n static numberPattern(attrs) {\n return new NumberPattern(attrs);\n }\n\n static numberPatterns(attrs) {\n return new NumberPatterns(attrs);\n }\n\n static numberSymbol(attrs) {\n return new NumberSymbol(attrs);\n }\n\n static numberSymbols(attrs) {\n return new NumberSymbols(attrs);\n }\n\n static timePattern(attrs) {\n return new TimePattern(attrs);\n }\n\n static timePatterns(attrs) {\n return new TimePatterns(attrs);\n }\n\n static typeFace(attrs) {\n return new TypeFace(attrs);\n }\n\n static typeFaces(attrs) {\n return new TypeFaces(attrs);\n }\n}\n\nexport { LocaleSetNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport { XFAObject } from \"./xfa_object.js\";\n\nconst SIGNATURE_NS_ID = NamespaceIds.signature.id;\n\nclass Signature extends XFAObject {\n constructor(attributes) {\n super(SIGNATURE_NS_ID, \"signature\", /* hasChildren = */ true);\n }\n}\n\nclass SignatureNamespace {\n static [$buildXFAObject](name, attributes) {\n if (SignatureNamespace.hasOwnProperty(name)) {\n return SignatureNamespace[name](attributes);\n }\n return undefined;\n }\n\n static signature(attributes) {\n return new Signature(attributes);\n }\n}\n\nexport { SignatureNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport { XFAObject } from \"./xfa_object.js\";\n\nconst STYLESHEET_NS_ID = NamespaceIds.stylesheet.id;\n\nclass Stylesheet extends XFAObject {\n constructor(attributes) {\n super(STYLESHEET_NS_ID, \"stylesheet\", /* hasChildren = */ true);\n }\n}\n\nclass StylesheetNamespace {\n static [$buildXFAObject](name, attributes) {\n if (StylesheetNamespace.hasOwnProperty(name)) {\n return StylesheetNamespace[name](attributes);\n }\n return undefined;\n }\n\n static stylesheet(attributes) {\n return new Stylesheet(attributes);\n }\n}\n\nexport { StylesheetNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport { $namespaceId, $nodeName, $onChildCheck } from \"./symbol_utils.js\";\nimport { XFAObject, XFAObjectArray } from \"./xfa_object.js\";\n\nconst XDP_NS_ID = NamespaceIds.xdp.id;\n\nclass Xdp extends XFAObject {\n constructor(attributes) {\n super(XDP_NS_ID, \"xdp\", /* hasChildren = */ true);\n this.uuid = attributes.uuid || \"\";\n this.timeStamp = attributes.timeStamp || \"\";\n this.config = null;\n this.connectionSet = null;\n this.datasets = null;\n this.localeSet = null;\n this.stylesheet = new XFAObjectArray();\n this.template = null;\n }\n\n [$onChildCheck](child) {\n const ns = NamespaceIds[child[$nodeName]];\n return ns && child[$namespaceId] === ns.id;\n }\n}\n\nclass XdpNamespace {\n static [$buildXFAObject](name, attributes) {\n if (XdpNamespace.hasOwnProperty(name)) {\n return XdpNamespace[name](attributes);\n }\n return undefined;\n }\n\n static xdp(attributes) {\n return new Xdp(attributes);\n }\n}\n\nexport { XdpNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n $acceptWhitespace,\n $childrenToHTML,\n $clean,\n $content,\n $extra,\n $getChildren,\n $getParent,\n $globalData,\n $nodeName,\n $onText,\n $pushGlyphs,\n $text,\n $toHTML,\n} from \"./symbol_utils.js\";\nimport { $buildXFAObject, NamespaceIds } from \"./namespaces.js\";\nimport {\n fixTextIndent,\n fixURL,\n measureToString,\n setFontFamily,\n} from \"./html_utils.js\";\nimport { getMeasurement, HTMLResult, stripQuotes } from \"./utils.js\";\nimport { XmlObject } from \"./xfa_object.js\";\n\nconst XHTML_NS_ID = NamespaceIds.xhtml.id;\nconst $richText = Symbol();\n\nconst VALID_STYLES = new Set([\n \"color\",\n \"font\",\n \"font-family\",\n \"font-size\",\n \"font-stretch\",\n \"font-style\",\n \"font-weight\",\n \"margin\",\n \"margin-bottom\",\n \"margin-left\",\n \"margin-right\",\n \"margin-top\",\n \"letter-spacing\",\n \"line-height\",\n \"orphans\",\n \"page-break-after\",\n \"page-break-before\",\n \"page-break-inside\",\n \"tab-interval\",\n \"tab-stop\",\n \"text-align\",\n \"text-decoration\",\n \"text-indent\",\n \"vertical-align\",\n \"widows\",\n \"kerning-mode\",\n \"xfa-font-horizontal-scale\",\n \"xfa-font-vertical-scale\",\n \"xfa-spacerun\",\n \"xfa-tab-stops\",\n]);\n\nconst StyleMapping = new Map([\n [\"page-break-after\", \"breakAfter\"],\n [\"page-break-before\", \"breakBefore\"],\n [\"page-break-inside\", \"breakInside\"],\n [\"kerning-mode\", value => (value === \"none\" ? \"none\" : \"normal\")],\n [\n \"xfa-font-horizontal-scale\",\n value =>\n `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`,\n ],\n [\n \"xfa-font-vertical-scale\",\n value =>\n `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`,\n ],\n [\"xfa-spacerun\", \"\"],\n [\"xfa-tab-stops\", \"\"],\n [\n \"font-size\",\n (value, original) => {\n value = original.fontSize = getMeasurement(value);\n return measureToString(0.99 * value);\n },\n ],\n [\"letter-spacing\", value => measureToString(getMeasurement(value))],\n [\"line-height\", value => measureToString(getMeasurement(value))],\n [\"margin\", value => measureToString(getMeasurement(value))],\n [\"margin-bottom\", value => measureToString(getMeasurement(value))],\n [\"margin-left\", value => measureToString(getMeasurement(value))],\n [\"margin-right\", value => measureToString(getMeasurement(value))],\n [\"margin-top\", value => measureToString(getMeasurement(value))],\n [\"text-indent\", value => measureToString(getMeasurement(value))],\n [\"font-family\", value => value],\n [\"vertical-align\", value => measureToString(getMeasurement(value))],\n]);\n\nconst spacesRegExp = /\\s+/g;\nconst crlfRegExp = /[\\r\\n]+/g;\nconst crlfForRichTextRegExp = /\\r\\n?/g;\n\nfunction mapStyle(styleStr, node, richText) {\n const style = Object.create(null);\n if (!styleStr) {\n return style;\n }\n const original = Object.create(null);\n for (const [key, value] of styleStr.split(\";\").map(s => s.split(\":\", 2))) {\n const mapping = StyleMapping.get(key);\n if (mapping === \"\") {\n continue;\n }\n let newValue = value;\n if (mapping) {\n newValue =\n typeof mapping === \"string\" ? mapping : mapping(value, original);\n }\n if (key.endsWith(\"scale\")) {\n style.transform = style.transform\n ? `${style[key]} ${newValue}`\n : newValue;\n } else {\n style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] =\n newValue;\n }\n }\n\n if (style.fontFamily) {\n setFontFamily(\n {\n typeface: style.fontFamily,\n weight: style.fontWeight || \"normal\",\n posture: style.fontStyle || \"normal\",\n size: original.fontSize || 0,\n },\n node,\n node[$globalData].fontFinder,\n style\n );\n }\n\n if (\n richText &&\n style.verticalAlign &&\n style.verticalAlign !== \"0px\" &&\n style.fontSize\n ) {\n // A non-zero verticalAlign means that we've a sub/super-script and\n // consequently the font size must be decreased.\n // https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2097514\n // And the two following factors to position the scripts have been\n // found here:\n // https://en.wikipedia.org/wiki/Subscript_and_superscript#Desktop_publishing\n const SUB_SUPER_SCRIPT_FACTOR = 0.583;\n const VERTICAL_FACTOR = 0.333;\n const fontSize = getMeasurement(style.fontSize);\n style.fontSize = measureToString(fontSize * SUB_SUPER_SCRIPT_FACTOR);\n style.verticalAlign = measureToString(\n Math.sign(getMeasurement(style.verticalAlign)) *\n fontSize *\n VERTICAL_FACTOR\n );\n }\n\n if (richText && style.fontSize) {\n style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;\n }\n\n fixTextIndent(style);\n return style;\n}\n\nfunction checkStyle(node) {\n if (!node.style) {\n return \"\";\n }\n\n // Remove any non-allowed keys.\n return node.style\n .trim()\n .split(/\\s*;\\s*/)\n .filter(s => !!s)\n .map(s => s.split(/\\s*:\\s*/, 2))\n .filter(([key, value]) => {\n if (key === \"font-family\") {\n node[$globalData].usedTypefaces.add(value);\n }\n return VALID_STYLES.has(key);\n })\n .map(kv => kv.join(\":\"))\n .join(\";\");\n}\n\nconst NoWhites = new Set([\"body\", \"html\"]);\n\nclass XhtmlObject extends XmlObject {\n constructor(attributes, name) {\n super(XHTML_NS_ID, name);\n this[$richText] = false;\n this.style = attributes.style || \"\";\n }\n\n [$clean](builder) {\n super[$clean](builder);\n this.style = checkStyle(this);\n }\n\n [$acceptWhitespace]() {\n return !NoWhites.has(this[$nodeName]);\n }\n\n [$onText](str, richText = false) {\n if (!richText) {\n str = str.replaceAll(crlfRegExp, \"\");\n if (!this.style.includes(\"xfa-spacerun:yes\")) {\n str = str.replaceAll(spacesRegExp, \" \");\n }\n } else {\n this[$richText] = true;\n }\n\n if (str) {\n this[$content] += str;\n }\n }\n\n [$pushGlyphs](measure, mustPop = true) {\n const xfaFont = Object.create(null);\n const margin = {\n top: NaN,\n bottom: NaN,\n left: NaN,\n right: NaN,\n };\n let lineHeight = null;\n for (const [key, value] of this.style\n .split(\";\")\n .map(s => s.split(\":\", 2))) {\n switch (key) {\n case \"font-family\":\n xfaFont.typeface = stripQuotes(value);\n break;\n case \"font-size\":\n xfaFont.size = getMeasurement(value);\n break;\n case \"font-weight\":\n xfaFont.weight = value;\n break;\n case \"font-style\":\n xfaFont.posture = value;\n break;\n case \"letter-spacing\":\n xfaFont.letterSpacing = getMeasurement(value);\n break;\n case \"margin\":\n const values = value.split(/ \\t/).map(x => getMeasurement(x));\n switch (values.length) {\n case 1:\n margin.top =\n margin.bottom =\n margin.left =\n margin.right =\n values[0];\n break;\n case 2:\n margin.top = margin.bottom = values[0];\n margin.left = margin.right = values[1];\n break;\n case 3:\n margin.top = values[0];\n margin.bottom = values[2];\n margin.left = margin.right = values[1];\n break;\n case 4:\n margin.top = values[0];\n margin.left = values[1];\n margin.bottom = values[2];\n margin.right = values[3];\n break;\n }\n break;\n case \"margin-top\":\n margin.top = getMeasurement(value);\n break;\n case \"margin-bottom\":\n margin.bottom = getMeasurement(value);\n break;\n case \"margin-left\":\n margin.left = getMeasurement(value);\n break;\n case \"margin-right\":\n margin.right = getMeasurement(value);\n break;\n case \"line-height\":\n lineHeight = getMeasurement(value);\n break;\n }\n }\n\n measure.pushData(xfaFont, margin, lineHeight);\n\n if (this[$content]) {\n measure.addString(this[$content]);\n } else {\n for (const child of this[$getChildren]()) {\n if (child[$nodeName] === \"#text\") {\n measure.addString(child[$content]);\n continue;\n }\n child[$pushGlyphs](measure);\n }\n }\n\n if (mustPop) {\n measure.popFont();\n }\n }\n\n [$toHTML](availableSpace) {\n const children = [];\n this[$extra] = {\n children,\n };\n\n this[$childrenToHTML]({});\n\n if (children.length === 0 && !this[$content]) {\n return HTMLResult.EMPTY;\n }\n\n let value;\n if (this[$richText]) {\n value = this[$content]\n ? this[$content].replaceAll(crlfForRichTextRegExp, \"\\n\")\n : undefined;\n } else {\n value = this[$content] || undefined;\n }\n\n return HTMLResult.success({\n name: this[$nodeName],\n attributes: {\n href: this.href,\n style: mapStyle(this.style, this, this[$richText]),\n },\n children,\n value,\n });\n }\n}\n\nclass A extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"a\");\n this.href = fixURL(attributes.href) || \"\";\n }\n}\n\nclass B extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"b\");\n }\n\n [$pushGlyphs](measure) {\n measure.pushFont({ weight: \"bold\" });\n super[$pushGlyphs](measure);\n measure.popFont();\n }\n}\n\nclass Body extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"body\");\n }\n\n [$toHTML](availableSpace) {\n const res = super[$toHTML](availableSpace);\n const { html } = res;\n if (!html) {\n return HTMLResult.EMPTY;\n }\n html.name = \"div\";\n html.attributes.class = [\"xfaRich\"];\n return res;\n }\n}\n\nclass Br extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"br\");\n }\n\n [$text]() {\n return \"\\n\";\n }\n\n [$pushGlyphs](measure) {\n measure.addString(\"\\n\");\n }\n\n [$toHTML](availableSpace) {\n return HTMLResult.success({\n name: \"br\",\n });\n }\n}\n\nclass Html extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"html\");\n }\n\n [$toHTML](availableSpace) {\n const children = [];\n this[$extra] = {\n children,\n };\n\n this[$childrenToHTML]({});\n if (children.length === 0) {\n return HTMLResult.success({\n name: \"div\",\n attributes: {\n class: [\"xfaRich\"],\n style: {},\n },\n value: this[$content] || \"\",\n });\n }\n\n if (children.length === 1) {\n const child = children[0];\n if (child.attributes?.class.includes(\"xfaRich\")) {\n return HTMLResult.success(child);\n }\n }\n\n return HTMLResult.success({\n name: \"div\",\n attributes: {\n class: [\"xfaRich\"],\n style: {},\n },\n children,\n });\n }\n}\n\nclass I extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"i\");\n }\n\n [$pushGlyphs](measure) {\n measure.pushFont({ posture: \"italic\" });\n super[$pushGlyphs](measure);\n measure.popFont();\n }\n}\n\nclass Li extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"li\");\n }\n}\n\nclass Ol extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"ol\");\n }\n}\n\nclass P extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"p\");\n }\n\n [$pushGlyphs](measure) {\n super[$pushGlyphs](measure, /* mustPop = */ false);\n measure.addString(\"\\n\");\n measure.addPara();\n measure.popFont();\n }\n\n [$text]() {\n const siblings = this[$getParent]()[$getChildren]();\n if (siblings.at(-1) === this) {\n return super[$text]();\n }\n return super[$text]() + \"\\n\";\n }\n}\n\nclass Span extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"span\");\n }\n}\n\nclass Sub extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"sub\");\n }\n}\n\nclass Sup extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"sup\");\n }\n}\n\nclass Ul extends XhtmlObject {\n constructor(attributes) {\n super(attributes, \"ul\");\n }\n}\n\nclass XhtmlNamespace {\n static [$buildXFAObject](name, attributes) {\n if (XhtmlNamespace.hasOwnProperty(name)) {\n return XhtmlNamespace[name](attributes);\n }\n return undefined;\n }\n\n static a(attributes) {\n return new A(attributes);\n }\n\n static b(attributes) {\n return new B(attributes);\n }\n\n static body(attributes) {\n return new Body(attributes);\n }\n\n static br(attributes) {\n return new Br(attributes);\n }\n\n static html(attributes) {\n return new Html(attributes);\n }\n\n static i(attributes) {\n return new I(attributes);\n }\n\n static li(attributes) {\n return new Li(attributes);\n }\n\n static ol(attributes) {\n return new Ol(attributes);\n }\n\n static p(attributes) {\n return new P(attributes);\n }\n\n static span(attributes) {\n return new Span(attributes);\n }\n\n static sub(attributes) {\n return new Sub(attributes);\n }\n\n static sup(attributes) {\n return new Sup(attributes);\n }\n\n static ul(attributes) {\n return new Ul(attributes);\n }\n}\n\nexport { XhtmlNamespace };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { $buildXFAObject } from \"./namespaces.js\";\nimport { XmlObject } from \"./xfa_object.js\";\n\nclass UnknownNamespace {\n constructor(nsId) {\n this.namespaceId = nsId;\n }\n\n [$buildXFAObject](name, attributes) {\n return new XmlObject(this.namespaceId, name, attributes);\n }\n}\n\nexport { UnknownNamespace };\n", "/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringToUTF8String, warn } from \"../shared/util.js\";\nimport { parseXFAPath } from \"./core_utils.js\";\nimport { SimpleXMLParser } from \"./xml_parser.js\";\n\nfunction decodeString(str) {\n try {\n return stringToUTF8String(str);\n } catch (ex) {\n warn(`UTF-8 decoding failed: \"${ex}\".`);\n return str;\n }\n}\n\nclass DatasetXMLParser extends SimpleXMLParser {\n constructor(options) {\n super(options);\n this.node = null;\n }\n\n onEndElement(name) {\n const node = super.onEndElement(name);\n if (node && name === \"xfa:datasets\") {\n this.node = node;\n\n // We don't need anything else, so just kill the parser.\n throw new Error(\"Aborting DatasetXMLParser.\");\n }\n }\n}\n\nclass DatasetReader {\n constructor(data) {\n if (data.datasets) {\n this.node = new SimpleXMLParser({ hasAttributes: true }).parseFromString(\n data.datasets\n ).documentElement;\n } else {\n const parser = new DatasetXMLParser({ hasAttributes: true });\n try {\n parser.parseFromString(data[\"xdp:xdp\"]);\n } catch {}\n this.node = parser.node;\n }\n }\n\n getValue(path) {\n if (!this.node || !path) {\n return \"\";\n }\n const node = this.node.searchNode(parseXFAPath(path), 0);\n\n if (!node) {\n return \"\";\n }\n\n const first = node.firstChild;\n if (first?.nodeName === \"value\") {\n return node.children.map(child => decodeString(child.textContent));\n }\n\n return decodeString(node.textContent);\n }\n}\n\nexport { DatasetReader };\n", "/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n assert,\n bytesToString,\n FormatError,\n info,\n InvalidPDFException,\n warn,\n} from \"../shared/util.js\";\nimport { CIRCULAR_REF, Cmd, Dict, isCmd, Ref, RefSet } from \"./primitives.js\";\nimport { Lexer, Parser } from \"./parser.js\";\nimport {\n MissingDataException,\n ParserEOFException,\n XRefEntryException,\n XRefParseException,\n} from \"./core_utils.js\";\nimport { BaseStream } from \"./base_stream.js\";\nimport { CipherTransformFactory } from \"./crypto.js\";\n\nclass XRef {\n #firstXRefStmPos = null;\n\n constructor(stream, pdfManager) {\n this.stream = stream;\n this.pdfManager = pdfManager;\n this.entries = [];\n this._xrefStms = new Set();\n this._cacheMap = new Map(); // Prepare the XRef cache.\n this._pendingRefs = new RefSet();\n this._newPersistentRefNum = null;\n this._newTemporaryRefNum = null;\n }\n\n getNewPersistentRef(obj) {\n // When printing we don't care that much about the ref number by itself, it\n // can increase for ever and it allows to keep some re-usable refs.\n if (this._newPersistentRefNum === null) {\n this._newPersistentRefNum = this.entries.length || 1;\n }\n const num = this._newPersistentRefNum++;\n this._cacheMap.set(num, obj);\n return Ref.get(num, 0);\n }\n\n getNewTemporaryRef() {\n // When saving we want to have some minimal numbers.\n // Those refs are only created in order to be written in the final pdf\n // stream.\n if (this._newTemporaryRefNum === null) {\n this._newTemporaryRefNum = this.entries.length || 1;\n }\n return Ref.get(this._newTemporaryRefNum++, 0);\n }\n\n resetNewTemporaryRef() {\n // Called once saving is finished.\n this._newTemporaryRefNum = null;\n }\n\n setStartXRef(startXRef) {\n // Store the starting positions of xref tables as we process them\n // so we can recover from missing data errors\n this.startXRefQueue = [startXRef];\n }\n\n parse(recoveryMode = false) {\n let trailerDict;\n if (!recoveryMode) {\n trailerDict = this.readXRef();\n } else {\n warn(\"Indexing all PDF objects\");\n trailerDict = this.indexObjects();\n }\n trailerDict.assignXref(this);\n this.trailer = trailerDict;\n\n let encrypt;\n try {\n encrypt = trailerDict.get(\"Encrypt\");\n } catch (ex) {\n if (ex instanceof MissingDataException) {\n throw ex;\n }\n warn(`XRef.parse - Invalid \"Encrypt\" reference: \"${ex}\".`);\n }\n if (encrypt instanceof Dict) {\n const ids = trailerDict.get(\"ID\");\n const fileId = ids?.length ? ids[0] : \"\";\n // The 'Encrypt' dictionary itself should not be encrypted, and by\n // setting `suppressEncryption` we can prevent an infinite loop inside\n // of `XRef_fetchUncompressed` if the dictionary contains indirect\n // objects (fixes issue7665.pdf).\n encrypt.suppressEncryption = true;\n this.encrypt = new CipherTransformFactory(\n encrypt,\n fileId,\n this.pdfManager.password\n );\n }\n\n // Get the root dictionary (catalog) object, and do some basic validation.\n let root;\n try {\n root = trailerDict.get(\"Root\");\n } catch (ex) {\n if (ex instanceof MissingDataException) {\n throw ex;\n }\n warn(`XRef.parse - Invalid \"Root\" reference: \"${ex}\".`);\n }\n if (root instanceof Dict) {\n try {\n const pages = root.get(\"Pages\");\n if (pages instanceof Dict) {\n this.root = root;\n return;\n }\n } catch (ex) {\n if (ex instanceof MissingDataException) {\n throw ex;\n }\n warn(`XRef.parse - Invalid \"Pages\" reference: \"${ex}\".`);\n }\n }\n\n if (!recoveryMode) {\n throw new XRefParseException();\n }\n // Even recovery failed, there's nothing more we can do here.\n throw new InvalidPDFException(\"Invalid Root reference.\");\n }\n\n processXRefTable(parser) {\n if (!(\"tableState\" in this)) {\n // Stores state of the table as we process it so we can resume\n // from middle of table in case of missing data error\n this.tableState = {\n entryNum: 0,\n streamPos: parser.lexer.stream.pos,\n parserBuf1: parser.buf1,\n parserBuf2: parser.buf2,\n };\n }\n\n const obj = this.readXRefTable(parser);\n\n // Sanity check\n if (!isCmd(obj, \"trailer\")) {\n throw new FormatError(\n \"Invalid XRef table: could not find trailer dictionary\"\n );\n }\n // Read trailer dictionary, e.g.\n // trailer\n // << /Size 22\n // /Root 20R\n // /Info 10R\n // /ID [ <81b14aafa313db63dbd6f981e49f94f4> ]\n // >>\n // The parser goes through the entire stream << ... >> and provides\n // a getter interface for the key-value table\n let dict = parser.getObj();\n\n // The pdflib PDF generator can generate a nested trailer dictionary\n if (!(dict instanceof Dict) && dict.dict) {\n dict = dict.dict;\n }\n if (!(dict instanceof Dict)) {\n throw new FormatError(\n \"Invalid XRef table: could not parse trailer dictionary\"\n );\n }\n delete this.tableState;\n\n return dict;\n }\n\n readXRefTable(parser) {\n // Example of cross-reference table:\n // xref\n // 0 1 <-- subsection header (first obj #, obj count)\n // 0000000000 65535 f <-- actual object (offset, generation #, f/n)\n // 23 2 <-- subsection header ... and so on ...\n // 0000025518 00002 n\n // 0000025635 00000 n\n // trailer\n // ...\n\n const stream = parser.lexer.stream;\n const tableState = this.tableState;\n stream.pos = tableState.streamPos;\n parser.buf1 = tableState.parserBuf1;\n parser.buf2 = tableState.parserBuf2;\n\n // Outer loop is over subsection headers\n let obj;\n\n while (true) {\n if (!(\"firstEntryNum\" in tableState) || !(\"entryCount\" in tableState)) {\n if (isCmd((obj = parser.getObj()), \"trailer\")) {\n break;\n }\n tableState.firstEntryNum = obj;\n tableState.entryCount = parser.getObj();\n }\n\n let first = tableState.firstEntryNum;\n const count = tableState.entryCount;\n if (!Number.isInteger(first) || !Number.isInteger(count)) {\n throw new FormatError(\n \"Invalid XRef table: wrong types in subsection header\"\n );\n }\n // Inner loop is over objects themselves\n for (let i = tableState.entryNum; i < count; i++) {\n tableState.streamPos = stream.pos;\n tableState.entryNum = i;\n tableState.parserBuf1 = parser.buf1;\n tableState.parserBuf2 = parser.buf2;\n\n const entry = {};\n entry.offset = parser.getObj();\n entry.gen = parser.getObj();\n const type = parser.getObj();\n\n if (type instanceof Cmd) {\n switch (type.cmd) {\n case \"f\":\n entry.free = true;\n break;\n case \"n\":\n entry.uncompressed = true;\n break;\n }\n }\n\n // Validate entry obj\n if (\n !Number.isInteger(entry.offset) ||\n !Number.isInteger(entry.gen) ||\n !(entry.free || entry.uncompressed)\n ) {\n throw new FormatError(\n `Invalid entry in XRef subsection: ${first}, ${count}`\n );\n }\n\n // The first xref table entry, i.e. obj 0, should be free. Attempting\n // to adjust an incorrect first obj # (fixes issue 3248 and 7229).\n if (i === 0 && entry.free && first === 1) {\n first = 0;\n }\n\n if (!this.entries[i + first]) {\n this.entries[i + first] = entry;\n }\n }\n\n tableState.entryNum = 0;\n tableState.streamPos = stream.pos;\n tableState.parserBuf1 = parser.buf1;\n tableState.parserBuf2 = parser.buf2;\n delete tableState.firstEntryNum;\n delete tableState.entryCount;\n }\n\n // Sanity check: as per spec, first object must be free\n if (this.entries[0] && !this.entries[0].free) {\n throw new FormatError(\"Invalid XRef table: unexpected first object\");\n }\n return obj;\n }\n\n processXRefStream(stream) {\n if (!(\"streamState\" in this)) {\n // Stores state of the stream as we process it so we can resume\n // from middle of stream in case of missing data error\n const streamParameters = stream.dict;\n const byteWidths = streamParameters.get(\"W\");\n let range = streamParameters.get(\"Index\");\n if (!range) {\n range = [0, streamParameters.get(\"Size\")];\n }\n\n this.streamState = {\n entryRanges: range,\n byteWidths,\n entryNum: 0,\n streamPos: stream.pos,\n };\n }\n this.readXRefStream(stream);\n delete this.streamState;\n\n return stream.dict;\n }\n\n readXRefStream(stream) {\n const streamState = this.streamState;\n stream.pos = streamState.streamPos;\n\n const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] =\n streamState.byteWidths;\n\n const entryRanges = streamState.entryRanges;\n while (entryRanges.length > 0) {\n const [first, n] = entryRanges;\n\n if (!Number.isInteger(first) || !Number.isInteger(n)) {\n throw new FormatError(`Invalid XRef range fields: ${first}, ${n}`);\n }\n if (\n !Number.isInteger(typeFieldWidth) ||\n !Number.isInteger(offsetFieldWidth) ||\n !Number.isInteger(generationFieldWidth)\n ) {\n throw new FormatError(\n `Invalid XRef entry fields length: ${first}, ${n}`\n );\n }\n for (let i = streamState.entryNum; i < n; ++i) {\n streamState.entryNum = i;\n streamState.streamPos = stream.pos;\n\n let type = 0,\n offset = 0,\n generation = 0;\n for (let j = 0; j < typeFieldWidth; ++j) {\n const typeByte = stream.getByte();\n if (typeByte === -1) {\n throw new FormatError(\"Invalid XRef byteWidths 'type'.\");\n }\n type = (type << 8) | typeByte;\n }\n // if type field is absent, its default value is 1\n if (typeFieldWidth === 0) {\n type = 1;\n }\n for (let j = 0; j < offsetFieldWidth; ++j) {\n const offsetByte = stream.getByte();\n if (offsetByte === -1) {\n throw new FormatError(\"Invalid XRef byteWidths 'offset'.\");\n }\n offset = (offset << 8) | offsetByte;\n }\n for (let j = 0; j < generationFieldWidth; ++j) {\n const generationByte = stream.getByte();\n if (generationByte === -1) {\n throw new FormatError(\"Invalid XRef byteWidths 'generation'.\");\n }\n generation = (generation << 8) | generationByte;\n }\n const entry = {};\n entry.offset = offset;\n entry.gen = generation;\n switch (type) {\n case 0:\n entry.free = true;\n break;\n case 1:\n entry.uncompressed = true;\n break;\n case 2:\n break;\n default:\n throw new FormatError(`Invalid XRef entry type: ${type}`);\n }\n if (!this.entries[first + i]) {\n this.entries[first + i] = entry;\n }\n }\n\n streamState.entryNum = 0;\n streamState.streamPos = stream.pos;\n entryRanges.splice(0, 2);\n }\n }\n\n indexObjects() {\n // Simple scan through the PDF content to find objects,\n // trailers and XRef streams.\n const TAB = 0x9,\n LF = 0xa,\n CR = 0xd,\n SPACE = 0x20;\n const PERCENT = 0x25,\n LT = 0x3c;\n\n function readToken(data, offset) {\n let token = \"\",\n ch = data[offset];\n while (ch !== LF && ch !== CR && ch !== LT) {\n if (++offset >= data.length) {\n break;\n }\n token += String.fromCharCode(ch);\n ch = data[offset];\n }\n return token;\n }\n function skipUntil(data, offset, what) {\n const length = what.length,\n dataLength = data.length;\n let skipped = 0;\n // finding byte sequence\n while (offset < dataLength) {\n let i = 0;\n while (i < length && data[offset + i] === what[i]) {\n ++i;\n }\n if (i >= length) {\n break; // sequence found\n }\n offset++;\n skipped++;\n }\n return skipped;\n }\n const gEndobjRegExp = /\\b(endobj|\\d+\\s+\\d+\\s+obj|xref|trailer\\s*<<)\\b/g;\n const gStartxrefRegExp = /\\b(startxref|\\d+\\s+\\d+\\s+obj)\\b/g;\n const objRegExp = /^(\\d+)\\s+(\\d+)\\s+obj\\b/;\n\n const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);\n const startxrefBytes = new Uint8Array([\n 115, 116, 97, 114, 116, 120, 114, 101, 102,\n ]);\n const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);\n\n // Clear out any existing entries, since they may be bogus.\n this.entries.length = 0;\n this._cacheMap.clear();\n\n const stream = this.stream;\n stream.pos = 0;\n const buffer = stream.getBytes(),\n bufferStr = bytesToString(buffer),\n length = buffer.length;\n let position = stream.start;\n const trailers = [],\n xrefStms = [];\n while (position < length) {\n let ch = buffer[position];\n if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {\n ++position;\n continue;\n }\n if (ch === PERCENT) {\n // %-comment\n do {\n ++position;\n if (position >= length) {\n break;\n }\n ch = buffer[position];\n } while (ch !== LF && ch !== CR);\n continue;\n }\n const token = readToken(buffer, position);\n let m;\n if (\n token.startsWith(\"xref\") &&\n (token.length === 4 || /\\s/.test(token[4]))\n ) {\n position += skipUntil(buffer, position, trailerBytes);\n trailers.push(position);\n position += skipUntil(buffer, position, startxrefBytes);\n } else if ((m = objRegExp.exec(token))) {\n const num = m[1] | 0,\n gen = m[2] | 0;\n\n const startPos = position + token.length;\n let contentLength,\n updateEntries = false;\n if (!this.entries[num]) {\n updateEntries = true;\n } else if (this.entries[num].gen === gen) {\n // Before overwriting an existing entry, ensure that the new one won't\n // cause *immediate* errors when it's accessed (fixes issue13783.pdf).\n try {\n const parser = new Parser({\n lexer: new Lexer(stream.makeSubStream(startPos)),\n });\n parser.getObj();\n updateEntries = true;\n } catch (ex) {\n if (ex instanceof ParserEOFException) {\n warn(`indexObjects -- checking object (${token}): \"${ex}\".`);\n } else {\n // The error may come from the `Parser`-instance being initialized\n // without an `XRef`-instance (we don't have a usable one yet).\n updateEntries = true;\n }\n }\n }\n if (updateEntries) {\n this.entries[num] = {\n offset: position - stream.start,\n gen,\n uncompressed: true,\n };\n }\n\n // Find the next \"obj\" string, rather than \"endobj\", to ensure that\n // we won't skip over a new 'obj' operator in corrupt files where\n // 'endobj' operators are missing (fixes issue9105_reduced.pdf).\n gEndobjRegExp.lastIndex = startPos;\n const match = gEndobjRegExp.exec(bufferStr);\n\n if (match) {\n const endPos = gEndobjRegExp.lastIndex + 1;\n contentLength = endPos - position;\n\n if (match[1] !== \"endobj\") {\n warn(\n `indexObjects: Found \"${match[1]}\" inside of another \"obj\", ` +\n 'caused by missing \"endobj\" -- trying to recover.'\n );\n contentLength -= match[1].length + 1;\n }\n } else {\n contentLength = length - position;\n }\n const content = buffer.subarray(position, position + contentLength);\n\n // checking XRef stream suspect\n // (it shall have '/XRef' and next char is not a letter)\n const xrefTagOffset = skipUntil(content, 0, xrefBytes);\n if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {\n xrefStms.push(position - stream.start);\n this._xrefStms.add(position - stream.start); // Avoid recursion\n }\n\n position += contentLength;\n } else if (\n token.startsWith(\"trailer\") &&\n (token.length === 7 || /\\s/.test(token[7]))\n ) {\n trailers.push(position);\n\n const startPos = position + token.length;\n let contentLength;\n // Attempt to handle (some) corrupt documents, where no 'startxref'\n // operators are present (fixes issue15590.pdf).\n gStartxrefRegExp.lastIndex = startPos;\n const match = gStartxrefRegExp.exec(bufferStr);\n\n if (match) {\n const endPos = gStartxrefRegExp.lastIndex + 1;\n contentLength = endPos - position;\n\n if (match[1] !== \"startxref\") {\n warn(\n `indexObjects: Found \"${match[1]}\" after \"trailer\", ` +\n 'caused by missing \"startxref\" -- trying to recover.'\n );\n contentLength -= match[1].length + 1;\n }\n } else {\n contentLength = length - position;\n }\n position += contentLength;\n } else {\n position += token.length + 1;\n }\n }\n // reading XRef streams\n for (const xrefStm of xrefStms) {\n this.startXRefQueue.push(xrefStm);\n this.readXRef(/* recoveryMode */ true);\n }\n\n const trailerDicts = [];\n // Pre-parsing the trailers to check if the document is possibly encrypted.\n let isEncrypted = false;\n for (const trailer of trailers) {\n stream.pos = trailer;\n const parser = new Parser({\n lexer: new Lexer(stream),\n xref: this,\n allowStreams: true,\n recoveryMode: true,\n });\n const obj = parser.getObj();\n if (!isCmd(obj, \"trailer\")) {\n continue;\n }\n // read the trailer dictionary\n const dict = parser.getObj();\n if (!(dict instanceof Dict)) {\n continue;\n }\n trailerDicts.push(dict);\n\n if (dict.has(\"Encrypt\")) {\n isEncrypted = true;\n }\n }\n\n // finding main trailer\n let trailerDict, trailerError;\n for (const dict of [...trailerDicts, \"genFallback\", ...trailerDicts]) {\n if (dict === \"genFallback\") {\n if (!trailerError) {\n break; // No need to fallback if there were no validation errors.\n }\n this._generationFallback = true;\n continue;\n }\n // Do some basic validation of the trailer/root dictionary candidate.\n let validPagesDict = false;\n try {\n const rootDict = dict.get(\"Root\");\n if (!(rootDict instanceof Dict)) {\n continue;\n }\n const pagesDict = rootDict.get(\"Pages\");\n if (!(pagesDict instanceof Dict)) {\n continue;\n }\n const pagesCount = pagesDict.get(\"Count\");\n if (Number.isInteger(pagesCount)) {\n validPagesDict = true;\n }\n // The top-level /Pages dictionary isn't obviously corrupt.\n } catch (ex) {\n trailerError = ex;\n continue;\n }\n // taking the first one with 'ID'\n if (\n validPagesDict &&\n (!isEncrypted || dict.has(\"Encrypt\")) &&\n dict.has(\"ID\")\n ) {\n return dict;\n }\n // The current dictionary is a candidate, but continue searching.\n trailerDict = dict;\n }\n // No trailer with 'ID', taking last one (if exists).\n if (trailerDict) {\n return trailerDict;\n }\n // No trailer dictionary found, taking the \"top\"-dictionary (if exists).\n if (this.topDict) {\n return this.topDict;\n }\n // nothing helps\n throw new InvalidPDFException(\"Invalid PDF structure.\");\n }\n\n readXRef(recoveryMode = false) {\n const stream = this.stream;\n // Keep track of already parsed XRef tables, to prevent an infinite loop\n // when parsing corrupt PDF files where e.g. the /Prev entries create a\n // circular dependency between tables (fixes bug1393476.pdf).\n const startXRefParsedCache = new Set();\n\n while (this.startXRefQueue.length) {\n try {\n const startXRef = this.startXRefQueue[0];\n\n if (startXRefParsedCache.has(startXRef)) {\n warn(\"readXRef - skipping XRef table since it was already parsed.\");\n this.startXRefQueue.shift();\n continue;\n }\n startXRefParsedCache.add(startXRef);\n\n stream.pos = startXRef + stream.start;\n\n const parser = new Parser({\n lexer: new Lexer(stream),\n xref: this,\n allowStreams: true,\n });\n let obj = parser.getObj();\n let dict;\n\n // Get dictionary\n if (isCmd(obj, \"xref\")) {\n // Parse end-of-file XRef\n dict = this.processXRefTable(parser);\n if (!this.topDict) {\n this.topDict = dict;\n }\n\n // Recursively get other XRefs 'XRefStm', if any\n obj = dict.get(\"XRefStm\");\n if (Number.isInteger(obj) && !this._xrefStms.has(obj)) {\n // ignore previously loaded xref streams\n // (possible infinite recursion)\n this._xrefStms.add(obj);\n this.startXRefQueue.push(obj);\n this.#firstXRefStmPos ??= obj;\n }\n } else if (Number.isInteger(obj)) {\n // Parse in-stream XRef\n if (\n !Number.isInteger(parser.getObj()) ||\n !isCmd(parser.getObj(), \"obj\") ||\n !((obj = parser.getObj()) instanceof BaseStream)\n ) {\n throw new FormatError(\"Invalid XRef stream\");\n }\n dict = this.processXRefStream(obj);\n if (!this.topDict) {\n this.topDict = dict;\n }\n if (!dict) {\n throw new FormatError(\"Failed to read XRef stream\");\n }\n } else {\n throw new FormatError(\"Invalid XRef stream header\");\n }\n\n // Recursively get previous dictionary, if any\n obj = dict.get(\"Prev\");\n if (Number.isInteger(obj)) {\n this.startXRefQueue.push(obj);\n } else if (obj instanceof Ref) {\n // The spec says Prev must not be a reference, i.e. \"/Prev NNN\"\n // This is a fallback for non-compliant PDFs, i.e. \"/Prev NNN 0 R\"\n this.startXRefQueue.push(obj.num);\n }\n } catch (e) {\n if (e instanceof MissingDataException) {\n throw e;\n }\n info(\"(while reading XRef): \" + e);\n }\n this.startXRefQueue.shift();\n }\n\n if (this.topDict) {\n return this.topDict;\n }\n if (recoveryMode) {\n return undefined;\n }\n throw new XRefParseException();\n }\n\n get lastXRefStreamPos() {\n return (\n this.#firstXRefStmPos ??\n (this._xrefStms.size > 0 ? Math.max(...this._xrefStms) : null)\n );\n }\n\n getEntry(i) {\n const xrefEntry = this.entries[i];\n if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {\n return xrefEntry;\n }\n return null;\n }\n\n fetchIfRef(obj, suppressEncryption = false) {\n if (obj instanceof Ref) {\n return this.fetch(obj, suppressEncryption);\n }\n return obj;\n }\n\n fetch(ref, suppressEncryption = false) {\n if (!(ref instanceof Ref)) {\n throw new Error(\"ref object is not a reference\");\n }\n const num = ref.num;\n\n // The XRef cache is populated with objects which are obtained through\n // `Parser.getObj`, and indirectly via `Lexer.getObj`. Neither of these\n // methods should ever return `undefined` (note the `assert` calls below).\n const cacheEntry = this._cacheMap.get(num);\n if (cacheEntry !== undefined) {\n // In documents with Object Streams, it's possible that cached `Dict`s\n // have not been assigned an `objId` yet (see e.g. issue3115r.pdf).\n if (cacheEntry instanceof Dict && !cacheEntry.objId) {\n cacheEntry.objId = ref.toString();\n }\n return cacheEntry;\n }\n let xrefEntry = this.getEntry(num);\n\n if (xrefEntry === null) {\n // The referenced entry can be free.\n this._cacheMap.set(num, xrefEntry);\n return xrefEntry;\n }\n // Prevent circular references, in corrupt PDF documents, from hanging the\n // worker-thread. This relies, implicitly, on the parsing being synchronous.\n if (this._pendingRefs.has(ref)) {\n this._pendingRefs.remove(ref);\n\n warn(`Ignoring circular reference: ${ref}.`);\n return CIRCULAR_REF;\n }\n this._pendingRefs.put(ref);\n\n try {\n xrefEntry = xrefEntry.uncompressed\n ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption)\n : this.fetchCompressed(ref, xrefEntry, suppressEncryption);\n this._pendingRefs.remove(ref);\n } catch (ex) {\n this._pendingRefs.remove(ref);\n throw ex;\n }\n if (xrefEntry instanceof Dict) {\n xrefEntry.objId = ref.toString();\n } else if (xrefEntry instanceof BaseStream) {\n xrefEntry.dict.objId = ref.toString();\n }\n return xrefEntry;\n }\n\n fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {\n const gen = ref.gen;\n let num = ref.num;\n if (xrefEntry.gen !== gen) {\n const msg = `Inconsistent generation in XRef: ${ref}`;\n // Try falling back to a *previous* generation (fixes issue15577.pdf).\n if (this._generationFallback && xrefEntry.gen < gen) {\n warn(msg);\n return this.fetchUncompressed(\n Ref.get(num, xrefEntry.gen),\n xrefEntry,\n suppressEncryption\n );\n }\n throw new XRefEntryException(msg);\n }\n const stream = this.stream.makeSubStream(\n xrefEntry.offset + this.stream.start\n );\n const parser = new Parser({\n lexer: new Lexer(stream),\n xref: this,\n allowStreams: true,\n });\n const obj1 = parser.getObj();\n const obj2 = parser.getObj();\n const obj3 = parser.getObj();\n\n if (obj1 !== num || obj2 !== gen || !(obj3 instanceof Cmd)) {\n throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);\n }\n if (obj3.cmd !== \"obj\") {\n // some bad PDFs use \"obj1234\" and really mean 1234\n if (obj3.cmd.startsWith(\"obj\")) {\n num = parseInt(obj3.cmd.substring(3), 10);\n if (!Number.isNaN(num)) {\n return num;\n }\n }\n throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);\n }\n xrefEntry =\n this.encrypt && !suppressEncryption\n ? parser.getObj(this.encrypt.createCipherTransform(num, gen))\n : parser.getObj();\n if (!(xrefEntry instanceof BaseStream)) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n assert(\n xrefEntry !== undefined,\n 'fetchUncompressed: The \"xrefEntry\" cannot be undefined.'\n );\n }\n this._cacheMap.set(num, xrefEntry);\n }\n return xrefEntry;\n }\n\n fetchCompressed(ref, xrefEntry, suppressEncryption = false) {\n const tableOffset = xrefEntry.offset;\n const stream = this.fetch(Ref.get(tableOffset, 0));\n if (!(stream instanceof BaseStream)) {\n throw new FormatError(\"bad ObjStm stream\");\n }\n const first = stream.dict.get(\"First\");\n const n = stream.dict.get(\"N\");\n if (!Number.isInteger(first) || !Number.isInteger(n)) {\n throw new FormatError(\"invalid first and n parameters for ObjStm stream\");\n }\n let parser = new Parser({\n lexer: new Lexer(stream),\n xref: this,\n allowStreams: true,\n });\n const nums = new Array(n);\n const offsets = new Array(n);\n // read the object numbers to populate cache\n for (let i = 0; i < n; ++i) {\n const num = parser.getObj();\n if (!Number.isInteger(num)) {\n throw new FormatError(\n `invalid object number in the ObjStm stream: ${num}`\n );\n }\n const offset = parser.getObj();\n if (!Number.isInteger(offset)) {\n throw new FormatError(\n `invalid object offset in the ObjStm stream: ${offset}`\n );\n }\n nums[i] = num;\n offsets[i] = offset;\n }\n\n const start = (stream.start || 0) + first;\n const entries = new Array(n);\n // read stream objects for cache\n for (let i = 0; i < n; ++i) {\n const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;\n if (length < 0) {\n throw new FormatError(\"Invalid offset in the ObjStm stream.\");\n }\n parser = new Parser({\n lexer: new Lexer(\n stream.makeSubStream(start + offsets[i], length, stream.dict)\n ),\n xref: this,\n allowStreams: true,\n });\n\n const obj = parser.getObj();\n entries[i] = obj;\n if (obj instanceof BaseStream) {\n continue;\n }\n const num = nums[i],\n entry = this.entries[num];\n if (entry && entry.offset === tableOffset && entry.gen === i) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n assert(\n obj !== undefined,\n 'fetchCompressed: The \"obj\" cannot be undefined.'\n );\n }\n this._cacheMap.set(num, obj);\n }\n }\n xrefEntry = entries[xrefEntry.gen];\n if (xrefEntry === undefined) {\n throw new XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);\n }\n return xrefEntry;\n }\n\n async fetchIfRefAsync(obj, suppressEncryption) {\n if (obj instanceof Ref) {\n return this.fetchAsync(obj, suppressEncryption);\n }\n return obj;\n }\n\n async fetchAsync(ref, suppressEncryption) {\n try {\n return this.fetch(ref, suppressEncryption);\n } catch (ex) {\n if (!(ex instanceof MissingDataException)) {\n throw ex;\n }\n await this.pdfManager.requestRange(ex.begin, ex.end);\n return this.fetchAsync(ref, suppressEncryption);\n }\n }\n\n getCatalogObj() {\n return this.root;\n }\n}\n\nexport { XRef };\n", "/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AbortException,\n assert,\n MissingPDFException,\n PasswordException,\n PromiseCapability,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n} from \"./util.js\";\n\nconst CallbackKind = {\n UNKNOWN: 0,\n DATA: 1,\n ERROR: 2,\n};\n\nconst StreamKind = {\n UNKNOWN: 0,\n CANCEL: 1,\n CANCEL_COMPLETE: 2,\n CLOSE: 3,\n ENQUEUE: 4,\n ERROR: 5,\n PULL: 6,\n PULL_COMPLETE: 7,\n START_COMPLETE: 8,\n};\n\nfunction wrapReason(reason) {\n if (\n !(\n reason instanceof Error ||\n (typeof reason === \"object\" && reason !== null)\n )\n ) {\n unreachable(\n 'wrapReason: Expected \"reason\" to be a (possibly cloned) Error.'\n );\n }\n switch (reason.name) {\n case \"AbortException\":\n return new AbortException(reason.message);\n case \"MissingPDFException\":\n return new MissingPDFException(reason.message);\n case \"PasswordException\":\n return new PasswordException(reason.message, reason.code);\n case \"UnexpectedResponseException\":\n return new UnexpectedResponseException(reason.message, reason.status);\n case \"UnknownErrorException\":\n return new UnknownErrorException(reason.message, reason.details);\n default:\n return new UnknownErrorException(reason.message, reason.toString());\n }\n}\n\nclass MessageHandler {\n constructor(sourceName, targetName, comObj) {\n this.sourceName = sourceName;\n this.targetName = targetName;\n this.comObj = comObj;\n this.callbackId = 1;\n this.streamId = 1;\n this.streamSinks = Object.create(null);\n this.streamControllers = Object.create(null);\n this.callbackCapabilities = Object.create(null);\n this.actionHandler = Object.create(null);\n\n this._onComObjOnMessage = event => {\n const data = event.data;\n if (data.targetName !== this.sourceName) {\n return;\n }\n if (data.stream) {\n this.#processStreamMessage(data);\n return;\n }\n if (data.callback) {\n const callbackId = data.callbackId;\n const capability = this.callbackCapabilities[callbackId];\n if (!capability) {\n throw new Error(`Cannot resolve callback ${callbackId}`);\n }\n delete this.callbackCapabilities[callbackId];\n\n if (data.callback === CallbackKind.DATA) {\n capability.resolve(data.data);\n } else if (data.callback === CallbackKind.ERROR) {\n capability.reject(wrapReason(data.reason));\n } else {\n throw new Error(\"Unexpected callback case\");\n }\n return;\n }\n const action = this.actionHandler[data.action];\n if (!action) {\n throw new Error(`Unknown action from worker: ${data.action}`);\n }\n if (data.callbackId) {\n const cbSourceName = this.sourceName;\n const cbTargetName = data.sourceName;\n\n new Promise(function (resolve) {\n resolve(action(data.data));\n }).then(\n function (result) {\n comObj.postMessage({\n sourceName: cbSourceName,\n targetName: cbTargetName,\n callback: CallbackKind.DATA,\n callbackId: data.callbackId,\n data: result,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName: cbSourceName,\n targetName: cbTargetName,\n callback: CallbackKind.ERROR,\n callbackId: data.callbackId,\n reason: wrapReason(reason),\n });\n }\n );\n return;\n }\n if (data.streamId) {\n this.#createStreamSink(data);\n return;\n }\n action(data.data);\n };\n comObj.addEventListener(\"message\", this._onComObjOnMessage);\n }\n\n on(actionName, handler) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n assert(\n typeof handler === \"function\",\n 'MessageHandler.on: Expected \"handler\" to be a function.'\n );\n }\n const ah = this.actionHandler;\n if (ah[actionName]) {\n throw new Error(`There is already an actionName called \"${actionName}\"`);\n }\n ah[actionName] = handler;\n }\n\n /**\n * Sends a message to the comObj to invoke the action with the supplied data.\n * @param {string} actionName - Action to call.\n * @param {JSON} data - JSON data to send.\n * @param {Array} [transfers] - List of transfers/ArrayBuffers.\n */\n send(actionName, data, transfers) {\n this.comObj.postMessage(\n {\n sourceName: this.sourceName,\n targetName: this.targetName,\n action: actionName,\n data,\n },\n transfers\n );\n }\n\n /**\n * Sends a message to the comObj to invoke the action with the supplied data.\n * Expects that the other side will callback with the response.\n * @param {string} actionName - Action to call.\n * @param {JSON} data - JSON data to send.\n * @param {Array} [transfers] - List of transfers/ArrayBuffers.\n * @returns {Promise} Promise to be resolved with response data.\n */\n sendWithPromise(actionName, data, transfers) {\n const callbackId = this.callbackId++;\n const capability = new PromiseCapability();\n this.callbackCapabilities[callbackId] = capability;\n try {\n this.comObj.postMessage(\n {\n sourceName: this.sourceName,\n targetName: this.targetName,\n action: actionName,\n callbackId,\n data,\n },\n transfers\n );\n } catch (ex) {\n capability.reject(ex);\n }\n return capability.promise;\n }\n\n /**\n * Sends a message to the comObj to invoke the action with the supplied data.\n * Expect that the other side will callback to signal 'start_complete'.\n * @param {string} actionName - Action to call.\n * @param {JSON} data - JSON data to send.\n * @param {Object} queueingStrategy - Strategy to signal backpressure based on\n * internal queue.\n * @param {Array} [transfers] - List of transfers/ArrayBuffers.\n * @returns {ReadableStream} ReadableStream to read data in chunks.\n */\n sendWithStream(actionName, data, queueingStrategy, transfers) {\n const streamId = this.streamId++,\n sourceName = this.sourceName,\n targetName = this.targetName,\n comObj = this.comObj;\n\n return new ReadableStream(\n {\n start: controller => {\n const startCapability = new PromiseCapability();\n this.streamControllers[streamId] = {\n controller,\n startCall: startCapability,\n pullCall: null,\n cancelCall: null,\n isClosed: false,\n };\n comObj.postMessage(\n {\n sourceName,\n targetName,\n action: actionName,\n streamId,\n data,\n desiredSize: controller.desiredSize,\n },\n transfers\n );\n // Return Promise for Async process, to signal success/failure.\n return startCapability.promise;\n },\n\n pull: controller => {\n const pullCapability = new PromiseCapability();\n this.streamControllers[streamId].pullCall = pullCapability;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL,\n streamId,\n desiredSize: controller.desiredSize,\n });\n // Returning Promise will not call \"pull\"\n // again until current pull is resolved.\n return pullCapability.promise;\n },\n\n cancel: reason => {\n assert(reason instanceof Error, \"cancel must have a valid reason\");\n const cancelCapability = new PromiseCapability();\n this.streamControllers[streamId].cancelCall = cancelCapability;\n this.streamControllers[streamId].isClosed = true;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CANCEL,\n streamId,\n reason: wrapReason(reason),\n });\n // Return Promise to signal success or failure.\n return cancelCapability.promise;\n },\n },\n queueingStrategy\n );\n }\n\n #createStreamSink(data) {\n const streamId = data.streamId,\n sourceName = this.sourceName,\n targetName = data.sourceName,\n comObj = this.comObj;\n const self = this,\n action = this.actionHandler[data.action];\n\n const streamSink = {\n enqueue(chunk, size = 1, transfers) {\n if (this.isCancelled) {\n return;\n }\n const lastDesiredSize = this.desiredSize;\n this.desiredSize -= size;\n // Enqueue decreases the desiredSize property of sink,\n // so when it changes from positive to negative,\n // set ready as unresolved promise.\n if (lastDesiredSize > 0 && this.desiredSize <= 0) {\n this.sinkCapability = new PromiseCapability();\n this.ready = this.sinkCapability.promise;\n }\n comObj.postMessage(\n {\n sourceName,\n targetName,\n stream: StreamKind.ENQUEUE,\n streamId,\n chunk,\n },\n transfers\n );\n },\n\n close() {\n if (this.isCancelled) {\n return;\n }\n this.isCancelled = true;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CLOSE,\n streamId,\n });\n delete self.streamSinks[streamId];\n },\n\n error(reason) {\n assert(reason instanceof Error, \"error must have a valid reason\");\n if (this.isCancelled) {\n return;\n }\n this.isCancelled = true;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.ERROR,\n streamId,\n reason: wrapReason(reason),\n });\n },\n\n sinkCapability: new PromiseCapability(),\n onPull: null,\n onCancel: null,\n isCancelled: false,\n desiredSize: data.desiredSize,\n ready: null,\n };\n\n streamSink.sinkCapability.resolve();\n streamSink.ready = streamSink.sinkCapability.promise;\n this.streamSinks[streamId] = streamSink;\n\n new Promise(function (resolve) {\n resolve(action(data.data, streamSink));\n }).then(\n function () {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.START_COMPLETE,\n streamId,\n success: true,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.START_COMPLETE,\n streamId,\n reason: wrapReason(reason),\n });\n }\n );\n }\n\n #processStreamMessage(data) {\n const streamId = data.streamId,\n sourceName = this.sourceName,\n targetName = data.sourceName,\n comObj = this.comObj;\n const streamController = this.streamControllers[streamId],\n streamSink = this.streamSinks[streamId];\n\n switch (data.stream) {\n case StreamKind.START_COMPLETE:\n if (data.success) {\n streamController.startCall.resolve();\n } else {\n streamController.startCall.reject(wrapReason(data.reason));\n }\n break;\n case StreamKind.PULL_COMPLETE:\n if (data.success) {\n streamController.pullCall.resolve();\n } else {\n streamController.pullCall.reject(wrapReason(data.reason));\n }\n break;\n case StreamKind.PULL:\n // Ignore any pull after close is called.\n if (!streamSink) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL_COMPLETE,\n streamId,\n success: true,\n });\n break;\n }\n // Pull increases the desiredSize property of sink, so when it changes\n // from negative to positive, set ready property as resolved promise.\n if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {\n streamSink.sinkCapability.resolve();\n }\n // Reset desiredSize property of sink on every pull.\n streamSink.desiredSize = data.desiredSize;\n\n new Promise(function (resolve) {\n resolve(streamSink.onPull?.());\n }).then(\n function () {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL_COMPLETE,\n streamId,\n success: true,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL_COMPLETE,\n streamId,\n reason: wrapReason(reason),\n });\n }\n );\n break;\n case StreamKind.ENQUEUE:\n assert(streamController, \"enqueue should have stream controller\");\n if (streamController.isClosed) {\n break;\n }\n streamController.controller.enqueue(data.chunk);\n break;\n case StreamKind.CLOSE:\n assert(streamController, \"close should have stream controller\");\n if (streamController.isClosed) {\n break;\n }\n streamController.isClosed = true;\n streamController.controller.close();\n this.#deleteStreamController(streamController, streamId);\n break;\n case StreamKind.ERROR:\n assert(streamController, \"error should have stream controller\");\n streamController.controller.error(wrapReason(data.reason));\n this.#deleteStreamController(streamController, streamId);\n break;\n case StreamKind.CANCEL_COMPLETE:\n if (data.success) {\n streamController.cancelCall.resolve();\n } else {\n streamController.cancelCall.reject(wrapReason(data.reason));\n }\n this.#deleteStreamController(streamController, streamId);\n break;\n case StreamKind.CANCEL:\n if (!streamSink) {\n break;\n }\n\n new Promise(function (resolve) {\n resolve(streamSink.onCancel?.(wrapReason(data.reason)));\n }).then(\n function () {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CANCEL_COMPLETE,\n streamId,\n success: true,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CANCEL_COMPLETE,\n streamId,\n reason: wrapReason(reason),\n });\n }\n );\n streamSink.sinkCapability.reject(wrapReason(data.reason));\n streamSink.isCancelled = true;\n delete this.streamSinks[streamId];\n break;\n default:\n throw new Error(\"Unexpected stream case\");\n }\n }\n\n async #deleteStreamController(streamController, streamId) {\n // Delete the `streamController` only when the start, pull, and cancel\n // capabilities have settled, to prevent `TypeError`s.\n await Promise.allSettled([\n streamController.startCall?.promise,\n streamController.pullCall?.promise,\n streamController.cancelCall?.promise,\n ]);\n delete this.streamControllers[streamId];\n }\n\n destroy() {\n this.comObj.removeEventListener(\"message\", this._onComObjOnMessage);\n }\n}\n\nexport { MessageHandler };\n", "/* Copyright 2019 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { assert } from \"../shared/util.js\";\n\n/** @implements {IPDFStream} */\nclass PDFWorkerStream {\n constructor(msgHandler) {\n this._msgHandler = msgHandler;\n this._contentLength = null;\n this._fullRequestReader = null;\n this._rangeRequestReaders = [];\n }\n\n getFullReader() {\n assert(\n !this._fullRequestReader,\n \"PDFWorkerStream.getFullReader can only be called once.\"\n );\n this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);\n return this._fullRequestReader;\n }\n\n getRangeReader(begin, end) {\n const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);\n this._rangeRequestReaders.push(reader);\n return reader;\n }\n\n cancelAllRequests(reason) {\n this._fullRequestReader?.cancel(reason);\n\n for (const reader of this._rangeRequestReaders.slice(0)) {\n reader.cancel(reason);\n }\n }\n}\n\n/** @implements {IPDFStreamReader} */\nclass PDFWorkerStreamReader {\n constructor(msgHandler) {\n this._msgHandler = msgHandler;\n this.onProgress = null;\n\n this._contentLength = null;\n this._isRangeSupported = false;\n this._isStreamingSupported = false;\n\n const readableStream = this._msgHandler.sendWithStream(\"GetReader\");\n this._reader = readableStream.getReader();\n\n this._headersReady = this._msgHandler\n .sendWithPromise(\"ReaderHeadersReady\")\n .then(data => {\n this._isStreamingSupported = data.isStreamingSupported;\n this._isRangeSupported = data.isRangeSupported;\n this._contentLength = data.contentLength;\n });\n }\n\n get headersReady() {\n return this._headersReady;\n }\n\n get contentLength() {\n return this._contentLength;\n }\n\n get isStreamingSupported() {\n return this._isStreamingSupported;\n }\n\n get isRangeSupported() {\n return this._isRangeSupported;\n }\n\n async read() {\n const { value, done } = await this._reader.read();\n if (done) {\n return { value: undefined, done: true };\n }\n // `value` is wrapped into Uint8Array, we need to\n // unwrap it to ArrayBuffer for further processing.\n return { value: value.buffer, done: false };\n }\n\n cancel(reason) {\n this._reader.cancel(reason);\n }\n}\n\n/** @implements {IPDFStreamRangeReader} */\nclass PDFWorkerStreamRangeReader {\n constructor(begin, end, msgHandler) {\n this._msgHandler = msgHandler;\n this.onProgress = null;\n\n const readableStream = this._msgHandler.sendWithStream(\"GetRangeReader\", {\n begin,\n end,\n });\n this._reader = readableStream.getReader();\n }\n\n get isStreamingSupported() {\n return false;\n }\n\n async read() {\n const { value, done } = await this._reader.read();\n if (done) {\n return { value: undefined, done: true };\n }\n return { value: value.buffer, done: false };\n }\n\n cancel(reason) {\n this._reader.cancel(reason);\n }\n}\n\nexport { PDFWorkerStream };\n", "// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __w_pdfjs_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n", "/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WorkerMessageHandler } from \"./core/worker.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nexport { WorkerMessageHandler };\n", "/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(typeof window !== \"undefined\"\n ? window\n : {}\n).pdfjsWorker = require(\"./pdf.worker.js\");\n", "'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n", "import { StrictMode } from \"react\";\r\nimport \"./index.css\";\r\nimport App from \"./App\";\r\nimport * as serviceWorkerRegistration from \"./serviceWorkerRegistration\";\r\nimport reportWebVitals from \"./reportWebVitals\";\r\nimport AppThemeProvider from \"./themes/ThemeProviders/AppThemeProvider\";\r\nimport { createRoot } from \"react-dom/client\";\r\nimport config from \"./config\";\r\nimport { initialize } from \"@nualang/nualang-api-and-queries/index.js\";\r\nimport { initializeAppConfig } from \"@nualang/nualang-ui-components/dist/config\";\r\n\r\ninitialize(config);\r\ninitializeAppConfig(config);\r\n\r\nconst root = createRoot(document.getElementById(\"root\"));\r\n\r\nroot.render(\r\n // \r\n \r\n \r\n ,\r\n // \r\n);\r\n\r\n// If you want your app to work offline and load faster, you can change\r\n// unregister() to register() below. Note this comes with some pitfalls.\r\n// Learn more about service workers: https://cra.link/PWA\r\nserviceWorkerRegistration.unregister();\r\n\r\n// If you want to start measuring performance in your app, pass a function\r\n// to log results (for example: reportWebVitals(console.log))\r\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\r\nreportWebVitals();\r\n", "import React, { Suspense, useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport * as router from \"react-router-dom\";\nimport ModalFactory from \"react-modal-promise\";\nimport ReactGA from \"react-ga4\";\nimport { styled } from \"@mui/material/styles\";\nimport { ErrorBoundary } from \"react-error-boundary\";\nimport Breadcrumbs from \"@nualang/nualang-ui-components/dist/Navigation/Breadcrumbs\";\nimport UIfx from \"uifx\";\nimport { users as userQuerys } from \"@nualang/nualang-api-and-queries/Queries\";\nimport correctAudio from \"./utils/audio/correct.wav\";\nimport incorrectAudio from \"./utils/audio/incorrect.wav\";\nimport tadaAudio from \"./utils/audio/tada.mp3\";\nimport { getUser } from \"@nualang/nualang-api-and-queries/APIs/Users\";\nimport Layout from \"./layouts/App\";\nimport routes from \"./routes\";\nimport { noAuthPaths } from \"./routes\";\nimport withAuth from \"./hoc/withAuth\";\nimport Loading from \"./components/Misc/Loading\";\nimport withRoot from \"./hoc/withRoot\";\nimport usePageTracking from \"./usePageTracking\";\nimport DefaultError from \"./views/DefaultError/DefaultError\";\nimport useLiveReload from \"./hooks/useLiveReload\";\nimport useUserOnboarding from \"./hooks/useUserOnboarding\";\nimport { trackRecommendedEvent } from \"./utils\";\n\nconst config = [{ trackingId: process.env.REACT_APP_GA4_TRACKING_ID }];\n\nReactGA.initialize(config);\n\nconst { Route, Routes, Navigate, useNavigate, useLocation } = router;\n\nconst Content = styled(\"div\")(({ theme }) => ({\n flexGrow: 1,\n color: theme.palette.text.primary,\n}));\n\nfunction AppRoute(props) {\n usePageTracking();\n const navigate = useNavigate();\n const location = useLocation();\n const {\n route,\n authData,\n themeContext,\n correctSound,\n incorrectSound,\n tadaSound,\n subscriptionPlan,\n authenticated,\n noAuth,\n handleSignIn,\n handleCloseSignIn,\n isAuthDialogOpen,\n setIsAuthDialogOpen,\n } = props;\n\n const { isOnboardingRequired, onboardingPath } = useUserOnboarding({\n authenticated,\n authData,\n });\n\n const isAuthRequired = authenticated === false && noAuth === false;\n\n useLiveReload();\n\n useEffect(() => {\n if (isAuthRequired && !isAuthDialogOpen) {\n handleSignIn();\n }\n if (\n isAuthDialogOpen === true &&\n noAuthPaths.some((path) => location.pathname.includes(path))\n ) {\n // Temp disable so query param doesn't get removed\n // window.history.pushState(null, null, location.pathname);\n }\n window.addEventListener(\"popstate\", function () {\n if (!authenticated) {\n handleCloseSignIn();\n }\n });\n }, [\n isAuthDialogOpen,\n handleSignIn,\n handleCloseSignIn,\n isAuthRequired,\n location,\n ]);\n\n useEffect(() => {\n if (route.title && route.title !== document.title) {\n document.title = route.title;\n }\n }, [route.title]);\n\n if (isOnboardingRequired && onboardingPath && route.path !== `/welcome`) {\n return ;\n }\n\n return (\n {\n try {\n const route = window.location.pathname || \"No route found\";\n const date = new Date().toLocaleDateString();\n trackRecommendedEvent(\"app_error\", {\n A1_errorInfoSummary: `Error: ${error} and Route: ${route}`,\n A2_route: route,\n A3_date: date,\n A4_componentStackTrace:\n errorInfo.componentStack ?? \"No component stack trace found\",\n });\n // doesn't have to navigate to display fallbackcomponent\n // navigate(`/error${route ? `${route}` : \"\"}`);\n } catch (err) {\n console.error(err);\n }\n }}\n FallbackComponent={DefaultError}\n >\n {isAuthRequired ? null : (\n {\n const {\n exerciseMemberId,\n createdBy,\n courseId,\n sectionId,\n topicId,\n exercise,\n createdAt,\n botId,\n roleplayId,\n classroomId,\n } = event;\n if (classroomId) {\n navigate(\n `/classrooms/${classroomId}/activity/courses/${courseId}/${sectionId}/${topicId}/${exercise}/${createdBy}/${createdAt}`,\n );\n } else if (\n exerciseMemberId.split(\"|\").length > 2 // activity that's part of course includes courseId,topicId,sectionId\n ) {\n navigate(\n `/courses/${courseId}/${sectionId}/${topicId}/activity/${exercise}/${createdBy}/${createdAt}`,\n );\n } else if (!botId.includes(\"none-\")) {\n navigate(`/bots/${botId}/activity/${createdBy}/${createdAt}`);\n } else if (!roleplayId.includes(\"none-\")) {\n navigate(\n `/roleplays/${roleplayId}/activity/${createdBy}/${createdAt}`,\n );\n }\n }}\n correctSound={correctSound}\n incorrectSound={incorrectSound}\n tadaSound={tadaSound}\n subscriptionPlan={subscriptionPlan}\n navigate={navigate}\n handleSignIn={handleSignIn}\n location={location}\n setIsAuthDialogOpen={setIsAuthDialogOpen}\n isAuthDialogOpen={isAuthDialogOpen}\n authenticated={authenticated}\n />\n )}\n \n );\n}\n\nAppRoute.propTypes = {\n route: PropTypes.object,\n authData: PropTypes.object,\n themeContext: PropTypes.object,\n location: PropTypes.object,\n subscriptionPlan: PropTypes.string,\n correctSound: PropTypes.object,\n incorrectSound: PropTypes.object,\n tadaSound: PropTypes.object,\n};\n\nlet correctSound, incorrectSound, tadaSound;\n\nfunction AppIndexPage(props) {\n const {\n authState,\n authData,\n themeContext,\n location,\n isAuthDialogOpen,\n setIsAuthDialogOpen,\n authenticated,\n } = props;\n\n const [soundEffects, setSoundEffects] = useState({\n correctSound: correctSound || null,\n incorrectSound: incorrectSound || null,\n tadaSound: tadaSound || null,\n });\n\n const userQuery = userQuerys.useUser(\n async (userId) => {\n const response = await getUser(userId);\n return response;\n },\n {\n userId: authData && authData.username,\n },\n {\n enabled: !!(authData && authData.username),\n },\n );\n const user = userQuery.isSuccess && userQuery.data ? userQuery.data : {};\n const subscriptionPlan = user && user.plan ? user.plan : \"basic\";\n const isBasicPlan =\n user &&\n user.plan &&\n authData &&\n authData.attributes &&\n authData.attributes[\"custom:role\"] === \"teach\"\n ? user.plan !== \"teach\"\n : null;\n\n useEffect(() => {\n if (\n !soundEffects.correctSound ||\n !soundEffects.incorrectSound ||\n !soundEffects.tadaSound\n ) {\n if (!correctSound) {\n correctSound = new UIfx(correctAudio, { volume: 0.5 });\n }\n if (!incorrectSound) {\n incorrectSound = new UIfx(incorrectAudio, { volume: 0.4 });\n }\n if (!tadaSound) {\n tadaSound = new UIfx(tadaAudio, { volume: 0.3 });\n }\n setSoundEffects({\n correctSound: correctSound,\n incorrectSound: incorrectSound,\n tadaSound: tadaSound,\n });\n }\n }, []);\n\n return (\n <>\n \n \n \n }>\n \n {routes.map((route, idx) =>\n route.component ? (\n setIsAuthDialogOpen(true)}\n handleCloseSignIn={() => setIsAuthDialogOpen(false)}\n isAuthDialogOpen={isAuthDialogOpen}\n setIsAuthDialogOpen={setIsAuthDialogOpen}\n noAuth={route.noAuth === true ? true : false}\n />\n }\n />\n ) : null,\n )}\n }\n />\n } />\n \n \n \n \n \n >\n );\n}\n\nAppIndexPage.propTypes = {\n authState: PropTypes.string,\n authData: PropTypes.object,\n themeContext: PropTypes.object,\n location: PropTypes.object,\n data: PropTypes.shape({\n site: PropTypes.object,\n termsVersion: PropTypes.string,\n }),\n};\n\nexport default withRoot(withAuth(AppIndexPage));\n", "'use client';\nimport { createContext, Component, createElement, useContext, useState, useMemo, forwardRef } from 'react';\n\nconst ErrorBoundaryContext = createContext(null);\n\nconst initialState = {\n didCatch: false,\n error: null\n};\nclass ErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n this.state = initialState;\n }\n static getDerivedStateFromError(error) {\n return {\n didCatch: true,\n error\n };\n }\n resetErrorBoundary() {\n const {\n error\n } = this.state;\n if (error !== null) {\n var _this$props$onReset, _this$props;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {\n args,\n reason: \"imperative-api\"\n });\n this.setState(initialState);\n }\n }\n componentDidCatch(error, info) {\n var _this$props$onError, _this$props2;\n (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);\n }\n componentDidUpdate(prevProps, prevState) {\n const {\n didCatch\n } = this.state;\n const {\n resetKeys\n } = this.props;\n\n // There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array,\n // we'd end up resetting the error boundary immediately.\n // This would likely trigger a second error to be thrown.\n // So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n var _this$props$onReset2, _this$props3;\n (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {\n next: resetKeys,\n prev: prevProps.resetKeys,\n reason: \"keys\"\n });\n this.setState(initialState);\n }\n }\n render() {\n const {\n children,\n fallbackRender,\n FallbackComponent,\n fallback\n } = this.props;\n const {\n didCatch,\n error\n } = this.state;\n let childToRender = children;\n if (didCatch) {\n const props = {\n error,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof fallbackRender === \"function\") {\n childToRender = fallbackRender(props);\n } else if (FallbackComponent) {\n childToRender = createElement(FallbackComponent, props);\n } else if (fallback !== undefined) {\n childToRender = fallback;\n } else {\n throw error;\n }\n }\n return createElement(ErrorBoundaryContext.Provider, {\n value: {\n didCatch,\n error,\n resetErrorBoundary: this.resetErrorBoundary\n }\n }, childToRender);\n }\n}\nfunction hasArrayChanged() {\n let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));\n}\n\nfunction assertErrorBoundaryContext(value) {\n if (value == null || typeof value.didCatch !== \"boolean\" || typeof value.resetErrorBoundary !== \"function\") {\n throw new Error(\"ErrorBoundaryContext not found\");\n }\n}\n\nfunction useErrorBoundary() {\n const context = useContext(ErrorBoundaryContext);\n assertErrorBoundaryContext(context);\n const [state, setState] = useState({\n error: null,\n hasError: false\n });\n const memoized = useMemo(() => ({\n resetBoundary: () => {\n context.resetErrorBoundary();\n setState({\n error: null,\n hasError: false\n });\n },\n showBoundary: error => setState({\n error,\n hasError: true\n })\n }), [context.resetErrorBoundary]);\n if (state.hasError) {\n throw state.error;\n }\n return memoized;\n}\n\nfunction withErrorBoundary(component, errorBoundaryProps) {\n const Wrapped = forwardRef((props, ref) => createElement(ErrorBoundary, errorBoundaryProps, createElement(component, {\n ...props,\n ref\n })));\n\n // Format for display in DevTools\n const name = component.displayName || component.name || \"Unknown\";\n Wrapped.displayName = \"withErrorBoundary(\".concat(name, \")\");\n return Wrapped;\n}\n\nexport { ErrorBoundary, ErrorBoundaryContext, useErrorBoundary, withErrorBoundary };\n", "import React, { useEffect, useContext, useState } from \"react\";\r\nimport PropTypes from \"prop-types\";\r\nimport { useTranslation } from \"react-i18next\";\r\nimport { useQueryClient } from \"@tanstack/react-query\";\r\nimport { signOut } from \"aws-amplify/auth\";\r\nimport { I18n as AmplifyI18n } from \"aws-amplify/utils\";\r\nimport { BrowserRouter as Router } from \"react-router-dom\";\r\nimport {\r\n courses as courseQuerys,\r\n classrooms as classroomQuerys,\r\n users as userQuerys,\r\n} from \"@nualang/nualang-api-and-queries/Queries\";\r\nimport AppContainer from \"@nualang/nualang-ui-components/dist/Containers/App\";\r\n// eslint-disable-next-line max-len\r\nimport EnrollmentKeyDialog from \"@nualang/nualang-ui-components/dist/Dialogs/EnrollmentKeyDialog/EnrollmentKeyDialog\";\r\nimport ShareDrawer from \"@nualang/nualang-ui-components/dist/Misc/ShareButton/ShareDrawer\";\r\nimport ModeratedDialog from \"@nualang/nualang-ui-components/dist/Dialogs/ModeratedDialog/ModeratedDialog\";\r\nimport ScrollToTop from \"../components/ScrollToTop/ScrollToTop\";\r\nimport Common from \"./Common\";\r\nimport logo from \"../img/logo/nualang-logo-white.svg\";\r\nimport { AppContext } from \"../context/AppContext\";\r\nimport navigation from \"../_nav\";\r\nimport i18n from \"../i18n\";\r\nimport Loading from \"../components/Misc/Loading\";\r\nimport AcceptTerms from \"../components/AcceptTerms/AcceptTerms\";\r\nimport coursesContext from \"../context/CoursesContext\";\r\nimport UsersContext from \"../context/UsersContext\";\r\nimport classroomsContext from \"../context/ClassroomsContext\";\r\nimport { ColorModeContext } from \"../themes/ThemeProviders/ColorModeContext\";\r\nimport * as router from \"react-router-dom\";\r\nimport config from \"../config\";\r\nimport { createClassroomMember } from \"@nualang/nualang-api-and-queries/APIs/ClassroomMembers\";\r\nimport { createCourseMember } from \"@nualang/nualang-api-and-queries/APIs/CourseMembers\";\r\nimport { getUser } from \"@nualang/nualang-api-and-queries/APIs/Users\";\r\nimport whatsNewMarkdown from \"../WhatsNew.md\";\r\n\r\n\r\n\r\nconst MainContent = ({\r\n children,\r\n isBasicPlan,\r\n authenticated,\r\n authState,\r\n authData,\r\n}) => {\r\n const CoursesContext = useContext(coursesContext);\r\n const ClassroomsContext = useContext(classroomsContext);\r\n const appContext = useContext(AppContext);\r\n const colorMode = useContext(ColorModeContext);\r\n\r\n const {\r\n joinCourseDialogOpen,\r\n handleClosePrivateCourseDialog,\r\n newCourse,\r\n setNewCourse,\r\n } = CoursesContext;\r\n const {\r\n joinClassroomDialogOpen,\r\n handleClosePrivateClassroomDialog,\r\n newClassroom,\r\n setNewClassroom,\r\n } = ClassroomsContext;\r\n const usersContext = useContext(UsersContext);\r\n const {} = usersContext;\r\n const { t } = useTranslation();\r\n const queryClient = useQueryClient();\r\n const {\r\n setUser,\r\n user,\r\n isSnackbarOpen,\r\n closeSnackbar,\r\n message,\r\n type,\r\n loading,\r\n shareUrl,\r\n shareScreenOpen,\r\n handleCloseShare,\r\n subscription,\r\n isModerateDialogOpen,\r\n handleCloseModerateDialog,\r\n openSnackbar,\r\n startLoading,\r\n stopLoading,\r\n isCollapsed,\r\n setIsCollapsed,\r\n moderationReason,\r\n } = appContext;\r\n\r\n const [readableMarkdown, setReadableMarkdown] = useState({ md: \"\" });\r\n const [whatsNewDate, setWhatsNewDate] = useState(\"\");\r\n\r\n // Mutations\r\n const joinClassroomMutation = classroomQuerys.useJoinClassroom(\r\n createClassroomMember,\r\n {\r\n onSettled: (data, error, variables, context) => {\r\n // Error or success... doesn't matter!\r\n stopLoading();\r\n },\r\n onSuccess: async (data, variables, context) => {\r\n openSnackbar(\"joined_classroom\", \"success\");\r\n queryClient.invalidateQueries({\r\n queryKey: classroomQuerys.classroomKeys.itemMembers(\r\n variables.classroomId,\r\n variables.username,\r\n ),\r\n });\r\n queryClient.invalidateQueries({\r\n queryKey: classroomQuerys.classroomKeys.itemMember(\r\n variables.classroomId,\r\n variables.username,\r\n variables.username,\r\n ),\r\n });\r\n queryClient.invalidateQueries({\r\n queryKey: classroomQuerys.classroomKeys.list({\r\n limit: config.limits.teachClassrooms,\r\n memberId: variables.username,\r\n verbose: false,\r\n }),\r\n });\r\n handleClosePrivateClassroomDialog();\r\n setNewClassroom(\"\");\r\n },\r\n onError: (error, variables, context) => {\r\n openSnackbar(\"problem\", \"error\");\r\n },\r\n },\r\n );\r\n const joinCourseMutation = courseQuerys.useJoinCourse(createCourseMember, {\r\n onSettled: (data, error, variables, context) => {\r\n // Error or success... doesn't matter!\r\n stopLoading();\r\n },\r\n onSuccess: async (data, variables, context) => {\r\n openSnackbar(\"joined_course\", \"success\");\r\n queryClient.invalidateQueries({\r\n queryKey: courseQuerys.courseKeys.itemMembers(\r\n variables.courseId,\r\n variables.username,\r\n ),\r\n });\r\n queryClient.invalidateQueries({\r\n queryKey: courseQuerys.courseKeys.itemMember(\r\n variables.courseId,\r\n variables.username,\r\n variables.username,\r\n ),\r\n });\r\n queryClient.invalidateQueries({\r\n queryKey: courseQuerys.courseKeys.list({\r\n memberId: authData.username,\r\n verbose: false,\r\n }),\r\n });\r\n handleClosePrivateCourseDialog();\r\n setNewCourse(\"\");\r\n },\r\n onError: (error, variables, context) => {\r\n openSnackbar(\"problem\", \"error\");\r\n },\r\n });\r\n\r\n const currentLanguage = i18n.language;\r\n\r\n // const title = newCourse ? t('join_course') : t('join_classroom');\r\n\r\n const joinClassroom = async (classroomId, enrollmentKey) => {\r\n startLoading();\r\n return joinClassroomMutation.mutateAsync({\r\n classroomId,\r\n username: authData.username,\r\n enrollmentKey,\r\n });\r\n };\r\n\r\n const handlePrivateClassroomSubmit = async (enrollmentKey) => {\r\n try {\r\n const { allowedDomains = [] } = newClassroom;\r\n // if there's no allowed domains specified then allow access\r\n let domainMatch = !(allowedDomains.length > 0);\r\n for (let index = 0; index < allowedDomains.length; index += 1) {\r\n const domain = allowedDomains[index];\r\n if (authData.attributes.email.endsWith(domain)) {\r\n domainMatch = true;\r\n }\r\n }\r\n if (!domainMatch) {\r\n openSnackbar(\r\n `You cannot join this classroom without having one of the allowed email domains: ${allowedDomains.toString()}`,\r\n \"error\",\r\n );\r\n } else {\r\n const response = await joinClassroom(\r\n newClassroom.classroomId,\r\n enrollmentKey,\r\n );\r\n if (\r\n response.Item.classroomId !== null ||\r\n response.Item.classroomId !== undefined\r\n ) {\r\n return newClassroom.classroomId;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n if (!enrollmentKey || enrollmentKey !== newClassroom.enrolmentKey) {\r\n openSnackbar(\"Incorrect Key\", \"error\");\r\n } else {\r\n openSnackbar(error.message, \"error\");\r\n }\r\n }\r\n };\r\n\r\n const joinCourse = async (courseId, enrollmentKey) => {\r\n startLoading();\r\n return joinCourseMutation.mutateAsync({\r\n courseId,\r\n username: authData.username,\r\n enrollmentKey,\r\n });\r\n };\r\n\r\n const handlePrivateCourseSubmit = async (enrollmentKey) => {\r\n try {\r\n const { allowedDomains = [] } = newCourse;\r\n // if there's no allowed domains specified then allow access\r\n let domainMatch = !(allowedDomains.length > 0);\r\n for (let index = 0; index < allowedDomains.length; index += 1) {\r\n const domain = allowedDomains[index];\r\n if (authData.attributes.email.endsWith(domain)) {\r\n domainMatch = true;\r\n }\r\n }\r\n if (!domainMatch) {\r\n openSnackbar(\r\n `You cannot join this course without having one of the allowed email domains: ${allowedDomains.toString()}`,\r\n \"error\",\r\n );\r\n } else {\r\n const response = await joinCourse(newCourse.courseId, enrollmentKey);\r\n if (\r\n response.Item.courseId !== null ||\r\n response.Item.courseId !== undefined\r\n ) {\r\n return newCourse.courseId;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n if (!enrollmentKey || enrollmentKey !== newClassroom.enrolmentKey) {\r\n openSnackbar(\"Incorrect Key\", \"error\");\r\n } else {\r\n openSnackbar(error.message, \"error\");\r\n }\r\n }\r\n };\r\n\r\n const handleCourseDialogSubmit = async (key) => {\r\n const response = await handlePrivateCourseSubmit(key);\r\n if (response && window.location.pathname !== `/courses/${response}`) {\r\n if (window.location.pathname.startsWith(\"/classrooms\")) {\r\n const pathname = window.location.pathname;\r\n const splitPath = pathname.split('/');\r\n const classroomId = splitPath[2];\r\n window.location.replace(`/classrooms/${classroomId}/${response}`);\r\n } else {\r\n window.location.replace(`/courses/${response}`);\r\n }\r\n }\r\n };\r\n\r\n const handleClassroomDialogSubmit = async (key) => {\r\n const response = await handlePrivateClassroomSubmit(key);\r\n if (response && window.location.pathname !== `/classrooms/${response}`) {\r\n window.location.replace(`/classrooms/${response}`);\r\n }\r\n };\r\n\r\n function handleChangeLanguage(language) {\r\n i18n.changeLanguage(language);\r\n AmplifyI18n.setLanguage(language);\r\n }\r\n\r\n useEffect(() => {\r\n const themePreference = localStorage.getItem(\"nualang-theme\");\r\n if (\r\n !themePreference &&\r\n window.matchMedia &&\r\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches\r\n ) {\r\n // eslint-disable-next-line no-console\r\n colorMode.toggleColorMode();\r\n }\r\n }, [authData?.username, colorMode]); // Only run on mount\r\n\r\n useEffect(() => {\r\n setUser(authData);\r\n // If user has no role selected direct them to the onboarding steps\r\n }, [authState, authData, setUser]); // Only re-run the effect if the authState, authData changes\r\n\r\n useEffect(() => {\r\n const regex = /: <> \\(([^\\)]+)\\)/i;\r\n fetch(whatsNewMarkdown)\r\n .then((res) => res.text())\r\n .then((md) => {\r\n setReadableMarkdown({ md });\r\n setWhatsNewDate(md.match(regex)[1]);\r\n });\r\n }, []);\r\n\r\n const userQuery = userQuerys.useUser(\r\n async (userId) => {\r\n const response = await getUser(userId);\r\n return response;\r\n },\r\n {\r\n userId: authData && authData.username,\r\n },\r\n {\r\n enabled: !!(authData && authData.username),\r\n },\r\n );\r\n const currentUser =\r\n userQuery.isSuccess && userQuery.data ? userQuery.data : {};\r\n\r\n const isTeacher = authData.attributes[\"custom:role\"] === \"teach\";\r\n\r\n return (\r\n <>\r\n {user && (\r\n signOut()}\r\n navigation={\r\n isTeacher ? navigation.teachSideNav : navigation.learnSideNav\r\n }\r\n bottomNav={\r\n isTeacher ? navigation.teachBottomNav : navigation.learnBottomNav\r\n }\r\n isSnackbarOpen={isSnackbarOpen}\r\n closeSnackbar={closeSnackbar}\r\n snackbarMessage={message}\r\n snackbarType={type}\r\n currentLanguage={currentLanguage}\r\n handleChangeLanguage={handleChangeLanguage}\r\n navToSettings={\"/settings\"}\r\n isBasicPlan={isBasicPlan}\r\n subscription={subscription}\r\n upgradePlanURL={`${config.SITE_URL}/pricing/${\r\n subscription && subscription.plan && subscription.plan !== \"basic\"\r\n ? \"upgrade\"\r\n : \"app\"\r\n }`}\r\n authenticated={authenticated}\r\n whatsNewMarkdown={readableMarkdown.md}\r\n whatsNewDate={whatsNewDate}\r\n verificationStatus={\r\n currentUser.verificationStatus ? currentUser.verificationStatus : \"\"\r\n }\r\n gameAward={currentUser.gameAward ? currentUser.gameAward : \"\"}\r\n isCollapsed={isCollapsed}\r\n setIsCollapsed={setIsCollapsed}\r\n >\r\n {children}\r\n \r\n )}\r\n {loading ? : null}\r\n \r\n \r\n \r\n \r\n \r\n >\r\n );\r\n};\r\n\r\nconst TemplateWrapper = ({\r\n children,\r\n authState,\r\n authData,\r\n isBasicPlan,\r\n authenticated,\r\n}) => {\r\n return (\r\n \r\n \r\n \r\n \r\n {children}\r\n \r\n \r\n \r\n \r\n );\r\n};\r\n\r\nTemplateWrapper.propTypes = {\r\n authData: PropTypes.object,\r\n authState: PropTypes.string,\r\n appContext: PropTypes.object,\r\n courseContext: PropTypes.object,\r\n classroomContext: PropTypes.object,\r\n children: PropTypes.node,\r\n isBasicPlan: PropTypes.bool,\r\n};\r\n\r\nexport default TemplateWrapper;\r\n", "import { useRef, useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { useLocation } from \"react-router-dom\";\n\nfunction ScrollToTop({ children, disableLiveChat }) {\n const componentMounted = useRef();\n const prevPath = useRef();\n const location = useLocation();\n\n useEffect(() => {\n const { pathname } = location;\n if (!componentMounted.current) {\n componentMounted.current = true;\n } else if (prevPath.current !== pathname) {\n window.scrollTo(0, 0);\n prevPath.current = pathname;\n /*\n widget.refresh\n\n Refresh and re-render the chat widget's information, given the current page URL.\n\n If you house the chat widget on a single-page application,\n this method can be useful for refreshing the widget on route changes.\n This allows you to specify different chatflows on different page routes.\n If widget.refresh is called on a route where there is no chatflow,\n and the user isn't engaged in a conversation, the widget will be removed.\n\n Note: widget.refresh is throttled to one call per second.\n */\n if (window.HubSpotConversations) {\n // The api is ready already\n if (disableLiveChat) {\n window.HubSpotConversations.widget.remove();\n } else {\n window.HubSpotConversations.widget.refresh();\n }\n } else {\n window.hsConversationsOnReady = [\n () => {\n // Now the api is ready\n if (disableLiveChat) {\n window.HubSpotConversations.widget.remove();\n } else {\n window.HubSpotConversations.widget.refresh();\n }\n },\n ];\n }\n }\n }, [location.pathname, disableLiveChat, location]);\n\n return children;\n}\n\nScrollToTop.propTypes = {\n children: PropTypes.node,\n};\n\nexport default ScrollToTop;\n", "import React, { useState, useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { DateTime } from \"luxon\";\n// import CookieFooter from '../components/CookieFooter/CookieFooter';\nimport Offer from \"../components/Offer/Offer\";\n\nconst TemplateWrapper = ({ children, authData }) => {\n const [isOfferOpen, setIsOfferOpen] = useState(false);\n\n useEffect(() => {\n const isTeacher = !!(\n authData &&\n authData.attributes &&\n authData.attributes[\"custom:role\"] === \"teach\"\n );\n if (isTeacher) {\n setIsOfferOpen(true);\n }\n }, [authData]); // Only re-run the effect if the authData changes\n\n // const DisplayCookieFooter = () => {\n // if (typeof window !== 'undefined' && window) {\n // const acceptedCP = localStorage.getItem('acceptedCP');\n // const navigator = () => {\n // // navigate to new page with cookie policy\n // console.log('navigator clicked');\n // };\n // const space = ' ';\n // const acceptCookie = async () => {\n // try {\n // localStorage.setItem('acceptedCP', true);\n // } catch (error) {\n // console.error('error accepting cookie', error);\n // }\n // };\n // const rejectCookie = () => {\n // console.log('Accepted Cookies');\n // };\n // if (!acceptedCP) {\n // return (\n // \n // {`This website uses only essential cookies in order to provide you with the best possible experience.\n // You can find all relevant information by reading our ${space} `}\n // \n // );\n // }\n // }\n // return '';\n // };\n\n const DisplayOffer = () => {\n if (typeof window !== \"undefined\" && window) {\n const currentMoment = DateTime.now().toUTC();\n const notInterestedInOffer = localStorage.getItem(\n `notInterestedInOffer-${currentMoment.toFormat(\"dd/MM/yyyy\")}`,\n );\n const payNow = () => {\n localStorage.setItem(\n `notInterestedInOffer-${currentMoment.toFormat(\"dd/MM/yyyy\")}`,\n true,\n );\n // setIsOfferOpen(false);\n };\n const notNow = () => {\n localStorage.setItem(\n `notInterestedInOffer-${currentMoment.toFormat(\"dd/MM/yyyy\")}`,\n true,\n );\n setIsOfferOpen(false);\n };\n const dateToCheck = \"2021-06-01\";\n const isOfferStillValid = currentMoment < dateToCheck;\n if (!notInterestedInOffer && isOfferStillValid) {\n return (\n \n );\n }\n }\n return \"\";\n };\n\n return (\n \n
{children}
\n {/* {DisplayCookieFooter()} */}\n {DisplayOffer()}\n
\n );\n};\n\nTemplateWrapper.propTypes = {\n children: PropTypes.node,\n authData: PropTypes.object,\n};\n\nexport default TemplateWrapper;\n", "import React, { useState, useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport ResponsiveDialog from \"@nualang/nualang-ui-components/dist/Dialogs/ResponsiveDialog\";\nimport DialogContentText from \"@mui/material/DialogContentText\";\nimport {\n getUser,\n updateUser,\n} from \"@nualang/nualang-api-and-queries/APIs/Users\";\nimport {\n invalidateCache,\n DataType,\n} from \"@nualang/nualang-api-and-queries/APIs/invalidation\";\nimport config from \"../../config\";\n\nfunction AcceptTermsDialog({ t, username, data }) {\n const { path, lastUpdated, keyChanges } = config.terms;\n const [isOpen, setIsOpen] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n\n const handleSubmit = async () => {\n try {\n if (!isLoading) {\n setIsLoading(true);\n setIsOpen(false);\n await updateUser(username, {\n acceptedTermsDate: new Date().toISOString().slice(0, 10),\n });\n await invalidateCache(DataType.USER, {\n userId: username,\n });\n setIsLoading(false);\n }\n } catch (error) {\n console.error(error);\n setIsLoading(false);\n setIsOpen(false);\n }\n };\n\n useEffect(() => {\n const checkIfTermsHaveUpdated = async () => {\n try {\n if (username) {\n const response = await getUser(username);\n if (response.errorMessage) {\n throw new Error(response.errorMessage);\n }\n if (\n !response.acceptedTermsDate &&\n lastUpdated.slice(0, 10) > \"2021-01-29\"\n ) {\n // acceptedTermsDate not known, check whether terms have been updated from orginal version '2021-01-29'\n setIsOpen(true);\n } else if (\n response.acceptedTermsDate &&\n lastUpdated.slice(0, 10) > response.acceptedTermsDate\n ) {\n // acceptedTermsDate is known, check whether terms have been updated since they were accepted\n setIsOpen(true);\n }\n }\n return true;\n } catch (error) {\n return false;\n }\n };\n checkIfTermsHaveUpdated();\n }, [lastUpdated, username]);\n\n return (\n \n \n Hi there,
\n \n {/* eslint-disable-next-line max-len */}\n We have updated our{\" \"}\n \n Terms of Service\n \n .\n
\n Below are some of the key changes:
\n \n {keyChanges.map((keyChange, i) => (\n - {keyChange}
\n ))}\n
\n \n {/* eslint-disable-next-line max-len */}\n By continuing to use our services, you acknowledge and accept the\n updated{\" \"}\n \n Terms of Service\n \n .\n
\n \n {/* eslint-disable-next-line max-len */}\n We encourage you to read the updated terms to understand how the\n changes affect you. Other than that, you don't need to take any\n further action.\n
\n Thank you for being part of our community,
\n The Nualang team
\n \n \n );\n}\n\nAcceptTermsDialog.propTypes = {\n t: PropTypes.func,\n data: PropTypes.object,\n open: PropTypes.bool,\n username: PropTypes.string,\n handleClose: PropTypes.func,\n};\n\nexport default function AcceptTerms(props) {\n return ;\n}\n", "import React from \"react\";\r\n\r\nconst Welcome = React.lazy(() => import(\"./views/Welcome\"));\r\nconst Payment = React.lazy(() => import(\"./views/Payment\"));\r\nconst StartTrial = React.lazy(() => import(\"./views/StartTrial\"));\r\nconst Error = React.lazy(() => import(\"./views/DefaultError\"));\r\n\r\nconst Dashboard = React.lazy(() => import(\"./views/Dashboard\"));\r\n\r\nconst Activity = React.lazy(() => import(\"./views/Activity\"));\r\nconst CourseActivity = React.lazy(() => import(\"./views/Activity/Course\"));\r\nconst SectionActivity = React.lazy(\r\n () => import(\"./views/Activity/Course/Section\"),\r\n);\r\nconst TopicActivity = React.lazy(\r\n () => import(\"./views/Activity/Course/Section/Topic\"),\r\n);\r\nconst ExerciseActivity = React.lazy(\r\n () => import(\"./views/Activity/Course/Section/Topic/Exercise\"),\r\n);\r\nconst ExerciseAttemptActivity = React.lazy(\r\n () => import(\"./views/Activity/Course/Section/Topic/Exercise/Attempt\"),\r\n);\r\nconst BotActivity = React.lazy(() => import(\"./views/Activity/Bot\"));\r\nconst BotAttemptActivity = React.lazy(\r\n () => import(\"./views/Activity/Bot/Attempt\"),\r\n);\r\nconst RoleplayActivity = React.lazy(() => import(\"./views/Activity/Roleplay\"));\r\nconst RoleplayAttemptActivity = React.lazy(\r\n () => import(\"./views/Activity/Roleplay/Attempt\"),\r\n);\r\nconst ClassroomActivity = React.lazy(\r\n () => import(\"./views/Activity/Classroom\"),\r\n);\r\nconst Search = React.lazy(() => import(\"./views/Search/Search\"));\r\n\r\nconst Courses = React.lazy(() => import(\"./views/Courses\"));\r\nconst SearchCourses = React.lazy(() => import(\"./views/Courses/SearchCourses\"));\r\nconst CreateCourse = React.lazy(() => import(\"./views/Courses/CreateCourse\"));\r\nconst ViewCourse = React.lazy(() => import(\"./views/Courses/ViewCourse\"));\r\nconst CreateTopic = React.lazy(\r\n () => import(\"./views/Courses/ViewCourse/CreateTopic\"),\r\n);\r\nconst ViewTopic = React.lazy(\r\n () => import(\"./views/Courses/ViewCourse/ViewTopic\"),\r\n);\r\n\r\nconst CreateRoleplay = React.lazy(\r\n () => import(\"./views/Roleplays/CreateRoleplay/CreateRoleplay\"),\r\n);\r\nconst PlayRoleplay = React.lazy(\r\n () => import(\"./views/Roleplays/PlayRoleplay/PlayRoleplay\"),\r\n);\r\nconst EditRoleplay = React.lazy(\r\n () => import(\"./views/Roleplays/EditRoleplay/EditRoleplay\"),\r\n);\r\n\r\nconst Roleplays = React.lazy(() => import(\"./views/Roleplays/Roleplays\"));\r\nconst SearchRoleplaysScreen = React.lazy(\r\n () => import(\"./views/Roleplays/SearchRoleplays/SearchRoleplays\"),\r\n);\r\n\r\nconst Classrooms = React.lazy(() => import(\"./views/Classrooms\"));\r\nconst SearchClassrooms = React.lazy(\r\n () => import(\"./views/Classrooms/SearchClassrooms\"),\r\n);\r\nconst CreateClassroom = React.lazy(\r\n () => import(\"./views/Classrooms/CreateClassroom\"),\r\n);\r\nconst ViewClassroom = React.lazy(\r\n () => import(\"./views/Classrooms/ViewClassroom\"),\r\n);\r\nconst ClassroomExerciseActivity = React.lazy(\r\n () => import(\"./views/Activity/Classroom/Course/Section/Topic/Exercise\"),\r\n);\r\n\r\nconst Bots = React.lazy(() => import(\"./views/Bots\"));\r\nconst SearchBots = React.lazy(() => import(\"./views/Bots/SearchBots\"));\r\nconst PlayBot = React.lazy(() => import(\"./views/Bots/PlayBot\"));\r\nconst CreateBot = React.lazy(() => import(\"./views/Bots/CreateBot\"));\r\nconst EditBot = React.lazy(() => import(\"./views/Bots/EditBot\"));\r\n\r\nconst Settings = React.lazy(() => import(\"./views/Settings\"));\r\nconst Library = React.lazy(() => import(\"./views/Library\"));\r\n\r\nconst JoinGroup = React.lazy(() => import(\"./views/Groups/Join\"));\r\n\r\nconst Profile = React.lazy(() => import(\"./views/Profile\"));\r\nconst Contact = React.lazy(() => import(\"./views/Contact\"));\r\n\r\nconst PlayGame = React.lazy(\r\n () => import(\"./views/Classrooms/ViewClassroom/Games/PlayGame\"),\r\n);\r\n\r\nconst GenerateAudioWrapper = React.lazy(\r\n () => import(\"./views/GenerateAudio/GenerateAudio\"),\r\n);\r\n\r\nconst pageTitleSuffix = `App | Nualang`;\r\n\r\n// https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config\r\nconst routes = [\r\n { path: \"/\", exact: true, name: \"home\" },\r\n {\r\n path: \"/welcome\",\r\n name: \"welcome\",\r\n component: Welcome,\r\n title: `Welcome | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/generate-audio\",\r\n name: \"generate_audio\",\r\n component: GenerateAudioWrapper,\r\n title: `Generate Audio | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/payment\",\r\n name: \"payment\",\r\n component: Payment,\r\n title: `Payment | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/start-trial\",\r\n name: \"start_trial\",\r\n component: StartTrial,\r\n title: `Start Trial | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/error/*\",\r\n name: \"error\",\r\n component: Error,\r\n noAuth: true,\r\n title: `Error | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/explore\",\r\n name: \"explore\",\r\n component: Dashboard,\r\n title: `Explore | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/search\",\r\n name: \"search\",\r\n component: Search,\r\n title: `Search | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/settings\",\r\n name: \"settings\",\r\n component: Settings,\r\n title: `Settings | ${pageTitleSuffix}`,\r\n },\r\n { path: \"/library\", name: \"library\", component: Library },\r\n {\r\n path: \"/contact\",\r\n name: \"contact\",\r\n component: Contact,\r\n noAuth: true,\r\n title: `Contact | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/profiles\",\r\n exact: true,\r\n name: \"profiles\",\r\n component: Profile,\r\n title: `Contact | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/profiles/:profileId\",\r\n exact: true,\r\n name: \"profile\",\r\n component: Profile,\r\n noAuth: true,\r\n title: `Profile | ${pageTitleSuffix}`,\r\n }, \r\n {\r\n path: \"/groups\",\r\n exact: true,\r\n name: \"groups\",\r\n component: Settings,\r\n title: `Groups | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/groups/:groupId\",\r\n exact: true,\r\n name: \"group\",\r\n component: Settings,\r\n title: `Group | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/groups/:groupId/join\",\r\n exact: true,\r\n name: \"join_group\",\r\n component: JoinGroup,\r\n title: `Join Group | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays\",\r\n exact: true,\r\n name: \"roleplays\",\r\n component: Roleplays,\r\n title: `Roleplays | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/search\",\r\n exact: true,\r\n name: \"search\",\r\n component: SearchRoleplaysScreen,\r\n noAuth: true,\r\n title: `Search Roleplays | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/create\",\r\n exact: true,\r\n name: \"create_roleplay\",\r\n component: CreateRoleplay,\r\n title: `Create Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/:roleplayId\",\r\n exact: true,\r\n name: \"roleplay\",\r\n component: PlayRoleplay,\r\n title: `Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/:roleplayId/edit\",\r\n exact: true,\r\n name: \"edit\",\r\n component: EditRoleplay,\r\n title: `Edit Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: Activity,\r\n title: `Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/activity/member\",\r\n exact: true,\r\n name: \"member\",\r\n component: Activity,\r\n title: `Member Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/activity/member/:memberId\",\r\n exact: true,\r\n name: \"member_activity\",\r\n component: Activity,\r\n title: `Member Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/activity/member/:memberId/:courseId\",\r\n exact: true,\r\n name: \"course\",\r\n component: Activity,\r\n title: `Course Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/activity/member/:memberId/:courseId/:sectionId\",\r\n exact: true,\r\n name: \"section\",\r\n component: Activity,\r\n title: `Section Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/activity/member/:memberId/:courseId/:sectionId/:topicId\",\r\n exact: true,\r\n name: \"topic\",\r\n component: Activity,\r\n title: `Topic Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses\",\r\n exact: true,\r\n name: \"courses\",\r\n component: Courses,\r\n title: `Courses | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/create\",\r\n exact: true,\r\n name: \"create_course\",\r\n component: CreateCourse,\r\n title: `Create Course | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/search\",\r\n exact: true,\r\n name: \"search\",\r\n component: SearchCourses,\r\n noAuth: true,\r\n title: `Search Courses | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId\",\r\n exact: true,\r\n name: \"course\",\r\n component: ViewCourse,\r\n noAuth: true,\r\n title: `Course | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: CourseActivity,\r\n title: `Course Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId\",\r\n exact: true,\r\n name: \"section\",\r\n component: ViewCourse,\r\n noAuth: true,\r\n title: `Course Section | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: SectionActivity,\r\n title: `Section Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/create\",\r\n exact: true,\r\n name: \"create_topic\",\r\n component: CreateTopic,\r\n title: `Create Topic | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId\",\r\n exact: true,\r\n name: \"topic\",\r\n component: ViewTopic,\r\n noAuth: true,\r\n title: `Topic | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: TopicActivity,\r\n title: `Topic Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/activity/:exercise\",\r\n exact: true,\r\n name: \"exercise\",\r\n component: ExerciseActivity,\r\n title: `Exercise Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/activity/:exercise/:memberId\",\r\n exact: true,\r\n name: \"member\",\r\n component: ExerciseActivity,\r\n title: `Member Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/activity/:exercise/:memberId/:createdAt\",\r\n exact: true,\r\n name: \"attempt\",\r\n component: ExerciseAttemptActivity,\r\n title: `Exercise Attempt | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/roleplays\",\r\n exact: true,\r\n name: \"roleplays\",\r\n component: ViewTopic,\r\n noAuth: true,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/roleplays/create\",\r\n exact: true,\r\n name: \"create_roleplay\",\r\n component: CreateRoleplay,\r\n title: `Create Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/roleplays/:roleplayId\",\r\n exact: true,\r\n name: \"roleplay\",\r\n component: PlayRoleplay,\r\n title: `Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/roleplays/:roleplayId/edit\",\r\n exact: true,\r\n name: \"edit\",\r\n component: EditRoleplay,\r\n title: `Edit Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/bots\",\r\n exact: true,\r\n name: \"bots\",\r\n component: ViewTopic,\r\n noAuth: true,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/bots/create\",\r\n exact: true,\r\n name: \"create_bot\",\r\n component: CreateBot,\r\n title: `Create Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/bots/:botId\",\r\n exact: true,\r\n name: \"bot\",\r\n component: PlayBot,\r\n title: `Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/courses/:courseId/:sectionId/:topicId/bots/:botId/edit\",\r\n exact: true,\r\n name: \"edit\",\r\n component: EditBot,\r\n title: `Edit Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms\",\r\n exact: true,\r\n name: \"classrooms\",\r\n component: Classrooms,\r\n title: `Classrooms | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/create\",\r\n exact: true,\r\n name: \"create_classroom\",\r\n component: CreateClassroom,\r\n title: `Create Classroom | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/search\",\r\n exact: true,\r\n name: \"search\",\r\n component: SearchClassrooms,\r\n noAuth: true,\r\n title: `Search Classrooms | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId\",\r\n name: \"classroom\",\r\n component: ViewClassroom,\r\n noAuth: false,\r\n title: `Classroom | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: ClassroomActivity,\r\n title: `Classroom Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses\",\r\n exact: true,\r\n name: \"courses\",\r\n component: ClassroomActivity,\r\n title: `Classroom Courses Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses/:courseId\",\r\n exact: true,\r\n name: \"course\",\r\n component: CourseActivity,\r\n title: `Classroom Course Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses/:courseId/:sectionId\",\r\n exact: true,\r\n name: \"section\",\r\n component: CourseActivity,\r\n title: `Classroom Section Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses/:courseId/:sectionId/:topicId\",\r\n exact: true,\r\n name: \"topic\",\r\n component: TopicActivity,\r\n title: `Classroom Topic Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses/:courseId/:sectionId/:topicId/:exercise\",\r\n exact: true,\r\n name: \"exercise\",\r\n component: ClassroomExerciseActivity,\r\n title: `Classroom Exercise Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses/:courseId/:sectionId/:topicId/:exercise/:memberId\",\r\n exact: true,\r\n name: \"member\",\r\n component: ExerciseActivity,\r\n title: `Classroom Member Exercise Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/courses/:courseId/:sectionId/:topicId/:exercise/:memberId/:createdAt\",\r\n exact: true,\r\n name: \"attempt\",\r\n component: ExerciseAttemptActivity,\r\n title: `Classroom Member Exercise Attempt | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/member\",\r\n exact: true,\r\n name: \"member\",\r\n component: Activity,\r\n title: `Classroom Member Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/member/:memberId\",\r\n exact: true,\r\n name: \"member_activity\",\r\n component: Activity,\r\n title: `Classroom Member Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/member/:memberId/:courseId\",\r\n exact: true,\r\n name: \"course\",\r\n component: Activity,\r\n title: `Classroom Member Course Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/member/:memberId/:courseId/:sectionId\",\r\n exact: true,\r\n name: \"section\",\r\n component: Activity,\r\n title: `Classroom Member Section Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/activity/member/:memberId/:courseId/:sectionId/:topicId\",\r\n exact: true,\r\n name: \"topic\",\r\n component: Activity,\r\n title: `Classroom Member Topic Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/games\",\r\n exact: true,\r\n name: \"games\",\r\n component: ViewClassroom,\r\n title: `Games | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/games/:gameId\",\r\n exact: true,\r\n name: \"play_game\",\r\n component: PlayGame,\r\n title: `Play Game | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/create\",\r\n exact: true,\r\n name: \"create_course\",\r\n component: CreateCourse,\r\n title: `Create Course | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId\",\r\n exact: true,\r\n name: \"course\",\r\n component: ViewCourse,\r\n title: `Course | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId\",\r\n exact: true,\r\n name: \"topic\",\r\n component: ViewTopic,\r\n title: `Topic | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: CourseActivity,\r\n title: `Course Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId\",\r\n exact: true,\r\n name: \"section\",\r\n component: ViewCourse,\r\n noAuth: true,\r\n title: `Course Section | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: SectionActivity,\r\n title: `Section Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/create\",\r\n exact: true,\r\n name: \"create_topic\",\r\n component: CreateTopic,\r\n title: `Create Topic | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId\",\r\n exact: true,\r\n name: \"topic\",\r\n component: ViewTopic,\r\n noAuth: true,\r\n title: `Topic | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: TopicActivity,\r\n title: `Topic Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/activity/:exercise\",\r\n exact: true,\r\n name: \"exercise\",\r\n component: ExerciseActivity,\r\n title: `Exercise Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/activity/:exercise/:memberId\",\r\n exact: true,\r\n name: \"member\",\r\n component: ExerciseActivity,\r\n title: `Member Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/activity/:exercise/:memberId/:createdAt\",\r\n exact: true,\r\n name: \"attempt\",\r\n component: ExerciseAttemptActivity,\r\n title: `Exercise Attempt | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/roleplays\",\r\n exact: true,\r\n name: \"roleplays\",\r\n component: ViewTopic,\r\n noAuth: true,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/roleplays/create\",\r\n exact: true,\r\n name: \"create_roleplay\",\r\n component: CreateRoleplay,\r\n title: `Create Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/roleplays/:roleplayId\",\r\n exact: true,\r\n name: \"roleplay\",\r\n component: PlayRoleplay,\r\n title: `Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/roleplays/:roleplayId/edit\",\r\n exact: true,\r\n name: \"edit\",\r\n component: EditRoleplay,\r\n title: `Edit Roleplay | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/bots\",\r\n exact: true,\r\n name: \"bots\",\r\n component: ViewTopic,\r\n noAuth: true,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/bots/create\",\r\n exact: true,\r\n name: \"create_bot\",\r\n component: CreateBot,\r\n title: `Create Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/bots/:botId\",\r\n exact: true,\r\n name: \"bot\",\r\n component: PlayBot,\r\n title: `Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/classrooms/:classroomId/:courseId/:sectionId/:topicId/bots/:botId/edit\",\r\n exact: true,\r\n name: \"edit\",\r\n component: EditBot,\r\n title: `Edit Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots\",\r\n exact: true,\r\n name: \"bots\",\r\n component: Bots,\r\n title: `Bots | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/search\",\r\n exact: true,\r\n name: \"search\",\r\n component: SearchBots,\r\n noAuth: true,\r\n title: `Search Bots | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/create\",\r\n exact: true,\r\n name: \"create_bot\",\r\n component: CreateBot,\r\n title: `Create Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/:botId\",\r\n exact: true,\r\n name: \"bot\",\r\n component: PlayBot,\r\n title: `Bot | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/:botId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: BotActivity,\r\n title: `Bot Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/:botId/activity/:memberId\",\r\n exact: true,\r\n name: \"member\",\r\n component: BotActivity,\r\n title: `Member Bot Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/:botId/activity/:memberId/:createdAt\",\r\n exact: true,\r\n name: \"attempt\",\r\n component: BotAttemptActivity,\r\n title: `Member Bot Exercise Attempt | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/:roleplayId/activity\",\r\n exact: true,\r\n name: \"activity\",\r\n component: RoleplayActivity,\r\n title: `Roleplay Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/:roleplayId/activity/:memberId\",\r\n exact: true,\r\n name: \"member\",\r\n component: RoleplayActivity,\r\n title: `Member Roleplay Activity | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/roleplays/:roleplayId/activity/:memberId/:createdAt\",\r\n exact: true,\r\n name: \"Attempt\",\r\n component: RoleplayAttemptActivity,\r\n title: `Member Roleplay Exercise Attempt | ${pageTitleSuffix}`,\r\n },\r\n {\r\n path: \"/bots/:botId/edit\",\r\n exact: true,\r\n name: \"edit\",\r\n component: EditBot,\r\n title: `Edit Bot | ${pageTitleSuffix}`,\r\n },\r\n];\r\n\r\nexport const noAuthPaths = routes\r\n .filter((route) => route.noAuth === true)\r\n .map((route) => route.path);\r\n\r\nexport default routes;\r\n", "/*\r\nCustom version of withAuthenticator,\r\nsee: https://github.com/aws-amplify/amplify-ui/blob/main/packages/react/src/components/Authenticator/withAuthenticator.tsx\r\n*/\r\nimport React, { useCallback, useEffect } from \"react\";\r\nimport { fetchAuthSession, getCurrentUser, signOut, signInWithRedirect } from \"aws-amplify/auth\";\r\nimport { Hub } from \"aws-amplify/utils\";\r\nimport {\r\n Authenticator,\r\n Flex,\r\n Grid,\r\n useTheme,\r\n ThemeProvider,\r\n View,\r\n Image,\r\n} from \"@aws-amplify/ui-react\";\r\n// import '@aws-amplify/ui-react/styles.css';\r\nimport { Dialog } from \"@mui/material\";\r\nimport components from \"./components\";\r\nimport services from \"./services\";\r\nimport Loading from \"../../components/Misc/Loading\";\r\nimport AmplifyBackgroundImage from \"../../img/amplify-background-person-laptop-nualas.jpeg\";\r\nimport {\r\n getUsernameFromAuthData,\r\n trackPageView,\r\n searchStringToObj,\r\n objToSearchString,\r\n} from \"../../utils/index\";\r\n\r\nconst validIdPs = [\"Wayside-SAML\"];\r\nconst validActions = [\"signIn\", \"signUp\", \"forgotPassword\"];\r\n\r\nfunction AmplifyAuthenticator(props) {\r\n const { tokens } = useTheme();\r\n\r\n useEffect(() => {\r\n trackPageView(`${window.location.pathname}${window.location.search}`);\r\n }, []);\r\n\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {(authenticator) => }\r\n \r\n \r\n \r\n \r\n );\r\n}\r\n\r\nfunction UnauthenticatedComponentWrapper({\r\n initialState,\r\n isAuthDialogOpen,\r\n setIsAuthDialogOpen,\r\n formFields,\r\n options,\r\n children,\r\n}) {\r\n return (\r\n <>\r\n \r\n {children}\r\n >\r\n );\r\n}\r\n\r\nexport default function withAuthenticator(Component, options) {\r\n return function WrappedWithAuthenticator(props) {\r\n const [authState, setAuthState] = React.useState();\r\n const [userState, setUserState] = React.useState();\r\n const [loading, setLoading] = React.useState(true);\r\n\r\n console.log(\"withAuth dev-1\");\r\n\r\n const qsParams =\r\n typeof window !== \"undefined\"\r\n ? searchStringToObj(window.location.search)\r\n : {};\r\n const initialState = validActions.includes(qsParams.action)\r\n ? qsParams.action\r\n : \"signIn\";\r\n const userId = qsParams.userId;\r\n const userEmail = qsParams.email || \"\";\r\n const [isAuthDialogOpen, setIsAuthDialogOpen] = React.useState(\r\n validActions.includes(qsParams.action) ? true : false,\r\n );\r\n const [idP, setIdP] = React.useState(\r\n validIdPs.includes(qsParams.idP) ? qsParams.idP : \"\",\r\n );\r\n const federatedSwitchUserPath = sessionStorage.getItem(\r\n \"federated-switch-user-path\",\r\n );\r\n const federatedSwitchUserIdPValue = sessionStorage.getItem(\r\n \"federated-switch-user-idp\",\r\n );\r\n const federatedSwitchUserIdP = validIdPs.includes(\r\n federatedSwitchUserIdPValue,\r\n )\r\n ? federatedSwitchUserIdPValue\r\n : \"\";\r\n const isSwitchingUser = federatedSwitchUserPath && federatedSwitchUserIdP;\r\n\r\n async function setUser() {\r\n try {\r\n const { username } = await getCurrentUser();\r\n let user;\r\n if (username) {\r\n const session = await fetchAuthSession({ forceRefresh : true });\r\n const attributes = session?.tokens?.idToken?.payload;\r\n user = { username, attributes };\r\n if (user && user.attributes) {\r\n const selectedUsername = getUsernameFromAuthData(user);\r\n // add 'username' to attributes\r\n user.attributes.username = selectedUsername;\r\n setUserState({\r\n ...user,\r\n username,\r\n });\r\n setAuthState(\"signedin\");\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n setLoading(false);\r\n console.error(err);\r\n }\r\n }\r\n\r\n const checkUser = useCallback(() => {\r\n setUser();\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!window.location.search.includes(\"code\")) {\r\n if (window.location.search.includes(\"idP\")) {\r\n /* \r\n Dont include the 'idP' param in the current path.\r\n we don't want it included in the url when the user returns from the idP.\r\n */\r\n let searchParams = searchStringToObj(window.location.search);\r\n delete searchParams[\"idP\"];\r\n delete searchParams[\"userId\"];\r\n let searchString =\r\n objToSearchString(searchParams).length > 0\r\n ? \"?\" + objToSearchString(searchParams)\r\n : \"\";\r\n localStorage.setItem(\r\n \"nualang-auth-current-path\",\r\n `${window.location.pathname}${searchString}`,\r\n );\r\n } else {\r\n localStorage.setItem(\r\n \"nualang-auth-current-path\",\r\n `${window.location.pathname}${window.location.search}`,\r\n );\r\n }\r\n }\r\n // eslint-disable-next-line consistent-return\r\n Hub.listen(\"auth\", ({ payload }) => {\r\n if (payload.event === \"signedIn\") {\r\n return checkUser();\r\n }\r\n if (payload.event === \"signedOut\") {\r\n setUserState(null);\r\n return setLoading(false);\r\n }\r\n });\r\n return checkUser();\r\n }, [checkUser]);\r\n\r\n const isSignedIn = authState === \"signedin\" && userState ? true : false;\r\n\r\n function handleFederatedSignIn() {\r\n try {\r\n if (\r\n isSignedIn &&\r\n userState &&\r\n userState.username &&\r\n userState.username.startsWith(idP)\r\n ) {\r\n if (`${idP}_${userId}` !== userState.username) {\r\n /*\r\n If there is currently a different federated user signed in\r\n we need to sign them out before signing the new user in.\r\n We need to keep track of the path since the signOut causes a redirect and we lose the current path.\r\n */\r\n sessionStorage.setItem(\"federated-switch-user-idp\", idP);\r\n sessionStorage.setItem(\r\n \"federated-switch-user-path\",\r\n localStorage.getItem(\"nualang-auth-current-path\"),\r\n );\r\n signOut();\r\n } else {\r\n let searchParams = searchStringToObj(window.location.search);\r\n delete searchParams[\"idP\"];\r\n delete searchParams[\"userId\"];\r\n window.history.replaceState(\r\n null,\r\n \"\",\r\n \"?\" + objToSearchString(searchParams) + window.location.hash,\r\n );\r\n setIdP(\"\");\r\n }\r\n } else {\r\n sessionStorage.setItem(\r\n \"last-federated-user-path\",\r\n localStorage.getItem(\"nualang-auth-current-path\"),\r\n );\r\n sessionStorage.setItem(\"last-federated-user-idp\", idP);\r\n signInWithRedirect({ provider: idP });\r\n }\r\n } catch (err) {\r\n console.error(err);\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n let signInTimer;\r\n const redirectPathQueryParam = (federatedSwitchUserPath || \"\").includes(\r\n \"?\",\r\n )\r\n ? `&idP=${federatedSwitchUserIdP}`\r\n : `?idP=${federatedSwitchUserIdP}`;\r\n const redirectPath = `${federatedSwitchUserPath}${redirectPathQueryParam}`;\r\n if (idP && !loading) {\r\n handleFederatedSignIn();\r\n } else if (isSwitchingUser && !loading && !isSignedIn) {\r\n if (\r\n `${window.location.pathname}${window.location.search}` !==\r\n redirectPath\r\n ) {\r\n sessionStorage.removeItem(\"federated-switch-user-path\");\r\n sessionStorage.removeItem(\"federated-switch-user-idp\");\r\n signInTimer = setTimeout(() => {\r\n window.location.replace(redirectPath);\r\n }, 500);\r\n }\r\n }\r\n return () => {\r\n if (signInTimer) {\r\n clearTimeout(signInTimer);\r\n }\r\n };\r\n }, [idP, loading]);\r\n\r\n useEffect(() => {\r\n function handleAmplifyError() {\r\n const cognitoIdentitySP = `CognitoIdentityServiceProvider.${process.env.REACT_APP_CLIENT_ID}`;\r\n const lastAuthUser = localStorage.getItem(\r\n `${cognitoIdentitySP}.LastAuthUser`,\r\n );\r\n if (lastAuthUser) {\r\n const userDataItemName = `${cognitoIdentitySP}.${lastAuthUser}.userData`;\r\n const userData = localStorage.getItem(userDataItemName);\r\n if (userData === \"{}\") {\r\n /*\r\n Amplify issue https://github.com/aws-amplify/amplify-js/issues/11106\r\n Sign out to clear local storage and prevent infinite loading screen\r\n */\r\n console.log(\r\n \"Encountered potential amplify error - Clearing userData in localstorage\",\r\n );\r\n localStorage.removeItem(userDataItemName);\r\n // const lastUserIdP = sessionStorage.getItem('last-federated-user-idp');\r\n // const lastUserPath = sessionStorage.getItem('last-federated-user-path');\r\n // if (lastUserIdP && lastUserPath) {\r\n // // Set following values to retry sign in once the sign out has ended\r\n // sessionStorage.setItem('federated-switch-user-idp', lastUserIdP);\r\n // sessionStorage.setItem('federated-switch-user-path', lastUserPath);\r\n // }\r\n // signOut();\r\n }\r\n }\r\n }\r\n handleAmplifyError();\r\n }, []);\r\n\r\n // show loading screen while fetching, otherwise return page\r\n if (loading || idP || isSwitchingUser) return ;\r\n\r\n return isSignedIn ? (\r\n \r\n ) : (\r\n <>\r\n \r\n \r\n \r\n >\r\n );\r\n };\r\n}\r\n", "import * as index from './components/index.mjs';\nexport { index as components };\nexport { useTheme } from './hooks/useTheme.mjs';\nexport { useBreakpointValue } from './hooks/useBreakpointValue.mjs';\nimport * as index$1 from './primitives/index.mjs';\nexport { index$1 as primitives };\nexport { createTheme, defaultDarkModeOverride, defaultTheme, translations } from '@aws-amplify/ui';\nexport { default as AccountSettings } from './components/AccountSettings/AccountSettings.mjs';\nexport { Authenticator } from './components/Authenticator/Authenticator.mjs';\nexport { withAuthenticator } from './components/Authenticator/withAuthenticator.mjs';\nexport { useAuthenticator } from '@aws-amplify/ui-react-core';\nexport { ThemeProvider } from './components/ThemeProvider/ThemeProvider.mjs';\nexport { IconsProvider } from './primitives/Icon/context/IconsProvider.mjs';\nexport { Alert } from './primitives/Alert/Alert.mjs';\nexport { Autocomplete } from './primitives/Autocomplete/Autocomplete.mjs';\nexport { Avatar } from './primitives/Avatar/Avatar.mjs';\nexport { Badge } from './primitives/Badge/Badge.mjs';\nexport { Breadcrumbs } from './primitives/Breadcrumbs/Breadcrumbs.mjs';\nexport { Button } from './primitives/Button/Button.mjs';\nexport { ButtonGroup } from './primitives/ButtonGroup/ButtonGroup.mjs';\nexport { Card } from './primitives/Card/Card.mjs';\nexport { Checkbox } from './primitives/Checkbox/Checkbox.mjs';\nexport { CheckboxField } from './primitives/CheckboxField/CheckboxField.mjs';\nexport { Collection } from './primitives/Collection/Collection.mjs';\nexport { Divider } from './primitives/Divider/Divider.mjs';\nexport { DropZone } from './primitives/DropZone/DropZone.mjs';\nexport { Accordion } from './primitives/Accordion/Accordion.mjs';\nexport { FieldGroupIcon } from './primitives/FieldGroupIcon/FieldGroupIcon.mjs';\nexport { FieldGroupIconButton } from './primitives/FieldGroupIcon/FieldGroupIconButton.mjs';\nexport { Fieldset } from './primitives/Fieldset/Fieldset.mjs';\nexport { Flex } from './primitives/Flex/Flex.mjs';\nexport { Grid } from './primitives/Grid/Grid.mjs';\nexport { Heading } from './primitives/Heading/Heading.mjs';\nexport { HighlightMatch } from './primitives/HighlightMatch/HighlightMatch.mjs';\nexport { Icon } from './primitives/Icon/Icon.mjs';\nexport { Image } from './primitives/Image/Image.mjs';\nexport { Input } from './primitives/Input/Input.mjs';\nexport { Label } from './primitives/Label/Label.mjs';\nexport { Link } from './primitives/Link/Link.mjs';\nexport { Loader } from './primitives/Loader/Loader.mjs';\nexport { Menu } from './primitives/Menu/Menu.mjs';\nexport { MenuButton } from './primitives/Menu/MenuButton.mjs';\nexport { MenuItem } from './primitives/Menu/MenuItem.mjs';\nexport { Message } from './primitives/Message/Message.mjs';\nexport { Pagination } from './primitives/Pagination/Pagination.mjs';\nexport { PasswordField } from './primitives/PasswordField/PasswordField.mjs';\nexport { PhoneNumberField } from './primitives/PhoneNumberField/PhoneNumberField.mjs';\nexport { Placeholder } from './primitives/Placeholder/Placeholder.mjs';\nexport { Radio } from './primitives/Radio/Radio.mjs';\nexport { RadioGroupField } from './primitives/RadioGroupField/RadioGroupField.mjs';\nexport { Rating } from './primitives/Rating/Rating.mjs';\nexport { ScrollView } from './primitives/ScrollView/ScrollView.mjs';\nexport { SearchField } from './primitives/SearchField/SearchField.mjs';\nexport { SelectField } from './primitives/SelectField/SelectField.mjs';\nexport { SliderField } from './primitives/SliderField/SliderField.mjs';\nexport { StepperField } from './primitives/StepperField/StepperField.mjs';\nexport { SwitchField } from './primitives/SwitchField/SwitchField.mjs';\nexport { Tabs } from './primitives/Tabs/Tabs.mjs';\nexport { Text } from './primitives/Text/Text.mjs';\nexport { TextAreaField } from './primitives/TextAreaField/TextAreaField.mjs';\nexport { TextField } from './primitives/TextField/TextField.mjs';\nexport { ToggleButton } from './primitives/ToggleButton/ToggleButton.mjs';\nexport { ToggleButtonGroup } from './primitives/ToggleButtonGroup/ToggleButtonGroup.mjs';\nexport { View } from './primitives/View/View.mjs';\nexport { VisuallyHidden } from './primitives/VisuallyHidden/VisuallyHidden.mjs';\nexport { Table } from './primitives/Table/Table.mjs';\nexport { TableBody } from './primitives/Table/TableBody.mjs';\nexport { TableCell } from './primitives/Table/TableCell.mjs';\nexport { TableFoot } from './primitives/Table/TableFoot.mjs';\nexport { TableHead } from './primitives/Table/TableHead.mjs';\nexport { TableRow } from './primitives/Table/TableRow.mjs';\nexport { usePagination } from './primitives/Pagination/usePagination.mjs';\nexport { ComponentPropsToStylePropsMap, ComponentPropsToStylePropsMapKeys } from './primitives/types/style.mjs';\n", "export { default as AuthenticatorProvider } from './Authenticator/context/AuthenticatorProvider.mjs';\nimport './Authenticator/context/AuthenticatorContext.mjs';\nexport { default as useAuthenticator } from './Authenticator/hooks/useAuthenticator/useAuthenticator.mjs';\nexport { default as useAuthenticatorRoute } from './Authenticator/hooks/useAuthenticatorRoute/useAuthenticatorRoute.mjs';\nexport { default as useAuthenticatorInitMachine } from './Authenticator/hooks/useAuthenticatorInitMachine/useAuthenticatorInitMachine.mjs';\nexport { isComponentRouteKey as isAuthenticatorComponentRouteKey, resolveAuthenticatorComponents } from './Authenticator/hooks/utils.mjs';\nexport { default as useField } from './components/FormCore/useField.mjs';\nexport { default as useForm } from './components/FormCore/useForm.mjs';\nexport { default as FormProvider } from './components/FormCore/FormProvider.mjs';\nexport { default as withFormProvider } from './components/FormCore/withFormProvider.mjs';\nexport { default as RenderNothing } from './components/RenderNothing/RenderNothing.mjs';\nexport { default as useDataState } from './hooks/useDataState.mjs';\nexport { default as useDeprecationWarning } from './hooks/useDeprecationWarning.mjs';\nexport { default as useGetUrl } from './hooks/useGetUrl.mjs';\nexport { default as useHasValueUpdated } from './hooks/useHasValueUpdated.mjs';\nexport { default as usePreviousValue } from './hooks/usePreviousValue.mjs';\nexport { default as useSetUserAgent } from './hooks/useSetUserAgent.mjs';\nexport { default as useTimeout } from './hooks/useTimeout.mjs';\nexport { default as useDropZone } from './hooks/useDropZone.mjs';\nexport { default as createContextUtilities } from './utils/createContextUtilities.mjs';\n", "import React__default, { useContext, useMemo, useEffect } from 'react';\nimport { useInterpret } from '@xstate/react';\nimport { getCurrentUser } from 'aws-amplify/auth';\nimport { createAuthenticatorMachine, listenToAuthHub, defaultAuthHubHandler } from '@aws-amplify/ui';\nimport { AuthenticatorContext } from './AuthenticatorContext.mjs';\n\nconst createHubHandler = (options) => (data, service) => {\n defaultAuthHubHandler(data, service, options);\n};\nfunction AuthenticatorProvider({ children, }) {\n // `authStatus` is exposed by `useAuthenticator` but should not be derived directly from the\n // state machine as the machine only updates on `Authenticator` initiated events, which\n // leads to scenarios where the state machine `authStatus` gets \"stuck\". For exmample,\n // if a user was to sign in using `Auth.signIn` directly rather than using `Authenticator`\n const [authStatus, setAuthStatus] = React__default.useState('configuring');\n // only run on first render\n React__default.useEffect(() => {\n getCurrentUser()\n .then(() => {\n setAuthStatus('authenticated');\n })\n .catch(() => {\n setAuthStatus('unauthenticated');\n });\n }, []);\n /**\n * Based on use cases, developer might already have added another Provider\n * outside Authenticator. In that case, we sync the two providers by just\n * passing the parent value.\n *\n * TODO(BREAKING): enforce only one provider in App tree\n */\n const parentProviderVal = useContext(AuthenticatorContext);\n const service = useInterpret(createAuthenticatorMachine);\n const value = useMemo(() => (!parentProviderVal ? { authStatus, service } : parentProviderVal), [authStatus, parentProviderVal, service]);\n const { service: activeService } = value;\n useEffect(() => {\n const onSignIn = () => {\n setAuthStatus('authenticated');\n };\n const onSignOut = () => {\n setAuthStatus('unauthenticated');\n };\n const unsubscribe = listenToAuthHub(activeService, createHubHandler({ onSignIn, onSignOut }));\n return unsubscribe;\n }, [activeService]);\n return (React__default.createElement(AuthenticatorContext.Provider, { value: value }, children));\n}\n\nexport { AuthenticatorProvider as default };\n", "export { useMachine } from './useMachine';\nexport { useActor } from './useActor';\nexport { useInterpret } from './useInterpret';\nexport { useSelector } from './useSelector';\nexport { useSpawn } from './useSpawn';\nexport { shallowEqual } from './utils';\nexport { createActorContext } from './createActorContext';\n", "import { assign as assign$1, cancel as cancel$1, send as send$1, sendTo as sendTo$1, sendParent as sendParent$1, sendUpdate as sendUpdate$1, forwardTo as forwardTo$1, doneInvoke as doneInvoke$1, raise as raise$1, log as log$1, pure as pure$1, choose as choose$1, stop as stop$1 } from './actions.js';\nimport * as actions from './actions.js';\nexport { actions };\nexport { toActorRef } from './Actor.js';\nexport { Interpreter, InterpreterStatus, interpret, spawn } from './interpreter.js';\nexport { Machine, createMachine } from './Machine.js';\nexport { mapState } from './mapState.js';\nexport { matchState } from './match.js';\nexport { createSchema, t } from './schema.js';\nexport { State } from './State.js';\nexport { StateNode } from './StateNode.js';\nexport { spawnBehavior } from './behaviors.js';\nexport { ActionTypes, SpecialTargets } from './types.js';\nexport { matchesState, toEventObject, toObserver, toSCXMLEvent } from './utils.js';\n\nvar assign = assign$1,\n cancel = cancel$1,\n send = send$1,\n sendTo = sendTo$1,\n sendParent = sendParent$1,\n sendUpdate = sendUpdate$1,\n forwardTo = forwardTo$1,\n doneInvoke = doneInvoke$1,\n raise = raise$1,\n log = log$1,\n pure = pure$1,\n choose = choose$1,\n stop = stop$1;\n\nexport { assign, cancel, choose, doneInvoke, forwardTo, log, pure, raise, send, sendParent, sendTo, sendUpdate, stop };\n", "import { __assign, __spreadArray, __read, __values } from './_virtual/_tslib.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { init, raise as raise$1, send as send$1, update, log as log$1, cancel as cancel$1, assign as assign$1, error as error$1, stop as stop$1, pure as pure$1, choose as choose$1 } from './actionTypes.js';\nimport * as actionTypes from './actionTypes.js';\nexport { actionTypes };\nimport { toSCXMLEvent, isString, isFunction, toEventObject, getEventType, updateContext, flatten, isArray, toArray, toGuard, evaluateGuard, warn } from './utils.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar initEvent = /*#__PURE__*/toSCXMLEvent({\n type: init\n});\nfunction getActionFunction(actionType, actionFunctionMap) {\n return actionFunctionMap ? actionFunctionMap[actionType] || undefined : undefined;\n}\nfunction toActionObject(action, actionFunctionMap) {\n var actionObject;\n\n if (isString(action) || typeof action === 'number') {\n var exec = getActionFunction(action, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = {\n type: action,\n exec: exec\n };\n } else if (exec) {\n actionObject = exec;\n } else {\n actionObject = {\n type: action,\n exec: undefined\n };\n }\n } else if (isFunction(action)) {\n actionObject = {\n // Convert action to string if unnamed\n type: action.name || action.toString(),\n exec: action\n };\n } else {\n var exec = getActionFunction(action.type, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = __assign(__assign({}, action), {\n exec: exec\n });\n } else if (exec) {\n var actionType = exec.type || action.type;\n actionObject = __assign(__assign(__assign({}, exec), action), {\n type: actionType\n });\n } else {\n actionObject = action;\n }\n }\n\n return actionObject;\n}\nvar toActionObjects = function (action, actionFunctionMap) {\n if (!action) {\n return [];\n }\n\n var actions = isArray(action) ? action : [action];\n return actions.map(function (subAction) {\n return toActionObject(subAction, actionFunctionMap);\n });\n};\nfunction toActivityDefinition(action) {\n var actionObject = toActionObject(action);\n return __assign(__assign({\n id: isString(action) ? action : actionObject.id\n }, actionObject), {\n type: actionObject.type\n });\n}\n/**\r\n * Raises an event. This places the event in the internal event queue, so that\r\n * the event is immediately consumed by the machine in the current step.\r\n *\r\n * @param eventType The event to raise.\r\n */\n\nfunction raise(event, options) {\n return {\n type: raise$1,\n event: typeof event === 'function' ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n id: options === null || options === void 0 ? void 0 : options.id\n };\n}\nfunction resolveRaise(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n };\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n return __assign(__assign({}, action), {\n type: raise$1,\n _event: resolvedEvent,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event. This returns an action that will be read by an interpreter to\r\n * send the event in the next step, after the current step is finished executing.\r\n *\r\n * @deprecated Use the `sendTo(...)` action creator instead.\r\n *\r\n * @param event The event to send.\r\n * @param options Options to pass into the send event:\r\n * - `id` - The unique send event identifier (used with `cancel()`).\r\n * - `delay` - The number of milliseconds to delay the sending of the event.\r\n * - `to` - The target of this event (by default, the machine the event was sent from).\r\n */\n\nfunction send(event, options) {\n return {\n to: options ? options.to : undefined,\n type: send$1,\n event: isFunction(event) ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n // TODO: don't auto-generate IDs here like that\n // there is too big chance of the ID collision\n id: options && options.id !== undefined ? options.id : isFunction(event) ? event.name : getEventType(event)\n };\n}\nfunction resolveSend(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n }; // TODO: helper function for resolving Expr\n\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n var resolvedTarget = isFunction(action.to) ? action.to(ctx, _event.data, meta) : action.to;\n return __assign(__assign({}, action), {\n to: resolvedTarget,\n _event: resolvedEvent,\n event: resolvedEvent.data,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event to this machine's parent.\r\n *\r\n * @param event The event to send to the parent machine.\r\n * @param options Options to pass into the send event.\r\n */\n\nfunction sendParent(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\n/**\r\n * Sends an event to an actor.\r\n *\r\n * @param actor The `ActorRef` to send the event to.\r\n * @param event The event to send, or an expression that evaluates to the event to send\r\n * @param options Send action options\r\n * @returns An XState send action object\r\n */\n\nfunction sendTo(actor, event, options) {\n return send(event, __assign(__assign({}, options), {\n to: actor\n }));\n}\n/**\r\n * Sends an update event to this machine's parent.\r\n */\n\nfunction sendUpdate() {\n return sendParent(update);\n}\n/**\r\n * Sends an event back to the sender of the original event.\r\n *\r\n * @param event The event to send back to the sender\r\n * @param options Options to pass into the send event\r\n */\n\nfunction respond(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: function (_, __, _a) {\n var _event = _a._event;\n return _event.origin; // TODO: handle when _event.origin is undefined\n }\n }));\n}\n\nvar defaultLogExpr = function (context, event) {\n return {\n context: context,\n event: event\n };\n};\n/**\r\n *\r\n * @param expr The expression function to evaluate which will be logged.\r\n * Takes in 2 arguments:\r\n * - `ctx` - the current state context\r\n * - `event` - the event that caused this action to be executed.\r\n * @param label The label to give to the logged expression.\r\n */\n\n\nfunction log(expr, label) {\n if (expr === void 0) {\n expr = defaultLogExpr;\n }\n\n return {\n type: log$1,\n label: label,\n expr: expr\n };\n}\nvar resolveLog = function (action, ctx, _event) {\n return __assign(__assign({}, action), {\n value: isString(action.expr) ? action.expr : action.expr(ctx, _event.data, {\n _event: _event\n })\n });\n};\n/**\r\n * Cancels an in-flight `send(...)` action. A canceled sent action will not\r\n * be executed, nor will its event be sent, unless it has already been sent\r\n * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).\r\n *\r\n * @param sendId The `id` of the `send(...)` action to cancel.\r\n */\n\nvar cancel = function (sendId) {\n return {\n type: cancel$1,\n sendId: sendId\n };\n};\n/**\r\n * Starts an activity.\r\n *\r\n * @param activity The activity to start.\r\n */\n\nfunction start(activity) {\n var activityDef = toActivityDefinition(activity);\n return {\n type: ActionTypes.Start,\n activity: activityDef,\n exec: undefined\n };\n}\n/**\r\n * Stops an activity.\r\n *\r\n * @param actorRef The activity to stop.\r\n */\n\nfunction stop(actorRef) {\n var activity = isFunction(actorRef) ? actorRef : toActivityDefinition(actorRef);\n return {\n type: ActionTypes.Stop,\n activity: activity,\n exec: undefined\n };\n}\nfunction resolveStop(action, context, _event) {\n var actorRefOrString = isFunction(action.activity) ? action.activity(context, _event.data) : action.activity;\n var resolvedActorRef = typeof actorRefOrString === 'string' ? {\n id: actorRefOrString\n } : actorRefOrString;\n var actionObject = {\n type: ActionTypes.Stop,\n activity: resolvedActorRef\n };\n return actionObject;\n}\n/**\r\n * Updates the current context of the machine.\r\n *\r\n * @param assignment An object that represents the partial context to update.\r\n */\n\nvar assign = function (assignment) {\n return {\n type: assign$1,\n assignment: assignment\n };\n};\nfunction isActionObject(action) {\n return typeof action === 'object' && 'type' in action;\n}\n/**\r\n * Returns an event type that represents an implicit event that\r\n * is sent after the specified `delay`.\r\n *\r\n * @param delayRef The delay in milliseconds\r\n * @param id The state node ID where this event is handled\r\n */\n\nfunction after(delayRef, id) {\n var idSuffix = id ? \"#\".concat(id) : '';\n return \"\".concat(ActionTypes.After, \"(\").concat(delayRef, \")\").concat(idSuffix);\n}\n/**\r\n * Returns an event that represents that a final state node\r\n * has been reached in the parent state node.\r\n *\r\n * @param id The final state node's parent state node `id`\r\n * @param data The data to pass into the event\r\n */\n\nfunction done(id, data) {\n var type = \"\".concat(ActionTypes.DoneState, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\n/**\r\n * Returns an event that represents that an invoked service has terminated.\r\n *\r\n * An invoked service is terminated when it has reached a top-level final state node,\r\n * but not when it is canceled.\r\n *\r\n * @param id The final state node ID\r\n * @param data The data to pass into the event\r\n */\n\nfunction doneInvoke(id, data) {\n var type = \"\".concat(ActionTypes.DoneInvoke, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\nfunction error(id, data) {\n var type = \"\".concat(ActionTypes.ErrorPlatform, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\nfunction pure(getActions) {\n return {\n type: ActionTypes.Pure,\n get: getActions\n };\n}\n/**\r\n * Forwards (sends) an event to a specified service.\r\n *\r\n * @param target The target service to forward the event to.\r\n * @param options Options to pass into the send action creator.\r\n */\n\nfunction forwardTo(target, options) {\n if (!IS_PRODUCTION && (!target || typeof target === 'function')) {\n var originalTarget_1 = target;\n\n target = function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n var resolvedTarget = typeof originalTarget_1 === 'function' ? originalTarget_1.apply(void 0, __spreadArray([], __read(args), false)) : originalTarget_1;\n\n if (!resolvedTarget) {\n throw new Error(\"Attempted to forward event to undefined actor. This risks an infinite loop in the sender.\");\n }\n\n return resolvedTarget;\n };\n }\n\n return send(function (_, event) {\n return event;\n }, __assign(__assign({}, options), {\n to: target\n }));\n}\n/**\r\n * Escalates an error by sending it as an event to this machine's parent.\r\n *\r\n * @param errorData The error data to send, or the expression function that\r\n * takes in the `context`, `event`, and `meta`, and returns the error data to send.\r\n * @param options Options to pass into the send action creator.\r\n */\n\nfunction escalate(errorData, options) {\n return sendParent(function (context, event, meta) {\n return {\n type: error$1,\n data: isFunction(errorData) ? errorData(context, event, meta) : errorData\n };\n }, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\nfunction choose(conds) {\n return {\n type: ActionTypes.Choose,\n conds: conds\n };\n}\n\nvar pluckAssigns = function (actionBlocks) {\n var e_1, _a;\n\n var assignActions = [];\n\n try {\n for (var actionBlocks_1 = __values(actionBlocks), actionBlocks_1_1 = actionBlocks_1.next(); !actionBlocks_1_1.done; actionBlocks_1_1 = actionBlocks_1.next()) {\n var block = actionBlocks_1_1.value;\n var i = 0;\n\n while (i < block.actions.length) {\n if (block.actions[i].type === assign$1) {\n assignActions.push(block.actions[i]);\n block.actions.splice(i, 1);\n continue;\n }\n\n i++;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (actionBlocks_1_1 && !actionBlocks_1_1.done && (_a = actionBlocks_1.return)) _a.call(actionBlocks_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return assignActions;\n};\n\nfunction resolveActions(machine, currentState, currentContext, _event, actionBlocks, predictableExec, preserveActionOrder) {\n if (preserveActionOrder === void 0) {\n preserveActionOrder = false;\n }\n\n var assignActions = preserveActionOrder ? [] : pluckAssigns(actionBlocks);\n var updatedContext = assignActions.length ? updateContext(currentContext, _event, assignActions, currentState) : currentContext;\n var preservedContexts = preserveActionOrder ? [currentContext] : undefined;\n var deferredToBlockEnd = [];\n\n function handleAction(blockType, actionObject) {\n var _a;\n\n switch (actionObject.type) {\n case raise$1:\n {\n var raisedAction = resolveRaise(actionObject, updatedContext, _event, machine.options.delays);\n\n if (predictableExec && typeof raisedAction.delay === 'number') {\n predictableExec(raisedAction, updatedContext, _event);\n }\n\n return raisedAction;\n }\n\n case send$1:\n var sendAction = resolveSend(actionObject, updatedContext, _event, machine.options.delays); // TODO: fix ActionTypes.Init\n\n if (!IS_PRODUCTION) {\n var configuredDelay = actionObject.delay; // warn after resolving as we can create better contextual message here\n\n warn(!isString(configuredDelay) || typeof sendAction.delay === 'number', // tslint:disable-next-line:max-line-length\n \"No delay reference for delay expression '\".concat(configuredDelay, \"' was found on machine '\").concat(machine.id, \"'\"));\n }\n\n if (predictableExec && sendAction.to !== SpecialTargets.Internal) {\n if (blockType === 'entry') {\n deferredToBlockEnd.push(sendAction);\n } else {\n predictableExec(sendAction, updatedContext, _event);\n }\n }\n\n return sendAction;\n\n case log$1:\n {\n var resolved = resolveLog(actionObject, updatedContext, _event);\n predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(resolved, updatedContext, _event);\n return resolved;\n }\n\n case choose$1:\n {\n var chooseAction = actionObject;\n var matchedActions = (_a = chooseAction.conds.find(function (condition) {\n var guard = toGuard(condition.cond, machine.options.guards);\n return !guard || evaluateGuard(machine, guard, updatedContext, _event, !predictableExec ? currentState : undefined);\n })) === null || _a === void 0 ? void 0 : _a.actions;\n\n if (!matchedActions) {\n return [];\n }\n\n var _b = __read(resolveActions(machine, currentState, updatedContext, _event, [{\n type: blockType,\n actions: toActionObjects(toArray(matchedActions), machine.options.actions)\n }], predictableExec, preserveActionOrder), 2),\n resolvedActionsFromChoose = _b[0],\n resolvedContextFromChoose = _b[1];\n\n updatedContext = resolvedContextFromChoose;\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n return resolvedActionsFromChoose;\n }\n\n case pure$1:\n {\n var matchedActions = actionObject.get(updatedContext, _event.data);\n\n if (!matchedActions) {\n return [];\n }\n\n var _c = __read(resolveActions(machine, currentState, updatedContext, _event, [{\n type: blockType,\n actions: toActionObjects(toArray(matchedActions), machine.options.actions)\n }], predictableExec, preserveActionOrder), 2),\n resolvedActionsFromPure = _c[0],\n resolvedContext = _c[1];\n\n updatedContext = resolvedContext;\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n return resolvedActionsFromPure;\n }\n\n case stop$1:\n {\n var resolved = resolveStop(actionObject, updatedContext, _event);\n predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(resolved, currentContext, _event);\n return resolved;\n }\n\n case assign$1:\n {\n updatedContext = updateContext(updatedContext, _event, [actionObject], !predictableExec ? currentState : undefined);\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n break;\n }\n\n default:\n var resolvedActionObject = toActionObject(actionObject, machine.options.actions);\n var exec_1 = resolvedActionObject.exec;\n\n if (predictableExec) {\n predictableExec(resolvedActionObject, updatedContext, _event);\n } else if (exec_1 && preservedContexts) {\n var contextIndex_1 = preservedContexts.length - 1;\n\n var wrapped = __assign(__assign({}, resolvedActionObject), {\n exec: function (_ctx) {\n var args = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n\n exec_1.apply(void 0, __spreadArray([preservedContexts[contextIndex_1]], __read(args), false));\n }\n });\n\n resolvedActionObject = wrapped;\n }\n\n return resolvedActionObject;\n }\n }\n\n function processBlock(block) {\n var e_2, _a;\n\n var resolvedActions = [];\n\n try {\n for (var _b = __values(block.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n var resolved = handleAction(block.type, action);\n\n if (resolved) {\n resolvedActions = resolvedActions.concat(resolved);\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n deferredToBlockEnd.forEach(function (action) {\n predictableExec(action, updatedContext, _event);\n });\n deferredToBlockEnd.length = 0;\n return resolvedActions;\n }\n\n var resolvedActions = flatten(actionBlocks.map(processBlock));\n return [resolvedActions, updatedContext];\n}\n\nexport { after, assign, cancel, choose, done, doneInvoke, error, escalate, forwardTo, getActionFunction, initEvent, isActionObject, log, pure, raise, resolveActions, resolveLog, resolveRaise, resolveSend, resolveStop, respond, send, sendParent, sendTo, sendUpdate, start, stop, toActionObject, toActionObjects, toActivityDefinition };\n", "/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\n\nexport { __assign, __read, __rest, __spreadArray, __values };\n", "var ActionTypes;\n\n(function (ActionTypes) {\n ActionTypes[\"Start\"] = \"xstate.start\";\n ActionTypes[\"Stop\"] = \"xstate.stop\";\n ActionTypes[\"Raise\"] = \"xstate.raise\";\n ActionTypes[\"Send\"] = \"xstate.send\";\n ActionTypes[\"Cancel\"] = \"xstate.cancel\";\n ActionTypes[\"NullEvent\"] = \"\";\n ActionTypes[\"Assign\"] = \"xstate.assign\";\n ActionTypes[\"After\"] = \"xstate.after\";\n ActionTypes[\"DoneState\"] = \"done.state\";\n ActionTypes[\"DoneInvoke\"] = \"done.invoke\";\n ActionTypes[\"Log\"] = \"xstate.log\";\n ActionTypes[\"Init\"] = \"xstate.init\";\n ActionTypes[\"Invoke\"] = \"xstate.invoke\";\n ActionTypes[\"ErrorExecution\"] = \"error.execution\";\n ActionTypes[\"ErrorCommunication\"] = \"error.communication\";\n ActionTypes[\"ErrorPlatform\"] = \"error.platform\";\n ActionTypes[\"ErrorCustom\"] = \"xstate.error\";\n ActionTypes[\"Update\"] = \"xstate.update\";\n ActionTypes[\"Pure\"] = \"xstate.pure\";\n ActionTypes[\"Choose\"] = \"xstate.choose\";\n})(ActionTypes || (ActionTypes = {}));\n\nvar SpecialTargets;\n\n(function (SpecialTargets) {\n SpecialTargets[\"Parent\"] = \"#_parent\";\n SpecialTargets[\"Internal\"] = \"#_internal\";\n})(SpecialTargets || (SpecialTargets = {}));\n\nexport { ActionTypes, SpecialTargets };\n", "import { ActionTypes } from './types.js';\n\nvar start = ActionTypes.Start;\nvar stop = ActionTypes.Stop;\nvar raise = ActionTypes.Raise;\nvar send = ActionTypes.Send;\nvar cancel = ActionTypes.Cancel;\nvar nullEvent = ActionTypes.NullEvent;\nvar assign = ActionTypes.Assign;\nvar after = ActionTypes.After;\nvar doneState = ActionTypes.DoneState;\nvar log = ActionTypes.Log;\nvar init = ActionTypes.Init;\nvar invoke = ActionTypes.Invoke;\nvar errorExecution = ActionTypes.ErrorExecution;\nvar errorPlatform = ActionTypes.ErrorPlatform;\nvar error = ActionTypes.ErrorCustom;\nvar update = ActionTypes.Update;\nvar choose = ActionTypes.Choose;\nvar pure = ActionTypes.Pure;\n\nexport { after, assign, cancel, choose, doneState, error, errorExecution, errorPlatform, init, invoke, log, nullEvent, pure, raise, send, start, stop, update };\n", "import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';\nimport { SpecialTargets } from './types.js';\nimport { raise, send } from './actionTypes.js';\nimport { DEFAULT_GUARD_TYPE, TARGETLESS_KEY, STATE_DELIMITER } from './constants.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar _a;\nfunction keys(value) {\n return Object.keys(value);\n}\nfunction matchesState(parentStateId, childStateId, delimiter) {\n if (delimiter === void 0) {\n delimiter = STATE_DELIMITER;\n }\n\n var parentStateValue = toStateValue(parentStateId, delimiter);\n var childStateValue = toStateValue(childStateId, delimiter);\n\n if (isString(childStateValue)) {\n if (isString(parentStateValue)) {\n return childStateValue === parentStateValue;\n } // Parent more specific than child\n\n\n return false;\n }\n\n if (isString(parentStateValue)) {\n return parentStateValue in childStateValue;\n }\n\n return Object.keys(parentStateValue).every(function (key) {\n if (!(key in childStateValue)) {\n return false;\n }\n\n return matchesState(parentStateValue[key], childStateValue[key]);\n });\n}\nfunction getEventType(event) {\n try {\n return isString(event) || typeof event === 'number' ? \"\".concat(event) : event.type;\n } catch (e) {\n throw new Error('Events must be strings or objects with a string event.type property.');\n }\n}\nfunction getActionType(action) {\n try {\n return isString(action) || typeof action === 'number' ? \"\".concat(action) : isFunction(action) ? action.name : action.type;\n } catch (e) {\n throw new Error('Actions must be strings or objects with a string action.type property.');\n }\n}\nfunction toStatePath(stateId, delimiter) {\n try {\n if (isArray(stateId)) {\n return stateId;\n }\n\n return stateId.toString().split(delimiter);\n } catch (e) {\n throw new Error(\"'\".concat(stateId, \"' is not a valid state path.\"));\n }\n}\nfunction isStateLike(state) {\n return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state && '_event' in state;\n}\nfunction toStateValue(stateValue, delimiter) {\n if (isStateLike(stateValue)) {\n return stateValue.value;\n }\n\n if (isArray(stateValue)) {\n return pathToStateValue(stateValue);\n }\n\n if (typeof stateValue !== 'string') {\n return stateValue;\n }\n\n var statePath = toStatePath(stateValue, delimiter);\n return pathToStateValue(statePath);\n}\nfunction pathToStateValue(statePath) {\n if (statePath.length === 1) {\n return statePath[0];\n }\n\n var value = {};\n var marker = value;\n\n for (var i = 0; i < statePath.length - 1; i++) {\n if (i === statePath.length - 2) {\n marker[statePath[i]] = statePath[i + 1];\n } else {\n marker[statePath[i]] = {};\n marker = marker[statePath[i]];\n }\n }\n\n return value;\n}\nfunction mapValues(collection, iteratee) {\n var result = {};\n var collectionKeys = Object.keys(collection);\n\n for (var i = 0; i < collectionKeys.length; i++) {\n var key = collectionKeys[i];\n result[key] = iteratee(collection[key], key, collection, i);\n }\n\n return result;\n}\nfunction mapFilterValues(collection, iteratee, predicate) {\n var e_1, _a;\n\n var result = {};\n\n try {\n for (var _b = __values(Object.keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var item = collection[key];\n\n if (!predicate(item)) {\n continue;\n }\n\n result[key] = iteratee(item, key, collection);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return result;\n}\n/**\r\n * Retrieves a value at the given path.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\nvar path = function (props) {\n return function (object) {\n var e_2, _a;\n\n var result = object;\n\n try {\n for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {\n var prop = props_1_1.value;\n result = result[prop];\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n return result;\n };\n};\n/**\r\n * Retrieves a value at the given path via the nested accessor prop.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\nfunction nestedPath(props, accessorProp) {\n return function (object) {\n var e_3, _a;\n\n var result = object;\n\n try {\n for (var props_2 = __values(props), props_2_1 = props_2.next(); !props_2_1.done; props_2_1 = props_2.next()) {\n var prop = props_2_1.value;\n result = result[accessorProp][prop];\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (props_2_1 && !props_2_1.done && (_a = props_2.return)) _a.call(props_2);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n return result;\n };\n}\nfunction toStatePaths(stateValue) {\n if (!stateValue) {\n return [[]];\n }\n\n if (isString(stateValue)) {\n return [[stateValue]];\n }\n\n var result = flatten(Object.keys(stateValue).map(function (key) {\n var subStateValue = stateValue[key];\n\n if (typeof subStateValue !== 'string' && (!subStateValue || !Object.keys(subStateValue).length)) {\n return [[key]];\n }\n\n return toStatePaths(stateValue[key]).map(function (subPath) {\n return [key].concat(subPath);\n });\n }));\n return result;\n}\nfunction pathsToStateValue(paths) {\n var e_4, _a;\n\n var result = {};\n\n if (paths && paths.length === 1 && paths[0].length === 1) {\n return paths[0][0];\n }\n\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var currentPath = paths_1_1.value;\n var marker = result; // tslint:disable-next-line:prefer-for-of\n\n for (var i = 0; i < currentPath.length; i++) {\n var subPath = currentPath[i];\n\n if (i === currentPath.length - 2) {\n marker[subPath] = currentPath[i + 1];\n break;\n }\n\n marker[subPath] = marker[subPath] || {};\n marker = marker[subPath];\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n return result;\n}\nfunction flatten(array) {\n var _a;\n\n return (_a = []).concat.apply(_a, __spreadArray([], __read(array), false));\n}\nfunction toArrayStrict(value) {\n if (isArray(value)) {\n return value;\n }\n\n return [value];\n}\nfunction toArray(value) {\n if (value === undefined) {\n return [];\n }\n\n return toArrayStrict(value);\n}\nfunction mapContext(mapper, context, _event) {\n var e_5, _a;\n\n if (isFunction(mapper)) {\n return mapper(context, _event.data);\n }\n\n var result = {};\n\n try {\n for (var _b = __values(Object.keys(mapper)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var subMapper = mapper[key];\n\n if (isFunction(subMapper)) {\n result[key] = subMapper(context, _event.data);\n } else {\n result[key] = subMapper;\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return result;\n}\nfunction isBuiltInEvent(eventType) {\n return /^(done|error)\\./.test(eventType);\n}\nfunction isPromiseLike(value) {\n if (value instanceof Promise) {\n return true;\n } // Check if shape matches the Promise/A+ specification for a \"thenable\".\n\n\n if (value !== null && (isFunction(value) || typeof value === 'object') && isFunction(value.then)) {\n return true;\n }\n\n return false;\n}\nfunction isBehavior(value) {\n return value !== null && typeof value === 'object' && 'transition' in value && typeof value.transition === 'function';\n}\nfunction partition(items, predicate) {\n var e_6, _a;\n\n var _b = __read([[], []], 2),\n truthy = _b[0],\n falsy = _b[1];\n\n try {\n for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n\n if (predicate(item)) {\n truthy.push(item);\n } else {\n falsy.push(item);\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n return [truthy, falsy];\n}\nfunction updateHistoryStates(hist, stateValue) {\n return mapValues(hist.states, function (subHist, key) {\n if (!subHist) {\n return undefined;\n }\n\n var subStateValue = (isString(stateValue) ? undefined : stateValue[key]) || (subHist ? subHist.current : undefined);\n\n if (!subStateValue) {\n return undefined;\n }\n\n return {\n current: subStateValue,\n states: updateHistoryStates(subHist, subStateValue)\n };\n });\n}\nfunction updateHistoryValue(hist, stateValue) {\n return {\n current: stateValue,\n states: updateHistoryStates(hist, stateValue)\n };\n}\nfunction updateContext(context, _event, assignActions, state) {\n if (!IS_PRODUCTION) {\n warn(!!context, 'Attempting to update undefined context');\n }\n\n var updatedContext = context ? assignActions.reduce(function (acc, assignAction) {\n var e_7, _a;\n\n var assignment = assignAction.assignment;\n var meta = {\n state: state,\n action: assignAction,\n _event: _event\n };\n var partialUpdate = {};\n\n if (isFunction(assignment)) {\n partialUpdate = assignment(acc, _event.data, meta);\n } else {\n try {\n for (var _b = __values(Object.keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var propAssignment = assignment[key];\n partialUpdate[key] = isFunction(propAssignment) ? propAssignment(acc, _event.data, meta) : propAssignment;\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n\n return Object.assign({}, acc, partialUpdate);\n }, context) : context;\n return updatedContext;\n} // tslint:disable-next-line:no-empty\n\nvar warn = function () {};\n\nif (!IS_PRODUCTION) {\n warn = function (condition, message) {\n var error = condition instanceof Error ? condition : undefined;\n\n if (!error && condition) {\n return;\n }\n\n if (console !== undefined) {\n var args = [\"Warning: \".concat(message)];\n\n if (error) {\n args.push(error);\n } // tslint:disable-next-line:no-console\n\n\n console.warn.apply(console, args);\n }\n };\n}\nfunction isArray(value) {\n return Array.isArray(value);\n} // tslint:disable-next-line:ban-types\n\nfunction isFunction(value) {\n return typeof value === 'function';\n}\nfunction isString(value) {\n return typeof value === 'string';\n}\nfunction toGuard(condition, guardMap) {\n if (!condition) {\n return undefined;\n }\n\n if (isString(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition,\n predicate: guardMap ? guardMap[condition] : undefined\n };\n }\n\n if (isFunction(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition.name,\n predicate: condition\n };\n }\n\n return condition;\n}\nfunction isObservable(value) {\n try {\n return 'subscribe' in value && isFunction(value.subscribe);\n } catch (e) {\n return false;\n }\n}\nvar symbolObservable = /*#__PURE__*/function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n}(); // TODO: to be removed in v5, left it out just to minimize the scope of the change and maintain compatibility with older versions of integration paackages\n\nvar interopSymbols = (_a = {}, _a[symbolObservable] = function () {\n return this;\n}, _a[Symbol.observable] = function () {\n return this;\n}, _a);\nfunction isMachine(value) {\n return !!value && '__xstatenode' in value;\n}\nfunction isActor(value) {\n return !!value && typeof value.send === 'function';\n}\nvar uniqueId = /*#__PURE__*/function () {\n var currentId = 0;\n return function () {\n currentId++;\n return currentId.toString(16);\n };\n}();\nfunction toEventObject(event, payload // id?: TEvent['type']\n) {\n if (isString(event) || typeof event === 'number') {\n return __assign({\n type: event\n }, payload);\n }\n\n return event;\n}\nfunction toSCXMLEvent(event, scxmlEvent) {\n if (!isString(event) && '$$type' in event && event.$$type === 'scxml') {\n return event;\n }\n\n var eventObject = toEventObject(event);\n return __assign({\n name: eventObject.type,\n data: eventObject,\n $$type: 'scxml',\n type: 'external'\n }, scxmlEvent);\n}\nfunction toTransitionConfigArray(event, configLike) {\n var transitions = toArrayStrict(configLike).map(function (transitionLike) {\n if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string' || isMachine(transitionLike)) {\n return {\n target: transitionLike,\n event: event\n };\n }\n\n return __assign(__assign({}, transitionLike), {\n event: event\n });\n });\n return transitions;\n}\nfunction normalizeTarget(target) {\n if (target === undefined || target === TARGETLESS_KEY) {\n return undefined;\n }\n\n return toArray(target);\n}\nfunction reportUnhandledExceptionOnInvocation(originalError, currentError, id) {\n if (!IS_PRODUCTION) {\n var originalStackTrace = originalError.stack ? \" Stacktrace was '\".concat(originalError.stack, \"'\") : '';\n\n if (originalError === currentError) {\n // tslint:disable-next-line:no-console\n console.error(\"Missing onError handler for invocation '\".concat(id, \"', error was '\").concat(originalError, \"'.\").concat(originalStackTrace));\n } else {\n var stackTrace = currentError.stack ? \" Stacktrace was '\".concat(currentError.stack, \"'\") : ''; // tslint:disable-next-line:no-console\n\n console.error(\"Missing onError handler and/or unhandled exception/promise rejection for invocation '\".concat(id, \"'. \") + \"Original error: '\".concat(originalError, \"'. \").concat(originalStackTrace, \" Current error is '\").concat(currentError, \"'.\").concat(stackTrace));\n }\n }\n}\nfunction evaluateGuard(machine, guard, context, _event, state) {\n var guards = machine.options.guards;\n var guardMeta = {\n state: state,\n cond: guard,\n _event: _event\n }; // TODO: do not hardcode!\n\n if (guard.type === DEFAULT_GUARD_TYPE) {\n return ((guards === null || guards === void 0 ? void 0 : guards[guard.name]) || guard.predicate)(context, _event.data, guardMeta);\n }\n\n var condFn = guards === null || guards === void 0 ? void 0 : guards[guard.type];\n\n if (!condFn) {\n throw new Error(\"Guard '\".concat(guard.type, \"' is not implemented on machine '\").concat(machine.id, \"'.\"));\n }\n\n return condFn(context, _event.data, guardMeta);\n}\nfunction toInvokeSource(src) {\n if (typeof src === 'string') {\n return {\n type: src\n };\n }\n\n return src;\n}\nfunction toObserver(nextHandler, errorHandler, completionHandler) {\n var noop = function () {};\n\n var isObserver = typeof nextHandler === 'object';\n var self = isObserver ? nextHandler : null;\n return {\n next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),\n error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),\n complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)\n };\n}\nfunction createInvokeId(stateNodeId, index) {\n return \"\".concat(stateNodeId, \":invocation[\").concat(index, \"]\");\n}\nfunction isRaisableAction(action) {\n return (action.type === raise || action.type === send && action.to === SpecialTargets.Internal) && typeof action.delay !== 'number';\n}\n\nexport { createInvokeId, evaluateGuard, flatten, getActionType, getEventType, interopSymbols, isActor, isArray, isBehavior, isBuiltInEvent, isFunction, isMachine, isObservable, isPromiseLike, isRaisableAction, isStateLike, isString, keys, mapContext, mapFilterValues, mapValues, matchesState, nestedPath, normalizeTarget, partition, path, pathToStateValue, pathsToStateValue, reportUnhandledExceptionOnInvocation, symbolObservable, toArray, toArrayStrict, toEventObject, toGuard, toInvokeSource, toObserver, toSCXMLEvent, toStatePath, toStatePaths, toStateValue, toTransitionConfigArray, uniqueId, updateContext, updateHistoryStates, updateHistoryValue, warn };\n", "var STATE_DELIMITER = '.';\nvar EMPTY_ACTIVITY_MAP = {};\nvar DEFAULT_GUARD_TYPE = 'xstate.guard';\nvar TARGETLESS_KEY = '';\n\nexport { DEFAULT_GUARD_TYPE, EMPTY_ACTIVITY_MAP, STATE_DELIMITER, TARGETLESS_KEY };\n", "var IS_PRODUCTION = process.env.NODE_ENV === 'production';\n\nexport { IS_PRODUCTION };\n", "import { __assign } from './_virtual/_tslib.js';\nimport { symbolObservable, toInvokeSource, mapContext, isMachine } from './utils.js';\nimport { provide } from './serviceScope.js';\n\nfunction createNullActor(id) {\n var _a;\n\n return _a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n getSnapshot: function () {\n return undefined;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a;\n}\n/**\r\n * Creates a deferred actor that is able to be invoked given the provided\r\n * invocation information in its `.meta` value.\r\n *\r\n * @param invokeDefinition The meta information needed to invoke the actor.\r\n */\n\nfunction createInvocableActor(invokeDefinition, machine, context, _event) {\n var _a;\n\n var invokeSrc = toInvokeSource(invokeDefinition.src);\n var serviceCreator = (_a = machine === null || machine === void 0 ? void 0 : machine.options.services) === null || _a === void 0 ? void 0 : _a[invokeSrc.type];\n var resolvedData = invokeDefinition.data ? mapContext(invokeDefinition.data, context, _event) : undefined;\n var tempActor = serviceCreator ? createDeferredActor(serviceCreator, invokeDefinition.id, resolvedData) : createNullActor(invokeDefinition.id); // @ts-ignore\n\n tempActor.meta = invokeDefinition;\n return tempActor;\n}\nfunction createDeferredActor(entity, id, data) {\n var tempActor = createNullActor(id); // @ts-ignore\n\n tempActor.deferred = true;\n\n if (isMachine(entity)) {\n // \"mute\" the existing service scope so potential spawned actors within the `.initialState` stay deferred here\n var initialState_1 = tempActor.state = provide(undefined, function () {\n return (data ? entity.withContext(data) : entity).initialState;\n });\n\n tempActor.getSnapshot = function () {\n return initialState_1;\n };\n }\n\n return tempActor;\n}\nfunction isActor(item) {\n try {\n return typeof item.send === 'function';\n } catch (e) {\n return false;\n }\n}\nfunction isSpawnedActor(item) {\n return isActor(item) && 'id' in item;\n} // TODO: refactor the return type, this could be written in a better way but it's best to avoid unneccessary breaking changes now\n\nfunction toActorRef(actorRefLike) {\n var _a;\n\n return __assign((_a = {\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n id: 'anonymous',\n getSnapshot: function () {\n return undefined;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a), actorRefLike);\n}\n\nexport { createDeferredActor, createInvocableActor, createNullActor, isActor, isSpawnedActor, toActorRef };\n", "/**\r\n * Maintains a stack of the current service in scope.\r\n * This is used to provide the correct service to spawn().\r\n */\nvar serviceStack = [];\nvar provide = function (service, fn) {\n serviceStack.push(service);\n var result = fn(service);\n serviceStack.pop();\n return result;\n};\nvar consume = function (fn) {\n return fn(serviceStack[serviceStack.length - 1]);\n};\n\nexport { consume, provide };\n", "import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { isStateConfig, State, bindActionToState } from './State.js';\nimport { errorPlatform, update, error as error$1, log, stop, start, cancel, send, raise } from './actionTypes.js';\nimport { initEvent, doneInvoke, toActionObjects, resolveActions, error, getActionFunction } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { warn, mapContext, toObserver, isFunction, toSCXMLEvent, flatten, isRaisableAction, isPromiseLike, isObservable, isMachine, isBehavior, reportUnhandledExceptionOnInvocation, symbolObservable, isArray, toEventObject, isString, isActor, toInvokeSource, uniqueId } from './utils.js';\nimport { Scheduler } from './scheduler.js';\nimport { createDeferredActor, isSpawnedActor } from './Actor.js';\nimport { registry } from './registry.js';\nimport { getGlobal, registerService } from './devTools.js';\nimport { provide, consume } from './serviceScope.js';\nimport { spawnBehavior } from './behaviors.js';\n\nvar DEFAULT_SPAWN_OPTIONS = {\n sync: false,\n autoForward: false\n};\nvar InterpreterStatus;\n\n(function (InterpreterStatus) {\n InterpreterStatus[InterpreterStatus[\"NotStarted\"] = 0] = \"NotStarted\";\n InterpreterStatus[InterpreterStatus[\"Running\"] = 1] = \"Running\";\n InterpreterStatus[InterpreterStatus[\"Stopped\"] = 2] = \"Stopped\";\n})(InterpreterStatus || (InterpreterStatus = {}));\n\nvar Interpreter =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new Interpreter instance (i.e., service) for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to be interpreted\r\n * @param options Interpreter options\r\n */\n function Interpreter(machine, options) {\n if (options === void 0) {\n options = Interpreter.defaultOptions;\n }\n\n var _this = this;\n\n this.machine = machine;\n this.delayedEventsMap = {};\n this.listeners = new Set();\n this.contextListeners = new Set();\n this.stopListeners = new Set();\n this.doneListeners = new Set();\n this.eventListeners = new Set();\n this.sendListeners = new Set();\n /**\r\n * Whether the service is started.\r\n */\n\n this.initialized = false;\n this.status = InterpreterStatus.NotStarted;\n this.children = new Map();\n this.forwardTo = new Set();\n this._outgoingQueue = [];\n /**\r\n * Alias for Interpreter.prototype.start\r\n */\n\n this.init = this.start;\n /**\r\n * Sends an event to the running interpreter to trigger a transition.\r\n *\r\n * An array of events (batched) can be sent as well, which will send all\r\n * batched events to the running interpreter. The listeners will be\r\n * notified only **once** when all events are processed.\r\n *\r\n * @param event The event(s) to send\r\n */\n\n this.send = function (event, payload) {\n if (isArray(event)) {\n _this.batch(event);\n\n return _this.state;\n }\n\n var _event = toSCXMLEvent(toEventObject(event, payload));\n\n if (_this.status === InterpreterStatus.Stopped) {\n // do nothing\n if (!IS_PRODUCTION) {\n warn(false, \"Event \\\"\".concat(_event.name, \"\\\" was sent to stopped service \\\"\").concat(_this.machine.id, \"\\\". This service has already reached its final state, and will not transition.\\nEvent: \").concat(JSON.stringify(_event.data)));\n }\n\n return _this.state;\n }\n\n if (_this.status !== InterpreterStatus.Running && !_this.options.deferEvents) {\n throw new Error(\"Event \\\"\".concat(_event.name, \"\\\" was sent to uninitialized service \\\"\").concat(_this.machine.id // tslint:disable-next-line:max-line-length\n , \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\\nEvent: \").concat(JSON.stringify(_event.data)));\n }\n\n _this.scheduler.schedule(function () {\n // Forward copy of event to child actors\n _this.forward(_event);\n\n var nextState = _this._nextState(_event);\n\n _this.update(nextState, _event);\n });\n\n return _this._state; // TODO: deprecate (should return void)\n // tslint:disable-next-line:semicolon\n };\n\n this.sendTo = function (event, to, immediate) {\n var isParent = _this.parent && (to === SpecialTargets.Parent || _this.parent.id === to);\n var target = isParent ? _this.parent : isString(to) ? to === SpecialTargets.Internal ? _this : _this.children.get(to) || registry.get(to) : isActor(to) ? to : undefined;\n\n if (!target) {\n if (!isParent) {\n throw new Error(\"Unable to send event to child '\".concat(to, \"' from service '\").concat(_this.id, \"'.\"));\n } // tslint:disable-next-line:no-console\n\n\n if (!IS_PRODUCTION) {\n warn(false, \"Service '\".concat(_this.id, \"' has no parent: unable to send event \").concat(event.type));\n }\n\n return;\n }\n\n if ('machine' in target) {\n // perhaps those events should be rejected in the parent\n // but atm it doesn't have easy access to all of the information that is required to do it reliably\n if (_this.status !== InterpreterStatus.Stopped || _this.parent !== target || // we need to send events to the parent from exit handlers of a machine that reached its final state\n _this.state.done) {\n // Send SCXML events to machines\n var scxmlEvent = __assign(__assign({}, event), {\n name: event.name === error$1 ? \"\".concat(error(_this.id)) : event.name,\n origin: _this.sessionId\n });\n\n if (!immediate && _this.machine.config.predictableActionArguments) {\n _this._outgoingQueue.push([target, scxmlEvent]);\n } else {\n target.send(scxmlEvent);\n }\n }\n } else {\n // Send normal events to other targets\n if (!immediate && _this.machine.config.predictableActionArguments) {\n _this._outgoingQueue.push([target, event.data]);\n } else {\n target.send(event.data);\n }\n }\n };\n\n this._exec = function (action, context, _event, actionFunctionMap) {\n if (actionFunctionMap === void 0) {\n actionFunctionMap = _this.machine.options.actions;\n }\n\n var actionOrExec = action.exec || getActionFunction(action.type, actionFunctionMap);\n var exec = isFunction(actionOrExec) ? actionOrExec : actionOrExec ? actionOrExec.exec : action.exec;\n\n if (exec) {\n try {\n return exec(context, _event.data, !_this.machine.config.predictableActionArguments ? {\n action: action,\n state: _this.state,\n _event: _event\n } : {\n action: action,\n _event: _event\n });\n } catch (err) {\n if (_this.parent) {\n _this.parent.send({\n type: 'xstate.error',\n data: err\n });\n }\n\n throw err;\n }\n }\n\n switch (action.type) {\n case raise:\n {\n // if raise action reached the interpreter then it's a delayed one\n var sendAction_1 = action;\n\n _this.defer(sendAction_1);\n\n break;\n }\n\n case send:\n var sendAction = action;\n\n if (typeof sendAction.delay === 'number') {\n _this.defer(sendAction);\n\n return;\n } else {\n if (sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to, _event === initEvent);\n } else {\n _this.send(sendAction._event);\n }\n }\n\n break;\n\n case cancel:\n _this.cancel(action.sendId);\n\n break;\n\n case start:\n {\n if (_this.status !== InterpreterStatus.Running) {\n return;\n }\n\n var activity = action.activity; // If the activity will be stopped right after it's started\n // (such as in transient states)\n // don't bother starting the activity.\n\n if ( // in v4 with `predictableActionArguments` invokes are called eagerly when the `this.state` still points to the previous state\n !_this.machine.config.predictableActionArguments && !_this.state.activities[activity.id || activity.type]) {\n break;\n } // Invoked services\n\n\n if (activity.type === ActionTypes.Invoke) {\n var invokeSource = toInvokeSource(activity.src);\n var serviceCreator = _this.machine.options.services ? _this.machine.options.services[invokeSource.type] : undefined;\n var id = activity.id,\n data = activity.data;\n\n if (!IS_PRODUCTION) {\n warn(!('forward' in activity), // tslint:disable-next-line:max-line-length\n \"`forward` property is deprecated (found in invocation of '\".concat(activity.src, \"' in in machine '\").concat(_this.machine.id, \"'). \") + \"Please use `autoForward` instead.\");\n }\n\n var autoForward = 'autoForward' in activity ? activity.autoForward : !!activity.forward;\n\n if (!serviceCreator) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"No service found for invocation '\".concat(activity.src, \"' in machine '\").concat(_this.machine.id, \"'.\"));\n }\n\n return;\n }\n\n var resolvedData = data ? mapContext(data, context, _event) : undefined;\n\n if (typeof serviceCreator === 'string') {\n // TODO: warn\n return;\n }\n\n var source = isFunction(serviceCreator) ? serviceCreator(context, _event.data, {\n data: resolvedData,\n src: invokeSource,\n meta: activity.meta\n }) : serviceCreator;\n\n if (!source) {\n // TODO: warn?\n return;\n }\n\n var options = void 0;\n\n if (isMachine(source)) {\n source = resolvedData ? source.withContext(resolvedData) : source;\n options = {\n autoForward: autoForward\n };\n }\n\n _this.spawn(source, id, options);\n } else {\n _this.spawnActivity(activity);\n }\n\n break;\n }\n\n case stop:\n {\n _this.stopChild(action.activity.id);\n\n break;\n }\n\n case log:\n var _a = action,\n label = _a.label,\n value = _a.value;\n\n if (label) {\n _this.logger(label, value);\n } else {\n _this.logger(value);\n }\n\n break;\n\n default:\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for action type '\".concat(action.type, \"'\"));\n }\n\n break;\n }\n };\n\n var resolvedOptions = __assign(__assign({}, Interpreter.defaultOptions), options);\n\n var clock = resolvedOptions.clock,\n logger = resolvedOptions.logger,\n parent = resolvedOptions.parent,\n id = resolvedOptions.id;\n var resolvedId = id !== undefined ? id : machine.id;\n this.id = resolvedId;\n this.logger = logger;\n this.clock = clock;\n this.parent = parent;\n this.options = resolvedOptions;\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n this.sessionId = registry.bookId();\n }\n\n Object.defineProperty(Interpreter.prototype, \"initialState\", {\n get: function () {\n var _this = this;\n\n if (this._initialState) {\n return this._initialState;\n }\n\n return provide(this, function () {\n _this._initialState = _this.machine.initialState;\n return _this._initialState;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Interpreter.prototype, \"state\", {\n /**\r\n * @deprecated Use `.getSnapshot()` instead.\r\n */\n get: function () {\n if (!IS_PRODUCTION) {\n warn(this.status !== InterpreterStatus.NotStarted, \"Attempted to read state from uninitialized service '\".concat(this.id, \"'. Make sure the service is started first.\"));\n }\n\n return this._state;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Executes the actions of the given state, with that state's `context` and `event`.\r\n *\r\n * @param state The state whose actions will be executed\r\n * @param actionsConfig The action implementations to use\r\n */\n\n Interpreter.prototype.execute = function (state, actionsConfig) {\n var e_1, _a;\n\n try {\n for (var _b = __values(state.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n this.exec(action, state, actionsConfig);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n };\n\n Interpreter.prototype.update = function (state, _event) {\n var e_2, _a, e_3, _b, e_4, _c, e_5, _d;\n\n var _this = this; // Attach session ID to state\n\n\n state._sessionid = this.sessionId; // Update state\n\n this._state = state; // Execute actions\n\n if ((!this.machine.config.predictableActionArguments || // this is currently required to execute initial actions as the `initialState` gets cached\n // we can't just recompute it (and execute actions while doing so) because we try to preserve identity of actors created within initial assigns\n _event === initEvent) && this.options.execute) {\n this.execute(this.state);\n } else {\n var item = void 0;\n\n while (item = this._outgoingQueue.shift()) {\n item[0].send(item[1]);\n }\n } // Update children\n\n\n this.children.forEach(function (child) {\n _this.state.children[child.id] = child;\n }); // Dev tools\n\n if (this.devTools) {\n this.devTools.send(_event.data, state);\n } // Execute listeners\n\n\n if (state.event) {\n try {\n for (var _e = __values(this.eventListeners), _f = _e.next(); !_f.done; _f = _e.next()) {\n var listener = _f.value;\n listener(state.event);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_a = _e.return)) _a.call(_e);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n }\n\n try {\n for (var _g = __values(this.listeners), _h = _g.next(); !_h.done; _h = _g.next()) {\n var listener = _h.value;\n listener(state, state.event);\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n try {\n for (var _j = __values(this.contextListeners), _k = _j.next(); !_k.done; _k = _j.next()) {\n var contextListener = _k.value;\n contextListener(this.state.context, this.state.history ? this.state.history.context : undefined);\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_k && !_k.done && (_c = _j.return)) _c.call(_j);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n if (this.state.done) {\n // get final child state node\n var finalChildStateNode = state.configuration.find(function (sn) {\n return sn.type === 'final' && sn.parent === _this.machine;\n });\n var doneData = finalChildStateNode && finalChildStateNode.doneData ? mapContext(finalChildStateNode.doneData, state.context, _event) : undefined;\n this._doneEvent = doneInvoke(this.id, doneData);\n\n try {\n for (var _l = __values(this.doneListeners), _m = _l.next(); !_m.done; _m = _l.next()) {\n var listener = _m.value;\n listener(this._doneEvent);\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_m && !_m.done && (_d = _l.return)) _d.call(_l);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n this._stop();\n\n this._stopChildren();\n\n registry.free(this.sessionId);\n }\n };\n /*\r\n * Adds a listener that is notified whenever a state transition happens. The listener is called with\r\n * the next state and the event object that caused the state transition.\r\n *\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onTransition = function (listener) {\n this.listeners.add(listener); // Send current state to listener\n\n if (this.status === InterpreterStatus.Running) {\n listener(this.state, this.state.event);\n }\n\n return this;\n };\n\n Interpreter.prototype.subscribe = function (nextListenerOrObserver, _, // TODO: error listener\n completeListener) {\n var _this = this;\n\n var observer = toObserver(nextListenerOrObserver, _, completeListener);\n this.listeners.add(observer.next); // Send current state to listener\n\n if (this.status !== InterpreterStatus.NotStarted) {\n observer.next(this.state);\n }\n\n var completeOnce = function () {\n _this.doneListeners.delete(completeOnce);\n\n _this.stopListeners.delete(completeOnce);\n\n observer.complete();\n };\n\n if (this.status === InterpreterStatus.Stopped) {\n observer.complete();\n } else {\n this.onDone(completeOnce);\n this.onStop(completeOnce);\n }\n\n return {\n unsubscribe: function () {\n _this.listeners.delete(observer.next);\n\n _this.doneListeners.delete(completeOnce);\n\n _this.stopListeners.delete(completeOnce);\n }\n };\n };\n /**\r\n * Adds an event listener that is notified whenever an event is sent to the running interpreter.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onEvent = function (listener) {\n this.eventListeners.add(listener);\n return this;\n };\n /**\r\n * Adds an event listener that is notified whenever a `send` event occurs.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onSend = function (listener) {\n this.sendListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a context listener that is notified whenever the state context changes.\r\n * @param listener The context listener\r\n */\n\n\n Interpreter.prototype.onChange = function (listener) {\n this.contextListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a listener that is notified when the machine is stopped.\r\n * @param listener The listener\r\n */\n\n\n Interpreter.prototype.onStop = function (listener) {\n this.stopListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a state listener that is notified when the statechart has reached its final state.\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onDone = function (listener) {\n if (this.status === InterpreterStatus.Stopped && this._doneEvent) {\n listener(this._doneEvent);\n } else {\n this.doneListeners.add(listener);\n }\n\n return this;\n };\n /**\r\n * Removes a listener.\r\n * @param listener The listener to remove\r\n */\n\n\n Interpreter.prototype.off = function (listener) {\n this.listeners.delete(listener);\n this.eventListeners.delete(listener);\n this.sendListeners.delete(listener);\n this.stopListeners.delete(listener);\n this.doneListeners.delete(listener);\n this.contextListeners.delete(listener);\n return this;\n };\n /**\r\n * Starts the interpreter from the given state, or the initial state.\r\n * @param initialState The state to start the statechart from\r\n */\n\n\n Interpreter.prototype.start = function (initialState) {\n var _this = this;\n\n if (this.status === InterpreterStatus.Running) {\n // Do not restart the service if it is already started\n return this;\n } // yes, it's a hack but we need the related cache to be populated for some things to work (like delayed transitions)\n // this is usually called by `machine.getInitialState` but if we rehydrate from a state we might bypass this call\n // we also don't want to call this method here as it resolves the full initial state which might involve calling assign actions\n // and that could potentially lead to some unwanted side-effects (even such as creating some rogue actors)\n\n\n this.machine._init();\n\n registry.register(this.sessionId, this);\n this.initialized = true;\n this.status = InterpreterStatus.Running;\n var resolvedState = initialState === undefined ? this.initialState : provide(this, function () {\n return isStateConfig(initialState) ? _this.machine.resolveState(initialState) : _this.machine.resolveState(State.from(initialState, _this.machine.context));\n });\n\n if (this.options.devTools) {\n this.attachDev();\n }\n\n this.scheduler.initialize(function () {\n _this.update(resolvedState, initEvent);\n });\n return this;\n };\n\n Interpreter.prototype._stopChildren = function () {\n // TODO: think about converting those to actions\n this.children.forEach(function (child) {\n if (isFunction(child.stop)) {\n child.stop();\n }\n });\n this.children.clear();\n };\n\n Interpreter.prototype._stop = function () {\n var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e;\n\n try {\n for (var _f = __values(this.listeners), _g = _f.next(); !_g.done; _g = _f.next()) {\n var listener = _g.value;\n this.listeners.delete(listener);\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (_g && !_g.done && (_a = _f.return)) _a.call(_f);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n try {\n for (var _h = __values(this.stopListeners), _j = _h.next(); !_j.done; _j = _h.next()) {\n var listener = _j.value; // call listener, then remove\n\n listener();\n this.stopListeners.delete(listener);\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_j && !_j.done && (_b = _h.return)) _b.call(_h);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n\n try {\n for (var _k = __values(this.contextListeners), _l = _k.next(); !_l.done; _l = _k.next()) {\n var listener = _l.value;\n this.contextListeners.delete(listener);\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n\n try {\n for (var _m = __values(this.doneListeners), _o = _m.next(); !_o.done; _o = _m.next()) {\n var listener = _o.value;\n this.doneListeners.delete(listener);\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_o && !_o.done && (_d = _m.return)) _d.call(_m);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n\n if (!this.initialized) {\n // Interpreter already stopped; do nothing\n return this;\n }\n\n this.initialized = false;\n this.status = InterpreterStatus.Stopped;\n this._initialState = undefined;\n\n try {\n // we are going to stop within the current sync frame\n // so we can safely just cancel this here as nothing async should be fired anyway\n for (var _p = __values(Object.keys(this.delayedEventsMap)), _q = _p.next(); !_q.done; _q = _p.next()) {\n var key = _q.value;\n this.clock.clearTimeout(this.delayedEventsMap[key]);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (_q && !_q.done && (_e = _p.return)) _e.call(_p);\n } finally {\n if (e_10) throw e_10.error;\n }\n } // clear everything that might be enqueued\n\n\n this.scheduler.clear();\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n };\n /**\r\n * Stops the interpreter and unsubscribe all listeners.\r\n *\r\n * This will also notify the `onStop` listeners.\r\n */\n\n\n Interpreter.prototype.stop = function () {\n // TODO: add warning for stopping non-root interpreters\n var _this = this; // grab the current scheduler as it will be replaced in _stop\n\n\n var scheduler = this.scheduler;\n\n this._stop(); // let what is currently processed to be finished\n\n\n scheduler.schedule(function () {\n var _a;\n\n if ((_a = _this._state) === null || _a === void 0 ? void 0 : _a.done) {\n return;\n } // it feels weird to handle this here but we need to handle this even slightly \"out of band\"\n\n\n var _event = toSCXMLEvent({\n type: 'xstate.stop'\n });\n\n var nextState = provide(_this, function () {\n var exitActions = flatten(__spreadArray([], __read(_this.state.configuration), false).sort(function (a, b) {\n return b.order - a.order;\n }).map(function (stateNode) {\n return toActionObjects(stateNode.onExit, _this.machine.options.actions);\n }));\n\n var _a = __read(resolveActions(_this.machine, _this.state, _this.state.context, _event, [{\n type: 'exit',\n actions: exitActions\n }], _this.machine.config.predictableActionArguments ? _this._exec : undefined, _this.machine.config.predictableActionArguments || _this.machine.config.preserveActionOrder), 2),\n resolvedActions = _a[0],\n updatedContext = _a[1];\n\n var newState = new State({\n value: _this.state.value,\n context: updatedContext,\n _event: _event,\n _sessionid: _this.sessionId,\n historyValue: undefined,\n history: _this.state,\n actions: resolvedActions.filter(function (action) {\n return !isRaisableAction(action);\n }),\n activities: {},\n events: [],\n configuration: [],\n transitions: [],\n children: {},\n done: _this.state.done,\n tags: _this.state.tags,\n machine: _this.machine\n });\n newState.changed = true;\n return newState;\n });\n\n _this.update(nextState, _event);\n\n _this._stopChildren();\n\n registry.free(_this.sessionId);\n });\n return this;\n };\n\n Interpreter.prototype.batch = function (events) {\n var _this = this;\n\n if (this.status === InterpreterStatus.NotStarted && this.options.deferEvents) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"\".concat(events.length, \" event(s) were sent to uninitialized service \\\"\").concat(this.machine.id, \"\\\" and are deferred. Make sure .start() is called for this service.\\nEvent: \").concat(JSON.stringify(event)));\n }\n } else if (this.status !== InterpreterStatus.Running) {\n throw new Error( // tslint:disable-next-line:max-line-length\n \"\".concat(events.length, \" event(s) were sent to uninitialized service \\\"\").concat(this.machine.id, \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\"));\n }\n\n if (!events.length) {\n return;\n }\n\n var exec = !!this.machine.config.predictableActionArguments && this._exec;\n this.scheduler.schedule(function () {\n var e_11, _a;\n\n var nextState = _this.state;\n var batchChanged = false;\n var batchedActions = [];\n\n var _loop_1 = function (event_1) {\n var _event = toSCXMLEvent(event_1);\n\n _this.forward(_event);\n\n nextState = provide(_this, function () {\n return _this.machine.transition(nextState, _event, undefined, exec || undefined);\n });\n batchedActions.push.apply(batchedActions, __spreadArray([], __read(_this.machine.config.predictableActionArguments ? nextState.actions : nextState.actions.map(function (a) {\n return bindActionToState(a, nextState);\n })), false));\n batchChanged = batchChanged || !!nextState.changed;\n };\n\n try {\n for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {\n var event_1 = events_1_1.value;\n\n _loop_1(event_1);\n }\n } catch (e_11_1) {\n e_11 = {\n error: e_11_1\n };\n } finally {\n try {\n if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);\n } finally {\n if (e_11) throw e_11.error;\n }\n }\n\n nextState.changed = batchChanged;\n nextState.actions = batchedActions;\n\n _this.update(nextState, toSCXMLEvent(events[events.length - 1]));\n });\n };\n /**\r\n * Returns a send function bound to this interpreter instance.\r\n *\r\n * @param event The event to be sent by the sender.\r\n */\n\n\n Interpreter.prototype.sender = function (event) {\n return this.send.bind(this, event);\n };\n\n Interpreter.prototype._nextState = function (event, exec) {\n var _this = this;\n\n if (exec === void 0) {\n exec = !!this.machine.config.predictableActionArguments && this._exec;\n }\n\n var _event = toSCXMLEvent(event);\n\n if (_event.name.indexOf(errorPlatform) === 0 && !this.state.nextEvents.some(function (nextEvent) {\n return nextEvent.indexOf(errorPlatform) === 0;\n })) {\n throw _event.data.data;\n }\n\n var nextState = provide(this, function () {\n return _this.machine.transition(_this.state, _event, undefined, exec || undefined);\n });\n return nextState;\n };\n /**\r\n * Returns the next state given the interpreter's current state and the event.\r\n *\r\n * This is a pure method that does _not_ update the interpreter's state.\r\n *\r\n * @param event The event to determine the next state\r\n */\n\n\n Interpreter.prototype.nextState = function (event) {\n return this._nextState(event, false);\n };\n\n Interpreter.prototype.forward = function (event) {\n var e_12, _a;\n\n try {\n for (var _b = __values(this.forwardTo), _c = _b.next(); !_c.done; _c = _b.next()) {\n var id = _c.value;\n var child = this.children.get(id);\n\n if (!child) {\n throw new Error(\"Unable to forward event '\".concat(event, \"' from interpreter '\").concat(this.id, \"' to nonexistant child '\").concat(id, \"'.\"));\n }\n\n child.send(event);\n }\n } catch (e_12_1) {\n e_12 = {\n error: e_12_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_12) throw e_12.error;\n }\n }\n };\n\n Interpreter.prototype.defer = function (sendAction) {\n var _this = this;\n\n var timerId = this.clock.setTimeout(function () {\n if ('to' in sendAction && sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to, true);\n } else {\n _this.send(sendAction._event);\n }\n }, sendAction.delay);\n\n if (sendAction.id) {\n this.delayedEventsMap[sendAction.id] = timerId;\n }\n };\n\n Interpreter.prototype.cancel = function (sendId) {\n this.clock.clearTimeout(this.delayedEventsMap[sendId]);\n delete this.delayedEventsMap[sendId];\n };\n\n Interpreter.prototype.exec = function (action, state, actionFunctionMap) {\n if (actionFunctionMap === void 0) {\n actionFunctionMap = this.machine.options.actions;\n }\n\n this._exec(action, state.context, state._event, actionFunctionMap);\n };\n\n Interpreter.prototype.removeChild = function (childId) {\n var _a;\n\n this.children.delete(childId);\n this.forwardTo.delete(childId); // this.state might not exist at the time this is called,\n // such as when a child is added then removed while initializing the state\n\n (_a = this.state) === null || _a === void 0 ? true : delete _a.children[childId];\n };\n\n Interpreter.prototype.stopChild = function (childId) {\n var child = this.children.get(childId);\n\n if (!child) {\n return;\n }\n\n this.removeChild(childId);\n\n if (isFunction(child.stop)) {\n child.stop();\n }\n };\n\n Interpreter.prototype.spawn = function (entity, name, options) {\n if (this.status !== InterpreterStatus.Running) {\n return createDeferredActor(entity, name);\n }\n\n if (isPromiseLike(entity)) {\n return this.spawnPromise(Promise.resolve(entity), name);\n } else if (isFunction(entity)) {\n return this.spawnCallback(entity, name);\n } else if (isSpawnedActor(entity)) {\n return this.spawnActor(entity, name);\n } else if (isObservable(entity)) {\n return this.spawnObservable(entity, name);\n } else if (isMachine(entity)) {\n return this.spawnMachine(entity, __assign(__assign({}, options), {\n id: name\n }));\n } else if (isBehavior(entity)) {\n return this.spawnBehavior(entity, name);\n } else {\n throw new Error(\"Unable to spawn entity \\\"\".concat(name, \"\\\" of type \\\"\").concat(typeof entity, \"\\\".\"));\n }\n };\n\n Interpreter.prototype.spawnMachine = function (machine, options) {\n var _this = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var childService = new Interpreter(machine, __assign(__assign({}, this.options), {\n parent: this,\n id: options.id || machine.id\n }));\n\n var resolvedOptions = __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), options);\n\n if (resolvedOptions.sync) {\n childService.onTransition(function (state) {\n _this.send(update, {\n state: state,\n id: childService.id\n });\n });\n }\n\n var actor = childService;\n this.children.set(childService.id, actor);\n\n if (resolvedOptions.autoForward) {\n this.forwardTo.add(childService.id);\n }\n\n childService.onDone(function (doneEvent) {\n _this.removeChild(childService.id);\n\n _this.send(toSCXMLEvent(doneEvent, {\n origin: childService.id\n }));\n }).start();\n return actor;\n };\n\n Interpreter.prototype.spawnBehavior = function (behavior, id) {\n var actorRef = spawnBehavior(behavior, {\n id: id,\n parent: this\n });\n this.children.set(id, actorRef);\n return actorRef;\n };\n\n Interpreter.prototype.spawnPromise = function (promise, id) {\n var _a;\n\n var _this = this;\n\n var canceled = false;\n var resolvedData;\n promise.then(function (response) {\n if (!canceled) {\n resolvedData = response;\n\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(doneInvoke(id, response), {\n origin: id\n }));\n }\n }, function (errorData) {\n if (!canceled) {\n _this.removeChild(id);\n\n var errorEvent = error(id, errorData);\n\n try {\n // Send \"error.platform.id\" to this (parent).\n _this.send(toSCXMLEvent(errorEvent, {\n origin: id\n }));\n } catch (error) {\n reportUnhandledExceptionOnInvocation(errorData, error, id);\n\n if (_this.devTools) {\n _this.devTools.send(errorEvent, _this.state);\n }\n\n if (_this.machine.strict) {\n // it would be better to always stop the state machine if unhandled\n // exception/promise rejection happens but because we don't want to\n // break existing code so enforce it on strict mode only especially so\n // because documentation says that onError is optional\n _this.stop();\n }\n }\n }\n });\n var actor = (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function (next, handleError, complete) {\n var observer = toObserver(next, handleError, complete);\n var unsubscribed = false;\n promise.then(function (response) {\n if (unsubscribed) {\n return;\n }\n\n observer.next(response);\n\n if (unsubscribed) {\n return;\n }\n\n observer.complete();\n }, function (err) {\n if (unsubscribed) {\n return;\n }\n\n observer.error(err);\n });\n return {\n unsubscribe: function () {\n return unsubscribed = true;\n }\n };\n },\n stop: function () {\n canceled = true;\n },\n toJSON: function () {\n return {\n id: id\n };\n },\n getSnapshot: function () {\n return resolvedData;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnCallback = function (callback, id) {\n var _a;\n\n var _this = this;\n\n var canceled = false;\n var receivers = new Set();\n var listeners = new Set();\n var emitted;\n\n var receive = function (e) {\n emitted = e;\n listeners.forEach(function (listener) {\n return listener(e);\n });\n\n if (canceled) {\n return;\n }\n\n _this.send(toSCXMLEvent(e, {\n origin: id\n }));\n };\n\n var callbackStop;\n\n try {\n callbackStop = callback(receive, function (newListener) {\n receivers.add(newListener);\n });\n } catch (err) {\n this.send(error(id, err));\n }\n\n if (isPromiseLike(callbackStop)) {\n // it turned out to be an async function, can't reliably check this before calling `callback`\n // because transpiled async functions are not recognizable\n return this.spawnPromise(callbackStop, id);\n }\n\n var actor = (_a = {\n id: id,\n send: function (event) {\n return receivers.forEach(function (receiver) {\n return receiver(event);\n });\n },\n subscribe: function (next) {\n var observer = toObserver(next);\n listeners.add(observer.next);\n return {\n unsubscribe: function () {\n listeners.delete(observer.next);\n }\n };\n },\n stop: function () {\n canceled = true;\n\n if (isFunction(callbackStop)) {\n callbackStop();\n }\n },\n toJSON: function () {\n return {\n id: id\n };\n },\n getSnapshot: function () {\n return emitted;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnObservable = function (source, id) {\n var _a;\n\n var _this = this;\n\n var emitted;\n var subscription = source.subscribe(function (value) {\n emitted = value;\n\n _this.send(toSCXMLEvent(value, {\n origin: id\n }));\n }, function (err) {\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(error(id, err), {\n origin: id\n }));\n }, function () {\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(doneInvoke(id), {\n origin: id\n }));\n });\n var actor = (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function (next, handleError, complete) {\n return source.subscribe(next, handleError, complete);\n },\n stop: function () {\n return subscription.unsubscribe();\n },\n getSnapshot: function () {\n return emitted;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActor = function (actor, name) {\n this.children.set(name, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActivity = function (activity) {\n var implementation = this.machine.options && this.machine.options.activities ? this.machine.options.activities[activity.type] : undefined;\n\n if (!implementation) {\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for activity '\".concat(activity.type, \"'\"));\n } // tslint:disable-next-line:no-console\n\n\n return;\n } // Start implementation\n\n\n var dispose = implementation(this.state.context, activity);\n this.spawnEffect(activity.id, dispose);\n };\n\n Interpreter.prototype.spawnEffect = function (id, dispose) {\n var _a;\n\n this.children.set(id, (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n stop: dispose || undefined,\n getSnapshot: function () {\n return undefined;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a));\n };\n\n Interpreter.prototype.attachDev = function () {\n var global = getGlobal();\n\n if (this.options.devTools && global) {\n if (global.__REDUX_DEVTOOLS_EXTENSION__) {\n var devToolsOptions = typeof this.options.devTools === 'object' ? this.options.devTools : undefined;\n this.devTools = global.__REDUX_DEVTOOLS_EXTENSION__.connect(__assign(__assign({\n name: this.id,\n autoPause: true,\n stateSanitizer: function (state) {\n return {\n value: state.value,\n context: state.context,\n actions: state.actions\n };\n }\n }, devToolsOptions), {\n features: __assign({\n jump: false,\n skip: false\n }, devToolsOptions ? devToolsOptions.features : undefined)\n }), this.machine);\n this.devTools.init(this.state);\n } // add XState-specific dev tooling hook\n\n\n registerService(this);\n }\n };\n\n Interpreter.prototype.toJSON = function () {\n return {\n id: this.id\n };\n };\n\n Interpreter.prototype[symbolObservable] = function () {\n return this;\n };\n\n Interpreter.prototype.getSnapshot = function () {\n if (this.status === InterpreterStatus.NotStarted) {\n return this.initialState;\n }\n\n return this._state;\n };\n /**\r\n * The default interpreter options:\r\n *\r\n * - `clock` uses the global `setTimeout` and `clearTimeout` functions\r\n * - `logger` uses the global `console.log()` method\r\n */\n\n\n Interpreter.defaultOptions = {\n execute: true,\n deferEvents: true,\n clock: {\n setTimeout: function (fn, ms) {\n return setTimeout(fn, ms);\n },\n clearTimeout: function (id) {\n return clearTimeout(id);\n }\n },\n logger: /*#__PURE__*/console.log.bind(console),\n devTools: false\n };\n Interpreter.interpret = interpret;\n return Interpreter;\n}();\n\nvar resolveSpawnOptions = function (nameOrOptions) {\n if (isString(nameOrOptions)) {\n return __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: nameOrOptions\n });\n }\n\n return __assign(__assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: uniqueId()\n }), nameOrOptions);\n};\n\nfunction spawn(entity, nameOrOptions) {\n var resolvedOptions = resolveSpawnOptions(nameOrOptions);\n return consume(function (service) {\n if (!IS_PRODUCTION) {\n var isLazyEntity = isMachine(entity) || isFunction(entity);\n warn(!!service || isLazyEntity, \"Attempted to spawn an Actor (ID: \\\"\".concat(isMachine(entity) ? entity.id : 'undefined', \"\\\") outside of a service. This will have no effect.\"));\n }\n\n if (service) {\n return service.spawn(entity, resolvedOptions.name, resolvedOptions);\n } else {\n return createDeferredActor(entity, resolvedOptions.name);\n }\n });\n}\n/**\r\n * Creates a new Interpreter instance for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to interpret\r\n * @param options Interpreter options\r\n */\n\nfunction interpret(machine, options) {\n var interpreter = new Interpreter(machine, options);\n return interpreter;\n}\n\nexport { Interpreter, InterpreterStatus, interpret, spawn };\n", "import { __assign, __spreadArray, __read, __rest } from './_virtual/_tslib.js';\nimport { EMPTY_ACTIVITY_MAP } from './constants.js';\nimport { isString, matchesState, warn } from './utils.js';\nimport { getMeta, nextEvents } from './stateUtils.js';\nimport { initEvent } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nfunction stateValuesEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (a === undefined || b === undefined) {\n return false;\n }\n\n if (isString(a) || isString(b)) {\n return a === b;\n }\n\n var aKeys = Object.keys(a);\n var bKeys = Object.keys(b);\n return aKeys.length === bKeys.length && aKeys.every(function (key) {\n return stateValuesEqual(a[key], b[key]);\n });\n}\nfunction isStateConfig(state) {\n if (typeof state !== 'object' || state === null) {\n return false;\n }\n\n return 'value' in state && '_event' in state;\n}\n/**\r\n * @deprecated Use `isStateConfig(object)` or `state instanceof State` instead.\r\n */\n\nvar isState = isStateConfig;\nfunction bindActionToState(action, state) {\n var exec = action.exec;\n\n var boundAction = __assign(__assign({}, action), {\n exec: exec !== undefined ? function () {\n return exec(state.context, state.event, {\n action: action,\n state: state,\n _event: state._event\n });\n } : undefined\n });\n\n return boundAction;\n}\n\nvar State =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new State instance.\r\n * @param value The state value\r\n * @param context The extended state\r\n * @param historyValue The tree representing historical values of the state nodes\r\n * @param history The previous state\r\n * @param actions An array of action objects to execute as side-effects\r\n * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).\r\n * @param meta\r\n * @param events Internal event queue. Should be empty with run-to-completion semantics.\r\n * @param configuration\r\n */\n function State(config) {\n var _this = this;\n\n var _a;\n\n this.actions = [];\n this.activities = EMPTY_ACTIVITY_MAP;\n this.meta = {};\n this.events = [];\n this.value = config.value;\n this.context = config.context;\n this._event = config._event;\n this._sessionid = config._sessionid;\n this.event = this._event.data;\n this.historyValue = config.historyValue;\n this.history = config.history;\n this.actions = config.actions || [];\n this.activities = config.activities || EMPTY_ACTIVITY_MAP;\n this.meta = getMeta(config.configuration);\n this.events = config.events || [];\n this.matches = this.matches.bind(this);\n this.toStrings = this.toStrings.bind(this);\n this.configuration = config.configuration;\n this.transitions = config.transitions;\n this.children = config.children;\n this.done = !!config.done;\n this.tags = (_a = Array.isArray(config.tags) ? new Set(config.tags) : config.tags) !== null && _a !== void 0 ? _a : new Set();\n this.machine = config.machine;\n Object.defineProperty(this, 'nextEvents', {\n get: function () {\n return nextEvents(_this.configuration);\n }\n });\n }\n /**\r\n * Creates a new State instance for the given `stateValue` and `context`.\r\n * @param stateValue\r\n * @param context\r\n */\n\n\n State.from = function (stateValue, context) {\n if (stateValue instanceof State) {\n if (stateValue.context !== context) {\n return new State({\n value: stateValue.value,\n context: context,\n _event: stateValue._event,\n _sessionid: null,\n historyValue: stateValue.historyValue,\n history: stateValue.history,\n actions: [],\n activities: stateValue.activities,\n meta: {},\n events: [],\n configuration: [],\n transitions: [],\n children: {}\n });\n }\n\n return stateValue;\n }\n\n var _event = initEvent;\n return new State({\n value: stateValue,\n context: context,\n _event: _event,\n _sessionid: null,\n historyValue: undefined,\n history: undefined,\n actions: [],\n activities: undefined,\n meta: undefined,\n events: [],\n configuration: [],\n transitions: [],\n children: {}\n });\n };\n /**\r\n * Creates a new State instance for the given `config`.\r\n * @param config The state config\r\n */\n\n\n State.create = function (config) {\n return new State(config);\n };\n /**\r\n * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).\r\n * @param stateValue\r\n * @param context\r\n */\n\n\n State.inert = function (stateValue, context) {\n if (stateValue instanceof State) {\n if (!stateValue.actions.length) {\n return stateValue;\n }\n\n var _event = initEvent;\n return new State({\n value: stateValue.value,\n context: context,\n _event: _event,\n _sessionid: null,\n historyValue: stateValue.historyValue,\n history: stateValue.history,\n activities: stateValue.activities,\n configuration: stateValue.configuration,\n transitions: [],\n children: {}\n });\n }\n\n return State.from(stateValue, context);\n };\n /**\r\n * Returns an array of all the string leaf state node paths.\r\n * @param stateValue\r\n * @param delimiter The character(s) that separate each subpath in the string state node path.\r\n */\n\n\n State.prototype.toStrings = function (stateValue, delimiter) {\n var _this = this;\n\n if (stateValue === void 0) {\n stateValue = this.value;\n }\n\n if (delimiter === void 0) {\n delimiter = '.';\n }\n\n if (isString(stateValue)) {\n return [stateValue];\n }\n\n var valueKeys = Object.keys(stateValue);\n return valueKeys.concat.apply(valueKeys, __spreadArray([], __read(valueKeys.map(function (key) {\n return _this.toStrings(stateValue[key], delimiter).map(function (s) {\n return key + delimiter + s;\n });\n })), false));\n };\n\n State.prototype.toJSON = function () {\n var _a = this;\n _a.configuration;\n _a.transitions;\n var tags = _a.tags;\n _a.machine;\n var jsonValues = __rest(_a, [\"configuration\", \"transitions\", \"tags\", \"machine\"]);\n\n return __assign(__assign({}, jsonValues), {\n tags: Array.from(tags)\n });\n };\n\n State.prototype.matches = function (parentStateValue) {\n return matchesState(parentStateValue, this.value);\n };\n /**\r\n * Whether the current state configuration has a state node with the specified `tag`.\r\n * @param tag\r\n */\n\n\n State.prototype.hasTag = function (tag) {\n return this.tags.has(tag);\n };\n /**\r\n * Determines whether sending the `event` will cause a non-forbidden transition\r\n * to be selected, even if the transitions have no actions nor\r\n * change the state value.\r\n *\r\n * @param event The event to test\r\n * @returns Whether the event will cause a transition\r\n */\n\n\n State.prototype.can = function (event) {\n var _a;\n\n if (IS_PRODUCTION) {\n warn(!!this.machine, \"state.can(...) used outside of a machine-created State object; this will always return false.\");\n }\n\n var transitionData = (_a = this.machine) === null || _a === void 0 ? void 0 : _a.getTransitionData(this, event);\n return !!(transitionData === null || transitionData === void 0 ? void 0 : transitionData.transitions.length) && // Check that at least one transition is not forbidden\n transitionData.transitions.some(function (t) {\n return t.target !== undefined || t.actions.length;\n });\n };\n\n return State;\n}();\n\nexport { State, bindActionToState, isState, isStateConfig, stateValuesEqual };\n", "import { __values, __spreadArray, __read } from './_virtual/_tslib.js';\nimport { flatten } from './utils.js';\n\nvar isLeafNode = function (stateNode) {\n return stateNode.type === 'atomic' || stateNode.type === 'final';\n};\nfunction getAllChildren(stateNode) {\n return Object.keys(stateNode.states).map(function (key) {\n return stateNode.states[key];\n });\n}\nfunction getChildren(stateNode) {\n return getAllChildren(stateNode).filter(function (sn) {\n return sn.type !== 'history';\n });\n}\nfunction getAllStateNodes(stateNode) {\n var stateNodes = [stateNode];\n\n if (isLeafNode(stateNode)) {\n return stateNodes;\n }\n\n return stateNodes.concat(flatten(getChildren(stateNode).map(getAllStateNodes)));\n}\nfunction getConfiguration(prevStateNodes, stateNodes) {\n var e_1, _a, e_2, _b, e_3, _c, e_4, _d;\n\n var prevConfiguration = new Set(prevStateNodes);\n var prevAdjList = getAdjList(prevConfiguration);\n var configuration = new Set(stateNodes);\n\n try {\n // add all ancestors\n for (var configuration_1 = __values(configuration), configuration_1_1 = configuration_1.next(); !configuration_1_1.done; configuration_1_1 = configuration_1.next()) {\n var s = configuration_1_1.value;\n var m = s.parent;\n\n while (m && !configuration.has(m)) {\n configuration.add(m);\n m = m.parent;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (configuration_1_1 && !configuration_1_1.done && (_a = configuration_1.return)) _a.call(configuration_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n var adjList = getAdjList(configuration);\n\n try {\n // add descendants\n for (var configuration_2 = __values(configuration), configuration_2_1 = configuration_2.next(); !configuration_2_1.done; configuration_2_1 = configuration_2.next()) {\n var s = configuration_2_1.value; // if previously active, add existing child nodes\n\n if (s.type === 'compound' && (!adjList.get(s) || !adjList.get(s).length)) {\n if (prevAdjList.get(s)) {\n prevAdjList.get(s).forEach(function (sn) {\n return configuration.add(sn);\n });\n } else {\n s.initialStateNodes.forEach(function (sn) {\n return configuration.add(sn);\n });\n }\n } else {\n if (s.type === 'parallel') {\n try {\n for (var _e = (e_3 = void 0, __values(getChildren(s))), _f = _e.next(); !_f.done; _f = _e.next()) {\n var child = _f.value;\n\n if (!configuration.has(child)) {\n configuration.add(child);\n\n if (prevAdjList.get(child)) {\n prevAdjList.get(child).forEach(function (sn) {\n return configuration.add(sn);\n });\n } else {\n child.initialStateNodes.forEach(function (sn) {\n return configuration.add(sn);\n });\n }\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_c = _e.return)) _c.call(_e);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n }\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (configuration_2_1 && !configuration_2_1.done && (_b = configuration_2.return)) _b.call(configuration_2);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n try {\n // add all ancestors\n for (var configuration_3 = __values(configuration), configuration_3_1 = configuration_3.next(); !configuration_3_1.done; configuration_3_1 = configuration_3.next()) {\n var s = configuration_3_1.value;\n var m = s.parent;\n\n while (m && !configuration.has(m)) {\n configuration.add(m);\n m = m.parent;\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (configuration_3_1 && !configuration_3_1.done && (_d = configuration_3.return)) _d.call(configuration_3);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n return configuration;\n}\n\nfunction getValueFromAdj(baseNode, adjList) {\n var childStateNodes = adjList.get(baseNode);\n\n if (!childStateNodes) {\n return {}; // todo: fix?\n }\n\n if (baseNode.type === 'compound') {\n var childStateNode = childStateNodes[0];\n\n if (childStateNode) {\n if (isLeafNode(childStateNode)) {\n return childStateNode.key;\n }\n } else {\n return {};\n }\n }\n\n var stateValue = {};\n childStateNodes.forEach(function (csn) {\n stateValue[csn.key] = getValueFromAdj(csn, adjList);\n });\n return stateValue;\n}\n\nfunction getAdjList(configuration) {\n var e_5, _a;\n\n var adjList = new Map();\n\n try {\n for (var configuration_4 = __values(configuration), configuration_4_1 = configuration_4.next(); !configuration_4_1.done; configuration_4_1 = configuration_4.next()) {\n var s = configuration_4_1.value;\n\n if (!adjList.has(s)) {\n adjList.set(s, []);\n }\n\n if (s.parent) {\n if (!adjList.has(s.parent)) {\n adjList.set(s.parent, []);\n }\n\n adjList.get(s.parent).push(s);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (configuration_4_1 && !configuration_4_1.done && (_a = configuration_4.return)) _a.call(configuration_4);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return adjList;\n}\nfunction getValue(rootNode, configuration) {\n var config = getConfiguration([rootNode], configuration);\n return getValueFromAdj(rootNode, getAdjList(config));\n}\nfunction has(iterable, item) {\n if (Array.isArray(iterable)) {\n return iterable.some(function (member) {\n return member === item;\n });\n }\n\n if (iterable instanceof Set) {\n return iterable.has(item);\n }\n\n return false; // TODO: fix\n}\nfunction nextEvents(configuration) {\n return __spreadArray([], __read(new Set(flatten(__spreadArray([], __read(configuration.map(function (sn) {\n return sn.ownEvents;\n })), false)))), false);\n}\nfunction isInFinalState(configuration, stateNode) {\n if (stateNode.type === 'compound') {\n return getChildren(stateNode).some(function (s) {\n return s.type === 'final' && has(configuration, s);\n });\n }\n\n if (stateNode.type === 'parallel') {\n return getChildren(stateNode).every(function (sn) {\n return isInFinalState(configuration, sn);\n });\n }\n\n return false;\n}\nfunction getMeta(configuration) {\n if (configuration === void 0) {\n configuration = [];\n }\n\n return configuration.reduce(function (acc, stateNode) {\n if (stateNode.meta !== undefined) {\n acc[stateNode.id] = stateNode.meta;\n }\n\n return acc;\n }, {});\n}\nfunction getTagsFromConfiguration(configuration) {\n return new Set(flatten(configuration.map(function (sn) {\n return sn.tags;\n })));\n}\n\nexport { getAdjList, getAllChildren, getAllStateNodes, getChildren, getConfiguration, getMeta, getTagsFromConfiguration, getValue, has, isInFinalState, isLeafNode, nextEvents };\n", "import { __assign } from './_virtual/_tslib.js';\n\nvar defaultOptions = {\n deferEvents: false\n};\n\nvar Scheduler =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function Scheduler(options) {\n this.processingEvent = false;\n this.queue = [];\n this.initialized = false;\n this.options = __assign(__assign({}, defaultOptions), options);\n }\n\n Scheduler.prototype.initialize = function (callback) {\n this.initialized = true;\n\n if (callback) {\n if (!this.options.deferEvents) {\n this.schedule(callback);\n return;\n }\n\n this.process(callback);\n }\n\n this.flushEvents();\n };\n\n Scheduler.prototype.schedule = function (task) {\n if (!this.initialized || this.processingEvent) {\n this.queue.push(task);\n return;\n }\n\n if (this.queue.length !== 0) {\n throw new Error('Event queue should be empty when it is not processing events');\n }\n\n this.process(task);\n this.flushEvents();\n };\n\n Scheduler.prototype.clear = function () {\n this.queue = [];\n };\n\n Scheduler.prototype.flushEvents = function () {\n var nextCallback = this.queue.shift();\n\n while (nextCallback) {\n this.process(nextCallback);\n nextCallback = this.queue.shift();\n }\n };\n\n Scheduler.prototype.process = function (callback) {\n this.processingEvent = true;\n\n try {\n callback();\n } catch (e) {\n // there is no use to keep the future events\n // as the situation is not anymore the same\n this.clear();\n throw e;\n } finally {\n this.processingEvent = false;\n }\n };\n\n return Scheduler;\n}();\n\nexport { Scheduler };\n", "var children = /*#__PURE__*/new Map();\nvar sessionIdIndex = 0;\nvar registry = {\n bookId: function () {\n return \"x:\".concat(sessionIdIndex++);\n },\n register: function (id, actor) {\n children.set(id, actor);\n return id;\n },\n get: function (id) {\n return children.get(id);\n },\n free: function (id) {\n children.delete(id);\n }\n};\n\nexport { registry };\n", "import { IS_PRODUCTION } from './environment.js';\n\nfunction getGlobal() {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof window !== 'undefined') {\n return window;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n }\n\n if (!IS_PRODUCTION) {\n console.warn('XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues');\n }\n}\n\nfunction getDevTools() {\n var global = getGlobal();\n\n if (global && '__xstate__' in global) {\n return global.__xstate__;\n }\n\n return undefined;\n}\n\nfunction registerService(service) {\n if (!getGlobal()) {\n return;\n }\n\n var devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n}\n\nexport { getGlobal, registerService };\n", "import { error, doneInvoke } from './actions.js';\nimport { toActorRef } from './Actor.js';\nimport { toObserver } from './utils.js';\n\n/**\r\n * Returns an actor behavior from a reducer and its initial state.\r\n *\r\n * @param transition The pure reducer that returns the next state given the current state and event.\r\n * @param initialState The initial state of the reducer.\r\n * @returns An actor behavior\r\n */\n\nfunction fromReducer(transition, initialState) {\n return {\n transition: transition,\n initialState: initialState\n };\n}\nfunction fromPromise(promiseFn) {\n var initialState = {\n error: undefined,\n data: undefined,\n status: 'pending'\n };\n return {\n transition: function (state, event, _a) {\n var parent = _a.parent,\n id = _a.id,\n observers = _a.observers;\n\n switch (event.type) {\n case 'fulfill':\n parent === null || parent === void 0 ? void 0 : parent.send(doneInvoke(id, event.data));\n return {\n error: undefined,\n data: event.data,\n status: 'fulfilled'\n };\n\n case 'reject':\n parent === null || parent === void 0 ? void 0 : parent.send(error(id, event.error));\n observers.forEach(function (observer) {\n observer.error(event.error);\n });\n return {\n error: event.error,\n data: undefined,\n status: 'rejected'\n };\n\n default:\n return state;\n }\n },\n initialState: initialState,\n start: function (_a) {\n var self = _a.self;\n promiseFn().then(function (data) {\n self.send({\n type: 'fulfill',\n data: data\n });\n }, function (reason) {\n self.send({\n type: 'reject',\n error: reason\n });\n });\n return initialState;\n }\n };\n}\nfunction spawnBehavior(behavior, options) {\n if (options === void 0) {\n options = {};\n }\n\n var state = behavior.initialState;\n var observers = new Set();\n var mailbox = [];\n var flushing = false;\n\n var flush = function () {\n if (flushing) {\n return;\n }\n\n flushing = true;\n\n while (mailbox.length > 0) {\n var event_1 = mailbox.shift();\n state = behavior.transition(state, event_1, actorCtx);\n observers.forEach(function (observer) {\n return observer.next(state);\n });\n }\n\n flushing = false;\n };\n\n var actor = toActorRef({\n id: options.id,\n send: function (event) {\n mailbox.push(event);\n flush();\n },\n getSnapshot: function () {\n return state;\n },\n subscribe: function (next, handleError, complete) {\n var observer = toObserver(next, handleError, complete);\n observers.add(observer);\n observer.next(state);\n return {\n unsubscribe: function () {\n observers.delete(observer);\n }\n };\n }\n });\n var actorCtx = {\n parent: options.parent,\n self: actor,\n id: options.id || 'anonymous',\n observers: observers\n };\n state = behavior.start ? behavior.start(actorCtx) : state;\n return actor;\n}\n\nexport { fromPromise, fromReducer, spawnBehavior };\n", "import { StateNode } from './StateNode.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar warned = false;\nfunction Machine(config, options, initialContext) {\n if (initialContext === void 0) {\n initialContext = config.context;\n }\n\n return new StateNode(config, options, initialContext);\n}\nfunction createMachine(config, options) {\n if (!IS_PRODUCTION && !('predictableActionArguments' in config) && !warned) {\n warned = true;\n console.warn('It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html');\n }\n\n return new StateNode(config, options);\n}\n\nexport { Machine, createMachine };\n", "import { __assign, __spreadArray, __read, __values, __rest } from './_virtual/_tslib.js';\nimport { isFunction, mapValues, isArray, flatten, toArray, toStateValue, isString, getEventType, toSCXMLEvent, matchesState, path, evaluateGuard, mapContext, isRaisableAction, pathToStateValue, isBuiltInEvent, partition, updateHistoryValue, toStatePath, mapFilterValues, warn, toStatePaths, nestedPath, normalizeTarget, toGuard, toTransitionConfigArray, isMachine, createInvokeId } from './utils.js';\nimport { State, stateValuesEqual } from './State.js';\nimport { start as start$1, stop as stop$1, invoke, update, nullEvent } from './actionTypes.js';\nimport { done, start, toActionObjects, raise, stop, resolveActions, doneInvoke, error, toActionObject, toActivityDefinition, after, send, cancel, initEvent } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { STATE_DELIMITER } from './constants.js';\nimport { getAllStateNodes, getConfiguration, isInFinalState, getTagsFromConfiguration, has, getChildren, getValue, isLeafNode, getAllChildren } from './stateUtils.js';\nimport { createInvocableActor } from './Actor.js';\nimport { toInvokeDefinition } from './invokeUtils.js';\n\nvar NULL_EVENT = '';\nvar STATE_IDENTIFIER = '#';\nvar WILDCARD = '*';\nvar EMPTY_OBJECT = {};\n\nvar isStateId = function (str) {\n return str[0] === STATE_IDENTIFIER;\n};\n\nvar createDefaultOptions = function () {\n return {\n actions: {},\n guards: {},\n services: {},\n activities: {},\n delays: {}\n };\n};\n\nvar validateArrayifiedTransitions = function (stateNode, event, transitions) {\n var hasNonLastUnguardedTarget = transitions.slice(0, -1).some(function (transition) {\n return !('cond' in transition) && !('in' in transition) && (isString(transition.target) || isMachine(transition.target));\n });\n var eventText = event === NULL_EVENT ? 'the transient event' : \"event '\".concat(event, \"'\");\n warn(!hasNonLastUnguardedTarget, \"One or more transitions for \".concat(eventText, \" on state '\").concat(stateNode.id, \"' are unreachable. \") + \"Make sure that the default transition is the last one defined.\");\n};\n\nvar StateNode =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function StateNode(\n /**\r\n * The raw config used to create the machine.\r\n */\n config, options,\n /**\r\n * The initial extended state\r\n */\n _context, // TODO: this is unsafe, but we're removing it in v5 anyway\n _stateInfo) {\n if (_context === void 0) {\n _context = 'context' in config ? config.context : undefined;\n }\n\n var _this = this;\n\n var _a;\n\n this.config = config;\n this._context = _context;\n /**\r\n * The order this state node appears. Corresponds to the implicit SCXML document order.\r\n */\n\n this.order = -1;\n this.__xstatenode = true;\n this.__cache = {\n events: undefined,\n relativeValue: new Map(),\n initialStateValue: undefined,\n initialState: undefined,\n on: undefined,\n transitions: undefined,\n candidates: {},\n delayedTransitions: undefined\n };\n this.idMap = {};\n this.tags = [];\n this.options = Object.assign(createDefaultOptions(), options);\n this.parent = _stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.parent;\n this.key = this.config.key || (_stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.key) || this.config.id || '(machine)';\n this.machine = this.parent ? this.parent.machine : this;\n this.path = this.parent ? this.parent.path.concat(this.key) : [];\n this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : STATE_DELIMITER);\n this.id = this.config.id || __spreadArray([this.machine.key], __read(this.path), false).join(this.delimiter);\n this.version = this.parent ? this.parent.version : this.config.version;\n this.type = this.config.type || (this.config.parallel ? 'parallel' : this.config.states && Object.keys(this.config.states).length ? 'compound' : this.config.history ? 'history' : 'atomic');\n this.schema = this.parent ? this.machine.schema : (_a = this.config.schema) !== null && _a !== void 0 ? _a : {};\n this.description = this.config.description;\n\n if (!IS_PRODUCTION) {\n warn(!('parallel' in this.config), \"The \\\"parallel\\\" property is deprecated and will be removed in version 4.1. \".concat(this.config.parallel ? \"Replace with `type: 'parallel'`\" : \"Use `type: '\".concat(this.type, \"'`\"), \" in the config for state node '\").concat(this.id, \"' instead.\"));\n }\n\n this.initial = this.config.initial;\n this.states = this.config.states ? mapValues(this.config.states, function (stateConfig, key) {\n var _a;\n\n var stateNode = new StateNode(stateConfig, {}, undefined, {\n parent: _this,\n key: key\n });\n Object.assign(_this.idMap, __assign((_a = {}, _a[stateNode.id] = stateNode, _a), stateNode.idMap));\n return stateNode;\n }) : EMPTY_OBJECT; // Document order\n\n var order = 0;\n\n function dfs(stateNode) {\n var e_1, _a;\n\n stateNode.order = order++;\n\n try {\n for (var _b = __values(getAllChildren(stateNode)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var child = _c.value;\n dfs(child);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n }\n\n dfs(this); // History config\n\n this.history = this.config.history === true ? 'shallow' : this.config.history || false;\n this._transient = !!this.config.always || (!this.config.on ? false : Array.isArray(this.config.on) ? this.config.on.some(function (_a) {\n var event = _a.event;\n return event === NULL_EVENT;\n }) : NULL_EVENT in this.config.on);\n this.strict = !!this.config.strict; // TODO: deprecate (entry)\n\n this.onEntry = toArray(this.config.entry || this.config.onEntry).map(function (action) {\n return toActionObject(action);\n }); // TODO: deprecate (exit)\n\n this.onExit = toArray(this.config.exit || this.config.onExit).map(function (action) {\n return toActionObject(action);\n });\n this.meta = this.config.meta;\n this.doneData = this.type === 'final' ? this.config.data : undefined;\n this.invoke = toArray(this.config.invoke).map(function (invokeConfig, i) {\n var _a, _b;\n\n if (isMachine(invokeConfig)) {\n var invokeId = createInvokeId(_this.id, i);\n _this.machine.options.services = __assign((_a = {}, _a[invokeId] = invokeConfig, _a), _this.machine.options.services);\n return toInvokeDefinition({\n src: invokeId,\n id: invokeId\n });\n } else if (isString(invokeConfig.src)) {\n var invokeId = invokeConfig.id || createInvokeId(_this.id, i);\n return toInvokeDefinition(__assign(__assign({}, invokeConfig), {\n id: invokeId,\n src: invokeConfig.src\n }));\n } else if (isMachine(invokeConfig.src) || isFunction(invokeConfig.src)) {\n var invokeId = invokeConfig.id || createInvokeId(_this.id, i);\n _this.machine.options.services = __assign((_b = {}, _b[invokeId] = invokeConfig.src, _b), _this.machine.options.services);\n return toInvokeDefinition(__assign(__assign({\n id: invokeId\n }, invokeConfig), {\n src: invokeId\n }));\n } else {\n var invokeSource = invokeConfig.src;\n return toInvokeDefinition(__assign(__assign({\n id: createInvokeId(_this.id, i)\n }, invokeConfig), {\n src: invokeSource\n }));\n }\n });\n this.activities = toArray(this.config.activities).concat(this.invoke).map(function (activity) {\n return toActivityDefinition(activity);\n });\n this.transition = this.transition.bind(this);\n this.tags = toArray(this.config.tags); // TODO: this is the real fix for initialization once\n // state node getters are deprecated\n // if (!this.parent) {\n // this._init();\n // }\n }\n\n StateNode.prototype._init = function () {\n if (this.__cache.transitions) {\n return;\n }\n\n getAllStateNodes(this).forEach(function (stateNode) {\n return stateNode.on;\n });\n };\n /**\r\n * Clones this state machine with custom options and context.\r\n *\r\n * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.\r\n * @param context Custom context (will override predefined context)\r\n */\n\n\n StateNode.prototype.withConfig = function (options, context) {\n var _a = this.options,\n actions = _a.actions,\n activities = _a.activities,\n guards = _a.guards,\n services = _a.services,\n delays = _a.delays;\n return new StateNode(this.config, {\n actions: __assign(__assign({}, actions), options.actions),\n activities: __assign(__assign({}, activities), options.activities),\n guards: __assign(__assign({}, guards), options.guards),\n services: __assign(__assign({}, services), options.services),\n delays: __assign(__assign({}, delays), options.delays)\n }, context !== null && context !== void 0 ? context : this.context);\n };\n /**\r\n * Clones this state machine with custom context.\r\n *\r\n * @param context Custom context (will override predefined context, not recursive)\r\n */\n\n\n StateNode.prototype.withContext = function (context) {\n return new StateNode(this.config, this.options, context);\n };\n\n Object.defineProperty(StateNode.prototype, \"context\", {\n get: function () {\n return isFunction(this._context) ? this._context() : this._context;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"definition\", {\n /**\r\n * The well-structured state node definition.\r\n */\n get: function () {\n return {\n id: this.id,\n key: this.key,\n version: this.version,\n context: this.context,\n type: this.type,\n initial: this.initial,\n history: this.history,\n states: mapValues(this.states, function (state) {\n return state.definition;\n }),\n on: this.on,\n transitions: this.transitions,\n entry: this.onEntry,\n exit: this.onExit,\n activities: this.activities || [],\n meta: this.meta,\n order: this.order || -1,\n data: this.doneData,\n invoke: this.invoke,\n description: this.description,\n tags: this.tags\n };\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.toJSON = function () {\n return this.definition;\n };\n\n Object.defineProperty(StateNode.prototype, \"on\", {\n /**\r\n * The mapping of events to transitions.\r\n */\n get: function () {\n if (this.__cache.on) {\n return this.__cache.on;\n }\n\n var transitions = this.transitions;\n return this.__cache.on = transitions.reduce(function (map, transition) {\n map[transition.eventType] = map[transition.eventType] || [];\n map[transition.eventType].push(transition);\n return map;\n }, {});\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"after\", {\n get: function () {\n return this.__cache.delayedTransitions || (this.__cache.delayedTransitions = this.getDelayedTransitions(), this.__cache.delayedTransitions);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"transitions\", {\n /**\r\n * All the transitions that can be taken from this state node.\r\n */\n get: function () {\n return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.getCandidates = function (eventName) {\n if (this.__cache.candidates[eventName]) {\n return this.__cache.candidates[eventName];\n }\n\n var transient = eventName === NULL_EVENT;\n var candidates = this.transitions.filter(function (transition) {\n var sameEventType = transition.eventType === eventName; // null events should only match against eventless transitions\n\n return transient ? sameEventType : sameEventType || transition.eventType === WILDCARD;\n });\n this.__cache.candidates[eventName] = candidates;\n return candidates;\n };\n /**\r\n * All delayed transitions from the config.\r\n */\n\n\n StateNode.prototype.getDelayedTransitions = function () {\n var _this = this;\n\n var afterConfig = this.config.after;\n\n if (!afterConfig) {\n return [];\n }\n\n var mutateEntryExit = function (delay, i) {\n var delayRef = isFunction(delay) ? \"\".concat(_this.id, \":delay[\").concat(i, \"]\") : delay;\n var eventType = after(delayRef, _this.id);\n\n _this.onEntry.push(send(eventType, {\n delay: delay\n }));\n\n _this.onExit.push(cancel(eventType));\n\n return eventType;\n };\n\n var delayedTransitions = isArray(afterConfig) ? afterConfig.map(function (transition, i) {\n var eventType = mutateEntryExit(transition.delay, i);\n return __assign(__assign({}, transition), {\n event: eventType\n });\n }) : flatten(Object.keys(afterConfig).map(function (delay, i) {\n var configTransition = afterConfig[delay];\n var resolvedTransition = isString(configTransition) ? {\n target: configTransition\n } : configTransition;\n var resolvedDelay = !isNaN(+delay) ? +delay : delay;\n var eventType = mutateEntryExit(resolvedDelay, i);\n return toArray(resolvedTransition).map(function (transition) {\n return __assign(__assign({}, transition), {\n event: eventType,\n delay: resolvedDelay\n });\n });\n }));\n return delayedTransitions.map(function (delayedTransition) {\n var delay = delayedTransition.delay;\n return __assign(__assign({}, _this.formatTransition(delayedTransition)), {\n delay: delay\n });\n });\n };\n /**\r\n * Returns the state nodes represented by the current state value.\r\n *\r\n * @param state The state value or State instance\r\n */\n\n\n StateNode.prototype.getStateNodes = function (state) {\n var _a;\n\n var _this = this;\n\n if (!state) {\n return [];\n }\n\n var stateValue = state instanceof State ? state.value : toStateValue(state, this.delimiter);\n\n if (isString(stateValue)) {\n var initialStateValue = this.getStateNode(stateValue).initial;\n return initialStateValue !== undefined ? this.getStateNodes((_a = {}, _a[stateValue] = initialStateValue, _a)) : [this, this.states[stateValue]];\n }\n\n var subStateKeys = Object.keys(stateValue);\n var subStateNodes = [this];\n subStateNodes.push.apply(subStateNodes, __spreadArray([], __read(flatten(subStateKeys.map(function (subStateKey) {\n return _this.getStateNode(subStateKey).getStateNodes(stateValue[subStateKey]);\n }))), false));\n return subStateNodes;\n };\n /**\r\n * Returns `true` if this state node explicitly handles the given event.\r\n *\r\n * @param event The event in question\r\n */\n\n\n StateNode.prototype.handles = function (event) {\n var eventType = getEventType(event);\n return this.events.includes(eventType);\n };\n /**\r\n * Resolves the given `state` to a new `State` instance relative to this machine.\r\n *\r\n * This ensures that `.events` and `.nextEvents` represent the correct values.\r\n *\r\n * @param state The state to resolve\r\n */\n\n\n StateNode.prototype.resolveState = function (state) {\n var stateFromConfig = state instanceof State ? state : State.create(state);\n var configuration = Array.from(getConfiguration([], this.getStateNodes(stateFromConfig.value)));\n return new State(__assign(__assign({}, stateFromConfig), {\n value: this.resolve(stateFromConfig.value),\n configuration: configuration,\n done: isInFinalState(configuration, this),\n tags: getTagsFromConfiguration(configuration),\n machine: this.machine\n }));\n };\n\n StateNode.prototype.transitionLeafNode = function (stateValue, state, _event) {\n var stateNode = this.getStateNode(stateValue);\n var next = stateNode.next(state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionCompoundNode = function (stateValue, state, _event) {\n var subStateKeys = Object.keys(stateValue);\n var stateNode = this.getStateNode(subStateKeys[0]);\n\n var next = stateNode._transition(stateValue[subStateKeys[0]], state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionParallelNode = function (stateValue, state, _event) {\n var e_2, _a;\n\n var transitionMap = {};\n\n try {\n for (var _b = __values(Object.keys(stateValue)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var subStateKey = _c.value;\n var subStateValue = stateValue[subStateKey];\n\n if (!subStateValue) {\n continue;\n }\n\n var subStateNode = this.getStateNode(subStateKey);\n\n var next = subStateNode._transition(subStateValue, state, _event);\n\n if (next) {\n transitionMap[subStateKey] = next;\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n var stateTransitions = Object.keys(transitionMap).map(function (key) {\n return transitionMap[key];\n });\n var enabledTransitions = flatten(stateTransitions.map(function (st) {\n return st.transitions;\n }));\n var willTransition = stateTransitions.some(function (st) {\n return st.transitions.length > 0;\n });\n\n if (!willTransition) {\n return this.next(state, _event);\n }\n\n var configuration = flatten(Object.keys(transitionMap).map(function (key) {\n return transitionMap[key].configuration;\n }));\n return {\n transitions: enabledTransitions,\n exitSet: flatten(stateTransitions.map(function (t) {\n return t.exitSet;\n })),\n configuration: configuration,\n source: state,\n actions: flatten(Object.keys(transitionMap).map(function (key) {\n return transitionMap[key].actions;\n }))\n };\n };\n\n StateNode.prototype._transition = function (stateValue, state, _event) {\n // leaf node\n if (isString(stateValue)) {\n return this.transitionLeafNode(stateValue, state, _event);\n } // hierarchical node\n\n\n if (Object.keys(stateValue).length === 1) {\n return this.transitionCompoundNode(stateValue, state, _event);\n } // orthogonal node\n\n\n return this.transitionParallelNode(stateValue, state, _event);\n };\n\n StateNode.prototype.getTransitionData = function (state, event) {\n return this._transition(state.value, state, toSCXMLEvent(event));\n };\n\n StateNode.prototype.next = function (state, _event) {\n var e_3, _a;\n\n var _this = this;\n\n var eventName = _event.name;\n var actions = [];\n var nextStateNodes = [];\n var selectedTransition;\n\n try {\n for (var _b = __values(this.getCandidates(eventName)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var candidate = _c.value;\n var cond = candidate.cond,\n stateIn = candidate.in;\n var resolvedContext = state.context;\n var isInState = stateIn ? isString(stateIn) && isStateId(stateIn) ? // Check if in state by ID\n state.matches(toStateValue(this.getStateNodeById(stateIn).path, this.delimiter)) : // Check if in state by relative grandparent\n matchesState(toStateValue(stateIn, this.delimiter), path(this.path.slice(0, -2))(state.value)) : true;\n var guardPassed = false;\n\n try {\n guardPassed = !cond || evaluateGuard(this.machine, cond, resolvedContext, _event, state);\n } catch (err) {\n throw new Error(\"Unable to evaluate guard '\".concat(cond.name || cond.type, \"' in transition for event '\").concat(eventName, \"' in state node '\").concat(this.id, \"':\\n\").concat(err.message));\n }\n\n if (guardPassed && isInState) {\n if (candidate.target !== undefined) {\n nextStateNodes = candidate.target;\n }\n\n actions.push.apply(actions, __spreadArray([], __read(candidate.actions), false));\n selectedTransition = candidate;\n break;\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n if (!selectedTransition) {\n return undefined;\n }\n\n if (!nextStateNodes.length) {\n return {\n transitions: [selectedTransition],\n exitSet: [],\n configuration: state.value ? [this] : [],\n source: state,\n actions: actions\n };\n }\n\n var allNextStateNodes = flatten(nextStateNodes.map(function (stateNode) {\n return _this.getRelativeStateNodes(stateNode, state.historyValue);\n }));\n var isInternal = !!selectedTransition.internal;\n return {\n transitions: [selectedTransition],\n exitSet: isInternal ? [] : flatten(nextStateNodes.map(function (targetNode) {\n return _this.getPotentiallyReenteringNodes(targetNode);\n })),\n configuration: allNextStateNodes,\n source: state,\n actions: actions\n };\n }; // even though the name of this function mentions reentry nodes\n // we are pushing its result into `exitSet`\n // that's because what we exit might be reentered (it's an invariant of reentrancy)\n\n\n StateNode.prototype.getPotentiallyReenteringNodes = function (targetNode) {\n if (this.order < targetNode.order) {\n return [this];\n }\n\n var nodes = [];\n var marker = this;\n var possibleAncestor = targetNode;\n\n while (marker && marker !== possibleAncestor) {\n nodes.push(marker);\n marker = marker.parent;\n }\n\n if (marker !== possibleAncestor) {\n // we never got to `possibleAncestor`, therefore the initial `marker` \"escapes\" it\n // it's in a different part of the tree so no states will be reentered for such an external transition\n return [];\n }\n\n nodes.push(possibleAncestor);\n return nodes;\n };\n\n StateNode.prototype.getActions = function (resolvedConfig, isDone, transition, currentContext, _event, prevState, predictableExec) {\n var e_4, _a, e_5, _b;\n\n var _this = this;\n\n var prevConfig = prevState ? getConfiguration([], this.getStateNodes(prevState.value)) : [];\n var entrySet = new Set();\n\n try {\n for (var _c = __values(Array.from(resolvedConfig).sort(function (a, b) {\n return a.order - b.order;\n })), _d = _c.next(); !_d.done; _d = _c.next()) {\n var sn = _d.value;\n\n if (!has(prevConfig, sn) || has(transition.exitSet, sn) || sn.parent && entrySet.has(sn.parent)) {\n entrySet.add(sn);\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n try {\n for (var prevConfig_1 = __values(prevConfig), prevConfig_1_1 = prevConfig_1.next(); !prevConfig_1_1.done; prevConfig_1_1 = prevConfig_1.next()) {\n var sn = prevConfig_1_1.value;\n\n if (!has(resolvedConfig, sn) || has(transition.exitSet, sn.parent)) {\n transition.exitSet.push(sn);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (prevConfig_1_1 && !prevConfig_1_1.done && (_b = prevConfig_1.return)) _b.call(prevConfig_1);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n transition.exitSet.sort(function (a, b) {\n return b.order - a.order;\n });\n var entryStates = Array.from(entrySet).sort(function (a, b) {\n return a.order - b.order;\n });\n var exitStates = new Set(transition.exitSet);\n var doneEvents = flatten(entryStates.map(function (sn) {\n var events = [];\n\n if (sn.type !== 'final') {\n return events;\n }\n\n var parent = sn.parent;\n\n if (!parent.parent) {\n return events;\n }\n\n events.push(done(sn.id, sn.doneData), // TODO: deprecate - final states should not emit done events for their own state.\n done(parent.id, sn.doneData ? mapContext(sn.doneData, currentContext, _event) : undefined));\n var grandparent = parent.parent;\n\n if (grandparent.type === 'parallel') {\n if (getChildren(grandparent).every(function (parentNode) {\n return isInFinalState(transition.configuration, parentNode);\n })) {\n events.push(done(grandparent.id));\n }\n }\n\n return events;\n }));\n var entryActions = entryStates.map(function (stateNode) {\n var entryActions = stateNode.onEntry;\n var invokeActions = stateNode.activities.map(function (activity) {\n return start(activity);\n });\n return {\n type: 'entry',\n actions: toActionObjects(predictableExec ? __spreadArray(__spreadArray([], __read(entryActions), false), __read(invokeActions), false) : __spreadArray(__spreadArray([], __read(invokeActions), false), __read(entryActions), false), _this.machine.options.actions)\n };\n }).concat({\n type: 'state_done',\n actions: doneEvents.map(function (event) {\n return raise(event);\n })\n });\n var exitActions = Array.from(exitStates).map(function (stateNode) {\n return {\n type: 'exit',\n actions: toActionObjects(__spreadArray(__spreadArray([], __read(stateNode.onExit), false), __read(stateNode.activities.map(function (activity) {\n return stop(activity);\n })), false), _this.machine.options.actions)\n };\n });\n var actions = exitActions.concat({\n type: 'transition',\n actions: toActionObjects(transition.actions, this.machine.options.actions)\n }).concat(entryActions);\n\n if (isDone) {\n var stopActions = toActionObjects(flatten(__spreadArray([], __read(resolvedConfig), false).sort(function (a, b) {\n return b.order - a.order;\n }).map(function (stateNode) {\n return stateNode.onExit;\n })), this.machine.options.actions).filter(function (action) {\n return !isRaisableAction(action);\n });\n return actions.concat({\n type: 'stop',\n actions: stopActions\n });\n }\n\n return actions;\n };\n /**\r\n * Determines the next state given the current `state` and sent `event`.\r\n *\r\n * @param state The current State instance or state value\r\n * @param event The event that was sent at the current state\r\n * @param context The current context (extended state) of the current state\r\n */\n\n\n StateNode.prototype.transition = function (state, event, context, exec) {\n if (state === void 0) {\n state = this.initialState;\n }\n\n var _event = toSCXMLEvent(event);\n\n var currentState;\n\n if (state instanceof State) {\n currentState = context === undefined ? state : this.resolveState(State.from(state, context));\n } else {\n var resolvedStateValue = isString(state) ? this.resolve(pathToStateValue(this.getResolvedPath(state))) : this.resolve(state);\n var resolvedContext = context !== null && context !== void 0 ? context : this.machine.context;\n currentState = this.resolveState(State.from(resolvedStateValue, resolvedContext));\n }\n\n if (!IS_PRODUCTION && _event.name === WILDCARD) {\n throw new Error(\"An event cannot have the wildcard type ('\".concat(WILDCARD, \"')\"));\n }\n\n if (this.strict) {\n if (!this.events.includes(_event.name) && !isBuiltInEvent(_event.name)) {\n throw new Error(\"Machine '\".concat(this.id, \"' does not accept event '\").concat(_event.name, \"'\"));\n }\n }\n\n var stateTransition = this._transition(currentState.value, currentState, _event) || {\n transitions: [],\n configuration: [],\n exitSet: [],\n source: currentState,\n actions: []\n };\n var prevConfig = getConfiguration([], this.getStateNodes(currentState.value));\n var resolvedConfig = stateTransition.configuration.length ? getConfiguration(prevConfig, stateTransition.configuration) : prevConfig;\n stateTransition.configuration = __spreadArray([], __read(resolvedConfig), false);\n return this.resolveTransition(stateTransition, currentState, currentState.context, exec, _event);\n };\n\n StateNode.prototype.resolveRaisedTransition = function (state, _event, originalEvent, predictableExec) {\n var _a;\n\n var currentActions = state.actions;\n state = this.transition(state, _event, undefined, predictableExec); // Save original event to state\n // TODO: this should be the raised event! Delete in V5 (breaking)\n\n state._event = originalEvent;\n state.event = originalEvent.data;\n\n (_a = state.actions).unshift.apply(_a, __spreadArray([], __read(currentActions), false));\n\n return state;\n };\n\n StateNode.prototype.resolveTransition = function (stateTransition, currentState, context, predictableExec, _event) {\n var e_6, _a, e_7, _b;\n\n var _this = this;\n\n if (_event === void 0) {\n _event = initEvent;\n }\n\n var configuration = stateTransition.configuration; // Transition will \"apply\" if:\n // - this is the initial state (there is no current state)\n // - OR there are transitions\n\n var willTransition = !currentState || stateTransition.transitions.length > 0;\n var resolvedConfiguration = willTransition ? stateTransition.configuration : currentState ? currentState.configuration : [];\n var isDone = isInFinalState(resolvedConfiguration, this);\n var resolvedStateValue = willTransition ? getValue(this.machine, configuration) : undefined;\n var historyValue = currentState ? currentState.historyValue ? currentState.historyValue : stateTransition.source ? this.machine.historyValue(currentState.value) : undefined : undefined;\n var actionBlocks = this.getActions(new Set(resolvedConfiguration), isDone, stateTransition, context, _event, currentState, predictableExec);\n var activities = currentState ? __assign({}, currentState.activities) : {};\n\n try {\n for (var actionBlocks_1 = __values(actionBlocks), actionBlocks_1_1 = actionBlocks_1.next(); !actionBlocks_1_1.done; actionBlocks_1_1 = actionBlocks_1.next()) {\n var block = actionBlocks_1_1.value;\n\n try {\n for (var _c = (e_7 = void 0, __values(block.actions)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var action = _d.value;\n\n if (action.type === start$1) {\n activities[action.activity.id || action.activity.type] = action;\n } else if (action.type === stop$1) {\n activities[action.activity.id || action.activity.type] = false;\n }\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_b = _c.return)) _b.call(_c);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (actionBlocks_1_1 && !actionBlocks_1_1.done && (_a = actionBlocks_1.return)) _a.call(actionBlocks_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n var _e = __read(resolveActions(this, currentState, context, _event, actionBlocks, predictableExec, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2),\n resolvedActions = _e[0],\n updatedContext = _e[1];\n\n var _f = __read(partition(resolvedActions, isRaisableAction), 2),\n raisedEvents = _f[0],\n nonRaisedActions = _f[1];\n\n var invokeActions = resolvedActions.filter(function (action) {\n var _a;\n\n return action.type === start$1 && ((_a = action.activity) === null || _a === void 0 ? void 0 : _a.type) === invoke;\n });\n var children = invokeActions.reduce(function (acc, action) {\n acc[action.activity.id] = createInvocableActor(action.activity, _this.machine, updatedContext, _event);\n return acc;\n }, currentState ? __assign({}, currentState.children) : {});\n var nextState = new State({\n value: resolvedStateValue || currentState.value,\n context: updatedContext,\n _event: _event,\n // Persist _sessionid between states\n _sessionid: currentState ? currentState._sessionid : null,\n historyValue: resolvedStateValue ? historyValue ? updateHistoryValue(historyValue, resolvedStateValue) : undefined : currentState ? currentState.historyValue : undefined,\n history: !resolvedStateValue || stateTransition.source ? currentState : undefined,\n actions: resolvedStateValue ? nonRaisedActions : [],\n activities: resolvedStateValue ? activities : currentState ? currentState.activities : {},\n events: [],\n configuration: resolvedConfiguration,\n transitions: stateTransition.transitions,\n children: children,\n done: isDone,\n tags: getTagsFromConfiguration(resolvedConfiguration),\n machine: this\n });\n var didUpdateContext = context !== updatedContext;\n nextState.changed = _event.name === update || didUpdateContext; // Dispose of penultimate histories to prevent memory leaks\n\n var history = nextState.history;\n\n if (history) {\n delete history.history;\n } // There are transient transitions if the machine is not in a final state\n // and if some of the state nodes have transient (\"always\") transitions.\n\n\n var hasAlwaysTransitions = !isDone && (this._transient || configuration.some(function (stateNode) {\n return stateNode._transient;\n })); // If there are no enabled transitions, check if there are transient transitions.\n // If there are transient transitions, continue checking for more transitions\n // because an transient transition should be triggered even if there are no\n // enabled transitions.\n //\n // If we're already working on an transient transition then stop to prevent an infinite loop.\n //\n // Otherwise, if there are no enabled nor transient transitions, we are done.\n\n if (!willTransition && (!hasAlwaysTransitions || _event.name === NULL_EVENT)) {\n return nextState;\n }\n\n var maybeNextState = nextState;\n\n if (!isDone) {\n if (hasAlwaysTransitions) {\n maybeNextState = this.resolveRaisedTransition(maybeNextState, {\n type: nullEvent\n }, _event, predictableExec);\n }\n\n while (raisedEvents.length) {\n var raisedEvent = raisedEvents.shift();\n maybeNextState = this.resolveRaisedTransition(maybeNextState, raisedEvent._event, _event, predictableExec);\n }\n } // Detect if state changed\n\n\n var changed = maybeNextState.changed || (history ? !!maybeNextState.actions.length || didUpdateContext || typeof history.value !== typeof maybeNextState.value || !stateValuesEqual(maybeNextState.value, history.value) : undefined);\n maybeNextState.changed = changed; // Preserve original history after raised events\n\n maybeNextState.history = history;\n return maybeNextState;\n };\n /**\r\n * Returns the child state node from its relative `stateKey`, or throws.\r\n */\n\n\n StateNode.prototype.getStateNode = function (stateKey) {\n if (isStateId(stateKey)) {\n return this.machine.getStateNodeById(stateKey);\n }\n\n if (!this.states) {\n throw new Error(\"Unable to retrieve child state '\".concat(stateKey, \"' from '\").concat(this.id, \"'; no child states exist.\"));\n }\n\n var result = this.states[stateKey];\n\n if (!result) {\n throw new Error(\"Child state '\".concat(stateKey, \"' does not exist on '\").concat(this.id, \"'\"));\n }\n\n return result;\n };\n /**\r\n * Returns the state node with the given `stateId`, or throws.\r\n *\r\n * @param stateId The state ID. The prefix \"#\" is removed.\r\n */\n\n\n StateNode.prototype.getStateNodeById = function (stateId) {\n var resolvedStateId = isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;\n\n if (resolvedStateId === this.id) {\n return this;\n }\n\n var stateNode = this.machine.idMap[resolvedStateId];\n\n if (!stateNode) {\n throw new Error(\"Child state node '#\".concat(resolvedStateId, \"' does not exist on machine '\").concat(this.id, \"'\"));\n }\n\n return stateNode;\n };\n /**\r\n * Returns the relative state node from the given `statePath`, or throws.\r\n *\r\n * @param statePath The string or string array relative path to the state node.\r\n */\n\n\n StateNode.prototype.getStateNodeByPath = function (statePath) {\n if (typeof statePath === 'string' && isStateId(statePath)) {\n try {\n return this.getStateNodeById(statePath.slice(1));\n } catch (e) {// try individual paths\n // throw e;\n }\n }\n\n var arrayStatePath = toStatePath(statePath, this.delimiter).slice();\n var currentStateNode = this;\n\n while (arrayStatePath.length) {\n var key = arrayStatePath.shift();\n\n if (!key.length) {\n break;\n }\n\n currentStateNode = currentStateNode.getStateNode(key);\n }\n\n return currentStateNode;\n };\n /**\r\n * Resolves a partial state value with its full representation in this machine.\r\n *\r\n * @param stateValue The partial state value to resolve.\r\n */\n\n\n StateNode.prototype.resolve = function (stateValue) {\n var _a;\n\n var _this = this;\n\n if (!stateValue) {\n return this.initialStateValue || EMPTY_OBJECT; // TODO: type-specific properties\n }\n\n switch (this.type) {\n case 'parallel':\n return mapValues(this.initialStateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(stateValue[subStateKey] || subStateValue) : EMPTY_OBJECT;\n });\n\n case 'compound':\n if (isString(stateValue)) {\n var subStateNode = this.getStateNode(stateValue);\n\n if (subStateNode.type === 'parallel' || subStateNode.type === 'compound') {\n return _a = {}, _a[stateValue] = subStateNode.initialStateValue, _a;\n }\n\n return stateValue;\n }\n\n if (!Object.keys(stateValue).length) {\n return this.initialStateValue || {};\n }\n\n return mapValues(stateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(subStateValue) : EMPTY_OBJECT;\n });\n\n default:\n return stateValue || EMPTY_OBJECT;\n }\n };\n\n StateNode.prototype.getResolvedPath = function (stateIdentifier) {\n if (isStateId(stateIdentifier)) {\n var stateNode = this.machine.idMap[stateIdentifier.slice(STATE_IDENTIFIER.length)];\n\n if (!stateNode) {\n throw new Error(\"Unable to find state node '\".concat(stateIdentifier, \"'\"));\n }\n\n return stateNode.path;\n }\n\n return toStatePath(stateIdentifier, this.delimiter);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateValue\", {\n get: function () {\n var _a;\n\n if (this.__cache.initialStateValue) {\n return this.__cache.initialStateValue;\n }\n\n var initialStateValue;\n\n if (this.type === 'parallel') {\n initialStateValue = mapFilterValues(this.states, function (state) {\n return state.initialStateValue || EMPTY_OBJECT;\n }, function (stateNode) {\n return !(stateNode.type === 'history');\n });\n } else if (this.initial !== undefined) {\n if (!this.states[this.initial]) {\n throw new Error(\"Initial state '\".concat(this.initial, \"' not found on '\").concat(this.key, \"'\"));\n }\n\n initialStateValue = isLeafNode(this.states[this.initial]) ? this.initial : (_a = {}, _a[this.initial] = this.states[this.initial].initialStateValue, _a);\n } else {\n // The finite state value of a machine without child states is just an empty object\n initialStateValue = {};\n }\n\n this.__cache.initialStateValue = initialStateValue;\n return this.__cache.initialStateValue;\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.getInitialState = function (stateValue, context) {\n this._init(); // TODO: this should be in the constructor (see note in constructor)\n\n\n var configuration = this.getStateNodes(stateValue);\n return this.resolveTransition({\n configuration: configuration,\n exitSet: [],\n transitions: [],\n source: undefined,\n actions: []\n }, undefined, context !== null && context !== void 0 ? context : this.machine.context, undefined);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialState\", {\n /**\r\n * The initial State instance, which includes all actions to be executed from\r\n * entering the initial state.\r\n */\n get: function () {\n var initialStateValue = this.initialStateValue;\n\n if (!initialStateValue) {\n throw new Error(\"Cannot retrieve initial state from simple state '\".concat(this.id, \"'.\"));\n }\n\n return this.getInitialState(initialStateValue);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"target\", {\n /**\r\n * The target state value of the history state node, if it exists. This represents the\r\n * default state value to transition to if no history value exists yet.\r\n */\n get: function () {\n var target;\n\n if (this.type === 'history') {\n var historyConfig = this.config;\n\n if (isString(historyConfig.target)) {\n target = isStateId(historyConfig.target) ? pathToStateValue(this.machine.getStateNodeById(historyConfig.target).path.slice(this.path.length - 1)) : historyConfig.target;\n } else {\n target = historyConfig.target;\n }\n }\n\n return target;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Returns the leaf nodes from a state path relative to this state node.\r\n *\r\n * @param relativeStateId The relative state path to retrieve the state nodes\r\n * @param history The previous state to retrieve history\r\n * @param resolve Whether state nodes should resolve to initial child state nodes\r\n */\n\n StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {\n if (resolve === void 0) {\n resolve = true;\n }\n\n return resolve ? relativeStateId.type === 'history' ? relativeStateId.resolveHistory(historyValue) : relativeStateId.initialStateNodes : [relativeStateId];\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateNodes\", {\n get: function () {\n var _this = this;\n\n if (isLeafNode(this)) {\n return [this];\n } // Case when state node is compound but no initial state is defined\n\n\n if (this.type === 'compound' && !this.initial) {\n if (!IS_PRODUCTION) {\n warn(false, \"Compound state node '\".concat(this.id, \"' has no initial state.\"));\n }\n\n return [this];\n }\n\n var initialStateNodePaths = toStatePaths(this.initialStateValue);\n return flatten(initialStateNodePaths.map(function (initialPath) {\n return _this.getFromRelativePath(initialPath);\n }));\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Retrieves state nodes from a relative path to this state node.\r\n *\r\n * @param relativePath The relative path from this state node\r\n * @param historyValue\r\n */\n\n StateNode.prototype.getFromRelativePath = function (relativePath) {\n if (!relativePath.length) {\n return [this];\n }\n\n var _a = __read(relativePath),\n stateKey = _a[0],\n childStatePath = _a.slice(1);\n\n if (!this.states) {\n throw new Error(\"Cannot retrieve subPath '\".concat(stateKey, \"' from node with no states\"));\n }\n\n var childStateNode = this.getStateNode(stateKey);\n\n if (childStateNode.type === 'history') {\n return childStateNode.resolveHistory();\n }\n\n if (!this.states[stateKey]) {\n throw new Error(\"Child state '\".concat(stateKey, \"' does not exist on '\").concat(this.id, \"'\"));\n }\n\n return this.states[stateKey].getFromRelativePath(childStatePath);\n };\n\n StateNode.prototype.historyValue = function (relativeStateValue) {\n if (!Object.keys(this.states).length) {\n return undefined;\n }\n\n return {\n current: relativeStateValue || this.initialStateValue,\n states: mapFilterValues(this.states, function (stateNode, key) {\n if (!relativeStateValue) {\n return stateNode.historyValue();\n }\n\n var subStateValue = isString(relativeStateValue) ? undefined : relativeStateValue[key];\n return stateNode.historyValue(subStateValue || stateNode.initialStateValue);\n }, function (stateNode) {\n return !stateNode.history;\n })\n };\n };\n /**\r\n * Resolves to the historical value(s) of the parent state node,\r\n * represented by state nodes.\r\n *\r\n * @param historyValue\r\n */\n\n\n StateNode.prototype.resolveHistory = function (historyValue) {\n var _this = this;\n\n if (this.type !== 'history') {\n return [this];\n }\n\n var parent = this.parent;\n\n if (!historyValue) {\n var historyTarget = this.target;\n return historyTarget ? flatten(toStatePaths(historyTarget).map(function (relativeChildPath) {\n return parent.getFromRelativePath(relativeChildPath);\n })) : parent.initialStateNodes;\n }\n\n var subHistoryValue = nestedPath(parent.path, 'states')(historyValue).current;\n\n if (isString(subHistoryValue)) {\n return [parent.getStateNode(subHistoryValue)];\n }\n\n return flatten(toStatePaths(subHistoryValue).map(function (subStatePath) {\n return _this.history === 'deep' ? parent.getFromRelativePath(subStatePath) : [parent.states[subStatePath[0]]];\n }));\n };\n\n Object.defineProperty(StateNode.prototype, \"stateIds\", {\n /**\r\n * All the state node IDs of this state node and its descendant state nodes.\r\n */\n get: function () {\n var _this = this;\n\n var childStateIds = flatten(Object.keys(this.states).map(function (stateKey) {\n return _this.states[stateKey].stateIds;\n }));\n return [this.id].concat(childStateIds);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"events\", {\n /**\r\n * All the event types accepted by this state node and its descendants.\r\n */\n get: function () {\n var e_8, _a, e_9, _b;\n\n if (this.__cache.events) {\n return this.__cache.events;\n }\n\n var states = this.states;\n var events = new Set(this.ownEvents);\n\n if (states) {\n try {\n for (var _c = __values(Object.keys(states)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var stateId = _d.value;\n var state = states[stateId];\n\n if (state.states) {\n try {\n for (var _e = (e_9 = void 0, __values(state.events)), _f = _e.next(); !_f.done; _f = _e.next()) {\n var event_1 = _f.value;\n events.add(\"\".concat(event_1));\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n }\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n }\n\n return this.__cache.events = Array.from(events);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"ownEvents\", {\n /**\r\n * All the events that have transitions directly from this state node.\r\n *\r\n * Excludes any inert events.\r\n */\n get: function () {\n var events = new Set(this.transitions.filter(function (transition) {\n return !(!transition.target && !transition.actions.length && transition.internal);\n }).map(function (transition) {\n return transition.eventType;\n }));\n return Array.from(events);\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.resolveTarget = function (_target) {\n var _this = this;\n\n if (_target === undefined) {\n // an undefined target signals that the state node should not transition from that state when receiving that event\n return undefined;\n }\n\n return _target.map(function (target) {\n if (!isString(target)) {\n return target;\n }\n\n var isInternalTarget = target[0] === _this.delimiter; // If internal target is defined on machine,\n // do not include machine key on target\n\n if (isInternalTarget && !_this.parent) {\n return _this.getStateNodeByPath(target.slice(1));\n }\n\n var resolvedTarget = isInternalTarget ? _this.key + target : target;\n\n if (_this.parent) {\n try {\n var targetStateNode = _this.parent.getStateNodeByPath(resolvedTarget);\n\n return targetStateNode;\n } catch (err) {\n throw new Error(\"Invalid transition definition for state node '\".concat(_this.id, \"':\\n\").concat(err.message));\n }\n } else {\n return _this.getStateNodeByPath(resolvedTarget);\n }\n });\n };\n\n StateNode.prototype.formatTransition = function (transitionConfig) {\n var _this = this;\n\n var normalizedTarget = normalizeTarget(transitionConfig.target);\n var internal = 'internal' in transitionConfig ? transitionConfig.internal : normalizedTarget ? normalizedTarget.some(function (_target) {\n return isString(_target) && _target[0] === _this.delimiter;\n }) : true;\n var guards = this.machine.options.guards;\n var target = this.resolveTarget(normalizedTarget);\n\n var transition = __assign(__assign({}, transitionConfig), {\n actions: toActionObjects(toArray(transitionConfig.actions)),\n cond: toGuard(transitionConfig.cond, guards),\n target: target,\n source: this,\n internal: internal,\n eventType: transitionConfig.event,\n toJSON: function () {\n return __assign(__assign({}, transition), {\n target: transition.target ? transition.target.map(function (t) {\n return \"#\".concat(t.id);\n }) : undefined,\n source: \"#\".concat(_this.id)\n });\n }\n });\n\n return transition;\n };\n\n StateNode.prototype.formatTransitions = function () {\n var e_10, _a;\n\n var _this = this;\n\n var onConfig;\n\n if (!this.config.on) {\n onConfig = [];\n } else if (Array.isArray(this.config.on)) {\n onConfig = this.config.on;\n } else {\n var _b = this.config.on,\n _c = WILDCARD,\n _d = _b[_c],\n wildcardConfigs = _d === void 0 ? [] : _d,\n strictTransitionConfigs_1 = __rest(_b, [typeof _c === \"symbol\" ? _c : _c + \"\"]);\n\n onConfig = flatten(Object.keys(strictTransitionConfigs_1).map(function (key) {\n if (!IS_PRODUCTION && key === NULL_EVENT) {\n warn(false, \"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. \" + \"Please check the `on` configuration for \\\"#\".concat(_this.id, \"\\\".\"));\n }\n\n var transitionConfigArray = toTransitionConfigArray(key, strictTransitionConfigs_1[key]);\n\n if (!IS_PRODUCTION) {\n validateArrayifiedTransitions(_this, key, transitionConfigArray);\n }\n\n return transitionConfigArray;\n }).concat(toTransitionConfigArray(WILDCARD, wildcardConfigs)));\n }\n\n var eventlessConfig = this.config.always ? toTransitionConfigArray('', this.config.always) : [];\n var doneConfig = this.config.onDone ? toTransitionConfigArray(String(done(this.id)), this.config.onDone) : [];\n\n if (!IS_PRODUCTION) {\n warn(!(this.config.onDone && !this.parent), \"Root nodes cannot have an \\\".onDone\\\" transition. Please check the config of \\\"\".concat(this.id, \"\\\".\"));\n }\n\n var invokeConfig = flatten(this.invoke.map(function (invokeDef) {\n var settleTransitions = [];\n\n if (invokeDef.onDone) {\n settleTransitions.push.apply(settleTransitions, __spreadArray([], __read(toTransitionConfigArray(String(doneInvoke(invokeDef.id)), invokeDef.onDone)), false));\n }\n\n if (invokeDef.onError) {\n settleTransitions.push.apply(settleTransitions, __spreadArray([], __read(toTransitionConfigArray(String(error(invokeDef.id)), invokeDef.onError)), false));\n }\n\n return settleTransitions;\n }));\n var delayedTransitions = this.after;\n var formattedTransitions = flatten(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(doneConfig), false), __read(invokeConfig), false), __read(onConfig), false), __read(eventlessConfig), false).map(function (transitionConfig) {\n return toArray(transitionConfig).map(function (transition) {\n return _this.formatTransition(transition);\n });\n }));\n\n try {\n for (var delayedTransitions_1 = __values(delayedTransitions), delayedTransitions_1_1 = delayedTransitions_1.next(); !delayedTransitions_1_1.done; delayedTransitions_1_1 = delayedTransitions_1.next()) {\n var delayedTransition = delayedTransitions_1_1.value;\n formattedTransitions.push(delayedTransition);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (delayedTransitions_1_1 && !delayedTransitions_1_1.done && (_a = delayedTransitions_1.return)) _a.call(delayedTransitions_1);\n } finally {\n if (e_10) throw e_10.error;\n }\n }\n\n return formattedTransitions;\n };\n\n return StateNode;\n}();\n\nexport { StateNode };\n", "import { __assign, __rest } from './_virtual/_tslib.js';\nimport './types.js';\nimport { invoke } from './actionTypes.js';\nimport './utils.js';\nimport './environment.js';\n\nfunction toInvokeSource(src) {\n if (typeof src === 'string') {\n var simpleSrc = {\n type: src\n };\n\n simpleSrc.toString = function () {\n return src;\n }; // v4 compat - TODO: remove in v5\n\n\n return simpleSrc;\n }\n\n return src;\n}\nfunction toInvokeDefinition(invokeConfig) {\n return __assign(__assign({\n type: invoke\n }, invokeConfig), {\n toJSON: function () {\n invokeConfig.onDone;\n invokeConfig.onError;\n var invokeDef = __rest(invokeConfig, [\"onDone\", \"onError\"]);\n\n return __assign(__assign({}, invokeDef), {\n type: invoke,\n src: toInvokeSource(invokeConfig.src)\n });\n }\n });\n}\n\nexport { toInvokeDefinition, toInvokeSource };\n", "var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { useEffect, useState } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { interpret, InterpreterStatus, State, toObserver } from 'xstate';\nimport useConstant from './useConstant';\nexport function useIdleInterpreter(getMachine, options) {\n var machine = useConstant(function () {\n return typeof getMachine === 'function' ? getMachine() : getMachine;\n });\n if (process.env.NODE_ENV !== 'production' &&\n typeof getMachine !== 'function') {\n var _a = __read(useState(machine), 1), initialMachine = _a[0];\n if (getMachine !== initialMachine) {\n console.warn('Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\\n' +\n 'Please make sure that you pass the same Machine as argument each time.');\n }\n }\n var context = options.context, guards = options.guards, actions = options.actions, activities = options.activities, services = options.services, delays = options.delays, rehydratedState = options.state, interpreterOptions = __rest(options, [\"context\", \"guards\", \"actions\", \"activities\", \"services\", \"delays\", \"state\"]);\n var service = useConstant(function () {\n var machineConfig = {\n context: context,\n guards: guards,\n actions: actions,\n activities: activities,\n services: services,\n delays: delays\n };\n var machineWithConfig = machine.withConfig(machineConfig, function () { return (__assign(__assign({}, machine.context), context)); });\n return interpret(machineWithConfig, interpreterOptions);\n });\n // Make sure options are kept updated when they change.\n // This mutation assignment is safe because the service instance is only used\n // in one place -- this hook's caller.\n useIsomorphicLayoutEffect(function () {\n Object.assign(service.machine.options.actions, actions);\n Object.assign(service.machine.options.guards, guards);\n Object.assign(service.machine.options.activities, activities);\n Object.assign(service.machine.options.services, services);\n Object.assign(service.machine.options.delays, delays);\n }, [actions, guards, activities, services, delays]);\n return service;\n}\nexport function useInterpret(getMachine) {\n var _a = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n _a[_i - 1] = arguments[_i];\n }\n var _b = __read(_a, 2), _c = _b[0], options = _c === void 0 ? {} : _c, observerOrListener = _b[1];\n var service = useIdleInterpreter(getMachine, options);\n useEffect(function () {\n if (!observerOrListener) {\n return;\n }\n var sub = service.subscribe(toObserver(observerOrListener));\n return function () {\n sub.unsubscribe();\n };\n }, [observerOrListener]);\n useEffect(function () {\n var rehydratedState = options.state;\n service.start(rehydratedState ? State.create(rehydratedState) : undefined);\n return function () {\n service.stop();\n service.status = InterpreterStatus.NotStarted;\n };\n }, []);\n return service;\n}\n", "import { useLayoutEffect } from 'react';\n\nvar index = useLayoutEffect ;\n\nexport { index as default };\n", "import * as React from 'react';\nexport default function useConstant(fn) {\n var ref = React.useRef();\n if (!ref.current) {\n ref.current = { v: fn() };\n }\n return ref.current.v;\n}\n", "var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nimport { InterpreterStatus } from 'xstate';\nexport function partition(items, predicate) {\n var e_1, _a;\n var _b = __read([[], []], 2), truthy = _b[0], falsy = _b[1];\n try {\n for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n if (predicate(item)) {\n truthy.push(item);\n }\n else {\n falsy.push(item);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return [truthy, falsy];\n}\nexport function getServiceSnapshot(service) {\n return service.status !== 0\n ? service.getSnapshot()\n : service.machine.initialState;\n}\n// From https://github.com/reduxjs/react-redux/blob/master/src/utils/shallowEqual.ts\nfunction is(x, y) {\n if (x === y) {\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n }\n else {\n return x !== x && y !== y;\n }\n}\nexport function shallowEqual(objA, objB) {\n if (is(objA, objB))\n return true;\n if (typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null) {\n return false;\n }\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n if (keysA.length !== keysB.length)\n return false;\n for (var i = 0; i < keysA.length; i++) {\n if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||\n !is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n return true;\n}\nexport function isService(actor) {\n return 'state' in actor && 'machine' in actor;\n}\nexport function isInterpreterStateEqual(service, prevState, nextState) {\n if (service.status === InterpreterStatus.NotStarted) {\n return true;\n }\n // Only change the current state if:\n // - the incoming state is the \"live\" initial state (since it might have new actors)\n // - OR the incoming state actually changed.\n //\n // The \"live\" initial state will have .changed === undefined.\n var initialStateChanged = nextState.changed === undefined &&\n (Object.keys(nextState.children).length > 0 ||\n typeof prevState.changed === 'boolean');\n return !(nextState.changed || initialStateChanged);\n}\n", "import { useRef, useCallback } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport useConstant from './useConstant';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { getServiceSnapshot, isInterpreterStateEqual, isService } from './utils';\nfunction identity(a) {\n return a;\n}\nexport function isActorWithState(actorRef) {\n return 'state' in actorRef;\n}\nfunction isDeferredActor(actorRef) {\n return 'deferred' in actorRef;\n}\nfunction defaultGetSnapshot(actorRef) {\n return 'getSnapshot' in actorRef\n ? isService(actorRef)\n ? getServiceSnapshot(actorRef)\n : actorRef.getSnapshot()\n : isActorWithState(actorRef)\n ? actorRef.state\n : undefined;\n}\nexport function useActor(actorRef, getSnapshot) {\n if (getSnapshot === void 0) { getSnapshot = defaultGetSnapshot; }\n var actorRefRef = useRef(actorRef);\n var deferredEventsRef = useRef([]);\n var subscribe = useCallback(function (handleStoreChange) {\n var unsubscribe = actorRef.subscribe(handleStoreChange).unsubscribe;\n return unsubscribe;\n }, [actorRef]);\n var boundGetSnapshot = useCallback(function () { return getSnapshot(actorRef); }, [actorRef, getSnapshot]);\n var isEqual = useCallback(function (prevState, nextState) {\n if (isService(actorRef)) {\n return isInterpreterStateEqual(actorRef, prevState, nextState);\n }\n return prevState === nextState;\n }, [actorRef]);\n var storeSnapshot = useSyncExternalStoreWithSelector(subscribe, boundGetSnapshot, boundGetSnapshot, identity, isEqual);\n var send = useConstant(function () { return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var event = args[0];\n if (process.env.NODE_ENV !== 'production' && args.length > 1) {\n console.warn(\"Unexpected payload: \".concat(JSON.stringify(args[1]), \". Only a single event object can be sent to actor send() functions.\"));\n }\n var currentActorRef = actorRefRef.current;\n // If the previous actor is a deferred actor,\n // queue the events so that they can be replayed\n // on the non-deferred actor.\n if (isDeferredActor(currentActorRef) && currentActorRef.deferred) {\n deferredEventsRef.current.push(event);\n }\n else {\n currentActorRef.send(event);\n }\n }; });\n useIsomorphicLayoutEffect(function () {\n actorRefRef.current = actorRef;\n // Dequeue deferred events from the previous deferred actorRef\n while (deferredEventsRef.current.length > 0) {\n var deferredEvent = deferredEventsRef.current.shift();\n actorRef.send(deferredEvent);\n }\n }, [actorRef]);\n return [storeSnapshot, send];\n}\n", "import { useCallback, useRef } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isActorWithState } from './useActor';\nimport { getServiceSnapshot, isService } from './utils';\nvar defaultCompare = function (a, b) { return a === b; };\nvar defaultGetSnapshot = function (a, initialStateCacheRef) {\n if (isService(a)) {\n // A status of 0 = interpreter not started\n if (a.status === 0 && initialStateCacheRef.current) {\n return initialStateCacheRef.current;\n }\n var snapshot = getServiceSnapshot(a);\n initialStateCacheRef.current = a.status === 0 ? snapshot : null;\n return snapshot;\n }\n return isActorWithState(a) ? a.state : undefined;\n};\nexport function useSelector(actor, selector, compare, getSnapshot) {\n if (compare === void 0) { compare = defaultCompare; }\n var initialStateCacheRef = useRef(null);\n var subscribe = useCallback(function (handleStoreChange) {\n var unsubscribe = actor.subscribe(handleStoreChange).unsubscribe;\n return unsubscribe;\n }, [actor]);\n var boundGetSnapshot = useCallback(function () {\n if (getSnapshot) {\n return getSnapshot(actor);\n }\n return defaultGetSnapshot(actor, initialStateCacheRef);\n }, [actor, getSnapshot]);\n var selectedSnapshot = useSyncExternalStoreWithSelector(subscribe, boundGetSnapshot, boundGetSnapshot, selector, compare);\n return selectedSnapshot;\n}\n", "export { getActorContext, getActorState } from './helpers/authenticator/actor.mjs';\nexport { defaultAuthHubHandler, listenToAuthHub } from './helpers/authenticator/defaultAuthHubHandler.mjs';\nexport { getNextServiceContextFacade, getNextServiceFacade, getSendEventAliases, getServiceContextFacade, getServiceFacade } from './helpers/authenticator/facade.mjs';\nexport { ALLOWED_SPECIAL_CHARACTERS, NAVIGABLE_ROUTE_EVENT, defaultFormFieldOptions, emailRegex } from './helpers/authenticator/constants.mjs';\nexport { getErrors, getFormDataFromEvent, isAuthFieldWithDefaults, setFormOrder } from './helpers/authenticator/form.mjs';\nexport { censorAllButFirstAndLast, censorContactMethod, censorEmail, censorPhoneNumber, getTotpCodeURL, hasSpecialChars, isValidEmail, trimValues } from './helpers/authenticator/utils.mjs';\nexport { getCustomFormFields, getDefaultFormFields, getFormFields, getSortedFormFields, removeOrderKeys } from './helpers/authenticator/formFields/formFields.mjs';\nexport { DEFAULT_COUNTRY_CODE, defaultFormFieldsGetters, getAliasDefaultFormField } from './helpers/authenticator/formFields/defaults.mjs';\nexport { applyTranslation, getPrimaryAlias, sortFormFields } from './helpers/authenticator/formFields/utils.mjs';\nexport { authenticatorTextUtil } from './helpers/authenticator/textUtil.mjs';\nexport { changePassword, deleteUser } from './helpers/accountSettings/utils.mjs';\nexport { getDefaultConfirmPasswordValidators, getDefaultPasswordValidators, runFieldValidators } from './helpers/accountSettings/validator.mjs';\nexport { getLogger } from './helpers/utils.mjs';\nexport { countryDialCodes } from './i18n/country-dial-codes.mjs';\nexport { DefaultTexts, hasTranslation, translate, translations } from './i18n/translations.mjs';\nexport { createAuthenticatorMachine } from './machines/authenticator/index.mjs';\nexport { createTheme } from './theme/createTheme/createTheme.mjs';\nexport { defineComponentTheme } from './theme/createTheme/defineComponentTheme.mjs';\nexport { createComponentCSS } from './theme/createTheme/createComponentCSS.mjs';\nexport { createGlobalCSS } from './theme/createTheme/createGlobalCSS.mjs';\nexport { cssNameTransform, deepExtend, isDesignToken, setupTokens } from './theme/createTheme/utils.mjs';\nexport { createComponentClasses } from './theme/createTheme/createComponentClasses.mjs';\nexport { resolveObject } from './theme/createTheme/resolveObject.mjs';\nexport { defaultTheme } from './theme/defaultTheme.mjs';\nexport { defaultDarkModeOverride, reactNativeDarkTokens } from './theme/defaultDarkModeOverride.mjs';\nexport { reactNativeTokens } from './theme/tokens/index.mjs';\nexport { FederatedIdentityProviders, UnverifiedContactMethodType } from './types/authenticator/user.mjs';\nexport { isUnverifiedContactMethodType } from './types/authenticator/utils.mjs';\nexport { LoginMechanismArray, authFieldsWithDefaults, isAuthFieldsWithDefaults, signUpFieldsWithDefault, signUpFieldsWithoutDefault } from './types/authenticator/attributes.mjs';\nexport { ComponentClassName } from './types/primitives/componentClassName.mjs';\nexport { setUserAgent } from './utils/setUserAgent/setUserAgent.mjs';\nexport { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, cloneDeep, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isUndefined, noop, sanitizeNamespaceImport, splitObject, templateJoin } from './utils/utils.mjs';\nexport { classNames } from './utils/classNames.mjs';\nexport { humanFileSize } from './utils/humanFileSize.mjs';\nexport { getName, getPathFromName, resolveReference, usesReference } from './utils/references.mjs';\n", "/**\n * This file contains helpers that lets you easily access current actor's state\n * and context.\n */\n/**\n * Get the state of current actor. This is useful for checking which screen\n * to render: e.g. `getActorState(state).matches('confirmSignUp.edit').\n */\nconst getActorState = (state) => {\n return state.context.actorRef?.getSnapshot();\n};\n/**\n * Get the context of current actor. Useful for getting any nested context\n * like remoteError.\n */\nconst getActorContext = (state) => {\n return getActorState(state)?.context;\n};\n\nexport { getActorContext, getActorState };\n", "import { Hub } from 'aws-amplify/utils';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isFunction } from '../../utils/utils.mjs';\n\n/**\n * Handles Amplify JS Auth hub events, by forwarding hub events as appropriate\n * xstate events.\n */\nconst defaultAuthHubHandler = ({ payload }, service, options) => {\n const { event } = payload;\n const { send } = service;\n const { onSignIn, onSignOut } = options ?? {};\n switch (event) {\n case 'signedIn': {\n if (isFunction(onSignIn)) {\n onSignIn(payload);\n }\n break;\n }\n case 'signInWithRedirect': {\n send('SIGN_IN_WITH_REDIRECT');\n break;\n }\n case 'signedOut':\n case 'tokenRefresh_failure': {\n if (event === 'signedOut' && isFunction(onSignOut)) {\n onSignOut();\n }\n send('SIGN_OUT');\n break;\n }\n }\n};\n/**\n * Listens to external auth Hub events and sends corresponding event to\n * the `service.send` of interest\n *\n * @param service - contains state machine `send` function\n * @param handler - auth event handler\n * @returns function that unsubscribes to the hub evenmt\n */\nconst listenToAuthHub = (service, handler = defaultAuthHubHandler) => {\n const eventHandler = (data) => handler(data, service);\n return Hub.listen('auth', eventHandler, 'authenticator-hub-handler');\n};\n\nexport { defaultAuthHubHandler, listenToAuthHub };\n", "import { Category, AiAction, AuthAction, StorageAction, InAppMessagingAction, GeoAction } from '@aws-amplify/core/internals/utils';\n\nconst AI_INPUT_BASE = {\n category: Category.AI,\n apis: [\n AiAction.CreateConversation,\n AiAction.DeleteConversation,\n AiAction.ListConversations,\n AiAction.UpdateConversation,\n AiAction.OnMessage,\n AiAction.SendMessage,\n AiAction.Generation,\n ],\n};\nconst ACCOUNT_SETTINGS_INPUT_BASE = {\n apis: [AuthAction.DeleteUser, AuthAction.UpdatePassword],\n category: Category.Auth,\n};\nconst AUTHENTICATOR_INPUT_BASE = {\n apis: [\n AuthAction.SignUp,\n AuthAction.ConfirmSignUp,\n AuthAction.ResendSignUpCode,\n AuthAction.SignIn,\n AuthAction.ConfirmSignIn,\n AuthAction.FetchUserAttributes,\n AuthAction.SignOut,\n AuthAction.ResetPassword,\n AuthAction.ConfirmResetPassword,\n AuthAction.SignInWithRedirect,\n ],\n category: Category.Auth,\n};\nconst FILE_UPLOADER_BASE_INPUT = {\n apis: [StorageAction.UploadData],\n category: Category.Storage,\n};\nconst IN_APP_MESSAGING_INPUT_BASE = {\n apis: [InAppMessagingAction.NotifyMessageInteraction],\n category: Category.InAppMessaging,\n};\nconst LOCATION_SEARCH_INPUT_BASE = {\n category: Category.Geo,\n apis: [\n GeoAction.SearchByText,\n GeoAction.SearchForSuggestions,\n GeoAction.SearchByPlaceId,\n ],\n};\nconst MAP_VIEW_INPUT_BASE = {\n category: Category.Geo,\n apis: [],\n};\nconst STORAGE_MANAGER_INPUT_BASE = {\n apis: [StorageAction.UploadData],\n category: Category.Storage,\n};\nconst STORAGE_BROWSER_INPUT_BASE = {\n apis: [\n StorageAction.UploadData,\n StorageAction.Copy,\n StorageAction.GetUrl,\n StorageAction.List,\n StorageAction.Remove,\n StorageAction.GetDataAccess,\n StorageAction.ListCallerAccessGrants,\n ],\n category: Category.Storage,\n};\n\nexport { ACCOUNT_SETTINGS_INPUT_BASE, AI_INPUT_BASE, AUTHENTICATOR_INPUT_BASE, FILE_UPLOADER_BASE_INPUT, IN_APP_MESSAGING_INPUT_BASE, LOCATION_SEARCH_INPUT_BASE, MAP_VIEW_INPUT_BASE, STORAGE_BROWSER_INPUT_BASE, STORAGE_MANAGER_INPUT_BASE };\n", "/**\n * Some libraries may not follow Node ES module spec and could be loaded as CommonJS modules,\n * To ensure the interoperability between ESM and CJS, modules from those libraries have to be loaded via namespace import\n * And sanitized by the function below because unlike ESM namespace, CJS namespace set `module.exports` object on the `default` key\n * https://nodejs.org/api/esm.html#interoperability-with-commonjs\n */\nconst sanitizeNamespaceImport = (namespaceModule) => {\n const sanitizedNamespaceModule = { default: undefined, ...namespaceModule };\n return sanitizedNamespaceModule.default ?? sanitizedNamespaceModule;\n};\n/**\n * Checks if `value` is an Object (non-primitive, non-array, non-function)\n * Will return false for Arrays and functions\n *\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is an object, `false` otherwise\n */\nfunction isObject(value) {\n return value != null && !Array.isArray(value) && typeof value === 'object';\n}\n/**\n * Checks if `value` is a string primitive or object\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is a string, `false` otherwise\n */\nfunction isString(value) {\n return (typeof value === 'string' ||\n (typeof value === 'object' &&\n Object.prototype.toString.call(value) === '[object String]'));\n}\n/**\n * Checks if `value` is a Map\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is a Map, `false` otherwise\n */\nfunction isMap(value) {\n return (isObject(value) && Object.prototype.toString.call(value) === '[object Map]');\n}\n/**\n * Checks if `value` is a Set\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is a Set, `false` otherwise\n */\nfunction isSet(value) {\n return (isObject(value) && Object.prototype.toString.call(value) === '[object Set]');\n}\n/**\n * Checks if `value` is undefined\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is undefined, `false` otherwise\n */\nfunction isUndefined(value) {\n return value === undefined;\n}\n/**\n * Checks if `value` is nullish\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is nullish, `false` otherwise\n */\nfunction isNil(value) {\n return value == null;\n}\n/**\n * Checks if `value` is empty\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is empty, `false` otherwise\n */\nfunction isEmpty(value) {\n if (value === null || value === undefined)\n return true;\n if (isObject(value) && (isMap(value) || isSet(value))) {\n return !value.size;\n }\n if (isObject(value) && (isString(value) || Array.isArray(value))) {\n return !value.length;\n }\n for (const key in value) {\n if (has(value, key)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Checks if `value` is an empty array\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is a empty, `false` otherwise\n */\nfunction isEmptyArray(value) {\n return Array.isArray(value) && isEmpty(value);\n}\n/**\n * Checks if all members of the `values` param are empty arrays\n *\n * @param {unknown} value The values to check\n * @returns {boolean} Returns `true` if all members of `values` are empty, `false` otherwise\n */\nfunction areEmptyArrays(...values) {\n return values.every(isEmptyArray);\n}\n/**\n * Checks if `value` is an empty object\n *\n * @param {unknown} value The value to check\n * @returns {boolean} Returns `true` if `value` is empty, `false` otherwise\n */\nfunction isEmptyObject(value) {\n return isObject(value) && isEmpty(value);\n}\n/**\n * Checks if all members of the `values` param are empty objects\n *\n * @param {unknown} values The values to check\n * @returns {boolean} Returns `true` if all members of the `values` param are empty, `false` otherwise\n */\nfunction areEmptyObjects(...values) {\n return values.every(isEmptyObject);\n}\n/**\n * Capitalizes `value` and its return type\n *\n * @param {string} value string to capitalize\n * @returns {string} capitalized string\n */\nfunction capitalize(value) {\n return (isString(value) ? value.charAt(0).toUpperCase() + value.slice(1) : '');\n}\n/**\n * Checks if `key` is a direct property of `value`\n *\n * @param {unknown} value `object` potentially containing property\n * @param {string} key property key\n * @returns whether `key` param is a property of the `obj` param\n */\nfunction has(value, key) {\n return value != null && Object.prototype.hasOwnProperty.call(value, key);\n}\n/**\n * Checks if `value` is a function\n *\n * @param {unknown} value param to check\n * @returns {boolean} whether `value` is a function\n */\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n/**\n * This helper function creates modifier class names that are used for our flat BEM styling\n * it takes in a base and modifier and returns the modified class if a modifier was passed in and null otherwise\n * @param base The base class of the output\n * @param modifier The modifier to add onto the base\n * @returns the modified class name or empty string\n */\nconst classNameModifier = (base, modifier) => {\n return modifier ? `${base}--${modifier}` : '';\n};\n/**\n * This helper function creates modified class names that are used for our flat BEM styling\n * it takes in a base, modifier, and flag and returns the modified class name if the flag is true and null if the flag is false\n * @param base\n * @param modifier\n * @param flag\n * @returns the modified class name or empty string\n */\nconst classNameModifierByFlag = (base, modifier, flag) => {\n return flag ? `${base}--${modifier}` : '';\n};\n/**\n * Similar to `Array.join`, with an optional callback/template param\n * for formatting returned string values\n *\n * @param {string[]} values string array\n * @param {(value: string) => string} template callback format param\n * @returns formatted string array\n */\nfunction templateJoin(values, template) {\n return values.reduce((acc, curr) => `${acc}${isString(curr) ? template(curr) : ''}`, '');\n}\n/**\n * A function that does nothing\n *\n * @param {any[]} _ accepts any parameters\n * @returns nothing\n */\nfunction noop(..._) {\n return;\n}\n/**\n * @param {string} groupName name of group\n * @param events string values related to group\n */\nfunction groupLog(groupName, ...events) {\n const hasEvents = !!events?.length;\n if (hasEvents) {\n // eslint-disable-next-line no-console\n console.groupCollapsed(groupName);\n events?.forEach((event) => {\n // eslint-disable-next-line no-console\n console.log(event);\n });\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n else {\n // eslint-disable-next-line no-console\n console.log(groupName);\n }\n}\n/**\n * Splits an object into 2 objects based on a predicate\n *\n * @param {object} obj an object to split into two\n * @param {function} predicate function to determin where an element should go\n * @returns\n */\nfunction splitObject(obj, predicate) {\n const left = {};\n const right = {};\n Object.entries(obj).forEach(([key, value]) => {\n if (predicate(key)) {\n left[key] = value;\n }\n else {\n right[key] = value;\n }\n });\n return [left, right];\n}\nconst cloneDeep = (obj) => {\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return obj;\n }\n if (obj instanceof Array) {\n return obj.reduce((arr, item, i) => {\n arr[i] = cloneDeep(item);\n return arr;\n }, []);\n }\n if (obj instanceof Object) {\n return Object.keys(obj || {}).reduce((cpObj, key) => {\n cpObj[key] = cloneDeep(obj[key]);\n return cpObj;\n }, {});\n }\n};\n\nexport { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, cloneDeep, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isUndefined, noop, sanitizeNamespaceImport, splitObject, templateJoin };\n", "import { getActorContext, getActorState } from './actor.mjs';\nimport { NAVIGABLE_ROUTE_EVENT } from './constants.mjs';\nimport { getRoute } from './getRoute.mjs';\n\n/**\n * This file contains helpers that translates xstate internals to more\n * understandable authenticator contexts. We provide these contexts with\n * `useAuthenticator` hook/composable/service.\n */\n/**\n * Creates public facing auth helpers that abstracts out xstate implementation\n * detail. Each framework implementation can export these helpers so that\n * developers can send events without having to learn internals.\n *\n * ```\n * const [state, send] = useActor(...);\n * const { submit } = getSendEventAliases(send);\n * submit({ username, password})\n * ```\n */\nconst getSendEventAliases = (send) => {\n const sendToMachine = (type) => {\n // TODO If these were created during the creation of the machine & provider,\n // then invalid transitions could be caught via https://xstate.js.org/docs/guides/states.html#state-can-event\n return (data) => send({ type, data });\n };\n return {\n initializeMachine: sendToMachine('INIT'),\n resendCode: sendToMachine('RESEND'),\n signOut: sendToMachine('SIGN_OUT'),\n submitForm: sendToMachine('SUBMIT'),\n updateForm: sendToMachine('CHANGE'),\n updateBlur: sendToMachine('BLUR'),\n // Actions that don't immediately invoke a service but instead transition to a screen\n // are prefixed with `to*`\n toFederatedSignIn: sendToMachine('FEDERATED_SIGN_IN'),\n toForgotPassword: sendToMachine('FORGOT_PASSWORD'),\n toSignIn: sendToMachine('SIGN_IN'),\n toSignUp: sendToMachine('SIGN_UP'),\n skipVerification: sendToMachine('SKIP'),\n };\n};\nconst getNextSendEventAliases = (send) => {\n const { toFederatedSignIn, submitForm, resendCode, skipVerification } = getSendEventAliases(send);\n return {\n handleSubmit: submitForm,\n resendConfirmationCode: resendCode,\n // manual \"route\" navigation\n setRoute: (route) => send({ type: NAVIGABLE_ROUTE_EVENT[route] }),\n skipAttributeVerification: skipVerification,\n toFederatedSignIn,\n };\n};\nconst getServiceContextFacade = (state) => {\n const actorContext = (getActorContext(state) ?? {});\n const { challengeName, codeDeliveryDetails, remoteError: error, validationError: validationErrors, totpSecretCode = null, unverifiedUserAttributes, username, } = actorContext;\n const { socialProviders = [] } = state.context?.config ?? {};\n // check for user in actorContext prior to state context. actorContext is more \"up to date\",\n // but is not available on all states\n const user = actorContext?.user ?? state.context?.user;\n const hasValidationErrors = !!(validationErrors && Object.keys(validationErrors).length > 0);\n const actorState = getActorState(state);\n const isPending = state.hasTag('pending') || actorState?.hasTag('pending');\n const route = getRoute(state, actorState);\n // Auth status represents the current state of the auth flow\n // The `configuring` state is used to indicate when the xState machine is loading\n const authStatus = ((route) => {\n switch (route) {\n case 'idle':\n case 'setup':\n return 'configuring';\n case 'authenticated':\n return 'authenticated';\n default:\n return 'unauthenticated';\n }\n })(route);\n const facade = {\n authStatus,\n challengeName,\n codeDeliveryDetails,\n error,\n hasValidationErrors,\n isPending,\n route,\n socialProviders,\n totpSecretCode,\n unverifiedUserAttributes,\n user,\n username,\n validationErrors,\n // @v6-migration-note\n // While most of the properties\n // on `AuthenticatorServiceContextFacade` can resolve to `undefined`, updating\n // the interface requires material changes in consumers (namely `useAuthenticator`)\n // which will have implications on the UI layer as typeguards and non-null checks\n // are required to pass type checking. As the `Authenticator` is behaving as expected\n // with the `AuthenticatorServiceContextFacade` interface, prefer to cast\n };\n return facade;\n};\nconst getNextServiceContextFacade = (state) => {\n const actorContext = (getActorContext(state) ?? {});\n const { challengeName, codeDeliveryDetails, remoteError: errorMessage, totpSecretCode, unverifiedUserAttributes, username, } = actorContext;\n const { socialProviders: federatedProviders, loginMechanisms } = state.context?.config ?? {};\n const loginMechanism = loginMechanisms?.[0];\n const actorState = getActorState(state);\n const isPending = state.hasTag('pending') || actorState?.hasTag('pending');\n // @todo-migration remove this cast for Authenticator.Next\n const route = getRoute(state, actorState);\n return {\n challengeName,\n codeDeliveryDetails,\n errorMessage,\n federatedProviders,\n isPending,\n loginMechanism,\n route,\n totpSecretCode,\n unverifiedUserAttributes,\n username,\n };\n};\nconst getServiceFacade = ({ send, state, }) => {\n const sendEventAliases = getSendEventAliases(send);\n const serviceContext = getServiceContextFacade(state);\n return {\n ...sendEventAliases,\n ...serviceContext,\n };\n};\nconst getNextServiceFacade = ({ send, state, }) => ({\n ...getNextSendEventAliases(send),\n ...getNextServiceContextFacade(state),\n});\n\nexport { getNextServiceContextFacade, getNextServiceFacade, getSendEventAliases, getServiceContextFacade, getServiceFacade };\n", "import { countryDialCodes } from '../../i18n/country-dial-codes.mjs';\nimport 'aws-amplify/utils';\n\n/**\n * This file contains helpers related to forms and input attributes.\n */\nconst defaultFormFieldOptions = {\n birthdate: {\n label: 'Birthdate',\n placeholder: 'Enter your Birthdate',\n type: 'date',\n autocomplete: 'bday',\n isRequired: true,\n },\n confirmation_code: {\n label: 'Confirmation Code',\n placeholder: 'Enter your Confirmation Code',\n type: 'text',\n autocomplete: 'one-time-code',\n isRequired: true,\n },\n confirm_password: {\n label: 'Confirm Password',\n placeholder: 'Please confirm your Password',\n type: 'password',\n autocomplete: 'new-password',\n isRequired: true,\n },\n email: {\n label: 'Email',\n placeholder: 'Enter your Email',\n type: 'email',\n autocomplete: 'username',\n isRequired: true,\n },\n family_name: {\n label: 'Family Name',\n placeholder: 'Enter your Family Name',\n type: 'text',\n autocomplete: 'family-name',\n isRequired: true,\n },\n given_name: {\n label: 'Given Name',\n placeholder: 'Enter your Given Name',\n type: 'text',\n autocomplete: 'given-name',\n isRequired: true,\n },\n middle_name: {\n label: 'Middle Name',\n placeholder: 'Enter your Middle Name',\n type: 'text',\n autocomplete: 'additional-name',\n isRequired: true,\n },\n name: {\n label: 'Name',\n placeholder: 'Enter your Name',\n type: 'text',\n autocomplete: 'name',\n isRequired: true,\n },\n nickname: {\n label: 'Nickname',\n placeholder: 'Enter your Nickname',\n type: 'text',\n autocomplete: 'tel',\n isRequired: true,\n },\n password: {\n label: 'Password',\n placeholder: 'Enter your Password',\n type: 'password',\n autocomplete: 'new-password',\n isRequired: true,\n },\n phone_number: {\n label: 'Phone Number',\n placeholder: 'Enter your Phone Number',\n type: 'tel',\n autocomplete: 'tel',\n dialCode: '+1',\n dialCodeList: countryDialCodes,\n isRequired: true,\n },\n preferred_username: {\n label: 'Preferred Username',\n placeholder: 'Enter your Preferred Username',\n type: 'text',\n isRequired: true,\n },\n profile: {\n label: 'Profile',\n placeholder: 'Add your Profile',\n type: 'url',\n autocomplete: 'url',\n isRequired: true,\n },\n website: {\n label: 'Website',\n placeholder: 'Add your Website',\n type: 'url',\n autocomplete: 'url',\n isRequired: true,\n },\n username: {\n label: 'Username',\n placeholder: 'Enter your Username',\n type: 'text',\n autocomplete: 'username',\n isRequired: true,\n },\n};\n/**\n * List of special characters that Cognito allows.\n *\n * Adapted from https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-policies.html\n */\n// prettier-ignore\nconst ALLOWED_SPECIAL_CHARACTERS = [\n '^', '$', '*', '.', '[', ']',\n '{', '}', '(', ')', '?', '\"',\n '!', '@', '#', '%', '&', '/',\n '\\\\', ',', '>', '<', \"'\", ':',\n ';', '|', '_', '~', '`', '=',\n '+', '-', ' '\n];\n/**\n * Email validation regex\n *\n * source: HTML5 spec https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address\n */\nconst emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n/**\n+ * map navigable route keys to auth event names\n+ */\nconst NAVIGABLE_ROUTE_EVENT = {\n forgotPassword: 'FORGOT_PASSWORD',\n signIn: 'SIGN_IN',\n signUp: 'SIGN_UP',\n};\n\nexport { ALLOWED_SPECIAL_CHARACTERS, NAVIGABLE_ROUTE_EVENT, defaultFormFieldOptions, emailRegex };\n", "const countryDialCodes = [\n '+1',\n '+7',\n '+20',\n '+27',\n '+30',\n '+31',\n '+32',\n '+33',\n '+34',\n '+36',\n '+39',\n '+40',\n '+41',\n '+43',\n '+44',\n '+45',\n '+46',\n '+47',\n '+48',\n '+49',\n '+51',\n '+52',\n '+53',\n '+54',\n '+55',\n '+56',\n '+57',\n '+58',\n '+60',\n '+61',\n '+62',\n '+63',\n '+64',\n '+65',\n '+66',\n '+81',\n '+82',\n '+84',\n '+86',\n '+90',\n '+91',\n '+92',\n '+93',\n '+94',\n '+95',\n '+98',\n '+212',\n '+213',\n '+216',\n '+218',\n '+220',\n '+221',\n '+222',\n '+223',\n '+224',\n '+225',\n '+226',\n '+227',\n '+228',\n '+229',\n '+230',\n '+231',\n '+232',\n '+233',\n '+234',\n '+235',\n '+236',\n '+237',\n '+238',\n '+239',\n '+240',\n '+241',\n '+242',\n '+243',\n '+244',\n '+245',\n '+246',\n '+248',\n '+249',\n '+250',\n '+251',\n '+252',\n '+253',\n '+254',\n '+255',\n '+256',\n '+257',\n '+258',\n '+260',\n '+261',\n '+262',\n '+263',\n '+264',\n '+265',\n '+266',\n '+267',\n '+268',\n '+269',\n '+290',\n '+291',\n '+297',\n '+298',\n '+299',\n '+345',\n '+350',\n '+351',\n '+352',\n '+353',\n '+354',\n '+355',\n '+356',\n '+357',\n '+358',\n '+359',\n '+370',\n '+371',\n '+372',\n '+373',\n '+374',\n '+375',\n '+376',\n '+377',\n '+378',\n '+379',\n '+380',\n '+381',\n '+382',\n '+385',\n '+386',\n '+387',\n '+389',\n '+420',\n '+421',\n '+423',\n '+500',\n '+501',\n '+502',\n '+503',\n '+504',\n '+505',\n '+506',\n '+507',\n '+508',\n '+509',\n '+537',\n '+590',\n '+591',\n '+593',\n '+594',\n '+595',\n '+596',\n '+597',\n '+598',\n '+599',\n '+670',\n '+672',\n '+673',\n '+674',\n '+675',\n '+676',\n '+677',\n '+678',\n '+679',\n '+680',\n '+681',\n '+682',\n '+683',\n '+685',\n '+686',\n '+687',\n '+688',\n '+689',\n '+690',\n '+691',\n '+692',\n '+850',\n '+852',\n '+853',\n '+855',\n '+856',\n '+872',\n '+880',\n '+886',\n '+960',\n '+961',\n '+962',\n '+963',\n '+964',\n '+965',\n '+966',\n '+967',\n '+968',\n '+970',\n '+971',\n '+972',\n '+973',\n '+974',\n '+975',\n '+976',\n '+977',\n '+992',\n '+993',\n '+994',\n '+995',\n '+996',\n '+998',\n];\n\nexport { countryDialCodes };\n", "const getRoute = (state, actorState) => {\n // 'federatedSignIn' exists as a state on both the 'signInActor' and 'signUpActor',\n // match against the `actorState` initially to determine if the federated sign in flow\n // has begun, then which actor has begun the flow and return the corresponding `route`\n if (actorState?.matches('federatedSignIn')) {\n if (state.matches('signUpActor')) {\n return 'signUp';\n }\n if (state.matches('signInActor')) {\n return 'signIn';\n }\n }\n switch (true) {\n case state.matches('idle'):\n return 'idle';\n case state.matches('setup'):\n return 'setup';\n case state.matches('signOut'):\n return 'signOut';\n case state.matches('authenticated'):\n return 'authenticated';\n case actorState?.matches('confirmSignUp'):\n case actorState?.matches('resendSignUpCode'):\n return 'confirmSignUp';\n case actorState?.matches('confirmSignIn'):\n return 'confirmSignIn';\n case actorState?.matches('setupTotp.edit'):\n case actorState?.matches('setupTotp.submit'):\n return 'setupTotp';\n case actorState?.matches('signIn'):\n return 'signIn';\n case actorState?.matches('signUp'):\n case actorState?.matches('autoSignIn'):\n return 'signUp';\n case actorState?.matches('forceChangePassword'):\n return 'forceNewPassword';\n case actorState?.matches('forgotPassword'):\n return 'forgotPassword';\n case actorState?.matches('confirmResetPassword'):\n return 'confirmResetPassword';\n case actorState?.matches('selectUserAttributes'):\n return 'verifyUser';\n case actorState?.matches('confirmVerifyUserAttribute'):\n return 'confirmVerifyUser';\n case state.matches('getCurrentUser'):\n case actorState?.matches('fetchUserAttributes'):\n /**\n * This route is needed for autoSignIn to capture both the\n * autoSignIn.pending and the resolved states when the\n * signIn actor is running.\n */\n return 'transition';\n default:\n return null;\n }\n};\n\nexport { getRoute };\n", "import '../../types/authenticator/user.mjs';\nimport { authFieldsWithDefaults } from '../../types/authenticator/attributes.mjs';\n\nconst getFormDataFromEvent = (event) => {\n const formData = new FormData(event.target);\n return Object.fromEntries(formData);\n};\nconst setFormOrder = (formOverrides, fieldNames) => {\n let orderedKeys = [];\n if (formOverrides) {\n orderedKeys = Object.keys(formOverrides)\n .reduce((prev, key) => {\n // reduce to array that can be sorted\n prev.push([key, formOverrides[key]?.order]);\n return prev;\n }, [])\n .sort((a, b) => \n //sort them based on order\n a[1] - b[1]) // returned just key\n .filter((a) => a[1] !== undefined)\n .map((a) => a[0]);\n }\n // remove duplicates\n return Array.from(new Set([...orderedKeys, ...fieldNames]));\n};\nconst isAuthFieldWithDefaults = (field) => {\n return authFieldsWithDefaults.includes(field);\n};\nconst isArray = (val) => {\n return Array.isArray(val);\n};\nconst getErrors = (errors) => {\n if (!errors)\n return null;\n if (isArray(errors)) {\n return errors;\n }\n else {\n return [errors];\n }\n};\n\nexport { getErrors, getFormDataFromEvent, isAuthFieldWithDefaults, setFormOrder };\n", "/** Federated IDPs that Authenticator supports */\nvar FederatedIdentityProviders;\n(function (FederatedIdentityProviders) {\n FederatedIdentityProviders[\"Apple\"] = \"Apple\";\n FederatedIdentityProviders[\"Amazon\"] = \"Amazon\";\n FederatedIdentityProviders[\"Facebook\"] = \"Facebook\";\n FederatedIdentityProviders[\"Google\"] = \"Google\";\n})(FederatedIdentityProviders || (FederatedIdentityProviders = {}));\n/**\n * Cognito user contact method types that have not been verified as valid\n */\nvar UnverifiedContactMethodType;\n(function (UnverifiedContactMethodType) {\n UnverifiedContactMethodType[\"Email\"] = \"email\";\n UnverifiedContactMethodType[\"PhoneNumber\"] = \"phone_number\";\n})(UnverifiedContactMethodType || (UnverifiedContactMethodType = {}));\n\nexport { FederatedIdentityProviders, UnverifiedContactMethodType };\n", "/** Array of auth fields that we supply defaults with */\nconst signUpFieldsWithDefault = [\n 'birthdate',\n 'email',\n 'family_name',\n 'given_name',\n 'middle_name',\n 'name',\n 'nickname',\n 'phone_number',\n 'preferred_username',\n 'profile',\n 'website',\n];\n/** Array of auth fields that we do not supply defaults with */\nconst signUpFieldsWithoutDefault = [\n 'address',\n 'gender',\n 'locale',\n 'picture',\n 'updated_at',\n 'zoneinfo',\n];\n/** Array of known login mechanisms */\nconst LoginMechanismArray = [\n 'username',\n 'email',\n 'phone_number',\n];\nconst authFieldsWithDefaults = [\n ...LoginMechanismArray,\n ...signUpFieldsWithDefault,\n 'confirmation_code',\n 'password',\n 'confirm_password',\n];\nconst isAuthFieldsWithDefaults = (field) => {\n return authFieldsWithDefaults.includes(field);\n};\n\nexport { LoginMechanismArray, authFieldsWithDefaults, isAuthFieldsWithDefaults, signUpFieldsWithDefault, signUpFieldsWithoutDefault };\n", "import { ALLOWED_SPECIAL_CHARACTERS, emailRegex } from './constants.mjs';\n\n// replaces all characters in a string with '*', except for the first and last char\nconst censorAllButFirstAndLast = (value) => {\n const split = value.trim().split('');\n for (let i = 0; i < split.length; i++) {\n if (i > 0 && i < split.length - 1) {\n split[i] = '*';\n }\n }\n return split.join('');\n};\n// censors all but the last four characters of a phone number\nconst censorPhoneNumber = (val) => {\n if (val.length < 4) {\n return val;\n }\n const split = val.split('');\n for (let i = 0; i < split.length - 4; i++) {\n split[i] = '*';\n }\n return split.join('');\n};\n// censors all but the first and last of the name of an email and keeps domain\nconst censorEmail = (val) => {\n const splitEmail = val.split('@');\n const censoredName = censorAllButFirstAndLast(splitEmail[0]);\n return `${censoredName}@${splitEmail[1]}`;\n};\n// based on the ContactMethod type, returns a censored contact value\nconst censorContactMethod = (type, value) => {\n return type === 'Phone Number'\n ? censorPhoneNumber(value)\n : censorEmail(value);\n};\nconst hasSpecialChars = (password) => ALLOWED_SPECIAL_CHARACTERS.some((char) => password.includes(char));\nconst getTotpCodeURL = (issuer, username, secret) => encodeURI(`otpauth://totp/${issuer}:${username}?secret=${secret}&issuer=${issuer}`);\nfunction trimValues(values, ...ignored) {\n return Object.entries(values).reduce((acc, [name, value]) => ({\n ...acc,\n [name]: ignored.includes(name) ? value : value?.trim(),\n }), {});\n}\nconst isValidEmail = (value) => {\n if (!value)\n return false;\n return emailRegex.test(value);\n};\n\nexport { censorAllButFirstAndLast, censorContactMethod, censorEmail, censorPhoneNumber, getTotpCodeURL, hasSpecialChars, isValidEmail, trimValues };\n", "import '../../../types/authenticator/user.mjs';\nimport { isAuthFieldsWithDefaults } from '../../../types/authenticator/attributes.mjs';\nimport { getActorContext } from '../actor.mjs';\nimport { defaultFormFieldOptions } from '../constants.mjs';\nimport { defaultFormFieldsGetters, getAliasDefaultFormField } from './defaults.mjs';\nimport { applyTranslation, sortFormFields } from './utils.mjs';\n\n// Gets the default formFields for given route\nconst getDefaultFormFields = (route, state) => {\n const formFieldGetter = defaultFormFieldsGetters[route];\n return formFieldGetter(state);\n};\n// Gets custom formFields, and applies default values\nconst getCustomFormFields = (route, state) => {\n const customFormFields = getActorContext(state)?.formFields?.[route];\n if (!customFormFields || Object.keys(customFormFields).length === 0) {\n return {};\n }\n return Object.entries(customFormFields).reduce((acc, [fieldName, customOptions]) => {\n if ((route === 'signIn' || route === 'forgotPassword') &&\n fieldName === 'username') {\n // Unlike other screens, `signIn` and `forgotPassword` screens default login\n // alias field names to \"username\", even if it's a phone number or email.\n // In this case, we get the default formFieldOptions based on loginMechanism.\n const defaultOptions = getAliasDefaultFormField(state);\n // apply default to fill any gaps that are not present in customOptions\n const mergedOptions = { ...defaultOptions, ...customOptions };\n return { ...acc, [fieldName]: mergedOptions };\n }\n else if (isAuthFieldsWithDefaults(fieldName)) {\n // if this field is a known auth attribute that we have defaults for,\n // apply defaults to customOptions.\n const defaultOptions = defaultFormFieldOptions[fieldName];\n const mergedOptions = { ...defaultOptions, ...customOptions };\n return { ...acc, [fieldName]: mergedOptions };\n }\n else {\n // if this is not a known field, use customOptions as is.\n return { ...acc, [fieldName]: customOptions };\n }\n }, {});\n};\nconst getFormFields = (route, state) => {\n const defaultFormFields = getDefaultFormFields(route, state);\n const customFormFields = getCustomFormFields(route, state);\n const formFields = { ...defaultFormFields, ...customFormFields };\n delete formFields['QR'];\n return applyTranslation(formFields);\n};\nconst removeOrderKeys = (formFields) => formFields.map((field) => {\n const key = field[0];\n // Drop order key to prevent passing to form field UI components\n const values = { ...field[1], order: undefined };\n return [key, values];\n});\n/** Calls `getFormFields` above, then sorts it into an indexed array */\nconst getSortedFormFields = (route, state) => {\n const formFields = getFormFields(route, state);\n return removeOrderKeys(sortFormFields(formFields));\n};\n\nexport { getCustomFormFields, getDefaultFormFields, getFormFields, getSortedFormFields, removeOrderKeys };\n", "import { getActorState } from '../actor.mjs';\nimport { defaultFormFieldOptions } from '../constants.mjs';\nimport { isAuthFieldWithDefaults } from '../form.mjs';\nimport { getPrimaryAlias } from './utils.mjs';\n\n/**\n * This file contains helpers that generate default formFields for each screen\n */\nconst DEFAULT_COUNTRY_CODE = '+1';\n/** Helper function that gets the default formField for given field name */\nconst getDefaultFormField = (fieldName) => {\n let options = defaultFormFieldOptions[fieldName];\n const { type } = options;\n if (type === 'tel') {\n options = { ...options, dialCode: DEFAULT_COUNTRY_CODE };\n }\n return options;\n};\n// Helper function that returns default form field for configured primary alias\nconst getAliasDefaultFormField = (state) => {\n const primaryAlias = getPrimaryAlias(state);\n return {\n ...getDefaultFormField(primaryAlias),\n autocomplete: 'username',\n };\n};\n/** Reusable confirmation code form fields. */\nconst getConfirmationCodeFormFields = (_) => ({\n confirmation_code: {\n ...getDefaultFormField('confirmation_code'),\n label: 'Code *',\n placeholder: 'Code',\n },\n});\nconst getSignInFormFields = (state) => ({\n username: { ...getAliasDefaultFormField(state) },\n password: {\n ...getDefaultFormField('password'),\n autocomplete: 'current-password',\n },\n});\nconst getSignUpFormFields = (state) => {\n const { loginMechanisms, signUpAttributes } = state.context.config;\n const primaryAlias = getPrimaryAlias(state);\n /**\n * @migration signUp Fields created here\n */\n const fieldNames = Array.from(new Set([\n ...loginMechanisms,\n 'password',\n 'confirm_password',\n ...signUpAttributes,\n ]));\n const formField = {};\n for (const fieldName of fieldNames) {\n if (isAuthFieldWithDefaults(fieldName)) {\n const fieldAttrs = fieldName === primaryAlias\n ? getAliasDefaultFormField(state)\n : getDefaultFormField(fieldName);\n formField[fieldName] = { ...fieldAttrs };\n }\n else {\n // There's a `custom:*` attribute or one we don't already have an implementation for\n // eslint-disable-next-line no-console\n console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize SignUp FormFields to add your own.`);\n }\n }\n return formField;\n};\nconst getConfirmSignUpFormFields = (_) => ({\n confirmation_code: {\n ...getDefaultFormField('confirmation_code'),\n placeholder: 'Enter your code',\n },\n});\nconst getForgotPasswordFormFields = (state) => {\n const primaryAlias = getPrimaryAlias(state);\n const { label } = defaultFormFieldOptions[primaryAlias];\n return {\n username: {\n ...getAliasDefaultFormField(state),\n label: `Enter your ${label.toLowerCase()}`,\n placeholder: `Enter your ${label.toLowerCase()}`,\n },\n };\n};\nconst getConfirmResetPasswordFormFields = (state) => ({\n ...getConfirmationCodeFormFields(),\n password: {\n ...getDefaultFormField('password'),\n label: 'New Password',\n placeholder: 'New Password',\n },\n confirm_password: {\n ...getDefaultFormField('confirm_password'),\n label: 'Confirm Password',\n placeholder: 'Confirm Password',\n },\n});\nconst getForceNewPasswordFormFields = (state) => {\n const actorState = getActorState(state);\n const { missingAttributes } = actorState.context;\n const fieldNames = Array.from(new Set([\n 'password',\n 'confirm_password',\n ...(missingAttributes ?? []),\n ]));\n const formField = {};\n for (const fieldName of fieldNames) {\n if (isAuthFieldWithDefaults(fieldName)) {\n formField[fieldName] = { ...getDefaultFormField(fieldName) };\n }\n else {\n // There's a `custom:*` attribute or one we don't already have an implementation for\n // eslint-disable-next-line no-console\n console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize ForceNewPassword FormFields to add your own.`);\n }\n }\n return formField;\n};\n/** Collect all the defaultFormFields getters */\nconst defaultFormFieldsGetters = {\n signIn: getSignInFormFields,\n signUp: getSignUpFormFields,\n confirmSignUp: getConfirmSignUpFormFields,\n confirmSignIn: getConfirmationCodeFormFields,\n forceNewPassword: getForceNewPasswordFormFields,\n forgotPassword: getForgotPasswordFormFields,\n confirmResetPassword: getConfirmResetPasswordFormFields,\n confirmVerifyUser: getConfirmationCodeFormFields,\n setupTotp: getConfirmationCodeFormFields,\n};\n\nexport { DEFAULT_COUNTRY_CODE, defaultFormFieldsGetters, getAliasDefaultFormField };\n", "import { translate } from '../../../i18n/translations.mjs';\n\nconst getPrimaryAlias = (state) => {\n const loginMechanisms = state?.context.config?.loginMechanisms;\n /**\n * @migration this is where we grab only the first index of `aws_cognito_username_attributes`\n */\n const [primaryAlias] = loginMechanisms ?? ['username'];\n return primaryAlias;\n};\n/** Applies translations to label and placeholder */\nconst applyTranslation = (formFields) => {\n const newFormFields = { ...formFields };\n for (const [name, options] of Object.entries(formFields)) {\n const { label, placeholder } = options;\n newFormFields[name] = {\n ...options,\n label: label ? translate(label) : undefined,\n placeholder: placeholder ? translate(placeholder) : undefined,\n };\n }\n return newFormFields;\n};\n/** Sorts formFields according to their `order`. */\nconst sortFormFields = (formFields) => {\n return Object.entries(formFields)\n .sort((a, b) => {\n const orderA = a[1].order || Number.MAX_VALUE;\n const orderB = b[1].order || Number.MAX_VALUE;\n return orderA - orderB;\n })\n .filter((formFieldEntry) => formFieldEntry[1] !== undefined);\n};\n\nexport { applyTranslation, getPrimaryAlias, sortFormFields };\n", "import { I18n } from 'aws-amplify/utils';\nimport { defaultTexts, deDict, enDict, esDict, frDict, idDict, itDict, jaDict, krDict, nbDict, nlDict, plDict, ptDict, zhDict, svDict, trDict, ruDict, heDict, uaDict, thDict } from './dictionaries/index.mjs';\n\n/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n/**\n * Contains translatable strings that authenticator provides by default. Customers\n * can use this to add custom vocabularies:\n *\n * ```\n * I18n.putVocabulariesForLanguage(\"en\", {\n * [DefaultTexts.SIGN_IN]: \"Custom Sign In Text\",\n * [DefaultTexts.SIGN_IN_BUTTON]: \"Custom Click Here to Sign In\"\n * });\n * ```\n */\nconst DefaultTexts = { ...defaultTexts };\n/**\n * This helper type checks that given phrase is one of the texts @aws-amplify/ui\n * provides by default. This enables vscode autocompletion to help catch typos\n * during development.\n *\n * You can also use translate to handle custom strings or dynamic content.\n */\nfunction translate(phrase) {\n return I18n.get(phrase);\n}\n/**\n * Whether I18n has a translation entry for given phrase\n */\nfunction hasTranslation(phrase) {\n return I18n.get(phrase) !== phrase;\n}\nconst translations = {\n de: deDict,\n en: enDict,\n es: esDict,\n fr: frDict,\n id: idDict,\n it: itDict,\n ja: jaDict,\n // TODO: remove kr in next major release\n kr: krDict,\n ko: krDict,\n nb: nbDict,\n nl: nlDict,\n pl: plDict,\n pt: ptDict,\n zh: zhDict,\n sv: svDict,\n tr: trDict,\n ru: ruDict,\n he: heDict,\n ua: uaDict,\n th: thDict,\n};\n\nexport { DefaultTexts, hasTranslation, translate, translations };\n", "import { deDict as deDict$1 } from './authenticator/de.mjs';\nimport { enDict as enDict$1 } from './authenticator/en.mjs';\nimport { esDict as esDict$1 } from './authenticator/es.mjs';\nimport { frDict as frDict$1 } from './authenticator/fr.mjs';\nimport { itDict as itDict$1 } from './authenticator/it.mjs';\nimport { jaDict as jaDict$1 } from './authenticator/ja.mjs';\nimport { krDict as krDict$1 } from './authenticator/kr.mjs';\nimport { nbDict as nbDict$1 } from './authenticator/nb.mjs';\nimport { nlDict as nlDict$1 } from './authenticator/nl.mjs';\nimport { plDict as plDict$1 } from './authenticator/pl.mjs';\nimport { ptDict as ptDict$1 } from './authenticator/pt.mjs';\nimport { zhDict as zhDict$1 } from './authenticator/zh.mjs';\nimport { svDict as svDict$1 } from './authenticator/sv.mjs';\nimport { idDict as idDict$1 } from './authenticator/id.mjs';\nimport { trDict as trDict$1 } from './authenticator/tr.mjs';\nimport { ruDict as ruDict$1 } from './authenticator/ru.mjs';\nimport { heDict as heDict$1 } from './authenticator/he.mjs';\nimport { uaDict as uaDict$1 } from './authenticator/ua.mjs';\nimport { thDict as thDict$1 } from './authenticator/th.mjs';\nimport { defaultTexts as defaultTexts$1 } from './authenticator/defaultTexts.mjs';\n\n//merge all the new module translations in respective locale constants\nconst deDict = { ...deDict$1 };\nconst enDict = {\n ...enDict$1,\n};\nconst esDict = { ...esDict$1 };\nconst frDict = { ...frDict$1 };\nconst itDict = { ...itDict$1 };\nconst jaDict = { ...jaDict$1 };\nconst krDict = { ...krDict$1 };\nconst nbDict = { ...nbDict$1 };\nconst nlDict = { ...nlDict$1 };\nconst plDict = { ...plDict$1 };\nconst ptDict = { ...ptDict$1 };\nconst zhDict = { ...zhDict$1 };\nconst svDict = { ...svDict$1 };\nconst idDict = { ...idDict$1 };\nconst trDict = { ...trDict$1 };\nconst ruDict = { ...ruDict$1 };\nconst heDict = { ...heDict$1 };\nconst uaDict = { ...uaDict$1 };\nconst thDict = { ...thDict$1 };\nconst defaultTexts = {\n ...defaultTexts$1,\n // new module related default texts goes here\n};\n\nexport { deDict, defaultTexts, enDict, esDict, frDict, heDict, idDict, itDict, jaDict, krDict, nbDict, nlDict, plDict, ptDict, ruDict, svDict, thDict, trDict, uaDict, zhDict };\n", "const deDict = {\n 'Account recovery requires verified contact information': 'Zur\u00FCcksetzen des Accounts ben\u00F6tigt einen verifizierten Account',\n 'Add your Profile': 'Ihr Profil hinzuf\u00FCgen',\n 'Add your Website': 'Ihre Website hinzuf\u00FCgen',\n 'Back to Sign In': 'Zur\u00FCck zur Anmeldung',\n 'Change Password': 'Passwort \u00E4ndern',\n Changing: '\u00C4ndern von',\n Code: 'Code',\n 'Confirm Password': 'Passwort best\u00E4tigen',\n 'Please confirm your Password': 'Bitte best\u00E4tigen Sie Ihr Passwort',\n 'Confirm Sign Up': 'Registrierung best\u00E4tigen',\n 'Confirm SMS Code': 'SMS-Code best\u00E4tigen',\n 'Confirm TOTP Code': 'TOTP-Code best\u00E4tigen',\n Confirm: 'Best\u00E4tigen',\n 'Confirmation Code': 'Best\u00E4tigungs-Code',\n Confirming: 'Wird best\u00E4tigt',\n 'Create a new account': 'Einen neuen Account erstellen',\n 'Create Account': 'Account erstellen',\n 'Creating Account': 'Account wird erstellt',\n 'Dismiss alert': 'Warnung verwerfen',\n Email: 'E-Mail',\n 'Enter your Birthdate': 'Geben Sie Ihr Geburtsdatum ein',\n 'Enter your code': 'Geben Sie Ihren Code ein',\n 'Enter your Confirmation Code': 'Geben Sie Ihren Best\u00E4tigungs-Code ein',\n 'Enter your Email': 'Geben Sie Ihre E-Mail ein',\n 'Enter your Family Name': 'Geben Sie Ihren Nachnamen ein',\n 'Enter your Given Name': 'Geben Sie Ihren Vornamen ein',\n 'Enter your Middle Name': 'Geben Sie Ihren zweiten Vornamen ein',\n 'Enter your Name': 'Geben Sie Ihren Namen ein',\n 'Enter your Nickname': 'Geben Sie Ihren Spitznamen ein',\n 'Enter your Password': 'Geben Sie Ihr Passwort ein',\n 'Enter your password': 'Geben Sie Ihr Passwort ein',\n 'Enter your email': 'Geben Sie Ihre E-Mail ein',\n 'Enter your phone number': 'Geben Sie Ihre Telefonnummer ein',\n 'Enter your Preferred Username': 'Geben Sie Ihren bevorzugten Benutzernamen ein',\n 'Enter your username': 'Geben Sie Ihren Benutzernamen ein',\n 'Forgot password?': 'Passwort vergessen?',\n 'Forgot your password?': 'Passwort vergessen? ',\n 'Hide password': 'Passwort verbergen',\n 'It may take a minute to arrive': 'Es kann eine Minute dauern, bis er ankommt',\n Loading: 'Wird geladen',\n 'New password': 'Neues Passwort',\n or: 'oder',\n Password: 'Passwort',\n 'Phone Number': 'Telefonnummer',\n 'Resend Code': 'Code erneut senden',\n 'Reset your Password': 'Zur\u00FCcksetzen des Passworts',\n 'Reset your password': 'Zur\u00FCcksetzen des passworts',\n 'Send code': 'Code senden',\n 'Send Code': 'Code senden',\n Sending: 'Wird gesendet',\n 'Setup TOTP': 'TOTP einrichten',\n 'Show password': 'Passwort anzeigen',\n 'Sign in to your account': 'Melden Sie sich mit Ihrem Account an',\n 'Sign In with Amazon': 'Mit Amazon anmelden',\n 'Sign In with Apple': 'Mit Apple anmelden',\n 'Sign In with Facebook': 'Mit Facebook anmelden',\n 'Sign In with Google': 'Mit Google anmelden',\n 'Sign in': 'Anmelden',\n 'Sign In': 'Anmelden',\n 'Signing in': 'Wird angemeldet',\n Skip: '\u00DCberspringen',\n Submit: 'Abschicken',\n Submitting: 'Wird gesendet',\n Username: 'Benutzername',\n 'Verify Contact': 'Kontakt verifizieren',\n Verify: 'Verifizieren',\n 'We Emailed You': 'E-Mail wurde versendet',\n 'We Sent A Code': 'Wir haben einen Code gesendet',\n 'We Texted You': 'Wir haben Ihnen eine SMS gesendet',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Ihr Best\u00E4tigungscode ist unterwegs. Um sich einzuloggen geben Sie den Code ein, den wir per E-Mail verschickt haben',\n 'Your code is on the way. To log in, enter the code we sent you': 'Ihr Code ist unterwegs. Um sich anzumelden, geben Sie den Code ein, den wir Ihnen gesendet haben',\n 'Your code is on the way. To log in, enter the code we texted to': 'Ihr Best\u00E4tigungscode ist unterwegs. Um sich einzuloggen geben Sie den Code ein, den wir per SMS verschickt haben',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Ein Account mit dieser E-Mail existiert bereits.',\n 'Confirm a Code': 'Code best\u00E4tigen',\n 'Confirm Sign In': 'Anmeldung best\u00E4tigen',\n 'Create account': 'Hier registrieren',\n 'Sign Up with Facebook': 'Mit Facebook registrieren',\n 'Sign Up with Google': 'Mit Google registrieren',\n 'Forgot Password': 'Passwort vergessen',\n 'Have an account? ': 'Schon registriert? ',\n 'Incorrect username or password': 'Falscher Benutzername oder falsches Passwort',\n 'Invalid password format': 'Ung\u00FCltiges Passwort-Format',\n 'Invalid phone number format': `Ung\u00FCltiges Telefonummern-Format. Benutze eine Nummer im Format: +12345678900`,\n 'It may take a minute to arrive.': 'Es k\u00F6nnte eine Minute dauern, bis der Code eintrifft.',\n 'Lost your code? ': 'Code verloren? ',\n 'New Password': 'Neues Passwort',\n 'No account? ': 'Kein Account? ',\n 'Password attempts exceeded': 'Die maximale Anzahl der fehlerhaften Anmeldeversuche wurde erreicht',\n 'Reset password': 'Passwort zur\u00FCcksetzen',\n 'Reset Password': 'Passwort Zur\u00FCcksetzen',\n 'Sign Out': 'Abmelden',\n 'Sign Up': 'Registrieren',\n 'User already exists': 'Dieser Benutzer existiert bereits',\n 'User does not exist': 'Dieser Benutzer existiert nicht',\n 'Username cannot be empty': 'Benutzername darf nicht leer sein',\n};\n\nexport { deDict };\n", "const enDict = {\n 'Account recovery requires verified contact information': 'Account recovery requires verified contact information',\n 'Add your Profile': 'Add your Profile',\n 'Add your Website': 'Add your Website',\n 'Back to Sign In': 'Back to Sign In',\n 'Change Password': 'Change Password',\n Changing: 'Changing',\n Code: 'Code',\n 'Confirm Password': 'Confirm Password',\n 'Confirm Sign Up': 'Confirm Sign Up',\n 'Confirm SMS Code': 'Confirm SMS Code',\n 'Confirm MFA Code': 'Confirm MFA Code',\n 'Confirm TOTP Code': 'Confirm TOTP Code',\n Confirm: 'Confirm',\n 'Confirmation Code': 'Confirmation Code',\n Confirming: 'Confirming',\n 'Create a new account': 'Create a new account',\n 'Create Account': 'Create Account',\n 'Creating Account': 'Creating Account',\n 'Dismiss alert': 'Dismiss alert',\n Email: 'Email',\n 'Enter your Birthdate': 'Enter your Birthdate',\n 'Enter your code': 'Enter your code',\n 'Enter your Confirmation Code': 'Enter your Confirmation Code',\n 'Enter your Email': 'Enter your Email',\n 'Enter your Family Name': 'Enter your Family Name',\n 'Enter your Given Name': 'Enter your Given Name',\n 'Enter your Middle Name': 'Enter your Middle Name',\n 'Enter your Name': 'Enter your Name',\n 'Enter your Nickname': 'Enter your Nickname',\n 'Enter your Password': 'Enter your Password',\n 'Enter your phone number': 'Enter your phone number',\n 'Enter your Preferred Username': 'Enter your Preferred Username',\n 'Enter your username': 'Enter your username',\n 'Forgot password?': 'Forgot password?',\n 'Forgot your password?': 'Forgot your password?',\n 'Hide password': 'Hide password',\n 'It may take a minute to arrive': 'It may take a minute to arrive',\n Loading: 'Loading',\n 'New password': 'New password',\n or: 'or',\n Password: 'Password',\n 'Phone Number': 'Phone Number',\n 'Please confirm your Password': 'Please confirm your Password',\n 'Resend Code': 'Resend Code',\n 'Reset your password': 'Reset your password',\n 'Reset your Password': 'Reset your Password',\n 'Send code': 'Send code',\n 'Send Code': 'Send Code',\n Sending: 'Sending',\n 'Setup TOTP': 'Setup TOTP',\n 'Show password': 'Show password',\n 'Sign in to your account': 'Sign in to your account',\n 'Sign In with Amazon': 'Sign In with Amazon',\n 'Sign In with Apple': 'Sign In with Apple',\n 'Sign In with Facebook': 'Sign In with Facebook',\n 'Sign In with Google': 'Sign In with Google',\n 'Sign in': 'Sign in',\n 'Sign In': 'Sign In',\n 'Signing in': 'Signing in',\n Skip: 'Skip',\n Submit: 'Submit',\n Submitting: 'Submitting',\n Username: 'Username',\n 'Verify Contact': 'Verify Contact',\n Verify: 'Verify',\n 'We Emailed You': 'We Emailed You',\n 'We Sent A Code': 'We Sent A Code',\n 'We Texted You': 'We Texted You',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Your code is on the way. To log in, enter the code we emailed to',\n 'Your code is on the way. To log in, enter the code we sent you': 'Your code is on the way. To log in, enter the code we sent you',\n 'Your code is on the way. To log in, enter the code we texted to': 'Your code is on the way. To log in, enter the code we texted to',\n};\n\nexport { enDict };\n", "const esDict = {\n 'Account recovery requires verified contact information': 'La recuperaci\u00F3n de la cuenta requiere informaci\u00F3n de contacto verificada',\n 'Back to Sign In': 'Volver a inicio de sesi\u00F3n',\n 'Change Password': 'Cambiar contrase\u00F1a',\n Changing: 'Cambiando',\n Code: 'C\u00F3digo',\n 'Code *': 'C\u00F3digo *',\n 'Confirm Password': 'Confirmar contrase\u00F1a',\n 'Confirm Sign Up': 'Confirmar registro',\n 'Confirm SMS Code': 'Confirmar el c\u00F3digo de SMS',\n 'Confirm TOTP Code': 'Confirmar c\u00F3digo TOTP',\n Confirm: 'Confirmar',\n 'Confirmation Code': 'C\u00F3digo de confirmaci\u00F3n',\n Confirming: 'Confirmando',\n 'Create a new account': 'Crear una cuenta nueva',\n 'Create Account': 'Crear cuenta',\n 'Creating Account': 'Creando cuenta',\n 'Dismiss alert': 'Descartar alerta',\n Email: 'Email',\n 'Enter your code': 'Ingrese el c\u00F3digo',\n 'Enter your Email': 'Escriba su Email',\n 'Enter your email': 'Escriba su email',\n 'Enter your Password': 'Escriba su Contrase\u00F1a',\n 'Enter your phone number': 'Ingrese el n\u00FAmero de tel\u00E9fono',\n 'Enter your username': 'Ingrese el nombre de usuario',\n 'Forgot your password?': '\u00BFOlvid\u00F3 su contrase\u00F1a?',\n 'Hide password': 'Ocultar contrase\u00F1a',\n 'It may take a minute to arrive': 'Es posible que tarde un minuto en llegar',\n Loading: 'Cargando',\n 'New password': 'Nueva contrase\u00F1a',\n or: 'o',\n Password: 'Contrase\u00F1a',\n 'Phone Number': 'N\u00FAmero de tel\u00E9fono',\n 'Resend Code': 'Reenviar c\u00F3digo',\n 'Reset your password': 'Restablecer su contrase\u00F1a',\n 'Reset your Password': 'Restablecer su Contrase\u00F1a',\n 'Send code': 'Enviar c\u00F3digo',\n 'Send Code': 'Enviar c\u00F3digo',\n Sending: 'Enviando',\n 'Setup TOTP': 'Configurar TOTP',\n 'Show password': 'Mostrar contrase\u00F1a',\n 'Sign in to your account': 'Iniciar sesi\u00F3n en tu cuenta',\n 'Sign In with Amazon': 'Iniciar Sesi\u00F3n con Amazon',\n 'Sign In with Apple': 'Iniciar Sesi\u00F3n con Apple',\n 'Sign In with Facebook': 'Iniciar Sesi\u00F3n con Facebook',\n 'Sign In with Google': 'Iniciar Sesi\u00F3n con Google',\n 'Sign in': 'Iniciar sesi\u00F3n',\n 'Sign In': 'Iniciar Sesi\u00F3n',\n 'Signing in': 'Iniciando sesi\u00F3n',\n Skip: 'Omitir',\n Submit: 'Enviar',\n Submitting: 'Enviando',\n Username: 'Nombre de usuario',\n 'Verify Contact': 'Verificar contacto',\n Verify: 'Verificar',\n 'We Emailed You': 'Le hemos enviado un correo electr\u00F3nico',\n 'We Sent A Code': 'Hemos enviado un c\u00F3digo',\n 'We Texted You': 'Le hemos enviado un mensaje de texto',\n 'Your code is on the way. To log in, enter the code we emailed to': 'El c\u00F3digo est\u00E1 en camino. Para iniciar sesi\u00F3n, escriba el c\u00F3digo que hemos enviado por correo electr\u00F3nico a',\n 'Your code is on the way. To log in, enter the code we sent you': 'El c\u00F3digo est\u00E1 en camino. Para iniciar sesi\u00F3n, escriba el c\u00F3digo que le hemos enviado',\n 'Your code is on the way. To log in, enter the code we texted to': 'El c\u00F3digo est\u00E1 en camino. Para iniciar sesi\u00F3n, escriba el c\u00F3digo que hemos enviado por mensaje de texto a',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Ya existe una cuenta con el correo ingresado.',\n 'Confirm a Code': 'Confirmar un c\u00F3digo',\n 'Confirm Sign In': 'Confirmar inicio de sesi\u00F3n',\n 'Forgot Password': 'Olvid\u00E9 mi contrase\u00F1a',\n 'Incorrect username or password.': 'Nombre de usuario o contrase\u00F1a incorrecta',\n 'Enter your Family Name': 'Escriba su apellido',\n 'Enter your Given Name': 'Escriba su nombre',\n 'Given Name': 'Nombre',\n 'Family Name': 'Apellido',\n 'Reset Password': 'Restablecer contrase\u00F1a',\n 'Please confirm your Password': 'Confirme su contrase\u00F1a',\n 'Invalid password format': 'Formato de contrase\u00F1a inv\u00E1lido',\n 'Invalid phone number format': 'Formato de n\u00FAmero de tel\u00E9fono inv\u00E1lido',\n 'Loading...': 'Cargando...',\n 'New Password': 'Nueva contrase\u00F1a',\n 'Resend a Code': 'Reenviar un c\u00F3digo',\n 'Sign Out': 'Cerrar sesi\u00F3n',\n 'Sign Up with Amazon': 'Crear cuenta con Amazon',\n 'Sign Up with Apple': 'Crear cuenta con Apple',\n 'Sign Up with Facebook': 'Crear cuenta con Facebook',\n 'Sign Up with Google': 'Crear cuenta con Google',\n 'Sign Up': 'Crear cuenta',\n 'User already exists': 'El usuario ya existe',\n 'User does not exist': 'El usuario no existe',\n 'Username/client id combination not found.': 'El usuario no existe',\n 'Username cannot be empty': 'El nombre de usuario no puede estar vac\u00EDo',\n 'Your passwords must match': 'Las contrase\u00F1as deben coincidir',\n 'Password must have at least 8 characters': 'La contrase\u00F1a debe tener al menos 8 caracteres',\n 'Password did not conform with policy: Password must have uppercase characters': 'La contrase\u00F1a debe tener al menos un car\u00E1cter en may\u00FAscula',\n 'Password did not conform with policy: Password must have numeric characters': 'La contrase\u00F1a debe tener al menos un car\u00E1cter num\u00E9rico',\n 'Password did not conform with policy: Password must have symbol characters': 'La contrase\u00F1a debe tener al menos un s\u00EDmbolo',\n 'Password did not conform with policy: Password must have lowercase characters': 'La contrase\u00F1a debe tener al menos un car\u00E1cter en min\u00FAsculas',\n 'Invalid verification code provided, please try again.': 'C\u00F3digo de verificaci\u00F3n no v\u00E1lido, int\u00E9ntelo de nuevo.',\n 'Attempt limit exceeded, please try after some time.': 'N\u00FAmero m\u00E1ximo de intentos excedido, por favor int\u00E9ntelo de nuevo m\u00E1s tarde.',\n 'A network error has occurred.': 'Se ha producido un error de red.',\n};\n\nexport { esDict };\n", "const frDict = {\n 'Account recovery requires verified contact information': 'La r\u00E9cup\u00E9ration du compte n\u00E9cessite des informations de contact v\u00E9rifi\u00E9es',\n 'Back to Sign In': 'Retour \u00E0 la connexion',\n 'Change Password': 'Modifier le mot de passe',\n Changing: 'Modification en cours',\n Code: 'Code',\n 'Confirm Password': 'Confirmez le mot de passe',\n 'Confirm Sign Up': \"Confirmer l'inscription\",\n 'Confirm SMS Code': 'Confirmer le code SMS',\n 'Confirm TOTP Code': 'Confirmer le code TOTP',\n Confirm: 'Confirmer',\n 'Confirmation Code': 'Code de confirmation',\n Confirming: 'Confirmation',\n 'Create a new account': 'Cr\u00E9er un nouveau compte',\n 'Create Account': 'Cr\u00E9er un compte',\n 'Creating Account': `Cr\u00E9ation d'un compte`,\n 'Dismiss alert': `Supprimer l'alerte`,\n Email: 'Email',\n 'Enter your code': 'Saisissez cotre code de confirmation',\n 'Enter your Email': 'Saisissez votre adresse e-mail',\n 'Enter your email': 'Saisissez votre adresse e-mail',\n 'Enter your phone number': 'Saisissez votre num\u00E9ro de t\u00E9l\u00E9phone',\n 'Enter your username': \"Saisissez votre nom d'utilisateur\",\n 'Forgot your password?': 'Mot de passe oubli\u00E9 ? ',\n 'Hide password': 'Masquer le mot de passe',\n 'It may take a minute to arrive': 'Cela peut prendre une minute',\n Loading: 'Chargement en cours',\n 'New password': 'Nouveau mot de passe',\n or: 'ou',\n Password: 'Mot de passe',\n 'Phone Number': 'Num\u00E9ro de t\u00E9l\u00E9phone',\n 'Resend Code': 'Renvoyer le code',\n 'Reset your Password': 'R\u00E9initialiser votre mot de passe',\n 'Reset your password': 'R\u00E9initialisez votre mot de passe',\n 'Send code': 'Envoyer le code',\n 'Send Code': \"M'envoyer un code\",\n Sending: 'Envoi en cours',\n 'Setup TOTP': 'Configuration de TOTP',\n 'Show password': 'Afficher le mot de passe',\n 'Sign in to your account': 'Connexion \u00E0 votre compte',\n 'Sign In with Amazon': 'Se connecter avec Amazon',\n 'Sign In with Apple': 'Se connecter avec Apple',\n 'Sign In with Facebook': 'Se connecter avec Facebook',\n 'Sign In with Google': 'Se connecter avec Google',\n 'Sign in': 'Se connecter',\n 'Sign In': 'Se connecter',\n 'Signing in': 'Connexion en cours',\n Skip: 'Passer',\n Submit: 'Soumettre',\n Submitting: 'Envoi en cours',\n Username: \"Nom d'utilisateur\",\n 'Verify Contact': 'V\u00E9rifier le contact',\n Verify: 'V\u00E9rifier',\n 'We Sent A Code': 'Nous avons envoy\u00E9 un code',\n 'We Texted You': 'Nous vous avons envoy\u00E9 un SMS',\n 'Your code is on the way. To log in, enter the code we sent you': `Votre code est en cours d'envoi. Pour vous connecter, saisissez le code que nous vous avons envoy\u00E9`,\n // Additional translations provided by customers\n 'Add your Profile': 'Ajoutez votre profil',\n 'Add your Website': 'Ajoutez votre site web',\n 'An account with the given email already exists.': 'Un utilisateur avec cette adresse email existe d\u00E9j\u00E0.',\n Birthdate: 'Date de naissance',\n Change: 'Modifier',\n 'Confirm a Code': 'Confirmer un code',\n 'Confirm Sign In': 'Confirmer la connexion',\n 'Create account': 'Cr\u00E9er un compte',\n 'Enter your Birthdate': 'Saisissez votre date de naissance',\n 'Enter your Confirmation Code': 'Saisissez votre code de confirmation',\n 'Enter your Family Name': 'Saisissez votre nom de famille',\n 'Enter your Given Name': 'Saisissez votre pr\u00E9nom',\n 'Enter your Middle Name': 'Saisissez votre deuxi\u00E8me pr\u00E9nom',\n 'Enter your Name': 'Saisissez votre nom',\n 'Enter your Nickname': 'Saisissez votre surnom',\n 'Enter your Password': 'Saisissez votre mot de passe',\n 'Enter your Phone Number': 'Saisissez votre num\u00E9ro de t\u00E9l\u00E9phone',\n 'Enter your Preferred Username': \"Saisissez votre nom d'utilisateur\",\n 'Enter your password': 'Saisissez votre mot de passe',\n 'Given Name': 'Pr\u00E9nom',\n 'Family Name': 'Nom de famille',\n 'Forgot Password': 'Mot de passe oubli\u00E9',\n 'Forgot Password?': 'Mot de passe oubli\u00E9 ?',\n 'Incorrect username or password.': 'Identifiant ou mot de passe incorrect.',\n 'Have an account? ': 'D\u00E9j\u00E0 un compte ? ',\n Hello: 'Bonjour',\n 'Incorrect username or password': 'Identifiant ou mot de passe incorrect',\n 'Invalid password format': 'Format de mot de passe invalide',\n 'Invalid phone number format': `Format de num\u00E9ro de t\u00E9l\u00E9phone invalide. Veuillez utiliser un format +12345678900`,\n 'Loading...': 'Chargement...',\n 'Lost your code? ': 'Vous avez perdu votre code ? ',\n 'Network error': 'Erreur r\u00E9seau',\n 'New Password': 'Nouveau mot de passe',\n Name: 'Nom',\n 'No account? ': 'Pas de compte ? ',\n 'Please confirm your Password': 'Confirmez votre mot de passe',\n 'Preferred Username': \"Nom d'utilisateur pr\u00E9f\u00E9r\u00E9\",\n Profile: 'Profil',\n 'Resend a Code': 'Renvoyer un code',\n 'Reset password': 'R\u00E9initialiser le mot de passe',\n 'Reset Password': 'R\u00E9initialiser le mot de passe',\n Send: 'Envoyer',\n 'Sign In with AWS': 'Se connecter avec AWS',\n 'Sign Out': 'D\u00E9connexion',\n 'Sign Up': \"S'inscrire\",\n SMS: 'SMS',\n 'User already exists': \"L'utilisateur existe d\u00E9j\u00E0\",\n 'User does not exist': \"L'utilisateur n'existe pas\",\n 'Username cannot be empty': \"Le nom d'utilisateur doit \u00EAtre renseign\u00E9\",\n 'Username/client id combination not found.': \"L'utilisateur n'existe pas\",\n 'We Emailed You': 'Nous vous avons envoy\u00E9 un code',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Votre code est en route. Pour vous connecter entrez le code re\u00E7u sur cette adresse email',\n 'Your code is on the way. To log in, enter the code we texted to': 'Votre code est en route. Pour vous connecter entrez le code re\u00E7u sur ce num\u00E9ro de t\u00E9l\u00E9phone',\n 'Your passwords must match': 'Vos mots de passe doivent \u00EAtre identiques',\n 'It may take a minute to arrive.': 'Cela peut prendre quelques minutes.',\n Website: 'Site web',\n 'Password must have at least 8 characters': 'Le mot de passe doit comporter au moins 8 caract\u00E8res',\n 'Password did not conform with policy: Password must have uppercase characters': 'Le mot de passe doit comporter des caract\u00E8res majuscules',\n 'Password did not conform with policy: Password must have numeric characters': 'Le mot de passe doit comporter des caract\u00E8res num\u00E9riques',\n 'Password did not conform with policy: Password must have symbol characters': 'Le mot de passe doit comporter des symboles',\n 'Password did not conform with policy: Password must have lowercase characters': 'Le mot de passe doit comporter des caract\u00E8res minuscules',\n 'Invalid verification code provided, please try again.': 'Code de v\u00E9rification invalide, veuillez r\u00E9essayer.',\n 'Attempt limit exceeded, please try after some time.': 'Nombre maximum de tentatives d\u00E9pass\u00E9, veuillez r\u00E9essayer plus tard.',\n 'A network error has occurred.': \"Une erreur de r\u00E9seau s'est produite.\",\n};\n\nexport { frDict };\n", "const itDict = {\n 'Account recovery requires verified contact information': \"Il ripristino dell'account richiede informazioni di contatto verificate\",\n 'Back to Sign In': 'Torna alla schermata di accesso',\n 'Change Password': 'Cambia la password',\n Changing: 'Modifica in corso',\n Code: 'Codice',\n 'Confirm Password': 'Conferma la password',\n 'Confirm Sign Up': 'Conferma registrazione',\n 'Confirm SMS Code': 'Conferma codice SMS',\n 'Confirm TOTP Code': 'Conferma codice TOTP',\n Confirm: 'Conferma',\n 'Confirmation Code': 'Codice di verifica',\n Confirming: 'Conferma in corso',\n 'Create a new account': 'Crea un nuovo account',\n 'Create Account': 'Crea Account',\n 'Creating Account': 'Creazione account in corso',\n 'Dismiss alert': `Ignora l'avviso`,\n Email: 'Email',\n 'Enter your code': 'Inserisci il tuo codice',\n 'Enter your Email': 'Inserisci la tua e-mail',\n 'Enter your phone number': 'Inserisci il tuo numero di telefono\"',\n 'Enter your username': 'Inserisci il tuo nome utente',\n 'Forgot your password?': 'Password dimenticata?',\n 'Hide password': 'Nascondi password',\n 'It may take a minute to arrive': \"L'arrivo potrebbe richiedere qualche minuto\",\n Loading: 'Caricamento in corso',\n 'New password': 'Nuova password',\n or: 'oppure',\n Password: 'Password',\n 'Phone Number': 'Numero di telefono',\n 'Resend Code': 'Invia nuovamente il codice',\n 'Reset your Password': 'Reimposta la tua Password',\n 'Reset your password': 'Reimposta la tua password',\n 'Send code': 'Invia codice',\n 'Send Code': 'Invia codice',\n Sending: 'Invio in corso',\n 'Setup TOTP': 'Configura TOTP',\n 'Show password': 'Mostra password',\n 'Sign in to your account': 'Accedi al tuo account',\n 'Sign In with Amazon': 'Accedi con Amazon',\n 'Sign In with Apple': 'Accedi con Apple',\n 'Sign In with Facebook': 'Accedi con Facebook',\n 'Sign In with Google': 'Accedi con Google',\n 'Sign in': 'Accedi',\n 'Sign In': 'Accedi',\n 'Signing in': 'Accesso in corso',\n Skip: 'Salta',\n Submit: 'Invia',\n Submitting: 'Invio in corso',\n Username: 'Nome utente',\n 'Verify Contact': 'Verifica contatto',\n Verify: 'Verifica',\n 'We Emailed You': \"Ti abbiamo inviato un'e-mail\",\n 'We Sent A Code': 'Ti abbiamo inviato un codice',\n 'We Texted You': 'Ti abbiamo inviato un SMS',\n 'Your code is on the way. To log in, enter the code we emailed to': \"Il codice \u00E8 in arrivo. Per effettuare l'accesso, immetti il codice che ti abbiamo inviato via e-mail\",\n 'Your code is on the way. To log in, enter the code we sent you': 'Il codice \u00E8 in arrivo. Per accedere, immetti il codice che ti abbiamo inviato',\n 'Your code is on the way. To log in, enter the code we texted to': 'Il codice \u00E8 in arrivo. Per accedere, immetti il codice che abbiamo inviato tramite SMS',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Questa email \u00E8 gi\u00E0 utilizzata da un altro account.',\n 'Confirm a Code': 'Conferma un codice',\n 'Confirm Sign In': \"Conferma l'accesso\",\n 'Create account': 'Crea account',\n 'Enter your password': 'Inserisci la tua password',\n 'Forgot Password?': 'Password dimenticata?',\n 'Have an account? ': 'Gi\u00E0 registrato?',\n 'Incorrect username or password': 'Nome utente o password errati',\n 'Invalid password format': 'Formato della password non valido',\n 'Invalid phone number format': 'Formato del numero di telefono non valido',\n 'Lost your code?': 'Codice smarrito?',\n 'New Password': 'Nuova password',\n 'No account? ': 'Non hai un account?',\n 'Password attempts exceeded': 'Il numero massimo di tentativi di accesso falliti \u00E8 stato raggiunto',\n 'Reset password': 'Reimposta password',\n 'Sign Out': 'Esci',\n 'Sign Up': 'Registrati',\n 'User already exists': 'Utente gi\u00E0 esistente',\n 'User does not exist': 'Utente inesistente',\n 'Username cannot be empty': 'Il nome utente non pu\u00F2 essere vuoto',\n};\n\nexport { itDict };\n", "const jaDict = {\n 'Account recovery requires verified contact information': '\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u5FA9\u65E7\u306B\u306F\u78BA\u8A8D\u6E08\u307F\u306E\u9023\u7D61\u5148\u304C\u5FC5\u8981\u3067\u3059',\n 'Back to Sign In': '\u30B5\u30A4\u30F3\u30A4\u30F3\u306B\u623B\u308B',\n 'Change Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u3048\u308B ',\n Changing: '\u5909\u66F4\u4E2D',\n Code: '\u30B3\u30FC\u30C9',\n 'Confirm Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u78BA\u8A8D',\n 'Confirm Sign Up': '\u767B\u9332\u3059\u308B',\n 'Confirm SMS Code': 'SMS \u30B3\u30FC\u30C9\u3092\u78BA\u8A8D',\n 'Confirm TOTP Code': 'TOTP \u30B3\u30FC\u30C9\u3092\u78BA\u8A8D',\n Confirm: '\u78BA\u5B9A',\n 'Confirmation Code': '\u78BA\u8A8D\u30B3\u30FC\u30C9',\n Confirming: '\u78BA\u8A8D\u4E2D',\n 'Create a new account': '\u65B0\u3057\u3044\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u308B',\n 'Create Account': '\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u308B',\n 'Creating Account': '\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4F5C\u6210\u4E2D',\n 'Dismiss alert': '\u30A2\u30E9\u30FC\u30C8\u3092\u9589\u3058\u308B',\n Email: '\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9',\n 'Enter your code': '\u30B3\u30FC\u30C9\u3092\u5165\u529B',\n 'Enter your Email': '\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B',\n 'Enter your phone number': '\u96FB\u8A71\u756A\u53F7\u3092\u5165\u529B',\n 'Enter your username': '\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u5165\u529B ',\n 'Enter your Username': '\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u5165\u529B ',\n 'Forgot your password?': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5FD8\u308C\u307E\u3057\u305F\u304B\uFF1F ',\n 'Hide password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u975E\u8868\u793A',\n 'It may take a minute to arrive': '\u5230\u7740\u3059\u308B\u307E\u3067\u306B 1 \u5206\u304B\u304B\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059',\n Loading: '\u30ED\u30FC\u30C9\u4E2D',\n 'New password': '\u65B0\u3057\u3044\u30D1\u30B9\u30EF\u30FC\u30C9',\n or: '\u53C8\u306F',\n Password: '\u30D1\u30B9\u30EF\u30FC\u30C9 ',\n 'Phone Number': '\u96FB\u8A71\u756A\u53F7',\n 'Resend Code': '\u30B3\u30FC\u30C9\u3092\u518D\u9001\u4FE1',\n 'Reset your Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8',\n 'Reset your password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8\u3059\u308B',\n 'Send code': '\u30B3\u30FC\u30C9\u3092\u9001\u4FE1',\n 'Send Code': '\u30B3\u30FC\u30C9\u3092\u9001\u4FE1',\n Sending: '\u9001\u4FE1\u4E2D',\n 'Setup TOTP': 'TOTP \u3092\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7',\n 'Show password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8868\u793A',\n 'Sign in to your account': '\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u30B5\u30A4\u30F3\u30A4\u30F3 ',\n 'Sign In with Amazon': 'Amazon\u3067\u30B5\u30A4\u30F3\u30A4\u30F3',\n 'Sign In with Apple': 'Apple \u3067\u30B5\u30A4\u30F3\u30A4\u30F3',\n 'Sign In with Facebook': 'Facebook\u3067\u30B5\u30A4\u30F3\u30A4\u30F3',\n 'Sign In with Google': 'Google\u3067\u30B5\u30A4\u30F3\u30A4\u30F3',\n 'Sign In': '\u30B5\u30A4\u30F3\u30A4\u30F3 ',\n 'Sign in': '\u30B5\u30A4\u30F3\u30A4\u30F3',\n 'Signing in': '\u30B5\u30A4\u30F3\u30A4\u30F3\u4E2D',\n Skip: '\u30B9\u30AD\u30C3\u30D7',\n Submit: '\u9001\u4FE1',\n Submitting: '\u9001\u4FE1\u4E2D',\n Username: '\u30E6\u30FC\u30B6\u30FC\u540D ',\n 'Verify Contact': '\u9023\u7D61\u5148\u3092\u78BA\u8A8D',\n Verify: '\u78BA\u8A8D',\n 'We Sent A Code': '\u30B3\u30FC\u30C9\u304C\u9001\u4FE1\u3055\u308C\u307E\u3057\u305F',\n 'We Texted You': '\u30C6\u30AD\u30B9\u30C8\u304C\u9001\u4FE1\u3055\u308C\u307E\u3057\u305F',\n 'Your code is on the way. To log in, enter the code we sent you': '\u30B3\u30FC\u30C9\u304C\u9014\u4E2D\u3067\u3059\u3002\u30ED\u30B0\u30A4\u30F3\u3059\u308B\u306B\u306F\u3001\u9001\u4FE1\u3057\u305F\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044',\n // Additional translations provided by customers\n 'An account with the given email already exists.': '\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059',\n 'Confirm a Code': '\u30B3\u30FC\u30C9\u3092\u78BA\u8A8D',\n 'Confirm Sign In': '\u30B5\u30A4\u30F3\u30A4\u30F3\u3059\u308B',\n 'Create account': '\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u4F5C\u308B ',\n 'Enter your password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B ',\n 'Enter your Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B',\n 'Please confirm your Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B',\n 'Forgot Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5FD8\u308C\u305F ',\n 'Have an account? ': '\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u6301\u3063\u3066\u3044\u307E\u3059\u304B\uFF1F',\n 'Incorrect username or password': '\u30E6\u30FC\u30B6\u30FC\u540D\u304B\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u7570\u306A\u308A\u307E\u3059 ',\n 'Invalid password format': '\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u5F62\u5F0F\u304C\u7121\u52B9\u3067\u3059 ',\n 'Invalid phone number format': '\u4E0D\u6B63\u306A\u96FB\u8A71\u756A\u53F7\u306E\u5F62\u5F0F\u3067\u3059\u3002\\n+12345678900 \u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044',\n 'It may take a minute to arrive.': '\u30B3\u30FC\u30C9\u3092\u53D7\u4FE1\u3059\u308B\u307E\u3067\u6570\u5206\u304B\u304B\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002',\n 'Lost your code? ': '\u30B3\u30FC\u30C9\u3092\u5931\u304F\u3057\u307E\u3057\u305F\u304B\uFF1F',\n 'New Password': '\u65B0\u3057\u3044\u30D1\u30B9\u30EF\u30FC\u30C9',\n 'No account? ': '\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u7121\u3044\u3068\u304D ',\n 'Password attempts exceeded': '\u30B5\u30A4\u30F3\u30A4\u30F3\u306E\u8A66\u884C\u56DE\u6570\u304C\u4E0A\u9650\u306B\u9054\u3057\u307E\u3057\u305F',\n 'Reset password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8 ',\n 'Reset Password': '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8',\n 'Sign Out': '\u30B5\u30A4\u30F3\u30A2\u30A6\u30C8 ',\n 'Sign Up': '\u767B\u9332 ',\n 'User already exists': '\u65E2\u306B\u30E6\u30FC\u30B6\u30FC\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u3059 ',\n 'User does not exist': '\u30E6\u30FC\u30B6\u30FC\u304C\u5B58\u5728\u3057\u307E\u305B\u3093 ',\n 'Username cannot be empty': '\u30E6\u30FC\u30B6\u30FC\u540D\u306F\u5165\u529B\u5FC5\u9808\u3067\u3059',\n 'We Emailed You': '\u30B3\u30FC\u30C9\u3092\u9001\u4FE1\u3057\u307E\u3057\u305F',\n 'Your code is on the way. To log in, enter the code we emailed to': '\u30ED\u30B0\u30A4\u30F3\u3059\u308B\u306B\u306F\u3001\u30E1\u30FC\u30EB\u306B\u8A18\u8F09\u3055\u308C\u305F\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u9001\u4FE1\u5148:',\n 'Your code is on the way. To log in, enter the code we texted to': '\u30ED\u30B0\u30A4\u30F3\u3059\u308B\u306B\u306F\u3001\u30C6\u30AD\u30B9\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u8A18\u8F09\u3055\u308C\u305F\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u9001\u4FE1\u5148:',\n};\n\nexport { jaDict };\n", "const krDict = {\n 'Account recovery requires verified contact information': '\uACC4\uC815 \uBCF5\uAD6C\uB97C \uC704\uD574 \uC5F0\uB77D\uCC98 \uD655\uC778\uC774 \uD544\uC694\uD569\uB2C8\uB2E4',\n 'Back to Sign In': '\uB85C\uADF8\uC778\uC73C\uB85C \uB3CC\uC544\uAC00\uAE30',\n 'Change Password': '\uBE44\uBC00\uBC88\uD638 \uBCC0\uACBD\uD558\uAE30',\n Changing: '\uBCC0\uACBD\uC911',\n Code: '\uCF54\uB4DC',\n 'Confirm Password': '\uBE44\uBC00\uBC88\uD638 \uC7AC\uD655\uC778',\n 'Confirm Sign Up': '\uD68C\uC6D0\uAC00\uC785 \uD655\uC778',\n 'Confirm SMS Code': '\uD734\uB300\uD3F0 \uBCF8\uC778 \uD655\uC778',\n 'Confirm TOTP Code': 'TOTP \uC778\uC99D\uBC88\uD638 \uD655\uC778',\n Confirm: '\uD655\uC778',\n 'Confirmation Code': '\uC778\uC99D\uBC88\uD638',\n Confirming: '\uD655\uC778\uC911',\n 'Create a new account': '\uD68C\uC6D0\uAC00\uC785',\n 'Create Account': '\uD68C\uC6D0\uAC00\uC785',\n 'Creating Account': '\uD68C\uC6D0\uAC00\uC785\uC911',\n 'Dismiss alert': '\uC54C\uB9BC \uBB34\uC2DC',\n Email: '\uC774\uBA54\uC77C',\n 'Enter your Birthdate': '\uC0DD\uB144\uC6D4\uC77C \uC785\uB825',\n 'Enter your code': '\uC778\uC99D\uBC88\uD638\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694',\n 'Enter your Confirmation Code': '\uD655\uC778 \uCF54\uB4DC \uC785\uB825',\n 'Enter your Email': '\uC774\uBA54\uC77C \uC785\uB825',\n 'Enter your Family Name': '\uC131 \uC785\uB825',\n 'Enter your Given Name': '\uC0AC\uC6A9\uC7A5 \uC774\uB984 \uC785\uB825',\n 'Enter your Name': '\uC774\uB984 \uC785\uB825',\n 'Enter your Nickname': '\uB2C9\uB124\uC784 \uC785\uB825',\n 'Enter your Password': '\uBE44\uBC00\uBC88\uD638 \uC785\uB825',\n 'Enter your phone number': '\uC804\uD654\uBC88\uD638 \uC785\uB825',\n 'Enter your Preferred Username': '\uC120\uD638\uD558\uB294 \uC544\uC774\uB514 \uC785\uB825',\n 'Enter your username': '\uC544\uC774\uB514\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694',\n 'Forgot password?': '\uBE44\uBC00\uBC88\uD638\uB97C \uC78A\uC73C\uC168\uB098\uC694?',\n 'Hide password': '\uBE44\uBC00\uBC88\uD638 \uC228\uAE30\uAE30',\n 'It may take a minute to arrive': '\uB3C4\uCC29\uD558\uB294 \uB370 1\uBD84 \uC815\uB3C4 \uAC78\uB9B4 \uC218 \uC788\uC2B5\uB2C8\uB2E4',\n Loading: '\uB85C\uB529\uC911',\n 'New password': '\uC0C8 \uBE44\uBC00\uBC88\uD638',\n or: '\uB610\uB294',\n Password: '\uBE44\uBC00\uBC88\uD638',\n 'Phone Number': '\uC804\uD654\uBC88\uD638',\n 'Please confirm your Password': '\uBE44\uBC00\uBC88\uD638\uB97C \uD655\uC778\uD574 \uC8FC\uC138\uC694.',\n 'Resend Code': '\uC778\uC99D\uBC88\uD638 \uC7AC\uC804\uC1A1',\n 'Reset your password': '\uBE44\uBC00\uBC88\uD638 \uC7AC\uC124\uC815',\n 'Reset your Password': '\uBE44\uBC00\uBC88\uD638 \uC7AC\uC124\uC815',\n 'Send code': '\uC778\uC99D\uCF54\uB4DC \uBCF4\uB0B4\uAE30',\n 'Send Code': '\uCF54\uB4DC \uC804\uC1A1',\n Sending: '\uC804\uC1A1\uC911',\n 'Setup TOTP': 'TOTP \uC124\uC815\uD558\uAE30',\n 'Show password': '\uBE44\uBC00\uBC88\uD638 \uBCF4\uC774\uAE30',\n 'Sign in to your account': '\uB85C\uADF8\uC778',\n 'Sign In with Amazon': 'Amazon \uB85C\uADF8\uC778',\n 'Sign In with Apple': 'Apple \uB85C\uADF8\uC778',\n 'Sign In with Facebook': 'Facebook \uB85C\uADF8\uC778',\n 'Sign In with Google': 'Google \uB85C\uADF8\uC778',\n 'Sign in': '\uB85C\uADF8\uC778',\n 'Sign In': '\uB85C\uADF8\uC778',\n 'Signing in': '\uB85C\uADF8\uC778\uC911',\n Skip: '\uB2E4\uC74C\uC5D0 \uD558\uAE30',\n Submit: '\uD655\uC778',\n Submitting: '\uD655\uC778\uC911',\n Username: '\uC544\uC774\uB514',\n 'Verify Contact': '\uC5F0\uB77D\uCC98 \uD655\uC778',\n Verify: '\uC778\uC99D',\n 'We Emailed You': '\uC774\uBA54\uC77C\uC744 \uBCF4\uB0C4',\n 'We Sent A Code': '\uCF54\uB4DC\uB97C \uBCF4\uB0C4',\n 'We Texted You': '\uBB38\uC790 \uBA54\uC2DC\uC9C0\uB97C \uBCF4\uB0C4',\n 'Your code is on the way. To log in, enter the code we emailed to': '\uCF54\uB4DC\uAC00 \uC804\uC1A1 \uC911\uC785\uB2C8\uB2E4. \uB85C\uADF8\uC778\uD558\uB824\uBA74 \uC774\uBA54\uC77C\uB85C \uC804\uC1A1\uD55C \uCF54\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694',\n 'Your code is on the way. To log in, enter the code we sent you': '\uCF54\uB4DC\uAC00 \uC804\uC1A1 \uC911\uC785\uB2C8\uB2E4. \uB85C\uADF8\uC778\uD558\uB824\uBA74 \uC804\uC1A1\uD55C \uCF54\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694',\n 'Your code is on the way. To log in, enter the code we texted to': '\uCF54\uB4DC\uAC00 \uC804\uC1A1 \uC911\uC785\uB2C8\uB2E4. \uB85C\uADF8\uC778\uD558\uB824\uBA74 \uBB38\uC790 \uBA54\uC2DC\uC9C0\uB85C \uC804\uC1A1\uD55C \uCF54\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694',\n // Additional translations provided by customers\n Birthdate: '\uC0DD\uB144\uC6D4\uC77C',\n 'Family Name': '\uC131',\n 'Forgot your password?': '\uBE44\uBC00\uBC88\uD638\uB97C \uC78A\uC73C\uC168\uB098\uC694?',\n 'Given Name': '\uC774\uB984',\n Name: '\uC131\uD568',\n Nickname: '\uB2C9\uB124\uC784',\n 'Preferred Username': '\uB2C9\uB124\uC784',\n Profile: '\uD504\uB85C\uD544',\n 'Reset Password': '\uBE44\uBC00\uBC88\uD638 \uC7AC\uC124\uC815',\n Website: '\uC6F9\uC0AC\uC774\uD2B8',\n};\n\nexport { krDict };\n", "const nbDict = {\n 'Account recovery requires verified contact information': 'Gjenoppretting av konto krever verifisert kontaktinformajson',\n 'Add your Profile': 'Legg til profilen din',\n 'Add your Website': 'Legg til nettsiden din',\n 'Back to Sign In': 'Tilbake til innlogging',\n 'Change Password': 'Bytt passord',\n Changing: 'Endre',\n Code: 'Kode',\n 'Confirm Password': 'Bekreft passordet',\n 'Confirm Sign Up': 'Bekreft registrering',\n 'Confirm SMS Code': 'Bekreft SMS-kode',\n 'Confirm TOTP Code': 'Bekreft TOTP-kode',\n Confirm: 'Bekreft',\n 'Confirmation Code': 'Bekreftelseskode',\n Confirming: 'Bekrefter',\n 'Create a new account': 'Opprett en ny konto',\n 'Create Account': 'Opprett konto',\n 'Creating Account': 'Oppretter konto',\n 'Dismiss alert': 'Avvis varsel',\n Email: 'E-post',\n 'Enter your Birthdate': 'Skriv inn f\u00F8dselsdatoen din',\n 'Enter your code': 'Skriv inn koden din',\n 'Enter your Confirmation Code': 'Skriv inn bekreftelseskoden din',\n 'Enter your Email': 'Skriv inn e-postadressen din',\n 'Enter your Family Name': 'Skriv inn etternavnet ditt',\n 'Enter your Given Name': 'Skriv inn fornavnet ditt',\n 'Enter your Middle Name': 'Skriv inn mellomnavnet ditt',\n 'Enter your Name': 'Skriv inn navnet ditt',\n 'Enter your Nickname': 'Skriv inn kallenavnet ditt',\n 'Enter your Password': 'Skriv inn passordet ditt',\n 'Enter your phone number': 'Skriv inn telefonnummeret ditt',\n 'Enter your Preferred Username': 'Skriv inn det foretrukne brukernavnet ditt',\n 'Enter your username': 'Skriv inn brukernavnet ditt',\n 'Forgot password?': 'Glemt passord?',\n 'Forgot your password?': 'Glemt passordet ditt?',\n 'Hide password': 'Skjul passordet',\n 'It may take a minute to arrive': 'Det kan ta et minutt for \u00E5 komme frem',\n Loading: 'Laster inn',\n 'New password': 'Nytt passord',\n or: 'eller',\n Password: 'Passord',\n 'Phone Number': 'Telefonnummer',\n 'Please confirm your Password': 'Vennligst bekreft passordet ditt',\n 'Resend Code': 'Send koden p\u00E5 nytt',\n 'Reset your password': 'Nullstill passordet ditt',\n 'Reset your Password': 'Nullstill passordet ditt',\n 'Send code': 'Send kode',\n 'Send Code': 'Send kode',\n Sending: 'Sender',\n 'Setup TOTP': 'Konfigurer TOTP',\n 'Show password': 'Vis passordet',\n 'Sign in to your account': 'Logg inn p\u00E5 kontoen din',\n 'Sign In with Amazon': 'Logg inn med Amazon',\n 'Sign In with Apple': 'Logg inn med Apple',\n 'Sign In with Facebook': 'Logg inn med Facebook',\n 'Sign In with Google': 'Logg inn med Google',\n 'Sign in': 'Logg inn',\n 'Sign In': 'Logg inn',\n 'Signing in': 'Logger inn',\n Skip: 'Hopp over',\n Submit: 'Send inn',\n Submitting: 'Sender inn',\n Username: 'Brukernavn',\n 'Verify Contact': 'Bekreft kontakt',\n Verify: 'Bekreft',\n 'We Emailed You': 'Vi sendte deg en e-post',\n 'We Sent A Code': 'Vi sendte en kode',\n 'We Texted You': 'Vi sendte deg en tekstmelding',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Koden din er p\u00E5 vei. For \u00E5 logge inn, skriv inn koden vi sendte e-post til',\n 'Your code is on the way. To log in, enter the code we sent you': 'Koden din er p\u00E5 vei. For \u00E5 logge inn, skriv inn koden vi sendte deg',\n 'Your code is on the way. To log in, enter the code we texted to': 'Koden din er p\u00E5 vei. For \u00E5 logge inn, skriv inn koden vi sendte tekstmelding til',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Det finnes allerede en konto med denne e-postadressen',\n 'Confirm a Code': 'Bekreft koden',\n 'Confirm Sign In': 'Bekreft innlogging',\n 'Create account': 'Opprett konto',\n 'Enter your password': 'Skriv inn passordet ditt',\n 'Forgot Password': 'Glemt passordet',\n 'Have an account? ': 'Har en konto allerede? ',\n 'Incorrect username or password': 'Feil brukernavn eller passord',\n 'Invalid password format': 'Ugyldig passordformat',\n 'Invalid phone number format': 'Ugyldig telefonnummerformat',\n 'Lost your code? ': 'Mistet koden? ',\n 'New Password': 'Nytt passord',\n 'No account? ': 'Ingen konto? ',\n 'Password attempts exceeded': 'For mange mislykkede passordfors\u00F8k',\n 'Reset password': 'Nullstill passord',\n 'Sign Out': 'Logg ut',\n 'Sign Up': 'Registrering',\n 'User already exists': 'Brukeren finnes allerede',\n 'User does not exist': 'Brukeren finnes ikke',\n 'Username cannot be empty': 'Brukernavnet kan ikke v\u00E6re tomt',\n};\n\nexport { nbDict };\n", "const nlDict = {\n 'Account recovery requires verified contact information': 'Accountherstel vereist geverifieerde contactgegevens',\n 'Back to Sign In': 'Terug naar inloggen',\n 'Change Password': 'Wachtwoord wijzigen',\n Changing: 'Wordt aangepast',\n Code: 'Code',\n 'Confirm Password': 'Bevestig Wachtwoord',\n 'Confirm Sign Up': 'Bevestig inschrijving',\n 'Confirm SMS Code': 'Bevestig SMS Code',\n 'Confirm TOTP Code': 'Bevestig TOTP Code',\n Confirm: 'Bevestig',\n 'Confirmation Code': 'Bevestigingscode',\n Confirming: 'Bevestigen',\n 'Create a new account': 'Nieuw account aanmaken',\n 'Create Account': 'Account aanmaken',\n 'Creating Account': 'Account wordt aangemaakt',\n 'Dismiss alert': 'Waarschuwing sluiten',\n Email: 'E-mail',\n 'Enter your code': 'Vul je code in',\n 'Enter your Email': 'Vul je e-mail in',\n 'Enter your Password': 'Vul je wachtwoord in',\n 'Enter your phone number': 'Vul je telefoonnummer in',\n 'Enter your username': 'Vul je gebruikersnaam in',\n 'Enter your Username': 'Vul je gebruikersnaam in',\n 'Forgot your password?': 'Wachtwoord vergeten? ',\n 'Hide password': 'Verberg wachtwoord',\n 'It may take a minute to arrive': 'Het kan even duren voordat deze aankomt',\n Loading: 'Laden',\n 'New password': 'Nieuw wachtwoord',\n 'New Password': 'Nieuw Wachtwoord',\n or: 'of',\n Password: 'Wachtwoord',\n 'Phone Number': 'Telefoonnummer',\n 'Please confirm your Password': 'Bevestig je wachtwoord',\n 'Resend Code': 'Verstuur code nogmaals',\n 'Reset Password': 'Wachtwoord resetten',\n 'Reset your password': 'Reset je wachtwoord',\n 'Reset your Password': 'Wachtwoord resetten',\n 'Send code': 'Verstuur code',\n 'Send Code': 'Verstuur Code',\n Sending: 'Versturen',\n 'Setup TOTP': 'TOTP Instellingen',\n 'Show password': 'Toon wachtwoord',\n 'Sign in to your account': 'Inloggen op je account',\n 'Sign In with Amazon': 'Inloggen met Amazon',\n 'Sign In with Apple': 'Inloggen met Apple',\n 'Sign In with Facebook': 'Inloggen met Facebook',\n 'Sign In with Google': 'Inloggen met Google',\n 'Sign in': 'Inloggen',\n 'Sign In': 'Inloggen',\n 'Signing in': 'Inloggen',\n Skip: 'Overslaan',\n Submit: 'Versturen',\n Submitting: 'Wordt verstuurd',\n Username: 'Gebruikersnaam',\n 'Verify Contact': 'Verifieer Contact',\n Verify: 'Verifieer',\n 'We Emailed You': 'We hebben u een e-mail gestuurd',\n 'We Sent A Code': 'We hebben een code gestuurd',\n 'We Texted You': 'We hebben u een sms gestuurd',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Uw code is onderweg. Om in te loggen, voer de code in die we gemaild hebben naar',\n 'Your code is on the way. To log in, enter the code we sent you': 'Uw code is onderweg. Om in te loggen, voer de code in die we u hebben gestuurd',\n 'Your code is on the way. To log in, enter the code we texted to': 'Uw code is onderweg. Om in te loggen, voer de code in die we hebben gestuurd naar',\n 'Your passwords must match': 'Je wachtwoorden moeten overeenkomen',\n};\n\nexport { nlDict };\n", "const plDict = {\n 'Account recovery requires verified contact information': 'Odzyskanie konta wymaga zweryfikowanych danych kontaktowych',\n 'Back to Sign In': 'Powr\u00F3t do logowania',\n 'Change Password': 'Zmie\u0144 has\u0142o',\n Changing: 'Zmienianie',\n Code: 'Kod',\n 'Confirm Password': 'Potwierd\u017A Has\u0142o',\n 'Confirm Sign Up': 'Potwierd\u017A rejestracj\u0119',\n 'Confirm SMS Code': 'Potwierd\u017A kod SMS',\n 'Confirm TOTP Code': 'Potwierd\u017A has\u0142o jednorazowe',\n Confirm: 'Potwierd\u017A',\n 'Confirmation Code': 'Kod potwierdzenia',\n Confirming: 'Potwierdzanie',\n 'Create a new account': 'Utw\u00F3rz nowe konto',\n 'Create Account': 'Utw\u00F3rz konto',\n 'Creating Account': 'Tworzenie konta',\n 'Dismiss alert': 'Odrzu\u0107 alert',\n Email: 'E-mail',\n 'Enter your code': 'Wprowad\u017A sw\u00F3j kod',\n 'Enter your Email': 'Wpisz sw\u00F3j adres e-mail',\n 'Enter your phone number': 'Wpisz sw\u00F3j numer telefonu',\n 'Enter your username': 'Wprowad\u017A swoj\u0105 nazw\u0119 u\u017Cytkownika',\n 'Forgot your password?': 'Zapomnia\u0142e\u015B has\u0142a? ',\n 'Hide password': 'Ukryj has\u0142o',\n 'It may take a minute to arrive': 'Mo\u017Ce to chwil\u0119 potrwa\u0107',\n Loading: '\u0141adowanie',\n 'New password': 'Nowe has\u0142o',\n or: 'albo',\n Password: 'Has\u0142o',\n 'Phone Number': 'Numer telefonu',\n 'Resend Code': 'Wy\u015Blij kod ponownie',\n 'Reset your password': 'Zresetuj swoje has\u0142o',\n 'Reset your Password': 'Zresetuj swoje has\u0142o',\n 'Send code': 'Wy\u015Blij kod',\n 'Send Code': 'Zresetuj has\u0142o',\n Sending: 'Wysy\u0142anie',\n 'Setup TOTP': 'Konfiguruj TOTP',\n 'Show password': 'Poka\u017C has\u0142o',\n 'Sign in to your account': 'Zaloguj si\u0119 na swoje konto',\n 'Sign In with Amazon': 'Zaloguj z Amazon',\n 'Sign In with Apple': 'Zaloguj z Apple',\n 'Sign In with Facebook': 'Zaloguj z Facebook',\n 'Sign In with Google': 'Zaloguj z Google',\n 'Sign In': 'Logowanie',\n 'Sign in': 'Zaloguj',\n 'Signing in': 'Logowanie',\n Skip: 'Pomi\u0144',\n Submit: 'Wy\u015Blij',\n Submitting: 'Wysy\u0142anie',\n Username: 'Nazwa u\u017Cytkownika',\n 'Verify Contact': 'Weryfikacja danych kontaktowych',\n Verify: 'Zweryfikuj',\n // Additional translations provided by customers\n Birthdate: 'Data urodzenia',\n 'Family Name': 'Nazwisko',\n 'Given Name': 'Pierwsze imi\u0119',\n 'Middle Name': 'Drugie imi\u0119',\n Name: 'Imi\u0119 i nazwisko',\n Nickname: 'Pseudonim',\n 'Preferred Username': 'Preferowana nazwa u\u017Cytkownika',\n Profile: 'Profil',\n Website: 'Strona internetowa',\n 'We Emailed You': 'Wys\u0142ali\u015Bmy Ci wiadomo\u015B\u0107 e-mail',\n 'We Sent A Code': 'Wys\u0142ali\u015Bmy kod',\n 'We Texted You': 'Wys\u0142ali\u015Bmy Ci wiadomo\u015B\u0107 SMS',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Tw\u00F3j kod zosta\u0142 wys\u0142any. Aby si\u0119 zalogowa\u0107, wprowad\u017A kod wys\u0142any na adres e-mail',\n 'Your code is on the way. To log in, enter the code we sent you': 'Tw\u00F3j kod zosta\u0142 wys\u0142any. Aby si\u0119 zalogowa\u0107, wprowad\u017A wys\u0142any do Ciebie kod',\n 'Your code is on the way. To log in, enter the code we texted to': 'Tw\u00F3j kod zosta\u0142 wys\u0142any. Aby si\u0119 zalogowa\u0107, wprowad\u017A kod wys\u0142any do Ciebie w wiadomo\u015Bci SMS pod numer',\n};\n\nexport { plDict };\n", "const ptDict = {\n 'Account recovery requires verified contact information': 'A recupera\u00E7\u00E3o da conta requer informa\u00E7\u00F5es de contato verificadas',\n 'Add your Profile': 'Adicione seu Perfil',\n 'Add your Website': 'Adicione seu Website',\n 'Back to Sign In': 'Voltar para Entrar',\n 'Change Password': 'Mudar senha',\n Changing: 'Mudando',\n Code: 'C\u00F3digo',\n 'Confirm Password': 'Confirme a Senha',\n 'Confirm Sign Up': 'Confirmar inscri\u00E7\u00E3o',\n 'Confirm SMS Code': 'Confirme o c\u00F3digo SMS',\n 'Confirm MFA Code': 'Confirme o c\u00F3digo MFA',\n 'Confirm TOTP Code': 'Confirme o c\u00F3digo TOTP',\n Confirm: 'confirme',\n 'Confirmation Code': 'C\u00F3digo de confirma\u00E7\u00E3o',\n Confirming: 'Confirmando',\n 'Create a new account': 'Criar uma nova conta',\n 'Create Account': 'Criar Conta',\n 'Creating Account': 'Criando conta',\n 'Dismiss alert': 'Descartar alerta',\n Email: 'O email',\n 'Enter your Birthdate': 'Digite sua Data de Nascimento',\n 'Enter your code': 'Insira seu c\u00F3digo',\n 'Enter your Confirmation Code': 'Digite seu c\u00F3digo de confirma\u00E7\u00E3o',\n 'Enter your Email': 'Digite seu e-mail',\n 'Enter your Family Name': 'Digite seu Sobrenome',\n 'Enter your Given Name': 'Digite seu Primeiro Nome',\n 'Enter your Middle Name': 'Digite seu Nome do Meio',\n 'Enter your Name': 'Digite seu Nome',\n 'Enter your Nickname': 'Digite seu Apelido',\n 'Enter your Password': 'Digite sua senha',\n 'Enter your phone number': 'Digite seu n\u00FAmero de telefone',\n 'Enter your Preferred Username': 'Digite seu nome de usu\u00E1rio preferido',\n 'Enter your username': 'Digite seu nome de usu\u00E1rio',\n 'Forgot password?': 'Esqueceu a senha?',\n 'Forgot your password?': 'Esqueceu sua senha?',\n 'Hide password': 'Esconder a senha',\n 'It may take a minute to arrive': 'Pode levar um minuto para chegar',\n Loading: 'Carregando',\n 'New password': 'Nova Senha',\n or: 'ou',\n Password: 'Senha',\n 'Phone Number': 'N\u00FAmero de telefone',\n 'Please confirm your Password': 'Por favor confirme sua Senha',\n 'Resend Code': 'Reenviar c\u00F3digo',\n 'Reset your password': 'Redefina sua senha',\n 'Reset your Password': 'Redefina sua senha',\n 'Send code': 'Enviar c\u00F3digo',\n 'Send Code': 'Enviar c\u00F3digo',\n Sending: 'Enviando',\n 'Setup TOTP': 'Configurar TOTP',\n 'Show password': 'Mostrar senha',\n 'Sign in to your account': 'Fa\u00E7a login em sua conta',\n 'Sign In with Amazon': 'Entrar com a Amazon',\n 'Sign In with Apple': 'Entrar com a Apple',\n 'Sign In with Facebook': 'Entrar com o Facebook',\n 'Sign In with Google': 'Fa\u00E7a login no Google',\n 'Sign in': 'Entrar',\n 'Sign In': 'Entrar',\n 'Signing in': 'Entrando',\n Skip: 'Pular',\n Submit: 'Enviar',\n Submitting: 'Enviando',\n Username: 'Nome do usu\u00E1rio',\n 'Verify Contact': 'Verificar contato',\n Verify: 'Verificar',\n 'We Emailed You': 'Enviamos um e-mail para voc\u00EA',\n 'We Sent A Code': 'Enviamos um c\u00F3digo',\n 'We Texted You': 'Enviamos um SMS para voc\u00EA',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Seu c\u00F3digo est\u00E1 a caminho. Para fazer login, insira o c\u00F3digo para o qual enviamos um e-mail',\n 'Your code is on the way. To log in, enter the code we sent you': 'Seu c\u00F3digo est\u00E1 a caminho. Para fazer login, insira o c\u00F3digo que enviamos para voc\u00EA',\n 'Your code is on the way. To log in, enter the code we texted to': 'Seu c\u00F3digo est\u00E1 a caminho. Para fazer login, insira o c\u00F3digo para o qual enviamos uma mensagem de texto',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'J\u00E1 existe uma conta com o email utilizado.',\n 'Confirm a Code': 'Confirmar um C\u00F3digo',\n 'Confirm Sign In': 'Confirmar In\u00EDcio de Sess\u00E3o',\n 'Forgot Password': 'Esqueci Minha Senha',\n 'Incorrect username or password.': 'Nome de usu\u00E1rio ou senha incorreta',\n 'Invalid password format': 'Formato de senha inv\u00E1lido',\n 'Invalid phone number format': 'Formato de n\u00FAmero de telefone inv\u00E1lido',\n 'Loading...': 'Carregando...',\n 'New Password': 'Nova Senha',\n 'Resend a Code': 'Reenviar um C\u00F3digo',\n 'Sign Out': 'Sair',\n 'Sign Up with Amazon': 'Criar Conta com a Amazon',\n 'Sign Up with Apple': 'Criar Conta com a Apple',\n 'Sign Up with Facebook': 'Criar Conta com o Facebook',\n 'Sign Up with Google': 'Criar Conta com o Google',\n 'Sign Up': 'Criar Conta',\n 'User already exists': 'Usu\u00E1rio j\u00E1 existe',\n 'User does not exist': 'Usu\u00E1rio n\u00E3o existe',\n 'Username cannot be empty': 'Nome de usu\u00E1rio n\u00E3o pode estar vazio',\n 'Your passwords must match': 'Suas senhas devem ser iguais',\n};\n\nexport { ptDict };\n", "const zhDict = {\n 'Account recovery requires verified contact information': '\u8D26\u6237\u6062\u590D\u9700\u8981\u9A8C\u8BC1\u8FC7\u7684\u8054\u7CFB\u65B9\u5F0F',\n 'Back to Sign In': '\u56DE\u5230\u767B\u5F55',\n 'Change Password': '\u66F4\u6539\u5BC6\u7801',\n Changing: '\u6B63\u5728\u4FEE\u6539',\n Code: '\u786E\u8BA4\u7801',\n 'Confirm Password': '\u786E\u8BA4\u5BC6\u7801',\n 'Confirm Sign Up': '\u786E\u8BA4\u6CE8\u518C',\n 'Confirm SMS Code': '\u786E\u8BA4\u77ED\u4FE1\u9A8C\u8BC1\u7801',\n 'Confirm TOTP Code': '\u786E\u8BA4 TOTP \u4EE3\u7801',\n Confirm: '\u786E\u8BA4',\n 'Confirmation Code': '\u786E\u8BA4\u7801',\n Confirming: '\u6B63\u5728\u786E\u8BA4',\n 'Create a new account': '\u521B\u5EFA\u65B0\u8D26\u6237',\n 'Create Account': '\u521B\u5EFA\u8D26\u6237',\n 'Creating Account': '\u6B63\u5728\u521B\u5EFA\u8D26\u6237',\n 'Dismiss alert': '\u5173\u95ED\u8B66\u62A5',\n Email: '\u90AE\u7BB1',\n 'Enter your code': '\u8F93\u5165\u9A8C\u8BC1\u7801',\n 'Enter your Email': '\u8F93\u5165\u7535\u5B50\u90AE\u4EF6',\n 'Enter your phone number': '\u8F93\u5165\u7535\u8BDD\u53F7\u7801',\n 'Enter your username': '\u8F93\u5165\u7528\u6237\u540D',\n 'Forgot your password?': '\u5FD8\u8BB0\u5BC6\u7801\u4E86\uFF1F',\n 'Hide password': '\u9690\u85CF\u5BC6\u7801',\n 'It may take a minute to arrive': '\u53EF\u80FD\u9700\u8981\u4E00\u5206\u949F\u624D\u80FD\u5230\u8FBE',\n Loading: '\u6B63\u5728\u52A0\u8F7D',\n 'New password': '\u65B0\u5BC6\u7801',\n or: '\u6216\u8005',\n Password: '\u5BC6\u7801',\n 'Phone Number': '\u7535\u8BDD',\n 'Resend Code': '\u91CD\u53D1\u9A8C\u8BC1\u7801',\n 'Reset your password': '\u91CD\u7F6E\u5BC6\u7801',\n 'Reset your Password': '\u91CD\u7F6E\u5BC6\u7801',\n 'Send Code': '\u53D1\u9001\u786E\u8BA4\u7801',\n 'Send code': '\u53D1\u9001\u9A8C\u8BC1\u7801',\n Sending: '\u6B63\u5728\u53D1\u9001',\n 'Setup TOTP': '\u8BBE\u7F6E TOTP',\n 'Show password': '\u663E\u793A\u5BC6\u7801',\n 'Sign in to your account': '\u767B\u5F55\u8D26\u6237',\n 'Sign In with Amazon': '\u901A\u8FC7 Amazon \u767B\u5F55',\n 'Sign In with Apple': '\u901A\u8FC7 Apple \u767B\u5F55',\n 'Sign In with Facebook': '\u901A\u8FC7 Facebook \u767B\u5F55',\n 'Sign In with Google': '\u901A\u8FC7 Google \u767B\u5F55',\n 'Sign in': '\u767B\u5F55',\n 'Sign In': '\u767B\u5F55',\n 'Signing in': '\u6B63\u5728\u767B\u5F55',\n Skip: '\u8DF3\u8FC7',\n Submit: '\u63D0\u4EA4',\n Submitting: '\u6B63\u5728\u63D0\u4EA4',\n Username: '\u7528\u6237\u540D',\n 'Verify Contact': '\u9A8C\u8BC1\u8054\u7CFB\u65B9\u5F0F',\n Verify: '\u9A8C\u8BC1',\n 'We Emailed You': '\u6211\u4EEC\u7ED9\u60A8\u53D1\u9001\u4E86\u7535\u5B50\u90AE\u4EF6',\n 'We Sent A Code': '\u6211\u4EEC\u53D1\u9001\u4E86\u4EE3\u7801',\n 'We Texted You': '\u6211\u4EEC\u7ED9\u60A8\u53D1\u9001\u4E86\u77ED\u4FE1',\n 'Your code is on the way. To log in, enter the code we emailed to': '\u60A8\u7684\u4EE3\u7801\u6B63\u5728\u53D1\u9001\u4E2D\u3002\u8981\u767B\u5F55\uFF0C\u8BF7\u8F93\u5165\u6211\u4EEC\u901A\u8FC7\u7535\u5B50\u90AE\u4EF6\u53D1\u9001\u7ED9\u4EE5\u4E0B\u4EBA\u5458\u7684\u4EE3\u7801\uFF1A',\n 'Your code is on the way. To log in, enter the code we sent you': '\u60A8\u7684\u4EE3\u7801\u6B63\u5728\u53D1\u9001\u4E2D\u3002\u8981\u767B\u5F55\uFF0C\u8BF7\u8F93\u5165\u6211\u4EEC\u53D1\u9001\u7ED9\u60A8\u7684\u4EE3\u7801',\n 'Your code is on the way. To log in, enter the code we texted to': '\u60A8\u7684\u4EE3\u7801\u6B63\u5728\u53D1\u9001\u4E2D\u3002\u8981\u767B\u5F55\uFF0C\u8BF7\u8F93\u5165\u6211\u4EEC\u901A\u8FC7\u77ED\u4FE1\u53D1\u9001\u7ED9\u4EE5\u4E0B\u4EBA\u5458\u7684\u4EE3\u7801\uFF1A',\n // Additional translations provided by customers\n 'Confirm a Code': '\u786E\u8BA4\u7801',\n 'Confirm Sign In': '\u786E\u8BA4\u767B\u5F55',\n 'Forgot Password': '\u5FD8\u8BB0\u5BC6\u7801',\n 'Incorrect username or password': '\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF',\n 'Invalid password format': '\u5BC6\u7801\u683C\u5F0F\u9519\u8BEF',\n 'Invalid phone number format': '\u7535\u8BDD\u683C\u5F0F\u9519\u8BEF\uFF0C\u8BF7\u4F7F\u7528\u683C\u5F0F +12345678900',\n 'New Password': '\u65B0\u5BC6\u7801',\n 'Resend a Code': '\u91CD\u53D1\u786E\u8BA4\u7801',\n 'Sign Out': '\u9000\u51FA',\n 'Sign Up': '\u6CE8\u518C',\n 'User already exists': '\u7528\u6237\u5DF2\u7ECF\u5B58\u5728',\n 'User does not exist': '\u7528\u6237\u4E0D\u5B58\u5728',\n};\n\nexport { zhDict };\n", "const svDict = {\n 'Account recovery requires verified contact information': 'F\u00F6r att \u00E5terst\u00E4lla kontot beh\u00F6ver du ett verifierat konto',\n 'Back to Sign In': 'Tillbaka till inloggningen',\n 'Change Password': 'Byt l\u00F6senord',\n Changing: '\u00C4ndra',\n Code: 'Kod',\n 'Confirm Password': 'Bekr\u00E4fta l\u00F6senord',\n 'Confirm Sign Up': 'Bekr\u00E4fta registrering',\n 'Confirm SMS Code': 'Bekr\u00E4fta SMS-kod',\n 'Confirm TOTP Code': 'Bekr\u00E4fta TOTP-kod',\n Confirm: 'Bekr\u00E4fta',\n 'Confirmation Code': 'Verifikationskod',\n Confirming: 'Bekr\u00E4ftar',\n 'Create a new account': 'Skapa ett nytt konto',\n 'Create Account': 'Skapa konto',\n 'Creating Account': 'Skapar konto',\n 'Dismiss alert': 'Avvisa varning',\n Email: 'E-post',\n 'Enter your code': 'Skriv din kod',\n 'Enter your Email': 'Fyll i din e-post',\n 'Enter your phone number': 'Ange ditt telefonnummer',\n 'Enter your username': 'Ange ditt anv\u00E4ndarnamn',\n 'Forgot your password?': 'Gl\u00F6mt ditt l\u00F6senord? ',\n 'Hide password': 'D\u00F6lj l\u00F6senord',\n 'It may take a minute to arrive': 'Det kan ta en minut att komma fram',\n Loading: 'Laddar',\n 'New password': 'Nytt l\u00F6senord',\n or: 'eller',\n Password: 'L\u00F6senord',\n 'Phone Number': 'Telefonnummer',\n 'Resend Code': 'Skicka koden igen',\n 'Reset your password': '\u00C5terst\u00E4ll ditt l\u00F6senord',\n 'Reset your Password': '\u00C5terst\u00E4ll ditt l\u00F6senord',\n 'Send code': 'Skicka kod',\n 'Send Code': 'Skicka kod',\n Sending: 'Skickar',\n 'Setup TOTP': 'Konfigurera TOTP',\n 'Show password': 'Visa l\u00F6senord',\n 'Sign in to your account': 'Logga in till ditt konto',\n 'Sign In with Amazon': 'Logga in med Amazon',\n 'Sign In with Apple': 'Logga in med Apple',\n 'Sign In with Facebook': 'Logga in med Facebook',\n 'Sign In with Google': 'Logga in med Google',\n 'Sign in': 'Logga in',\n 'Sign In': 'Logga in',\n 'Signing in': 'Loggar in',\n Skip: 'Hoppa \u00F6ver',\n Submit: 'Skicka',\n Submitting: 'Skickar in',\n Username: 'Anv\u00E4ndarnamn',\n 'Verify Contact': 'Verifiera kontakt',\n Verify: 'Verifiera',\n 'We Sent A Code': 'Vi skickade en kod',\n 'We Texted You': 'Vi sms:ade dig',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Din kod \u00E4r p\u00E5 v\u00E4g. F\u00F6r att logga in, ange koden vi mejlade till',\n 'Your code is on the way. To log in, enter the code we sent you': 'Din kod \u00E4r p\u00E5 v\u00E4g. F\u00F6r att logga in, ange koden vi skickade till dig',\n 'Your code is on the way. To log in, enter the code we texted to': 'Din kod \u00E4r p\u00E5 v\u00E4g. F\u00F6r att logga in, ange koden vi sms:ade till',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Det finns redan ett konto med denna e-postadress',\n 'Confirm a Code': 'Bekr\u00E4fta koden',\n 'Confirm Sign In': 'Bekr\u00E4fta inloggning',\n 'Create account': 'Skapa konto',\n 'Enter your password': 'Ange ditt l\u00F6senord',\n 'Forgot Password': 'Gl\u00F6mt l\u00F6senordet',\n 'Have an account? ': 'Redan registrerad? ',\n 'Incorrect username or password': 'Felaktigt anv\u00E4ndarnamn eller l\u00F6senord',\n 'Invalid password format': 'Ogiltigt l\u00F6senordsformat',\n 'Invalid phone number format': `Ogiltigt format f\u00F6r telefonnummer`,\n 'Lost your code? ': 'F\u00F6rlorat koden? ',\n 'New Password': 'Nytt l\u00F6senord',\n 'No account? ': 'Inget konto? ',\n 'Password attempts exceeded': 'Maximalt antal felaktiga inloggningsf\u00F6rs\u00F6k har uppn\u00E5tts',\n 'Reset password': '\u00C5terst\u00E4ll l\u00F6senord',\n 'Sign Out': 'Logga ut',\n 'Sign Up': 'Registrering',\n 'User already exists': 'Anv\u00E4ndaren finns redan',\n 'User does not exist': 'Anv\u00E4ndaren finns inte',\n 'Username cannot be empty': 'Anv\u00E4ndarnamnet kan inte vara tomt',\n 'We Emailed You': 'Vi har skickat e-post till dig',\n};\n\nexport { svDict };\n", "const idDict = {\n 'Account recovery requires verified contact information': 'Pemulihan akun memerlukan informasi kontak terverifikasi',\n 'Back to Sign In': 'Kembali ke Masuk',\n 'Change Password': 'Ubah kata sandi',\n Changing: 'Mengubah',\n Code: 'Kode',\n 'Confirm Password': 'Konfirmasi kata sandi',\n 'Confirm Sign Up': 'Konfirmasi Pendaftaran',\n 'Confirm SMS Code': 'Konfirmasi Kode SMS',\n 'Confirm TOTP Code': 'Konfirmasi Kode TOTP',\n Confirm: 'Konfirmasi',\n 'Confirmation Code': 'Kode Konfirmasi',\n Confirming: 'Mengkonfirmasi',\n 'Create a new account': 'Buat akun baru',\n 'Create Account': 'Buat Akun',\n 'Creating Account': 'Membuat Akun',\n 'Dismiss alert': 'Hentikan pemberitahuan',\n Email: 'Email',\n 'Enter your code': 'Masukkan kode anda',\n 'Enter your Email': 'Masukkan email anda',\n 'Enter your phone number': 'Masukkan nomor telepon anda',\n 'Enter your username': 'Masukkan nama akun anda',\n 'Forgot your password?': 'Lupa kata sandi? ',\n 'Hide password': 'Sembunyikan kata sandi',\n 'It may take a minute to arrive': 'Mungkin perlu waktu satu menit untuk tiba',\n Loading: 'Memuat',\n 'New password': 'Kata sandi baru',\n or: 'atau',\n Password: 'Kata sandi',\n 'Phone Number': 'Nomor telepon',\n 'Resend Code': 'Kirim ulang kodenya',\n 'Reset your Password': 'Reset Kata Sandi',\n 'Reset your password': 'Ubah kata sandi anda',\n 'Send code': 'Kirim kode',\n 'Send Code': 'Kirim Kode',\n Sending: 'Mengirim',\n 'Setup TOTP': 'Siapkan TOTP',\n 'Show password': 'Tampilkan kata sandi',\n 'Sign in to your account': 'Masuk akun anda',\n 'Sign In with Amazon': 'Masuk dengan Amazon',\n 'Sign In with Apple': 'Masuk dengan Apple',\n 'Sign In with Facebook': 'Masuk dengan Facebook',\n 'Sign In with Google': 'Masuk dengan Google',\n 'Sign in': 'Masuk',\n 'Sign In': 'Masuk',\n 'Signing in': 'Memasuki',\n Skip: 'Lewati',\n Submit: 'Ajukan',\n Submitting: 'Mengajukan',\n Username: 'Nama akun',\n 'Verify Contact': 'Verifikasi Kontak',\n Verify: 'Verifikasi',\n 'We Sent A Code': 'Kami Mengirim Kode',\n 'We Texted You': 'Kami mengirim SMS kepada Anda',\n 'Your code is on the way. To log in, enter the code we sent you': 'Kode Anda segera hadir. Untuk masuk, masukkan kode yang kami kirimkan kepada Anda',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Akun dengan email tersebut sudah terdaftar.',\n 'Attempt limit exceeded, please try after some time.': 'Batas percobaan terlampaui, mohon coba lagi setelah beberapa waktu.',\n 'Cannot reset password for the user as there is no registered/verified email or phone_number': 'Tidak dapat mengatur ulang kata sandi karena tidak ada email terdaftar / terverifikasi atau nomor telepon',\n Change: 'Ubah',\n 'Confirm a Code': 'Konfirmasi kode',\n 'Create account': 'Buat akun',\n 'Enter your password': 'Masukkan kata sandi anda',\n 'Forgot Password': 'Lupa kata sandi',\n 'Have an account? ': 'Sudah punya akun? ',\n Hello: 'Halo',\n 'Incorrect username or password.': 'Nama akun atau kata sandi salah.',\n 'Invalid phone number format': 'Nomor telepon tidak sesuai dengan format.',\n 'Invalid verification code provided, please try again.': 'Kode verifikasi tidak sesuai, mohon coba lagi.',\n 'It may take a minute to arrive.': 'Mungkin perlu beberapa waktu untuk tiba.',\n 'Lost your code? ': 'Kode anda hilang?',\n Name: 'Nama',\n 'Network error': 'Galat jaringan',\n 'No account? ': 'Tidak ada akun?',\n 'Password did not conform with policy: Password not long enough': 'Kata sandi tidak sesuai dengan aturan: Kata sandi kurang panjang',\n 'Resend a Code': 'Renvoyer un code',\n 'Reset password': 'Ubah kata sandi anda',\n Send: 'Kirim',\n 'Sign In with AWS': 'Masuk dengan AWS',\n 'Sign Up with Amazon': 'Daftar dengan Amazon',\n 'Sign Up with AWS': 'Daftar dengan AWS',\n 'Sign Up with Facebook': 'Daftar dengan Facebook',\n 'Sign Up with Google': 'Daftar dengan Google',\n SMS: 'SMS',\n 'User already exists': 'Akun sudah terdaftar',\n 'User does not exist.': 'Akun tidak terdaftar.',\n 'User is disabled.': 'Akun dinonaktifkan.',\n 'Username cannot be empty': 'Nama akun tidak boleh kosong',\n 'Username/client id combination not found.': 'Nama akun atau id tidak ditemukan.',\n 'We Emailed You': 'Kami mengirimkanmu email',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Kode anda dalam pengiriman. Untuk masuk, masukkan kode yang kami emailkan ke',\n 'Your code is on the way. To log in, enter the code we texted to': 'Kode anda dalam pengiriman. Untuk masuk, masukkan kode yang kami tuliskan ke',\n 'Your passwords must match': 'Kata sandi harus sama',\n};\n\nexport { idDict };\n", "const trDict = {\n 'Account recovery requires verified contact information': 'Hesap kurtarma, do\u011Frulanm\u0131\u015F ileti\u015Fim bilgilerini gerektirir',\n 'Add your Profile': 'Profilinizi ekleyin',\n 'Add your Website': 'Web sitenizi ekleyin',\n 'Back to Sign In': 'Oturum A\u00E7maya Geri D\u00F6n',\n 'Change Password': '\u015Eifreyi De\u011Fi\u015Ftir',\n Changing: 'De\u011Fi\u015Ftiriliyor',\n Code: 'Kod',\n 'Confirm Password': '\u015Eifreyi Do\u011Frula',\n 'Confirm Sign Up': 'Kay\u0131t \u0130\u015Flemini Do\u011Frula',\n 'Confirm SMS Code': 'SMS Kodunu Do\u011Frula',\n 'Confirm MFA Code': '\u00C7oklu Fakt\u00F6rl\u00FC Do\u011Frulama Kodunu Do\u011Frula',\n 'Confirm TOTP Code': 'Tek Kullan\u0131ml\u0131k \u015Eifreyi Do\u011Frula',\n Confirm: 'Do\u011Frula',\n 'Confirmation Code': 'Do\u011Frulama Kodu',\n Confirming: 'Do\u011Frulan\u0131yor',\n 'Create a new account': 'Yeni bir hesap olu\u015Ftur',\n 'Create Account': 'Hesap Olu\u015Ftur',\n 'Creating Account': 'Hesap Olu\u015Fturuluyor',\n 'Dismiss alert': 'Uyar\u0131y\u0131 reddet',\n Email: 'E-posta',\n 'Enter your Birthdate': 'Do\u011Fum g\u00FCn\u00FCn\u00FCz\u00FC girin',\n 'Enter your code': 'Kodu girin',\n 'Enter your Confirmation Code': 'Do\u011Frulama Kodunuzu Girin',\n 'Enter your Email': 'E-posta adresinizi girin',\n 'Enter your email': 'E-posta adresinizi girin',\n 'Enter your Family Name': 'Ad Soyad\u0131n\u0131z\u0131 girin',\n 'Enter your Given Name': 'Ad\u0131n\u0131z\u0131 girin',\n 'Enter your Middle Name': 'Soyad\u0131n\u0131z\u0131 girin',\n 'Enter your Name': 'Ad\u0131n\u0131z\u0131 girin',\n 'Enter your Nickname': 'Takma ad\u0131n\u0131z\u0131 girin',\n 'Enter your Password': '\u015Eifrenizi girin',\n 'Enter your phone number': 'Telefon numaran\u0131z\u0131 girin',\n 'Enter your Preferred Username': 'Tercih etti\u011Finiz kullan\u0131c\u0131 ad\u0131n\u0131z\u0131 girin',\n 'Enter your username': 'Kullan\u0131c\u0131 ad\u0131n\u0131z\u0131 girin',\n 'Forgot Password?': '\u015Eifrenizi Mi Unuttunuz?',\n 'Forgot password?': '\u015Eifrenizi mi unuttunuz?',\n 'Forgot your password?': '\u015Eifrenizi mi unuttunuz?',\n 'Hide password': '\u015Eifreyi gizle',\n 'It may take a minute to arrive': 'Kodun gelmesi bir dakika s\u00FCrebilir',\n Loading: 'Y\u00FCkleniyor',\n 'New password': 'Yeni \u015Fifre',\n or: 'veya',\n Password: '\u015Eifre',\n 'Phone Number': 'Telefon Numaras\u0131',\n 'Please confirm your Password': 'L\u00FCtfen \u015Fifrenizi do\u011Frulay\u0131n',\n 'Resend Code': 'Kodu Yeniden G\u00F6nder',\n 'Reset your password': '\u015Eifrenizi s\u0131f\u0131rlay\u0131n',\n 'Reset your Password': '\u015Eifrenizi S\u0131f\u0131rlay\u0131n',\n 'Reset Password': '\u015Eifreyi S\u0131f\u0131rla',\n 'Send code': 'Kod g\u00F6nder',\n 'Send Code': 'Kod G\u00F6nder',\n Sending: 'G\u00F6nderiliyor',\n 'Setup TOTP': 'Tek kullan\u0131ml\u0131k \u015Fifre kurulumu yap',\n 'Show password': '\u015Eifreyi g\u00F6ster',\n 'Sign in to your account': 'Hesab\u0131n\u0131zda oturum a\u00E7\u0131n',\n 'Sign In with Amazon': 'Amazon ile Oturum A\u00E7',\n 'Sign In with Apple': 'Apple ile Oturum A\u00E7',\n 'Sign In with Facebook': 'Facebook ile Oturum A\u00E7',\n 'Sign In with Google': 'Google ile Oturum A\u00E7',\n 'Sign in': 'Oturum a\u00E7',\n 'Sign In': 'Oturum A\u00E7',\n 'Sign Up with Facebook': 'Facebook ile Kay\u0131t Ol',\n 'Sign Up with Google': 'Google ile Kay\u0131t Ol',\n 'Signing in': 'Oturum a\u00E7\u0131l\u0131yor',\n Skip: 'Atla',\n Submit: 'G\u00F6nder',\n Submitting: 'G\u00F6nderiliyor',\n Username: 'Kullan\u0131c\u0131 ad\u0131',\n 'Verify Contact': 'Ki\u015Fiyi Do\u011Frula',\n Verify: 'Do\u011Frula',\n 'We Emailed You': 'Size E-posta G\u00F6nderdik',\n 'We Sent A Code': 'Bir Kod G\u00F6nderdik',\n 'We Texted You': 'Size Mesaj G\u00F6nderdik',\n 'Your code is on the way. To log in, enter the code we emailed to': 'Kodunuz yolda. Oturum a\u00E7mak i\u00E7in, g\u00F6nderdi\u011Fimiz e-postadaki kodu girin',\n 'Your code is on the way. To log in, enter the code we sent you': 'Kodunuz yolda. Oturum a\u00E7mak i\u00E7in, size g\u00F6nderdi\u011Fimiz kodu girin',\n 'Your code is on the way. To log in, enter the code we texted to': 'Kodunuz yolda. Oturum a\u00E7mak i\u00E7in, g\u00F6nderdi\u011Fimiz mesajdaki kodu girin',\n // Additional translations provided by customers\n 'An account with the given email already exists.': 'Bu e-postaya ait zaten bir hesap var.',\n 'Confirm Sign In': 'Oturum A\u00E7may\u0131 Do\u011Frula',\n 'Have an account? ': 'Hesab\u0131n\u0131z var m\u0131? ',\n 'Incorrect username or password': 'Yanl\u0131\u015F kullan\u0131c\u0131 ad\u0131 ya da \u015Fifre',\n 'Invalid password format': 'Ge\u00E7ersiz parola format\u0131',\n 'Invalid phone number format': 'Ge\u00E7ersiz telefon numaras\u0131 format\u0131',\n 'Lost your code? ': 'Kodu mu kaybettiniz? ',\n 'No account? ': 'Hesab\u0131n\u0131z yok mu? ',\n 'Password attempts exceeded': 'Maksimum oturum a\u00E7ma giri\u015Fimi a\u015F\u0131ld\u0131',\n 'Sign Out': '\u00C7\u0131k\u0131\u015F yap',\n 'Sign Up': 'Kay\u0131t Ol',\n 'User already exists': 'Bu kullan\u0131c\u0131 zaten var',\n 'User does not exist': 'B\u00F6yle bir kullan\u0131c\u0131 mevcut de\u011Fil',\n 'Username cannot be empty': 'Kullan\u0131c\u0131 ad\u0131 bo\u015F olamaz'\n};\n\nexport { trDict };\n", "const ruDict = {\n 'Account recovery requires verified contact information': '\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0443\u0447\u0435\u0442\u043D\u043E\u0439 \u0437\u0430\u043F\u0438\u0441\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043A\u043E\u043D\u0442\u0430\u043A\u0442\u043D\u043E\u0439 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438',\n 'Back to Sign In': '\u041D\u0430\u0437\u0430\u0434, \u0447\u0442\u043E\u0431\u044B \u0432\u043E\u0439\u0442\u0438',\n 'Change Password': '\u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C',\n Changing: '\u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435',\n Code: '\u041A\u043E\u0434',\n 'Confirm Password': '\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435 \u043F\u0430\u0440\u043E\u043B\u044F',\n 'Confirm Sign Up': '\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C\u0441\u044F',\n 'Confirm SMS Code': '\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435 CMC-\u041A\u043E\u0434',\n 'Confirm TOTP Code': '\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435 TOTP-\u041A\u043E\u0434',\n Confirm: '\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044C',\n 'Confirmation Code': '\u043A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F',\n Confirming: '\u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435',\n 'Create a new account': '\u0421\u043E\u0437\u0434\u0430\u0432\u0430\u0442\u044C \u043D\u043E\u0432\u0443\u044E \u0443\u0447\u0435\u0442\u043D\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C',\n 'Create Account': '\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0443\u0447\u0435\u0442\u043D\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C',\n 'Creating Account': '\u0441\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u0443\u0447\u0435\u0442\u043D\u0430\u044F \u0437\u0430\u043F\u0438\u0441\u044C',\n 'Dismiss alert': '\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043E\u043F\u043E\u0432\u0435\u0449\u0435\u043D\u0438\u0435',\n Email: '\u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430',\n 'Enter your code': '\u0432\u0432\u0435\u0441\u0442\u0438 \u0432\u0430\u0448 \u041A\u043E\u0434',\n 'Enter your Email': '\u0432\u0432\u0435\u0441\u0442\u0438 \u0432\u0430\u0448 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430',\n 'Enter your phone number': '\u0432\u0432\u0435\u0441\u0442\u0438 \u0432\u0430\u0448 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430',\n 'Enter your username': '\u0432\u0432\u0435\u0441\u0442\u0438 \u0432\u0430\u0448 \u0438\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F',\n 'Forgot your password?': '\u0417\u0430\u0431\u044B\u043B\u0438 \u0432\u0430\u0448 \u043F\u0430\u0440\u043E\u043B\u044C?',\n 'Hide password': '\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C',\n 'It may take a minute to arrive': '\u0414\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u043C\u043E\u0436\u0435\u0442 \u0437\u0430\u043D\u044F\u0442\u044C \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u043E\u0435 \u0432\u0440\u0435\u043C\u044F',\n Loading: '\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430',\n 'New password': '\u041D\u043E\u0432\u044B\u0439 \u043F\u0430\u0440\u043E\u043B\u044C',\n or: '\u0438\u043B\u0438',\n Password: '\u041F\u0430\u0440\u043E\u043B\u044C',\n 'Phone Number': '\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430',\n 'Resend Code': '\u041E\u0442\u043F\u0440\u0430\u0432\u044C \u0435\u0449\u0435 \u0440\u0430\u0437 \u041A\u043E\u0434',\n 'Reset your password': '\u0441\u0431\u0440\u043E\u0441 \u0432\u0430\u0448 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Reset your Password': '\u0441\u0431\u0440\u043E\u0441 \u0432\u0430\u0448 \u041F\u0430\u0440\u043E\u043B\u044C',\n 'Send code': '\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u041A\u043E\u0434',\n 'Send Code': '\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u041A\u043E\u0434',\n Sending: '\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0430',\n 'Setup TOTP': '\u041D\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044C TOTP',\n 'Show password': '\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Sign in to your account': '\u0437\u043D\u0430\u043A \u0432 \u0441\u0432\u043E\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442',\n 'Sign In with Amazon': '\u0437\u043D\u0430\u043A \u0432 \u0441 Amazon',\n 'Sign In with Apple': '\u0437\u043D\u0430\u043A \u0432 \u0441 Apple',\n 'Sign In with Facebook': '\u0437\u043D\u0430\u043A \u0432 \u0441 Facebook',\n 'Sign In with Google': '\u0437\u043D\u0430\u043A \u0432 \u0441 Google',\n 'Sign in': '\u0437\u043D\u0430\u043A \u0432',\n 'Sign In': '\u0437\u043D\u0430\u043A \u0432',\n 'Signing in': '\u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0432',\n Skip: '\u041F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u0442\u044C',\n Submit: '\u041F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u043D\u0430 \u0440\u0430\u0441\u0441\u043C\u043E\u0442\u0440\u0435\u043D\u0438\u0435',\n Submitting: '\u041F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0432',\n Username: '\u0418\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F',\n 'Verify Contact': '\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043A\u043E\u043D\u0442\u0430\u043A\u0442',\n Verify: '\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C',\n 'We Emailed You': '\u041C\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0432\u0430\u043C \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0435 \u043F\u0438\u0441\u044C\u043C\u043E',\n 'We Sent A Code': '\u041C\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u043A\u043E\u0434',\n 'We Texted You': '\u041C\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0432\u0430\u043C \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u043E\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435',\n 'Your code is on the way. To log in, enter the code we emailed to': '\u0412\u0430\u0448 \u043A\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D. \u0427\u0442\u043E\u0431\u044B \u0432\u043E\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0443, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u043C\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u043F\u043E \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u0435',\n 'Your code is on the way. To log in, enter the code we sent you': '\u0412\u0430\u0448 \u043A\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D. \u0427\u0442\u043E\u0431\u044B \u0432\u043E\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0443, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u043C\u044B \u043F\u043E\u0441\u043B\u0430\u043B\u0438 \u0432\u0430\u043C',\n 'Your code is on the way. To log in, enter the code we texted to': '\u0412\u0430\u0448 \u043A\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D. \u0427\u0442\u043E\u0431\u044B \u0432\u043E\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0443, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u043C\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u044B\u043C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435\u043C',\n};\n\nexport { ruDict };\n", "const heDict = {\n 'Account recovery requires verified contact information': '\u05E9\u05D7\u05D6\u05D5\u05E8 \u05DC\u05E7\u05D5\u05D7 \u05D3\u05D5\u05E8\u05E9 \u05E2\u05D5\u05D3 \u05DE\u05D9\u05D3\u05E2',\n 'Back to Sign In': '\u05D7\u05D6\u05D5\u05E8 \u05DC\u05D4\u05E8\u05E9\u05DE\u05D4',\n 'Change Password': '\u05E2\u05D3\u05DB\u05D5\u05DF \u05E1\u05D9\u05E1\u05DE\u05D0',\n Changing: '\u05DE\u05E2\u05D3\u05DB\u05DF',\n Code: '\u05E7\u05D5\u05D3',\n 'Confirm Password': '\u05D0\u05E9\u05E8 \u05E1\u05D9\u05E1\u05DE\u05D0',\n 'Confirm Sign Up': '\u05D0\u05E9\u05E8 \u05D4\u05E8\u05E9\u05DE\u05D4',\n 'Confirm SMS Code': '\u05D0\u05E9\u05E8 sms \u05E7\u05D5\u05D3',\n 'Confirm TOTP Code': '\u05D0\u05E9\u05E8 totp \u05E7\u05D5\u05D3',\n Confirm: '\u05D0\u05D9\u05E9\u05D5\u05E8',\n 'Confirmation Code': '\u05D0\u05D9\u05E9\u05D5\u05E8 \u05E7\u05D5\u05D3',\n Confirming: '\u05DE\u05D0\u05E9\u05E8',\n 'Create a new account': '\u05E6\u05D5\u05E8 \u05DE\u05E9\u05EA\u05DE\u05E9 \u05D7\u05D3\u05E9',\n 'Create Account': '\u05E6\u05D5\u05E8 \u05DE\u05E9\u05EA\u05DE\u05E9',\n 'Creating Account': '\u05D9\u05E6\u05D9\u05E8\u05EA \u05DE\u05E9\u05EA\u05DE\u05E9',\n 'Dismiss alert': '\u05D4\u05E1\u05E8 \u05D4\u05EA\u05E8\u05D0\u05D4',\n Email: '\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC',\n 'Enter your code': '\u05D4\u05DB\u05E0\u05E1 \u05D0\u05EA \u05D4\u05E7\u05D5\u05D3',\n 'Enter your Email': '\u05D4\u05DB\u05E0\u05E1 \u05D0\u05EA \u05D4\u05DE\u05D9\u05D9\u05DC \u05E9\u05DC\u05DA',\n 'Enter your phone number': '\u05D4\u05DB\u05E0\u05E1 \u05D0\u05EA \u05DE\u05E1\u05E4\u05E8 \u05D4\u05D8\u05DC\u05E4\u05D5\u05DF \u05E9\u05DC\u05DA',\n 'Enter your username': '\u05D4\u05DB\u05E0\u05E1 \u05D0\u05EA \u05E9\u05DD \u05D4\u05DE\u05EA\u05DE\u05E9 \u05E9\u05DC\u05DA',\n 'Forgot your password?': '\u05E9\u05DB\u05D7\u05EA \u05E1\u05D9\u05E1\u05DE\u05D0 ?',\n 'Hide password': '\u05D4\u05E1\u05EA\u05E8 \u05E1\u05D9\u05E1\u05DE\u05D0',\n Loading: '\u05D8\u05D5\u05E2\u05DF',\n 'New password': '\u05E1\u05D9\u05E1\u05DE\u05D0 \u05D7\u05D3\u05E9\u05D4',\n or: '\u05D0\u05D5\u05B9',\n Password: '\u05E1\u05D9\u05E1\u05DE\u05D0',\n 'Phone Number': '\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF',\n 'Resend Code': '\u05E9\u05DC\u05D7 \u05E7\u05D5\u05D3 \u05E9\u05D5\u05D1',\n 'Reset your password': '\u05D0\u05E4\u05E1 \u05E1\u05D9\u05E1\u05DE\u05D0',\n 'Reset your Password': '\u05D0\u05E4\u05E1 \u05E1\u05D9\u05E1\u05DE\u05D0',\n 'Send code': '\u05E9\u05DC\u05D7 \u05E7\u05D5\u05D3',\n 'Send Code': '\u05E9\u05DC\u05D7 \u05E7\u05D5\u05D3',\n Sending: '\u05E9\u05D5\u05DC\u05D7',\n 'Setup TOTP': 'Setup TOTP',\n 'Show password': '\u05D4\u05E6\u05D2 \u05E1\u05D9\u05E1\u05DE\u05D0',\n 'Sign in to your account': '\u05D4\u05EA\u05D7\u05D1\u05E8 \u05DC\u05D7\u05E9\u05D1\u05D5\u05DF \u05E9\u05DC\u05DA',\n 'Sign In with Amazon': 'Sign In with Amazon',\n 'Sign In with Apple': 'Sign In with Apple',\n 'Sign In with Facebook': 'Sign In with Facebook',\n 'Sign In with Google': 'Sign In with Google',\n 'Sign in': '\u05D4\u05EA\u05D7\u05D1\u05E8',\n 'Sign In': '\u05D4\u05EA\u05D7\u05D1\u05E8',\n 'Signing in': '\u05DE\u05EA\u05D7\u05D1\u05E8',\n Skip: '\u05D3\u05DC\u05D2',\n Submit: '\u05E9\u05DC\u05D7',\n Submitting: '\u05E9\u05D5\u05DC\u05D7',\n Username: '\u05E9\u05DD \u05DE\u05E9\u05EA\u05DE\u05E9',\n 'Verify Contact': '\u05D0\u05DE\u05EA \u05D0\u05D9\u05E9 \u05E7\u05E9\u05E8',\n Verify: '\u05D0\u05DE\u05EA',\n};\n\nexport { heDict };\n", "const uaDict = {\n 'Account recovery requires verified contact information': '\u0412\u0456\u0434\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044F \u043E\u0431\u043B\u0456\u043A\u043E\u0432\u043E\u0433\u043E \u0437\u0430\u043F\u0438\u0441\u0443 \u043F\u043E\u0442\u0440\u0435\u0431\u0443\u0454 \u043A\u043E\u043D\u0442\u0430\u043A\u0442\u043D\u043E\u0457 \u0456\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u0457',\n 'Back to Sign In': '\u041D\u0430\u0437\u0430\u0434 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0432\u0445\u043E\u0434\u0443',\n 'Change Password': '\u0417\u043C\u0456\u043D\u0438\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n Changing: '\u0417\u043C\u0456\u043D\u044E\u0454\u043C\u043E',\n Code: '\u041A\u043E\u0434',\n 'Confirm Password': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0456\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Confirm Sign Up': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0456\u0442\u044C \u0440\u0435\u0454\u0441\u0442\u0440\u0430\u0446\u0456\u044E',\n 'Confirm SMS Code': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0456\u0442\u044C SMS \u043A\u043E\u0434',\n 'Confirm TOTP Code': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0456\u0442\u044C TOTP \u043A\u043E\u0434',\n Confirm: '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438',\n 'Confirmation Code': '\u041A\u043E\u0434 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043D\u044F',\n Confirming: '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0443\u0454\u043C\u043E',\n 'Create a new account': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F',\n 'Create Account': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F',\n 'Creating Account': '\u0420\u0435\u0454\u0441\u0442\u0440\u0443\u0454\u043C\u043E',\n 'Dismiss alert': '\u0412\u0456\u0434\u0445\u0438\u043B\u0438\u0442\u0438 \u0441\u043F\u043E\u0432\u0456\u0449\u0435\u043D\u043D\u044F',\n Email: 'Email',\n 'Enter your code': '\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u043A\u043E\u0434',\n 'Enter your Email': '\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u0432\u0430\u0448 email',\n 'Enter your phone number': '\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u0432\u0430\u0448 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443',\n 'Enter your username': '\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u0432\u0430\u0448\u0435 \u0456\u043C\u02BC\u044F \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430',\n 'Forgot password?': '\u0417\u0430\u0431\u0443\u043B\u0438 \u043F\u0430\u0440\u043E\u043B\u044C?',\n 'Forgot your password?': '\u0417\u0430\u0431\u0443\u043B\u0438 \u0432\u0430\u0448 \u043F\u0430\u0440\u043E\u043B\u044C?',\n 'Hide password': '\u0421\u0445\u043E\u0432\u0430\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'It may take a minute to arrive': '\u0414\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u043C\u043E\u0436\u0435 \u0442\u0440\u0438\u0432\u0430\u0442\u0438 \u0445\u0432\u0438\u043B\u0438\u043D\u0443',\n Loading: '\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0454\u043C\u043E',\n 'New password': '\u041D\u043E\u0432\u0438\u0439 \u043F\u0430\u0440\u043E\u043B\u044C',\n or: '\u0430\u0431\u043E',\n Password: '\u041F\u0430\u0440\u043E\u043B\u044C',\n 'Phone Number': '\u041D\u043E\u043C\u0435\u0440 \u0422\u0435\u043B\u0435\u0444\u043E\u043D\u0443',\n 'Resend Code': '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u0442\u0438 \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E',\n 'Reset your password': '\u0421\u043A\u0438\u043D\u0443\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Reset your Password': '\u0421\u043A\u0438\u043D\u0443\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Send code': '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u0442\u0438 \u043A\u043E\u0434',\n 'Send Code': '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u0442\u0438 \u043A\u043E\u0434',\n Sending: '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u043B\u044F\u0454\u043C\u043E',\n 'Setup TOTP': '\u041D\u0430\u043B\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 TOTP',\n 'Show password': '\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Sign in to your account': '\u0423\u0432\u0456\u0439\u0442\u0438 \u0443 \u0432\u0430\u0448 \u043E\u0431\u043B\u0456\u043A\u043E\u0432\u0438\u0439 \u0437\u0430\u043F\u0438\u0441',\n 'Sign In with Amazon': '\u0423\u0432\u0456\u0439\u0442\u0438 \u0437 Amazon',\n 'Sign In with Apple': '\u0423\u0432\u0456\u0439\u0442\u0438 \u0437 Apple',\n 'Sign In with Facebook': '\u0423\u0432\u0456\u0439\u0442\u0438 \u0437 Facebook',\n 'Sign In with Google': '\u0423\u0432\u0456\u0439\u0442\u0438 \u0437 Google',\n 'Sign in': '\u0423\u0432\u0456\u0439\u0442\u0438',\n 'Sign In': '\u0423\u0432\u0456\u0439\u0442\u0438',\n 'Signing in': '\u0412\u0445\u043E\u0434\u0438\u043C\u043E',\n Skip: '\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u0438',\n Submit: '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u0442\u0438',\n Submitting: '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u043B\u044F\u0454\u043C\u043E',\n Username: '\u0406\u043C\u02BC\u044F \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430',\n 'Verify Contact': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438 \u041A\u043E\u043D\u0442\u0430\u043A\u0442',\n Verify: '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438',\n 'We Emailed You': '\u041C\u0438 \u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0432\u0430\u043C Email',\n 'We Sent A Code': '\u041C\u0438 \u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u043A\u043E\u0434',\n 'We Texted You': '\u041C\u0438 \u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0432\u0430\u043C \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0435 \u043F\u043E\u0432\u0456\u0434\u043E\u043C\u043B\u0435\u043D\u043D\u044F',\n 'Your code is on the way. To log in, enter the code we emailed to': '\u0412\u0430\u0448 \u043A\u043E\u0434 \u0432\u0436\u0435 \u0432 \u0434\u043E\u0440\u043E\u0437\u0456. \u0429\u043E\u0431 \u0443\u0432\u0456\u0439\u0442\u0438, \u0432\u0432\u0435\u0434\u0456\u0442\u044C \u043A\u043E\u0434, \u0449\u043E \u043C\u0438 \u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0432\u0430\u043C \u043D\u0430 Email',\n 'Your code is on the way. To log in, enter the code we sent you': '\u0412\u0430\u0448 \u043A\u043E\u0434 \u0432\u0436\u0435 \u0432 \u0434\u043E\u0440\u043E\u0437\u0456. \u0429\u043E\u0431 \u0443\u0432\u0456\u0439\u0442\u0438, \u0432\u0432\u0435\u0434\u0456\u0442\u044C \u043A\u043E\u0434, \u0449\u043E \u043C\u0438 \u0432\u0430\u043C \u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u043B\u0438',\n 'Your code is on the way. To log in, enter the code we texted to': '\u0412\u0430\u0448 \u043A\u043E\u0434 \u0432\u0436\u0435 \u0432 \u0434\u043E\u0440\u043E\u0437\u0456. \u0429\u043E\u0431 \u0443\u0432\u0456\u0439\u0442\u0438, \u0432\u0432\u0435\u0434\u0456\u0442\u044C \u043A\u043E\u0434, \u0449\u043E \u043C\u0438 \u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u0432\u0430\u043C \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438\u043C \u043F\u043E\u0432\u0456\u0434\u043E\u043C\u043B\u0435\u043D\u043D\u044F\u043C',\n // Additional translations\n 'An account with the given email already exists.': '\u041E\u0431\u043B\u0456\u043A\u043E\u0432\u0438\u0439 \u0437\u0430\u043F\u0438\u0441 \u0437 \u0446\u0438\u043C Email \u0432\u0436\u0435 \u0456\u0441\u043D\u0443\u0454.',\n 'Confirm a Code': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0456\u0442\u044C \u043A\u043E\u0434',\n 'Confirm Sign In': '\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0456\u0442\u044C \u0432\u0445\u0456\u0434',\n 'Forgot Password': '\u0417\u0430\u0431\u0443\u043B\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Incorrect username or password.': '\u041D\u0435\u0432\u0456\u0440\u043D\u0435 \u0456\u043C\u02BC\u044F \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430 \u0430\u0431\u043E \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Invalid password format': '\u041D\u0435\u0432\u0456\u0440\u043D\u0438\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u043F\u0430\u0440\u043E\u043B\u044E',\n 'Invalid phone number format': '\u041D\u0435\u0432\u0456\u0440\u043D\u0438\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u043D\u043E\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443',\n 'Loading...': '\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0454\u043C\u043E...',\n 'New Password': '\u041D\u043E\u0432\u0438\u0439 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Resend a Code': '\u0412\u0456\u0434\u043F\u0440\u0430\u0432\u0438\u0442\u0438 \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E',\n 'Reset Password': '\u0421\u043A\u0438\u043D\u0443\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C',\n 'Sign Out': '\u0412\u0438\u0439\u0442\u0438',\n 'Sign Up with Amazon': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u0437 Amazon',\n 'Sign Up with Apple': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u0437 Apple',\n 'Sign Up with Facebook': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u0437 Facebook',\n 'Sign Up with Google': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u0437 Google',\n 'Sign Up': '\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u0442\u0438\u0441\u044F',\n 'User already exists': '\u041A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447 \u0432\u0436\u0435 \u0456\u0441\u043D\u0443\u0454',\n 'User does not exist': '\u0422\u0430\u043A\u0438\u0439 \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447 \u043D\u0435 \u0456\u0441\u043D\u0443\u0454',\n 'Username cannot be empty': '\u0406\u043C\u02BC\u044F \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0431\u0443\u0442\u0438 \u043F\u0443\u0441\u0442\u0438\u043C',\n 'Your passwords must match': '\u041F\u0430\u0440\u043E\u043B\u0456 \u043C\u0430\u044E\u0442\u044C \u0437\u0431\u0456\u0433\u0430\u0442\u0438\u0441\u044F',\n};\n\nexport { uaDict };\n", "const thDict = {\n 'Account recovery requires verified contact information': '\u0E01\u0E32\u0E23\u0E01\u0E39\u0E49\u0E04\u0E37\u0E19\u0E1A\u0E31\u0E0D\u0E0A\u0E35\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E15\u0E34\u0E14\u0E15\u0E48\u0E2D\u0E17\u0E35\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E41\u0E25\u0E49\u0E27',\n 'Add your Profile': '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E42\u0E1B\u0E23\u0E44\u0E1F\u0E25\u0E4C\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Add your Website': '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E27\u0E47\u0E1A\u0E44\u0E0B\u0E15\u0E4C\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Back to Sign In': '\u0E01\u0E25\u0E31\u0E1A\u0E44\u0E1B\u0E17\u0E35\u0E48\u0E01\u0E32\u0E23\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A',\n 'Change Password': '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n Changing: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19',\n Code: '\u0E23\u0E2B\u0E31\u0E2A',\n 'Confirm Password': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Please confirm your Password': '\u0E01\u0E23\u0E38\u0E13\u0E32\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Confirm Sign Up': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E01\u0E32\u0E23\u0E25\u0E07\u0E17\u0E30\u0E40\u0E1A\u0E35\u0E22\u0E19',\n 'Confirm SMS Code': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E23\u0E2B\u0E31\u0E2A SMS',\n 'Confirm MFA Code': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E23\u0E2B\u0E31\u0E2A MFA',\n 'Confirm TOTP Code': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E23\u0E2B\u0E31\u0E2A TOTP',\n Confirm: '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19',\n 'Confirmation Code': '\u0E23\u0E2B\u0E31\u0E2A\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19',\n Confirming: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19',\n 'Create a new account': '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E1A\u0E31\u0E0D\u0E0A\u0E35\u0E43\u0E2B\u0E21\u0E48',\n 'Create Account': '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E1A\u0E31\u0E0D\u0E0A\u0E35',\n 'Creating Account': '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E1A\u0E31\u0E0D\u0E0A\u0E35',\n 'Dismiss alert': '\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19',\n Email: '\u0E2D\u0E35\u0E40\u0E21\u0E25',\n 'Enter your Birthdate': '\u0E01\u0E23\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E01\u0E34\u0E14\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your code': '\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Confirmation Code': '\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Email': '\u0E01\u0E23\u0E2D\u0E01\u0E2D\u0E35\u0E40\u0E21\u0E25\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Family Name': '\u0E01\u0E23\u0E2D\u0E01\u0E19\u0E32\u0E21\u0E2A\u0E01\u0E38\u0E25\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Given Name': '\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E37\u0E48\u0E2D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Middle Name': '\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E37\u0E48\u0E2D\u0E01\u0E25\u0E32\u0E07\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Name': '\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E37\u0E48\u0E2D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Nickname': '\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E37\u0E48\u0E2D\u0E40\u0E25\u0E48\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Password': '\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your email': '\u0E01\u0E23\u0E2D\u0E01\u0E2D\u0E35\u0E40\u0E21\u0E25\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your phone number': '\u0E01\u0E23\u0E2D\u0E01\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Enter your Preferred Username': '\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E17\u0E35\u0E48\u0E15\u0E49\u0E2D\u0E07\u0E01\u0E32\u0E23',\n 'Enter your username': '\u0E01\u0E23\u0E2D\u0E01\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Forgot password?': '\u0E25\u0E37\u0E21\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19?',\n 'Forgot your password?': '\u0E25\u0E37\u0E21\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E43\u0E0A\u0E48\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48?',\n 'Hide password': '\u0E0B\u0E48\u0E2D\u0E19\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'It may take a minute to arrive': '\u0E2D\u0E32\u0E08\u0E43\u0E0A\u0E49\u0E40\u0E27\u0E25\u0E32\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48',\n Loading: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14',\n 'New password': '\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E43\u0E2B\u0E21\u0E48',\n or: '\u0E2B\u0E23\u0E37\u0E2D',\n Password: '\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Phone Number': '\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C',\n 'Resend Code': '\u0E2A\u0E48\u0E07\u0E23\u0E2B\u0E31\u0E2A\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07',\n 'Reset your Password': '\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Reset your password': '\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Send code': '\u0E2A\u0E48\u0E07\u0E23\u0E2B\u0E31\u0E2A',\n 'Send Code': '\u0E2A\u0E48\u0E07\u0E23\u0E2B\u0E31\u0E2A',\n Sending: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07',\n 'Setup TOTP': '\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32 TOTP',\n 'Show password': '\u0E41\u0E2A\u0E14\u0E07\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Sign in to your account': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E1A\u0E31\u0E0D\u0E0A\u0E35\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n 'Sign In with Amazon': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E14\u0E49\u0E27\u0E22 Amazon',\n 'Sign In with Apple': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E14\u0E49\u0E27\u0E22 Apple',\n 'Sign In with Facebook': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E14\u0E49\u0E27\u0E22 Facebook',\n 'Sign In with Google': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E14\u0E49\u0E27\u0E22 Google',\n 'Sign in': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A',\n 'Sign In': '\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A',\n 'Signing in': '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A',\n Skip: '\u0E02\u0E49\u0E32\u0E21',\n Submit: '\u0E2A\u0E48\u0E07',\n Submitting: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07',\n Username: '\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49',\n 'Verify Contact': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E01\u0E32\u0E23\u0E15\u0E34\u0E14\u0E15\u0E48\u0E2D',\n Verify: '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19',\n 'We Emailed You': '\u0E40\u0E23\u0E32\u0E44\u0E14\u0E49\u0E2A\u0E48\u0E07\u0E2D\u0E35\u0E40\u0E21\u0E25\u0E16\u0E36\u0E07\u0E04\u0E38\u0E13\u0E41\u0E25\u0E49\u0E27',\n 'We Sent A Code': '\u0E40\u0E23\u0E32\u0E44\u0E14\u0E49\u0E2A\u0E48\u0E07\u0E23\u0E2B\u0E31\u0E2A\u0E41\u0E25\u0E49\u0E27',\n 'We Texted You': '\u0E40\u0E23\u0E32\u0E44\u0E14\u0E49\u0E2A\u0E48\u0E07 SMS \u0E16\u0E36\u0E07\u0E04\u0E38\u0E13\u0E41\u0E25\u0E49\u0E27',\n 'Your code is on the way. To log in, enter the code we emailed to': '\u0E23\u0E2B\u0E31\u0E2A\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E01\u0E33\u0E25\u0E31\u0E07\u0E21\u0E32 \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A \u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E17\u0E35\u0E48\u0E40\u0E23\u0E32\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E2D\u0E35\u0E40\u0E21\u0E25',\n 'Your code is on the way. To log in, enter the code we sent you': '\u0E23\u0E2B\u0E31\u0E2A\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E01\u0E33\u0E25\u0E31\u0E07\u0E21\u0E32 \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A \u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E17\u0E35\u0E48\u0E40\u0E23\u0E32\u0E2A\u0E48\u0E07\u0E43\u0E2B\u0E49\u0E04\u0E38\u0E13',\n 'Your code is on the way. To log in, enter the code we texted to': '\u0E23\u0E2B\u0E31\u0E2A\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E01\u0E33\u0E25\u0E31\u0E07\u0E21\u0E32 \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A \u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E17\u0E35\u0E48\u0E40\u0E23\u0E32\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07 SMS',\n // Additional translations\n 'An account with the given email already exists.': '\u0E1A\u0E31\u0E0D\u0E0A\u0E35\u0E17\u0E35\u0E48\u0E43\u0E0A\u0E49\u0E2D\u0E35\u0E40\u0E21\u0E25\u0E19\u0E35\u0E49\u0E21\u0E35\u0E2D\u0E22\u0E39\u0E48\u0E41\u0E25\u0E49\u0E27',\n 'Confirm a Code': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E23\u0E2B\u0E31\u0E2A',\n 'Confirm Sign In': '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E01\u0E32\u0E23\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A',\n 'Create account': '\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E1A\u0E31\u0E0D\u0E0A\u0E35',\n 'Sign Up with Facebook': '\u0E25\u0E07\u0E17\u0E30\u0E40\u0E1A\u0E35\u0E22\u0E19\u0E14\u0E49\u0E27\u0E22 Facebook',\n 'Sign Up with Google': '\u0E25\u0E07\u0E17\u0E30\u0E40\u0E1A\u0E35\u0E22\u0E19\u0E14\u0E49\u0E27\u0E22 Google',\n 'Sign Up with Apple': '\u0E25\u0E07\u0E17\u0E30\u0E40\u0E1A\u0E35\u0E22\u0E19\u0E14\u0E49\u0E27\u0E22 Apple',\n 'Sign Up with Line': '\u0E25\u0E07\u0E17\u0E30\u0E40\u0E1A\u0E35\u0E22\u0E19\u0E14\u0E49\u0E27\u0E22 Line',\n 'Forgot Password': '\u0E25\u0E37\u0E21\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Have an account? ': '\u0E21\u0E35\u0E1A\u0E31\u0E0D\u0E0A\u0E35\u0E2D\u0E22\u0E39\u0E48\u0E41\u0E25\u0E49\u0E27? ',\n 'Incorrect username or password': '\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E2B\u0E23\u0E37\u0E2D\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07',\n 'Invalid password format': '\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07',\n 'It may take a minute to arrive.': '\u0E2D\u0E32\u0E08\u0E43\u0E0A\u0E49\u0E40\u0E27\u0E25\u0E32\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48\u0E43\u0E19\u0E01\u0E32\u0E23\u0E21\u0E32\u0E16\u0E36\u0E07',\n 'Lost your code? ': '\u0E2B\u0E32\u0E23\u0E2B\u0E31\u0E2A\u0E44\u0E21\u0E48\u0E40\u0E08\u0E2D? ',\n 'New Password': '\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E43\u0E2B\u0E21\u0E48',\n 'No account? ': '\u0E44\u0E21\u0E48\u0E21\u0E35\u0E1A\u0E31\u0E0D\u0E0A\u0E35? ',\n 'Password attempts exceeded': '\u0E40\u0E01\u0E34\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E04\u0E23\u0E31\u0E49\u0E07\u0E17\u0E35\u0E48\u0E2D\u0E19\u0E38\u0E0D\u0E32\u0E15\u0E43\u0E2B\u0E49\u0E43\u0E2A\u0E48\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Reset password': '\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Reset Password': '\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19',\n 'Sign Out': '\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A',\n 'Sign Up': '\u0E25\u0E07\u0E17\u0E30\u0E40\u0E1A\u0E35\u0E22\u0E19',\n 'User already exists': '\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E19\u0E35\u0E49\u0E21\u0E35\u0E2D\u0E22\u0E39\u0E48\u0E41\u0E25\u0E49\u0E27',\n 'User does not exist': '\u0E44\u0E21\u0E48\u0E21\u0E35\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E19\u0E35\u0E49',\n 'Username cannot be empty': '\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E2A\u0E48\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19',\n};\n\nexport { thDict };\n", "const defaultTexts = {\n ADD_PROFILE: 'Add your Profile',\n ADD_WEBSITE: 'Add your Website',\n BACK_SIGN_IN: 'Back to Sign In',\n BIRTHDATE: 'Birthdate',\n CHANGE_PASSWORD: 'Change Password',\n CHANGING_PASSWORD: 'Changing',\n CODE: 'Code',\n CODE_ARRIVAL: 'It may take a minute to arrive',\n CODE_EMAILED: 'Your code is on the way. To log in, enter the code we emailed to',\n CODE_SENT: 'Your code is on the way. To log in, enter the code we sent you',\n CODE_TEXTED: 'Your code is on the way. To log in, enter the code we texted to',\n CONFIRM_PASSWORD: 'Confirm Password',\n CONFIRM_PASSWORD_PLACEHOLDER: 'Please confirm your Password',\n CONFIRM_RESET_PASSWORD_HEADING: 'Reset your Password',\n CONFIRM_SIGNUP_HEADING: 'Confirm Sign Up',\n CONFIRM_SMS: 'Confirm SMS Code',\n // If challenge name is not returned\n CONFIRM_MFA_DEFAULT: 'Confirm MFA Code',\n CONFIRM_TOTP: 'Confirm TOTP Code',\n CONFIRM: 'Confirm',\n CONFIRMATION_CODE: 'Confirmation Code',\n CONFIRMING: 'Confirming',\n CREATE_ACCOUNT: 'Create Account',\n CREATING_ACCOUNT: 'Creating Account',\n EMAIL_ADDRESS: 'Email',\n ENTER_BIRTHDATE: 'Enter your Birthdate',\n ENTER_CODE: 'Enter your code',\n ENTER_CONFIRMATION_CODE: 'Enter your Confirmation Code',\n ENTER_EMAIL: 'Enter your Email',\n ENTER_FAMILY_NAME: 'Enter your Family Name',\n ENTER_GIVEN_NAME: 'Enter your Given Name',\n ENTER_MIDDLE_NAME: 'Enter your Middle Name',\n ENTER_NAME: 'Enter your Name',\n ENTER_NICK_NAME: 'Enter your Nickname',\n ENTER_PASSWORD: 'Enter your Password',\n ENTER_PHONE_NUMBER: 'Enter your Phone Number',\n ENTER_PREFERRED_USERNAME: 'Enter your Preferred Username',\n ENTER_USERNAME: 'Enter your username',\n FAMILY_NAME: 'Family Name',\n GIVEN_NAME: 'Given Name',\n FORGOT_PASSWORD: 'Forgot Password?',\n FORGOT_YOUR_PASSWORD: 'Forgot your password?',\n HIDE_PASSWORD: 'Hide password',\n LOADING: 'Loading',\n LOGIN_NAME: 'Username',\n MIDDLE_NAME: 'Middle Name',\n NAME: 'Name',\n NICKNAME: 'Nickname',\n NEW_PASSWORD: 'New password',\n OR: 'or',\n PASSWORD: 'Password',\n PHONE_NUMBER: 'Phone Number',\n PREFERRED_USERNAME: 'Preferred Username',\n PROFILE: 'Profile',\n RESEND_CODE: 'Resend Code',\n RESET_PASSWORD_HEADING: 'Reset your password',\n RESET_PASSWORD: 'Reset Password',\n SEND_CODE: 'Send code',\n SENDING: 'Sending',\n SETUP_TOTP: 'Setup TOTP',\n SHOW_PASSWORD: 'Show password',\n SIGN_IN_BUTTON: 'Sign in',\n SIGN_IN_TAB: 'Sign In',\n SIGN_IN_WITH_AMAZON: 'Sign In with Amazon',\n SIGN_IN_WITH_APPLE: 'Sign In with Apple',\n SIGN_IN_WITH_FACEBOOK: 'Sign In with Facebook',\n SIGN_IN_WITH_GOOGLE: 'Sign In with Google',\n SIGN_IN: 'Sign in to your account',\n SIGN_UP_BUTTON: 'Create a new account',\n SIGNING_IN_BUTTON: 'Signing in',\n SKIP: 'Skip',\n SUBMIT: 'Submit',\n SUBMITTING: 'Submitting',\n UPPERCASE_COPY: 'COPY',\n VERIFY_CONTACT: 'Verify Contact',\n VERIFY_HEADING: 'Account recovery requires verified contact information',\n VERIFY: 'Verify',\n WE_EMAILED: 'We Emailed You',\n WE_SENT_CODE: 'We Sent A Code',\n WE_TEXTED: 'We Texted You',\n WEBSITE: 'Website',\n};\n\nexport { defaultTexts };\n", "import { translate, DefaultTexts } from '../../i18n/translations.mjs';\n\n/**\n * ConfirmSignIn\n */\nconst getChallengeText = (challengeName) => {\n switch (challengeName) {\n case 'SMS_MFA':\n return translate(DefaultTexts.CONFIRM_SMS);\n case 'SOFTWARE_TOKEN_MFA':\n return translate(DefaultTexts.CONFIRM_TOTP);\n default:\n return translate(DefaultTexts.CONFIRM_MFA_DEFAULT);\n }\n};\n/**\n * ConfirmSignUp\n */\nconst getDeliveryMessageText = (codeDeliveryDetails) => {\n const { DeliveryMedium, Destination } = codeDeliveryDetails ?? {};\n const isEmailMessage = DeliveryMedium === 'EMAIL';\n const isTextMessage = DeliveryMedium === 'SMS';\n const arrivalMessage = translate(DefaultTexts.CODE_ARRIVAL);\n if (!(isEmailMessage || isTextMessage)) {\n return `${translate(DefaultTexts.CODE_SENT)}. ${arrivalMessage}.`;\n }\n const instructionMessage = isEmailMessage\n ? translate(DefaultTexts.CODE_EMAILED)\n : translate(DefaultTexts.CODE_TEXTED);\n return `${instructionMessage} ${Destination}. ${arrivalMessage}.`;\n};\nconst getDeliveryMethodText = (codeDeliveryDetails) => {\n const { DeliveryMedium } = codeDeliveryDetails ?? {};\n const isEmailMessage = DeliveryMedium === 'EMAIL';\n const isTextMessage = DeliveryMedium === 'SMS';\n if (!isEmailMessage && isTextMessage) {\n return translate(DefaultTexts.WE_SENT_CODE);\n }\n return isEmailMessage\n ? translate(DefaultTexts.WE_EMAILED)\n : translate(DefaultTexts.WE_TEXTED);\n};\n/**\n * FederatedSignIn\n */\nconst providerNameMap = {\n amazon: 'Amazon',\n apple: 'Apple',\n facebook: 'Facebook',\n google: 'Google',\n};\nconst getSignInWithFederationText = (route, provider) => {\n const isSignIn = route === 'signIn';\n return translate(`Sign ${isSignIn ? 'In' : 'Up'} with ${providerNameMap[provider]}`);\n};\nconst authenticatorTextUtil = {\n /** Shared */\n getBackToSignInText: () => translate(DefaultTexts.BACK_SIGN_IN),\n getChangePasswordText: () => translate(DefaultTexts.CHANGE_PASSWORD),\n getChangingText: () => translate(DefaultTexts.CHANGING_PASSWORD),\n getConfirmText: () => translate(DefaultTexts.CONFIRM),\n getConfirmingText: () => translate(DefaultTexts.CONFIRMING),\n getCopyText: () => translate(DefaultTexts.UPPERCASE_COPY),\n getHidePasswordText: () => translate(DefaultTexts.HIDE_PASSWORD),\n getLoadingText: () => translate(DefaultTexts.LOADING),\n getOrText: () => translate(DefaultTexts.OR),\n getResendCodeText: () => translate(DefaultTexts.RESEND_CODE),\n getSendCodeText: () => translate(DefaultTexts.SEND_CODE),\n getSendingText: () => translate(DefaultTexts.SENDING),\n getShowPasswordText: () => translate(DefaultTexts.SHOW_PASSWORD),\n getSubmitText: () => translate(DefaultTexts.SUBMIT),\n getSubmittingText: () => translate(DefaultTexts.SUBMITTING),\n /** SignInSignUpTabs */\n getSignInTabText: () => translate(DefaultTexts.SIGN_IN_TAB),\n getSignUpTabText: () => translate(DefaultTexts.CREATE_ACCOUNT),\n /** SignIn */\n getForgotPasswordText: (shortVersion) => translate(shortVersion\n ? DefaultTexts.FORGOT_PASSWORD\n : DefaultTexts.FORGOT_YOUR_PASSWORD),\n getSigningInText: () => translate(DefaultTexts.SIGNING_IN_BUTTON),\n getSignInText: () => translate(DefaultTexts.SIGN_IN_BUTTON),\n /** SignUp */\n getCreatingAccountText: () => translate(DefaultTexts.CREATING_ACCOUNT),\n getCreateAccountText: () => translate(DefaultTexts.CREATE_ACCOUNT),\n /** ConfirmSignUp */\n getDeliveryMessageText,\n getDeliveryMethodText,\n /** ConfirmSignIn */\n getChallengeText,\n /** ForgotPassword */\n getResetYourPasswordText: () => translate(DefaultTexts.RESET_PASSWORD),\n /** SetupTotp */\n getSetupTotpText: () => translate(DefaultTexts.SETUP_TOTP),\n // TODO: add defaultText for below\n getSetupTotpInstructionsText: () => translate('Copy and paste the secret key below into an authenticator app and then enter the code in the text field below.'),\n // TODO: add defaultText for \"COPIED\"\n getCopiedText: () => translate('COPIED'),\n /** FederatedSignIn */\n getSignInWithFederationText,\n /** VerifyUser */\n getSkipText: () => translate(DefaultTexts.SKIP),\n getVerifyText: () => translate(DefaultTexts.VERIFY),\n getVerifyContactText: () => translate(DefaultTexts.VERIFY_CONTACT),\n getAccountRecoveryInfoText: () => translate(DefaultTexts.VERIFY_HEADING),\n /** Validations */\n // TODO: add defaultText\n getInvalidEmailText: () => translate('Please enter a valid email'),\n // TODO: add defaultText\n getRequiredFieldText: () => translate('This field is required'),\n}; // using `as const` so that keys are strongly typed\n\nexport { authenticatorTextUtil };\n", "import { createMachine, forwardTo, assign, spawn, actions } from 'xstate';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isEmptyObject } from '../../utils/utils.mjs';\nimport ACTIONS from './actions.mjs';\nimport GUARDS from './guards.mjs';\nimport { forgotPasswordActor } from './actors/forgotPassword.mjs';\nimport { signInActor } from './actors/signIn.mjs';\nimport { signUpActor } from './actors/signUp.mjs';\nimport { signOutActor } from './actors/signOut.mjs';\nimport { verifyUserAttributesActor } from './actors/verifyUserAttributes.mjs';\nimport { defaultServices } from './defaultServices.mjs';\n\nconst getActorContext = (context, defaultStep) => ({\n ...context.actorDoneData,\n step: context?.actorDoneData?.step ?? defaultStep,\n // initialize empty objects on actor start\n formValues: {},\n touched: {},\n validationError: {},\n // values included on `context.config` that should be available in actors\n formFields: context.config?.formFields,\n loginMechanisms: context.config?.loginMechanisms,\n passwordSettings: context.config?.passwordSettings,\n signUpAttributes: context.config?.signUpAttributes,\n socialProviders: context.config?.socialProviders,\n});\nconst { choose, stop } = actions;\nconst stopActor = (machineId) => stop(machineId);\n// setup step waits for ui to emit INIT action to proceed to configure\nconst LEGACY_WAIT_CONFIG = {\n on: {\n INIT: {\n actions: 'configure',\n target: 'getConfig',\n },\n SIGN_OUT: '#authenticator.signOut',\n },\n};\n// setup step proceeds directly to configure\nconst NEXT_WAIT_CONFIG = {\n always: { actions: 'configure', target: 'getConfig' },\n};\nfunction createAuthenticatorMachine(options) {\n const { useNextWaitConfig, ...overrideConfigServices } = options ?? {};\n const initConfig = useNextWaitConfig ? NEXT_WAIT_CONFIG : LEGACY_WAIT_CONFIG;\n return createMachine({\n id: 'authenticator',\n initial: 'idle',\n context: {\n user: undefined,\n config: {},\n services: defaultServices,\n actorRef: undefined,\n hasSetup: false,\n },\n predictableActionArguments: true,\n states: {\n // See: https://xstate.js.org/docs/guides/communication.html#invoking-promises\n idle: {\n invoke: {\n src: 'handleGetCurrentUser',\n onDone: { actions: 'setUser', target: 'setup' },\n onError: { target: 'setup' },\n },\n },\n setup: {\n initial: 'initConfig',\n states: {\n initConfig,\n getConfig: {\n invoke: {\n src: 'getAmplifyConfig',\n onDone: [\n {\n actions: ['applyAmplifyConfig', 'setHasSetup'],\n cond: 'hasUser',\n target: '#authenticator.authenticated',\n },\n {\n actions: ['applyAmplifyConfig', 'setHasSetup'],\n target: 'goToInitialState',\n },\n ],\n },\n },\n goToInitialState: {\n always: [\n {\n cond: 'isInitialStateSignUp',\n target: '#authenticator.signUpActor',\n },\n {\n cond: 'isInitialStateResetPassword',\n target: '#authenticator.forgotPasswordActor',\n },\n { target: '#authenticator.signInActor' },\n ],\n },\n },\n },\n getCurrentUser: {\n invoke: {\n src: 'handleGetCurrentUser',\n onDone: {\n actions: 'setUser',\n target: '#authenticator.authenticated',\n },\n onError: { target: '#authenticator.setup' },\n },\n },\n signInActor: {\n initial: 'spawnActor',\n states: {\n spawnActor: {\n always: { actions: 'spawnSignInActor', target: 'runActor' },\n },\n runActor: {\n entry: 'clearActorDoneData',\n exit: stopActor('signInActor'),\n },\n },\n on: {\n FORGOT_PASSWORD: 'forgotPasswordActor',\n SIGN_IN: 'signInActor',\n SIGN_UP: 'signUpActor',\n 'done.invoke.signInActor': [\n {\n cond: 'hasCompletedAttributeConfirmation',\n target: '#authenticator.getCurrentUser',\n },\n {\n cond: 'isShouldConfirmUserAttributeStep',\n actions: 'setActorDoneData',\n target: '#authenticator.verifyUserAttributesActor',\n },\n {\n cond: 'isResetPasswordStep',\n actions: 'setActorDoneData',\n target: '#authenticator.forgotPasswordActor',\n },\n {\n cond: 'isConfirmSignUpStep',\n actions: 'setActorDoneData',\n target: '#authenticator.signUpActor',\n },\n ],\n },\n },\n signUpActor: {\n initial: 'spawnActor',\n states: {\n spawnActor: {\n always: { actions: 'spawnSignUpActor', target: 'runActor' },\n },\n runActor: {\n entry: 'clearActorDoneData',\n exit: stopActor('signUpActor'),\n },\n },\n on: {\n SIGN_IN: 'signInActor',\n 'done.invoke.signUpActor': [\n {\n cond: 'hasCompletedAttributeConfirmation',\n target: '#authenticator.getCurrentUser',\n },\n {\n cond: 'isShouldConfirmUserAttributeStep',\n actions: 'setActorDoneData',\n target: '#authenticator.verifyUserAttributesActor',\n },\n {\n cond: 'isConfirmUserAttributeStep',\n target: '#authenticator.verifyUserAttributesActor',\n },\n {\n actions: 'setActorDoneData',\n target: '#authenticator.signInActor',\n },\n ],\n },\n },\n forgotPasswordActor: {\n initial: 'spawnActor',\n states: {\n spawnActor: {\n always: {\n actions: 'spawnForgotPasswordActor',\n target: 'runActor',\n },\n },\n runActor: {\n entry: 'clearActorDoneData',\n exit: stopActor('forgotPasswordActor'),\n },\n },\n on: {\n SIGN_IN: 'signInActor',\n 'done.invoke.forgotPasswordActor': [\n { target: '#authenticator.signInActor' },\n ],\n },\n },\n verifyUserAttributesActor: {\n initial: 'spawnActor',\n states: {\n spawnActor: {\n always: {\n actions: 'spawnVerifyUserAttributesActor',\n target: 'runActor',\n },\n },\n runActor: {\n entry: 'clearActorDoneData',\n exit: stopActor('verifyUserAttributesActor'),\n },\n },\n on: {\n 'done.invoke.verifyUserAttributesActor': [\n {\n actions: 'setActorDoneData',\n target: '#authenticator.getCurrentUser',\n },\n ],\n },\n },\n authenticated: {\n initial: 'idle',\n states: {\n idle: { on: { TOKEN_REFRESH: 'refreshUser' } },\n refreshUser: {\n invoke: {\n src: '#authenticator.getCurrentUser',\n onDone: { actions: 'setUser', target: 'idle' },\n onError: { target: '#authenticator.signOut' },\n },\n },\n },\n on: { SIGN_OUT: 'signOut' },\n },\n signOut: {\n initial: 'spawnActor',\n states: {\n spawnActor: {\n always: { actions: 'spawnSignOutActor', target: 'runActor' },\n },\n runActor: {\n entry: 'clearActorDoneData',\n exit: stopActor('signOutActor'),\n },\n },\n on: {\n 'done.invoke.signOutActor': {\n actions: 'clearUser',\n target: 'setup.getConfig',\n },\n },\n },\n },\n on: {\n SIGN_IN_WITH_REDIRECT: { target: '#authenticator.getCurrentUser' },\n CHANGE: { actions: 'forwardToActor' },\n BLUR: { actions: 'forwardToActor' },\n SUBMIT: { actions: 'forwardToActor' },\n FEDERATED_SIGN_IN: { actions: 'forwardToActor' },\n RESEND: { actions: 'forwardToActor' },\n SIGN_IN: { actions: 'forwardToActor' },\n SKIP: { actions: 'forwardToActor' },\n },\n }, {\n actions: {\n ...ACTIONS,\n forwardToActor: choose([\n { cond: 'hasActor', actions: forwardTo(({ actorRef }) => actorRef) },\n ]),\n setActorDoneData: assign({\n actorDoneData: (context, event) => ({\n challengeName: event.data.challengeName,\n codeDeliveryDetails: event.data.codeDeliveryDetails,\n missingAttributes: event.data.missingAttributes,\n remoteError: event.data.remoteError,\n username: event.data.username,\n step: event.data.step,\n totpSecretCode: event.data.totpSecretCode,\n unverifiedUserAttributes: event.data.unverifiedUserAttributes,\n }),\n }),\n applyAmplifyConfig: assign({\n config(context, { data: cliConfig }) {\n // Prefer explicitly configured settings over default CLI values\\\n const { loginMechanisms = cliConfig.loginMechanisms ?? [], signUpAttributes = cliConfig.signUpAttributes ?? [], socialProviders = cliConfig.socialProviders ?? [], initialState, formFields: _formFields, passwordSettings = cliConfig.passwordFormat ??\n {}, } = context.config;\n // By default, Cognito assumes `username`, so there isn't a different username attribute like `email`.\n // We explicitly add it as a login mechanism to be consistent with Admin UI's language.\n if (loginMechanisms.length === 0) {\n loginMechanisms.push('username');\n }\n const formFields = convertFormFields(_formFields) ?? {};\n return {\n formFields,\n initialState,\n loginMechanisms,\n passwordSettings,\n signUpAttributes,\n socialProviders,\n };\n },\n }),\n spawnSignInActor: assign({\n actorRef: (context, _) => {\n const { services } = context;\n const actor = signInActor({ services }).withContext(getActorContext(context, 'SIGN_IN'));\n return spawn(actor, { name: 'signInActor' });\n },\n }),\n spawnSignUpActor: assign({\n actorRef: (context, _) => {\n const { services } = context;\n const actor = signUpActor({ services }).withContext(getActorContext(context, 'SIGN_UP'));\n return spawn(actor, { name: 'signUpActor' });\n },\n }),\n spawnForgotPasswordActor: assign({\n actorRef: (context, _) => {\n const { services } = context;\n const actor = forgotPasswordActor({ services }).withContext(getActorContext(context, 'FORGOT_PASSWORD'));\n return spawn(actor, { name: 'forgotPasswordActor' });\n },\n }),\n spawnVerifyUserAttributesActor: assign({\n actorRef: (context) => {\n const actor = verifyUserAttributesActor().withContext(getActorContext(context));\n return spawn(actor, { name: 'verifyUserAttributesActor' });\n },\n }),\n spawnSignOutActor: assign({\n actorRef: (context) => {\n const actor = signOutActor().withContext({ user: context?.user });\n return spawn(actor, { name: 'signOutActor' });\n },\n }),\n configure: assign((_, event) => {\n const { services: customServices, ...config } = !isEmptyObject(overrideConfigServices)\n ? overrideConfigServices\n : event.data ?? {};\n return {\n services: { ...defaultServices, ...customServices },\n config,\n };\n }),\n setHasSetup: assign({ hasSetup: true }),\n },\n guards: {\n ...GUARDS,\n hasActor: ({ actorRef }) => !!actorRef,\n isInitialStateSignUp: ({ config }) => config.initialState === 'signUp',\n isInitialStateResetPassword: ({ config }) => config.initialState === 'forgotPassword',\n shouldSetup: ({ hasSetup }) => !hasSetup,\n hasUser: ({ user }) => {\n return !!user;\n },\n },\n services: {\n getAmplifyConfig: ({ services }) => services.getAmplifyConfig(),\n handleGetCurrentUser: ({ services }) => services.getCurrentUser(),\n },\n });\n}\nfunction convertFormFields(formFields) {\n if (formFields) {\n Object.keys(formFields).forEach((component) => {\n Object.keys(formFields[component]).forEach((inputName) => {\n let ff = formFields[component][inputName];\n ff.required = ff.isRequired;\n });\n });\n }\n return formFields;\n}\n\nexport { createAuthenticatorMachine };\n", "import { actions } from 'xstate';\nimport 'aws-amplify/utils';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport '../../types/authenticator/user.mjs';\nimport '../../types/authenticator/attributes.mjs';\nimport { trimValues } from '../../helpers/authenticator/utils.mjs';\nimport '../../helpers/accountSettings/utils.mjs';\nimport 'aws-amplify';\nimport { sanitizePhoneNumber, getUsernameSignUp } from './utils.mjs';\n\nconst { assign } = actions;\nconst clearActorDoneData = assign({ actorDoneData: undefined });\nconst clearChallengeName = assign({ challengeName: undefined });\nconst clearMissingAttributes = assign({ missingAttributes: undefined });\nconst clearError = assign({ remoteError: undefined });\nconst clearFormValues = assign({ formValues: {} });\nconst clearTouched = assign({ touched: {} });\nconst clearUser = assign({ user: undefined });\nconst clearValidationError = assign({ validationError: {} });\n/**\n * \"set\" actions\n */\nconst setTotpSecretCode = assign({\n totpSecretCode: (_, { data }) => {\n const { sharedSecret } = (data.nextStep?.totpSetupDetails ??\n {});\n return sharedSecret;\n },\n});\nconst setSignInStep = assign({ step: 'SIGN_IN' });\nconst setShouldVerifyUserAttributeStep = assign({\n step: 'SHOULD_CONFIRM_USER_ATTRIBUTE',\n});\nconst setConfirmAttributeCompleteStep = assign({\n step: 'CONFIRM_ATTRIBUTE_COMPLETE',\n});\n// map v6 `signInStep` to v5 `challengeName`\nconst setChallengeName = assign({\n challengeName: (_, { data }) => {\n const { signInStep } = data.nextStep;\n return signInStep === 'CONFIRM_SIGN_IN_WITH_SMS_CODE'\n ? 'SMS_MFA'\n : signInStep === 'CONFIRM_SIGN_IN_WITH_TOTP_CODE'\n ? 'SOFTWARE_TOKEN_MFA'\n : undefined;\n },\n});\nconst setUsernameForgotPassword = assign({\n username: ({ formValues, loginMechanisms }) => {\n const loginMechanism = loginMechanisms[0];\n const { username, country_code } = formValues;\n if (loginMechanism === 'phone_number') {\n // forgot password `formValues` uses `username` for base phone number value\n // prefix `country_code` for full `username`\n return sanitizePhoneNumber(country_code, username);\n }\n // default username field for loginMechanism === 'email' is \"username\" for SignIn\n return username;\n },\n});\nconst setUsernameSignUp = assign({ username: getUsernameSignUp });\nconst setUsernameSignIn = assign({\n username: ({ formValues, loginMechanisms }) => {\n const loginMechanism = loginMechanisms[0];\n const { username, country_code } = formValues;\n if (loginMechanism === 'phone_number') {\n // sign in `formValues` uses `username` for base phone number value\n // prefix `country_code` for full `username`\n return sanitizePhoneNumber(country_code, username);\n }\n // return `email` and `username`\n return username;\n },\n});\nconst setNextSignInStep = assign({\n step: (_, { data }) => data.nextStep.signInStep === 'DONE'\n ? 'SIGN_IN_COMPLETE'\n : data.nextStep.signInStep,\n});\nconst setNextSignUpStep = assign({\n step: (_, { data }) => data.nextStep.signUpStep === 'DONE'\n ? 'SIGN_UP_COMPLETE'\n : data.nextStep.signUpStep,\n});\nconst setNextResetPasswordStep = assign({\n step: (_, { data }) => data.nextStep.resetPasswordStep === 'DONE'\n ? 'RESET_PASSWORD_COMPLETE'\n : data.nextStep.resetPasswordStep,\n});\nconst setMissingAttributes = assign({\n missingAttributes: (_, { data }) => data.nextStep?.missingAttributes,\n});\nconst setFieldErrors = assign({\n validationError: (_, { data }) => data,\n});\nconst setRemoteError = assign({\n remoteError: (_, { data }) => {\n if (data.name === 'NoUserPoolError') {\n return `Configuration error (see console) \u2013 please contact the administrator`;\n }\n return data?.message || data;\n },\n});\nconst setUser = assign({ user: (_, { data }) => data });\nconst resolveCodeDeliveryDetails = (details) => ({\n Destination: details.destination,\n DeliveryMedium: details.deliveryMedium,\n AttributeName: details.attributName,\n});\nconst setCodeDeliveryDetails = assign({\n codeDeliveryDetails: (_, { data }) => {\n if (data\n ?.nextStep?.codeDeliveryDetails) {\n return resolveCodeDeliveryDetails(data\n .nextStep.codeDeliveryDetails);\n }\n return resolveCodeDeliveryDetails(data);\n },\n});\nconst handleInput = assign({\n formValues: (context, { data }) => {\n const { name, value } = data;\n return { ...context['formValues'], [name]: value };\n },\n});\nconst handleSubmit = assign({\n formValues: (context, { data }) => \n // do not trim password\n trimValues({ ...context['formValues'], ...data }, 'password'),\n});\nconst handleBlur = assign({\n touched: (context, { data }) => ({\n ...context['touched'],\n [data.name]: true,\n }),\n});\nconst setUnverifiedUserAttributes = assign({\n unverifiedUserAttributes: (_, { data }) => {\n const { email, phone_number } = data;\n const unverifiedUserAttributes = {\n ...(email && { email }),\n ...(phone_number && { phone_number }),\n };\n return unverifiedUserAttributes;\n },\n});\nconst clearSelectedUserAttribute = assign({ selectedUserAttribute: undefined });\nconst setSelectedUserAttribute = assign({\n selectedUserAttribute: (context) => context.formValues?.unverifiedAttr,\n});\n// Maps to unexposed `ConfirmSignUpSignUpStep`\nconst setConfirmSignUpSignUpStep = assign({ step: 'CONFIRM_SIGN_UP' });\nconst ACTIONS = {\n clearActorDoneData,\n clearChallengeName,\n clearError,\n clearFormValues,\n clearMissingAttributes,\n clearSelectedUserAttribute,\n clearTouched,\n clearUser,\n clearValidationError,\n handleBlur,\n handleInput,\n handleSubmit,\n setChallengeName,\n setCodeDeliveryDetails,\n setFieldErrors,\n setMissingAttributes,\n setNextResetPasswordStep,\n setNextSignInStep,\n setNextSignUpStep,\n setRemoteError,\n setConfirmAttributeCompleteStep,\n setConfirmSignUpSignUpStep,\n setShouldVerifyUserAttributeStep,\n setSelectedUserAttribute,\n setSignInStep,\n setTotpSecretCode,\n setUser,\n setUnverifiedUserAttributes,\n setUsernameForgotPassword,\n setUsernameSignIn,\n setUsernameSignUp,\n};\n\nexport { ACTIONS as default };\n", "import pickBy from 'lodash/pickBy.js';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isString } from '../../utils/utils.mjs';\n\n// default `autoSignIn` flag is `true`\nconst DEFAULT_AUTO_SIGN_IN = true;\nconst EMPTY_STRING = '';\nconst sanitizePhoneNumber = (dialCode, phoneNumber) => `${dialCode}${phoneNumber}`.replace(/[^A-Z0-9+]/gi, '');\nconst selectUserAttributes = (_, key) => {\n // Allowlist of Cognito User Pool Attributes (from OpenID Connect specification)\n // See: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html\n switch (key) {\n case 'address':\n case 'birthdate':\n case 'email':\n case 'family_name':\n case 'gender':\n case 'given_name':\n case 'locale':\n case 'middle_name':\n case 'name':\n case 'nickname':\n case 'phone_number':\n case 'picture':\n case 'preferred_username':\n case 'profile':\n case 'updated_at':\n case 'website':\n case 'zoneinfo':\n return true;\n // Otherwise, it's a custom attribute\n default:\n return key.startsWith('custom:');\n }\n};\nconst getUserAttributes = (formValues) => {\n const { phone_number, ...userAttributes } = pickBy(formValues, selectUserAttributes);\n // only include `phone_number` attribute in `userAttributes` if it has a value\n if (isString(phone_number) && phone_number !== EMPTY_STRING) {\n const { country_code } = formValues;\n return {\n ...userAttributes,\n phone_number: sanitizePhoneNumber(country_code, phone_number),\n };\n }\n return userAttributes;\n};\nconst getSignUpInput = (username, formValues, loginMechanism) => {\n const { password, ...values } = formValues;\n const attributes = getUserAttributes(values);\n const options = {\n autoSignIn: DEFAULT_AUTO_SIGN_IN,\n userAttributes: {\n // use `username` value for `phone_number`\n ...(loginMechanism === 'phone_number'\n ? { ...attributes, phone_number: username }\n : attributes),\n },\n };\n return { username, password, options };\n};\nconst getUsernameSignUp = ({ formValues, loginMechanisms, }) => {\n const loginMechanism = loginMechanisms[0];\n if (loginMechanism === 'phone_number') {\n const { country_code, phone_number } = formValues;\n return sanitizePhoneNumber(country_code, phone_number);\n }\n return formValues[loginMechanism];\n};\n\nexport { getSignUpInput, getUserAttributes, getUsernameSignUp, sanitizePhoneNumber };\n", "const SIGN_IN_STEP_MFA_CONFIRMATION = [\n 'CONFIRM_SIGN_IN_WITH_SMS_CODE',\n 'CONFIRM_SIGN_IN_WITH_TOTP_CODE',\n];\n// response next step guards\nconst shouldConfirmSignInWithNewPassword = (_, { data }) => data?.nextStep.signInStep ===\n 'CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED';\nconst shouldResetPasswordFromSignIn = (_, { data }) => data?.nextStep?.signInStep === 'RESET_PASSWORD';\nconst shouldConfirmSignUpFromSignIn = (_, { data }) => data?.nextStep.signInStep === 'CONFIRM_SIGN_UP';\nconst shouldAutoSignIn = (_, { data }) => data?.nextStep.signUpStep === 'COMPLETE_AUTO_SIGN_IN';\nconst hasCompletedSignIn = (_, { data }) => data?.nextStep.signInStep === 'DONE';\nconst hasCompletedSignUp = (_, { data }) => data?.nextStep.signUpStep === 'DONE';\nconst hasCompletedResetPassword = (_, { data }) => data?.nextStep.resetPasswordStep === 'DONE';\n// actor done guards read `step` from actor exit event\nconst hasCompletedAttributeConfirmation = (_, { data }) => data?.step === 'CONFIRM_ATTRIBUTE_COMPLETE';\nconst isConfirmUserAttributeStep = (_, { data }) => data?.step === 'CONFIRM_ATTRIBUTE_WITH_CODE';\nconst isShouldConfirmUserAttributeStep = (_, { data }) => data?.step === 'SHOULD_CONFIRM_USER_ATTRIBUTE';\nconst isResetPasswordStep = (_, { data }) => data?.step === 'RESET_PASSWORD';\nconst isConfirmSignUpStep = (_, { data }) => data?.step === 'CONFIRM_SIGN_UP';\n// actor entry guards read `step` from actor context\nconst shouldConfirmSignIn = ({ step }) => SIGN_IN_STEP_MFA_CONFIRMATION.includes(step);\nconst shouldSetupTotp = ({ step }) => step === 'CONTINUE_SIGN_IN_WITH_TOTP_SETUP';\nconst shouldResetPassword = ({ step }) => step === 'RESET_PASSWORD';\nconst shouldConfirmResetPassword = ({ step }) => step === 'CONFIRM_RESET_PASSWORD_WITH_CODE';\nconst shouldConfirmSignUp = ({ step }) => step === 'CONFIRM_SIGN_UP';\n// miscellaneous guards\nconst shouldVerifyAttribute = (_, { data }) => {\n const { phone_number_verified, email_verified } = data;\n // email/phone_verified is returned as a string\n const emailNotVerified = email_verified === undefined || email_verified === 'false';\n const phoneNotVerified = phone_number_verified === undefined || phone_number_verified === 'false';\n // only request verification if both email and phone are not verified\n return emailNotVerified && phoneNotVerified;\n};\n/**\n * This guard covers an edge case that exists in the current state of the UI.\n * As of now, our ConfirmSignUp screen only supports showing an input for a\n * confirmation code. However, a Cognito UserPool can instead verify users\n * through a link that gets emailed to them. If a user verifies through the\n * link and then they click on the \"Resend Code\" button, they will get an error\n * saying that the user has already been confirmed. If we encounter that error,\n * we want to just funnel them through the rest of the flow. In the future, we will\n * want to update our UI to support both confirmation codes and links.\n *\n * https://github.com/aws-amplify/amplify-ui/issues/219\n */\nconst isUserAlreadyConfirmed = (_, { data }) => data.message === 'User is already confirmed.';\nconst GUARDS = {\n hasCompletedAttributeConfirmation,\n hasCompletedResetPassword,\n hasCompletedSignIn,\n hasCompletedSignUp,\n isConfirmSignUpStep,\n isConfirmUserAttributeStep,\n isResetPasswordStep,\n isShouldConfirmUserAttributeStep,\n isUserAlreadyConfirmed,\n shouldAutoSignIn,\n shouldConfirmResetPassword,\n shouldConfirmSignIn,\n shouldConfirmSignInWithNewPassword,\n shouldConfirmSignUp,\n shouldConfirmSignUpFromSignIn,\n shouldResetPassword,\n shouldResetPasswordFromSignIn,\n shouldSetupTotp,\n shouldVerifyAttribute,\n};\n\nexport { GUARDS as default };\n", "import { createMachine, sendUpdate } from 'xstate';\nimport { runValidators } from '../../../validators/index.mjs';\nimport ACTIONS from '../actions.mjs';\nimport GUARDS from '../guards.mjs';\nimport { defaultServices } from '../defaultServices.mjs';\n\nfunction forgotPasswordActor({ services, }) {\n return createMachine({\n id: 'forgotPasswordActor',\n initial: 'init',\n predictableActionArguments: true,\n states: {\n init: {\n always: [\n {\n cond: 'shouldResetPassword',\n target: 'confirmResetPassword',\n },\n {\n cond: 'shouldConfirmResetPassword',\n target: 'confirmResetPassword',\n },\n {\n target: 'forgotPassword',\n },\n ],\n },\n forgotPassword: {\n initial: 'edit',\n entry: 'sendUpdate',\n exit: ['clearError', 'clearTouched'],\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n CHANGE: { actions: 'handleInput' },\n BLUR: { actions: 'handleBlur' },\n },\n },\n submit: {\n tags: 'pending',\n entry: ['sendUpdate', 'clearError', 'setUsernameForgotPassword'],\n invoke: {\n src: 'handleResetPassword',\n onDone: {\n actions: [\n 'setCodeDeliveryDetails',\n 'setNextResetPasswordStep',\n ],\n target: '#forgotPasswordActor.confirmResetPassword',\n },\n onError: {\n actions: 'setRemoteError',\n target: 'edit',\n },\n },\n },\n },\n },\n confirmResetPassword: {\n type: 'parallel',\n exit: ['clearFormValues', 'clearError', 'clearTouched'],\n states: {\n validation: {\n initial: 'pending',\n states: {\n pending: {\n invoke: {\n src: 'validateFields',\n onDone: {\n target: 'valid',\n actions: 'clearValidationError',\n },\n onError: {\n target: 'invalid',\n actions: 'setFieldErrors',\n },\n },\n },\n valid: { entry: 'sendUpdate' },\n invalid: { entry: 'sendUpdate' },\n },\n on: {\n CHANGE: {\n actions: 'handleInput',\n target: '.pending',\n },\n BLUR: {\n actions: 'handleBlur',\n target: '.pending',\n },\n },\n },\n submission: {\n initial: 'idle',\n states: {\n idle: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'validate' },\n RESEND: 'resendCode',\n CHANGE: { actions: 'handleInput' },\n BLUR: { actions: 'handleBlur' },\n },\n },\n validate: {\n entry: 'sendUpdate',\n invoke: {\n src: 'validateFields',\n onDone: {\n target: 'pending',\n actions: 'clearValidationError',\n },\n onError: {\n target: 'idle',\n actions: 'setFieldErrors',\n },\n },\n },\n resendCode: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate'],\n invoke: {\n src: 'handleResetPassword',\n onDone: { target: 'idle' },\n onError: { actions: 'setRemoteError', target: 'idle' },\n },\n },\n pending: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate'],\n invoke: {\n src: 'handleConfirmResetPassword',\n onDone: [\n {\n cond: 'hasCompletedResetPassword',\n actions: 'setNextResetPasswordStep',\n target: '#forgotPasswordActor.resolved',\n },\n {\n actions: 'setSignInStep',\n target: '#forgotPasswordActor.resolved',\n },\n ],\n onError: { actions: 'setRemoteError', target: 'idle' },\n },\n },\n },\n },\n },\n },\n resolved: {\n type: 'final',\n data: ({ step }) => ({ step }),\n },\n },\n }, {\n // sendUpdate is a HOC\n actions: { ...ACTIONS, sendUpdate: sendUpdate() },\n guards: GUARDS,\n services: {\n handleResetPassword({ username }) {\n return services.handleForgotPassword({ username });\n },\n handleConfirmResetPassword({ formValues, username }) {\n const { confirmation_code: confirmationCode, password: newPassword } = formValues;\n return services.handleForgotPasswordSubmit({\n confirmationCode,\n newPassword,\n username,\n });\n },\n validateFields(context) {\n return runValidators(context.formValues, context.touched, context.passwordSettings, [\n defaultServices.validateFormPassword,\n defaultServices.validateConfirmPassword,\n ]);\n },\n },\n });\n}\n\nexport { forgotPasswordActor };\n", "import merge from 'lodash/merge.js';\nimport '@aws-amplify/core/internals/utils';\nimport '../utils/setUserAgent/constants.mjs';\nimport { isEmpty } from '../utils/utils.mjs';\n\n// Runs all validators given. Resolves if there are no error. Rejects otherwise.\nconst runValidators = async (formData, touchData, passwordSettings, validators) => {\n const errors = await Promise.all(validators.map((validator) => validator(formData, touchData, passwordSettings)));\n const mergedError = merge({}, ...errors);\n if (isEmpty(mergedError)) {\n // no errors were found\n return Promise.resolve();\n }\n else {\n return Promise.reject(mergedError);\n }\n};\n\nexport { runValidators };\n", "import { Amplify } from 'aws-amplify';\nimport { getCurrentUser, signIn, signUp, confirmSignIn, confirmSignUp, confirmResetPassword, resetPassword } from 'aws-amplify/auth';\nimport 'aws-amplify/utils';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport '../../types/authenticator/user.mjs';\nimport '../../types/authenticator/attributes.mjs';\nimport { hasSpecialChars } from '../../helpers/authenticator/utils.mjs';\nimport '../../helpers/accountSettings/utils.mjs';\n\n// Cognito does not allow a password length less then 8 characters\nconst DEFAULT_COGNITO_PASSWORD_MIN_LENGTH = 8;\nconst isInvalidUserAtributes = (userAttributes) => Array.isArray(userAttributes);\nconst parseUserAttributes = (userAttributes) => {\n if (!userAttributes) {\n return undefined;\n }\n // `aws-amplify` versions <= 6.0.5 return an array of `userAttributes` rather than an object\n if (isInvalidUserAtributes(userAttributes)) {\n return Object.entries(userAttributes).map(([_, value]) => Object.keys(value)[0]);\n }\n return Object.keys(userAttributes);\n};\nconst defaultServices = {\n async getAmplifyConfig() {\n const result = Amplify.getConfig();\n const cliConfig = result.Auth?.Cognito;\n const { loginWith, userAttributes } = result.Auth?.Cognito ?? {};\n const parsedLoginMechanisms = loginWith\n ? Object.entries(loginWith)\n .filter(([key, _value]) => key !== 'oauth')\n .filter(([_key, value]) => !!value)\n .map((keyValueArray) => {\n return keyValueArray[0] === 'phone' // the key for phone_number is phone in getConfig but everywhere else we treat is as phone_number\n ? 'phone_number'\n : keyValueArray[0];\n })\n : undefined;\n const parsedSignupAttributes = parseUserAttributes(userAttributes);\n const parsedSocialProviders = loginWith?.oauth?.providers\n ? loginWith.oauth.providers?.map((provider) => provider.toString().toLowerCase())\n : undefined;\n return {\n ...cliConfig,\n loginMechanisms: parsedLoginMechanisms,\n signUpAttributes: parsedSignupAttributes,\n socialProviders: parsedSocialProviders,\n };\n },\n getCurrentUser,\n handleSignIn: signIn,\n handleSignUp: signUp,\n handleConfirmSignIn: confirmSignIn,\n handleConfirmSignUp: confirmSignUp,\n handleForgotPasswordSubmit: confirmResetPassword,\n handleForgotPassword: resetPassword,\n // Validation hooks for overriding\n async validateCustomSignUp(_, __) { },\n async validateFormPassword(formData, touchData, passwordSettings) {\n const { password } = formData;\n const { password: touched_password } = touchData;\n /**\n * If the password is not touched,\n * or if the password settings are not set, we don't need to validate it.\n */\n if (!touched_password || !passwordSettings)\n return null;\n const password_complexity = [];\n const policyMinLength = passwordSettings.minLength ?? DEFAULT_COGNITO_PASSWORD_MIN_LENGTH;\n if (password.length < policyMinLength) {\n password_complexity.push(`Password must have at least ${policyMinLength} characters`);\n }\n if (passwordSettings.requireLowercase && !/[a-z]/.test(password))\n password_complexity.push('Password must have lower case letters');\n if (passwordSettings.requireUppercase && !/[A-Z]/.test(password))\n password_complexity.push('Password must have upper case letters');\n if (passwordSettings.requireNumbers && !/[0-9]/.test(password))\n password_complexity.push('Password must have numbers');\n // https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-policies.html\n if (passwordSettings.requireSpecialCharacters && !hasSpecialChars(password))\n password_complexity.push('Password must have special characters');\n /**\n * Only return an error if there is at least one error.\n */\n return password_complexity.length !== 0\n ? { password: password_complexity }\n : null;\n },\n async validateConfirmPassword(formData, touchData) {\n const { password, confirm_password } = formData;\n const { confirm_password: touched_confirm_password, password: touched_password, } = touchData;\n if (!password && !confirm_password) {\n // these inputs are clean, don't complain yet\n return null;\n }\n else if ((password || confirm_password) &&\n password !== confirm_password &&\n ((touched_confirm_password && touched_password) ||\n (password?.length >= 6 && confirm_password?.length >= 6))) {\n // Only return an error if both fields have text entered,\n // the passwords do not match, and the fields have been\n // touched or the password and confirm password is longer then or equal to 6.\n return {\n confirm_password: 'Your passwords must match',\n };\n }\n },\n async validatePreferredUsername(_, __) { },\n};\n\nexport { defaultServices };\n", "import { createMachine, sendUpdate } from 'xstate';\nimport { fetchUserAttributes, resetPassword, resendSignUpCode, confirmSignIn, signInWithRedirect } from 'aws-amplify/auth';\nimport { runValidators } from '../../../validators/index.mjs';\nimport ACTIONS from '../actions.mjs';\nimport { defaultServices } from '../defaultServices.mjs';\nimport GUARDS from '../guards.mjs';\nimport { getFederatedSignInState } from './utils.mjs';\n\nconst handleSignInResponse = {\n onDone: [\n {\n cond: 'hasCompletedSignIn',\n actions: 'setNextSignInStep',\n target: '#signInActor.fetchUserAttributes',\n },\n {\n cond: 'shouldConfirmSignInWithNewPassword',\n actions: ['setMissingAttributes', 'setNextSignInStep'],\n target: '#signInActor.forceChangePassword',\n },\n {\n cond: 'shouldResetPasswordFromSignIn',\n actions: 'setNextSignInStep',\n target: '#signInActor.resetPassword',\n },\n {\n cond: 'shouldConfirmSignUpFromSignIn',\n actions: 'setNextSignInStep',\n target: '#signInActor.resendSignUpCode',\n },\n {\n actions: [\n 'setChallengeName',\n 'setMissingAttributes',\n 'setNextSignInStep',\n 'setTotpSecretCode',\n ],\n target: '#signInActor.init',\n },\n ],\n onError: { actions: 'setRemoteError', target: 'edit' },\n};\nconst handleFetchUserAttributesResponse = {\n onDone: [\n {\n cond: 'shouldVerifyAttribute',\n actions: [\n 'setShouldVerifyUserAttributeStep',\n 'setUnverifiedUserAttributes',\n ],\n target: '#signInActor.resolved',\n },\n {\n actions: 'setConfirmAttributeCompleteStep',\n target: '#signInActor.resolved',\n },\n ],\n onError: {\n actions: 'setConfirmAttributeCompleteStep',\n target: '#signInActor.resolved',\n },\n};\nfunction signInActor({ services }) {\n return createMachine({\n id: 'signInActor',\n initial: 'init',\n predictableActionArguments: true,\n states: {\n init: {\n always: [\n {\n cond: 'shouldConfirmSignIn',\n target: 'confirmSignIn',\n },\n {\n cond: 'shouldSetupTotp',\n target: 'setupTotp',\n },\n {\n cond: ({ step }) => step === 'CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED',\n actions: 'setActorDoneData',\n target: 'forceChangePassword',\n },\n { target: 'signIn' },\n ],\n },\n federatedSignIn: getFederatedSignInState('signIn'),\n fetchUserAttributes: {\n invoke: {\n src: 'fetchUserAttributes',\n ...handleFetchUserAttributesResponse,\n },\n },\n resendSignUpCode: {\n invoke: {\n src: 'handleResendSignUpCode',\n onDone: {\n actions: 'setCodeDeliveryDetails',\n target: '#signInActor.resolved',\n },\n onError: {\n actions: 'setRemoteError',\n target: '#signInActor.signIn',\n },\n },\n },\n resetPassword: {\n invoke: {\n src: 'resetPassword',\n onDone: [\n {\n actions: 'setCodeDeliveryDetails',\n target: '#signInActor.resolved',\n },\n ],\n onError: { actions: ['setRemoteError', 'sendUpdate'] },\n },\n },\n signIn: {\n initial: 'edit',\n exit: 'clearTouched',\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n CHANGE: { actions: 'handleInput' },\n FEDERATED_SIGN_IN: { target: '#signInActor.federatedSignIn' },\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n },\n },\n submit: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate', 'setUsernameSignIn'],\n exit: 'clearFormValues',\n invoke: { src: 'handleSignIn', ...handleSignInResponse },\n },\n },\n },\n confirmSignIn: {\n initial: 'edit',\n exit: [\n 'clearChallengeName',\n 'clearFormValues',\n 'clearError',\n 'clearTouched',\n ],\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n SIGN_IN: '#signInActor.signIn',\n CHANGE: { actions: 'handleInput' },\n },\n },\n submit: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate'],\n invoke: {\n src: 'confirmSignIn',\n ...handleSignInResponse,\n },\n },\n },\n },\n forceChangePassword: {\n entry: 'sendUpdate',\n type: 'parallel',\n exit: ['clearFormValues', 'clearError', 'clearTouched'],\n states: {\n validation: {\n initial: 'pending',\n states: {\n pending: {\n invoke: {\n src: 'validateFields',\n onDone: {\n target: 'valid',\n actions: 'clearValidationError',\n },\n onError: {\n target: 'invalid',\n actions: 'setFieldErrors',\n },\n },\n },\n valid: { entry: 'sendUpdate' },\n invalid: { entry: 'sendUpdate' },\n },\n on: {\n SIGN_IN: {\n actions: 'setSignInStep',\n target: '#signInActor.resolved',\n },\n CHANGE: {\n actions: 'handleInput',\n target: '.pending',\n },\n BLUR: {\n actions: 'handleBlur',\n target: '.pending',\n },\n },\n },\n submit: {\n initial: 'edit',\n entry: 'clearError',\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'validate' },\n },\n },\n validate: {\n entry: 'sendUpdate',\n invoke: {\n src: 'validateFields',\n onDone: {\n actions: 'clearValidationError',\n target: 'pending',\n },\n onError: { actions: 'setFieldErrors', target: 'edit' },\n },\n },\n pending: {\n tags: 'pending',\n entry: ['sendUpdate', 'clearError'],\n invoke: {\n src: 'handleForceChangePassword',\n ...handleSignInResponse,\n },\n },\n },\n },\n },\n },\n setupTotp: {\n initial: 'edit',\n exit: ['clearFormValues', 'clearError', 'clearTouched'],\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n SIGN_IN: '#signInActor.signIn',\n CHANGE: { actions: 'handleInput' },\n },\n },\n submit: {\n tags: 'pending',\n entry: ['sendUpdate', 'clearError'],\n invoke: { src: 'confirmSignIn', ...handleSignInResponse },\n },\n },\n },\n resolved: {\n type: 'final',\n data: (context) => ({\n codeDeliveryDetails: context.codeDeliveryDetails,\n remoteError: context.remoteError,\n step: context.step,\n unverifiedUserAttributes: context.unverifiedUserAttributes,\n username: context.username,\n }),\n },\n },\n }, {\n // sendUpdate is a HOC\n actions: { ...ACTIONS, sendUpdate: sendUpdate() },\n guards: GUARDS,\n services: {\n async fetchUserAttributes() {\n return fetchUserAttributes();\n },\n resetPassword({ username }) {\n return resetPassword({ username });\n },\n handleResendSignUpCode({ username }) {\n return resendSignUpCode({ username });\n },\n handleSignIn({ formValues, username }) {\n const { password } = formValues;\n return services.handleSignIn({ username, password });\n },\n confirmSignIn({ formValues }) {\n const { confirmation_code: challengeResponse } = formValues;\n return services.handleConfirmSignIn({ challengeResponse });\n },\n async handleForceChangePassword({ formValues }) {\n let { password: challengeResponse, phone_number, country_code, \n // destructure and toss UI confirm_password field\n // to prevent error from sending to confirmSignIn\n confirm_password, ...userAttributes } = formValues;\n let phoneNumberWithCountryCode;\n if (phone_number) {\n phoneNumberWithCountryCode =\n `${country_code}${phone_number}`.replace(/[^A-Z0-9+]/gi, '');\n userAttributes = {\n ...userAttributes,\n phone_number: phoneNumberWithCountryCode,\n };\n }\n const input = {\n challengeResponse,\n options: { userAttributes },\n };\n return confirmSignIn(input);\n },\n signInWithRedirect(_, { data }) {\n return signInWithRedirect(data);\n },\n async validateFields(context) {\n return runValidators(context.formValues, context.touched, context.passwordSettings, [\n defaultServices.validateFormPassword,\n defaultServices.validateConfirmPassword,\n ]);\n },\n },\n });\n}\n\nexport { signInActor };\n", "const getFederatedSignInState = (target) => ({\n entry: ['sendUpdate', 'clearError'],\n invoke: {\n src: 'signInWithRedirect',\n onDone: { target },\n onError: { actions: 'setRemoteError', target },\n },\n});\n\nexport { getFederatedSignInState };\n", "import { createMachine, sendUpdate } from 'xstate';\nimport { autoSignIn, fetchUserAttributes, resendSignUpCode, signInWithRedirect } from 'aws-amplify/auth';\nimport { getSignUpInput } from '../utils.mjs';\nimport { runValidators } from '../../../validators/index.mjs';\nimport ACTIONS from '../actions.mjs';\nimport GUARDS from '../guards.mjs';\nimport { getFederatedSignInState } from './utils.mjs';\n\nconst handleResetPasswordResponse = {\n onDone: [\n { actions: 'setCodeDeliveryDetails', target: '#signUpActor.resolved' },\n ],\n onError: { actions: ['setRemoteError', 'sendUpdate'] },\n};\nconst handleAutoSignInResponse = {\n onDone: [\n {\n cond: 'hasCompletedSignIn',\n actions: 'setNextSignInStep',\n target: '#signUpActor.fetchUserAttributes',\n },\n {\n cond: 'shouldConfirmSignInWithNewPassword',\n actions: 'setNextSignInStep',\n target: '#signUpActor.resolved',\n },\n {\n cond: 'shouldResetPasswordFromSignIn',\n actions: 'setNextSignInStep',\n target: '#signUpActor.resetPassword',\n },\n {\n cond: 'shouldConfirmSignUpFromSignIn',\n actions: 'setNextSignInStep',\n target: '#signUpActor.resendSignUpCode',\n },\n {\n actions: [\n 'setNextSignInStep',\n 'setChallengeName',\n 'setMissingAttributes',\n 'setTotpSecretCode',\n ],\n target: '#signUpActor.resolved',\n },\n ],\n onError: {\n actions: 'setRemoteError',\n target: '#signUpActor.resolved',\n },\n};\nconst handleFetchUserAttributesResponse = {\n onDone: [\n {\n cond: 'shouldVerifyAttribute',\n actions: [\n 'setShouldVerifyUserAttributeStep',\n 'setUnverifiedUserAttributes',\n ],\n target: '#signUpActor.resolved',\n },\n {\n actions: 'setConfirmAttributeCompleteStep',\n target: '#signUpActor.resolved',\n },\n ],\n onError: {\n actions: 'setConfirmAttributeCompleteStep',\n target: '#signUpActor.resolved',\n },\n};\nfunction signUpActor({ services }) {\n return createMachine({\n id: 'signUpActor',\n initial: 'init',\n predictableActionArguments: true,\n states: {\n init: {\n always: [\n { cond: 'shouldConfirmSignUp', target: 'confirmSignUp' },\n { target: 'signUp' },\n ],\n },\n autoSignIn: {\n tags: 'pending',\n invoke: { src: 'autoSignIn', ...handleAutoSignInResponse },\n },\n fetchUserAttributes: {\n invoke: {\n src: 'fetchUserAttributes',\n ...handleFetchUserAttributesResponse,\n },\n },\n federatedSignIn: getFederatedSignInState('signUp'),\n resetPassword: {\n invoke: { src: 'resetPassword', ...handleResetPasswordResponse },\n },\n resendSignUpCode: {\n tags: 'pending',\n entry: 'sendUpdate',\n exit: 'sendUpdate',\n invoke: {\n src: 'resendSignUpCode',\n onDone: {\n actions: ['setCodeDeliveryDetails', 'sendUpdate'],\n target: '#signUpActor.confirmSignUp',\n },\n onError: [\n {\n cond: 'isUserAlreadyConfirmed',\n target: '#signUpActor.resolved',\n },\n { actions: ['setRemoteError', 'sendUpdate'] },\n ],\n },\n },\n signUp: {\n type: 'parallel',\n exit: 'clearTouched',\n on: {\n FEDERATED_SIGN_IN: { target: 'federatedSignIn' },\n },\n states: {\n validation: {\n initial: 'pending',\n states: {\n pending: {\n invoke: {\n src: 'validateSignUp',\n onDone: {\n actions: 'clearValidationError',\n target: 'valid',\n },\n onError: { actions: 'setFieldErrors', target: 'invalid' },\n },\n },\n valid: { entry: 'sendUpdate' },\n invalid: { entry: 'sendUpdate' },\n },\n on: {\n BLUR: { actions: 'handleBlur', target: '.pending' },\n CHANGE: { actions: 'handleInput', target: '.pending' },\n },\n },\n submission: {\n initial: 'idle',\n states: {\n idle: {\n entry: ['sendUpdate'],\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'validate' },\n },\n },\n validate: {\n entry: 'sendUpdate',\n invoke: {\n src: 'validateSignUp',\n onDone: {\n target: 'handleSignUp',\n actions: 'clearValidationError',\n },\n onError: { actions: 'setFieldErrors', target: 'idle' },\n },\n },\n handleSignUp: {\n tags: 'pending',\n entry: ['setUsernameSignUp', 'clearError'],\n exit: 'sendUpdate',\n invoke: {\n src: 'handleSignUp',\n onDone: [\n {\n cond: 'hasCompletedSignUp',\n actions: 'setNextSignUpStep',\n target: '#signUpActor.resolved',\n },\n {\n cond: 'shouldAutoSignIn',\n actions: 'setNextSignUpStep',\n target: '#signUpActor.autoSignIn',\n },\n {\n actions: [\n 'setCodeDeliveryDetails',\n 'setNextSignUpStep',\n ],\n target: '#signUpActor.init',\n },\n ],\n onError: {\n actions: ['sendUpdate', 'setRemoteError'],\n target: 'idle',\n },\n },\n },\n },\n },\n },\n },\n confirmSignUp: {\n initial: 'edit',\n entry: 'sendUpdate',\n states: {\n edit: {\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n CHANGE: { actions: 'handleInput' },\n BLUR: { actions: 'handleBlur' },\n RESEND: '#signUpActor.resendSignUpCode',\n },\n },\n submit: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate'],\n invoke: {\n src: 'confirmSignUp',\n onDone: [\n {\n cond: 'shouldAutoSignIn',\n actions: ['setNextSignUpStep', 'clearFormValues'],\n target: '#signUpActor.autoSignIn',\n },\n {\n actions: 'setNextSignUpStep',\n target: '#signUpActor.init',\n },\n ],\n onError: {\n actions: ['setRemoteError', 'sendUpdate'],\n target: 'edit',\n },\n },\n },\n },\n },\n resolved: {\n type: 'final',\n data: (context) => ({\n challengeName: context.challengeName,\n missingAttributes: context.missingAttributes,\n remoteError: context.remoteError,\n step: context.step,\n totpSecretCode: context.totpSecretCode,\n username: context.username,\n unverifiedUserAttributes: context.unverifiedUserAttributes,\n }),\n },\n },\n }, {\n // sendUpdate is a HOC\n actions: { ...ACTIONS, sendUpdate: sendUpdate() },\n guards: GUARDS,\n services: {\n autoSignIn() {\n return autoSignIn();\n },\n async fetchUserAttributes() {\n return fetchUserAttributes();\n },\n confirmSignUp({ formValues, username }) {\n const { confirmation_code: confirmationCode } = formValues;\n const input = { username, confirmationCode };\n return services.handleConfirmSignUp(input);\n },\n resendSignUpCode({ username }) {\n return resendSignUpCode({ username });\n },\n signInWithRedirect(_, { data }) {\n return signInWithRedirect(data);\n },\n handleSignUp(context) {\n const { formValues, loginMechanisms, username } = context;\n const loginMechanism = loginMechanisms[0];\n const input = getSignUpInput(username, formValues, loginMechanism);\n return services.handleSignUp(input);\n },\n async validateSignUp(context) {\n // This needs to exist in the machine to reference new `services`\n return runValidators(context.formValues, context.touched, context.passwordSettings, [\n // Validation of password\n services.validateFormPassword,\n // Validation for default form fields\n services.validateConfirmPassword,\n services.validatePreferredUsername,\n // Validation for any custom Sign Up fields\n services.validateCustomSignUp,\n ]);\n },\n },\n });\n}\n\nexport { signUpActor };\n", "import { createMachine } from 'xstate';\nimport { signOut } from 'aws-amplify/auth';\n\nconst signOutActor = () => {\n return createMachine({\n initial: 'pending',\n id: 'signOutActor',\n predictableActionArguments: true,\n states: {\n pending: {\n tags: 'pending',\n invoke: {\n src: 'signOut',\n onDone: 'resolved',\n onError: 'rejected',\n },\n },\n resolved: { type: 'final' },\n rejected: { type: 'final' },\n },\n }, {\n services: {\n signOut: () => signOut(),\n },\n });\n};\n\nexport { signOutActor };\n", "import { createMachine, sendUpdate } from 'xstate';\nimport { sendUserAttributeVerificationCode, confirmUserAttribute } from 'aws-amplify/auth';\nimport { runValidators } from '../../../validators/index.mjs';\nimport ACTIONS from '../actions.mjs';\nimport { defaultServices } from '../defaultServices.mjs';\n\nfunction verifyUserAttributesActor() {\n return createMachine({\n id: 'verifyUserAttributesActor',\n initial: 'selectUserAttributes',\n predictableActionArguments: true,\n states: {\n selectUserAttributes: {\n initial: 'edit',\n exit: ['clearError', 'clearTouched', 'sendUpdate'],\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n SKIP: { target: '#verifyUserAttributesActor.resolved' },\n CHANGE: { actions: 'handleInput' },\n },\n },\n submit: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate'],\n invoke: {\n src: 'sendUserAttributeVerificationCode',\n onDone: {\n actions: [\n 'setSelectedUserAttribute',\n 'setCodeDeliveryDetails',\n ],\n target: '#verifyUserAttributesActor.confirmVerifyUserAttribute',\n },\n onError: {\n actions: 'setRemoteError',\n target: 'edit',\n },\n },\n },\n },\n },\n confirmVerifyUserAttribute: {\n initial: 'edit',\n exit: ['clearError', 'clearFormValues', 'clearTouched'],\n states: {\n edit: {\n entry: 'sendUpdate',\n on: {\n SUBMIT: { actions: 'handleSubmit', target: 'submit' },\n SKIP: '#verifyUserAttributesActor.resolved',\n CHANGE: { actions: 'handleInput' },\n },\n },\n submit: {\n tags: 'pending',\n entry: ['clearError', 'sendUpdate'],\n invoke: {\n src: 'confirmVerifyUserAttribute',\n onDone: {\n actions: [\n 'setConfirmAttributeCompleteStep',\n 'clearSelectedUserAttribute',\n ],\n target: '#verifyUserAttributesActor.resolved',\n },\n onError: {\n actions: 'setRemoteError',\n target: 'edit',\n },\n },\n },\n },\n },\n resolved: { type: 'final', data: ({ step }) => ({ step }) },\n },\n }, {\n // sendUpdate is a HOC\n actions: { ...ACTIONS, sendUpdate: sendUpdate() },\n services: {\n sendUserAttributeVerificationCode({ formValues: { unverifiedAttr } }) {\n const input = {\n userAttributeKey: unverifiedAttr,\n };\n return sendUserAttributeVerificationCode(input);\n },\n async confirmVerifyUserAttribute({ formValues: { confirmation_code: confirmationCode }, selectedUserAttribute, }) {\n const input = {\n confirmationCode,\n userAttributeKey: selectedUserAttribute,\n };\n return confirmUserAttribute(input);\n },\n async validateFields(context) {\n return runValidators(context.formValues, context.touched, context.passwordSettings, [\n defaultServices.validateFormPassword,\n defaultServices.validateConfirmPassword,\n ]);\n },\n },\n });\n}\n\nexport { verifyUserAttributesActor };\n", "import { defaultTheme } from '../defaultTheme.mjs';\nimport { deepExtend, setupTokens, setupToken, flattenProperties } from './utils.mjs';\nimport { createComponentCSS } from './createComponentCSS.mjs';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isString } from '../../utils/utils.mjs';\nimport { createColorPalette } from './createColorPalette.mjs';\nimport { createAnimationCSS } from './createAnimationCSS.mjs';\n\n/**\n * This will be used like `const myTheme = createTheme({})`\n * `myTheme` can then be passed to a Provider or the generated CSS\n * can be passed to a stylesheet at build-time or run-time.\n * const myTheme = createTheme({})\n * const myOtherTheme = createTheme({}, myTheme);\n */\nfunction createTheme(theme, DefaultTheme = defaultTheme) {\n // merge theme and DefaultTheme to get a complete theme\n // deepExtend is an internal Style Dictionary method\n // that performs a deep merge on n objects. We could change\n // this to another 3p deep merge solution too.\n const mergedTheme = deepExtend([\n {},\n DefaultTheme,\n {\n ...theme,\n components: {},\n },\n ]);\n const { primaryColor, secondaryColor } = mergedTheme;\n // apply primaryColor and secondaryColor if present\n if (isString(primaryColor)) {\n mergedTheme.tokens.colors.primary = createColorPalette({\n keys: Object.keys(mergedTheme.tokens.colors[primaryColor]),\n value: primaryColor,\n });\n }\n if (isString(secondaryColor)) {\n mergedTheme.tokens.colors.secondary = createColorPalette({\n keys: Object.keys(mergedTheme.tokens.colors[secondaryColor]),\n value: secondaryColor,\n });\n }\n // Setting up the tokens. This is similar to what Style Dictionary\n // does. At the end of this, each token should have:\n // - CSS variable name of itself\n // - its value (reference to another CSS variable or raw value)\n const tokens = setupTokens({\n tokens: mergedTheme.tokens,\n setupToken,\n }); // Setting the type here because setupTokens is recursive\n const { breakpoints, name } = mergedTheme;\n // flattenProperties is another internal Style Dictionary function\n // that creates an array of all tokens.\n let cssText = `[data-amplify-theme=\"${name}\"] {\\n` +\n flattenProperties(tokens)\n .map((token) => `${token.name}: ${token.value};`)\n .join('\\n') +\n `\\n}\\n`;\n if (theme?.components) {\n cssText += createComponentCSS({\n theme: {\n ...mergedTheme,\n tokens,\n },\n components: theme.components,\n });\n }\n let overrides = [];\n if (mergedTheme.animations) {\n cssText += createAnimationCSS({\n animations: mergedTheme.animations,\n tokens,\n });\n }\n /**\n * For each override, we setup the tokens and then generate the CSS.\n * This allows us to have one single CSS string for all possible overrides\n * and avoid re-renders in React, but also support other frameworks as well.\n */\n if (mergedTheme.overrides) {\n overrides = mergedTheme.overrides.map((override) => {\n const overrideTokens = setupTokens({\n tokens: override.tokens,\n setupToken,\n });\n const customProperties = flattenProperties(overrideTokens)\n .map((token) => `${token.name}: ${token.value};`)\n .join('\\n');\n // Overrides can have a selector, media query, breakpoint, or color mode\n // for creating the selector\n if ('selector' in override) {\n cssText += `\\n${override.selector} {\\n${customProperties}\\n}\\n`;\n }\n if ('mediaQuery' in override) {\n cssText += `\\n@media (${override.mediaQuery}) {\n [data-amplify-theme=\"${name}\"] {\n ${customProperties}\n }\n}\\n`;\n }\n if ('breakpoint' in override) {\n const breakpoint = mergedTheme.breakpoints.values[override.breakpoint];\n cssText += `\\n@media (min-width: ${breakpoint}px) {\n [data-amplify-theme=\"${name}\"] {\n ${customProperties}\n }\n}\\n`;\n }\n if ('colorMode' in override) {\n cssText += `\\n@media (prefers-color-scheme: ${override.colorMode}) {\n [data-amplify-theme=\"${name}\"][data-amplify-color-mode=\"system\"] {\n ${customProperties}\n color-scheme: ${override.colorMode};\n }\n }\\n`;\n cssText += `\\n[data-amplify-theme=\"${name}\"][data-amplify-color-mode=\"${override.colorMode}\"] {\n ${customProperties}\n color-scheme: ${override.colorMode};\n }\\n`;\n }\n return {\n ...override,\n tokens: overrideTokens,\n };\n });\n }\n return {\n tokens,\n breakpoints,\n name,\n cssText,\n containerProps: ({ colorMode } = {}) => {\n return {\n 'data-amplify-theme': name,\n 'data-amplify-color-mode': colorMode,\n };\n },\n // keep overrides separate from base theme\n // this allows web platforms to use plain CSS scoped to a\n // selector and only override the CSS vars needed. This\n // means we could generate CSS at build-time in a postcss\n // plugin, or do it at runtime and inject the CSS into a\n // style tag.\n // This also allows RN to dynamically switch themes in a\n // provider.\n overrides,\n };\n}\n\nexport { createTheme };\n", "import { tokens } from './tokens/index.mjs';\nimport { breakpoints } from './breakpoints.mjs';\n\nconst defaultTheme = {\n tokens,\n breakpoints,\n name: 'default-theme',\n};\n\nexport { defaultTheme };\n", "import { borderWidths } from './borderWidths.mjs';\nimport { colors } from './colors.mjs';\nimport { components } from './components/index.mjs';\nimport { fonts } from './fonts.mjs';\nimport { fontSizes } from './fontSizes.mjs';\nimport { fontWeights } from './fontWeights.mjs';\nimport { lineHeights } from './lineHeights.mjs';\nimport { opacities } from './opacities.mjs';\nimport { outlineOffsets } from './outlineOffsets.mjs';\nimport { outlineWidths } from './outlineWidths.mjs';\nimport { radii } from './radii.mjs';\nimport { shadows } from './shadows.mjs';\nimport { space } from './space.mjs';\nimport { time } from './time.mjs';\nimport { transforms } from './transforms.mjs';\n\nconst tokens = {\n components,\n borderWidths,\n colors,\n fonts,\n fontSizes,\n fontWeights,\n lineHeights,\n opacities,\n outlineOffsets,\n outlineWidths,\n radii,\n shadows,\n space,\n time,\n transforms,\n};\nconst reactNativeTokens = {\n colors,\n borderWidths,\n fontSizes: {\n xxs: fontSizes.xxs,\n xs: fontSizes.xs,\n small: fontSizes.small,\n medium: fontSizes.medium,\n large: fontSizes.large,\n xl: fontSizes.xl,\n xxl: fontSizes.xxl,\n xxxl: fontSizes.xxxl,\n },\n fontWeights,\n opacities,\n // React Native doesn't need the relative space values\n space: {\n // use `space.xxxs` to output a value of `2` and avoid odd space numbers\n xxs: space.xxxs,\n xs: space.xs,\n small: space.small,\n medium: space.medium,\n large: space.large,\n xl: space.xl,\n xxl: space.xxl,\n xxxl: space.xxxl,\n },\n radii,\n time,\n};\n\nexport { reactNativeTokens, tokens };\n", "const borderWidths = {\n small: { value: '1px' },\n medium: { value: '2px' },\n large: { value: '3px' },\n};\n\nexport { borderWidths };\n", "const colors = {\n red: {\n 10: { value: 'hsl(0, 75%, 95%)' },\n 20: { value: 'hsl(0, 75%, 85%)' },\n 40: { value: 'hsl(0, 75%, 75%)' },\n 60: { value: 'hsl(0, 50%, 50%)' },\n 80: { value: 'hsl(0, 95%, 30%)' },\n 90: { value: 'hsl(0, 100%, 20%)' },\n 100: { value: 'hsl(0, 100%, 15%)' },\n },\n orange: {\n 10: { value: 'hsl(30, 75%, 95%)' },\n 20: { value: 'hsl(30, 75%, 85%)' },\n 40: { value: 'hsl(30, 75%, 75%)' },\n 60: { value: 'hsl(30, 50%, 50%)' },\n 80: { value: 'hsl(30, 95%, 30%)' },\n 90: { value: 'hsl(30, 100%, 20%)' },\n 100: { value: 'hsl(30, 100%, 15%)' },\n },\n yellow: {\n 10: { value: 'hsl(60, 75%, 95%)' },\n 20: { value: 'hsl(60, 75%, 85%)' },\n 40: { value: 'hsl(60, 75%, 75%)' },\n 60: { value: 'hsl(60, 50%, 50%)' },\n 80: { value: 'hsl(60, 95%, 30%)' },\n 90: { value: 'hsl(60, 100%, 20%)' },\n 100: { value: 'hsl(60, 100%, 15%)' },\n },\n green: {\n 10: { value: 'hsl(130, 60%, 95%)' },\n 20: { value: 'hsl(130, 60%, 90%)' },\n 40: { value: 'hsl(130, 44%, 63%)' },\n 60: { value: 'hsl(130, 43%, 46%)' },\n 80: { value: 'hsl(130, 33%, 37%)' },\n 90: { value: 'hsl(130, 27%, 29%)' },\n 100: { value: 'hsl(130, 22%, 23%)' },\n },\n teal: {\n 10: { value: 'hsl(190, 75%, 95%)' },\n 20: { value: 'hsl(190, 75%, 85%)' },\n 40: { value: 'hsl(190, 70%, 70%)' },\n 60: { value: 'hsl(190, 50%, 50%)' },\n 80: { value: 'hsl(190, 95%, 30%)' },\n 90: { value: 'hsl(190, 100%, 20%)' },\n 100: { value: 'hsl(190, 100%, 15%)' },\n },\n blue: {\n 10: { value: 'hsl(220, 95%, 95%)' },\n 20: { value: 'hsl(220, 85%, 85%)' },\n 40: { value: 'hsl(220, 70%, 70%)' },\n 60: { value: 'hsl(220, 50%, 50%)' },\n 80: { value: 'hsl(220, 95%, 30%)' },\n 90: { value: 'hsl(220, 100%, 20%)' },\n 100: { value: 'hsl(220, 100%, 15%)' },\n },\n purple: {\n 10: { value: 'hsl(300, 95%, 95%)' },\n 20: { value: 'hsl(300, 85%, 85%)' },\n 40: { value: 'hsl(300, 70%, 70%)' },\n 60: { value: 'hsl(300, 50%, 50%)' },\n 80: { value: 'hsl(300, 95%, 30%)' },\n 90: { value: 'hsl(300, 100%, 20%)' },\n 100: { value: 'hsl(300, 100%, 15%)' },\n },\n pink: {\n 10: { value: 'hsl(340, 95%, 95%)' },\n 20: { value: 'hsl(340, 90%, 85%)' },\n 40: { value: 'hsl(340, 70%, 70%)' },\n 60: { value: 'hsl(340, 50%, 50%)' },\n 80: { value: 'hsl(340, 95%, 30%)' },\n 90: { value: 'hsl(340, 100%, 20%)' },\n 100: { value: 'hsl(340, 100%, 15%)' },\n },\n neutral: {\n 10: { value: 'hsl(210, 5%, 98%)' },\n 20: { value: 'hsl(210, 5%, 94%)' },\n 40: { value: 'hsl(210, 5%, 87%)' },\n 60: { value: 'hsl(210, 10%, 58%)' },\n 80: { value: 'hsl(210, 10%, 40%)' },\n 90: { value: 'hsl(210, 25%, 25%)' },\n 100: { value: 'hsl(210, 50%, 10%)' },\n },\n primary: {\n 10: { value: '{colors.teal.10.value}' },\n 20: { value: '{colors.teal.20.value}' },\n 40: { value: '{colors.teal.40.value}' },\n 60: { value: '{colors.teal.60.value}' },\n 80: { value: '{colors.teal.80.value}' },\n 90: { value: '{colors.teal.90.value}' },\n 100: { value: '{colors.teal.100.value}' },\n },\n secondary: {\n 10: { value: '{colors.purple.10.value}' },\n 20: { value: '{colors.purple.20.value}' },\n 40: { value: '{colors.purple.40.value}' },\n 60: { value: '{colors.purple.60.value}' },\n 80: { value: '{colors.purple.80.value}' },\n 90: { value: '{colors.purple.90.value}' },\n 100: { value: '{colors.purple.100.value}' },\n },\n font: {\n primary: { value: '{colors.neutral.100.value}' },\n secondary: { value: '{colors.neutral.90.value}' },\n tertiary: { value: '{colors.neutral.80.value}' },\n disabled: { value: '{colors.neutral.60.value}' },\n inverse: { value: '{colors.white.value}' },\n interactive: { value: '{colors.primary.80.value}' },\n // Hover and Focus colors are intentionally different colors.\n // This allows users to distinguish between the current keyboard focus\n // and the location of their pointer\n hover: { value: '{colors.primary.90.value}' },\n // Focus color is set to 100 to ensure enough contrast for accessibility\n focus: { value: '{colors.primary.100.value}' },\n active: { value: '{colors.primary.100.value}' },\n info: { value: '{colors.blue.90.value}' },\n warning: { value: '{colors.orange.90.value}' },\n error: { value: '{colors.red.90.value}' },\n success: { value: '{colors.green.90.value}' },\n },\n background: {\n primary: { value: '{colors.white.value}' },\n secondary: { value: '{colors.neutral.10.value}' },\n tertiary: { value: '{colors.neutral.20.value}' },\n quaternary: { value: '{colors.neutral.60.value}' },\n disabled: { value: '{colors.background.tertiary.value}' },\n info: { value: '{colors.blue.10.value}' },\n warning: { value: '{colors.orange.10.value}' },\n error: { value: '{colors.red.10.value}' },\n success: { value: '{colors.green.10.value}' },\n },\n border: {\n primary: { value: '{colors.neutral.60.value}' },\n secondary: { value: '{colors.neutral.40.value}' },\n tertiary: { value: '{colors.neutral.20.value}' },\n disabled: { value: '{colors.border.tertiary.value}' },\n pressed: { value: '{colors.primary.100.value}' },\n // Focus color is set to 100 to ensure enough contrast for accessibility\n focus: { value: '{colors.primary.100.value}' },\n error: { value: '{colors.red.80.value}' },\n info: { value: '{colors.blue.80.value}' },\n success: { value: '{colors.green.80.value}' },\n warning: { value: '{colors.orange.80.value}' },\n },\n shadow: {\n primary: { value: 'hsla(210, 50%, 10%, 0.25)' },\n secondary: { value: 'hsla(210, 50%, 10%, 0.15)' },\n tertiary: { value: 'hsla(210, 50%, 10%, 0.05)' },\n },\n overlay: {\n 5: { value: 'hsla(0, 0%, 0%, 0.05)' },\n 10: { value: 'hsla(0, 0%, 0%, 0.1)' },\n 20: { value: 'hsla(0, 0%, 0%, 0.2)' },\n 30: { value: 'hsla(0, 0%, 0%, 0.3)' },\n 40: { value: 'hsla(0, 0%, 0%, 0.4)' },\n 50: { value: 'hsla(0, 0%, 0%, 0.5)' },\n 60: { value: 'hsla(0, 0%, 0%, 0.6)' },\n 70: { value: 'hsla(0, 0%, 0%, 0.7)' },\n 80: { value: 'hsla(0, 0%, 0%, 0.8)' },\n 90: { value: 'hsla(0, 0%, 0%, 0.9)' },\n },\n black: { value: 'hsl(0, 0%, 0%)' },\n white: { value: 'hsl(0, 0%, 100%)' },\n transparent: { value: 'transparent' },\n};\n\nexport { colors };\n", "import { alert } from './alert.mjs';\nimport { aiConversation } from './aiConversation.mjs';\nimport { autocomplete } from './autocomplete.mjs';\nimport { authenticator } from './authenticator.mjs';\nimport { avatar } from './avatar.mjs';\nimport { badge } from './badge.mjs';\nimport { breadcrumbs } from './breadcrumbs.mjs';\nimport { button } from './button.mjs';\nimport { card } from './card.mjs';\nimport { checkbox } from './checkbox.mjs';\nimport { checkboxfield } from './checkboxField.mjs';\nimport { collection } from './collection.mjs';\nimport { copy } from './copy.mjs';\nimport { dialcodeselect } from './dialCodeSelect.mjs';\nimport { divider } from './divider.mjs';\nimport { dropzone } from './dropZone.mjs';\nimport { accordion } from './accordion.mjs';\nimport { field } from './field.mjs';\nimport { fieldcontrol } from './fieldControl.mjs';\nimport { fieldgroup } from './fieldGroup.mjs';\nimport { fieldset } from './fieldset.mjs';\nimport { fieldmessages } from './fieldMessages.mjs';\nimport { fileuploader } from './fileuploader.mjs';\nimport { flex } from './flex.mjs';\nimport { heading } from './heading.mjs';\nimport { highlightmatch } from './highlightMatch.mjs';\nimport { icon } from './icon.mjs';\nimport { input } from './input.mjs';\nimport { image } from './image.mjs';\nimport { inappmessaging } from './inAppMessaging.mjs';\nimport { link } from './link.mjs';\nimport { liveness } from './liveness.mjs';\nimport { loader } from './loader.mjs';\nimport { menu } from './menu.mjs';\nimport { message } from './message.mjs';\nimport { pagination } from './pagination.mjs';\nimport { passwordfield } from './passwordField.mjs';\nimport { phonenumberfield } from './phoneNumberField.mjs';\nimport { placeholder } from './placeholder.mjs';\nimport { radio } from './radio.mjs';\nimport { radiogroup } from './radioGroup.mjs';\nimport { rating } from './rating.mjs';\nimport { searchfield } from './searchField.mjs';\nimport { select } from './select.mjs';\nimport { selectfield } from './selectField.mjs';\nimport { sliderfield } from './sliderField.mjs';\nimport { stepperfield } from './stepperField.mjs';\nimport { storagemanager } from './storagemanager.mjs';\nimport { switchfield } from './switchField.mjs';\nimport { table } from './table.mjs';\nimport { tabs } from './tabs.mjs';\nimport { text } from './text.mjs';\nimport { textareafield } from './textAreaField.mjs';\nimport { textfield } from './textField.mjs';\nimport { togglebutton } from './toggleButton.mjs';\nimport { togglebuttongroup } from './toggleButtonGroup.mjs';\n\nconst components = {\n accordion,\n aiConversation,\n alert,\n authenticator,\n autocomplete,\n avatar,\n badge,\n breadcrumbs,\n button,\n card,\n checkbox,\n checkboxfield,\n collection,\n copy,\n countrycodeselect: dialcodeselect,\n divider,\n dropzone,\n field,\n fieldcontrol,\n fieldgroup,\n fieldmessages,\n fieldset,\n fileuploader,\n flex,\n heading,\n icon,\n highlightmatch,\n image,\n inappmessaging,\n input,\n link,\n liveness,\n loader,\n menu,\n message,\n pagination,\n passwordfield,\n phonenumberfield,\n placeholder,\n radio,\n radiogroup,\n rating,\n searchfield,\n select,\n selectfield,\n sliderfield,\n stepperfield,\n storagemanager,\n switchfield,\n table,\n tabs,\n text,\n textareafield,\n textfield,\n togglebutton,\n togglebuttongroup,\n};\n\nexport { components };\n", "const alert = {\n // Default styles\n alignItems: { value: 'center' },\n justifyContent: { value: 'space-between' },\n color: { value: '{colors.font.primary.value}' },\n backgroundColor: { value: '{colors.background.tertiary.value}' },\n paddingBlock: { value: '{space.small.value}' },\n paddingInline: { value: '{space.medium.value}' },\n icon: {\n size: { value: '{fontSizes.xl.value}' },\n },\n heading: {\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n },\n // Variations\n info: {\n color: { value: '{colors.font.info.value}' },\n backgroundColor: { value: '{colors.background.info.value}' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n backgroundColor: { value: '{colors.background.error.value}' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n backgroundColor: { value: '{colors.background.warning.value}' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n backgroundColor: { value: '{colors.background.success.value}' },\n },\n};\n\nexport { alert };\n", "const aiConversation = {\n message: {\n backgroundColor: { value: '{colors.background.secondary.value}' },\n borderRadius: { value: '{radii.large.value}' },\n gap: { value: '{space.small.value}' },\n paddingBlock: { value: '{space.small.value}' },\n paddingInline: { value: '{space.small.value}' },\n user: {\n backgroundColor: { value: '{colors.background.secondary.value}' },\n },\n assistant: {\n backgroundColor: { value: '{colors.primary.10.value}' },\n },\n sender: {\n gap: { value: '{space.small.value}' },\n username: {\n color: { value: '{colors.font.primary.value}' },\n fontSize: { value: 'inherit' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n },\n timestamp: {\n color: { value: '{colors.font.tertiary.value}' },\n fontSize: { value: 'inherit' },\n fontWeight: { value: 'inherit' },\n },\n },\n body: { gap: { value: '{space.xs.value}' } },\n actions: { gap: { value: '{space.xs.value}' } },\n },\n form: {\n gap: { value: '{space.small.value}' },\n padding: { value: '{space.small.value}' },\n },\n attachment: {\n borderColor: { value: '{colors.border.secondary.value}' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderRadius: { value: '{radii.small.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n paddingBlock: { value: '{space.xxxs.value}' },\n paddingInline: { value: '{space.xs.value}' },\n gap: { value: '{space.xs.value}' },\n list: {\n paddingBlockStart: { value: '{space.xs.value}' },\n gap: { value: '{space.xxs.value}' },\n },\n name: {\n color: { value: '{colors.font.primary.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n fontWeight: { value: '{fontWeights.normal.value}' },\n },\n size: {\n color: { value: '{colors.font.tertiary.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n fontWeight: { value: '{fontWeights.normal.value}' },\n },\n remove: {\n padding: { value: '{space.xxs.value}' },\n },\n image: {\n width: { value: '{fontSizes.medium.value}' },\n height: { value: '{fontSizes.medium.value}' },\n },\n },\n};\n\nexport { aiConversation };\n", "const autocomplete = {\n menu: {\n width: { value: '100%' },\n marginBlockStart: { value: '{space.xxxs}' },\n backgroundColor: { value: '{colors.background.primary}' },\n borderColor: { value: '{colors.border.primary}' },\n borderWidth: { value: '{borderWidths.small}' },\n borderStyle: { value: 'solid' },\n borderRadius: { value: '{radii.small}' },\n options: {\n display: { value: 'flex' },\n flexDirection: { value: 'column' },\n maxHeight: { value: '300px' },\n },\n option: {\n backgroundColor: { value: '{colors.background.primary}' },\n color: { value: 'currentcolor' },\n cursor: { value: 'pointer' },\n transitionDuration: { value: '{time.short}' },\n transitionProperty: { value: 'background-color, color' },\n transitionTimingFunction: { value: 'ease' },\n _active: {\n backgroundColor: { value: '{colors.primary.80}' },\n color: { value: '{colors.white}' },\n },\n },\n _empty: {\n display: { value: 'flex' },\n },\n _loading: {\n alignItems: { value: 'center' },\n display: { value: 'flex' },\n gap: { value: '{space.xxxs}' },\n },\n spaceShared: {\n paddingBlock: { value: '{space.xs}' },\n paddingInline: { value: '{space.small}' },\n },\n },\n};\n\nexport { autocomplete };\n", "const authenticator = {\n maxWidth: { value: '60rem' },\n modal: {\n width: { value: '{space.relative.full}' },\n height: { value: '{space.relative.full}' },\n backgroundColor: { value: '{colors.overlay.50.value}' },\n top: { value: '{space.zero}' },\n left: { value: '{space.zero}' },\n },\n container: {\n widthMax: { value: '30rem' },\n },\n router: {\n borderWidth: { value: '{borderWidths.small.value}' },\n borderStyle: { value: 'solid' },\n borderColor: { value: '{colors.border.primary.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n boxShadow: { value: '{shadows.medium.value}' },\n },\n footer: {\n paddingBottom: { value: '{space.medium.value}' },\n },\n form: {\n padding: { value: '{space.xl.value}' },\n },\n state: {\n inactive: {\n backgroundColor: { value: '{colors.background.secondary.value}' },\n },\n },\n orContainer: {\n color: { value: '{colors.neutral.80.value}' },\n orLine: {\n backgroundColor: { value: '{colors.background.primary.value}' },\n },\n },\n};\n\nexport { authenticator };\n", "const avatar = {\n // Default styles\n color: { value: '{colors.font.tertiary.value}' },\n lineHeight: { value: 1 },\n fontWeight: { value: '{fontWeights.semibold.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n textAlign: { value: 'center' },\n width: { value: '{fontSizes.xxl.value}' },\n height: { value: '{fontSizes.xxl.value}' },\n backgroundColor: { value: '{colors.background.tertiary}' },\n borderRadius: { value: '100%' },\n borderColor: { value: '{colors.border.primary.value}' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n // Color Theme Variations\n info: {\n color: { value: '{colors.font.info.value}' },\n backgroundColor: { value: '{colors.background.info.value}' },\n borderColor: { value: '{colors.border.info.value}' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n backgroundColor: { value: '{colors.background.warning.value}' },\n borderColor: { value: '{colors.border.warning.value}' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n backgroundColor: { value: '{colors.background.success.value}' },\n borderColor: { value: '{colors.border.success.value}' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n backgroundColor: { value: '{colors.background.error.value}' },\n borderColor: { value: '{colors.border.error.value}' },\n },\n // Sizes\n small: {\n fontSize: { value: '{fontSizes.xs.value}' },\n width: { value: '{fontSizes.xl.value}' },\n height: { value: '{fontSizes.xl.value}' },\n },\n // medium is the default size\n large: {\n fontSize: { value: '{fontSizes.medium.value}' },\n width: { value: '{fontSizes.xxxl.value}' },\n height: { value: '{fontSizes.xxxl.value}' },\n },\n};\n\nexport { avatar };\n", "const badge = {\n // Default styles\n color: { value: '{colors.font.primary.value}' },\n lineHeight: { value: 1 },\n fontWeight: { value: '{fontWeights.semibold.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n textAlign: { value: 'center' },\n paddingVertical: { value: '{space.xs.value}' },\n paddingHorizontal: { value: '{space.small.value}' },\n backgroundColor: { value: '{colors.background.tertiary.value}' },\n // An arbitrarily large value to ensure that the left and right sides of the badge are perfectly rounded for any size variation\n borderRadius: { value: '{radii.xl.value}' },\n // Variations\n info: {\n color: { value: '{colors.font.info.value}' },\n backgroundColor: { value: '{colors.background.info.value}' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n backgroundColor: { value: '{colors.background.warning.value}' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n backgroundColor: { value: '{colors.background.success.value}' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n backgroundColor: { value: '{colors.background.error.value}' },\n },\n // Sizes\n small: {\n fontSize: { value: '{fontSizes.xs.value}' },\n paddingVertical: { value: '{space.xxs.value}' },\n paddingHorizontal: { value: '{space.xs.value}' },\n },\n // medium is the default size\n large: {\n fontSize: { value: '{fontSizes.medium.value}' },\n paddingVertical: { value: '{space.small.value}' },\n paddingHorizontal: { value: '{space.medium.value}' },\n },\n};\n\nexport { badge };\n", "const breadcrumbs = {\n flexDirection: { value: 'row' },\n flexWrap: { value: 'wrap' },\n gap: { value: '0' },\n color: { value: '{colors.font.tertiary}' },\n item: {\n flexDirection: { value: 'row' },\n color: { value: 'inherit' },\n fontSize: { value: 'inherit' },\n alignItems: { value: 'center' },\n lineHeight: { value: '1' },\n },\n separator: {\n color: { value: 'inherit' },\n fontSize: { value: 'inherit' },\n paddingInline: { value: '{space.xxs}' },\n },\n link: {\n color: { value: '{components.link.color}' },\n fontSize: { value: 'inherit' },\n fontWeight: { value: 'normal' },\n textDecoration: { value: 'none' },\n paddingInline: { value: '{space.xs}' },\n paddingBlock: { value: '{space.xxs}' },\n current: {\n color: { value: 'inherit' },\n fontSize: { value: 'inherit' },\n fontWeight: { value: 'normal' },\n textDecoration: { value: 'none' },\n },\n },\n};\n\nexport { breadcrumbs };\n", "const button = {\n // shared styles\n fontWeight: { value: '{fontWeights.bold.value}' },\n transitionDuration: {\n value: '{components.fieldcontrol.transitionDuration.value}',\n },\n fontSize: { value: '{components.fieldcontrol.fontSize.value}' },\n lineHeight: { value: '{components.fieldcontrol.lineHeight.value}' },\n paddingBlockStart: {\n value: '{components.fieldcontrol.paddingBlockStart.value}',\n },\n paddingBlockEnd: {\n value: '{components.fieldcontrol.paddingBlockEnd.value}',\n },\n paddingInlineStart: {\n value: '{components.fieldcontrol.paddingInlineStart.value}',\n },\n paddingInlineEnd: {\n value: '{components.fieldcontrol.paddingInlineEnd.value}',\n },\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{components.fieldcontrol.borderColor.value}' },\n borderWidth: { value: '{components.fieldcontrol.borderWidth.value}' },\n borderStyle: { value: '{components.fieldcontrol.borderStyle.value}' },\n borderRadius: { value: '{components.fieldcontrol.borderRadius.value}' },\n color: { value: '{colors.font.primary.value}' },\n _hover: {\n color: { value: '{colors.font.focus.value}' },\n backgroundColor: { value: '{colors.primary.10.value}' },\n borderColor: { value: '{colors.primary.60.value}' },\n },\n _focus: {\n color: { value: '{colors.font.focus.value}' },\n backgroundColor: { value: '{colors.primary.10.value}' },\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n },\n _active: {\n color: { value: '{colors.font.active.value}' },\n backgroundColor: { value: '{colors.primary.20.value}' },\n borderColor: { value: '{colors.primary.100.value}' },\n },\n _loading: {\n color: { value: '{colors.font.disabled.value}' },\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.tertiary.value}' },\n },\n _disabled: {\n color: { value: '{colors.font.disabled.value}' },\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.tertiary.value}' },\n },\n // variations\n outlined: {\n info: {\n borderColor: { value: '{colors.blue.60.value}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.blue.100}' },\n _hover: {\n borderColor: { value: '{colors.blue.60.value}' },\n backgroundColor: { value: '{colors.blue.10.value}' },\n color: { value: '{colors.blue.100.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.blue.100.value}' },\n backgroundColor: { value: '{colors.blue.10.value}' },\n color: { value: '{colors.blue.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.info._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: '{colors.blue.100.value}' },\n backgroundColor: { value: '{colors.blue.20.value}' },\n color: { value: '{colors.blue.100.value}' },\n },\n },\n warning: {\n borderColor: { value: '{colors.orange.60.value}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.orange.100}' },\n _hover: {\n borderColor: { value: '{colors.orange.60.value}' },\n backgroundColor: { value: '{colors.orange.10.value}' },\n color: { value: '{colors.orange.100.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.orange.100.value}' },\n backgroundColor: { value: '{colors.orange.10.value}' },\n color: { value: '{colors.orange.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.warning._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: '{colors.orange.100.value}' },\n backgroundColor: { value: '{colors.orange.20.value}' },\n color: { value: '{colors.orange.100.value}' },\n },\n },\n success: {\n borderColor: { value: '{colors.green.60.value}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.green.100}' },\n _hover: {\n borderColor: { value: '{colors.green.60.value}' },\n backgroundColor: { value: '{colors.green.10.value}' },\n color: { value: '{colors.green.100.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.green.100.value}' },\n backgroundColor: { value: '{colors.green.10.value}' },\n color: { value: '{colors.green.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.success._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: '{colors.green.100.value}' },\n backgroundColor: { value: '{colors.green.20.value}' },\n color: { value: '{colors.green.100.value}' },\n },\n },\n error: {\n borderColor: { value: '{colors.red.80.value}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.red.100}' },\n _hover: {\n borderColor: { value: '{colors.red.80.value}' },\n backgroundColor: { value: '{colors.red.10.value}' },\n color: { value: '{colors.red.100.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.red.100.value}' },\n backgroundColor: { value: '{colors.red.10.value}' },\n color: { value: '{colors.red.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol._error._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: '{colors.red.100.value}' },\n backgroundColor: { value: '{colors.red.20.value}' },\n color: { value: '{colors.red.100.value}' },\n },\n },\n overlay: {\n borderColor: { value: '{colors.overlay.60.value}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.font.primary.value}' },\n _hover: {\n borderColor: { value: '{colors.overlay.60.value}' },\n backgroundColor: { value: '{colors.overlay.5.value}' },\n color: { value: '{colors.neutral.90.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.overlay.90.value}' },\n backgroundColor: { value: '{colors.overlay.5.value}' },\n color: { value: '{colors.neutral.90.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.overlay._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: '{colors.overlay.90.value}' },\n backgroundColor: { value: '{colors.overlay.10.value}' },\n color: { value: '{colors.neutral.100.value}' },\n },\n },\n },\n primary: {\n borderColor: { value: 'transparent' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderStyle: { value: 'solid' },\n backgroundColor: { value: '{colors.primary.80.value}' },\n color: { value: '{colors.font.inverse.value}' },\n _disabled: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.background.disabled.value}' },\n color: { value: '{colors.font.disabled.value}' },\n },\n _loading: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.background.disabled.value}' },\n color: { value: '{colors.font.disabled.value}' },\n },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.primary.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.primary.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.primary.100.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n info: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.80}' },\n color: { value: '{colors.font.inverse.value}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.info._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.100.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n },\n warning: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.80}' },\n color: { value: '{colors.font.inverse.value}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.overlay._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.100.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n },\n error: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.80}' },\n color: { value: '{colors.font.inverse.value}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n boxShadow: {\n value: '{components.fieldcontrol._error._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.100.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n },\n success: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.80}' },\n color: { value: '{colors.font.inverse.value}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.success._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.100.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n },\n overlay: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.70}' },\n color: { value: '{colors.font.inverse.value}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.overlay._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.90.value}' },\n color: { value: '{colors.font.inverse.value}' },\n },\n },\n },\n menu: {\n borderWidth: { value: '{space.zero.value}' },\n backgroundColor: { value: 'transparent' },\n justifyContent: { value: 'start' },\n // Focus and hover styles are identical for menu variation\n // because for Menu primitive, menu items are forced to be focused even\n // for mouse interactions, making it impossible to distinguish the two interactions\n _hover: {\n color: { value: '{colors.font.inverse.value}' },\n backgroundColor: { value: '{colors.primary.80.value}' },\n },\n _focus: {\n color: { value: '{colors.font.inverse.value}' },\n backgroundColor: { value: '{colors.primary.80.value}' },\n },\n _active: {\n color: { value: '{colors.font.inverse.value}' },\n backgroundColor: { value: '{colors.primary.90.value}' },\n },\n _disabled: {\n color: { value: '{colors.font.disabled.value}' },\n },\n },\n link: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: 'transparent' },\n borderWidth: { value: '{borderWidths.small.value}' },\n color: { value: '{colors.font.interactive.value}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.primary.10.value}' },\n color: { value: '{colors.font.hover.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.primary.10.value}' },\n color: { value: '{colors.font.focus.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.primary.20.value}' },\n color: { value: '{colors.font.active.value}' },\n },\n _disabled: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.font.disabled.value}' },\n },\n _loading: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.font.disabled.value}' },\n },\n info: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.blue.100}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.10.value}' },\n color: { value: '{colors.blue.90.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.10.value}' },\n color: { value: '{colors.blue.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.info._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.blue.20.value}' },\n color: { value: '{colors.blue.100.value}' },\n },\n },\n warning: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.orange.100}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.10.value}' },\n color: { value: '{colors.orange.90.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.10.value}' },\n color: { value: '{colors.orange.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.warning._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.orange.20.value}' },\n color: { value: '{colors.orange.100.value}' },\n },\n },\n success: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.green.100}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.10.value}' },\n color: { value: '{colors.green.90.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.10.value}' },\n color: { value: '{colors.green.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.success._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.green.20.value}' },\n color: { value: '{colors.green.100.value}' },\n },\n },\n error: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.red.100}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.10.value}' },\n color: { value: '{colors.red.90.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.10.value}' },\n color: { value: '{colors.red.100.value}' },\n boxShadow: {\n value: '{components.fieldcontrol._error._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.20.value}' },\n color: { value: '{colors.red.100.value}' },\n },\n },\n overlay: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.neutral.100}' },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.5.value}' },\n color: { value: '{colors.overlay.80.value}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.5.value}' },\n color: { value: '{colors.overlay.90.value}' },\n boxShadow: {\n value: '{components.fieldcontrol.overlay._focus.boxShadow.value}',\n },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.overlay.10.value}' },\n color: { value: '{colors.overlay.90.value}' },\n },\n },\n },\n warning: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.red.60}' },\n borderWidth: { value: '{borderWidths.small}' },\n color: { value: '{colors.red.60}' },\n _hover: {\n borderColor: { value: '{colors.red.80}' },\n backgroundColor: { value: '{colors.red.10}' },\n color: { value: '{colors.font.error}' },\n },\n _focus: {\n borderColor: { value: '{colors.red.80}' },\n backgroundColor: { value: '{colors.red.10}' },\n color: { value: '{colors.red.80}' },\n boxShadow: { value: '{components.fieldcontrol._error._focus.boxShadow}' },\n },\n _active: {\n borderColor: { value: '{colors.red.100}' },\n backgroundColor: { value: '{colors.red.20}' },\n color: { value: '{colors.red.100}' },\n },\n _disabled: {\n borderColor: { value: '{colors.border.tertiary}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.font.disabled}' },\n },\n _loading: {\n borderColor: { value: '{colors.border.tertiary}' },\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.font.disabled}' },\n },\n },\n destructive: {\n borderColor: { value: 'transparent' },\n borderWidth: { value: '{borderWidths.small}' },\n borderStyle: { value: 'solid' },\n backgroundColor: { value: '{colors.red.60}' },\n color: { value: '{colors.font.inverse}' },\n _disabled: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.background.disabled}' },\n color: { value: '{colors.font.disabled}' },\n },\n _loading: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.background.disabled}' },\n color: { value: '{colors.font.disabled}' },\n },\n _hover: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.80}' },\n color: { value: '{colors.font.inverse}' },\n },\n _focus: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.80}' },\n color: { value: '{colors.font.inverse}' },\n boxShadow: { value: '{components.fieldcontrol._error._focus.boxShadow}' },\n },\n _active: {\n borderColor: { value: 'transparent' },\n backgroundColor: { value: '{colors.red.100}' },\n color: { value: '{colors.font.inverse}' },\n },\n },\n // sizes\n small: {\n fontSize: { value: '{components.fieldcontrol.small.fontSize.value}' },\n paddingBlockStart: {\n value: '{components.fieldcontrol.small.paddingBlockStart.value}',\n },\n paddingBlockEnd: {\n value: '{components.fieldcontrol.small.paddingBlockEnd.value}',\n },\n paddingInlineStart: {\n value: '{components.fieldcontrol.small.paddingInlineStart.value}',\n },\n paddingInlineEnd: {\n value: '{components.fieldcontrol.small.paddingInlineEnd.value}',\n },\n },\n large: {\n fontSize: { value: '{components.fieldcontrol.large.fontSize.value}' },\n paddingBlockStart: {\n value: '{components.fieldcontrol.large.paddingBlockStart.value}',\n },\n paddingBlockEnd: {\n value: '{components.fieldcontrol.large.paddingBlockEnd.value}',\n },\n paddingInlineStart: {\n value: '{components.fieldcontrol.large.paddingInlineStart.value}',\n },\n paddingInlineEnd: {\n value: '{components.fieldcontrol.large.paddingInlineEnd.value}',\n },\n },\n loaderWrapper: {\n alignItems: {\n value: 'center',\n },\n gap: {\n value: '{space.xs.value}',\n },\n },\n};\n\nexport { button };\n", "const card = {\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderRadius: { value: '{radii.xs.value}' },\n borderWidth: { value: '0' },\n borderStyle: { value: 'solid' },\n borderColor: { value: 'transparent' },\n boxShadow: { value: 'none' },\n padding: { value: '{space.medium.value}' },\n outlined: {\n backgroundColor: { value: '{components.card.backgroundColor.value}' },\n borderRadius: { value: '{radii.xs.value}' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderStyle: { value: 'solid' },\n borderColor: { value: '{colors.border.primary.value}' },\n boxShadow: { value: '{components.card.boxShadow.value}' },\n },\n elevated: {\n backgroundColor: { value: '{components.card.backgroundColor.value}' },\n borderRadius: { value: '{radii.xs.value}' },\n borderWidth: { value: '0' },\n borderStyle: { value: 'solid' },\n borderColor: { value: 'transparent' },\n boxShadow: { value: '{shadows.medium.value}' },\n },\n};\n\nexport { card };\n", "const checkbox = {\n cursor: { value: 'pointer' },\n alignItems: { value: 'center' },\n _disabled: {\n cursor: {\n value: 'not-allowed',\n },\n },\n button: {\n position: { value: 'relative' },\n alignItems: { value: 'center' },\n justifyContent: { value: 'center' },\n color: { value: '{colors.font.inverse.value}' },\n before: {\n width: { value: '100%' },\n height: { value: '100%' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n borderRadius: { value: '20%' },\n borderStyle: { value: 'solid' },\n borderColor: { value: '{colors.border.primary.value}' },\n },\n _focus: {\n outlineColor: { value: '{colors.transparent.value}' },\n outlineStyle: { value: 'solid' },\n outlineWidth: { value: '{outlineWidths.medium.value}' },\n outlineOffset: { value: '{outlineOffsets.medium.value}' },\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n },\n _disabled: {\n borderColor: { value: '{colors.border.disabled.value}' },\n },\n _error: {\n borderColor: { value: '{colors.border.error.value}' },\n _focus: {\n borderColor: { value: '{colors.border.error.value}' },\n boxShadow: {\n value: '{components.fieldcontrol._error._focus.boxShadow.value}',\n },\n },\n },\n },\n icon: {\n backgroundColor: { value: '{colors.primary.80.value}' },\n borderRadius: { value: '20%' },\n opacity: { value: '{opacities.0.value}' },\n transform: { value: 'scale(0)' },\n transitionProperty: { value: 'all' },\n transitionDuration: { value: '{time.short.value}' },\n transitionTimingFunction: { value: 'ease-in-out' },\n _checked: {\n opacity: { value: '{opacities.100.value}' },\n transform: { value: 'scale(1)' },\n _disabled: {\n backgroundColor: { value: '{colors.background.disabled.value}' },\n },\n },\n _indeterminate: {\n opacity: { value: '{opacities.100.value}' },\n transform: { value: 'scale(1)' },\n _disabled: {\n backgroundColor: { value: '{colors.background.disabled.value}' },\n },\n },\n },\n label: {\n color: { value: '{components.text.color.value}' },\n _disabled: {\n color: {\n value: '{colors.font.disabled.value}',\n },\n },\n },\n};\n\nexport { checkbox };\n", "const checkboxfield = {\n alignItems: { value: 'flex-start' },\n alignContent: { value: 'center' },\n flexDirection: { value: 'column' },\n justifyContent: { value: 'center' },\n};\n\nexport { checkboxfield };\n", "//we are reusing the types from the nested components but new tokens need to be created that reference the previous tokens so that they can inherit the needed values but can be overwritten and only effect the collection component.\n//only a subset of the design tokens of the nested components are being exposed, this can be expanded later.\nconst collection = {\n pagination: {\n current: {\n color: { value: '{components.pagination.current.color}' },\n backgroundColor: {\n value: '{components.pagination.current.backgroundColor}',\n },\n },\n button: {\n color: { value: '{components.pagination.button.color}' },\n _hover: {\n backgroundColor: {\n value: '{components.pagination.button.hover.backgroundColor}',\n },\n color: { value: '{components.pagination.button.hover.color}' },\n },\n _disabled: {\n color: { value: '{components.pagination.button.disabled.color}' },\n },\n },\n },\n search: {\n input: {\n color: { value: '{components.searchfield.color}' },\n },\n button: {\n color: { value: '{components.searchfield.button.color}' },\n _active: {\n backgroundColor: {\n value: '{components.searchfield.button._active.backgroundColor}',\n },\n borderColor: {\n value: '{components.searchfield.button._active.borderColor}',\n },\n color: { value: '{components.searchfield.button._active.color}' },\n },\n _disabled: {\n backgroundColor: {\n value: '{components.searchfield.button._disabled.backgroundColor}',\n },\n borderColor: {\n value: '{components.searchfield.button._disabled.borderColor}',\n },\n color: {\n value: '{components.searchfield.button._disabled.color}',\n },\n },\n _focus: {\n backgroundColor: {\n value: '{components.searchfield.button._focus.backgroundColor}',\n },\n borderColor: {\n value: '{components.searchfield.button._focus.borderColor}',\n },\n color: { value: '{components.searchfield.button._focus.color}' },\n },\n _hover: {\n backgroundColor: {\n value: '{components.searchfield.button._hover.backgroundColor}',\n },\n borderColor: {\n value: '{components.searchfield.button._hover.borderColor}',\n },\n color: { value: '{components.searchfield.button._hover.color}' },\n },\n },\n },\n};\n\nexport { collection };\n", "const copy = {\n fontSize: { value: '{fontSizes.xs}' },\n gap: { value: '{space.relative.medium}' },\n svg: {\n path: {\n fill: {\n value: '{colors.font.primary}',\n },\n },\n },\n toolTip: {\n bottom: { value: '{space.large}' },\n color: { value: '{colors.teal.100}' },\n fontSize: { value: '{fontSizes.xxs}' },\n },\n};\n\nexport { copy };\n", "const dialcodeselect = {\n height: {\n value: '{space.relative.full.value}',\n },\n};\n\nexport { dialcodeselect };\n", "const divider = {\n borderStyle: { value: 'solid' },\n borderColor: { value: '{colors.border.primary.value}' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n label: {\n color: { value: '{colors.font.tertiary.value}' },\n paddingInline: { value: '{space.medium.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n },\n small: {\n borderWidth: { value: '{borderWidths.small.value}' },\n },\n large: {\n borderWidth: { value: '{borderWidths.large.value}' },\n },\n opacity: {\n value: '{opacities.60.value}',\n },\n};\n\nexport { divider };\n", "const dropzone = {\n backgroundColor: { value: '{colors.background.primary}' },\n borderRadius: { value: '{radii.small}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'dashed' },\n borderWidth: { value: '{borderWidths.small}' },\n color: { value: '{colors.font.primary}' },\n gap: { value: '{space.small}' },\n paddingBlock: { value: '{space.xl}' },\n paddingInline: { value: '{space.large}' },\n textAlign: { value: 'center' },\n _active: {\n backgroundColor: { value: '{colors.primary.10}' },\n borderRadius: { value: '{components.dropzone.borderRadius}' },\n borderColor: { value: '{colors.border.pressed}' },\n borderStyle: { value: '{components.dropzone.borderStyle}' },\n borderWidth: { value: '{components.dropzone.borderWidth}' },\n color: { value: '{colors.font.primary}' },\n },\n _disabled: {\n backgroundColor: { value: '{colors.background.disabled}' },\n borderRadius: { value: '{components.dropzone.borderRadius}' },\n borderColor: { value: '{colors.border.disabled}' },\n borderStyle: { value: '{components.dropzone.borderStyle}' },\n borderWidth: { value: '{components.dropzone.borderWidth}' },\n color: { value: '{colors.font.disabled}' },\n },\n accepted: {\n backgroundColor: { value: '{colors.background.success}' },\n borderRadius: { value: '{components.dropzone.borderRadius}' },\n borderColor: { value: '{colors.border.success}' },\n borderStyle: { value: '{components.dropzone.borderStyle}' },\n borderWidth: { value: '{components.dropzone.borderWidth}' },\n color: { value: '{colors.font.success}' },\n },\n rejected: {\n backgroundColor: { value: '{colors.background.error}' },\n borderRadius: { value: '{components.dropzone.borderRadius}' },\n borderColor: { value: '{colors.border.pressed}' },\n borderStyle: { value: '{components.dropzone.borderStyle}' },\n borderWidth: { value: '{components.dropzone.borderWidth}' },\n color: { value: '{colors.font.error}' },\n },\n};\n\nexport { dropzone };\n", "const accordion = {\n backgroundColor: { value: '{colors.background.primary.value}' },\n item: {\n borderColor: { value: '{colors.border.secondary.value}' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderStyle: { value: 'solid' },\n borderRadius: { value: '{radii.small.value}' },\n trigger: {\n alignItems: { value: 'center' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n color: { value: 'inherit' },\n gap: { value: '{space.small.value}' },\n justifyContent: { value: 'space-between' },\n paddingBlock: { value: '{space.xs.value}' },\n paddingInline: { value: '{space.small.value}' },\n _hover: {\n color: { value: 'inherit' },\n backgroundColor: { value: '{colors.overlay.5.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: {\n value: {\n offsetX: '0',\n offsetY: '0',\n blurRadius: '0',\n spreadRadius: '2px',\n color: '{colors.border.focus.value}',\n },\n },\n },\n },\n content: {\n color: { value: 'inherit' },\n paddingInline: { value: '{space.small.value}' },\n paddingBlockEnd: { value: '{space.small.value}' },\n paddingBlockStart: { value: '{space.xxxs.value}' },\n },\n icon: {\n color: { value: '{colors.font.tertiary.value}' },\n transitionDuration: { value: '{time.medium.value}' },\n transitionTimingFunction: { value: 'cubic-bezier(0.87, 0, 0.13, 1)' },\n },\n },\n};\n\nexport { accordion };\n", "const field = {\n // default styles\n gap: { value: '{space.xs.value}' },\n fontSize: { value: '{fontSizes.medium.value}' },\n flexDirection: { value: 'column' },\n // Adjust base fontSize and gap for small and large sizes\n small: {\n gap: { value: '{space.xxxs.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n },\n large: {\n gap: { value: '{space.small.value}' },\n fontSize: { value: '{fontSizes.large.value}' },\n },\n label: {\n color: { value: '{colors.font.secondary.value}' },\n },\n};\n\nexport { field };\n", "const fieldcontrol = {\n borderStyle: { value: 'solid' },\n borderColor: { value: '{colors.border.primary.value}' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderRadius: { value: '{radii.small.value}' },\n color: { value: '{colors.font.primary.value}' },\n paddingBlockStart: {\n value: '{space.xs.value}',\n },\n paddingBlockEnd: {\n value: '{space.xs.value}',\n },\n paddingInlineStart: {\n value: '{space.medium.value}',\n },\n paddingInlineEnd: {\n value: '{space.medium.value}',\n },\n fontSize: { value: '{components.field.fontSize.value}' },\n lineHeight: { value: '{lineHeights.medium.value}' },\n transitionDuration: { value: '{time.medium.value}' },\n outlineColor: { value: '{colors.transparent.value}' },\n outlineStyle: { value: 'solid' },\n outlineWidth: { value: '{outlineWidths.medium.value}' },\n outlineOffset: { value: '{outlineOffsets.medium.value}' },\n small: {\n fontSize: { value: '{components.field.small.fontSize.value}' },\n paddingBlockStart: {\n value: '{space.xxs.value}',\n },\n paddingBlockEnd: {\n value: '{space.xxs.value}',\n },\n paddingInlineStart: {\n value: '{space.small.value}',\n },\n paddingInlineEnd: {\n value: '{space.small.value}',\n },\n },\n large: {\n fontSize: { value: '{components.field.large.fontSize.value}' },\n paddingBlockStart: {\n value: '{space.xs.value}',\n },\n paddingBlockEnd: {\n value: '{space.xs.value}',\n },\n paddingInlineStart: {\n value: '{space.medium.value}',\n },\n paddingInlineEnd: {\n value: '{space.medium.value}',\n },\n },\n quiet: {\n borderStyle: { value: 'none' },\n borderInlineStart: { value: 'none' },\n borderInlineEnd: { value: 'none' },\n borderBlockStart: { value: 'none' },\n borderRadius: { value: '0' },\n _focus: {\n borderBlockEndColor: { value: 'transparent' },\n boxShadow: {\n value: '{components.fieldcontrol._focus.boxShadow.value}',\n },\n },\n _error: {\n borderBlockEndColor: { value: '{colors.border.error.value}' },\n _focus: {\n borderBlockEndColor: { value: 'transparent' },\n boxShadow: {\n value: '{components.fieldcontrol._error._focus.boxShadow.value}',\n },\n },\n },\n },\n _focus: {\n // These focus styles have been calibrated to create\n // a highly visible focus indicator per WCAG 2.2 guidlines:\n // See: https://www.w3.org/TR/WCAG22/#focus-appearance\n //\n // Key features:\n // * Focus indicator area is at least the 2 CSS px perimeter around the component.\n // * Contrast between focused and unfocused area of contrast has a ratio of 3:1\n //\n // IMPORTANT: Must recalibrate if `colors.border.focus` are changed\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '2px',\n color: '{colors.border.focus.value}',\n },\n },\n },\n _disabled: {\n color: { value: '{colors.font.disabled.value}' },\n cursor: { value: 'not-allowed' },\n borderColor: { value: '{colors.transparent.value}' },\n backgroundColor: { value: '{colors.background.disabled.value}' },\n },\n _error: {\n borderColor: { value: '{colors.border.error.value}' },\n color: { value: '{colors.font.error.value}' },\n _focus: {\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '2px',\n color: '{colors.border.error.value}',\n },\n },\n },\n },\n info: {\n _focus: {\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '2px',\n color: '{colors.blue.100.value}',\n },\n },\n },\n },\n warning: {\n _focus: {\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '2px',\n color: '{colors.orange.100.value}',\n },\n },\n },\n },\n success: {\n _focus: {\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '2px',\n color: '{colors.green.100.value}',\n },\n },\n },\n },\n overlay: {\n _focus: {\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '2px',\n color: '{colors.overlay.90.value}',\n },\n },\n },\n },\n};\n\nexport { fieldcontrol };\n", "const fieldgroup = {\n gap: { value: '{space.zero.value}' },\n vertical: {\n alignItems: { value: 'center' },\n },\n outer: {\n alignItems: { value: 'center' },\n },\n};\n\nexport { fieldgroup };\n", "const fieldset = {\n backgroundColor: { value: 'transparent' },\n borderRadius: { value: '{radii.xs.value}' },\n flexDirection: {\n value: 'column',\n },\n gap: { value: '{components.field.gap.value}' },\n legend: {\n color: { value: '{colors.font.primary.value}' },\n fontSize: { value: '{components.field.fontSize.value}' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n lineHeight: { value: '{lineHeights.medium.value}' },\n small: {\n fontSize: '{components.field.small.fontSize.value}',\n },\n large: {\n fontSize: '{components.field.large.fontSize.value}',\n },\n },\n outlined: {\n padding: '{space.medium.value}',\n borderColor: '{colors.neutral.40.value}',\n borderWidth: '{borderWidths.small.value}',\n borderStyle: 'solid',\n small: {\n padding: '{space.small.value}',\n },\n large: {\n padding: '{space.large.value}',\n },\n },\n small: {\n gap: '{components.field.small.gap.value}',\n },\n large: {\n gap: '{components.field.large.gap.value}',\n },\n};\n\nexport { fieldset };\n", "const fieldmessages = {\n error: {\n color: { value: '{colors.font.error.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n },\n description: {\n color: { value: '{colors.font.secondary.value}' },\n fontStyle: { value: 'italic' },\n fontSize: { value: '{fontSizes.small.value}' },\n },\n};\n\nexport { fieldmessages };\n", "const fileuploader = {\n dropzone: {\n backgroundColor: { value: '{colors.background.primary}' },\n borderRadius: { value: '{radii.small}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'dashed' },\n borderWidth: { value: '{borderWidths.small}' },\n gap: { value: '{space.small}' },\n paddingBlock: { value: '{space.xl}' },\n paddingInline: { value: '{space.large}' },\n textAlign: { value: 'center' },\n _active: {\n backgroundColor: { value: '{colors.primary.10}' },\n borderRadius: {\n value: '{components.fileuploader.dropzone.borderRadius}',\n },\n borderColor: { value: '{colors.border.pressed}' },\n borderStyle: {\n value: '{components.fileuploader.dropzone.borderStyle}',\n },\n borderWidth: { value: '{borderWidths.medium}' },\n },\n icon: {\n color: { value: '{colors.border.primary}' },\n fontSize: { value: '{fontSizes.xxl}' },\n },\n text: {\n color: { value: '{colors.font.tertiary}' },\n fontSize: { value: '{fontSizes.medium}' },\n fontWeight: { value: '{fontWeights.bold}' },\n },\n },\n file: {\n backgroundColor: { value: '{colors.background.primary}' },\n borderRadius: { value: '{radii.small}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small}' },\n paddingBlock: { value: '{space.xs}' },\n paddingInline: { value: '{space.small}' },\n gap: { value: '{space.small}' },\n alignItems: { value: 'baseline' },\n name: {\n fontSize: { value: '{fontSizes.medium}' },\n fontWeight: { value: '{fontWeights.bold}' },\n color: { value: '{colors.font.primary}' },\n },\n size: {\n fontSize: { value: '{fontSizes.small}' },\n fontWeight: { value: '{fontWeights.normal}' },\n color: { value: '{colors.font.tertiary}' },\n },\n image: {\n width: { value: '{space.xxl}' },\n height: { value: '{space.xxl}' },\n backgroundColor: { value: '{colors.background.secondary}' },\n color: { value: '{colors.font.tertiary}' },\n borderRadius: { value: '{radii.small}' },\n },\n },\n filelist: {\n flexDirection: { value: 'column' },\n gap: { value: '{space.small}' },\n },\n loader: {\n strokeLinecap: { value: 'round' },\n strokeEmpty: { value: '{colors.border.secondary}' },\n strokeFilled: { value: '{components.loader.strokeFilled}' },\n strokeWidth: { value: '{borderWidths.large}' },\n },\n previewer: {\n backgroundColor: { value: '{colors.background.primary}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small}' },\n borderRadius: { value: '{radii.small}' },\n paddingBlock: { value: '{space.zero}' },\n paddingInline: { value: '{space.zero}' },\n maxHeight: { value: '40rem' },\n maxWidth: { value: 'auto' },\n text: {\n fontSize: { value: '{fontSizes.medium}' },\n fontWeight: { value: '{fontWeights.bold}' },\n color: { value: '{colors.font.primary}' },\n },\n body: {\n paddingBlock: { value: '{space.medium}' },\n paddingInline: { value: '{space.medium}' },\n gap: { value: '{space.small}' },\n },\n footer: {\n justifyContent: { value: 'flex-end' },\n },\n },\n};\n\nexport { fileuploader };\n", "const flex = {\n gap: { value: '{space.medium.value}' },\n justifyContent: { value: 'normal' },\n alignItems: { value: 'stretch' },\n alignContent: { value: 'normal' },\n flexWrap: { value: 'nowrap' },\n};\n\nexport { flex };\n", "const heading = {\n color: { value: '{colors.font.primary.value}' },\n lineHeight: { value: '{lineHeights.small.value}' },\n 1: {\n fontSize: { value: '{fontSizes.xxxxl.value}' },\n fontWeight: { value: '{fontWeights.light.value}' },\n },\n 2: {\n fontSize: { value: '{fontSizes.xxxl.value}' },\n fontWeight: { value: '{fontWeights.normal.value}' },\n },\n 3: {\n fontSize: { value: '{fontSizes.xxl.value}' },\n fontWeight: { value: '{fontWeights.medium.value}' },\n },\n 4: {\n fontSize: { value: '{fontSizes.xl.value}' },\n fontWeight: { value: '{fontWeights.semibold.value}' },\n },\n 5: {\n fontSize: { value: '{fontSizes.large.value}' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n },\n 6: {\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.extrabold.value}' },\n },\n};\n\nexport { heading };\n", "const highlightmatch = {\n highlighted: {\n fontWeight: { value: '{fontWeights.bold}' },\n },\n};\n\nexport { highlightmatch };\n", "const icon = {\n lineHeight: { value: 1 },\n height: { value: '1em' }, // Should match height of parent container font-size\n};\n\nexport { icon };\n", "const input = {\n color: { value: '{components.fieldcontrol.color.value}' },\n borderColor: { value: '{components.fieldcontrol.borderColor.value}' },\n fontSize: { value: '{components.fieldcontrol.fontSize.value}' },\n _focus: {\n borderColor: {\n value: '{components.fieldcontrol._focus.borderColor.value}',\n },\n },\n};\n\nexport { input };\n", "const image = {\n maxWidth: { value: '100%' },\n height: { value: 'auto' },\n objectFit: { value: 'initial' },\n objectPosition: { value: 'initial' },\n};\n\nexport { image };\n", "const inappmessaging = {\n banner: {\n height: { value: '150px ' },\n width: { value: '400px ' },\n },\n button: {\n backgroundColor: { value: '#e8e8e8' },\n borderRadius: { value: '5px' },\n color: { value: 'black' },\n },\n dialog: {\n height: { value: '50vh' },\n minHeight: { value: '400px' },\n minWidth: { value: '400px' },\n width: { value: '30vw' },\n },\n header: {\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.extrabold.value}' },\n },\n};\n\nexport { inappmessaging };\n", "const link = {\n active: { color: { value: '{colors.font.active.value}' } },\n color: { value: '{colors.font.interactive.value}' },\n focus: { color: { value: '{colors.font.focus.value}' } },\n hover: { color: { value: '{colors.font.hover.value}' } },\n visited: { color: { value: '{colors.font.interactive.value}' } },\n};\n\nexport { link };\n", "const liveness = {\n cameraModule: {\n backgroundColor: { value: '{colors.background.primary.value}' },\n },\n};\n\nexport { liveness };\n", "const loader = {\n width: { value: '{fontSizes.medium.value}' },\n height: { value: '{fontSizes.medium.value}' },\n fontSize: { value: '{fontSizes.xs.value}' },\n strokeEmpty: { value: '{colors.neutral.20.value}' },\n strokeFilled: { value: '{colors.primary.80.value}' },\n strokeLinecap: { value: 'round' },\n animationDuration: { value: '1s' },\n small: {\n width: { value: '{fontSizes.small.value}' },\n height: { value: '{fontSizes.small.value}' },\n fontSize: { value: '{fontSizes.xxs.value}' },\n },\n large: {\n width: { value: '{fontSizes.large.value}' },\n height: { value: '{fontSizes.large.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n },\n linear: {\n width: { value: '100%' },\n minWidth: { value: '5rem' },\n fontSize: { value: '{fontSizes.xxs.value}' },\n strokeWidth: { value: '{fontSizes.xxs.value}' },\n strokeFilled: { value: '{colors.primary.80.value}' },\n strokeEmpty: { value: '{colors.neutral.20.value}' },\n strokeLinecap: { value: 'round' },\n animationDuration: { value: '1s' },\n small: {\n strokeWidth: { value: '{fontSizes.xxxs.value}' },\n fontSize: { value: '{fontSizes.xxxs.value}' },\n },\n large: {\n strokeWidth: { value: '{fontSizes.xs.value}' },\n fontSize: { value: '{fontSizes.xs.value}' },\n },\n },\n text: {\n fill: { value: '{colors.font.primary.value}' },\n },\n};\n\nexport { loader };\n", "const menu = {\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderRadius: { value: '{radii.medium.value}' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderStyle: { value: 'solid' },\n borderColor: { value: '{colors.border.primary.value}' },\n boxShadow: { value: '{shadows.large.value}' },\n flexDirection: { value: 'column' },\n gap: { value: '{space.zero.value}' },\n maxWidth: { value: '30rem' },\n minWidth: { value: '14rem' },\n small: {\n width: { value: '{fontSizes.medium.value}' },\n height: { value: '{fontSizes.medium.value}' },\n },\n large: {\n width: { value: '{fontSizes.xxxl.value}' },\n height: { value: '{fontSizes.xxxl.value}' },\n },\n item: {\n minHeight: { value: '2.5rem' },\n paddingInlineStart: { value: '{space.medium.value}' },\n paddingInlineEnd: { value: '{space.medium.value}' },\n },\n};\n\nexport { menu };\n", "const message = {\n // Default styles\n alignItems: { value: 'center' },\n backgroundColor: { value: '{colors.background.tertiary.value}' },\n borderColor: { value: 'transparent' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderRadius: { value: '{radii.xs.value}' },\n color: { value: '{colors.font.primary.value}' },\n justifyContent: { value: 'flex-start' },\n paddingBlock: { value: '{space.small.value}' },\n paddingInline: { value: '{space.medium.value}' },\n lineHeight: { value: '{lineHeights.small.value}' },\n icon: {\n size: { value: '{fontSizes.xl.value}' },\n },\n heading: {\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n },\n dismiss: {\n gap: { value: '{space.xxs.value}' },\n },\n // Variations\n plain: {\n color: { value: '{colors.font.primary.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: 'transparent' },\n info: {\n color: { value: '{colors.font.info.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: 'transparent' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: 'transparent' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: 'transparent' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: 'transparent' },\n },\n },\n outlined: {\n color: { value: '{colors.font.primary.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: '{colors.border.primary.value}' },\n info: {\n color: { value: '{colors.font.info.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: '{colors.border.info.value}' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: '{colors.border.error.value}' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: '{colors.border.success.value}' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: '{colors.border.warning.value}' },\n },\n },\n filled: {\n color: { value: '{colors.font.primary.value}' },\n backgroundColor: { value: '{colors.background.secondary.value}' },\n borderColor: { value: 'transparent' },\n info: {\n color: { value: '{colors.font.info.value}' },\n backgroundColor: { value: '{colors.background.info.value}' },\n borderColor: { value: 'transparent' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n backgroundColor: { value: '{colors.background.error.value}' },\n borderColor: { value: 'transparent' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n backgroundColor: { value: '{colors.background.success.value}' },\n borderColor: { value: 'transparent' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n backgroundColor: { value: '{colors.background.warning.value}' },\n borderColor: { value: 'transparent' },\n },\n },\n};\n\nexport { message };\n", "const pagination = {\n current: {\n alignItems: { value: 'center' },\n justifyContent: { value: 'center' },\n color: { value: '{colors.font.inverse.value}' },\n fontSize: { value: '{fontSizes.small.value}' },\n backgroundColor: { value: '{colors.overlay.40.value}' },\n },\n button: {\n color: { value: '{colors.font.primary.value}' },\n paddingInlineStart: { value: '{space.xxs.value}' },\n paddingInlineEnd: { value: '{space.xxs.value}' },\n transitionProperty: { value: 'background-color' },\n transitionDuration: { value: '{time.medium.value}' },\n hover: {\n backgroundColor: { value: '{colors.overlay.10.value}' },\n color: { value: '{colors.font.primary.value}' },\n },\n disabled: {\n color: { value: '{colors.font.disabled.value}' },\n },\n },\n ellipsis: {\n alignItems: { value: 'baseline' },\n justifyContent: { value: 'center' },\n paddingInlineStart: { value: '{space.xs.value}' },\n paddingInlineEnd: { value: '{space.xs.value}' },\n },\n itemContainer: {\n marginLeft: { value: '{space.xxxs.value}' },\n marginRight: { value: '{space.xxxs.value}' },\n },\n itemShared: {\n height: { value: '{fontSizes.xxl.value}' },\n minWidth: { value: '{fontSizes.xxl.value}' },\n borderRadius: { value: '{fontSizes.medium.value}' },\n },\n};\n\nexport { pagination };\n", "const passwordfield = {\n color: { value: '{components.fieldcontrol.color.value}' },\n button: {\n color: { value: '{components.button.color.value}' },\n _active: {\n backgroundColor: {\n value: '{components.button._active.backgroundColor.value}',\n },\n borderColor: { value: '{components.button._active.borderColor.value}' },\n color: { value: '{components.button._active.color.value}' },\n },\n _disabled: {\n backgroundColor: {\n value: '{components.button._disabled.backgroundColor.value}',\n },\n borderColor: {\n value: '{components.button._disabled.borderColor.value}',\n },\n color: { value: '{components.button._disabled.color.value}' },\n },\n _error: {\n color: { value: '{components.button.outlined.error.color.value}' },\n backgroundColor: {\n value: '{components.button.outlined.error.backgroundColor.value}',\n },\n borderColor: {\n value: '{components.button.outlined.error.borderColor.value}',\n },\n _active: {\n borderColor: {\n value: '{components.button.outlined.error._active.borderColor.value}',\n },\n backgroundColor: {\n value: '{components.button.outlined.error._active.backgroundColor.value}',\n },\n color: {\n value: '{components.button.outlined.error._active.color.value}',\n },\n },\n _focus: {\n borderColor: {\n value: '{components.button.outlined.error._focus.borderColor.value}',\n },\n backgroundColor: {\n value: '{components.button.outlined.error._focus.backgroundColor.value}',\n },\n color: {\n value: '{components.button.outlined.error._focus.color.value}',\n },\n boxShadow: {\n value: '{components.button.outlined.error._focus.boxShadow.value}',\n },\n },\n _hover: {\n borderColor: {\n value: '{components.button.outlined.error._hover.borderColor.value}',\n },\n backgroundColor: {\n value: '{components.button.outlined.error._hover.backgroundColor.value}',\n },\n color: {\n value: '{components.button.outlined.error._hover.color.value}',\n },\n },\n },\n _focus: {\n backgroundColor: {\n value: '{components.button._focus.backgroundColor.value}',\n },\n borderColor: { value: '{components.button._focus.borderColor.value}' },\n color: { value: '{components.button._focus.color.value}' },\n },\n _hover: {\n backgroundColor: {\n value: '{components.button._hover.backgroundColor.value}',\n },\n borderColor: { value: '{components.button._hover.borderColor.value}' },\n color: { value: '{components.button._hover.color.value}' },\n },\n },\n};\n\nexport { passwordfield };\n", "const phonenumberfield = {\n color: { value: '{components.fieldcontrol.color}' },\n borderColor: { value: '{components.fieldcontrol.borderColor}' },\n fontSize: { value: '{components.fieldcontrol.fontSize}' },\n _focus: {\n borderColor: { value: '{components.fieldcontrol._focus.borderColor}' },\n },\n};\n\nexport { phonenumberfield };\n", "const placeholder = {\n borderRadius: { value: '{radii.small.value}' },\n transitionDuration: { value: '{time.long.value}' },\n startColor: { value: '{colors.background.secondary.value}' },\n endColor: { value: '{colors.background.tertiary.value}' },\n // sizes\n small: {\n height: { value: '{space.small.value}' },\n },\n default: {\n height: { value: '{space.medium.value}' },\n },\n large: {\n height: { value: '{space.large.value}' },\n },\n};\n\nexport { placeholder };\n", "const radio = {\n alignItems: { value: 'center' },\n justifyContent: { value: 'flex-start' },\n gap: { value: 'inherit' },\n _disabled: { cursor: { value: 'not-allowed' } },\n button: {\n alignItems: { value: 'center' },\n justifyContent: { value: 'center' },\n width: { value: '{fontSizes.medium.value}' },\n height: { value: '{fontSizes.medium.value}' },\n boxSizing: { value: 'border-box' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n borderStyle: { value: 'solid' },\n borderRadius: { value: '50%' },\n borderColor: { value: '{colors.border.primary.value}' },\n color: { value: '{colors.background.primary.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n transitionProperty: { value: 'all' },\n transitionDuration: { value: '{time.medium.value}' },\n outlineColor: { value: '{colors.transparent.value}' },\n outlineStyle: { value: 'solid' },\n outlineWidth: { value: '{outlineWidths.medium.value}' },\n outlineOffset: { value: '{outlineOffsets.medium.value}' },\n // We want the dot inside the border to be a border-width from the border\n padding: { value: '{borderWidths.medium.value}' },\n small: {\n width: { value: '{fontSizes.small.value}' },\n height: { value: '{fontSizes.small.value}' },\n },\n large: {\n width: { value: '{fontSizes.large.value}' },\n height: { value: '{fontSizes.large.value}' },\n },\n _checked: {\n color: {\n value: '{colors.primary.80.value}',\n },\n _disabled: { color: { value: '{colors.background.disabled.value}' } },\n },\n _focus: {\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n },\n _error: {\n borderColor: { value: '{colors.border.error.value}' },\n _focus: {\n boxShadow: {\n value: '{components.fieldcontrol._error._focus.boxShadow.value}',\n },\n },\n },\n _disabled: {\n borderColor: { value: '{colors.border.disabled.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n },\n },\n label: {\n color: { value: '{components.text.color.value}' },\n _disabled: {\n color: {\n value: '{colors.font.disabled.value}',\n },\n },\n },\n};\n\nexport { radio };\n", "const radiogroup = {\n radio: {\n borderWidth: { value: '{components.radio.button.borderWidth}' },\n borderColor: { value: '{components.radio.button.borderColor}' },\n backgroundColor: { value: '{components.radio.button.backgroundColor}' },\n _checked: {\n color: { value: '{components.radio.button._checked.color}' },\n },\n label: {\n color: { value: '{components.radio.label.color}' },\n },\n },\n legend: {\n color: { value: '{components.fieldset.legend.color}' },\n fontWeight: { value: '{fontWeights.normal}' },\n },\n};\n\nexport { radiogroup };\n", "const rating = {\n large: { size: { value: '{fontSizes.xxxl.value}' } },\n default: { size: { value: '{fontSizes.xl.value}' } },\n small: { size: { value: '{fontSizes.small.value}' } },\n filled: { color: { value: '{colors.secondary.80.value}' } },\n empty: { color: { value: '{colors.background.tertiary.value}' } },\n};\n\nexport { rating };\n", "const searchfield = {\n color: { value: '{components.fieldcontrol.color.value}' },\n button: {\n color: { value: '{components.button.color.value}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n _active: {\n backgroundColor: {\n value: '{components.button._active.backgroundColor.value}',\n },\n borderColor: { value: '{components.button._active.borderColor.value}' },\n color: { value: '{components.button._active.color.value}' },\n },\n _disabled: {\n backgroundColor: {\n value: '{components.button._disabled.backgroundColor.value}',\n },\n borderColor: {\n value: '{components.button._disabled.borderColor.value}',\n },\n color: { value: '{components.button._disabled.color.value}' },\n },\n _focus: {\n backgroundColor: {\n value: '{components.button._focus.backgroundColor.value}',\n },\n borderColor: { value: '{components.button._focus.borderColor.value}' },\n color: { value: '{components.button._focus.color.value}' },\n },\n _hover: {\n backgroundColor: {\n value: '{components.button._hover.backgroundColor.value}',\n },\n borderColor: { value: '{components.button._hover.borderColor.value}' },\n color: { value: '{components.button._hover.color.value}' },\n },\n },\n};\n\nexport { searchfield };\n", "const select = {\n color: { value: '{components.fieldcontrol.color}' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n paddingInlineEnd: { value: '{space.xxl.value}' },\n _disabled: {\n color: { value: '{colors.font.disabled.value}' },\n backgroundColor: { value: '{colors.background.disabled.value}' },\n },\n // wrappers\n wrapper: {\n flex: { value: '1' },\n display: { value: 'block' },\n position: { value: 'relative' },\n cursor: { value: 'pointer' },\n },\n iconWrapper: {\n alignItems: { value: 'center' },\n position: { value: 'absolute' },\n top: { value: '50%' },\n right: { value: '{space.medium.value}' },\n transform: { value: 'translateY(-50%)' },\n pointerEvents: { value: 'none' },\n small: {\n right: { value: '{space.xs.value}' },\n },\n large: {\n right: { value: '{space.medium.value}' },\n },\n },\n // It's important to test these option values on Chrome/FireFox/Edge\n // on Windows because they allow styling of the option element.\n // Chrome/Safari/Firefox on Mac uses the system ui.\n option: {\n backgroundColor: { value: 'transparent' },\n color: { value: '{colors.font.primary.value}' },\n _disabled: {\n color: { value: '{colors.font.disabled.value}' },\n backgroundColor: {\n value: 'transparent',\n },\n },\n },\n whiteSpace: { value: 'nowrap' },\n minWidth: { value: '6.5rem' },\n small: {\n minWidth: { value: '5.5rem' },\n paddingInlineEnd: { value: '{space.xl.value}' },\n },\n large: {\n minWidth: { value: '7.5rem' },\n paddingInlineEnd: { value: '{space.xxl.value}' },\n },\n expanded: {\n paddingBlock: { value: '{space.xs.value}' },\n paddingInline: { value: '{space.small.value}' },\n option: {\n paddingBlock: { value: '{space.xs.value}' },\n paddingInline: { value: '{space.small.value}' },\n },\n },\n};\n\nexport { select };\n", "const selectfield = {\n borderColor: { value: '{components.fieldcontrol.borderColor}' },\n color: { value: '{components.fieldcontrol.color}' },\n flexDirection: {\n value: 'column',\n },\n fontSize: { value: '{components.fieldcontrol.fontSize}' },\n _focus: {\n borderColor: { value: '{components.fieldcontrol._focus.borderColor}' },\n },\n label: {\n color: { value: '{components.field.label.color}' },\n },\n};\n\nexport { selectfield };\n", "const sliderfield = {\n paddingBlock: { value: '{space.xs.value}' },\n // The track is the thin background of the slider\n track: {\n backgroundColor: { value: '{colors.background.quaternary.value}' },\n borderRadius: { value: '9999px' },\n height: { value: '0.375rem' },\n minWidth: { value: '10rem' },\n },\n // The range is the filled part of the track\n range: {\n backgroundColor: { value: '{colors.primary.80.value}' },\n borderRadius: { value: '9999px' },\n _disabled: {\n backgroundColor: { value: '{colors.background.disabled.value}' },\n },\n },\n // The thumb is the circle above the track that the user drags\n thumb: {\n width: { value: '1.25rem' },\n height: { value: '1.25rem' },\n backgroundColor: { value: '{colors.background.primary.value}' },\n boxShadow: { value: '{shadows.small.value}' },\n borderRadius: { value: '50%' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n borderColor: { value: '{colors.border.primary.value}' },\n borderStyle: { value: 'solid' },\n _disabled: {\n backgroundColor: { value: '{colors.background.disabled.value}' },\n borderColor: { value: 'transparent' },\n boxShadow: { value: 'none' },\n },\n _hover: {\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: '{colors.border.focus.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n },\n },\n small: {\n track: {\n height: { value: '0.25rem' },\n },\n thumb: {\n width: { value: '1rem' },\n height: { value: '1rem' },\n },\n },\n large: {\n track: {\n height: { value: '0.625rem' },\n },\n thumb: {\n width: { value: '1.5rem' },\n height: { value: '1.5rem' },\n },\n },\n};\n\nexport { sliderfield };\n", "const stepperfield = {\n borderColor: { value: '{components.fieldcontrol.borderColor}' },\n flexDirection: { value: 'column' },\n input: {\n color: { value: '{components.fieldcontrol.color}' },\n fontSize: { value: '{components.fieldcontrol.fontSize}' },\n textAlign: { value: 'center' },\n },\n button: {\n color: { value: '{components.button.color}' },\n backgroundColor: { value: '{colors.transparent}' },\n _active: {\n color: { value: '{components.button._active.color}' },\n backgroundColor: { value: '{components.button._active.backgroundColor}' },\n },\n _focus: {\n color: { value: '{components.button._focus.color}' },\n backgroundColor: { value: '{components.button._focus.backgroundColor}' },\n },\n _disabled: {\n color: { value: '{components.button._disabled.color}' },\n backgroundColor: {\n value: '{components.fieldcontrol._disabled.backgroundColor}',\n },\n },\n _hover: {\n color: { value: '{components.button._hover.color}' },\n backgroundColor: { value: '{components.button._hover.backgroundColor}' },\n },\n },\n};\n\nexport { stepperfield };\n", "const storagemanager = {\n dropzone: {\n backgroundColor: { value: '{colors.background.primary}' },\n borderRadius: { value: '{radii.small}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'dashed' },\n borderWidth: { value: '{borderWidths.small}' },\n gap: { value: '{space.small}' },\n paddingBlock: { value: '{space.xl}' },\n paddingInline: { value: '{space.large}' },\n textAlign: { value: 'center' },\n _active: {\n backgroundColor: { value: '{colors.primary.10}' },\n borderRadius: {\n value: '{components.storagemanager.dropzone.borderRadius}',\n },\n borderColor: { value: '{colors.border.pressed}' },\n borderStyle: {\n value: '{components.storagemanager.dropzone.borderStyle}',\n },\n borderWidth: { value: '{borderWidths.medium}' },\n },\n icon: {\n color: { value: '{colors.border.primary}' },\n fontSize: { value: '{fontSizes.xxl}' },\n },\n text: {\n color: { value: '{colors.font.tertiary}' },\n fontSize: { value: '{fontSizes.medium}' },\n fontWeight: { value: '{fontWeights.bold}' },\n },\n },\n file: {\n backgroundColor: { value: '{colors.background.primary}' },\n borderRadius: { value: '{radii.small}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small}' },\n paddingBlock: { value: '{space.xs}' },\n paddingInline: { value: '{space.small}' },\n gap: { value: '{space.small}' },\n alignItems: { value: 'baseline' },\n name: {\n fontSize: { value: '{fontSizes.medium}' },\n fontWeight: { value: '{fontWeights.bold}' },\n color: { value: '{colors.font.primary}' },\n },\n size: {\n fontSize: { value: '{fontSizes.small}' },\n fontWeight: { value: '{fontWeights.normal}' },\n color: { value: '{colors.font.tertiary}' },\n },\n image: {\n width: { value: '{space.xxl}' },\n height: { value: '{space.xxl}' },\n backgroundColor: { value: '{colors.background.secondary}' },\n color: { value: '{colors.font.tertiary}' },\n borderRadius: { value: '{radii.small}' },\n },\n },\n filelist: {\n flexDirection: { value: 'column' },\n gap: { value: '{space.small}' },\n },\n loader: {\n strokeLinecap: { value: 'round' },\n strokeEmpty: { value: '{colors.border.secondary}' },\n strokeFilled: { value: '{components.loader.strokeFilled}' },\n strokeWidth: { value: '{borderWidths.large}' },\n },\n previewer: {\n backgroundColor: { value: '{colors.background.primary}' },\n borderColor: { value: '{colors.border.primary}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small}' },\n borderRadius: { value: '{radii.small}' },\n paddingBlock: { value: '{space.zero}' },\n paddingInline: { value: '{space.zero}' },\n maxHeight: { value: '40rem' },\n maxWidth: { value: 'auto' },\n text: {\n fontSize: { value: '{fontSizes.medium}' },\n fontWeight: { value: '{fontWeights.bold}' },\n color: { value: '{colors.font.primary}' },\n },\n body: {\n paddingBlock: { value: '{space.medium}' },\n paddingInline: { value: '{space.medium}' },\n gap: { value: '{space.small}' },\n },\n footer: {\n justifyContent: { value: 'flex-end' },\n },\n },\n};\n\nexport { storagemanager };\n", "const switchfield = {\n // States\n _disabled: {\n opacity: { value: '{opacities.60.value}' },\n },\n _focused: {\n shadow: {\n value: '{components.fieldcontrol._focus.boxShadow.value}',\n },\n },\n // Sizes\n fontSize: { value: '{fontSizes.medium.value}' },\n large: {\n fontSize: { value: '{fontSizes.large.value}' },\n },\n small: {\n fontSize: { value: '{fontSizes.small.value}' },\n },\n // Child elements\n label: {\n padding: { value: '{space.xs.value}' },\n },\n thumb: {\n backgroundColor: { value: '{colors.background.primary.value}' },\n borderColor: { value: 'transparent' },\n borderWidth: { value: '{borderWidths.small.value}' },\n borderStyle: { value: 'solid' },\n borderRadius: { value: '{radii.xxxl.value}' },\n checked: {\n transform: { value: '{transforms.slideX.medium.value}' },\n },\n transition: {\n duration: { value: '{time.medium.value}' },\n },\n width: { value: '{space.relative.medium.value}' },\n },\n track: {\n backgroundColor: { value: '{colors.background.quaternary.value}' },\n borderRadius: { value: '{radii.xxxl.value}' },\n checked: {\n backgroundColor: { value: '{colors.primary.80.value}' },\n },\n height: { value: '{space.relative.medium.value}' },\n padding: { value: '{outlineWidths.medium.value}' },\n transition: {\n duration: { value: '{time.short.value}' },\n },\n width: { value: '{space.relative.xl.value}' },\n _error: {\n backgroundColor: { value: '{colors.background.error.value}' },\n },\n },\n};\n\nexport { switchfield };\n", "const table = {\n /**\n * Default table styles\n */\n borderCollapse: { value: 'collapse' },\n display: { value: 'table' },\n width: { value: '100%' },\n /**\n * Default table head styles\n */\n head: {\n display: { value: 'table-header-group' },\n verticalAlign: { value: 'middle' },\n },\n /**\n * Default table body styles\n */\n body: {\n display: { value: 'table-row-group' },\n verticalAlign: { value: 'middle' },\n },\n /**\n * Default table foot styles\n */\n foot: {\n display: { value: 'table-footer-group' },\n verticalAlign: { value: 'middle' },\n },\n /**\n * Default table row styles\n */\n row: {\n display: { value: 'table-row' },\n verticalAlign: { value: 'middle' },\n hover: {\n backgroundColor: { value: '{colors.background.tertiary.value}' },\n },\n striped: {\n backgroundColor: { value: '{colors.background.secondary.value}' },\n },\n },\n /**\n * Default table header cell styles\n */\n header: {\n borderColor: { value: '{colors.border.tertiary.value}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small.value}' },\n color: { value: '{colors.font.primary.value}' },\n display: { value: 'table-cell' },\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n padding: { value: '{space.medium.value}' },\n verticalAlign: { value: 'middle' },\n large: {\n fontSize: { value: '{fontSizes.large.value}' },\n padding: { value: '{space.large.value}' },\n },\n small: {\n fontSize: { value: '{fontSizes.small.value}' },\n padding: { value: '{space.xs.value}' },\n },\n },\n /**\n * Default table data cell styles\n */\n data: {\n borderColor: { value: '{colors.border.tertiary.value}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.small.value}' },\n color: { value: '{colors.font.primary.value}' },\n display: { value: 'table-cell' },\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.normal.value}' },\n padding: { value: '{space.medium.value}' },\n verticalAlign: { value: 'middle' },\n large: {\n fontSize: { value: '{fontSizes.large.value}' },\n padding: { value: '{space.large.value}' },\n },\n small: {\n fontSize: { value: '{fontSizes.small.value}' },\n padding: { value: '{space.xs.value}' },\n },\n },\n /**\n * Default table caption styles\n */\n caption: {\n captionSide: { value: 'bottom' },\n color: { value: '{colors.font.primary.value}' },\n display: { value: 'table-caption' },\n fontSize: { value: '{fontSizes.medium.value}' },\n textAlign: { value: 'center' },\n wordBreak: { value: 'break-all' },\n large: {\n fontSize: { value: '{fontSizes.large.value}' },\n },\n small: {\n fontSize: { value: '{fontSizes.small.value}' },\n },\n },\n};\n\nexport { table };\n", "const tabs = {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.secondary.value}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n gap: { value: '0' },\n item: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.secondary.value}' },\n borderStyle: { value: 'solid' },\n borderWidth: { value: '{borderWidths.medium.value}' },\n color: { value: '{colors.font.secondary.value}' },\n fontSize: { value: '{fontSizes.medium.value}' },\n fontWeight: { value: '{fontWeights.bold.value}' },\n paddingVertical: { value: '{space.small.value}' },\n paddingHorizontal: { value: '{space.medium.value}' },\n textAlign: { value: 'center' },\n transitionDuration: { value: '{time.medium.value}' },\n _hover: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: { value: 'none' },\n color: { value: '{colors.font.hover.value}' },\n },\n _focus: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.focus.value}' },\n boxShadow: {\n value: {\n offsetX: '0px',\n offsetY: '0px',\n blurRadius: '0px',\n spreadRadius: '{borderWidths.medium}',\n color: '{colors.border.focus.value}',\n },\n },\n color: { value: '{colors.font.focus.value}' },\n },\n _active: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.font.interactive.value}' },\n boxShadow: { value: 'none' },\n color: { value: '{colors.font.interactive.value}' },\n },\n _disabled: {\n backgroundColor: { value: 'transparent' },\n borderColor: { value: '{colors.border.tertiary.value}' },\n boxShadow: { value: 'none' },\n color: { value: '{colors.font.disabled.value}' },\n },\n },\n panel: {\n backgroundColor: { value: 'transparent' },\n paddingInline: { value: '0' },\n paddingBlock: { value: '{space.small.value}' },\n },\n};\n\nexport { tabs };\n", "const text = {\n // default styles\n color: { value: '{colors.font.primary.value}' },\n // variations\n primary: {\n color: { value: '{colors.font.primary.value}' },\n },\n secondary: {\n color: { value: '{colors.font.secondary.value}' },\n },\n tertiary: {\n color: { value: '{colors.font.tertiary.value}' },\n },\n error: {\n color: { value: '{colors.font.error.value}' },\n },\n warning: {\n color: { value: '{colors.font.warning.value}' },\n },\n success: {\n color: { value: '{colors.font.success.value}' },\n },\n info: {\n color: { value: '{colors.font.info.value}' },\n },\n};\n\nexport { text };\n", "const textareafield = {\n color: { value: '{components.fieldcontrol.color.value}' },\n borderColor: { value: '{components.fieldcontrol.borderColor.value}' },\n _focus: {\n borderColor: {\n value: '{components.fieldcontrol._focus.borderColor.value}',\n },\n },\n};\n\nexport { textareafield };\n", "const textfield = {\n color: { value: '{components.fieldcontrol.color.value}' },\n borderColor: { value: '{components.fieldcontrol.borderColor.value}' },\n fontSize: { value: '{components.fieldcontrol.fontSize.value}' },\n _focus: {\n borderColor: {\n value: '{components.fieldcontrol._focus.borderColor.value}',\n },\n },\n};\n\nexport { textfield };\n", "const togglebutton = {\n borderColor: { value: '{colors.border.primary.value}' },\n color: { value: '{colors.font.primary.value}' },\n _hover: {\n backgroundColor: { value: '{colors.overlay.10.value}' },\n },\n _focus: {\n borderColor: { value: '{colors.border.focus.value}' },\n color: { value: '{colors.font.primary.value}' },\n },\n _active: {\n backgroundColor: { value: '{colors.transparent.value}' },\n },\n _disabled: {\n backgroundColor: { value: '{colors.transparent.value}' },\n borderColor: { value: '{colors.border.disabled.value}' },\n color: { value: '{colors.font.disabled.value}' },\n },\n _pressed: {\n borderColor: { value: '{colors.border.pressed.value}' },\n color: { value: '{colors.font.primary.value}' },\n backgroundColor: { value: '{colors.overlay.20.value}' },\n _hover: {\n backgroundColor: { value: '{colors.overlay.30.value}' },\n },\n },\n primary: {\n backgroundColor: { value: '{colors.transparent.value}' },\n borderWidth: { value: '{borderWidths.small.value}' },\n _focus: {\n borderColor: { value: '{colors.border.focus.value}' },\n backgroundColor: { value: '{colors.transparent.value}' },\n boxShadow: { value: '{components.fieldcontrol._focus.boxShadow.value}' },\n color: { value: '{colors.font.primary.value}' },\n },\n _hover: {\n backgroundColor: { value: '{colors.overlay.10.value}' },\n color: { value: '{colors.font.primary.value}' },\n },\n _disabled: {\n borderColor: { value: '{colors.border.disabled.value}' },\n backgroundColor: { value: '{colors.background.disabled.value}' },\n color: { value: '{colors.font.disabled.value}' },\n },\n _pressed: {\n backgroundColor: { value: '{colors.primary.80.value}' },\n borderColor: { value: '{colors.primary.80.value}' },\n color: { value: '{colors.background.primary.value}' },\n _focus: {\n backgroundColor: {\n value: '{colors.border.focus.value}',\n },\n borderColor: { value: '{colors.border.focus.value}' },\n color: { value: '{colors.background.primary.value}' },\n },\n _hover: {\n borderColor: { value: '{colors.primary.60.value}' },\n backgroundColor: {\n value: '{colors.primary.60.value}',\n },\n boxShadow: { value: '{colors.primary.60.value}' },\n color: { value: '{colors.background.primary.value}' },\n },\n },\n },\n link: {\n backgroundColor: { value: '{colors.transparent.value}' },\n color: { value: '{colors.overlay.50.value}' },\n _hover: {\n backgroundColor: { value: '{colors.transparent.value}' },\n color: { value: '{colors.overlay.50.value}' },\n },\n _focus: {\n backgroundColor: { value: '{colors.transparent.value}' },\n color: { value: '{colors.overlay.50.value}' },\n },\n _disabled: {\n backgroundColor: { value: '{colors.transparent.value}' },\n color: { value: '{colors.font.disabled.value}' },\n },\n _pressed: {\n backgroundColor: { value: '{colors.transparent.value}' },\n color: { value: '{colors.overlay.90.value}' },\n _focus: {\n backgroundColor: { value: '{colors.transparent.value}' },\n color: { value: '{colors.overlay.90.value}' },\n },\n _hover: {\n color: { value: '{colors.overlay.90.value}' },\n backgroundColor: { value: '{colors.transparent.value}' },\n },\n },\n },\n};\n\nexport { togglebutton };\n", "const togglebuttongroup = {\n alignItems: { value: 'center' },\n alignContent: { value: 'center' },\n justifyContent: { value: 'flex-start' },\n};\n\nexport { togglebuttongroup };\n", "// TODO: update the design tokens to use an array\n// export interface FontDesignToken {\n// value: Array\n// }\nconst fonts = {\n default: {\n variable: {\n value: `'InterVariable', 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont,\n 'Helvetica Neue', 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans',\n sans-serif`,\n },\n static: {\n value: `'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue',\n 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif`,\n },\n },\n};\n\nexport { fonts };\n", "const fontSizes = {\n xxxs: { value: '0.375rem' },\n xxs: { value: '0.5rem' },\n xs: { value: '0.75rem' },\n small: { value: '0.875rem' },\n medium: { value: '1rem' },\n large: { value: '1.25rem' },\n xl: { value: '1.5rem' },\n xxl: { value: '2rem' },\n xxxl: { value: '2.5rem' },\n xxxxl: { value: '3rem' },\n};\n\nexport { fontSizes };\n", "const fontWeights = {\n hairline: { value: 100 },\n thin: { value: 200 },\n light: { value: 300 },\n normal: { value: 400 },\n medium: { value: 500 },\n semibold: { value: 600 },\n bold: { value: 700 },\n extrabold: { value: 800 },\n black: { value: 900 },\n};\n\nexport { fontWeights };\n", "const lineHeights = {\n small: { value: '1.25' },\n medium: { value: '1.5' },\n large: { value: '2' },\n};\n\nexport { lineHeights };\n", "const opacities = {\n 0: { value: '0' },\n 10: { value: '0.1' },\n 20: { value: '0.2' },\n 30: { value: '0.3' },\n 40: { value: '0.4' },\n 50: { value: '0.5' },\n 60: { value: '0.6' },\n 70: { value: '0.7' },\n 80: { value: '0.8' },\n 90: { value: '0.9' },\n 100: { value: '1' },\n};\n\nexport { opacities };\n", "const outlineOffsets = {\n small: { value: '1px' },\n medium: { value: '2px' },\n large: { value: '3px' },\n};\n\nexport { outlineOffsets };\n", "const outlineWidths = {\n small: { value: '1px' },\n medium: { value: '2px' },\n large: { value: '3px' },\n};\n\nexport { outlineWidths };\n", "const radii = {\n xs: { value: '0.125rem' },\n small: { value: '0.25rem' },\n medium: { value: '0.5rem' },\n large: { value: '1rem' },\n xl: { value: '2rem' },\n xxl: { value: '4rem' },\n xxxl: { value: '8rem' },\n};\n\nexport { radii };\n", "const shadows = {\n small: {\n value: {\n offsetX: '0px',\n offsetY: '2px',\n blurRadius: '4px',\n color: '{colors.shadow.tertiary.value}',\n },\n },\n medium: {\n value: {\n offsetX: '0px',\n offsetY: '2px',\n blurRadius: '6px',\n color: '{colors.shadow.secondary.value}',\n },\n },\n large: {\n value: {\n offsetX: '0px',\n offsetY: '4px',\n blurRadius: '12px',\n color: '{colors.shadow.primary.value}',\n },\n },\n};\n\nexport { shadows };\n", "const space = {\n zero: { value: '0' },\n xxxs: { value: '0.25rem' },\n xxs: { value: '0.375rem' },\n xs: { value: '0.5rem' },\n small: { value: '0.75rem' },\n medium: { value: '1rem' },\n large: { value: '1.5rem' },\n xl: { value: '2.0rem' },\n xxl: { value: '3.0rem' },\n xxxl: { value: '4.5rem' },\n relative: {\n //creating a second set of sizes using em which will be sized relative to a parent instead of the root\n xxxs: { value: '0.25em' },\n xxs: { value: '0.375em' },\n xs: { value: '0.5em' },\n small: { value: '0.75em' },\n medium: { value: '1em' },\n large: { value: '1.5em' },\n xl: { value: '2.0em' },\n xxl: { value: '3.0em' },\n xxxl: { value: '4.5em' },\n full: { value: '100%' },\n },\n};\n// I want to be able to pass in a Theme object that has extra tokens\n// and it returns that same object type WITH the extra tokens\n\nexport { space };\n", "const time = {\n short: { value: '100ms' },\n medium: { value: '250ms' },\n long: { value: '500ms' },\n};\n\nexport { time };\n", "const transforms = {\n // TODO: make this more generic and cross-platform\n slideX: {\n small: { value: 'translateX(0.5em)' },\n medium: { value: 'translateX(1em)' },\n large: { value: 'translateX(2em)' },\n },\n};\n\nexport { transforms };\n", "// Breakpoint unit is in pixels\nconst breakpoints = {\n values: {\n base: 0,\n small: 480,\n medium: 768,\n large: 992,\n xl: 1280,\n xxl: 1536,\n },\n defaultBreakpoint: 'base',\n};\n\nexport { breakpoints };\n", "import kebabCase from 'lodash/kebabCase.js';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isObject, has, isString } from '../../utils/utils.mjs';\nimport { usesReference } from '../../utils/references.mjs';\n\nconst CSS_VARIABLE_PREFIX = 'amplify';\n/**\n * This will take an object like:\n * {paddingTop:'20px',color:'{colors.font.primary}'}\n * and turn it into a CSS string:\n * `padding-top:20px; color: var(--colors-font-primary);`\n */\nfunction propsToString(props) {\n return Object.entries(props)\n .map(([key, value]) => {\n const _value = isDesignToken(value)\n ? value.toString()\n : // @ts-ignore\n cssValue({ value });\n return `${kebabCase(key)}:${_value}; `;\n })\n .join(' ');\n}\nfunction cssNameTransform({ path = [] }) {\n return `${kebabCase([CSS_VARIABLE_PREFIX, ...path].join(' '))}`;\n}\n// Important: these properties should not be altered in\n// order to maintain the expected order of the CSS `box-shadow` property\nconst SHADOW_PROPERTIES = [\n 'offsetX',\n 'offsetY',\n 'blurRadius',\n 'spreadRadius',\n 'color',\n];\n/**\n * Will take a design token in a theme and return its value as CSS\n *\n * @param token\n * @returns\n */\nfunction cssValue(token) {\n const { value } = token;\n if (isString(value)) {\n return referenceValue(value);\n }\n if (isShadowTokenObject(value)) {\n return SHADOW_PROPERTIES.map((property) => {\n return referenceValue(\n // lookup property against `token` first for custom non-nested value, then lookup\n // property against `value` for design token value\n isShadowTokenObject(token) ? token[property] : value[property]);\n }).join(' ');\n }\n return value;\n}\n/**\n * Helper function to test if something is a design token or not.\n * Used in the React component style props.\n *\n * @param value - thing to test if it is a design token or not\n * @returns boolean\n */\nfunction isDesignToken(value) {\n return isObject(value) && has(value, 'value');\n}\nfunction isShadowTokenObject(value) {\n return isObject(value) && has(value, 'offsetX');\n}\n/**\n * Function that sees if a string contains a design token reference\n * and if so will turn that into a CSS variable.\n *\n * @param {string} value\n * @returns string\n */\nfunction referenceValue(value) {\n if (!value)\n return '';\n if (usesReference(value)) {\n const path = value.replace(/\\{|\\}/g, '').replace('.value', '').split('.');\n return `var(--${cssNameTransform({ path })})`;\n }\n return value;\n}\n/**\n * This will take a design token and add some data to it for it\n * to be used in JS/CSS. It will create its CSS var name and update\n * the value to use a CSS var if it is a reference. It will also\n * add a `.toString()` method to make it easier to use in JS.\n *\n * We should see if there is a way to share this logic with style dictionary...\n */\nconst setupToken = ({ token, path }) => {\n const name = `--${cssNameTransform({ path })}`;\n const { value: original } = token;\n const value = cssValue(token);\n return { name, original, path, value, toString: () => `var(${name})` };\n};\n/**\n * Recursive function that will walk down the token object\n * and perform the setupToken function on each token.\n * Similar to what Style Dictionary does.\n */\nfunction setupTokens({ tokens, path = [], setupToken, }) {\n if (has(tokens, 'value')) {\n return setupToken({ token: tokens, path });\n }\n const output = {};\n for (const name in tokens) {\n if (has(tokens, name)) {\n const value = tokens[name];\n const nextTokens = isObject(value) ? value : { value };\n output[name] = setupTokens({\n tokens: nextTokens,\n path: path.concat(name),\n setupToken,\n });\n }\n }\n return output;\n}\n// Internal Style Dictionary methods\n// copied from amzn/style-dictionary with the owner's permission\n/**\n * Takes an plain javascript object and will make a flat array of all the leaf nodes.\n * A leaf node in this context has a 'value' property. Potentially refactor this to\n * be more generic.\n * @private\n * @param {Object} properties - The plain object you want flattened into an array.\n * @param {Array} [to_ret=[]] - Properties array. This function is recursive therefore this is what gets passed along.\n * @return {Array}\n */\nfunction flattenProperties(properties, to_ret) {\n to_ret = to_ret || [];\n for (var name in properties) {\n if (has(properties, name)) {\n if (isObject(properties[name]) && 'value' in properties[name]) {\n to_ret.push(properties[name]);\n }\n else if (isObject(properties[name])) {\n flattenProperties(properties[name], to_ret);\n }\n }\n }\n return to_ret;\n}\n/**\n * Performs an deep extend on the objects, from right to left.\n * @private\n * @param {Object[]} objects - An array of JS objects\n * @param {Function} collision - A function to be called when a merge collision happens.\n * @param {string[]} path - (for internal use) An array of strings which is the current path down the object when this is called recursively.\n * @returns {Object}\n */\nfunction deepExtend(objects, collision, path) {\n if (objects == null)\n return {};\n var src, copyIsArray, copy, name, options, clone, target = objects[0] || {}, i = 1, length = objects.length;\n path = path || [];\n // Handle case when target is a string or something (possible in deep copy)\n if (typeof target !== 'object') {\n target = {};\n }\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = objects[i]) != null) {\n // Extend the base object\n for (name in options) {\n if (!has(options, name))\n continue;\n if (name === '__proto__')\n continue;\n src = target[name];\n copy = options[name];\n // Prevent never-ending loop\n if (target === copy) {\n continue;\n }\n // Recurse if we're merging plain objects or arrays\n if (copy && (isObject(copy) || (copyIsArray = Array.isArray(copy)))) {\n if (copyIsArray) {\n copyIsArray = false;\n clone = src && Array.isArray(src) ? src : [];\n }\n else {\n clone = src && isObject(src) ? src : {};\n }\n var nextPath = path.slice(0);\n nextPath.push(name);\n // Never move original objects, clone them\n target[name] = deepExtend([clone, copy], collision, nextPath);\n // Don't bring in undefined values\n }\n else if (copy !== undefined) {\n if (src != null && typeof collision == 'function') {\n collision({ target: target, copy: options, path: path, key: name });\n }\n target[name] = copy;\n }\n }\n }\n }\n return target;\n}\n\nexport { CSS_VARIABLE_PREFIX, cssNameTransform, cssValue, deepExtend, flattenProperties, isDesignToken, isShadowTokenObject, propsToString, referenceValue, setupToken, setupTokens };\n", "import { has } from './utils.mjs';\nimport { OPTIONS, REFERENCE_REGEX } from '../theme/createTheme/constants.mjs';\n\n/**\n * Checks if the value uses a value reference.\n * @param {string} value\n * @returns {boolean} - True, if the value uses a value reference\n */\nfunction usesReference(value) {\n const regex = new RegExp(REFERENCE_REGEX);\n if (typeof value === 'string') {\n return regex.test(value);\n }\n if (typeof value === 'object') {\n let hasReference = false;\n // iterate over each property in the object,\n // if any element passes the regex test,\n // the whole thing should be true\n for (const key in value) {\n if (has(value, key)) {\n const element = value[key];\n let reference = usesReference(element);\n if (reference) {\n hasReference = true;\n break;\n }\n }\n }\n return hasReference;\n }\n return false;\n}\nfunction resolveReference(path, obj) {\n let ref = obj;\n if (!Array.isArray(path)) {\n return;\n }\n for (let i = 0; i < path.length; i++) {\n // Check for undefined as 0 is a valid, truthy value\n if (typeof ref[path[i]] !== 'undefined') {\n ref = ref[path[i]];\n }\n else {\n // set the reference as undefined if we don't find anything\n ref = undefined;\n break;\n }\n }\n return ref;\n}\n/**\n * Returns the path from a path name be splitting the name by a given separator.\n */\nfunction getPathFromName(pathName) {\n if (typeof pathName !== 'string') {\n throw new Error('Getting path from name failed. Name must be a string');\n }\n return pathName.split(OPTIONS.separator);\n}\n/**\n * Returns the paths name be joining its parts with a given separator.\n */\nfunction getName(path) {\n if (!path || !(path instanceof Array)) {\n throw new Error('Getting name for path failed. Path must be an array');\n }\n return path.join(OPTIONS.separator);\n}\n\nexport { getName, getPathFromName, resolveReference, usesReference };\n", "const OPTIONS = {\n openingCharacter: '{',\n closingCharacter: '}',\n separator: '.',\n};\nconst REFERENCE_REGEX = /\\{([^}]+)\\}/g;\n\nexport { OPTIONS, REFERENCE_REGEX };\n", "import { propsToString } from './utils.mjs';\nimport '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isFunction, splitObject } from '../../utils/utils.mjs';\n\nfunction addVars(selector, vars) {\n if (!vars)\n return '';\n return `${selector} { ${Object.entries(vars)\n .map(([key, value]) => {\n return `--${key}:${value}; `;\n })\n .join(' ')}}\\n`;\n}\nfunction recursiveComponentCSS(baseSelector, theme) {\n let str = '';\n const { _modifiers = {}, _element = {}, _vars, ...props } = theme;\n // if there are no props, skip\n if (Object.keys(props).length) {\n // separate psuedo/attribute selectors\n const [selectors, other] = splitObject(props, (key) => key.startsWith(':') || key.startsWith('['));\n Object.entries(selectors).forEach(([selector, value]) => {\n // need to remove nested things like vars and elements\n const { _modifiers = {}, _element = {}, _vars, ...props } = value;\n str += `${baseSelector}${selector} { ${propsToString(props)} }\\n`;\n str += addVars(`${baseSelector}${selector}`, _vars);\n });\n str += `${baseSelector} { ${propsToString(other)} }\\n`;\n }\n str += addVars(baseSelector, _vars);\n Object.entries(_modifiers).forEach(([key, value]) => {\n if (value && Object.keys(value).length) {\n str += recursiveComponentCSS(`${baseSelector}--${key}`, value);\n }\n });\n Object.entries(_element).forEach(([key, value]) => {\n if (value && Object.keys(value).length) {\n str += recursiveComponentCSS(`${baseSelector}__${key}`, value);\n }\n });\n return str;\n}\n/**\n * This will take a component theme and create the appropriate CSS for it.\n *\n */\nfunction createComponentCSS({ theme, components, }) {\n let cssText = '';\n const { tokens, name: themeName, breakpoints } = theme;\n components.forEach(({ name, theme, overrides }) => {\n const baseComponentClassName = `amplify-${name}`;\n const componentClassName = `[data-amplify-theme=\"${themeName}\"] .${baseComponentClassName}`;\n // unwrap the component theme\n // if it is a function: call it with the defaultTheme to get a static object\n const componentTheme = isFunction(theme)\n ? theme(tokens)\n : theme;\n cssText += recursiveComponentCSS(componentClassName, componentTheme);\n // if the component theme has overrides\n // generate the appropriate CSS for each of them\n if (overrides) {\n overrides.forEach((override) => {\n // unwrap the override component theme just like above\n const componentTheme = isFunction(override.theme)\n ? override.theme(tokens)\n : override.theme;\n if ('mediaQuery' in override) {\n cssText += `@media (${override.mediaQuery}) {\\n ${recursiveComponentCSS(componentClassName, componentTheme)} \\n}`;\n }\n if ('breakpoint' in override) {\n const breakpoint = breakpoints.values[override.breakpoint];\n cssText += `\\n@media (min-width: ${breakpoint}px) {\\n ${recursiveComponentCSS(componentClassName, componentTheme)} \\n}`;\n }\n if ('selector' in override) {\n cssText += recursiveComponentCSS(`${override.selector} .${baseComponentClassName}`, componentTheme);\n }\n if ('colorMode' in override) {\n cssText += `\\n@media (prefers-color-scheme: ${override.colorMode}) {\\n${recursiveComponentCSS(`[data-amplify-theme=\"${themeName}\"][data-amplify-color-mode=\"system\"] .${baseComponentClassName}`, componentTheme)}\\n}\\n`;\n cssText += recursiveComponentCSS(`[data-amplify-theme=\"${themeName}\"][data-amplify-color-mode=\"${override.colorMode}\"] .${baseComponentClassName}`, componentTheme);\n }\n });\n }\n });\n return cssText;\n}\n\nexport { createComponentCSS, recursiveComponentCSS };\n", "/**\n * Takes a set of keys and a color name and returns an object of design tokens,\n * used for applying a primary color at the theme level to our tokens.\n *\n * createColorPalette({keys: ['10','20',...], value: 'red'})\n * returns {\n * 10: { value: '{colors.red.10.value}' },\n * 20: { value: '{colors.red.20.value}' },\n * ...\n * }\n */\nfunction createColorPalette({ keys, value }) {\n return keys.reduce((acc, key) => {\n return {\n ...acc,\n [key]: { value: `{colors.${value}.${key}.value}` },\n };\n }, {});\n}\n\nexport { createColorPalette };\n", "import '@aws-amplify/core/internals/utils';\nimport '../../utils/setUserAgent/constants.mjs';\nimport { isFunction } from '../../utils/utils.mjs';\nimport { propsToString } from './utils.mjs';\n\nfunction createAnimationCSS({ animations, tokens, }) {\n let cssText = '';\n Object.entries(animations).forEach(([key, value]) => {\n cssText += `\\n @keyframes ${key} {`;\n Object.entries(value).forEach(([step, properties]) => {\n cssText += `\\n ${step} {\\n`;\n const animationProperties = isFunction(properties)\n ? properties(tokens)\n : properties;\n cssText += propsToString(animationProperties);\n cssText += `\\n }`;\n });\n cssText += `\\n }`;\n });\n return cssText;\n}\n\nexport { createAnimationCSS };\n", "import { isString, isObject, has } from './utils.mjs';\n\nconst classNames = (...args) => {\n const classes = [];\n for (const arg of args) {\n // skip falsey values\n if (!arg) {\n continue;\n }\n if (isString(arg)) {\n classes.push(arg);\n continue;\n }\n if (typeof arg === 'number') {\n classes.push(arg.toString());\n continue;\n }\n if (Array.isArray(arg)) {\n classes.push(classNames(...arg));\n continue;\n }\n if (isObject(arg)) {\n // check if the object has a valid .toString() method\n if (arg.toString !== Object.prototype.toString &&\n arg.toString() !== '[object Object]') {\n classes.push(arg.toString());\n continue;\n }\n for (const key in arg) {\n if (has(arg, key) && arg[key]) {\n classes.push(key);\n }\n }\n }\n }\n return classes.join(' ');\n};\n\nexport { classNames };\n", "const ComponentClassName = {\n Accordion: 'amplify-accordion',\n AccordionItem: 'amplify-accordion__item',\n AccordionItemTrigger: 'amplify-accordion__item__trigger',\n AccordionItemContent: 'amplify-accordion__item__content',\n AccordionItemIcon: 'amplify-accordion__item__icon',\n Alert: 'amplify-alert',\n AlertIcon: 'amplify-alert__icon',\n AlertHeading: 'amplify-alert__heading',\n AlertBody: 'amplify-alert__body',\n AlertDismiss: 'amplify-alert__dismiss',\n Autocomplete: 'amplify-autocomplete',\n AutocompleteMenu: 'amplify-autocomplete__menu',\n AutocompleteMenuEmpty: 'amplify-autocomplete__menu--empty',\n AutocompleteMenuFooter: 'amplify-autocomplete__menu__footer',\n AutocompleteMenuHeader: 'amplify-autocomplete__menu__header',\n AutocompleteMenuLoading: 'amplify-autocomplete__menu--loading',\n AutocompleteMenuOption: 'amplify-autocomplete__menu__option',\n AutocompleteMenuOptions: 'amplify-autocomplete__menu__options',\n Avatar: 'amplify-avatar',\n AvatarIcon: 'amplify-avatar__icon',\n AvatarImage: 'amplify-avatar__image',\n AvatarLoader: 'amplify-avatar__loader',\n AIConversation: 'amplify-ai-conversation',\n AIConversationAttachment: 'amplify-ai-conversation__attachment',\n AIConversationAttachmentList: 'amplify-ai-conversation__attachment__list',\n AIConversationAttachmentImage: 'amplify-ai-conversation__attachment__image',\n AIConversationAttachmentName: 'amplify-ai-conversation__attachment__name',\n AIConversationAttachmentSize: 'amplify-ai-conversation__attachment__size',\n AIConversationAttachmentRemove: 'amplify-ai-conversation__attachment__remove',\n AIConversationForm: 'amplify-ai-conversation__form',\n AIConversationFormAttach: 'amplify-ai-conversation__form__attach',\n AIConversationFormError: 'amplify-ai-conversation__form__error',\n AIConversationFormSend: 'amplify-ai-conversation__form__send',\n AIConversationFormField: 'amplify-ai-conversation__form__field',\n AIConversationFormDropzone: 'amplify-ai-conversation__form__dropzone',\n AIConversationMessage: 'amplify-ai-conversation__message',\n AIConversationMessageAvatar: 'amplify-ai-conversation__message__avatar',\n AIConversationMessageSender: 'amplify-ai-conversation__message__sender',\n AIConversationMessageSenderUsername: 'amplify-ai-conversation__message__sender__username',\n AIConversationMessageSenderTimestamp: 'amplify-ai-conversation__message__sender__timestamp',\n AIConversationMessageBody: 'amplify-ai-conversation__message__body',\n AIConversationMessageContent: 'amplify-ai-conversation__message__content',\n AIConversationMessageActions: 'amplify-ai-conversation__message__actions',\n AIConversationMessageList: 'amplify-ai-conversation__message__list',\n AIConversationPrompt: 'amplify-ai-conversation__prompt',\n Badge: 'amplify-badge',\n Breadcrumbs: 'amplify-breadcrumbs',\n BreadcrumbsList: 'amplify-breadcrumbs__list',\n BreadcrumbsItem: 'amplify-breadcrumbs__item',\n BreadcrumbsSeparator: 'amplify-breadcrumbs__separator',\n BreadcrumbsLink: 'amplify-breadcrumbs__link',\n Button: 'amplify-button',\n ButtonGroup: 'amplify-buttongroup',\n ButtonLoaderWrapper: 'amplify-button__loader-wrapper',\n Card: 'amplify-card',\n Checkbox: 'amplify-checkbox',\n CheckboxButton: 'amplify-checkbox__button',\n CheckboxIcon: 'amplify-checkbox__icon',\n CheckboxInput: 'amplify-checkbox__input',\n CheckboxLabel: 'amplify-checkbox__label',\n CheckboxField: 'amplify-checkboxfield',\n Collection: 'amplify-collection',\n CollectionItems: 'amplify-collection-items',\n CollectionSearch: 'amplify-collection-search',\n CollectionPagination: 'amplify-collection-pagination',\n CountryCodeSelect: 'amplify-countrycodeselect',\n DialCodeSelect: 'amplify-dialcodeselect',\n Divider: 'amplify-divider',\n DividerLabel: 'amplify-divider--label',\n DropZone: 'amplify-dropzone',\n Field: 'amplify-field',\n FieldDescription: 'amplify-field__description',\n FieldErrorMessage: 'amplify-field__error-message',\n FieldGroup: 'amplify-field-group',\n FieldGroupControl: 'amplify-field-group__control',\n FieldGroupOuterEnd: 'amplify-field-group__outer-end',\n FieldGroupOuterStart: 'amplify-field-group__outer-start',\n FieldGroupInnerEnd: 'amplify-field-group__inner-end',\n FieldGroupInnerStart: 'amplify-field-group__inner-start',\n FieldGroupIcon: 'amplify-field-group__icon',\n FieldGroupIconButton: 'amplify-field-group__icon-button',\n FieldGroupHasInnerEnd: 'amplify-field-group--has-inner-end',\n FieldGroupHasInnerStart: 'amplify-field-group--has-inner-start',\n FieldShowPassword: 'amplify-field__show-password',\n FieldGroupFieldWrapper: 'amplify-field-group__field-wrapper',\n Fieldset: 'amplify-fieldset',\n FieldsetLegend: 'amplify-fieldset__legend',\n FileUploader: 'amplify-fileuploader',\n FileUploaderDropZone: 'amplify-fileuploader__dropzone',\n FileUploaderDropZoneIcon: 'amplify-fileuploader__dropzone__icon',\n FileUploaderDropZoneText: 'amplify-fileuploader__dropzone__text',\n FileUploaderFilePicker: 'amplify-fileuploader__file__picker',\n FileUploaderFile: 'amplify-fileuploader__file',\n FileUploaderFileWrapper: 'amplify-fileuploader__file__wrapper',\n FileUploaderFileList: 'amplify-fileuploader__file__list',\n FileUploaderFileName: 'amplify-fileuploader__file__name',\n FileUploaderFileSize: 'amplify-fileuploader__file__size',\n FileUploaderFileInfo: 'amplify-fileuploader__file__info',\n FileUploaderFileImage: 'amplify-fileuploader__file__image',\n FileUploaderFileMain: 'amplify-fileuploader__file__main',\n FileUploaderFileStatus: 'amplify-fileuploader__file__status',\n FileUploaderLoader: 'amplify-fileuploader__loader',\n FileUploaderPreviewer: 'amplify-fileuploader__previewer',\n FileUploaderPreviewerText: 'amplify-fileuploader__previewer__text',\n FileUploaderPreviewerActions: 'amplify-fileuploader__previewer__actions',\n FileUploaderPreviewerFooter: 'amplify-fileuploader__previewer__footer',\n Flex: 'amplify-flex',\n Grid: 'amplify-grid',\n Heading: 'amplify-heading',\n HighlightMatch: 'amplify-highlightmatch',\n HighlightMatchHighlighted: 'amplify-highlightmatch__highlighted',\n Icon: 'amplify-icon',\n Image: 'amplify-image',\n Input: 'amplify-input',\n Label: 'amplify-label',\n Link: 'amplify-link',\n Loader: 'amplify-loader',\n LoaderLabel: 'amplify-loader__label',\n MenuContent: 'amplify-menu__content',\n MenuItem: 'amplify-menu__content__item',\n MenuTrigger: 'amplify-menu__trigger',\n MenuWrapper: 'amplify-menu__wrapper',\n Message: 'amplify-message',\n MessageIcon: 'amplify-message__icon',\n MessageHeading: 'amplify-message__heading',\n MessageBody: 'amplify-message__body',\n MessageContent: 'amplify-message__content',\n MessageDismiss: 'amplify-message__dismiss',\n Pagination: 'amplify-pagination',\n PaginationItem: 'amplify-pagination__item',\n PasswordField: 'amplify-passwordfield',\n PhoneNumberField: 'amplify-phonenumberfield',\n Placeholder: 'amplify-placeholder',\n Radio: 'amplify-radio',\n RadioButton: 'amplify-radio__button',\n RadioInput: 'amplify-radio__input',\n RadioLabel: 'amplify-radio__label',\n RadioGroupField: 'amplify-radiogroupfield',\n RadioGroup: 'amplify-radiogroup',\n Rating: 'amplify-rating',\n RatingItem: 'amplify-rating__item',\n RatingIcon: 'amplify-rating__icon',\n RatingLabel: 'amplify-rating__label',\n ScrollView: 'amplify-scrollview',\n SearchField: 'amplify-searchfield',\n SearchFieldClear: 'amplify-searchfield__clear',\n SearchFieldSearch: 'amplify-searchfield__search',\n Select: 'amplify-select',\n SelectField: 'amplify-selectfield',\n SelectWrapper: 'amplify-select__wrapper',\n SelectIcon: 'amplify-select__icon',\n SliderField: 'amplify-sliderfield',\n SliderFieldGroup: 'amplify-sliderfield__group',\n SliderFieldLabel: 'amplify-sliderfield__label',\n SliderFieldRange: 'amplify-sliderfield__range',\n SliderFieldRoot: 'amplify-sliderfield__root',\n SliderFieldThumb: 'amplify-sliderfield__thumb',\n SliderFieldTrack: 'amplify-sliderfield__track',\n StepperField: 'amplify-stepperfield',\n StepperFieldButtonDecrease: 'amplify-stepperfield__button--decrease',\n StepperFieldButtonIncrease: 'amplify-stepperfield__button--increase',\n StepperFieldInput: 'amplify-stepperfield__input',\n StorageImage: 'amplify-storageimage',\n StorageManager: 'amplify-storagemanager',\n StorageManagerDropZone: 'amplify-storagemanager__dropzone',\n StorageManagerDropZoneIcon: 'amplify-storagemanager__dropzone__icon',\n StorageManagerDropZoneText: 'amplify-storagemanager__dropzone__text',\n StorageManagerFilePicker: 'amplify-storagemanager__file__picker',\n StorageManagerFile: 'amplify-storagemanager__file',\n StorageManagerFileWrapper: 'amplify-storagemanager__file__wrapper',\n StorageManagerFileList: 'amplify-storagemanager__file__list',\n StorageManagerFileName: 'amplify-storagemanager__file__name',\n StorageManagerFileSize: 'amplify-storagemanager__file__size',\n StorageManagerFileInfo: 'amplify-storagemanager__file__info',\n StorageManagerFileImage: 'amplify-storagemanager__file__image',\n StorageManagerFileMain: 'amplify-storagemanager__file__main',\n StorageManagerFileStatus: 'amplify-storagemanager__file__status',\n StorageManagerLoader: 'amplify-storagemanager__loader',\n StorageManagerPreviewer: 'amplify-storagemanager__previewer',\n StorageManagerPreviewerText: 'amplify-storagemanager__previewer__text',\n StorageManagerPreviewerActions: 'amplify-storagemanager__previewer__actions',\n StorageManagerPreviewerFooter: 'amplify-storagemanager__previewer__footer',\n SwitchField: 'amplify-switchfield',\n SwitchLabel: 'amplify-switch__label',\n SwitchThumb: 'amplify-switch__thumb',\n SwitchTrack: 'amplify-switch__track',\n SwitchWrapper: 'amplify-switch__wrapper',\n Table: 'amplify-table',\n TableCaption: 'amplify-table__caption',\n TableBody: 'amplify-table__body',\n TableTd: 'amplify-table__td',\n TableTh: 'amplify-table__th',\n TableFoot: 'amplify-table__foot',\n TableHead: 'amplify-table__head',\n TableRow: 'amplify-table__row',\n Tabs: 'amplify-tabs',\n TabsList: 'amplify-tabs__list',\n TabsItem: 'amplify-tabs__item',\n TabsPanel: 'amplify-tabs__panel',\n Text: 'amplify-text',\n Textarea: 'amplify-textarea',\n TextAreaField: 'amplify-textareafield',\n TextField: 'amplify-textfield',\n ToggleButton: 'amplify-togglebutton',\n ToggleButtonGroup: 'amplify-togglebuttongroup',\n VisuallyHidden: 'amplify-visually-hidden',\n};\n\nexport { ComponentClassName };\n", "import { setCustomUserAgent } from '@aws-amplify/core/internals/utils';\nimport { STORAGE_BROWSER_INPUT_BASE, STORAGE_MANAGER_INPUT_BASE, MAP_VIEW_INPUT_BASE, LOCATION_SEARCH_INPUT_BASE, IN_APP_MESSAGING_INPUT_BASE, FILE_UPLOADER_BASE_INPUT, ACCOUNT_SETTINGS_INPUT_BASE, AUTHENTICATOR_INPUT_BASE, AI_INPUT_BASE } from './constants.mjs';\nimport { noop } from '../utils.mjs';\n\n/**\n * @example\n * ```ts\n * // set user agent options\n * const clear = setUserAgent(input);\n *\n * // clear user agent options\n * clear();\n * ```\n */\nconst setUserAgent = ({ componentName, packageName, version, }) => {\n const packageData = [`ui-${packageName}`, version];\n switch (componentName) {\n case 'AIConversation': {\n setCustomUserAgent({\n ...AI_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'Authenticator': {\n setCustomUserAgent({\n ...AUTHENTICATOR_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'ChangePassword':\n case 'DeleteUser': {\n setCustomUserAgent({\n ...ACCOUNT_SETTINGS_INPUT_BASE,\n additionalDetails: [['AccountSettings'], packageData],\n });\n break;\n }\n case 'FileUploader': {\n setCustomUserAgent({\n ...FILE_UPLOADER_BASE_INPUT,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'InAppMessaging': {\n setCustomUserAgent({\n ...IN_APP_MESSAGING_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'LocationSearch': {\n setCustomUserAgent({\n ...LOCATION_SEARCH_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'MapView': {\n setCustomUserAgent({\n ...MAP_VIEW_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'StorageManager': {\n setCustomUserAgent({\n ...STORAGE_MANAGER_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n case 'StorageBrowser': {\n setCustomUserAgent({\n ...STORAGE_BROWSER_INPUT_BASE,\n additionalDetails: [[componentName], packageData],\n });\n break;\n }\n }\n return noop;\n};\n\nexport { setUserAgent };\n", "import React__default from 'react';\n\n/**\n * AuthenticatorContext serves static reference to the auth machine service.\n *\n * https://xstate.js.org/docs/recipes/react.html#context-provider\n */\nconst AuthenticatorContext = React__default.createContext(null);\n\nexport { AuthenticatorContext };\n", "import React__default, { useCallback } from 'react';\nimport { useSelector } from '@xstate/react';\nimport { getServiceFacade } from '@aws-amplify/ui';\nimport 'aws-amplify/auth';\nimport { AuthenticatorContext } from '../../context/AuthenticatorContext.mjs';\nimport { USE_AUTHENTICATOR_ERROR } from './constants.mjs';\nimport { getQRFields, getMachineFields, getComparator, defaultComparator } from './utils.mjs';\n\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/connected-components/authenticator/headless#useauthenticator-hook)\n */\nfunction useAuthenticator(selector) {\n const context = React__default.useContext(AuthenticatorContext);\n if (!context) {\n throw new Error(USE_AUTHENTICATOR_ERROR);\n }\n const { service } = context;\n const { send } = service;\n const xstateSelector = useCallback((state) => ({ ...getServiceFacade({ send, state }) }), [send]);\n const comparator = selector ? getComparator(selector) : defaultComparator;\n // the purpose of `context.authStatus`is to intentionally override `facade.authStatus`. `facade.authStatus` does\n // not update on external sign in events (for example when a user is not using the `Authenticator`).\n const { authStatus } = context;\n const facade = useSelector(service, xstateSelector, comparator);\n const { route, totpSecretCode, unverifiedUserAttributes, user, ...rest } = facade;\n // do not memoize output. `service.getSnapshot` reference remains stable preventing\n // `fields` from updating with current form state on value changes\n const serviceSnapshot = service.getSnapshot();\n // legacy `QRFields` values only used for SetupTotp page to retrieve issuer information, will be removed in future\n const QRFields = route === 'setupTotp' ? getQRFields(serviceSnapshot) : null;\n // legacy `formFields` values required until form state is removed from state machine\n const fields = getMachineFields(route, serviceSnapshot, unverifiedUserAttributes);\n return {\n ...rest,\n authStatus,\n route,\n totpSecretCode,\n unverifiedUserAttributes,\n user,\n /** @deprecated For internal use only */\n fields,\n QRFields,\n };\n}\n\nexport { useAuthenticator as default };\n", "const USE_AUTHENTICATOR_ERROR = '`useAuthenticator` must be used inside an `Authenticator.Provider`.';\n\nexport { USE_AUTHENTICATOR_ERROR };\n", "import { getActorContext, getSortedFormFields, isString, areEmptyArrays, areEmptyObjects } from '@aws-amplify/ui';\nimport { isComponentRouteKey } from '../utils.mjs';\n\nconst defaultComparator = () => false;\n/**\n * Does an ordering and shallow comparison of each array value,\n * plus a value equality check for empty objects and arrays.\n */\nfunction areSelectorDepsEqual(currentDeps, nextDeps) {\n if (currentDeps.length !== nextDeps.length) {\n return false;\n }\n return currentDeps.every((currentDep, index) => {\n const nextDep = nextDeps[index];\n if (areEmptyArrays(currentDep, nextDep) ||\n areEmptyObjects(currentDep, nextDep)) {\n return true;\n }\n return currentDep === nextDep;\n });\n}\nconst getComparator = (selector) => (currentFacade, nextFacade) => {\n const currentSelectorDeps = selector(currentFacade);\n const nextSelectorDeps = selector(nextFacade);\n // Shallow compare the array values\n return areSelectorDepsEqual(currentSelectorDeps, nextSelectorDeps);\n};\nconst getQRFields = (state) => ({\n ...getActorContext(state)?.formFields?.setupTotp?.QR,\n});\nconst flattenFormFields = (fields) => fields.flatMap(([name, options]) => ({ name, ...options }));\nconst convertContactMethodsToFields = (unverifiedUserAttributes) => {\n return (unverifiedUserAttributes &&\n Object.entries(unverifiedUserAttributes).map(([name, value]) => {\n const valueIsString = isString(value);\n if (!valueIsString || !name) {\n return {};\n }\n return { name, label: value, type: 'radio', value };\n }));\n};\n/**\n * Retrieves default and custom (RWA only, to be updated) form field values from state machine\n * for subcomponent routes that render fields\n */\nconst getMachineFields = (route, state, unverifiedUserAttributes) => {\n if (isComponentRouteKey(route)) {\n return route === 'verifyUser'\n ? convertContactMethodsToFields(unverifiedUserAttributes)\n : flattenFormFields(getSortedFormFields(route, state));\n }\n return [];\n};\n\nexport { areSelectorDepsEqual, defaultComparator, getComparator, getMachineFields, getQRFields };\n", "import { COMPONENT_ROUTE_KEYS, COMPONENT_ROUTE_NAMES } from './constants.mjs';\n\nconst isComponentRouteKey = (route) => COMPONENT_ROUTE_KEYS.some((componentRoute) => componentRoute === route);\nfunction resolveAuthenticatorComponents(defaults, overrides) {\n if (!overrides) {\n return defaults;\n }\n return COMPONENT_ROUTE_NAMES.reduce((components, route) => {\n const Default = defaults[route];\n const Override = overrides[route];\n if (typeof Override !== 'function') {\n return { ...components, [route]: Default };\n }\n const { Footer, FormFields, Header } = Default;\n // cast to allow assigning of component slots\n const Component = Override;\n Component.Footer = Footer;\n Component.FormFields = FormFields;\n Component.Header = Header;\n return { ...components, [route]: Component };\n }, {});\n}\n\nexport { isComponentRouteKey, resolveAuthenticatorComponents };\n", "const COMPONENT_ROUTE_KEYS = [\n 'confirmResetPassword',\n 'confirmSignIn',\n 'confirmSignUp',\n 'confirmVerifyUser',\n 'forceNewPassword',\n 'forgotPassword',\n 'setupTotp',\n 'signIn',\n 'signUp',\n 'verifyUser',\n];\nconst COMPONENT_ROUTE_NAMES = [\n 'ConfirmResetPassword',\n 'ConfirmSignIn',\n 'ConfirmSignUp',\n 'ConfirmVerifyUser',\n 'ForceNewPassword',\n 'ForgotPassword',\n 'SetupTotp',\n 'SignIn',\n 'SignUp',\n 'VerifyUser',\n];\n\nexport { COMPONENT_ROUTE_KEYS, COMPONENT_ROUTE_NAMES };\n", "import React__default from 'react';\nimport useAuthenticator from '../useAuthenticator/useAuthenticator.mjs';\n\n// only select `route` from machine context\nconst routeSelector = ({ route }) => [route];\nfunction useAuthenticatorInitMachine(data) {\n const { route, initializeMachine } = useAuthenticator(routeSelector);\n const hasInitialized = React__default.useRef(false);\n React__default.useEffect(() => {\n if (!hasInitialized.current && route === 'setup') {\n initializeMachine(data);\n hasInitialized.current = true;\n }\n }, [initializeMachine, route, data]);\n}\n\nexport { useAuthenticatorInitMachine as default, routeSelector };\n", "import * as React from 'react';\n\n/**\n * Logs a deprecation warning message.\n *\n * @important Please use the React/React Native specific platform implementations.\n * This version of the hook is a base implementation that the others extend from due\n * to env differences between running in RN or the browser\n */\nconst useDeprecationWarning = ({ shouldWarn, message, }) => {\n React.useEffect(() => {\n if (shouldWarn) {\n // eslint-disable-next-line no-console\n console.warn(message);\n }\n }, [shouldWarn, message]);\n};\n\nexport { useDeprecationWarning as default };\n", "import { useEffect } from 'react';\nimport { setUserAgent } from '@aws-amplify/ui';\n\nfunction useSetUserAgent({ componentName, packageName, version, }) {\n useEffect(() => {\n const clearUserAgent = setUserAgent({\n componentName,\n packageName,\n version,\n });\n return clearUserAgent;\n }, [componentName, packageName, version]);\n}\n\nexport { useSetUserAgent as default };\n", "import * as React from 'react';\nimport { createTheme } from '@aws-amplify/ui';\n\nconst ThemeContext = React.createContext({\n theme: createTheme(),\n colorMode: undefined,\n});\n\nexport { ThemeContext };\n", "import * as React from 'react';\nimport { ComponentClassName } from '@aws-amplify/ui';\nimport '../Icon/Icon.mjs';\nimport '../Icon/context/IconsContext.mjs';\nimport { useIcons } from '../Icon/context/useIcons.mjs';\nimport '../View/View.mjs';\nimport { IconCheckCircle } from '../Icon/icons/IconCheckCircle.mjs';\nimport { IconError } from '../Icon/icons/IconError.mjs';\nimport { IconInfo } from '../Icon/icons/IconInfo.mjs';\nimport { IconWarning } from '../Icon/icons/IconWarning.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst AlertIcon = ({ variation, ariaHidden, ariaLabel, role, }) => {\n const icons = useIcons('alert');\n let icon;\n switch (variation) {\n case 'info':\n icon = icons?.info ?? (React.createElement(IconInfo, { \"aria-hidden\": ariaHidden, \"aria-label\": ariaLabel, role: role }));\n break;\n case 'error':\n icon = icons?.error ?? (React.createElement(IconError, { \"aria-hidden\": ariaHidden, \"aria-label\": ariaLabel, role: role }));\n break;\n case 'warning':\n icon = icons?.warning ?? (React.createElement(IconWarning, { \"aria-hidden\": ariaHidden, \"aria-label\": ariaLabel, role: role }));\n break;\n case 'success':\n icon = icons?.success ?? (React.createElement(IconCheckCircle, { \"aria-hidden\": ariaHidden, \"aria-label\": ariaLabel, role: role }));\n break;\n }\n return icon ? (React.createElement(\"span\", { className: ComponentClassName.AlertIcon }, icon)) : null;\n};\nAlertIcon.displayName = 'AlertIcon';\n\nexport { AlertIcon };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst defaultViewBox = { minX: 0, minY: 0, width: 24, height: 24 };\nconst IconPrimitive = ({ className, \n// as can be used to render other icon react components too\nas = 'svg', fill = 'currentColor', pathData, viewBox = defaultViewBox, children, paths, ...rest }, ref) => {\n const minX = viewBox.minX ? viewBox.minX : defaultViewBox.minX;\n const minY = viewBox.minY ? viewBox.minY : defaultViewBox.minY;\n const width = viewBox.width ? viewBox.width : defaultViewBox.width;\n const height = viewBox.height ? viewBox.height : defaultViewBox.height;\n // An icon can be drawn in 3 ways:\n // 1. Pass it children which should be valid SVG elements\n // 2. Pass an array of path-like objects to `paths` prop\n // 3. Supply `pathData` for a simple icons\n let _children;\n if (children) {\n _children = children;\n }\n if (paths) {\n _children = paths.map((path, index) => React.createElement(\"path\", { ...path, key: index }));\n }\n if (pathData) {\n _children = React.createElement(\"path\", { d: pathData, fill: fill });\n }\n return (React.createElement(View, { as: as, className: classNames(ComponentClassName.Icon, className), ref: ref, viewBox: `${minX} ${minY} ${width} ${height}`, ...rest }, _children));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/icon)\n */\nconst Icon = primitiveWithForwardRef(IconPrimitive);\nIcon.displayName = 'Icon';\n\nexport { Icon };\n", "import * as React from 'react';\nimport { useStyles } from '../shared/styleUtils.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst ViewPrimitive = ({ as = 'div', children, testId, ariaLabel, isDisabled, style, inert, ...rest }, ref) => {\n const { propStyles, nonStyleProps } = useStyles(rest, style);\n return React.createElement(as, {\n 'aria-label': ariaLabel,\n 'data-testid': testId,\n disabled: isDisabled,\n ref,\n inert: inert ? '' : null,\n style: propStyles,\n ...nonStyleProps,\n }, children);\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/view)\n */\nconst View = primitiveWithForwardRef(ViewPrimitive);\nView.displayName = 'View';\n\nexport { View };\n", "import * as React from 'react';\nimport { isDesignToken } from '@aws-amplify/ui';\nimport { ComponentPropsToStylePropsMap } from '../types/style.mjs';\nimport { getValueAtCurrentBreakpoint } from './responsive/utils.mjs';\nimport { useBreakpoint } from './responsive/useBreakpoint.mjs';\nimport { useTheme } from '../../hooks/useTheme.mjs';\nimport { getStyleValue } from './getStyleValue.mjs';\nimport { isNullOrEmptyString, isEmptyString, getCSSVariableIfValueIsThemeKey } from './utils.mjs';\n\nconst isSpanPrimitiveValue = (spanValue) => {\n return (spanValue === 'auto' ||\n (typeof spanValue === 'number' && !isNaN(spanValue)) ||\n (typeof spanValue === 'string' && !isNaN(parseFloat(spanValue))));\n};\nconst getGridSpan = (spanValue) => {\n return spanValue === 'auto' ? 'auto' : `span ${spanValue}`;\n};\nconst convertGridSpan = (spanValue) => {\n // PropertyType\n if (isSpanPrimitiveValue(spanValue)) {\n return getGridSpan(spanValue);\n }\n // PropertyType[]\n if (Array.isArray(spanValue)) {\n return spanValue.map((value) => getGridSpan(value));\n }\n // ResponsiveObject\n if (typeof spanValue === 'object' && spanValue != null) {\n return Object.entries(spanValue).reduce((acc, [key, value]) => ({ ...acc, [key]: getGridSpan(value) }), {});\n }\n return null;\n};\n/**\n * Transforms style props to another target prop\n * where the original is a simpler API than the target.\n * This function will remove the original prop and\n * replace target prop values with calculated\n * E.g. rowSpan => row, columnSpan => column\n */\nconst useTransformStyleProps = (props) => {\n const { rowSpan, columnSpan, row, column, ...rest } = props;\n const { rowFromSpanValue, columnFromSpanValue } = React.useMemo(() => {\n return {\n rowFromSpanValue: convertGridSpan(rowSpan),\n columnFromSpanValue: convertGridSpan(columnSpan),\n };\n }, [rowSpan, columnSpan]);\n return {\n row: !isNullOrEmptyString(row) ? row : rowFromSpanValue,\n column: !isNullOrEmptyString(column) ? column : columnFromSpanValue,\n ...rest,\n };\n};\nconst isComponentStyleProp = (key) => {\n return key in ComponentPropsToStylePropsMap;\n};\n/**\n * Convert style props to CSS variables for React style prop\n * Note: Will filter out undefined, null, and empty string prop values\n */\nconst convertStylePropsToStyleObj = ({ props = {}, style = {}, breakpoint, breakpoints, tokens, }) => {\n const nonStyleProps = {};\n Object.keys(props)\n .filter((propKey) => props[propKey] !== null)\n .forEach((propKey) => {\n if (isComponentStyleProp(propKey)) {\n const values = props[propKey];\n if (!values || isEmptyString(values))\n return;\n const reactStyleProp = ComponentPropsToStylePropsMap[propKey];\n // short circuit the style prop here if it is a string or design token\n // so we don't have to call getValueAtCurrentBreakpoint every time\n let value = '';\n if (isDesignToken(values)) {\n value = values.toString();\n }\n else if (typeof values === 'string') {\n value = getCSSVariableIfValueIsThemeKey(propKey, values, tokens);\n }\n else if (typeof values === 'number') {\n value = values;\n }\n else if (typeof values === 'object') {\n // here values should be a responsive array or object\n value = getStyleValue({\n propKey,\n tokens,\n value: getValueAtCurrentBreakpoint({\n values,\n breakpoint,\n breakpoints,\n }),\n });\n }\n style = {\n ...style,\n [reactStyleProp]: value,\n };\n }\n else if (typeof props[propKey] !== 'undefined') {\n nonStyleProps[propKey] = props[propKey];\n }\n });\n return { propStyles: style, nonStyleProps };\n};\nconst useStyles = (props, style) => {\n const { breakpoints: { values: breakpoints, defaultBreakpoint }, tokens, } = useTheme();\n const breakpoint = useBreakpoint({\n breakpoints,\n defaultBreakpoint,\n });\n const propStyles = useTransformStyleProps(props);\n return React.useMemo(() => convertStylePropsToStyleObj({\n props: propStyles,\n style,\n breakpoint,\n breakpoints,\n tokens,\n }), [propStyles, style, breakpoints, breakpoint, tokens]);\n};\n\nexport { convertGridSpan, convertStylePropsToStyleObj, getGridSpan, isSpanPrimitiveValue, useStyles, useTransformStyleProps };\n", "/**\n * @internal May be removed in a future version\n * Maps from component style props to React `style` props\n * Note: Primarily needed to map from component style props that don't match CSS Properties directly\n * such as wrap => flexWrap and direction => flexDirection\n */\nconst ComponentPropsToStylePropsMap = {\n alignContent: 'alignContent',\n alignItems: 'alignItems',\n alignSelf: 'alignSelf',\n area: 'gridArea',\n aspectRatio: 'aspectRatio',\n autoColumns: 'gridAutoColumns',\n autoFlow: 'gridAutoFlow',\n autoRows: 'gridAutoRows',\n backgroundColor: 'backgroundColor',\n backgroundImage: 'backgroundImage',\n basis: 'flexBasis',\n border: 'border',\n borderRadius: 'borderRadius',\n borderColor: 'borderColor',\n borderWidth: 'borderWidth',\n borderStyle: 'borderStyle',\n bottom: 'bottom',\n boxShadow: 'boxShadow',\n color: 'color',\n column: 'gridColumn',\n columnEnd: 'gridColumnEnd',\n columnGap: 'columnGap',\n columnSpan: 'gridColumn',\n columnStart: 'gridColumnStart',\n direction: 'flexDirection',\n display: 'display',\n flex: 'flex',\n fontFamily: 'fontFamily',\n fontSize: 'fontSize',\n fontStyle: 'fontStyle',\n fontWeight: 'fontWeight',\n gap: 'gap',\n grow: 'flexGrow',\n height: 'height',\n justifyContent: 'justifyContent',\n left: 'left',\n letterSpacing: 'letterSpacing',\n lineHeight: 'lineHeight',\n margin: 'margin',\n marginBlock: 'marginBlock',\n marginBlockEnd: 'marginBlockEnd',\n marginBlockStart: 'marginBlockStart',\n marginBottom: 'marginBlockEnd',\n marginInline: 'marginInline',\n marginInlineEnd: 'marginInlineEnd',\n marginInlineStart: 'marginInlineStart',\n marginLeft: 'marginInlineStart',\n marginRight: 'marginInlineEnd',\n marginTop: 'marginBlockStart',\n maxHeight: 'maxHeight',\n maxWidth: 'maxWidth',\n minHeight: 'minHeight',\n minWidth: 'minWidth',\n objectFit: 'objectFit',\n objectPosition: 'objectPosition',\n opacity: 'opacity',\n order: 'order',\n overflow: 'overflow',\n padding: 'padding',\n paddingBlock: 'paddingBlock',\n paddingBlockEnd: 'paddingBlockEnd',\n paddingBlockStart: 'paddingBlockStart',\n paddingBottom: 'paddingBlockEnd',\n paddingInline: 'paddingInline',\n paddingInlineEnd: 'paddingInlineEnd',\n paddingInlineStart: 'paddingInlineStart',\n paddingLeft: 'paddingInlineStart',\n paddingRight: 'paddingInlineEnd',\n paddingTop: 'paddingBlockStart',\n position: 'position',\n resize: 'resize',\n right: 'right',\n row: 'gridRow',\n rowEnd: 'gridRowEnd',\n rowGap: 'rowGap',\n rowSpan: 'gridRow',\n rowStart: 'gridRowStart',\n shrink: 'flexShrink',\n templateAreas: 'gridTemplateAreas',\n templateColumns: 'gridTemplateColumns',\n templateRows: 'gridTemplateRows',\n textAlign: 'textAlign',\n textDecoration: 'textDecoration',\n textTransform: 'textTransform',\n top: 'top',\n transform: 'transform',\n transformOrigin: 'transformOrigin',\n width: 'width',\n whiteSpace: 'whiteSpace',\n wrap: 'flexWrap',\n};\n/**\n * @internal May be removed in a future version\n */\nconst ComponentPropsToStylePropsMapKeys = Object.keys(ComponentPropsToStylePropsMap);\n\nexport { ComponentPropsToStylePropsMap, ComponentPropsToStylePropsMapKeys };\n", "import { defaultTheme } from '@aws-amplify/ui';\nimport { objectKeys } from '../utils.mjs';\n\nconst getClosestValueByBreakpoint = ({ breakpoint, breakpoints, values, }) => {\n const value = values[breakpoint];\n // Check if breakpoint exists in values\n if (value !== undefined) {\n return value;\n }\n // Otherwise use a lower breakpoint value\n const breakpointsDesc = objectKeys(breakpoints).sort((a, b) => breakpoints[b] - breakpoints[a]);\n const lowerBreakpoints = breakpointsDesc.slice(breakpointsDesc.indexOf(breakpoint));\n for (const breakpoint of lowerBreakpoints) {\n // Check if breakpoint exists in values\n const value = values[breakpoint];\n if (value !== undefined) {\n return value;\n }\n }\n return null;\n};\n/**\n * This takes an object and will return an object that only has the\n * breakpoint keys\n * @param obj\n * @returns\n */\nconst valueObjToBreakpoints = (obj) => {\n return objectKeys(obj).reduce((acc, key) => key in defaultTheme.breakpoints.values\n ? { ...acc, [key]: obj[key] }\n : acc, {});\n};\nconst getValueAtCurrentBreakpoint = ({ breakpoint, breakpoints, values, }) => {\n let breakpointCompatValues = {};\n const breakpointsAscending = objectKeys(breakpoints).sort((a, b) => breakpoints[a] - breakpoints[b]);\n if (Array.isArray(values)) {\n values.forEach((value, index) => {\n breakpointCompatValues[breakpointsAscending[index]] = value;\n });\n }\n else if (typeof values === 'object') {\n breakpointCompatValues = valueObjToBreakpoints(values);\n }\n return getClosestValueByBreakpoint({\n breakpoint,\n breakpoints,\n values: breakpointCompatValues,\n });\n};\n\nexport { getValueAtCurrentBreakpoint };\n", "import { isDesignToken, cssNameTransform } from '@aws-amplify/ui';\nexport { classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { isThemeStylePropKey } from '../types/theme.mjs';\nimport { stylePropsToThemeKeys } from './constants.mjs';\n\nconst strHasLength = (str) => typeof str === 'string' && str.length > 0;\nconst isEmptyString = (value) => typeof value === 'string' && value.length === 0;\nconst isNullOrEmptyString = (value) => value == null || isEmptyString(value);\n/**\n * Create a consecutive integer array from start value to end value.\n * @param start start value\n * @param end end value\n * @returns an integer array with elements from start to end consecutively\n */\nconst getConsecutiveIntArray = (start, end) => {\n const length = end - start + 1;\n return Array.from({ length }, (_, idx) => idx + start);\n};\n/**\n * TS helper function to make using Object.keys more typesafe\n */\nconst objectKeys = (obj) => {\n return Object.keys(obj);\n};\nconst getCSSVariableIfValueIsThemeKey = (propKey, value, tokens) => {\n if (typeof value !== 'string') {\n return value;\n }\n // For shorthand properties like `padding` which can accept 1, 2, 3, or 4 values\n // run this function on each value. This would not work on CSS shorthands that\n // mix types, like border which is a composite of borderWidth, borderStyle, and\n // borderColor.\n if (value.includes(' ')) {\n return value\n .split(' ')\n .map((val) => getCSSVariableIfValueIsThemeKey(propKey, val, tokens))\n .join(' ');\n }\n if (isThemeStylePropKey(propKey)) {\n const path = value.split('.');\n const tokenKey = stylePropsToThemeKeys[propKey];\n let tokenProps = tokens[tokenKey];\n for (let i = 0; i < path.length; i++) {\n if (tokenProps) {\n // overwrite tokenProps with next nested value of tokenProps\n tokenProps = tokenProps[path[i]];\n continue;\n }\n break;\n }\n return isDesignToken(tokenProps)\n ? `var(--${cssNameTransform({\n path: [stylePropsToThemeKeys[propKey], ...path],\n })})`\n : value;\n }\n return value;\n};\n\nexport { getCSSVariableIfValueIsThemeKey, getConsecutiveIntArray, isEmptyString, isNullOrEmptyString, objectKeys, strHasLength };\n", "import { stylePropsToThemeKeys } from '../shared/constants.mjs';\n\nconst isThemeStylePropKey = (key) => {\n return key in stylePropsToThemeKeys;\n};\n\nexport { isThemeStylePropKey };\n", "// For internal use, no need to export\nconst ComponentText = {\n Alert: {\n dismissButtonLabel: 'Dismiss alert',\n },\n Autocomplete: {\n emptyText: 'No options found',\n loadingText: 'Loading options...',\n },\n Collection: {\n searchButtonLabel: 'Search',\n searchNoResultsFound: 'No results found',\n },\n Fields: {\n clearButtonLabel: 'Clear input',\n },\n Message: {\n dismissLabel: 'Dismiss message',\n },\n PaginationItem: {\n currentPageLabel: 'Page',\n nextLabel: 'Go to next page',\n pageLabel: 'Go to page',\n previousLabel: 'Go to previous page',\n },\n PhoneNumberField: {\n countryCodeLabel: 'Country code',\n },\n SearchField: {\n searchButtonLabel: 'Search',\n },\n PasswordField: {\n passwordIsHidden: 'Password is hidden',\n passwordIsShown: 'Password is shown',\n showPassword: 'Show password',\n },\n StepperField: {\n increaseButtonLabel: 'Increase to',\n decreaseButtonLabel: 'Decrease to',\n },\n};\nconst stylePropsToThemeKeys = {\n backgroundColor: 'colors',\n borderColor: 'colors',\n borderWidth: 'borderWidths',\n color: 'colors',\n borderRadius: 'radii',\n fontSize: 'fontSizes',\n fontWeight: 'fontWeights',\n fontFamily: 'fonts',\n lineHeight: 'lineHeights',\n opacity: 'opacities',\n boxShadow: 'shadows',\n transform: 'transforms',\n left: 'space',\n right: 'space',\n top: 'space',\n bottom: 'space',\n height: 'space',\n width: 'space',\n letterSpacing: 'space',\n margin: 'space',\n marginBlock: 'space',\n marginBlockEnd: 'space',\n marginBlockStart: 'space',\n marginInline: 'space',\n marginInlineEnd: 'space',\n marginInlineStart: 'space',\n marginLeft: 'space',\n marginRight: 'space',\n marginTop: 'space',\n marginBottom: 'space',\n maxHeight: 'space',\n maxWidth: 'space',\n minHeight: 'space',\n minWidth: 'space',\n padding: 'space',\n paddingBlock: 'space',\n paddingBlockEnd: 'space',\n paddingBlockStart: 'space',\n paddingInline: 'space',\n paddingInlineEnd: 'space',\n paddingInlineStart: 'space',\n paddingLeft: 'space',\n paddingRight: 'space',\n paddingTop: 'space',\n paddingBottom: 'space',\n gap: 'space',\n columnGap: 'space',\n rowGap: 'space',\n};\n// key name\nconst ESCAPE_KEY = 'Escape';\nconst ENTER_KEY = 'Enter';\nconst ARROW_UP = 'ArrowUp';\nconst ARROW_DOWN = 'ArrowDown';\n\nexport { ARROW_DOWN, ARROW_UP, ComponentText, ENTER_KEY, ESCAPE_KEY, stylePropsToThemeKeys };\n", "import * as React from 'react';\nimport { getMediaQueries } from './getMediaQueries.mjs';\n\n// Inspiration for getMediaQueries and useBreakpoint\n// comes from https://github.com/iiroj/use-breakpoint/\nconst useIsomorphicEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\nconst useBreakpoint = ({ breakpoints, defaultBreakpoint, }) => {\n const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';\n const matchMedia = supportMatchMedia ? window.matchMedia : null;\n const mediaQueries = React.useMemo(() => getMediaQueries({ breakpoints }), [breakpoints]);\n const [breakpoint, setBreakpoint] = React.useState(defaultBreakpoint);\n const updateBreakpoint = React.useCallback((matches, breakpoint) => {\n if (matches) {\n setBreakpoint(breakpoint);\n }\n }, [setBreakpoint]);\n useIsomorphicEffect(() => {\n if (!matchMedia)\n return;\n const unsubscribeList = mediaQueries.map(({ query, breakpoint }) => {\n const queryList = matchMedia(query);\n updateBreakpoint(queryList.matches, breakpoint);\n const handleMediaChange = (event) => {\n if (event.matches) {\n setBreakpoint(breakpoint);\n }\n };\n queryList.addEventListener('change', handleMediaChange);\n return () => queryList.removeEventListener('change', handleMediaChange);\n });\n return () => {\n unsubscribeList.forEach((unsubscribe) => unsubscribe());\n };\n }, [breakpoints, setBreakpoint, matchMedia, mediaQueries]);\n /** Print a nice debug value for React Devtools */\n React.useDebugValue(breakpoint, (breakpoint) => breakpoint);\n return breakpoint;\n};\n\nexport { useBreakpoint };\n", "import { objectKeys } from '../utils.mjs';\n\n// Inspiration for getMediaQueries and useBreakpoint\n// comes from https://github.com/iiroj/use-breakpoint/\nconst getMediaQueries = ({ breakpoints }) => {\n const sortedBreakpoints = objectKeys(breakpoints).sort((a, b) => breakpoints[b] - breakpoints[a]);\n return sortedBreakpoints.map((breakpoint, index) => {\n let query = '';\n const minWidth = breakpoints[breakpoint];\n const nextBreakpoint = sortedBreakpoints[index - 1];\n const maxWidth = nextBreakpoint ? breakpoints[nextBreakpoint] - 1 : null;\n if (minWidth >= 0) {\n query = `(min-width: ${minWidth}px)`;\n }\n if (maxWidth !== null) {\n if (query) {\n query += ' and ';\n }\n query += `(max-width: ${maxWidth}px)`;\n }\n return {\n breakpoint,\n query,\n maxWidth,\n minWidth,\n };\n });\n};\n\nexport { getMediaQueries };\n", "import * as React from 'react';\nimport { createTheme } from '@aws-amplify/ui';\nimport { ThemeContext } from '../components/ThemeProvider/ThemeContext.mjs';\n\n/**\n * Get current Theme object value from Amplify context.\n * Returns a default theme if context is not available\n */\nconst getThemeFromContext = (context) => {\n if (typeof context === 'undefined' || typeof context.theme === 'undefined') {\n return createTheme();\n }\n return context.theme;\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/theming)\n */\nconst useTheme = () => {\n const context = React.useContext(ThemeContext);\n return getThemeFromContext(context);\n};\n/**\n * Internal use only\n */\nconst useColorMode = () => {\n const context = React.useContext(ThemeContext);\n return context.colorMode;\n};\n\nexport { getThemeFromContext, useColorMode, useTheme };\n", "import { isDesignToken, isString } from '@aws-amplify/ui';\nimport { getCSSVariableIfValueIsThemeKey } from './utils.mjs';\n\n/**\n * This takes an unknown value, which could be a:\n * - design token: `color={tokens.colors.font.primary}`\n * - string, which could be a:\n * - theme key: `color='font.primary'`\n * - plain style: `color='red'`\n * - or a number: `padding={10}`\n * and returns the appropriate and resolved value\n */\nconst getStyleValue = ({ value, propKey, tokens, }) => {\n if (isDesignToken(value)) {\n return value.toString();\n }\n if (isString(value)) {\n return isString(propKey)\n ? getCSSVariableIfValueIsThemeKey(propKey, value, tokens)\n : value;\n }\n return null;\n};\n\nexport { getStyleValue };\n", "import * as React from 'react';\n\n/**\n * Updates the return type for primitives wrapped in `React.forwardRef` to\n * `React.ReactElement`. In React 18 the return type of `React.ExoticComponent`\n * was changed from `React.ReactElement` to `React.ReactNode`, which breaks\n * clients using React 16 and 17.\n *\n * @param primitive UI Primitive to be wrapped with `React.forwardRef`\n * @returns ForwaredRef wrapped UI Primitive\n */\nconst primitiveWithForwardRef = (primitive) => React.forwardRef(primitive);\n\nexport { primitiveWithForwardRef };\n", "import * as React from 'react';\n\nconst IconsContext = React.createContext({});\n\nexport { IconsContext };\n", "import * as React from 'react';\nimport { IconsContext } from './IconsContext.mjs';\n\nfunction useIcons(component) {\n const context = React.useContext(IconsContext);\n if (component && context) {\n return context[component];\n }\n return undefined;\n}\n\nexport { useIcons };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconCheckCircle = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconCheckCircle };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconError = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V15H13V17ZM13 13H11V7H13V13Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconError };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconInfo = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M11 7H13V9H11V7ZM11 11H13V17H11V11ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconInfo };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconWarning = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M1 21H23L12 2L1 21ZM13 18H11V16H13V18ZM13 14H11V10H13V14Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconWarning };\n", "import * as React from 'react';\nimport { useLayoutEffect } from './useLayoutEffect.mjs';\n\n// Adapted from https://github.com/radix-ui/primitives/blob/main/packages/react/id/src/id.tsx#L8\n// Prefixed autogenerated id created by useStableId\nconst AUTO_GENERATED_ID_PREFIX = 'amplify-id';\n// Create a local version of React.useId which will reference React.useId for React 18\n// and fallback to noop for React 17 and below\n// Note: We use `toString()` to prevent bundlers from trying to `import { useId } from 'react';`\n// since it doesn't exist in React 17 and below (prevents https://github.com/aws-amplify/amplify-ui/issues/1154)\nconst useReactId = \n// disable eslint below to allow usage of casting React to `any`, which ensures that TS\n// does not get confused about the existence of `useId` in React 17 and below\n// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\nReact['useId'.toString()] || (() => undefined);\nlet count = 0;\n/**\n * Create a uuid to use with amplify fields unless\n * an id is provided\n * @param id user specified id\n * @returns string\n */\nconst useStableId = (id) => {\n const [stableId, setStableId] = React.useState(useReactId());\n // React versions older than 18 will have client-side ids only\n useLayoutEffect(() => {\n if (!id) {\n setStableId((reactId) => reactId ?? String(count++));\n }\n }, [id]);\n return id ?? (stableId ? `${AUTO_GENERATED_ID_PREFIX}-${stableId}` : '');\n};\n\nexport { AUTO_GENERATED_ID_PREFIX, useStableId };\n", "import * as React from 'react';\n\n// Source: https://github.com/radix-ui/primitives/blob/7ae63b6cce6ea53ea5d65b6d411894c004b38f47/packages/react/use-layout-effect/src/useLayoutEffect.tsx\n/**\n * On the server, React emits a warning when calling `useLayoutEffect`.\n * This is because neither `useLayoutEffect` nor `useEffect` run on the server.\n * We use this safe version which suppresses the warning by replacing it with a noop on the server.\n *\n * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect\n */\nconst useLayoutEffect = globalThis?.document ? React.useLayoutEffect : () => { };\n\nexport { useLayoutEffect };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\nimport { useFieldset } from '../Fieldset/useFieldset.mjs';\nimport { Flex } from '../Flex/Flex.mjs';\nimport { Loader } from '../Loader/Loader.mjs';\nimport { View } from '../View/View.mjs';\n\n// These variations support colorThemes. 'undefined' accounts for our\n// 'default' variation which is not named.\nconst supportedVariations = ['link', 'primary', undefined];\nconst ButtonPrimitive = ({ className, children, colorTheme, isFullWidth = false, isDisabled, isLoading, loadingText = '', size, type = 'button', variation, ...rest }, ref) => {\n // Creates our colorTheme modifier string based on if the variation\n // supports colorThemes and a colorTheme is used.\n const colorThemeModifier = supportedVariations.includes(variation) && colorTheme\n ? `${variation ?? 'outlined'}--${colorTheme}`\n : undefined;\n const { isFieldsetDisabled } = useFieldset();\n const shouldBeDisabled = isFieldsetDisabled\n ? isFieldsetDisabled\n : isDisabled ?? isLoading ?? rest['disabled'];\n const componentClasses = classNames(ComponentClassName.Button, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Button, variation), classNameModifier(ComponentClassName.Button, colorThemeModifier), classNameModifier(ComponentClassName.Button, size), classNameModifierByFlag(ComponentClassName.Button, 'disabled', shouldBeDisabled), classNameModifierByFlag(ComponentClassName.Button, 'loading', isLoading), classNameModifierByFlag(ComponentClassName.Button, 'fullwidth', isFullWidth), className);\n return (React.createElement(View, { ref: ref, as: \"button\", className: componentClasses, isDisabled: shouldBeDisabled, type: type, ...rest }, isLoading ? (React.createElement(Flex, { as: \"span\", className: ComponentClassName.ButtonLoaderWrapper },\n React.createElement(Loader, { size: size }),\n loadingText ? loadingText : null)) : (children)));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/button)\n */\nconst Button = primitiveWithForwardRef(ButtonPrimitive);\nButton.displayName = 'Button';\n\nexport { Button };\n", "import * as React from 'react';\n\nconst FieldsetContext = React.createContext({\n isFieldsetDisabled: false,\n});\n/**\n * @description Fieldsets in HTML can be disabled, which disables all child\n * fieldsets and input controls. `useFieldset` passes the disabled state down\n * via context.\n */\nconst useFieldset = () => React.useContext(FieldsetContext);\n\nexport { FieldsetContext, useFieldset };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst FlexPrimitive = ({ className, children, ...rest }, ref) => (React.createElement(View, { className: classNames(ComponentClassName.Flex, className), ref: ref, ...rest }, children));\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/flex)\n */\nconst Flex = primitiveWithForwardRef(FlexPrimitive);\nFlex.displayName = 'Flex';\n\nexport { Flex };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst LINEAR_EMPTY = 'linear-empty';\nconst LINEAR_FILLED = 'linear-filled';\nconst CIRCULAR_EMPTY = 'circular-empty';\nconst CIRCULAR_FILLED = 'circular-filled';\n// radius + strokeWidth = 50\nconst CIRCULAR_STROKE_WIDTH = 8;\nconst RADIUS = 42;\n// circumference = 2 * r * PI (r = 42)\nconst CIRCUMFERENCE = 2 * RADIUS * Math.PI;\nconst LoaderPrimitive = ({ className, filledColor, emptyColor, size, variation, isDeterminate = false, isPercentageTextHidden = false, percentage = 0, ...rest }, ref) => {\n percentage = Math.min(percentage, 100);\n percentage = Math.max(percentage, 0);\n const percent = `${percentage}%`;\n const componentClasses = classNames(ComponentClassName.Loader, classNameModifier(ComponentClassName.Loader, size), classNameModifier(ComponentClassName.Loader, variation), classNameModifierByFlag(ComponentClassName.Loader, 'determinate', isDeterminate), className);\n const linearLoader = (React.createElement(\"g\", null,\n React.createElement(\"line\", { x1: \"0\", x2: \"100%\", y1: \"50%\", y2: \"50%\", style: { stroke: String(emptyColor) }, \"data-testid\": LINEAR_EMPTY }),\n React.createElement(\"line\", { x1: \"0\", x2: isDeterminate ? percent : '100%', y1: \"50%\", y2: \"50%\", style: {\n // To get rid of the visible stroke linecap when percentage is 0\n stroke: isDeterminate && percentage === 0\n ? 'none'\n : filledColor\n ? String(filledColor)\n : undefined,\n }, \"data-testid\": LINEAR_FILLED }),\n isDeterminate ? (React.createElement(\"text\", { \"aria-live\": \"polite\", className: classNames(ComponentClassName.LoaderLabel, isPercentageTextHidden ? ComponentClassName.VisuallyHidden : null), \n // -1% offset makes the text position look nicest\n x: `${-1 + percentage}%`, y: \"200%\" }, percent)) : null));\n // r + stroke-width should add up to 50% to avoid overflow\n const circularLoader = (React.createElement(\"g\", null,\n React.createElement(\"circle\", { cx: \"50%\", cy: \"50%\", r: `${RADIUS}%`, strokeWidth: `${CIRCULAR_STROKE_WIDTH}%`, style: { stroke: String(emptyColor) }, \"data-testid\": CIRCULAR_EMPTY }),\n React.createElement(\"circle\", { cx: \"50%\", cy: \"50%\", r: `${RADIUS}%`, strokeWidth: `${CIRCULAR_STROKE_WIDTH}%`, style: {\n stroke: String(filledColor),\n strokeDasharray: isDeterminate\n ? `${CIRCUMFERENCE}% ${CIRCUMFERENCE}%`\n : undefined,\n strokeDashoffset: isDeterminate\n ? `${CIRCUMFERENCE - (CIRCUMFERENCE * percentage) / 100}%`\n : undefined,\n }, \"data-testid\": CIRCULAR_FILLED }),\n isDeterminate ? (React.createElement(\"text\", { \"aria-live\": \"polite\", className: classNames(ComponentClassName.LoaderLabel, isPercentageTextHidden ? ComponentClassName.VisuallyHidden : null), \n // this x and y make text position look nicest\n x: \"130%\", y: \"80%\" }, percent)) : null));\n return (React.createElement(View, { as: \"svg\", className: componentClasses, ref: ref, role: \"img\", ...rest }, variation === 'linear' ? linearLoader : circularLoader));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/loader)\n */\nconst Loader = primitiveWithForwardRef(LoaderPrimitive);\nLoader.displayName = 'Loader';\n\nexport { CIRCULAR_EMPTY, CIRCULAR_FILLED, CIRCULAR_STROKE_WIDTH, CIRCUMFERENCE, LINEAR_EMPTY, LINEAR_FILLED, Loader, RADIUS };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconClose = (props) => {\n const { className, size, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: size ?? '1em', height: size ?? '1em', className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", style: size ? { width: size, height: size } : undefined },\n React.createElement(\"path\", { d: \"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconClose };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { Text } from '../Text/Text.mjs';\n\nconst QA_FIELD_DESCRIPTION = 'qa-field-description';\nconst FieldDescription = ({ descriptiveText, labelHidden, ...rest }) => descriptiveText ? (React.createElement(Text, { \"data-testid\": QA_FIELD_DESCRIPTION, className: classNames(ComponentClassName.FieldDescription, {\n [ComponentClassName.VisuallyHidden]: labelHidden,\n }), ...rest }, descriptiveText)) : null;\nFieldDescription.displayName = 'FieldDescription';\n\nexport { FieldDescription, QA_FIELD_DESCRIPTION };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst TextPrimitive = ({ as = 'p', className, children, isTruncated, variation, ...rest }, ref) => {\n const componentClasses = classNames(ComponentClassName.Text, classNameModifier(ComponentClassName.Text, variation), classNameModifierByFlag(ComponentClassName.Text, 'truncated', isTruncated), className);\n return (React.createElement(View, { as: as, className: componentClasses, ref: ref, ...rest }, children));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/text)\n */\nconst Text = primitiveWithForwardRef(TextPrimitive);\nText.displayName = 'Text';\n\nexport { Text };\n", "import * as React from 'react';\nimport { Text } from '../Text/Text.mjs';\nimport { ComponentClassName } from '@aws-amplify/ui';\n\nconst FieldErrorMessage = ({ errorMessage, hasError, ...rest }) => {\n return hasError && errorMessage ? (React.createElement(Text, { className: ComponentClassName.FieldErrorMessage, ...rest }, errorMessage)) : null;\n};\nFieldErrorMessage.displayName = 'FieldErrorMessage';\n\nexport { FieldErrorMessage };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst LabelPrimitive = ({ children, className, visuallyHidden, ...rest }, ref) => {\n return (React.createElement(View, { as: \"label\", className: classNames(ComponentClassName.Label, className, {\n [ComponentClassName.VisuallyHidden]: visuallyHidden,\n }), ref: ref, ...rest }, children));\n};\nconst Label = primitiveWithForwardRef(LabelPrimitive);\nLabel.displayName = 'Label';\n\nexport { Label };\n", "import * as React from 'react';\nimport { isFunction, classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';\nimport { ComponentText } from '../shared/constants.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\nimport { View } from '../View/View.mjs';\nimport { Flex } from '../Flex/Flex.mjs';\nimport { Button } from '../Button/Button.mjs';\nimport { AlertIcon } from './AlertIcon.mjs';\nimport '../Icon/Icon.mjs';\nimport '../Icon/context/IconsContext.mjs';\nimport { useIcons } from '../Icon/context/useIcons.mjs';\nimport { IconClose } from '../Icon/icons/IconClose.mjs';\n\nconst AlertPrimitive = ({ buttonRef, children, className, dismissButtonLabel = ComponentText.Alert.dismissButtonLabel, hasIcon = true, heading, isDismissible = false, onDismiss, variation, ...rest }, ref) => {\n const [dismissed, setDismissed] = React.useState(false);\n const icons = useIcons('alert');\n const dismissAlert = React.useCallback(() => {\n setDismissed(!dismissed);\n if (isFunction(onDismiss)) {\n onDismiss();\n }\n }, [setDismissed, onDismiss, dismissed]);\n return !dismissed ? (React.createElement(Flex, { className: classNames(ComponentClassName.Alert, className, classNameModifier(ComponentClassName.Alert, variation)), ref: ref, role: \"alert\", ...rest },\n hasIcon && React.createElement(AlertIcon, { variation: variation, ariaHidden: true }),\n React.createElement(View, { flex: \"1\" },\n heading && (React.createElement(View, { className: ComponentClassName.AlertHeading }, heading)),\n React.createElement(View, { className: ComponentClassName.AlertBody }, children)),\n isDismissible && (React.createElement(Button, { ariaLabel: dismissButtonLabel, variation: \"link\", className: ComponentClassName.AlertDismiss, onClick: dismissAlert, ref: buttonRef }, icons?.close ?? React.createElement(IconClose, { \"aria-hidden\": \"true\" }))))) : null;\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/alert)\n */\nconst Alert = primitiveWithForwardRef(AlertPrimitive);\nAlert.displayName = 'Alert';\n\nexport { Alert };\n", "const getUniqueComponentId = (id, suffix) => (id && suffix ? `${id}-${suffix}` : undefined);\n\nexport { getUniqueComponentId };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';\nimport '../Field/FieldClearButton.mjs';\nimport { FieldDescription } from '../Field/FieldDescription.mjs';\nimport { FieldErrorMessage } from '../Field/FieldErrorMessage.mjs';\nimport '../Field/Field.mjs';\nimport { FieldGroup } from '../FieldGroup/FieldGroup.mjs';\nimport { Flex } from '../Flex/Flex.mjs';\nimport { Input } from '../Input/Input.mjs';\nimport { Label } from '../Label/Label.mjs';\nimport { splitPrimitiveProps } from '../utils/splitPrimitiveProps.mjs';\nimport { useStableId } from '../utils/useStableId.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\nimport { createSpaceSeparatedIds } from '../utils/createSpaceSeparatedIds.mjs';\nimport { DESCRIPTION_SUFFIX, ERROR_SUFFIX } from '../../helpers/constants.mjs';\nimport { getUniqueComponentId } from '../utils/getUniqueComponentId.mjs';\n\nconst TextFieldPrimitive = (props, ref) => {\n const { className, descriptiveText, errorMessage, hasError = false, id, innerEndComponent, innerStartComponent, label, labelHidden = false, outerEndComponent, outerStartComponent, size, testId, variation, inputStyles, ..._rest } = props;\n const fieldId = useStableId(id);\n const stableId = useStableId();\n const descriptionId = descriptiveText\n ? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)\n : undefined;\n const errorId = hasError\n ? getUniqueComponentId(stableId, ERROR_SUFFIX)\n : undefined;\n const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);\n const { styleProps, rest } = splitPrimitiveProps(_rest);\n return (React.createElement(Flex, { className: classNames(ComponentClassName.Field, classNameModifier(ComponentClassName.Field, size), ComponentClassName.TextField, className), testId: testId, ...styleProps },\n React.createElement(Label, { htmlFor: fieldId, visuallyHidden: labelHidden }, label),\n React.createElement(FieldDescription, { id: descriptionId, labelHidden: labelHidden, descriptiveText: descriptiveText }),\n React.createElement(FieldGroup, { outerStartComponent: outerStartComponent, outerEndComponent: outerEndComponent, innerStartComponent: innerStartComponent, innerEndComponent: innerEndComponent, variation: variation },\n React.createElement(Input, { \"aria-describedby\": ariaDescribedBy, hasError: hasError, id: fieldId, ref: ref, size: size, variation: variation, ...inputStyles, ...rest })),\n React.createElement(FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/textfield)\n */\nconst TextField = primitiveWithForwardRef(TextFieldPrimitive);\nTextField.displayName = 'TextField';\n\nexport { TextField };\n", "import * as React from 'react';\nimport { ComponentClassName, classNames, classNameModifier } from '@aws-amplify/ui';\nimport { Flex } from '../Flex/Flex.mjs';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst FieldGroupPrimitive = ({ children, className, innerEndComponent, innerStartComponent, orientation = 'horizontal', outerEndComponent, outerStartComponent, variation, ...rest }, ref) => {\n // Don't apply hasInner classnames unless a component was provided\n const hasInnerStartComponent = innerStartComponent != null;\n const hasInnerEndComponent = innerEndComponent != null;\n const fieldGroupHasInnerStartClassName = hasInnerStartComponent\n ? ComponentClassName.FieldGroupHasInnerStart\n : null;\n const fieldGroupHasInnerEndClassName = hasInnerEndComponent\n ? ComponentClassName.FieldGroupHasInnerEnd\n : null;\n const componentClasses = classNames(ComponentClassName.FieldGroup, fieldGroupHasInnerStartClassName, fieldGroupHasInnerEndClassName, classNameModifier(ComponentClassName.FieldGroup, orientation), className);\n return (React.createElement(Flex, { className: componentClasses, ref: ref, ...rest },\n outerStartComponent && (React.createElement(View, { className: classNames(ComponentClassName.FieldGroupOuterStart, classNameModifier(ComponentClassName.FieldGroupOuterStart, variation)) }, outerStartComponent)),\n React.createElement(View, { className: classNames(ComponentClassName.FieldGroupFieldWrapper, classNameModifier(ComponentClassName.FieldGroupFieldWrapper, orientation)) },\n innerStartComponent && (React.createElement(View, { className: ComponentClassName.FieldGroupInnerStart }, innerStartComponent)),\n children,\n innerEndComponent && (React.createElement(View, { className: ComponentClassName.FieldGroupInnerEnd }, innerEndComponent))),\n outerEndComponent && (React.createElement(View, { className: classNames(ComponentClassName.FieldGroupOuterEnd, classNameModifier(ComponentClassName.FieldGroupOuterEnd, variation)) }, outerEndComponent))));\n};\nconst FieldGroup = primitiveWithForwardRef(FieldGroupPrimitive);\nFieldGroup.displayName = 'FieldGroup';\n\nexport { FieldGroup };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { useFieldset } from '../Fieldset/useFieldset.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst InputPrimitive = ({ autoComplete, checked, className, defaultChecked, defaultValue, id, isDisabled, isReadOnly, isRequired, size, type = 'text', hasError = false, value, variation, ...rest }, ref) => {\n const componentClasses = classNames(ComponentClassName.Input, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Input, variation), classNameModifierByFlag(ComponentClassName.Input, 'error', hasError), classNameModifier(ComponentClassName.Input, size), className);\n const { isFieldsetDisabled } = useFieldset();\n return (React.createElement(View, { \"aria-invalid\": hasError, as: \"input\", autoComplete: autoComplete, checked: checked, className: componentClasses, defaultChecked: defaultChecked, defaultValue: defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, id: id, readOnly: isReadOnly, ref: ref, required: isRequired, type: type, value: value, ...rest }));\n};\nconst Input = primitiveWithForwardRef(InputPrimitive);\nInput.displayName = 'Input';\n\nexport { Input };\n", "import { ComponentPropsToStylePropsMap } from '../types/style.mjs';\n\nconst isStyleKey = (prop) => {\n return prop in ComponentPropsToStylePropsMap;\n};\n/**\n * This function splits props into style props and non-style props. This is used\n * on Field primitives so we can apply style props on the wrapper element and\n * the rest on the input.\n * @param props this should be a destructured `rest` from the component's props\n */\nconst splitPrimitiveProps = (props) => {\n const splitProps = {\n styleProps: {},\n rest: {},\n };\n Object.keys(props).forEach((prop) => {\n if (isStyleKey(prop)) {\n // we know it is a style key\n // so we know we can assign the key in styleProps\n splitProps.styleProps = {\n ...splitProps.styleProps,\n [prop]: props[prop],\n };\n }\n else {\n splitProps.rest = {\n ...splitProps.rest,\n [prop]: props[prop],\n };\n }\n });\n return splitProps;\n};\n\nexport { splitPrimitiveProps };\n", "/**\n * Joins an array of strings and undefined values into a single string with spaces as separators.\n * If all elements are undefined, returns undefined.\n *\n * @param {(string | undefined)[]} ids - An array of strings or undefined values.\n * @returns {string | undefined} A single string with space-separated IDs, or undefined if all elements are undefined.\n */\nconst createSpaceSeparatedIds = (ids) => {\n const joinedIds = ids.filter((id) => id !== undefined).join(' ');\n return joinedIds.length > 0 ? joinedIds : undefined;\n};\n\nexport { createSpaceSeparatedIds };\n", "import { isFunction } from '@aws-amplify/ui';\n\n(typeof Symbol !== 'undefined' && isFunction(Symbol.for)\n ? Symbol.for('amplify_default')\n : '@@amplify_default');\nconst ERROR_SUFFIX = 'error';\nconst DESCRIPTION_SUFFIX = 'description';\n\nexport { DESCRIPTION_SUFFIX, ERROR_SUFFIX };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst ImagePrimitive = ({ className, ...rest }, ref) => (React.createElement(View, { as: \"img\", ref: ref, className: classNames(ComponentClassName.Image, className), ...rest }));\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/image)\n */\nconst Image = primitiveWithForwardRef(ImagePrimitive);\nImage.displayName = 'Image';\n\nexport { Image };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst LinkPrimitive = ({ as = 'a', children, className, isExternal, ...rest }, ref) => {\n return (React.createElement(View, { as: as, className: classNames(ComponentClassName.Link, className), ref: ref, rel: isExternal ? 'noopener noreferrer' : undefined, target: isExternal ? '_blank' : undefined, ...rest }, children));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/link)\n */\nconst Link = primitiveWithForwardRef(LinkPrimitive);\nLink.displayName = 'Link';\n\nexport { Link };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst VisuallyHiddenPrimitive = ({ as = 'span', children, className, ...rest }, ref) => (React.createElement(View, { as: as, className: classNames(ComponentClassName.VisuallyHidden, className), ref: ref, ...rest }, children));\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/visuallyhidden)\n */\nconst VisuallyHidden = primitiveWithForwardRef(VisuallyHiddenPrimitive);\nVisuallyHidden.displayName = 'VisuallyHidden';\n\nexport { VisuallyHidden };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst GridPrimitive = ({ className, children, ...rest }, ref) => (React.createElement(View, { className: classNames(ComponentClassName.Grid, className), ref: ref, ...rest }, children));\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/grid)\n */\nconst Grid = primitiveWithForwardRef(GridPrimitive);\nGrid.displayName = 'Grid';\n\nexport { Grid };\n", "import { classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\nimport { View } from '../View/View.mjs';\n\nconst DividerPrimitive = ({ className, orientation = 'horizontal', size, label, ...rest }, ref) => {\n const componentClasses = classNames(ComponentClassName.Divider, classNameModifier(ComponentClassName.Divider, orientation), classNameModifier(ComponentClassName.Divider, size), className);\n return (React.createElement(View, { \"aria-orientation\": orientation, as: \"hr\", className: componentClasses, \"data-label\": label, ref: ref, ...rest }));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/divider)\n */\nconst Divider = primitiveWithForwardRef(DividerPrimitive);\nDivider.displayName = 'Divider';\n\nexport { Divider };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconExpandMore = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M16.59 8.58984L12 13.1698L7.41 8.58984L6 9.99984L12 15.9998L18 9.99984L16.59 8.58984Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconExpandMore };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier } from '@aws-amplify/ui';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\nimport { Flex } from '../Flex/Flex.mjs';\nimport { View } from '../View/View.mjs';\nimport { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.mjs';\nimport { useFieldset, FieldsetContext } from './useFieldset.mjs';\n\nconst FieldsetPrimitive = ({ children, className, isDisabled, legend, legendHidden, size, testId, variation = 'plain', ...rest }, ref) => {\n const { isFieldsetDisabled } = useFieldset();\n // Fieldsets that are nested within a disabled Fieldset should\n // also be disabled.\n const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;\n const value = React.useMemo(() => ({\n isFieldsetDisabled: shouldBeDisabled,\n }), [shouldBeDisabled]);\n const fieldsetClasses = classNames(ComponentClassName.Fieldset, classNameModifier(ComponentClassName.Fieldset, variation), classNameModifier(ComponentClassName.Fieldset, size), className);\n const legendClasses = classNames(ComponentClassName.FieldsetLegend, classNameModifier(ComponentClassName.FieldsetLegend, size), {\n [ComponentClassName.VisuallyHidden]: legendHidden,\n });\n return (React.createElement(FieldsetContext.Provider, { value: value },\n React.createElement(Flex, { as: \"fieldset\", className: fieldsetClasses, ref: ref, disabled: shouldBeDisabled, testId: testId, ...rest },\n React.createElement(VisuallyHidden, { as: \"legend\" }, legend),\n React.createElement(View, { as: \"div\", \"aria-hidden\": \"true\", className: legendClasses }, legend),\n children)));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/fieldset)\n */\nconst Fieldset = primitiveWithForwardRef(FieldsetPrimitive);\nFieldset.displayName = 'Fieldset';\n\nexport { Fieldset };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifier, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { View } from '../View/View.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst headingLevels = {\n 1: 'h1',\n 2: 'h2',\n 3: 'h3',\n 4: 'h4',\n 5: 'h5',\n 6: 'h6',\n};\nconst HeadingPrimitive = ({ className, children, isTruncated, level = 6, ...rest }, ref) => (React.createElement(View, { as: headingLevels[level], className: classNames(ComponentClassName.Heading, classNameModifier(ComponentClassName.Heading, level), classNameModifierByFlag(ComponentClassName.Heading, 'truncated', isTruncated), className), ref: ref, ...rest }, children));\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/heading)\n */\nconst Heading = primitiveWithForwardRef(HeadingPrimitive);\nHeading.displayName = 'Heading';\n\nexport { Heading };\n", "export {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n} from './Direction';\n", "import * as React from 'react';\n\ntype Direction = 'ltr' | 'rtl';\nconst DirectionContext = React.createContext(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode;\n dir: Direction;\n}\nconst DirectionProvider: React.FC = (props) => {\n const { dir, children } = props;\n return {children};\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || 'ltr';\n}\n\nconst Provider = DirectionProvider;\n\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n};\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { ShowPasswordButton } from './ShowPasswordButton.mjs';\nimport { TextField } from '../TextField/TextField.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst PasswordFieldPrimitive = ({ autoComplete = 'current-password', label, className, hideShowPassword = false, passwordIsHiddenLabel, passwordIsShownLabel, showPasswordButtonLabel, showPasswordButtonRef, size, hasError, ...rest }, ref) => {\n const [type, setType] = React.useState('password');\n const showPasswordOnClick = React.useCallback(() => {\n if (type === 'password') {\n setType('text');\n }\n else {\n setType('password');\n }\n }, [setType, type]);\n return (React.createElement(TextField, { autoComplete: autoComplete, outerEndComponent: hideShowPassword ? null : (React.createElement(ShowPasswordButton, { fieldType: type, onClick: showPasswordOnClick, passwordIsHiddenLabel: passwordIsHiddenLabel, passwordIsShownLabel: passwordIsShownLabel, ref: showPasswordButtonRef, size: size, showPasswordButtonLabel: showPasswordButtonLabel, hasError: hasError })), size: size, type: type, label: label, className: classNames(ComponentClassName.PasswordField, className), ref: ref, hasError: hasError, ...rest }));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/passwordfield)\n */\nconst PasswordField = primitiveWithForwardRef(PasswordFieldPrimitive);\nPasswordField.displayName = 'PasswordField';\n\nexport { PasswordField };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, classNameModifierByFlag } from '@aws-amplify/ui';\nimport { Button } from '../Button/Button.mjs';\nimport { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.mjs';\nimport { ComponentText } from '../shared/constants.mjs';\nimport '../Icon/Icon.mjs';\nimport '../Icon/context/IconsContext.mjs';\nimport { useIcons } from '../Icon/context/useIcons.mjs';\nimport '../View/View.mjs';\nimport { IconVisibilityOff } from '../Icon/icons/IconVisibilityOff.mjs';\nimport { IconVisibility } from '../Icon/icons/IconVisibility.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst { passwordIsHidden, passwordIsShown, showPassword } = ComponentText.PasswordField;\nconst ShowPasswordButtonPrimitive = ({ fieldType, passwordIsHiddenLabel = passwordIsHidden, passwordIsShownLabel = passwordIsShown, showPasswordButtonLabel = showPassword, size, hasError, ...rest }, ref) => {\n const icons = useIcons('passwordField');\n const showPasswordButtonClass = classNames(ComponentClassName.FieldShowPassword, classNameModifierByFlag(ComponentClassName.FieldShowPassword, 'error', hasError));\n const icon = fieldType === 'password'\n ? icons?.visibility ?? React.createElement(IconVisibility, { \"aria-hidden\": \"true\" })\n : icons?.visibilityOff ?? React.createElement(IconVisibilityOff, { \"aria-hidden\": \"true\" });\n return (React.createElement(Button, { \"aria-checked\": fieldType !== 'password', ariaLabel: showPasswordButtonLabel, className: showPasswordButtonClass, colorTheme: hasError ? 'error' : undefined, ref: ref, role: \"switch\", size: size, ...rest },\n React.createElement(VisuallyHidden, { \"aria-live\": \"polite\" }, fieldType === 'password'\n ? passwordIsHiddenLabel\n : passwordIsShownLabel),\n icon));\n};\nconst ShowPasswordButton = primitiveWithForwardRef(ShowPasswordButtonPrimitive);\nShowPasswordButton.displayName = 'ShowPasswordButton';\n\nexport { ShowPasswordButton };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconVisibilityOff = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M12 6.0002C15.79 6.0002 19.17 8.1302 20.82 11.5002C20.23 12.7202 19.4 13.7702 18.41 14.6202L19.82 16.0302C21.21 14.8002 22.31 13.2602 23 11.5002C21.27 7.1102 17 4.0002 12 4.0002C10.73 4.0002 9.51 4.2002 8.36 4.5702L10.01 6.2202C10.66 6.0902 11.32 6.0002 12 6.0002ZM10.93 7.14019L13 9.2102C13.57 9.4602 14.03 9.9202 14.28 10.4902L16.35 12.5602C16.43 12.2202 16.49 11.8602 16.49 11.4902C16.5 9.0102 14.48 7.0002 12 7.0002C11.63 7.0002 11.28 7.05019 10.93 7.14019ZM2.01 3.8702L4.69 6.5502C3.06 7.8302 1.77 9.5302 1 11.5002C2.73 15.8902 7 19.0002 12 19.0002C13.52 19.0002 14.98 18.7102 16.32 18.1802L19.74 21.6002L21.15 20.1902L3.42 2.4502L2.01 3.8702ZM9.51 11.3702L12.12 13.9802C12.08 13.9902 12.04 14.0002 12 14.0002C10.62 14.0002 9.5 12.8802 9.5 11.5002C9.5 11.4502 9.51 11.4202 9.51 11.3702V11.3702ZM6.11 7.97019L7.86 9.7202C7.63 10.2702 7.5 10.8702 7.5 11.5002C7.5 13.9802 9.52 16.0002 12 16.0002C12.63 16.0002 13.23 15.8702 13.77 15.6402L14.75 16.6202C13.87 16.8602 12.95 17.0002 12 17.0002C8.21 17.0002 4.83 14.8702 3.18 11.5002C3.88 10.0702 4.9 8.89019 6.11 7.97019Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconVisibilityOff };\n", "import { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport * as React from 'react';\nimport { View } from '../../View/View.mjs';\n\n/**\n * @internal For internal Amplify UI use only. May be removed in a future release.\n */\nconst IconVisibility = (props) => {\n const { className, ...rest } = props;\n return (React.createElement(View, { as: \"span\", width: \"1em\", height: \"1em\", className: classNames(ComponentClassName.Icon, className), ...rest },\n React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n React.createElement(\"path\", { d: \"M12 6C15.79 6 19.17 8.13 20.82 11.5C19.17 14.87 15.79 17 12 17C8.21 17 4.83 14.87 3.18 11.5C4.83 8.13 8.21 6 12 6ZM12 4C7 4 2.73 7.11 1 11.5C2.73 15.89 7 19 12 19C17 19 21.27 15.89 23 11.5C21.27 7.11 17 4 12 4ZM12 9C13.38 9 14.5 10.12 14.5 11.5C14.5 12.88 13.38 14 12 14C10.62 14 9.5 12.88 9.5 11.5C9.5 10.12 10.62 9 12 9ZM12 7C9.52 7 7.5 9.02 7.5 11.5C7.5 13.98 9.52 16 12 16C14.48 16 16.5 13.98 16.5 11.5C16.5 9.02 14.48 7 12 7Z\", fill: \"currentColor\" }))));\n};\n\nexport { IconVisibility };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName } from '@aws-amplify/ui';\nimport { DialCodeSelect } from './DialCodeSelect.mjs';\nimport { ComponentText } from '../shared/constants.mjs';\nimport { TextField } from '../TextField/TextField.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst PhoneNumberFieldPrimitive = ({ autoComplete = 'tel-national', className, defaultDialCode, dialCodeLabel = ComponentText.PhoneNumberField.countryCodeLabel, dialCodeList, dialCodeName, dialCodeRef, hasError, isDisabled, isReadOnly, onDialCodeChange, onInput, size, variation, ...rest }, ref) => {\n return (React.createElement(TextField, { outerStartComponent: React.createElement(DialCodeSelect, { defaultValue: defaultDialCode, dialCodeList: dialCodeList, className: className, hasError: hasError, isDisabled: isDisabled, isReadOnly: isReadOnly, label: dialCodeLabel, name: dialCodeName, onChange: onDialCodeChange, ref: dialCodeRef, size: size, variation: variation }), autoComplete: autoComplete, className: classNames(ComponentClassName.PhoneNumberField, className), hasError: hasError, isDisabled: isDisabled, isReadOnly: isReadOnly, onInput: onInput, ref: ref, size: size, type: \"tel\", variation: variation, ...rest }));\n};\n/**\n * [\uD83D\uDCD6 Docs](https://ui.docs.amplify.aws/react/components/phonenumberfield)\n */\nconst PhoneNumberField = primitiveWithForwardRef(PhoneNumberFieldPrimitive);\nPhoneNumberField.displayName = 'PhoneNumberField';\n\nexport { PhoneNumberField };\n", "import * as React from 'react';\nimport { classNames, ComponentClassName, countryDialCodes } from '@aws-amplify/ui';\nimport { SelectField } from '../SelectField/SelectField.mjs';\nimport { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';\n\nconst DialCodeSelectPrimitive = ({ className, dialCodeList, isReadOnly, ...props }, ref) => {\n const dialList = dialCodeList ?? countryDialCodes;\n const dialCodeOptions = React.useMemo(() => dialList.map((dialCode) => (\n // Regarding the `disabled` attribute, see comment in SelectField below\n React.createElement(\"option\", { key: dialCode, value: dialCode, disabled: isReadOnly }, dialCode))), [dialList, isReadOnly]);\n return (React.createElement(SelectField\n /*\n Since