{"version":3,"file":"TemplateID.DuUCUezs.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/qWYtVRFzIb56NF0Ys4nc/EcbdflexEI1X7dAIjJ33/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":"oOAA2C,IAAoC,CACzE,EAAoB,iBAA8B,EAAyB,GAAmB,GAAO,CAC3G,IAAM,EAAIA,EAAO,KAAK,CAQtB,OARuB,MAAc,CACrC,GAAU,IAAS,OAAY,OAC/B,IAAM,EAAiB,EAAI,SAA2D,YAChF,EAAa,aAAa,QAAQ,EAAoB,CAAK,EAAe,EAAE,CAAC,GAAG,EAAc,GAAG,CAAC,EAAe,KAAK,MAAM,EAAa,OAAQ,EAAM,CAAC,QAAQ,MAAM,mCAAmC,EAAM,CACrN,AAAgD,EAAe,8BAA4B,EAAE,CAC1F,GAAI,CAAC,EAAe,4BAA4B,SAAS,EAAG,GAAE,EAAe,4BAA4B,CAAC,GAAG,EAAe,6BAA6B,EAAE,CAAC,EAAG,EAClK,GAAG,CAAC,EAAe,QAAQ,IAAI,IAAI,EAAO,SAAS,KAAK,CAAC,eAAgB,EAAM,CAAC,QAAQ,MAAM,yBAAyB,EAAM,CAC7H,aAAa,QAAQ,EAAoB,KAAK,UAAU,EAAe,CAAC,EAAG,EAAE,CAAC,CAC1D,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,CAAC"}