{"version":3,"file":"InlineImageText.CLbrm4CP.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/zLSKTbXCHezmswXkJy10/S8eiTWsng6xyHxIsCIrG/InlineImageText.js"],"sourcesContent":["// Component that allows inserting images inline within text at specified target words\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function InlineImageText(props){const{text=\"Bring every lesson to life, right inside your LMS\",imageReplacements=[{targetWord:\"lesson\",image:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Image 1\"},position:\"suffix\",width:600,alignment:\"middle\",spacingTop:0,spacingRight:6,spacingBottom:0,spacingLeft:6}],font,textColor=\"#000000\",textAlign=\"center\",htmlTag=\"div\"}=props;const processedContent=useMemo(()=>{const words=text.split(\" \");const result=[];words.forEach((word,index)=>{const cleanWord=word.trim();const replacement=imageReplacements.find(r=>{// Add safety check for undefined image\nif(!r||!r.targetWord||!r.image||!r.image.src)return false;return cleanWord.toLowerCase().includes(r.targetWord.toLowerCase());});if(replacement){if(replacement.position===\"prefix\"){result.push({type:\"image\",content:\"\",imageData:replacement});result.push({type:\"text\",content:word});}else{result.push({type:\"text\",content:word});result.push({type:\"image\",content:\"\",imageData:replacement});}}else{result.push({type:\"text\",content:word});}// Only add space if this isn't the last word AND the next item won't be an image\nif(index<words.length-1){// Check if we just added an image\nconst lastItem=result[result.length-1];if(lastItem.type!==\"image\"){result.push({type:\"text\",content:\" \"});}}});return result;},[text,imageReplacements]);const Tag=htmlTag;return /*#__PURE__*/_jsx(Tag,{style:{...props.style,display:\"flex\",flexWrap:\"wrap\",alignItems:\"center\",justifyContent:textAlign===\"center\"?\"center\":textAlign===\"right\"?\"flex-end\":\"flex-start\",gap:\"0px\",width:\"100%\",margin:0,...font,color:textColor,textAlign:textAlign},children:processedContent.map((item,index)=>{if(item.type===\"image\"&&item.imageData&&item.imageData.image&&item.imageData.image.src){const alignment=item.imageData.alignment||\"middle\";const verticalAlignValue=alignment===\"top\"?\"top\":alignment===\"bottom\"?\"bottom\":\"middle\";return /*#__PURE__*/_jsx(\"img\",{src:item.imageData.image.src,alt:item.imageData.image.alt||\"\",style:{width:`${item.imageData.width||600}px`,height:\"auto\",display:\"inline-block\",verticalAlign:verticalAlignValue,marginTop:`${item.imageData.spacingTop||0}px`,marginRight:`${item.imageData.spacingRight!==undefined?item.imageData.spacingRight:6}px`,marginBottom:`${item.imageData.spacingBottom||0}px`,marginLeft:`${item.imageData.spacingLeft!==undefined?item.imageData.spacingLeft:6}px`}},index);}return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline\",whiteSpace:item.content===\" \"?\"pre\":\"normal\"},children:item.content},index);})});}addPropertyControls(InlineImageText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Bring every lesson to life, right inside your LMS\",displayTextArea:true},htmlTag:{type:ControlType.Enum,title:\"HTML Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"div\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Div\"],defaultValue:\"div\",displaySegmentedControl:false},imageReplacements:{type:ControlType.Array,title:\"Image Replacements\",control:{type:ControlType.Object,controls:{targetWord:{type:ControlType.String,title:\"Target Word\",defaultValue:\"lesson\"},image:{type:ControlType.ResponsiveImage,title:\"Image\"},position:{type:ControlType.Enum,title:\"Position\",options:[\"prefix\",\"suffix\"],optionTitles:[\"Before Word\",\"After Word\"],defaultValue:\"suffix\"},width:{type:ControlType.Number,title:\"Width\",defaultValue:600,min:20,max:200,step:1,unit:\"px\"},alignment:{type:ControlType.Enum,title:\"Alignment\",options:[\"top\",\"middle\",\"bottom\"],optionTitles:[\"Top\",\"Middle\",\"Bottom\"],defaultValue:\"middle\"},spacingTop:{type:ControlType.Number,title:\"Top\",defaultValue:0,min:0,max:50,step:1,unit:\"px\"},spacingRight:{type:ControlType.Number,title:\"Right\",defaultValue:6,min:0,max:50,step:1,unit:\"px\"},spacingBottom:{type:ControlType.Number,title:\"Bottom\",defaultValue:0,min:0,max:50,step:1,unit:\"px\"},spacingLeft:{type:ControlType.Number,title:\"Left\",defaultValue:6,min:0,max:50,step:1,unit:\"px\"}}},defaultValue:[{targetWord:\"lesson\",image:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Image 1\"},position:\"suffix\",width:600,alignment:\"middle\",spacingTop:0,spacingRight:6,spacingBottom:0,spacingLeft:6}]},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InlineImageText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InlineImageText.map"],"mappings":"kQAIG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,OAAK,oDAAoD,oBAAkB,CAAC,CAAC,WAAW,SAAS,MAAM,CAAC,IAAI,sEAAsE,IAAI,UAAU,CAAC,SAAS,SAAS,MAAM,IAAI,UAAU,SAAS,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAC,OAAK,YAAU,UAAU,YAAU,SAAS,UAAQ,OAAO,EAAY,EAAiBA,MAAY,CAAC,IAAM,EAAM,EAAK,MAAM,IAAI,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