{"version":3,"file":"SeriesNavigation.DNXCSZ10.mjs","names":["React.useMemo","React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/CtvJC4NJGV3dwZSj6xEO/QfnZEEieOXR8jdFItFdm/SeriesNavigation.js"],"sourcesContent":["// Generated from canonical Git sources; do not patch this file directly.\n/** Shared data rules only. This module must not modify the DOM or inject styles. */import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";const PRODUCTION_API=\"https://yeomi-pr-web-worker-production.yeomi-pr-web-worker.workers.dev\";const BRANCH_PREVIEW_API=\"https://yeomi-pr-web-branch-proxy.yeomi-pr-web-worker.workers.dev\";function runtimeApiBase(configured=PRODUCTION_API,hostname=typeof window===\"undefined\"?\"\":window.location.hostname){const url=new URL(configured);if(url.protocol!==\"https:\")throw new Error(\"HTTPS_REQUIRED\");const preview=hostname.endsWith(\".framer.app\")&&hostname.includes(\"--\");if(preview&&url.origin===PRODUCTION_API)return BRANCH_PREVIEW_API;if(!preview&&url.origin===BRANCH_PREVIEW_API)return PRODUCTION_API;return configured;}const MAGAZINE_SERIES=[[\"news\",\"여미 News\"],[\"pick\",\"여미 Pick\"],[\"view\",\"여미 View\"],[\"signature\",\"여미 Signature\"]];const YOUTUBE_SERIES=[[\"signature\",\"여행실험\"],[\"view\",\"여행질문\"],[\"pick\",\"극락여행사\"],[\"news\",\"여행토크\"]];/** Normalize CMS hashtag strings consistently without changing presentation. */function splitHashtags(value){return[...new Set(value.split(/[\\s,，、#]+/u).map(tag=>tag.trim()).filter(Boolean))];}function listingQuery(page,filters){const query=new URLSearchParams({sort:\"newest\",page:String(page),pageSize:\"24\"});for(const[key,value]of Object.entries(filters))if(value)query.set(key,value);return query;}/** Shared transport, validation and cancellable backoff; callers own UI state. */async function fetchListingPage(url,page,signal,options){const attempts=Math.max(1,options.attempts);for(let attempt=0;attempt<attempts;attempt+=1){const response=await fetch(url,{signal});if(response.ok)return parseListingPage(await response.json(),page);if(response.status!==429&&response.status<500||attempt===attempts-1)throw new Error(`${options.label} API ${response.status}`);const retryAfter=Number(response.headers.get(\"retry-after\")||\"0\");await abortableDelay(Math.max(750,Math.min(2e3,retryAfter*1e3||750*(attempt+1))),signal);}throw new Error(`${options.label} API request exhausted`);}function parseListingPage(value,page){if(!value||typeof value!==\"object\"||!(\"items\"in value)||!Array.isArray(value.items))throw new Error(\"INVALID_LISTING_RESPONSE\");const payload=value;const items=value.items.map(item=>{if(!item||typeof item!==\"object\")throw new Error(\"INVALID_LISTING_ITEM\");const record=item;for(const key of[\"id\",\"slug\",\"title\",\"postedAt\",\"coverUrl\"]){if(typeof record[key]!==\"string\")throw new Error(`INVALID_LISTING_FIELD:${key}`);}if(record.hashtags!=null&&typeof record.hashtags!==\"string\"&&!(Array.isArray(record.hashtags)&&record.hashtags.every(tag=>typeof tag===\"string\")))throw new Error(\"INVALID_LISTING_FIELD:hashtags\");return record;});const number=(key,fallback)=>{if(payload[key]==null)return fallback;const result=payload[key];if(typeof result!==\"number\"||!Number.isSafeInteger(result)||result<0)throw new Error(`INVALID_LISTING_FIELD:${key}`);return result;};return{items,page,totalPages:Math.max(page,number(\"totalPages\",page)),total:number(\"total\",items.length)};}function formatListingDate(value){const date=new Date(value);return Number.isNaN(date.getTime())?\"\":`${date.getFullYear()}. ${String(date.getMonth()+1).padStart(2,\"0\")}. ${String(date.getDate()).padStart(2,\"0\")}.`;}/** Cancel backoff immediately when the owning controller unmounts. */function abortableDelay(milliseconds,signal){return new Promise((resolve,reject)=>{if(signal.aborted){reject(signal.reason);return;}const abort=()=>{clearTimeout(timer);reject(signal.reason);};const timer=setTimeout(()=>{signal.removeEventListener(\"abort\",abort);resolve();},milliseconds);signal.addEventListener(\"abort\",abort,{once:true});});}// Responsive Canvas instances may coexist. Share one controller until the last\n// instance unmounts, then release every listener/observer owned by that route.\nconst controllerOwners=new Map;function retainController(key,start){let entry=controllerOwners.get(key);if(!entry){entry={count:0,dispose:start()||(()=>{})};controllerOwners.set(key,entry);}entry.count+=1;let released=false;return()=>{if(released)return;released=true;entry.count-=1;if(entry.count===0){entry.dispose();controllerOwners.delete(key);}};}const DEFAULT_API=PRODUCTION_API;import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Shared dynamic series navigation for listing and detail routes.\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function SeriesNavigation(props){const canvas=RenderTarget.current()===RenderTarget.canvas;const route=React.useMemo(()=>routeState(props.section,props.slug),[props.section,props.slug]);const[active,setActive]=React.useState(route);React.useEffect(()=>{if(canvas||route.slug)return;const restore=()=>setActive(routeState(props.section,props.slug));window.addEventListener(\"yeomi:listing-state\",restore);window.addEventListener(\"popstate\",restore);return()=>{window.removeEventListener(\"yeomi:listing-state\",restore);window.removeEventListener(\"popstate\",restore);};},[canvas,route.slug,props.section,props.slug]);React.useEffect(()=>{if(canvas||!route.slug){setActive(route);return;}const controller=new AbortController;const load=async()=>{try{const base=new URL(runtimeApiBase(props.apiBaseUrl||DEFAULT_API));if(base.protocol!==\"https:\")throw new Error(\"HTTPS_REQUIRED\");const url=new URL(\"/api/search\",base);url.searchParams.set(\"slug\",route.slug);url.searchParams.set(\"pageSize\",\"1\");const response=await fetch(url,{signal:controller.signal});if(!response.ok)throw new Error(`SERIES_NAVIGATION_${response.status}`);const payload=await response.json();const article=payload.items?.[0];if(!article)return;setActive({section:article.source===\"youtube\"?\"youtube\":\"magazine\",category:article.mainCategory??\"\",series:article.subCategories?.[0]??\"\",slug:route.slug});}catch(error){if(error.name!==\"AbortError\")setActive(route);}};void load();return()=>controller.abort();},[canvas,props.apiBaseUrl,route]);const section=active.section;const base=section===\"youtube\"?\"/youtube\":\"/magazine\";return /*#__PURE__*/_jsxs(\"nav\",{className:\"yeomi-series-navigation\",\"aria-label\":section===\"youtube\"?\"유튜브 시리즈\":\"매거진 카테고리\",style:props.style,children:[/*#__PURE__*/_jsx(\"style\",{children:css}),/*#__PURE__*/_jsx(\"a\",{className:\"title\",href:base,children:section===\"youtube\"?\"YOUTUBE\":\"MAGAZINE\"}),/*#__PURE__*/_jsx(\"a\",{className:!active.category&&!active.series?\"active\":\"\",\"aria-current\":!active.category&&!active.series?\"page\":undefined,href:base,children:\"All\"}),section===\"magazine\"?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(MagazineRegion,{category:\"domestic\",label:\"국내여행\",activeCategory:active.category,activeSeries:active.series}),/*#__PURE__*/_jsx(MagazineRegion,{category:\"foreign\",label:\"해외여행\",activeCategory:active.category,activeSeries:active.series})]}):/*#__PURE__*/_jsx(\"div\",{className:\"series youtube-series\",children:YOUTUBE_SERIES.map(([value,label])=>/*#__PURE__*/_jsx(\"a\",{className:active.series===value?\"active\":\"\",\"aria-current\":active.series===value?\"page\":undefined,href:`${base}?subCategory=${value}`,children:label},value))})]});}function MagazineRegion({category,label,activeCategory,activeSeries}){return /*#__PURE__*/_jsxs(\"section\",{className:\"region\",\"aria-label\":label,children:[/*#__PURE__*/_jsx(\"a\",{className:activeCategory===category&&!activeSeries?\"active region-title\":\"region-title\",href:`/magazine?category=${category}`,\"aria-current\":activeCategory===category&&!activeSeries?\"page\":undefined,children:label}),/*#__PURE__*/_jsx(\"div\",{className:\"series\",children:MAGAZINE_SERIES.map(([value,seriesLabel])=>/*#__PURE__*/_jsx(\"a\",{className:activeCategory===category&&activeSeries===value?\"active\":\"\",href:`/magazine?category=${category}&subCategory=${value}`,\"aria-current\":activeCategory===category&&activeSeries===value?\"page\":undefined,children:seriesLabel},`${category}-${value}`))})]});}function routeState(fallback,configuredSlug){if(typeof window===\"undefined\")return{section:fallback,category:fallback===\"magazine\"?\"domestic\":\"\",series:fallback===\"magazine\"?\"pick\":\"\",slug:configuredSlug.trim()};const section=window.location.pathname.startsWith(\"/youtube\")?\"youtube\":window.location.pathname.startsWith(\"/magazine\")?\"magazine\":fallback;const params=new URLSearchParams(window.location.search);const parts=window.location.pathname.split(\"/\").filter(Boolean);let slug=configuredSlug.trim()||(parts.length>1?parts[parts.length-1]??\"\":\"\");try{slug=decodeURIComponent(slug);}catch{}return{section,category:params.get(\"category\")??\"\",series:params.get(\"subCategory\")??\"\",slug};}const css=`.yeomi-series-navigation{align-self:start;display:flex;flex-direction:column;font-family:\"Pretendard Variable\",Pretendard,sans-serif;padding-top:14px;width:100%}\n.yeomi-series-navigation a{box-sizing:border-box;color:#A5A5A5;font-size:14px;font-weight:500;line-height:1.3;padding:8px 0;text-decoration:none;transition:color .15s ease}\n.yeomi-series-navigation a:hover,.yeomi-series-navigation a:focus-visible,.yeomi-series-navigation a.active{color:#FF6F00;font-weight:700}\n.yeomi-series-navigation .title{border-bottom:2px solid #111;color:#111;font-size:18px;font-weight:800;margin-bottom:6px;padding:0 0 16px}\n.yeomi-series-navigation .region{display:flex;flex-direction:column;padding:8px 0 14px}\n.yeomi-series-navigation .region+.region{border-top:1px solid #D9D9D9;margin-top:2px;padding-top:16px}\n.yeomi-series-navigation .region-title{color:#575757;font-weight:600;padding-bottom:11px}\n.yeomi-series-navigation .region .series a{padding-left:28px}\n.yeomi-series-navigation .series{display:flex;flex-direction:column}\n.yeomi-series-navigation .youtube-series{padding-top:2px}`;SeriesNavigation.displayName=\"SeriesNavigation\";SeriesNavigation.defaultProps={apiBaseUrl:DEFAULT_API,slug:\"\",section:\"magazine\"};addPropertyControls(SeriesNavigation,{apiBaseUrl:{type:ControlType.String,title:\"API\",defaultValue:DEFAULT_API},slug:{type:ControlType.String,title:\"Slug\",placeholder:\"비우면 현재 URL\"},section:{type:ControlType.Enum,title:\"Section\",options:[\"magazine\",\"youtube\"],optionTitles:[\"Magazine\",\"YouTube\"],defaultValue:\"magazine\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SeriesNavigation\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"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