{"version":3,"file":"LessonChapters.C8RS5vyu.mjs","names":["useMemo","c"],"sources":["https:/framerusercontent.com/modules/34AiwqOyjgYrJsxPzEku/comabDQGHWm8ZyNcm9G9/LessonChapters.js"],"sourcesContent":["/**\n * LessonChapters — Movement Wisdom Yoga\n *\n * CMS-driven chapter list for a Spotlightr video. Replaces the stack of\n * individual ChapterMarkerItem layers, which could not live on a CMS\n * template page (the chapters were hardcoded, so every lesson showed the\n * same eight rows).\n *\n * ── How to place it ──────────────────────────────────────────────────────\n * ONE instance on /lessons/:slug, directly under the SpotlightrAdvancedEmbed.\n * Bind exactly two props to CMS fields and never touch it again:\n *\n *   Video ID  →  Video ID          (same field the embed above uses)\n *   Chapters  →  Video Chapters    (multi-line text)\n *\n * ── Chapters field format ────────────────────────────────────────────────\n * One chapter per line, timestamp first, label after. All of these parse:\n *\n *   0:00 Yoga on the plane\n *   4:08 — One million students\n *   13:08 - Childhood yogi\n *   1:02:30 | The long one\n *\n * mm:ss and hh:mm:ss both work. Blank lines are ignored. A line with no\n * leading timestamp is treated as a label at 0:00 rather than being dropped,\n * so a typo degrades visibly instead of silently.\n *\n * ── Behavior ─────────────────────────────────────────────────────────────\n * • Empty or unparseable field → renders nothing at all (no gap). This is\n *   what makes it safe on the 17 lessons with no video and on any video\n *   published without chapters.\n * • Columns: \"Auto\" puts everything in one column up to `singleColumnMax`\n *   (default 5) and two columns above that, so 3 chapters look deliberate\n *   and 12 chapters do not become a tower. Fill order is column-wise, so\n *   chapters read top-to-bottom then across — chronological either way.\n * • Always collapses to one column under 700px.\n * • Clicking a row calls window.__mwSeekVideo[videoId](seconds), registered\n *   by SpotlightrAdvancedEmbed, which activates the player if idle and then\n *   seeks. Same bridge ChapterMarkerItem used.\n *\n * ChapterMarkerItem stays in the project for one-off canvas use (static\n * pages, sales pages). On CMS pages use this.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useMemo}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const STYLE_ID=\"mw-chapters-css\";const CSS=`\n[data-mw-chapters]{}\n@media (max-width: 700px){\n  [data-mw-chapters]{\n    grid-auto-flow: row !important;\n    grid-template-rows: none !important;\n    grid-template-columns: 1fr !important;\n  }\n}\n[data-mw-chapter-row]:hover{ opacity: .62; }\n[data-mw-chapter-row]:focus-visible{\n  outline: 2px solid currentColor;\n  outline-offset: 2px;\n  border-radius: 6px;\n}\n`;const TS=/^(\\d{1,2}(?::\\d{1,2}){1,2})\\s*[—–\\-|:.)]?\\s*(.*)$/;function toSeconds(ts){const parts=ts.split(\":\").map(p=>parseInt(p,10)||0);if(parts.length===2)return parts[0]*60+parts[1];if(parts.length===3)return parts[0]*3600+parts[1]*60+parts[2];return 0;}function pad(ts){// 4:8 → 4:08, leaves 1:02:30 alone\nconst parts=ts.split(\":\");return parts.map((p,i)=>i===0?String(parseInt(p,10)||0):p.padStart(2,\"0\")).join(\":\");}function parseChapters(raw){if(!raw||typeof raw!==\"string\")return[];return raw.split(/\\r?\\n/).map(l=>l.trim()).filter(Boolean).map(line=>{const m=line.match(TS);if(m){const ts=pad(m[1]);return{seconds:toSeconds(m[1]),timestamp:ts,label:m[2].trim()||\"Chapter\"};}return{seconds:0,timestamp:\"0:00\",label:line};});}export default function LessonChapters(props){const{videoId,chapters:raw,columnMode,singleColumnMax,heading,font,headingFont,textColor,timeColor,headingColor,backgroundColor,dividerColor,dividerThickness,itemPadding,columnGap,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const chapters=useMemo(()=>parseChapters(raw),[raw]);useEffect(()=>{if(typeof document===\"undefined\")return;if(document.getElementById(STYLE_ID))return;const el=document.createElement(\"style\");el.id=STYLE_ID;el.textContent=CSS;document.head.appendChild(el);},[]);// Canvas placeholder so an unbound instance is visible while building.\nif(chapters.length===0){if(!isCanvas)return null;return /*#__PURE__*/_jsx(\"div\",{style:{fontFamily:'\"Satoshi\", ui-sans-serif, system-ui, sans-serif',border:\"1.5px dashed rgba(74,47,128,.5)\",borderRadius:12,padding:\"12px 16px\",fontSize:13,fontWeight:600,color:\"rgb(74,47,128)\",background:\"rgba(74,47,128,0.05)\",...style},children:\"LessonChapters — bind “Chapters” to the Video Chapters field. Renders nothing on the live site while empty.\"});}const n=chapters.length;const cols=columnMode===\"One\"?1:columnMode===\"Two\"?2:n>singleColumnMax?2:1;const rows=Math.ceil(n/cols);const fontFamily=font?.fontFamily||'\"Satoshi\", ui-sans-serif, sans-serif';const fontWeight=font?.fontWeight??500;const labelSize=font?.fontSize??17;const timeSize=Math.max(11,Math.round(labelSize*.88));const seek=seconds=>{if(typeof window===\"undefined\"||!videoId)return;const w=window;const fn=w.__mwSeekVideo?.[videoId];if(fn)fn(seconds);else setTimeout(()=>w.__mwSeekVideo?.[videoId]?.(seconds),300);};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",...style},children:[heading?/*#__PURE__*/_jsx(\"div\",{style:{fontFamily:headingFont?.fontFamily||'\"Satoshi\", ui-sans-serif, sans-serif',fontSize:headingFont?.fontSize??13,fontWeight:headingFont?.fontWeight??700,letterSpacing:headingFont?.letterSpacing??\"0.16em\",textTransform:\"uppercase\",color:headingColor,marginBottom:14},children:heading}):null,/*#__PURE__*/_jsx(\"div\",{\"data-mw-chapters\":\"\",style:{display:\"grid\",width:\"100%\",background:backgroundColor,gridAutoFlow:cols>1?\"column\":\"row\",gridTemplateRows:cols>1?`repeat(${rows}, auto)`:undefined,gridTemplateColumns:`repeat(${cols}, minmax(0, 1fr))`,columnGap},children:chapters.map((c,i)=>{const lastInColumn=cols>1&&(i+1)%rows===0;const showDivider=dividerThickness>0&&!lastInColumn&&i!==n-1;return /*#__PURE__*/_jsxs(\"div\",{\"data-mw-chapter-row\":\"\",role:\"button\",tabIndex:0,\"aria-label\":`Jump to ${c.label} at ${c.timestamp}`,onClick:()=>seek(c.seconds),onKeyDown:e=>{if(e.key===\"Enter\"||e.key===\" \"){e.preventDefault();seek(c.seconds);}},style:{display:\"flex\",alignItems:\"baseline\",gap:20,width:\"100%\",minWidth:0,fontFamily,padding:`${itemPadding}px 4px`,borderBottom:showDivider?`${dividerThickness}px solid ${dividerColor}`:\"none\",cursor:videoId?\"pointer\":\"default\",outline:\"none\",transition:\"opacity .15s ease\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontSize:timeSize,fontWeight,color:timeColor,minWidth:44,flexShrink:0,fontVariantNumeric:\"tabular-nums\"},children:c.timestamp}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize:labelSize,fontWeight,color:textColor,minWidth:0},children:c.label})]},`${c.seconds}-${i}`);})})]});}LessonChapters.defaultProps={videoId:\"\",chapters:\"\",columnMode:\"Auto\",singleColumnMax:5,heading:\"\",textColor:\"rgb(28, 22, 19)\",timeColor:\"rgb(142, 76, 132)\",headingColor:\"rgb(110, 102, 89)\",backgroundColor:\"rgba(0,0,0,0)\",dividerColor:\"rgba(142, 76, 132, 0.7)\",dividerThickness:.5,itemPadding:20,columnGap:40};addPropertyControls(LessonChapters,{videoId:{type:ControlType.String,title:\"Video ID\",placeholder:\"e.g. MTg0ODYyNQ==\",description:\"Bind to the Video ID field. Must match the SpotlightrAdvancedEmbed above.\"},chapters:{type:ControlType.String,title:\"Chapters\",displayTextArea:true,placeholder:\"0:00 Yoga on the plane\\n4:08 One million students\",description:\"Bind to the Video Chapters field. One per line: timestamp then label. Empty = renders nothing.\"},columnMode:{type:ControlType.Enum,title:\"Columns\",options:[\"Auto\",\"One\",\"Two\"],description:\"Auto: one column up to the threshold below, two above.\"},singleColumnMax:{type:ControlType.Number,title:\"1-col up to\",min:1,max:20,step:1,displayStepper:true,hidden:p=>p.columnMode!==\"Auto\"},heading:{type:ControlType.String,title:\"Heading\",placeholder:\"In this video\",description:\"Optional. Leave empty for no heading.\"},font:{type:ControlType.Font,title:\"Row font\",controls:\"extended\",defaultValue:{fontSize:17},description:\"Sets the label size; the timestamp scales to ≈88%.\"},headingFont:{type:ControlType.Font,title:\"Heading font\",controls:\"extended\",defaultValue:{fontSize:13},hidden:p=>!p.heading},textColor:{type:ControlType.Color,title:\"Label\"},timeColor:{type:ControlType.Color,title:\"Timestamp\"},headingColor:{type:ControlType.Color,title:\"Heading\",hidden:p=>!p.heading},backgroundColor:{type:ControlType.Color,title:\"Background\"},dividerColor:{type:ControlType.Color,title:\"Divider\"},dividerThickness:{type:ControlType.Number,title:\"Divider px\",min:0,max:8,step:.5,displayStepper:true},itemPadding:{type:ControlType.Number,title:\"Row padding\",min:0,max:60,step:1,displayStepper:true},columnGap:{type:ControlType.Number,title:\"Column gap\",min:0,max:120,step:4,displayStepper:true,hidden:p=>p.columnMode===\"One\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LessonChapters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LessonChapters.map"],"mappings":"6MA4D+D,SAAS,EAAU,EAAG,CAAC,IAAM,EAAM,EAAG,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG,SAAS,EAAE,EAAE,GAAG,CAAC,EAAgH,OAA3G,EAAM,SAAS,EAAS,EAAM,GAAG,GAAG,EAAM,GAAM,EAAM,SAAS,EAAS,EAAM,GAAG,KAAK,EAAM,GAAG,GAAG,EAAM,GAAU,CAAE,CAAC,SAAS,EAAI,EAAG,CACxP,OAAd,EAAG,MAAM,GAAgB,CAAC,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,OAAO,SAAS,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAE,CAAC,SAAS,EAAc,EAAI,CAAyC,MAArC,CAAC,GAAK,OAAO,GAAM,SAAe,CAAC,EAAS,EAAI,MAAM,OAAO,CAAC,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,OA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