{"version":3,"file":"ChamferedPanel.DLfbJIsm.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/tIEcHifSpAtzVGpjqBe7/fpnFy8l9UxIzI3YrCNeC/ChamferedPanel.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function SciFiPanel(props){const{cornerCut,highlightLength,borderWidth,highlightWidth,borderColor,highlightColor,backgroundEnabled,backgroundColor,backgroundOpacity,glow,glowStrength,style}=props;const containerRef=React.useRef(null);const[size,setSize]=React.useState({width:600,height:500});// Measure the component's real pixel dimensions.\n// This prevents the corners from being distorted by the SVG viewBox.\nReact.useLayoutEffect(()=>{const element=containerRef.current;if(!element)return;const updateSize=()=>{const rect=element.getBoundingClientRect();setSize({width:Math.max(1,rect.width),height:Math.max(1,rect.height)});};updateSize();const observer=new ResizeObserver(updateSize);observer.observe(element);return()=>observer.disconnect();},[]);const width=size.width;const height=size.height;const maximumCut=Math.max(0,Math.min(width,height)/2-1);const cut=clamp(cornerCut,0,maximumCut);// Prevent highlights from colliding with highlights\n// coming from the opposite corners.\nconst maximumHighlightLength=Math.max(0,Math.min((width-cut*2)/2,(height-cut*2)/2));const extension=clamp(highlightLength,0,maximumHighlightLength);const borderPath=createBorderPath(width,height,cut);const cornerHighlights=createCornerHighlights(width,height,cut,extension);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"visible\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsxs(\"svg\",{width:\"100%\",height:\"100%\",viewBox:`0 0 ${width} ${height}`,preserveAspectRatio:\"none\",style:{display:\"block\",overflow:\"visible\",filter:glow?`drop-shadow(0 0 ${glowStrength}px ${borderColor})`:\"none\"},children:[/*#__PURE__*/_jsx(\"path\",{d:borderPath,fill:backgroundEnabled?backgroundColor:\"none\",fillOpacity:backgroundEnabled?backgroundOpacity:0}),/*#__PURE__*/_jsx(\"path\",{d:borderPath,fill:\"none\",stroke:borderColor,strokeWidth:borderWidth,strokeLinejoin:\"miter\",strokeMiterlimit:10,vectorEffect:\"non-scaling-stroke\"}),cornerHighlights.map((path,index)=>/*#__PURE__*/_jsx(\"path\",{d:path,fill:\"none\",stroke:highlightColor,strokeWidth:highlightWidth,strokeLinecap:\"square\",strokeLinejoin:\"miter\",strokeMiterlimit:10,vectorEffect:\"non-scaling-stroke\",style:{filter:glow?`drop-shadow(0 0 ${Math.max(2,glowStrength*.65)}px ${highlightColor})`:\"none\"}},index))]})});}function clamp(value,min,max){return Math.min(max,Math.max(min,value));}function createBorderPath(width,height,cut){return`\n        M ${cut} 0\n        H ${width-cut}\n        L ${width} ${cut}\n        V ${height-cut}\n        L ${width-cut} ${height}\n        H ${cut}\n        L 0 ${height-cut}\n        V ${cut}\n        Z\n    `;}function createCornerHighlights(width,height,cut,extension){return[// Top-left:\n// top edge → full diagonal → left edge\n`\n            M ${cut+extension} 0\n            H ${cut}\n            L 0 ${cut}\n            V ${cut+extension}\n        `,// Top-right\n`\n            M ${width-cut-extension} 0\n            H ${width-cut}\n            L ${width} ${cut}\n            V ${cut+extension}\n        `,// Bottom-right\n`\n            M ${width} ${height-cut-extension}\n            V ${height-cut}\n            L ${width-cut} ${height}\n            H ${width-cut-extension}\n        `,// Bottom-left\n`\n            M ${cut+extension} ${height}\n            H ${cut}\n            L 0 ${height-cut}\n            V ${height-cut-extension}\n        `];}SciFiPanel.defaultProps={cornerCut:16,highlightLength:18,borderWidth:1.25,highlightWidth:2.25,borderColor:\"#49CFE8\",highlightColor:\"#D7FAFF\",backgroundEnabled:false,backgroundColor:\"#092A40\",backgroundOpacity:.14,glow:true,glowStrength:5};addPropertyControls(SciFiPanel,{cornerCut:{type:ControlType.Number,title:\"Corner Cut\",defaultValue:16,min:0,max:100,step:1},highlightLength:{type:ControlType.Number,title:\"Highlight Length\",defaultValue:18,min:0,max:100,step:1},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:1.25,min:.5,max:8,step:.25},highlightWidth:{type:ControlType.Number,title:\"Highlight Width\",defaultValue:2.25,min:.5,max:10,step:.25},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#49CFE8\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#D7FAFF\"},backgroundEnabled:{type:ControlType.Boolean,title:\"Background\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},backgroundColor:{type:ControlType.Color,title:\"BG Color\",defaultValue:\"#092A40\",hidden(props){return!props.backgroundEnabled;}},backgroundOpacity:{type:ControlType.Number,title:\"BG Opacity\",defaultValue:.14,min:0,max:1,step:.01,hidden(props){return!props.backgroundEnabled;}},glow:{type:ControlType.Boolean,title:\"Glow\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},glowStrength:{type:ControlType.Number,title:\"Glow Amount\",defaultValue:5,min:0,max:30,step:1,hidden(props){return!props.glow;}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SciFiPanel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ChamferedPanel.map"],"mappings":"+LAGG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,YAAU,kBAAgB,cAAY,iBAAe,cAAY,iBAAe,oBAAkB,kBAAgB,oBAAkB,OAAK,eAAa,SAAO,EAAY,EAAaA,EAAa,IAAI,EAAO,CAAC,EAAK,GAASC,EAAe,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,EAErT,MAA0B,CAAC,IAAM,EAAQ,EAAa,QAAQ,GAAG,CAAC,EAAQ,OAAO,IAAM,MAAe,CAAC,IAAM,EAAK,EAAQ,sBAAsB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