{"version":3,"file":"CopyMessage.mBxf_vHc.mjs","names":["useState","useRef","useEffect","_jsxs","_jsx","__esmMin","init_ssg_sandbox_shims","navigator","_e","de","init_jsx_runtime","c","p","init_npm_react_18_3_1","ce","window","addPropertyControls","init_framer_ChujFWHC","ControlType","init_framer_motion_1EwlFBEG","motion","CopyMessage","props","message","namePlaceholder","copyLabel","copiedLabel","textLabel","style","practice","setPractice","focused","setFocused","copied","setCopied","timer","name","finalText","shown","copy","area","openMessages","ios","base","spring","init_CopyMessage"],"sources":["https:/framerusercontent.com/modules/fOc86oQV9KosaRh4L6cp/PmU7nl2ZGETvGQS8OFly/CopyMessage.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function CopyMessage(props){const{message,namePlaceholder,copyLabel,copiedLabel,textLabel,style}=props;const[practice,setPractice]=useState(\"\");const[focused,setFocused]=useState(false);const[copied,setCopied]=useState(false);const timer=useRef(null);useEffect(()=>()=>{if(timer.current)clearTimeout(timer.current);},[]);const name=practice.trim().replace(/\\s+/g,\" \").slice(0,60);const finalText=message.replace(\"{at}\",name?\" at \"+name:\"\");const shown=finalText.replace(/\\((\\d{3})\\) (\\d{3})-(\\d{4})/g,\"($1)\\xa0$2‑$3\");const copy=async()=>{try{await navigator.clipboard.writeText(finalText);}catch{const area=document.createElement(\"textarea\");area.value=finalText;area.setAttribute(\"readonly\",\"\");area.style.position=\"absolute\";area.style.left=\"-9999px\";document.body.appendChild(area);area.select();try{document.execCommand(\"copy\");}catch{}document.body.removeChild(area);}setCopied(true);if(timer.current)clearTimeout(timer.current);timer.current=setTimeout(()=>setCopied(false),2200);};const openMessages=()=>{const ios=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===\"MacIntel\"&&navigator.maxTouchPoints>1;window.location.href=\"sms:\"+(ios?\"&\":\"?\")+\"body=\"+encodeURIComponent(finalText);};const base={flex:\"1 1 180px\",height:48,borderRadius:13,fontFamily:\"Inter, sans-serif\",fontSize:16,fontWeight:500,letterSpacing:\"-0.01em\",cursor:\"pointer\",padding:\"0 20px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",outline:\"none\"};const spring={type:\"spring\",stiffness:500,damping:32};return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:12},children:[namePlaceholder?/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:practice,onChange:e=>setPractice(e.target.value),onFocus:()=>setFocused(true),onBlur:()=>setFocused(false),placeholder:namePlaceholder,\"aria-label\":namePlaceholder,maxLength:60,style:{width:\"100%\",height:40,boxSizing:\"border-box\",padding:\"0 12px\",borderRadius:17,border:\"1px solid \"+(focused?\"rgb(233, 237, 248)\":\"transparent\"),background:\"rgb(241, 245, 249)\",fontFamily:\"Inter, sans-serif\",fontSize:16,color:\"rgb(0, 0, 0)\",outline:\"none\",transition:\"border-color 0.2s ease\"}}):null,/*#__PURE__*/_jsx(\"div\",{style:{background:\"rgb(241, 245, 249)\",borderRadius:17,padding:\"16px 18px\",fontFamily:\"Inter, sans-serif\",fontSize:16,lineHeight:1.6,letterSpacing:\"-0.01em\",color:\"rgb(0, 0, 0)\",whiteSpace:\"pre-wrap\",textAlign:\"left\"},children:shown}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:10,flexWrap:\"wrap\",marginTop:4},children:[/*#__PURE__*/_jsx(motion.button,{type:\"button\",onClick:copy,whileHover:{scale:1.01},whileTap:{scale:.98},transition:spring,style:{...base,color:\"#fff\",border:\"none\",background:\"linear-gradient(125deg, rgb(255, 255, 255) -172%, rgb(0, 0, 0) 74%)\"},children:/*#__PURE__*/_jsx(motion.span,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2},children:copied?copiedLabel:copyLabel},copied?\"c\":\"d\")}),/*#__PURE__*/_jsx(motion.button,{type:\"button\",onClick:openMessages,whileHover:{scale:1.01},whileTap:{scale:.98},transition:spring,style:{...base,color:\"#000\",background:\"#fff\",border:\"1px solid rgba(28, 26, 46, 0.1)\"},children:textLabel})]}),/*#__PURE__*/_jsx(\"span\",{\"aria-live\":\"polite\",style:{position:\"absolute\",width:1,height:1,overflow:\"hidden\",clip:\"rect(0 0 0 0)\"},children:copied?\"Message copied\":\"\"})]});}CopyMessage.defaultProps={message:\"Hey! The marketing company we use{at} is called Solora. They've been great to work with. If you ever want more patients or Google reviews, call or text them at (313) 888-8144. solora.ai\",namePlaceholder:\"Your practice name (optional)\",copyLabel:\"Copy message\",copiedLabel:\"Copied to clipboard\",textLabel:\"Open in Messages\"};addPropertyControls(CopyMessage,{message:{type:ControlType.String,title:\"Message\",displayTextArea:true,defaultValue:CopyMessage.defaultProps.message,description:'{at} becomes \" at <practice name>\" when one is typed.'},namePlaceholder:{type:ControlType.String,title:\"Name hint\",defaultValue:\"Your practice name (optional)\",description:\"Leave empty to hide the name box.\"},copyLabel:{type:ControlType.String,title:\"Copy label\",defaultValue:\"Copy message\"},copiedLabel:{type:ControlType.String,title:\"Copied label\",defaultValue:\"Copied to clipboard\"},textLabel:{type:ControlType.String,title:\"Text label\",defaultValue:\"Open in Messages\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyMessage\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyMessage.map"],"mappings":"A,qQAGG,SAAwBqB,EAAYC,EAAM,CAAC,GAAK,CAACC,UAAQC,kBAAgBC,YAAUC,cAAYC,YAAUC,SAAON,EAAW,CAACO,EAASC,GAAa9B,EAAS,EAAE,EAAO,CAAC+B,EAAQC,G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