{"version":3,"file":"Math_LaTeX_.C9JnRFzS.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/iR8CgAEuDAa4PXx8gKyB/dlASOtR91wb1TOfC705g/Math_LaTeX_.js"],"sourcesContent":["// Requested: Create a Framer React code component named \"Math (LaTeX)\" that renders LaTeX as proper typeset math via KaTeX, loads KaTeX CSS, gracefully handles invalid LaTeX, is SSR/canvas-safe, and exposes configurable property controls.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{startTransition,useEffect,useMemo,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const KATEX_CSS_ID=\"framer-katex-stylesheet\";const KATEX_CSS_URL=\"https://esm.sh/katex/dist/katex.min.css\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MathLaTeX(props){const{latex=\"\\\\frac{p(\\\\text{customer})}{p(\\\\text{unknown})} = e^{z_{\\\\text{customer}} - z_{\\\\text{unknown}}}\",displayMode=true,color=\"#111111\",fontSize=20,align=\"center\",style}=props;const[html,setHtml]=useState(\"\");useEffect(()=>{let cancelled=false;async function renderMath(){if(typeof window===\"undefined\")return;if(typeof document!==\"undefined\"&&!document.getElementById(KATEX_CSS_ID)){const link=document.createElement(\"link\");link.id=KATEX_CSS_ID;link.rel=\"stylesheet\";link.href=KATEX_CSS_URL;document.head.appendChild(link);}try{const dynamicImport=new Function(\"u\",\"return import(u)\");const katexModule=await dynamicImport(\"https://esm.sh/katex\");const katex=katexModule.default??katexModule;const output=katex.renderToString(latex,{displayMode,throwOnError:false});if(!cancelled){startTransition(()=>setHtml(output));}}catch(_error){if(!cancelled){const fallback=String(latex??\"\");startTransition(()=>setHtml(fallback));}}}renderMath();return()=>{cancelled=true;};},[latex,displayMode]);const containerStyle=useMemo(()=>({position:\"relative\",width:\"100%\",minHeight:1,color,fontSize,textAlign:align,lineHeight:1.25,...style}),[align,color,fontSize,style]);if(typeof window===\"undefined\"){return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,\"aria-label\":\"Math expression\",children:latex});}return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,\"aria-label\":\"Math expression\",dangerouslySetInnerHTML:{__html:html||latex}});}addPropertyControls(MathLaTeX,{latex:{type:ControlType.String,title:\"LaTeX\",displayTextArea:true,defaultValue:\"\\\\frac{p(\\\\text{customer})}{p(\\\\text{unknown})} = e^{z_{\\\\text{customer}} - z_{\\\\text{unknown}}}\"},displayMode:{type:ControlType.Boolean,title:\"Display mode\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#111111\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:20,min:8,max:160,unit:\"px\",step:1},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MathLaTeX\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Math_LaTeX_.map"],"mappings":"wMAIG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,mGAAmG,cAAY,GAAK,QAAM,UAAU,WAAS,GAAG,QAAM,SAAS,SAAO,EAAW,CAAC,EAAK,GAASA,EAAS,EAAE,EAAE,MAAc,CAAC,IAAI,EAAU,GAAM,eAAe,GAAY,CAAI,GAAO,IAAS,OAAmB,IAAG,OAAO,SAAW,KAAa,CAAC,SAAS,eAAe,CAAY,EAAE,CAAC,IAAM,EAAK,SAAS,cAAc,MAAM,EAAE,EAAK,GAAG,EAAa,EAAK,IAAI,aAAa,EAAK,KAAK,EAAc,SAAS,KAAK,YAAY,CAAI,CAAE,CAAC,GAAG,CAA0D,IAAM,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