{"version":3,"file":"conditionalContent.RJprSVYA.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Tkqcdr5x13HFWTYBwxOC/GH82YCCW1T12gyMq9syL/conditionalContent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useState,useEffect,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth fill\n * @framerSupportedLayoutHeight auto\n */export default function ConditionalContent(props){const{content,parameterName,parameterValue,matchType,showPlaceholder,overflow,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[shouldShow,setShouldShow]=useState(false);const containerRef=useRef(null);const contentRef=useRef(null);const uniqueId=useRef(`conditional-content-${Date.now()}-${Math.random().toString(36).substr(2,9)}`);// Simple CSS injection for width forcing\nuseEffect(()=>{const styleId=`conditional-content-style-${uniqueId.current}`;let styleElement=document.getElementById(styleId);if(!styleElement){styleElement=document.createElement(\"style\");styleElement.id=styleId;styleElement.textContent=`\n                .${uniqueId.current} > * {\n                    width: 100% !important;\n                    min-width: 100% !important;\n                    max-width: 100% !important;\n                    box-sizing: border-box !important;\n                }\n                .${uniqueId.current} * {\n                    max-width: 100% !important;\n                    box-sizing: border-box !important;\n                }\n            `;document.head.appendChild(styleElement);}return()=>{if(styleElement&&styleElement.parentNode){styleElement.parentNode.removeChild(styleElement);}};},[]);// Simple resize and breakpoint handler\nuseEffect(()=>{if(isCanvas)return;// Don't run on canvas\n// Simple function to check and fix width\nconst checkAndFixWidth=()=>{if(!contentRef.current)return;const children=contentRef.current.children;for(let i=0;i<children.length;i++){const child=children[i];if(child&&child.offsetWidth!==contentRef.current.offsetWidth){// Force reflow by toggling class\nconst currentClass=contentRef.current.className;contentRef.current.className=\"\";void contentRef.current.offsetHeight;contentRef.current.className=currentClass;break;}}};// Check periodically for Framer breakpoint changes\nconst interval=setInterval(checkAndFixWidth,500);// Also on window resize\nwindow.addEventListener(\"resize\",checkAndFixWidth);return()=>{clearInterval(interval);window.removeEventListener(\"resize\",checkAndFixWidth);};},[isCanvas]);// Handle URL parameter checking\nuseEffect(()=>{if(typeof window!==\"undefined\"&&!isCanvas){const urlParams=new URLSearchParams(window.location.search);const param=urlParams.get(parameterName);if(param!==null){if(matchType===\"exists\"){setShouldShow(true);}else if(matchType===\"equals\"){setShouldShow(param===parameterValue);}else if(matchType===\"contains\"){setShouldShow(param.includes(parameterValue));}}else{setShouldShow(false);}}},[parameterName,parameterValue,matchType,isCanvas]);// Hide the Framer wrapper container when content is hidden\nuseEffect(()=>{if(!isCanvas&&containerRef.current){let wrapper=containerRef.current.parentElement;while(wrapper&&!wrapper.className?.includes(\"framer-\")){wrapper=wrapper.parentElement;}if(wrapper){if(!shouldShow){wrapper.style.display=\"none\";wrapper.style.height=\"0\";wrapper.style.minHeight=\"0\";wrapper.style.margin=\"0\";wrapper.style.padding=\"0\";}else{wrapper.style.display=\"\";wrapper.style.height=\"\";wrapper.style.minHeight=\"\";wrapper.style.margin=\"\";wrapper.style.padding=\"\";}}}},[shouldShow,isCanvas]);// In canvas mode\nif(isCanvas){if(!showPlaceholder){return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{display:\"none\"}});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"100%\",height:\"auto\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{ref:contentRef,className:uniqueId.current,style:{width:\"100%\",minWidth:\"100%\",maxWidth:\"100%\",height:\"auto\",overflow:\"visible\",display:\"block\",boxSizing:\"border-box\"},children:content})});}// On published site\nreturn /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:shouldShow?{...style,width:\"100%\",minWidth:\"100%\",maxWidth:\"100%\",position:\"relative\",display:\"block\",boxSizing:\"border-box\"}:{display:\"none\"},children:shouldShow&&/*#__PURE__*/_jsx(\"div\",{ref:contentRef,className:uniqueId.current,style:{width:\"100%\",minWidth:\"100%\",maxWidth:\"100%\",overflow:overflow||\"hidden\",display:\"block\",boxSizing:\"border-box\"},children:content})});}ConditionalContent.defaultProps={parameterName:\"hide\",parameterValue:\"\",matchType:\"exists\",showPlaceholder:false,placeholderText:\"Hidden Content\",overflow:\"hidden\"};addPropertyControls(ConditionalContent,{content:{type:ControlType.ComponentInstance,title:\"Content\",description:\"Connect the stack or component to show conditionally\"},parameterName:{type:ControlType.String,title:\"Parameter Name\",description:\"URL parameter to check for\",defaultValue:\"hide\"},matchType:{type:ControlType.Enum,title:\"Match Type\",options:[\"exists\",\"equals\",\"contains\"],optionTitles:[\"Exists\",\"Equals\",\"Contains\"],defaultValue:\"exists\"},parameterValue:{type:ControlType.String,title:\"Parameter Value\",description:\"Value to match (for equals/contains)\",defaultValue:\"\",hidden:props=>props.matchType===\"exists\"},showPlaceholder:{type:ControlType.Boolean,title:\"Show in Canvas\",description:\"Display content in canvas mode\",defaultValue:false},overflow:{type:ControlType.Enum,title:\"Overflow\",description:\"CSS overflow property for content\",options:[\"hidden\",\"visible\",\"auto\",\"scroll\"],optionTitles:[\"Hidden\",\"Visible\",\"Auto\",\"Scroll\"],defaultValue:\"hidden\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ConditionalContent\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fill\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./conditionalContent.map"],"mappings":"4UAGG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,UAAQ,gBAAc,iBAAe,YAAU,kBAAgB,WAAS,QAAM,CAAC,EAAY,EAAS,EAAa,YAAY,EAAa,OAAY,CAAC,EAAW,EAAc,CAACA,EAAS,IAAa,EAAaC,EAAO,MAAY,EAAWA,EAAO,MAAY,EAASA,EAAO,uBAAuB,KAAK,MAAM,GAAG,KAAK,SAAS,SAAS,IAAI,OAAO,EAAE,MAsBzZ,OArBA,MAAc,CAAC,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