{"version":3,"file":"CMS2JSON_Source.VsOYxOD9.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/eyBZRZiXLfizxHbKRkQW/s5T2bka4dKdlUfAjyqVf/CMS2JSON_Source.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import{useRef,cloneElement,useState,useEffect}from\"react\";export default function CMS2JSON_Source(props){const{cmsCollection}=props;const cloneRef=useRef();const stateRef=useRef();const displayRef=useRef();const[state,setState]=useState(\"loading\");const[jsonData,setJsonData]=useState(\"\");const collectCMSData=async()=>{if(!cloneRef.current)return;const results=[];const dataItems=cloneRef.current.querySelectorAll(`[aria-label=\"cms-item\"]`);console.log(\"items\",dataItems);dataItems.forEach(item=>{const dataItem={properties:[]};const properties=item.querySelectorAll(`[aria-label^=\"cms-\"]`);console.log(\"props\",properties);properties.forEach(property=>{// cms-[type]-[name -...]\nconst titleProps=property.ariaLabel.split(\"-\");const type=titleProps[1];const name=titleProps.slice(2).join(\"-\");dataItem.properties.push({key:name,type:type,value:property.textContent});});results.push(dataItem);});return results;};useEffect(()=>{collectCMSData().then(data=>{const dataString=JSON.stringify(data);console.log(\"data\",data);setJsonData(dataString);setState(\"done\");}).catch(()=>{setState(\"error\");});},[]);return /*#__PURE__*/_jsxs(motion.div,{style:{position:\"relative\"},children:[/*#__PURE__*/_jsx(\"div\",{ref:stateRef,id:\"cms-data-state\",children:state}),/*#__PURE__*/_jsx(\"div\",{ref:cloneRef,style:{position:\"absolute\",left:0,top:0,width:0,height:0,overflow:\"hidden\"},children:cmsCollection&&cmsCollection[0]&&/*#__PURE__*/cloneElement(cmsCollection[0])}),/*#__PURE__*/_jsx(\"code\",{ref:displayRef,id:\"cms-data-display\",style:{maxWidth:\"100%\"},children:jsonData})]});}addPropertyControls(CMS2JSON_Source,{cmsCollection:{type:ControlType.Slot,maxCount:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMS2JSON_Source\",\"slots\":[\"cmsCollection\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMS2JSON_Source.map"],"mappings":"mPACyM,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,iBAAe,EAAY,EAASA,GAAQ,CAAO,EAASA,GAAQ,CAAO,EAAWA,GAAQ,CAAM,CAAC,EAAM,GAAUC,EAAS,UAAU,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAO,EAAe,SAAS,CAAC,GAAG,CAAC,EAAS,QAAQ,OAAO,IAAM,EAAQ,EAAE,CAAO,EAAU,EAAS,QAAQ,iBAAiB,0BAA0B,CAChX,OADiX,QAAQ,IAAI,QAAQ,EAAU,CAAC,EAAU,QAAQ,GAAM,CAAC,IAAM,EAAS,CAAC,WAAW,EAAE,CAAC,CAAO,EAAW,EAAK,iBAAiB,uBAAuB,CAAC,QAAQ,IAAI,QAAQ,EAAW,CAAC,EAAW,QAAQ,GAAU,CAC5xB,IAAM,EAAW,EAAS,UAAU,MAAM,IAAI,CAAO,EAAK,EAAW,GAAS,EAAK,EAAW,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,EAAS,WAAW,KAAK,CAAC,IAAI,EAAU,OAAK,MAAM,EAAS,YAAY,CAAC,EAAG,CAAC,EAAQ,KAAK,EAAS,EAAG,CAAQ,GAAuM,OAA7L,MAAc,CAAC,GAAgB,CAAC,KAAK,GAAM,CAAC,IAAM,EAAW,KAAK,UAAU,EAAK,CAAC,QAAQ,IAAI,OAAO,EAAK,CAAC,EAAY,EAAW,CAAC,EAAS,OAAO,EAAG,CAAC,UAAU,CAAC,EAAS,QAAQ,EAAG,EAAG,EAAE,CAAC,CAAqB,EAAM,EAAO,IAAI,CAAC,MAAM,CAAC,SAAS,WAAW,CAAC,SAAS,CAAc,EAAK,MAAM,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