{"version":3,"file":"StructuredData.Cy_kUL6j.mjs","names":["React.useRef","React.useMemo"],"sources":["https:/framerusercontent.com/modules/nQIWx5hHwvtexvsVBi5x/qOvZn96XqGuXGqym7eJg/StructuredData.js"],"sourcesContent":["// User request: Create a new Framer code component named StructuredData that renders no visible UI and injects valid JSON-LD into the document head. It must support a Type control with options Organization, Article, CreativeWork, Breadcrumbs, FAQ; expose editable string controls needed for each type (name/title, description, canonical URL, image URL, datePublished, dateModified, author, breadcrumb item names/URLs, and FAQ questions/answers). Keep defaults minimal and never fabricate claims. It must be safe for CMS-bound strings and avoid duplicate scripts per instance.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function cleanString(value){if(typeof value!==\"string\")return\"\";return value.replace(/[\\u0000-\\u001F\\u007F]/g,\"\").trim();}function isValidUrl(value){const safe=cleanString(value);if(!safe)return false;try{const url=new URL(safe);return url.protocol===\"http:\"||url.protocol===\"https:\";}catch{return false;}}function buildSchema(props){const schemaType=props.schemaType;const name=cleanString(props.name);const title=cleanString(props.title);const description=cleanString(props.description);const canonicalUrl=cleanString(props.canonicalUrl);const imageUrl=cleanString(props.imageUrl);const datePublished=cleanString(props.datePublished);const dateModified=cleanString(props.dateModified);const author=cleanString(props.author);if(schemaType===\"Organization\"){if(!name)return null;const organization={\"@context\":\"https://schema.org\",\"@type\":\"Organization\",name};if(description)organization.description=description;if(isValidUrl(canonicalUrl))organization.url=canonicalUrl;if(isValidUrl(imageUrl))organization.image=imageUrl;return organization;}if(schemaType===\"Article\"){const headline=title||name;if(!headline)return null;const article={\"@context\":\"https://schema.org\",\"@type\":\"Article\",headline};if(description)article.description=description;if(isValidUrl(canonicalUrl))article.url=canonicalUrl;if(isValidUrl(imageUrl))article.image=[imageUrl];if(datePublished)article.datePublished=datePublished;if(dateModified)article.dateModified=dateModified;if(author)article.author={\"@type\":\"Person\",name:author};return article;}if(schemaType===\"CreativeWork\"){const creativeWorkName=title||name;if(!creativeWorkName)return null;const creativeWork={\"@context\":\"https://schema.org\",\"@type\":\"CreativeWork\",name:creativeWorkName};if(description)creativeWork.description=description;if(isValidUrl(canonicalUrl))creativeWork.url=canonicalUrl;if(isValidUrl(imageUrl))creativeWork.image=imageUrl;if(datePublished)creativeWork.datePublished=datePublished;if(dateModified)creativeWork.dateModified=dateModified;if(author)creativeWork.author={\"@type\":\"Person\",name:author};return creativeWork;}if(schemaType===\"Breadcrumbs\"){const items=(props.breadcrumbItems||[]).map(item=>({name:cleanString(item?.name),url:cleanString(item?.url)})).filter(item=>item.name&&isValidUrl(item.url));if(items.length===0)return null;return{\"@context\":\"https://schema.org\",\"@type\":\"BreadcrumbList\",itemListElement:items.map((item,index)=>({\"@type\":\"ListItem\",position:index+1,name:item.name,item:item.url}))};}if(schemaType===\"FAQ\"){const questions=(props.faqItems||[]).map(item=>({question:cleanString(item?.question),answer:cleanString(item?.answer)})).filter(item=>item.question&&item.answer);if(questions.length===0)return null;return{\"@context\":\"https://schema.org\",\"@type\":\"FAQPage\",mainEntity:questions.map(item=>({\"@type\":\"Question\",name:item.question,acceptedAnswer:{\"@type\":\"Answer\",text:item.answer}}))};}return null;}/**\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function StructuredData(props){const instanceScriptId=React.useRef(`framer-structured-data-${Math.random().toString(36).slice(2)}`);const schemaObject=React.useMemo(()=>buildSchema(props),[props]);const schemaJson=React.useMemo(()=>schemaObject?JSON.stringify(schemaObject):\"\",[schemaObject]);React.useEffect(()=>{if(typeof document===\"undefined\")return;const scriptId=instanceScriptId.current;const existing=document.getElementById(scriptId);if(!schemaJson){if(existing?.parentNode){existing.parentNode.removeChild(existing);}return;}let script=existing;if(!script){script=document.createElement(\"script\");script.id=scriptId;script.type=\"application/ld+json\";script.setAttribute(\"data-framer-structured-data\",\"true\");document.head.appendChild(script);}script.textContent=schemaJson;return()=>{const mountedScript=document.getElementById(scriptId);if(mountedScript?.parentNode){mountedScript.parentNode.removeChild(mountedScript);}};},[schemaJson]);return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{width:1,height:1,opacity:0,pointerEvents:\"none\",overflow:\"hidden\"}});}addPropertyControls(StructuredData,{schemaType:{type:ControlType.Enum,title:\"Type\",options:[\"Organization\",\"Article\",\"CreativeWork\",\"Breadcrumbs\",\"FAQ\"],optionTitles:[\"Organization\",\"Article\",\"CreativeWork\",\"Breadcrumbs\",\"FAQ\"],defaultValue:\"Organization\"},name:{type:ControlType.String,title:\"Name\",defaultValue:\"\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"\",hidden:props=>props.schemaType===\"Organization\"},description:{type:ControlType.String,title:\"Description\",defaultValue:\"\",displayTextArea:true,hidden:props=>props.schemaType===\"Breadcrumbs\"||props.schemaType===\"FAQ\"},canonicalUrl:{type:ControlType.String,title:\"Canonical URL\",defaultValue:\"\",hidden:props=>props.schemaType===\"Breadcrumbs\"||props.schemaType===\"FAQ\"},imageUrl:{type:ControlType.String,title:\"Image URL\",defaultValue:\"\",hidden:props=>props.schemaType===\"Breadcrumbs\"||props.schemaType===\"FAQ\"},datePublished:{type:ControlType.String,title:\"Date Published\",defaultValue:\"\",hidden:props=>props.schemaType===\"Organization\"||props.schemaType===\"Breadcrumbs\"||props.schemaType===\"FAQ\"},dateModified:{type:ControlType.String,title:\"Date Modified\",defaultValue:\"\",hidden:props=>props.schemaType===\"Organization\"||props.schemaType===\"Breadcrumbs\"||props.schemaType===\"FAQ\"},author:{type:ControlType.String,title:\"Author\",defaultValue:\"\",hidden:props=>props.schemaType===\"Organization\"||props.schemaType===\"Breadcrumbs\"||props.schemaType===\"FAQ\"},breadcrumbItems:{type:ControlType.Array,title:\"Breadcrumbs\",hidden:props=>props.schemaType!==\"Breadcrumbs\",defaultValue:[{name:\"\",url:\"\"}],control:{type:ControlType.Object,controls:{name:{type:ControlType.String,title:\"Name\",defaultValue:\"\"},url:{type:ControlType.String,title:\"URL\",defaultValue:\"\"}}}},faqItems:{type:ControlType.Array,title:\"FAQ\",hidden:props=>props.schemaType!==\"FAQ\",defaultValue:[{question:\"\",answer:\"\"}],control:{type:ControlType.Object,controls:{question:{type:ControlType.String,title:\"Question\",defaultValue:\"\"},answer:{type:ControlType.String,title:\"Answer\",defaultValue:\"\",displayTextArea:true}}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StructuredData\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"1\",\"framerIntrinsicWidth\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./StructuredData.map"],"mappings":"mLAC2H,SAAS,EAAY,EAAM,CAAqC,OAAjC,OAAO,GAAQ,SAAyB,EAAM,QAAQ,yBAAyB,EAAE,CAAC,CAAC,KAAK,EAA1D,EAA4D,CAAC,SAAS,EAAW,EAAM,CAAC,IAAM,EAAK,EAAY,CAAK,EAAE,GAAG,CAAC,EAAK,MAAO,GAAM,GAAG,CAAC,IAAM,EAAI,IAAI,IAAI,CAAI,EAAE,OAAO,EAAI,WAAW,SAAS,EAAI,WAAW,QAAS,MAAM,CAAC,MAAO,EAAM,CAAC,CAAC,SAAS,EAAY,EAAM,CAAC,IAAM,EAAW,EAAM,WAAiB,EAAK,EAAY,EAAM,IAAI,EAAQ,EAAM,EAAY,EAAM,KAAK,EAAQ,EAAY,EAAY,EAAM,WAAW,EAAQ,EAAa,EAAY,EAAM,YAAY,EAAQ,EAAS,EAAY,EAAM,QAAQ,EAAQ,EAAc,EAAY,EAAM,aAAa,EAAQ,EAAa,EAAY,EAAM,YAAY,EAAQ,EAAO,EAAY,EAAM,MAAM,EAAE,GAAG,IAAa,eAAe,CAAC,GAAG,CAAC,EAAK,OAAO,KAAK,IAAM,EAA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