{"version":3,"file":"Arc.DdCwAfOT.mjs","names":["Arc","Children","useState","renderToString","hash"],"sources":["https:/framerusercontent.com/modules/4S4SnR1GdEzX95H1h5mT/hXnD9L8hCVy3gHrauXbL/Arc.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{Children,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget,withCSS}from\"framer\";import{motion}from\"framer-motion\";import hash from\"@emotion/hash\";/**\n * ARC TEXT\n * By Adam and Benjamin\n *\n * @framerIntrinsicWidth 150\n * @framerIntrinsicHeight 150\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */const Arc=withCSS(function Arc(props={height:50,width:50}){// Checks\nconst hasChildren=Children.count(props.slots)>0;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const showCustomPath=hasChildren&&props.type===\"graphic\";// For Ellipse\nconst isCircle=props.type===\"circle\";const isEllipse=props.type===\"ellipse\";const cylinder=isEllipse?props.cylinderHeight/2:0;// Base arc path\nlet path=createPath(props.flip,cylinder);let childPath;let viewBox;const[renderToString,setRenderToString]=useState();React.useEffect(()=>{if(!isCanvas)return;import(\"react-dom/server\").then(({renderToString})=>{setRenderToString(()=>renderToString);});},[]);// If graphic is connected\nif(showCustomPath){const firstChild=getFirstChild(props.slots);const svgChild=getFirstChild(firstChild?.props.svg);const svgChildCanvas=getFirstChild(firstChild?.props.children);// Show placeholder on canvas if connected layer isn’t a graphic\nif(isCanvas&&!svgChildCanvas?.props.frame){return /*#__PURE__*/_jsxs(\"div\",{style:placeholderStyles,children:[/*#__PURE__*/_jsx(\"div\",{style:emojiStyles,children:\"💎\"}),/*#__PURE__*/_jsx(\"p\",{style:titleStyles,children:\"Please connect to Graphic\"}),/*#__PURE__*/_jsx(\"p\",{style:subtitleStyles,children:\"You can only connect the Arc to a Graphic with a single path.\"})]});}// Grab the react element from the canvas and turn it into SVG\nif(isCanvas&&svgChildCanvas){if(!renderToString)return null;const svgString=renderToString(svgChildCanvas);// Canvas does not give us viewBox within the string\nconst canvasFrame=svgChildCanvas.props.frame;viewBox=`0 0 ${canvasFrame.width} ${canvasFrame.height}`;let attributes=svgString.match(/[\\w-]+=\"[^\"]*\"/g);for(const element of attributes){if(element.includes(\"d=\")){childPath=splitAndReplace(element);}}}// On the preview/deploy we already get the SVG string\nif(!isCanvas&&svgChild){let attributes=svgChild.match(/[\\w-]+=\"[^\"]*\"/g);viewBox=svgChild.split(\"viewBox=\")[1];viewBox=viewBox.split(\">\")[0];viewBox=viewBox.replace(/^\"(.+(?=\"$))\"$/,\"$1\");for(const element of attributes){if(element.includes(\"d=\")){childPath=splitAndReplace(element);}}}}// Unique IDs to avoid multiple instances on the canvas sharing a single path\nconst id=`curve-${hash(childPath||path)}`;// Alignment icon conversion\nlet alignmentValue;if(props.alignmentBaseline===\"top\")alignmentValue=\"Text Top\";if(props.alignmentBaseline===\"center\")alignmentValue=\"Central\";if(props.alignmentBaseline===\"bottom\")alignmentValue=\"Hanging\";return /*#__PURE__*/_jsx(motion.div,{style:{width:\"100%\",height:\"100%\",// userSelect: \"none\",\n// pointerEvents: \"none\",\nposition:\"relative\"},draggable:\"false\",children:/*#__PURE__*/_jsxs(motion.svg,{className:\"transform-origin-center-center\",style:{width:\"100%\",height:\"100%\",position:\"absolute\",inset:0,transformOrigin:\"center\",willChange:props.rotate&&\"transform\"},viewBox:showCustomPath?viewBox:`0 0 100 100`,overflow:\"visible\",animate:isCircle&&props.rotate&&{rotate:360},transition:isCircle&&props.rotate&&{duration:100/props.rotateSpeed,repeat:Infinity,ease:\"linear\"},children:[/*#__PURE__*/_jsx(\"path\",{id:id,d:showCustomPath?childPath:path,strokeWidth:\"none\",fill:\"transparent\"}),/*#__PURE__*/_jsx(\"text\",{children:/*#__PURE__*/_jsxs(\"textPath\",{href:`#${id}`,startOffset:props.startOffset,dominantBaseline:alignmentValue,style:{...props.font,wordSpacing:props.wordSpacing,fill:props.color},children:[props.text,!isCanvas&&props.animate&&/*#__PURE__*/_jsx(\"animate\",{attributeName:\"startOffset\",from:`${props.animateStart}%`,to:`${props.animateEnd}%`,begin:\"0s\",dur:`${props.animateDuration}s`,repeatCount:\"indefinite\"})]})})]})});},// Work around a bug with framer-motion that calculates a px origin when animating SVG elements.\n[\".transform-origin-center-center { transform-origin: center center !important; }\"],\"blitz-arc-text\");export default Arc;Arc.defaultProps={height:50,width:50};addPropertyControls(Arc,{text:{title:\"Content\",type:ControlType.String,defaultValue:\"✦ THANK YOU ✦ FOR VISITING\",displayTextArea:true},type:{title:\"Type\",type:ControlType.Enum,options:[\"circle\",\"ellipse\",\"graphic\"],optionTitles:[\"Circle\",\"Ellipse\",\"Graphic\"],defaultValue:true},cylinderHeight:{title:\"Height\",type:ControlType.Number,unit:\"px\",min:0,max:1e3,hidden:({type})=>type!==\"ellipse\"},rotate:{type:ControlType.Boolean,title:\"Rotate\",defaultValue:false,hidden:({type})=>type!==\"circle\"},rotateSpeed:{type:ControlType.Number,title:\"Speed\",min:0,max:50,defaultValue:5,displayStepper:true,step:1,hidden:({type,rotate})=>type!==\"circle\"||!rotate},slots:{type:ControlType.ComponentInstance,title:\"Graphic\",hidden:({type})=>type!==\"graphic\"},alignmentBaseline:{title:\"Align\",type:ControlType.Enum,options:[\"top\",\"center\",\"bottom\"],optionIcons:[\"align-top\",\"align-middle\",\"align-bottom\"],defaultValue:\"bottom\",displaySegmentedControl:true},flip:{type:ControlType.Boolean,defaultValue:false,title:\"Direction\",enabledTitle:\"CW\",disabledTitle:\"CCW\",hidden:({type})=>type===\"graphic\"},startOffset:{title:\"Offset\",type:ControlType.Number,defaultValue:0,max:360,unit:\"\\xb0\",step:.5},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#999\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",displayTextAlignment:false},wordSpacing:{type:ControlType.Number,step:1,defaultValue:0,title:\"Word\",displayStepper:true},animate:{type:ControlType.Boolean,defaultValue:false,title:\"Animate\"},animateStart:{type:ControlType.Number,min:-200,max:200,step:.1,defaultValue:-50,title:\"From\",unit:\"%\",hidden:props=>!props.animate},animateEnd:{type:ControlType.Number,min:-200,max:200,step:.1,defaultValue:150,title:\"To\",unit:\"%\",hidden:props=>!props.animate},animateDuration:{type:ControlType.Number,min:0,max:50,defaultValue:5,title:\"Time\",unit:\"s\",displayStepper:true,hidden:props=>!props.animate}});/* Method to get the first child */function getFirstChild(slots){let firstChild;Children.map(slots,child=>{if(firstChild===undefined){firstChild=child;}});return firstChild;}/* Method to get stringless attributes */const splitAndReplace=string=>{return string.split(\"=\")[1].replace(/['\"]+/g,\"\");};/* Path creation method */const createPath=(flip,cylinder)=>{const cylinderTop=50-cylinder;const cylinderBottom=50+cylinder;return!flip?`M 0 50 L 0 ${cylinderTop} A 1 1 0 0 1 100 ${cylinderTop} L 100 50 L 100 ${cylinderBottom} A 1 1 0 0 1 0 ${cylinderBottom} L 0 ${cylinderTop}`:`M 0 50 L 0 ${cylinderBottom} A 1 1 0 1 0 100 ${cylinderBottom} L 100 ${cylinderTop} A 1 1 0 1 0 0 ${cylinderTop} L 0 50`;};/* Styles */const placeholderStyles={display:\"flex\",width:\"100%\",height:\"100%\",placeContent:\"center\",placeItems:\"center\",flexDirection:\"column\",color:\"#96F\",background:\"rgba(136, 85, 255, 0.1)\",fontSize:11,overflow:\"hidden\"};const emojiStyles={fontSize:32,marginBottom:10};const titleStyles={margin:0,marginBottom:10,fontWeight:600,textAlign:\"center\"};const subtitleStyles={margin:0,opacity:.7,maxWidth:160,lineHeight:1.5,textAlign:\"center\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Arc\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"150\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"150\",\"framerDisableUnlink\":\"*\"}},\"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