{"version":3,"file":"normalizeText.LDGcqyCh.mjs","names":["React"],"sources":["https:/framerusercontent.com/modules/LOImSWeUQtShQNRVQ5ij/4KKTtYkWgtKuJzGQJYVa/normalizeText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,forwardRef}from\"react\";import React from\"react\";// Example: { \"®\": <sup>®</sup>, \"™\": <sup>™</sup> }\nconst defaultWrapMap={\"\\xae\":/*#__PURE__*/_jsx(\"sup\",{style:{fontSize:\"0.65em\",lineHeight:0,verticalAlign:\"baseline\",position:\"relative\",top:\"-0.5em\"},children:\"\\xae\"})};function escapeRegExp(s){return s.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");}function wrapInText(text,wrapMap){const tokens=Object.keys(wrapMap);if(tokens.length===0)return[text];// Matches any token, e.g. /(®|™)/g\nconst re=new RegExp(`(${tokens.map(escapeRegExp).join(\"|\")})`,\"g\");// split() keeps the matched tokens as separate items in the resulting array\nconst parts=text.split(re);return parts.map((part,i)=>{const replacement=wrapMap[part];if(replacement){// Keys to keep React happy in lists\nreturn /*#__PURE__*/_jsx(React.Fragment,{children:replacement},`sup-${part}-${i}`);}return /*#__PURE__*/_jsx(React.Fragment,{children:part},`txt-${i}`);});}export function wrapSymbols(node,wrapMap=defaultWrapMap){if(node==null||typeof node===\"boolean\")return node;// Handle plain text content\nif(typeof node===\"string\")return wrapInText(node,wrapMap);if(typeof node===\"number\")return wrapInText(String(node),wrapMap);// Handle arrays of children\nif(Array.isArray(node)){return node.map((child,i)=>/*#__PURE__*/_jsx(React.Fragment,{children:wrapSymbols(child,wrapMap)},i));}// Handle React elements\nif(/*#__PURE__*/React.isValidElement(node)){// Optionally skip elements that should never be touched\nconst type=node.type;const isDomEl=typeof type===\"string\";if(isDomEl&&(type===\"script\"||type===\"style\"))return node;const children=node.props.children;if(!children)return node;// Clone the element and replace its children with the transformed children\nreturn /*#__PURE__*/React.cloneElement(node,{...node.props,children:wrapSymbols(children,wrapMap)});}// Fallback for anything else (e.g. functions, symbols)\nreturn node;}export function normalizeText(Component){return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{},[]);return wrapSymbols(/*#__PURE__*/_jsx(Component,{ref:ref,...props}));});}\nexport const __FramerMetadata__ = {\"exports\":{\"normalizeText\":{\"type\":\"reactHoc\",\"name\":\"normalizeText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"wrapSymbols\":{\"type\":\"reactComponent\",\"name\":\"wrapSymbols\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./normalizeText.map"],"mappings":"gIAC0K,SAAS,EAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,sBAAsB,OAAO,CAAE,SAAS,EAAW,EAAK,EAAQ,CAAC,IAAM,EAAO,OAAO,KAAK,EAAQ,CAAC,GAAG,EAAO,SAAS,EAAE,MAAM,CAAC,EAAK,CACxV,IAAM,EAAO,OAAO,IAAI,EAAO,IAAI,EAAa,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CACvC,OAAf,EAAK,MAAM,EAAG,CAAc,KAAK,EAAK,IAAI,CAAC,IAAM,EAAY,EAAQ,GACG,OADM,EACtE,EAAKA,EAAM,SAAS,CAAC,SAAS,EAAY,CAAC,OAAO,EAAK,GAAG,IAAI,CAAsB,EAAKA,EAAM,SAAS,CAAC,SAAS,EAAK,CAAC,OAAO,IAAI,EAAG,CAAE,SAAgB,EAAY,EAAK,EAAQ,EAAe,CAAC,GAAG,GAAM,MAAM,OAAO,GAAO,UAAU,OAAO,EACnQ,GAAG,OAAO,GAAO,SAAS,OAAO,EAAW,EAAK,EAAQ,CAAC,GAAG,OAAO,GAAO,SAAS,OAAO,EAAW,OAAO,EAAK,CAAC,EAAQ,CAC3H,GAAG,MAAM,QAAQ,EAAK,CAAE,OAAO,EAAK,KAAK,EAAM,IAAiB,EAAKA,EAAM,SAAS,CAAC,SAAS,EAAY,EAAM,EAAQ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