PageSourceSearch

https://ijs.to/_next/static/chunks/pages/app/[host]/author/to/course/[courseId]/lessons-8a4d471d4af9b93f.js

js ijs.to collected 2026-10-04 14:58:45 UTC 30,755 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[43803],{20908:function(e,r,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/[host]/author/to/course/[courseId]/lessons",function(){return s(55714)}])},29281:function(e,r,s){"use strict";s.d(r,{C$:function(){return getOrderedCourseChapters},Mj:function(){return getOrderStringFromArray},OM:function(){return getOrderedChapterLessons},Zj:function(){return getDndInitialCourseData},wb:function(){return isValidChapterLessonsOrder}});var n=s(30256);let getMapFromArray=(e,r)=>{let s={};return r?e.forEach(e=>{s[e.id]=r[e.id]}):e.forEach(e=>{s[e.id]=e}),s},getOrderArrayFromString=e=>{if("string"!=typeof e)throw(0,n.v)("\uD83D\uDFE0 : getOrderArrayFromString ~ listOrder ".concat(JSON.stringify(e),")}")),Error("getOrderArrayFromString: listOrder items must be strings.");let r=e.split(",").map(e=>e.trim()).filter(Boolean);return r},getOrderStringFromArray=e=>{let r=e.every(e=>"string"==typeof e);if(!r)throw(0,n.v)("\uD83D\uDFE0 : getOrderStringFromArray ~ listOrder ".concat(JSON.stringify(e),")}")),Error("getOrderStringFromArray: listOrder items must be strings.");let s=e.join(",");return s},isValidChapterLessonsOrder=e=>{let r=[],s=e.foreignLessons?e.foreignLessons.map(e=>{var r;return{...e.lesson,id:"frn-".concat(null===(r=e.lesson)||void 0===r?void 0:r.id)}}):[],t=[...e.lessons,...s],a=t.length,i=Array.isArray(e.lessonsOrder),l=i?e.lessonsOrder:e.lessonsOrder.split(",").map(e=>e.trim()).filter(Boolean),o=i?e.lessonsOrder:l;if(o.length!==a)return r.push("Order length mismatch: ".concat(o.length," !== ").concat(a)),console.warn("\uD83D\uDFE0 : lessonsOrder length is not equal to combinedChapterLessonsLength",{combinedLessons:t,lessonsOrder:o},{chapters:e,messages:r}),!1;if(new Set(o).size!==o.length)return console.warn("Has duplicates"),!1;let d=t.map(e=>(null==e?void 0:e.id)||"missing-foreign-lesson-id"),c=d.every(e=>o.includes(e));return c?((0,n.v)("✅ All good with isValidChapterLessonsOrder"),!0):(console.warn("Does not contain all lessons ids"),!1)},containsDuplicates=e=>{let r=e;return Array.isArray(e)||(r=e.split(",")),new Set(r).size!==r.length},getOrderedCourseChapters=e=>{let{chaptersMap:r,course:s}=e,t=r||getMapFromArray(s.chapters),a=Array.isArray(s.chaptersOrder),i=a?s.chaptersOrder:getOrderArrayFromString(s.chaptersOrder),l=Array.isArray(i)&&i.length>0&&!containsDuplicates(s.chaptersOrder)&&i.length===s.chapters.length;containsDuplicates(s.chaptersOrder)&&(0,n.v)("\uD83D\uDFE0 : getOrderedCourseChapters ~ containsDuplicates"),l||(0,n.v)("\uD83D\uDFE0 : getOrderedChapterLessons: NOT isValidChaptersOrderArray");let o=containsDuplicates(s.chaptersOrder),d=l?i:s.chapters.map(e=>e.id),c=d.length<s.chapters.length,u=d.filter((e,r)=>d.indexOf(e)===r),h=u.filter(e=>!d.includes(e)),p=o?u:c?[...d,...h]:d,m=p.map(e=>t[e]).filter(Boolean);return{orderedChaptersArray:m}},getOrderedChapterLessons=e=>{let{chapter:r,lessonsMap:s}=e,t=[],a=(null==r?void 0:r.foreignLessons)?r.foreignLessons.map(e=>{var r;return{...e.lesson,id:"frn-".concat(null===(r=e.lesson)||void 0===r?void 0:r.id)}}):[],i=(null==r?void 0:r.lessons)||[],l=(null==r?void 0:r.lessonsOrder)||"",o=[...i,...a],d=o.length,c=s||getMapFromArray(o||[]),u=Array.isArray(l),h=u?r.lessonsOrder:getOrderArrayFromString(l),p=h.length===d,m=Array.isArray(h)&&h.length>0&&!containsDuplicates(r.lessonsOrder)&&p;containsDuplicates(l)&&((0,n.v)("\uD83D\uDFE0 : getOrderedChapterLessons: ".concat(r.id," containsDuplicates")),t.push('Chapter "'.concat(r.id,'" containsDuplicates'))),m||(0,n.v)("\uD83D\uDFE0 : getOrderedChapterLessons: NOT isValidLessonsOrderArray");let g=containsDuplicates(l),f=m?h:o.map(e=>e.id),x=f.length<d,v=f.filter((e,r)=>f.indexOf(e)===r),j=v.filter(e=>!f.includes(e)),b=g?v:x?[...f,...j]:f,y=b.map(e=>c[e]).filter(Boolean);return{messages:t,orderedLessonsArray:y}},getLessonsOrderArrayFromChapter=e=>{let{orderedLessonsArray:r}=getOrderedChapterLessons({chapter:e}),s=r.map(e=>e.id),n=s.join(",");return{lessonsOrderArray:s,lessonsOrderString:n}},getCourseChapterLessonsMap=e=>{let{course:r}=e,s=[...r.chapters.map(e=>e.lessons).flat(),...r.chapters.map(e=>e.foreignLessons.map(e=>{var r;return{...e.lesson,id:"frn-".concat(null===(r=e.lesson)||void 0===r?void 0:r.id)}})).flat()],n=getMapFromArray(s);return{allLessons:s,lessonsMap:n}},getDndInitialCourseData=e=>{let{course:r}=e,{allLessons:s,lessonsMap:n}=getCourseChapterLessonsMap({course:r}),t=r.chapters.reduce((e,r)=>{let{lessonsOrderArray:s}=getLessonsOrderArrayFromChapter(r),n=r.foreignLessons?r.foreignLessons.map(e=>{var r;return{...e.lesson,id:"frn-".concat(null===(r=e.lesson)||void 0===r?void 0:r.id)}}):[],t=[...r.lessons,...n],a=s.length>0?s:t.map(e=>e.id);return e[r.id]={...r,lessonsOrder:a},e},{}),a=r.chapters.map(e=>e.id),i=getOrderArrayFromString(r.chaptersOrder),l=a.length!==i.length,o=l?r.chapters.map(e=>e.id):i;return{allLessons:s,chaptersMap:t,chaptersOrder:o,initialData:{lessonsMap:n,chapters:t,chaptersOrder:o},lessonsMap:n}}},30758:function(e,r,s){"use strict";s.d(r,{z:function(){return CircleLessonPublishStatus}});var n=s(11527),t=s(62288),a=s(42256),i=s(40735);let CircleLessonPublishStatus=e=>{let{className:r,lesson:s}=e,{isPublished:l}=s;return(0,n.jsx)(a.u,{content:(0,n.jsxs)("div",{className:"w-36",children:[l&&(0,n.jsx)(n.Fragment,{children:"Your lesson is publicly listed."}),!l&&(0,n.jsxs)(n.Fragment,{children:["Your lesson is not listed. Change in"," ",(0,n.jsx)(t.default,{gradient:!0,className:"font-bold",children:"Visibility"})," ","card."]})]}),children:(0,n.jsx)(i.C,{className:r,variant:l?"success":"neutral"})})}},65327:function(e,r,s){"use strict";s.d(r,{N:function(){return CourseBuilderHeading}}
1);var n=s(11527),t=s(53226),a=s(82540);let CourseEditTitleForm=e=>{let{onCompleted:r,course:s,fieldName:i="title",label:l="Course Title",labelSrOnly:o,onError:d,...c}=e,[u,{loading:h}]=(0,a.h4F)({onCompleted(e){r&&r(e)},onError(e){d&&d(e)}});if(!i)throw Error("fieldName is required");if(!s)throw Error("course is required");let p=s[i];return(0,n.jsx)(t.q,{variant:"h1",valueGradient:!0,labelGradient:!1,labelSrOnly:o,loading:h,defaultEditing:!p,name:i,onSubmit:e=>{let{title:r}=e;u({variables:{courseId:s.id,title:r}})},value:p,label:l,...c})};var i=s(62288);let CourseBuilderHeading=e=>{let{course:r,heading:t}=e;return(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsx)(CourseEditTitleForm,{variant:"h3",labelSrOnly:!0,course:r,onCompleted:async()=>{let e=await s.e(75480).then(s.bind(s,75480)),r=e.toast;r({message:"Your course title has been updated",title:"Course title updated",type:"success"})}})}),(0,n.jsx)(i.default,{align:"center",as:"h2",variant:"h1",children:t})]})}},87462:function(e,r,s){"use strict";s.d(r,{o:function(){return LessonTitle}});var n=s(11527),t=s(68566),a=s(30758),i=s(53226),l=s(82540);let CourseLessonEditTitleForm=e=>{let{block:r,href:s,onCompleted:t,lesson:a,onError:o,fieldName:d,...c}=e,[u]=(0,l.HUI)({onCompleted(e){t&&t(e)},onError(e){o&&o(e)}});if(!d)throw Error("fieldName is required");if(!a)throw Error("lesson is required");let h=a[d];return(0,n.jsx)(i.q,{block:r,defaultEditing:!h,href:s,name:d,onSubmit:e=>{let{title:r}=e;u({variables:{lessonId:a.id,title:r}}
1)},value:h,...c})},LessonEditTitle=e=>{let{lesson:r,variant:s="h2"}=e;return(0,n.jsx)(CourseLessonEditTitleForm,{block:!0,fieldName:"title",lesson:r,valueGradient:!0,variant:s,prefix:(0,n.jsx)(a.z,{className:"mt-1",lesson:r})})};var o=s(34453),d=s(62288);let LessonTitle=e=>{let{as:r="h5",className:s,gradient:a,hideOsi:i,isEditable:l,isFree:c,iconClx:u="mt-0.5",iconSize:h,lesson:p,variant:m="h5"}=e;return(0,n.jsxs)("div",{className:"inline-flex items-start gap-1",children:[c&&!i&&(0,n.jsx)(o.default,{className:(0,t.A)("shrink-0 self-start",u),size:h,icon:"osi"}),l&&(0,n.jsx)(LessonEditTitle,{variant:m,lesson:p}),!l&&(0,n.jsx)(d.default,{as:r,className:s,variant:m,gradient:a,children:p.title})]})}},55714:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return U}});var n=s(11527),t=s(16046),a=s.n(t),i=s(71334),l=s(64471),o=s(69190),d=s(50959),c=s(91674),u=s(4763),h=s(81633),p=s(82540),m=s(11421),g=s(68566),f=s(30256),x=s(89160),v=s(94408),j=s(62288),b=s(20882),y=s(69305),C=s(86763),N=s.n(C),L=s(71041);let SearchAutocomplete=e=>{var r,s,t,a,i,l,o,c;let{onSelect:u,block:h,className:p,colorScheme:m="default",disabled:f,invalid:x,label:v="Search",onSearch:b,orientation:C,searchResults:O,selectedItem:D,size:F="base",variant:w="outline"}=e,[A,S]=(0,d.useState)(""),I=N()(()=>b(A),600);(0,d.useEffect)(()=>{I()},[A]);let E=L.o.core,k=L.o.transition,M=L.o[F].spacing,T=L.o[F].height,P=L.o.ring,R=f?"inactive":x?"invalid":m,z=null===(s=L.o[w])||void 0===s?void 0:null===(r=s[R])||void 0===r?void 0:r.bgColor,B=null===(a=L.o[w])||void 0===a?void 0:null===(t=a[R])||void 0===t?void 0:t.border,_=null===(l=L.o[w])||void 0===l?void 0:null===(i=l[R])||void 0===i?void 0:i.value,q=null===(c=L.o[w])||void 0===c?void 0:null===(o=c[R])||void 0===o?void 0:o.label,G=(0,g.A)(h&&"flex-1 w-full","horizontal"===C&&"flex gap-2 items-center",p);return(0,n.jsx)("div",{className:G,children:(0,n.jsxs)(j.default,{as:"label",className:"flex flex-col",htmlFor:"item",children:[(0,n.jsx)(j.default,{as:"span",className:(0,g.A)(q,"flex items-center gap-2"),children:v}),(0,n.jsxs)(y.h,{value:null==D?void 0:D.title,onChange:e=>{u(e),S(null)},name:"item",children:[(0,n.jsx)(y.h.Input,{onChange:e=>S(e.target.value),className:(0,g.A)(z,B,P,E,T,M,_,k,(null==A?void 0:A.length)>0&&"rounded-b-none"),disabled:f,placeholder:"Search by typing..."}),(0,n.jsxs)(y.h.Options,{className:"mb-5 mt-0 rounded-b-xl border-2 border-primary/20 bg-surface py-2",children:[!(null==O?void 0:O.length)&&(0,n.jsxs)(y.h.Option,{disabled:!0,children:[(0,n.jsx)(j.default,{variant:"h5",className:"text-center",children:"No results found"}),(0,n.jsx)(j.default,{variant:"caption",className:"text-center",children:"Try different search term"})]}),null==O?void 0:O.map(e=>(0,n.jsx)(y.h.Option,{value:e,children:r=>{let{active:s}=r;return(0,n.jsx)("span",{className:(0,g.A)("block border-y px-3 py-1",s?"border-dashed border-primary":"border-transparent"),children:(0,n.jsx)(j.default,{className:"font-bold",children:e.title})})}},e.id))]})]})]})})};var O=s(21519),D=s.n(O),F=s(23352),w=s(44811);let A=D()(()=>s.e(8094).then(s.bind(s,8094)).then(e=>e.Form),{loadableGenerated:{webpack:()=>[8094]},ssr:!1}),CreateForeignLessonForm=e=>{let{cancelComponent:r,chapterId:s,lesson:t,onCompleted:a}=e,i=t.id,[l,{loading:o}]=(0,p.Uvj)();if(!s)return(0,F.S3)("Got no chapterId in CreateChapterLessonForm"),(0,n.jsx)(n.Fragment,{children:"Sorry, something went wrong."});let handleCreateLesson=async e=>{let{title:r}=e;await l({onCompleted(e){a&&a(e)},refetchQueries:["MyCourses"],variables:{chapterId:s,lessonId:i,slug:r?(0,w.hD)(r):void 0,title:r}})};return(0,n.jsxs)("div",{className:"relative space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-2xl border-2 border-dashed border-primary/20 p-2",children:[(0,n.jsx)(j.default,{variant:"h4",children:t.title}),(0,n.jsxs)(j.default,{variant:"caption",children:["Lesson by"," ",(0,n.jsxs)(j.default,{as:"span",children:[t.author.firstName," ",t.author.lastName]})]})]}),(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)(A,{id:"add-chapter-lesson",className:"space-y-5",onSubmit:handleCreateLesson,children:()=>(0,n.jsx)("div",{})}),(0,n.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[r,(0,n.jsx)(u.default,{form:"add-chapter-lesson",loading:o,loadingText:"Publishing...",children:"Save"})]})]})]})},CreateChapterForeignLesson=e=>{let{chapterId:r,onCompleted:s}=e,[t,a]=(0,d.useState)(null),[i,{data:l}]=(0,p.hYN)();return(0,n.jsxs)("div",{className:"space-y-5",children:[(null==t?void 0:t.id)&&(0,n.jsx)(CreateForeignLessonForm,{chapterId:r,lesson:t,cancelComponent:(0,n.jsx)(u.default,{variant:"outline",onClick:()=>a(null),children:"Change Lesson"}),onCompleted:e=>{s&&s(e),a(null)}}),!(null==t?void 0:t.id)&&(0,n.jsx)(SearchAutocomplete,{selectedItem:t,onSelect:e=>{a(e)},onSearch:e=>{e&&i({variables:{searchTerm:e,take:12}})},searchResults:null==l?void 0:l.courseLessons,block:void 0,className:void 0,disabled:void 0,invalid:void 0,orientation:void 0})]})};var S=s(17004),I=s(6277),E=s(8348);let k=D()(()=>s.e(8094).then(s.bind(s,8094)).then(e=>
1e.Form),{loadableGenerated:{webpack:()=>[8094]},ssr:!1}),CreateChapterLessonForm=e=>{let{chapterId:r,onCompleted:s}=e,[t,{loading:a}]=(0,p.ue4)();if(!r)return(0,F.S3)("Got no chapterId in CreateChapterLessonForm"),(0,n.jsx)(n.Fragment,{children:"Sorry, something went wrong."});let handleCreateLesson=async e=>{let{body:n,isFree:a,isAllowedForeign:i,isInstantForeign:l,title:o}=e;await t({onCompleted(e){s&&s(e)},variables:{body:n,chapterId:r,isAllowedForeign:i,isFree:a,isInstantForeign:l,slug:(0,w.hD)(o),title:o}})};return(0,n.jsx)("div",{className:"relative",children:(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)(k,{id:"add-chapter-lesson",className:"space-y-5",onSubmit:handleCreateLesson,children:e=>{let{methods:r}=e,s=r.watch("isAllowedForeign");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(I.default,{label:"Title",methods:r,name:"title",required:!0}),(0,n.jsxs)("div",{className:"flex gap-4 rounded-2xl border-2 border-dashed border-primary/20 p-2",children:[(0,n.jsx)(E.default,{label:"Free",methods:r,name:"isFree"}),(0,n.jsx)(E.default,{label:"Allow Links",methods:r,name:"isAllowedForeign"})]}),s&&(0,n.jsx)(S.p,{defaultChecked:!0,label:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j.default,{gradient:!0,className:"font-bold",children:"Instant Link."}),"Allow other authors to include this lesson without approval."]}),methods:r,name:"isInstantForeign"})]})}}),(0,n.jsx)("div",{className:"flex justify-end gap-2",children:(0,n.jsx)(u.default,{form:"add-chapter-lesson",variant:"outline",block:!0,loading:a,loadingText:"Publishing...",children:"Save"})})]})})},CreateChapterLessonFormMap=e=>{let{chapterId:r,onChangeLessonType:s,onCompleted:t,title:a}=e,[i,l]=(0,d.useState)(!1);return(0,n.jsxs)("div",{className:"space-y-5",children:[a&&(0,n.jsx)(j.default,{variant:"h4",children:i?"Connect an existing lesson":a}),(0,n.jsxs)(b.Z,{onClick:()=>{s&&s(),l(!i)},children:[!i&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-semibold underline",children:"Connect an existing lesson"})," ",(0,n.jsx)(v.default,{size:"sm",variant:"outline",children:"Beta"})]}),i&&(0,n.jsx)("span",{className:"font-semibold underline",children:"Back"})]}),i&&(0,n.jsx)(CreateChapterForeignLesson,{onCompleted:t,chapterId:r}),!i&&(0,n.jsx)(CreateChapterLessonForm,{chapterId:r,onCompleted:t})]})};var M=s(34453),T=s(84930),P=s(87236),R=s(70851);let DeleteCourseLessonButton=e=>{let{className:r,label:t="Delete lesson",lesson:a,onCompleted:i}=e,[l,o]=(0,d.useState)(!1),c=a.id,[u]=(0,p.$93)({onCompleted:e=>{i&&i(e)},onError:async e=>{let r=await s.e(75480).then(s.bind(s,75480)),n=r.toast;n({message:e.message,title:"Failed to delete lesson",type:"error"})},update(e,r){let{data:{deleteCourseLesson:s}}=r,n=e.identify(s);e.evict({id:n}),e.gc()},variables:{lessonId:c}}),handleDelete=()=>{u(),o(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.I,{isOpen:l,onClose:()=>o(!1),onConfirm:()=>{handleDelete()},title:"Are you sure? \uD83E\uDDD0",message:"Please proceed with caution. Deleting a lesson cannot be undone."}),(0,n.jsx)("button",{type:"button",className:r,onClick:()=>o(!0),children:t})]})},DeleteForeignLessonButton=e=>{let{className:r,label:t="Unlink lesson",foreignLessonId:a,onCompleted:i}=e,[l,o]=(0,d.useState)(!1),[c]=(0,p.KFk)({onCompleted:e=>{i&&i(e)},onError:async e=>{let r=await s.e(75480).then(s.bind(s,75480)),n=r.toast;n({message:e.message,title:"Failed to unlink foreign lesson",type:"error"})},update(e,r){let{data:{deleteForeignLesson:s}}=r,n=e.identify(s);e.evict({id:n}),e.gc()},variables:{foreignLessonId:a}}),handleDelete=()=>{c(),o(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.I,{isOpen:l,onClose:()=>o(!1),onConfirm:()=>{handleDelete()},title:"Unlink lesson? \uD83E\uDDD0",message:"If you unlink this lesson you may need to request permission from the author to re-link it."}),(0,n.jsx)("button",{type:"button",className:r,onClick:()=>o(!0),children:t})]})};var z=s(87462),B=s(39097);let Dropdown=e=>{let{children:r,trigger:s,triggerAs:t,triggerWrapperClassName:a="h-full flex items-center"}=e;return(0,n.jsxs)(P.v,{as:"div",className:"relative inline-block",children:[(0,n.jsx)("div",{className:a,children:(0,n.jsxs)(P.v.Button,{as:t,children:[(0,n.jsx)("span",{className:"sr-only",children:"Open options"}),s]})}),(0,n.jsx)(B.u,{as:d.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,n.jsx)(P.v.Items,{className:"absolute right-0 z-10 mt-2 w-auto origin-top-right rounded-lg bg-surface shadow-lg ring-1 ring-primary ring-opacity-5 focus:outline-none",children:(0,n.jsx)("div",{children:r})})})]})},AuthorDndCurriculumLesson=e=>{let{index:r,isFree:s,isReorderEnabled:t,chapter:a,lesson:i}=e,{course:l}=a,o=l.id,d=i.id.includes("frn-");return(0,n.jsx)(c._l,{draggableId:i.id,index:r,children:(e,c)=>{var u,h,p,f;
1return(0,n.jsxs)("div",{className:(0,g.A)("rounded-lg bg-surface",s?"hover:bg-osi-bg/10 border border-dashed border-osi/20":"hover:bg-info/5",c.isDragging?"border-b shadow-md":""),...e.draggableProps,ref:e.innerRef,children:[(0,n.jsxs)("div",{className:"flex justify-between px-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"-mb-1 text-xs",children:r+1}),(0,n.jsx)("span",{className:"-mx-2 -mb-1 font-bold opacity-40",children:"・"}),d?(0,n.jsx)("span",{className:"mt-1 text-xs font-bold",children:"F"}):"",(0,n.jsx)(b.Z,{href:"".concat(T.r5,"/").concat(o,"/lessons/edit/").concat(d?"frn/":"").concat(i.id.replace("frn-","")),className:(0,g.A)("flex justify-between pb-1 pt-2"),children:(0,n.jsx)(z.o,{variant:"h4",lesson:i,isFree:!a.isFree&&i.isFree})},i.id)]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(Dropdown,{triggerAs:"div",trigger:(0,n.jsx)("span",{tabIndex:0,role:"button",className:"group -mr-1 flex cursor-pointer items-center justify-center self-center rounded-md border border-transparent p-1 hover:bg-primary/10",children:(0,n.jsx)(M.default,{icon:"ellipsis",className:"group-hover:fill-primary"})}),children:(0,n.jsxs)("div",{children:[(0,n.jsx)(P.v.Item,{children:e=>{let{active:r}=e;return(0,n.jsx)("button",{type:"button",className:(0,g.A)("w-full whitespace-nowrap px-3 py-2 text-left text-sm font-semibold",r?"bg-primary/5":"text-primary"),onClick:()=>{navigator.clipboard.writeText("".concat(window.location.origin).concat(T.zQ,"/").concat(l.slug,"/").concat(a.slug,"/").concat(i.slug))},children:"Copy lesson link"})}}),(0,n.jsx)("hr",{}),d&&(0,n.jsx)(P.v.Item,{disabled:!1,children:e=>{let{active:r}=e;return(0,n.jsx)(DeleteForeignLessonButton,{foreignLessonId:i.foreignLesson.id,className:(0,g.A)("w-full whitespace-nowrap px-3 py-2 text-left text-sm font-semibold",r?"bg-primary/5":"text-primary"),onCompleted:e=>{(0,m.jG)(e.deleteForeignLesson.id)}})}}),!d&&(0,n.jsx)(P.v.Item,{disabled:!1,children:e=>{let{active:r}=e;return(0,n.jsx)(DeleteCourseLessonButton,{lesson:{...i,chapter:a},className:(0,g.A)("w-full whitespace-nowrap px-3 py-2 text-left text-sm font-semibold",r?"bg-primary/5":"text-primary"),onCompleted:e=>{(0,m.jG)(e.deleteCourseLesson.id)}})}})]})}),(0,n.jsx)("div",{className:(0,g.A)("sr-only"),...e.dragHandleProps}),t&&(0,n.jsx)("div",{className:"group -mr-1 flex cursor-move items-center justify-center self-center rounded border border-primary/20 bg-primary/10 p-1 hover:border-primary hover:bg-primary",...e.dragHandleProps,children:(0,n.jsx)(M.default,{icon:"drag",fillClassName:"transition-all group-hover:fill-white fill-primary"})})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 px-2 pb-1",children:[(0,n.jsx)(j.default,{as:"h5",className:"text-sm opacity-70",children:(null===(h=i.video)||void 0===h?void 0:null===(u=h.videoAsset)||void 0===u?void 0:u.durationSeconds)?new Date(1e3*((null===(f=i.video)||void 0===f?void 0:null===(p=f.videoAsset)||void 0===p?void 0:p.durationSeconds)||0)).toISOString().slice(14,19):"0 mins"}),(0,n.jsx)(j.default,{className:"font-bold opacity-40",children:"・"}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)(M.default,{icon:"chart-mixed",size:"sm"}),(0,n.jsx)(j.default,{className:"text-sm",children:i.totalVideoViews})]})]})]})}})};var _=s(29281);let InnerList=class InnerList extends d.Component{shouldComponentUpdate(e){return e.orderedLessons!==this.props.orderedLessons}render(){let e=this.props.orderedLessons.length>0;if(!e){let e=this.props.chapter.id,r=this.props.chapter.course.id;return(0,n.jsx)("div",{className:"mx-auto max-w-md space-y-5 rounded-xl border-2 border-dashed border-primary/50 bg-surface p-4 text-center",children:(0,n.jsx)("div",{className:"mx-auto max-w-md",children:(0,n.jsx)(CreateChapterLessonFormMap,{chapterId:e,onCompleted:e=>{var s;let{createCourseLesson:n,createForeignLesson:t}=e;(0,m.Dm)((null==n?void 0:n.id)||(null==t?void 0:null===(s=t.lesson)||void 0===s?void 0:s.id)),a().push("".concat(T.r5,"/").concat(r,"/lessons"))},title:"Add first chapter lesson"})})})}return this.props.orderedLessons.map((e,r)=>(0,n.jsx)(AuthorDndCurriculumLesson,{chapter:this.props.chapter,lesson:e,isFree:this.props.isFree||e.isFree,isReorderEnabled:this.props.isReorderEnabled,index:r},e.id))}};let AuthorDndCurriculumChapter=e=>{let{chapter:r,isFree:s,isReorderEnabled:a,orderedLessons:i,index:l}=e,o=(0,t.useRouter)(),{courseId:h}=o.query,[f,v]=(0,d.useState)(!1),b=null==r?void 0:r.foreignLessons,y=r.lessonsOrder.length!==i.length,[C,{loading:N}]=(0,p.iL)(),handleRefreshChapter=()=>{let e=[...i,...b.map(e=>{var r;return{...e.lesson,id:"frn-".concat(null===(r=e.lesson)||void 0===r?void 0:r.id)}})],s=e.map(e=>e.id),n=(0,_.Mj)(s);C({variables:{chapterId:r.id,lessonsOrder:n}})};(0,d.useEffect)(()=>{y&&!f&&v(!0)}
1,[]),f&&(0,F.S3)("Chapter ".concat(JSON.stringify(r)," lessonsOrder was out of sync"));let L=(0,_.wb)(r);return(0,n.jsx)(c._l,{draggableId:r.id,index:l,children:(e,t)=>(0,n.jsx)("div",{...e.draggableProps,ref:e.innerRef,children:(0,n.jsxs)("div",{className:(0,g.A)("space-y-5 bg-surface p-2 sm:rounded-xl sm:p-5",s?"border-2 border-dashed border-osi/50":"bg-surface",t.isDragging?"shadow-lg":""),children:[(0,n.jsxs)("div",{className:"items-start justify-between space-y-3 md:flex md:flex-row-reverse md:gap-3 md:space-y-0",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[i.length>0&&(0,n.jsx)(u.default,{type:"button",onClick:()=>{o.push("".concat(T.r5,"/").concat(h,"/lessons?toChapterId=").concat(r.id))},size:"sm",variant:"outline",children:"Add Lesson"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.default,{type:"button",onClick:()=>(0,m.y8)(r.id),shape:"square",icon:"edit",size:"sm",variant:"outline"}),(0,n.jsx)("div",{className:(0,g.A)("sr-only"),...e.dragHandleProps}),a&&(0,n.jsx)("div",{className:(0,g.A)("group flex h-12  w-12  cursor-move items-center justify-center rounded-lg border border-primary bg-primary/10 hover:border-primary hover:bg-primary"),...e.dragHandleProps,children:(0,n.jsx)(M.default,{icon:"drag",className:"h-6 w-6",fillClassName:"transition-all group-hover:fill-white fill-primary"})})]})]}),(0,n.jsx)("div",{className:"pt-1",children:(0,n.jsx)(x.j,{as:"h2",chapter:r,isFree:r.isFree,iconSize:"lg",variant:"h2"})})]}),(0,n.jsx)("div",{className:"border-b border-dashed border-primary/20"}),(0,n.jsx)(c.bK,{droppableId:r.id,type:"lesson",children:(t,l)=>(0,n.jsxs)("div",{ref:t.innerRef,...e.droppableProps,className:(0,g.A)("space-y-2 rounded-lg border",!l.isDraggingOver&&"border-transparent",l.isDraggingOver&&"border-dashed border-primary"),children:[!L&&(0,n.jsxs)("div",{className:"flex justify-center gap-3 py-4",children:[(0,n.jsx)(u.default,{loading:N,onClick:handleRefreshChapter,size:"sm",type:"button",variant:"outline",children:"Refresh"}),(0,n.jsxs)("div",{children:[(0,n.jsx)(j.default,{variant:"h6",children:"Yikes!"}),(0,n.jsx)(j.default,{variant:"caption",children:"If the issue persists, please contact us."})]})]}),(0,n.jsx)(InnerList,{orderedLessons:i,chapter:r,isFree:s,isReorderEnabled:a}),t.placeholder]})})]})})})},AuthorDndCurriculum_InnerList=e=>{let{chapter:r,isFree:s,isReorderEnabled:t,lessonsMap:a,index:i}=e,{orderedLessonsArray:l}=(0,_.OM)({chapter:r,lessonsMap:a});return(0,n.jsx)(AuthorDndCurriculumChapter,{chapter:r,isFree:s,isReorderEnabled:t,orderedLessons:l,index:i})},AuthorDndCurriculum=()=>{let e=(0,t.useRouter)(),r=e.query.courseId,{data:s}=(0,p.XDS)({variables:{courseId:r}}),a=null==s?void 0:s.course,[i,l]=(0,d.useState)(!1),x=(0,o.l)(m.QM),[v]=(0,p.CZe)(),[j]=(0,p.mGM)(),[b]=(0,p.iL)(),[y]=(0,p.i2u)(),[C]=(0,p.JDS)();(0,d.useEffect)(()=>{let{initialData:e}=(0,_.Zj)({course:a});(0,m.QM)(e)},[]);let N=(0,o.l)(m.Dm),L=(0,o.l)(m.jG);if((0,d.useEffect)(()=>{if(N||L){let{initialData:e}=(0,_.Zj)({course:a});(0,m.QM)(e),(0,m.Dm)(""),(0,m.jG)("")}},[a]),!(null==x?void 0:x.chapters))return(0,n.jsx)(h.LoadingSpinner,{center:!0,padded:!0});let O=a.isFree;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex justify-center sm:justify-end",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)(u.default,{icon:"drag",onClick:()=>l(!i),variant:i?"solid":"outline",size:"sm",children:[i&&"Hide"," Reorder"]}),(0,n.jsx)(u.default,{icon:"create",onClick:()=>(0,m.Ki)(!0),size:"sm",children:"New Chapter"})]})}),(0,n.jsx)(c.Z5,{onDragEnd:e=>{let{destination:r,source:s,draggableId:n,type:t}=e;if(!r||r.droppableId===s.droppableId&&r.index===s.index)return;if("chapter"===t){let e=Array.from(x.chaptersOrder);e.splice(s.index,1),e.splice(r.index,0,n);let t={...x,chaptersOrder:e};(0,m.QM)(t),j({variables:{chaptersOrder:e.join(","),courseId:a.id}});return}let i=x.chapters[s.droppableId],l=x.chapters[r.droppableId];if(i===l){let e=Array.from(i.lessonsOrder);e.splice(s.index,1),e.splice(r.index,0,n);let t={...i,lessonsOrder:e};b({variables:{chapterId:i.id,lessonsOrder:e.join(",")}});let a={...x,chapters:{...x.chapters,[t.id]:t}};(0,m.QM)(a);return}let o=Array.from(i.lessonsOrder);o.splice(s.index,1);let d={...i,lessonsOrder:o},c=Array.from(l.lessonsOrder);c.splice(r.index,0,n);let u={...l,lessonsOrder:c},h={...x,chapters:{...x.chapters,[d.id]:d,[u.id]:u}};if(n.includes("frn-")){let e=n.replace("frn-",""),r=a.chapters.reduce((r,s)=>{let n=s.foreignLessons.find(r=>{var s;return(null==r?void 0:null===(s=r.lesson)||void 0===s?void 0:s.id)===e});return n||r},null),s=null==r?void 0:r.id;if(!s){console.error("No foreign lesson found");return}let t={foreignChapterId:u.id,foreignLessonId:s,foreignLessonsOrder:u.lessonsOrder.join(","),homeChapterId:d.id,homeLessonsOrder:d.lessonsOrder.join(",")};C({onCompleted(e){var n;
1(0,f.v)("transferForeignLessonToChapterMutation res",e);let a=e.updateForeignCourseChapter.foreignLessons.find(e=>{var s,n;return(0,f.v)("⚪️ onCompleted ~ foreign?.lesson",null==e?void 0:e.lesson),(null==e?void 0:null===(s=e.lesson)||void 0===s?void 0:s.id)===(null===(n=r.lesson)||void 0===n?void 0:n.id)});(0,f.v)("⚪️ onCompleted:",{fId:r.id,fLId:null===(n=r.lesson)||void 0===n?void 0:n.id}),a&&(0,f.v)("\uD83D\uDFE2 onCompleted: TransferSuccess"),a||((0,f.v)("\uD83D\uDD34 Foreign lesson not found in chapter",t),v({variables:{foreignChapterId:t.foreignChapterId,foreignLessonId:s}}))},variables:t})}else y({variables:{foreignChapterId:u.id,foreignLessonsOrder:u.lessonsOrder.join(","),homeChapterId:d.id,homeLessonsOrder:d.lessonsOrder.join(","),lessonId:n}});(0,m.QM)(h)},children:(0,n.jsx)(c.bK,{droppableId:"all-chapters",type:"chapter",children:(e,r)=>(0,n.jsxs)("div",{...e.droppableProps,"data-test":"dnd-curriculum-container",ref:e.innerRef,className:(0,g.A)("space-y-5 border sm:rounded-2xl sm:p-1",!r.isDraggingOver&&"border-transparent",r.isDraggingOver&&"border-dashed border-primary bg-primary/5"),children:[x.chaptersOrder.map((e,r)=>{let s=x.chapters[e];return(0,n.jsx)(AuthorDndCurriculum_InnerList,{chapter:s,isFree:O,isReorderEnabled:i,lessonsMap:x.lessonsMap,index:r},s.id)}),e.placeholder]})})})]})};var q=s(65327),G=s(47324),H=s(78524),Q=s(8482);let V=D()(()=>s.e(48446).then(s.bind(s,48446)),{loadableGenerated:{webpack:()=>[48446]},ssr:!1}),CreateChapterLessonModal=()=>{let[e,r]=(0,d.useState)(!1),s=(0,t.useRouter)(),{courseId:a,toChapterId:i}=s.query;return(0,n.jsx)(V,{title:e?"Connect existing lesson":"New Lesson",isOpen:!!i,onClose:()=>{s.push("".concat(T.r5,"/").concat(a,"/lessons"))},children:(0,n.jsx)(CreateChapterLessonFormMap,{chapterId:i,onCompleted:e=>{var r;let{createCourseLesson:n,createForeignLesson:t}=e;(0,m.Dm)((null==n?void 0:n.id)||(null==t?void 0:null===(r=t.lesson)||void 0===r?void 0:r.id)),s.push("".concat(T.r5,"/").concat(a,"/lessons"))},onChangeLessonType:()=>r(!e)})})},CourseLessons=()=>{let e=(0,t.useRouter)(),{courseId:r}=e.query,{data:s,loading:a}=(0,p.XDS)({variables:{courseId:r}}),i=null==s?void 0:s.course;if(a)return(0,n.jsx)(h.LoadingSpinner,{center:!0,padded:!0});let l=i.chapters.length>0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(G.B,{courseId:r}),(0,n.jsx)(CreateChapterLessonModal,{}),(0,n.jsx)(H.B,{}),(0,n.jsx)(q.N,{course:i,heading:"Chapters & Lessons"}),(0,n.jsxs)("div",{className:(0,g.A)("mx-auto mt-7 max-w-4xl space-y-7 pb-24 sm:px-3 sm:pb-16"),children:[!l&&(0,n.jsxs)("div",{className:"mx-auto max-w-md space-y-5 rounded-xl border-2 border-dashed border-primary/50 bg-surface p-4 text-center",children:[(0,n.jsx)(j.default,{as:"p",variant:"h4",children:"Add first course chapter"}),(0,n.jsx)("div",{className:"mx-auto max-w-md",children:(0,n.jsx)(Q.P,{courseId:r})})]}),l&&(0,n.jsx)(AuthorDndCurriculum,{})]})]})};var Z=s(98674),J=s(87270);let CourseEditLessonsPage=()=>{let e=(0,t.useRouter)(),{courseId:r}=e.query,s="Chapters & Lessons ᐧ Course Builder \xb7 iJS",a="iJS Author's Course builder Chapters & Lessons.";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.DefaultPWATheme,{}),(0,n.jsx)(i.PB,{title:s,description:a,openGraph:{description:a,images:[{alt:a,height:630,url:Z.Az,width:1200}],title:s,url:"https://ijs.to/auhtor/to/course/".concat(r,"/lessons")},nofollow:!0,noindex:!0}),(0,n.jsx)("div",{className:"relative pb-24",children:r&&(0,n.jsx)(CourseLessons,{})})]})};CourseEditLessonsPage.Layout=J.t;var U=CourseEditLessonsPage}},function(e){e.O(0,[32525,55112,69305,47538,62109,27511,8390,49774,92888,40179],function(){return e(e.s=20908)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.