{"version":3,"file":"RichTextCounter.BDUez5RD.mjs","names":["useState"],"sources":["https:/framer.com/m/framer/default-utils.js@^0.45.0","https:/framerusercontent.com/modules/wrakxNaeTVzW88I5GHMq/YPOOIZNo7BbKeYp5M94x/RichTextCounter.js"],"sourcesContent":["/*\n * index (framer/default-utils@0.45.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/G4IfyjvwmaeSBpdb4TWu/OIjZRBmWDcIE2B6qgG1j/index.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{fontControls}from\"https://framer.com/m/framer/default-utils.js@^0.45.0\";import{useEffect,useState}from\"react\";export function WordCounter(props){const{font,fontColor,title,displayMode}=props;const[countWords,setCountWords]=useState(0);useEffect(()=>{if(typeof window===\"undefined\")return;// Check if running in a browser environment\nconst div=document.createElement(\"div\");div.innerHTML=typeof title===\"string\"?title:JSON.stringify(title);const text=div.textContent||div.innerText||\"\";setCountWords(text.trim().split(/\\s+/).length);},[title]);const wordsPerMinute=200// Average reading speed\n;const timeToRead=Math.ceil(countWords/wordsPerMinute);return /*#__PURE__*/_jsx(\"div\",{style:{...font,color:fontColor,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",padding:0},children:displayMode===\"words\"?`${countWords}`:`${timeToRead} min read`});}WordCounter.defaultProps={title:\"<p>Your rich text here</p>\",font:fontControls.defaultProps,fontColor:\"#000\",displayMode:\"words\"};addPropertyControls(WordCounter,{title:{title:\"Title\",//@ts-ignore\ntype:ControlType.RichText},font:{// @ts-expect-error – Internal\ntype:ControlType.Font,controls:\"extended\",title:\"Font\"},fontColor:{title:\"Font Color\",type:ControlType.Color,defaultValue:WordCounter.defaultProps.fontColor},displayMode:{title:\"Display Mode\",type:ControlType.SegmentedEnum,options:[\"words\",\"time\"],optionTitles:[\"Words\",\"Time to Read\"],defaultValue:WordCounter.defaultProps.displayMode,description:\"[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"WordCounter\":{\"type\":\"reactComponent\",\"name\":\"WordCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RichTextCounter.map"],"mappings":"+QCAoN,SAAgB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,YAAU,QAAM,eAAa,EAAW,CAAC,EAAW,GAAeA,EAAS,EAAE,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAC/X,IAAM,EAAI,SAAS,cAAc,MAAM,CAAC,EAAI,UAAU,OAAO,GAAQ,SAAS,EAAM,KAAK,UAAU,EAAM,CAA+C,GAAnC,EAAI,aAAa,EAAI,WAAW,IAAsB,MAAM,CAAC,MAAM,MAAM,CAAC,OAAO,EAAG,CAAC,EAAM,CAAC,CAChN,IAAM,EAAW,KAAK,KAAK,EAD2M,IACjL,CAAC,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAK,MAAM,EAAU,QAAQ,OAAO,eAAe,SAAS,WAAW,SAAS,QAAQ,EAAE,CAAC,SAAS,IAAc,QAAQ,GAAG,IAAa,GAAG,EAAW,WAAW,CAAC,sBAF1N,IAAoD,IAA+E,IAAsC,CAEmD,EAAY,aAAa,CAAC,MAAM,6BAA6B,KAAK,EAAa,aAAa,UAAU,OAAO,YAAY,QAAQ,CAAC,EAAoB,EAAY,CAAC,MAAM,CAAC,MAAM,QACvb,KAAK,EAAY,SAAS,CAAC,KAAK,CAChC,KAAK,EAAY,KAAK,SAAS,WAAW,MAAM,OAAO,CAAC,UAAU,CAAC,MAAM,aAAa,KAAK,EAAY,MAAM,aAAa,EAAY,aAAa,UAAU,CAAC,YAAY,CAAC,MAAM,eAAe,KAAK,EAAY,cAAc,QAAQ,CAAC,QAAQ,OAAO,CAAC,aAAa,CAAC,QAAQ,eAAe,CAAC,aAAa,EAAY,aAAa,YAAY,YAAY,6CAA6C,CAAC,CAAC"}