{"version":3,"file":"LifestyleDeepLink._eXNIOGk.mjs","names":["forwardRef","useRef","useEffect","_jsx","useState","forwardRef","_jsx","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","c","J","init_jsx_runtime","ce","de","window","useRouter","init_framer_ChujFWHC","useCurrentRouteId","setForwardedRef","ref","value","useLifestyleDestination","router","routeId","path","english","destination","route","href","keepEnglishHref","root","update","links","link","previous","observer","withStoredTab","Component","tab","props","forwardedRef","localRef","disconnect","rememberTab","event","storageKey","node","withHealthyLink","withLowSodiumLink","withMomKidsLink","withSeniorsLink","withBusinessLink","withTargetTab","variant","setVariant","variants","withLifestyleGroupLinks","rememberClickedTab","clickable","label","match","lifestyleTabByLabel","text","init_LifestyleTwoCardTest","titleKey","withLifestyleLinkByText","withHealthyCardLink","withLowSodiumCardLink","withMomKidsCardLink","withSeniorsCardLink","withBusinessCardLink","withMenuDetailFromCardText","title","withBlogDetailFromCardText","key","slug","blogSlugByTitle","init_LifestyleDeepLink"],"sources":["https:/framerusercontent.com/modules/wcJA0YeRUEgQN55ljr2r/J3YK4PRnzYazk4nhWKJg/LifestyleTwoCardTest.js","https:/framerusercontent.com/modules/crbZjpMNkO2okZuowGeF/GZVkAx4k3StEsCZ3GlLJ/LifestyleDeepLink.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{useRouter,useCurrentRouteId}from\"framer\";const storageKey=\"kitchi-lifestyle-tab\";function setForwardedRef(ref,value){if(typeof ref===\"function\"){ref(value);}else if(ref){ref.current=value;}}// Keep shared cards in the current language, including Framer Preview.\nfunction useLifestyleDestination(){const router=useRouter();const routeId=useCurrentRouteId();const path=router.routes?.[routeId]?.path||\"/\";const english=/^\\/en(?:\\/|$)/.test(path);const destination=Object.entries(router.routes||{}).find(([,route])=>route.path===(english?\"/en/target\":\"/target\"));const href=path===\"/en\"?\"./en/target\":\"./target\";return{router,english,destinationId:destination?.[0],href};}function keepEnglishHref(root,href){const update=()=>{const links=root.matches(\"a\")?[root]:Array.from(root.querySelectorAll(\"a\"));for(const link of links){const previous=link.getAttribute(\"href\")||\"\";if(/\\/target(?:[?#]|$)/.test(previous)&&previous!==href){link.setAttribute(\"href\",href);}}};update();const observer=new MutationObserver(update);observer.observe(root,{subtree:true,childList:true,attributes:true,attributeFilter:[\"href\"]});return()=>observer.disconnect();}function withStoredTab(Component,tab){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const localRef=useRef(null);const destination=useLifestyleDestination();useEffect(()=>{const root=localRef.current;if(!root)return;const disconnect=destination.english?keepEnglishHref(root,destination.href):()=>{};const rememberTab=event=>{window.sessionStorage.setItem(storageKey,tab);if(destination.english&&destination.destinationId&&!event.metaKey&&!event.ctrlKey&&!event.shiftKey&&!event.altKey&&event.button===0){event.preventDefault();event.stopPropagation();destination.router.navigate(destination.destinationId);}};root.addEventListener(\"click\",rememberTab,true);return()=>{root.removeEventListener(\"click\",rememberTab,true);disconnect();};},[destination.english,destination.destinationId,destination.href]);const attachRef=node=>{localRef.current=node;setForwardedRef(forwardedRef,node);};return /*#__PURE__*/_jsx(Component,{ref:attachRef,...props});});}export function withHealthyLink(Component){return withStoredTab(Component,\"healthy\");}export function withLowSodiumLink(Component){return withStoredTab(Component,\"low-sodium\");}export function withMomKidsLink(Component){return withStoredTab(Component,\"mom-kids\");}export function withSeniorsLink(Component){return withStoredTab(Component,\"seniors\");}export function withBusinessLink(Component){return withStoredTab(Component,\"business\");}export function withTargetTab(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[variant,setVariant]=useState(props.variant);useEffect(()=>{const tab=window.sessionStorage.getItem(storageKey);const variants={healthy:\"Healthy\",\"low-sodium\":\"Low Sodium\",\"mom-kids\":\"Mom & Kids\",seniors:\"Seniors\",business:\"Business\"};if(tab&&variants[tab]){setVariant(variants[tab]);}window.sessionStorage.removeItem(storageKey);},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,variant:variant});});}const lifestyleTabByLabel=[[\"Healthy\",\"healthy\"],[\"Less Sodium\",\"low-sodium\"],[\"Low Sodium\",\"low-sodium\"],[\"Mom & Kids\",\"mom-kids\"],[\"Seniors\",\"seniors\"],[\"Restaurants\",\"business\"],[\"คนรักสุขภาพ\",\"healthy\"],[\"ผู้ที่ต้องควบคุมโซเดียม\",\"low-sodium\"],[\"คุณแม่และเด็ก\",\"mom-kids\"],[\"ผู้สูงอายุ\",\"seniors\"],[\"ธุรกิจร้านอาหาร\",\"business\"]];export function withLifestyleGroupLinks(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const localRef=useRef(null);const destination=useLifestyleDestination();useEffect(()=>{const root=localRef.current;if(!root)return;const disconnect=destination.english?keepEnglishHref(root,destination.href):()=>{};const rememberClickedTab=event=>{const target=event.target;const clickable=target?.closest(\"a, button, [role='link']\");if(!clickable||!root.contains(clickable))return;const label=(clickable.textContent||\"\").replace(/\\s+/g,\" \").trim();const match=lifestyleTabByLabel.find(([text])=>label.includes(text));if(match){window.sessionStorage.setItem(storageKey,match[1]);if(destination.english&&destination.destinationId&&!event.metaKey&&!event.ctrlKey&&!event.shiftKey&&!event.altKey&&event.button===0){event.preventDefault();event.stopPropagation();destination.router.navigate(destination.destinationId);}}};root.addEventListener(\"click\",rememberClickedTab,true);return()=>{root.removeEventListener(\"click\",rememberClickedTab,true);disconnect();};},[destination.english,destination.destinationId,destination.href]);const attachRef=node=>{localRef.current=node;setForwardedRef(forwardedRef,node);};return /*#__PURE__*/_jsx(Component,{ref:attachRef,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withBusinessLink\":{\"type\":\"reactHoc\",\"name\":\"withBusinessLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSeniorsLink\":{\"type\":\"reactHoc\",\"name\":\"withSeniorsLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLowSodiumLink\":{\"type\":\"reactHoc\",\"name\":\"withLowSodiumLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLifestyleGroupLinks\":{\"type\":\"reactHoc\",\"name\":\"withLifestyleGroupLinks\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHealthyLink\":{\"type\":\"reactHoc\",\"name\":\"withHealthyLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTargetTab\":{\"type\":\"reactHoc\",\"name\":\"withTargetTab\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMomKidsLink\":{\"type\":\"reactHoc\",\"name\":\"withMomKidsLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LifestyleTwoCardTest.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{withHealthyLink,withLowSodiumLink,withMomKidsLink,withSeniorsLink,withBusinessLink,withLifestyleGroupLinks}from\"https://framerusercontent.com/modules/wcJA0YeRUEgQN55ljr2r/J3YK4PRnzYazk4nhWKJg/LifestyleTwoCardTest.js\";const blogSlugByTitle={\"the-secret-behind-our-fresh-and-flavorful-dishes\":\"the-secret-behind-our-fresh-and-flavorful-dishes.\",\"5-must-try-signature-dishes-for-your-next-visit\":\"5-must-try-signature-dishes-for-your-next-visit.\",\"how-fresh-ingredients-transform-every-dishwe-erve\":\"how-fresh-ingredients-transform-every-dish-we-serve\",\"behind-the-kitchen-crafting-flavorful-dining-experiences\":\"behind-the-kitchen-crafting-flavorful-dining-experiences\"};function titleKey(value){return String(value??\"\").toLowerCase().trim().replace(/[^a-z0-9]+/g,\"-\").replace(/^-+|-+$/g,\"\");}export function withLifestyleFromUrl(Component){return Component;}export function withLifestyleLinkByText(Component){return withLifestyleGroupLinks(Component);}export function withHealthyCardLink(Component){return withHealthyLink(Component);}export function withLowSodiumCardLink(Component){return withLowSodiumLink(Component);}export function withMomKidsCardLink(Component){return withMomKidsLink(Component);}export function withSeniorsCardLink(Component){return withSeniorsLink(Component);}export function withBusinessCardLink(Component){return withBusinessLink(Component);}export function withMenuDetailLink(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"/menu/\"+encodeURIComponent(title):\"/menu\"});});}export function withMenuDetailNavigation(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"/menu/\"+encodeURIComponent(title):\"/menu\"});});}export function withMenuDetailNavigationRelative(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"./menu/\"+encodeURIComponent(title):\"./menu\"});});}export function withMenuDetailFromCardText(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"/menu/\"+encodeURIComponent(title):\"/menu\"});});}export function withBlogDetailFromCardText(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const key=titleKey(props.Title??props.title);const slug=blogSlugByTitle[key];return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:slug?\"/blog/\"+slug:\"/blog\"});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withLifestyleLinkByText\":{\"type\":\"reactHoc\",\"name\":\"withLifestyleLinkByText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLowSodiumCardLink\":{\"type\":\"reactHoc\",\"name\":\"withLowSodiumCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBusinessCardLink\":{\"type\":\"reactHoc\",\"name\":\"withBusinessCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLifestyleFromUrl\":{\"type\":\"reactHoc\",\"name\":\"withLifestyleFromUrl\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailNavigationRelative\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailNavigationRelative\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailNavigation\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailNavigation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSeniorsCardLink\":{\"type\":\"reactHoc\",\"name\":\"withSeniorsCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBlogDetailFromCardText\":{\"type\":\"reactHoc\",\"name\":\"withBlogDetailFromCardText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHealthyCardLink\":{\"type\":\"reactHoc\",\"name\":\"withHealthyCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMomKidsCardLink\":{\"type\":\"reactHoc\",\"name\":\"withMomKidsCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailLink\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailFromCardText\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailFromCardText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"A,+MAA2L,SAASoB,EAAgBC,EAAIC,EAAM,CAAI,OAAOD,GAAM,WAAYA,EAAIC,CAAK,EAAWD,IAAKA,EAAI,QAAQC,EAAO,CACvS,SAASC,GAAyB,CAAC,IAAMC,EAAOP,EAAU,EAAQQ,EAAQN,EAAkB,EAAQO,EAAKF,EAAO,SAASC,EAAQ,EAAE,MAAM,IAAUE,EAAQ,gBAAgB,KAAKD,CAAI,EAAQE,EAAY,OAAO,QAAQJ,EAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAEK,KAASA,EAAM,QAAQF,EAAQ,aAAa,UAAU,EAAQG,EAAKJ,IAAO,MAAM,cAAc,WAAW,MAAM,CAACF,SAAOG,UAAQ,cAAcC,IAAc,GAAGE,MAAI,CAAE,CAAC,SAASC,EAAgBC,EAAKF,EAAK,CAAC,IAAMG,MAAW,CAAC,IAAMC,EAA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