{"version":3,"file":"MonthDisplay.BDbfH33e.mjs","names":[],"sources":["https:/framerusercontent.com/modules/pIGEMps6hXhOvo2SMFcy/tp3nWYy82sKTo2bHVS2f/MonthDisplay.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const now=getKSTDate();const useStore=createStore({dayInfoLoaded:false,year:now.getFullYear(),monthIndex:now.getMonth(),prevMonthVariant:\"Disabled\",nextMonthVariant:\"Default\",firstDate:null,secondDate:null,membership_number:null,name:null,birthdate:null,phone:null,email:null,membership:\"Non-Member\",enteredCouponCode:[],signupDate:null,initialPrice:null,discountedPrice:null,integratedPrice:null,additionalPrice:0,vatPrice:null,depositPrice:null,finalPrice:null,couponDetails:[],couponPrimaryDetails:[],couponSecondaryDetails:[],remarks:[],usedMileage:0,ownedMileage:0,expiredCoupons:[]});function getKSTDate(baseDate=new Date){const utc=baseDate.getTime()+baseDate.getTimezoneOffset()*6e4;return new Date(utc+9*60*60*1e3);}// helper to centralize your year-based variant rules\nfunction getMonthVariants(monthIndex,year){const today=getKSTDate();const ty=today.getFullYear();const tm=today.getMonth();const isPastOrCurrent=year<ty||year===ty&&monthIndex<=tm;return{prevMonthVariant:isPastOrCurrent?\"Disabled\":\"Default\",nextMonthVariant:\"Default\"};}// export const MONTH_NAMES = [\n//     \"JANUARY\",\n//     \"FEBRUARY\",\n//     \"MARCH\",\n//     \"APRIL\",\n//     \"MAY\",\n//     \"JUNE\",\n//     \"JULY\",\n//     \"AUGUST\",\n//     \"SEPTEMBER\",\n//     \"OCTOBER\",\n//     \"NOVEMBER\",\n//     \"DECEMBER\",\n// ]\nexport const MONTH_NAMES=[\"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\",\"10\",\"11\",\"12\"];export function displayThisMonth(Component){return props=>{const[store]=useStore();const monthName=MONTH_NAMES[store.monthIndex];const text=`${store.year}. ${monthName}`;return /*#__PURE__*/_jsx(Component,{...props,text:text});};}export function displayNextMonth(Component){return props=>{const[store]=useStore();// store.monthIndex/store.year 기준으로 +1달 계산\nconst nextIndex=(store.monthIndex+1)%12;const nextYear=store.monthIndex===11?store.year+1:store.year;const monthName=MONTH_NAMES[nextIndex];const text=`${nextYear}. ${monthName}`;return /*#__PURE__*/_jsx(Component,{...props,text:text});};}export function toggleNextMonth(Component){return props=>{const[store,setStore]=useStore();const handleClick=()=>{// variant가 Default가 아니면 무시\nif(store.nextMonthVariant!==\"Default\")return;// syncPrevVariant()\nconst{monthIndex,year}=store;const nextIndex=(monthIndex+1)%12;const nextYear=monthIndex===11?year+1:year;setStore({monthIndex:nextIndex,year:nextYear});setStore(getMonthVariants(nextIndex,nextYear));};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,variant:store.nextMonthVariant});};}export function togglePrevMonth(Component){return props=>{const[store,setStore]=useStore();const handleClick=()=>{// variant가 default가 아니면 무시\nif(store.prevMonthVariant!==\"Default\")return;// syncPrevVariant()\nconst{monthIndex,year}=store;const prevIndex=(monthIndex+11)%12;const prevYear=monthIndex===0?year-1:year;setStore({monthIndex:prevIndex,year:prevYear});setStore(getMonthVariants(prevIndex,prevYear));};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,variant:store.prevMonthVariant});};}export function calculateDay(year,monthIndex,row,col){// 이 달 1일의 요일 (0=일,1=월,…6=토)\nconst firstWeekday=new Date(year,monthIndex,1).getDay();// 이 달의 총 일수\nconst daysInMonth=new Date(year,monthIndex+1,0).getDate();// 이전 달의 총 일수\nconst daysInPrevMonth=new Date(year,monthIndex,0).getDate();// 전체 그리드 상에서의 인덱스\nconst cellIndex=row*7+col;// \"1일\"을 기준 삼아 상대적인 날짜 계산\nconst relativeDay=cellIndex-firstWeekday+1;let day;let isCurrentMonth;let actualDate;if(relativeDay<1){day=daysInPrevMonth+relativeDay;isCurrentMonth=false;actualDate=new Date(year,monthIndex-1,day);}else if(relativeDay>daysInMonth){day=relativeDay-daysInMonth;isCurrentMonth=false;actualDate=new Date(year,monthIndex+1,day);}else{day=relativeDay;isCurrentMonth=true;actualDate=new Date(year,monthIndex,day);}return{day,isCurrentMonth,actualMonth:actualDate.getMonth(),actualYear:actualDate.getFullYear()};}export{useStore};export function toggleMembershipNumber(Component){return props=>{const[store,setStore]=useStore();const handleChange=event=>{const inputValue=event.target.value;setStore({membership_number:inputValue});};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}\nexport const __FramerMetadata__ = {\"exports\":{\"togglePrevMonth\":{\"type\":\"reactHoc\",\"name\":\"togglePrevMonth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayThisMonth\":{\"type\":\"reactHoc\",\"name\":\"displayThisMonth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"MONTH_NAMES\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"calculateDay\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleNextMonth\":{\"type\":\"reactHoc\",\"name\":\"toggleNextMonth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"toggleMembershipNumber\":{\"type\":\"reactHoc\",\"name\":\"toggleMembershipNumber\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"displayNextMonth\":{\"type\":\"reactHoc\",\"name\":\"displayNextMonth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MonthDisplay.map"],"mappings":"mMAA8rB,SAAS,EAAW,EAAS,IAAI,KAAK,CAAC,IAAM,EAAI,EAAS,SAAS,CAAC,EAAS,mBAAmB,CAAC,IAAI,OAAO,IAAI,KAAK,EAAI,EAAE,GAAG,GAAG,IAAM,CAoBthB,SAAgB,EAAa,EAAK,EAAW,EAAI,EAAI,CACpW,IAAM,EAAa,IAAI,KAAK,EAAK,EAAW,GAAG,QAAQ,CACjD,EAAY,IAA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