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ACzB2B,UAAA,CACA,CACAb,KAAA,QACAC,aAAA,mBACApB,KAAA,OACA+B,KAAAhB,EACA3C,aAAA,gBAEA,CACA+C,KAAA,UACAC,aAAA,gBACApB,KAAA,SACA5B,aAAA,8CCpGA,SAAA6D,EAAAC,GACA,qEAA+CA,GAC/C,CACA,SAAAC,EAAAC,EAAAjB,EAAAkB,EAAA,WAEA,OAAAJ,EAAA,GAAgCG,KAAQjB,MADxCkB,EAAA3E,cAAA4E,QAAA,cAEA,CACA,SAAAC,EAAAC,EAAAH,EAAA,WACA,OAAAF,EAAA,aAAAK,EAAAH,EACA,CACA,SAAAI,EAAAC,EAAAL,EAAA,WACA,OAAAF,EAAA,YAAAO,EAAAL,EACA,CACA,SAAAM,EAAAC,EAAAP,EAAA,WACA,OAAAF,EAAA,YAAAS,EAAAP,EACA,CACA,SAAAQ,EAAAC,EAAAT,EAAA,WACA,OAAAF,EAAA,QAAAW,EAAAT,EACA","sources":["webpack://@logos/commerceweb-frontend/javascript/node_modules/uuid/dist/native.js","webpack://@logos/commerceweb-frontend/javascript/node_modules/uuid/dist/rng.js","webpack://@logos/commerceweb-frontend/javascript/node_modules/uuid/dist/stringify.js","webpack://@logos/commerceweb-frontend/javascript/node_modules/uuid/dist/v4.js","webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-QMTSAHE6.js","webpack://@logos/commerceweb-frontend/javascript/node_modules/lucide-react/dist/esm/icons/text-cursor-input.mjs","webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-NYDERNVO.js","webpack://@logos/commerceweb-frontend/./node_modules/@faithlife/commerce-components/dist/chunk-QJ7P73DS.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n    if (!getRandomValues) {\n        if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n            throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n        }\n        getRandomValues = crypto.getRandomValues.bind(crypto);\n    }\n    return getRandomValues(rnds8);\n}\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n    byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n    return (byteToHex[arr[offset + 0]] +\n        byteToHex[arr[offset + 1]] +\n        byteToHex[arr[offset + 2]] +\n        byteToHex[arr[offset + 3]] +\n        '-' +\n        byteToHex[arr[offset + 4]] +\n        byteToHex[arr[offset + 5]] +\n        '-' +\n        byteToHex[arr[offset + 6]] +\n        byteToHex[arr[offset + 7]] +\n        '-' +\n        byteToHex[arr[offset + 8]] +\n        byteToHex[arr[offset + 9]] +\n        '-' +\n        byteToHex[arr[offset + 10]] +\n        byteToHex[arr[offset + 11]] +\n        byteToHex[arr[offset + 12]] +\n        byteToHex[arr[offset + 13]] +\n        byteToHex[arr[offset + 14]] +\n        byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n    const uuid = unsafeStringify(arr, offset);\n    if (!validate(uuid)) {\n        throw TypeError('Stringified UUID is invalid');\n    }\n    return uuid;\n}\nexport default stringify;\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction _v4(options, buf, offset) {\n    options = options || {};\n    const rnds = options.random ?? options.rng?.() ?? rng();\n    if (rnds.length < 16) {\n        throw new Error('Random bytes length must be >= 16');\n    }\n    rnds[6] = (rnds[6] & 0x0f) | 0x40;\n    rnds[8] = (rnds[8] & 0x3f) | 0x80;\n    if (buf) {\n        offset = offset || 0;\n        if (offset < 0 || offset + 16 > buf.length) {\n            throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n        }\n        for (let i = 0; i < 16; ++i) {\n            buf[offset + i] = rnds[i];\n        }\n        return buf;\n    }\n    return unsafeStringify(rnds);\n}\nfunction v4(options, buf, offset) {\n    if (native.randomUUID && !buf && !options) {\n        return native.randomUUID();\n    }\n    return _v4(options, buf, offset);\n}\nexport default v4;\n","import {\n  Typography\n} from \"./chunk-P4MY4MXU.js\";\nimport {\n  cn\n} from \"./chunk-NZVMNINS.js\";\n\n// src/components/text-input/component.tsx\nimport React from \"react\";\nimport * as Form from \"@radix-ui/react-form\";\nimport { v4 as uuid } from \"uuid\";\nvar TextInput = ({\n  className,\n  id,\n  labelText,\n  inputType = \"text\",\n  placeholderText,\n  isRequired = false,\n  icon,\n  defaultValue,\n  errorMessages,\n  \"data-testid\": dataTestId,\n  ...props\n}) => {\n  const [generatedInputId, setGeneratedInputId] = React.useState(() => `${uuid()}-input`);\n  const inputRef = React.useRef(null);\n  const explicitId = id;\n  const inputId = explicitId ?? generatedInputId;\n  React.useEffect(() => {\n    if (explicitId == null && inputRef.current?.id) {\n      setGeneratedInputId(inputRef.current.id);\n    }\n  }, [explicitId]);\n  return /* @__PURE__ */ React.createElement(\n    Form.Field,\n    {\n      className: cn(\"tw-preflight group gap-sp8 flex flex-col\", className),\n      \"data-testid\": dataTestId,\n      ...props\n    },\n    labelText && /* @__PURE__ */ React.createElement(Form.Label, { htmlFor: inputId, suppressHydrationWarning: explicitId == null }, /* @__PURE__ */ React.createElement(\n      Typography,\n      {\n        variant: \"finePrint\",\n        className: \"group-data-[invalid]:text-error\"\n      },\n      `${labelText}${isRequired ? \" *\" : \"\"}`\n    )),\n    /* @__PURE__ */ React.createElement(\"div\", { className: \"gap-sp12 border-border-strong px-sp16 py-sp12 focus-within:border-focus focus-within:ring-focus hover:ring-foreground focus-within:hover:ring-focus focus-visible:ring-foreground group-data-[invalid]:border-error group-data-[invalid]:ring-error flex min-h-[48px] items-center rounded-lg border bg-white transition-colors group-data-[invalid]:ring-1 group-data-[invalid]:ring-inset focus-within:ring-1 focus-within:ring-inset hover:ring-1 hover:ring-inset focus-visible:ring-1 focus-visible:ring-inset motion-reduce:transition-none\" }, icon && /* @__PURE__ */ React.createElement(\"span\", { className: \"flex size-4 shrink-0 items-center justify-center\" }, icon), /* @__PURE__ */ React.createElement(Form.Control, { asChild: true, id: inputId }, /* @__PURE__ */ React.createElement(\n      \"input\",\n      {\n        ref: inputRef,\n        suppressHydrationWarning: explicitId == null,\n        className: \"text-fs16 bodyMd placeholder:text-foreground/33 min-w-0 flex-1 bg-transparent leading-none outline-none\",\n        type: inputType,\n        placeholder: placeholderText,\n        defaultValue,\n        required: isRequired\n      }\n    ))),\n    errorMessages?.map(({ match, message }) => /* @__PURE__ */ React.createElement(Form.Message, { key: match, match }, /* @__PURE__ */ React.createElement(Typography, { variant: \"finePrint\", className: \"text-error\" }, message)))\n  );\n};\nTextInput.displayName = \"TextInput\";\n\nexport {\n  TextInput\n};\n//# sourceMappingURL=chunk-QMTSAHE6.js.map","/**\n * @license lucide-react v1.27.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n  [\"path\", { d: \"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6\", key: \"1528k5\" }],\n  [\"path\", { d: \"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7\", key: \"13ksps\" }],\n  [\"path\", { d: \"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1\", key: \"1n9rhb\" }],\n  [\"path\", { d: \"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1\", key: \"1mj8rg\" }],\n  [\"path\", { d: \"M9 6v12\", key: \"velyjx\" }]\n];\nconst TextCursorInput = createLucideIcon(\"text-cursor-input\", __iconNode);\n\nexport { __iconNode, TextCursorInput as default };\n//# sourceMappingURL=text-cursor-input.mjs.map\n","import {\n  TextInput\n} from \"./chunk-QMTSAHE6.js\";\nimport {\n  lucideIconUri\n} from \"./chunk-BEFWWR2C.js\";\nimport {\n  getStorybookDocsUrlForAtom\n} from \"./chunk-QJ7P73DS.js\";\n\n// src/components/text-input/register.tsx\nimport { Builder } from \"@builder.io/react\";\nimport { TextCursorInput } from \"lucide-react\";\n\n// src/components/text-input/builder.tsx\nimport React from \"react\";\nfunction TextInputForBuilder({ builderBlock, ...props }) {\n  const id = props.id ?? (builderBlock?.id ? `${builderBlock.id}-input` : void 0);\n  return /* @__PURE__ */ React.createElement(TextInput, { ...props, id });\n}\n\n// src/components/text-input/text-input-options.ts\nvar textInputTypeOptions = [\"text\", \"email\", \"tel\"];\nvar textInputValidationMatchOptions = [\n  \"badInput\",\n  \"patternMismatch\",\n  \"rangeOverflow\",\n  \"rangeUnderflow\",\n  \"stepMismatch\",\n  \"tooLong\",\n  \"tooShort\",\n  \"typeMismatch\",\n  \"valueMissing\"\n];\n\n// src/components/text-input/register.tsx\nvar registerComponent = () => {\n  Builder.registerComponent(TextInputForBuilder, {\n    name: \"TextInput\",\n    friendlyName: \"Text Input\",\n    docsLink: getStorybookDocsUrlForAtom(\"text-input\"),\n    image: lucideIconUri(TextCursorInput),\n    requiresParent: {\n      query: {\n        \"component.name\": { $in: [\"BasicForm\", \"EmailCaptureForm\"] }\n      },\n      message: \"TextInput must be used within a BasicForm or EmailCaptureForm component.\"\n    },\n    inputs: [\n      {\n        name: \"labelText\",\n        friendlyName: \"Label Text\",\n        type: \"string\",\n        defaultValue: \"Label\"\n      },\n      {\n        name: \"name\",\n        friendlyName: \"Input Name\",\n        type: \"string\",\n        defaultValue: \"input-name\"\n      },\n      {\n        name: \"inputType\",\n        friendlyName: \"Input Type\",\n        type: \"enum\",\n        enum: textInputTypeOptions,\n        defaultValue: \"text\"\n      },\n      {\n        name: \"defaultValue\",\n        friendlyName: \"Default Value\",\n        type: \"string\"\n      },\n      {\n        name: \"placeholderText\",\n        friendlyName: \"Placeholder Text\",\n        type: \"string\",\n        defaultValue: \"Placeholder text\"\n      },\n      {\n        name: \"isRequired\",\n        friendlyName: \"Is Required\",\n        type: \"boolean\",\n        defaultValue: false\n      },\n      {\n        name: \"errorMessages\",\n        friendlyName: \"Error Messages\",\n        type: \"list\",\n        defaultValue: [{ match: \"typeMismatch\", message: \"Error explanation text\" }],\n        subFields: [\n          {\n            name: \"match\",\n            friendlyName: \"Validation Match\",\n            type: \"enum\",\n            enum: textInputValidationMatchOptions,\n            defaultValue: \"typeMismatch\"\n          },\n          {\n            name: \"message\",\n            friendlyName: \"Error Message\",\n            type: \"string\",\n            defaultValue: \"Error explanation text\"\n          }\n        ]\n      }\n    ]\n  });\n};\n\nexport {\n  registerComponent\n};\n//# sourceMappingURL=chunk-NYDERNVO.js.map","// src/config/storybook.ts\nvar STORYBOOK_BASE_URL = \"https://storybook.commercecomponents.logos.com\";\nfunction getStorybookDocsUrl(storyId) {\n  return `${STORYBOOK_BASE_URL}/?path=/story/${storyId}`;\n}\nfunction getStorybookDocsUrlForTier(tier, name, story = \"default\") {\n  const storySlug = story.toLowerCase().replace(/\\s+/g, \"-\");\n  return getStorybookDocsUrl(`${tier}-${name}--${storySlug}`);\n}\nfunction getStorybookDocsUrlForComponent(component, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"components\", component, story);\n}\nfunction getStorybookDocsUrlForOrganism(organism, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"organisms\", organism, story);\n}\nfunction getStorybookDocsUrlForMolecule(molecule, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"molecules\", molecule, story);\n}\nfunction getStorybookDocsUrlForAtom(atom, story = \"default\") {\n  return getStorybookDocsUrlForTier(\"atoms\", atom, story);\n}\n\nexport {\n  getStorybookDocsUrl,\n  getStorybookDocsUrlForComponent,\n  getStorybookDocsUrlForOrganism,\n  getStorybookDocsUrlForMolecule,\n  getStorybookDocsUrlForAtom\n};\n//# sourceMappingURL=chunk-QJ7P73DS.js.map"],"names":["dist_native","randomUUID","crypto","bind","getRandomValues","rnds8","Uint8Array","byteToHex","i","push","toString","slice","_v4","options","buf","offset","rnds","random","rng","Error","length","RangeError","arr","toLowerCase","unsafeStringify","TextInput","className","id","labelText","inputType","placeholderText","isRequired","icon","defaultValue","errorMessages","dataTestId","props","generatedInputId","setGeneratedInputId","react","useState","inputRef","useRef","explicitId","inputId","useEffect","current","createElement","dist","D0","chunk_NZVMNINS","cn","JU","htmlFor","suppressHydrationWarning","chunk_P4MY4MXU","o","variant","Ec","asChild","ref","type","placeholder","required","map","match","message","QB","key","displayName","TextCursorInput","A","d","TextInputForBuilder","builderBlock","textInputTypeOptions","textInputValidationMatchOptions","registerComponent","builder_react_es5","M$","name","friendlyName","docsLink","chunk_QJ7P73DS","Lu","image","chunk_BEFWWR2C","c","requiresParent","query","$in","inputs","enum","subFields","getStorybookDocsUrl","storyId","getStorybookDocsUrlForTier","tier","story","replace","getStorybookDocsUrlForComponent","component","getStorybookDocsUrlForOrganism","organism","getStorybookDocsUrlForMolecule","molecule","getStorybookDocsUrlForAtom","atom"],"sourceRoot":""}