{"version":3,"file":"TemplateID.DZLoAoj7.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/y8ko3Kyby8Do4Pal5PCE/ZR1OwnD0AmrVIafee76s/TemplateID.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";// Localstorage key\nconst WEBSITE_CONTEXT_KEY=\"websiteContext\";export const withSaveIdToLocalstorage=Component=>{return props=>{// Create a ref to get the rendered element\nconst ref=useRef(null);useEffect(()=>{var _ref_current;// Ensure we're in a browser environment\nif(typeof window===\"undefined\")return;// Get the text content (ID) from the rendered element\nconst id=(_ref_current=ref.current)===null||_ref_current===void 0?void 0:_ref_current.textContent;// Get existing data from localStorage\nconst existingData=localStorage.getItem(WEBSITE_CONTEXT_KEY);let websiteContext={};if(existingData){try{websiteContext=JSON.parse(existingData);}catch(error){console.error(\"Error parsing localStorage data:\",error);}}// Initialize the lastVisitedUseCaseTemplates array if it doesn't exist\nif(!websiteContext.lastVisitedUseCaseTemplates){websiteContext.lastVisitedUseCaseTemplates=[];}// Add the ID & page url to the lastVisitedUseCaseTemplates array if it's not already\nif(id&&!websiteContext.lastVisitedUseCaseTemplates.includes(id)){websiteContext.lastVisitedUseCaseTemplates=[...websiteContext.lastVisitedUseCaseTemplates||[],id];}// Update the pageUrl every time the component is rendered\ntry{websiteContext.pageUrl=new URL(window.location.href).pathname;}catch(error){console.error(\"Error updating pageUrl\",error);}// Save to localStorage\nlocalStorage.setItem(WEBSITE_CONTEXT_KEY,JSON.stringify(websiteContext));},[]);// Return the component with its original props\nreturn /*#__PURE__*/_jsx(Component,{...props,ref:ref});};};\nexport const __FramerMetadata__ = {\"exports\":{\"withSaveIdToLocalstorage\":{\"type\":\"reactHoc\",\"name\":\"withSaveIdToLocalstorage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TemplateID.map"],"mappings":"yOACM,EAAoB,iBAA8B,EAAyB,GAAmB,GAAO,CAC3G,IAAM,EAAIA,EAAO,MAQjB,OARuB,MAAc,CAAC,IAAI,EAC1C,GAAU,IAAS,OAAY,OAC/B,IAAM,GAAI,EAAa,EAAI,UAA2D,YAChF,EAAa,aAAa,QAAQ,GAAyB,EAAe,EAAE,CAAC,GAAG,EAAc,GAAG,CAAC,EAAe,KAAK,MAAM,EAAe,OAAM,EAAM,CAAC,QAAQ,MAAM,mCAAmC,EAAQ,CACvN,AAAgD,EAAe,8BAA4B,EAAE,CAC1F,GAAI,CAAC,EAAe,4BAA4B,SAAS,KAAK,EAAe,4BAA4B,CAAC,GAAG,EAAe,6BAA6B,EAAE,CAAC,EAAG,EAClK,GAAG,CAAC,EAAe,QAAQ,IAAI,IAAI,EAAO,SAAS,MAAM,QAAU,OAAM,EAAM,CAAC,QAAQ,MAAM,yBAAyB,EAAQ,CAC/H,aAAa,QAAQ,EAAoB,KAAK,UAAU,GAAkB,EAAC,EAAE,EACzD,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,CAAG"}