{"version":3,"file":"CalendarEvent.ffYmwYrA.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/l3o2CBJdnJwetf50N7Jr/TSkE8bXYCsEqsRmOBDdX/CalendarEvent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo,useState}from\"react\";// Helper to parse date string for accurate chronological sorting\nfunction parseDate(title){if(!title)return 0;try{const yearMatch=title.match(/(20\\d{2})/);const monthMatch=title.match(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i);if(!yearMatch||!monthMatch)return 0;const months=[\"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\"];const monthIndex=months.indexOf(monthMatch[0].toLowerCase());const splitIndex=monthMatch.index+monthMatch[0].length;const dayMatch=title.substring(splitIndex).match(/(\\d{1,2})/);const day=dayMatch?parseInt(dayMatch[0]):1;return new Date(parseInt(yearMatch[0]),monthIndex,day).getTime();}catch(e){return 0;}}export default function CalendarEvent(props){const{availableOptions,variantKey,yearFilter,removeYear,gap,initialLimit,column,textColor,accentColor,font,showDivider,dividerColor}=props;const[isExpanded,setIsExpanded]=useState(false);const sortedDates=useMemo(()=>{try{const parsed=JSON.parse(availableOptions);const rawDates=parsed?.find(item=>item.name===variantKey)?.values||[];// 1. Filter\nconst filtered=rawDates.filter(str=>yearFilter.length?yearFilter.some(year=>str.includes(year)):true);// 2. Chronological Sort (Fixed the arithmetic error by using timestamps)\nreturn filtered.sort((a,b)=>parseDate(a)-parseDate(b));}catch{return[];}},[availableOptions,variantKey,yearFilter]);const visibleDates=isExpanded?sortedDates:sortedDates.slice(0,initialLimit);const hasMore=sortedDates.length>initialLimit;return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",width:\"100%\",gap:\"32px\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{display:\"grid\",gridTemplateColumns:`repeat(${column}, 1fr)`,columnGap:gap,rowGap:\"0px\",width:\"100%\"},children:visibleDates.map((item,i)=>{// ✅ KEEPING THE FULL STRING (including wk 1 Yin info)\nlet str=item.trim();if(removeYear){str=str.replace(/\\s*-\\s*\\d{4}/g,\"\");}return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"16px 0\",borderBottom:showDivider?`1px solid ${dividerColor}`:\"none\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"p\",{style:{...font,margin:0,color:textColor,textAlign:\"center\",fontWeight:\"400\",lineHeight:\"1.4\"},children:str})},i);})}),hasMore&&/*#__PURE__*/_jsx(\"button\",{onClick:()=>setIsExpanded(!isExpanded),style:{background:\"none\",border:\"none\",color:accentColor,fontSize:\"14px\",fontWeight:\"700\",cursor:\"pointer\",textDecoration:\"underline\",display:\"flex\",alignItems:\"center\",gap:\"6px\",padding:\"8px\",marginTop:\"-8px\"},children:isExpanded?\"See less\":`View all`})]});}addPropertyControls(CalendarEvent,{availableOptions:{title:\"Options\",type:ControlType.String},variantKey:{title:\"Option Key\",type:ControlType.String,defaultValue:\"Dates\"},yearFilter:{title:\"Year Filter\",type:ControlType.Array,control:{type:ControlType.String}},removeYear:{title:\"Hide Year\",type:ControlType.Boolean,defaultValue:true},initialLimit:{title:\"Show Items\",type:ControlType.Number,defaultValue:6,min:2,max:30},column:{title:\"Columns\",type:ControlType.Number,defaultValue:2,min:1,max:4},gap:{title:\"Column Gap\",type:ControlType.Gap,defaultValue:\"40px\"},font:{title:\"Font\",type:ControlType.Font,controls:\"extended\"},textColor:{title:\"Text Color\",type:ControlType.Color,defaultValue:\"#333\"},accentColor:{title:\"Link Color\",type:ControlType.Color,defaultValue:\"#2F2C3F\"},showDivider:{title:\"Show Dividers\",type:ControlType.Boolean,defaultValue:true},dividerColor:{title:\"Divider Color\",type:ControlType.Color,defaultValue:\"#EEEEEE\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CalendarEvent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CalendarEvent.map"],"mappings":"mLACA,SAAS,EAAU,EAAM,CAAC,GAAG,CAAC,EAAM,MAAO,GAAE,GAAG,CAAC,IAAM,EAAU,EAAM,MAAM,YAAY,CAAO,EAAW,EAAM,MAAM,qDAAqD,CAAC,GAAG,CAAC,GAAW,CAAC,EAAW,MAAO,GAAyF,IAAM,EAAhF,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,CAAyB,QAAQ,EAAW,GAAG,aAAa,CAAC,CAAO,EAAW,EAAW,MAAM,EAAW,GAAG,OAAa,EAAS,EAAM,UAAU,EAAW,CAAC,MAAM,YAAY,CAAO,EAAI,EAAS,SAAS,EAAS,GAAG,CAAC,EAAE,OAAO,IAAI,KAAK,SAAS,EAAU,GAAG,CAAC,EAAW,EAAI,CAAC,SAAS,MAAU,CAAC,MAAO,IAAI,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,mBAAiB,aAAW,aAAW,aAAW,MAAI,eAAa,SAAO,YAAU,cAAY,OAAK,cAAY,gBAAc,EAAW,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAO,EAAYC,MAAY,CAAC,GAAG,CAEr2B,OAFm3B,KAAK,MAAM,EAAiB,EAAwB,KAAK,GAAM,EAAK,OAAO,EAAW,EAAE,QAAQ,EAAE,EAC77B,OAAO,GAAK,EAAW,OAAO,EAAW,KAAK,GAAM,EAAI,SAAS,EAAK,CAAC,CAAC,GAAK,CACrF,MAAM,EAAE,IAAI,EAAU,EAAE,CAAC,EAAU,EAAE,CAAC,MAAO,CAAC,MAAM,EAAE,GAAI,CAAC,EAAiB,EAAW,EAAW,CAAC,CAAO,EAAa,EAAW,EAAY,EAAY,MAAM,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