{"version":3,"file":"InlineSlotText.BeMsX2gO.mjs","names":["React.useMemo"],"sources":["https:/framerusercontent.com/modules/w1jKqgHJkmcAWXLCwRmc/8FBn9C2F6zPWCX9uQg5I/InlineSlotText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Встраиваемый текст со слотами\n *\n * Компонент принимает текстовый шаблон с плейсхолдерами \"[]\"\n * и подставляет в эти места компоненты из слота.\n *\n * Пример шаблона:\n * \"Lorem ipsum [] sit amet, consectetur adipiscing elit. Suspendisse vel eros rutrum, [] massa congue, porttitor nunc. Lorem ipsum dolor sit amet, [] adipiscing elit.\"\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 120\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function InlineSlotText(props){const{textTemplate,textColor,textFont,t1,t2,t3,t4,t5,t6,t7,style}=props;const isFixedWidth=style&&style.width===\"100%\";const isFixedHeight=style&&style.height===\"100%\";const childrenArray=React.useMemo(()=>{const variableMap={t1:t1,t2:t2,t3:t3,t4:t4,t5:t5,t6:t6,t7:t7};// Updated pattern to capture everything inside brackets\nconst pattern=/\\[[^\\]]+\\]/g;const matches=String(textTemplate||\"\").match(pattern)||[];const textParts=String(textTemplate||\"\").split(pattern);const result=[];let matchIndex=0;textParts.forEach((part,i)=>{// Add text part if not empty\nif(part){result.push(/*#__PURE__*/_jsx(\"span\",{style:{whiteSpace:\"pre-wrap\"},children:part},`text-${i}`));}// Add corresponding match if exists\nif(matchIndex<matches.length){const match=matches[matchIndex];matchIndex++;// Remove the outer brackets\nconst innerContent=match.slice(1,-1);// Parse the expression inside brackets\n// Split by & to get parts that need to be concatenated\nconst segments=innerContent.split(\"&\").map(seg=>seg.trim());let finalValue=\"\";let hasEmptyVariable=false;segments.forEach(segment=>{// Check if it's a string literal (wrapped in quotes)\nif(segment.startsWith('\"')&&segment.endsWith('\"')||segment.startsWith(\"'\")&&segment.endsWith(\"'\")){// Remove quotes and add to final value\nfinalValue+=segment.slice(1,-1);}else if(variableMap.hasOwnProperty(segment)){const variableValue=variableMap[segment];if(!variableValue||variableValue.trim()===\"\"){hasEmptyVariable=true;return;}finalValue+=variableValue;}else{finalValue+=segment;}});// Skip rendering if any variable was empty\nif(!hasEmptyVariable&&finalValue!==\"\"){result.push(/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline\"},children:finalValue},`var-${i}-${matchIndex}`));}}});return result;},[textTemplate,t1,t2,t3,t4,t5,t6,t7]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:isFixedWidth?\"100%\":\"max-content\",height:isFixedHeight?\"100%\":\"auto\",color:textColor,display:\"inline-flex\",alignItems:\"flex-start\",justifyContent:\"flex-start\",boxSizing:\"border-box\",padding:0,...style},children:/*#__PURE__*/_jsx(\"div\",{style:{width:isFixedWidth?\"100%\":\"max-content\",minWidth:isFixedWidth?undefined:\"max-content\",...textFont,color:textColor,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",overflowWrap:\"break-word\"},children:childrenArray})});}addPropertyControls(InlineSlotText,{textTemplate:{type:ControlType.String,title:\"Template\",displayTextArea:true,defaultValue:\"Lorem ipsum [t1] sit amet, consectetur adipiscing elit. Suspendisse vel eros rutrum, [t2] massa congue, porttitor nunc. Lorem ipsum dolor sit amet, [t3] adipiscing elit.\",description:'Use [t1], [t2], etc. to insert variables. Concatenation is supported: [t1&\",\"] adds a comma after the variable, [\"Sun \"&t1&\" Bath\"] combines text with the variable.'},t1:{type:ControlType.String,title:\"t1\",defaultValue:\"variable 1\"},t2:{type:ControlType.String,title:\"t2\",defaultValue:\"variable 2\"},t3:{type:ControlType.String,title:\"t3\",defaultValue:\"variable 3\"},t4:{type:ControlType.String,title:\"t4\",defaultValue:\"variable 4\"},t5:{type:ControlType.String,title:\"t5\",defaultValue:\"variable 5\"},t6:{type:ControlType.String,title:\"t6\",defaultValue:\"variable 6\"},t7:{type:ControlType.String,title:\"t7\",defaultValue:\"variable 7\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},textFont:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InlineSlotText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"120\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InlineSlotText.map"],"mappings":"sKAcG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,eAAa,YAAU,WAAS,KAAG,KAAG,KAAG,KAAG,KAAG,KAAG,KAAG,SAAO,EAAY,EAAa,GAAO,EAAM,QAAQ,OAAa,EAAc,GAAO,EAAM,SAAS,OAAa,EAAcA,MAAkB,CAAC,IAAM,EAAY,CAAI,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAG,CACvT,EAAQ,cAAoB,EAAQ,OAAO,GAAc,GAAG,CAAC,MAAM,EAAQ,EAAE,EAAE,CAAO,EAAU,OAAO,GAAc,GAAG,CAAC,MAAM,EAAQ,CAAO,EAAO,EAAE,CAAK,EAAW,EAQlB,OARoB,EAAU,SAAS,EAAK,IAAI,CAE3M,GADG,GAAM,EAAO,KAAkB,EAAK,OAAO,CAAC,MAAM,CAAC,WAAW,WAAW,CAAC,SAAS,EAAK,CAAC,QAAQ,IAAI,CAAC,CACtG,EAAW,EAAQ,OAAO,CAAC,IAAM,EAAM,EAAQ,GAAY,IAG9D,IAAM,EAFa,EAAM,MAAM,EAAE,GAAG,CAER,MAAM,IAAI,CAAC,IAAI,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